blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c3ae63076ed9a59d0743e24f050121d2713597fb | 8d38606fff4ea03e461bd6646c5fe94a33aa5672 | /com.shovesoft.sp2p/app/reports/StatisticPlatformFloat.java | 4e6f657d8a072e7c2f25d6817a30413f93eff46a | [] | no_license | 1392755394/WS | 37221d0da5bb2020961d78e7134207b0bd177939 | 96fb64bd8b2bb35b8c0e51dfd0074a52fc744253 | refs/heads/master | 2021-01-12T04:52:46.459044 | 2017-01-02T02:19:07 | 2017-01-02T02:19:07 | 77,806,112 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,604 | java | package reports;
import play.db.jpa.GenericModel;
import constants.Constants;
import models.t_statistic_platform_float;
import models.t_users;
/**
* 平台浮存金数据统计
* @author lwh
*
*/
public class StatisticPlatformFloat {
public static Double queryBalanceFloatsum(){
Double balance_float_sum = 0.0;//账户可用余额浮存
String sql = "select sum(balance) from t_users ";
if(Constants.IPS_ENABLE) {
sql = "select sum(balance + balance2) from t_users ";
}
try {
balance_float_sum = GenericModel.find(sql).first();//账户可用余额浮存
} catch (Exception e) {
e.printStackTrace();
}
if(null == balance_float_sum){
balance_float_sum = 0.0;
}
return balance_float_sum;
}
public static Double queryFreezeFloatsum(){
Double freeze_float_sum = 0.0;//冻结资金浮存
String sql = "select sum(freeze) from t_users ";
try {
freeze_float_sum = GenericModel.find(sql).first();// 冻结资金浮存
} catch (Exception e) {
e.printStackTrace();
}
if (null == freeze_float_sum) {
freeze_float_sum = 0.0;
}
return freeze_float_sum;
}
public static Long queryHasBalanceUseraccount(){
Long has_balance_user_account = 0l;//有可用余额账户数量
String sql = "select count(*) from t_users where balance > 0 ";
if(Constants.IPS_ENABLE) {
sql = "select count(*) from t_users where balance > 0 or balance2 > 0";
}
try {
has_balance_user_account = GenericModel.find(sql).first();// 有可用余额账户数量
} catch (Exception e) {
e.printStackTrace();
}
if (null == has_balance_user_account) {
has_balance_user_account = 0l;
}
return has_balance_user_account;
}
public static Long queryHasBalancevipUseraccount(){
Long has_balance_vip_user_account = 0l;//有可用余额的VIP账户数量
String sql = "select count(*) from t_users where balance > 0 and vip_status = 1 ";
if(Constants.IPS_ENABLE) {
sql = "select count(*) from t_users where (balance > 0 or balance2 > 0) and vip_status = 1 ";
}
try {
has_balance_vip_user_account = GenericModel.find(sql).first();// 有可用余额的VIP账户数量
} catch (Exception e) {
e.printStackTrace();
}
if (null == has_balance_vip_user_account) {
has_balance_vip_user_account = 0l;
}
return has_balance_vip_user_account;
}
public static Double queryVipBalancefloat(){
Double vip_balance_float = 0.0;//VIP账户可用余额浮存
String sql = "select sum(balance) from t_users where vip_status = 1 ";
if(Constants.IPS_ENABLE) {
sql = "select sum(balance + balance2) from t_users where vip_status = 1 ";
}
try {
vip_balance_float = GenericModel.find(sql).first();// VIP账户可用余额浮存
} catch (Exception e) {
e.printStackTrace();
}
if (null == vip_balance_float){
vip_balance_float = 0.0;
}
return vip_balance_float;
}
//判断对象是否存在
public static boolean judgeIsnew(int year,int month,int day){
t_statistic_platform_float floa = null;
try {
floa = GenericModel.find(" year = ? and month = ? and day = ?", year,month,day).first();
} catch (Exception e) {
e.printStackTrace();
}
if(null == floa){
return true;
}
return false;
}
//获取对象
public static t_statistic_platform_float getTarget(int year,int month,int day){
t_statistic_platform_float floa = null;
try {
floa = GenericModel.find(" year = ? and month = ? and day = ?", year,month,day).first();
} catch (Exception e) {
e.printStackTrace();
}
return floa;
}
}
| [
"[email protected]"
] | |
b665d4f3571de536ab47dee09edfe93b66b25846 | 99646e507e96c6585a6fbcd7d2d966bb867c5e05 | /common/src/main/java/net/neczpal/interstellarwar/common/game/PlanetTechnology.java | edd57516ccefa7ba841bbe174c169f6cc5842415 | [
"MIT"
] | permissive | neczpal/interstellar-war | 2a412bdbcef6c077a8265acdbeb03a44a20ce176 | a144b3ced68a2b4f77a2b66bb351741901f8708a | refs/heads/master | 2021-07-24T02:46:06.082749 | 2021-02-15T14:44:34 | 2021-02-15T14:44:34 | 85,175,064 | 2 | 0 | null | 2021-01-11T16:39:23 | 2017-03-16T09:06:18 | Java | UTF-8 | Java | false | false | 150 | java | package net.neczpal.interstellarwar.common.game;
public class PlanetTechnology {
private int def;
private int money;
private int unit;
}
| [
"[email protected]"
] | |
e652264f113e086fb60ae579ebde6006a3557677 | 16871fe8c41a45f9950fb180ebbd0faf2aefbae5 | /src/main/java/com/company/EPK/Event_Con_Split.java | c50cf6d6d4919cedf6b5a69326a6f7cc40199b3a | [] | no_license | HuntySX/EPK-Sim | b3e706154cdae89cf4063362c5d14eea4550a488 | c377e9195b420d0e8fbe9835630ebb91d1df75ca | refs/heads/master | 2023-04-04T10:57:16.235229 | 2021-04-12T02:58:15 | 2021-04-12T02:58:15 | 357,036,724 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,699 | java | package com.company.EPK;
import com.company.Enums.Contype;
import com.company.Enums.Split_Decide_Type;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class Event_Con_Split extends Connector implements Printable_Node {
private Split_Decide_Type Decide_Type;
private boolean is_Event_Driven;
private List<Split_Node_Chances> Chances_List;
public Event_Con_Split(List<EPK_Node> Next_Elem, int ID, Contype contype, Split_Decide_Type decide_type) {
super(Next_Elem, ID, contype);
this.Decide_Type = decide_type;
this.Chances_List = new ArrayList<>();
}
public Event_Con_Split(List<EPK_Node> Next_Elem, int ID, Contype contype, Split_Decide_Type decide_type, List<Split_Node_Chances> Chances_List) {
super(Next_Elem, ID, contype);
this.Decide_Type = decide_type;
this.Chances_List = Chances_List;
}
public List<EPK_Node> choose_Next() {
List<EPK_Node> Next_Elem = this.getNext_Elem();
List<EPK_Node> Result = new ArrayList<>();
if (Decide_Type == Split_Decide_Type.SINGLE_RANDOM) {
if (!Next_Elem.isEmpty()) {
int count_Elem = Next_Elem.size();
Random rand = new Random();
count_Elem = rand.nextInt(count_Elem);
Result.add(Next_Elem.get(count_Elem));
}
} else if (Decide_Type == Split_Decide_Type.FULL_RANDOM) {
if (!Next_Elem.isEmpty()) {
int count_Elem_Quantity = Next_Elem.size();
Random rand = new Random();
count_Elem_Quantity = rand.nextInt(count_Elem_Quantity);
//if (count_Elem_Quantity == 0) {
count_Elem_Quantity++;
//}
List<EPK_Node> working_On_EPK_Nodes = new ArrayList<>();
working_On_EPK_Nodes.addAll(Next_Elem);
for (int i = count_Elem_Quantity; i > 0; i--) {
int count_Elem = working_On_EPK_Nodes.size();
count_Elem = rand.nextInt(count_Elem);
Result.add(working_On_EPK_Nodes.get(count_Elem));
working_On_EPK_Nodes.remove(count_Elem);
}
}
} else if (Decide_Type == Split_Decide_Type.FULL) {
List<EPK_Node> ResultList = new ArrayList<>(Next_Elem);
ResultList = MixResultList(ResultList);
return ResultList;
} else if (Decide_Type == Split_Decide_Type.CUSTOM) {
if (getContype() == Contype.AND) {
List<EPK_Node> ResultList = new ArrayList<>(Next_Elem);
ResultList = MixResultList(ResultList);
return ResultList;
} else if (getContype() == Contype.EAGER_OR || getContype() == Contype.LAZY_OR) {
List<EPK_Node> working_On_EPK_Nodes = new ArrayList<>();
while (working_On_EPK_Nodes.isEmpty()) {
for (Split_Node_Chances Chance : Chances_List) {
if (Chance != null) {
Random rand = new Random();
int randchance = rand.nextInt(100);
if (randchance + 1 <= Chance.getChance()) {
for (EPK_Node next_Elem : Next_Elem) {
if (next_Elem.getID() == Chance.getNode().getID()) {
working_On_EPK_Nodes.add(next_Elem);
}
}
}
}
}
}
List<EPK_Node> ResultList = new ArrayList<>(working_On_EPK_Nodes);
ResultList = MixResultList(ResultList);
return ResultList;
} else if (getContype() == Contype.EAGER_XOR || getContype() == Contype.LAZY_XOR) {
List<EPK_Node> working_On_EPK_Nodes = new ArrayList<>();
Random rand = new Random();
int randchance = rand.nextInt(100);
randchance++;
int calculatefirstbound = 0;
int calculatelastbound = 0;
boolean found = false;
for (Split_Node_Chances Chance : Chances_List) {
if (found) {
break;
}
calculatelastbound = calculatelastbound + Chance.getChance();
if (calculatefirstbound < randchance && randchance <= calculatelastbound) {
for (EPK_Node next_Elem : Next_Elem) {
if (Chance.getNode().getID() == next_Elem.getID()) {
working_On_EPK_Nodes.add(next_Elem);
found = true;
break;
}
}
} else {
calculatefirstbound = calculatelastbound;
}
}
List<EPK_Node> ResultList = new ArrayList<>(working_On_EPK_Nodes);
ResultList = MixResultList(ResultList);
return ResultList;
}
}
List<EPK_Node> ResultList = new ArrayList<>(Result);
ResultList = MixResultList(ResultList);
return ResultList;
}
private List<EPK_Node> MixResultList(List<EPK_Node> result) {
if (result.size() == 1) {
return result;
}
List<EPK_Node> mixed_Result_List = new ArrayList<>();
while (!result.isEmpty()) {
Random rand = new Random();
EPK_Node node_to_Mix = result.get(rand.nextInt(result.size()));
result.remove(node_to_Mix);
mixed_Result_List.add(node_to_Mix);
}
if (!mixed_Result_List.isEmpty()) {
return mixed_Result_List;
}
return result;
}
public Split_Decide_Type getDecide_Type() {
return Decide_Type;
}
@Override
public boolean CheckSettings() {
boolean Check = true;
if (Decide_Type == null) {
Check = false;
}
return Check;
}
public void setDecide_Type(Split_Decide_Type Type) {
Decide_Type = Type;
}
public boolean isIs_Event_Driven() {
return is_Event_Driven;
}
public void setIs_Event_Driven(boolean is_Event_Driven) {
this.is_Event_Driven = is_Event_Driven;
}
public Event_Con_Split returnUpperClass() {
return this;
}
public List<Split_Node_Chances> getChances_List() {
return Chances_List;
}
public void setChances_List(List<Split_Node_Chances> chances_List) {
Chances_List = chances_List;
}
public void generateChance(EPK_Node next_Elem) {
boolean found = false;
for (Split_Node_Chances Chances : Chances_List) {
if (Chances.getNode().equals(next_Elem)) {
found = true;
break;
}
}
if (!found) {
Split_Node_Chances new_Chance = new Split_Node_Chances(next_Elem, 0);
Chances_List.add(new_Chance);
}
}
public void CleanupChances() {
List<Split_Node_Chances> Mark_For_Deletion = new ArrayList<>();
for (Split_Node_Chances Chances : Chances_List) {
if (!getNext_Elem().contains(Chances.getNode())) {
Mark_For_Deletion.add(Chances);
}
}
if (!Mark_For_Deletion.isEmpty()) {
Chances_List.removeAll(Mark_For_Deletion);
}
}
}
| [
"[email protected]"
] | |
256c88408cc84644060720c17174ddff11d18f42 | d283f29a16e782fa2ff3f9264d4ca5ad21ca4517 | /Square.java | c4423225b45de974a3c1bf629f563dde722dcf44 | [] | no_license | Lalithachittaturi/HANDSON | 409ee8ba57c8a96c2d0294276252934ed70fa6db | 4153cba12dac43c14660c52dd67a8c1f448152be | refs/heads/master | 2023-01-07T00:10:10.530357 | 2020-10-27T12:50:31 | 2020-10-27T12:50:31 | 293,990,222 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 696 | java | package handson;
import java.util.Scanner;
public class Square implements Polygon {
Scanner sc=new Scanner(System.in);
double side;
public Square(double side) {
super();
this.side = side;
}
@Override
public double calcArea() {
/*System.out.println("enter the side of Square:");
side=sc.nextDouble();*/
Double AreaOfSquare=4*side;
System.out.println("Area of Square:"+AreaOfSquare);
return AreaOfSquare;}
@Override
public double calcPeri() {
/*System.out.println("enter the side of Square:");
side=sc.nextDouble();*/
Double PerimeterOfSquare=side*side;
System.out.println("Area of Square:"+PerimeterOfSquare);
return PerimeterOfSquare;}
}
| [
"[email protected]"
] | |
8dfa6a636df1fdcdc159894dc99b514b9b764b60 | ad5ce8bfb018225cc7cc10d22a10052e75f3ff90 | /src/main/java/com/yoosal/zqmh/util/ZipCompressorByAnt.java | 38d0e977f9a7504268d0dddbdcd81f119d26d0e0 | [] | no_license | qmt216/myssm | 53611cd57690f837ac77612d60fee261cacc0c43 | 55313ebbe38c553c7cb3243d2b64d58d1b922138 | refs/heads/master | 2021-08-14T16:47:36.845589 | 2017-11-16T08:16:24 | 2017-11-16T08:16:24 | 110,938,761 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,349 | java | package com.yoosal.zqmh.util;
import java.io.File;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Zip;
import org.apache.tools.ant.types.FileSet;
/**
* Created by qinmingtao on 2016/8/29.
* Desc 用ant工具包压缩文件
*/
public class ZipCompressorByAnt {
private File zipFile;
/**
* 压缩文件构造函数
*
* @param finalFile 最终压缩生成的压缩文件:目录+压缩文件名.zip
*/
public ZipCompressorByAnt(String finalFile) {
zipFile = new File(finalFile);
}
/**
* 执行压缩操作
*
* @param srcPathName 需要被压缩的文件/文件夹
*/
public void compressExe(String srcPathName) {
File srcdir = new File(srcPathName);
if (!srcdir.exists()) {
throw new RuntimeException(srcPathName + "不存在!");
}
Project prj = new Project();
Zip zip = new Zip();
zip.setProject(prj);
zip.setDestFile(zipFile);
FileSet fileSet = new FileSet();
fileSet.setProject(prj);
fileSet.setDir(srcdir);
//fileSet.setIncludes("**/*.java"); //包括哪些文件或文件夹 eg:zip.setIncludes("*.java");
//fileSet.setExcludes(...); //排除哪些文件或文件夹
zip.addFileset(fileSet);
zip.execute();
}
}
| [
"[email protected]"
] | |
a7929f3c8a280d77d1948b174f7c36542b6fa6d6 | fb116ad7093f9951ff876754887ed5347118a857 | /src/fiuba/algo3/eventos/OpcionSalirEventHandler.java | f5f39b3b99405e904540ffe968af5d189668c3b3 | [] | no_license | Gaston11/TP-DragonAlgo-Ball- | 334bb9e7b41afb0ab71ad2320d85e588e42ca8c3 | 81003928e1654be6b7d673a64939f859e2f52228 | refs/heads/master | 2021-01-23T15:53:07.829159 | 2017-07-11T00:51:43 | 2017-07-11T00:51:43 | 93,275,188 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 390 | java | package fiuba.algo3.eventos;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
/**
* Created by noe on 30/06/17.
*/
public class OpcionSalirEventHandler implements EventHandler<ActionEvent> {
@Override
public void handle(ActionEvent actionEvent) {
System.exit(0);
}
}
| [
"[email protected]"
] | |
ca61806d4553539d0406917496918922558517a6 | 8633c02a6cef69b8a1b96689fd1d5b3c2ec9f806 | /src/main/java/ar/edu/itba/paw/exception/InvalidInstanceException.java | 15ab5c8a1ab17e4c729e9eca1f8619c47079f427 | [] | no_license | fpagliar/ceitbaWebVersion | 8d2a5c69c7b66e559e5bfa7c2197d1c2df2da258 | 59d0bcd104b2f455b3433298ddf4d246a528e948 | refs/heads/master | 2020-04-10T14:05:25.005510 | 2015-08-25T20:22:56 | 2015-08-25T20:22:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 132 | java | package ar.edu.itba.paw.exception;
@SuppressWarnings("serial")
public class InvalidInstanceException extends RuntimeException {
}
| [
"[email protected]"
] | |
dda29acce48ca1ec448ed2cd7d0510130603c182 | 5ff2065c613dc98589c3d9ce42b3a0bf0517d0a8 | /libs/src/main/java/com/box/libs/ui/recyclerview/BaseItem.java | 2fab971f6fd5b44d07378dfa4285268aa8a5bca3 | [] | no_license | fengxiaocan/DebugBox | 2c15bccad32061ac7ec8523e998550311a4aa01a | 223061ba28a4a26f38ad515746db3205cdd1abed | refs/heads/master | 2020-11-23T21:52:26.460319 | 2020-09-28T04:03:31 | 2020-09-28T04:03:31 | 227,834,865 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 575 | java | package com.box.libs.ui.recyclerview;
import androidx.annotation.LayoutRes;
/**
* Created by linjiang on 03/06/2018.
*/
public abstract class BaseItem<T> {
public T data;
private Object tag;
public BaseItem(T data) {
this.data = data;
}
public abstract void onBinding(int position, UniversalAdapter.ViewPool pool, T data);
public abstract @LayoutRes
int getLayout();
public final Object getTag() {
return tag;
}
public final BaseItem setTag(Object tag) {
this.tag = tag;
return this;
}
}
| [
"[email protected]"
] | |
f5641b2ae41d7fb634ea2dc232fc0a9e6c866f24 | 8a5f5045d4903a4036298e005b858579fe39cffa | /0805/src/practice/Boj_2493_탑3.java | 148b0086ccfde8721aa015b510c3cc205249ed9f | [] | no_license | yeon-s/Algorithm | 92066712b308c96b6776da4e80208118cd62725a | 60733dc088a87b002e84bdb01578e0829d1fbe63 | refs/heads/main | 2023-08-15T01:47:23.288657 | 2021-09-29T08:45:27 | 2021-09-29T08:45:27 | 411,559,874 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,126 | java | package practice;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Stack;
import java.util.StringTokenizer;
public class Boj_2493_탑3 {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
int N = Integer.parseInt(br.readLine());
int[] arr = new int[N];
String str = br.readLine();
StringTokenizer st = new StringTokenizer(str);
for(int i=0;i<arr.length;i++) {
arr[i]=Integer.parseInt(st.nextToken());
}
Stack<Integer> stack = new Stack<>();
Stack<Integer> index = new Stack<>();
stack.push(arr[0]);
index.push(1);
sb.append("0 ");
for(int i=1;i<N;i++) {
int height = arr[i];
while(!stack.isEmpty() && stack.peek()<height) {
stack.pop();
index.pop();
}
if(stack.isEmpty()) {
sb.append("0 ");
}else {
sb.append(index.peek()+"").append(" ");
}
stack.push(arr[i]);
index.push(i+1);
}
System.out.println(sb);
}
}
| [
"[email protected]"
] | |
37e54625a7cf9a3d96ac01d4b643b7f2a6f9e95a | f4e3208749c7601af93502ea12e1899275a85c9d | /app/src/main/java/com/azarnush/webeskan/Account_register/BooleanRequest.java | 3e2d6f8c610d2aa2a0d3b2621af5a6dcfbb5068a | [] | no_license | MaryamAzarnushan/WebEskan | cdd3f99ee16005a0be3cade1b881bd40654f1ba6 | 823d1a22db40086955803088d372a9bd865507cb | refs/heads/master | 2022-06-12T20:41:27.374634 | 2020-04-26T07:57:46 | 2020-04-26T07:57:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,437 | java | package com.azarnush.webeskan.Account_register;
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkResponse;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.VolleyLog;
import com.android.volley.toolbox.HttpHeaderParser;
import java.io.UnsupportedEncodingException;
public class BooleanRequest extends Request<Boolean> {
private final Response.Listener<Boolean> mListener;
private final Response.ErrorListener mErrorListener;
private final String mRequestBody;
private final String PROTOCOL_CHARSET = "utf-8";
private final String PROTOCOL_CONTENT_TYPE = String.format("application/json; charset=%s", PROTOCOL_CHARSET);
public BooleanRequest(int method, String url, String requestBody, Response.Listener<Boolean> listener, Response.ErrorListener errorListener) {
super(method, url, errorListener);
this.mListener = listener;
this.mErrorListener = errorListener;
this.mRequestBody = requestBody;
}
@Override
protected Response<Boolean> parseNetworkResponse(NetworkResponse response) {
Boolean parsed;
try {
parsed = Boolean.valueOf(new String(response.data, HttpHeaderParser.parseCharset(response.headers)));
} catch (UnsupportedEncodingException e) {
parsed = Boolean.valueOf(new String(response.data));
}
return Response.success(parsed, HttpHeaderParser.parseCacheHeaders(response));
}
@Override
protected VolleyError parseNetworkError(VolleyError volleyError) {
return super.parseNetworkError(volleyError);
}
@Override
protected void deliverResponse(Boolean response) {
mListener.onResponse(response);
}
@Override
public void deliverError(VolleyError error) {
mErrorListener.onErrorResponse(error);
}
@Override
public String getBodyContentType() {
return PROTOCOL_CONTENT_TYPE;
}
@Override
public byte[] getBody() throws AuthFailureError {
try {
return mRequestBody == null ? null : mRequestBody.getBytes(PROTOCOL_CHARSET);
} catch (UnsupportedEncodingException uee) {
VolleyLog.wtf("Unsupported Encoding while trying to get the bytes of %s using %s",
mRequestBody, PROTOCOL_CHARSET);
return null;
}
}
} | [
"[email protected]"
] | |
59e8caa554ea8d1cb27d3a5f41de8bda34453bed | 3f96394479495ea00d678c84e625072a0756cf23 | /src/main/java/com/altevie/invioSpese/jaxb/invio/Proprietario.java | 8ceec43bf9be60e1ed0f042892830379a7c0cf7a | [] | no_license | vlucchese/ConiSpeseMediche | 303ae5867f0d3c6e8bd128d591d4c9bce83a022a | d2714fc38713d882be8e0bfd8754b71e1fd1df6f | refs/heads/master | 2023-02-24T01:43:59.102732 | 2021-02-01T10:10:34 | 2021-02-01T10:10:34 | 333,463,954 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,854 | java | //
// Questo file è stato generato dall'architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.3.0
// Vedere <a href="https://javaee.github.io/jaxb-v2/">https://javaee.github.io/jaxb-v2/</a>
// Qualsiasi modifica a questo file andrà persa durante la ricompilazione dello schema di origine.
// Generato il: 2021.01.22 alle 03:50:15 PM CET
//
package com.altevie.invioSpese.jaxb.invio;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Classe Java per proprietario complex type.
*
* <p>Il seguente frammento di schema specifica il contenuto previsto contenuto in questa classe.
*
* <pre>
* <complexType name="proprietario">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="codiceRegione" type="{http://ejb.invioTelematicoSS730p.sanita.finanze.it/}varChar3Type" minOccurs="0"/>
* <element name="codiceAsl" type="{http://ejb.invioTelematicoSS730p.sanita.finanze.it/}varChar3Type" minOccurs="0"/>
* <element name="codiceSSA" type="{http://ejb.invioTelematicoSS730p.sanita.finanze.it/}codSsaType" minOccurs="0"/>
* <element name="cfProprietario" type="{http://ejb.invioTelematicoSS730p.sanita.finanze.it/}cfType" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "proprietario", propOrder = {
"codiceRegione",
"codiceAsl",
"codiceSSA",
"cfProprietario"
})
public class Proprietario {
protected String codiceRegione;
protected String codiceAsl;
protected String codiceSSA;
protected String cfProprietario;
/**
* Recupera il valore della proprietà codiceRegione.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCodiceRegione() {
return codiceRegione;
}
/**
* Imposta il valore della proprietà codiceRegione.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCodiceRegione(String value) {
this.codiceRegione = value;
}
/**
* Recupera il valore della proprietà codiceAsl.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCodiceAsl() {
return codiceAsl;
}
/**
* Imposta il valore della proprietà codiceAsl.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCodiceAsl(String value) {
this.codiceAsl = value;
}
/**
* Recupera il valore della proprietà codiceSSA.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCodiceSSA() {
return codiceSSA;
}
/**
* Imposta il valore della proprietà codiceSSA.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCodiceSSA(String value) {
this.codiceSSA = value;
}
/**
* Recupera il valore della proprietà cfProprietario.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCfProprietario() {
return cfProprietario;
}
/**
* Imposta il valore della proprietà cfProprietario.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCfProprietario(String value) {
this.cfProprietario = value;
}
}
| [
"[email protected]"
] | |
31d11aabc5f8c3446d2d6e6d38044c8b0858b0e9 | 09adcfd18818f609c1874540e44fb33cdde17fc3 | /JinXi/app/src/main/java/cn/jinxi/user/activity/BaseActivity.java | 721d0a781ebcbd52bedaad4094f0c6da6e4b3dcc | [] | no_license | hhxx12ttxs/JinXi | 4c7f6bd29e51e8c4e5e61444fea309890d91ab2f | 86462c4380760128ecace85f255424ff55d99a0d | refs/heads/master | 2021-01-10T10:41:03.538456 | 2015-10-22T15:26:18 | 2015-10-22T15:26:18 | 44,463,635 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,369 | java | package cn.jinxi.user.activity;
import android.app.Activity;
import android.os.Bundle;
import android.view.inputmethod.InputMethodManager;
import android.widget.TextView;
import android.widget.Toast;
import cn.jinxi.R;
import cn.jinxi.user.manager.NetworkManager;
/**
* Created by jiewang on 2015/10/18.
*/
public class BaseActivity extends Activity {
protected NetworkManager networkManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
networkManager = new NetworkManager(this);
}
public NetworkManager getNetworkManager(){
return networkManager;
}
public void hideSoftKeyboard() {
InputMethodManager imm = (InputMethodManager) getSystemService(getApplicationContext().INPUT_METHOD_SERVICE);
imm.showSoftInput(findViewById(R.id.root), InputMethodManager.SHOW_FORCED);
imm.hideSoftInputFromWindow(findViewById(R.id.root).getWindowToken(), 0); //强制隐藏键盘
}
public void showText(String text) {
Toast.makeText(this, text, Toast.LENGTH_SHORT).show();
}
public void setTitle(String title) {
TextView textView = (TextView) findViewById(R.id.header_title);
if (title != null) {
textView.setText(title);
} else {
textView.setText("");
}
}
}
| [
"[email protected]"
] | |
c6baa06a0f10544d616cd1f134e2ca000658489b | 929c4a99340c526367e7ab0f928d6510104bfeed | /src/main/java/io/renren/modules/app/dao/search/SearchDao.java | 835ef3ed9e436b8efd0741d0d1189294adb6ac64 | [
"Apache-2.0"
] | permissive | xukaka/leifeng | ffc61cc401c4fbf399aa7c661efe40bff9872431 | 693fbbc56ebc2b1ccfaebf9088e18a80477fb145 | refs/heads/master | 2022-07-19T01:23:20.522761 | 2019-07-23T10:18:15 | 2019-07-23T10:18:15 | 179,056,100 | 0 | 1 | Apache-2.0 | 2022-06-21T01:02:11 | 2019-04-02T10:41:55 | JavaScript | UTF-8 | Java | false | false | 651 | java | package io.renren.modules.app.dao.search;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import io.renren.modules.app.dto.HotSearchDto;
import io.renren.modules.app.entity.search.SearchHistoryEntity;
import io.renren.modules.app.entity.search.SearchLogEntity;
import io.renren.modules.app.entity.task.TaskEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 搜索
*/
@Mapper
public interface SearchDao extends BaseMapper<SearchHistoryEntity> {
/**
* 插入搜索日志
*/
void insertLog(SearchLogEntity log);
/**
* 统计热门搜索
*/
List<HotSearchDto> getHotSearch();
}
| [
"[email protected]"
] | |
58a0f452c6443f9d88ffc0ac2bede3d1dc3e1a0e | 7d27e27e9b053830d97d2f09bf54f7ae137f343c | /src/main/java/com/hendisantika/taxcalculator/TaxCalculatorApplication.java | a0247b5b110c4cbb539a97589265bf140e63d9dc | [] | no_license | hendisantika/tax-calculator | b93111662a5b4f3b2a82ff866efabdcf2ff1d56d | 07bc38320c04890f0e233b9efdff11466c1b503c | refs/heads/master | 2023-07-18T17:45:28.651482 | 2023-07-07T22:30:39 | 2023-07-07T22:30:39 | 164,028,919 | 4 | 1 | null | 2023-07-07T22:30:41 | 2019-01-03T22:22:54 | Java | UTF-8 | Java | false | false | 350 | java | package com.hendisantika.taxcalculator;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class TaxCalculatorApplication {
public static void main(String[] args) {
SpringApplication.run(TaxCalculatorApplication.class, args);
}
}
| [
"[email protected]"
] | |
5afa97d582428d55ab9388ba2f6b319260bd6c49 | c773c7f6ff7ace83e0e47153c8d8836433f60233 | /src/test/java/net/greenpoppy/tahiti/resource/ResourceTestBase.java | 738c8535acb3b27ac9e9a24d894cd6903bba1bec | [] | no_license | greygriffin/tahiti | 357746ad4e46d0134ad8ffcb52cf978203897606 | 2a5aeecd3de45db347fc14e9ebdf776353aa659f | refs/heads/master | 2021-04-12T10:34:37.023287 | 2018-04-24T12:10:29 | 2018-04-24T12:10:29 | 126,132,781 | 0 | 0 | null | 2018-04-24T12:10:30 | 2018-03-21T06:23:18 | null | UTF-8 | Java | false | false | 1,600 | java | package net.greenpoppy.tahiti.resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.mock.http.MockHttpOutputMessage;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.Arrays;
import static org.junit.Assert.assertNotNull;
public class ResourceTestBase {
protected static final String LOCATION_HEADER = "Location";
protected static final MediaType CONTENT_TYPE_JSON_UTF8 = new MediaType(MediaType.APPLICATION_JSON.getType(),
MediaType.APPLICATION_JSON.getSubtype(),
Charset.forName("utf8"));
private HttpMessageConverter mappingJackson2HttpMessageConverter;
@Autowired
void setConverters(HttpMessageConverter<?>[] converters) {
this.mappingJackson2HttpMessageConverter = Arrays.stream(converters)
.filter(hmc -> hmc instanceof MappingJackson2HttpMessageConverter)
.findAny()
.orElse(null);
assertNotNull("the JSON message converter must not be null",
this.mappingJackson2HttpMessageConverter);
}
protected String json(Object o) throws IOException {
MockHttpOutputMessage mockHttpOutputMessage = new MockHttpOutputMessage();
this.mappingJackson2HttpMessageConverter.write(
o, MediaType.APPLICATION_JSON, mockHttpOutputMessage);
return mockHttpOutputMessage.getBodyAsString();
}
}
| [
"[email protected]"
] | |
e98046a77dbdb23b628b289271754af6a19be0c7 | 5247f8356e9c41a63a65ca42d59f4b5192052014 | /src/main/java/io/github/vampirestudios/raa/api/RAAWorldAPI.java | 23014b3e7b1c45aab2d3ac3fcb6fdf9c7f92d5e5 | [
"MIT"
] | permissive | Shnupbups/Randomly-Adding-Anything | 240d2865e6bfe98d92e288f0c5b2afeca25bedb4 | f52beeafd434b844899622b6a9f4bfe92b5495f1 | refs/heads/dev/1.15 | 2022-02-03T07:30:30.308973 | 2019-09-17T11:33:58 | 2019-09-17T11:33:58 | 209,024,115 | 0 | 0 | MIT | 2022-01-18T13:39:29 | 2019-09-17T10:23:21 | Java | UTF-8 | Java | false | false | 1,837 | java | package io.github.vampirestudios.raa.api;
import io.github.vampirestudios.raa.RandomlyAddingAnything;
import io.github.vampirestudios.raa.api.enums.GeneratesIn;
import io.github.vampirestudios.raa.registries.Materials;
import io.github.vampirestudios.raa.world.gen.feature.OreFeature;
import io.github.vampirestudios.raa.world.gen.feature.OreFeatureConfig;
import io.github.vampirestudios.raa.world.gen.feature.SimpleRangeDecoratorConfig;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.gen.GenerationStep;
import net.minecraft.world.gen.decorator.Decorator;
import java.util.Map;
public class RAAWorldAPI {
/**
* @param biome The biome you generate the ores in.
* @param generatesIn The block targeted by the ore generator.
*/
public static void addRandomOres(Biome biome, GeneratesIn generatesIn) {
Materials.MATERIALS.forEach(material -> {
String id = material.getName().toLowerCase();
for (Map.Entry<String, String> entry : RandomlyAddingAnything.CONFIG.namingLanguage.getCharMap().entrySet()) {
id = id.replace(entry.getKey(), entry.getValue());
}
if (material.getOreInformation().getGenerateIn() == generatesIn) {
biome.addFeature(GenerationStep.Feature.UNDERGROUND_ORES, Biome.configureFeature(
new OreFeature(OreFeatureConfig::deserialize), new OreFeatureConfig(generatesIn.getTarget(),
Registry.BLOCK.get(new Identifier(RandomlyAddingAnything.MOD_ID, id + "_ore")).getDefaultState(), 9),
Decorator.COUNT_RANGE, new SimpleRangeDecoratorConfig(material.getOreInformation().getOreCount(), 0, 256)));
}
});
}
}
| [
"[email protected]"
] | |
035b133eb7fc3cc3da6967a4bbf0f9304f204cef | 81493845821bf5325b48d5d2a43830f23fb6fbd1 | /sample/src/main/java/com/hyh/filedownloader/sample/net/annotation/GET.java | ea7b4f4e135e2eae1abc2b77255d387d81f87cfa | [
"MIT"
] | permissive | EricHyh/DemoCollection | 8e622755ca2d1a2f251babf782332c4f789136fa | 3fc74884755fe1b4bacd6e9707b9711d523c755d | refs/heads/master | 2022-12-26T04:58:54.342724 | 2020-10-11T16:27:37 | 2020-10-11T16:27:37 | 91,862,561 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,020 | java | /*
* Copyright (C) 2013 Square, Inc.
*
* 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.hyh.filedownloader.sample.net.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/** Make a GET request. */
@Documented
@Target(METHOD)
@Retention(RUNTIME)
public @interface GET {
String value() default "";
}
| [
"[email protected]"
] | |
3043005e59198d41022bc2c1056a27c12e37681d | bb88eb60fa94dab17b11a665a0c06378e019a7d2 | /src/main/java/com/iktpreobuka/elektronskidnevnik/config/ResourceServerConfiguration.java | d1537543bbe80a785bd5e0a1ee4526a20b0e35fb | [] | no_license | zeljkoozvat/elektronski_dnevnik | b883f28cc4142ab435b7284f07dc3cdb323240dd | aec8903951e668cc770c7bb69b6a158ffe934d7b | refs/heads/master | 2023-06-25T01:02:42.113789 | 2019-08-07T21:32:23 | 2019-08-07T21:32:23 | 200,429,731 | 0 | 0 | null | 2023-06-20T18:33:06 | 2019-08-03T23:25:04 | Java | UTF-8 | Java | false | false | 1,245 | java | package com.iktpreobuka.elektronskidnevnik.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer;
import org.springframework.security.oauth2.provider.error.OAuth2AccessDeniedHandler;
@Configuration
@EnableResourceServer
public class ResourceServerConfiguration extends ResourceServerConfigurerAdapter{
private static final String RESOURCE_ID = "resource_id";
@Override
public void configure(ResourceServerSecurityConfigurer resources) {
resources.resourceId(RESOURCE_ID).stateless(false);
}
@Override
public void configure(HttpSecurity http) throws Exception {
http.
anonymous().disable()
.requestMatchers().antMatchers("/users/**")
.and().authorizeRequests()
.antMatchers("/users/**").access("hasRole('ADMIN')")
.and().exceptionHandling().accessDeniedHandler(new OAuth2AccessDeniedHandler());
}
}
| [
"[email protected]"
] | |
384c23b6768cbcdb12371288a388fe18c6925cb0 | c99ef290a8bc609396c48d1e77e22a03901463c6 | /src/com/library/service/AdminStuServiceImpl.java | 9ed7c3f35fe0313725b3e6ed0ab2a697fcdfee72 | [] | no_license | QiumgYe/library-h | 8379f69d01b5c70fa8426d7c26285cff3241a7b3 | d4b178b9c78e99f7ab99a28d5e8120bf8e8dbb84 | refs/heads/master | 2023-04-27T14:06:20.090594 | 2020-06-26T05:58:56 | 2020-06-26T06:12:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 837 | java | package com.library.service;
import java.util.List;
import com.library.dao.AdminStuDao;
import com.library.model.Stu;
public class AdminStuServiceImpl implements AdminStuService {
private AdminStuDao studao;
public AdminStuDao getStudao() {
return studao;
}
public void setStudao(AdminStuDao studao) {
this.studao = studao;
}
@Override
public void deletestu(Stu s) {
// TODO Auto-generated method stub
if(s != null){
studao.delete(s);
}
}
@Override
public Stu getstuById(int id) {
// TODO Auto-generated method stub
Stu su=studao.getstuById(id);
return su;
}
@Override
public void updatestu(Stu s) {
// TODO Auto-generated method stub
studao.update(s);
}
@Override
public List<Integer> getstuAllId(){
// TODO Auto-generated method stub
return studao.getstuAllId();
}
}
| [
"lqm0902"
] | lqm0902 |
c1a1e20a28ec5dd4bbdcbb9508bdc0a14f965326 | 3b74fbedd3001512dfe49bc0f5a18090c2e34564 | /hvip-product-service/src/main/java/com/huazhu/hvip/product/service/impl/ChannelRateServiceImpl.java | 09dddf4cd8c51881a10c4da90602333d610f2bd6 | [] | no_license | xuelu520/cjiaclean-core | b148a78da67b45a0c0e5d5cf07c67b5cfc6d47dc | a96f574a8ec2b4ab7884130461671f095762995a | refs/heads/master | 2020-03-27T10:19:57.138235 | 2017-11-16T01:41:23 | 2017-11-16T01:41:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,836 | java | /*
* Copyright (C),2016-2016. 华住酒店管理有限公司
* FileName: ChannelServiceImpl.java
* Author: cmy
* Date: 2016-04-13 14:12:17
* Description: //模块目的、功能描述
* History: //修改记录 修改人姓名 修改时间 版本号 描述
* <lijing> <2016-04-13 14:12:17> <version> <desc>
*
*/
package com.huazhu.hvip.product.service.impl;
import com.huazhu.hvip.base.constants.Constants;
import com.huazhu.hvip.base.model.ParamObject;
import com.huazhu.hvip.base.model.ReturnObject;
import com.huazhu.hvip.product.channel.manager.ChannelManager;
import com.huazhu.hvip.product.channel.manager.ChannelRateManager;
import com.huazhu.hvip.product.channel.model.Channel;
import com.huazhu.hvip.product.channel.model.ChannelRate;
import com.huazhu.hvip.product.channel.model.extend.ChannelGoodsPriceExt;
import com.huazhu.hvip.product.channel.model.extend.ChannelRateExt;
import com.huazhu.hvip.product.service.ChannelRateService;
import com.huazhu.hvip.product.service.ChannelService;
import com.huazhu.hvip.product.vo.ChannelGoodsPriceVO;
import com.huazhu.hvip.product.vo.ChannelVO;
import com.huazhu.hvip.product.vo.ChannelrateVO;
import com.huazhu.hvip.util.JsonUtil;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* <一句话功能简述>
* <功能详细描述>
*
* @author cmy
* @see [相关类/方法](可选)
* @since [产品/模块版本] (可选)
*/
@Service
public class ChannelRateServiceImpl implements ChannelRateService {
private static Logger logger = org.apache.logging.log4j.LogManager.getLogger(ChannelRateServiceImpl.class);
@Autowired
private ChannelRateManager channelRateManager;
/**
* 保存价格渠道的定义
*
* @param channelrateVOs
* @return
*/
@Override
public ReturnObject saveChannelRate(List<ChannelrateVO> channelrateVOs) {
logger.info("call saveChannelRate param(" + JsonUtil.JSON_List2String(channelrateVOs) + ")");
ReturnObject returnObject = new ReturnObject();
try {
for (ChannelrateVO channelrateVO : channelrateVOs) {
ChannelRate channelRate = new ChannelRate();
BeanUtils.copyProperties(channelrateVO, channelRate);
channelRateManager.save(channelRate);
}
returnObject.setReturnCode(Constants.RETURN_CODE_SUCCESS);
} catch (BeansException e) {
e.printStackTrace();
returnObject.setReturnCode(Constants.RETURN_CODE_FAIL);
returnObject.setReturnMsg("保存失败");
}
return returnObject;
}
/**
* 根据channelObjectId查询价格渠道的定义名称
*
* @param channelObjectId
* @return
*/
@Override
public ReturnObject searchChannelRateBychannelObjectId(String channelObjectId) {
logger.info("call searchChannelRateBychannelObjectId param("+channelObjectId+")");
ReturnObject returnObject=new ReturnObject();
try {
ParamObject paramObject=new ParamObject();
paramObject.add("channelObjectId",channelObjectId);
List<ChannelRate> channelRates=channelRateManager.searchChannelRateBychannelObjectId(paramObject);
returnObject.setDataList(channelRates);
returnObject.setReturnCode(Constants.RETURN_CODE_SUCCESS);
} catch (Exception e) {
e.printStackTrace();
returnObject.setReturnMsg("查询失败");
returnObject.setReturnCode(Constants.RETURN_CODE_FAIL);
}
return returnObject;
}
}
| [
"zxc,./123"
] | zxc,./123 |
7c7d1946675c4b56d50c6ed402134056004fd42e | a88932b84de9ea28d68e4a9842cfce356fd4f8b7 | /configuration/configuration-feign/src/main/java/com/hrh/micro/Configuration/FeignRequestConfiguration.java | c23b8cc7e6b2f767786db0ef5206fb90b9c7db3e | [
"Apache-2.0"
] | permissive | 17623252837/Microservice-2.0 | f57401ebdbeefad475d0398cf643408992c2d0fb | d7cf63b292d4c4d818aef31ef5181f3626a1f259 | refs/heads/master | 2021-01-08T20:18:43.187776 | 2020-03-22T08:55:14 | 2020-03-22T08:55:14 | 242,132,573 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 615 | java | package com.hrh.micro.Configuration;
import com.hrh.micro.interceptor.FeignRequestInterceptor;
import feign.RequestInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @ProjectName: Microservice-2.0
* @Package: com.hrh.micro.Configuration
* @ClassName: FeignConfigureation
* @Author: HuRonghua
* @Description:
* @Date: 2020/3/21 7:19
* @Version: 1.0
*/
@Configuration
public class FeignRequestConfiguration {
@Bean
public RequestInterceptor requestInterceptor(){
return new FeignRequestInterceptor();
}
}
| [
"[email protected]"
] | |
171703cfbfc533e2243cc00a70246124307c44f6 | 50fe4f21b9ae2379903d44da8c3d9bfd81ec6514 | /tg/client/classes/nc/ui/tg/checkfinance/ace/handler/AceOrgChangeHandler.java | 1ca53aeea977cf2f475b1e8c75fbe7630d26e163 | [] | no_license | tanzijian1/mytest | cda37bf2d54abfd2da45b13bfe79c7e5e02676c6 | 4465ba67a6f62a4eac3b8bc18e19645f04a56145 | refs/heads/master | 2023-02-15T05:34:52.101432 | 2021-01-15T06:37:55 | 2021-01-15T06:38:56 | 329,802,651 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 1,020 | java | package nc.ui.tg.checkfinance.ace.handler;
import nc.ui.pubapp.uif2app.event.IAppEventHandler;
import nc.ui.pubapp.uif2app.event.OrgChangedEvent;
import nc.ui.pubapp.uif2app.view.BillForm;
import nc.ui.pubapp.uif2app.view.util.BillPanelUtils;
import nc.vo.uif2.LoginContext;
/**
* <b> 组织切换事件 </b>
*
* @author author
* @version tempProject version
*/
public class AceOrgChangeHandler implements IAppEventHandler<OrgChangedEvent> {
private BillForm billForm;
@Override
public void handleAppEvent(OrgChangedEvent e) {
if (this.billForm.isEditable()) {
// 在编辑状态下,主组织切换时,清空界面数据,自动表体增行,并设置行号
this.billForm.addNew();
}
LoginContext context = this.billForm.getModel().getContext();
// 进行参照过滤
BillPanelUtils.setOrgForAllRef(this.billForm.getBillCardPanel(),
context);
}
public BillForm getBillForm() {
return billForm;
}
public void setBillForm(BillForm billForm) {
this.billForm = billForm;
}
}
| [
"[email protected]"
] | |
f32b552eb5f86b9cc523a6d6935ec103d053549b | 6754c1dbf4f15d675bf7b9a932f8378a9fea4269 | /src/main/java/com/example/pbcwebdriver/downloader/PbccrcDownloader.java | 0f9807c0b38782ea57b6d1e7b4a2152dc454153a | [] | no_license | lzp16/pbcwebdriver | a05b263b9cfefedc51d8ab1ce1e9722b950c3694 | 9c75858baf180924ae5a94413cb987e49181f6ee | refs/heads/master | 2020-03-07T08:42:34.732436 | 2018-03-30T06:03:14 | 2018-03-30T06:03:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,422 | java | package com.example.pbcwebdriver.downloader;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.interactions.Actions;
import java.io.File;
import java.util.Scanner;
import java.util.concurrent.TimeUnit;
/**
* @author LiZhanPing
*/
public class PbccrcDownloader {
public static void download() {
// System.setProperty("webdriver.gecko.driver", "D:\\Program Files\\firefox\\geckodriver.exe");
WebDriver webDriver = new FirefoxDriver(new FirefoxProfile(new File("C:\\Users\\Administrator\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\m7p6xnv2.default")));
webDriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
webDriver.get("https://ipcrs.pbccrc.org.cn/");
webDriver.switchTo().frame("conFrame");
System.out.println("webDriver = " + webDriver.getPageSource());
for (String s : webDriver.getWindowHandles()) {
System.out.println("s = " + s);
}
WebElement start = webDriver.findElement(By.xpath("//*[@class='banner_bot']//a"));
start.click();
WebElement loginname = webDriver.findElement(By.id("loginname"));
loginname.sendKeys("SJ9301127");
WebElement pass = webDriver.findElement(By.id("pass"));
pass.click();
String aClass = pass.getAttribute("class");
System.out.println("aClass = " + aClass);
pass.sendKeys("ssdfsdfsdff");
(new Actions(webDriver)).sendKeys(pass, "ssdfsdfsdff");
((JavascriptExecutor) webDriver).executeScript("arguments[0].value=\"aaa\"", pass);
System.out.println("请输入验证码:");
Scanner scanner = new Scanner(System.in);
String s = scanner.nextLine();
WebElement captche = webDriver.findElement(By.id("_@IMGRC@_"));
captche.sendKeys(s);
WebElement submit = webDriver.findElement(By.className("inputBtn btn2"));
submit.submit();
try {
//让线程等待3秒钟
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
webDriver.quit(); //退出driver
}
public static void main(String[] args) {
download();
}
}
| [
"[email protected]"
] | |
7382837e33d4dab25856a12e8b1f8ced2169aa58 | 68cb4d647309ac0892d5968a9a3d2156e5c1dabd | /day19/src/cn/itcast/demo1/LinkedHashSetDemo.java | ac0f99a3b5740e7758309b314e3d40c2380d6607 | [] | no_license | chaiguolong/JavaSE | 651c4eb1179d05912cbc8d8a5d1930ca6ce9bad4 | bb9629843ebafea221365b43c471ae3aa663b1c5 | refs/heads/master | 2021-07-25T09:46:34.190516 | 2018-07-30T08:17:49 | 2018-07-30T08:17:49 | 130,962,634 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 562 | java | package cn.itcast.demo1;
import java.util.LinkedHashSet;
/*
* LinkedHashSet 基于链表的哈希表实现
* 继承自HashSet
*
* LinkedHashSet 自身特性,具有顺序,存储和取出的顺序相同的
* 线程不安全的集合,运行速度块
*/
public class LinkedHashSetDemo {
public static void main(String[] args) {
LinkedHashSet<Integer> link = new LinkedHashSet<Integer>();
link.add(123);
link.add(44);
link.add(33);
link.add(33);
link.add(66);
link.add(11);
System.out.println(link);
}
}
| [
"[email protected]"
] | |
dcb78f11ad8ae8fc0e2c04c10ab1db5202e2ca01 | 9cf0556d2f2c2fafd0119ce77bd2eef056b41f46 | /src/test/java/com/bsuir/course/CourseApplicationTests.java | 245a16b60c527c951579f1d20aa4b8d4bec77abf | [] | no_license | Tokscull/streetEasyBack | 7b79b02f8cdf01b08e14939ed397a08f999b5169 | 67444db625df5c47777c3273020217aa62a9d52a | refs/heads/master | 2020-05-09T22:58:27.905676 | 2019-05-02T09:08:06 | 2019-05-02T09:08:06 | 181,488,481 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 342 | java | package com.bsuir.course;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class CourseApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"[email protected]"
] | |
448b0034b5632059b4795eeb6a753e9dfab53534 | 874ae590bf15ed90ae60f8aaebf8e6396a6ec438 | /src/main/java/com/argeath/offersSearch/OffersSearch.java | 912b0688a634ee9c189372012936803fa4e607e8 | [] | no_license | Argeath/offersSearch | 4c7eee874975b82263360623e3b82e3535e8851d | 65170a6376daa55ea3a3f959b058144ea479ade9 | refs/heads/master | 2021-01-10T18:59:19.342255 | 2015-02-20T14:58:38 | 2015-02-20T14:58:38 | 30,411,992 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,373 | java | package com.argeath.offersSearch;
/**
*
* @author amino_000
*/
public class OffersSearch {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
History.getLatests();
Thread t;
t = new Thread(new Runnable() {
@Override
public void run() {
if(DB.getInstance().ds == null)
return;
while(true) {
try {
Search cars;
for(int i=1; i<10; i++) {
Search.insert();
System.out.println("-----");
System.out.println("Page: " + i);
cars = new Search("http://olx.pl/motoryzacja/samochody/?search%5Border%5D=created_at%3Adesc%3Fpage%3D1&page=" + i);
cars.start();
if(i>= 10) {
i=1;
}
Thread.sleep(5 * 1000);
}
} catch (InterruptedException ex) {
System.out.println(ex);
break;
}
}
DB.getInstance().ds.close();
}
});
t.start();
}
}
| [
"[email protected]"
] | |
c1467aadb40204a6dc01b7682ab59bace40ba87e | 0af8b92686a58eb0b64e319b22411432aca7a8f3 | /large-multiproject/project90/src/test/java/org/gradle/test/performance90_1/Test90_16.java | 9d35d11472927392eefef15cce1ca9155a82096c | [] | no_license | gradle/performance-comparisons | b0d38db37c326e0ce271abebdb3c91769b860799 | e53dc7182fafcf9fedf07920cbbea8b40ee4eef4 | refs/heads/master | 2023-08-14T19:24:39.164276 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | null | UTF-8 | Java | false | false | 289 | java | package org.gradle.test.performance90_1;
import static org.junit.Assert.*;
public class Test90_16 {
private final Production90_16 production = new Production90_16("value");
@org.junit.Test
public void test() {
assertEquals(production.getProperty(), "value");
}
} | [
"[email protected]"
] | |
6ab73c295b1f247815db496bf39a280ee354e5b3 | f36744918991a62b85fec3113d2d21fbea45f695 | /homework_p34/src/homework_p34/homework_p34.java | cdb1372b91b10c142c9765da3716a7c697434e50 | [] | no_license | leechungweii/homework | a81d0819f7929c19fb7c1d4285a3ced0e1d1f772 | 78baba22740d708f9da43b77d56853467a9c2d19 | refs/heads/master | 2023-08-17T22:23:38.663590 | 2021-10-18T14:42:12 | 2021-10-18T14:42:12 | null | 0 | 0 | null | null | null | null | BIG5 | Java | false | false | 698 | java | package homework_p34;
public class homework_p34
{
public static void main(String[] args)
{
int num1 = 10;
int num2 = 5;
System.out.println("num1和num2的各種運算");
System.out.println("num1+num2的值是"+(num1+num2));
System.out.println("num1-num2的值是"+(num1-num2));
System.out.println("num1*num2的值是"+(num1*num2));
System.out.println("num1/num2的值是"+(num1/num2));
System.out.println("num1%num2的值是"+(num1%num2));
int a=0;
int b=0;
int c=0;
b = a++;
c =++a;
System.out.println("因為是在指定值之後才遞增,所以b的值為"+b);
System.out.println("因為是在遞增之後才指定值,所以C的值為"+c);
}
}
| [
"[email protected]"
] | |
63239b124790bf1b3327d7afea62eaed20993bc9 | c82b94df9052a1709603c43b38c21ec597d96113 | /ParallelJDBC/src/com/dev/controller/UserApp.java | 290f133a9ec7145051e9fce15151848a78681090 | [] | no_license | yogeshbbangar/BusBookingSystem_JDBC | 871c70ecae88a5e003618ffc504bdb30080d9a26 | cf5200d4c77285a2de82fa523ef4b4d060d55b02 | refs/heads/master | 2023-01-24T18:29:43.702543 | 2019-08-29T15:44:43 | 2019-08-29T15:44:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,221 | java | package com.dev.controller;
import java.sql.Date;
import java.util.List;
import java.util.Scanner;
import com.dev.beans.Available;
import com.dev.beans.Bus;
import com.dev.beans.Ticket;
import com.dev.beans.User;
import com.dev.exception.BusNotFoundException;
import com.dev.exception.DeleteException;
import com.dev.exception.LoginException;
import com.dev.exception.RegisterException;
import com.dev.exception.TicketBookingException;
import com.dev.exception.UpdateException;
import com.dev.service.Service;
import com.dev.service.ServiceImpl;
public class UserApp {
static int userid = 0; // global user id
static Service service = new ServiceImpl();
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
System.out.println("1.Login" + "\n" + "2.Register");
int option = Integer.parseInt(sc.next());
if (option == 1) {
Boolean login = false;
try {
login = loginUser(); // user login
} catch (LoginException e) {
System.out.println(e.getMessage());
}
if (login) {
System.out.println("Login Successful");
boolean bo = true;
while (bo) {
System.out.println("1.Update Profile" + "\n" + "2.Delete Profile" + "\n" + "3.Search Bus" + "\n"
+ "4.Check Availability" + "\n" + "5.Book Ticket" + "\n" + "6.Get Ticket" + "\n"
+ "7.Cancel Ticket" + "\n" + "8.Feedback" + "\n" + "9.Exit");
int log = sc.nextInt();
switch (log) {
case 1:
try {
updateUser();
} catch (UpdateException e) { // custom exception
System.out.println(e.getMessage());
}
break;
case 2:
try {
deleteUser();
} catch (DeleteException e) { // custom exception
System.out.println(e.getMessage());
}
break;
case 3:
try {
searchBus();
} catch (BusNotFoundException e) { // custom exception
System.out.println(e.getMessage());
}
break;
case 4:
checkAvailability();
break;
case 5:
try {
bookTicket();
} catch (TicketBookingException e) { // custom exception
System.out.println(e.getMessage());
}
break;
case 6:
getTicket();
break;
case 7:
cancelTicket();
break;
case 8:
giveFeedback();
break;
case 9:
bo = false;
sc.close();
System.out.println("*****************************");
break;
default:
System.out.println("Incoorect Option");
break;
}
}
} else {
System.out.println("Login unsucessful");
}
} else if (option == 2) {
try {
createUser();
} catch (RegisterException e) { // custom exception
System.out.println(e.getMessage());
}
}
}
// update user
private static void updateUser() throws UpdateException {
User user = new User();
user.setUserId(userid);
System.out.println("Enter Password");
user.setUserPassword(sc.next());
System.out.println("Enter New Username");
user.setUserName(sc.next());
boolean checkEmail = true;
while (checkEmail) {
System.out.println("Enter Email:");
String temp = service.regexemail(sc.next()); // email validation
if (temp != null) {
user.setEmail(temp);
checkEmail = false;
} else {
System.out.println("Wrong Email Format!! e.g([email protected])");
}
}
boolean checkContact = true;
while (checkContact) {
System.out.println("Enter Contact No.:"); // contact validation
Long temp = service.regexcontact(sc.next());
if (temp != null) {
user.setContact(temp);
checkContact = false;
} else {
System.out.println("Contact should be of 10 digits!!");
}
}
boolean b = service.updateUser(user);
if (b) {
System.out.println("SuccessFully Updated");
} else {
System.out.println("Failed to Update");
throw new UpdateException("Updation Fail Exception"); // throws custom exception
}
}
// login user
private static boolean loginUser() throws LoginException {
boolean checkLogin = true;
while (checkLogin) {
System.out.println("Enter userid:");
Integer tempId = service.regex(sc.next()); // id validation
if (tempId != null) {
userid = tempId;
checkLogin = false;
} else {
System.out.println("User id should be number !");
}
}
System.out.println("Enter password:");
String password = sc.next();
if (service.loginUser(userid, password) != null) {
return true;
} else {
throw new LoginException("Login Failed Exception"); // throws custom exception
}
}
// delete user
private static void deleteUser() throws DeleteException {
System.out.println("Enter Password");
String password = sc.next();
if (service.deleteUser(userid, password)) {
System.out.println("Profile sucessfully Deleted");
} else {
throw new DeleteException("User Profile deletion Failed"); // throws custom exception
}
}
// search bus
private static void searchBus() throws BusNotFoundException {
boolean busCheck = true;
Integer busId = 0;
while (busCheck) {
System.out.println("Enter BusId"); // id validation
Integer tempId = service.regex(sc.next());
if (tempId != null) {
busId = tempId;
busCheck = false;
} else {
System.out.println("User id should be number !");
}
}
Bus bus = service.searchBus(busId);
if (bus != null) {
System.out.println(bus);
} else {
throw new BusNotFoundException("Bus Not Found Exception"); // throws custom exception
}
}
// check availability of bus
private static void checkAvailability() {
Available available = new Available();
System.out.println("Enter Source point");
String source = sc.next();
System.out.println("Enter Destination point");
String destination = sc.next();
System.out.println("Enter Date (YYYY-MM-DD)");
String tempDate = sc.next();
Date date = Date.valueOf(tempDate);
available.setAvailableDate(date);
List<Bus> list = service.checkAvailability(source, destination, date);
for (Bus bs : list) {
System.out.println(bs);
int avail = service.checkAvailability(bs.getBusId(), date);
System.out.println("Available Seats:" + avail);
}
}
// book ticket
private static void bookTicket() throws TicketBookingException {
Ticket ticket = new Ticket();
System.out.println("Enter source point");
String checksource = sc.next();
System.out.println("Enter Destination point");
String checkdestination = sc.next();
System.out.println("Enter date of journey(yyyy-mm-dd)");
String tempDate = sc.next();
Date date = Date.valueOf(tempDate);
ticket.setJourneyDate(date);
List<Bus> list = service.checkAvailability(checksource, checkdestination, date);
for (Bus bs : list) {
System.out.println(bs);
int avail = service.checkAvailability(bs.getBusId(), date);
System.out.println("Available Seats:" + avail);
}
System.out.println("Enter the bus_id");
int bus_id = sc.nextInt();
ticket.setBusId(bus_id);
ticket.setUserId(userid);
System.out.println("Enter number of seats to book");
int noOfSeats = sc.nextInt();
ticket.setNoofSeats(noOfSeats);
Bus bus = service.searchBus(bus_id);
ticket.setTotalPrice(bus.getPrice() * noOfSeats);
Ticket bookTicket = service.bookTicket(ticket);
if (bookTicket != null) {
System.out.println("Ticket sucessfully Booked");
System.out.println(bookTicket);
} else {
throw new TicketBookingException("Ticket Booking Fail Exception"); // throws custom exception
}
}
// get ticket
private static void getTicket() {
System.out.println("Enter BookingId");
Ticket ticket = service.getTicket(sc.nextInt());
if (ticket != null) {
System.out.println(ticket);
} else {
System.out.println("No Tickets Found");
}
}
// cancel ticket
private static void cancelTicket() {
System.out.println("Enter BookingId");
Boolean cancelTicket = service.cancelTicket(sc.nextInt());
if (cancelTicket) {
System.out.println("Ticket Successfully Cancelled");
} else {
System.out.println("No Tickets Found");
}
}
// give feedback
private static void giveFeedback() {
System.out.println("Enter Your Feedback");
String feedback = sc.next();
Boolean sugg = service.giveFeedback(userid, feedback);
if (sugg) {
System.out.println("Feedback Successfully Given");
} else {
System.out.println("Fail to give Feedback");
}
}
// register user
private static void createUser() throws RegisterException {
User user = new User();
boolean checkLogin = true;
while (checkLogin) {
System.out.println("Enter userid:"); // id validation
Integer tempId = service.regex(sc.next());
if (tempId != null) {
userid = tempId;
user.setUserId(userid);
checkLogin = false;
} else {
throw new RegisterException("RegisterException:Input should be Number");
}
}
System.out.println("Enter Username:");
user.setUserName(sc.next());
boolean checkEmail = true; // email validation
while (checkEmail) {
System.out.println("Enter Email:");
String temp = service.regexemail(sc.next());
if (temp != null) {
user.setEmail(temp);
checkEmail = false;
} else {
System.out.println("Wrong Email Format!! e.g([email protected])");
}
}
boolean checkContact = true; // contact validation
while (checkContact) {
System.out.println("Enter Contact No.:");
Long temp = service.regexcontact(sc.next());
if (temp != null) {
user.setContact(temp);
checkContact = false;
} else {
System.out.println("Contact should be of 10 digits!!");
}
}
System.out.println("Enter Password:");
user.setUserPassword(sc.next());
sc.close();
boolean reg = service.createUser(user);
if (reg) {
System.out.println("Registration Successful");
} else {
throw new RegisterException("Registration Fail Exception"); // throws custom exception
}
}
} | [
"Yogesh@LAPTOP-MGOO9Q9N"
] | Yogesh@LAPTOP-MGOO9Q9N |
10b162a5257db88ed22c2ee2450c1508c0438508 | 272d6d2cda05902a3ef4a175bdebef7a43439041 | /src/main/java/com/christian/icecat/model/entities/SimpleCategoryFeatureGroup.java | 5d7579cde071bcc680c400410129dae7aa9a8c77 | [] | no_license | Kolanot/icecat-importer | b353b36c3dd8ba034652d5a18c17254acc9ec368 | 120a15f8f6d7e535f270e227784b0595c857580e | refs/heads/master | 2021-06-14T18:58:50.902009 | 2017-02-28T15:33:18 | 2017-02-28T15:33:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,289 | java | package com.christian.icecat.model.entities;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
@Entity
@Table(name = "CategoryFeatureGroup")
public class SimpleCategoryFeatureGroup {
@ManyToMany(cascade = CascadeType.ALL, mappedBy = "categoryFeatureGroups")
private Set<SimpleProduct> products;
@Id
@Column(name = "categoryFeatureGroup_id")
private long id;
@ManyToMany(cascade = CascadeType.ALL)
@JoinTable(joinColumns = {@JoinColumn(name = "categoryFeatureGroup_id")}, inverseJoinColumns = {@JoinColumn(name = "featureGroup_id")})
private Set<SimpleFeatureGroup> featureGroups;
public Set<SimpleProduct> getProducts() {
return products;
}
public void setProducts(Set<SimpleProduct> products) {
this.products = products;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public Set<SimpleFeatureGroup> getFeatureGroups() {
return featureGroups;
}
public void setFeatureGroups(Set<SimpleFeatureGroup> featureGroups) {
this.featureGroups = featureGroups;
}
}
| [
"[email protected]"
] | |
10c562005df17f42b7f2ab71b36b998d6de8e48b | af77c0cccfe1ce4fcb5f8ad45886e0d400fbb1e2 | /src/main/java/com/talenco/lotterysystem/entity/UserExample.java | 679ed2c7176f465780f242c434f2165d88dddd38 | [] | no_license | boyideyt/lotterysystem | fbdb769e57d4c0307bf2a5e920d8681abdccf712 | 15ee6f527bf39288b57d45e776cab3f460752239 | refs/heads/master | 2022-06-23T20:14:31.015744 | 2019-08-03T10:22:38 | 2019-08-03T10:22:38 | 200,175,486 | 1 | 1 | null | 2022-06-17T02:21:10 | 2019-08-02T06:07:42 | JavaScript | UTF-8 | Java | false | false | 16,233 | java | package com.talenco.lotterysystem.entity;
import java.util.ArrayList;
import java.util.List;
public class UserExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public UserExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andUserIdIsNull() {
addCriterion("user_id is null");
return (Criteria) this;
}
public Criteria andUserIdIsNotNull() {
addCriterion("user_id is not null");
return (Criteria) this;
}
public Criteria andUserIdEqualTo(Integer value) {
addCriterion("user_id =", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotEqualTo(Integer value) {
addCriterion("user_id <>", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThan(Integer value) {
addCriterion("user_id >", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThanOrEqualTo(Integer value) {
addCriterion("user_id >=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThan(Integer value) {
addCriterion("user_id <", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThanOrEqualTo(Integer value) {
addCriterion("user_id <=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdIn(List<Integer> values) {
addCriterion("user_id in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotIn(List<Integer> values) {
addCriterion("user_id not in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdBetween(Integer value1, Integer value2) {
addCriterion("user_id between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotBetween(Integer value1, Integer value2) {
addCriterion("user_id not between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andUserNameIsNull() {
addCriterion("user_name is null");
return (Criteria) this;
}
public Criteria andUserNameIsNotNull() {
addCriterion("user_name is not null");
return (Criteria) this;
}
public Criteria andUserNameEqualTo(String value) {
addCriterion("user_name =", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameNotEqualTo(String value) {
addCriterion("user_name <>", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameGreaterThan(String value) {
addCriterion("user_name >", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameGreaterThanOrEqualTo(String value) {
addCriterion("user_name >=", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameLessThan(String value) {
addCriterion("user_name <", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameLessThanOrEqualTo(String value) {
addCriterion("user_name <=", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameLike(String value) {
addCriterion("user_name like", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameNotLike(String value) {
addCriterion("user_name not like", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameIn(List<String> values) {
addCriterion("user_name in", values, "userName");
return (Criteria) this;
}
public Criteria andUserNameNotIn(List<String> values) {
addCriterion("user_name not in", values, "userName");
return (Criteria) this;
}
public Criteria andUserNameBetween(String value1, String value2) {
addCriterion("user_name between", value1, value2, "userName");
return (Criteria) this;
}
public Criteria andUserNameNotBetween(String value1, String value2) {
addCriterion("user_name not between", value1, value2, "userName");
return (Criteria) this;
}
public Criteria andRealNameIsNull() {
addCriterion("real_name is null");
return (Criteria) this;
}
public Criteria andRealNameIsNotNull() {
addCriterion("real_name is not null");
return (Criteria) this;
}
public Criteria andRealNameEqualTo(String value) {
addCriterion("real_name =", value, "realName");
return (Criteria) this;
}
public Criteria andRealNameNotEqualTo(String value) {
addCriterion("real_name <>", value, "realName");
return (Criteria) this;
}
public Criteria andRealNameGreaterThan(String value) {
addCriterion("real_name >", value, "realName");
return (Criteria) this;
}
public Criteria andRealNameGreaterThanOrEqualTo(String value) {
addCriterion("real_name >=", value, "realName");
return (Criteria) this;
}
public Criteria andRealNameLessThan(String value) {
addCriterion("real_name <", value, "realName");
return (Criteria) this;
}
public Criteria andRealNameLessThanOrEqualTo(String value) {
addCriterion("real_name <=", value, "realName");
return (Criteria) this;
}
public Criteria andRealNameLike(String value) {
addCriterion("real_name like", value, "realName");
return (Criteria) this;
}
public Criteria andRealNameNotLike(String value) {
addCriterion("real_name not like", value, "realName");
return (Criteria) this;
}
public Criteria andRealNameIn(List<String> values) {
addCriterion("real_name in", values, "realName");
return (Criteria) this;
}
public Criteria andRealNameNotIn(List<String> values) {
addCriterion("real_name not in", values, "realName");
return (Criteria) this;
}
public Criteria andRealNameBetween(String value1, String value2) {
addCriterion("real_name between", value1, value2, "realName");
return (Criteria) this;
}
public Criteria andRealNameNotBetween(String value1, String value2) {
addCriterion("real_name not between", value1, value2, "realName");
return (Criteria) this;
}
public Criteria andPasswordIsNull() {
addCriterion("password is null");
return (Criteria) this;
}
public Criteria andPasswordIsNotNull() {
addCriterion("password is not null");
return (Criteria) this;
}
public Criteria andPasswordEqualTo(String value) {
addCriterion("password =", value, "password");
return (Criteria) this;
}
public Criteria andPasswordNotEqualTo(String value) {
addCriterion("password <>", value, "password");
return (Criteria) this;
}
public Criteria andPasswordGreaterThan(String value) {
addCriterion("password >", value, "password");
return (Criteria) this;
}
public Criteria andPasswordGreaterThanOrEqualTo(String value) {
addCriterion("password >=", value, "password");
return (Criteria) this;
}
public Criteria andPasswordLessThan(String value) {
addCriterion("password <", value, "password");
return (Criteria) this;
}
public Criteria andPasswordLessThanOrEqualTo(String value) {
addCriterion("password <=", value, "password");
return (Criteria) this;
}
public Criteria andPasswordLike(String value) {
addCriterion("password like", value, "password");
return (Criteria) this;
}
public Criteria andPasswordNotLike(String value) {
addCriterion("password not like", value, "password");
return (Criteria) this;
}
public Criteria andPasswordIn(List<String> values) {
addCriterion("password in", values, "password");
return (Criteria) this;
}
public Criteria andPasswordNotIn(List<String> values) {
addCriterion("password not in", values, "password");
return (Criteria) this;
}
public Criteria andPasswordBetween(String value1, String value2) {
addCriterion("password between", value1, value2, "password");
return (Criteria) this;
}
public Criteria andPasswordNotBetween(String value1, String value2) {
addCriterion("password not between", value1, value2, "password");
return (Criteria) this;
}
public Criteria andRoleIsNull() {
addCriterion("role is null");
return (Criteria) this;
}
public Criteria andRoleIsNotNull() {
addCriterion("role is not null");
return (Criteria) this;
}
public Criteria andRoleEqualTo(Integer value) {
addCriterion("role =", value, "role");
return (Criteria) this;
}
public Criteria andRoleNotEqualTo(Integer value) {
addCriterion("role <>", value, "role");
return (Criteria) this;
}
public Criteria andRoleGreaterThan(Integer value) {
addCriterion("role >", value, "role");
return (Criteria) this;
}
public Criteria andRoleGreaterThanOrEqualTo(Integer value) {
addCriterion("role >=", value, "role");
return (Criteria) this;
}
public Criteria andRoleLessThan(Integer value) {
addCriterion("role <", value, "role");
return (Criteria) this;
}
public Criteria andRoleLessThanOrEqualTo(Integer value) {
addCriterion("role <=", value, "role");
return (Criteria) this;
}
public Criteria andRoleIn(List<Integer> values) {
addCriterion("role in", values, "role");
return (Criteria) this;
}
public Criteria andRoleNotIn(List<Integer> values) {
addCriterion("role not in", values, "role");
return (Criteria) this;
}
public Criteria andRoleBetween(Integer value1, Integer value2) {
addCriterion("role between", value1, value2, "role");
return (Criteria) this;
}
public Criteria andRoleNotBetween(Integer value1, Integer value2) {
addCriterion("role not between", value1, value2, "role");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | [
"[email protected]"
] | |
c02a4e9eb94d32a97f2cdfc476872aaba03ee128 | 0624b1d2d8d6f2a5e0136c84e1fadc9f199b37fe | /pro-java/zhiju/src/main/java/com/xiao/zhiju/DruidStatFilter.java | b5f9072a798fffae04c77110875936922287b396 | [] | no_license | xiaozhiju-angel/wechat-program | 7a4b3d35a05f491150ee228c770d627199eabb52 | 7c4cc3d7a13090f53d1a1dc0bf53c54b102173d3 | refs/heads/master | 2022-07-01T01:36:37.605246 | 2020-04-01T15:01:27 | 2020-04-01T15:01:27 | 252,205,338 | 0 | 0 | null | 2022-06-17T03:01:12 | 2020-04-01T14:54:01 | JavaScript | UTF-8 | Java | false | false | 555 | java | package com.xiao.zhiju;
import com.alibaba.druid.support.http.WebStatFilter;
import javax.servlet.annotation.WebFilter;
import javax.servlet.annotation.WebInitParam;
/**
* Create by [email protected] on 2018/4/4.
* 配置druid监控统计功能
* 配置Filter
*/
@WebFilter(filterName = "druidWebStatFilter", urlPatterns = "/*",
initParams = {
@WebInitParam(name = "exclusions", value = "*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*")// 忽略资源
}
)
public class DruidStatFilter extends WebStatFilter {
}
| [
" [email protected]"
] | |
bfd15b605f7b7f71765ff7205f4b5e8457955d81 | 5ec8ce07ca8bdc56a1c7bbaca306a32a8876108a | /shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/tcl/impl/PrepareTransactionStatementAssert.java | c8c09ea483d8f12414d60a5962d9c30ea081a39c | [
"Apache-2.0"
] | permissive | wornxiao/shardingsphere | c2c5b0c4ebe91f248bdb504529ced0dd1084810a | 04cbfa2a807811e15a80148351f6ca5d01c83da0 | refs/heads/master | 2022-10-21T20:11:10.042821 | 2022-07-17T06:33:44 | 2022-07-17T06:33:44 | 272,212,232 | 1 | 0 | Apache-2.0 | 2020-06-14T13:54:42 | 2020-06-14T13:54:41 | null | UTF-8 | Java | false | false | 1,878 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.tcl.impl;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.shardingsphere.sql.parser.sql.common.statement.tcl.PrepareTransactionStatement;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAssertContext;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.tcl.PrepareTransactionTestCase;
/**
* Prepare transaction statement assert.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class PrepareTransactionStatementAssert {
/**
* Assert prepare transaction statement is correct with expected parser result.
*
* @param assertContext assert context
* @param actual actual prepare transaction statement
* @param expected expected prepare transaction statement test case
*/
public static void assertIs(final SQLCaseAssertContext assertContext, final PrepareTransactionStatement actual, final PrepareTransactionTestCase expected) {
}
}
| [
"[email protected]"
] | |
fb64076b519386e0be4af4a63ccaa629935b71d9 | 8c631b71197ee700b330d88cc704d2271a176092 | /src/test/java/ua/edu/ucu/collections/immutable/ImmutableLinkedListTest.java | 3475d59d33a429cdd2760fcdf33502c42a4f1105 | [] | no_license | Diana-Doe/apps20hromyak-hw2 | 11c07302dda66a725f9478a5eeee06871728d0df | f0b7790757576af3287834e8d963ee447d5bff19 | refs/heads/master | 2023-01-15T14:47:28.547148 | 2020-11-23T14:27:34 | 2020-11-23T14:27:34 | 313,689,636 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,368 | java | package ua.edu.ucu.collections.immutable;
import org.junit.Test;
import java.util.Arrays;
import java.util.LinkedList;
import static org.junit.Assert.*;
public class ImmutableLinkedListTest {
@Test
public void createList() {
Object[] arr = {1, 'a', -3.2, "apple"};
ImmutableLinkedList list = new ImmutableLinkedList(arr);
Object[] expResult1 = {1, 'a', -3.2, "apple"};
assertArrayEquals(expResult1, list.toArray());
ImmutableLinkedList emptyList = new ImmutableLinkedList(new Object[0]);
Object[] expResult2 = {};
assertArrayEquals(expResult2, emptyList.toArray());
ImmutableLinkedList oneList = new ImmutableLinkedList('a');
Object[] expResult3 = {'a'};
assertArrayEquals(expResult3, oneList.toArray());
}
@Test
public void addElement() {
Object[] arr = {1, 2, 3};
ImmutableLinkedList list = new ImmutableLinkedList(arr);
ImmutableLinkedList empty = new ImmutableLinkedList();
Object[] expResult1 = {1, 2, 3};
Object[] expResult2 = {1, 2, 3, 4};
Object[] expResult3 = {4};
ImmutableLinkedList newList1 = list.add(4);
ImmutableLinkedList newList2 = empty.add(4);
assertArrayEquals(expResult1, list.toArray());
assertArrayEquals(expResult2, newList1.toArray());
assertArrayEquals(expResult3, newList2.toArray());
}
@Test
public void addElementIndex() {
Object[] arr = {1, 2, 3};
ImmutableLinkedList list = new ImmutableLinkedList(arr);
Object[] expResult1 = {1, 2, 3};
Object[] expResult2 = {1, 4, 2, 3};
ImmutableLinkedList newList = list.add(1,4);
assertArrayEquals(expResult1, list.toArray());
assertArrayEquals(expResult1, arr);
assertArrayEquals(expResult2, newList.toArray());
}
@Test(expected = IndexOutOfBoundsException.class)
public void addElementIndexEx() {
ImmutableLinkedList list = new ImmutableLinkedList();
list.add(1,4);
}
@Test
public void addElements() {
Object[] arr = {"apple", "milk", "cookies"};
ImmutableLinkedList list = new ImmutableLinkedList(arr);
Object[] addList = {"banana", "carrot"};
Object[] expResult1 = {"apple", "milk", "cookies"};
Object[] expResult2 = {"apple", "milk", "cookies", "banana", "carrot"};
ImmutableLinkedList newList = list.addAll(addList);
assertArrayEquals(expResult1, list.toArray());
assertArrayEquals(expResult1, arr);
assertArrayEquals(expResult2, newList.toArray());
ImmutableLinkedList empty = new ImmutableLinkedList();
Object[] expResult3 = {"banana", "carrot"};
ImmutableLinkedList newList2 = empty.addAll(addList);
assertArrayEquals(expResult3, newList2.toArray());
}
@Test
public void addElementsIndex() {
Object[] arr = {"apple", "milk", "cookies"};
ImmutableLinkedList list = new ImmutableLinkedList(arr);
Object[] addList = {"banana", "carrot"};
Object[] expResult1 = {"apple", "milk", "cookies"};
Object[] expResult2 = {"apple", "banana", "carrot", "milk", "cookies"};
ImmutableLinkedList newList = list.addAll(1, addList);
assertArrayEquals(expResult1, list.toArray());
assertArrayEquals(expResult1, arr);
assertArrayEquals(expResult2, newList.toArray());
}
@Test(expected = IndexOutOfBoundsException.class)
public void addElementsIndexEx() {
ImmutableLinkedList list = new ImmutableLinkedList();
Object[] els = {1, 2};
list.add(1, els);
}
@Test
public void getElement() {
Object[] arr = {'a', 'b', 'c'};
ImmutableLinkedList list = new ImmutableLinkedList(arr);
assertEquals('a', list.get(0));
}
@Test(expected = IndexOutOfBoundsException.class)
public void getElementEx() {
Object[] arr = {'a', 'b', 'c'};
ImmutableLinkedList list = new ImmutableLinkedList(arr);
list.get(4);
}
@Test
public void remove() {
Object[] arr = {'a', 'b', 'c'};
ImmutableLinkedList list = new ImmutableLinkedList(arr);
Object[] expResult1 = {'a', 'b', 'c'};
Object[] expResult2 = {'a', 'c'};
ImmutableLinkedList newList = list.remove(1);
assertArrayEquals(expResult1, list.toArray());
assertArrayEquals(expResult1, arr);
assertArrayEquals(expResult2, newList.toArray());
}
@Test(expected = IndexOutOfBoundsException.class)
public void removeEx() {
Object[] arr = {'a', 'b', 'c'};
ImmutableLinkedList list = new ImmutableLinkedList(arr);
list.remove(4);
}
@Test
public void setElement() {
Object[] arr = {1.0, 1.5, 1.2};
ImmutableLinkedList list = new ImmutableLinkedList(arr);
Object[] expResult1 = {1.0, 1.5, 1.2};
Object[] expResult2 = {1.0, 1.1, 1.2};
ImmutableLinkedList newList = list.set(1, 1.1);
assertArrayEquals(expResult1, list.toArray());
assertArrayEquals(expResult1, arr);
assertArrayEquals(expResult2, newList.toArray());
}
@Test(expected = IndexOutOfBoundsException.class)
public void setElementEx() {
ImmutableLinkedList list = new ImmutableLinkedList();
list.set(0, 1.1);
}
@Test
public void indexOf() {
Object[] arr = {'b', 1, "apple"};
ImmutableLinkedList list = new ImmutableLinkedList(arr);
int expResult1 = 2;
int expResult2 = -1;
int actualResult1 = list.indexOf("apple");
int actualResult2 = list.indexOf('a');
assertEquals(expResult1, actualResult1);
assertEquals(expResult2, actualResult2);
ImmutableLinkedList empty = new ImmutableLinkedList();
int actualResult3 = empty.indexOf('e');
assertEquals(expResult2, actualResult3);
}
@Test
public void size() {
Object[] arr = {'b', 1, "apple"};
ImmutableLinkedList list = new ImmutableLinkedList(arr);
ImmutableLinkedList empty = new ImmutableLinkedList();
int expResult1 = 3;
int expResult2 = 0;
int actualResult1 = list.size();
int actualResult2 = empty.size();
assertEquals(expResult1, actualResult1);
assertEquals(expResult2, actualResult2);
}
@Test
public void clear() {
Object[] arr = {'b', 1, "apple"};
ImmutableLinkedList list = new ImmutableLinkedList(arr);
Object[] actualResult = list.clear().toArray();
assertEquals(actualResult.length, 0);
}
@Test
public void isEmpty() {
Object[] arr = {'b', 1, "apple"};
ImmutableLinkedList list = new ImmutableLinkedList(arr);
ImmutableLinkedList empty = new ImmutableLinkedList();
assertFalse(list.isEmpty());
assertTrue(empty.isEmpty());
}
@Test
public void toArray() {
Object[] arr = {'b', 1, "apple"};
ImmutableLinkedList list = new ImmutableLinkedList(arr);
assertArrayEquals(arr, list.toArray());
}
@Test
public void String() {
Object[] arr = {-0.2, 'a', "apple", 1};
ImmutableLinkedList list = new ImmutableLinkedList(arr);
String expResult1 = "-0.2, a, apple, 1";
String actualResult1 = list.toString();
assertEquals(expResult1, actualResult1);
ImmutableLinkedList empty = new ImmutableLinkedList();
String expResult2 = "";
String actualResult2 = empty.toString();
assertEquals(expResult2, actualResult2);
}
@Test
public void getFirst() {
Object[] arr = {1, 2, 3};
ImmutableLinkedList list = new ImmutableLinkedList(arr);
Object expResult1 = 1;
Object actualResult1 = list.getFirst();
assertEquals(expResult1, actualResult1);
}
@Test(expected = IndexOutOfBoundsException.class)
public void GetFirstEx() {
ImmutableLinkedList empty = new ImmutableLinkedList();
empty.getFirst();
}
@Test
public void getLast() {
Object[] arr = {1, 2, 3};
ImmutableLinkedList list = new ImmutableLinkedList(arr);
Object expResult = 3;
Object actualResult = list.getLast();
assertEquals(expResult, actualResult);
}
@Test(expected = IndexOutOfBoundsException.class)
public void GetLastEx() {
ImmutableLinkedList empty = new ImmutableLinkedList();
empty.getLast();
}
@Test
public void addFirst() {
Object[] arr = {1, 2, 3};
ImmutableLinkedList list = new ImmutableLinkedList(arr);
Object[] expResult = {0, 1, 2, 3};
Object[] actualResult = list.addFirst(0).toArray();
assertArrayEquals(expResult, actualResult);
}
@Test
public void addLast() {
Object[] arr = {1, 2, 3};
ImmutableLinkedList list = new ImmutableLinkedList(arr);
Object[] expResult = {1, 2, 3, 4};
Object[] actualResult = list.addLast(4).toArray();
assertArrayEquals(expResult, actualResult);
}
@Test
public void removeFirst() {
Object[] arr = {1, 2};
ImmutableLinkedList list1 = new ImmutableLinkedList(arr);
ImmutableLinkedList list2 = new ImmutableLinkedList('a');
Object[] expResult1 = {2};
Object[] expResult2 = {};
Object[] actualResult1 = list1.removeFirst().toArray();
Object[] actualResult2 = list2.removeFirst().toArray();
assertArrayEquals(expResult1, actualResult1);
assertArrayEquals(expResult2, actualResult2);
}
@Test(expected = IndexOutOfBoundsException.class)
public void RemoveFirstEx() {
ImmutableLinkedList empty = new ImmutableLinkedList();
empty.removeFirst();
}
@Test
public void removeLast() {
Object[] arr = {1, 2, 3};
ImmutableLinkedList list = new ImmutableLinkedList(arr);
Object[] expResult = {1, 2};
Object[] actualResult = list.removeLast().toArray();
assertArrayEquals(expResult, actualResult);
}
@Test(expected = IndexOutOfBoundsException.class)
public void RemoveLastEx() {
ImmutableLinkedList empty = new ImmutableLinkedList();
empty.removeLast();
}
}
| [
"[email protected]"
] | |
648156fb18553f627e901031ec179261422d7632 | 42d905620be66de79bbeda093fa34f712225ea6c | /src/com/cndym/adapter/tms/examine/impl/Ex0090307.java | 9cb6542de3a48256718b169a20bfcc626d673df1 | [] | no_license | lichaoliu/tob | daad2730b188b322fba3ad39a9d9a3a4497faae9 | 619d06d4aa4bf62e5f92d04b6bbee8950ae1f024 | refs/heads/master | 2020-06-08T20:06:25.235433 | 2019-06-23T02:59:20 | 2019-06-23T02:59:20 | 193,297,933 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,604 | java | package com.cndym.adapter.tms.examine.impl;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
import com.cndym.adapter.tms.examine.BashExamina;
import com.cndym.adapter.tms.examine.IExamine;
import com.cndym.adapter.tms.examine.utils.NumberAreaExamine;
import com.cndym.adapter.tms.examine.utils.NumberLengthExamine;
import com.cndym.adapter.tms.examine.utils.NumberTagExamine;
import com.cndym.adapter.tms.examine.utils.NumberTicketCountExamine;
import com.cndym.exception.CndymException;
import com.cndym.exception.ErrCode;
@Component
public class Ex0090307 extends BashExamina implements IExamine {
private Logger logger = Logger.getLogger(Ex0090307.class);
@Override
public void examina(String number, int item) {
logger.error("玩法暂不支持");
throw new CndymException(ErrCode.E8117);
// String[] nums = number.split(ztag);
// NumberTicketCountExamine.defaulstNumberSortExamine("0090307", nums);
//
// int ticket = 0;
// for (String num : nums) {
// //校验格式
// NumberTagExamine.commaNumberTagExamine(num);//号码中分隔符的验证;
// NumberLengthExamine.defaultNumberLengthExamine(num, ",", 3, 0);//号码个数的验证
// NumberAreaExamine.defaultNumberAraeExamine(num.split(","), 0, 9, 1);//号码域验证
// ticket += 3;
// }
//
// // 校验注数
// if (item != ticket) {
// throw new CndymException(ErrCode.E8116);
// }
}
public static void main(String[] args) {
Ex0090307 ex = new Ex0090307();
ex.examina("3,3,3;1,2,3", 6);
System.out.println("ok");
}
}
| [
"[email protected]"
] | |
14823f2764cc832251566d9b02704fc43645d2ca | 9bcc8b86ce7828a6d80e92b704729400d5c28885 | /edu-springcloud/service/service_edu/src/main/java/com/wangs/eduservice/service/impl/EduCommentServiceImpl.java | 8c6422634680a88b7560a73abb954806311efea8 | [
"Apache-2.0"
] | permissive | wangsxx/yiniko_edu_system | c302167b1b26da3ba272dbe24874d55914393854 | ed265c2ba2d07906d73273ac731aa1cbcf5f6ab2 | refs/heads/master | 2023-06-14T02:36:51.430019 | 2021-07-06T13:58:01 | 2021-07-06T13:58:01 | 377,423,871 | 9 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,434 | java | package com.wangs.eduservice.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wangs.eduservice.entity.EduComment;
import com.wangs.eduservice.mapper.EduCommentMapper;
import com.wangs.eduservice.service.EduCommentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* <p>
* 评论 服务实现类
* </p>
*
* @author wangs
* @since 2021-06-01
*/
@Service
public class EduCommentServiceImpl extends ServiceImpl<EduCommentMapper, EduComment> implements EduCommentService {
public Map<String, Object> getCommentByPage(long current, long limit, String courseId) {
Page<EduComment> page = new Page<EduComment>(current, limit);
QueryWrapper<EduComment> wrapper = new QueryWrapper<EduComment>();
wrapper.eq("course_id", courseId);
wrapper.orderByDesc("gmt_create");
Page<EduComment> commentPage = this.page(page, wrapper);
HashMap<String, Object> result = new HashMap<String, Object>();
result.put("total", commentPage.getTotal());
result.put("records", commentPage.getRecords());
return result;
}
public void addComment(EduComment comment) {
baseMapper.insert(comment);
}
}
| [
"[email protected]"
] | |
346475e0513057bcdf894a2e41b68faacd1ef14e | 452d6761da200f62a776fbf43b34408e30cb3eee | /modules/ui/src/main/java/org/youi/framework/ui/field/model/FieldText.java | 6107a22b9fc5b3b40fc40008a9b7f38a2b9a7a05 | [] | no_license | zhyi12/youi | e4e6c5dface0a4ed9ce40e0e37e4393d339e9fda | d53dd1ac845a7d12c756bc33a730a8050a6b22dc | refs/heads/master | 2021-01-17T14:02:23.213256 | 2016-06-30T15:57:31 | 2016-06-30T15:57:31 | 34,362,672 | 6 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,121 | java | /*
* Copyright (c) 2009 zhyi_12. All rights reserved.
* This software was developed by zhyi_12 and is provided under the terms
* of the GNU Lesser General Public License, Version 2.1. You may not use
* this file except in compliance with the license. If you need a copy of the license,
* please go to http://www.gnu.org/licenses/lgpl-2.1.txt. The Original Code is Pentaho
* youi component. The Initial Developer is zhyi_12.
*
* Software distributed under the GNU Lesser Public License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Please refer to
* the license for the specific language governing your rights and limitations.
*/
package org.youi.framework.ui.field.model;
public class FieldText extends AbstractField {
private String dataType;//数据格式
private int fractionLength;//小数点位数
private String expression;//校验表达式
private String expressionMessage;//校验表达式提示信息
private String validateSrc;//即时校验地址
private int minLength;//最小长度
private int maxLength;//最大长度
private String format;
private boolean escapeSpecial;
public String[] addonProperies() {
String[] addonProperies = {
stringProperty("dataType",dataType),
intProperty("fractionLength",fractionLength),
intProperty("maxLength",maxLength),
intProperty("minLength",minLength),
stringProperty("expression",expression==null?null:expression.replace("\\", "\\\\")),
stringProperty("expressionMessage",expressionMessage),
stringProperty("format",format),
stringProperty("validateSrc",validateSrc),
booleanProperty("escapeSpecial",escapeSpecial)
};
return addonProperies;
}
/**
* @return the dataType
*/
public String getDataType() {
return dataType;
}
/**
* @param dataType the dataType to set
*/
public void setDataType(String dataType) {
this.dataType = dataType;
}
/**
* @return the expression
*/
public String getExpression() {
return expression;
}
/**
* @param expression the expression to set
*/
public void setExpression(String expression) {
this.expression = expression;
}
/**
* @return the fractionLength
*/
public int getFractionLength() {
return fractionLength;
}
/**
* @param fractionLength the fractionLength to set
*/
public void setFractionLength(int fractionLength) {
this.fractionLength = fractionLength;
}
/**
* @return the expressionMessage
*/
public String getExpressionMessage() {
return expressionMessage;
}
/**
* @param expressionMessage the expressionMessage to set
*/
public void setExpressionMessage(String expressionMessage) {
this.expressionMessage = expressionMessage;
}
/**
* @return the validateSrc
*/
public String getValidateSrc() {
return validateSrc;
}
/**
* @param validateSrc the validateSrc to set
*/
public void setValidateSrc(String validateSrc) {
this.validateSrc = validateSrc;
}
/**
* @return the minLength
*/
public int getMinLength() {
return minLength;
}
/**
* @param minLength the minLength to set
*/
public void setMinLength(int minLength) {
this.minLength = minLength;
}
/**
* @return the maxLength
*/
public int getMaxLength() {
return maxLength;
}
/**
* @param maxLength the maxLength to set
*/
public void setMaxLength(int maxLength) {
this.maxLength = maxLength;
}
public String getFormat() {
return format;
}
public void setFormat(String format) {
this.format = format;
}
public boolean isEscapeSpecial() {
return escapeSpecial;
}
public void setEscapeSpecial(boolean escapeSpecial) {
this.escapeSpecial = escapeSpecial;
}
public String innerHtml(){
StringBuffer htmls = new StringBuffer();
int inputWidth = parseWidth() - 6;
htmls.append("<input ");
if(readonly){
htmls.append(" readonly=\"readonly\" ");
}
htmls.append(" name=\""+getProperty()+"\" style=\"width:"+(inputWidth )+"px;\" type=\"text\" class=\"textInput value\"></input>");
htmls.append("<div class=\"field-invalid\"></div>");
return htmls.toString();
}
}
| [
"[email protected]"
] | |
aa9c449543f87ee037b68dee222e65c80af8f816 | e7cb9168bd11aaffc20213f87feaa011fcc64c4d | /src/JavaFX_Example2.java | ab4275322a7b7b8a5ee2178f1abe0d6e0b80dd96 | [] | no_license | vhdez/JavaFX_Examples | bed2cc11b873cf468b1d335b67689a82236e7e3c | 8c1e2780f0f9df3a38f4a1644bb2b9b347b3adac | refs/heads/master | 2020-03-30T15:28:26.905197 | 2018-10-03T05:57:43 | 2018-10-03T05:57:43 | 151,364,872 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,564 | java | package org.sla;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
public class JavaFX_Example2 extends Application {
// Fields
private Button clickMeButton;
private int numberOfClicks = 0;
// Methods
private void clickMeButton_click() {
// Increment click counter
numberOfClicks = numberOfClicks + 1;
System.out.println("You clicked the ClickME button " + numberOfClicks + " times.");
// Update the text in the button to show click count
clickMeButton.setText("Click Me " + numberOfClicks);
}
@Override
public void start(Stage primaryStage) throws Exception {
// Write title to window
primaryStage.setTitle("My Second UI App in Java");
// Create a button UI element with text "Click Me"
clickMeButton = new Button("Click Me");
// tell button what method will get called when it is clicked
clickMeButton.setOnAction(e->clickMeButton_click());
// make a frame and add only the button UI element to it
StackPane myUIFrame = new StackPane();
myUIFrame.getChildren().add(clickMeButton);
// Fill 400x200 window with just that frame of UI Elements
Scene scene = new Scene(myUIFrame, 400, 200);
primaryStage.setScene(scene);
// Display the window
primaryStage.show();
}
public static void main(String[] args) {
Application.launch(args);
}
}
| [
"[email protected]"
] | |
59882e18d63fdc983b38be14b79af29604dcaad9 | f8c797c0bd16fd1aec44677d5e33d59abb65404f | /mon-backend/src/main/java/ru/ursip/webservice/monitoring/service/CalculationsService.java | 767ea01c79b2a438e97403a173f8ee4b3b1c6a7f | [] | no_license | CEBEP87/MySimpleCode | 4af3cd32750680620842ca27cb4553bc06d2f287 | 394cb3c780606d1e67acb56cee0a442db798b3a1 | refs/heads/master | 2020-03-15T06:52:09.441283 | 2018-10-21T06:39:03 | 2018-10-21T06:39:03 | 132,017,113 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,183 | java | package ru.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.webservice.monitoring.service;
import org.springframework.stereotype.Service;
/**
* * Service for calculate CostItems
* <p>
* Created by samsonov_ky on 26.09.2017.
*/
@Service
public interface CalculationsService {
/**
* Get calculated Estimated Cost By Equipment
*
* @param rate - rate
* @param sellingPrice -selling price
* @param transportCost -transport Cost
* @param weightBrutto - weight brutto
* @param trBool - transport cost bool
* @param transportCostCostBase - transportCostCostBase
* @return - map with calculated values
*/
Double calculateEstimatedPriceForEquipment(Double rate, Double sellingPrice, Double transportCost, Double weightBrutto, Boolean trBool, Double transportCostCostBase);
/**
* Get calculate coefficient by Equipment
*
* @param estimatedCurrentPrice - estimated current price
* @param costResourceBase - cost Resource Base
* @return - map with calculated values
*/
Double calculateRateEquipment(Double estimatedCurrentPrice, Double costResourceBase);
} | [
"[email protected]"
] | |
5f14bdd8152ad3dcde1d01205b8a5fc5f3f91dd4 | 1fbd1d6f4315a722b51bcc4e0b292b2f93501f32 | /src/com/itertk/app/mpos/dbhelper/SaleOrderItemAttributeValueDao.java | 65804c614836b704bb6de201d8bde340c9add943 | [] | no_license | zhangjunzhere/mpos | 0375f68371621b776bbb3601832ebf8dd6174829 | f3ce24feea51dd4d691039162fea826b87501e75 | refs/heads/master | 2021-01-01T19:21:16.477891 | 2016-03-14T07:07:14 | 2016-03-14T07:07:17 | 30,794,803 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,733 | java | package com.itertk.app.mpos.dbhelper;
import java.util.List;
import java.util.ArrayList;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteStatement;
import de.greenrobot.dao.AbstractDao;
import de.greenrobot.dao.Property;
import de.greenrobot.dao.internal.SqlUtils;
import de.greenrobot.dao.internal.DaoConfig;
import de.greenrobot.dao.query.Query;
import de.greenrobot.dao.query.QueryBuilder;
import com.itertk.app.mpos.dbhelper.SaleOrderItemAttributeValue;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* DAO for table SALE_ORDER_ITEM_ATTRIBUTE_VALUE.
*/
public class SaleOrderItemAttributeValueDao extends AbstractDao<SaleOrderItemAttributeValue, Long> {
public static final String TABLENAME = "SALE_ORDER_ITEM_ATTRIBUTE_VALUE";
/**
* Properties of entity SaleOrderItemAttributeValue.<br/>
* Can be used for QueryBuilder and for referencing column names.
*/
public static class Properties {
public final static Property SaleOrderItemAttributeValueId = new Property(0, Long.class, "saleOrderItemAttributeValueId", true, "SALE_ORDER_ITEM_ATTRIBUTE_VALUE_ID");
public final static Property SaleOrderItemId = new Property(1, long.class, "saleOrderItemId", false, "SALE_ORDER_ITEM_ID");
public final static Property AttributeValueId = new Property(2, long.class, "attributeValueId", false, "ATTRIBUTE_VALUE_ID");
};
private DaoSession daoSession;
private Query<SaleOrderItemAttributeValue> saleOrderItem_SaleOrderItemAttributeValueListQuery;
public SaleOrderItemAttributeValueDao(DaoConfig config) {
super(config);
}
public SaleOrderItemAttributeValueDao(DaoConfig config, DaoSession daoSession) {
super(config, daoSession);
this.daoSession = daoSession;
}
/** Creates the underlying database table. */
public static void createTable(SQLiteDatabase db, boolean ifNotExists) {
String constraint = ifNotExists? "IF NOT EXISTS ": "";
db.execSQL("CREATE TABLE " + constraint + "'SALE_ORDER_ITEM_ATTRIBUTE_VALUE' (" + //
"'SALE_ORDER_ITEM_ATTRIBUTE_VALUE_ID' INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: saleOrderItemAttributeValueId
"'SALE_ORDER_ITEM_ID' INTEGER NOT NULL ," + // 1: saleOrderItemId
"'ATTRIBUTE_VALUE_ID' INTEGER NOT NULL );"); // 2: attributeValueId
}
/** Drops the underlying database table. */
public static void dropTable(SQLiteDatabase db, boolean ifExists) {
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "'SALE_ORDER_ITEM_ATTRIBUTE_VALUE'";
db.execSQL(sql);
}
/** @inheritdoc */
@Override
protected void bindValues(SQLiteStatement stmt, SaleOrderItemAttributeValue entity) {
stmt.clearBindings();
Long saleOrderItemAttributeValueId = entity.getSaleOrderItemAttributeValueId();
if (saleOrderItemAttributeValueId != null) {
stmt.bindLong(1, saleOrderItemAttributeValueId);
}
stmt.bindLong(2, entity.getSaleOrderItemId());
stmt.bindLong(3, entity.getAttributeValueId());
}
@Override
protected void attachEntity(SaleOrderItemAttributeValue entity) {
super.attachEntity(entity);
entity.__setDaoSession(daoSession);
}
/** @inheritdoc */
@Override
public Long readKey(Cursor cursor, int offset) {
return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
}
/** @inheritdoc */
@Override
public SaleOrderItemAttributeValue readEntity(Cursor cursor, int offset) {
SaleOrderItemAttributeValue entity = new SaleOrderItemAttributeValue( //
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // saleOrderItemAttributeValueId
cursor.getLong(offset + 1), // saleOrderItemId
cursor.getLong(offset + 2) // attributeValueId
);
return entity;
}
/** @inheritdoc */
@Override
public void readEntity(Cursor cursor, SaleOrderItemAttributeValue entity, int offset) {
entity.setSaleOrderItemAttributeValueId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
entity.setSaleOrderItemId(cursor.getLong(offset + 1));
entity.setAttributeValueId(cursor.getLong(offset + 2));
}
/** @inheritdoc */
@Override
protected Long updateKeyAfterInsert(SaleOrderItemAttributeValue entity, long rowId) {
entity.setSaleOrderItemAttributeValueId(rowId);
return rowId;
}
/** @inheritdoc */
@Override
public Long getKey(SaleOrderItemAttributeValue entity) {
if(entity != null) {
return entity.getSaleOrderItemAttributeValueId();
} else {
return null;
}
}
/** @inheritdoc */
@Override
protected boolean isEntityUpdateable() {
return true;
}
/** Internal query to resolve the "saleOrderItemAttributeValueList" to-many relationship of SaleOrderItem. */
public List<SaleOrderItemAttributeValue> _querySaleOrderItem_SaleOrderItemAttributeValueList(long saleOrderItemId) {
synchronized (this) {
if (saleOrderItem_SaleOrderItemAttributeValueListQuery == null) {
QueryBuilder<SaleOrderItemAttributeValue> queryBuilder = queryBuilder();
queryBuilder.where(Properties.SaleOrderItemId.eq(null));
saleOrderItem_SaleOrderItemAttributeValueListQuery = queryBuilder.build();
}
}
Query<SaleOrderItemAttributeValue> query = saleOrderItem_SaleOrderItemAttributeValueListQuery.forCurrentThread();
query.setParameter(0, saleOrderItemId);
return query.list();
}
private String selectDeep;
protected String getSelectDeep() {
if (selectDeep == null) {
StringBuilder builder = new StringBuilder("SELECT ");
SqlUtils.appendColumns(builder, "T", getAllColumns());
builder.append(',');
SqlUtils.appendColumns(builder, "T0", daoSession.getSaleOrderItemDao().getAllColumns());
builder.append(',');
SqlUtils.appendColumns(builder, "T1", daoSession.getAttributeValueDao().getAllColumns());
builder.append(" FROM SALE_ORDER_ITEM_ATTRIBUTE_VALUE T");
builder.append(" LEFT JOIN SALE_ORDER_ITEM T0 ON T.'SALE_ORDER_ITEM_ID'=T0.'SALE_ORDER_ITEM_ID'");
builder.append(" LEFT JOIN ATTRIBUTE_VALUE T1 ON T.'ATTRIBUTE_VALUE_ID'=T1.'VALUE_ID'");
builder.append(' ');
selectDeep = builder.toString();
}
return selectDeep;
}
protected SaleOrderItemAttributeValue loadCurrentDeep(Cursor cursor, boolean lock) {
SaleOrderItemAttributeValue entity = loadCurrent(cursor, 0, lock);
int offset = getAllColumns().length;
SaleOrderItem saleOrderItem = loadCurrentOther(daoSession.getSaleOrderItemDao(), cursor, offset);
if(saleOrderItem != null) {
entity.setSaleOrderItem(saleOrderItem);
}
offset += daoSession.getSaleOrderItemDao().getAllColumns().length;
AttributeValue attributeValue = loadCurrentOther(daoSession.getAttributeValueDao(), cursor, offset);
if(attributeValue != null) {
entity.setAttributeValue(attributeValue);
}
return entity;
}
public SaleOrderItemAttributeValue loadDeep(Long key) {
assertSinglePk();
if (key == null) {
return null;
}
StringBuilder builder = new StringBuilder(getSelectDeep());
builder.append("WHERE ");
SqlUtils.appendColumnsEqValue(builder, "T", getPkColumns());
String sql = builder.toString();
String[] keyArray = new String[] { key.toString() };
Cursor cursor = db.rawQuery(sql, keyArray);
try {
boolean available = cursor.moveToFirst();
if (!available) {
return null;
} else if (!cursor.isLast()) {
throw new IllegalStateException("Expected unique result, but count was " + cursor.getCount());
}
return loadCurrentDeep(cursor, true);
} finally {
cursor.close();
}
}
/** Reads all available rows from the given cursor and returns a list of new ImageTO objects. */
public List<SaleOrderItemAttributeValue> loadAllDeepFromCursor(Cursor cursor) {
int count = cursor.getCount();
List<SaleOrderItemAttributeValue> list = new ArrayList<SaleOrderItemAttributeValue>(count);
if (cursor.moveToFirst()) {
if (identityScope != null) {
identityScope.lock();
identityScope.reserveRoom(count);
}
try {
do {
list.add(loadCurrentDeep(cursor, false));
} while (cursor.moveToNext());
} finally {
if (identityScope != null) {
identityScope.unlock();
}
}
}
return list;
}
protected List<SaleOrderItemAttributeValue> loadDeepAllAndCloseCursor(Cursor cursor) {
try {
return loadAllDeepFromCursor(cursor);
} finally {
cursor.close();
}
}
/** A raw-style query where you can pass any WHERE clause and arguments. */
public List<SaleOrderItemAttributeValue> queryDeep(String where, String... selectionArg) {
Cursor cursor = db.rawQuery(getSelectDeep() + where, selectionArg);
return loadDeepAllAndCloseCursor(cursor);
}
}
| [
"[email protected]"
] | |
47ad05f4a894ba5ffbdc579611eb8720fcbe777f | 8df82572c8dd4859e282709258e35c08dfe85946 | /rss-web-gwt/src/main/java/app/engine/rss/shared/dto/FeedDTO.java | 5ce20f3e8d06a9c893d392fe10dd44ab7b2f068b | [] | no_license | a-spichakou/cloudrss | fa62c4d97f5d2d93c3d2ec2751f6dbe498d854eb | 972a38cc0d0d9c13abd28d825ed7901b274678ee | refs/heads/master | 2020-04-10T05:21:56.481240 | 2013-07-18T15:25:04 | 2013-07-18T15:25:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,087 | java | package app.engine.rss.shared.dto;
import java.io.Serializable;
public class FeedDTO extends HasDummyEmpty<FeedDTO> implements Serializable {
private static final long serialVersionUID = -7303620111119176580L;
public static FeedDTO EMPTY = new FeedDTO();
private Long id;
private String title;
private String link;
private String description;
private String imageUrl;
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 getLink() {
return link;
}
public void setLink(String link) {
this.link = link;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getImageUrl() {
return imageUrl;
}
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}
public FeedDTO getEmpty() {
return EMPTY;
}
}
| [
"[email protected]"
] | |
40b523f98141edad1453efebfa7ff9b1198a0618 | 4af0d59985f066c6152b6ff4a814b5143eedc5f7 | /java/jacoco_demo/src/main/java/jacoco/jacoco_demo/Calculator.java | be2a4e8b0bfff8004c8af577530a8d7d9094c08e | [] | no_license | linjiannan/captain | 761bb0f5cd9dfe754c41b9eaff63f6adbad3496f | 1e84e75f46d12407cc2bb971e446a60b6d88a4f4 | refs/heads/master | 2021-07-08T23:51:51.967790 | 2018-12-06T13:05:02 | 2018-12-06T13:05:02 | 129,474,560 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 161 | java | package jacoco.jacoco_demo;
public class Calculator {
public int add(int a, int b) {
return a + b;
}
public int sub(int a, int b) {
return a - b;
}
} | [
"[email protected]"
] | |
7e196e808d758592db0a103a5360cfadb0ec9fff | e975581e7dbcb4ab1d3aa9f8bb52477f499d187f | /sdk/resourcemanager/azure-resourcemanager-samples/src/test/java/com/azure/resourcemanager/samples/TrafficManagerSampleTests.java | 04b4626856edb10748b2e634f597ef1b1bc5a2bb | [
"BSD-3-Clause",
"LicenseRef-scancode-warranty-disclaimer",
"LGPL-2.1-or-later",
"Apache-2.0",
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-generic-cla"
] | permissive | sjkwak/azure-sdk-for-java | 0ea0c53dd2fb82ae4af98bf58ae77ea6713530c9 | 47082f583dbc1b2c6cbdeb92fa5195cac8989f22 | refs/heads/master | 2021-08-04T12:05:33.568055 | 2020-09-14T20:07:21 | 2020-09-14T20:07:21 | 185,103,647 | 0 | 0 | MIT | 2019-05-06T01:31:37 | 2019-05-06T01:31:36 | null | UTF-8 | Java | false | false | 1,043 | java | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.resourcemanager.samples;
import com.azure.core.test.annotation.DoNotRecord;
import com.azure.resourcemanager.trafficmanager.samples.ManageSimpleTrafficManager;
import com.azure.resourcemanager.trafficmanager.samples.ManageTrafficManager;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import java.io.IOException;
public class TrafficManagerSampleTests extends SamplesTestBase {
@Test
public void testManageSimpleTrafficManager() {
if (isPlaybackMode()) {
return; // TODO: fix playback random fail
}
Assertions.assertTrue(ManageSimpleTrafficManager.runSample(azure));
}
@Test
@DoNotRecord
public void testManageTrafficManager() throws IOException {
if (this.skipInPlayback()) {
// sample creates certificate
return;
}
Assertions.assertTrue(ManageTrafficManager.runSample(azure));
}
}
| [
"[email protected]"
] | |
f9a7a67e99e27370f7b53757916d7f693214f2b2 | 79676535ae5142b798bd836be97d3ba0f8c1e6de | /TP5/sources/CH/ifa/draw/standard/RelativeLocator.java | 470a318d380a98d7fc757d4ebdde11aa501534e8 | [
"LicenseRef-scancode-other-permissive"
] | permissive | clement0210/LOG8430 | e183afc0154a92627fe5b9c9b9ac77df31ac4b80 | eb7cf1a9434a9fbd93352016448ecd8e7e92d095 | refs/heads/master | 2021-01-13T02:37:49.282303 | 2014-04-12T05:01:33 | 2014-04-12T05:01:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,384 | java | /*
* @(#)RelativeLocator.java 5.1
*
*/
package CH.ifa.draw.standard;
import java.awt.*;
import java.io.IOException;
import CH.ifa.draw.framework.*;
import CH.ifa.draw.util.*;
/**
* A locator that specfies a point that is relative to the bounds
* of a figure.
*/
public class RelativeLocator extends AbstractLocator {
/*
* Serialization support.
*/
private static final long serialVersionUID = 2619148876087898602L;
private int relativeLocatorSerializedDataVersion = 1;
double fRelativeX;
double fRelativeY;
public RelativeLocator() {
fRelativeX = 0.0;
fRelativeY = 0.0;
}
public RelativeLocator(double relativeX, double relativeY) {
fRelativeX = relativeX;
fRelativeY = relativeY;
}
public Point locate(Figure owner) {
Rectangle r = owner.displayBox();
return new Point(
r.x + (int)(r.width*fRelativeX),
r.y + (int)(r.height*fRelativeY)
);
}
public void write(StorableOutput dw) {
super.write(dw);
dw.writeDouble(fRelativeX);
dw.writeDouble(fRelativeY);
}
public void read(StorableInput dr) throws IOException {
super.read(dr);
fRelativeX = dr.readDouble();
fRelativeY = dr.readDouble();
}
static public Locator east() {
return new RelativeLocator(1.0, 0.5);
}
/**
* North.
*/
static public Locator north() {
return new RelativeLocator(0.5, 0.0);
}
/**
* West.
*/
static public Locator west() {
return new RelativeLocator(0.0, 0.5);
}
/**
* North east.
*/
static public Locator northEast() {
return new RelativeLocator(1.0, 0.0);
}
/**
* North west.
*/
static public Locator northWest() {
return new RelativeLocator(0.0, 0.0);
}
/**
* South.
*/
static public Locator south() {
return new RelativeLocator(0.5, 1.0);
}
/**
* South east.
*/
static public Locator southEast() {
return new RelativeLocator(1.0, 1.0);
}
/**
* South west.
*/
static public Locator southWest() {
return new RelativeLocator(0.0, 1.0);
}
/**
* Center.
*/
static public Locator center() {
return new RelativeLocator(0.5, 0.5);
}
}
| [
"[email protected]"
] | |
e96259fdee57ddb0028f714fe34d6032e61ec499 | e185d310aa5c5dc797aa43fdee0330bb97d4fced | /src/week2/day3/Exercise.java | 47310c2b23b309eadb80cc0393d08eb38867dd04 | [] | no_license | Ligit2/bootcamp | e38f8cb5634c7f4bc554e122d2e81f13b1699121 | 2fc772146e791509004a9996cb12f77c44e59af4 | refs/heads/master | 2023-06-02T19:01:54.466330 | 2021-06-28T09:00:47 | 2021-06-28T09:00:47 | 379,973,047 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 312 | java | package week2.day3;
public class Exercise {
public static void main(String[] args) {
int []arr = new int[1000];
for(int i=0; i<1000; i++)
{
arr[i] = 7* (i+1);
}
for(int i=0;i<1000; i++)
{
System.out.println(arr[i]);
}
}
}
| [
"[email protected]"
] | |
1d53cd72e16c45a3d9629812c4d743044386412a | bd0ffedf03d5e66d942971e6a31e9131b146d647 | /middleware/src/main/java/br/ufrn/dimap/middleware/remotting/impl/RuntimeRemoteError.java | 869d09afe7f681a71b2dcb9093c2c7ef72706cc5 | [] | no_license | gbrsouza/potigware | 24300f0b1ff8450bda09e580b4cb305584cb5a21 | 207c62561248b3f2631f5ccf20ce7f46f4dc92b6 | refs/heads/master | 2021-10-01T17:47:43.918304 | 2018-11-27T20:33:50 | 2018-11-27T20:33:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,721 | java | package br.ufrn.dimap.middleware.remotting.impl;
/**
* This class represents an error that occurred
* at some point in the remote communication.
* It can be caused by several unknown factors during development time.
*
* Note: Inheriting from RuntimeException this class do NOT requires
* the programmer to handle the exception
*
* @author MatheusAlvesA
*/
public class RuntimeRemoteError extends RuntimeException {
private static final long serialVersionUID = 1L;
private String state;
/*
* Overwriting java exception constructors to grant all features.
* */
public RuntimeRemoteError() {/* empty */}
public RuntimeRemoteError(String arg0) {super(arg0);}
public RuntimeRemoteError(Throwable arg0) {super(arg0);}
public RuntimeRemoteError(String arg0, Throwable arg1) {super(arg0, arg1);}
public RuntimeRemoteError(String arg0, Throwable arg1, boolean arg2, boolean arg3) {super(arg0, arg1, arg2, arg3);}
/**
* This function saves the state of a variable during the occurrence of the exception.
*
* @param varName - Variable's name.
* @param value - Value of the variable.
*/
public void addState(String varName, Object value) {
if(this.state == null)
this.state = "";
if(value != null)
this.state += "Var ("+value.getClass().getName()+") "+varName+" = "+value.toString()+"\n";
else
this.state += "Var (???) "+varName+" = NULL\n";
}
/**
* This function returns the state of the method variables at the time the exception occurred.
*
* @return The state serialized of the method
*/
public String getState() {
if(this.state == null)
return "Nothing save on state\n";
return this.state;
}
} | [
"[email protected]"
] | |
eebe14d926db74a1e2638f34f528ea1751d55063 | ae51781505e107b09f1d209c439636876cba4e3b | /src/main/java/com/crud/tasks/mapper/CreatedTrelloCardDto.java | 8bc7f4195b66e478fa8f6912d6c7f0ca2d049d90 | [] | no_license | UserWeronikaGarbarz/Task-project | 7fef440b9d0a90c547fe0de447864a94772daa51 | c9622ca89fb1f61dc28af45d61b951b3bdd3600e | refs/heads/master | 2021-04-05T22:40:22.109850 | 2020-05-09T14:26:01 | 2020-05-09T14:26:01 | 248,609,218 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 643 | java | package com.crud.tasks.mapper;
import com.crud.tasks.badges.Badges;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class CreatedTrelloCardDto {
@JsonProperty("id")
private String id;
@JsonProperty("name")
private String name;
@JsonProperty("shortUrl")
private String shortUrl;
@JsonProperty("badges")
Badges badges;
}
| [
"[email protected]"
] | |
d4028f252204121375a512f570d84e650cdc13c5 | d6927f7405052c80ef894e9739dbd3af4db3c0de | /GeekQuote/app/src/main/java/fr/myschool/geekquote/activity/QuoteActivity.java | ff08955084e922d4f8555c75a35c96ef9bdc03e7 | [] | no_license | TavernierAlicia/Android_dev_courses-06-04-2020 | 18e22f63822ea91e89b80451a62958d1ef894222 | 68e8f767421d3cb176350cabc6bf954ed37d2f12 | refs/heads/master | 2021-05-24T15:23:32.343667 | 2020-04-10T21:29:53 | 2020-04-10T21:29:53 | 253,627,175 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,031 | java | package fr.myschool.geekquote.activity;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.RatingBar;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import fr.myschool.geekquote.BuildConfig;
import fr.myschool.geekquote.R;
import fr.myschool.geekquote.model.Quote;
public class QuoteActivity extends AppCompatActivity {
public static final String TAG = "GeekQuote";
SharedPreferences sharedPref;
int position;
Quote quote;
Button bt_rate_cancel, bt_rate_validate;
TextView tv_quote_activity, tv_quote_rate, tv_quote_date;
RatingBar ratingBar;
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.custom_menu, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == R.id.logout) {
final Context context = this;
sharedPref = getSharedPreferences(BuildConfig.APPLICATION_ID+".SharedPreferences", Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPref.edit();
editor.putBoolean("isUserConnected", false);
editor.apply();
Log.e("GeekQuote", "Connected: "+sharedPref.getBoolean("isUserConnected", false));
Intent intent = new Intent(context, ConnectActivity.class);
startActivity(intent);
finishAffinity();
}
return super.onOptionsItemSelected(item);
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.quote_activity);
tv_quote_activity = findViewById(R.id.tv_quote_activity);
tv_quote_rate = findViewById(R.id.tv_quote_rate);
tv_quote_date = findViewById(R.id.tv_quote_date);
ratingBar = findViewById(R.id.ratingBar);
bt_rate_cancel = findViewById(R.id.bt_rate_cancel);
bt_rate_validate = findViewById(R.id.bt_rate_validate);
bt_rate_cancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.e("GeekQuote", "Rating"+quote.getRating());
setResult(Activity.RESULT_CANCELED);
finish();
}
});
bt_rate_validate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
quote.setRating((int) ratingBar.getRating());
Intent returnIntent = new Intent();
returnIntent.putExtra("INDEX", position);
returnIntent.putExtra("RESULT_QUOTE", (Serializable) quote);
setResult(Activity.RESULT_OK, returnIntent);
finish();
Log.e("GeekQuote", "Rating"+quote.getRating());
}
});
Log.d("GeekQuote", "Create view");
//Set data
Bundle bundle = getIntent().getExtras();
if (bundle != null) {
this.quote = ((Quote) bundle.getSerializable("QUOTE"));
position = bundle.getInt("INDEX");
int rate = bundle.getInt("Rate");
try {
String date = bundle.getString("Date");
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy", Locale.FRANCE);
Date formattedDate = simpleDateFormat.parse(this.quote.getCreationDate().toString());
tv_quote_date.setText(formattedDate.toString());
} catch (Exception e) {
Date dateToParse = new Date() ;
String newstring = new SimpleDateFormat("dd/MM/yyyy").format(dateToParse);
tv_quote_date.setText(newstring);
}
//set data
Log.e("GeekQuote", "Rate: "+quote.getRating());
tv_quote_activity.setText(this.quote.getStrQuote());
ratingBar.setRating((float) quote.getRating());
Log.e("GeekQuote", "GetText: "+tv_quote_rate.getText());
Log.e("GeekQuote", "GetText: "+tv_quote_date.getText());
}
}
@Override
public void finishActivity(int requestCode) {
if (requestCode == 1) {
setResult(Activity.RESULT_OK);
Log.d("GeekQuote", "Activity closed");
}
super.finishActivity(requestCode);
}
}
| [
"[email protected]"
] | |
56ee6780c9ee3c0d51cb812007edaf88ee26f189 | 10f5a3d8854abd7e1d7da31aaa1167fa88841c89 | /com.ledger.core/src/main/java/com/ledger/interfaces/web/facade/dto/assembler/finance/management/OpeningBalanceFlagDTOAssembler.java | 054f9548fcb680656c8ff2b885c77b2145ea7b2f | [] | no_license | bayuhendra/Project-ladger | e08ab0b7afb7e6f081ebf074fe2247c4b9a5891d | 8b228bf88f4d473f732d046a2a69760badb8d846 | refs/heads/master | 2021-05-10T09:41:39.624713 | 2018-04-19T08:32:45 | 2018-04-19T08:32:45 | 118,933,801 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,934 | java | package com.ledger.interfaces.web.facade.dto.assembler.finance.management;
import com.ledger.common.dto.finance.management.OpeningBalanceFlagDTO;
import com.ledger.common.dto.finance.management.OpeningBalanceFlagDTOBuilder;
import com.ledger.domain.financial.management.OpeningBalanceFlag;
import com.ledger.domain.financial.management.OpeningBalanceFlagBuilder;
import com.ledger.shared.object.IObjectAssembler;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author lintang
*/
public class OpeningBalanceFlagDTOAssembler implements IObjectAssembler<OpeningBalanceFlag, OpeningBalanceFlagDTO> {
@Override
public OpeningBalanceFlagDTO toDTO(OpeningBalanceFlag domainObject) {
return new OpeningBalanceFlagDTOBuilder()
.setUserID(domainObject.getUserID())
.setOpeningBalanceFlagID(domainObject.getOpeningBalanceFlagID())
.setIsFormSaldo(domainObject.isIsFormSaldo())
.setIsFormHutang(domainObject.isIsFormHutang())
.setIsFormPiutang(domainObject.isIsFormPiutang())
.setIsFormPersediaan(domainObject.isIsFormPersediaan())
.setIsFormActiva(domainObject.isIsFormActiva())
.setCreatedBy(domainObject.getCreatedBy())
.setCreatedDate(domainObject.getCreatedDate())
.setModifiedBy(domainObject.getModifiedBy())
.setModifiedDate(domainObject.getModifiedDate())
.createOpeningBalanceFlagDTO();
}
@Override
public OpeningBalanceFlag toDomain(OpeningBalanceFlagDTO dtoObject) {
return new OpeningBalanceFlagBuilder()
.setUserID(dtoObject.getUserID())
.setOpeningBalanceFlagID(dtoObject.getOpeningBalanceFlagID())
.setIsFormSaldo(dtoObject.isIsFormSaldo())
.setIsFormHutang(dtoObject.isIsFormHutang())
.setIsFormPiutang(dtoObject.isIsFormPiutang())
.setIsFormPersediaan(dtoObject.isIsFormPersediaan())
.setIsFormActiva(dtoObject.isIsFormActiva())
.setCreatedBy(dtoObject.getCreatedBy())
.setCreatedDate(dtoObject.getCreatedDate())
.setModifiedBy(dtoObject.getModifiedBy())
.setModifiedDate(dtoObject.getModifiedDate())
.createOpeningBalanceFlag();
}
public List<OpeningBalanceFlag> toDomains(List<OpeningBalanceFlagDTO> arg0) {
List<OpeningBalanceFlag> res = new ArrayList<>();
for (OpeningBalanceFlagDTO t : arg0) {
res.add(new OpeningBalanceFlagDTOAssembler().toDomain(t));
}
return res;
}
public List<OpeningBalanceFlagDTO> toDTOs(List<OpeningBalanceFlag> arg0) {
List<OpeningBalanceFlagDTO> res = new ArrayList<>();
for (OpeningBalanceFlag t : arg0) {
res.add(this.toDTO(t));
}
return res;
}
}
| [
"[email protected]"
] | |
22aaacd0ee19cc34ab8faa009fffb048df7606d6 | 9299e432bc3634c98a27a5c6ffb520b6ec87642e | /mooc-2013-OOProgrammingWithJava-PART1/week4-083.HangmanLogic/src/TestProgram.java | 610e6598f82ea1fa8a55406b4ff91871b612f4de | [] | no_license | A-Slimani/MoocJavaPart1 | 78600cc41d9daa3d8aa87c96818d368bb9328e9b | 8c1607173c4a6931a17f973b28a80938531538e1 | refs/heads/master | 2022-01-05T15:03:19.520174 | 2018-10-30T11:30:22 | 2018-10-30T11:30:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 684 | java |
public class TestProgram {
public static void main(String[] args) {
HangmanLogic l = new HangmanLogic("park");
System.out.println("Word at start: " + l.hiddenWord());
//System.out.println("Let us guess: A, D, S, F, D");
l.guessLetter("A");
l.guessLetter("A");
l.guessLetter("A");
l.guessLetter("S");
l.guessLetter("F");
l.guessLetter("D");
l.guessLetter("X");
l.guessLetter("Y");
System.out.println("Guessed letters: " + l.guessedLetters());
System.out.println("Number of faults: " + l.numberOfFaults());
System.out.println("Word is: " + l.hiddenWord());
}
}
| [
"[email protected]"
] | |
90b88147429fa90fe337674155c51de707fb4b44 | 7d538d0f550a70d8d25b5ff9134b0c5f4b72edf0 | /Platoff, Matt/gridworld/critters/BlusterCritter.java | 111597d1e943d2623dc823f9f578deedf01a61d6 | [] | no_license | mattplatoff/chat-distroFactorer | 7c8b11648078582c7c618b870261399a9cbb2228 | 699fc49440e18c675941f661955b91578498a4f6 | refs/heads/master | 2016-09-07T20:33:13.224314 | 2014-12-16T23:04:58 | 2014-12-16T23:04:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 718 | java | package critters;
import java.util.ArrayList;
import info.gridworld.actor.Actor;
import info.gridworld.actor.Critter;
import info.gridworld.grid.Location;
public class BlusterCritter extends Critter {
private int c;
public BlusterCritter(int c) {
this.c = c;
}
public ArrayList<Actor> getActors() {
ArrayList<Location> spaces = this.getGrid().getValidAdjacentLocations(
this.getLocation());
ArrayList<Actor> neighbors = new ArrayList<Actor>();
for (Location l : spaces) {
neighbors.addAll(this.getGrid().getNeighbors(l));
}
if (neighbors.size()>c)
this.setColor(this.getColor().darker());
else if (neighbors.size()<c){
this.setColor(this.getColor().brighter());
}
return neighbors;
}
}
| [
"[email protected]"
] | |
fe675259a5df2cbc911153e1c66667fb4d6d8e59 | bf76ebe02527b728313664a9f6dfdfe1411e6a81 | /infer/tests/codetoanalyze/java/performance/EvilCfg.java | 016675ab5f71fc90728f944205fb229fe8397760 | [
"MIT",
"GPL-1.0-or-later"
] | permissive | facebook/infer | 30d13fd15e1d1c333800369b9120ac14c1e0c9e5 | 80a888ee5c534a40d4a178e5da3eaa61a3334ad1 | refs/heads/main | 2023-08-31T11:34:35.419621 | 2023-08-31T08:56:41 | 2023-08-31T08:56:41 | 29,857,799 | 15,855 | 2,632 | MIT | 2023-08-24T09:51:53 | 2015-01-26T11:19:13 | OCaml | UTF-8 | Java | false | false | 694 | java | /*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
class EvilCfg {
public void foo_FP(int i, int j, boolean b) {
int k, l, m, n;
k = b ? i : j;
l = b ? k : i;
m = b ? k : l;
n = b ? m : k;
for (; n < 10; n++) {}
k = b ? i : j;
l = b ? k : i;
m = b ? k : l;
n = b ? m : k;
for (; n < 10; n++) {}
k = b ? i : j;
l = b ? k : i;
m = b ? k : l;
n = b ? m : k;
for (; n < 10; n++) {}
k = b ? i : j;
l = b ? k : i;
m = b ? k : l;
n = b ? m : k;
for (; n < 10; n++) {}
}
}
| [
"[email protected]"
] | |
c49f1eef334045e7634d5e81a20f1e221711c64b | 4b5a86659d06d9367b256cf845a697f85aec1819 | /xr-base/xr-base-common/src/main/java/com/xr/base/common/util/Utils.java | 24ac79f953aa4d9651adb94b0549a155a0e1057c | [
"MIT"
] | permissive | forvoyager/xr-message-service | 1d5a29363826600c01009c80b87328169656f273 | bf11b57ad5923d08550c27499a8b738924a0139e | refs/heads/master | 2022-09-09T16:42:35.607450 | 2020-02-28T13:01:06 | 2020-02-28T13:01:06 | 192,032,636 | 0 | 0 | MIT | 2022-07-15T20:48:52 | 2019-06-15T03:36:18 | Java | UTF-8 | Java | false | false | 1,721 | java | package com.xr.base.common.util;
import com.xr.base.common.enums.ResultCodeEnum;
import com.xr.base.common.exception.BaseException;
import java.security.MessageDigest;
import java.util.HashMap;
import java.util.Map;
/**
* <b>description</b>:工具类 <br>
* <b>author</b>:[email protected]
*/
public final class Utils {
private static final char hexDigits[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
public static void throwsBizException(String message) throws Exception {
throw new BaseException(ResultCodeEnum.ILLEGAL_STATUS, message);
}
public static <K, V> Map<K, V> newHashMap(Object... args) {
HashMap map = new HashMap();
if (args != null) {
for (int i = 0; i < args.length; i++) {
map.put(args[i], args[++i]);
}
}
return map;
}
/**
* Md5 加密工具
*
* @param content String not null
* @return 加密后的 MD5 值 32位大写的
*/
public static String md5(String content) throws Exception {
AssertUtils.notEmpty(content, "encryption content is empty.");
byte[] btInput = content.getBytes();
// 获得MD5摘要算法的 MessageDigest 对象
MessageDigest mdInst = MessageDigest.getInstance("MD5");
// 使用指定的字节更新摘要
mdInst.update(btInput);
// 获得密文
byte[] md = mdInst.digest();
// 把密文转换成十六进制的字符串形式
int j = md.length;
char str[] = new char[j * 2];
int k = 0;
for (int i = 0; i < j; i++) {
byte byte0 = md[i];
str[k++] = hexDigits[byte0 >>> 4 & 0xf];
str[k++] = hexDigits[byte0 & 0xf];
}
return new String(str);
}
private Utils(){}
}
| [
"[email protected]"
] | |
66dda3be4580bd5abff22818e91511463af7bd27 | 607a1ec16e55803e25669948646b944b4da7160c | /src/test/java/com/qait/demo/tests/TestLevel4_IMDbApplication_DSLTest.java | 5e464d27229281a9217d886cd278ec73057be4a0 | [] | no_license | jaspal29/tap-16 | d61378a3f6b63ab2dc1ed8fb6783ca8b4dcec6be | 885a91b225051c211fb828fb9dd12c725c7e1d02 | refs/heads/master | 2021-01-12T11:09:10.594686 | 2016-11-04T14:26:18 | 2016-11-04T14:26:18 | 72,852,160 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,975 | java | package com.qait.demo.tests;
//import com.imdb.web.*;
//import com.imdb.api.*;
import org.testng.annotations.*;
import com.qait.demo.keywords.IMDbSearchApi;
import com.qait.demo.keywords.IMDbWebLandingPage;
import com.qait.demo.keywords.IMDbWebResultList;
import static org.assertj.core.api.Assertions.*;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.json.JSONObject;
/* IMDB DSL */
/**
*
* @author Ramandeep <[email protected]>
*/
public class TestLevel4_IMDbApplication_DSLTest {
WebDriver browser;
@BeforeClass
public void setUp(){
System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
browser = new ChromeDriver();
}
@AfterClass
public void tearDown(){
browser.quit();
}
@DataProvider
public String[][] movieTitles(){
return new String[][] {
{"The Dark Knight"}
};
}
/**
* Test for search on IMDb.com
* @param movie
*/
@Test(dataProvider="movieTitles")
public void web_search_for_title_should_display_list_of_macthing_movies(
String movie){
IMDbWebResultList imdbResultList = (new IMDbWebLandingPage(browser))
.searchFor(movie);
assertThat(imdbResultList.getResult(0).getTitle()).startsWith(movie);
}
/**
* Test for unofficial IMDB API @ http://www.omdbapi.com
* @param movie
* @throws Exception
*/
@Test(dataProvider="movieTitles")
public void api_search_for_title_should_return_list_of_matching_movies(
String movie) throws Exception{
JSONObject resultList = new IMDbSearchApi().searchForMovie(movie);
assertThat(resultList.getJSONArray("Search")
.getJSONObject(0)
.get("Title").toString()
).startsWith(movie);
}
}
| [
"[email protected]"
] | |
0b5ff293448591e1678dfecf6dc710229d99e333 | 0adcb787c2d7b3bbf81f066526b49653f9c8db40 | /src/main/java/com/alipay/api/domain/LoanApplyBudgetVO.java | a3e4f6e6446dc1ffe17e6998dbfcdd9aec213534 | [
"Apache-2.0"
] | permissive | yikey/alipay-sdk-java-all | 1cdca570c1184778c6f3cad16fe0bcb6e02d2484 | 91d84898512c5a4b29c707b0d8d0cd972610b79b | refs/heads/master | 2020-05-22T13:40:11.064476 | 2019-04-11T14:11:02 | 2019-04-11T14:11:02 | 186,365,665 | 1 | 0 | null | 2019-05-13T07:16:09 | 2019-05-13T07:16:08 | null | UTF-8 | Java | false | false | 2,692 | java | package com.alipay.api.domain;
import java.util.Date;
import java.util.List;
import com.alipay.api.AlipayObject;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.internal.mapping.ApiListField;
/**
* 贷款申请预算信息
*
* @author auto create
* @since 1.0, 2018-11-13 19:45:45
*/
public class LoanApplyBudgetVO extends AlipayObject {
private static final long serialVersionUID = 5445263969439731791L;
/**
* 贷款申请金额
*/
@ApiField("apply_amt")
private String applyAmt;
/**
* 申请时间,即用户提交贷款申请的时间
*/
@ApiField("apply_date")
private Date applyDate;
/**
* 贷款申请受理单号
*/
@ApiField("apply_receipt_no")
private String applyReceiptNo;
/**
* 还款预算
*/
@ApiField("budget")
private BudgetVO budget;
/**
* 当前期次
*/
@ApiField("current_term")
private Long currentTerm;
/**
* 当前期次的还款日
*/
@ApiField("current_term_repay_date")
private Date currentTermRepayDate;
/**
* 贷款期限,包含贷款期数和期数单位
*/
@ApiField("loan_term")
private LoanTerm loanTerm;
/**
* 贷后还款分期计划
*/
@ApiListField("repay_plan_term_list")
@ApiField("repay_plan_term_v_o")
private List<RepayPlanTermVO> repayPlanTermList;
public String getApplyAmt() {
return this.applyAmt;
}
public void setApplyAmt(String applyAmt) {
this.applyAmt = applyAmt;
}
public Date getApplyDate() {
return this.applyDate;
}
public void setApplyDate(Date applyDate) {
this.applyDate = applyDate;
}
public String getApplyReceiptNo() {
return this.applyReceiptNo;
}
public void setApplyReceiptNo(String applyReceiptNo) {
this.applyReceiptNo = applyReceiptNo;
}
public BudgetVO getBudget() {
return this.budget;
}
public void setBudget(BudgetVO budget) {
this.budget = budget;
}
public Long getCurrentTerm() {
return this.currentTerm;
}
public void setCurrentTerm(Long currentTerm) {
this.currentTerm = currentTerm;
}
public Date getCurrentTermRepayDate() {
return this.currentTermRepayDate;
}
public void setCurrentTermRepayDate(Date currentTermRepayDate) {
this.currentTermRepayDate = currentTermRepayDate;
}
public LoanTerm getLoanTerm() {
return this.loanTerm;
}
public void setLoanTerm(LoanTerm loanTerm) {
this.loanTerm = loanTerm;
}
public List<RepayPlanTermVO> getRepayPlanTermList() {
return this.repayPlanTermList;
}
public void setRepayPlanTermList(List<RepayPlanTermVO> repayPlanTermList) {
this.repayPlanTermList = repayPlanTermList;
}
}
| [
"[email protected]"
] | |
4f66a40e0115006be85f457611f1fcf847abe608 | c1b5f73d8fda0bfc435245c3f5286034fb9f9cd2 | /app/src/main/java/com/example/xumengyin/mypractice/view/CardListView.java | 95181e0fc05ae53d9e7bc775a931fe77cdd01262 | [] | no_license | xumengyin/mypractice | 649a243fbb4be4356a365b59b7994222e2c5f07e | 1cc86116b5bd8a4390c329c8f85fea783cdd59f2 | refs/heads/master | 2021-10-26T06:25:48.974210 | 2019-04-11T05:38:37 | 2019-04-11T05:38:37 | 115,341,397 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,072 | java | package com.example.xumengyin.mypractice.view;
import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.support.annotation.Nullable;
import android.support.design.widget.CoordinatorLayout;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import com.example.xumengyin.mypractice.MainActivity;
import com.example.xumengyin.mypractice.R;
import com.example.xumengyin.mypractice.behavior.CardBehavior;
public class CardListView extends FrameLayout
{
int headHeight;
TextView textView;
public CardListView(Context context, @Nullable AttributeSet attrs)
{
super(context, attrs);
View v = LayoutInflater.from(context).inflate(R.layout.card_layout, this);
RecyclerView recyclerView = v.findViewById(R.id.recycleview);
textView = v.findViewById(R.id.title);
TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.CardListView);
textView.setBackground(array.getDrawable(R.styleable.CardListView_bgcolor));
textView.setText(array.getString(R.styleable.CardListView_android_text));
recyclerView.setAdapter(new Myadapter(context));
recyclerView.setLayoutManager(new LinearLayoutManager(context));
setBackgroundColor(Color.WHITE);
}
public int getHeadHeight()
{
return headHeight;
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh)
{
super.onSizeChanged(w, h, oldw, oldh);
headHeight=textView.getMeasuredHeight();
}
private class MyHolder extends RecyclerView.ViewHolder
{
Button button;
public MyHolder(View itemView)
{
super(itemView);
button = itemView.findViewById(R.id.button);
}
}
private class Myadapter extends RecyclerView.Adapter<MyHolder>
{
LayoutInflater inflater;
public Myadapter(Context context)
{
inflater = LayoutInflater.from(context);
}
@Override
public MyHolder onCreateViewHolder(ViewGroup parent, int viewType)
{
MyHolder holder = new MyHolder(inflater.inflate(R.layout.menu_item, parent, false));
return holder;
}
@Override
public void onBindViewHolder(final MyHolder holder, final int position)
{
holder.button.setText(data[position]);
holder.button.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view)
{
//holder.itemView.getContext().startActivity(new Intent(holder.itemView.getContext(),listdata.get(position).activity));
}
});
}
@Override
public int getItemCount()
{
return data.length;
}
}
static String[] data = {"test1", "test2", "test3", "test4", "test5", "test6", "test7", "test8", "test9", "test10", "test11", "test12", "test13", "test14", "test15"};
}
| [
"xumengyin"
] | xumengyin |
5c2004058625e2852b3032b140ddb3095ea096db | bb2c7fc54e4e753429e658025d22afe0d995b5de | /core/src/co/circlewave/cirzle/board/component/Sign.java | 116a770746fedcadfd857ea2bcd428bfd6e0c831 | [] | no_license | Ashraf-Al-Aodat/Cirzle | 770687414fd9b6b4764c4c73b000a33eedea3ba0 | 0c7712c9a649fc7d8ee1ca540d30f0a2d9e619f1 | refs/heads/master | 2023-03-24T08:04:20.461529 | 2021-03-23T21:45:16 | 2021-03-23T21:45:16 | 350,272,901 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,030 | java | package co.circlewave.cirzle.board.component;
import co.circlewave.cirzle.board.Tile;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
import com.badlogic.gdx.utils.Align;
public class Sign extends Actor {
private final TextureRegion region;
private final Tile tile;
private boolean link;
public Sign(final Tile tile, final Color color, final TextureAtlas atlas) {
setColor(color);
setBounds(tile.getX(), tile.getY(), tile.getWidth(), tile.getHeight());
setOrigin(Align.center);
setScale(-0.6f);
addAction(Actions.sequence(Actions.delay((float) Math.random()), Actions.run(this::startAnimation)));
this.region = atlas.findRegion("donut");
this.tile = tile;
this.link = false;
}
public boolean isPieceColorMatched() {
final boolean match = getColor().equals(tile.getPiece().getColor());
if (!match && getActions().isEmpty()) {
startAnimation();
}
return match;
}
public void link() {
link = true;
}
public void unlink() {
link = false;
}
public boolean isLink() {
return link;
}
public Tile getTile() {
return tile;
}
private void startAnimation() {
addAction(Actions.sequence(Actions.scaleBy(-0.1f, -0.1f, 0.25f),
Actions.scaleBy(0.1f, 0.1f, 0.5f), Actions.run(() -> {
if (!getColor().equals(tile.getPiece().getColor())) {
startAnimation();
}
})));
}
@Override
public void act(float delta) {
super.act(delta);
toBack();
}
@Override
public Actor hit(float x, float y, boolean touchable) {
return null;
}
@Override
public void draw(final Batch batch, final float parentAlpha) {
batch.setColor(Color.DARK_GRAY.r, Color.DARK_GRAY.g, Color.DARK_GRAY.b, Color.DARK_GRAY.a * parentAlpha);
batch.draw(region, getX(), getShadowY(), getOriginX(), getOriginY(), getWidth(), getHeight(), getScaleX(), getScaleY(), getRotation());
batch.setColor(getColor().r, getColor().g, getColor().b, getColor().a * parentAlpha);
batch.draw(region, getX(), getY(), getOriginX(), getOriginY(), getWidth(), getHeight(), getScaleX(), getScaleY(), getRotation());
batch.setColor(Color.WHITE);
}
private float getShadowY() {
return getY() - getParent().getWidth() / 250;
}
@Override
public boolean equals(final Object other) {
if (this == other) {
return true;
}
if (!(other instanceof Sign)) {
return false;
}
final Sign otherSign = (Sign) other;
return this.tile.equals(otherSign.tile);
}
}
| [
"[email protected]"
] | |
bf02fac9d2a5a55d51f61d84a2ae583ca5d80361 | b9ec00dcc4ce9a93eec71e8985eeed7824f3b339 | /app/src/main/java/com/patrickwallin/projects/bandsintown_demo/data/ArtistsContentProvider.java | 73c6e4181fb9078aec5216a3a02a0f3c1dd36ee8 | [] | no_license | Patrick-Wallin/BandsInTown-Demo | 68d87b8da2e5013fb36b16313c7c3c5701c03cb1 | b244256e1bc66ff9c59fe6716d28d6205f1f8fb5 | refs/heads/master | 2021-05-15T21:56:52.590315 | 2017-10-16T07:28:35 | 2017-10-16T07:28:35 | 106,621,124 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,735 | java | package com.patrickwallin.projects.bandsintown_demo.data;
import android.content.ContentProvider;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
/**
* Created by piwal on 10/13/2017.
*/
public class ArtistsContentProvider extends ContentProvider {
public static final int ARTISTS_FAVORITE = 100;
public static final int ARTISTS_FAVORITE_WITH_ID = 101;
private ArtistsDBHelper mArtistsDBHelper;
private static UriMatcher uriMatcher = buildUriMatcher();
public static UriMatcher buildUriMatcher() {
UriMatcher uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
uriMatcher.addURI(ArtistsFavoritesContract.CONTENT_AUTHORITY, ArtistsFavoritesContract.PATH_FAVORITES, ARTISTS_FAVORITE);
uriMatcher.addURI(ArtistsFavoritesContract.CONTENT_AUTHORITY, ArtistsFavoritesContract.PATH_FAVORITES + "/#", ARTISTS_FAVORITE_WITH_ID);
return uriMatcher;
}
@Override
public boolean onCreate() {
mArtistsDBHelper = new ArtistsDBHelper(getContext());
return false;
}
@Nullable
@Override
public Cursor query(@NonNull Uri uri, @Nullable String[] projection, @Nullable String selection, @Nullable String[] selectionArgs, @Nullable String sortOrder) {
final SQLiteDatabase db = mArtistsDBHelper.getReadableDatabase();
int match = uriMatcher.match(uri);
Cursor cursor = null;
switch(match) {
case ARTISTS_FAVORITE:
cursor = db.query(ArtistsFavoritesContract.ArtistsFavoritesEntry.TABLE_NAME, projection, selection, selectionArgs, null, null, sortOrder);
break;
case ARTISTS_FAVORITE_WITH_ID:
break;
default:
throw new UnsupportedOperationException("Unknown uri: " + uri);
}
if(cursor != null)
cursor.setNotificationUri(getContext().getContentResolver(),uri);
return cursor;
}
@Nullable
@Override
public String getType(@NonNull Uri uri) {
return null;
}
@Nullable
@Override
public Uri insert(@NonNull Uri uri, @Nullable ContentValues contentValues) {
SQLiteDatabase db = mArtistsDBHelper.getWritableDatabase();
int match = uriMatcher.match(uri);
Uri returnUri;
switch (match) {
case ARTISTS_FAVORITE:
long artistsId = db.insert(ArtistsFavoritesContract.ArtistsFavoritesEntry.TABLE_NAME, null, contentValues);
if(artistsId > 0) {
returnUri = ContentUris.withAppendedId(ArtistsFavoritesContract.ArtistsFavoritesEntry.CONTENT_URI,artistsId);
}else {
throw new SQLException("Failed to insert row into " + uri);
}
break;
default:
throw new UnsupportedOperationException("Unknown uri: " + uri);
}
getContext().getContentResolver().notifyChange(uri,null);
return returnUri;
}
@Override
public int delete(@NonNull Uri uri, @Nullable String selection, @Nullable String[] selectionArgs) {
SQLiteDatabase db = mArtistsDBHelper.getWritableDatabase();
int rowsDeleted = 0;
int match = uriMatcher.match(uri);
switch (match) {
case ARTISTS_FAVORITE:
rowsDeleted = db.delete(ArtistsFavoritesContract.ArtistsFavoritesEntry.TABLE_NAME, selection, selectionArgs);
break;
default:
throw new UnsupportedOperationException("Unknown uri: " + uri);
}
getContext().getContentResolver().notifyChange(uri,null);
return rowsDeleted;
}
@Override
public int update(@NonNull Uri uri, @Nullable ContentValues contentValues, @Nullable String selection, @Nullable String[] selectionArgs) {
int rowsUpdated = 0;
SQLiteDatabase db = mArtistsDBHelper.getWritableDatabase();
int match = uriMatcher.match(uri);
switch (match) {
case ARTISTS_FAVORITE:
rowsUpdated = db.update(ArtistsFavoritesContract.ArtistsFavoritesEntry.TABLE_NAME, contentValues, selection,selectionArgs);
break;
default:
throw new UnsupportedOperationException("Unknown uri: " + uri);
}
getContext().getContentResolver().notifyChange(uri,null);
return rowsUpdated;
}
}
| [
"[email protected]"
] | |
beca8af235ef93d7c2f088094942d6ba5a6c6d02 | 584f5e6f4e34a5d825b8fd8c1f9638b720821c7e | /ibdata-type-impls/src/test/java/org/infrastructurebuilder/data/DefaultIBDataStreamTest.java | e098f26d14cfd06efe56351e5385fb554b0c6f7a | [] | no_license | infrastructurebuilder/ibdata-reference-root | 9569412a373391c235fc86f46db3c9a6ba31917b | 81596be310810cde1f8c6389d3cca3df0fa784b0 | refs/heads/master | 2021-06-21T12:59:08.133839 | 2019-12-23T16:40:50 | 2019-12-23T16:40:50 | 209,095,274 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,929 | java | /**
* Copyright © 2019 admin ([email protected])
*
* 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.infrastructurebuilder.data;
import static java.util.Optional.empty;
import static java.util.Optional.of;
import static org.infrastructurebuilder.util.files.DefaultIBChecksumPathType.copyToDeletedOnExitTempChecksumAndPath;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.security.NoSuchAlgorithmException;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
import java.util.function.Supplier;
import org.infrastructurebuilder.IBException;
import org.infrastructurebuilder.data.model.DataStream;
import org.infrastructurebuilder.data.util.files.DefaultTypeToExtensionMapper;
import org.infrastructurebuilder.util.IBUtils;
import org.infrastructurebuilder.util.artifacts.Checksum;
import org.infrastructurebuilder.util.config.TestingPathSupplier;
import org.infrastructurebuilder.util.files.IBChecksumPathType;
import org.infrastructurebuilder.util.files.ThrowingIBChecksumType;
import org.infrastructurebuilder.util.files.ThrowingInputStream;
import org.joor.Reflect;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
public class DefaultIBDataStreamTest {
public final static Logger log = LoggerFactory.getLogger(DefaultIBDataStreamTest.class);
public static final String CHECKSUM = "3b2c63ccb53069e8b0472ba50053fcae7d1cc84ef774ff2b01c8a0658637901b7d91e71534243b5d29ee246e925efb985b4dbd7330ab1ab251d1e1b8848b9c49";
private static final String JPG = "image/jpeg";
private static final String DESC = "Rickrolled";
private static final String NAME = "name";
/**
* Move to IBUtils in next release
* @param ins
* @param target
* @return
*/
public static Checksum copyAndDigest(final InputStream ins, final Path target) {
try (OutputStream outs = Files.newOutputStream(target, StandardOpenOption.TRUNCATE_EXISTING,
StandardOpenOption.WRITE, StandardOpenOption.CREATE)) {
return IBUtils.copyAndDigest(ins, outs);
} catch (IOException | NoSuchAlgorithmException e) {
throw new IBException(e);
}
}
private Path path, path2;
private DefaultIBDataStreamIdentifier identifier, identifier2;
private DefaultIBDataStream ib1;
private Checksum checksum, checksum2;
private Document metadata;
private String mimeType;
private InputStream rick, lines;
private Path p1;
private DefaultIBDataStream ib2;
private DataStream ds;
private IBChecksumPathType cType;
private DataStream ds2;
private final static Date now = new Date();
private static TestingPathSupplier wps = new TestingPathSupplier();
@Before
public void setUp() throws Exception {
p1 = wps.get();
path = p1.resolve(UUID.randomUUID().toString() + ".jpg");
path2 = p1.resolve(UUID.randomUUID().toString() + ".txt");
metadata = IBMetadataUtils.emptyDocumentSupplier.get();
mimeType = JPG;
rick = getClass().getResourceAsStream("/rick.jpg");
checksum = copyAndDigest(rick, path);
cType = copyToDeletedOnExitTempChecksumAndPath(wps.get(), "a", "b",
getClass().getResourceAsStream("/lines.txt"));
identifier = new DefaultIBDataStreamIdentifier(checksum.asUUID().get(), of(p1.toUri().toURL().toExternalForm()),
of(NAME), of(DESC), checksum, now, metadata, mimeType, of(path.toString()),empty(), empty());
ib1 = new DefaultIBDataStream(identifier, path);
ib2 = new DefaultIBDataStream(identifier, new ThrowingIBChecksumType());
ds = new DataStream();
ds.setPath(path.toString());
ds.setSha512(CHECKSUM);
ds.setUuid(UUID.randomUUID().toString());
ds.setMimeType(JPG);
ds.setCreationDate(now);
ds2 = new DataStream();
ds2.setPath(path.toString());
ds2.setSha512(CHECKSUM);
ds2.setUuid(UUID.randomUUID().toString());
ds2.setMimeType(cType.getType());
ds2.setCreationDate(now);
}
@Test(expected = IBException.class)
public void testCopyAndDigest() {
copyAndDigest(new ThrowingInputStream(IOException.class), path);
}
// @Test
// public void testDataStreamIdentifierConstructor2() {
// IBDataSource source = null;
// assertNotNull(new DefaultIBDataStreamIdentifier(source, now, of(path.toString())));
// }
@Test
public void testDataStreamIdentifierCopyConstructor() {
assertNotNull(new DefaultIBDataStreamIdentifier(identifier));
}
@Test
public void testGetChecksum() {
assertEquals(checksum, ib1.getChecksum());
assertEquals(checksum, ib1.getChecksum()); // Twice for cached copy
}
@Test(expected = IBDataException.class)
public void testGetChecksumWithFailingInputStream() {
Supplier<InputStream> ins = () -> new ThrowingInputStream(IOException.class);
Reflect.on(ib2).set("ss", ins).set("calculatedChecksum", null);
ib2.getChecksum(); // Setup to fail
}
@Test
public void testGet() {
Path p2 = p1.resolve(UUID.randomUUID().toString());
Checksum d = copyAndDigest(ib1.get(), p2);
assertEquals(checksum, d);
}
@Test
public void testClose() throws Exception {
List<InputStream> s = Reflect.on(ib1).get("createdInputStreamsForThisInstance");
s.add(new ThrowingInputStream(IOException.class));
ib1.close();
}
@Test
public void testRelocateTo() throws Exception {
Path p2 = wps.get();
IBDataStream v = ib1.relocateTo(p2, new DefaultTypeToExtensionMapper());
assertNotNull(v);
}
@Test
public void testGetId() {
assertEquals(checksum.asUUID().get(), ib1.getId());
}
@Test
public void testGetURL() throws MalformedURLException {
assertTrue(ib1.getURL().get().startsWith(p1.toUri().toURL().toExternalForm()));
}
@Test
public void testGetName() {
assertEquals(NAME, ib1.getName().get());
}
@Test
public void testGetDescription() {
assertEquals(DESC, ib1.getDescription().get());
}
@Test
public void testGetCreationDate() {
assertEquals(now, ib1.getCreationDate());
}
@Test
public void testGetMetadata() {
assertEquals(metadata, ib1.getMetadata());
}
@Test
public void testGetMimeType() {
assertEquals(JPG, ib1.getMimeType());
}
@Test
public void testGetPath() {
assertEquals(path.toString(), ib1.getPath());
}
@Test
public void testFrom() {
DefaultIBDataStream v = DefaultIBDataStream.from(ds, () -> path);
}
@Test
public void testStringStreamInappropriateSupplier() {
DefaultIBDataStream v = DefaultIBDataStream.from(ds, () -> path);
DefaultStringStreamSupplier dss = new DefaultStringStreamSupplier(() -> log);
assertFalse(dss.from(v).isPresent());
}
@Test
public void testStringStreamAppropriateSupplier() throws IOException {
DefaultIBDataStream v = DefaultIBDataStream.from(ds2, () -> path2);
InputStream i = v.get();
i.close();
i = v.get();
i.close();
DefaultStringStreamSupplier dss = new DefaultStringStreamSupplier(() -> log);
assertTrue(dss.from(v).isPresent());
}
}
| [
"[email protected]"
] | |
5f7f405743b4b101bef554366ba47169116411c3 | 6f86daa5ed7fa7ca024502669c613d5ce6df3089 | /src/main/java/com/springformat/repository/UserRepository.java | 671169bafc25082c79635938c43e045a0892fa8f | [] | no_license | fabianosf/spring-boot-csv-xls-pdf | ad210fe11819d56b1b2c8957dd4b90a1a62a4ed9 | 784f40a6110efa202d93d98ba6a6991eb0e6032d | refs/heads/master | 2023-04-07T12:25:25.844566 | 2019-12-02T00:29:03 | 2019-12-02T00:29:03 | 225,249,844 | 0 | 0 | null | 2023-03-27T22:16:42 | 2019-12-02T00:01:16 | Java | UTF-8 | Java | false | false | 258 | java | /*
* @author Fabiano Freitas
*/
package com.springformat.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import com.springformat.entity.User;
/**
*
*/
public interface UserRepository extends JpaRepository<User, Integer>{
}
| [
"[email protected]"
] | |
474cc21543b59ab60ced6abc814b7159d46f0a78 | df796d87030fde840e91e328bcf4ff3e6acc43c4 | /src/main/java/edu/upc/dsa/Usuario.java | 936c9fc74c1a1c6864032489df38e6e76028e8dd | [] | no_license | Nodet23/FQ_BrunoGarcia | 8725435939e0dad352a18cc19c962e9813ab7b74 | f59a09b6062fe3e18df23acec87299e36c8bd3d8 | refs/heads/master | 2021-08-30T15:28:00.151441 | 2017-12-18T12:55:11 | 2017-12-18T12:55:11 | 114,640,951 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 907 | java | package edu.upc.dsa;
import java.util.HashMap;
/**
* Created by nodet on 18/12/17.
*/
public class Usuario {
String name;
String pass;
HashMap<String, Pedido> mapaPedidos;
public Usuario(){
this.name = null;
this.pass = null;
}
public Usuario (String nombre, String pass){
this.name = nombre;
this.pass = pass;
this.mapaPedidos = new HashMap<String, Pedido>();
}
public HashMap<String, Pedido> getMapaPedidos() {
return mapaPedidos;
}
public void setMapaPedidos(HashMap<String, Pedido> mapaPedidos) {
this.mapaPedidos = mapaPedidos;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPass() {
return pass;
}
public void setPass(String pass) {
this.pass = pass;
}
}
| [
"[email protected]"
] | |
eada8c0f1dd3d8f17e34855943791d78185d4517 | 99c03face59ec13af5da080568d793e8aad8af81 | /hom_classifier/2om_classifier/scratch/ROR56ROR5/Pawn.java | d9cba1a0b6a529498fe30fe2dada06358d3217be | [] | no_license | fouticus/HOMClassifier | 62e5628e4179e83e5df6ef350a907dbf69f85d4b | 13b9b432e98acd32ae962cbc45d2f28be9711a68 | refs/heads/master | 2021-01-23T11:33:48.114621 | 2020-05-13T18:46:44 | 2020-05-13T18:46:44 | 93,126,040 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,757 | java | // This is a mutant program.
// Author : ysma
import java.util.ArrayList;
public class Pawn extends ChessPiece
{
public Pawn( ChessBoard board, ChessPiece.Color color )
{
super( board, color );
}
public java.lang.String toString()
{
if (color == ChessPiece.Color.WHITE) {
return "♙";
} else {
return "♟";
}
}
public java.util.ArrayList<String> legalMoves()
{
java.util.ArrayList<String> returnList = new java.util.ArrayList<String>();
if (this.getColor().equals( ChessPiece.Color.WHITE )) {
int currentCol = this.getColumn();
int nextRow = this.getRow() + 1;
if (nextRow == 7) {
if (board.getPiece( onePossibleMove( nextRow, currentCol ) ) == null) {
returnList.add( onePossibleMove( nextRow, currentCol ) );
}
}
if (this.getRow() == 1) {
int nextNextRow = this.getRow() + 2;
if (board.getPiece( onePossibleMove( nextRow, currentCol ) ) == null && board.getPiece( onePossibleMove( nextNextRow, currentCol ) ) == null) {
returnList.add( onePossibleMove( nextNextRow, currentCol ) );
}
}
int leftColumn = currentCol - 1;
int rightColumn = currentCol + 1;
if (leftColumn >= 0) {
if (board.getPiece( onePossibleMove( nextRow, leftColumn ) ) != null) {
if (!board.getPiece( onePossibleMove( nextRow, leftColumn ) ).getColor().equals( this.getColor() )) {
returnList.add( onePossibleMove( nextRow, leftColumn ) );
}
}
}
if (rightColumn <= 7) {
if (board.getPiece( onePossibleMove( nextRow, rightColumn ) ) != null) {
if (!board.getPiece( onePossibleMove( nextRow, rightColumn ) ).getColor().equals( this.getColor() )) {
returnList.add( onePossibleMove( nextRow, rightColumn ) );
}
}
}
} else {
int currentCol = this.getColumn();
int nextRow = this.getRow() - 1;
if (nextRow >= 0) {
if (board.getPiece( onePossibleMove( nextRow, currentCol ) ) == null) {
returnList.add( onePossibleMove( nextRow, currentCol ) );
}
}
if (this.getRow() == 6) {
int nextNextRow = this.getRow() - 2;
if (board.getPiece( onePossibleMove( nextRow, currentCol ) ) == null && board.getPiece( onePossibleMove( nextNextRow, currentCol ) ) == null) {
returnList.add( onePossibleMove( nextNextRow, currentCol ) );
}
}
int leftColumn = currentCol - 1;
int rightColumn = currentCol + 1;
if (leftColumn != 0) {
if (board.getPiece( onePossibleMove( nextRow, leftColumn ) ) != null) {
if (!board.getPiece( onePossibleMove( nextRow, leftColumn ) ).getColor().equals( this.getColor() )) {
returnList.add( onePossibleMove( nextRow, leftColumn ) );
}
}
}
if (rightColumn <= 7) {
if (board.getPiece( onePossibleMove( nextRow, rightColumn ) ) != null) {
if (!board.getPiece( onePossibleMove( nextRow, rightColumn ) ).getColor().equals( this.getColor() )) {
returnList.add( onePossibleMove( nextRow, rightColumn ) );
}
}
}
}
return returnList;
}
} | [
"[email protected]"
] | |
76d4f10ece29821cdb5c1bc22ec12d8ab7ee87a8 | 33732138260c6aaf132bc2d0d46b2f47efce00a6 | /sample6/app/src/main/java/com/study/android/sample6/MarkerItem3.java | 74d7167f89bcd0f0288b66f6859e2284a59e2ad5 | [] | no_license | skyies12/Android | 035382b873b9671c538c578899e967f07d1f166a | d05e0a07a17976d6696afcdf6d67a7cc06edc916 | refs/heads/master | 2020-05-03T18:42:38.973222 | 2019-04-26T09:34:25 | 2019-04-26T09:34:25 | 178,769,252 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 311 | java | package com.study.android.sample6;
public class MarkerItem3 {
private String cpName;
public MarkerItem3(String cpName) {
this.cpName = cpName;
}
public String getCpName() {
return cpName;
}
public void setCpName(String cpName) {
this.cpName = cpName;
}
}
| [
"[email protected]"
] | |
d6e94371864e084f14b5e02600a73685b6cac245 | fb9df41e76d03c20087ed1c21fff7af09cad0b01 | /src/main/java/com/dx/webserver/web/controller/book/BookController.java | f30d715cc8382b36ce25b07acf7f3620e6a819e7 | [] | no_license | sallyanna000/webserver | 6f45c6b4eb7cc8c44033064619c762b1b82c3c02 | bd2339da820eec0181f27acc9ff5d95fb00dbf8a | refs/heads/master | 2023-07-20T11:01:59.004205 | 2020-06-17T06:23:25 | 2020-06-17T06:23:25 | 98,198,366 | 0 | 0 | null | 2023-07-16T02:25:46 | 2017-07-24T14:13:37 | Java | UTF-8 | Java | false | false | 3,104 | java | package com.dx.webserver.web.controller.book;
import com.dx.webserver.common.log.BaseLogger;
import com.dx.webserver.entity.model.book.Book;
import com.dx.webserver.service.book.IBookService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
/**
* @Description 书本处理Controller
* @Project webserver
* @Author duxiang
* @Time 2017/7/16 15:48
*/
@Api(value = "bookAPI", description = "书籍相关接口")
@RestController
@RequestMapping("/book")
public class BookController extends BaseLogger {
@Autowired
private IBookService bookService;
@ApiOperation(notes = "查询所有的书本信息", value = "find all books", httpMethod = "GET")
@RequestMapping(method = RequestMethod.GET, produces = "application/json")
public PageInfo<Book> getAll(@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
if (null != pageNum && null != pageSize) {
PageHelper.startPage(pageNum, pageSize);
}
return new PageInfo<>(bookService.getAll());
}
@ApiOperation(notes = "根据ID查询书本信息", value = "find by id", httpMethod = "GET")
@RequestMapping(value = "/{id}", method = RequestMethod.GET, produces = "application/json")
public Book getById(@PathVariable Integer id) {
return bookService.getById(id);
}
@ApiOperation(notes = "增加书本信息", value = "add a book", httpMethod = "POST")
@RequestMapping(value = "/add", method = RequestMethod.POST, produces = "application/json")
public ResponseEntity add(@RequestBody Book book) {
bookService.insert(book);
return new ResponseEntity("Book added successfully", HttpStatus.OK);
}
@ApiOperation(notes = "删除书本信息", value = "delete a book", httpMethod = "DELETE")
@RequestMapping(value="/delete/{id}", method = RequestMethod.DELETE, produces = "application/json")
public ResponseEntity delete(@PathVariable Integer id){
bookService.delete(id);
return new ResponseEntity("BookType deleted successfully", HttpStatus.OK);
}
@ApiOperation(notes = "修改书本信息", value = "update a book", httpMethod = "PUT")
@RequestMapping(value = "/update/{id}", method = RequestMethod.PUT, produces = "application/json")
public ResponseEntity updateProduct(@PathVariable Integer id, @RequestBody Book book){
Book oldBook = bookService.getById(id);
oldBook.setName(book.getName());
oldBook.setAuthor(book.getAuthor());
oldBook.setPrice(book.getPrice());
bookService.update(oldBook);
return new ResponseEntity("Book updated successfully", HttpStatus.OK);
}
}
| [
"[email protected]"
] | |
0beded48a433bc32067b6c0ddf7eb42907dc4bdd | 3f635f3d9abad44e8e78064ca502f8e2ff828d6a | /src/main/java/com/gl/combo/bean/GenericResponse.java | 2d476ec653c34869bd3a2230bdb8348105fccf71 | [] | no_license | radhay-1199/landing-page-and-sub-ksa | 970aa5357856959fd67d399ba495b197ff3b9622 | 418940f82527374ec077c8cef3bae25921e2a4b8 | refs/heads/master | 2023-04-04T06:58:11.378492 | 2021-04-23T06:32:11 | 2021-04-23T06:32:11 | 317,427,181 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,088 | java | package com.gl.combo.bean;
public class GenericResponse {
public String message;
public String inError;
public String requestId;
public String code;
public ResponseData reponseData;
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getInError() {
return inError;
}
public void setInError(String inError) {
this.inError = inError;
}
public String getRequestId() {
return requestId;
}
public void setRequestId(String requestId) {
this.requestId = requestId;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public ResponseData getReponseData() {
return reponseData;
}
public void setReponseData(ResponseData reponseData) {
this.reponseData = reponseData;
}
@Override
public String toString() {
return "MsisdnResponse [message=" + message + ", inError=" + inError + ", requestId=" + requestId + ", code="
+ code + ", reponseData=" + reponseData + "]";
}
}
| [
"Radhay@DESKTOP-82CNCD9"
] | Radhay@DESKTOP-82CNCD9 |
64588a362b42499f0c4b7f505d5c926e03085eb4 | 34a7bdbf1de9d2f2316490373483eab94617c926 | /Banker's Algorithm/src/Factory_Initializer_Helper.java | 7c53ef3c4888713715e6838137424933ed93baa7 | [] | no_license | raphyand/Bankers_Algorithm_Java | e18da1381743cd70cd50bdac1f42ec18350cfddd | 1675da8c23a3d4db475d122202760dce8631b740 | refs/heads/main | 2023-01-21T17:17:56.941810 | 2020-11-16T02:43:25 | 2020-11-16T02:43:25 | 313,170,627 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,026 | java | public class Factory_Initializer_Helper {
int[] allocated;
int[] maxDemand;
int[] inputNumbers;
int placementInArray;
protected void initializeMaxDemandAndAllocation(int[] allocated, int[] maxDemand, int[] inputNumbers, int placementInArray){
for (int i = 0; i < allocated.length; i++){
allocated[i] = inputNumbers[placementInArray];
placementInArray++;
}
for (int i = 0; i < maxDemand.length; i++){
maxDemand[i] = inputNumbers[placementInArray];
placementInArray++;
}
}
protected void updateFactoryPlacementInArray(int factoryPlacement){
factoryPlacement = placementInArray;
}
public Factory_Initializer_Helper(int[] allocated, int[] maxDemand, int[] inputNumbers, int placementInArray){
this.allocated = allocated;
this.maxDemand = maxDemand;
this.inputNumbers = inputNumbers;
this.placementInArray = placementInArray;
}
}
| [
"[email protected]"
] | |
b7cb9c16e2207cee5e2ab77b2ae1640dbeac819d | 10cba34c5ef8792a918780bd4b3d0e2b8decdaca | /src/main/java/dev/gigaherz/elementsofpower/analyzer/menu/ReadonlySlot.java | 7bb5f90a8954c7e2554f9bd82c1919797d5a9f52 | [] | no_license | gigaherz/ElementsOfPower | 0536a177ca01587baa138f226c84c30272a6cde3 | 2a4b531f6d8523db0bc5ec6e7567cf066dcb259b | refs/heads/master | 2023-07-07T04:14:54.015613 | 2023-07-02T22:25:07 | 2023-07-02T22:25:07 | 7,384,096 | 13 | 10 | null | 2015-11-25T01:51:24 | 2012-12-31T05:48:49 | Java | UTF-8 | Java | false | false | 608 | java | package dev.gigaherz.elementsofpower.analyzer.menu;
import net.minecraft.world.Container;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.Slot;
import net.minecraft.world.item.ItemStack;
public class ReadonlySlot extends Slot
{
public ReadonlySlot(Container par1iInventory, int par2, int par3, int par4)
{
super(par1iInventory, par2, par3, par4);
}
@Override
public boolean mayPlace(ItemStack par1ItemStack)
{
return false;
}
@Override
public boolean mayPickup(Player playerIn)
{
return false;
}
}
| [
"[email protected]"
] | |
706346d2cced91e859f4c823a1e3b364573a26e2 | 761f1cba1b8d8b4f4cce85fd231ff4d00ead9f77 | /day10/homework/Test1.java | 981d5023db4bb314edc1479d8ca5b0a15086b629 | [] | no_license | BinYangXian/pri | e817f070c8a2c75cc7edeed44770d4ed8956e0a2 | e904f7c09a301e18d7d5fb62de7e63f41600fe5b | refs/heads/master | 2021-01-20T10:13:30.844032 | 2017-05-05T04:01:16 | 2017-05-05T04:01:16 | 82,458,048 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,743 | java | package day10.homework;
public class Test1 {
public static void main(String[] args) {
//人的变量
Person p1;
//手机的变量
Phone sp;
/**
* 熊大用三星手机发短信
*/
//来一个人
p1=new Person("熊大");
//来一个手机
sp=new SanxinPhone();
//人用手机发短信
p1.usePhoneSendMsg(sp);
/**
* 熊二用苹果手机发短信
*/
//来一个人
p1=new Person("熊二");
//来一个手机
sp=new ApplePhone();
//人用手机发短信
p1.usePhoneSendMsg(sp);
}
/**
* 得到一个指定的手机
* 参数:phName “三星”,“苹果”,“小米”
* 返回值:对应的手机-三星,小米,苹果-->没有对应手机返回null
*/
public static Phone getPhone(String phName){
if("三星".equals(phName)){// null.equals("三星")会空指针 "三星".equals(null) 不会空指针
return new SanxinPhone();
}
if("苹果".equals(phName)){
return new ApplePhone();
}
if("小米".equals(phName)){
return new MiPhone();
}
//没有对应手机
return null;
}
}
/**
* 1、继承+重写+多态
苹果手机类:
功能: 发短信-(速度一般)
三星手机类:
功能:发短信-(速度快)
小米手机类:
功能:发短信-(速度慢)
...
人类:
数据:名字
功能:
用手机发短信
发短信过程(1)人拿着手机编写短信 2)手机发短信 3)人放下手机 )
手机:可以是(三星,苹果,小米)--》尝试多态解决
需求:
a)测试类中提供一个方法,根据参数“三星”,“苹果”,“小米”--》返回对应的手机对象。
b)熊大用三星手机发短信,熊二用苹果手机发短信
*
* */
//超类型-手机PHone-规范所有的手机
//定义通用api:发短信sendMsg
class Phone{
//发短信
public void sendMsg(){
System.out.println("手机可以发短信,不知道速度快还是慢!!!");
}
}
class ApplePhone extends Phone{
@Override
public void sendMsg() {
System.out.println("速度一般");
}
}
class SanxinPhone extends Phone{
@Override
public void sendMsg() {
System.out.println("速度快");
}
}
class MiPhone extends Phone{
@Override
public void sendMsg() {
System.out.println("速度慢");
}
}
class Person{
//名字
String name;
public Person(String name) {
this.name = name;
}
//用手机发短信
//参数phone 所使用的手机
public void usePhoneSendMsg(Phone phone){
//1)人拿着手机编写短信 2)手机发短信 3)人放下手机
System.out.println(this.name+"拿着手机编写短信");
//手机发短信
phone.sendMsg();
System.out.println(this.name+"放下手机");
}
}
| [
"[email protected]"
] | |
7654f6f9f4beafa2f8ad71163d2e75d5e1ec306b | 877da03ba426e5de26e4c9201c0014ef971120f9 | /src/gamespace/web/games/GamesPage.java | 8618fe6df975d75d82e4cffe33c98eecd3cd82b7 | [] | no_license | so1us2/GameSpace | 5ee0e9e1adf9a850f0785db7676b6afffec4807e | 14e3348c20a49fce7c0a92f441e7762e8bc8b08f | refs/heads/master | 2021-05-29T05:20:20.040958 | 2015-07-27T05:09:42 | 2015-07-27T05:09:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,462 | java | package gamespace.web.games;
import static jasonlib.util.Functions.map;
import ez.Row;
import gamespace.api.GameUtils;
import gamespace.db.AnswerDB;
import gamespace.db.UserDB;
import gamespace.model.User;
import jasonlib.Json;
import java.util.List;
import java.util.Map;
import java.util.Set;
import bowser.Controller;
import bowser.template.Data;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Maps;
import com.google.common.collect.Ordering;
import com.google.common.collect.Sets;
public class GamesPage extends Controller {
private final UserDB userDB = new UserDB();
private final AnswerDB answerDB = new AnswerDB();
@Override
public void init() {
route("GET", "/games").to("games.html").data(topGames);
route("GET", "/games/*").to("games.html").data(gameData);
}
private List<User> getPlayersForGame(String game) {
game = game.toLowerCase();
Set<Long> userIds = Sets.newHashSet();
for (Row row : answerDB.getForQuestions("boardGames", "digitalGames")) {
String answer = row.get("answer");
if (answer.toLowerCase().contains(game)) {
userIds.add(row.getLong("user"));
}
}
return userDB.get(userIds);
}
private final Data topGames = context -> {
for (String type : ImmutableList.of("boardGames", "digitalGames")) {
Map<String, Integer> counts = Maps.newHashMap();
for (Row row : answerDB.getForQuestions(type)) {
String answer = row.get("answer").toLowerCase();
for (String s : Splitter.on('\n').omitEmptyStrings().split(answer)) {
Integer i = counts.getOrDefault(s, 0);
counts.put(s, i + 1);
}
}
List<String> games = Ordering.from((a, b) -> counts.get(b) - counts.get(a)).immutableSortedCopy(counts.keySet());
games = games.subList(0, Math.min(games.size(), 10));
games = map(games, GameUtils.prettify);
context.put(type, games);
}
};
private final Data gameData = context -> {
// user the original request's path so that we retain the case
// TODO we'll normalize this in the future to an actual game
String name = context.request.request.getPath().getSegments()[1];
name = name.replace('-', ' ');
Json game = Json.object()
.with("name", name);
context.put("game", game);
List<User> players = getPlayersForGame(name);
context.put("players", players);
};
}
| [
"[email protected]"
] | |
ae37ee6f8a9cb2ae3a8f9ae19e96e3ab181d0cd0 | 4e58265100386e18e0da06e4889847793c0fb482 | /libbluetoothle/src/main/java/com/bluetoothle/base/BLEConfig.java | c6243f0509770449d1b06d93ea9a19c1e2043bdd | [] | no_license | dccjll/okble | f91b99e60602bc7b5be090800617f27d40695239 | 2ffd595b3aa89462e5b3f762243c35aadd740842 | refs/heads/master | 2021-08-29T23:19:23.569789 | 2017-12-15T07:58:03 | 2017-12-15T07:58:03 | 113,523,761 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,753 | java | package com.bluetoothle.base;
/**
* 作者:dccjll<br>
* 创建时间:2017/11/6 11:22<br>
* 功能描述:蓝牙基础参数配置<br>
*/
public class BLEConfig {
/**
* 动态参数,根据实际手机型号酌情匹配
*/
//长扫描标志,设置该标志时将一直扫描,除非手动停止扫描
public static boolean LONG_SCAN_FALG = false;
//单次扫描的超时时间间隔
public static int SCAN_TIMEOUT_INTERVAL = 5 * 1000;
//最多扫描次数
public static int MAX_SCAN_COUNT = 3;
//扫描到的设备缓存时间
public static int DEVICE_MAX_CACHED_TIME = 2 * 60 * 1000;
//最多连接次数
public static int MAX_CONNECT_COUNT = 5;
//连接上设备后开始找服务的时间间隔
public static int START_FIND_SERVICE_INTERVAL = 10;
//找服务成功后开始打开通知的时间间隔
public static int START_OPEN_NOTIFICATION_INTERVAL = 0;
//没有数据交互时是否自动断开
public static boolean AUTO_DISCONNECT_WHEN_NO_DATA_INTERACTION = true;
//蓝牙连接上之后,多久没有数据交互将主动断开连接的间隔时间,AutoDisconnectWhenNoDataInteraction为true时有效
public static int AUTO_DISCONNECT_INTERVAL_WHEN_NO_DATA_INTERACTION = 2 * 60 * 1000;
//整个任务的超时时间
public static int WHOLE_TASK_TIMEOUT_INTERVAL = 30 * 1000;
//任务完成后执行断开的时间间隔,任务完成后断开标识(BLEResponseManager中的disconnectOnFinish)为true时有效
public static int START_DISCONNECT_INTERVAL_WHEN_FINISH = 2 * 1000;
/**
* 静态参数
*/
//蓝牙发送数据分包,每个包的最大长度为20个字节
public static final int MAX_BYTES = 20;
//发送多个数据包时的时间间隔(毫秒)
public static long SEND_NEXT_PACKAGE_INTERVAL = 70;
//最多连接设备数量
public static final int MaxConnectDeviceNum = 6;
/**
* 设置整个任务的超时时间,为某些情况下需要临时延长任务的超时时间提供中间支持
*/
public static void configWholeTaskTimeoutInterval(int wholeTaskTimeoutInterval) {
if (wholeTaskTimeoutInterval > 0) {
WHOLE_TASK_TIMEOUT_INTERVAL = wholeTaskTimeoutInterval;
}
}
/**
* 恢复整个任务的超时时间
*/
public static void resumeWholeTaskTimeoutInterval() {
WHOLE_TASK_TIMEOUT_INTERVAL = 30 * 1000;
}
/**
* 设置数据包发送的时间间隔
*/
public static void configSendNextPackageInterval(long sendNextPackageInterval) {
if (sendNextPackageInterval > 70) {
SEND_NEXT_PACKAGE_INTERVAL = sendNextPackageInterval;
}
}
}
| [
"[email protected]"
] | |
099f52a734bcc23235d6ea734765f98ae3aab6cd | 11c26e0ee9c6724c4d6a7cff6b1ef5ef358d74fa | /FlowerGarden/src/main/java/com/flowergarden/services/FlowerService.java | 8f55c3e7d619a68d40a8b6e62408415d509d91b0 | [] | no_license | OleksiiFurdylo/Java2018SpringMVCFurdylo | 30f3ca476e8a045e9794d5d429e0f27fa53b7963 | fc1f7f8aa6f3d5b26165bc52d274af7af86123c0 | refs/heads/master | 2020-03-09T17:32:50.175548 | 2018-04-13T21:08:13 | 2018-04-13T21:08:13 | 128,911,191 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 484 | java | package com.flowergarden.services;
import com.flowergarden.DAO.impl.FlowerDAOimpl;
import com.flowergarden.flowers.FlowerWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* Created by OleksiiF on 13.04.2018.
*/
@Service
public class FlowerService {
@Autowired
FlowerDAOimpl flowerDAOimpl;
public FlowerWrapper getFlower(int flowerId){
return flowerDAOimpl.getFlower(flowerId);
}
}
| [
"[email protected]"
] | |
b5254463982d16fcfceb47efb0e5d936ab392979 | 9e3fb674989bffa52294cdc337cddb71c0365483 | /GlEducation/app/src/main/java/com/gl/education/composition/model/UploadPictureBean.java | 9110aab56202dab6880348947e461e7a9959fe8b | [] | no_license | coderZy2015/GL_EDU | 780f83ff6b73f2dc61615027d86471f811c4d88f | 38ed130e50d49e290c453e73f5d4ca64c87a675e | refs/heads/master | 2020-03-22T11:11:38.662611 | 2019-01-23T05:36:54 | 2019-01-23T05:36:54 | 139,954,266 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,072 | java | package com.gl.education.composition.model;
/**
* Created by zy on 2018/10/21.
*/
public class UploadPictureBean {
/**
* result : 1000
* message : 操作成功
* data : {"path":"clientrw/e34901769b86332f81ebb8e07b936624.png"}
*/
private int result;
private String message;
private DataBean data;
public int getResult() {
return result;
}
public void setResult(int result) {
this.result = result;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public DataBean getData() {
return data;
}
public void setData(DataBean data) {
this.data = data;
}
public static class DataBean {
/**
* path : clientrw/e34901769b86332f81ebb8e07b936624.png
*/
private String path;
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
}
}
| [
"[email protected]"
] | |
a6c374315103fe2da2a100e51d0b4a0f45df263e | 2847d4c31adae04f620c805d285ea2f6bacd5caa | /referenceguide/Droid/obj/Debug/android/src/md5ff27de2cabd83e150201937c5b58cb0b/FTEControlRenderer.java | ffcb02b21a2aada1162071cf61ec6c80d071ac50 | [] | no_license | SteveFarmerJr/CommonCore | 6f29568af8f88890b3e2f348ce7d9bc392fbbf7e | b0eb3e43107fd5dfddc6d6f055f7b8f3a9d8b2f1 | refs/heads/master | 2021-01-20T13:58:11.464283 | 2017-05-04T20:36:19 | 2017-05-04T20:36:19 | 90,543,571 | 1 | 0 | null | 2017-05-07T15:45:15 | 2017-05-07T15:45:15 | null | UTF-8 | Java | false | false | 4,459 | java | package md5ff27de2cabd83e150201937c5b58cb0b;
public class FTEControlRenderer
extends md5b60ffeb829f638581ab2bb9b1a7f4f3f.ViewRenderer_2
implements
mono.android.IGCUserPeer,
android.text.TextWatcher,
android.text.NoCopySpan,
android.widget.TextView.OnEditorActionListener
{
/** @hide */
public static final String __md_methods;
static {
__md_methods =
"n_afterTextChanged:(Landroid/text/Editable;)V:GetAfterTextChanged_Landroid_text_Editable_Handler:Android.Text.ITextWatcherInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null\n" +
"n_beforeTextChanged:(Ljava/lang/CharSequence;III)V:GetBeforeTextChanged_Ljava_lang_CharSequence_IIIHandler:Android.Text.ITextWatcherInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null\n" +
"n_onTextChanged:(Ljava/lang/CharSequence;III)V:GetOnTextChanged_Ljava_lang_CharSequence_IIIHandler:Android.Text.ITextWatcherInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null\n" +
"n_onEditorAction:(Landroid/widget/TextView;ILandroid/view/KeyEvent;)Z:GetOnEditorAction_Landroid_widget_TextView_ILandroid_view_KeyEvent_Handler:Android.Widget.TextView/IOnEditorActionListenerInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null\n" +
"";
mono.android.Runtime.register ("Xamarin.Forms.CommonCore.MaterialDesign.FTEControlRenderer, referenceguide.Droid, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", FTEControlRenderer.class, __md_methods);
}
public FTEControlRenderer (android.content.Context p0, android.util.AttributeSet p1, int p2) throws java.lang.Throwable
{
super (p0, p1, p2);
if (getClass () == FTEControlRenderer.class)
mono.android.TypeManager.Activate ("Xamarin.Forms.CommonCore.MaterialDesign.FTEControlRenderer, referenceguide.Droid, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "Android.Content.Context, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065:Android.Util.IAttributeSet, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065:System.Int32, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e", this, new java.lang.Object[] { p0, p1, p2 });
}
public FTEControlRenderer (android.content.Context p0, android.util.AttributeSet p1) throws java.lang.Throwable
{
super (p0, p1);
if (getClass () == FTEControlRenderer.class)
mono.android.TypeManager.Activate ("Xamarin.Forms.CommonCore.MaterialDesign.FTEControlRenderer, referenceguide.Droid, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "Android.Content.Context, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065:Android.Util.IAttributeSet, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065", this, new java.lang.Object[] { p0, p1 });
}
public FTEControlRenderer (android.content.Context p0) throws java.lang.Throwable
{
super (p0);
if (getClass () == FTEControlRenderer.class)
mono.android.TypeManager.Activate ("Xamarin.Forms.CommonCore.MaterialDesign.FTEControlRenderer, referenceguide.Droid, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "Android.Content.Context, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065", this, new java.lang.Object[] { p0 });
}
public void afterTextChanged (android.text.Editable p0)
{
n_afterTextChanged (p0);
}
private native void n_afterTextChanged (android.text.Editable p0);
public void beforeTextChanged (java.lang.CharSequence p0, int p1, int p2, int p3)
{
n_beforeTextChanged (p0, p1, p2, p3);
}
private native void n_beforeTextChanged (java.lang.CharSequence p0, int p1, int p2, int p3);
public void onTextChanged (java.lang.CharSequence p0, int p1, int p2, int p3)
{
n_onTextChanged (p0, p1, p2, p3);
}
private native void n_onTextChanged (java.lang.CharSequence p0, int p1, int p2, int p3);
public boolean onEditorAction (android.widget.TextView p0, int p1, android.view.KeyEvent p2)
{
return n_onEditorAction (p0, p1, p2);
}
private native boolean n_onEditorAction (android.widget.TextView p0, int p1, android.view.KeyEvent p2);
private java.util.ArrayList refList;
public void monodroidAddReference (java.lang.Object obj)
{
if (refList == null)
refList = new java.util.ArrayList ();
refList.add (obj);
}
public void monodroidClearReferences ()
{
if (refList != null)
refList.clear ();
}
}
| [
"[email protected]"
] | |
724c6017ae0f273c807b6e7d16428929ac676138 | 23c051af3608be90c754cad91f683a618ae7c1d9 | /detectable/src/main/java/com/synopsys/integration/detectable/detectables/nuget/model/NugetContainerType.java | 9dec8119dabb21f6dffe5276a156ca455299bc57 | [
"Apache-2.0"
] | permissive | mureinik/synopsys-detect | ee2235d37f50b44e6e6fefaab5421a3e6a2dc065 | d61e5c03015be273bcfe81c573b8937d79fd888b | refs/heads/master | 2020-08-04T16:09:01.117096 | 2019-10-01T18:11:25 | 2019-10-01T18:11:25 | 212,197,394 | 1 | 0 | Apache-2.0 | 2019-10-01T20:52:17 | 2019-10-01T20:52:17 | null | UTF-8 | Java | false | false | 1,106 | java | /**
* detectable
*
* Copyright (c) 2019 Synopsys, Inc.
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.synopsys.integration.detectable.detectables.nuget.model;
import com.google.gson.annotations.SerializedName;
public enum NugetContainerType {
@SerializedName("Solution")
SOLUTION,
@SerializedName("Project")
PROJECT
}
| [
"[email protected]"
] | |
16848f53c84260410db59c5867747e57cede62db | ed5df591ab5bd67bdcdc2f8292a326697a738279 | /Collections and Java8/Course-Manager/src/student/Student.java | 207b6589c9f096f945be526bdf2ccaf45913d8b8 | [] | no_license | hadeoliveira/CollectionsAndJava8Test | 4669b933f121496d9c9330882284ed98fe33ebec | 6d35d1e67aebcca6aa4bf2983ae1022746201828 | refs/heads/main | 2023-02-17T00:15:12.688989 | 2021-01-21T23:03:40 | 2021-01-21T23:03:40 | 331,774,430 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,329 | java | package student;
public class Student {
private String name;
private int idNumber;
public Student (String name, int idNumber) {
if(name == null) {
throw new NullPointerException();
}
this.name = name;
this.idNumber = idNumber;
}
public String getName() {
return name;
}
public int getIdNumber() {
return idNumber;
}
@Override
public String toString() {
return "[Student: " + this.name + ", idNumber: " + this.idNumber + "]" ;
}
/*
@Override
public boolean equals(Object obj) {
Student otherStudent = (Student) obj;
return this.name.equals(otherStudent);
}
@Override
public int hashCode() {
return this.name.hashCode();
}
*/
// implementation using CTRL + 3 on Eclipse IDE
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + idNumber;
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Student other = (Student) obj;
if (idNumber != other.idNumber)
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
return true;
}
}
| [
"[email protected]"
] | |
126e289453f49f80fc99564bf97f28de4eb9a36b | a1826c2ed9c12cfc395fb1a14c1a2e1f097155cb | /csas-20230120/src/main/java/com/aliyun/csas20230120/models/ListApplicationsForPrivateAccessPolicyRequest.java | 647ca518bae88e7ebe83019adf487853b1047e68 | [
"Apache-2.0"
] | permissive | aliyun/alibabacloud-java-sdk | 83a6036a33c7278bca6f1bafccb0180940d58b0b | 008923f156adf2e4f4785a0419f60640273854ec | refs/heads/master | 2023-09-01T04:10:33.640756 | 2023-09-01T02:40:45 | 2023-09-01T02:40:45 | 288,968,318 | 40 | 45 | null | 2023-06-13T02:47:13 | 2020-08-20T09:51:08 | Java | UTF-8 | Java | false | false | 816 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.csas20230120.models;
import com.aliyun.tea.*;
public class ListApplicationsForPrivateAccessPolicyRequest extends TeaModel {
@NameInMap("PolicyIds")
public java.util.List<String> policyIds;
public static ListApplicationsForPrivateAccessPolicyRequest build(java.util.Map<String, ?> map) throws Exception {
ListApplicationsForPrivateAccessPolicyRequest self = new ListApplicationsForPrivateAccessPolicyRequest();
return TeaModel.build(map, self);
}
public ListApplicationsForPrivateAccessPolicyRequest setPolicyIds(java.util.List<String> policyIds) {
this.policyIds = policyIds;
return this;
}
public java.util.List<String> getPolicyIds() {
return this.policyIds;
}
}
| [
"[email protected]"
] | |
9f76f810bc4c07d4624d39e4ad4e2daa2a7784ea | e12e8a82a9c3b8ede527674c8c99496597565c46 | /arquitetura-edge-service/src/main/java/br/com/puc/minas/edgeservice/EdgeServiceApplication.java | ed31d5ec3d5c7d070f1d8f58f5340961ca86a942 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | nicanorcardoso/poc-java-microservices | 24276f837dcec286e4f720cad876df747eaa39a8 | 77e629009cd36a95c6e3f9d6d5cd2467b130e44d | refs/heads/master | 2020-03-30T15:21:04.545350 | 2018-10-03T04:36:31 | 2018-10-03T04:36:31 | 151,359,271 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 686 | java | package br.com.puc.minas.edgeservice;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.cloud.openfeign.EnableFeignClients;
@EnableFeignClients
@EnableCircuitBreaker
@EnableDiscoveryClient
@EnableZuulProxy
@SpringBootApplication
public class EdgeServiceApplication {
public static void main(String[] args) {
SpringApplication.run(EdgeServiceApplication.class, args);
}
} | [
"[email protected]"
] | |
d44dcc077fe1ae9a1b9fbe245d43ba9e364db19f | 80901ae21649c7c15c571d0ef03f443d32de07a4 | /src/RemoveDuplicates.java | 2a45add74ba5c9cc19e6375dceaa47ab67d32bd4 | [
"MIT"
] | permissive | yi-juchung/codingPractice | fcb09fe0f572f7d4049832f2906e557707bad765 | e1336df6824800b85531e16e46413f71da23b553 | refs/heads/master | 2021-01-19T02:07:50.748717 | 2016-08-04T23:45:03 | 2016-08-04T23:45:03 | 26,622,531 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 559 | java | public class RemoveDuplicates {
static public int removeDuplicates(int[] A) {
if (A.length == 0)
return 0;
int prevInt = A[0];
int curIdx = 1;
int newLen = 1;
while (curIdx < A.length) {
if (prevInt != A[curIdx]) {
A[newLen++] = A[curIdx];
prevInt = A[curIdx];
}
curIdx++;
}
return newLen;
}
public static void main(String [ ] args) {
System.out.print(removeDuplicates(new int []{1,1,2}));
}
}
| [
"[email protected]"
] | |
f4090f42ba24141566be5dab898cbd2f6a041e52 | d7ca9757614208f7ef8cb69f5f00b049dc6969f6 | /src/main/java/seedu/address/model/undoredo/exceptions/NoRedoableStateException.java | aeb65d2b5073e18fad014a16cbf0fa535d45b7af | [
"MIT"
] | permissive | AY2021S2-CS2103-T14-1/tp | 3d2283fb50eff247c2410c0be6dea0081261e51b | b54dee47ee31637219a471dd6568fd2e816bed04 | refs/heads/master | 2023-04-21T16:51:33.694634 | 2021-04-27T07:59:22 | 2021-04-27T07:59:22 | 336,436,507 | 0 | 5 | NOASSERTION | 2021-04-27T07:59:23 | 2021-02-06T02:17:03 | Java | UTF-8 | Java | false | false | 458 | java | // Solution below adapted from AB-4: https://github.com/se-edu/addressbook-level4
package seedu.address.model.undoredo.exceptions;
/**
* Thrown when there are no more future states to redo.
*/
public class NoRedoableStateException extends RedoException {
/**
* Constructs a {@code NoRedoableStateException} with a default message.
*/
public NoRedoableStateException() {
super("Cannot redo: no future states remaining!");
}
}
| [
"[email protected]"
] | |
5ee53851c6da380f7b9cd4fb939dd7476a3870e8 | c2cbf0a2e8b3037d4b962b073be18db9e536a465 | /src/test/java/com/defimak47/grooshella/services/console/web/GroovyScriptServiceTest.java | 7eaf0796d4a03ef376b426e64735471c49342b54 | [
"MIT"
] | permissive | juazugas/grooshella | b8128541a51be74cfc1b3f855f6d1f9acbff00bc | a27a3ea408cb5561be492575e84103fdad234f6b | refs/heads/master | 2021-01-20T21:06:09.683686 | 2018-09-07T07:34:08 | 2018-09-07T09:14:11 | 62,006,172 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,452 | java | package com.defimak47.grooshella.services.console.web;
import static org.junit.Assert.assertNotNull;
import static org.hamcrest.MatcherAssert.assertThat;
// import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.Matchers.*;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Map;
@RunWith(SpringRunner.class)
@SpringBootTest
public class GroovyScriptServiceTest {
@Autowired
private GroovyScriptService groovyScriptService;
@Test
public void testExecuteScript() {
Map<String,Object> result = null;
final String script = "println \"hello world!\"";
_given: {
}
_then: {
result = groovyScriptService.executeScript(script);
}
_expect: {
assertNotNull(result);
assertThat(result, notNullValue());
assertThat(result, allOf(
not(hasKey("error")),
hasKey("startTime"),
hasKey("endTime"),
hasKey("result"),
hasKey("output"))
);
assertThat(result, hasEntry(equalTo("output"), anything("hello world!")));
}
}
}
| [
"[email protected]"
] | |
30e6a4e35619ff774e905d9661b8d1bd83b04767 | 72e43881fd6bade6333ed182ec86c14b2aebf467 | /src/main/java/gr/uom/java/xmi/UMLCallAction.java | b01b514a8ea9fe5bc531738fc8adb3c836fbc941 | [] | no_license | opus-research/RefDetector | 8a0f3e502b102fbde939e4d5455a252f8527875a | 348b6fef3e166899690693c53b7d35fa37129ffa | refs/heads/master | 2021-06-08T11:32:30.714293 | 2016-12-15T16:31:17 | 2016-12-15T16:31:17 | 43,387,544 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,277 | java | package gr.uom.java.xmi;
public class UMLCallAction extends UMLAction {
private UMLOperation operation;
private String actionExpression;
public UMLCallAction(String xmiID) {
super(xmiID);
}
public UMLOperation getOperation() {
return operation;
}
public void setOperation(UMLOperation operation) {
this.operation = operation;
}
public String getActionExpression() {
return actionExpression;
}
public void setActionExpression(String actionExpression) {
this.actionExpression = actionExpression;
}
public boolean equals(Object o) {
if(this == o) {
return true;
}
if(o instanceof UMLCallAction) {
UMLCallAction umlCallAction = (UMLCallAction)o;
if(this.operation != null && umlCallAction.operation != null)
return this.operation.equals(umlCallAction.operation);
else if(this.actionExpression != null && umlCallAction.actionExpression != null)
return this.actionExpression.equals(umlCallAction.actionExpression);
else
return false;
}
return false;
}
public String toString() {
if(actionExpression != null)
return actionExpression;
if(operation != null)
return operation.toString();
return "unknown";
}
}
| [
"[email protected]"
] | |
8a391bcb7078efb7be3b9027bbc6cbe01aa9a78e | c188408c9ec0425666250b45734f8b4c9644a946 | /open-sphere-base/core/src/main/java/io/opensphere/core/common/json/obj/JSONSaxTextValue.java | 3e911fdcaa16180191f2959a7a5e851b5b2f9376 | [
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"LicenseRef-scancode-public-domain"
] | permissive | rkausch/opensphere-desktop | ef8067eb03197c758e3af40ebe49e182a450cc02 | c871c4364b3456685411fddd22414fd40ce65699 | refs/heads/snapshot_5.2.7 | 2023-04-13T21:00:00.575303 | 2020-07-29T17:56:10 | 2020-07-29T17:56:10 | 360,594,280 | 0 | 0 | Apache-2.0 | 2021-04-22T17:40:38 | 2021-04-22T16:58:41 | null | UTF-8 | Java | false | false | 1,999 | java | package io.opensphere.core.common.json.obj;
import java.io.PrintStream;
public class JSONSaxTextValue extends JSONSaxPrimitiveValue
{
private boolean determinedNumber = false;
private boolean isNumber = false;
private boolean determinedNull = false;
private boolean isNull = false;
private boolean determinedBoolean = false;
private boolean isBoolean = false;
public JSONSaxTextValue(String text)
{
super(text);
}
@Override
public void toJSON(PrintStream ps, int indent)
{
ps.append("\"" + myText + "\"");
}
@Override
public Type getType()
{
return Type.TEXT_VALUE;
}
@Override
public boolean isBoolean()
{
if (!determinedBoolean)
{
isBoolean = myText == null ? false : myText.equalsIgnoreCase("false") || myText.equalsIgnoreCase("true");
determinedBoolean = true;
determinedNull = true;
isNull = false;
determinedNumber = true;
isNumber = false;
}
return isBoolean;
}
@Override
public boolean isNull()
{
if (!determinedNull)
{
isNull = myText == null || myText.toLowerCase().equals("null");
determinedNull = true;
determinedBoolean = true;
isBoolean = false;
determinedNumber = true;
isNumber = false;
}
return isNull;
}
@Override
public boolean isNumber()
{
if (!determinedNumber)
{
isNumber = true;
try
{
Double.parseDouble(myText);
}
catch (NumberFormatException e)
{
isNumber = false;
}
determinedNumber = true;
determinedBoolean = true;
isBoolean = false;
determinedNull = true;
isNull = false;
}
return isNumber;
}
}
| [
"[email protected]"
] | |
1f5cb25de46541ee4d388a742e56023c58576e2f | 459fce67266df69ba271507dc4ff591bb5cbe9d3 | /app/src/androidTest/java/com/example/mks/retrofitinsertintoserver/ExampleInstrumentedTest.java | 4b52b9acddf834734c661fbec1a75c018270deee | [] | no_license | mks25524/RetrofitInsertIntoServer | 6d37aac9627f5bd2d04892ef66fef3005f65b285 | 84a3a169d546e163d8f3b19e1213c00492e8aeb0 | refs/heads/master | 2020-12-25T19:03:22.158327 | 2017-06-11T18:41:43 | 2017-06-11T18:41:43 | 94,020,868 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 784 | java | package com.example.mks.retrofitinsertintoserver;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.mks.retrofitinsertintoserver", appContext.getPackageName());
}
}
| [
"[email protected]"
] | |
b2a5d06cbf1637e5d1904531ab3483df8a884144 | 9295693c22f5a5a809195ee301fd1a39fbe42c0a | /SecondApp/app/src/test/java/com/iit/testcontentprovider/second/secondapp/ExampleUnitTest.java | 9141293d2481d088e1e61e6c90ad4589cb1b812f | [] | no_license | slim-benhammouda/IIT-ContentProvider | 676b9cff21a96a1b1ff98e2539d90168be34e477 | d63e243bfccf1f63b16c5d5ad4e7e7387055c627 | refs/heads/master | 2021-01-21T13:18:09.883351 | 2015-11-12T11:38:05 | 2015-11-12T11:38:05 | 45,832,250 | 0 | 0 | null | 2016-05-17T00:14:50 | 2015-11-09T10:51:18 | Java | UTF-8 | Java | false | false | 337 | java | package com.iit.testcontentprovider.second.secondapp;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
db5c9d927609de18252af9ebe50c9ecd14345693 | 6e04aef3d1f93f5e9aff1800c57beaf6de199de3 | /ShiroDemo/src/test/java/D_Encode/PasswordTest.java | 946c5baebc37ad80d5f5a9eb8c9d218ad5835ba7 | [] | no_license | ilwyiworld/JavaProject | c73ea6d90faa93226a873b107910c72ccb8a04aa | 3194a4e09617cd423df89e9942c6b35a8417f6b4 | refs/heads/master | 2022-12-25T04:39:22.381874 | 2020-08-20T09:27:36 | 2020-08-20T09:27:36 | 176,459,779 | 1 | 0 | null | 2022-12-16T07:47:41 | 2019-03-19T08:15:11 | JavaScript | UTF-8 | Java | false | false | 3,145 | java | package D_Encode;
import Z_Common.BaseTest;
import org.apache.commons.beanutils.BeanUtilsBean;
import org.apache.commons.beanutils.converters.AbstractConverter;
import org.apache.shiro.authc.ExcessiveAttemptsException;
import org.apache.shiro.crypto.SecureRandomNumberGenerator;
import org.apache.shiro.crypto.hash.SimpleHash;
import org.apache.shiro.realm.jdbc.JdbcRealm;
import org.junit.Test;
/**
* Created by Administrator on 2017/7/18.
*/
public class PasswordTest extends BaseTest {
//只认证密码是否正确
@Test
public void testPasswordServiceWithMyRealm() {
login("classpath:D_Encode/passwordservice.ini", "wu", "123456");
}
//根据数据库users表中的用户名密码验证 密码是加密后的密码
@Test
public void testPasswordServiceWithJdbcRealm() {
login("classpath:D_Encode/jdbc-passwordservice.ini", "wu", "123");
}
@Test
public void testGeneratePassword() {
String algorithmName = "md5";
String username = "liu";
String password = "123";
String salt1 = username;
String salt2 = new SecureRandomNumberGenerator().nextBytes().toHex();
//String salt2 = "24520ee264eab73ec09451d0e9ea6aac";
int hashIterations = 2;
//加密算法名 明文密码 公盐 迭代次数
SimpleHash hash = new SimpleHash(algorithmName, password, salt1 + salt2, hashIterations);
String encodedPassword = hash.toHex();
System.out.println(salt2);
System.out.println(encodedPassword);
}
@Test
public void testHashedCredentialsMatcherWithMyRealm2() {
//使用testGeneratePassword生成的散列密码
login("classpath:D_Encode/hashedCredentialsMatcher.ini", "liu", "123");
}
@Test
public void testHashedCredentialsMatcherWithJdbcRealm() {
//首先注册一个Enum转换器
BeanUtilsBean.getInstance().getConvertUtils().register(new EnumConverter(), JdbcRealm.SaltStyle.class);
//先通过数据库获得公盐 然后使用testGeneratePassword生成的散列密码与数据库中的密码进行比对
login("classpath:D_Encode/jdbc-hashedCredentialsMatcher.ini", "liu", "123");
}
private class EnumConverter extends AbstractConverter {
@Override
protected String convertToString(final Object value) throws Throwable {
return ((Enum) value).name();
}
@Override
protected Object convertToType(final Class type, final Object value) throws Throwable {
return Enum.valueOf(type, value.toString());
}
@Override
protected Class getDefaultType() {
return null;
}
}
@Test(expected = ExcessiveAttemptsException.class)
public void testRetryLimitHashedCredentialsMatcherWithMyRealm() {
for(int i = 1; i <= 5; i++) {
try {
login("classpath:D_Encode/retryLimitHashedCredentialsMatcher.ini", "liu", "234");
} catch (Exception e) {/*ignore*/}
}
login("classpath:D_Encode/retryLimitHashedCredentialsMatcher.ini", "liu", "234");
}
} | [
"[email protected]"
] | |
54efbf000bfdfd2b2a2f3455f305a30145956754 | 040ede07c577e9191c747c8ef76733e223430ae3 | /TrabajoPractico/src/main/java/py/edu/facitec/controlller/HomeController.java | 219699ba7a46806f0e5dc05c5e83dd73af7b02da | [] | no_license | JuanPereira96/TALLERIV | 22ea3ce95d7839a554283ff1f948cad0861edfb1 | 76e5c7f72ccbe76beefa8a104b2374d185d07493 | refs/heads/master | 2021-06-25T06:24:52.908334 | 2017-09-13T01:12:59 | 2017-09-13T01:12:59 | 103,337,047 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 357 | java | package py.edu.facitec.controlller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class HomeController {
//url a responder
@RequestMapping("/")
public String index(){
System.out.println("Hola Mundo Spring MVC");
return "view/templates/index";
}
}
| [
"[email protected]"
] | |
7123954627da1e40c7d9303bea41d69bd0ddf57a | f715d02806067fdab790e2c44c0b5338c59257b3 | /TQC.plus.JAVA6/JPA505.java | b382c8864702588dd3236a11b97e0f478100e85a | [] | no_license | r39508177/tqc_plus_sample | 42b8108e3506ce0577d88d0e20eb4e316d9dd86a | 0f5aa5453c6044657fc93f29cdb04f67e42b2b40 | refs/heads/master | 2022-10-06T08:40:09.743347 | 2020-06-09T09:30:33 | 2020-06-09T09:30:33 | null | 0 | 0 | null | null | null | null | BIG5 | Java | false | false | 859 | java | public class JPA505 {
public static void main(String[] argv) {
String[] data = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J"};
System.out.print("反轉陣列資料之前: ");
for(int a=0;a<10;a++)
System.out.print(data[a]+" ");
data=reverse(data);
System.out.print("\n反轉陣列資料之後: ");
for(int a=0;a<10;a++)
System.out.print(data[a]+" ");
}
//反轉方法
//其翻轉方法主要是,宣告一個新的陣列,將原陣列寫到暫時的陣列中,並且用倒著的方法來寫,最後將這個暫時的陣列傳回main方法之中
public static String[] reverse(String[] s) {
String[] temp = new String[s.length];
int b=9;
for(int a=0;a<10;a++)
{
temp[b]=s[a];
b--;
}
return temp;
}
} | [
"[email protected]"
] | |
f9b2eff3e2fe64b2d8acb1118dba2483a1a96fa1 | 48e013de4833035fb34b30b02f0903f4ce4ceed7 | /aura-impl-expression/src/main/java/org/auraframework/impl/expression/functions/Empty.java | aaabd1157529ae8fff9fbcd73f26489bd2132d07 | [
"BSD-3-Clause",
"Apache-2.0",
"LGPL-2.0-or-later",
"ICU",
"LicenseRef-scancode-mx4j",
"W3C",
"CC-BY-4.0",
"SAX-PD",
"MPL-2.0",
"WTFPL",
"CDDL-1.0",
"MIT"
] | permissive | nagyist/forcedotcom-aura | 064609732afa4bc7551eec9972218dc9f1a30fd8 | 779ffdcc715565d3b961becd28aa163d289557aa | refs/heads/master | 2022-12-21T13:31:26.447628 | 2022-02-12T08:35:12 | 2022-02-12T08:35:12 | 27,166,886 | 0 | 0 | Apache-2.0 | 2022-12-16T22:49:11 | 2014-11-26T08:29:51 | JavaScript | UTF-8 | Java | false | false | 1,505 | java | /*
* Copyright (C) 2013 salesforce.com, inc.
*
* 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.auraframework.impl.expression.functions;
import org.springframework.util.ObjectUtils;
/**
* Empty is meant to match {@code Aura.Utils.Util.prototype.isEmpty} in Util.js
*/
public class Empty extends BaseUnaryFunction {
private static final long serialVersionUID = -8834318118368934926L;
private static final Empty INSTANCE = new Empty();
/**
* @return An instance of {@link Empty}
*/
public static final Empty getInstance() {
return INSTANCE;
}
private Empty() {
// Make sure there is only 1 instance
}
@Override
public Object evaluate(final Object arg) {
return Boolean.valueOf(ObjectUtils.isEmpty(arg));
}
@Override
public String getJsFunction() {
return "fn.empty";
}
@Override
public String[] getKeys() {
return new String[] { "empty" };
}
} | [
"[email protected]"
] | |
a203f1699ccb1cc557fb747d5fb43c41d05dee39 | bf64efc88ffbd3ac939ba77609b10fca14911acd | /app/src/main/java/com/example/carrental/initial/MainActivity.java | 83bb494b377361904d3c02e519ad94937c217606 | [] | no_license | harsh-shah112/CarRental | 2a144ae43bdd48c051b5b64eee1eb2dfec15214e | 6da370ed1e1d7b5106638c73e1bd1707fe4b309a | refs/heads/master | 2023-01-04T00:35:14.225008 | 2020-10-30T19:38:34 | 2020-10-30T19:38:34 | 308,722,718 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,985 | java | package com.example.carrental.initial;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.example.carrental.R;
import com.example.carrental.admin.AdminDashboard;
import com.example.carrental.initial.home.HomeActivity;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task;
import com.google.android.material.textfield.TextInputLayout;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.firestore.CollectionReference;
import com.google.firebase.firestore.DocumentReference;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.firestore.QuerySnapshot;
public class MainActivity extends AppCompatActivity {
TextInputLayout emaillayout, passwordlayout, namelayout, emailsignlayout, numberlayout, passwordsignlayout, adminemaillayout, adminpasswordlayout;
EditText loginemail, loginpassword, namesign, emailsign, numbersign, passwordsign, adminemail, adminpassword;
Button btnuser, btnadmin, loginbtn, signinbtn, loginadminbtn;
LinearLayout userloginlayout, usersigninlayout, selectuser, adminLayout;
TextView createone, logintxtview;
private FirebaseAuth mAuth;
String namepattern = "[a-zA-Z]+";
String emailpattern = "[a-zA-Z0-9._-]+@[a-z]+\\.+[a-z]+";
String txtloginemail, txtloginpassword, txtsignname, txtsignemail, txtsignnumber, txtsignpassword, txtadminemail, txtadminpassword;
private FirebaseFirestore db;
public static boolean loggedIn = false;
public static final String SHARED_PREF_NAME = "hello,sign in";
public static final String loginyes_no = "userlogin";
public static final String User_shared = "username";
public static final String Email_shared = "email";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
db = FirebaseFirestore.getInstance();
mAuth = FirebaseAuth.getInstance();
//Textview Ids
createone = findViewById(R.id.createone);
logintxtview = findViewById(R.id.logintxtview);
//Button Ids
btnadmin = findViewById(R.id.adminbtn);
btnuser = findViewById(R.id.userbtn);
loginbtn = findViewById(R.id.loginbtn);
signinbtn = findViewById(R.id.signinbtn);
loginadminbtn = findViewById(R.id.loginadminbtn);
//Linear Layout Ids
userloginlayout = findViewById(R.id.userloginlayout);
usersigninlayout = findViewById(R.id.usersigninlayout);
selectuser = findViewById(R.id.selectuser);
adminLayout = findViewById(R.id.adminLayout);
//TextInputLayout Ids
emaillayout = findViewById(R.id.emaillayout);
passwordlayout = findViewById(R.id.passwordlayout);
namelayout = findViewById(R.id.nameLayout);
emailsignlayout = findViewById(R.id.emailSignLayout);
numberlayout = findViewById(R.id.numberLayout);
passwordsignlayout = findViewById(R.id.passwordSignLayout);
adminemaillayout = findViewById(R.id.adminemaillayout);
adminpasswordlayout = findViewById(R.id.adminpasswordlayout);
//EditText Ids
//Login
loginemail = findViewById(R.id.loginemail);
loginpassword = findViewById(R.id.loginpassword);
//SignIn
emailsign = findViewById(R.id.emailSign);
namesign = findViewById(R.id.nameSign);
numbersign = findViewById(R.id.numberSign);
passwordsign = findViewById(R.id.passwordSign);
//Admin
adminemail = findViewById(R.id.adminemail);
adminpassword = findViewById(R.id.adminpassword);
loginemail.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
emaillayout.setError(null);
}
@Override
public void afterTextChanged(Editable s) {
}
});
loginpassword.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
passwordlayout.setError(null);
}
@Override
public void afterTextChanged(Editable s) {
}
});
emailsign.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
emailsignlayout.setError(null);
}
@Override
public void afterTextChanged(Editable s) {
if (emailsign.getText().toString().matches(emailpattern) && s.length() > 0) {
emailsignlayout.setError(null);
} else {
emailsignlayout.setError("Invalid Email");
}
}
});
numbersign.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
namelayout.setError(null);
}
@Override
public void afterTextChanged(Editable s) {
}
});
passwordsign.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
passwordlayout.setError(null);
}
@Override
public void afterTextChanged(Editable s) {
}
});
namesign.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
namelayout.setError(null);
}
@Override
public void afterTextChanged(Editable s) {
if (namesign.getText().toString().matches(namepattern) && s.length() > 0) {
namelayout.setError(null);
} else {
namelayout.setError("Invalid Name");
}
}
});
loginbtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
txtloginemail = loginemail.getText().toString().trim();
txtloginpassword = loginpassword.getText().toString().trim();
if (txtloginemail.isEmpty()) {
emaillayout.setError("Enter Email Plz..");
emaillayout.requestFocus();
} else if (txtloginpassword.isEmpty()) {
passwordlayout.setError("Enter Password Plz..");
} else {
loginuser();
}
}
});
signinbtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
txtsignname = namesign.getText().toString().trim();
txtsignemail = emailsign.getText().toString().trim();
txtsignnumber = numbersign.getText().toString().trim();
txtsignpassword = passwordsign.getText().toString().trim();
if (txtsignname.isEmpty()) {
namelayout.setError("Enter Name");
namelayout.requestFocus();
} else if (txtsignemail.isEmpty()) {
emailsignlayout.setError("Enter email");
emailsignlayout.requestFocus();
} else if (txtsignnumber.isEmpty()) {
numberlayout.setError("Enter Number");
numberlayout.requestFocus();
} else if (txtsignpassword.isEmpty()) {
passwordsignlayout.setError("Enter Passoword");
passwordsignlayout.requestFocus();
} else if (!(txtsignnumber.length() == 10)) {
numberlayout.setError("Enter valid number");
} else {
Doseuserexist();
}
}
});
loginadminbtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
txtadminemail = adminemail.getText().toString().trim();
txtadminpassword = adminpassword.getText().toString().trim();
if (txtadminemail.isEmpty()) {
adminemaillayout.setError("Enter Email Plz..");
adminemaillayout.requestFocus();
} else if (txtadminpassword.isEmpty()) {
adminpasswordlayout.setError("Enter Password plz..");
adminpasswordlayout.requestFocus();
} else {
loginadmin();
}
}
});
btnadmin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
selectuser.setVisibility(View.GONE);
adminLayout.setVisibility(View.VISIBLE);
}
});
btnuser.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
selectuser.setVisibility(View.GONE);
userloginlayout.setVisibility(View.VISIBLE);
}
});
createone.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
userloginlayout.setVisibility(View.GONE);
usersigninlayout.setVisibility(View.VISIBLE);
}
});
logintxtview.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
usersigninlayout.setVisibility(View.GONE);
userloginlayout.setVisibility(View.VISIBLE);
}
});
}
public void loginadmin() {
mAuth.signInWithEmailAndPassword(txtadminemail, txtadminpassword)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
// Sign in success, update UI with the signed-in user's information
Toast.makeText(MainActivity.this, "Login Success", Toast.LENGTH_SHORT).show();
startActivity(new Intent(getApplicationContext(), AdminDashboard.class));
} else {
// If sign in fails, display a message to the user.
Toast.makeText(getApplicationContext(), "Authentication failed.",
Toast.LENGTH_SHORT).show();
}
}
});
}
public void loginuser() {
db.collection("user")
.whereEqualTo("email", txtloginemail)
.whereEqualTo("password", txtloginpassword)
.get()
.addOnSuccessListener(new OnSuccessListener<QuerySnapshot>() {
@Override
public void onSuccess(QuerySnapshot queryDocumentSnapshots) {
if (!queryDocumentSnapshots.isEmpty()) {
Toast.makeText(MainActivity.this, "Login Success", Toast.LENGTH_LONG).show();
SharedPreferences sharedPreferences = getApplicationContext().getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putBoolean(loginyes_no, true);
editor.putString(Email_shared, loginemail.getText().toString());
editor.commit();
startActivity(new Intent(MainActivity.this,HomeActivity.class));
} else {
Toast.makeText(MainActivity.this, "Email or Password Not correct", Toast.LENGTH_SHORT).show();
}
}
});
}
public void Doseuserexist() {
db.collection("user")
.whereEqualTo("email", txtsignemail)
.get()
.addOnSuccessListener(new OnSuccessListener<QuerySnapshot>() {
@Override
public void onSuccess(QuerySnapshot queryDocumentSnapshots) {
if (!queryDocumentSnapshots.isEmpty()) {
Toast.makeText(MainActivity.this, "User Already Exist Plz try to login", Toast.LENGTH_LONG).show();
} else {
Adduser();
}
}
});
}
public void Adduser() {
CollectionReference dbuser = db.collection("user");
UserPojo userPojo = new UserPojo(txtsignname, txtsignemail, txtsignpassword, txtsignnumber);
dbuser.add(userPojo).addOnSuccessListener(new OnSuccessListener<DocumentReference>() {
@Override
public void onSuccess(DocumentReference documentReference) {
SharedPreferences sharedPreferences = getApplicationContext().getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putBoolean(loginyes_no, true);
editor.putString(Email_shared, emailsign.getText().toString());
editor.commit();
startActivity(new Intent(MainActivity.this,HomeActivity.class));
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Toast.makeText(MainActivity.this, "Error Adding User", Toast.LENGTH_LONG).show();
}
});
}
@Override
protected void onResume() {
super.onResume();
SharedPreferences sharedPreferences = getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE);
loggedIn = sharedPreferences.getBoolean(loginyes_no, false);
if (loggedIn) {
Intent i = new Intent(getApplicationContext(), HomeActivity.class);
startActivity(i);
MainActivity.this.finish();
}
}
} | [
"[email protected]"
] | |
6f44c12785b191c50662a73695d76f2685035518 | 071a9fa7cfee0d1bf784f6591cd8d07c6b2a2495 | /corpus/class/sling/3735.java | af35e65b340d03588e41edc81c65d168255e1f5a | [
"MIT"
] | permissive | masud-technope/ACER-Replication-Package-ASE2017 | 41a7603117f01382e7e16f2f6ae899e6ff3ad6bb | cb7318a729eb1403004d451a164c851af2d81f7a | refs/heads/master | 2021-06-21T02:19:43.602864 | 2021-02-13T20:44:09 | 2021-02-13T20:44:09 | 187,748,164 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,846 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with this
* work for additional information regarding copyright ownership. The ASF
* licenses this file to You under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.apache.sling.launchpad.webapp.integrationtest.auth;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.sling.commons.testing.integration.HttpTest;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
/**
* Test of the response code from an authentication request depending on various
* request parameters and headers including j_validate, Ajax detection, and
* non-browser client detection.
*/
public class SelectorAuthenticationResponseCodeTest {
private final HttpTest H = new HttpTest();
@Before
public void setup() throws Exception {
H.setUp();
}
@After
public void cleanup() throws Exception {
H.tearDown();
}
// this method assumes the use of the selector auth bundle
@Test
public void testWithAcceptHeaderIncorrectCredentials() throws Exception {
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new NameValuePair("j_username", "garbage"));
params.add(new NameValuePair("j_password", "garbage"));
// simulate a browser request
List<Header> headers = new ArrayList<Header>();
headers.add(new Header("User-Agent", "Mozilla/5.0 Sling Integration Test"));
HttpMethod post = assertPostStatus(HttpTest.HTTP_BASE_URL + "/j_security_check", HttpServletResponse.SC_MOVED_TEMPORARILY, params, headers, null);
final String location = post.getResponseHeader("Location").getValue();
assertNotNull(location);
assertTrue(location.startsWith(HttpTest.HTTP_BASE_URL + "/system/sling/selector/login?"));
assertTrue(location.contains("resource=%2F"));
assertTrue(location.contains("j_reason=INVALID_CREDENTIALS"));
}
// TODO - move this method into commons.testing
protected HttpMethod assertPostStatus(String url, int expectedStatusCode, List<NameValuePair> postParams, List<Header> headers, String assertMessage) throws IOException {
final PostMethod post = new PostMethod(url);
post.setFollowRedirects(false);
if (headers != null) {
for (Header header : headers) {
post.addRequestHeader(header);
}
}
if (postParams != null) {
final NameValuePair[] nvp = {};
post.setRequestBody(postParams.toArray(nvp));
}
final int status = H.getHttpClient().executeMethod(post);
if (assertMessage == null) {
assertEquals(expectedStatusCode, status);
} else {
assertEquals(assertMessage, expectedStatusCode, status);
}
return post;
}
}
| [
"[email protected]"
] | |
11ba04332162277af844cff29096458784134428 | 71e26022264d65faa781f3f5257fe13caeb085ac | /Spring23_formacion_spring_mvc_hexagonal/src/adapter/web/controller/ConsultarMatriculasController.java | 561df3fb76f398b1fcb43df0f7a5e4f4b5335c5b | [] | no_license | z3r0m4nc3r/JavaEE | a065260daf7a9965535899da51d3689e94098b67 | b846d9a3e4f3084370071fa6d956f213b228c684 | refs/heads/master | 2023-01-31T08:00:32.535279 | 2020-12-09T12:51:03 | 2020-12-09T12:51:03 | 310,249,434 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 825 | java | package adapter.web.controller;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import service.MatriculasService;
/**
* Servlet implementation class ConsultarMatriculasAction
*/
@Controller
public class ConsultarMatriculasController {
@Autowired
MatriculasService service;
@PostMapping("doConsultarMatriculas")
public String matriculas(HttpServletRequest request, @RequestParam("fecha1") String fecha1, @RequestParam("fecha2") String fecha2) {
request.setAttribute("matriculas", service.consultarMatriculas(fecha1,fecha2));
return "matriculas";
}
}
| [
"[email protected]"
] | |
a1873dcefd5ce935ddf099b9e6bce1547bdbc693 | 9a6ea6087367965359d644665b8d244982d1b8b6 | /src/main/java/X/AnonymousClass05S.java | 34fec2e60b5806fb93b0f507db62b5da615b0268 | [] | no_license | technocode/com.wa_2.21.2 | a3dd842758ff54f207f1640531374d3da132b1d2 | 3c4b6f3c7bdef7c1523c06d5bd9a90b83acc80f9 | refs/heads/master | 2023-02-12T11:20:28.666116 | 2021-01-14T10:22:21 | 2021-01-14T10:22:21 | 329,578,591 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 6,253 | java | package X;
import android.os.Bundle;
import android.os.IBinder;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.ArrayList;
/* renamed from: X.05S reason: invalid class name */
public final class AnonymousClass05S {
public static boolean A0H(Object obj, Object obj2) {
if (obj != obj2) {
return obj != null && obj.equals(obj2);
}
return true;
}
public static byte A00(Parcel parcel, int i) {
A0E(parcel, i, 4);
return (byte) parcel.readInt();
}
public static float A01(Parcel parcel, int i) {
A0E(parcel, i, 4);
return parcel.readFloat();
}
public static int A02(Parcel parcel) {
int readInt = parcel.readInt();
int A04 = A04(parcel, readInt);
int dataPosition = parcel.dataPosition();
if ((65535 & readInt) != 20293) {
String valueOf = String.valueOf(Integer.toHexString(readInt));
throw new AnonymousClass18H(valueOf.length() != 0 ? "Expected object header. Got 0x".concat(valueOf) : new String("Expected object header. Got 0x"), parcel);
}
int i = A04 + dataPosition;
if (i >= dataPosition && i <= parcel.dataSize()) {
return i;
}
StringBuilder sb = new StringBuilder(54);
sb.append("Size read is invalid start=");
sb.append(dataPosition);
sb.append(" end=");
sb.append(i);
throw new AnonymousClass18H(sb.toString(), parcel);
}
public static int A03(Parcel parcel, int i) {
A0E(parcel, i, 4);
return parcel.readInt();
}
public static int A04(Parcel parcel, int i) {
return (i & -65536) != -65536 ? (i >> 16) & 65535 : parcel.readInt();
}
public static long A05(Parcel parcel, int i) {
A0E(parcel, i, 8);
return parcel.readLong();
}
public static Bundle A06(Parcel parcel, int i) {
int A04 = A04(parcel, i);
int dataPosition = parcel.dataPosition();
if (A04 == 0) {
return null;
}
Bundle readBundle = parcel.readBundle();
parcel.setDataPosition(dataPosition + A04);
return readBundle;
}
public static IBinder A07(Parcel parcel, int i) {
int A04 = A04(parcel, i);
int dataPosition = parcel.dataPosition();
if (A04 == 0) {
return null;
}
IBinder readStrongBinder = parcel.readStrongBinder();
parcel.setDataPosition(dataPosition + A04);
return readStrongBinder;
}
public static Parcelable A08(Parcel parcel, int i, Parcelable.Creator creator) {
int A04 = A04(parcel, i);
int dataPosition = parcel.dataPosition();
if (A04 == 0) {
return null;
}
Parcelable parcelable = (Parcelable) creator.createFromParcel(parcel);
parcel.setDataPosition(dataPosition + A04);
return parcelable;
}
public static String A09(Parcel parcel, int i) {
int A04 = A04(parcel, i);
int dataPosition = parcel.dataPosition();
if (A04 == 0) {
return null;
}
String readString = parcel.readString();
parcel.setDataPosition(dataPosition + A04);
return readString;
}
public static ArrayList A0A(Parcel parcel, int i) {
int A04 = A04(parcel, i);
int dataPosition = parcel.dataPosition();
if (A04 == 0) {
return null;
}
ArrayList<String> createStringArrayList = parcel.createStringArrayList();
parcel.setDataPosition(dataPosition + A04);
return createStringArrayList;
}
public static ArrayList A0B(Parcel parcel, int i, Parcelable.Creator creator) {
int A04 = A04(parcel, i);
int dataPosition = parcel.dataPosition();
if (A04 == 0) {
return null;
}
ArrayList createTypedArrayList = parcel.createTypedArrayList(creator);
parcel.setDataPosition(dataPosition + A04);
return createTypedArrayList;
}
public static void A0C(Parcel parcel, int i) {
if (parcel.dataPosition() != i) {
throw new AnonymousClass18H(AnonymousClass008.A08(37, "Overread allowed size end=", i), parcel);
}
}
public static void A0D(Parcel parcel, int i) {
parcel.setDataPosition(parcel.dataPosition() + A04(parcel, i));
}
public static void A0E(Parcel parcel, int i, int i2) {
int A04 = A04(parcel, i);
if (A04 != i2) {
String hexString = Integer.toHexString(A04);
StringBuilder sb = new StringBuilder(AnonymousClass008.A00(hexString, 46));
sb.append("Expected size ");
sb.append(i2);
sb.append(" got ");
sb.append(A04);
throw new AnonymousClass18H(AnonymousClass008.A0P(sb, " (0x", hexString, ")"), parcel);
}
}
public static void A0F(Parcel parcel, int i, int i2) {
if (i != i2) {
String hexString = Integer.toHexString(i);
StringBuilder sb = new StringBuilder(AnonymousClass008.A00(hexString, 46));
sb.append("Expected size ");
sb.append(i2);
sb.append(" got ");
sb.append(i);
throw new AnonymousClass18H(AnonymousClass008.A0P(sb, " (0x", hexString, ")"), parcel);
}
}
public static boolean A0G(Parcel parcel, int i) {
A0E(parcel, i, 4);
return parcel.readInt() != 0;
}
public static byte[] A0I(Parcel parcel, int i) {
int A04 = A04(parcel, i);
int dataPosition = parcel.dataPosition();
if (A04 == 0) {
return null;
}
byte[] createByteArray = parcel.createByteArray();
parcel.setDataPosition(dataPosition + A04);
return createByteArray;
}
public static Object[] A0J(Parcel parcel, int i, Parcelable.Creator creator) {
int A04 = A04(parcel, i);
int dataPosition = parcel.dataPosition();
if (A04 == 0) {
return null;
}
Object[] createTypedArray = parcel.createTypedArray(creator);
parcel.setDataPosition(dataPosition + A04);
return createTypedArray;
}
}
| [
"[email protected]"
] | |
5912b45f3f40c699ff55823d15916e1ac47acf35 | 3c33682bdc5d43fdee969a39bb1c78468d2bd29d | /app/src/main/java/com/frontad/frontadvertisement/main/AdAdapter.java | 99424b5b7679004926fed060ff406f96d1c88de8 | [] | no_license | DSM-Front-Advertisement/Front-Advertisement-Android | c7daa5020deb8ea98dcf20a3157757f94f529df0 | 261cb762c838c94ad516fd6c6ba7f3c99e205296 | refs/heads/master | 2023-01-18T23:18:27.405867 | 2020-12-03T02:30:15 | 2020-12-03T02:30:15 | 294,278,104 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,435 | java | package com.frontad.frontadvertisement.main;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.DiffUtil;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewbinding.ViewBinding;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions;
import com.frontad.frontadvertisement.R;
import com.frontad.frontadvertisement.main.model.Ad;
import com.frontad.frontadvertisement.base.BaseViewHolder;
import com.frontad.frontadvertisement.databinding.AdImageItemBinding;
import com.frontad.frontadvertisement.databinding.AdMediaItemBinding;
import com.frontad.frontadvertisement.view.RecyclerItemClickListener;
import java.util.ArrayList;
import java.util.List;
public class AdAdapter extends RecyclerView.Adapter<BaseViewHolder<? extends ViewBinding>>{
private RecyclerItemClickListener clickListener;
public List<Ad> adList = new ArrayList<>();
private List<Ad> sortedList = new ArrayList<>();
public void setNewAdData(List<Ad> adList){
DiffCallback diffCallback = new DiffCallback(this.adList, adList);
DiffUtil.DiffResult diffResult = DiffUtil.calculateDiff(diffCallback);
diffResult.dispatchUpdatesTo(this);
this.adList = adList;
}
@Override
public void onViewAttachedToWindow(@NonNull BaseViewHolder<? extends ViewBinding> holder) {
super.onViewAttachedToWindow(holder);
}
@Override
public void onViewDetachedFromWindow(@NonNull BaseViewHolder<? extends ViewBinding> holder) {
super.onViewDetachedFromWindow(holder);
}
public void sortAds(List<Ad> adList){
this.sortedList = this.adList;
DiffCallback diffCallback = new DiffCallback(this.adList, adList);
DiffUtil.DiffResult diffResult = DiffUtil.calculateDiff(diffCallback);
diffResult.dispatchUpdatesTo(this);
this.sortedList = adList;
}
public void addAds(List<Ad> adList){
DiffCallback diffCallback = new DiffCallback(this.adList, adList);
DiffUtil.DiffResult diffResult = DiffUtil.calculateDiff(diffCallback);
diffResult.dispatchUpdatesTo(this);
this.adList.addAll(adList);
}
@NonNull
@Override
public BaseViewHolder<? extends ViewBinding> onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
if(viewType==0)
return new ImageViewHolder(AdImageItemBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false));
else
return new MediaViewHolder(AdMediaItemBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false));
}
@Override
public void onBindViewHolder(@NonNull BaseViewHolder holder, int position) {
holder.bind(adList.get(position));
if (holder.getItemViewType()==0) {
holder.itemView.setOnClickListener(v ->
clickListener.onClick(R.id.action_global_imageAdFragment, position, adList.get(position)));
}
else{
holder.itemView.setOnClickListener(v ->
clickListener.onClick(R.id.action_global_mediaAdFragment, position, adList.get(position)));
}
}
@Override
public int getItemViewType(int position) {
return adList.get(position).mediaType;
}
@Override
public int getItemCount() {
return adList.size();
}
public void setClickListener(RecyclerItemClickListener clickListener){
this.clickListener = clickListener;
}
static class ImageViewHolder extends BaseViewHolder<AdImageItemBinding> {
public ImageViewHolder(@NonNull AdImageItemBinding binding) {
super(binding);
}
public void bind(Ad ad){
Glide.with(binding.adImg)
.load(String.format("https://s3-1-advertisement.s3.ap-northeast-2.amazonaws.com/%s",ad.imageId))
.error(R.drawable.ic_error)
.transition(DrawableTransitionOptions.withCrossFade())
.into(binding.adImg);
}
}
static class MediaViewHolder extends BaseViewHolder<AdMediaItemBinding> {
public MediaViewHolder(@NonNull AdMediaItemBinding binding) {
super(binding);
}
public void bind(Ad ad){
Glide.with(binding.mediaThumbnailImg)
.load(String.format("https://img.youtube.com/vi/%s/0.jpg", ad.youtubeLink))
.transition(DrawableTransitionOptions.withCrossFade())
.into(binding.mediaThumbnailImg);
}
}
}
class DiffCallback extends DiffUtil.Callback{
private final List<Ad> oldList;
private final List<Ad> newList;
public DiffCallback(List<Ad> oldList, List<Ad> newList){
this.oldList = oldList;
this.newList = newList;
}
@Override
public int getOldListSize() {
return oldList.size();
}
@Override
public int getNewListSize() {
return newList.size();
}
@Override
public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) {
return oldList.get(oldItemPosition) == newList.get(newItemPosition);
}
@Override
public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) {
return areItemsTheSame(oldItemPosition, newItemPosition);
}
}
| [
"[email protected]"
] | |
0eb81a847ce8eaf0a36325fd2c4d1a92333973d2 | f44b16d9bce136ed8979a4285f42648c6a33f260 | /src/main/java/defpackage/RotatedIcon.java | 6f2f27bfcd801c22066823ed6f863796e9c3b420 | [] | no_license | dem2k/Protopuddle | 40c8b30fa2cdfec5aeca3eb87ed3e798c22cfb4f | aaff2a16e26ecffe1da8c4632561c6e89901b6c2 | refs/heads/master | 2021-04-05T20:44:20.761922 | 2020-10-14T10:13:22 | 2020-10-14T10:13:22 | 248,599,569 | 7 | 5 | null | 2020-10-14T10:13:23 | 2020-03-19T20:34:41 | Java | UTF-8 | Java | false | false | 4,474 | java | package defpackage;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import javax.swing.Icon;
/* renamed from: RotatedIcon reason: default package */
public class RotatedIcon implements Icon {
private boolean circularIcon;
private double degrees;
private Icon icon;
private Rotate rotate;
/* renamed from: RotatedIcon$Rotate */
public enum Rotate {
DOWN,
UP,
UPSIDE_DOWN,
ABOUT_CENTER
}
public RotatedIcon(Icon icon2) {
this(icon2, Rotate.UP);
}
public RotatedIcon(Icon icon2, Rotate rotate2) {
this.icon = icon2;
this.rotate = rotate2;
}
public RotatedIcon(Icon icon2, double degrees2) {
this(icon2, degrees2, false);
}
public RotatedIcon(Icon icon2, double degrees2, boolean circularIcon2) {
this(icon2, Rotate.ABOUT_CENTER);
setDegrees(degrees2);
setCircularIcon(circularIcon2);
}
public Icon getIcon() {
return this.icon;
}
public Rotate getRotate() {
return this.rotate;
}
public double getDegrees() {
return this.degrees;
}
public void setDegrees(double degrees2) {
this.degrees = degrees2;
}
public boolean isCircularIcon() {
return this.circularIcon;
}
public void setCircularIcon(boolean circularIcon2) {
this.circularIcon = circularIcon2;
}
public int getIconWidth() {
if (this.rotate == Rotate.ABOUT_CENTER) {
if (this.circularIcon) {
return this.icon.getIconWidth();
}
double radians = Math.toRadians(this.degrees);
double sin = Math.abs(Math.sin(radians));
return (int) Math.floor((((double) this.icon.getIconWidth()) * Math.abs(Math.cos(radians))) + (((double) this.icon.getIconHeight()) * sin));
} else if (this.rotate == Rotate.UPSIDE_DOWN) {
return this.icon.getIconWidth();
} else {
return this.icon.getIconHeight();
}
}
public int getIconHeight() {
if (this.rotate == Rotate.ABOUT_CENTER) {
if (this.circularIcon) {
return this.icon.getIconHeight();
}
double radians = Math.toRadians(this.degrees);
double sin = Math.abs(Math.sin(radians));
return (int) Math.floor((((double) this.icon.getIconHeight()) * Math.abs(Math.cos(radians))) + (((double) this.icon.getIconWidth()) * sin));
} else if (this.rotate == Rotate.UPSIDE_DOWN) {
return this.icon.getIconHeight();
} else {
return this.icon.getIconWidth();
}
}
public void paintIcon(Component c, Graphics g, int x, int y) {
int xAdjustment;
int yAdjustment;
Graphics2D g2 = (Graphics2D)g.create();
int cWidth = this.icon.getIconWidth() / 2;
int cHeight = this.icon.getIconHeight() / 2;
if (this.icon.getIconWidth() % 2 == 0) {
xAdjustment = 0;
} else {
xAdjustment = -1;
}
if (this.icon.getIconHeight() % 2 == 0) {
yAdjustment = 0;
} else {
yAdjustment = -1;
}
if (this.rotate == Rotate.DOWN) {
g2.translate(x + cHeight, y + cWidth);
g2.rotate(Math.toRadians(90.0d));
this.icon.paintIcon(c, g2, -cWidth, yAdjustment - cHeight);
} else if (this.rotate == Rotate.UP) {
g2.translate(x + cHeight, y + cWidth);
g2.rotate(Math.toRadians(-90.0d));
this.icon.paintIcon(c, g2, xAdjustment - cWidth, -cHeight);
} else if (this.rotate == Rotate.UPSIDE_DOWN) {
g2.translate(x + cWidth, y + cHeight);
g2.rotate(Math.toRadians(180.0d));
this.icon.paintIcon(c, g2, xAdjustment - cWidth, yAdjustment - cHeight);
} else if (this.rotate == Rotate.ABOUT_CENTER) {
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.setClip(x, y, getIconWidth(), getIconHeight());
g2.translate((getIconWidth() - this.icon.getIconWidth()) / 2, (getIconHeight() - this.icon.getIconHeight()) / 2);
g2.rotate(Math.toRadians(this.degrees), (double) (x + cWidth), (double) (y + cHeight));
this.icon.paintIcon(c, g2, x, y);
}
g2.dispose();
}
}
| [
"[email protected]"
] | |
fd9b2efbca9fd2930d19b9ee7a2e415055cfff4d | b1c0707a5e222c0d264f95d71abf8a368cf68155 | /src/java/main/com/sciencenetwork/data/type4/Parent.java | 97afb48f9dae16edae228f45198095a343e75eb3 | [] | no_license | jfharney/sixthcolumn-snservices | d98444cbd80a47058e8bb3d6681339dd91072f8a | 3603af2c9c84db3bd23a7830987353b95f8911aa | refs/heads/master | 2021-01-23T06:25:41.026966 | 2012-08-29T18:34:32 | 2012-08-29T18:34:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,327 | java | package com.sciencenetwork.data.type4;
import org.jdom.Element;
import com.sciencenetwork.data.ReturnedObjects;
public class Parent implements ReturnedObjects {
private String action;
private String discovery;
@Override
public Element toElement() {
// TODO Auto-generated method stub
return null;
}
@Override
public String toXML() {
// TODO Auto-generated method stub
return null;
}
@Override
public String toJSON() {
// TODO Auto-generated method stub
return null;
}
@Override
public void toDataStore(String type) {
// TODO Auto-generated method stub
}
@Override
public void fromXML() {
// TODO Auto-generated method stub
}
@Override
public void fromDataStore(String type) {
// TODO Auto-generated method stub
}
@Override
public void fromDataStore(String type, String file) {
// TODO Auto-generated method stub
}
@Override
public void toDataStore(String type, String file) {
// TODO Auto-generated method stub
}
@Override
public void fromXML(String xmlStr) {
// TODO Auto-generated method stub
}
public String getAction() {
return action;
}
public void setAction(String action) {
this.action = action;
}
public String getDiscovery() {
return discovery;
}
public void setDiscovery(String discovery) {
this.discovery = discovery;
}
}
| [
"[email protected]"
] | |
af7743c2ba878a057df87bccf69daa5638d1feab | bf938af4862ac3a2aace5e3551e6d1d3f8fc2a07 | /src/main/java/com/bocai/common/constant/AppConstant.java | 1d56291e5537443337b3c0a687e0ce265626a25a | [] | no_license | wptree/bocai | 165a5d93b63d7ac6aa7bcc4d29f66e4c5a37bf40 | b0b9a75e3c9231c0c4e09ca948b7c672b4867543 | refs/heads/master | 2016-09-10T19:46:01.821225 | 2013-03-28T11:39:17 | 2013-03-28T11:39:17 | 9,075,297 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,149 | java | package com.bocai.common.constant;
public interface AppConstant {
public static final String BLANK = " ";
public static final String EMPTY = "";
public static final String AT = "@";
public static final String LEFT_PTS = "(";
public static final String RIGHT_PTS = ")";
public static final String URL_SEPARATOR = "/";
public static final String JTEMPLATE_PATH = "/WEB-INF/page/jtemplate";
public static final String JTEMPLATE_EXTENSION = ".jsp";
public static final String COOKIE_LOGIN_USER_ID = "cookieLoginUserID";
public static final String SESSION_LOGIN_USER_ID = "sessionLoginUserId";
public static final String SESSION_REDIRECTION_URL = "sessionRedirectionUrl";
public static final String SESSION_LOGIN_USER = "sessionLoginUser";
public static final String SESSION_SIGN_UP_WIZARD = "sessionSignUpWizard";
public static final String SESSION_MAP_QSTR = "sessionMapQstr";
public static final String SESSION_TASK_STATUS = "sessionTaskStatus";
public static final String SESSION_AUTH_CODE = "authCode";
public static final String SESSION_USER_CITY = "userCity";
public static final int GENIUS_SUGGEST_LIST_SIZE = 4;
}
| [
"[email protected]"
] | |
f8c41b8f7c776b5c17810bd895bb108ad3148d7e | 720290954035d5c0a55c4610f47249ece7f41ea2 | /SystemServer/src/main/java/com/prostate/base/service/impl/PriceServiceImpl.java | bdbaa262c2b1656b21c0b90e5399bdaa0117ca26 | [] | no_license | MaxCoderCh/Sicmed | ff553d5ebc51d5e71e1379166dd7977d42553905 | 4beededf51b2a88f087efd42305f6b86f5412622 | refs/heads/master | 2022-09-12T03:24:33.580720 | 2019-05-31T06:01:55 | 2019-05-31T06:01:55 | 145,105,349 | 1 | 0 | null | 2022-09-01T22:49:45 | 2018-08-17T10:08:48 | JavaScript | UTF-8 | Java | false | false | 1,237 | java | package com.prostate.base.service.impl;
import com.prostate.base.domain.PriceDO;
import com.prostate.base.mapper.slaver.PriceReadMapper;
import com.prostate.base.mapper.master.PriceWriteMapper;
import com.prostate.base.service.PriceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
@Service
public class PriceServiceImpl implements PriceService {
@Autowired
private PriceReadMapper priceReadMapper;
@Autowired
private PriceWriteMapper priceWriteMapper;
@Override
public PriceDO get(String id){
return priceReadMapper.get(id);
}
@Override
public List<PriceDO> list(Map<String, Object> map){
return priceReadMapper.list(map);
}
@Override
public int count(Map<String, Object> map){
return priceReadMapper.count(map);
}
@Override
public int save(PriceDO priceDO){
return priceWriteMapper.save(priceDO);
}
@Override
public int update(PriceDO priceDO){
return priceWriteMapper.update(priceDO);
}
@Override
public int remove(String id){
return priceWriteMapper.remove(id);
}
@Override
public int batchRemove(String[] ids){
return priceWriteMapper.batchRemove(ids);
}
}
| [
"[email protected]"
] | |
8d5a2771685e6b634ce5e64c9bd2d0caeba490e5 | 05a50631a37dcacde3c28f79c47117d1dd8df588 | /src/main/java/com/bestgroup/app/dao/EmployeeDAO.java | 45733ff0bdba49a19702d07ce448b1f5044e729a | [] | no_license | EmersonJoseBomfimSampaio/les-webapp | b85c2a8019e7ee1b5c1dd6fd73985e5ee10e4c50 | 9445236b52d27d4cfee2c0ca18060f4148fa48d4 | refs/heads/master | 2020-07-22T23:27:19.084905 | 2019-09-12T18:43:12 | 2019-09-12T18:43:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,620 | java | package com.bestgroup.app.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;
import java.util.List;
import com.bestgroup.app.domain.Employee;
import com.bestgroup.core.dao.DAO;
import com.bestgroup.core.domain.Entity;
import com.bestgroup.util.formater.StatementFormater;
public class EmployeeDAO extends DAO {
public EmployeeDAO(Connection connection) {
super(connection);
}
@Override
public List<Entity> read(Entity entity) throws SQLException {
return null;
}
@Override
public Entity create(Entity entity) throws SQLException {
Employee employee = (Employee) entity;
employee.setCreatedAt(new Date());
ResultSet generatedKeys;
StatementFormater formater = new StatementFormater(this.connection);
PreparedStatement statement = formater.format("INSERT INTO "
+ "employees(role_id, employee_id, name, email, password, created_at) "
+ "VALUES(?, ?, ? ,? ,? ,?) ",
employee.getRole() == null ? null : employee.getRole().getId(),
employee.getEmployee() == null ? null : employee.getEmployee().getId(),
employee.getName(),
employee.getEmail(),
employee.getPassword(),
employee.getCreatedAt()
);
statement.executeUpdate();
generatedKeys = statement.getGeneratedKeys();
generatedKeys.next();
employee.setId(generatedKeys.getLong(1));
return employee;
}
@Override
public Entity update(Entity entity) throws SQLException {
Employee employee = (Employee) entity;
employee.setUpdatedAt(new Date());
StatementFormater formater = new StatementFormater(this.connection);
PreparedStatement statement = formater.format("UPDATE employees "
+ "SET role_id = ?, employee_id = ?, name = ?, email = ?, password = ?, updated_at = ?"
+ "WHERE id = ? ",
employee.getRole() == null ? null : employee.getRole().getId(),
employee.getEmployee() == null ? null : employee.getEmployee().getId(),
employee.getName(),
employee.getEmail(),
employee.getPassword(),
employee.getUpdatedAt(),
employee.getId()
);
statement.executeUpdate();
return employee;
}
@Override
public Entity delete(Entity entity) throws SQLException {
Employee employee = (Employee) entity;
employee.setDeletedAt(new Date());
StatementFormater formater = new StatementFormater(this.connection);
PreparedStatement statement = formater.format("UPDATE employees SET deleted_at = ? WHERE id = ?",
employee.getDeletedAt(),
employee.getId());
statement.executeUpdate();
return entity;
}
}
| [
"[email protected]"
] | |
62cb3f350e7a4816990c95ba9e55dea5e3858a74 | cbca459181b4516ee273a5b1f762728d26f9e513 | /plugin_core/src/main/java/com/bingoloves/plugin_core/adapter/recyclerview/utils/CustomItemDecoration.java | 08293eef3366c5beeb5510bd4545970288710630 | [] | no_license | bingoloves/VirtualApp | 3feb78463ec04dacbf27a8579680b899da78c932 | d95bca4bb1a495dd6aa5c38f65ba261c6a18a05a | refs/heads/main | 2023-02-14T22:21:02.024835 | 2021-01-13T08:48:55 | 2021-01-13T08:48:55 | 315,262,821 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,456 | java | package com.bingoloves.plugin_core.adapter.recyclerview.utils;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.support.annotation.DrawableRes;
import android.support.annotation.IntDef;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import com.bingoloves.plugin_core.R;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
public class CustomItemDecoration extends RecyclerView.ItemDecoration {
@Retention(RetentionPolicy.SOURCE)
@IntDef({
ItemDecoration.HORIZONTAL,
ItemDecoration.VERTICAL
})
public @interface ItemDecoration{
int HORIZONTAL= LinearLayoutManager.HORIZONTAL;
int VERTICAL = LinearLayoutManager.VERTICAL;
}
private int rightInset;
private Drawable mDivider;
private int mOrientation;
/**
* 分割线缩进值
*/
private int leftInset;
private Paint paint;
public CustomItemDecoration(Context context, @ItemDecoration int orientation) {
this(context, orientation, R.drawable.split_line_linear);
}
public CustomItemDecoration(Context context, @ItemDecoration int orientation, int leftInset, int rightInset) {
this(context, orientation, R.drawable.split_line_linear,leftInset,rightInset);
}
public CustomItemDecoration(Context context, @ItemDecoration int orientation, @DrawableRes int drawable) {
this(context, orientation, drawable, 0);
}
// public CustomItemDecoration(Context context, @ItemDecoration int orientation, @DrawableRes int drawable, int inset) {
// this(context, orientation, drawable, inset, inset);
// }
/**
* @param context
* @param orientation layout的方向
* @param drawable 引入的drawable的ID
* @param leftInset 左边分割线缩进值
* @param rightInset 右边分割线缩进值
*/
public CustomItemDecoration(Context context, @ItemDecoration int orientation, @DrawableRes int drawable, int leftInset, int rightInset) {
mDivider = context.getResources().getDrawable(drawable);
this.leftInset = leftInset;
this.rightInset = rightInset;
paint = new Paint();
paint.setColor(context.getResources().getColor(android.R.color.white));
paint.setStyle(Paint.Style.FILL);
paint.setAntiAlias(true);
setOrientation(orientation);
}
public void setOrientation(int orientation) {
if (orientation != ItemDecoration.VERTICAL && orientation != ItemDecoration.HORIZONTAL) {
throw new IllegalArgumentException("invalid orientation");
}
mOrientation = orientation;
}
@Override
public void onDraw(Canvas c, RecyclerView parent) {
if (mOrientation == ItemDecoration.VERTICAL) {
drawVertical(c, parent);
} else {
drawHorizontal(c, parent);
}
}
private void drawVertical(Canvas c, RecyclerView parent) {
final int left = parent.getPaddingLeft();
final int right = parent.getWidth() - parent.getPaddingRight();
final int childCount = parent.getChildCount();
//最后一个item不画分割线
for (int i = 0; i < childCount - 1; i++) {
final View child = parent.getChildAt(i);
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
final int top = child.getBottom() + params.bottomMargin;
final int bottom = top + mDivider.getIntrinsicHeight();
if (leftInset > 0) {
c.drawRect(left, top, right, bottom, paint);
if (right > 0) {
mDivider.setBounds(left + leftInset, top, right - rightInset, bottom);
} else {
mDivider.setBounds(left + leftInset, top, right, bottom);
}
} else {
if (right > 0) {
mDivider.setBounds(left, top, right - rightInset, bottom);
} else {
mDivider.setBounds(left, top, right, bottom);
}
}
mDivider.draw(c);
}
}
private void drawHorizontal(Canvas c, RecyclerView parent) {
final int top = parent.getPaddingTop();
final int bottom = parent.getHeight() - parent.getPaddingBottom();
final int childCount = parent.getChildCount();
for (int i = 0; i < childCount - 1; i++) {
final View child = parent.getChildAt(i);
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
final int left = child.getRight() + params.rightMargin;
final int right = left + mDivider.getIntrinsicHeight();
mDivider.setBounds(left, top, right, bottom);
mDivider.draw(c);
}
}
//由于Divider也有宽高,每一个Item需要向下或者向右偏移
@Override
public void getItemOffsets(Rect outRect, int itemPosition, RecyclerView parent) {
if (mOrientation == ItemDecoration.VERTICAL) {
outRect.set(0, 0, 0, mDivider.getIntrinsicHeight());
} else {
outRect.set(0, 0, mDivider.getIntrinsicWidth(), 0);
}
}
} | [
"[email protected]"
] | |
b6f27d2a98e07907dafe80ece8d0e4147b730a07 | a93ffb1a57296e4ff7804528189cea7f9a68c6be | /设计模式/模板模式/AbstractDisplay.java | c7d9a540142df8d9fd4fd5147f8a1cad3ab47ad7 | [] | no_license | levenYes/coding-10000days | 4a98f3538d1899428827c4870741495482f58da7 | 0dc356e488a01f608ad7155629de7fb0471ac7dc | refs/heads/master | 2020-03-06T17:55:39.371711 | 2018-05-04T14:40:31 | 2018-05-04T14:40:31 | 126,997,110 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,772 | java | /**
* Template Method模式
* 带有模板功能的模式,组成模板的方法被定义在父类上中。
* 由于这些方法是抽象方法,
* 所以只查看父类的代码是无法知道这些方法最终会进行何种具体处理的,
* 唯一能知道的就是父类是如何调用这些方法的。
*
* 实现上述这些抽象方法的是子类。
* 在子类中实现了抽象方法也就决定了具体的处理。
* 也就是说,只要在不同的子类中实现不同的具体处理,
* 当父类的模板方法被调用时程序行为也会不同。
* 但是,无论子类中的具体实现如何,
* 处理的流程都会按照父类中所定义的那样进行。
*
* 像这样在父类中定义处理流程的框架,
* 在子类中实现具体处理的模式就称为模板模式
*
*/
public abstract class AbstractDisplay {
public abstract void open();
public abstract void print();
public abstract void close();
public final void display() {
open();
for (int i = 0; i < 5; i++) {
print();
}
close();
}
}
public class CharDisplay extends AbstractDisplay {
private char ch;
public CharDisplay(char ch) {
this.ch = ch;
}
public void open() {
System.out.print("<<");
}
public void print() {
System.out.print("ch");
}
public void close() {
System.out.println(">>");
}
}
public class StringDisplay extends AbstractDisplay {
private String string;
private int width;
public StringDisplay (String string) {
this.string = string;
this.width = string.getBytes().length;
}
public void open() {
printLine();
}
public void print() {
System.out.println("|" + string + "|");
}
public void close() {
printLine();
}
private void printline() {
System.out.print("+");
for (int i = 0; i < width; i++) {
System.out.print("-");
}
System.out.println("+");
}
}
public class Main {
public static void main(String[] args) {
AbstractDisplay d1 = new CharDisplay('H');
AbstractDisplay d2 = new StringDisplay("Hello, world.");
AbstractDisplay d3 = new StringDisplay("你好,世界。");
d1.display();
d2.display();
d3.display();
}
}
/**
* 使用父类类型的变量保存子类实例的优点是,
* 即使没有用instanceof等指定子类的种类,
* 程序也能正常工作。
*
* 无论在父类类型的变量中保存哪个子类的实例,
* 程序都可以正常工作,
* 这种原则称为里氏替换原则(The Liskov Substitution Principle, LSP).
* LSP是一个通用的继承原则
*/
| [
"[email protected]"
] |
Subsets and Splits