blob_id
stringlengths
40
40
__id__
int64
225
39,780B
directory_id
stringlengths
40
40
path
stringlengths
6
313
content_id
stringlengths
40
40
detected_licenses
list
license_type
stringclasses
2 values
repo_name
stringlengths
6
132
repo_url
stringlengths
25
151
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
70
visit_date
timestamp[ns]
revision_date
timestamp[ns]
committer_date
timestamp[ns]
github_id
int64
7.28k
689M
star_events_count
int64
0
131k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
23 values
gha_fork
bool
2 classes
gha_event_created_at
timestamp[ns]
gha_created_at
timestamp[ns]
gha_updated_at
timestamp[ns]
gha_pushed_at
timestamp[ns]
gha_size
int64
0
40.4M
gha_stargazers_count
int32
0
112k
gha_forks_count
int32
0
39.4k
gha_open_issues_count
int32
0
11k
gha_language
stringlengths
1
21
gha_archived
bool
2 classes
gha_disabled
bool
1 class
content
stringlengths
7
4.37M
src_encoding
stringlengths
3
16
language
stringclasses
1 value
length_bytes
int64
7
4.37M
extension
stringclasses
24 values
filename
stringlengths
4
174
language_id
stringclasses
1 value
entities
list
contaminating_dataset
stringclasses
0 values
malware_signatures
list
redacted_content
stringlengths
7
4.37M
redacted_length_bytes
int64
7
4.37M
alphanum_fraction
float32
0.25
0.94
alpha_fraction
float32
0.25
0.94
num_lines
int32
1
84k
avg_line_length
float32
0.76
99.9
std_line_length
float32
0
220
max_line_length
int32
5
998
is_vendor
bool
2 classes
is_generated
bool
1 class
max_hex_length
int32
0
319
hex_fraction
float32
0
0.38
max_unicode_length
int32
0
408
unicode_fraction
float32
0
0.36
max_base64_length
int32
0
506
base64_fraction
float32
0
0.5
avg_csv_sep_count
float32
0
4
is_autogen_header
bool
1 class
is_empty_html
bool
1 class
shard
stringclasses
16 values
04fd75a51a904c35ba900ed91d1d3f173f94686c
2,130,303,832,187
a4e2fcf2da52f479c2c25164599bbdb2628a1ffa
/soft/sextante_lib/sextante/src/es/unex/sextante/additionalInfo/AdditionalInfo.java
8625bb0bef1a5dc7a9acfbc1e5717e567817e1f0
[]
no_license
GRSEB9S/sextante
https://github.com/GRSEB9S/sextante
126ffc222a2bed9918bae3b59f87f30158b9bbfe
8ea12c6c40712df01e2e87b02d722d51adb912ea
refs/heads/master
2021-05-28T19:24:23.306000
2013-03-04T15:21:30
2013-03-04T15:21:30
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package es.unex.sextante.additionalInfo; /** * Additional information for a {@link es.unex.sextante.parameters.Parameter} in a {@link es.unex.sextante.core.OutputObjectsSet} * * This information includes all the necessary elements to fully define the parameter, like a default value, a range of possible * values, or any other thing needed. * * @author Victor Olaya volaya@unex.es * */ public interface AdditionalInfo { public String getTextDescription(); }
UTF-8
Java
491
java
AdditionalInfo.java
Java
[ { "context": "alues, or any other thing needed.\r\n * \r\n * @author Victor Olaya volaya@unex.es\r\n * \r\n */\r\npublic interface Additi", "end": 382, "score": 0.9998989105224609, "start": 370, "tag": "NAME", "value": "Victor Olaya" }, { "context": " other thing needed.\r\n * \r\n * @author Victor Olaya volaya@unex.es\r\n * \r\n */\r\npublic interface AdditionalInfo {\r\n\r\n ", "end": 397, "score": 0.9998895525932312, "start": 383, "tag": "EMAIL", "value": "volaya@unex.es" } ]
null
[]
package es.unex.sextante.additionalInfo; /** * Additional information for a {@link es.unex.sextante.parameters.Parameter} in a {@link es.unex.sextante.core.OutputObjectsSet} * * This information includes all the necessary elements to fully define the parameter, like a default value, a range of possible * values, or any other thing needed. * * @author <NAME> <EMAIL> * */ public interface AdditionalInfo { public String getTextDescription(); }
478
0.727088
0.727088
16
28.6875
40.964497
129
false
false
0
0
0
0
0
0
0.3125
false
false
3
069ef15bb3cb3dec1571d3c7cdff29f33958bfcf
22,643,067,612,841
d19f1566d34ab22b36dc3910433eb870b10f5813
/app/src/main/java/id/web/faerul/boilerplate/util/customview/TitleBar.java
f9380265a791505322df1027c9a7319f5406cdcf
[ "Apache-2.0" ]
permissive
faerulsalamun/androidboilerplate-java
https://github.com/faerulsalamun/androidboilerplate-java
65aeebfe4fef2aa2d514c2808e96a5619bc406cc
aa93bbea26e9512ebd5d6c42dee2c3c06755d754
refs/heads/master
2021-08-19T12:34:43.768000
2017-11-26T08:56:13
2017-11-26T08:56:13
112,067,583
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package id.web.faerul.boilerplate.util.customview; import android.content.Context; import android.content.res.TypedArray; import android.support.annotation.StringRes; import android.util.AttributeSet; import android.util.TypedValue; import android.view.LayoutInflater; import android.view.View; import android.widget.ImageButton; import android.widget.RelativeLayout; import android.widget.TextView; import butterknife.BindView; import butterknife.ButterKnife; import id.web.faerul.boilerplate.R; /** * Created by faerulsalamun(faerulsalamun@gmail.com) on 10/13/16. */ public class TitleBar extends RelativeLayout { @BindView(R.id.titlebar_title) TextView mTxtTitle; @BindView(R.id.titlebar_action_button) ImageButton mActionButton; @BindView(R.id.titlebar_action_right_button) ImageButton mRightActionButton; public TitleBar(Context context) { this(context, null); } public TitleBar(Context context, AttributeSet attrs) { this(context, attrs, 0); } public TitleBar(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(); if (isInEditMode()) return; TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.TitleBar, 0, 0); int src = typedArray.getResourceId(R.styleable.TitleBar_src, 0); int rightSrc = typedArray.getResourceId(R.styleable.TitleBar_rightSrc, 0); mTxtTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); if (src != 0) mActionButton.setImageResource(src); if (rightSrc != 0) { mRightActionButton.setImageResource(rightSrc); mRightActionButton.setVisibility(View.VISIBLE); } } private void init() { LayoutInflater.from(getContext()).inflate(R.layout.custom_view_title_bar, this, true); if (isInEditMode()) return; ButterKnife.bind(this); } public void setTitle(@StringRes int resId) { mTxtTitle.setText(resId); } public void setTitle(String title) { mTxtTitle.setText(title); } public void setTitleTextSize(float size) { mTxtTitle.setTextSize(size); } public void setImageButton(int image) { mActionButton.setImageResource(image); } public void setImageRightButton(int image) { mRightActionButton.setImageResource(image); } public void setOnActionButtonClick(OnClickListener onActionButtonClick) { mActionButton.setOnClickListener(onActionButtonClick); } public void setSecondaryActionClick(OnClickListener secondaryActionClick) { mRightActionButton.setOnClickListener(secondaryActionClick); } }
UTF-8
Java
2,561
java
TitleBar.java
Java
[ { "context": "rt id.web.faerul.boilerplate.R;\n\n/**\n * Created by faerulsalamun(faerulsalamun@gmail.com) on 10/13/16.\n */\n\npublic", "end": 530, "score": 0.999592125415802, "start": 517, "tag": "USERNAME", "value": "faerulsalamun" }, { "context": "l.boilerplate.R;\n\n/**\n * Created by faerulsalamun(faerulsalamun@gmail.com) on 10/13/16.\n */\n\npublic class TitleBar extends ", "end": 554, "score": 0.9999312162399292, "start": 531, "tag": "EMAIL", "value": "faerulsalamun@gmail.com" } ]
null
[]
package id.web.faerul.boilerplate.util.customview; import android.content.Context; import android.content.res.TypedArray; import android.support.annotation.StringRes; import android.util.AttributeSet; import android.util.TypedValue; import android.view.LayoutInflater; import android.view.View; import android.widget.ImageButton; import android.widget.RelativeLayout; import android.widget.TextView; import butterknife.BindView; import butterknife.ButterKnife; import id.web.faerul.boilerplate.R; /** * Created by faerulsalamun(<EMAIL>) on 10/13/16. */ public class TitleBar extends RelativeLayout { @BindView(R.id.titlebar_title) TextView mTxtTitle; @BindView(R.id.titlebar_action_button) ImageButton mActionButton; @BindView(R.id.titlebar_action_right_button) ImageButton mRightActionButton; public TitleBar(Context context) { this(context, null); } public TitleBar(Context context, AttributeSet attrs) { this(context, attrs, 0); } public TitleBar(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(); if (isInEditMode()) return; TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.TitleBar, 0, 0); int src = typedArray.getResourceId(R.styleable.TitleBar_src, 0); int rightSrc = typedArray.getResourceId(R.styleable.TitleBar_rightSrc, 0); mTxtTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); if (src != 0) mActionButton.setImageResource(src); if (rightSrc != 0) { mRightActionButton.setImageResource(rightSrc); mRightActionButton.setVisibility(View.VISIBLE); } } private void init() { LayoutInflater.from(getContext()).inflate(R.layout.custom_view_title_bar, this, true); if (isInEditMode()) return; ButterKnife.bind(this); } public void setTitle(@StringRes int resId) { mTxtTitle.setText(resId); } public void setTitle(String title) { mTxtTitle.setText(title); } public void setTitleTextSize(float size) { mTxtTitle.setTextSize(size); } public void setImageButton(int image) { mActionButton.setImageResource(image); } public void setImageRightButton(int image) { mRightActionButton.setImageResource(image); } public void setOnActionButtonClick(OnClickListener onActionButtonClick) { mActionButton.setOnClickListener(onActionButtonClick); } public void setSecondaryActionClick(OnClickListener secondaryActionClick) { mRightActionButton.setOnClickListener(secondaryActionClick); } }
2,545
0.754783
0.748926
87
28.436781
25.571941
90
false
false
0
0
0
0
0
0
0.632184
false
false
3
dadcf401bee1b2251f4e751bdec08e6119c667a2
36,344,013,263,220
5fcbda3d69c987283b804bcb5b0a7e9befc2be93
/app/src/main/java/com/example/apple/secondproject/activity/SigninActivity.java
5bbf49d604670a7e6d82b85b1c8b8d48c38c1ff4
[]
no_license
GUTINGLIAO/SecondProject
https://github.com/GUTINGLIAO/SecondProject
ad5292c18afce242a062ba7a78518240b866a2fb
4df2de37b08f70203803244446aacd6260fcb0c1
refs/heads/master
2020-07-10T09:27:29.901000
2019-09-07T15:34:36
2019-09-07T15:34:36
204,231,084
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.apple.secondproject.activity; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.TextUtils; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import com.example.apple.secondproject.R; import com.example.apple.secondproject.util.CommonRequest; import com.example.apple.secondproject.util.HttpUtil; import com.example.apple.secondproject.util.Util; import org.json.JSONException; import org.json.JSONObject; import java.io.IOException; import okhttp3.Call; import okhttp3.Callback; import okhttp3.Response; public class SigninActivity extends AppCompatActivity { //定义控件 EditText userNameEdit; EditText passwordEdit; EditText passConfirmEdit; Button signInButton; //定义变量 String userName; String password; String passwordc; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_signin); //获取控件实例 userNameEdit = findViewById(R.id.sign_in_user_name); passwordEdit = findViewById(R.id.sign_in_password); passConfirmEdit = findViewById(R.id.sign_in_password_confirm); signInButton = findViewById(R.id.sign_in_button); signInButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //获取变量 userName = Util.handleString(userNameEdit.getText().toString()); password = Util.handleString(passwordEdit.getText().toString()); passwordc = Util.handleString(passConfirmEdit.getText().toString()); //有效性验证 String mesg = validateData(userName, password, passwordc); showResponse(mesg); if (mesg == "") { final CommonRequest request = new CommonRequest(); request.put("userName", userName); request.put("password", password); final String jsonRequest = request.getJsonStr(); HttpUtil.sendPostRequset("https://www.easy-mock.com/mock/5d63256c1ec417142732a7bd/signIn", jsonRequest, new Callback() { @Override public void onFailure(Call call, IOException e) { e.printStackTrace(); showResponse("Network ERROR"); } @Override public void onResponse(Call call, Response response) throws IOException { try { JSONObject jsonObject = new JSONObject(response.body().string()); Boolean result = jsonObject.getBoolean("data"); if (result == true) { showResponse("注册成功"); Intent intent = new Intent(SigninActivity.this, LoginActivity.class); startActivity(intent); } else { showResponse("注册失败"); } } catch (JSONException e) { e.printStackTrace(); } } }); } } }); } private String validateData(String userName, String password, String passwordc) { if (TextUtils.isEmpty(userName) | TextUtils.isEmpty(password) | TextUtils.isEmpty(passwordc)) { return "输入不能为空"; } else if (!(password.equals(passwordc))) { return "两次输入密码不一致"; } return ""; } private void showResponse(final String mesg) { runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(SigninActivity.this, mesg, Toast.LENGTH_SHORT).show(); } }); } }
UTF-8
Java
4,257
java
SigninActivity.java
Java
[ { "context": "est();\n request.put(\"userName\", userName);\n request.put(\"password\", pas", "end": 2055, "score": 0.9605560898780823, "start": 2047, "tag": "USERNAME", "value": "userName" }, { "context": " });\n }\n\n private String validateData(String userName, String password, String passwordc) {\n if ", "end": 3608, "score": 0.8837636709213257, "start": 3600, "tag": "USERNAME", "value": "userName" } ]
null
[]
package com.example.apple.secondproject.activity; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.TextUtils; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import com.example.apple.secondproject.R; import com.example.apple.secondproject.util.CommonRequest; import com.example.apple.secondproject.util.HttpUtil; import com.example.apple.secondproject.util.Util; import org.json.JSONException; import org.json.JSONObject; import java.io.IOException; import okhttp3.Call; import okhttp3.Callback; import okhttp3.Response; public class SigninActivity extends AppCompatActivity { //定义控件 EditText userNameEdit; EditText passwordEdit; EditText passConfirmEdit; Button signInButton; //定义变量 String userName; String password; String passwordc; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_signin); //获取控件实例 userNameEdit = findViewById(R.id.sign_in_user_name); passwordEdit = findViewById(R.id.sign_in_password); passConfirmEdit = findViewById(R.id.sign_in_password_confirm); signInButton = findViewById(R.id.sign_in_button); signInButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //获取变量 userName = Util.handleString(userNameEdit.getText().toString()); password = Util.handleString(passwordEdit.getText().toString()); passwordc = Util.handleString(passConfirmEdit.getText().toString()); //有效性验证 String mesg = validateData(userName, password, passwordc); showResponse(mesg); if (mesg == "") { final CommonRequest request = new CommonRequest(); request.put("userName", userName); request.put("password", password); final String jsonRequest = request.getJsonStr(); HttpUtil.sendPostRequset("https://www.easy-mock.com/mock/5d63256c1ec417142732a7bd/signIn", jsonRequest, new Callback() { @Override public void onFailure(Call call, IOException e) { e.printStackTrace(); showResponse("Network ERROR"); } @Override public void onResponse(Call call, Response response) throws IOException { try { JSONObject jsonObject = new JSONObject(response.body().string()); Boolean result = jsonObject.getBoolean("data"); if (result == true) { showResponse("注册成功"); Intent intent = new Intent(SigninActivity.this, LoginActivity.class); startActivity(intent); } else { showResponse("注册失败"); } } catch (JSONException e) { e.printStackTrace(); } } }); } } }); } private String validateData(String userName, String password, String passwordc) { if (TextUtils.isEmpty(userName) | TextUtils.isEmpty(password) | TextUtils.isEmpty(passwordc)) { return "输入不能为空"; } else if (!(password.equals(passwordc))) { return "两次输入密码不一致"; } return ""; } private void showResponse(final String mesg) { runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(SigninActivity.this, mesg, Toast.LENGTH_SHORT).show(); } }); } }
4,257
0.560384
0.555342
112
36.1875
28.131239
140
false
false
0
0
0
0
0
0
0.642857
false
false
3
c995bc4567b0f1cdf8f5a10cd216cc7d8bb7a845
34,016,141,006,950
963599f6f1f376ba94cbb504e8b324bcce5de7a3
/sources/com/google/android/gms/cloudmessaging/zzy.java
bd588499b80f5e55a7148b16d9514a919c19e215
[]
no_license
NikiHard/cuddly-pancake
https://github.com/NikiHard/cuddly-pancake
563718cb73fdc4b7b12c6233d9bf44f381dd6759
3a5aa80d25d12da08fd621dc3a15fbd536d0b3d4
refs/heads/main
2023-04-09T06:58:04.403000
2021-04-20T00:45:08
2021-04-20T00:45:08
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.google.android.gms.cloudmessaging; import android.os.Looper; import android.os.Message; import com.google.android.gms.internal.cloudmessaging.zze; /* compiled from: com.google.android.gms:play-services-cloud-messaging@@16.0.0 */ final class zzy extends zze { private final /* synthetic */ Rpc zza; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ zzy(Rpc rpc, Looper looper) { super(looper); this.zza = rpc; } public final void handleMessage(Message message) { this.zza.zza(message); } }
UTF-8
Java
589
java
zzy.java
Java
[]
null
[]
package com.google.android.gms.cloudmessaging; import android.os.Looper; import android.os.Message; import com.google.android.gms.internal.cloudmessaging.zze; /* compiled from: com.google.android.gms:play-services-cloud-messaging@@16.0.0 */ final class zzy extends zze { private final /* synthetic */ Rpc zza; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ zzy(Rpc rpc, Looper looper) { super(looper); this.zza = rpc; } public final void handleMessage(Message message) { this.zza.zza(message); } }
589
0.691002
0.684211
20
28.450001
26.123695
89
false
false
0
0
0
0
0
0
0.45
false
false
3
43504d520e3cff7114169f3dddab96ad2c88edd2
34,016,141,004,466
3b81b0415100a12f9401e9db5d753eddc8a4ebe3
/ListFileServlet.java
64befc00f2e3928a9e660e17ebae0d3a05cf6d67
[]
no_license
BaiAT/Code
https://github.com/BaiAT/Code
15d8db0b8d783768b4dc9c7969279035b0429949
fe4bf2841264492278db7689af09e30219fd3cab
refs/heads/master
2016-09-01T08:04:36.259000
2016-04-01T14:48:53
2016-04-01T14:48:53
55,239,122
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Servlet; import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.util.HashMap; import java.util.Map; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class ListFileServlet extends HttpServlet { /** * Constructor of the object. */ public ListFileServlet() { super(); } /** * Destruction of the servlet. <br> */ public void destroy() { super.destroy(); // Just puts "destroy" string in log // Put your code here } /** * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } /** * The doPost method of the servlet. <br> * * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //获取上传文件的目录 String uploadfilePath= this.getServletContext().getRealPath("/files"); System.out.println(uploadfilePath); //存储要下载的文件名 Map<String,String> filenameMap=new HashMap<String, String>(); //递归遍历目录下的所有文件和目录,将文件的文件名存储到Map中 listfile(new File(uploadfilePath),filenameMap); request.setAttribute("filenameMap", filenameMap); request.getRequestDispatcher("../listfile.jsp").forward(request, response); } private void listfile(File file, Map<String, String> filenameMap) { // TODO Auto-generated method stub if(!file.isFile()) { File files[]=file.listFiles(); for(File f:files) { listfile(f,filenameMap); } } else { filenameMap.put(file.getName(),file.getName()); } } /** * Initialization of the servlet. <br> * * @throws ServletException if an error occurs */ public void init() throws ServletException { // Put your code here } }
UTF-8
Java
2,701
java
ListFileServlet.java
Java
[]
null
[]
package Servlet; import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.util.HashMap; import java.util.Map; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class ListFileServlet extends HttpServlet { /** * Constructor of the object. */ public ListFileServlet() { super(); } /** * Destruction of the servlet. <br> */ public void destroy() { super.destroy(); // Just puts "destroy" string in log // Put your code here } /** * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } /** * The doPost method of the servlet. <br> * * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //获取上传文件的目录 String uploadfilePath= this.getServletContext().getRealPath("/files"); System.out.println(uploadfilePath); //存储要下载的文件名 Map<String,String> filenameMap=new HashMap<String, String>(); //递归遍历目录下的所有文件和目录,将文件的文件名存储到Map中 listfile(new File(uploadfilePath),filenameMap); request.setAttribute("filenameMap", filenameMap); request.getRequestDispatcher("../listfile.jsp").forward(request, response); } private void listfile(File file, Map<String, String> filenameMap) { // TODO Auto-generated method stub if(!file.isFile()) { File files[]=file.listFiles(); for(File f:files) { listfile(f,filenameMap); } } else { filenameMap.put(file.getName(),file.getName()); } } /** * Initialization of the servlet. <br> * * @throws ServletException if an error occurs */ public void init() throws ServletException { // Put your code here } }
2,701
0.69437
0.69437
97
24.917526
24.174055
78
false
false
0
0
0
0
0
0
1.525773
false
false
3
dd56f45ebc732ba32f81c8e4588b84cc8f529349
1,391,569,432,955
630026bc3d552853bc90f8e4e0ff2d7496c4dfc1
/Data Structures/Unit 4/Wilson_Charles_PA4/test/SmallestInArray_TDDTest.java
bb797eae05f4dbe0249f073056acddb2c6407dd0
[]
no_license
chwilso1999/DataStructuresLETU
https://github.com/chwilso1999/DataStructuresLETU
7bc89cadfbb9ebffdb816bc92212e7eab50ae51e
8cd5f04190dd2746a70c852c6b437ff252eeceea
refs/heads/master
2022-12-09T19:40:02.234000
2020-10-01T02:04:34
2020-10-01T02:04:34
300,108,782
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import org.junit.Test; import static org.junit.Assert.*; /** * * @author Charles * * Test List: * 1. Not enough elements in given args * 2. Incorrect output/ logic error */ public class SmallestInArray_TDDTest { public SmallestInArray_TDDTest() { } @Test public void testFindSmallest_Norm() { int tdd_Array[] = new int[]{99, 22, 33, 454, 1, 5, 3, 6}; int expResult = 1; int result = SmallestInArray_TDD.findSmallest(tdd_Array); assertEquals("Error with Logic: Should have returned \"0\"", expResult, result); } @Test(expected = NullPointerException.class) public void testFindSmallest_Null() { int tdd_Array[] = null; int expResult = 0; int result = SmallestInArray_TDD.findSmallest(tdd_Array); assertEquals("Error with Null input: Should have returned \"0\"", expResult, result); } }
UTF-8
Java
1,120
java
SmallestInArray_TDDTest.java
Java
[ { "context": "port static org.junit.Assert.*;\n\n/**\n *\n * @author Charles\n * \n * Test List:\n * 1. Not enough elements in gi", "end": 269, "score": 0.9996373057365417, "start": 262, "tag": "NAME", "value": "Charles" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import org.junit.Test; import static org.junit.Assert.*; /** * * @author Charles * * Test List: * 1. Not enough elements in given args * 2. Incorrect output/ logic error */ public class SmallestInArray_TDDTest { public SmallestInArray_TDDTest() { } @Test public void testFindSmallest_Norm() { int tdd_Array[] = new int[]{99, 22, 33, 454, 1, 5, 3, 6}; int expResult = 1; int result = SmallestInArray_TDD.findSmallest(tdd_Array); assertEquals("Error with Logic: Should have returned \"0\"", expResult, result); } @Test(expected = NullPointerException.class) public void testFindSmallest_Null() { int tdd_Array[] = null; int expResult = 0; int result = SmallestInArray_TDD.findSmallest(tdd_Array); assertEquals("Error with Null input: Should have returned \"0\"", expResult, result); } }
1,120
0.632143
0.615179
40
27
23.967686
79
false
false
0
0
0
0
0
0
0.6
false
false
3
1353cd6038795ed9628488601b166af4593f9ad7
8,504,035,310,171
46b42155da474773dd4f42f1af272bc9f7155565
/src/main/java/DataStructure/LinearSearchMain.java
009c94e8ce2a14d69d257bb5c7ec6653776da61d
[]
no_license
shinseongsu/Algorism
https://github.com/shinseongsu/Algorism
8104feadcc34f3022c04ba5dec2f7dced656c2b4
64e3b7be7d2755443a669050402f5cfc4d607cff
refs/heads/master
2023-04-26T18:06:04.441000
2021-05-31T13:37:49
2021-05-31T13:37:49
341,226,205
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package DataStructure; public class LinearSearchMain { public static void main(String[] args) { LinearSearch table = new LinearSearch(); // 테이블을 생성한다. table.add(1, "one"); table.add(10, "ten"); table.add(7, "seven"); table.add(5, "five"); table.add(2, "two"); table.add(8, "eight"); table.add(9, "nine"); table.add(4, "four"); table.add(3, "three"); String x; x = (String) table.search(10); if(x != null) { System.out.println("value = " + x); } else { System.out.println("Not found"); } } }
UTF-8
Java
667
java
LinearSearchMain.java
Java
[]
null
[]
package DataStructure; public class LinearSearchMain { public static void main(String[] args) { LinearSearch table = new LinearSearch(); // 테이블을 생성한다. table.add(1, "one"); table.add(10, "ten"); table.add(7, "seven"); table.add(5, "five"); table.add(2, "two"); table.add(8, "eight"); table.add(9, "nine"); table.add(4, "four"); table.add(3, "three"); String x; x = (String) table.search(10); if(x != null) { System.out.println("value = " + x); } else { System.out.println("Not found"); } } }
667
0.490015
0.471582
27
23.111111
16.762686
65
false
false
0
0
0
0
0
0
0.888889
false
false
3
0938e68e473bae1ff161b5a4119fb3431c6ccf1f
8,504,035,309,988
8e4318bdec9d00038b7b985a1d0eb037695ba7f7
/cctvcc-modules/cctvcc-system/src/main/java/cn/cctvcc/system/service/impl/SysUserServiceImpl.java
ae5d77c43d3faaff4e941e976667c3b9ba05db8f
[]
no_license
904316429/cctvcc
https://github.com/904316429/cctvcc
d2fcda49ec4ff894f925cf52957e4984d2f4287e
a81ca24b48605a6cbbb61a58d279bdbfb61beae9
refs/heads/master
2023-08-19T08:00:05.133000
2021-09-26T04:09:16
2021-09-26T04:09:16
407,736,438
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.cctvcc.system.service.impl; import cn.cctvcc.system.api.domain.SysUser; import cn.cctvcc.system.mapper.SysUserMapper; import cn.cctvcc.system.service.SysUserService; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /** * @description: 用户信息实现类 * @author: Jiang * @create: 2021-09-22 15:59 */ @Service public class SysUserServiceImpl implements SysUserService { @Autowired private SysUserMapper sysUserMapper; /** * 根据用户名称获取用户 * @param userName * @return */ @Override public SysUser selectUserByUserName(String userName) { QueryWrapper<SysUser> queryWrapper = new QueryWrapper<>(); queryWrapper.lambda().eq(SysUser :: getUserName, userName); return sysUserMapper.selectOne(queryWrapper); } }
UTF-8
Java
941
java
SysUserServiceImpl.java
Java
[ { "context": "Service;\n\n/**\n * @description: 用户信息实现类\n * @author: Jiang\n * @create: 2021-09-22 15:59\n */\n@Service\npublic ", "end": 403, "score": 0.9951575994491577, "start": 398, "tag": "NAME", "value": "Jiang" } ]
null
[]
package cn.cctvcc.system.service.impl; import cn.cctvcc.system.api.domain.SysUser; import cn.cctvcc.system.mapper.SysUserMapper; import cn.cctvcc.system.service.SysUserService; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /** * @description: 用户信息实现类 * @author: Jiang * @create: 2021-09-22 15:59 */ @Service public class SysUserServiceImpl implements SysUserService { @Autowired private SysUserMapper sysUserMapper; /** * 根据用户名称获取用户 * @param userName * @return */ @Override public SysUser selectUserByUserName(String userName) { QueryWrapper<SysUser> queryWrapper = new QueryWrapper<>(); queryWrapper.lambda().eq(SysUser :: getUserName, userName); return sysUserMapper.selectOne(queryWrapper); } }
941
0.736494
0.723264
33
26.484848
23.43026
67
false
false
0
0
0
0
0
0
0.363636
false
false
3
ad1efe556cbcf0061e29460519158fc6beccc657
8,143,258,031,111
383e578ec8ac3043ddece8223494f27f4a4c76dd
/legend.biz/src/main/java/com/tqmall/legend/facade/activity/vo/BarginAppointDataVo.java
3fb3e8f78b381a3072a906a769b05fc1f8ebee57
[]
no_license
xie-summer/legend
https://github.com/xie-summer/legend
0018ee61f9e864204382cd202fe595b63d58343a
7e7bb14d209e03445a098b84cf63566702e07f15
refs/heads/master
2021-06-19T13:44:58.640000
2017-05-18T08:34:13
2017-05-18T08:34:13
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.tqmall.legend.facade.activity.vo; import com.tqmall.dandelion.wechat.client.dto.wechat.ShopActDiscountListDTO; import lombok.Data; /** * Created by pituo on 16/10/28. */ @Data public class BarginAppointDataVo extends ShopActDiscountListDTO { private Integer durationDay;//活动进行天数 }
UTF-8
Java
313
java
BarginAppointDataVo.java
Java
[ { "context": "untListDTO;\nimport lombok.Data;\n\n/**\n * Created by pituo on 16/10/28.\n */\n@Data\npublic class BarginAppoint", "end": 168, "score": 0.9987518787384033, "start": 163, "tag": "USERNAME", "value": "pituo" } ]
null
[]
package com.tqmall.legend.facade.activity.vo; import com.tqmall.dandelion.wechat.client.dto.wechat.ShopActDiscountListDTO; import lombok.Data; /** * Created by pituo on 16/10/28. */ @Data public class BarginAppointDataVo extends ShopActDiscountListDTO { private Integer durationDay;//活动进行天数 }
313
0.787375
0.767442
12
24.083334
25.972609
76
false
false
0
0
0
0
0
0
0.333333
false
false
3
66faead69216bc709ccb860a2f4632e2bf7aed53
28,424,093,632,637
c8a514e71e09a12ce89fc2d0af77a8f42e79b465
/src/main/java/com/tenjava/entries/Marenwynn/t3/data/Data.java
19898c5ff63e7afeeb9f326b63d0e89bbf543853
[]
no_license
tenjava-2014/Marenwynn-t3
https://github.com/tenjava-2014/Marenwynn-t3
7249e41397ba278b180ee63917b608645c3d19cf
4849a23106de7a41bda574cc46a2212661518ecc
refs/heads/master
2020-04-10T21:06:34.163000
2014-07-12T23:59:56
2014-07-12T23:59:56
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.tenjava.entries.Marenwynn.t3.data; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.UUID; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.Recipe; import org.bukkit.inventory.ShapedRecipe; import org.bukkit.scheduler.BukkitTask; import com.tenjava.entries.Marenwynn.t3.TenJava; import com.tenjava.entries.Marenwynn.t3.Util; public class Data { private static TenJava tj; private static Map<Msg, String> messages; private static File playerDataFolder; private static Map<UUID, PlayerData> players; public static Map<String, ItemStack> customItems; public static Map<UUID, BukkitTask> bleedTasks; public static void init(TenJava tj) { Data.tj = tj; messages = new HashMap<Msg, String>(); loadConfig(); playerDataFolder = new File(tj.getDataFolder().getPath() + File.separator + "players"); players = new HashMap<UUID, PlayerData>(); if (!playerDataFolder.exists()) playerDataFolder.mkdirs(); customItems = new HashMap<String, ItemStack>(); bleedTasks = new HashMap<UUID, BukkitTask>(); // Create gauze List<String> lore = new ArrayList<String>(); lore.add(Util.color("&fCan be used to patch up")); lore.add(Util.color("&fflesh wounds.")); lore.add(Util.color("&8&oRight-click to use")); ItemStack gauze = Util.setItemNameAndLore(new ItemStack(Material.PAPER, 1), "&aGauze", lore); customItems.put("gauze", gauze); ShapedRecipe sr = new ShapedRecipe(gauze); sr.shape("SW ", "SW ", "SW "); sr.setIngredient('S', Material.STRING); sr.setIngredient('W', Material.WOOL); tj.getServer().addRecipe(sr); // Create splint lore.clear(); lore.add(Util.color("&fBraces broken legs to")); lore.add(Util.color("&frestore mobility.")); lore.add(Util.color("&8&oRight-click to use")); ItemStack splint = Util.setItemNameAndLore(new ItemStack(Material.STICK, 1), "&aSplint", lore); customItems.put("splint", splint); sr = new ShapedRecipe(splint); sr.shape(" S ", " T ", " S "); sr.setIngredient('S', Material.STRING); sr.setIngredient('T', Material.STICK); tj.getServer().addRecipe(sr); } public static void kill() { // Clear custom recipes from server Iterator<Recipe> recipes = tj.getServer().recipeIterator(); Recipe recipe; while (recipes.hasNext()) { recipe = recipes.next(); if (recipe != null && customItems.containsValue(recipe.getResult())) recipes.remove(); } tj = null; messages = null; playerDataFolder = null; players = null; customItems = null; } public static void loadConfig() { tj.saveDefaultConfig(); for (Msg msg : Msg.values()) messages.put(msg, tj.getConfig().getString("Language." + msg.name(), msg.getDefaultMsg())); } public static String getMsg(Msg msg) { return messages.get(msg); } public static PlayerData getPlayerData(UUID playerUUID) { return players.get(playerUUID); } public static PlayerData loadPlayer(UUID playerUUID) { File playerDataFile = new File(playerDataFolder + File.separator + playerUUID); if (playerDataFile.exists()) { Object uncasted = null; try { FileInputStream fis = new FileInputStream(playerDataFile); ObjectInputStream ois = new ObjectInputStream(fis); try { uncasted = ois.readObject(); } catch (ClassNotFoundException e) { e.printStackTrace(); } finally { ois.close(); } } catch (IOException e) { e.printStackTrace(); } if (uncasted != null && uncasted instanceof PlayerData) { players.put(playerUUID, (PlayerData) uncasted); } } else { players.put(playerUUID, new PlayerData()); } return players.get(playerUUID); } public static void unloadPlayer(UUID playerUUID) { if (players.containsKey(playerUUID)) players.remove(playerUUID); } public static void savePlayer(UUID playerUUID) { File playerDataFile = new File(playerDataFolder + File.separator + playerUUID); try { FileOutputStream fos = new FileOutputStream(playerDataFile); ObjectOutputStream oos = new ObjectOutputStream(fos); try { oos.writeObject(players.get(playerUUID)); } finally { oos.close(); } } catch (IOException e) { e.printStackTrace(); } } public static void saveAllPlayers() { for (UUID playerUUID : players.keySet()) savePlayer(playerUUID); } }
UTF-8
Java
5,554
java
Data.java
Java
[]
null
[]
package com.tenjava.entries.Marenwynn.t3.data; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.UUID; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.Recipe; import org.bukkit.inventory.ShapedRecipe; import org.bukkit.scheduler.BukkitTask; import com.tenjava.entries.Marenwynn.t3.TenJava; import com.tenjava.entries.Marenwynn.t3.Util; public class Data { private static TenJava tj; private static Map<Msg, String> messages; private static File playerDataFolder; private static Map<UUID, PlayerData> players; public static Map<String, ItemStack> customItems; public static Map<UUID, BukkitTask> bleedTasks; public static void init(TenJava tj) { Data.tj = tj; messages = new HashMap<Msg, String>(); loadConfig(); playerDataFolder = new File(tj.getDataFolder().getPath() + File.separator + "players"); players = new HashMap<UUID, PlayerData>(); if (!playerDataFolder.exists()) playerDataFolder.mkdirs(); customItems = new HashMap<String, ItemStack>(); bleedTasks = new HashMap<UUID, BukkitTask>(); // Create gauze List<String> lore = new ArrayList<String>(); lore.add(Util.color("&fCan be used to patch up")); lore.add(Util.color("&fflesh wounds.")); lore.add(Util.color("&8&oRight-click to use")); ItemStack gauze = Util.setItemNameAndLore(new ItemStack(Material.PAPER, 1), "&aGauze", lore); customItems.put("gauze", gauze); ShapedRecipe sr = new ShapedRecipe(gauze); sr.shape("SW ", "SW ", "SW "); sr.setIngredient('S', Material.STRING); sr.setIngredient('W', Material.WOOL); tj.getServer().addRecipe(sr); // Create splint lore.clear(); lore.add(Util.color("&fBraces broken legs to")); lore.add(Util.color("&frestore mobility.")); lore.add(Util.color("&8&oRight-click to use")); ItemStack splint = Util.setItemNameAndLore(new ItemStack(Material.STICK, 1), "&aSplint", lore); customItems.put("splint", splint); sr = new ShapedRecipe(splint); sr.shape(" S ", " T ", " S "); sr.setIngredient('S', Material.STRING); sr.setIngredient('T', Material.STICK); tj.getServer().addRecipe(sr); } public static void kill() { // Clear custom recipes from server Iterator<Recipe> recipes = tj.getServer().recipeIterator(); Recipe recipe; while (recipes.hasNext()) { recipe = recipes.next(); if (recipe != null && customItems.containsValue(recipe.getResult())) recipes.remove(); } tj = null; messages = null; playerDataFolder = null; players = null; customItems = null; } public static void loadConfig() { tj.saveDefaultConfig(); for (Msg msg : Msg.values()) messages.put(msg, tj.getConfig().getString("Language." + msg.name(), msg.getDefaultMsg())); } public static String getMsg(Msg msg) { return messages.get(msg); } public static PlayerData getPlayerData(UUID playerUUID) { return players.get(playerUUID); } public static PlayerData loadPlayer(UUID playerUUID) { File playerDataFile = new File(playerDataFolder + File.separator + playerUUID); if (playerDataFile.exists()) { Object uncasted = null; try { FileInputStream fis = new FileInputStream(playerDataFile); ObjectInputStream ois = new ObjectInputStream(fis); try { uncasted = ois.readObject(); } catch (ClassNotFoundException e) { e.printStackTrace(); } finally { ois.close(); } } catch (IOException e) { e.printStackTrace(); } if (uncasted != null && uncasted instanceof PlayerData) { players.put(playerUUID, (PlayerData) uncasted); } } else { players.put(playerUUID, new PlayerData()); } return players.get(playerUUID); } public static void unloadPlayer(UUID playerUUID) { if (players.containsKey(playerUUID)) players.remove(playerUUID); } public static void savePlayer(UUID playerUUID) { File playerDataFile = new File(playerDataFolder + File.separator + playerUUID); try { FileOutputStream fos = new FileOutputStream(playerDataFile); ObjectOutputStream oos = new ObjectOutputStream(fos); try { oos.writeObject(players.get(playerUUID)); } finally { oos.close(); } } catch (IOException e) { e.printStackTrace(); } } public static void saveAllPlayers() { for (UUID playerUUID : players.keySet()) savePlayer(playerUUID); } }
5,554
0.583543
0.582283
173
30.104046
24.277315
103
false
false
0
0
0
0
0
0
0.67052
false
false
3
88e3656cb4c40515d2b3a2ee1be20d0c93f9fcef
6,270,652,301,313
81853c5fa1eeccc9517382c89e2b3726cc9b928c
/src/main/java/com/chinatelecom/jx/zone/management/weixin/controller/RedPackApiController.java
a2417aa1ac824eca970295829dd8d791cd99e87f
[]
no_license
wwwK/XPROJECT
https://github.com/wwwK/XPROJECT
4afaae3b270938cb47ffb81d43a0688e8495210e
905ebc37664bc7f036bf9472a0edc17f501e6df1
refs/heads/master
2023-07-20T14:22:38.255000
2019-12-05T15:37:28
2019-12-05T15:37:28
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.chinatelecom.jx.zone.management.weixin.controller; import com.chinatelecom.jx.zone.management.util.ReadPackUtils; import com.jfinal.core.Controller; import com.jfinal.kit.PropKit; import com.jfinal.weixin.sdk.api.ApiResult; import com.jfinal.weixin.sdk.api.UserApi; /** * 微信红包demo * @author Javen * 2016年5月28日 */ public class RedPackApiController extends Controller { private static String sendName = PropKit.get("mch_name"); //微信签名证书路径 "d:/cert/apiclient_cert.p12" private static String certPath = "/opt/zone/cert/apiclient_cert.p12"; //商户相关资料 String wxappid = PropKit.get("appId"); // 微信支付分配的商户号 String partner = PropKit.get("mch_id"); //API密钥 String paternerKey = PropKit.get("paternerKey"); //接受人 xwf String userOpenId = "obnfavjAH7CRrrwIpVI7L7vHLLf0" ; //普通红包 public void send() { String isSend = ""; String act_name=getPara("act_name"); //活动名称 String wishing=getPara("wishing"); //活动祝福语 String remark=getPara("remark"); //活动备注 String total_num=getPara("total_num"); //数量 String path=getPara("path"); //路径 String money=getPara("money"); // try{ isSend = ReadPackUtils.send(getRequest(),money, total_num, wishing, act_name, remark,userOpenId ,partner, wxappid, sendName, paternerKey,path); }catch(Exception e){ isSend =e.getMessage(); } renderJson(isSend); } //裂变红包 public void sendGroup() { String isSend = ""; String act_name=getPara("act_name"); //活动名称 String wishing=getPara("wishing"); //活动祝福语 String remark=getPara("remark"); //活动备注 String total_num=getPara("total_num"); //数量 String path=getPara("path"); //路径 String money=getPara("money"); // try{ isSend = ReadPackUtils.sendGroup(getRequest(), money, total_num, wishing, act_name, remark,userOpenId ,partner, wxappid, sendName, paternerKey,path); }catch(Exception e){ isSend =e.getMessage(); } renderJson(isSend); } public void query() { String query = ReadPackUtils.query("10000098201411111234567890", partner, wxappid, paternerKey, certPath); renderJson(query); } public void allUser() { ApiResult result =UserApi.getFollows(); } }
UTF-8
Java
2,277
java
RedPackApiController.java
Java
[ { "context": "eixin.sdk.api.UserApi;\n\n/**\n * 微信红包demo\n * @author Javen\n * 2016年5月28日\n */\npublic class RedPackApiControll", "end": 312, "score": 0.9912559986114502, "start": 307, "tag": "USERNAME", "value": "Javen" } ]
null
[]
package com.chinatelecom.jx.zone.management.weixin.controller; import com.chinatelecom.jx.zone.management.util.ReadPackUtils; import com.jfinal.core.Controller; import com.jfinal.kit.PropKit; import com.jfinal.weixin.sdk.api.ApiResult; import com.jfinal.weixin.sdk.api.UserApi; /** * 微信红包demo * @author Javen * 2016年5月28日 */ public class RedPackApiController extends Controller { private static String sendName = PropKit.get("mch_name"); //微信签名证书路径 "d:/cert/apiclient_cert.p12" private static String certPath = "/opt/zone/cert/apiclient_cert.p12"; //商户相关资料 String wxappid = PropKit.get("appId"); // 微信支付分配的商户号 String partner = PropKit.get("mch_id"); //API密钥 String paternerKey = PropKit.get("paternerKey"); //接受人 xwf String userOpenId = "obnfavjAH7CRrrwIpVI7L7vHLLf0" ; //普通红包 public void send() { String isSend = ""; String act_name=getPara("act_name"); //活动名称 String wishing=getPara("wishing"); //活动祝福语 String remark=getPara("remark"); //活动备注 String total_num=getPara("total_num"); //数量 String path=getPara("path"); //路径 String money=getPara("money"); // try{ isSend = ReadPackUtils.send(getRequest(),money, total_num, wishing, act_name, remark,userOpenId ,partner, wxappid, sendName, paternerKey,path); }catch(Exception e){ isSend =e.getMessage(); } renderJson(isSend); } //裂变红包 public void sendGroup() { String isSend = ""; String act_name=getPara("act_name"); //活动名称 String wishing=getPara("wishing"); //活动祝福语 String remark=getPara("remark"); //活动备注 String total_num=getPara("total_num"); //数量 String path=getPara("path"); //路径 String money=getPara("money"); // try{ isSend = ReadPackUtils.sendGroup(getRequest(), money, total_num, wishing, act_name, remark,userOpenId ,partner, wxappid, sendName, paternerKey,path); }catch(Exception e){ isSend =e.getMessage(); } renderJson(isSend); } public void query() { String query = ReadPackUtils.query("10000098201411111234567890", partner, wxappid, paternerKey, certPath); renderJson(query); } public void allUser() { ApiResult result =UserApi.getFollows(); } }
2,277
0.709099
0.689769
71
28.887323
23.94039
108
false
false
0
0
0
0
0
0
2.140845
false
false
3
9814e30db66e046ba42a8c5423ebba32c5d764b2
8,065,948,631,400
9f4b4438d4329db792de6d370d876001e85e095f
/src/listener/window/Bottom_Window_listener.java
bccf8cdf3a04465e6fa10d4d8d13775b2aad296a
[]
no_license
squirrelhuan/FxProject01
https://github.com/squirrelhuan/FxProject01
9c59e8e8408b67d72dd7e7a4a62c3b413083cb08
30c2676e0686ff441561f41218b237f140ff0d50
refs/heads/master
2021-05-06T19:46:34.528000
2021-01-18T02:09:47
2021-01-18T02:09:47
112,151,804
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package listener.window; import java.time.LocalTime; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import application.Dialog_View; import application.LogCate_NewTag_Dialog; import application.Test; import provider.ConsoleProvider; import provider.LogCateProvider; import event.LogCateEvent.ILogCateListener; import event.LogCateEvent.LogCateEvent; import event.LogCateEvent.LogCateListenerImpl; import event.LogCateEvent.LogCateManager; import model.CGQ_log.LogCate_Tag; import model.View_model.LogCate; import model.View_model.TabBase; import model.View_model.adapter.RadioButton_Tag; import model.View_model.window.Console_Tab; import model.View_model.window.LogCate_Tab; import model.View_model.window.Progress_Tab; import util.JsonValidator; import util.MySystem; import javafx.beans.property.SimpleStringProperty; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.control.ChoiceBox; import javafx.scene.control.Control; import javafx.scene.control.Label; import javafx.scene.control.MenuButton; import javafx.scene.control.RadioButton; import javafx.scene.control.RadioMenuItem; import javafx.scene.control.RadioMenuItemBuilder; import javafx.scene.control.TabPane; import javafx.scene.control.TableCell; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.TextArea; import javafx.scene.control.Toggle; import javafx.scene.control.ToggleGroup; import javafx.scene.control.Tooltip; import javafx.scene.control.cell.MapValueFactory; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.input.MouseEvent; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.HBox; import javafx.scene.paint.Color; import javafx.scene.text.Font; import javafx.stage.Stage; import javafx.util.Callback; public class Bottom_Window_listener implements ILogCateListener { @FXML public TabPane tabPane_01,tabPane_bottom; @FXML private MenuButton menuButton_windows; @FXML private void onTabPaneStarted(ActionEvent event) { // System.out.println(tabPane_01.getTabs()); System.out.println("Current Tab:" + event.getSource()); } /** * 清空控制台 */ @FXML private void onClickedClipboardDeleteButton(ActionEvent event) { ConsoleProvider.getInstance().getMessage_list().clear(); //Cosole_TextArea.setText(""); } private TabBase console_Tab,logCate_Tab,progress_Tab; private List<TabBase> list_tabs = new ArrayList<TabBase>(); /** 表格初始化 */ @FXML private void initialize() { console_Tab = Console_Tab.getInstance(); logCate_Tab = LogCate_Tab.getInstance(); progress_Tab = Progress_Tab.getInstance(); list_tabs.add(console_Tab); list_tabs.add(logCate_Tab); list_tabs.add(progress_Tab); tabPane_bottom.getTabs().add(console_Tab); tabPane_bottom.getTabs().add(logCate_Tab); tabPane_bottom.getTabs().add(progress_Tab); //logCate_Tab = new LogCate_Tab("Logcate", Test.getInstance()); for (TabBase tab : list_tabs) { RadioMenuItem soundAlarmItem = RadioMenuItemBuilder.create() .text(tab.getText()) .build(); soundAlarmItem.selectedProperty().set(true); soundAlarmItem.selectedProperty().addListener( new ChangeListener<Boolean>() { public void changed( ObservableValue<? extends Boolean> ov, Boolean old_val, Boolean new_val) { if(new_val){ tabPane_bottom.getTabs().add(tab); tabPane_bottom.getSelectionModel().select(tab); }else{ tabPane_bottom.getTabs().remove(tab); } //tabPane_01.getSelectionModel().select(tabPane_01.getTabs().size() - 1); //part_rdbtn_d.selectedProperty().set(true); } }); menuButton_windows.getItems().add(soundAlarmItem); } } /** * LogCate_Tab */ @FXML private void onClickedLogCateMenuItem() { //LogCate_Tab tab = new LogCate_Tab("Logcate", Test.getInstance()); //tabPane_bottom.getTabs().add(tab); //tabPane_bottom.getSelectionModel().select(tabPane_bottom.getTabs().size() - 1); } @Override public void doorEvent(LogCateEvent event) { if (event.getEventType() == LogCateEvent.LogCateEventType.onLogsChanged) { } else if (event.getEventType() == LogCateEvent.LogCateEventType.onTagsChanged) { } } /** 清空 */ @FXML public void onClickedClearButton(ActionEvent event) { LogCateProvider.getInstance().clear(); } /** * Json_Tab */ @FXML private void onMouseEntered(MouseEvent event) { /* * Rectangle rect = new Rectangle(0, 0, 100, 100); Tooltip t = new * Tooltip("A Square"); Tooltip.install(rect, t); */ if (event.getSource() instanceof TabBase) { ((TabBase) event.getSource()).setTooltip(new Tooltip( ((TabBase) event.getSource()).getDescription())); } else { ((Control) event.getSource()).setTooltip(new Tooltip("清空控制台")); } } }
UTF-8
Java
5,268
java
Bottom_Window_listener.java
Java
[]
null
[]
package listener.window; import java.time.LocalTime; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import application.Dialog_View; import application.LogCate_NewTag_Dialog; import application.Test; import provider.ConsoleProvider; import provider.LogCateProvider; import event.LogCateEvent.ILogCateListener; import event.LogCateEvent.LogCateEvent; import event.LogCateEvent.LogCateListenerImpl; import event.LogCateEvent.LogCateManager; import model.CGQ_log.LogCate_Tag; import model.View_model.LogCate; import model.View_model.TabBase; import model.View_model.adapter.RadioButton_Tag; import model.View_model.window.Console_Tab; import model.View_model.window.LogCate_Tab; import model.View_model.window.Progress_Tab; import util.JsonValidator; import util.MySystem; import javafx.beans.property.SimpleStringProperty; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.control.ChoiceBox; import javafx.scene.control.Control; import javafx.scene.control.Label; import javafx.scene.control.MenuButton; import javafx.scene.control.RadioButton; import javafx.scene.control.RadioMenuItem; import javafx.scene.control.RadioMenuItemBuilder; import javafx.scene.control.TabPane; import javafx.scene.control.TableCell; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.TextArea; import javafx.scene.control.Toggle; import javafx.scene.control.ToggleGroup; import javafx.scene.control.Tooltip; import javafx.scene.control.cell.MapValueFactory; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.input.MouseEvent; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.HBox; import javafx.scene.paint.Color; import javafx.scene.text.Font; import javafx.stage.Stage; import javafx.util.Callback; public class Bottom_Window_listener implements ILogCateListener { @FXML public TabPane tabPane_01,tabPane_bottom; @FXML private MenuButton menuButton_windows; @FXML private void onTabPaneStarted(ActionEvent event) { // System.out.println(tabPane_01.getTabs()); System.out.println("Current Tab:" + event.getSource()); } /** * 清空控制台 */ @FXML private void onClickedClipboardDeleteButton(ActionEvent event) { ConsoleProvider.getInstance().getMessage_list().clear(); //Cosole_TextArea.setText(""); } private TabBase console_Tab,logCate_Tab,progress_Tab; private List<TabBase> list_tabs = new ArrayList<TabBase>(); /** 表格初始化 */ @FXML private void initialize() { console_Tab = Console_Tab.getInstance(); logCate_Tab = LogCate_Tab.getInstance(); progress_Tab = Progress_Tab.getInstance(); list_tabs.add(console_Tab); list_tabs.add(logCate_Tab); list_tabs.add(progress_Tab); tabPane_bottom.getTabs().add(console_Tab); tabPane_bottom.getTabs().add(logCate_Tab); tabPane_bottom.getTabs().add(progress_Tab); //logCate_Tab = new LogCate_Tab("Logcate", Test.getInstance()); for (TabBase tab : list_tabs) { RadioMenuItem soundAlarmItem = RadioMenuItemBuilder.create() .text(tab.getText()) .build(); soundAlarmItem.selectedProperty().set(true); soundAlarmItem.selectedProperty().addListener( new ChangeListener<Boolean>() { public void changed( ObservableValue<? extends Boolean> ov, Boolean old_val, Boolean new_val) { if(new_val){ tabPane_bottom.getTabs().add(tab); tabPane_bottom.getSelectionModel().select(tab); }else{ tabPane_bottom.getTabs().remove(tab); } //tabPane_01.getSelectionModel().select(tabPane_01.getTabs().size() - 1); //part_rdbtn_d.selectedProperty().set(true); } }); menuButton_windows.getItems().add(soundAlarmItem); } } /** * LogCate_Tab */ @FXML private void onClickedLogCateMenuItem() { //LogCate_Tab tab = new LogCate_Tab("Logcate", Test.getInstance()); //tabPane_bottom.getTabs().add(tab); //tabPane_bottom.getSelectionModel().select(tabPane_bottom.getTabs().size() - 1); } @Override public void doorEvent(LogCateEvent event) { if (event.getEventType() == LogCateEvent.LogCateEventType.onLogsChanged) { } else if (event.getEventType() == LogCateEvent.LogCateEventType.onTagsChanged) { } } /** 清空 */ @FXML public void onClickedClearButton(ActionEvent event) { LogCateProvider.getInstance().clear(); } /** * Json_Tab */ @FXML private void onMouseEntered(MouseEvent event) { /* * Rectangle rect = new Rectangle(0, 0, 100, 100); Tooltip t = new * Tooltip("A Square"); Tooltip.install(rect, t); */ if (event.getSource() instanceof TabBase) { ((TabBase) event.getSource()).setTooltip(new Tooltip( ((TabBase) event.getSource()).getDescription())); } else { ((Control) event.getSource()).setTooltip(new Tooltip("清空控制台")); } } }
5,268
0.739205
0.735766
170
29.788235
21.137697
83
false
false
0
0
0
0
0
0
2.070588
false
false
3
9af7615deeb4e76961f06d46d47dfc3e7a5e2412
3,332,894,652,615
24159cbf5f6be2983d43efb6468bb1ed520550eb
/HW_23_Affiche/src/main/java/inno/util/validators/CinemaValidator.java
d9a1efea2b29fba4c433140230487f115d738c2b
[]
no_license
bus4/Home_Work_JAVA
https://github.com/bus4/Home_Work_JAVA
633fd1843335f691bf315bd096aeff52f7bcd60f
f1fd5308921e21a25e368f0c0c262328fe5847ee
refs/heads/master
2021-01-11T19:34:29.669000
2017-02-13T08:23:05
2017-02-13T08:23:05
72,636,358
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package inno.util.validators; import inno.model.Cinema; import org.springframework.stereotype.Component; import org.springframework.util.StringUtils; import org.springframework.validation.Errors; import org.springframework.validation.Validator; @Component public class CinemaValidator implements Validator { @Override public boolean supports(Class<?> aClass) { return Cinema.class.equals(aClass); } @Override public void validate(Object o, Errors errors) { Cinema cinema = (Cinema) o; if (StringUtils.isEmpty(cinema.getName()) || cinema.getName().length() < 2) { errors.rejectValue("name", "", "Название должно быть минимум 2 символа"); } if (StringUtils.isEmpty(cinema.getDescription()) || cinema.getDescription().length() < 10) { errors.rejectValue("description", "", "Описание должно быть минимум 10 символов"); } } }
UTF-8
Java
988
java
CinemaValidator.java
Java
[]
null
[]
package inno.util.validators; import inno.model.Cinema; import org.springframework.stereotype.Component; import org.springframework.util.StringUtils; import org.springframework.validation.Errors; import org.springframework.validation.Validator; @Component public class CinemaValidator implements Validator { @Override public boolean supports(Class<?> aClass) { return Cinema.class.equals(aClass); } @Override public void validate(Object o, Errors errors) { Cinema cinema = (Cinema) o; if (StringUtils.isEmpty(cinema.getName()) || cinema.getName().length() < 2) { errors.rejectValue("name", "", "Название должно быть минимум 2 символа"); } if (StringUtils.isEmpty(cinema.getDescription()) || cinema.getDescription().length() < 10) { errors.rejectValue("description", "", "Описание должно быть минимум 10 символов"); } } }
988
0.689057
0.682557
29
30.827587
30.401983
100
false
false
0
0
0
0
0
0
0.655172
false
false
3
14dbee365f97777aa150156942ff89e03415b13e
28,776,280,912,926
34209188c466a6d30d79341e4c6309ddccb74ff8
/mbap/src/main/java/com/supcon/mes/mbap/beans/BAPErrorEntity.java
76bfaeb57200979aabc407846800ac2861a1d249
[]
no_license
jasonwang18/mbap
https://github.com/jasonwang18/mbap
95fb8c54b4f31273dedbdcf20aff9bbf1242e971
5769e838d34667260caa532bec95b61a23ac6d42
refs/heads/master
2020-07-03T10:37:22.432000
2019-08-12T07:58:24
2019-08-12T07:58:24
201,879,594
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.supcon.mes.mbap.beans; import com.supcon.common.com_http.BaseEntity; import java.util.List; /** * Created by wangshizhan on 2018/5/4. * Email:wangshizhan@supcon.com */ public class BAPErrorEntity extends BaseEntity{ public boolean success; public List<String> actionErrors; public String exceptionMsg; public Object items; }
UTF-8
Java
383
java
BAPErrorEntity.java
Java
[ { "context": "y;\r\n\r\nimport java.util.List;\r\n\r\n/**\r\n * Created by wangshizhan on 2018/5/4.\r\n * Email:wangshizhan@supcon.com\r\n *", "end": 143, "score": 0.9994837045669556, "start": 132, "tag": "USERNAME", "value": "wangshizhan" }, { "context": "\n * Created by wangshizhan on 2018/5/4.\r\n * Email:wangshizhan@supcon.com\r\n */\r\n\r\npublic class BAPErrorEntity extends BaseE", "end": 189, "score": 0.9999306201934814, "start": 167, "tag": "EMAIL", "value": "wangshizhan@supcon.com" } ]
null
[]
package com.supcon.mes.mbap.beans; import com.supcon.common.com_http.BaseEntity; import java.util.List; /** * Created by wangshizhan on 2018/5/4. * Email:<EMAIL> */ public class BAPErrorEntity extends BaseEntity{ public boolean success; public List<String> actionErrors; public String exceptionMsg; public Object items; }
368
0.699739
0.684073
20
17.15
17.393318
47
false
false
0
0
0
0
0
0
0.35
false
false
3
436e0dccf6d059aaac112a634fe8e3b2874be13b
6,485,400,651,963
2f85a583ab8672f1be5d2a09eb1cb4a1ac2a1bf3
/src/model/User_Book_Marl.java
75acb77125a852e94877cd87b59016dc67f50b7c
[]
no_license
chendao131/tribus_final
https://github.com/chendao131/tribus_final
d2b12a03684c462a33fe71e6584b55dcb4841b92
9ad51692eaa4ffedc7a7aafcb9dc1536072e893f
refs/heads/master
2021-01-13T01:45:55.578000
2012-12-07T20:29:36
2012-12-07T20:29:36
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package model; public class User_Book_Marl { }
UTF-8
Java
49
java
User_Book_Marl.java
Java
[]
null
[]
package model; public class User_Book_Marl { }
49
0.714286
0.714286
5
8.8
11.408769
29
false
false
0
0
0
0
0
0
0.2
false
false
3
305b33305efac61bbdf7548ed048c6a46588338a
33,732,673,189,985
0fdb7ed312a70be82e2fe22b76f218baf890d378
/src/test/java/com/clinic/web/rest/DiagnosticResourceTest.java
ddf4f8830c8e1cb92e214e3321e554a8b6119b11
[]
no_license
zoirs/clinic
https://github.com/zoirs/clinic
ee0ba8a17e4defffd87920c77fc6ec96908dbbb1
9efc346c3eb25eda5b778570a866ead86818d845
refs/heads/master
2021-01-21T12:58:22.728000
2015-11-12T19:12:43
2015-11-12T19:12:43
44,183,238
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.clinic.web.rest; import com.clinic.Application; import com.clinic.domain.Diagnostic; import com.clinic.repository.DiagnosticRepository; import com.clinic.repository.search.DiagnosticSearchRepository; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import static org.hamcrest.Matchers.hasItem; import org.mockito.MockitoAnnotations; import org.springframework.boot.test.IntegrationTest; import org.springframework.boot.test.SpringApplicationConfiguration; import org.springframework.http.MediaType; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.data.web.PageableHandlerMethodArgumentResolver; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.util.ReflectionTestUtils; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.transaction.annotation.Transactional; import javax.annotation.PostConstruct; import javax.inject.Inject; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormatter; import java.util.List; import static org.assertj.core.api.Assertions.assertThat; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; /** * Test class for the DiagnosticResource REST controller. * * @see DiagnosticResource */ @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = Application.class) @WebAppConfiguration @IntegrationTest public class DiagnosticResourceTest { private static final DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss'Z'"); private static final String DEFAULT_NAME = "AAAAA"; private static final String UPDATED_NAME = "BBBBB"; private static final String DEFAULT_ALIAS = "AAAAA"; private static final String UPDATED_ALIAS = "BBBBB"; private static final Long DEFAULT_DOCDOC_ID = 1L; private static final Long UPDATED_DOCDOC_ID = 2L; private static final DateTime DEFAULT_LAST_UPDATED = new DateTime(0L, DateTimeZone.UTC); private static final DateTime UPDATED_LAST_UPDATED = new DateTime(DateTimeZone.UTC).withMillisOfSecond(0); private static final String DEFAULT_LAST_UPDATED_STR = dateTimeFormatter.print(DEFAULT_LAST_UPDATED); @Inject private DiagnosticRepository diagnosticRepository; @Inject private DiagnosticSearchRepository diagnosticSearchRepository; @Inject private MappingJackson2HttpMessageConverter jacksonMessageConverter; @Inject private PageableHandlerMethodArgumentResolver pageableArgumentResolver; private MockMvc restDiagnosticMockMvc; private Diagnostic diagnostic; @PostConstruct public void setup() { MockitoAnnotations.initMocks(this); DiagnosticResource diagnosticResource = new DiagnosticResource(); ReflectionTestUtils.setField(diagnosticResource, "diagnosticRepository", diagnosticRepository); ReflectionTestUtils.setField(diagnosticResource, "diagnosticSearchRepository", diagnosticSearchRepository); this.restDiagnosticMockMvc = MockMvcBuilders.standaloneSetup(diagnosticResource) .setCustomArgumentResolvers(pageableArgumentResolver) .setMessageConverters(jacksonMessageConverter).build(); } @Before public void initTest() { diagnostic = new Diagnostic(); diagnostic.setName(DEFAULT_NAME); diagnostic.setAlias(DEFAULT_ALIAS); diagnostic.setDocdocId(DEFAULT_DOCDOC_ID); diagnostic.setLastUpdated(DEFAULT_LAST_UPDATED); } @Test @Transactional public void createDiagnostic() throws Exception { int databaseSizeBeforeCreate = diagnosticRepository.findAll().size(); // Create the Diagnostic restDiagnosticMockMvc.perform(post("/api/diagnostics") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(diagnostic))) .andExpect(status().isCreated()); // Validate the Diagnostic in the database List<Diagnostic> diagnostics = diagnosticRepository.findAll(); assertThat(diagnostics).hasSize(databaseSizeBeforeCreate + 1); Diagnostic testDiagnostic = diagnostics.get(diagnostics.size() - 1); assertThat(testDiagnostic.getName()).isEqualTo(DEFAULT_NAME); assertThat(testDiagnostic.getAlias()).isEqualTo(DEFAULT_ALIAS); assertThat(testDiagnostic.getDocdocId()).isEqualTo(DEFAULT_DOCDOC_ID); assertThat(testDiagnostic.getLastUpdated().toDateTime(DateTimeZone.UTC)).isEqualTo(DEFAULT_LAST_UPDATED); } @Test @Transactional public void checkNameIsRequired() throws Exception { int databaseSizeBeforeTest = diagnosticRepository.findAll().size(); // set the field null diagnostic.setName(null); // Create the Diagnostic, which fails. restDiagnosticMockMvc.perform(post("/api/diagnostics") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(diagnostic))) .andExpect(status().isBadRequest()); List<Diagnostic> diagnostics = diagnosticRepository.findAll(); assertThat(diagnostics).hasSize(databaseSizeBeforeTest); } @Test @Transactional public void checkAliasIsRequired() throws Exception { int databaseSizeBeforeTest = diagnosticRepository.findAll().size(); // set the field null diagnostic.setAlias(null); // Create the Diagnostic, which fails. restDiagnosticMockMvc.perform(post("/api/diagnostics") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(diagnostic))) .andExpect(status().isBadRequest()); List<Diagnostic> diagnostics = diagnosticRepository.findAll(); assertThat(diagnostics).hasSize(databaseSizeBeforeTest); } @Test @Transactional public void getAllDiagnostics() throws Exception { // Initialize the database diagnosticRepository.saveAndFlush(diagnostic); // Get all the diagnostics restDiagnosticMockMvc.perform(get("/api/diagnostics")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.[*].id").value(hasItem(diagnostic.getId().intValue()))) .andExpect(jsonPath("$.[*].name").value(hasItem(DEFAULT_NAME.toString()))) .andExpect(jsonPath("$.[*].alias").value(hasItem(DEFAULT_ALIAS.toString()))) .andExpect(jsonPath("$.[*].docdocId").value(hasItem(DEFAULT_DOCDOC_ID.intValue()))) .andExpect(jsonPath("$.[*].lastUpdated").value(hasItem(DEFAULT_LAST_UPDATED_STR))); } @Test @Transactional public void getDiagnostic() throws Exception { // Initialize the database diagnosticRepository.saveAndFlush(diagnostic); // Get the diagnostic restDiagnosticMockMvc.perform(get("/api/diagnostics/{id}", diagnostic.getId())) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.id").value(diagnostic.getId().intValue())) .andExpect(jsonPath("$.name").value(DEFAULT_NAME.toString())) .andExpect(jsonPath("$.alias").value(DEFAULT_ALIAS.toString())) .andExpect(jsonPath("$.docdocId").value(DEFAULT_DOCDOC_ID.intValue())) .andExpect(jsonPath("$.lastUpdated").value(DEFAULT_LAST_UPDATED_STR)); } @Test @Transactional public void getNonExistingDiagnostic() throws Exception { // Get the diagnostic restDiagnosticMockMvc.perform(get("/api/diagnostics/{id}", Long.MAX_VALUE)) .andExpect(status().isNotFound()); } @Test @Transactional public void updateDiagnostic() throws Exception { // Initialize the database diagnosticRepository.saveAndFlush(diagnostic); int databaseSizeBeforeUpdate = diagnosticRepository.findAll().size(); // Update the diagnostic diagnostic.setName(UPDATED_NAME); diagnostic.setAlias(UPDATED_ALIAS); diagnostic.setDocdocId(UPDATED_DOCDOC_ID); diagnostic.setLastUpdated(UPDATED_LAST_UPDATED); restDiagnosticMockMvc.perform(put("/api/diagnostics") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(diagnostic))) .andExpect(status().isOk()); // Validate the Diagnostic in the database List<Diagnostic> diagnostics = diagnosticRepository.findAll(); assertThat(diagnostics).hasSize(databaseSizeBeforeUpdate); Diagnostic testDiagnostic = diagnostics.get(diagnostics.size() - 1); assertThat(testDiagnostic.getName()).isEqualTo(UPDATED_NAME); assertThat(testDiagnostic.getAlias()).isEqualTo(UPDATED_ALIAS); assertThat(testDiagnostic.getDocdocId()).isEqualTo(UPDATED_DOCDOC_ID); assertThat(testDiagnostic.getLastUpdated().toDateTime(DateTimeZone.UTC)).isEqualTo(UPDATED_LAST_UPDATED); } @Test @Transactional public void deleteDiagnostic() throws Exception { // Initialize the database diagnosticRepository.saveAndFlush(diagnostic); int databaseSizeBeforeDelete = diagnosticRepository.findAll().size(); // Get the diagnostic restDiagnosticMockMvc.perform(delete("/api/diagnostics/{id}", diagnostic.getId()) .accept(TestUtil.APPLICATION_JSON_UTF8)) .andExpect(status().isOk()); // Validate the database is empty List<Diagnostic> diagnostics = diagnosticRepository.findAll(); assertThat(diagnostics).hasSize(databaseSizeBeforeDelete - 1); } }
UTF-8
Java
10,229
java
DiagnosticResourceTest.java
Java
[]
null
[]
package com.clinic.web.rest; import com.clinic.Application; import com.clinic.domain.Diagnostic; import com.clinic.repository.DiagnosticRepository; import com.clinic.repository.search.DiagnosticSearchRepository; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import static org.hamcrest.Matchers.hasItem; import org.mockito.MockitoAnnotations; import org.springframework.boot.test.IntegrationTest; import org.springframework.boot.test.SpringApplicationConfiguration; import org.springframework.http.MediaType; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.data.web.PageableHandlerMethodArgumentResolver; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.util.ReflectionTestUtils; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.transaction.annotation.Transactional; import javax.annotation.PostConstruct; import javax.inject.Inject; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormatter; import java.util.List; import static org.assertj.core.api.Assertions.assertThat; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; /** * Test class for the DiagnosticResource REST controller. * * @see DiagnosticResource */ @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = Application.class) @WebAppConfiguration @IntegrationTest public class DiagnosticResourceTest { private static final DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss'Z'"); private static final String DEFAULT_NAME = "AAAAA"; private static final String UPDATED_NAME = "BBBBB"; private static final String DEFAULT_ALIAS = "AAAAA"; private static final String UPDATED_ALIAS = "BBBBB"; private static final Long DEFAULT_DOCDOC_ID = 1L; private static final Long UPDATED_DOCDOC_ID = 2L; private static final DateTime DEFAULT_LAST_UPDATED = new DateTime(0L, DateTimeZone.UTC); private static final DateTime UPDATED_LAST_UPDATED = new DateTime(DateTimeZone.UTC).withMillisOfSecond(0); private static final String DEFAULT_LAST_UPDATED_STR = dateTimeFormatter.print(DEFAULT_LAST_UPDATED); @Inject private DiagnosticRepository diagnosticRepository; @Inject private DiagnosticSearchRepository diagnosticSearchRepository; @Inject private MappingJackson2HttpMessageConverter jacksonMessageConverter; @Inject private PageableHandlerMethodArgumentResolver pageableArgumentResolver; private MockMvc restDiagnosticMockMvc; private Diagnostic diagnostic; @PostConstruct public void setup() { MockitoAnnotations.initMocks(this); DiagnosticResource diagnosticResource = new DiagnosticResource(); ReflectionTestUtils.setField(diagnosticResource, "diagnosticRepository", diagnosticRepository); ReflectionTestUtils.setField(diagnosticResource, "diagnosticSearchRepository", diagnosticSearchRepository); this.restDiagnosticMockMvc = MockMvcBuilders.standaloneSetup(diagnosticResource) .setCustomArgumentResolvers(pageableArgumentResolver) .setMessageConverters(jacksonMessageConverter).build(); } @Before public void initTest() { diagnostic = new Diagnostic(); diagnostic.setName(DEFAULT_NAME); diagnostic.setAlias(DEFAULT_ALIAS); diagnostic.setDocdocId(DEFAULT_DOCDOC_ID); diagnostic.setLastUpdated(DEFAULT_LAST_UPDATED); } @Test @Transactional public void createDiagnostic() throws Exception { int databaseSizeBeforeCreate = diagnosticRepository.findAll().size(); // Create the Diagnostic restDiagnosticMockMvc.perform(post("/api/diagnostics") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(diagnostic))) .andExpect(status().isCreated()); // Validate the Diagnostic in the database List<Diagnostic> diagnostics = diagnosticRepository.findAll(); assertThat(diagnostics).hasSize(databaseSizeBeforeCreate + 1); Diagnostic testDiagnostic = diagnostics.get(diagnostics.size() - 1); assertThat(testDiagnostic.getName()).isEqualTo(DEFAULT_NAME); assertThat(testDiagnostic.getAlias()).isEqualTo(DEFAULT_ALIAS); assertThat(testDiagnostic.getDocdocId()).isEqualTo(DEFAULT_DOCDOC_ID); assertThat(testDiagnostic.getLastUpdated().toDateTime(DateTimeZone.UTC)).isEqualTo(DEFAULT_LAST_UPDATED); } @Test @Transactional public void checkNameIsRequired() throws Exception { int databaseSizeBeforeTest = diagnosticRepository.findAll().size(); // set the field null diagnostic.setName(null); // Create the Diagnostic, which fails. restDiagnosticMockMvc.perform(post("/api/diagnostics") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(diagnostic))) .andExpect(status().isBadRequest()); List<Diagnostic> diagnostics = diagnosticRepository.findAll(); assertThat(diagnostics).hasSize(databaseSizeBeforeTest); } @Test @Transactional public void checkAliasIsRequired() throws Exception { int databaseSizeBeforeTest = diagnosticRepository.findAll().size(); // set the field null diagnostic.setAlias(null); // Create the Diagnostic, which fails. restDiagnosticMockMvc.perform(post("/api/diagnostics") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(diagnostic))) .andExpect(status().isBadRequest()); List<Diagnostic> diagnostics = diagnosticRepository.findAll(); assertThat(diagnostics).hasSize(databaseSizeBeforeTest); } @Test @Transactional public void getAllDiagnostics() throws Exception { // Initialize the database diagnosticRepository.saveAndFlush(diagnostic); // Get all the diagnostics restDiagnosticMockMvc.perform(get("/api/diagnostics")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.[*].id").value(hasItem(diagnostic.getId().intValue()))) .andExpect(jsonPath("$.[*].name").value(hasItem(DEFAULT_NAME.toString()))) .andExpect(jsonPath("$.[*].alias").value(hasItem(DEFAULT_ALIAS.toString()))) .andExpect(jsonPath("$.[*].docdocId").value(hasItem(DEFAULT_DOCDOC_ID.intValue()))) .andExpect(jsonPath("$.[*].lastUpdated").value(hasItem(DEFAULT_LAST_UPDATED_STR))); } @Test @Transactional public void getDiagnostic() throws Exception { // Initialize the database diagnosticRepository.saveAndFlush(diagnostic); // Get the diagnostic restDiagnosticMockMvc.perform(get("/api/diagnostics/{id}", diagnostic.getId())) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.id").value(diagnostic.getId().intValue())) .andExpect(jsonPath("$.name").value(DEFAULT_NAME.toString())) .andExpect(jsonPath("$.alias").value(DEFAULT_ALIAS.toString())) .andExpect(jsonPath("$.docdocId").value(DEFAULT_DOCDOC_ID.intValue())) .andExpect(jsonPath("$.lastUpdated").value(DEFAULT_LAST_UPDATED_STR)); } @Test @Transactional public void getNonExistingDiagnostic() throws Exception { // Get the diagnostic restDiagnosticMockMvc.perform(get("/api/diagnostics/{id}", Long.MAX_VALUE)) .andExpect(status().isNotFound()); } @Test @Transactional public void updateDiagnostic() throws Exception { // Initialize the database diagnosticRepository.saveAndFlush(diagnostic); int databaseSizeBeforeUpdate = diagnosticRepository.findAll().size(); // Update the diagnostic diagnostic.setName(UPDATED_NAME); diagnostic.setAlias(UPDATED_ALIAS); diagnostic.setDocdocId(UPDATED_DOCDOC_ID); diagnostic.setLastUpdated(UPDATED_LAST_UPDATED); restDiagnosticMockMvc.perform(put("/api/diagnostics") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(diagnostic))) .andExpect(status().isOk()); // Validate the Diagnostic in the database List<Diagnostic> diagnostics = diagnosticRepository.findAll(); assertThat(diagnostics).hasSize(databaseSizeBeforeUpdate); Diagnostic testDiagnostic = diagnostics.get(diagnostics.size() - 1); assertThat(testDiagnostic.getName()).isEqualTo(UPDATED_NAME); assertThat(testDiagnostic.getAlias()).isEqualTo(UPDATED_ALIAS); assertThat(testDiagnostic.getDocdocId()).isEqualTo(UPDATED_DOCDOC_ID); assertThat(testDiagnostic.getLastUpdated().toDateTime(DateTimeZone.UTC)).isEqualTo(UPDATED_LAST_UPDATED); } @Test @Transactional public void deleteDiagnostic() throws Exception { // Initialize the database diagnosticRepository.saveAndFlush(diagnostic); int databaseSizeBeforeDelete = diagnosticRepository.findAll().size(); // Get the diagnostic restDiagnosticMockMvc.perform(delete("/api/diagnostics/{id}", diagnostic.getId()) .accept(TestUtil.APPLICATION_JSON_UTF8)) .andExpect(status().isOk()); // Validate the database is empty List<Diagnostic> diagnostics = diagnosticRepository.findAll(); assertThat(diagnostics).hasSize(databaseSizeBeforeDelete - 1); } }
10,229
0.717177
0.715417
245
40.751019
30.965275
117
false
false
0
0
0
0
0
0
0.465306
false
false
3
a259a7fa39b702db0c541b4ab302b0f4d02b846f
27,187,143,034,593
f9bd1382e9aa80b076308b4ad51af2df2bf2726f
/src/main/java/com/curleesoft/pickem/model/SeasonWeek_.java
912c4cfa115fe56475e2bdc422b36ae5635af103
[]
no_license
bassetthnd824/pickem
https://github.com/bassetthnd824/pickem
ac10645ffc7c3438ebc51a9ea318a474ab4573ae
f34e7ceb21fc8e6247849d23bfdb81361b6275c0
refs/heads/master
2021-01-23T22:10:58.156000
2015-08-13T20:56:09
2015-08-13T20:56:09
33,272,243
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.curleesoft.pickem.model; import java.util.Date; import javax.annotation.Generated; import javax.persistence.metamodel.SingularAttribute; import javax.persistence.metamodel.StaticMetamodel; @Generated(value="Dali", date="2015-07-15T09:36:26.555-0500") @StaticMetamodel(SeasonWeek.class) public class SeasonWeek_ extends AbstractBaseEntity_ { public static volatile SingularAttribute<SeasonWeek, Long> id; public static volatile SingularAttribute<SeasonWeek, Date> beginDate; public static volatile SingularAttribute<SeasonWeek, Date> endDate; public static volatile SingularAttribute<SeasonWeek, Long> weekNumber; public static volatile SingularAttribute<SeasonWeek, Season> season; }
UTF-8
Java
719
java
SeasonWeek_.java
Java
[]
null
[]
package com.curleesoft.pickem.model; import java.util.Date; import javax.annotation.Generated; import javax.persistence.metamodel.SingularAttribute; import javax.persistence.metamodel.StaticMetamodel; @Generated(value="Dali", date="2015-07-15T09:36:26.555-0500") @StaticMetamodel(SeasonWeek.class) public class SeasonWeek_ extends AbstractBaseEntity_ { public static volatile SingularAttribute<SeasonWeek, Long> id; public static volatile SingularAttribute<SeasonWeek, Date> beginDate; public static volatile SingularAttribute<SeasonWeek, Date> endDate; public static volatile SingularAttribute<SeasonWeek, Long> weekNumber; public static volatile SingularAttribute<SeasonWeek, Season> season; }
719
0.812239
0.783032
16
42.9375
24.921047
71
false
false
0
0
0
0
0
0
1.3125
false
false
3
ae1bb9d2c13af80241c5c04c954bef22b0f1c07f
10,170,482,570,073
88ce808b877b60c55fa7069f24d43cdc1394adbe
/mobile/android/PayPlatformDynamic/appclient/com/jxt/pay/appclient/service/dynamic/net/HhkjYyDynamicService.java
314ee964363ef832e88503326da57b15d52f4a83
[]
no_license
moutainhigh/lxtx
https://github.com/moutainhigh/lxtx
d2f7130f7440a9d133951a333b7d6b387ca3e51f
a2ea814de9b6d62bb139bf8a1ff1642dd2cb9551
refs/heads/master
2021-07-23T08:14:58.164000
2017-11-02T11:48:45
2017-11-02T11:48:45
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jxt.pay.appclient.service.dynamic.net; import java.util.Calendar; import java.util.HashMap; import java.util.Map; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.NameValuePair; import org.apache.commons.httpclient.methods.PostMethod; import org.apache.log4j.Logger; import org.json.JSONObject; import com.jxt.pay.appclient.service.dynamic.pojo.Sets; import com.jxt.pay.appclient.service.dynamic.pojo.Sms; import com.jxt.pay.appclient.service.dynamic.utils.XstreamHelper; import com.jxt.pay.appclient.utils.DynamicUtils; import com.jxt.pay.appclient.utils.GetData; import com.qlzf.commons.helper.MD5Encrypt; /** * 掌智通页游 * @author leoliu *1、 *请求 http://api.datacomx.com/PCGameSms/FirDataImp?app=abc&tel=13866668888&consumecode=000082639001&time=1398496458&userid=1&price=1 *响应 {"resultCode":"200000","resultMsg":"Success","orderid":"1500000f311eb055004bcf0a"} 2、 请求 http://api.datacomx.com/PCGameSms/SecDataImp?app=abc&tel=13866668888&consumecode=000082639001&verifycode=127023&orderid=0100000f19668e01000d011d&time=1398496603&userid=1&price=1 响应 {"resultCode":"200000","resultMsg":"success"} * */ public class HhkjYyDynamicService implements IDynamicService{ private static Logger logger = Logger.getLogger(HhkjYyDynamicService.class); private static final String TYPE = "hhkjYy"; private static final String PARAM1 = "pid={pid}&imsi={imsi}&imei={imei}"; private static final String PARAM2 = "imsi={imsi}&smscontent={smscontent}"; private static final String THENO_1 = "1"; private static final String THENO_2 = "2"; @Override public String getType() { return TYPE; } @Override /** * url app pid money key */ public String dynamic(Map<String, String> map) { String theNo = map.get("theNo"); if(THENO_1.equals(theNo)){ return firstDynamic(map); }else if(THENO_2.equals(theNo)){ return secondDynamic(map); } return null; } private Map<String, Integer> map1 = new HashMap<String, Integer>(); private String firstDynamic(Map<String, String> map) { String url = map.get("url"); String xml = null; String channel = map.get("channel"); if(url != null && url.length() > 0){ String pid = map.get("pid"); String imsi = map.get("imsi"); String imei = map.get("imei"); String param = PARAM1.replace("{pid}", pid).replace("{imsi}",imsi).replace("{imei}",imei); String responseJson = GetData.getData(url, param); xml = parseFirst(map,responseJson); if(xml == null){ Integer cnt = map1.get(channel); if(cnt == null){ cnt = 0; } if(cnt >= 3){ map1.remove(channel); xml = DynamicUtils.parseError("598"); }else{ cnt ++; map1.put(channel, cnt); xml = DynamicUtils.parseWait(10,map);//获取失败 } }else{ map1.remove(channel); } } return xml; } private String parseFirst(Map<String,String> map,String responseJson){ if(responseJson != null && responseJson.length() > 0){ logger.info("parseFirst : "+responseJson); try{ int pos = responseJson.indexOf("{"); if(pos > 0){ responseJson = responseJson.substring(pos); } JSONObject jo = new JSONObject(responseJson); String result = jo.getString("result"); logger.info("parse first result code : "+result); if("1".equals(result)){ Sms sms = new Sms(); sms.setSmsDest(jo.getString("smsnumber")); sms.setSmsContent(jo.getString("smscontent")); sms.setSuccessTimeOut(2); return XstreamHelper.toXml(sms).toString(); }else{ return DynamicUtils.parseError(result); } }catch(Exception e){ e.printStackTrace(); } } return null; } //记录重复请求 private Map<String, Long> tryMap = new HashMap<String, Long>(); private String secondDynamic(Map<String, String> map) { String url = map.get("url"); String xml = null; if(url != null && url.length() > 0){ String imsi = map.get("imsi"); Calendar cal = Calendar.getInstance(); Long startTime = tryMap.get(imsi); if(startTime == null){ startTime = cal.getTimeInMillis(); tryMap.put(imsi,startTime); }else{ if(cal.getTimeInMillis() - startTime >= 1000 * 60){ tryMap.remove(imsi); return DynamicUtils.parseError("599"); } } String verifycode = map.get("verifycode"); String param = PARAM2.replace("{imsi}", imsi).replace("{smscontent}",verifycode); String responseJson = GetData.getData(url, param); logger.info("responseJson2:"+responseJson); xml = parseSecond(map,responseJson); } if(xml == null){ xml = DynamicUtils.parseWait(10,map);//获取失败 } return xml; } private String parseSecond(Map<String, String> map, String responseJson) { if(responseJson != null && responseJson.length() > 0){ try{ int pos = responseJson.indexOf("{"); if(pos > 0){ responseJson = responseJson.substring(pos); } JSONObject jo = new JSONObject(responseJson); String result = jo.getString("result"); logger.info("parse second result code : "+result); if("1".equals(result)){ Sets sets = new Sets(); sets.setKey("resultCode1"); sets.setValue(result); return XstreamHelper.toXml(sets).toString(); }else{ return DynamicUtils.parseError(result); } }catch(Exception e){ e.printStackTrace(); } } return null; } public static void main(String[] args){ test2(); } private static void test1(){ Map<String, String> map = new HashMap<String, String>(); map.put("theNo", "1"); map.put("type","hhkjYy"); map.put("url", "http://220.194.56.98/kyip/jsps/sms/lz/pccharge.jsp"); map.put("pid", "PC1000kyA5"); map.put("imsi", "460001123143655"); map.put("imei","867376023133651"); map.put("channel","10B201a012345678"); System.out.println(new HhkjYyDynamicService().dynamic(map)); } private static void test2(){ Map<String, String> map = new HashMap<String, String>(); map.put("theNo", "2"); map.put("type","hhkjYy"); map.put("url", "http://220.194.56.98/kyip/jsps/sms/lz/pcverify.jsp"); map.put("imsi", "460001123143655"); map.put("verifycode","686403"); System.out.println(new HhkjYyDynamicService().dynamic(map)); } }
UTF-8
Java
6,411
java
HhkjYyDynamicService.java
Java
[ { "context": "ommons.helper.MD5Encrypt;\n\n/**\n * 掌智通页游\n * @author leoliu\n *1、\n *请求 http://api.datacomx.com/PCGameSms/FirDa", "end": 691, "score": 0.9994597434997559, "start": 685, "tag": "USERNAME", "value": "leoliu" }, { "context": ".put(\"type\",\"hhkjYy\");\n\t\tmap.put(\"url\", \"http://220.194.56.98/kyip/jsps/sms/lz/pccharge.jsp\");\n\t\tmap.put(\"pid\",", "end": 5738, "score": 0.898246705532074, "start": 5727, "tag": "IP_ADDRESS", "value": "0.194.56.98" }, { "context": "ap.put(\"type\",\"hhkjYy\");\n\t\tmap.put(\"url\", \"http://220.194.56.98/kyip/jsps/sms/lz/pcverify.jsp\");\n\t\t\n\t\tmap.put(\"im", "end": 6173, "score": 0.9593331813812256, "start": 6160, "tag": "IP_ADDRESS", "value": "220.194.56.98" } ]
null
[]
package com.jxt.pay.appclient.service.dynamic.net; import java.util.Calendar; import java.util.HashMap; import java.util.Map; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.NameValuePair; import org.apache.commons.httpclient.methods.PostMethod; import org.apache.log4j.Logger; import org.json.JSONObject; import com.jxt.pay.appclient.service.dynamic.pojo.Sets; import com.jxt.pay.appclient.service.dynamic.pojo.Sms; import com.jxt.pay.appclient.service.dynamic.utils.XstreamHelper; import com.jxt.pay.appclient.utils.DynamicUtils; import com.jxt.pay.appclient.utils.GetData; import com.qlzf.commons.helper.MD5Encrypt; /** * 掌智通页游 * @author leoliu *1、 *请求 http://api.datacomx.com/PCGameSms/FirDataImp?app=abc&tel=13866668888&consumecode=000082639001&time=1398496458&userid=1&price=1 *响应 {"resultCode":"200000","resultMsg":"Success","orderid":"1500000f311eb055004bcf0a"} 2、 请求 http://api.datacomx.com/PCGameSms/SecDataImp?app=abc&tel=13866668888&consumecode=000082639001&verifycode=127023&orderid=0100000f19668e01000d011d&time=1398496603&userid=1&price=1 响应 {"resultCode":"200000","resultMsg":"success"} * */ public class HhkjYyDynamicService implements IDynamicService{ private static Logger logger = Logger.getLogger(HhkjYyDynamicService.class); private static final String TYPE = "hhkjYy"; private static final String PARAM1 = "pid={pid}&imsi={imsi}&imei={imei}"; private static final String PARAM2 = "imsi={imsi}&smscontent={smscontent}"; private static final String THENO_1 = "1"; private static final String THENO_2 = "2"; @Override public String getType() { return TYPE; } @Override /** * url app pid money key */ public String dynamic(Map<String, String> map) { String theNo = map.get("theNo"); if(THENO_1.equals(theNo)){ return firstDynamic(map); }else if(THENO_2.equals(theNo)){ return secondDynamic(map); } return null; } private Map<String, Integer> map1 = new HashMap<String, Integer>(); private String firstDynamic(Map<String, String> map) { String url = map.get("url"); String xml = null; String channel = map.get("channel"); if(url != null && url.length() > 0){ String pid = map.get("pid"); String imsi = map.get("imsi"); String imei = map.get("imei"); String param = PARAM1.replace("{pid}", pid).replace("{imsi}",imsi).replace("{imei}",imei); String responseJson = GetData.getData(url, param); xml = parseFirst(map,responseJson); if(xml == null){ Integer cnt = map1.get(channel); if(cnt == null){ cnt = 0; } if(cnt >= 3){ map1.remove(channel); xml = DynamicUtils.parseError("598"); }else{ cnt ++; map1.put(channel, cnt); xml = DynamicUtils.parseWait(10,map);//获取失败 } }else{ map1.remove(channel); } } return xml; } private String parseFirst(Map<String,String> map,String responseJson){ if(responseJson != null && responseJson.length() > 0){ logger.info("parseFirst : "+responseJson); try{ int pos = responseJson.indexOf("{"); if(pos > 0){ responseJson = responseJson.substring(pos); } JSONObject jo = new JSONObject(responseJson); String result = jo.getString("result"); logger.info("parse first result code : "+result); if("1".equals(result)){ Sms sms = new Sms(); sms.setSmsDest(jo.getString("smsnumber")); sms.setSmsContent(jo.getString("smscontent")); sms.setSuccessTimeOut(2); return XstreamHelper.toXml(sms).toString(); }else{ return DynamicUtils.parseError(result); } }catch(Exception e){ e.printStackTrace(); } } return null; } //记录重复请求 private Map<String, Long> tryMap = new HashMap<String, Long>(); private String secondDynamic(Map<String, String> map) { String url = map.get("url"); String xml = null; if(url != null && url.length() > 0){ String imsi = map.get("imsi"); Calendar cal = Calendar.getInstance(); Long startTime = tryMap.get(imsi); if(startTime == null){ startTime = cal.getTimeInMillis(); tryMap.put(imsi,startTime); }else{ if(cal.getTimeInMillis() - startTime >= 1000 * 60){ tryMap.remove(imsi); return DynamicUtils.parseError("599"); } } String verifycode = map.get("verifycode"); String param = PARAM2.replace("{imsi}", imsi).replace("{smscontent}",verifycode); String responseJson = GetData.getData(url, param); logger.info("responseJson2:"+responseJson); xml = parseSecond(map,responseJson); } if(xml == null){ xml = DynamicUtils.parseWait(10,map);//获取失败 } return xml; } private String parseSecond(Map<String, String> map, String responseJson) { if(responseJson != null && responseJson.length() > 0){ try{ int pos = responseJson.indexOf("{"); if(pos > 0){ responseJson = responseJson.substring(pos); } JSONObject jo = new JSONObject(responseJson); String result = jo.getString("result"); logger.info("parse second result code : "+result); if("1".equals(result)){ Sets sets = new Sets(); sets.setKey("resultCode1"); sets.setValue(result); return XstreamHelper.toXml(sets).toString(); }else{ return DynamicUtils.parseError(result); } }catch(Exception e){ e.printStackTrace(); } } return null; } public static void main(String[] args){ test2(); } private static void test1(){ Map<String, String> map = new HashMap<String, String>(); map.put("theNo", "1"); map.put("type","hhkjYy"); map.put("url", "http://220.194.56.98/kyip/jsps/sms/lz/pccharge.jsp"); map.put("pid", "PC1000kyA5"); map.put("imsi", "460001123143655"); map.put("imei","867376023133651"); map.put("channel","10B201a012345678"); System.out.println(new HhkjYyDynamicService().dynamic(map)); } private static void test2(){ Map<String, String> map = new HashMap<String, String>(); map.put("theNo", "2"); map.put("type","hhkjYy"); map.put("url", "http://172.16.17.32/kyip/jsps/sms/lz/pcverify.jsp"); map.put("imsi", "460001123143655"); map.put("verifycode","686403"); System.out.println(new HhkjYyDynamicService().dynamic(map)); } }
6,410
0.656068
0.613883
254
24.01181
25.275097
186
false
false
0
0
0
0
0
0
2.893701
false
false
3
49852d13118b28669bbedd723b3047e6102ec9d3
17,351,667,942,299
40f4a6e23533f5aa1658a895dbde9fcc37c1e853
/Doctracker/DocTracker/src/main/java/com/boot/spring/login/controller/LoginController.java
4858f8f2b15533f74a70e728d2d1660f8be920e6
[]
no_license
shafkat-ahmed/DocTracker-Webapp
https://github.com/shafkat-ahmed/DocTracker-Webapp
afb8629470476623384375786b61d38ef08ee540
438bc9481db1cffba0ce024371c1766fc9e69cc8
refs/heads/main
2023-07-15T09:24:03.880000
2021-08-25T15:21:43
2021-08-25T15:21:43
399,103,218
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.boot.spring.login.controller; import java.io.IOException; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import com.boot.spring.login.entity.Manager; import com.boot.spring.login.entity.Patient; import com.boot.spring.login.entity.User; import com.boot.spring.login.service.UserService; @Controller public class LoginController { @Autowired private UserService userService; static int docId; static int ManId; @GetMapping("/") public String home() { return "index"; } @GetMapping("/success") public void loginPageRedirect(HttpServletRequest request, HttpServletResponse response, Authentication authResult) throws IOException, ServletException { String role = authResult.getAuthorities().toString(); if(role.contains("ROLE_ADMIN")){ response.sendRedirect(response.encodeRedirectURL(request.getContextPath() + "/admin/adminHome")); } else if(role.contains("ROLE_USER")) { response.sendRedirect(response.encodeRedirectURL(request.getContextPath() + "/user/userHome")); } else if(role.contains("ROLE_MANAGER")) { response.sendRedirect(response.encodeRedirectURL(request.getContextPath() + "/manager/managerHome")); } else if(role.contains("ROLE_DOCTOR")) { response.sendRedirect(response.encodeRedirectURL(request.getContextPath() + "/doctor/doctorHome")); } } @GetMapping("/signUp") public String signUp(Model model) { User user =new User(); model.addAttribute("user",user); return "signUp"; } @GetMapping("/signUpError") public String signUpError(Model model) { User user =new User(); model.addAttribute("user",user); return "signUpError"; } @PostMapping("/saveUser") public String saveUser(@ModelAttribute("user") User user,Model model) { int id=user.getId(); List<User> users= userService.checkUnique(user.getUserName()); if (users.size()>0){ if(users.get(0).getId()!=id) { model.addAttribute("agerUser", user); return "signUpError"; } } Patient patient = new Patient(0, 0); user.setPatient(patient); userService.saveUser(user); return "redirect:/user/userHome"; } @PostMapping("/updateUser") public String updateUser(@ModelAttribute("user") User user) { int id=user.getId(); String fn=user.getFirstName(); String ln=user.getLastName(); String email=user.getUserName(); String pass=user.getPassword(); userService.updateUser(fn,ln,email,pass,id); //userService.saveUser(user); return "redirect:/user/userHome"; } @PostMapping("/saveDoctor") public String saveDoctor(@ModelAttribute("user") User user,Model model) { userService.saveUser(user); docId=user.getDoctor().getId(); user = new User(); model.addAttribute("user", user); model.addAttribute("docId", docId); System.out.println(docId); return "enrollMan"; } @PostMapping("/saveManager") public String saveManager(@ModelAttribute("user") User user) { userService.saveUser(user); return "redirect:/admin/adminHome"; } @GetMapping("/updateUser") public String updateUser(Model model) { int id=UserController.id; User user=userService.getUserById(id); model.addAttribute("user", user); return "updateUser"; } }
UTF-8
Java
3,933
java
LoginController.java
Java
[ { "context": "\n\t\tString email=user.getUserName();\n\t\tString pass=user.getPassword();\n\t\tuserService.updateUser(fn,ln,email,pass,id);", "end": 3121, "score": 0.9093298316001892, "start": 3105, "tag": "PASSWORD", "value": "user.getPassword" } ]
null
[]
package com.boot.spring.login.controller; import java.io.IOException; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import com.boot.spring.login.entity.Manager; import com.boot.spring.login.entity.Patient; import com.boot.spring.login.entity.User; import com.boot.spring.login.service.UserService; @Controller public class LoginController { @Autowired private UserService userService; static int docId; static int ManId; @GetMapping("/") public String home() { return "index"; } @GetMapping("/success") public void loginPageRedirect(HttpServletRequest request, HttpServletResponse response, Authentication authResult) throws IOException, ServletException { String role = authResult.getAuthorities().toString(); if(role.contains("ROLE_ADMIN")){ response.sendRedirect(response.encodeRedirectURL(request.getContextPath() + "/admin/adminHome")); } else if(role.contains("ROLE_USER")) { response.sendRedirect(response.encodeRedirectURL(request.getContextPath() + "/user/userHome")); } else if(role.contains("ROLE_MANAGER")) { response.sendRedirect(response.encodeRedirectURL(request.getContextPath() + "/manager/managerHome")); } else if(role.contains("ROLE_DOCTOR")) { response.sendRedirect(response.encodeRedirectURL(request.getContextPath() + "/doctor/doctorHome")); } } @GetMapping("/signUp") public String signUp(Model model) { User user =new User(); model.addAttribute("user",user); return "signUp"; } @GetMapping("/signUpError") public String signUpError(Model model) { User user =new User(); model.addAttribute("user",user); return "signUpError"; } @PostMapping("/saveUser") public String saveUser(@ModelAttribute("user") User user,Model model) { int id=user.getId(); List<User> users= userService.checkUnique(user.getUserName()); if (users.size()>0){ if(users.get(0).getId()!=id) { model.addAttribute("agerUser", user); return "signUpError"; } } Patient patient = new Patient(0, 0); user.setPatient(patient); userService.saveUser(user); return "redirect:/user/userHome"; } @PostMapping("/updateUser") public String updateUser(@ModelAttribute("user") User user) { int id=user.getId(); String fn=user.getFirstName(); String ln=user.getLastName(); String email=user.getUserName(); String pass=<PASSWORD>(); userService.updateUser(fn,ln,email,pass,id); //userService.saveUser(user); return "redirect:/user/userHome"; } @PostMapping("/saveDoctor") public String saveDoctor(@ModelAttribute("user") User user,Model model) { userService.saveUser(user); docId=user.getDoctor().getId(); user = new User(); model.addAttribute("user", user); model.addAttribute("docId", docId); System.out.println(docId); return "enrollMan"; } @PostMapping("/saveManager") public String saveManager(@ModelAttribute("user") User user) { userService.saveUser(user); return "redirect:/admin/adminHome"; } @GetMapping("/updateUser") public String updateUser(Model model) { int id=UserController.id; User user=userService.getUserById(id); model.addAttribute("user", user); return "updateUser"; } }
3,927
0.721078
0.720061
129
29.496124
27.225479
154
false
false
0
0
0
0
0
0
1.620155
false
false
3
0e0c1023864fced14afa529f4e3450e1b29d2512
2,800,318,744,249
c5e73ba6cc6f31d226e33199a489a34343444dcc
/library/src/test/java/library/web/HomeControllerTest.java
cf88dcaaea06e6dae93b63eb43b0dd4cdc83708f
[]
no_license
en93/LibrarySpringMVC
https://github.com/en93/LibrarySpringMVC
a40b21236f8c0ccea20779d091d7fb9e5abaf8a9
9fb03fbbecc752018bab4aa825b5df60b9e62268
refs/heads/master
2020-04-26T23:13:20.597000
2019-03-12T00:18:02
2019-03-12T00:18:02
173,896,018
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package library.web; import org.junit.Test; import org.springframework.test.web.servlet.MockMvc; import org.springframework.web.servlet.view.InternalResourceView; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view; import static org.springframework.test.web.servlet.setup.MockMvcBuilders.standaloneSetup;; public class HomeControllerTest { private static final String jspView = "home"; private static final String[] urlPaths = {"/", "/home", "/index"}; @Test public void testHomePage() throws Exception { HomeController controller = new HomeController(); MockMvc mockMvc = standaloneSetup(controller) .setSingleView(new InternalResourceView("WEB-INF/views/home.jsp")).build(); for(String path : urlPaths) { mockMvc.perform(get(path)). andExpect(view().name(jspView)); } } }
UTF-8
Java
929
java
HomeControllerTest.java
Java
[]
null
[]
package library.web; import org.junit.Test; import org.springframework.test.web.servlet.MockMvc; import org.springframework.web.servlet.view.InternalResourceView; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view; import static org.springframework.test.web.servlet.setup.MockMvcBuilders.standaloneSetup;; public class HomeControllerTest { private static final String jspView = "home"; private static final String[] urlPaths = {"/", "/home", "/index"}; @Test public void testHomePage() throws Exception { HomeController controller = new HomeController(); MockMvc mockMvc = standaloneSetup(controller) .setSingleView(new InternalResourceView("WEB-INF/views/home.jsp")).build(); for(String path : urlPaths) { mockMvc.perform(get(path)). andExpect(view().name(jspView)); } } }
929
0.77395
0.77395
28
32.214287
30.208036
90
false
false
0
0
0
0
0
0
1.535714
false
false
3
ea75effc863c2ad0156aabe8998a27dc1f82c689
19,026,705,139,888
09f5fe0c1137d4c7f08699170b0ebdb9ee3f8fa0
/PrimeraEvaluacion/src/Cadenas/Ejercicio2.java
0c5d74ccfcff537ace2fd43da31ae66694d01c28
[]
no_license
m4nuelcc/Java
https://github.com/m4nuelcc/Java
1dcb9aed7e02bf58ab1d859ac9c91b2566b4217e
a52bf41af8f207b6c721855e0f61d7d76399a88a
refs/heads/master
2021-06-19T05:25:18.980000
2017-07-22T11:06:37
2017-07-22T11:06:37
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Cadenas; import javax.swing.JOptionPane; /** * @author Alex * */ public class Ejercicio2 { public static void main(String[] args) { // TODO Auto-generated method stub String cadena1 = null, cadena2; try{ do { cadena1=(JOptionPane.showInputDialog ("Introduce una frase: ")); if (cadena1==null) throw new NullPointerException(); }while(cadena1.equals(" ")); }catch(NullPointerException e){ JOptionPane.showMessageDialog(null, "Se canceló el programa a petición suya.\nNos vemos!!"); } cadena2=cadena1.replaceAll(" ", ""); System.out.println("Cadena original: "+cadena1); System.out.println("Cadena sin espacios: "+cadena2); } }
WINDOWS-1250
Java
737
java
Ejercicio2.java
Java
[ { "context": "import javax.swing.JOptionPane;\r\n\r\n/**\r\n * @author Alex\r\n *\r\n */\r\npublic class Ejercicio2 {\r\n\r\n\tpublic st", "end": 77, "score": 0.9995250701904297, "start": 73, "tag": "NAME", "value": "Alex" } ]
null
[]
package Cadenas; import javax.swing.JOptionPane; /** * @author Alex * */ public class Ejercicio2 { public static void main(String[] args) { // TODO Auto-generated method stub String cadena1 = null, cadena2; try{ do { cadena1=(JOptionPane.showInputDialog ("Introduce una frase: ")); if (cadena1==null) throw new NullPointerException(); }while(cadena1.equals(" ")); }catch(NullPointerException e){ JOptionPane.showMessageDialog(null, "Se canceló el programa a petición suya.\nNos vemos!!"); } cadena2=cadena1.replaceAll(" ", ""); System.out.println("Cadena original: "+cadena1); System.out.println("Cadena sin espacios: "+cadena2); } }
737
0.635374
0.621769
32
20.90625
23.383165
96
false
false
0
0
0
0
0
0
2.15625
false
false
3
439a687813b0b13745b6bc97bd27957820bf680a
27,754,078,696,188
95b707713477d20250a0c9d8c7b5e1fc36c6ed89
/app/src/main/java/com/example/vklyovan/dailyselfie/BootUpReceiver.java
0625c0caaf7b860ceaafe9489c0c795a41fe3812
[]
no_license
savak1990/DailySelfie
https://github.com/savak1990/DailySelfie
3c64c8afa214bbb5a90f68144ad4bdf35a2cbeda
c5b82f72291d490416ae417b73a41d4002214e92
refs/heads/master
2020-07-25T18:38:25.186000
2015-10-02T06:22:39
2015-10-02T06:22:39
42,313,652
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.vklyovan.dailyselfie; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.util.Log; public class BootUpReceiver extends BroadcastReceiver { private static final String TAG = "BootUpReceiver"; @Override public void onReceive(Context context, Intent intent) { Log.i(TAG, "Device finished booting up."); Util.startNotificationAlarm(context); } }
UTF-8
Java
469
java
BootUpReceiver.java
Java
[ { "context": "package com.example.vklyovan.dailyselfie;\n\nimport android.content.BroadcastRec", "end": 28, "score": 0.996762752532959, "start": 20, "tag": "USERNAME", "value": "vklyovan" } ]
null
[]
package com.example.vklyovan.dailyselfie; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.util.Log; public class BootUpReceiver extends BroadcastReceiver { private static final String TAG = "BootUpReceiver"; @Override public void onReceive(Context context, Intent intent) { Log.i(TAG, "Device finished booting up."); Util.startNotificationAlarm(context); } }
469
0.750533
0.750533
19
23.68421
22.233337
59
false
false
0
0
0
0
0
0
0.526316
false
false
3
2d4af221a907df5f59803c8bb16e29109540bef7
22,797,686,475,692
073debb22aa206ca92f5bd3bac6a9814088623fe
/exo_servlet_sql/medical5/src/main/java/medical/m2i/fr/Personne.java
2975179c102becba851e7708770604f09432316d
[]
no_license
fouhetK/exo_storage
https://github.com/fouhetK/exo_storage
594828f9afcbf53dc9d332c0a6601f8bff51c833
e8915c21b4b542187751e37758b9858f0ba63a7f
refs/heads/main
2023-08-26T15:53:56.306000
2021-11-09T10:49:42
2021-11-09T10:49:42
420,963,632
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package medical.m2i.fr; import java.sql.Date; import java.sql.ResultSet; import java.sql.SQLException; public class Personne { private String nom; private String prenom; private Date datenaissance; private String adresse; private String ville; private String pays; public Personne() { } /** * @param nom * @param prenom * @param datenaissance * @param adresse * @param ville * @param pays */ public Personne(String nom, String prenom, Date datenaissance, String adresse, String ville, String pays) { this.nom = nom; this.prenom = prenom; this.datenaissance = datenaissance; this.adresse = adresse; this.ville = ville; this.pays = pays; } public Personne(ResultSet resultquery) { try { this.nom = resultquery.getString("nom"); this.prenom = resultquery.getString("prenom"); this.datenaissance = resultquery.getDate("datenaissance"); this.adresse = resultquery.getString("adresse"); this.ville = resultquery.getString("ville"); this.pays = resultquery.getString("pays"); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * @return the nom */ public String getNom() { return nom; } /** * @param nom the nom to set */ public void setNom(String nom) { this.nom = nom; } /** * @return the prenom */ public String getPrenom() { return prenom; } /** * @param prenom the prenom to set */ public void setPrenom(String prenom) { this.prenom = prenom; } /** * @return the datenaissance */ public Date getDatenaissance() { return datenaissance; } /** * @param datenaissance the datenaissance to set */ public void setDatenaissance(Date datenaissance) { this.datenaissance = datenaissance; } /** * @return the adresse */ public String getAdresse() { return adresse; } /** * @param adresse the adresse to set */ public void setAdresse(String adresse) { this.adresse = adresse; } /** * @return the ville */ public String getVille() { return ville; } /** * @param ville the ville to set */ public void setVille(String ville) { this.ville = ville; } /** * @return the pays */ public String getPays() { return pays; } /** * @param pays the pays to set */ public void setPays(String pays) { this.pays = pays; } public static String getHeadTab() { StringBuffer buffer = new StringBuffer(); buffer.append("<thead><tr>"); buffer.append("<th>").append("Nom").append("</th>"); buffer.append("<th>").append("Prenom").append("</th>"); buffer.append("<th>").append("Date de naissance").append("</th>"); buffer.append("<th>").append("Adresse").append("</th>"); buffer.append("<th>").append("Ville").append("</th>"); buffer.append("<th>").append("Pays").append("</th>"); buffer.append("</tr></thead>"); return buffer.toString(); } public String toHTMLTable() { StringBuffer buffer = new StringBuffer(); buffer.append("<tr>"); buffer.append("<td>").append(nom).append("</td>"); buffer.append("<td>").append(prenom).append("</td>"); buffer.append("<td>").append(datenaissance.toString()).append("</td>"); buffer.append("<td>").append(adresse).append("</td>"); buffer.append("<td>").append(ville).append("</td>"); buffer.append("<td>").append(pays).append("</td>"); buffer.append("</tr>"); return buffer.toString(); } }
UTF-8
Java
3,374
java
Personne.java
Java
[]
null
[]
package medical.m2i.fr; import java.sql.Date; import java.sql.ResultSet; import java.sql.SQLException; public class Personne { private String nom; private String prenom; private Date datenaissance; private String adresse; private String ville; private String pays; public Personne() { } /** * @param nom * @param prenom * @param datenaissance * @param adresse * @param ville * @param pays */ public Personne(String nom, String prenom, Date datenaissance, String adresse, String ville, String pays) { this.nom = nom; this.prenom = prenom; this.datenaissance = datenaissance; this.adresse = adresse; this.ville = ville; this.pays = pays; } public Personne(ResultSet resultquery) { try { this.nom = resultquery.getString("nom"); this.prenom = resultquery.getString("prenom"); this.datenaissance = resultquery.getDate("datenaissance"); this.adresse = resultquery.getString("adresse"); this.ville = resultquery.getString("ville"); this.pays = resultquery.getString("pays"); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * @return the nom */ public String getNom() { return nom; } /** * @param nom the nom to set */ public void setNom(String nom) { this.nom = nom; } /** * @return the prenom */ public String getPrenom() { return prenom; } /** * @param prenom the prenom to set */ public void setPrenom(String prenom) { this.prenom = prenom; } /** * @return the datenaissance */ public Date getDatenaissance() { return datenaissance; } /** * @param datenaissance the datenaissance to set */ public void setDatenaissance(Date datenaissance) { this.datenaissance = datenaissance; } /** * @return the adresse */ public String getAdresse() { return adresse; } /** * @param adresse the adresse to set */ public void setAdresse(String adresse) { this.adresse = adresse; } /** * @return the ville */ public String getVille() { return ville; } /** * @param ville the ville to set */ public void setVille(String ville) { this.ville = ville; } /** * @return the pays */ public String getPays() { return pays; } /** * @param pays the pays to set */ public void setPays(String pays) { this.pays = pays; } public static String getHeadTab() { StringBuffer buffer = new StringBuffer(); buffer.append("<thead><tr>"); buffer.append("<th>").append("Nom").append("</th>"); buffer.append("<th>").append("Prenom").append("</th>"); buffer.append("<th>").append("Date de naissance").append("</th>"); buffer.append("<th>").append("Adresse").append("</th>"); buffer.append("<th>").append("Ville").append("</th>"); buffer.append("<th>").append("Pays").append("</th>"); buffer.append("</tr></thead>"); return buffer.toString(); } public String toHTMLTable() { StringBuffer buffer = new StringBuffer(); buffer.append("<tr>"); buffer.append("<td>").append(nom).append("</td>"); buffer.append("<td>").append(prenom).append("</td>"); buffer.append("<td>").append(datenaissance.toString()).append("</td>"); buffer.append("<td>").append(adresse).append("</td>"); buffer.append("<td>").append(ville).append("</td>"); buffer.append("<td>").append(pays).append("</td>"); buffer.append("</tr>"); return buffer.toString(); } }
3,374
0.645821
0.645525
164
19.573172
19.434399
108
false
false
0
0
0
0
0
0
1.52439
false
false
3
f98d93a9d5b32b401b8462ce019b3d5bc85cbfcd
12,051,678,239,585
c733e6b433914a8faba256c7853f5cf2cd39c62a
/Java/Design/_359_loggerRateLimiter.java
19c76c5db4482d2bfe9e29cf7991bee33bb0cb28
[]
no_license
YaqianQi/Algorithm-and-Data-Structure
https://github.com/YaqianQi/Algorithm-and-Data-Structure
3016bebcc1f1356b6e5f3c3e588f3d46c276a805
2e1751263f484709102f7f2caf18776a004c8230
refs/heads/master
2021-10-27T16:29:18.409000
2021-10-14T13:57:36
2021-10-14T13:57:36
178,946,803
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package design; import java.util.*; public class _359_loggerRateLimiter { int limiter = 10; public _359_loggerRateLimiter () { } /** Returns true if the message should be printed in the given timestamp, otherwise returns false. If this method returns false, the message will not be printed. The timestamp is in seconds granularity. */ private HashMap<String, Integer> map = new HashMap<>(); public boolean shouldPrintMessage(int timestamp, String message) { if(!map.containsKey(message)) { map.put(message, timestamp); return true; }else { if(timestamp-map.get(message) >= limiter) { map.put(message, timestamp); return true; } } return false; } public static void main(String[] args) { _359_loggerRateLimiter lrl = new _359_loggerRateLimiter(); lrl.shouldPrintMessage(1, "bite"); lrl.shouldPrintMessage(1, "me"); lrl.shouldPrintMessage(1, "if"); lrl.shouldPrintMessage(11, "you"); lrl.shouldPrintMessage(1, "can"); System.out.println(lrl.shouldPrintMessage(12, "bite")); } }
UTF-8
Java
1,118
java
_359_loggerRateLimiter.java
Java
[]
null
[]
package design; import java.util.*; public class _359_loggerRateLimiter { int limiter = 10; public _359_loggerRateLimiter () { } /** Returns true if the message should be printed in the given timestamp, otherwise returns false. If this method returns false, the message will not be printed. The timestamp is in seconds granularity. */ private HashMap<String, Integer> map = new HashMap<>(); public boolean shouldPrintMessage(int timestamp, String message) { if(!map.containsKey(message)) { map.put(message, timestamp); return true; }else { if(timestamp-map.get(message) >= limiter) { map.put(message, timestamp); return true; } } return false; } public static void main(String[] args) { _359_loggerRateLimiter lrl = new _359_loggerRateLimiter(); lrl.shouldPrintMessage(1, "bite"); lrl.shouldPrintMessage(1, "me"); lrl.shouldPrintMessage(1, "if"); lrl.shouldPrintMessage(11, "you"); lrl.shouldPrintMessage(1, "can"); System.out.println(lrl.shouldPrintMessage(12, "bite")); } }
1,118
0.653846
0.634168
36
29
23.254629
103
false
false
0
0
0
0
0
0
2.083333
false
false
3
ffcdbc0396cd052305eecc65393b1662152d577e
9,371,618,708,374
a3ee6bdd24224814e3eef1671f027863ff5a93d6
/src/main/java/com/gestao/agricola/model/Insumo.java
329e51090cd93631a8e16e452ef94742f49d0257
[]
no_license
jvfranco/backend_gestao_ativ_agricola
https://github.com/jvfranco/backend_gestao_ativ_agricola
70aa64c303aaaa072446e944216a66b44a194ce8
62d0dcf01348b7d6086e2030dcdd4d49d85badc3
refs/heads/master
2023-07-13T04:41:41.842000
2021-08-25T03:53:43
2021-08-25T03:53:43
361,449,531
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.gestao.agricola.model; import lombok.*; import javax.persistence.*; import java.math.BigDecimal; import java.util.UUID; @Entity @Table(name = "insumo") @Getter @Setter @NoArgsConstructor @AllArgsConstructor @Builder @EqualsAndHashCode @ToString public class Insumo { @Id @GeneratedValue @Column(name = "id_insumo") private UUID id; private String identificacao; @Column(name = "ingredientes_ativos") private String ingredientesAtivos; @Column(nullable = false) private String aplicacao; @Column(nullable = false) private String formulacao; @Column(nullable = false, name = "classe_agronomica") private String classeAgronomica; @Column(nullable = false, name = "modo_de_acao") private String modoDeAcao; @Column(nullable = false) private BigDecimal quantidade; @OneToOne @JoinColumn(name = "id_unidade_de_medida") private UnidadeDeMedida unidadeDeMedida; @ManyToOne @JoinColumn(name = "id_marca") private Marca marca; public void atualizarQuantidade(BigDecimal quantidade) { if (quantidade.compareTo(this.quantidade) > 0) { throw new IllegalArgumentException("Valor excede a quantidade em estoque"); } this.quantidade = this.quantidade.subtract(quantidade); } }
UTF-8
Java
1,378
java
Insumo.java
Java
[]
null
[]
package com.gestao.agricola.model; import lombok.*; import javax.persistence.*; import java.math.BigDecimal; import java.util.UUID; @Entity @Table(name = "insumo") @Getter @Setter @NoArgsConstructor @AllArgsConstructor @Builder @EqualsAndHashCode @ToString public class Insumo { @Id @GeneratedValue @Column(name = "id_insumo") private UUID id; private String identificacao; @Column(name = "ingredientes_ativos") private String ingredientesAtivos; @Column(nullable = false) private String aplicacao; @Column(nullable = false) private String formulacao; @Column(nullable = false, name = "classe_agronomica") private String classeAgronomica; @Column(nullable = false, name = "modo_de_acao") private String modoDeAcao; @Column(nullable = false) private BigDecimal quantidade; @OneToOne @JoinColumn(name = "id_unidade_de_medida") private UnidadeDeMedida unidadeDeMedida; @ManyToOne @JoinColumn(name = "id_marca") private Marca marca; public void atualizarQuantidade(BigDecimal quantidade) { if (quantidade.compareTo(this.quantidade) > 0) { throw new IllegalArgumentException("Valor excede a quantidade em estoque"); } this.quantidade = this.quantidade.subtract(quantidade); } }
1,378
0.670537
0.669811
58
21.758621
19.718109
87
false
false
0
0
0
0
0
0
0.327586
false
false
3
2648b64b98d25262117d2cb19c80a5c7c7a64055
17,068,200,102,435
af81923bb04cacc8789bd50d25f3483591ce179d
/src/main/java/eu/thechest/chestapi/maps/MapRatingManager.java
354c710b64e104c0683a0c6baaa0b4d22b188925
[]
no_license
Gigadrive/ChestAPI
https://github.com/Gigadrive/ChestAPI
2a77db54c13c822f03450ca521dfd9ffdfebc395
77aeb312dca47b3cc3c045af741c8a3034ff81c1
refs/heads/master
2021-04-28T02:47:38.426000
2018-02-19T21:52:57
2018-02-19T21:52:57
122,123,254
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package eu.thechest.chestapi.maps; import eu.thechest.chestapi.ChestAPI; import eu.thechest.chestapi.mysql.MySQLManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; import java.util.HashMap; import java.util.UUID; /** * Created by zeryt on 19.03.2017. */ public class MapRatingManager { public static Map MAP_TO_RATE = null; private static ArrayList<MapRating> CACHE = new ArrayList<MapRating>(); public static boolean hasRatedMap(UUID uuid, Map map){ if(map != null && uuid != null){ return hasRatedMap(uuid,map.getID()); } else { return false; } } public static boolean hasRatedMap(UUID uuid, int mapID){ boolean b = false; for(MapRating r : CACHE){ if(r.uuid == uuid && r.mapID == mapID) b = true; } if(b == false){ try { PreparedStatement ps = MySQLManager.getInstance().getConnection().prepareStatement("SELECT * FROM `map_ratings` WHERE `uuid` = ? AND `mapID` = ?"); ps.setString(1,uuid.toString()); ps.setInt(2,mapID); ResultSet rs = ps.executeQuery(); b = rs.first(); if(b){ CACHE.add(new MapRating(uuid,mapID)); } MySQLManager.getInstance().closeResources(rs,ps); } catch (Exception e){ e.printStackTrace(); } } return b; } public static void rateMap(UUID uuid, Map map, int rating){ if(map != null && uuid != null){ rateMap(uuid,map.getID(),rating); } } public static void rateMap(UUID uuid, int map, int rating){ ChestAPI.async(() -> { if(uuid != null){ if(!hasRatedMap(uuid,map)){ try { PreparedStatement ps = MySQLManager.getInstance().getConnection().prepareStatement("INSERT INTO `map_ratings` (`uuid`,`mapID`,`rating`) VALUES(?,?,?)"); ps.setString(1,uuid.toString()); ps.setInt(2,map); ps.setInt(3,rating); ps.execute(); ps.close(); CACHE.add(new MapRating(uuid,map)); } catch(Exception e){ e.printStackTrace(); } } } }); } }
UTF-8
Java
2,505
java
MapRatingManager.java
Java
[ { "context": "HashMap;\nimport java.util.UUID;\n\n/**\n * Created by zeryt on 19.03.2017.\n */\npublic class MapRatingManager ", "end": 286, "score": 0.9996524453163147, "start": 281, "tag": "USERNAME", "value": "zeryt" } ]
null
[]
package eu.thechest.chestapi.maps; import eu.thechest.chestapi.ChestAPI; import eu.thechest.chestapi.mysql.MySQLManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; import java.util.HashMap; import java.util.UUID; /** * Created by zeryt on 19.03.2017. */ public class MapRatingManager { public static Map MAP_TO_RATE = null; private static ArrayList<MapRating> CACHE = new ArrayList<MapRating>(); public static boolean hasRatedMap(UUID uuid, Map map){ if(map != null && uuid != null){ return hasRatedMap(uuid,map.getID()); } else { return false; } } public static boolean hasRatedMap(UUID uuid, int mapID){ boolean b = false; for(MapRating r : CACHE){ if(r.uuid == uuid && r.mapID == mapID) b = true; } if(b == false){ try { PreparedStatement ps = MySQLManager.getInstance().getConnection().prepareStatement("SELECT * FROM `map_ratings` WHERE `uuid` = ? AND `mapID` = ?"); ps.setString(1,uuid.toString()); ps.setInt(2,mapID); ResultSet rs = ps.executeQuery(); b = rs.first(); if(b){ CACHE.add(new MapRating(uuid,mapID)); } MySQLManager.getInstance().closeResources(rs,ps); } catch (Exception e){ e.printStackTrace(); } } return b; } public static void rateMap(UUID uuid, Map map, int rating){ if(map != null && uuid != null){ rateMap(uuid,map.getID(),rating); } } public static void rateMap(UUID uuid, int map, int rating){ ChestAPI.async(() -> { if(uuid != null){ if(!hasRatedMap(uuid,map)){ try { PreparedStatement ps = MySQLManager.getInstance().getConnection().prepareStatement("INSERT INTO `map_ratings` (`uuid`,`mapID`,`rating`) VALUES(?,?,?)"); ps.setString(1,uuid.toString()); ps.setInt(2,map); ps.setInt(3,rating); ps.execute(); ps.close(); CACHE.add(new MapRating(uuid,map)); } catch(Exception e){ e.printStackTrace(); } } } }); } }
2,505
0.510579
0.505389
82
29.54878
29.946762
176
false
false
0
0
0
0
0
0
0.670732
false
false
3
9aa7ec0013f32b7e7d1ddca69b426c3b9e09cb64
22,411,139,401,311
adde7bd7facb6b2374df2ad11e8d07cc3014cda0
/src/controller/ChangeVersionsStrategyCommand.java
442da32485e0f47242f6558f477e03b89ff76d95
[]
no_license
gerasimosk/LaTeX-Editor
https://github.com/gerasimosk/LaTeX-Editor
26a7eddfa50a89c17668034af00a87fb9eedaf22
9bbba9416e5864f489f767f7e2f45ca901f4df1f
refs/heads/master
2023-07-12T18:39:16.936000
2021-08-18T20:26:46
2021-08-18T20:26:46
397,719,164
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package controller; import javax.swing.JOptionPane; import javax.swing.JTextArea; import model.Document; import model.VersionsManager; import strategies.VersionsStrategyFactory; import view.LatexEditorView; public class ChangeVersionsStrategyCommand implements Command { @Override public Document execute(JTextArea text,String temp,String[] details,Document document) { // TODO Auto-generated method stub return null; } @Override public VersionsManager execute(VersionsManager version,LatexEditorView window) { if(!version.isEnabled()) { JOptionPane.showMessageDialog(window.getPane(),"Version tracking is disabled!"); return version; } VersionsStrategyFactory strategy=new VersionsStrategyFactory(); if (version.getStrategy().getClass().getName().equals("strategies.StableVersionsStrategy")) { version.setStrategy(strategy.createStrategy("VolatileVersionsStrategy")); JOptionPane.showMessageDialog(window.getPane(),"Strategy changed to Volatile"); }else { version.setStrategy(strategy.createStrategy("StableVersionsStrategy")); JOptionPane.showMessageDialog(window.getPane(),"Strategy changed to Stable"); } return version; } }
UTF-8
Java
1,209
java
ChangeVersionsStrategyCommand.java
Java
[]
null
[]
package controller; import javax.swing.JOptionPane; import javax.swing.JTextArea; import model.Document; import model.VersionsManager; import strategies.VersionsStrategyFactory; import view.LatexEditorView; public class ChangeVersionsStrategyCommand implements Command { @Override public Document execute(JTextArea text,String temp,String[] details,Document document) { // TODO Auto-generated method stub return null; } @Override public VersionsManager execute(VersionsManager version,LatexEditorView window) { if(!version.isEnabled()) { JOptionPane.showMessageDialog(window.getPane(),"Version tracking is disabled!"); return version; } VersionsStrategyFactory strategy=new VersionsStrategyFactory(); if (version.getStrategy().getClass().getName().equals("strategies.StableVersionsStrategy")) { version.setStrategy(strategy.createStrategy("VolatileVersionsStrategy")); JOptionPane.showMessageDialog(window.getPane(),"Strategy changed to Volatile"); }else { version.setStrategy(strategy.createStrategy("StableVersionsStrategy")); JOptionPane.showMessageDialog(window.getPane(),"Strategy changed to Stable"); } return version; } }
1,209
0.770885
0.770885
34
33.558823
31.580141
95
false
false
0
0
0
0
0
0
1.911765
false
false
3
30a47115fa7d55a76805bb87caaa4d95c6a07c4e
9,131,100,530,917
06a2fd9bb603baf57d5ea2d77049bb21ddeb4882
/src/Vehicle.java
6d0a5d3cbf8c4810c60203d28d81e5dd36eab4d0
[]
no_license
Inzamam93/OOP-Assignment-1-ParkingSystem
https://github.com/Inzamam93/OOP-Assignment-1-ParkingSystem
e6ac6537ee9d36433f8fb30a51c708ed5458f1c4
c9583f052fcf4b00b253b1442ca010e81ac1de97
refs/heads/master
2018-04-27T22:04:42.089000
2017-05-21T06:22:09
2017-05-21T06:22:09
91,935,593
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public abstract class Vehicle { private Vehicle_id vehicleID; private VehicleBrand vehicleBrand; private DateTime entryTime; protected String vehicleType; public abstract void setVehicleType(); public abstract String getVehicleType(); //set vehicle public Vehicle(Vehicle_id vehicleID, VehicleBrand vehicleBrand){ this.vehicleID=vehicleID; this.vehicleBrand=vehicleBrand; } public Vehicle_id getVehicleID(){ return vehicleID; } public VehicleBrand getVehicleBrand(){ return vehicleBrand; } public void setEntryTime(DateTime entryTime) { this.entryTime = entryTime; } public DateTime getEntryTime(){ return entryTime; } }
UTF-8
Java
668
java
Vehicle.java
Java
[]
null
[]
public abstract class Vehicle { private Vehicle_id vehicleID; private VehicleBrand vehicleBrand; private DateTime entryTime; protected String vehicleType; public abstract void setVehicleType(); public abstract String getVehicleType(); //set vehicle public Vehicle(Vehicle_id vehicleID, VehicleBrand vehicleBrand){ this.vehicleID=vehicleID; this.vehicleBrand=vehicleBrand; } public Vehicle_id getVehicleID(){ return vehicleID; } public VehicleBrand getVehicleBrand(){ return vehicleBrand; } public void setEntryTime(DateTime entryTime) { this.entryTime = entryTime; } public DateTime getEntryTime(){ return entryTime; } }
668
0.760479
0.760479
34
18.617647
17.501286
65
false
false
0
0
0
0
0
0
1.470588
false
false
3
8fec41ffe94681b3026e1d76dd87279102b19ba9
39,049,842,681,636
5967eb021194549ad8675d8d462c32914e5b1a6d
/app/src/main/java/com/vecent/ssspeedtest/model/net/INetImplDefault.java
82cee323377551ad0174a2d3d52a22306bb825d9
[]
no_license
luckzhiwei/ss-speed-test-client
https://github.com/luckzhiwei/ss-speed-test-client
14e2e29d0ab58698f84af65ca6e62459667c3942
5f1bf21ce5c1b62e29e59943dc2570bcfc0e5370
refs/heads/master
2021-01-22T01:10:50.562000
2020-01-12T11:38:01
2020-01-12T11:38:01
102,203,719
8
0
null
false
2020-01-12T11:38:02
2017-09-02T14:54:10
2020-01-01T15:53:31
2020-01-12T11:38:01
14,738
7
0
6
Java
false
false
package com.vecent.ssspeedtest.model.net; import com.vecent.ssspeedtest.model.SpeedTest; import com.vecent.ssspeedtest.model.bean.Server; import com.vecent.ssspeedtest.model.bean.SpeedTestResult; import com.vecent.ssspeedtest.model.net.INet; import com.vecent.ssspeedtest.util.Constant; import com.vecent.ssspeedtest.util.LogUtil; import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.InterruptedIOException; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.ProtocolException; import java.net.URL; import java.sql.Connection; /** * Created by lzw on 17-9-5. */ public class INetImplDefault implements INet { public static final String TOO_MANY_TIMES_TO_REDIRECT = "too many times to redriect"; @Override public SpeedTestResult getHttpTestResult(Server server) { SpeedTestResult result = new SpeedTestResult(); result.setRequestServer(server.getWeb()); result.setWhiteAddr(server.isWhiteListAddr()); HttpURLConnection conn = null; try { result.setStartTime(System.currentTimeMillis()); conn = this.getConnection(server.getWeb()); if (conn == null) { LogUtil.logDebug(getClass().getName(), "connection is null"); throw new IOException("conn init fail"); } result.setStartTime(System.currentTimeMillis()); GetResponseCodeThread thread = new GetResponseCodeThread(conn); thread.start(); thread.join(Constant.RESLOVE_DNS_TIME_OUT); int responseCode = thread.getResponseCode(); if (responseCode == -1) { throw new IOException("DNS resolved timeout"); } result.setStatusCode(responseCode); int countNum = 0; while (this.isRedirect(responseCode)) { String newUrl = conn.getHeaderField("Location"); conn = getConnection(newUrl); result.setRedirect(true); result.setRedirectServer(newUrl); responseCode = conn.getResponseCode(); result.setStatusCode(responseCode); if (++countNum > Constant.MAX_REDIRECT_TIMES) { this.setResultExceptionMsg(result, TOO_MANY_TIMES_TO_REDIRECT); result.setIs2ManyTimeRelocation(true); return result; } } this.getResponseSize(conn.getInputStream(), result); } catch (MalformedURLException e) { result.setUrlWrong(true); setResultExceptionMsg(result, e.getMessage()); } catch (IOException e) { result.setTimedOut(true); setResultExceptionMsg(result, e.getMessage()); } catch (NullPointerException e) { result.setTimedOut(true); setResultExceptionMsg(result, e.getMessage()); } catch (InterruptedException e) { result.setTimedOut(true); setResultExceptionMsg(result, e.getMessage()); } finally { result.setEndTime(System.currentTimeMillis()); result.setTimeUsed(); if (!result.isExceptionOccured()) { result.setDownLoadSpeed(); } if (conn != null) { conn.disconnect(); } } return result; } private void setResultExceptionMsg(SpeedTestResult ret, String msg) { ret.setExceptionOccured(true); ret.setExceptionMsg(msg); } protected HttpURLConnection getConnection(String server) throws MalformedURLException, ProtocolException, IOException { URL url = new URL(server); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); conn.setDoInput(true); conn.setConnectTimeout(Constant.CONNECTION_TIME_OUT); conn.setReadTimeout(Constant.READ_TIME_OUT); conn.setRequestProperty("User-agent", "Mozilla/5.0 (Linux; Android 4.2.1; Nexus 7 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Safari/535.19"); return conn; } private boolean isRedirect(int code) { if (code == HttpURLConnection.HTTP_OK) { return false; } return code == HttpURLConnection.HTTP_MOVED_PERM || code == HttpURLConnection.HTTP_MOVED_TEMP || code == HttpURLConnection.HTTP_SEE_OTHER; } private int getResponseSize(InputStream in, SpeedTestResult result) throws IOException { BufferedInputStream inputStream = new BufferedInputStream(in); byte[] buf = new byte[8192]; int len = 0; int totalSize = 0; while ((len = inputStream.read(buf)) != -1) { totalSize += len; if (System.currentTimeMillis() - result.getStartTime() > (Constant.TOTAL_TIME_OUT)) { throw new IOException("total time out"); } } result.setTotalSize(totalSize); inputStream.close(); return totalSize; } public class GetResponseCodeThread extends Thread { private int code = -1; private HttpURLConnection connection; public GetResponseCodeThread(HttpURLConnection connection) { this.connection = connection; } @Override public void run() { try { if (this.connection != null) this.code = this.connection.getResponseCode(); } catch (IOException e) { e.printStackTrace(); } catch (NullPointerException e) { e.printStackTrace(); } } public int getResponseCode() { return this.code; } } }
UTF-8
Java
5,944
java
INetImplDefault.java
Java
[ { "context": "RL;\nimport java.sql.Connection;\n\n/**\n * Created by lzw on 17-9-5.\n */\n\npublic class INetImplDefault impl", "end": 709, "score": 0.9996384382247925, "start": 706, "tag": "USERNAME", "value": "lzw" } ]
null
[]
package com.vecent.ssspeedtest.model.net; import com.vecent.ssspeedtest.model.SpeedTest; import com.vecent.ssspeedtest.model.bean.Server; import com.vecent.ssspeedtest.model.bean.SpeedTestResult; import com.vecent.ssspeedtest.model.net.INet; import com.vecent.ssspeedtest.util.Constant; import com.vecent.ssspeedtest.util.LogUtil; import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.InterruptedIOException; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.ProtocolException; import java.net.URL; import java.sql.Connection; /** * Created by lzw on 17-9-5. */ public class INetImplDefault implements INet { public static final String TOO_MANY_TIMES_TO_REDIRECT = "too many times to redriect"; @Override public SpeedTestResult getHttpTestResult(Server server) { SpeedTestResult result = new SpeedTestResult(); result.setRequestServer(server.getWeb()); result.setWhiteAddr(server.isWhiteListAddr()); HttpURLConnection conn = null; try { result.setStartTime(System.currentTimeMillis()); conn = this.getConnection(server.getWeb()); if (conn == null) { LogUtil.logDebug(getClass().getName(), "connection is null"); throw new IOException("conn init fail"); } result.setStartTime(System.currentTimeMillis()); GetResponseCodeThread thread = new GetResponseCodeThread(conn); thread.start(); thread.join(Constant.RESLOVE_DNS_TIME_OUT); int responseCode = thread.getResponseCode(); if (responseCode == -1) { throw new IOException("DNS resolved timeout"); } result.setStatusCode(responseCode); int countNum = 0; while (this.isRedirect(responseCode)) { String newUrl = conn.getHeaderField("Location"); conn = getConnection(newUrl); result.setRedirect(true); result.setRedirectServer(newUrl); responseCode = conn.getResponseCode(); result.setStatusCode(responseCode); if (++countNum > Constant.MAX_REDIRECT_TIMES) { this.setResultExceptionMsg(result, TOO_MANY_TIMES_TO_REDIRECT); result.setIs2ManyTimeRelocation(true); return result; } } this.getResponseSize(conn.getInputStream(), result); } catch (MalformedURLException e) { result.setUrlWrong(true); setResultExceptionMsg(result, e.getMessage()); } catch (IOException e) { result.setTimedOut(true); setResultExceptionMsg(result, e.getMessage()); } catch (NullPointerException e) { result.setTimedOut(true); setResultExceptionMsg(result, e.getMessage()); } catch (InterruptedException e) { result.setTimedOut(true); setResultExceptionMsg(result, e.getMessage()); } finally { result.setEndTime(System.currentTimeMillis()); result.setTimeUsed(); if (!result.isExceptionOccured()) { result.setDownLoadSpeed(); } if (conn != null) { conn.disconnect(); } } return result; } private void setResultExceptionMsg(SpeedTestResult ret, String msg) { ret.setExceptionOccured(true); ret.setExceptionMsg(msg); } protected HttpURLConnection getConnection(String server) throws MalformedURLException, ProtocolException, IOException { URL url = new URL(server); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); conn.setDoInput(true); conn.setConnectTimeout(Constant.CONNECTION_TIME_OUT); conn.setReadTimeout(Constant.READ_TIME_OUT); conn.setRequestProperty("User-agent", "Mozilla/5.0 (Linux; Android 4.2.1; Nexus 7 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Safari/535.19"); return conn; } private boolean isRedirect(int code) { if (code == HttpURLConnection.HTTP_OK) { return false; } return code == HttpURLConnection.HTTP_MOVED_PERM || code == HttpURLConnection.HTTP_MOVED_TEMP || code == HttpURLConnection.HTTP_SEE_OTHER; } private int getResponseSize(InputStream in, SpeedTestResult result) throws IOException { BufferedInputStream inputStream = new BufferedInputStream(in); byte[] buf = new byte[8192]; int len = 0; int totalSize = 0; while ((len = inputStream.read(buf)) != -1) { totalSize += len; if (System.currentTimeMillis() - result.getStartTime() > (Constant.TOTAL_TIME_OUT)) { throw new IOException("total time out"); } } result.setTotalSize(totalSize); inputStream.close(); return totalSize; } public class GetResponseCodeThread extends Thread { private int code = -1; private HttpURLConnection connection; public GetResponseCodeThread(HttpURLConnection connection) { this.connection = connection; } @Override public void run() { try { if (this.connection != null) this.code = this.connection.getResponseCode(); } catch (IOException e) { e.printStackTrace(); } catch (NullPointerException e) { e.printStackTrace(); } } public int getResponseCode() { return this.code; } } }
5,944
0.613223
0.605989
161
35.919254
25.449493
181
false
false
0
0
0
0
0
0
0.652174
false
false
3
b1e2fc95f638a3b63b82a6d93266d8932064311e
34,402,688,087,999
cd1c369b164e329e0c1e83093c18786395e6ff58
/src/main/java/com/cn/pojo/Monthly.java
39329c0d001a5820430be9daaace7895a9445350
[]
no_license
mahuandong/graduation
https://github.com/mahuandong/graduation
4700d2a0e9090292ba637b2f1dcd84e679d5188c
406b53c2df661ecf43d76c39dce7cdaa0c9ab146
refs/heads/master
2021-09-21T15:27:50.659000
2018-08-28T13:52:08
2018-08-28T13:52:08
119,647,452
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cn.pojo; public class Monthly { private Integer id; private Integer year; private String areaCode; private Float one; private Float feb; private Float three; private Float four; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Integer getYear() { return year; } public void setYear(Integer year) { this.year = year; } public String getAreaCode() { return areaCode; } public void setAreaCode(String areaCode) { this.areaCode = areaCode == null ? null : areaCode.trim(); } public Float getOne() { return one; } public void setOne(Float one) { this.one = one; } public Float getFeb() { return feb; } public void setFeb(Float feb) { this.feb = feb; } public Float getThree() { return three; } public void setThree(Float three) { this.three = three; } public Float getFour() { return four; } public void setFour(Float four) { this.four = four; } }
UTF-8
Java
1,171
java
Monthly.java
Java
[]
null
[]
package com.cn.pojo; public class Monthly { private Integer id; private Integer year; private String areaCode; private Float one; private Float feb; private Float three; private Float four; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Integer getYear() { return year; } public void setYear(Integer year) { this.year = year; } public String getAreaCode() { return areaCode; } public void setAreaCode(String areaCode) { this.areaCode = areaCode == null ? null : areaCode.trim(); } public Float getOne() { return one; } public void setOne(Float one) { this.one = one; } public Float getFeb() { return feb; } public void setFeb(Float feb) { this.feb = feb; } public Float getThree() { return three; } public void setThree(Float three) { this.three = three; } public Float getFour() { return four; } public void setFour(Float four) { this.four = four; } }
1,171
0.555081
0.555081
73
15.054794
14.550705
66
false
false
0
0
0
0
0
0
0.30137
false
false
3
b94f4ae9ac371177c607d6b92621afdf8757c06e
34,978,213,702,797
e551b5d4a5decbc5db85d6c8f18273f90e16837d
/src/kaban/iklan/MainView.java
d55168252d0459adf8588c6f5e318dbdcee532b8
[]
no_license
aboichev/gLoop
https://github.com/aboichev/gLoop
64c837e4e0d8a5ad583787044d93f1d42ceb81de
bcde39b2e60523df1ea241718aed2836892d3696
refs/heads/master
2020-06-02T15:27:53.095000
2012-08-18T03:11:53
2012-08-18T03:11:53
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package kaban.iklan; import android.app.Activity; import android.content.Context; import android.graphics.*; import android.util.Log; import android.view.MotionEvent; import android.view.SurfaceHolder; import android.view.SurfaceView; import java.text.DecimalFormat; public class MainView extends SurfaceView implements SurfaceHolder.Callback { private static final String TAG = MainView.class.getName(); private GameInfo gameInfo; private DecimalFormat decimalFormat = new DecimalFormat("0.##"); private Velocity velocity; private Ball ball; private Rect canvasRect; private int fontSize; private EngineThread engine; public MainView(Context context) { super(context); getHolder().addCallback(this); // create the game loop thread gameInfo = new GameInfo(); engine = new EngineThread(getHolder(), gameInfo, this); ball = new Ball(BitmapFactory.decodeResource(getResources(), R.drawable.ball)); velocity = new Velocity(); setFocusable(true); } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { canvasRect = new Rect(0,0, width, height); } @Override public void surfaceCreated(SurfaceHolder holder) { fontSize = this.getWidth() / 26; velocity.setDir(340); velocity.setSpeed(this.getWidth() / (ball.getBounds().width() * 6)); ball.setX(400); ball.setY(400); engine.start(); } @Override public void surfaceDestroyed(SurfaceHolder holder) { engine.stopLoop(); } @Override public boolean onTouchEvent(MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { if (event.getY() > getHeight() - 50) { engine.stopLoop(); ((Activity)getContext()).finish(); } else { if(engine.isLoopRunning()) { engine.pauseLoop(); } else { engine.resumeLoop(); } Log.d(TAG, "Coords: x=" + event.getX() + ",y=" + event.getY()); } } return super.onTouchEvent(event); } protected void update(long time) { ball.updatePos(velocity, time, this.getWidth(), this.getHeight()); } private Paint paint = new Paint(); protected void render(Canvas canvas) { // draw background paint.setColor(Color.WHITE); //paint.setStyle(Paint.Style.FILL); canvas.drawPaint(paint); // draw ball ball.draw(canvas); // draw info bar paint.setColor(Color.BLACK); paint.setTextSize(fontSize); canvas.drawText(" Frames: " + gameInfo.getTotalFrames() + " FPS: " + decimalFormat.format(gameInfo.getAverageFps()) + " Skipped: " + gameInfo.getAvgFramesSkipped() + " " + gameInfo.getMessage(), fontSize, fontSize, paint); } }
UTF-8
Java
3,053
java
MainView.java
Java
[]
null
[]
package kaban.iklan; import android.app.Activity; import android.content.Context; import android.graphics.*; import android.util.Log; import android.view.MotionEvent; import android.view.SurfaceHolder; import android.view.SurfaceView; import java.text.DecimalFormat; public class MainView extends SurfaceView implements SurfaceHolder.Callback { private static final String TAG = MainView.class.getName(); private GameInfo gameInfo; private DecimalFormat decimalFormat = new DecimalFormat("0.##"); private Velocity velocity; private Ball ball; private Rect canvasRect; private int fontSize; private EngineThread engine; public MainView(Context context) { super(context); getHolder().addCallback(this); // create the game loop thread gameInfo = new GameInfo(); engine = new EngineThread(getHolder(), gameInfo, this); ball = new Ball(BitmapFactory.decodeResource(getResources(), R.drawable.ball)); velocity = new Velocity(); setFocusable(true); } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { canvasRect = new Rect(0,0, width, height); } @Override public void surfaceCreated(SurfaceHolder holder) { fontSize = this.getWidth() / 26; velocity.setDir(340); velocity.setSpeed(this.getWidth() / (ball.getBounds().width() * 6)); ball.setX(400); ball.setY(400); engine.start(); } @Override public void surfaceDestroyed(SurfaceHolder holder) { engine.stopLoop(); } @Override public boolean onTouchEvent(MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { if (event.getY() > getHeight() - 50) { engine.stopLoop(); ((Activity)getContext()).finish(); } else { if(engine.isLoopRunning()) { engine.pauseLoop(); } else { engine.resumeLoop(); } Log.d(TAG, "Coords: x=" + event.getX() + ",y=" + event.getY()); } } return super.onTouchEvent(event); } protected void update(long time) { ball.updatePos(velocity, time, this.getWidth(), this.getHeight()); } private Paint paint = new Paint(); protected void render(Canvas canvas) { // draw background paint.setColor(Color.WHITE); //paint.setStyle(Paint.Style.FILL); canvas.drawPaint(paint); // draw ball ball.draw(canvas); // draw info bar paint.setColor(Color.BLACK); paint.setTextSize(fontSize); canvas.drawText(" Frames: " + gameInfo.getTotalFrames() + " FPS: " + decimalFormat.format(gameInfo.getAverageFps()) + " Skipped: " + gameInfo.getAvgFramesSkipped() + " " + gameInfo.getMessage(), fontSize, fontSize, paint); } }
3,053
0.597445
0.591877
105
28.085714
23.951584
89
false
false
0
0
0
0
0
0
0.609524
false
false
3
229c6029b9eb0d683b964ca67830be32f9b17eda
34,471,407,558,561
97fac26b6f2f89863ccc36d855824e43b4648a93
/AnalyseTweet/src/services/MostUsedHashService.java
20f2ac8410dfaab87985cc6053c8a79281474c73
[]
no_license
iness1/springLDA
https://github.com/iness1/springLDA
f44a7e994fbaf6e31e9a198b3adc2b8b4ab523c1
99574949b76a5f7debd5ccab47c666ed753e8325
refs/heads/master
2020-12-30T16:01:56.179000
2017-06-11T14:32:52
2017-06-11T14:32:52
91,198,854
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package services; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.TreeMap; import comparator.MapComparator; import entities.TweetEntity; /** * @author iness */ public class MostUsedHashService extends GenericService { private static MostUsedHashService singleton; /** * private constructor */ private MostUsedHashService(){ } /** * Recuperation du singleton * @return */ public static MostUsedHashService getSingleton(){ if(null == singleton){ singleton = new MostUsedHashService(); } return singleton; } /** * Nbr of each hashtag * @param tweets * @return */ public Map<String, Integer> hashtagByValue(List<TweetEntity> tweets){ Map<String, Integer> result = new HashMap<String, Integer>(); if(null == tweets){ return result; } for(TweetEntity tweet : tweets){ String text = tweet.getText().toLowerCase(); while(text.length() > 0 ){ Integer startHash = indexOf(text, '#'); if(startHash > -1){ String currentHash = text.substring(startHash); List<Integer> positions = new ArrayList<Integer>(); positions.add(indexOf(currentHash, ' ')); positions.add(indexOf(currentHash, '#')); positions.add(indexOf(currentHash, '.')); positions.add(indexOf(currentHash, ';')); positions.add(indexOf(currentHash, ':')); positions.add(indexOf(currentHash, '!')); positions.add(indexOf(currentHash, ',')); positions.add(indexOf(currentHash, '?')); int min = getMinPlace(positions, currentHash.length()); currentHash = currentHash.substring(0, min); text = text.substring(startHash+currentHash.length(), text.length()); if(null != result.get(currentHash)) { result.put(currentHash, result.get(currentHash) + 1); }else { result.put(currentHash, 1); } }else{ text = ""; } } } return result; } }
UTF-8
Java
1,957
java
MostUsedHashService.java
Java
[ { "context": "ator;\nimport entities.TweetEntity;\n\n/**\n * @author iness\n */\npublic class MostUsedHashService extends Gene", "end": 228, "score": 0.9996591210365295, "start": 223, "tag": "USERNAME", "value": "iness" } ]
null
[]
package services; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.TreeMap; import comparator.MapComparator; import entities.TweetEntity; /** * @author iness */ public class MostUsedHashService extends GenericService { private static MostUsedHashService singleton; /** * private constructor */ private MostUsedHashService(){ } /** * Recuperation du singleton * @return */ public static MostUsedHashService getSingleton(){ if(null == singleton){ singleton = new MostUsedHashService(); } return singleton; } /** * Nbr of each hashtag * @param tweets * @return */ public Map<String, Integer> hashtagByValue(List<TweetEntity> tweets){ Map<String, Integer> result = new HashMap<String, Integer>(); if(null == tweets){ return result; } for(TweetEntity tweet : tweets){ String text = tweet.getText().toLowerCase(); while(text.length() > 0 ){ Integer startHash = indexOf(text, '#'); if(startHash > -1){ String currentHash = text.substring(startHash); List<Integer> positions = new ArrayList<Integer>(); positions.add(indexOf(currentHash, ' ')); positions.add(indexOf(currentHash, '#')); positions.add(indexOf(currentHash, '.')); positions.add(indexOf(currentHash, ';')); positions.add(indexOf(currentHash, ':')); positions.add(indexOf(currentHash, '!')); positions.add(indexOf(currentHash, ',')); positions.add(indexOf(currentHash, '?')); int min = getMinPlace(positions, currentHash.length()); currentHash = currentHash.substring(0, min); text = text.substring(startHash+currentHash.length(), text.length()); if(null != result.get(currentHash)) { result.put(currentHash, result.get(currentHash) + 1); }else { result.put(currentHash, 1); } }else{ text = ""; } } } return result; } }
1,957
0.655084
0.652529
77
24.415585
20.57192
74
false
false
0
0
0
0
0
0
3.194805
false
false
3
e3daad8b3e43733b8aefdd362587c833c01826dc
38,826,504,368,622
8c482609cf8b8f346422272f4d672c3567d8d5ca
/solplatform-service/src/main/java/com/solplatform/service/builds/ReportService.java
6b6360ab3dd2e50b2ae6c4b98142511b65a08f14
[]
no_license
cuiyishuo/naruto_api
https://github.com/cuiyishuo/naruto_api
a7bf30275c6236cd211b094c01bc6a2463aa1270
982ce0c93cc1e87506399ebe2e4ff0f92b889672
refs/heads/master
2023-05-10T20:05:33.831000
2020-06-21T15:31:35
2020-06-21T15:31:35
230,287,479
2
0
null
false
2023-05-09T18:42:32
2019-12-26T15:37:32
2023-02-03T08:53:06
2023-05-09T18:42:29
313
2
0
3
Java
false
false
package com.solplatform.service.builds; import com.solplatform.util.ReportLogUtil; import com.solplatform.vo.ReportLog; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; /** * 日志报告业务 * * @author sol * @create 2020-06-21 11:53 上午 */ @Service @Slf4j public class ReportService { /** * 读取测试日志 * * @param buildId 该日志对应构建id * @param lastFileSize 上一次读取到的日志位置 * @return */ public ReportLog readReport(String buildId, Long lastFileSize) { ReportLogUtil reportLogUtil = new ReportLogUtil (); if (null != lastFileSize) { return reportLogUtil.readLog (buildId, lastFileSize); } else { return reportLogUtil.readLog (buildId, 0L); } } }
UTF-8
Java
831
java
ReportService.java
Java
[ { "context": "k.stereotype.Service;\n\n/**\n * 日志报告业务\n *\n * @author sol\n * @create 2020-06-21 11:53 上午\n */\n@Service\n@Slf", "end": 234, "score": 0.9991679191589355, "start": 231, "tag": "USERNAME", "value": "sol" } ]
null
[]
package com.solplatform.service.builds; import com.solplatform.util.ReportLogUtil; import com.solplatform.vo.ReportLog; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; /** * 日志报告业务 * * @author sol * @create 2020-06-21 11:53 上午 */ @Service @Slf4j public class ReportService { /** * 读取测试日志 * * @param buildId 该日志对应构建id * @param lastFileSize 上一次读取到的日志位置 * @return */ public ReportLog readReport(String buildId, Long lastFileSize) { ReportLogUtil reportLogUtil = new ReportLogUtil (); if (null != lastFileSize) { return reportLogUtil.readLog (buildId, lastFileSize); } else { return reportLogUtil.readLog (buildId, 0L); } } }
831
0.653194
0.632334
33
22.242424
20.439163
68
false
false
0
0
0
0
0
0
0.333333
false
false
3
f583a9e95a14b0066090d42149a6c238b6f886b8
37,005,438,250,104
0716ecaeb7e5b5cd296618efb5300cb84765ebf5
/hpsdf-ngp-module-core/src/main/java/com/hp/sdf/ngp/workflow/descriptor/AccessDescriptor.java
67aaa304cf10d873f27dfa242c3bad4c8ebf48c8
[]
no_license
liweisnake/storefront
https://github.com/liweisnake/storefront
2b21f491d12ac7e8eb04a26040b453b69220404a
d0886a906516618ac220f35abfe9b60dc976b1e2
refs/heads/master
2020-06-06T03:33:16.518000
2013-08-31T03:30:05
2013-08-31T06:35:22
12,499,948
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright (c) 2009 Hewlett-Packard Company, All Rights Reserved. * * RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure by the U.S. * Government is subject to restrictions as set forth in sub-paragraph * (c)(1)(ii) of the Rights in Technical Data and Computer Software * clause in DFARS 252.227-7013. * * Hewlett-Packard Company * 3000 Hanover Street * Palo Alto, CA 94304 U.S.A. * Rights for non-DOD U.S. Government Departments and Agencies are as * set forth in FAR 52.227-19(c)(1,2). */ package com.hp.sdf.ngp.workflow.descriptor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.hp.sdf.ngp.common.exception.WorkFlowFailureException; import com.hp.sdf.ngp.model.RoleCategory; import com.hp.sdf.ngp.service.UserService; import com.hp.sdf.ngp.workflow.AccessType; public class AccessDescriptor extends BaseDescriptor { private final static Log log = LogFactory.getLog(AccessDescriptor.class); public static final String OWNER = "owner"; private UserService userService = null; private String operation; private String[] allowed; public String getOperation() { return operation; } public void setOperation(String operation) { this.operation = operation; } public String[] getAllowed() { return allowed; } public void setAllowed(String[] allowed) { this.allowed = allowed; } @Override protected BaseDescriptor[] visitArray() { return null; } @Override protected void onValidate() throws WorkFlowFailureException { // Check the operation value if (AccessType.convert(this.operation) == null) { throw new WorkFlowFailureException( "The operation value in 'access' is illegal, which is not defined in system"); } if (allowed != null) { for (String allow : allowed) { if (allow.equalsIgnoreCase(OWNER)) { // "owner" is a default value representing the application // creator continue; } try { RoleCategory roleCategory = this.userService .getRoleByName(allow); if (roleCategory == null) { log .warn("Can't get the corresponding role category definition in current backend system for [" + allow + "], it may wrong, or this role category will be created soon"); } } catch (Throwable e) { log .warn("Can't get the corresponding role category definition in current backend system for [" + allow + "], it may wrong, or this role category will be created soon"); } } } } @Override protected void onSetUserService(UserService userService) { this.userService = userService; } } // $Id$
UTF-8
Java
2,736
java
AccessDescriptor.java
Java
[]
null
[]
/* * Copyright (c) 2009 Hewlett-Packard Company, All Rights Reserved. * * RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure by the U.S. * Government is subject to restrictions as set forth in sub-paragraph * (c)(1)(ii) of the Rights in Technical Data and Computer Software * clause in DFARS 252.227-7013. * * Hewlett-Packard Company * 3000 Hanover Street * Palo Alto, CA 94304 U.S.A. * Rights for non-DOD U.S. Government Departments and Agencies are as * set forth in FAR 52.227-19(c)(1,2). */ package com.hp.sdf.ngp.workflow.descriptor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.hp.sdf.ngp.common.exception.WorkFlowFailureException; import com.hp.sdf.ngp.model.RoleCategory; import com.hp.sdf.ngp.service.UserService; import com.hp.sdf.ngp.workflow.AccessType; public class AccessDescriptor extends BaseDescriptor { private final static Log log = LogFactory.getLog(AccessDescriptor.class); public static final String OWNER = "owner"; private UserService userService = null; private String operation; private String[] allowed; public String getOperation() { return operation; } public void setOperation(String operation) { this.operation = operation; } public String[] getAllowed() { return allowed; } public void setAllowed(String[] allowed) { this.allowed = allowed; } @Override protected BaseDescriptor[] visitArray() { return null; } @Override protected void onValidate() throws WorkFlowFailureException { // Check the operation value if (AccessType.convert(this.operation) == null) { throw new WorkFlowFailureException( "The operation value in 'access' is illegal, which is not defined in system"); } if (allowed != null) { for (String allow : allowed) { if (allow.equalsIgnoreCase(OWNER)) { // "owner" is a default value representing the application // creator continue; } try { RoleCategory roleCategory = this.userService .getRoleByName(allow); if (roleCategory == null) { log .warn("Can't get the corresponding role category definition in current backend system for [" + allow + "], it may wrong, or this role category will be created soon"); } } catch (Throwable e) { log .warn("Can't get the corresponding role category definition in current backend system for [" + allow + "], it may wrong, or this role category will be created soon"); } } } } @Override protected void onSetUserService(UserService userService) { this.userService = userService; } } // $Id$
2,736
0.677997
0.665936
98
25.938776
25.769312
100
false
false
0
0
0
0
0
0
2.163265
false
false
3
671aa8792b01844424527c712573e2b4cd1019a1
12,146,167,582,332
6e72d10ca2641d9835812e3864d102ece415e136
/src/main/java/com/linagora/utils/AllureFilesManager.java
f30c49b352d2d715176e7d1ffaea48467d4d4c2f
[]
no_license
dylanisrael/linagora
https://github.com/dylanisrael/linagora
d4790d1ea28d9866df793b11faac2c284febfb2c
aa3e73cd1f07a59143dccd428759bb69306f31a3
refs/heads/main
2023-08-27T20:00:39.688000
2021-10-06T09:02:55
2021-10-06T09:02:55
413,399,722
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.linagora.utils; import com.linagora.config.Properties; import org.apache.logging.log4j.Logger; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import java.io.File; import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; import static org.apache.logging.log4j.LogManager.getLogger; public class AllureFilesManager { public static Logger logger = getLogger(AllureFilesManager.class); public static void createEnvironmentPropertiesFile() throws IOException { File environment = new File("allure-results/environment.properties"); if(!environment.exists()){ FileOutputStream fileOutputStream = new FileOutputStream( "allure-results/environment.properties"); java.util.Properties properties = new java.util.Properties(); properties.setProperty("Test URL ☢️", Properties.Config.getEnvironment()); properties.setProperty("Headless mode 🌀", String.valueOf(Properties.Config.getHeadless())); properties.setProperty("Local browser 🌍", String.valueOf(Properties.Config.getBrowser())); properties.store( fileOutputStream, "environment allure configuration file"); fileOutputStream.close(); } } public static void createCategorieJsonFile() { File categoriesFile = new File("allure-results/categories.json"); if (!categoriesFile.exists()) { JSONObject ignoredTests = new JSONObject(); ignoredTests.put("name", "Ignored tests"); JSONArray matchedStatusesIT = new JSONArray(); matchedStatusesIT.add("skipped"); ignoredTests.put("matchedStatuses", matchedStatusesIT); JSONObject infrastructureProblems = new JSONObject(); infrastructureProblems.put("name", "Infrastructure problems"); JSONArray matchedStatusesIP = new JSONArray(); matchedStatusesIP.add("broken"); matchedStatusesIP.add("failed"); infrastructureProblems.put("matchedStatuses", matchedStatusesIP); infrastructureProblems.put("messageRegex", ".*bye-bye.*"); JSONObject outdatedTests = new JSONObject(); outdatedTests.put("name", "Outdated tests"); JSONArray matchedStatusesOT = new JSONArray(); matchedStatusesOT.add("broken"); outdatedTests.put("matchedStatuses", matchedStatusesOT); outdatedTests.put("traceRegex", ".*FileNotFoundException.*"); JSONObject koTests = new JSONObject(); koTests.put("name", "KO tests"); JSONArray matchedStatusesKO = new JSONArray(); matchedStatusesKO.add("failed"); koTests.put("matchedStatuses", matchedStatusesKO); JSONObject errorDuringTests = new JSONObject(); errorDuringTests.put("name", "Error during test execution"); JSONArray matchedStatusesEDE = new JSONArray(); matchedStatusesEDE.add("broken"); errorDuringTests.put("matchedStatuses", matchedStatusesEDE); JSONArray categories = new JSONArray(); categories.add(ignoredTests); categories.add(infrastructureProblems); categories.add(outdatedTests); categories.add(koTests); categories.add(errorDuringTests); //Write JSON file try (FileWriter file = new FileWriter("allure-results/categories.json")) { //We can write any JSONArray or JSONObject instance to the file file.write(categories.toJSONString()); file.flush(); } catch (IOException e) { e.printStackTrace(); } } } public static void createExecutorJsonFile () { File executorFile = new File("allure-results/executor.json"); if (!executorFile.exists()) { JSONObject executor = new JSONObject(); executor.put("name", "Maven"); executor.put("type", "Maven"); executor.put("reportName", "airFrance"); //Write JSON file try (FileWriter file = new FileWriter("allure-results/executor.json")) { //We can write any JSONArray or JSONObject instance to the file file.write(executor.toJSONString()); file.flush(); } catch (IOException e) { e.printStackTrace(); } } } }
UTF-8
Java
4,611
java
AllureFilesManager.java
Java
[]
null
[]
package com.linagora.utils; import com.linagora.config.Properties; import org.apache.logging.log4j.Logger; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import java.io.File; import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; import static org.apache.logging.log4j.LogManager.getLogger; public class AllureFilesManager { public static Logger logger = getLogger(AllureFilesManager.class); public static void createEnvironmentPropertiesFile() throws IOException { File environment = new File("allure-results/environment.properties"); if(!environment.exists()){ FileOutputStream fileOutputStream = new FileOutputStream( "allure-results/environment.properties"); java.util.Properties properties = new java.util.Properties(); properties.setProperty("Test URL ☢️", Properties.Config.getEnvironment()); properties.setProperty("Headless mode 🌀", String.valueOf(Properties.Config.getHeadless())); properties.setProperty("Local browser 🌍", String.valueOf(Properties.Config.getBrowser())); properties.store( fileOutputStream, "environment allure configuration file"); fileOutputStream.close(); } } public static void createCategorieJsonFile() { File categoriesFile = new File("allure-results/categories.json"); if (!categoriesFile.exists()) { JSONObject ignoredTests = new JSONObject(); ignoredTests.put("name", "Ignored tests"); JSONArray matchedStatusesIT = new JSONArray(); matchedStatusesIT.add("skipped"); ignoredTests.put("matchedStatuses", matchedStatusesIT); JSONObject infrastructureProblems = new JSONObject(); infrastructureProblems.put("name", "Infrastructure problems"); JSONArray matchedStatusesIP = new JSONArray(); matchedStatusesIP.add("broken"); matchedStatusesIP.add("failed"); infrastructureProblems.put("matchedStatuses", matchedStatusesIP); infrastructureProblems.put("messageRegex", ".*bye-bye.*"); JSONObject outdatedTests = new JSONObject(); outdatedTests.put("name", "Outdated tests"); JSONArray matchedStatusesOT = new JSONArray(); matchedStatusesOT.add("broken"); outdatedTests.put("matchedStatuses", matchedStatusesOT); outdatedTests.put("traceRegex", ".*FileNotFoundException.*"); JSONObject koTests = new JSONObject(); koTests.put("name", "KO tests"); JSONArray matchedStatusesKO = new JSONArray(); matchedStatusesKO.add("failed"); koTests.put("matchedStatuses", matchedStatusesKO); JSONObject errorDuringTests = new JSONObject(); errorDuringTests.put("name", "Error during test execution"); JSONArray matchedStatusesEDE = new JSONArray(); matchedStatusesEDE.add("broken"); errorDuringTests.put("matchedStatuses", matchedStatusesEDE); JSONArray categories = new JSONArray(); categories.add(ignoredTests); categories.add(infrastructureProblems); categories.add(outdatedTests); categories.add(koTests); categories.add(errorDuringTests); //Write JSON file try (FileWriter file = new FileWriter("allure-results/categories.json")) { //We can write any JSONArray or JSONObject instance to the file file.write(categories.toJSONString()); file.flush(); } catch (IOException e) { e.printStackTrace(); } } } public static void createExecutorJsonFile () { File executorFile = new File("allure-results/executor.json"); if (!executorFile.exists()) { JSONObject executor = new JSONObject(); executor.put("name", "Maven"); executor.put("type", "Maven"); executor.put("reportName", "airFrance"); //Write JSON file try (FileWriter file = new FileWriter("allure-results/executor.json")) { //We can write any JSONArray or JSONObject instance to the file file.write(executor.toJSONString()); file.flush(); } catch (IOException e) { e.printStackTrace(); } } } }
4,611
0.620952
0.620517
127
35.228348
28.178896
103
false
false
0
0
0
0
0
0
0.661417
false
false
3
e2b19ed8b46a63fa9213bfd606ff3ea38abf4dbd
16,381,005,268,027
0135e51243abeb65c5260f64b557a7ef1dc86bb3
/src/main/java/mylearning/recursion/NaturalNumber.java
be04ce88b62b7d135b66f113499c27992e82371a
[]
no_license
Ranjith-TechLearning/DataStructuresAndAlgorithms
https://github.com/Ranjith-TechLearning/DataStructuresAndAlgorithms
ee76f60c59b2bc6327771540f1a974cdd461054e
a2fb1848051e54c3f0fcf0f7288a090b04b86613
refs/heads/master
2021-07-05T14:26:47.987000
2021-01-31T17:20:34
2021-01-31T17:20:34
222,858,869
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package mylearning.recursion; public class NaturalNumber{ public static void main(String arg[]){ System.out.println(naturalNumber(100)); } private static int naturalNumber(int number){ if(number ==0){ return 0; } return number+naturalNumber(number-1); } }
UTF-8
Java
276
java
NaturalNumber.java
Java
[]
null
[]
package mylearning.recursion; public class NaturalNumber{ public static void main(String arg[]){ System.out.println(naturalNumber(100)); } private static int naturalNumber(int number){ if(number ==0){ return 0; } return number+naturalNumber(number-1); } }
276
0.713768
0.692029
18
14.388889
17.016785
46
false
false
0
0
0
0
0
0
1.055556
false
false
3
bcbea86dd411901da9faf9ecb68d0c261142376a
21,328,807,595,925
fce51cb3baad829a267a81ea225e5420e44cb6ab
/downloader/src/main/java/com/xwf/common/utils/ZipCompressor.java
5d951aa4c1e4fcb212db67960a381035c6a00a8c
[]
no_license
tomzhang/downloader
https://github.com/tomzhang/downloader
c51dd7885f6632f5d6ccafbf39da87973769c14a
fb9eee5ab4a14baeb9c16e1f72439f1008c2d9a7
refs/heads/master
2020-04-01T01:59:51.277000
2018-09-12T07:31:35
2018-09-12T07:31:35
152,761,405
1
0
null
true
2018-10-12T14:18:24
2018-10-12T14:18:24
2018-09-12T07:32:26
2018-09-12T07:32:24
67,081
0
0
0
null
false
null
package com.xwf.common.utils; import java.io.*; import java.util.Enumeration; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import java.util.zip.ZipOutputStream; /** * Created by weifengxu on 2018/8/8. */ public class ZipCompressor { /** * 功能:压缩多个文件成一个zip文件 * * @param srcfile:源文件列表 * @param zipfile:压缩后的文件 */ public static void zipFiles(File[] srcfile, File zipfile) { byte[] buf = new byte[1024]; try { //ZipOutputStream类:完成文件或文件夹的压缩 ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipfile)); //去重 并重命名 File [] deDubble = checkIsRepeat(srcfile); for (int i = 0; i < srcfile.length; i++) { FileInputStream in = new FileInputStream(srcfile[i]); out.putNextEntry(new ZipEntry(deDubble[i].getName())); int len; while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); } out.closeEntry(); in.close(); } out.close(); System.out.println("压缩完成."); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * 功能:解压缩 * * @param zipfile:需要解压缩的文件 * @param descDir:解压后的目标目录 */ public static void unZipFiles(File zipfile, String descDir) { try { ZipFile zf = new ZipFile(zipfile); for (Enumeration entries = zf.entries(); entries.hasMoreElements(); ) { ZipEntry entry = (ZipEntry) entries.nextElement(); String zipEntryName = entry.getName(); InputStream in = zf.getInputStream(entry); OutputStream out = new FileOutputStream(descDir + zipEntryName); byte[] buf1 = new byte[1024]; int len; while ((len = in.read(buf1)) > 0) { out.write(buf1, 0, len); } in.close(); out.close(); System.out.println("解压缩完成."); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * 功能: * * @param args */ public static void main(String[] args) { //2个源文件 File f1 = new File("D:\\workspace\\flexTest\\src\\com\\biao\\test\\abc.txt"); File f2 = new File("D:\\workspace\\flexTest\\src\\com\\biao\\test\\test.zip"); File[] srcfile = {f1, f2}; //压缩后的文件 File zipfile = new File("D:\\workspace\\flexTest\\src\\com\\biao\\test\\biao.zip"); //TestZIP.zipFiles(srcfile, zipfile); //需要解压缩的文件 File file = new File("D:\\workspace\\flexTest\\src\\com\\biao\\test\\biao.zip"); //解压后的目标目录 String dir = "D:\\workspace\\flexTest\\src\\com\\biao\\test\\"; ZipCompressor.unZipFiles(file, dir); } /** * 判断整型数组中是否含有重复的元素 * * @param arr */ private static File[] checkIsRepeat(File[] arr) { boolean flag = true; //假设不重复 File[] after = arr.clone(); for (int i = 0; i < arr.length - 1; i++) { //循环开始元素 int n = 2; for (int j = i + 1; j < arr.length; j++) { //循环后续所有元素 //如果相等,则重复 if (arr[i].getAbsolutePath().equals(arr[j].getAbsolutePath())) { File f = new File(arr[j].getAbsolutePath().replace(".mp4", "(" + n + ").mp4")); after[j] = f; System.out.println("重复:" + arr[i]); n++; } } } return after; } }
UTF-8
Java
4,061
java
ZipCompressor.java
Java
[ { "context": " java.util.zip.ZipOutputStream;\n\n/**\n * Created by weifengxu on 2018/8/8.\n */\n\npublic class ZipCompressor {\n\n\n", "end": 206, "score": 0.9976088404655457, "start": 197, "tag": "USERNAME", "value": "weifengxu" } ]
null
[]
package com.xwf.common.utils; import java.io.*; import java.util.Enumeration; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import java.util.zip.ZipOutputStream; /** * Created by weifengxu on 2018/8/8. */ public class ZipCompressor { /** * 功能:压缩多个文件成一个zip文件 * * @param srcfile:源文件列表 * @param zipfile:压缩后的文件 */ public static void zipFiles(File[] srcfile, File zipfile) { byte[] buf = new byte[1024]; try { //ZipOutputStream类:完成文件或文件夹的压缩 ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipfile)); //去重 并重命名 File [] deDubble = checkIsRepeat(srcfile); for (int i = 0; i < srcfile.length; i++) { FileInputStream in = new FileInputStream(srcfile[i]); out.putNextEntry(new ZipEntry(deDubble[i].getName())); int len; while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); } out.closeEntry(); in.close(); } out.close(); System.out.println("压缩完成."); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * 功能:解压缩 * * @param zipfile:需要解压缩的文件 * @param descDir:解压后的目标目录 */ public static void unZipFiles(File zipfile, String descDir) { try { ZipFile zf = new ZipFile(zipfile); for (Enumeration entries = zf.entries(); entries.hasMoreElements(); ) { ZipEntry entry = (ZipEntry) entries.nextElement(); String zipEntryName = entry.getName(); InputStream in = zf.getInputStream(entry); OutputStream out = new FileOutputStream(descDir + zipEntryName); byte[] buf1 = new byte[1024]; int len; while ((len = in.read(buf1)) > 0) { out.write(buf1, 0, len); } in.close(); out.close(); System.out.println("解压缩完成."); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * 功能: * * @param args */ public static void main(String[] args) { //2个源文件 File f1 = new File("D:\\workspace\\flexTest\\src\\com\\biao\\test\\abc.txt"); File f2 = new File("D:\\workspace\\flexTest\\src\\com\\biao\\test\\test.zip"); File[] srcfile = {f1, f2}; //压缩后的文件 File zipfile = new File("D:\\workspace\\flexTest\\src\\com\\biao\\test\\biao.zip"); //TestZIP.zipFiles(srcfile, zipfile); //需要解压缩的文件 File file = new File("D:\\workspace\\flexTest\\src\\com\\biao\\test\\biao.zip"); //解压后的目标目录 String dir = "D:\\workspace\\flexTest\\src\\com\\biao\\test\\"; ZipCompressor.unZipFiles(file, dir); } /** * 判断整型数组中是否含有重复的元素 * * @param arr */ private static File[] checkIsRepeat(File[] arr) { boolean flag = true; //假设不重复 File[] after = arr.clone(); for (int i = 0; i < arr.length - 1; i++) { //循环开始元素 int n = 2; for (int j = i + 1; j < arr.length; j++) { //循环后续所有元素 //如果相等,则重复 if (arr[i].getAbsolutePath().equals(arr[j].getAbsolutePath())) { File f = new File(arr[j].getAbsolutePath().replace(".mp4", "(" + n + ").mp4")); after[j] = f; System.out.println("重复:" + arr[i]); n++; } } } return after; } }
4,061
0.496942
0.488168
123
29.585365
24.727104
99
false
false
0
0
0
0
0
0
0.520325
false
false
3
1bf850899b25925320ce60f069049b8e580bcb4a
30,116,310,692,340
c7a32973cb35160c65d7c722135b19b924288e42
/piccoloExtensions/edu/cmu/cs/bungee/piccoloUtils/gui/Button.java
e9cc0f08d7ec4eb97b4e108c891944d75bb0bba9
[]
no_license
derthick/bungee-view
https://github.com/derthick/bungee-view
f70c5e3df1f2f81f818949fe384ce32282157eb0
452d95b022c928da44daa01fa65867c651ae569b
refs/heads/master
2021-01-01T05:46:22.250000
2016-05-05T19:20:01
2016-05-05T19:20:01
58,075,795
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* Created on Jun 19, 2005 The Bungee View applet lets you search, browse, and data-mine an image collection. Copyright (C) 2006 Mark Derthick This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. See gpl.html. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. You may also contact the author at mad@cs.cmu.edu, or at Mark Derthick Carnegie-Mellon University Human-Computer Interaction Institute Pittsburgh, PA 15213 */ package edu.cmu.cs.bungee.piccoloUtils.gui; import java.awt.Paint; import java.util.Objects; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; import edu.cmu.cs.bungee.javaExtensions.UtilColor; import edu.cmu.cs.bungee.javaExtensions.UtilString; import edu.umd.cs.piccolo.PNode; public class Button extends LazyPNode { // NO_UCD (use // default) protected static final @NonNull ButtonHandler BUTTON_HANDLER = new ButtonHandler(); public @Nullable String mouseDoc; /** * Whether positionChild scales, or just centers. */ public boolean isScaleToFit = true; protected @Nullable String disabledMessage = "<Disabled>"; private boolean isEnabled = true; // NO_UCD (use default) /** * Lazily evaluated. If disabledMessageText!=null && disabledMessage==null, * must recompute. */ private @Nullable APText disabledMessageAPText; private @Nullable BevelBorder border; // NO_UCD (use final) /** * @param x * xOffset * @param y * yOffset * @param outerW * @param outerH * @param _disabledMessage * mouse doc * @param _mouseDoc * mouse doc * @param is3D * Add BevelBorder * @param paintS * bgColor */ public Button(final double x, final double y, final double outerW, final double outerH, final @Nullable String _disabledMessage, final @Nullable String _mouseDoc, final boolean is3D, final @Nullable Paint paintS) // NO_UCD // (use // default) { setPaint(paintS); mouseDoc = _mouseDoc; if (is3D) { assert getPaint() != null; border = new BevelBorder(true); addChild(border); } setDisabledMessage(_disabledMessage); setOffset(x, y); adjustSize(Math.rint(outerW), Math.rint(outerH)); addInputEventListener(BUTTON_HANDLER); setChildrenPickable(false); } // Assumes border.strokeW==1 static double inner2outerSize(final double innerSize, final boolean is3D) { final double borderSize = is3D ? /* border.strokeW * */2 : 0.0; final double outerSize = Math.rint(innerSize + 2.0 * borderSize); return outerSize; } public @Nullable APText getDisabledMessageAPText() { final String _disabledMessage = getDisabledMessage(); if (_disabledMessage != null && disabledMessageAPText == null) { final APText _disabledMessageAPText = new APText(); _disabledMessageAPText.setPaint(UtilColor.YELLOW); _disabledMessageAPText.maybeSetText(_disabledMessage); _disabledMessageAPText.setOffset(getXOffset(), getYOffset() + outerH() + 1.0); disabledMessageAPText = _disabledMessageAPText; } return disabledMessageAPText; } public @Nullable String getDisabledMessage() { return disabledMessage; } public void setDisabledMessage(final @Nullable String message) { if (!Objects.deepEquals(disabledMessage, message)) { disabledMessage = message; disabledMessageAPText = null; } } /** * Gray out if !isEnabled() */ public void setVisibility(final boolean isVisible) { setVisible(isVisible); if (isVisible) { updateTransparency(); } } /** * Set partially transparent if !isEnabled() */ public void updateTransparency() { setTransparency(isEnabled() ? 1f : 0.5f); } /** * Having raised mean true seems backwards... * * @return whether state changed (if is3D; else always returns false). */ public boolean setState(final boolean state) { return border != null && border.setBorderState(state); } // public void setBorderColor(final Color bgColor) { // border.setPaint(bgColor); // } @Override public double getXOffset() { return super.getXOffset() - borderTwiceStrokeW(); } @Override public double getYOffset() { return super.getYOffset() - borderTwiceStrokeW(); } @Override public void setOffset(final double outerX, final double outerY) { super.setOffset(Math.rint(outerX) + borderTwiceStrokeW(), Math.rint(outerY) + borderTwiceStrokeW()); } @Override public double getMaxX() { return getX() + getXOffset() + outerW() * getScale(); } @Override public double getMaxY() { return getY() + getYOffset() + outerH() * getScale(); } int borderTwiceStrokeW() { return border != null ? border.getStrokeW() * 2 : 0; } public double outerW() { return super.getWidth() + 2 * borderTwiceStrokeW(); } protected double innerW() { return super.getWidth(); } public double outerH() { // NO_UCD (use default) return super.getHeight() + 2 * borderTwiceStrokeW(); } protected double innerH() { return super.getHeight(); } /** * Compute bounds by subtracting border from outerW/outerH; call * positionChild to transform child to these bounds. */ void adjustSize(final double outerW, final double outerH) { // Always setBounds, because it may not have been set yet. final double borderSize = borderTwiceStrokeW(); super.setOffset(getXOffset() + borderSize, getYOffset() + borderSize); final double newWidth = Math.rint(outerW - 2.0 * borderSize); final double newHeight = Math.rint(outerH - 2.0 * borderSize); assert newWidth > 0.0 && newHeight > 0.0 : adjustSizeErrorMessage(mouseDoc, disabledMessage); super.setBounds(0.0, 0.0, newWidth, newHeight); } protected @NonNull String adjustSizeErrorMessage(final @Nullable String outerW, final @Nullable String outerH) { return "borderSize=" + borderTwiceStrokeW() + " outerW=" + outerW + " " + " outerH=" + outerH; } protected boolean isEnabled() { return isEnabled; } /** * Usually subclasses override isEnabled instead of calling this. */ public void setIsEnabled(final boolean _isEnabled) { isEnabled = _isEnabled; updateTransparency(); } void exit() { if (disabledMessageAPText != null) { disabledMessageAPText.removeFromParent(); } setMouseDoc(false); } void enter() { setMouseDoc(true); } public void setMouseDoc(final boolean state) { if (getParent() instanceof MouseDoc) { ((MouseDoc) getParent()).setMouseDoc(getMouseDoc(state)); } } private @Nullable String getMouseDoc(final boolean state) { return state ? getMouseDoc() : null; } protected @NonNull String getMouseDoc() { final String result = isEnabled() ? mouseDoc : getDisabledMessage(); assert UtilString.isNonEmptyString(result) : this + "\n isEnabled=" + isEnabled() + " getVisible=" + getVisible() + " getPickable=" + getPickable() + " getPickableMode=" + getPickableMode() + " result=" + result; assert result != null; return result; } public void doPick() { assert false : "default (no-op) doPick on " + this; } public void pick() { if (isEnabled()) { doPick(); } else { showDisabledError(); } } protected void showDisabledError() { final PNode parent = getParent(); if (parent instanceof MouseDoc) { ((MouseDoc) parent).setMouseDoc(getDisabledMessage()); } else { parent.addChild(getDisabledMessageAPText()); } } // @SuppressWarnings({ "static-method", "unused" }) // /** // * Nothing calls this! // */ // public void mayHideTransients(final PNode node) { // // Override this // assert false; // } } class ButtonHandler extends MyInputEventHandler<Button> { public ButtonHandler() { super(Button.class); } // Pretty much anything you do on a button shouldn't go any further, so // always return true. @Override public boolean click(final @NonNull Button node) { node.pick(); return true; } @Override public boolean exit(final @NonNull Button node) { node.exit(); return true; } @Override public boolean enter(final @NonNull Button node) { node.enter(); return true; } // @Override // public void mayHideTransients(final Button<?> node) { // node.mayHideTransients(node); // } }
UTF-8
Java
9,038
java
Button.java
Java
[ { "context": "ta-mine an image collection.\r\n Copyright (C) 2006 Mark Derthick\r\n\r\n This program is free software; you can redist", "end": 153, "score": 0.999818742275238, "start": 140, "tag": "NAME", "value": "Mark Derthick" }, { "context": "301, USA.\r\n\r\n You may also contact the author at\r\n mad@cs.cmu.edu,\r\n or at\r\n Mark Derthick\r\n Carnegie-Mellon Univer", "end": 932, "score": 0.9999310970306396, "start": 918, "tag": "EMAIL", "value": "mad@cs.cmu.edu" }, { "context": " contact the author at\r\n mad@cs.cmu.edu,\r\n or at\r\n Mark Derthick\r\n Carnegie-Mellon University\r\n Human-Computer Int", "end": 957, "score": 0.9998049139976501, "start": 944, "tag": "NAME", "value": "Mark Derthick" } ]
null
[]
/* Created on Jun 19, 2005 The Bungee View applet lets you search, browse, and data-mine an image collection. Copyright (C) 2006 <NAME> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. See gpl.html. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. You may also contact the author at <EMAIL>, or at <NAME> Carnegie-Mellon University Human-Computer Interaction Institute Pittsburgh, PA 15213 */ package edu.cmu.cs.bungee.piccoloUtils.gui; import java.awt.Paint; import java.util.Objects; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; import edu.cmu.cs.bungee.javaExtensions.UtilColor; import edu.cmu.cs.bungee.javaExtensions.UtilString; import edu.umd.cs.piccolo.PNode; public class Button extends LazyPNode { // NO_UCD (use // default) protected static final @NonNull ButtonHandler BUTTON_HANDLER = new ButtonHandler(); public @Nullable String mouseDoc; /** * Whether positionChild scales, or just centers. */ public boolean isScaleToFit = true; protected @Nullable String disabledMessage = "<Disabled>"; private boolean isEnabled = true; // NO_UCD (use default) /** * Lazily evaluated. If disabledMessageText!=null && disabledMessage==null, * must recompute. */ private @Nullable APText disabledMessageAPText; private @Nullable BevelBorder border; // NO_UCD (use final) /** * @param x * xOffset * @param y * yOffset * @param outerW * @param outerH * @param _disabledMessage * mouse doc * @param _mouseDoc * mouse doc * @param is3D * Add BevelBorder * @param paintS * bgColor */ public Button(final double x, final double y, final double outerW, final double outerH, final @Nullable String _disabledMessage, final @Nullable String _mouseDoc, final boolean is3D, final @Nullable Paint paintS) // NO_UCD // (use // default) { setPaint(paintS); mouseDoc = _mouseDoc; if (is3D) { assert getPaint() != null; border = new BevelBorder(true); addChild(border); } setDisabledMessage(_disabledMessage); setOffset(x, y); adjustSize(Math.rint(outerW), Math.rint(outerH)); addInputEventListener(BUTTON_HANDLER); setChildrenPickable(false); } // Assumes border.strokeW==1 static double inner2outerSize(final double innerSize, final boolean is3D) { final double borderSize = is3D ? /* border.strokeW * */2 : 0.0; final double outerSize = Math.rint(innerSize + 2.0 * borderSize); return outerSize; } public @Nullable APText getDisabledMessageAPText() { final String _disabledMessage = getDisabledMessage(); if (_disabledMessage != null && disabledMessageAPText == null) { final APText _disabledMessageAPText = new APText(); _disabledMessageAPText.setPaint(UtilColor.YELLOW); _disabledMessageAPText.maybeSetText(_disabledMessage); _disabledMessageAPText.setOffset(getXOffset(), getYOffset() + outerH() + 1.0); disabledMessageAPText = _disabledMessageAPText; } return disabledMessageAPText; } public @Nullable String getDisabledMessage() { return disabledMessage; } public void setDisabledMessage(final @Nullable String message) { if (!Objects.deepEquals(disabledMessage, message)) { disabledMessage = message; disabledMessageAPText = null; } } /** * Gray out if !isEnabled() */ public void setVisibility(final boolean isVisible) { setVisible(isVisible); if (isVisible) { updateTransparency(); } } /** * Set partially transparent if !isEnabled() */ public void updateTransparency() { setTransparency(isEnabled() ? 1f : 0.5f); } /** * Having raised mean true seems backwards... * * @return whether state changed (if is3D; else always returns false). */ public boolean setState(final boolean state) { return border != null && border.setBorderState(state); } // public void setBorderColor(final Color bgColor) { // border.setPaint(bgColor); // } @Override public double getXOffset() { return super.getXOffset() - borderTwiceStrokeW(); } @Override public double getYOffset() { return super.getYOffset() - borderTwiceStrokeW(); } @Override public void setOffset(final double outerX, final double outerY) { super.setOffset(Math.rint(outerX) + borderTwiceStrokeW(), Math.rint(outerY) + borderTwiceStrokeW()); } @Override public double getMaxX() { return getX() + getXOffset() + outerW() * getScale(); } @Override public double getMaxY() { return getY() + getYOffset() + outerH() * getScale(); } int borderTwiceStrokeW() { return border != null ? border.getStrokeW() * 2 : 0; } public double outerW() { return super.getWidth() + 2 * borderTwiceStrokeW(); } protected double innerW() { return super.getWidth(); } public double outerH() { // NO_UCD (use default) return super.getHeight() + 2 * borderTwiceStrokeW(); } protected double innerH() { return super.getHeight(); } /** * Compute bounds by subtracting border from outerW/outerH; call * positionChild to transform child to these bounds. */ void adjustSize(final double outerW, final double outerH) { // Always setBounds, because it may not have been set yet. final double borderSize = borderTwiceStrokeW(); super.setOffset(getXOffset() + borderSize, getYOffset() + borderSize); final double newWidth = Math.rint(outerW - 2.0 * borderSize); final double newHeight = Math.rint(outerH - 2.0 * borderSize); assert newWidth > 0.0 && newHeight > 0.0 : adjustSizeErrorMessage(mouseDoc, disabledMessage); super.setBounds(0.0, 0.0, newWidth, newHeight); } protected @NonNull String adjustSizeErrorMessage(final @Nullable String outerW, final @Nullable String outerH) { return "borderSize=" + borderTwiceStrokeW() + " outerW=" + outerW + " " + " outerH=" + outerH; } protected boolean isEnabled() { return isEnabled; } /** * Usually subclasses override isEnabled instead of calling this. */ public void setIsEnabled(final boolean _isEnabled) { isEnabled = _isEnabled; updateTransparency(); } void exit() { if (disabledMessageAPText != null) { disabledMessageAPText.removeFromParent(); } setMouseDoc(false); } void enter() { setMouseDoc(true); } public void setMouseDoc(final boolean state) { if (getParent() instanceof MouseDoc) { ((MouseDoc) getParent()).setMouseDoc(getMouseDoc(state)); } } private @Nullable String getMouseDoc(final boolean state) { return state ? getMouseDoc() : null; } protected @NonNull String getMouseDoc() { final String result = isEnabled() ? mouseDoc : getDisabledMessage(); assert UtilString.isNonEmptyString(result) : this + "\n isEnabled=" + isEnabled() + " getVisible=" + getVisible() + " getPickable=" + getPickable() + " getPickableMode=" + getPickableMode() + " result=" + result; assert result != null; return result; } public void doPick() { assert false : "default (no-op) doPick on " + this; } public void pick() { if (isEnabled()) { doPick(); } else { showDisabledError(); } } protected void showDisabledError() { final PNode parent = getParent(); if (parent instanceof MouseDoc) { ((MouseDoc) parent).setMouseDoc(getDisabledMessage()); } else { parent.addChild(getDisabledMessageAPText()); } } // @SuppressWarnings({ "static-method", "unused" }) // /** // * Nothing calls this! // */ // public void mayHideTransients(final PNode node) { // // Override this // assert false; // } } class ButtonHandler extends MyInputEventHandler<Button> { public ButtonHandler() { super(Button.class); } // Pretty much anything you do on a button shouldn't go any further, so // always return true. @Override public boolean click(final @NonNull Button node) { node.pick(); return true; } @Override public boolean exit(final @NonNull Button node) { node.exit(); return true; } @Override public boolean enter(final @NonNull Button node) { node.enter(); return true; } // @Override // public void mayHideTransients(final Button<?> node) { // node.mayHideTransients(node); // } }
9,017
0.676366
0.669617
332
25.222891
25.826199
113
false
false
0
0
0
0
0
0
1.490964
false
false
3
67d62b0f45454a3865a8ea6652e5dc3e9a9b264e
30,116,310,693,818
8375f18ad92e4bdb6735253b983827d59a1a743b
/app/src/main/java/com/bingo/king/mvp/presenter/ZhihuDetailPresenter.java
694af0a2f61ac19716717d02f0fc11b4080600a3
[]
no_license
BingoKingCoding/Mamba24
https://github.com/BingoKingCoding/Mamba24
8bf069f4c54b02de0e666ec56c735fd57be6b517
28ad6e4c80adc44fda8571f7b643991ec150a16d
refs/heads/master
2022-09-05T09:30:22.128000
2020-05-28T07:19:37
2020-05-28T07:19:37
109,247,525
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bingo.king.mvp.presenter; import android.app.Application; import com.bingo.king.app.base.BasePresenter; import com.bingo.king.di.scope.ActivityScope; import com.bingo.king.mvp.contract.ZhihuDetailContract; import com.bingo.king.mvp.model.entity.zhihu.DetailExtraBean; import com.bingo.king.mvp.model.entity.zhihu.ZhihuDetailBean; import com.bingo.king.mvp.model.http.rxerrorhandler.HttpCallback; import javax.inject.Inject; @ActivityScope public class ZhihuDetailPresenter extends BasePresenter<ZhihuDetailContract.Model, ZhihuDetailContract.View> { private Application mApplication; @Inject public ZhihuDetailPresenter(ZhihuDetailContract.Model model, ZhihuDetailContract.View rootView, Application application) { super(model, rootView); this.mApplication = application; } public void requestDetailInfo(int id){ requestInitializeData(mModel.requestDetailInfo(id), new HttpCallback<ZhihuDetailBean>() { @Override public void onSuccess(ZhihuDetailBean data) { mRootView.showDetailInfo(data); } }); } public void requestDetailExtraInfo(int id) { requestInitializeData(mModel.requestDetailExtraInfo(id), new HttpCallback<DetailExtraBean>() { @Override public void onSuccess(DetailExtraBean data) { mRootView.showExtraInfo(data); } }); } @Override public void onDestroy() { super.onDestroy(); this.mApplication = null; } }
UTF-8
Java
1,609
java
ZhihuDetailPresenter.java
Java
[]
null
[]
package com.bingo.king.mvp.presenter; import android.app.Application; import com.bingo.king.app.base.BasePresenter; import com.bingo.king.di.scope.ActivityScope; import com.bingo.king.mvp.contract.ZhihuDetailContract; import com.bingo.king.mvp.model.entity.zhihu.DetailExtraBean; import com.bingo.king.mvp.model.entity.zhihu.ZhihuDetailBean; import com.bingo.king.mvp.model.http.rxerrorhandler.HttpCallback; import javax.inject.Inject; @ActivityScope public class ZhihuDetailPresenter extends BasePresenter<ZhihuDetailContract.Model, ZhihuDetailContract.View> { private Application mApplication; @Inject public ZhihuDetailPresenter(ZhihuDetailContract.Model model, ZhihuDetailContract.View rootView, Application application) { super(model, rootView); this.mApplication = application; } public void requestDetailInfo(int id){ requestInitializeData(mModel.requestDetailInfo(id), new HttpCallback<ZhihuDetailBean>() { @Override public void onSuccess(ZhihuDetailBean data) { mRootView.showDetailInfo(data); } }); } public void requestDetailExtraInfo(int id) { requestInitializeData(mModel.requestDetailExtraInfo(id), new HttpCallback<DetailExtraBean>() { @Override public void onSuccess(DetailExtraBean data) { mRootView.showExtraInfo(data); } }); } @Override public void onDestroy() { super.onDestroy(); this.mApplication = null; } }
1,609
0.68179
0.68179
64
24.140625
29.056984
124
false
false
0
0
0
0
0
0
0.375
false
false
3
86af3b71c61e46812a38ed0b9b3c7e8e6490a4b0
4,140,348,512,974
17ca6c9576e0b469ecf8c19e0de16bfc6a9890b6
/Java8Features/src/com/nttdata/Assignment/Addition.java
2755be2c7159b9830dc64e9971e40a5a6d2bd717
[]
no_license
Chakravardhanreddy/Sample
https://github.com/Chakravardhanreddy/Sample
b2ccb31e2b033694a7e259141f4ff1124ecda5ae
c988472d0f071702abaa207fb09e1099f8edef67
refs/heads/main
2023-01-01T01:12:37.771000
2020-10-22T12:47:49
2020-10-22T12:47:49
306,307,198
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.nttdata.Assignment; import java.util.function.BiFunction; public class Addition { static int add(int a, int b) { return a+b; } static float add1(int a,float b) { return a+b; } public static void main(String[] args) { BiFunction<Integer, Integer,Integer>add=Addition::add; int res=add.apply(30, 40); System.out.println("Addition "+res); BiFunction<Integer, Float,Float>add1=Addition::add1; Float result=add1.apply(30, 40.98f); System.out.println("FloatAddition "+result); } }
UTF-8
Java
535
java
Addition.java
Java
[]
null
[]
package com.nttdata.Assignment; import java.util.function.BiFunction; public class Addition { static int add(int a, int b) { return a+b; } static float add1(int a,float b) { return a+b; } public static void main(String[] args) { BiFunction<Integer, Integer,Integer>add=Addition::add; int res=add.apply(30, 40); System.out.println("Addition "+res); BiFunction<Integer, Float,Float>add1=Addition::add1; Float result=add1.apply(30, 40.98f); System.out.println("FloatAddition "+result); } }
535
0.680374
0.654206
31
16.258064
18.402258
56
false
false
0
0
0
0
0
0
1.774194
false
false
3
3419a9b3d6a07e996f2be412543add05c2874002
26,328,149,582,726
080c084615293fb8859ee173b5df0d66c7f125cc
/app/src/main/java/com/example/chen/guigup2p/adapter/ProductAdapter2.java
2427344c2a24f765da6700b090897f3793dddb7e
[]
no_license
chenxzong/GuiguP2P
https://github.com/chenxzong/GuiguP2P
20cd2d8d18f254b46dd5098be2e5c11bf55eba19
016d70ee0830f22dc212cbde9e0bd864fbe86579
refs/heads/master
2021-01-19T11:53:26.252000
2017-08-25T05:59:25
2017-08-25T05:59:25
96,959,491
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.chen.guigup2p.adapter; import com.example.chen.guigup2p.bean.Product; import java.util.List; /** * Created by chen on 2017/8/7. */ public class ProductAdapter2 extends MyBaseAdapter2<Product> { public ProductAdapter2(List<Product> list) { super(list); } @Override public BaseHolder getHolder() { return new MyProductHolder(); } }
UTF-8
Java
394
java
ProductAdapter2.java
Java
[ { "context": "roduct;\n\nimport java.util.List;\n\n/**\n * Created by chen on 2017/8/7.\n */\n\npublic class ProductAdapter2 ex", "end": 138, "score": 0.9984736442565918, "start": 134, "tag": "USERNAME", "value": "chen" } ]
null
[]
package com.example.chen.guigup2p.adapter; import com.example.chen.guigup2p.bean.Product; import java.util.List; /** * Created by chen on 2017/8/7. */ public class ProductAdapter2 extends MyBaseAdapter2<Product> { public ProductAdapter2(List<Product> list) { super(list); } @Override public BaseHolder getHolder() { return new MyProductHolder(); } }
394
0.685279
0.65736
21
17.761906
19.615118
62
false
false
0
0
0
0
0
0
0.238095
false
false
3
dad730c02e86b1d899f2a359a6f1846e92318819
20,822,001,507,299
a6a6a27d3a2b62dd05735ac25459cf7b10ce5651
/src/klaseis/TrainerCourse.java
8da603f4850bfab9766d19dd87de918608b7a6cf
[]
no_license
elxa/School-JDBC
https://github.com/elxa/School-JDBC
382a1ca2bf3210e218fcae10a96ab427f0a1440c
6da2e26f55b3b47e8e649c795fbdc0517ccea9cf
refs/heads/master
2022-10-13T19:02:59.908000
2020-06-11T18:13:28
2020-06-11T18:13:28
271,597,170
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package klaseis; import dhmiourgiaBasewndedomenwn.BashCourse; import dhmiourgiaBasewndedomenwn.BashTrainer; import elegxoi.ElegxoiMetablhtwn; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.Scanner; import tools.Ypar3hStoixeiwnSthnLista; public class TrainerCourse { Trainer trainer = new Trainer(); Course course = new Course(); BashCourse bc = new BashCourse(); BashTrainer bT = new BashTrainer(); Scanner scan = new Scanner(System.in); ElegxoiMetablhtwn em = new ElegxoiMetablhtwn(); Ypar3hStoixeiwnSthnLista up = new Ypar3hStoixeiwnSthnLista(); public TrainerCourse() { } public void antistoixiaTrainersMeCourses(Statement stm, ArrayList<Trainer> trainers, ArrayList<Course> courses) { String stop = " "; boolean existList = true; int courseId = 0; int trainerId = 0; if (courses.isEmpty()) { System.out.println("Den uparxoun courses"); existList = false; //efoson den uparxei bgainoume e3w apo th me8odo } if (trainers.isEmpty()) { System.out.println("Den uparxoun trainers"); existList = false; } else { while (!stop.equals("stop") && existList == true) { try { System.out.println("******************Exoume ta e3hs Courses************************"); System.out.println(""); bc.emfanishCourses(stm); System.out.println(""); System.out.println("*****************Exoume tous e3hs Trainers*************************"); System.out.println(""); bT.emfanishTrainers(stm); System.out.println("Diale3e to Course "); int epiloghCourses = 0; epiloghCourses = em.ElegxosGiaIntMetablhth(epiloghCourses); courseId = bc.courseId(stm, epiloghCourses); System.out.println("Diale3e ton Trainer"); int epiloghTrainer = 0; epiloghTrainer = em.ElegxosGiaIntMetablhth(epiloghTrainer); trainerId = bT.trainerId(stm, epiloghTrainer); String sqlStudentCourse = "INSERT INTO TRAINERS_COURSES VALUES (" + trainerId + "," + courseId + ")"; stm.executeUpdate(sqlStudentCourse); } catch (SQLException ex) { System.out.println("1)XRHSIMOPOIHSES ARI8MO POU DEN UPARXEI h 2)YPARXEI HDH STH BASH H KATAXWRHSH POU KANEIS"); } // } System.out.println("ean 8es na stamathseis pata 'stop' alliws pata kapoion allon xarakthra"); stop = scan.nextLine(); } } } }
UTF-8
Java
2,910
java
TrainerCourse.java
Java
[]
null
[]
package klaseis; import dhmiourgiaBasewndedomenwn.BashCourse; import dhmiourgiaBasewndedomenwn.BashTrainer; import elegxoi.ElegxoiMetablhtwn; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.Scanner; import tools.Ypar3hStoixeiwnSthnLista; public class TrainerCourse { Trainer trainer = new Trainer(); Course course = new Course(); BashCourse bc = new BashCourse(); BashTrainer bT = new BashTrainer(); Scanner scan = new Scanner(System.in); ElegxoiMetablhtwn em = new ElegxoiMetablhtwn(); Ypar3hStoixeiwnSthnLista up = new Ypar3hStoixeiwnSthnLista(); public TrainerCourse() { } public void antistoixiaTrainersMeCourses(Statement stm, ArrayList<Trainer> trainers, ArrayList<Course> courses) { String stop = " "; boolean existList = true; int courseId = 0; int trainerId = 0; if (courses.isEmpty()) { System.out.println("Den uparxoun courses"); existList = false; //efoson den uparxei bgainoume e3w apo th me8odo } if (trainers.isEmpty()) { System.out.println("Den uparxoun trainers"); existList = false; } else { while (!stop.equals("stop") && existList == true) { try { System.out.println("******************Exoume ta e3hs Courses************************"); System.out.println(""); bc.emfanishCourses(stm); System.out.println(""); System.out.println("*****************Exoume tous e3hs Trainers*************************"); System.out.println(""); bT.emfanishTrainers(stm); System.out.println("Diale3e to Course "); int epiloghCourses = 0; epiloghCourses = em.ElegxosGiaIntMetablhth(epiloghCourses); courseId = bc.courseId(stm, epiloghCourses); System.out.println("Diale3e ton Trainer"); int epiloghTrainer = 0; epiloghTrainer = em.ElegxosGiaIntMetablhth(epiloghTrainer); trainerId = bT.trainerId(stm, epiloghTrainer); String sqlStudentCourse = "INSERT INTO TRAINERS_COURSES VALUES (" + trainerId + "," + courseId + ")"; stm.executeUpdate(sqlStudentCourse); } catch (SQLException ex) { System.out.println("1)XRHSIMOPOIHSES ARI8MO POU DEN UPARXEI h 2)YPARXEI HDH STH BASH H KATAXWRHSH POU KANEIS"); } // } System.out.println("ean 8es na stamathseis pata 'stop' alliws pata kapoion allon xarakthra"); stop = scan.nextLine(); } } } }
2,910
0.553608
0.547766
72
38.416668
31.672697
131
false
false
0
0
0
0
0
0
0.680556
false
false
3
9f788fecea114400d31c5f25389768e1c351e0da
22,728,966,977,293
b4da6c6899d0b524608faf9c1e9e556c817f179e
/SolutionIC.java
f2f2c7c68eed5f5834ee2400754f4e2a175de0fe
[]
no_license
tongzhao/LeetCodes
https://github.com/tongzhao/LeetCodes
5650a1c6b194cb7444b447320eb1bab3ae7f0e29
82feedc7e9da182e34e66bee348af4ba4a3857a6
refs/heads/master
2021-01-18T19:35:09.735000
2016-10-27T04:29:33
2016-10-27T04:29:33
72,070,838
0
0
null
false
2016-10-27T04:29:33
2016-10-27T04:24:21
2016-10-27T04:24:21
2016-10-27T04:29:33
0
0
0
0
null
null
null
/** * Two elements of a binary search tree (BST) are swapped by mistake. * Recover the tree without changing its structure. */ // https://leetcode.com/discuss/13034/no-fancy-algorithm-just-simple-and-powerful-order-traversal public class SolutionIC { TreeNode firstElement = null; TreeNode secondElement = null; // The reason for this initialization is to avoid null pointer exception // in the first comparison when prevElement has not been initialized TreeNode prevElement = new TreeNode(Integer.MIN_VALUE); public void recoverTree(TreeNode root) { traverse(root); int temp = firstElement.val; firstElement.val = secondElement.val; secondElement.val = temp; } public void traverse(TreeNode root) { // inorder traverse if (root==null) return; traverse(root.left); // do some business if (firstElement==null && prevElement.val >= root.val) firstElement = prevElement; if (firstElement!=null && prevElement.val >= root.val) secondElement = root; prevElement = root; traverse(root.right); } }
UTF-8
Java
1,150
java
SolutionIC.java
Java
[]
null
[]
/** * Two elements of a binary search tree (BST) are swapped by mistake. * Recover the tree without changing its structure. */ // https://leetcode.com/discuss/13034/no-fancy-algorithm-just-simple-and-powerful-order-traversal public class SolutionIC { TreeNode firstElement = null; TreeNode secondElement = null; // The reason for this initialization is to avoid null pointer exception // in the first comparison when prevElement has not been initialized TreeNode prevElement = new TreeNode(Integer.MIN_VALUE); public void recoverTree(TreeNode root) { traverse(root); int temp = firstElement.val; firstElement.val = secondElement.val; secondElement.val = temp; } public void traverse(TreeNode root) { // inorder traverse if (root==null) return; traverse(root.left); // do some business if (firstElement==null && prevElement.val >= root.val) firstElement = prevElement; if (firstElement!=null && prevElement.val >= root.val) secondElement = root; prevElement = root; traverse(root.right); } }
1,150
0.661739
0.657391
30
37.333332
23.068497
97
false
false
0
0
0
0
0
0
0.433333
false
false
3
d355836312408782f9f3bc9230bcc40597ce4091
15,350,213,166,203
c772780c169bb8cb64f3780018f4ce380e9aab29
/src/activity/SplashActivity.java
a70f34dd2106e5fc6cb720d2e21544d10997ddfd
[]
no_license
Elise2/school_tong
https://github.com/Elise2/school_tong
3238cc45b84038b0b9d44cf407ead82005b9d0d7
e7d573b33771154350601326de3efc86834e4e3c
refs/heads/master
2016-09-06T19:38:43.415000
2015-09-20T09:40:55
2015-09-20T09:40:55
42,807,697
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package activity; import com.example.school_tong.R; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.os.Handler; import android.view.Window; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.ImageView; public class SplashActivity extends Activity { private ImageView img; private Handler mhandle = new Handler(); @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub requestWindowFeature(Window.FEATURE_NO_TITLE); super.onCreate(savedInstanceState); setContentView(R.layout.splashview_layout); img = (ImageView) findViewById(R.id.firstPic); Animation animation = AnimationUtils.loadAnimation(this, R.anim.scale); img.startAnimation(animation); mhandle.postDelayed(new Runnable() { @Override public void run() { // TODO Auto-generated method stub SharedPreferences sp = getSharedPreferences("name", MODE_PRIVATE); boolean flag = sp.getBoolean("isFirst", true); Intent intent = null; if (flag) { intent = new Intent(SplashActivity.this, IndicatorActivity.class); } else { intent = new Intent(SplashActivity.this, NewsActivity.class); } startActivity(intent); } }, 1000); } }
UTF-8
Java
1,363
java
SplashActivity.java
Java
[]
null
[]
package activity; import com.example.school_tong.R; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.os.Handler; import android.view.Window; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.ImageView; public class SplashActivity extends Activity { private ImageView img; private Handler mhandle = new Handler(); @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub requestWindowFeature(Window.FEATURE_NO_TITLE); super.onCreate(savedInstanceState); setContentView(R.layout.splashview_layout); img = (ImageView) findViewById(R.id.firstPic); Animation animation = AnimationUtils.loadAnimation(this, R.anim.scale); img.startAnimation(animation); mhandle.postDelayed(new Runnable() { @Override public void run() { // TODO Auto-generated method stub SharedPreferences sp = getSharedPreferences("name", MODE_PRIVATE); boolean flag = sp.getBoolean("isFirst", true); Intent intent = null; if (flag) { intent = new Intent(SplashActivity.this, IndicatorActivity.class); } else { intent = new Intent(SplashActivity.this, NewsActivity.class); } startActivity(intent); } }, 1000); } }
1,363
0.744681
0.741746
48
27.395834
18.8002
73
false
false
0
0
0
0
0
0
2.479167
false
false
3
1993f1489b33dc09fbf5ad2ca6d2a26cbd6ef38d
31,516,470,069,272
647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4
/com.tencent.minihd.qq/assets/exlibs.2.jar/classes.jar/eof.java
8ad3990872afbac77debb47ef401566c4b838dd6
[]
no_license
tsuzcx/qq_apk
https://github.com/tsuzcx/qq_apk
0d5e792c3c7351ab781957bac465c55c505caf61
afe46ef5640d0ba6850cdefd3c11badbd725a3f6
refs/heads/main
2022-07-02T10:32:11.651000
2022-02-01T12:41:38
2022-02-01T12:41:38
453,860,108
36
9
null
false
2022-01-31T09:46:26
2022-01-31T02:43:22
2022-01-31T06:56:43
2022-01-31T09:46:26
167,304
0
1
1
Java
false
false
import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import com.tencent.mobileqq.activity.NotifyPushSettingActivity; import com.tencent.mobileqq.app.QQAppInterface; import com.tencent.mobileqq.widget.FormSwitchItem; public class eof extends BroadcastReceiver { public eof(NotifyPushSettingActivity paramNotifyPushSettingActivity) {} public void onReceive(Context paramContext, Intent paramIntent) { paramContext = paramIntent.getAction(); if (paramContext.equals("com.tencent.mobileqq.activity.NotifyPushSettingActivity.PCActive")) { paramContext = paramIntent.getStringExtra("uin"); NotifyPushSettingActivity.a(this.a, paramContext); } boolean bool; do { do { return; } while (!paramContext.equals("com.tencent.mobileqq.activity.NotifyPushSettingActivity.ConfigPCActive")); paramContext = paramIntent.getStringExtra("uin"); bool = paramIntent.getBooleanExtra("configPCActive", false); } while (!this.a.app.getAccount().equals(paramContext)); if (true == bool) { NotifyPushSettingActivity.f(this.a).setVisibility(0); return; } NotifyPushSettingActivity.f(this.a).setVisibility(8); } } /* Location: L:\local\mybackup\temp\qq_apk\com.tencent.minihd.qq\assets\exlibs.2.jar\classes.jar * Qualified Name: eof * JD-Core Version: 0.7.0.1 */
UTF-8
Java
1,478
java
eof.java
Java
[]
null
[]
import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import com.tencent.mobileqq.activity.NotifyPushSettingActivity; import com.tencent.mobileqq.app.QQAppInterface; import com.tencent.mobileqq.widget.FormSwitchItem; public class eof extends BroadcastReceiver { public eof(NotifyPushSettingActivity paramNotifyPushSettingActivity) {} public void onReceive(Context paramContext, Intent paramIntent) { paramContext = paramIntent.getAction(); if (paramContext.equals("com.tencent.mobileqq.activity.NotifyPushSettingActivity.PCActive")) { paramContext = paramIntent.getStringExtra("uin"); NotifyPushSettingActivity.a(this.a, paramContext); } boolean bool; do { do { return; } while (!paramContext.equals("com.tencent.mobileqq.activity.NotifyPushSettingActivity.ConfigPCActive")); paramContext = paramIntent.getStringExtra("uin"); bool = paramIntent.getBooleanExtra("configPCActive", false); } while (!this.a.app.getAccount().equals(paramContext)); if (true == bool) { NotifyPushSettingActivity.f(this.a).setVisibility(0); return; } NotifyPushSettingActivity.f(this.a).setVisibility(8); } } /* Location: L:\local\mybackup\temp\qq_apk\com.tencent.minihd.qq\assets\exlibs.2.jar\classes.jar * Qualified Name: eof * JD-Core Version: 0.7.0.1 */
1,478
0.700947
0.696211
48
28.916666
30.319021
111
false
false
0
0
0
0
0
0
0.4375
false
false
3
a04ade1c1ee72528e759db0f8b979c9237a26373
4,724,464,033,224
5017ca8362665edac595becc007773df2f7c2ba6
/src/main/java/au/org/aurin/wif/io/SslUtil.java
51aa52cad7d3dd543ddb5152e74e4a8af71ead7a
[ "MIT" ]
permissive
arsh7023/online-whatif
https://github.com/arsh7023/online-whatif
fb76c993cf043e056e8e19f6c85106125eb1bb26
0d8a0db11f7ef277f359260c7bb11437c0287bf3
refs/heads/master
2022-12-22T07:54:57.853000
2019-03-27T05:04:07
2019-03-27T05:04:07
226,495,906
0
0
MIT
false
2022-12-16T01:26:44
2019-12-07T10:53:01
2019-12-07T10:53:28
2022-12-16T01:26:41
23,522
0
0
9
TSQL
false
false
package au.org.aurin.wif.io; import java.security.KeyStore; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; import javax.net.ssl.TrustManagerFactory; import javax.net.ssl.X509TrustManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public final class SslUtil { private static final Logger LOGGER = LoggerFactory.getLogger(SslUtil.class); private SslUtil() { } public static void trustSelfSignedSSL() { try { final SSLContext ctx = SSLContext.getInstance("TLS"); final X509TrustManager tm = new X509TrustManager() { public X509Certificate[] getAcceptedIssuers() { return new X509Certificate[] {}; } public void checkServerTrusted(final X509Certificate[] arg0, final String arg1) throws CertificateException { } public void checkClientTrusted(final X509Certificate[] arg0, final String arg1) throws CertificateException { } }; ctx.init(null, new TrustManager[] { tm }, null); SSLContext.setDefault(ctx); } catch (final Exception ex) { LOGGER.error("Error while setting default ssl context", ex); } } public static void trustJavaTrustStore() { try { final SSLContext ctx = SSLContext.getInstance("TLS"); final X509TrustManager tm = new SunX509TrustManager(); ctx.init(null, new TrustManager[] { tm }, null); SSLContext.setDefault(ctx); } catch (final Exception ex) { LOGGER.error("Error while trusting local keystore", ex); } } } class SunX509TrustManager implements X509TrustManager { private static final Logger LOGGER = LoggerFactory .getLogger(SunX509TrustManager.class); /* * The default X509TrustManager returned by SunX509. We'll delegate decisions * to it, and fall back to the logic in this class if the default * X509TrustManager doesn't trust it. */ X509TrustManager sunJSSEX509TrustManager; SunX509TrustManager() throws Exception { // create a "default" JSSE X509TrustManager. final KeyStore ks = KeyStore.getInstance("JKS"); ks.load(ClassLoader .getSystemResourceAsStream("au/org/aurin/security/sun-cacerts.jks"), "changeit".toCharArray()); final TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509", "SunJSSE"); tmf.init(ks); final TrustManager tms[] = tmf.getTrustManagers(); /* * Iterate over the returned trustmanagers, look for an instance of * X509TrustManager. If found, use that as our "default" trust manager. */ for (final TrustManager tm : tms) { if (tm instanceof X509TrustManager) { sunJSSEX509TrustManager = (X509TrustManager) tm; return; } } /* * Find some other way to initialize, or else we have to fail the * constructor. */ throw new Exception("Couldn't initialize"); } /* * Delegate to the default trust manager. */ public void checkClientTrusted(final X509Certificate[] chain, final String authType) throws CertificateException { try { sunJSSEX509TrustManager.checkClientTrusted(chain, authType); } catch (final CertificateException excep) { // do any special handling here, or rethrow exception. LOGGER.error("Error while checking client certificate chain", excep); } } /* * Delegate to the default trust manager. */ public void checkServerTrusted(final X509Certificate[] chain, final String authType) throws CertificateException { try { sunJSSEX509TrustManager.checkServerTrusted(chain, authType); } catch (final CertificateException excep) { // do any special handling here, or rethrow exception LOGGER.error("Error while checking server certificate chain", excep); } } /* * Merely pass this through. */ public X509Certificate[] getAcceptedIssuers() { return sunJSSEX509TrustManager.getAcceptedIssuers(); } }
UTF-8
Java
4,050
java
SslUtil.java
Java
[]
null
[]
package au.org.aurin.wif.io; import java.security.KeyStore; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; import javax.net.ssl.TrustManagerFactory; import javax.net.ssl.X509TrustManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public final class SslUtil { private static final Logger LOGGER = LoggerFactory.getLogger(SslUtil.class); private SslUtil() { } public static void trustSelfSignedSSL() { try { final SSLContext ctx = SSLContext.getInstance("TLS"); final X509TrustManager tm = new X509TrustManager() { public X509Certificate[] getAcceptedIssuers() { return new X509Certificate[] {}; } public void checkServerTrusted(final X509Certificate[] arg0, final String arg1) throws CertificateException { } public void checkClientTrusted(final X509Certificate[] arg0, final String arg1) throws CertificateException { } }; ctx.init(null, new TrustManager[] { tm }, null); SSLContext.setDefault(ctx); } catch (final Exception ex) { LOGGER.error("Error while setting default ssl context", ex); } } public static void trustJavaTrustStore() { try { final SSLContext ctx = SSLContext.getInstance("TLS"); final X509TrustManager tm = new SunX509TrustManager(); ctx.init(null, new TrustManager[] { tm }, null); SSLContext.setDefault(ctx); } catch (final Exception ex) { LOGGER.error("Error while trusting local keystore", ex); } } } class SunX509TrustManager implements X509TrustManager { private static final Logger LOGGER = LoggerFactory .getLogger(SunX509TrustManager.class); /* * The default X509TrustManager returned by SunX509. We'll delegate decisions * to it, and fall back to the logic in this class if the default * X509TrustManager doesn't trust it. */ X509TrustManager sunJSSEX509TrustManager; SunX509TrustManager() throws Exception { // create a "default" JSSE X509TrustManager. final KeyStore ks = KeyStore.getInstance("JKS"); ks.load(ClassLoader .getSystemResourceAsStream("au/org/aurin/security/sun-cacerts.jks"), "changeit".toCharArray()); final TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509", "SunJSSE"); tmf.init(ks); final TrustManager tms[] = tmf.getTrustManagers(); /* * Iterate over the returned trustmanagers, look for an instance of * X509TrustManager. If found, use that as our "default" trust manager. */ for (final TrustManager tm : tms) { if (tm instanceof X509TrustManager) { sunJSSEX509TrustManager = (X509TrustManager) tm; return; } } /* * Find some other way to initialize, or else we have to fail the * constructor. */ throw new Exception("Couldn't initialize"); } /* * Delegate to the default trust manager. */ public void checkClientTrusted(final X509Certificate[] chain, final String authType) throws CertificateException { try { sunJSSEX509TrustManager.checkClientTrusted(chain, authType); } catch (final CertificateException excep) { // do any special handling here, or rethrow exception. LOGGER.error("Error while checking client certificate chain", excep); } } /* * Delegate to the default trust manager. */ public void checkServerTrusted(final X509Certificate[] chain, final String authType) throws CertificateException { try { sunJSSEX509TrustManager.checkServerTrusted(chain, authType); } catch (final CertificateException excep) { // do any special handling here, or rethrow exception LOGGER.error("Error while checking server certificate chain", excep); } } /* * Merely pass this through. */ public X509Certificate[] getAcceptedIssuers() { return sunJSSEX509TrustManager.getAcceptedIssuers(); } }
4,050
0.694074
0.66963
126
31.142857
25.682034
79
false
false
0
0
0
0
0
0
0.468254
false
false
3
39b750171b4780ba84a93e1e462e66099d5391f0
10,737,418,250,562
2c829350e6bbb719b38b4415a22d768ea37b2381
/core/src/test/java/org/ocpsoft/prettytime/PrettyTimeI18n_ET_Test.java
730229c85d1207286ebdde91535e0b7166b18118
[ "Apache-2.0" ]
permissive
ocpsoft/prettytime
https://github.com/ocpsoft/prettytime
347895e2050bd1ad8a30e848bf39548fde23ee07
5eafbbaa3b15e20d095b973fe20e8b9bf72f9a87
refs/heads/master
2023-08-31T04:56:06.308000
2023-06-23T16:30:14
2023-06-23T16:30:14
1,164,974
1,120
220
Apache-2.0
false
2023-09-02T21:46:42
2010-12-13T15:25:42
2023-08-28T12:16:36
2023-09-02T21:46:42
841
1,268
244
17
Java
false
false
package org.ocpsoft.prettytime; import static org.junit.Assert.assertEquals; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Locale; import org.junit.Before; import org.junit.Test; import org.ocpsoft.prettytime.units.JustNow; public class PrettyTimeI18n_ET_Test { private Locale locale; @Before public void setUp() throws Exception { locale = new Locale("et"); } private PrettyTime newPrettyTimeWOJustNow(Date ref, Locale locale) { PrettyTime t = new PrettyTime(ref, locale); List<TimeUnit> units = t.getUnits(); List<TimeFormat> formats = new ArrayList<TimeFormat>(); for (TimeUnit timeUnit : units) { if (!(timeUnit instanceof JustNow)) { formats.add(t.getFormat(timeUnit)); } } int index = 0; t.clearUnits(); for (TimeUnit timeUnit : units) { if (!(timeUnit instanceof JustNow)) { t.registerUnit(timeUnit, formats.get(index)); index++; } } return t; } @Test public void testRightNow() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); assertEquals("hetke pärast", t.format(new Date(6000))); } @Test public void testMomentsAgo() throws Exception { PrettyTime t = new PrettyTime(new Date(6000), locale); assertEquals("hetk tagasi", t.format(new Date(0))); } @Test public void testMilliSecondsFromNow() throws Exception { PrettyTime t = newPrettyTimeWOJustNow(new Date(0), locale); assertEquals("13 millisekundi pärast", t.format(new Date(13))); } @Test public void testMilliSecondsAgo() throws Exception { PrettyTime t = newPrettyTimeWOJustNow(new Date(13), locale); assertEquals("13 millisekundit tagasi", t.format(new Date(0))); } @Test public void testMilliSecondFromNow() throws Exception { PrettyTime t = newPrettyTimeWOJustNow(new Date(0), locale); assertEquals("millisekundi pärast", t.format(new Date(1))); } @Test public void testMilliSecondAgo() throws Exception { PrettyTime t = newPrettyTimeWOJustNow(new Date(1), locale); assertEquals("millisekund tagasi", t.format(new Date(0))); } @Test public void testSecondsFromNow() throws Exception { PrettyTime t = newPrettyTimeWOJustNow(new Date(0), locale); assertEquals("13 sekundi pärast", t.format(new Date(1000 * 13))); } @Test public void testSecondsAgo() throws Exception { PrettyTime t = newPrettyTimeWOJustNow(new Date(1000 * 13), locale); assertEquals("13 sekundit tagasi", t.format(new Date(0))); } @Test public void testSecondFromNow() throws Exception { PrettyTime t = newPrettyTimeWOJustNow(new Date(0), locale); assertEquals("sekundi pärast", t.format(new Date(1000 * 1))); } @Test public void testSecondAgo() throws Exception { PrettyTime t = newPrettyTimeWOJustNow(new Date(1000 * 1), locale); assertEquals("sekund tagasi", t.format(new Date(0))); } @Test public void testMinutesFromNow() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); assertEquals("13 minuti pärast", t.format(new Date(1000 * 60 * 13))); } @Test public void testMinutesAgo() throws Exception { PrettyTime t = new PrettyTime(new Date(1000 * 60 * 13), locale); assertEquals("13 minutit tagasi", t.format(new Date(0))); } @Test public void testMinuteFromNow() throws Exception { PrettyTime t = newPrettyTimeWOJustNow(new Date(0), locale); assertEquals("minuti pärast", t.format(new Date(1000 * 60 * 1))); } @Test public void testMinuteAgo() throws Exception { PrettyTime t = newPrettyTimeWOJustNow(new Date(1000 * 60 * 1), locale); assertEquals("minut tagasi", t.format(new Date(0))); } @Test public void testHoursFromNow() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); assertEquals("3 tunni pärast", t.format(new Date(1000 * 60 * 60 * 3))); } @Test public void testHoursAgo() throws Exception { PrettyTime t = new PrettyTime(new Date(1000 * 60 * 60 * 3), locale); assertEquals("3 tundi tagasi", t.format(new Date(0))); } @Test public void testHoursFromNowSingle() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); assertEquals("tunni pärast", t.format(new Date(1000 * 60 * 60 * 1))); } @Test public void testHoursAgoSingle() throws Exception { PrettyTime t = new PrettyTime(new Date(1000 * 60 * 60 * 1), locale); assertEquals("tund tagasi", t.format(new Date(0))); } @Test public void testDaysFromNow() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); assertEquals("3 päeva pärast", t.format(new Date(1000 * 60 * 60 * 24 * 3))); } @Test public void testDaysAgo() throws Exception { PrettyTime t = new PrettyTime(new Date(1000 * 60 * 60 * 24 * 3), locale); assertEquals("3 päeva tagasi", t.format(new Date(0))); } @Test public void testDaysFromNowSingle() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); assertEquals("homme", t.format(new Date(1000 * 60 * 60 * 24 * 1))); } @Test public void testDaysAgoSingle() throws Exception { PrettyTime t = new PrettyTime(new Date(1000 * 60 * 60 * 24 * 1), locale); assertEquals("eile", t.format(new Date(0))); } @Test public void testWeeksFromNow() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); assertEquals("3 nädala pärast", t.format(new Date(1000 * 60 * 60 * 24 * 7 * 3))); } @Test public void testWeeksAgo() throws Exception { PrettyTime t = new PrettyTime(new Date(1000 * 60 * 60 * 24 * 7 * 3), locale); assertEquals("3 nädalat tagasi", t.format(new Date(0))); } @Test public void testWeeksFromNowSingle() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); assertEquals("nädala pärast", t.format(new Date(1000 * 60 * 60 * 24 * 7 * 1))); } @Test public void testWeeksAgoSingle() throws Exception { PrettyTime t = new PrettyTime(new Date(1000 * 60 * 60 * 24 * 7 * 1), locale); assertEquals("nädal tagasi", t.format(new Date(0))); } @Test public void testMonthsFromNow() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); assertEquals("3 kuu pärast", t.format(new Date(1000L * 60 * 60 * 24 * 30 * 3))); } @Test public void testMonthsAgo() throws Exception { PrettyTime t = new PrettyTime(new Date(1000L * 60 * 60 * 24 * 30 * 3), locale); assertEquals("3 kuud tagasi", t.format(new Date(0))); } @Test public void testMonthFromNow() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); assertEquals("kuu pärast", t.format(new Date(1000L * 60 * 60 * 24 * 30 * 1))); } @Test public void testMonthAgo() throws Exception { PrettyTime t = new PrettyTime(new Date(1000L * 60 * 60 * 24 * 30 * 1), locale); assertEquals("kuu tagasi", t.format(new Date(0))); } @Test public void testYearsFromNow() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); assertEquals("3 aasta pärast", t.format(new Date(1000L * 60 * 60 * 24 * 365 * 3))); } @Test public void testYearsAgo() throws Exception { PrettyTime t = new PrettyTime(new Date(1000L * 60 * 60 * 24 * 365 * 3), locale); assertEquals("3 aastat tagasi", t.format(new Date(0))); } @Test public void testYearFromNow() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); assertEquals("aasta pärast", t.format(new Date(1000L * 60 * 60 * 24 * 366 * 1))); } @Test public void testYearAgo() throws Exception { PrettyTime t = new PrettyTime(new Date(1000L * 60 * 60 * 24 * 366 * 1), locale); assertEquals("aasta tagasi", t.format(new Date(0))); } @Test public void testDecadesFromNow() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); assertEquals("3 aastakümne pärast", t.format(new Date(1000L * 60 * 60 * 24 * 365 * 10 * 3))); } @Test public void testDecadesAgo() throws Exception { PrettyTime t = new PrettyTime(new Date(1000L * 60 * 60 * 24 * 365 * 10 * 3), locale); assertEquals("3 aastakümmet tagasi", t.format(new Date(0))); } @Test public void testDecadeFromNow() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); assertEquals("aastakümne pärast", t.format(new Date(1000L * 60 * 60 * 24 * 365 * 11 * 1))); } @Test public void testDecadeAgo() throws Exception { PrettyTime t = new PrettyTime(new Date(1000L * 60 * 60 * 24 * 365 * 11), locale); assertEquals("aastakümme tagasi", t.format(new Date(0))); } @Test public void testCenturiesFromNow() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); assertEquals("3 sajandi pärast", t.format(new Date(1000L * 60 * 60 * 24 * 365 * 100 * 3))); } @Test public void testCenturiesAgo() throws Exception { PrettyTime t = new PrettyTime(new Date(1000L * 60 * 60 * 24 * 365 * 100 * 3), locale); assertEquals("3 sajandit tagasi", t.format(new Date(0))); } @Test public void testCenturyFromNow() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); assertEquals("sajandi pärast", t.format(new Date(1000L * 60 * 60 * 24 * 365 * 101))); } @Test public void testCenturyAgo() throws Exception { PrettyTime t = new PrettyTime(new Date(1000L * 60 * 60 * 24 * 365 * 101), locale); assertEquals("sajand tagasi", t.format(new Date(0))); } @Test public void testMillenniaFromNow() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); assertEquals("3 aastatuhande pärast", t.format(new Date(1000L * 60 * 60 * 24 * 365 * 1000 * 3))); } @Test public void testMillenniaAgo() throws Exception { PrettyTime t = new PrettyTime(new Date(1000L * 60 * 60 * 24 * 365 * 1000 * 3), locale); assertEquals("3 aastatuhandet tagasi", t.format(new Date(0))); } @Test public void testMillenniumFromNow() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); assertEquals("aastatuhande pärast", t.format(new Date(1000L * 60 * 60 * 24 * 365 * 1001))); } @Test public void testMillenniumAgo() throws Exception { PrettyTime t = new PrettyTime(new Date(1000L * 60 * 60 * 24 * 365 * 1001), locale); assertEquals("aastatuhat tagasi", t.format(new Date(0))); } @Test public void testFormattingDurationListInThePast() throws Exception { PrettyTime t = new PrettyTime(new Date(1000 * 60 * 60 * 24 * 3 + 1000 * 60 * 60 * 15 + 1000 * 60 * 38), locale); List<Duration> durations = t.calculatePreciseDuration(new Date(0)); assertEquals("3 päeva 15 tundi 38 minutit tagasi", t.format(durations)); } @Test public void testFormattingDurationListInTheFuture() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); List<Duration> durations = t.calculatePreciseDuration(new Date(1000 * 60 * 60 * 24 * 3 + 1000 * 60 * 60 * 15 + 1000 * 60 * 38)); assertEquals("3 päeva 15 tunni 38 minuti pärast", t.format(durations)); } }
UTF-8
Java
12,134
java
PrettyTimeI18n_ET_Test.java
Java
[]
null
[]
package org.ocpsoft.prettytime; import static org.junit.Assert.assertEquals; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Locale; import org.junit.Before; import org.junit.Test; import org.ocpsoft.prettytime.units.JustNow; public class PrettyTimeI18n_ET_Test { private Locale locale; @Before public void setUp() throws Exception { locale = new Locale("et"); } private PrettyTime newPrettyTimeWOJustNow(Date ref, Locale locale) { PrettyTime t = new PrettyTime(ref, locale); List<TimeUnit> units = t.getUnits(); List<TimeFormat> formats = new ArrayList<TimeFormat>(); for (TimeUnit timeUnit : units) { if (!(timeUnit instanceof JustNow)) { formats.add(t.getFormat(timeUnit)); } } int index = 0; t.clearUnits(); for (TimeUnit timeUnit : units) { if (!(timeUnit instanceof JustNow)) { t.registerUnit(timeUnit, formats.get(index)); index++; } } return t; } @Test public void testRightNow() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); assertEquals("hetke pärast", t.format(new Date(6000))); } @Test public void testMomentsAgo() throws Exception { PrettyTime t = new PrettyTime(new Date(6000), locale); assertEquals("hetk tagasi", t.format(new Date(0))); } @Test public void testMilliSecondsFromNow() throws Exception { PrettyTime t = newPrettyTimeWOJustNow(new Date(0), locale); assertEquals("13 millisekundi pärast", t.format(new Date(13))); } @Test public void testMilliSecondsAgo() throws Exception { PrettyTime t = newPrettyTimeWOJustNow(new Date(13), locale); assertEquals("13 millisekundit tagasi", t.format(new Date(0))); } @Test public void testMilliSecondFromNow() throws Exception { PrettyTime t = newPrettyTimeWOJustNow(new Date(0), locale); assertEquals("millisekundi pärast", t.format(new Date(1))); } @Test public void testMilliSecondAgo() throws Exception { PrettyTime t = newPrettyTimeWOJustNow(new Date(1), locale); assertEquals("millisekund tagasi", t.format(new Date(0))); } @Test public void testSecondsFromNow() throws Exception { PrettyTime t = newPrettyTimeWOJustNow(new Date(0), locale); assertEquals("13 sekundi pärast", t.format(new Date(1000 * 13))); } @Test public void testSecondsAgo() throws Exception { PrettyTime t = newPrettyTimeWOJustNow(new Date(1000 * 13), locale); assertEquals("13 sekundit tagasi", t.format(new Date(0))); } @Test public void testSecondFromNow() throws Exception { PrettyTime t = newPrettyTimeWOJustNow(new Date(0), locale); assertEquals("sekundi pärast", t.format(new Date(1000 * 1))); } @Test public void testSecondAgo() throws Exception { PrettyTime t = newPrettyTimeWOJustNow(new Date(1000 * 1), locale); assertEquals("sekund tagasi", t.format(new Date(0))); } @Test public void testMinutesFromNow() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); assertEquals("13 minuti pärast", t.format(new Date(1000 * 60 * 13))); } @Test public void testMinutesAgo() throws Exception { PrettyTime t = new PrettyTime(new Date(1000 * 60 * 13), locale); assertEquals("13 minutit tagasi", t.format(new Date(0))); } @Test public void testMinuteFromNow() throws Exception { PrettyTime t = newPrettyTimeWOJustNow(new Date(0), locale); assertEquals("minuti pärast", t.format(new Date(1000 * 60 * 1))); } @Test public void testMinuteAgo() throws Exception { PrettyTime t = newPrettyTimeWOJustNow(new Date(1000 * 60 * 1), locale); assertEquals("minut tagasi", t.format(new Date(0))); } @Test public void testHoursFromNow() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); assertEquals("3 tunni pärast", t.format(new Date(1000 * 60 * 60 * 3))); } @Test public void testHoursAgo() throws Exception { PrettyTime t = new PrettyTime(new Date(1000 * 60 * 60 * 3), locale); assertEquals("3 tundi tagasi", t.format(new Date(0))); } @Test public void testHoursFromNowSingle() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); assertEquals("tunni pärast", t.format(new Date(1000 * 60 * 60 * 1))); } @Test public void testHoursAgoSingle() throws Exception { PrettyTime t = new PrettyTime(new Date(1000 * 60 * 60 * 1), locale); assertEquals("tund tagasi", t.format(new Date(0))); } @Test public void testDaysFromNow() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); assertEquals("3 päeva pärast", t.format(new Date(1000 * 60 * 60 * 24 * 3))); } @Test public void testDaysAgo() throws Exception { PrettyTime t = new PrettyTime(new Date(1000 * 60 * 60 * 24 * 3), locale); assertEquals("3 päeva tagasi", t.format(new Date(0))); } @Test public void testDaysFromNowSingle() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); assertEquals("homme", t.format(new Date(1000 * 60 * 60 * 24 * 1))); } @Test public void testDaysAgoSingle() throws Exception { PrettyTime t = new PrettyTime(new Date(1000 * 60 * 60 * 24 * 1), locale); assertEquals("eile", t.format(new Date(0))); } @Test public void testWeeksFromNow() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); assertEquals("3 nädala pärast", t.format(new Date(1000 * 60 * 60 * 24 * 7 * 3))); } @Test public void testWeeksAgo() throws Exception { PrettyTime t = new PrettyTime(new Date(1000 * 60 * 60 * 24 * 7 * 3), locale); assertEquals("3 nädalat tagasi", t.format(new Date(0))); } @Test public void testWeeksFromNowSingle() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); assertEquals("nädala pärast", t.format(new Date(1000 * 60 * 60 * 24 * 7 * 1))); } @Test public void testWeeksAgoSingle() throws Exception { PrettyTime t = new PrettyTime(new Date(1000 * 60 * 60 * 24 * 7 * 1), locale); assertEquals("nädal tagasi", t.format(new Date(0))); } @Test public void testMonthsFromNow() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); assertEquals("3 kuu pärast", t.format(new Date(1000L * 60 * 60 * 24 * 30 * 3))); } @Test public void testMonthsAgo() throws Exception { PrettyTime t = new PrettyTime(new Date(1000L * 60 * 60 * 24 * 30 * 3), locale); assertEquals("3 kuud tagasi", t.format(new Date(0))); } @Test public void testMonthFromNow() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); assertEquals("kuu pärast", t.format(new Date(1000L * 60 * 60 * 24 * 30 * 1))); } @Test public void testMonthAgo() throws Exception { PrettyTime t = new PrettyTime(new Date(1000L * 60 * 60 * 24 * 30 * 1), locale); assertEquals("kuu tagasi", t.format(new Date(0))); } @Test public void testYearsFromNow() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); assertEquals("3 aasta pärast", t.format(new Date(1000L * 60 * 60 * 24 * 365 * 3))); } @Test public void testYearsAgo() throws Exception { PrettyTime t = new PrettyTime(new Date(1000L * 60 * 60 * 24 * 365 * 3), locale); assertEquals("3 aastat tagasi", t.format(new Date(0))); } @Test public void testYearFromNow() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); assertEquals("aasta pärast", t.format(new Date(1000L * 60 * 60 * 24 * 366 * 1))); } @Test public void testYearAgo() throws Exception { PrettyTime t = new PrettyTime(new Date(1000L * 60 * 60 * 24 * 366 * 1), locale); assertEquals("aasta tagasi", t.format(new Date(0))); } @Test public void testDecadesFromNow() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); assertEquals("3 aastakümne pärast", t.format(new Date(1000L * 60 * 60 * 24 * 365 * 10 * 3))); } @Test public void testDecadesAgo() throws Exception { PrettyTime t = new PrettyTime(new Date(1000L * 60 * 60 * 24 * 365 * 10 * 3), locale); assertEquals("3 aastakümmet tagasi", t.format(new Date(0))); } @Test public void testDecadeFromNow() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); assertEquals("aastakümne pärast", t.format(new Date(1000L * 60 * 60 * 24 * 365 * 11 * 1))); } @Test public void testDecadeAgo() throws Exception { PrettyTime t = new PrettyTime(new Date(1000L * 60 * 60 * 24 * 365 * 11), locale); assertEquals("aastakümme tagasi", t.format(new Date(0))); } @Test public void testCenturiesFromNow() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); assertEquals("3 sajandi pärast", t.format(new Date(1000L * 60 * 60 * 24 * 365 * 100 * 3))); } @Test public void testCenturiesAgo() throws Exception { PrettyTime t = new PrettyTime(new Date(1000L * 60 * 60 * 24 * 365 * 100 * 3), locale); assertEquals("3 sajandit tagasi", t.format(new Date(0))); } @Test public void testCenturyFromNow() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); assertEquals("sajandi pärast", t.format(new Date(1000L * 60 * 60 * 24 * 365 * 101))); } @Test public void testCenturyAgo() throws Exception { PrettyTime t = new PrettyTime(new Date(1000L * 60 * 60 * 24 * 365 * 101), locale); assertEquals("sajand tagasi", t.format(new Date(0))); } @Test public void testMillenniaFromNow() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); assertEquals("3 aastatuhande pärast", t.format(new Date(1000L * 60 * 60 * 24 * 365 * 1000 * 3))); } @Test public void testMillenniaAgo() throws Exception { PrettyTime t = new PrettyTime(new Date(1000L * 60 * 60 * 24 * 365 * 1000 * 3), locale); assertEquals("3 aastatuhandet tagasi", t.format(new Date(0))); } @Test public void testMillenniumFromNow() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); assertEquals("aastatuhande pärast", t.format(new Date(1000L * 60 * 60 * 24 * 365 * 1001))); } @Test public void testMillenniumAgo() throws Exception { PrettyTime t = new PrettyTime(new Date(1000L * 60 * 60 * 24 * 365 * 1001), locale); assertEquals("aastatuhat tagasi", t.format(new Date(0))); } @Test public void testFormattingDurationListInThePast() throws Exception { PrettyTime t = new PrettyTime(new Date(1000 * 60 * 60 * 24 * 3 + 1000 * 60 * 60 * 15 + 1000 * 60 * 38), locale); List<Duration> durations = t.calculatePreciseDuration(new Date(0)); assertEquals("3 päeva 15 tundi 38 minutit tagasi", t.format(durations)); } @Test public void testFormattingDurationListInTheFuture() throws Exception { PrettyTime t = new PrettyTime(new Date(0), locale); List<Duration> durations = t.calculatePreciseDuration(new Date(1000 * 60 * 60 * 24 * 3 + 1000 * 60 * 60 * 15 + 1000 * 60 * 38)); assertEquals("3 päeva 15 tunni 38 minuti pärast", t.format(durations)); } }
12,134
0.612613
0.559054
384
30.507813
31.151176
120
false
false
0
0
0
0
0
0
0.565104
false
false
3
da79ea43f1ab0a350781e3fc2e4e0041ced26b36
14,156,212,222,575
5aa23bfd0c112444185a0252c116b1553f11afe4
/src/main/java/validate/Result.java
b2a32cbf81198f3c83e58c43eb65b6fec5106b8f
[]
no_license
zluo/java_lab
https://github.com/zluo/java_lab
11c0efda85c2cdda53059bf84f5c7ab7223e0c9b
59efa2897e3ec57cf607beed0b3a794d38de2ac6
refs/heads/master
2018-12-26T18:07:13.274000
2018-11-05T22:47:51
2018-11-05T22:47:51
1,110,100
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package validate; public class Result { String autoGraphName; int points; private Result(String autoGraphName, int points) { super(); this.autoGraphName = autoGraphName; this.points = points; } public String getAutoGraphName() { return autoGraphName; } public void setAutoGraphName(String autoGraphName) { this.autoGraphName = autoGraphName; } public int getPoints() { return points; } public void setPoints(int points) { this.points = points; } }
UTF-8
Java
488
java
Result.java
Java
[]
null
[]
package validate; public class Result { String autoGraphName; int points; private Result(String autoGraphName, int points) { super(); this.autoGraphName = autoGraphName; this.points = points; } public String getAutoGraphName() { return autoGraphName; } public void setAutoGraphName(String autoGraphName) { this.autoGraphName = autoGraphName; } public int getPoints() { return points; } public void setPoints(int points) { this.points = points; } }
488
0.713115
0.713115
30
15.266666
15.947692
53
false
false
0
0
0
0
0
0
1.433333
false
false
3
200abadcfe3f259131ba48ed1b9ed0258ca4b37f
29,841,432,799,529
3656585b517adf282bd2af3d1e42c32b1fcf27f4
/vraptor-blank-project/src/br/com/wine/vraptorbigw/entity/WebSite.java
bca9f3c25f16115b13e382325db35db5de77e570
[]
no_license
marioromulo/hello-world
https://github.com/marioromulo/hello-world
cb2a794b3b88b49e8583efd565749be91b36c1ec
29ac1f0019650ad38c7cba0edcc3d030b7ab7b63
refs/heads/master
2020-01-20T00:25:26.373000
2013-02-27T13:47:46
2013-02-27T13:47:46
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.wine.vraptorbigw.entity; import java.io.Serializable; import java.text.SimpleDateFormat; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import org.hibernate.validator.constraints.NotEmpty; import br.com.wine.vraptorbigw.entity.common.CommonEntity; @Entity @Table(name = WebSite.TABLE, schema = WebSite.SCHEMA) public class WebSite extends CommonEntity implements Serializable { private static final long serialVersionUID = -3823425012908657764L; protected static final String TABLE = "T_WEBSITE"; protected static final String SCHEMA = "CURSO_BIGW"; @NotEmpty(message = "Não pode ser vazio.") @Column(name = "st_url", length = 60, unique = true) private String url; @NotEmpty(message = "Não pode ser vazio.") @Column(name = "st_descricao", length = 50) private String descricao; @Column(name = "st_categorizacao", length = 200) private String categorizacao; @Column(name = "dt_criacao") @Temporal(TemporalType.DATE) private Date criacao; public String getUrl() { return url; } public void setUrl(String url) { this.url = url!=null?url.trim():url;; } public String getDescricao() { return descricao; } public void setDescricao(String descricao) { this.descricao = descricao!=null?descricao.trim():descricao; } public String getCategorizacao() { return categorizacao==null?"":categorizacao; } public void setCategorizacao(String categorizacao) { this.categorizacao = categorizacao; } public String getCriacao() { if (criacao != null) { return new SimpleDateFormat("dd/MM/yyyy").format(criacao); } return ""; } public void setCriacao(Date criacao) { this.criacao = criacao; } }
UTF-8
Java
1,812
java
WebSite.java
Java
[]
null
[]
package br.com.wine.vraptorbigw.entity; import java.io.Serializable; import java.text.SimpleDateFormat; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import org.hibernate.validator.constraints.NotEmpty; import br.com.wine.vraptorbigw.entity.common.CommonEntity; @Entity @Table(name = WebSite.TABLE, schema = WebSite.SCHEMA) public class WebSite extends CommonEntity implements Serializable { private static final long serialVersionUID = -3823425012908657764L; protected static final String TABLE = "T_WEBSITE"; protected static final String SCHEMA = "CURSO_BIGW"; @NotEmpty(message = "Não pode ser vazio.") @Column(name = "st_url", length = 60, unique = true) private String url; @NotEmpty(message = "Não pode ser vazio.") @Column(name = "st_descricao", length = 50) private String descricao; @Column(name = "st_categorizacao", length = 200) private String categorizacao; @Column(name = "dt_criacao") @Temporal(TemporalType.DATE) private Date criacao; public String getUrl() { return url; } public void setUrl(String url) { this.url = url!=null?url.trim():url;; } public String getDescricao() { return descricao; } public void setDescricao(String descricao) { this.descricao = descricao!=null?descricao.trim():descricao; } public String getCategorizacao() { return categorizacao==null?"":categorizacao; } public void setCategorizacao(String categorizacao) { this.categorizacao = categorizacao; } public String getCriacao() { if (criacao != null) { return new SimpleDateFormat("dd/MM/yyyy").format(criacao); } return ""; } public void setCriacao(Date criacao) { this.criacao = criacao; } }
1,812
0.744199
0.729834
75
23.133333
21.114502
68
false
false
0
0
0
0
0
0
1.146667
false
false
3
b22935f7784ca722da4ff4652341196cdf85b742
2,611,340,181,574
d519da64b6ec7db0a3871993c2da60c46a9e594d
/app/src/main/java/com/example/Fund/bean/NetValue.java
61da2f7c6d97f7c4008a5f818dcb7842ff3249f0
[ "Apache-2.0" ]
permissive
guyon-better/Fund
https://github.com/guyon-better/Fund
c320e56e16549a27d02b29d8812bc4ba8f6f0e92
b01a7ff4dd594e8d6c4f7204d34775023237edf5
refs/heads/master
2021-05-30T07:58:02.139000
2015-08-19T03:51:40
2015-08-19T03:51:40
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.Fund.bean; /** * Created by Administrator on 2015/7/20 0020. */ public class NetValue { public String _row_id; public String code; public String curr_date; public float unit_net_value; public float total_net_value; public float increase; public float increase_rate; }
UTF-8
Java
321
java
NetValue.java
Java
[]
null
[]
package com.example.Fund.bean; /** * Created by Administrator on 2015/7/20 0020. */ public class NetValue { public String _row_id; public String code; public String curr_date; public float unit_net_value; public float total_net_value; public float increase; public float increase_rate; }
321
0.688474
0.654206
14
21.785715
13.779792
46
false
false
0
0
0
0
0
0
0.571429
false
false
3
77e5cee1821dba63975614bed12219e50ca0414d
31,688,268,730,475
e8942852b1ced982ac3275c24f3cb9078e370fd7
/proton-1.3-build20200607/a/฿᠗ȏ.java
751733a8b97fd6ad09480c7309308e30f9930a2a
[ "MIT" ]
permissive
Rxwr/AtomClient
https://github.com/Rxwr/AtomClient
959d5d3bf16acd08b5dd92654e0a3cb4d60e8e42
b963e01f06b23d18b7c473c048a6cc489a3fff40
refs/heads/master
2023-07-21T16:05:11.559000
2021-08-14T10:13:58
2021-08-14T10:13:58
388,284,918
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package a; import java.awt.Color; import kotlin.Metadata; import kotlin.jvm.JvmName; import kotlin.jvm.internal.DefaultConstructorMarker; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @Metadata( mv = {1, 1, 16}, bv = {1, 0, 3}, k = 1, d1 = {"\u0000(\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0006\n\u0002\b\u0004\n\u0002\u0010\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\b\u0017\u0018\u00002\u00020\u0018B'\u0012\n\b\u0002\u0010\u0013\u001a\u0004\u0018\u00010\u0001\u0012\b\b\u0002\u0010\u0014\u001a\u00020\u000b\u0012\b\b\u0002\u0010\u0015\u001a\u00020\b¢\u0006\u0004\b\u0016\u0010\u0017J\u000f\u0010\u0011\u001a\u00020\u0010H\u0016¢\u0006\u0004\b\u0011\u0010\u0012R(\u0010\u0006\u001a\u0004\u0018\u00010\u00018\u0007@\u0007X\u0086\u000e¢\u0006\u0012\n\u0004\b\u0002\u0010\u0003\u001a\u0004\b\u0004\u0010\u0005\"\u0004\b\u0006\u0010\u0007¨\u0006\u0086\u000eR \u0010\u0004\u001a\u00020\b8\u0017@\u0016X\u0096\u0004¢\u0006\f\n\u0004\b\u0006\u0010\t\u001a\u0004\b\u0006\u0010\n¨\u0006\u0096\u0004R&\u0010\u0002\u001a\u00020\u000b8\u0007@\u0007X\u0086\u000e¢\u0006\u0012\n\u0004\b\f\u0010\r\u001a\u0004\b\f\u0010\u000e\"\u0004\b\u0006\u0010\u000f¨\u0006\u0086\u000e"}, d2 = {"La/฿᠗ȏ;", "Ljava/awt/Color;", "u", "Ljava/awt/Color;", "ĂƂ", "()Ljava/awt/Color;", "ⲋ", "(Ljava/awt/Color;)V", "La/ė;", "La/ė;", "()La/ė;", "", "ᴃᎲ", "D", "()D", "(D)V", "", "b_", "()V", "p0", "p1", "p2", "<init>", "(Ljava/awt/Color;DLa/ė;)V", "La/Ữ;"} ) public class ฿᠗ȏ extends Ữ { @JvmName( name = "ⲋ" ) public ė ⲋ() { return this.ⲋ; } @JvmName( name = "ᴃᎲ" ) public final double ᴃᎲ() { return this.ᴃᎲ; } static { llIllIlllI(); } private static boolean llIlllIIIl(int var0) { return var0 == 0; } public void b_() { Color var10000 = llIIIlIIIIIllII.u; if (llIlllIIII(var10000)) { Color var1 = var10000; int var2 = llIlIlIIl[0]; int var3 = llIlIlIIl[0]; int var5 = llIlIlIIl[0]; if (llIlllIIIl(llIllIllll(llIIIlIIIIIllII.ᴃᎲ, 0.0D))) { ⲙ.ⲋ(0.0F, 0.0F, (float)llIIIlIIIIIllII.ⲡ().ⲋ(), (float)llIIIlIIIIIllII.ⲡ().ĂƂ(), var1); "".length(); if (" ".length() <= " ".length()) { return; } } else { ⲙ.ⲋ.ⲋ(0.0D, 0.0D, (double)llIIIlIIIIIllII.ⲡ().ⲋ(), (double)llIIIlIIIIIllII.ⲡ().ĂƂ(), llIIIlIIIIIllII.ᴃᎲ, var1); } "".length(); if (" ".length() == -" ".length()) { return; } } else { "".length(); } super.b_(); } private static int llIllIllll(double var0, double var2) { double var4; return (var4 = var0 - var2) == 0.0D ? 0 : (var4 < 0.0D ? -1 : 1); } public ฿᠗ȏ() { this((Color)null, 0.0D, (ė)null, llIlIlIIl[4], (DefaultConstructorMarker)null); } private static boolean llIlllIIII(Object var0) { return var0 != null; } public ฿᠗ȏ(@Nullable Color var1, double var2, @NotNull ė var4) { super(); this.u = var1; this.ᴃᎲ = var2; this.ⲋ = var4; } private static void llIllIlllI() { llIlIlIIl = new int[5]; llIlIlIIl[0] = (29 ^ 61) & ~(50 ^ 18); llIlIlIIl[1] = " ".length(); llIlIlIIl[2] = " ".length(); llIlIlIIl[3] = 99 + 73 - 116 + 76 ^ 15 + 35 - -66 + 12; llIlIlIIl[4] = 100 ^ 77 ^ 164 ^ 138; } @JvmName( name = "ⲋ" ) public final void ⲋ(@Nullable Color var1) { this.u = var1; } @JvmName( name = "ĂƂ" ) public final Color ĂƂ() { return this.u; } @JvmName( name = "ⲋ" ) public final void ⲋ(double var1) { this.ᴃᎲ = var1; } private static boolean llIlllIIlI(int var0) { return var0 != 0; } }
UTF-8
Java
4,004
java
฿᠗ȏ.java
Java
[]
null
[]
package a; import java.awt.Color; import kotlin.Metadata; import kotlin.jvm.JvmName; import kotlin.jvm.internal.DefaultConstructorMarker; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @Metadata( mv = {1, 1, 16}, bv = {1, 0, 3}, k = 1, d1 = {"\u0000(\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0006\n\u0002\b\u0004\n\u0002\u0010\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\b\u0017\u0018\u00002\u00020\u0018B'\u0012\n\b\u0002\u0010\u0013\u001a\u0004\u0018\u00010\u0001\u0012\b\b\u0002\u0010\u0014\u001a\u00020\u000b\u0012\b\b\u0002\u0010\u0015\u001a\u00020\b¢\u0006\u0004\b\u0016\u0010\u0017J\u000f\u0010\u0011\u001a\u00020\u0010H\u0016¢\u0006\u0004\b\u0011\u0010\u0012R(\u0010\u0006\u001a\u0004\u0018\u00010\u00018\u0007@\u0007X\u0086\u000e¢\u0006\u0012\n\u0004\b\u0002\u0010\u0003\u001a\u0004\b\u0004\u0010\u0005\"\u0004\b\u0006\u0010\u0007¨\u0006\u0086\u000eR \u0010\u0004\u001a\u00020\b8\u0017@\u0016X\u0096\u0004¢\u0006\f\n\u0004\b\u0006\u0010\t\u001a\u0004\b\u0006\u0010\n¨\u0006\u0096\u0004R&\u0010\u0002\u001a\u00020\u000b8\u0007@\u0007X\u0086\u000e¢\u0006\u0012\n\u0004\b\f\u0010\r\u001a\u0004\b\f\u0010\u000e\"\u0004\b\u0006\u0010\u000f¨\u0006\u0086\u000e"}, d2 = {"La/฿᠗ȏ;", "Ljava/awt/Color;", "u", "Ljava/awt/Color;", "ĂƂ", "()Ljava/awt/Color;", "ⲋ", "(Ljava/awt/Color;)V", "La/ė;", "La/ė;", "()La/ė;", "", "ᴃᎲ", "D", "()D", "(D)V", "", "b_", "()V", "p0", "p1", "p2", "<init>", "(Ljava/awt/Color;DLa/ė;)V", "La/Ữ;"} ) public class ฿᠗ȏ extends Ữ { @JvmName( name = "ⲋ" ) public ė ⲋ() { return this.ⲋ; } @JvmName( name = "ᴃᎲ" ) public final double ᴃᎲ() { return this.ᴃᎲ; } static { llIllIlllI(); } private static boolean llIlllIIIl(int var0) { return var0 == 0; } public void b_() { Color var10000 = llIIIlIIIIIllII.u; if (llIlllIIII(var10000)) { Color var1 = var10000; int var2 = llIlIlIIl[0]; int var3 = llIlIlIIl[0]; int var5 = llIlIlIIl[0]; if (llIlllIIIl(llIllIllll(llIIIlIIIIIllII.ᴃᎲ, 0.0D))) { ⲙ.ⲋ(0.0F, 0.0F, (float)llIIIlIIIIIllII.ⲡ().ⲋ(), (float)llIIIlIIIIIllII.ⲡ().ĂƂ(), var1); "".length(); if (" ".length() <= " ".length()) { return; } } else { ⲙ.ⲋ.ⲋ(0.0D, 0.0D, (double)llIIIlIIIIIllII.ⲡ().ⲋ(), (double)llIIIlIIIIIllII.ⲡ().ĂƂ(), llIIIlIIIIIllII.ᴃᎲ, var1); } "".length(); if (" ".length() == -" ".length()) { return; } } else { "".length(); } super.b_(); } private static int llIllIllll(double var0, double var2) { double var4; return (var4 = var0 - var2) == 0.0D ? 0 : (var4 < 0.0D ? -1 : 1); } public ฿᠗ȏ() { this((Color)null, 0.0D, (ė)null, llIlIlIIl[4], (DefaultConstructorMarker)null); } private static boolean llIlllIIII(Object var0) { return var0 != null; } public ฿᠗ȏ(@Nullable Color var1, double var2, @NotNull ė var4) { super(); this.u = var1; this.ᴃᎲ = var2; this.ⲋ = var4; } private static void llIllIlllI() { llIlIlIIl = new int[5]; llIlIlIIl[0] = (29 ^ 61) & ~(50 ^ 18); llIlIlIIl[1] = " ".length(); llIlIlIIl[2] = " ".length(); llIlIlIIl[3] = 99 + 73 - 116 + 76 ^ 15 + 35 - -66 + 12; llIlIlIIl[4] = 100 ^ 77 ^ 164 ^ 138; } @JvmName( name = "ⲋ" ) public final void ⲋ(@Nullable Color var1) { this.u = var1; } @JvmName( name = "ĂƂ" ) public final Color ĂƂ() { return this.u; } @JvmName( name = "ⲋ" ) public final void ⲋ(double var1) { this.ᴃᎲ = var1; } private static boolean llIlllIIlI(int var0) { return var0 != 0; } }
4,004
0.581252
0.402781
121
31.09091
93.218483
996
false
false
0
0
42
0.063353
0
0
0.842975
false
false
3
e10f1fe09ab1d96079dc336cd128a051ee4da5cf
32,083,405,710,802
1b371ae3b4ee6e6647af28aaee875dd0db413a81
/Assignment 6/Assignment6.java
51b30452d1552768fb4901b9be151efb336a18e0
[]
no_license
ConnorBaker/CSC201
https://github.com/ConnorBaker/CSC201
7a2b2cf09a48a7ce802c8d7f69f1e03e1dba9f28
950828914d2160f780e093447fed93413c36aadf
refs/heads/master
2021-01-10T17:40:01.049000
2016-04-30T03:25:38
2016-04-30T03:25:38
54,502,345
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Author: Connor Baker * Version: 0.4a * Created: March 30, 2016 * Last Updated: April 2, 2016 * * Description: Book Assignment 10.13, from "Introduction to Java Programming: * Brief Version, 10th Edition" by Y. Daniel Liang. * * Geometry: the MyRectangle2D class * * Define it so that it contains: * * Two double data fields names x and y that specify the center of the rectangle * with getter and setter methods. (Assume that the rectangle sides are parallel * to the x-or-y axes.) * * The data fields width and height with getter and setter methods. * * A no-arg constructor that creates a default rectangle with (0,0) for (x,y) and * 1 for both width and height. * * A constructor that creates a rectangle with the specified x, y , width, and * height. * * A method getArea() that returns the area of the rectangle. * * A method getPerimeter() that returns the perimeter of the rectangle. * * A method contains(double x, double y) that returns true if the specified * point (x,y) is inside the rectangle. * * A method contains(MyRectangle2D r) that returns true if the specified * rectangle is inside this rectangle. * * A method overlaps(MyRectangle2D r) that returns true if the specified * rectangle overlaps with this rectangle. * * Special Requirements: * Name your class "MyRectangle2D.java" * Make the "no argument" constructor of your class output your first and last * name. * Write methods getX, getY, getWidth, getHeight that return the appropriate * property. * Write methods setX, setY, setWidth, setHeight that set the appropriate * property. * The "overlaps" method is not required. If you do it, you can earn up to 5 * points extra credit. * * TODO: Check for negative lengths. */ public class Assignment6 { public static void main(String[] args) { if (args.length == 0) { System.out.println("Connor Baker"); MyRectangle2D noargRectangle = new MyRectangle2D(); } else if (args.length == 4) { MyRectangle2D argRectangle = new MyRectangle2D(Double.parseDouble(args[0]), Double.parseDouble(args[1]), Double.parseDouble(args[2]), Double.parseDouble(args[3])); } else { System.out.println("Incorrect number of arguments."); System.out.println("Accepted arguments are x y width height"); System.out.println("Example:"); System.out.println("java Assignment6 1.0 2.0 3.0 4.0"); } } }
UTF-8
Java
2,459
java
Assignment6.java
Java
[ { "context": "/*\n* Author: Connor Baker\n* Version: 0.4a\n* Created: March 30, 2016\n* La", "end": 26, "score": 0.9998676180839539, "start": 14, "tag": "NAME", "value": "Connor Baker" }, { "context": "va Programming:\n* Brief Version, 10th Edition\" by Y. Daniel Liang.\n*\n* Geometry: the MyRectangle2D class\n*\n* Defi", "end": 233, "score": 0.9907803535461426, "start": 218, "tag": "NAME", "value": "Y. Daniel Liang" }, { "context": "if (args.length == 0) {\n System.out.println(\"Connor Baker\");\n MyRectangle2D noargRectangle = new MyRec", "end": 1878, "score": 0.999846875667572, "start": 1866, "tag": "NAME", "value": "Connor Baker" } ]
null
[]
/* * Author: <NAME> * Version: 0.4a * Created: March 30, 2016 * Last Updated: April 2, 2016 * * Description: Book Assignment 10.13, from "Introduction to Java Programming: * Brief Version, 10th Edition" by <NAME>. * * Geometry: the MyRectangle2D class * * Define it so that it contains: * * Two double data fields names x and y that specify the center of the rectangle * with getter and setter methods. (Assume that the rectangle sides are parallel * to the x-or-y axes.) * * The data fields width and height with getter and setter methods. * * A no-arg constructor that creates a default rectangle with (0,0) for (x,y) and * 1 for both width and height. * * A constructor that creates a rectangle with the specified x, y , width, and * height. * * A method getArea() that returns the area of the rectangle. * * A method getPerimeter() that returns the perimeter of the rectangle. * * A method contains(double x, double y) that returns true if the specified * point (x,y) is inside the rectangle. * * A method contains(MyRectangle2D r) that returns true if the specified * rectangle is inside this rectangle. * * A method overlaps(MyRectangle2D r) that returns true if the specified * rectangle overlaps with this rectangle. * * Special Requirements: * Name your class "MyRectangle2D.java" * Make the "no argument" constructor of your class output your first and last * name. * Write methods getX, getY, getWidth, getHeight that return the appropriate * property. * Write methods setX, setY, setWidth, setHeight that set the appropriate * property. * The "overlaps" method is not required. If you do it, you can earn up to 5 * points extra credit. * * TODO: Check for negative lengths. */ public class Assignment6 { public static void main(String[] args) { if (args.length == 0) { System.out.println("<NAME>"); MyRectangle2D noargRectangle = new MyRectangle2D(); } else if (args.length == 4) { MyRectangle2D argRectangle = new MyRectangle2D(Double.parseDouble(args[0]), Double.parseDouble(args[1]), Double.parseDouble(args[2]), Double.parseDouble(args[3])); } else { System.out.println("Incorrect number of arguments."); System.out.println("Accepted arguments are x y width height"); System.out.println("Example:"); System.out.println("java Assignment6 1.0 2.0 3.0 4.0"); } } }
2,438
0.694998
0.675884
71
33.633804
28.515989
81
false
false
0
0
0
0
0
0
0.394366
false
false
3
599b287793b0ae1ff7c4f48254f7dd9f914fd0e5
28,509,992,951,922
9f1356e1db91caa8edb3f222ba377de8f9af1ff3
/Tests & Demos/Shape/Circle.java
d469a9bed6c3ffcec8943857be97dc5c7e4c69bf
[]
no_license
arzafiruddin/APCompSciA
https://github.com/arzafiruddin/APCompSciA
5102de86025d82d4b5b7e2e0f7b1fa2853c169c1
b8d627528667e387783e90fe078fc42db669007a
refs/heads/main
2023-06-20T15:08:38.159000
2021-07-17T21:08:51
2021-07-17T21:08:51
386,317,810
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class Circle extends Shape { private double radius; public Circle(double r) { super(); radius = r; } public Circle(String nm, double r) { super(nm); radius = r; } public double getRadius() { return radius; } public double area() { return Math.PI*(Math.pow(radius, 2)); } public double perimeter() { return 2*(Math.PI*radius); } public String toString() { return "Name: " + this.getName() + " + Radius: " + radius; } }
UTF-8
Java
559
java
Circle.java
Java
[]
null
[]
public class Circle extends Shape { private double radius; public Circle(double r) { super(); radius = r; } public Circle(String nm, double r) { super(nm); radius = r; } public double getRadius() { return radius; } public double area() { return Math.PI*(Math.pow(radius, 2)); } public double perimeter() { return 2*(Math.PI*radius); } public String toString() { return "Name: " + this.getName() + " + Radius: " + radius; } }
559
0.515206
0.511628
30
17.666666
15.490499
66
false
false
0
0
0
0
0
0
0.366667
false
false
3
1dcbf2a925e7c761dba43d288b196b791f28d53a
4,973,572,155,563
6ff6d330c6799e45ff76a0faea4ae578963de055
/src/com/majong/structure/Grid.java
be44cbcb592d3e5b2aecf310f2d25cdfaeb8b6d6
[]
no_license
jazeren1/majong
https://github.com/jazeren1/majong
25e5abf677a96e13309c9b69e9f7fe3a81f1cdf8
d819321cb63abdb4c13d010f12a850f76609dbf9
refs/heads/master
2020-04-27T07:46:27.947000
2012-12-30T20:02:40
2012-12-30T20:02:40
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.majong.structure; public class Grid { private int _rows; private int _columns; private String[][] _fullGrid; public Grid(int rows, int columns){ _rows = rows; _columns = columns; _fullGrid = new String[rows][columns]; } public int getRows(){ return _rows; } public void setRows(int rows){ _rows = rows; } public int getColumns(){ return _columns; } public void setColumns(int columns){ _columns = columns; } public String[][] getFullGrid(){ return _fullGrid; } public void setFullGrid(String[][] fullGrid){ _fullGrid = fullGrid; } }
UTF-8
Java
575
java
Grid.java
Java
[]
null
[]
package com.majong.structure; public class Grid { private int _rows; private int _columns; private String[][] _fullGrid; public Grid(int rows, int columns){ _rows = rows; _columns = columns; _fullGrid = new String[rows][columns]; } public int getRows(){ return _rows; } public void setRows(int rows){ _rows = rows; } public int getColumns(){ return _columns; } public void setColumns(int columns){ _columns = columns; } public String[][] getFullGrid(){ return _fullGrid; } public void setFullGrid(String[][] fullGrid){ _fullGrid = fullGrid; } }
575
0.68
0.68
24
22.958334
21.064344
70
false
false
0
0
0
0
0
0
1.541667
false
false
3
39ecfbcef7b7f34b0f1fba645526192c891f96af
15,977,278,407,914
99e284fe8bbc585fe0723067c00b0c2ec827ec75
/ddd-mizukami/src/main/java/eight/biz/domain/businessLock/BusinessLocked.java
3f7aea5b92fc63d90952e07f73e88c9f44f9b6cb
[]
no_license
AgileDevelopmentClub/DDD
https://github.com/AgileDevelopmentClub/DDD
8547d533eb9a11f751a04a502f9566a5815541d7
3f4ef42bd5feebd9ebaaf7478603e232dea8948a
refs/heads/master
2020-08-20T14:25:06.207000
2019-12-12T16:46:45
2019-12-12T16:46:45
216,033,674
1
0
null
true
2019-10-18T13:45:26
2019-10-18T13:45:26
2019-10-16T15:55:33
2019-10-16T15:55:31
219
0
0
0
null
false
false
package eight.biz.domain.businessLock; import eight.biz.repository.BusinessLockRepository; import lombok.Data; import lombok.RequiredArgsConstructor; public interface BusinessLocked { void lockedCheck(RootBusinessLock rootBusinessLock); }
UTF-8
Java
244
java
BusinessLocked.java
Java
[]
null
[]
package eight.biz.domain.businessLock; import eight.biz.repository.BusinessLockRepository; import lombok.Data; import lombok.RequiredArgsConstructor; public interface BusinessLocked { void lockedCheck(RootBusinessLock rootBusinessLock); }
244
0.844262
0.844262
10
23.4
20.929405
54
false
false
0
0
0
0
0
0
0.5
false
false
3
5554b24760a700575bc547a40cfe602ea63a4d54
13,108,240,245,069
5f106265ead618312810d123c10b87c9b7966878
/src/com/human/ex/class1.java
9b92ded184c3250d29dde845fd7a714005d124f7
[]
no_license
cndustjd2000/2020-05-11
https://github.com/cndustjd2000/2020-05-11
f9b7fc84a2bb9d102f79dcb5e4e7ae3cbe8e38c4
d90a3ffba10cc2379e2de228eb75d1541296f6b6
refs/heads/master
2022-06-19T17:49:54.087000
2020-05-07T02:58:03
2020-05-07T02:58:03
262,904,422
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.human.ex; public abstract class class1{ int num; String str; public class1() { System.out.println("AbstractClassEX constructor"); } public class1(int i, String s) { System.out.println("AbstractClassEX constructor"); this.num=i; this.str=s; } public void fun1() { System.out.println(" -- fun1() Start -- "); } public abstract void fun2(); public static void main(String[] args) { class1 ex=new ClassEx(10,"Java"); ex.fun1(); ex.fun2(); } }
UTF-8
Java
529
java
class1.java
Java
[]
null
[]
package com.human.ex; public abstract class class1{ int num; String str; public class1() { System.out.println("AbstractClassEX constructor"); } public class1(int i, String s) { System.out.println("AbstractClassEX constructor"); this.num=i; this.str=s; } public void fun1() { System.out.println(" -- fun1() Start -- "); } public abstract void fun2(); public static void main(String[] args) { class1 ex=new ClassEx(10,"Java"); ex.fun1(); ex.fun2(); } }
529
0.603025
0.582231
32
14.53125
16.240353
52
false
false
0
0
0
0
0
0
1.5625
false
false
3
a713c1942d1345bf57bcc718b4e1b3f164c459da
2,817,498,549,335
55040e239d2a4c4ac177d298354212d7115e1552
/src/main/java/br/com/portovelho/upa24h/service/AtendimentoIdentificadoService.java
1f2d3119338b950000066302bf64ac9061673992
[]
no_license
PauloJorgeJunior/upa24hSpringBoot
https://github.com/PauloJorgeJunior/upa24hSpringBoot
fd4280dd789bc0bedc9dfc250545e994e806be32
29da41adf9e351b7096d6fe570d47be6766f3eab
refs/heads/master
2021-01-12T17:05:51.644000
2016-10-19T14:17:52
2016-10-19T14:17:52
71,503,016
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.portovelho.upa24h.service; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import br.com.portovelho.upa24h.model.AtendimentoIdentificado; import br.com.portovelho.upa24h.repository.PacientesRepository; import br.com.portovelho.upa24h.repository.filter.AtendimentoIdentificadoFiltro; @Service public class AtendimentoIdentificadoService { /*@Autowired private AtendimentoIdentificadoRepository atendimentoIdentificadoRepository;*/ @Autowired private PacientesRepository pacientesRepository; public List<AtendimentoIdentificado> filtrar(AtendimentoIdentificadoFiltro filtro) { String nome = filtro.getNomeCompleto() == null ? "%" : filtro.getNomeCompleto(); return pacientesRepository.findByNomeCompletoContainingOrderByNomeCompletoAsc(nome); } }
UTF-8
Java
864
java
AtendimentoIdentificadoService.java
Java
[]
null
[]
package br.com.portovelho.upa24h.service; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import br.com.portovelho.upa24h.model.AtendimentoIdentificado; import br.com.portovelho.upa24h.repository.PacientesRepository; import br.com.portovelho.upa24h.repository.filter.AtendimentoIdentificadoFiltro; @Service public class AtendimentoIdentificadoService { /*@Autowired private AtendimentoIdentificadoRepository atendimentoIdentificadoRepository;*/ @Autowired private PacientesRepository pacientesRepository; public List<AtendimentoIdentificado> filtrar(AtendimentoIdentificadoFiltro filtro) { String nome = filtro.getNomeCompleto() == null ? "%" : filtro.getNomeCompleto(); return pacientesRepository.findByNomeCompletoContainingOrderByNomeCompletoAsc(nome); } }
864
0.840278
0.831019
26
32.23077
32.640594
86
false
false
0
0
0
0
0
0
0.846154
false
false
5
04680343a74be48c94506db2c4291f0b1de0e07e
5,506,148,143,553
c300558503cf75237950b8211a8a164716c0ca6c
/src/trainingcentersystem/Admin.java
b50ceb27b6ec66e9c706189eaa35023867bd8730
[]
no_license
YoussefRashad/Training-Center-System
https://github.com/YoussefRashad/Training-Center-System
8c07c0fc01a6e9f87f61e68ffe297fa174429278
5b627eecae07a7103024a49ab7537ed1e239d92c
refs/heads/master
2020-04-20T20:58:48.848000
2019-02-04T14:50:00
2019-02-04T14:50:00
169,093,676
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package trainingcentersystem; import java.io.Serializable; import java.util.ArrayList; public class Admin extends Person/* implements Serializable*/{ private ArrayList<Admin>admins = new ArrayList<Admin>(); private String FilePath = "Admin.txt"; public Admin() { } public Admin(int ID, String Name, String Tel, String Email, String Pass) { super(ID, Name, Tel, Email, Pass); } public void loadFromFile() { admins =(ArrayList<Admin>)(Object) FManger.Read(FilePath); } public boolean searchAdmin(int id) { loadFromFile(); for(Admin ad : admins) if(ad.ID==id) return true; return false; } public Admin getAdmin(int id) { loadFromFile(); for(Admin ad : admins) if(ad.ID==id) return ad; return null; } public int getIndexAdmin(int id) { for(int i=0;i<admins.size();i++) if(admins.get(i).ID==id) return i; return -1; } public boolean addAdmin() { //loadFromFile(); if(FManger.Write(this.getAdminFile(), FilePath, true)) return true; return false; //return commitToFile(); } public void commitToFile() { FManger.Write(admins.get(0).getAdminFile(), FilePath, false); for(int i=1;i<admins.size();i++) FManger.Write(admins.get(i).getAdminFile(), FilePath, true); //return FManger.Write(FilePath, admins); } public String getAdminFile() { return this.ID+"`"+this.Name+"`"+this.Email+"`"+this.Pass+"`"+this.Tel+"`"; } public boolean editAdmin(int id) { if(searchAdmin(id)){ int index = getIndexAdmin(id); admins.set(index, this); commitToFile(); return true; //return commitToFile(); } return false; } public boolean removeAdmin(int id) { if(searchAdmin(id)){ int index = getIndexAdmin(id); admins.remove(index); commitToFile(); return true; //return commitToFile(); } return false; } public ArrayList<Admin> ListAllAdmin() { loadFromFile(); return admins; } public boolean logIn(String Email , String Pass) { if(Email.equals("Admin@yahoo.com")&&Pass.equals("12345678")) return true; loadFromFile(); for(Admin ad:admins) if(ad.Email.equals(Email)&&ad.Pass.equals(Pass)) return true; return false; } public boolean dublicate(int ID) { loadFromFile(); for(Admin t : admins) if(t.ID==ID) return true; return false; } }
UTF-8
Java
2,871
java
Admin.java
Java
[ { "context": "ail , String Pass)\n {\n if(Email.equals(\"Admin@yahoo.com\")&&Pass.equals(\"12345678\"))\n return tr", "end": 2460, "score": 0.999917209148407, "start": 2445, "tag": "EMAIL", "value": "Admin@yahoo.com" }, { "context": " if(Email.equals(\"Admin@yahoo.com\")&&Pass.equals(\"12345678\"))\n return true;\n loadFromFile(", "end": 2485, "score": 0.9994020462036133, "start": 2477, "tag": "PASSWORD", "value": "12345678" } ]
null
[]
package trainingcentersystem; import java.io.Serializable; import java.util.ArrayList; public class Admin extends Person/* implements Serializable*/{ private ArrayList<Admin>admins = new ArrayList<Admin>(); private String FilePath = "Admin.txt"; public Admin() { } public Admin(int ID, String Name, String Tel, String Email, String Pass) { super(ID, Name, Tel, Email, Pass); } public void loadFromFile() { admins =(ArrayList<Admin>)(Object) FManger.Read(FilePath); } public boolean searchAdmin(int id) { loadFromFile(); for(Admin ad : admins) if(ad.ID==id) return true; return false; } public Admin getAdmin(int id) { loadFromFile(); for(Admin ad : admins) if(ad.ID==id) return ad; return null; } public int getIndexAdmin(int id) { for(int i=0;i<admins.size();i++) if(admins.get(i).ID==id) return i; return -1; } public boolean addAdmin() { //loadFromFile(); if(FManger.Write(this.getAdminFile(), FilePath, true)) return true; return false; //return commitToFile(); } public void commitToFile() { FManger.Write(admins.get(0).getAdminFile(), FilePath, false); for(int i=1;i<admins.size();i++) FManger.Write(admins.get(i).getAdminFile(), FilePath, true); //return FManger.Write(FilePath, admins); } public String getAdminFile() { return this.ID+"`"+this.Name+"`"+this.Email+"`"+this.Pass+"`"+this.Tel+"`"; } public boolean editAdmin(int id) { if(searchAdmin(id)){ int index = getIndexAdmin(id); admins.set(index, this); commitToFile(); return true; //return commitToFile(); } return false; } public boolean removeAdmin(int id) { if(searchAdmin(id)){ int index = getIndexAdmin(id); admins.remove(index); commitToFile(); return true; //return commitToFile(); } return false; } public ArrayList<Admin> ListAllAdmin() { loadFromFile(); return admins; } public boolean logIn(String Email , String Pass) { if(Email.equals("<EMAIL>")&&Pass.equals("<PASSWORD>")) return true; loadFromFile(); for(Admin ad:admins) if(ad.Email.equals(Email)&&ad.Pass.equals(Pass)) return true; return false; } public boolean dublicate(int ID) { loadFromFile(); for(Admin t : admins) if(t.ID==ID) return true; return false; } }
2,865
0.532915
0.528736
115
23.939131
19.084839
83
false
false
0
0
0
0
0
0
0.565217
false
false
5
4bcbedbbb827f881b95698d6ea47a898d2e26251
15,350,213,177,765
4bbe8f933513cf105bb5a3a59c8a683329448452
/src/main/java/com/neuedu/credit/pojo/Governpunish.java
fb6afb7252abca7825fe58859484016d213dd8c2
[]
no_license
yinmaoning55/credit
https://github.com/yinmaoning55/credit
029eee5f9cfbbc60757bb878d1a0eb7824e2f687
49580ae87670b6c3889b6b8a5e8059c642fae136
refs/heads/master
2020-05-15T01:45:09.479000
2019-04-18T07:16:31
2019-04-18T07:16:31
182,036,430
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.neuedu.credit.pojo; import javax.persistence.*; import java.sql.Date; import java.util.Objects; /** * @Created by elvin on 2018/9/21 10:22. * @Describe: */ @Entity @Table(name = "governpunish", schema = "edu_credit", catalog = "") public class Governpunish { private static final String TAG = "Governpunish"; private int id; private int entId; private String decidedocnum; private String decidegovernment; private Date decidedate; private String decidetype; private String content; private String remark; @Id @Column(name = "id") public int getId() { return id; } public void setId(int id) { this.id = id; } @Basic @Column(name = "ent_id") public int getEntId() { return entId; } public void setEntId(int entId) { this.entId = entId; } @Basic @Column(name = "decidedocnum") public String getDecidedocnum() { return decidedocnum; } public void setDecidedocnum(String decidedocnum) { this.decidedocnum = decidedocnum; } @Basic @Column(name = "decidegovernment") public String getDecidegovernment() { return decidegovernment; } public void setDecidegovernment(String decidegovernment) { this.decidegovernment = decidegovernment; } @Basic @Column(name = "decidedate") public Date getDecidedate() { return decidedate; } public void setDecidedate(Date decidedate) { this.decidedate = decidedate; } @Basic @Column(name = "decidetype") public String getDecidetype() { return decidetype; } public void setDecidetype(String decidetype) { this.decidetype = decidetype; } @Basic @Column(name = "content") public String getContent() { return content; } public void setContent(String content) { this.content = content; } @Basic @Column(name = "remark") public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Governpunish that = (Governpunish) o; return id == that.id && entId == that.entId && Objects.equals(decidedocnum, that.decidedocnum) && Objects.equals(decidegovernment, that.decidegovernment) && Objects.equals(decidedate, that.decidedate) && Objects.equals(decidetype, that.decidetype) && Objects.equals(content, that.content) && Objects.equals(remark, that.remark); } @Override public int hashCode() { return Objects.hash(id, entId, decidedocnum, decidegovernment, decidedate, decidetype, content, remark); } }
UTF-8
Java
2,958
java
Governpunish.java
Java
[ { "context": "ate;\nimport java.util.Objects;\n\n/**\n * @Created by elvin on 2018/9/21 10:22.\n * @Describe:\n */\n@Entity\n@Ta", "end": 134, "score": 0.9840689897537231, "start": 129, "tag": "USERNAME", "value": "elvin" } ]
null
[]
package com.neuedu.credit.pojo; import javax.persistence.*; import java.sql.Date; import java.util.Objects; /** * @Created by elvin on 2018/9/21 10:22. * @Describe: */ @Entity @Table(name = "governpunish", schema = "edu_credit", catalog = "") public class Governpunish { private static final String TAG = "Governpunish"; private int id; private int entId; private String decidedocnum; private String decidegovernment; private Date decidedate; private String decidetype; private String content; private String remark; @Id @Column(name = "id") public int getId() { return id; } public void setId(int id) { this.id = id; } @Basic @Column(name = "ent_id") public int getEntId() { return entId; } public void setEntId(int entId) { this.entId = entId; } @Basic @Column(name = "decidedocnum") public String getDecidedocnum() { return decidedocnum; } public void setDecidedocnum(String decidedocnum) { this.decidedocnum = decidedocnum; } @Basic @Column(name = "decidegovernment") public String getDecidegovernment() { return decidegovernment; } public void setDecidegovernment(String decidegovernment) { this.decidegovernment = decidegovernment; } @Basic @Column(name = "decidedate") public Date getDecidedate() { return decidedate; } public void setDecidedate(Date decidedate) { this.decidedate = decidedate; } @Basic @Column(name = "decidetype") public String getDecidetype() { return decidetype; } public void setDecidetype(String decidetype) { this.decidetype = decidetype; } @Basic @Column(name = "content") public String getContent() { return content; } public void setContent(String content) { this.content = content; } @Basic @Column(name = "remark") public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Governpunish that = (Governpunish) o; return id == that.id && entId == that.entId && Objects.equals(decidedocnum, that.decidedocnum) && Objects.equals(decidegovernment, that.decidegovernment) && Objects.equals(decidedate, that.decidedate) && Objects.equals(decidetype, that.decidetype) && Objects.equals(content, that.content) && Objects.equals(remark, that.remark); } @Override public int hashCode() { return Objects.hash(id, entId, decidedocnum, decidegovernment, decidedate, decidetype, content, remark); } }
2,958
0.609195
0.605477
124
22.854839
20.504009
112
false
false
0
0
0
0
0
0
0.41129
false
false
5
9fa25c49ff3fa6cd32179d764da51633637a6c6e
15,547,781,669,610
d094fdcfc264e03978a843fa8a90b2fd531718d4
/src/ast/IfElse.java
f61753a630904e69e8465bafc14064fb1dae5f6b
[]
no_license
alcalaperez/Dlp-2016-2017
https://github.com/alcalaperez/Dlp-2016-2017
5cf5541480cd67ddfe137023c473e623384c58fe
c83e2fe6cef4d1835eba9c22178f7eb2a545afae
refs/heads/master
2021-01-21T22:06:29.580000
2017-06-23T14:06:25
2017-06-23T14:06:25
95,170,706
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * @generated VGen 1.3.3 */ package ast; import java.util.*; import visitor.*; // ifElse:cuerpoMetodo -> condicion:expresion cuerpoIf:cuerpoMetodo* cuerpoElse:cuerpoMetodo* public class IfElse extends AbstractCuerpoMetodo { public IfElse(Expresion condicion, List<CuerpoMetodo> cuerpoIf, List<CuerpoMetodo> cuerpoElse) { this.condicion = condicion; this.cuerpoIf = cuerpoIf; this.cuerpoElse = cuerpoElse; searchForPositions(condicion, cuerpoIf, cuerpoElse); // Obtener linea/columna a partir de los hijos } @SuppressWarnings("unchecked") public IfElse(Object condicion, Object cuerpoIf, Object cuerpoElse) { this.condicion = (Expresion) condicion; this.cuerpoIf = (List<CuerpoMetodo>) cuerpoIf; this.cuerpoElse = (List<CuerpoMetodo>) cuerpoElse; searchForPositions(condicion, cuerpoIf, cuerpoElse); // Obtener linea/columna a partir de los hijos } public Expresion getCondicion() { return condicion; } public void setCondicion(Expresion condicion) { this.condicion = condicion; } public List<CuerpoMetodo> getCuerpoIf() { return cuerpoIf; } public void setCuerpoIf(List<CuerpoMetodo> cuerpoIf) { this.cuerpoIf = cuerpoIf; } public List<CuerpoMetodo> getCuerpoElse() { return cuerpoElse; } public void setCuerpoElse(List<CuerpoMetodo> cuerpoElse) { this.cuerpoElse = cuerpoElse; } @Override public Object accept(Visitor v, Object param) { return v.visit(this, param); } private Expresion condicion; private List<CuerpoMetodo> cuerpoIf; private List<CuerpoMetodo> cuerpoElse; }
UTF-8
Java
1,553
java
IfElse.java
Java
[]
null
[]
/** * @generated VGen 1.3.3 */ package ast; import java.util.*; import visitor.*; // ifElse:cuerpoMetodo -> condicion:expresion cuerpoIf:cuerpoMetodo* cuerpoElse:cuerpoMetodo* public class IfElse extends AbstractCuerpoMetodo { public IfElse(Expresion condicion, List<CuerpoMetodo> cuerpoIf, List<CuerpoMetodo> cuerpoElse) { this.condicion = condicion; this.cuerpoIf = cuerpoIf; this.cuerpoElse = cuerpoElse; searchForPositions(condicion, cuerpoIf, cuerpoElse); // Obtener linea/columna a partir de los hijos } @SuppressWarnings("unchecked") public IfElse(Object condicion, Object cuerpoIf, Object cuerpoElse) { this.condicion = (Expresion) condicion; this.cuerpoIf = (List<CuerpoMetodo>) cuerpoIf; this.cuerpoElse = (List<CuerpoMetodo>) cuerpoElse; searchForPositions(condicion, cuerpoIf, cuerpoElse); // Obtener linea/columna a partir de los hijos } public Expresion getCondicion() { return condicion; } public void setCondicion(Expresion condicion) { this.condicion = condicion; } public List<CuerpoMetodo> getCuerpoIf() { return cuerpoIf; } public void setCuerpoIf(List<CuerpoMetodo> cuerpoIf) { this.cuerpoIf = cuerpoIf; } public List<CuerpoMetodo> getCuerpoElse() { return cuerpoElse; } public void setCuerpoElse(List<CuerpoMetodo> cuerpoElse) { this.cuerpoElse = cuerpoElse; } @Override public Object accept(Visitor v, Object param) { return v.visit(this, param); } private Expresion condicion; private List<CuerpoMetodo> cuerpoIf; private List<CuerpoMetodo> cuerpoElse; }
1,553
0.751449
0.749517
61
24.442623
27.404993
101
false
false
0
0
0
0
0
0
1.442623
false
false
5
893b2a9b2155539b9c4229703ba3364456c5fc48
23,648,089,973,020
4e70e5b66cfe3a4b403d85b4e303cb0463ada332
/app/src/main/java/com/farias/fariastpintegrador/ui/contrato/ContratoFragment.java
9e62e2f9dc753efbd998f98fc1dd8a46584e2fe4
[]
no_license
gfsanluis78/FariasTpIntegrador
https://github.com/gfsanluis78/FariasTpIntegrador
70df6eb5173cbc04600eba35e8ecf4fae8590255
2aca777fe66c2d7194e5adc4dd90440ee7f1e2a8
refs/heads/master
2023-08-23T07:53:14.845000
2021-10-03T16:12:52
2021-10-03T16:12:52
406,534,765
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.farias.fariastpintegrador.ui.contrato; import androidx.lifecycle.ViewModelProvider; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.farias.fariastpintegrador.R; import com.farias.fariastpintegrador.ui.contrato.adapter.RecyclerAdapterContratos; public class ContratoFragment extends Fragment { private ContratoViewModel model; private RecyclerView recyclerView; public static ContratoFragment newInstance() { return new ContratoFragment(); } @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_contrato,container,false); model = new ViewModelProvider(this).get(ContratoViewModel.class); recyclerView = view.findViewById(R.id.RV_Contratos); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL,false); model.getInmuebles().observe( getViewLifecycleOwner(), inmuebles -> { RecyclerAdapterContratos mAdapter = new RecyclerAdapterContratos(getContext(), inmuebles); recyclerView.setLayoutManager(linearLayoutManager); recyclerView.setAdapter(mAdapter); }); model.setInmuebles(); return view; } @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); } }
UTF-8
Java
1,820
java
ContratoFragment.java
Java
[]
null
[]
package com.farias.fariastpintegrador.ui.contrato; import androidx.lifecycle.ViewModelProvider; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.farias.fariastpintegrador.R; import com.farias.fariastpintegrador.ui.contrato.adapter.RecyclerAdapterContratos; public class ContratoFragment extends Fragment { private ContratoViewModel model; private RecyclerView recyclerView; public static ContratoFragment newInstance() { return new ContratoFragment(); } @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_contrato,container,false); model = new ViewModelProvider(this).get(ContratoViewModel.class); recyclerView = view.findViewById(R.id.RV_Contratos); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL,false); model.getInmuebles().observe( getViewLifecycleOwner(), inmuebles -> { RecyclerAdapterContratos mAdapter = new RecyclerAdapterContratos(getContext(), inmuebles); recyclerView.setLayoutManager(linearLayoutManager); recyclerView.setAdapter(mAdapter); }); model.setInmuebles(); return view; } @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); } }
1,820
0.750549
0.750549
55
32.109093
31.312891
124
false
false
0
0
0
0
0
0
0.636364
false
false
5
ff19edf472a3c2ae586fd25255c855f88a27d29e
1,563,368,159,114
b27e8ce5247869fa9fee54e063e2891cf8dc8adb
/tags/YAJOGLB-0-4/YAJOGLB/DIR/sun/awt/windows/WindowspDataAccess.java
cd6d26965cc6c4245113a271ac8c922ab1a436d0
[]
no_license
BackupTheBerlios/yajoglb-svn
https://github.com/BackupTheBerlios/yajoglb-svn
d2fdefd035a5d37ef0f4a14a7b46555e4787f877
3ec2d2d761ee961b9726c817a17de7157edea972
refs/heads/master
2016-09-06T15:13:12.798000
2005-02-05T13:03:03
2005-02-05T13:03:03
40,801,680
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * $Id: WindowspDataAccess.java,v 1.6 1999/05/22 15:30:39 razeh Exp $ * * Taken (and then modified) from jogl-0.7 * */ package sun.awt.windows; import sun.awt.DrawingSurface; import sun.awt.DrawingSurfaceInfo; import sun.awt.windows.*; import sun.awt.Win32DrawingSurface; import OpenGL.OpenGLpDataAccess; import OpenGL.OpenGLCanvas; import java.awt.Graphics; import java.awt.Canvas; import java.awt.peer.*; /** * This class is used to access the raw window pointer and device * context from a canvas object. It will, of course, only function * under windows. * * @author Robert Allan Zeh (razeh@balr.com) * * @version 0.3 */ public class WindowspDataAccess implements OpenGLpDataAccess { /** Invoked by our OpenGLCanvas when it attaches to us. */ public void attach(OpenGLCanvas canvas) { ; } /** Returns the device context for canvas. */ public int getHDC(Canvas canvas) { DrawingSurfaceInfo drawingSurfaceInfo; Win32DrawingSurface win32DrawingSurface; int hdc = 0; drawingSurfaceInfo = ((DrawingSurface)(canvas.getPeer())).getDrawingSurfaceInfo(); if (null != drawingSurfaceInfo) { drawingSurfaceInfo.lock(); win32DrawingSurface = (Win32DrawingSurface)drawingSurfaceInfo.getSurface(); hdc = win32DrawingSurface.getHDC(); drawingSurfaceInfo.unlock(); } return hdc; } /* X11 accessors that return 0 here. */ public int getColormapID(Canvas g) { return 0; } public int getDrawable(Canvas g) { return 0; } }
UTF-8
Java
1,595
java
WindowspDataAccess.java
Java
[ { "context": " only function\r\n * under windows. \r\n *\r\n * @author Robert Allan Zeh (razeh@balr.com)\r\n *\r\n * @version 0.3\r\n */\r\npubli", "end": 628, "score": 0.9998375773429871, "start": 612, "tag": "NAME", "value": "Robert Allan Zeh" }, { "context": "under windows. \r\n *\r\n * @author Robert Allan Zeh (razeh@balr.com)\r\n *\r\n * @version 0.3\r\n */\r\npublic class Windowsp", "end": 644, "score": 0.9999329447746277, "start": 630, "tag": "EMAIL", "value": "razeh@balr.com" } ]
null
[]
/* * $Id: WindowspDataAccess.java,v 1.6 1999/05/22 15:30:39 razeh Exp $ * * Taken (and then modified) from jogl-0.7 * */ package sun.awt.windows; import sun.awt.DrawingSurface; import sun.awt.DrawingSurfaceInfo; import sun.awt.windows.*; import sun.awt.Win32DrawingSurface; import OpenGL.OpenGLpDataAccess; import OpenGL.OpenGLCanvas; import java.awt.Graphics; import java.awt.Canvas; import java.awt.peer.*; /** * This class is used to access the raw window pointer and device * context from a canvas object. It will, of course, only function * under windows. * * @author <NAME> (<EMAIL>) * * @version 0.3 */ public class WindowspDataAccess implements OpenGLpDataAccess { /** Invoked by our OpenGLCanvas when it attaches to us. */ public void attach(OpenGLCanvas canvas) { ; } /** Returns the device context for canvas. */ public int getHDC(Canvas canvas) { DrawingSurfaceInfo drawingSurfaceInfo; Win32DrawingSurface win32DrawingSurface; int hdc = 0; drawingSurfaceInfo = ((DrawingSurface)(canvas.getPeer())).getDrawingSurfaceInfo(); if (null != drawingSurfaceInfo) { drawingSurfaceInfo.lock(); win32DrawingSurface = (Win32DrawingSurface)drawingSurfaceInfo.getSurface(); hdc = win32DrawingSurface.getHDC(); drawingSurfaceInfo.unlock(); } return hdc; } /* X11 accessors that return 0 here. */ public int getColormapID(Canvas g) { return 0; } public int getDrawable(Canvas g) { return 0; } }
1,578
0.675235
0.651411
64
22.921875
22.745401
86
false
false
0
0
0
0
0
0
0.390625
false
false
5
39cb4ab85b51d9a7d959824ff84312a238334a5b
29,566,554,895,139
6a548bf66e5d0160f6577c56bd8137f7686b00eb
/src/InputHandler.java
aff0870191240906efd3fc708ae784f87165b0aa
[]
no_license
NoveniaM/NewHarvestValley
https://github.com/NoveniaM/NewHarvestValley
e29dcc21793f777d3e836e30a1ec61c08cb89a54
24e42767c28b0fc7bb0280d230a5723af0aff21e
refs/heads/master
2021-01-18T07:56:35.200000
2017-03-08T14:24:36
2017-03-08T14:24:36
84,297,904
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JButton; public class InputHandler implements KeyListener{ //Attribute Game game; //Method public InputHandler(Game game){ this.game = game; } @Override public void keyPressed(KeyEvent e) { int c = e.getKeyCode(); if(Game.state == Game.State.Game){ if (c == KeyEvent.VK_W){ Game.getPemain().action(0); } if (c == KeyEvent.VK_D){ Game.getPemain().action(1); } if (c == KeyEvent.VK_S){ Game.getPemain().action(2); } if (c == KeyEvent.VK_A){ Game.getPemain().action(3); } if (c == KeyEvent.VK_Q){ Game.getPemain().action(4); } if (c == KeyEvent.VK_E){ Game.getPemain().action(5); } if (c == KeyEvent.VK_F){ Game.getPemain().action(6); } } if (c == KeyEvent.VK_B){ Game.getPemain().action(7); } if (c == KeyEvent.VK_M){ Game.getPemain().action(8); } if (c == KeyEvent.VK_G){ Game.getPemain().action(10); } if (c == KeyEvent.VK_1){ if (Game.state == Game.State.Shop){ Game.getPemain().action(20); } else if (Game.state == Game.State.Sell){ Game.getPemain().action(25); } else{ Game.getPemain().setHeldTool(0); } } if (c == KeyEvent.VK_2){ if (Game.state == Game.State.Shop){ Game.getPemain().action(21); } else if (Game.state == Game.State.Sell){ Game.getPemain().action(26); } else { Game.getPemain().setHeldTool(1); } } if (c == KeyEvent.VK_3){ if (Game.state == Game.State.Shop){ Game.getPemain().action(22); } else if (Game.state == Game.State.Sell){ Game.getPemain().action(27); } else{ Game.getPemain().setHeldTool(2); } } if (c == KeyEvent.VK_4){ if (Game.state == Game.State.Shop){ Game.getPemain().action(23); } else if (Game.state == Game.State.Sell){ Game.getPemain().action(28); } else{ Game.getPemain().setHeldTool(3); } } if (c == KeyEvent.VK_5){ if (Game.state == Game.State.Shop){ Game.getPemain().action(24); } else if(Game.state == Game.State.Sell){ Game.getPemain().action(29); } else{ Game.getPemain().setHeldTool(4); } } if (c == KeyEvent.VK_6){ Game.getPemain().setHeldTool(5); } if (c == KeyEvent.VK_7){ Game.getPemain().setHeldTool(6); } if (c == KeyEvent.VK_8){ Game.getPemain().setHeldTool(7); } if (c == KeyEvent.VK_9){ Game.getPemain().setHeldTool(8); } if (c == KeyEvent.VK_0){ Game.getPemain().setHeldTool(9); } } @Override public void keyReleased(KeyEvent arg0) { // TODO Auto-generated method stub } @Override public void keyTyped(KeyEvent arg0) { // TODO Auto-generated method stub } }
UTF-8
Java
3,904
java
InputHandler.java
Java
[]
null
[]
import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JButton; public class InputHandler implements KeyListener{ //Attribute Game game; //Method public InputHandler(Game game){ this.game = game; } @Override public void keyPressed(KeyEvent e) { int c = e.getKeyCode(); if(Game.state == Game.State.Game){ if (c == KeyEvent.VK_W){ Game.getPemain().action(0); } if (c == KeyEvent.VK_D){ Game.getPemain().action(1); } if (c == KeyEvent.VK_S){ Game.getPemain().action(2); } if (c == KeyEvent.VK_A){ Game.getPemain().action(3); } if (c == KeyEvent.VK_Q){ Game.getPemain().action(4); } if (c == KeyEvent.VK_E){ Game.getPemain().action(5); } if (c == KeyEvent.VK_F){ Game.getPemain().action(6); } } if (c == KeyEvent.VK_B){ Game.getPemain().action(7); } if (c == KeyEvent.VK_M){ Game.getPemain().action(8); } if (c == KeyEvent.VK_G){ Game.getPemain().action(10); } if (c == KeyEvent.VK_1){ if (Game.state == Game.State.Shop){ Game.getPemain().action(20); } else if (Game.state == Game.State.Sell){ Game.getPemain().action(25); } else{ Game.getPemain().setHeldTool(0); } } if (c == KeyEvent.VK_2){ if (Game.state == Game.State.Shop){ Game.getPemain().action(21); } else if (Game.state == Game.State.Sell){ Game.getPemain().action(26); } else { Game.getPemain().setHeldTool(1); } } if (c == KeyEvent.VK_3){ if (Game.state == Game.State.Shop){ Game.getPemain().action(22); } else if (Game.state == Game.State.Sell){ Game.getPemain().action(27); } else{ Game.getPemain().setHeldTool(2); } } if (c == KeyEvent.VK_4){ if (Game.state == Game.State.Shop){ Game.getPemain().action(23); } else if (Game.state == Game.State.Sell){ Game.getPemain().action(28); } else{ Game.getPemain().setHeldTool(3); } } if (c == KeyEvent.VK_5){ if (Game.state == Game.State.Shop){ Game.getPemain().action(24); } else if(Game.state == Game.State.Sell){ Game.getPemain().action(29); } else{ Game.getPemain().setHeldTool(4); } } if (c == KeyEvent.VK_6){ Game.getPemain().setHeldTool(5); } if (c == KeyEvent.VK_7){ Game.getPemain().setHeldTool(6); } if (c == KeyEvent.VK_8){ Game.getPemain().setHeldTool(7); } if (c == KeyEvent.VK_9){ Game.getPemain().setHeldTool(8); } if (c == KeyEvent.VK_0){ Game.getPemain().setHeldTool(9); } } @Override public void keyReleased(KeyEvent arg0) { // TODO Auto-generated method stub } @Override public void keyTyped(KeyEvent arg0) { // TODO Auto-generated method stub } }
3,904
0.454406
0.44083
146
24.739725
15.970459
52
false
false
0
0
0
0
0
0
0.780822
false
false
5
ebf87a2e07210abf5d4e1baa9ffa0642144c0c9c
30,339,649,049,792
da8faa40c79b55b0e5143e861501a4be2f00713c
/src/main/java/net/galenchai/multithread/TestFutureTask.java
48361c462dc020555d1ec05874cc1b418fa0dcc3
[]
no_license
galenchai/jcl
https://github.com/galenchai/jcl
61bc30f49fc82530524227b183b9228d16501977
434eaaa6a3d08fb63e95a6fb54df95634af37f15
refs/heads/master
2020-06-06T08:43:03.541000
2015-07-15T04:05:23
2015-07-15T04:05:23
38,726,234
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.galenchai.multithread; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.FutureTask; import org.junit.Test; /** * FutureTask is asynchronous taks. * When we start it, the program will not wait for its return. Instead, the program will execute the following codes * But when invoking futureTask.get(), the thread will be blocked to ensure we get the result * @author caizhen */ public class TestFutureTask { @Test public void testFutureTask() { Callable<Integer> cal = new Callable<Integer>() { public Integer call() { System.out.println("I need some sleep!"); try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("I am getting up!"); return new Integer(8); } }; FutureTask<Integer> futureTask = new FutureTask<Integer>(cal); Thread newThread = new Thread(futureTask); newThread.start(); System.out.println("Am I sleeping?"); Integer result = null; try { result = futureTask.get(); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } System.out.println("Am I waking up?"); System.out.println(result); } }
UTF-8
Java
1,281
java
TestFutureTask.java
Java
[ { "context": " be blocked to ensure we get the result\n * @author caizhen\n */\npublic class TestFutureTask {\n\t\n\t@Test\n\tpubli", "end": 458, "score": 0.999485969543457, "start": 451, "tag": "USERNAME", "value": "caizhen" } ]
null
[]
package net.galenchai.multithread; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.FutureTask; import org.junit.Test; /** * FutureTask is asynchronous taks. * When we start it, the program will not wait for its return. Instead, the program will execute the following codes * But when invoking futureTask.get(), the thread will be blocked to ensure we get the result * @author caizhen */ public class TestFutureTask { @Test public void testFutureTask() { Callable<Integer> cal = new Callable<Integer>() { public Integer call() { System.out.println("I need some sleep!"); try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("I am getting up!"); return new Integer(8); } }; FutureTask<Integer> futureTask = new FutureTask<Integer>(cal); Thread newThread = new Thread(futureTask); newThread.start(); System.out.println("Am I sleeping?"); Integer result = null; try { result = futureTask.get(); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } System.out.println("Am I waking up?"); System.out.println(result); } }
1,281
0.699454
0.69555
48
25.6875
23.55946
116
false
false
0
0
0
0
0
0
2.145833
false
false
5
771d834b9961c6bcad394376585949c168654d79
22,986,665,036,746
c7b84cc2f8bd8b26b87471bb9882607b5af2afd2
/LearnJava/Interface/Laptop/Keyboard.java
a9e6cbd7a081fd44b645c3e14f41d20adea8b1a2
[]
no_license
EngulfMiss/LearnJava
https://github.com/EngulfMiss/LearnJava
6e33fb4d772b0e8222b15181f86072ecbd552104
df098dc3a405be0c49bee0606ff50c9d2bd9e1ac
refs/heads/master
2021-05-20T03:58:28.734000
2020-04-26T08:16:18
2020-04-26T08:16:18
252,174,738
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package LearnJava.Interface.Laptop; public class Keyboard implements USB{ @Override public void On() { System.out.println("打开键盘"); } @Override public void Off() { System.out.println("关闭键盘"); } public void type(){ System.out.println("键盘按键"); } }
UTF-8
Java
345
java
Keyboard.java
Java
[]
null
[]
package LearnJava.Interface.Laptop; public class Keyboard implements USB{ @Override public void On() { System.out.println("打开键盘"); } @Override public void Off() { System.out.println("关闭键盘"); } public void type(){ System.out.println("键盘按键"); } }
345
0.554517
0.554517
17
16.882353
14.099989
37
false
false
0
0
0
0
0
0
0.235294
false
false
5
54b994180aa74c44cc8a80af20f1aafa12ebb5ee
29,180,007,852,568
5bda4ffb0f64afd32fb2acd3e1e3a11acd9515f0
/trucking/src/main/java/com/ibm/optim/oaas/sample/trucking/model/Parameters.java
e4dda581ef95099436df475303f9f784f627901e
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
IBMDecisionOptimization/DOcloud-Trucking-Java-sample
https://github.com/IBMDecisionOptimization/DOcloud-Trucking-Java-sample
d06417ee9d5833a56ab6782c48d744664beca151
5042f34def0dfc8552125d27ec8682f58db5a6d3
refs/heads/master
2020-01-30T19:28:29.412000
2019-01-17T11:30:47
2019-01-17T11:30:47
46,786,124
4
5
null
false
2017-10-10T11:57:57
2015-11-24T11:03:19
2016-11-22T15:21:05
2017-10-10T11:57:56
36
0
3
0
Java
null
null
package com.ibm.optim.oaas.sample.trucking.model; /** * Class used to specify global parameters for the <code>truck.mod</code> shipment * problem model. * * Instances of this class are mapped to entries of the <code>Parameters</code> * singleton tuple of the <code>truck.mod</code> model. Properties are mapped to the * corresponding fields of the <code>parameters</code> tuple definition. */ public class Parameters { // Maximum number of trucks for each type on a route private int maxTrucks; // Maximum volume of goods that can be handled on each path for each type of truck private int maxVolume; public Parameters(int maxTrucks, int maxVolume) { super(); this.maxTrucks = maxTrucks; this.maxVolume = maxVolume; } public int getMaxTrucks() { return maxTrucks; } public void setMaxTrucks(int maxTrucks) { this.maxTrucks = maxTrucks; } public int getMaxVolume() { return maxVolume; } public void setMaxVolume(int maxVolume) { this.maxVolume = maxVolume; } }
UTF-8
Java
1,007
java
Parameters.java
Java
[]
null
[]
package com.ibm.optim.oaas.sample.trucking.model; /** * Class used to specify global parameters for the <code>truck.mod</code> shipment * problem model. * * Instances of this class are mapped to entries of the <code>Parameters</code> * singleton tuple of the <code>truck.mod</code> model. Properties are mapped to the * corresponding fields of the <code>parameters</code> tuple definition. */ public class Parameters { // Maximum number of trucks for each type on a route private int maxTrucks; // Maximum volume of goods that can be handled on each path for each type of truck private int maxVolume; public Parameters(int maxTrucks, int maxVolume) { super(); this.maxTrucks = maxTrucks; this.maxVolume = maxVolume; } public int getMaxTrucks() { return maxTrucks; } public void setMaxTrucks(int maxTrucks) { this.maxTrucks = maxTrucks; } public int getMaxVolume() { return maxVolume; } public void setMaxVolume(int maxVolume) { this.maxVolume = maxVolume; } }
1,007
0.729891
0.729891
40
24.174999
26.562086
85
false
false
0
0
0
0
0
0
0.975
false
false
5
843bccc08aab07c4baa1cf48fe663f4d20a34b3b
18,511,309,101,931
8fb9d793d860d1fa075ca8e70cc5f4cfd2cc5a82
/src/main/java/pl/overr/drop/drop/DropLoader.java
f1eaf6b5833674fbb5da500379f09326a7f5f468
[]
no_license
0VERR/RgDrop
https://github.com/0VERR/RgDrop
e8656fb634db42c5978d7433252605dc6d98b7cf
28b9fbb7051dc866ee5362ada0e1d92c6fc0e080
refs/heads/master
2022-05-18T08:49:30.211000
2020-04-12T14:40:54
2020-04-12T14:40:54
255,102,315
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pl.overr.drop.drop; import org.bukkit.Material; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.inventory.ItemStack; import pl.overr.drop.DropPlugin; import pl.overr.drop.managers.DropManager; import pl.overr.drop.utils.FixColor; public class DropLoader { private final FileConfiguration cfg = DropPlugin.getDropPlugin().getConfig(); private final DropManager dropManager; public DropLoader(DropManager dropManager) { this.dropManager = dropManager; loadDrop(); } public void loadDrop(){ for (String drop : cfg.getConfigurationSection("Drop").getKeys(false)){ String dropInGuiName = FixColor.fixer(cfg.getString("Drop." + drop +".nameInGui")); String stringMaterial = cfg.getString("Drop." + drop + ".material"); String dropMessage = cfg.getString("Drop." + drop + ".message"); short durability = (short) cfg.getInt(cfg.getString("Drop." + drop + ".durability")); double chance = cfg.getDouble("Drop." + drop + ".chance"); dropManager.addToDrop(new Drop(drop, new ItemStack(Material.getMaterial(stringMaterial),1,durability), chance, dropMessage, dropInGuiName)); } } }
UTF-8
Java
1,271
java
DropLoader.java
Java
[]
null
[]
package pl.overr.drop.drop; import org.bukkit.Material; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.inventory.ItemStack; import pl.overr.drop.DropPlugin; import pl.overr.drop.managers.DropManager; import pl.overr.drop.utils.FixColor; public class DropLoader { private final FileConfiguration cfg = DropPlugin.getDropPlugin().getConfig(); private final DropManager dropManager; public DropLoader(DropManager dropManager) { this.dropManager = dropManager; loadDrop(); } public void loadDrop(){ for (String drop : cfg.getConfigurationSection("Drop").getKeys(false)){ String dropInGuiName = FixColor.fixer(cfg.getString("Drop." + drop +".nameInGui")); String stringMaterial = cfg.getString("Drop." + drop + ".material"); String dropMessage = cfg.getString("Drop." + drop + ".message"); short durability = (short) cfg.getInt(cfg.getString("Drop." + drop + ".durability")); double chance = cfg.getDouble("Drop." + drop + ".chance"); dropManager.addToDrop(new Drop(drop, new ItemStack(Material.getMaterial(stringMaterial),1,durability), chance, dropMessage, dropInGuiName)); } } }
1,271
0.669552
0.668765
32
37.71875
36.800335
152
false
false
0
0
0
0
0
0
0.71875
false
false
5
10592e022d6d002afdf6ad0e3aa3466645041a2c
3,624,952,421,725
8981974d931e1153e956e054d9c7d369e70cc230
/coffee-stock-quarkus/src/main/java/com/tdc/kafka/kafka_coffee/StartServices.java
d42f7b4a4e78c653c1abde01483c331972849bd9
[ "MIT" ]
permissive
aolmez/event-streams-quarkus
https://github.com/aolmez/event-streams-quarkus
83d80b5d6c86cec2cc2ab893b0eb6a20b07d988c
2309ecce8468a68abb57ee42cea8510b1c7eef55
refs/heads/master
2023-08-16T17:28:06.899000
2019-05-26T23:22:44
2019-05-26T23:22:44
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.tdc.kafka.kafka_coffee; import io.quarkus.runtime.ShutdownEvent; import io.quarkus.runtime.StartupEvent; import io.vertx.core.DeploymentOptions; import io.vertx.core.json.JsonObject; import io.vertx.reactivex.core.Vertx; import org.eclipse.microprofile.config.inject.ConfigProperty; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.event.Observes; @ApplicationScoped public class StartServices { private Logger LOG = LoggerFactory.getLogger(StartServices.class); private Vertx vertx; @ConfigProperty(name = "mysql.host") String mysqlHost; @ConfigProperty(name = "mysql.username") String mysqlUsername; @ConfigProperty(name = "mysql.password") String mysqlPassword; @ConfigProperty(name = "mysql.database") String mysqlDatabase; @ConfigProperty(name = "kafka.bootstrap.servers") String bootstrapServers; @ConfigProperty(name = "kafka.group.id") String groupId; @ConfigProperty(name = "kafka.order.placed.topic") String orderPlacedTopic; @ConfigProperty(name = "kafka.order.confirmed.topic") String orderConfirmedTopic; @ConfigProperty(name = "kafka.order.canceled.topic") String orderCanceledTopic; @ConfigProperty(name = "kafka.stock.updated.topic") String orderStockUpdatedTopic; void onStart(@Observes StartupEvent ev) { LOG.info("onStart..."); this.vertx = Vertx.vertx(); DeploymentOptions mainConfig = new DeploymentOptions(); mainConfig.setConfig(new JsonObject() .put("mysql", new JsonObject() .put("host", mysqlHost) .put("username", mysqlUsername) .put("password", mysqlPassword) .put("database", mysqlDatabase) ) .put("kafka", new JsonObject() .put("bootstrap.servers", bootstrapServers) .put("group.id", groupId) .put("order.placed.topic", orderPlacedTopic) .put("order.confirmed.topic", orderConfirmedTopic) .put("order.canceled.topic", orderCanceledTopic) .put("stock.updated.topic", orderStockUpdatedTopic) )); LOG.info(mainConfig.getConfig().encodePrettily()); vertx.rxDeployVerticle(new RepositoryVerticle(), mainConfig) .ignoreElement() .andThen(vertx.rxDeployVerticle(new EventStreamVerticle(), mainConfig)) .ignoreElement() .andThen(vertx.rxDeployVerticle(new UserInputEventStream(), mainConfig)) .ignoreElement() .subscribe(); } void onStop(@Observes ShutdownEvent ev) { LOG.info("onStop..."); this.vertx.close(); } }
UTF-8
Java
2,912
java
StartServices.java
Java
[ { "context": "ysqlHost)\n .put(\"username\", mysqlUsername)\n .put(\"password\", mysqlPa", "end": 1754, "score": 0.9487745761871338, "start": 1741, "tag": "USERNAME", "value": "mysqlUsername" }, { "context": "Username)\n .put(\"password\", mysqlPassword)\n .put(\"database\", mysqlDa", "end": 1810, "score": 0.9931440353393555, "start": 1797, "tag": "PASSWORD", "value": "mysqlPassword" } ]
null
[]
package com.tdc.kafka.kafka_coffee; import io.quarkus.runtime.ShutdownEvent; import io.quarkus.runtime.StartupEvent; import io.vertx.core.DeploymentOptions; import io.vertx.core.json.JsonObject; import io.vertx.reactivex.core.Vertx; import org.eclipse.microprofile.config.inject.ConfigProperty; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.event.Observes; @ApplicationScoped public class StartServices { private Logger LOG = LoggerFactory.getLogger(StartServices.class); private Vertx vertx; @ConfigProperty(name = "mysql.host") String mysqlHost; @ConfigProperty(name = "mysql.username") String mysqlUsername; @ConfigProperty(name = "mysql.password") String mysqlPassword; @ConfigProperty(name = "mysql.database") String mysqlDatabase; @ConfigProperty(name = "kafka.bootstrap.servers") String bootstrapServers; @ConfigProperty(name = "kafka.group.id") String groupId; @ConfigProperty(name = "kafka.order.placed.topic") String orderPlacedTopic; @ConfigProperty(name = "kafka.order.confirmed.topic") String orderConfirmedTopic; @ConfigProperty(name = "kafka.order.canceled.topic") String orderCanceledTopic; @ConfigProperty(name = "kafka.stock.updated.topic") String orderStockUpdatedTopic; void onStart(@Observes StartupEvent ev) { LOG.info("onStart..."); this.vertx = Vertx.vertx(); DeploymentOptions mainConfig = new DeploymentOptions(); mainConfig.setConfig(new JsonObject() .put("mysql", new JsonObject() .put("host", mysqlHost) .put("username", mysqlUsername) .put("password", <PASSWORD>) .put("database", mysqlDatabase) ) .put("kafka", new JsonObject() .put("bootstrap.servers", bootstrapServers) .put("group.id", groupId) .put("order.placed.topic", orderPlacedTopic) .put("order.confirmed.topic", orderConfirmedTopic) .put("order.canceled.topic", orderCanceledTopic) .put("stock.updated.topic", orderStockUpdatedTopic) )); LOG.info(mainConfig.getConfig().encodePrettily()); vertx.rxDeployVerticle(new RepositoryVerticle(), mainConfig) .ignoreElement() .andThen(vertx.rxDeployVerticle(new EventStreamVerticle(), mainConfig)) .ignoreElement() .andThen(vertx.rxDeployVerticle(new UserInputEventStream(), mainConfig)) .ignoreElement() .subscribe(); } void onStop(@Observes ShutdownEvent ev) { LOG.info("onStop..."); this.vertx.close(); } }
2,909
0.635302
0.634615
88
32.090908
23.939619
88
false
false
0
0
0
0
0
0
0.522727
false
false
5
e13210061edfaca6b5a7e477f2c3b66bfe5bbdc4
23,940,147,730,756
6eacdfcf2ae8aea04187ce17ac007f220af8927b
/Harmony/src/main/java/tools/NumberGenerator.java
a15b66626f0e640ab83bd1d12e27774a6d08e852
[]
no_license
monikatl/JavaProjects
https://github.com/monikatl/JavaProjects
58b7df1c3ce215ccdcbe0c0bd3b8531911ce13c2
5fa7c3293d118e30e8e890d19e3174350826e160
refs/heads/master
2020-12-12T13:37:21.972000
2020-02-26T13:30:10
2020-02-26T13:30:10
234,138,565
0
0
null
false
2020-10-13T19:13:43
2020-01-15T17:47:48
2020-02-26T13:32:51
2020-10-13T19:13:42
100
0
0
1
Java
false
false
package tools; import java.security.SecureRandom; public class NumberGenerator { private static final SecureRandom randomNumber = new SecureRandom(); public static int generateNumber(int scope, int move){ return move + randomNumber.nextInt(scope); } public static boolean generateNumber(){ return randomNumber.nextBoolean(); } }
UTF-8
Java
374
java
NumberGenerator.java
Java
[]
null
[]
package tools; import java.security.SecureRandom; public class NumberGenerator { private static final SecureRandom randomNumber = new SecureRandom(); public static int generateNumber(int scope, int move){ return move + randomNumber.nextInt(scope); } public static boolean generateNumber(){ return randomNumber.nextBoolean(); } }
374
0.708556
0.708556
16
22.375
23.677191
72
false
false
0
0
0
0
0
0
0.375
false
false
5
3d4fe2c3ccd4353df7bcdd9a4aba4100e4690ee7
30,451,318,153,228
3b67b360686f4189c793f7f6a442f338819bcc22
/java/src/main/java/com/br/antbridge/severino/entity/mod_controleponto/Legenda.java
ff8868b943a3dc5551e60ab1c6df1847015543f8
[ "Apache-2.0" ]
permissive
volkmerrafael/severino-api-rest
https://github.com/volkmerrafael/severino-api-rest
7808754c0bc842ad029471c4c2cd7ec9f37d257d
93bcdea18fe4c113b006e82a569671accfb58ef8
refs/heads/master
2020-03-23T20:32:22.362000
2018-07-27T22:47:13
2018-07-27T22:47:13
142,047,097
1
0
Apache-2.0
true
2018-07-27T22:47:14
2018-07-23T17:31:12
2018-07-24T03:59:41
2018-07-27T22:47:13
645
1
0
0
Java
false
null
package com.br.antbridge.severino.entity.mod_controleponto; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Index; import javax.persistence.Table; import javax.validation.constraints.NotNull; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Getter; import lombok.Setter; @ApiModel(value="Legenda", description="Legenda") @Table( indexes = { @Index(name = "legenda_sigla_idx", columnList = "sigla") }) @Getter @Setter @Entity public class Legenda { @Id @ApiModelProperty("Código") @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(length=100) @NotNull @ApiModelProperty("Nome") private String nome; @Column(length=1) @NotNull @ApiModelProperty("Sigla") private String sigla; }
UTF-8
Java
943
java
Legenda.java
Java
[]
null
[]
package com.br.antbridge.severino.entity.mod_controleponto; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Index; import javax.persistence.Table; import javax.validation.constraints.NotNull; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Getter; import lombok.Setter; @ApiModel(value="Legenda", description="Legenda") @Table( indexes = { @Index(name = "legenda_sigla_idx", columnList = "sigla") }) @Getter @Setter @Entity public class Legenda { @Id @ApiModelProperty("Código") @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(length=100) @NotNull @ApiModelProperty("Nome") private String nome; @Column(length=1) @NotNull @ApiModelProperty("Sigla") private String sigla; }
943
0.77707
0.772824
41
21.975609
17.261953
60
false
false
0
0
0
0
0
0
1.02439
false
false
5
a657c7dd2f54babadb8a4de305ef22d00734a0e2
25,752,623,915,863
1fb92133bd6476cf0c7a8efcccf931dc22ac111a
/app/src/main/java/com/example/khaing/fundamentalappkhai/datas/Models/NewsModel.java
5e9fd052c56bd0e78c5f4eaaf5d52ad03fc27220
[ "MIT" ]
permissive
ThaeThinzar/FundamentalAppKhai1
https://github.com/ThaeThinzar/FundamentalAppKhai1
756a581420e97e6ce5585af153201d1b6008fbfa
a364db785f79b316db92c363ff0bfb680829dcbe
refs/heads/master
2020-04-03T16:42:25.130000
2018-12-16T16:03:04
2018-12-16T16:03:04
155,415,333
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.khaing.fundamentalappkhai.datas.Models; import com.example.khaing.fundamentalappkhai.network.NewDataAgent; import com.example.khaing.fundamentalappkhai.network.RetrofitDataAgentImpl; public class NewsModel { private static NewsModel newObjInst; private static final String DUMMY_ACCESS_TOKEN="b002c7e1a528b7cb460933fc2875e916"; private NewDataAgent mAgent; private RetrofitDataAgentImpl mretrofitAgent; private NewsModel() { mretrofitAgent=RetrofitDataAgentImpl.getsObjInstance(); } public static NewsModel getNewObjInst() { if(newObjInst==null){ newObjInst=new NewsModel(); } return newObjInst; } public void loadNews(){ mretrofitAgent.loadNews(1,DUMMY_ACCESS_TOKEN); } }
UTF-8
Java
790
java
NewsModel.java
Java
[ { "context": " private static final String DUMMY_ACCESS_TOKEN=\"b002c7e1a528b7cb460933fc2875e916\";\n private NewDataAgent mAgent;\n private Re", "end": 355, "score": 0.9868113398551941, "start": 323, "tag": "KEY", "value": "b002c7e1a528b7cb460933fc2875e916" } ]
null
[]
package com.example.khaing.fundamentalappkhai.datas.Models; import com.example.khaing.fundamentalappkhai.network.NewDataAgent; import com.example.khaing.fundamentalappkhai.network.RetrofitDataAgentImpl; public class NewsModel { private static NewsModel newObjInst; private static final String DUMMY_ACCESS_TOKEN="<KEY>"; private NewDataAgent mAgent; private RetrofitDataAgentImpl mretrofitAgent; private NewsModel() { mretrofitAgent=RetrofitDataAgentImpl.getsObjInstance(); } public static NewsModel getNewObjInst() { if(newObjInst==null){ newObjInst=new NewsModel(); } return newObjInst; } public void loadNews(){ mretrofitAgent.loadNews(1,DUMMY_ACCESS_TOKEN); } }
763
0.735443
0.706329
26
29.384615
25.920109
86
false
false
0
0
0
0
0
0
0.461538
false
false
5
9e8d4b529b66b6ffe206920fc5485eb42c790819
16,638,703,345,507
51bf521e581c7bf746ae695a99fb6e6c84cd223b
/src/com/evsward/butler/entities/PlayerInfo.java
38c2a7b96c20ff33216616bd1264edd402237720
[]
no_license
evsward/android-butler
https://github.com/evsward/android-butler
a2fa501cac59a639f5b29005f03a7d0bde10693a
74cb5393fd7c3cb273f98c5d3be710c8d8fcf290
refs/heads/master
2020-06-26T18:53:30.764000
2017-03-01T15:35:12
2017-03-01T15:35:12
52,575,211
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.evsward.butler.entities; import java.util.Date; public class PlayerInfo { private int id; private int memID; private String cardNO; private long nfcID; private String memMobile; private int compID; private int mcState; private int tableNO; private int seatNO; private String memName; private int sysType; private Date regTime; private Date outTime; private int chip; public int getId() { return id; } public void setId(int id) { this.id = id; } public int getMemID() { return memID; } public void setMemID(int memID) { this.memID = memID; } public String getCardNO() { return cardNO; } public void setCardNO(String cardNO) { this.cardNO = cardNO; } public long getNfcID() { return nfcID; } public void setNfcID(long nfcID) { this.nfcID = nfcID; } public String getMemMobile() { return memMobile; } public void setMemMobile(String memMobile) { this.memMobile = memMobile; } public int getCompID() { return compID; } public void setCompID(int compID) { this.compID = compID; } public int getMcState() { return mcState; } public void setMcState(int mcState) { this.mcState = mcState; } public int getTableNO() { return tableNO; } public void setTableNO(int tableNO) { this.tableNO = tableNO; } public int getSeatNO() { return seatNO; } public void setSeatNO(int seatNO) { this.seatNO = seatNO; } public String getMemName() { return memName; } public void setMemName(String memName) { this.memName = memName; } public int getSysType() { return sysType; } public void setSysType(int sysType) { this.sysType = sysType; } public Date getRegTime() { return regTime; } public void setRegTime(Date regTime) { this.regTime = regTime; } public Date getOutTime() { return outTime; } public void setOutTime(Date outTime) { this.outTime = outTime; } public int getChip() { return chip; } public void setChip(int chip) { this.chip = chip; } }
UTF-8
Java
1,996
java
PlayerInfo.java
Java
[]
null
[]
package com.evsward.butler.entities; import java.util.Date; public class PlayerInfo { private int id; private int memID; private String cardNO; private long nfcID; private String memMobile; private int compID; private int mcState; private int tableNO; private int seatNO; private String memName; private int sysType; private Date regTime; private Date outTime; private int chip; public int getId() { return id; } public void setId(int id) { this.id = id; } public int getMemID() { return memID; } public void setMemID(int memID) { this.memID = memID; } public String getCardNO() { return cardNO; } public void setCardNO(String cardNO) { this.cardNO = cardNO; } public long getNfcID() { return nfcID; } public void setNfcID(long nfcID) { this.nfcID = nfcID; } public String getMemMobile() { return memMobile; } public void setMemMobile(String memMobile) { this.memMobile = memMobile; } public int getCompID() { return compID; } public void setCompID(int compID) { this.compID = compID; } public int getMcState() { return mcState; } public void setMcState(int mcState) { this.mcState = mcState; } public int getTableNO() { return tableNO; } public void setTableNO(int tableNO) { this.tableNO = tableNO; } public int getSeatNO() { return seatNO; } public void setSeatNO(int seatNO) { this.seatNO = seatNO; } public String getMemName() { return memName; } public void setMemName(String memName) { this.memName = memName; } public int getSysType() { return sysType; } public void setSysType(int sysType) { this.sysType = sysType; } public Date getRegTime() { return regTime; } public void setRegTime(Date regTime) { this.regTime = regTime; } public Date getOutTime() { return outTime; } public void setOutTime(Date outTime) { this.outTime = outTime; } public int getChip() { return chip; } public void setChip(int chip) { this.chip = chip; } }
1,996
0.687876
0.687876
133
14.007519
13.095655
45
false
false
0
0
0
0
0
0
1.278196
false
false
5
35fcf8e981d66ec77b13f717fc3c4555d9c14ece
326,417,554,243
6ed482a6b3c9716f585d04b965a75964c8efd35d
/java/l2trunk/gameserver/handler/admincommands/impl/AdminKill.java
a0cafe70f8c15f9c9e8959bc1276771fb388cc8b
[]
no_license
VitaliiBashta/Trunk
https://github.com/VitaliiBashta/Trunk
0796d1be73f0ced917fd3ebf725403f30ebb6a84
9f58afca0deb4e6f69fc89e3b47b5fc02d2a31e9
refs/heads/master
2021-10-24T20:56:55.327000
2019-03-28T15:36:37
2019-03-28T15:36:37
155,664,256
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package l2trunk.gameserver.handler.admincommands.impl; import l2trunk.gameserver.handler.admincommands.IAdminCommandHandler; import l2trunk.gameserver.model.Creature; import l2trunk.gameserver.model.GameObject; import l2trunk.gameserver.model.Player; import l2trunk.gameserver.model.World; import l2trunk.gameserver.model.instances.DoorInstance; import l2trunk.gameserver.network.serverpackets.components.SystemMsg; import java.util.List; import static l2trunk.commons.lang.NumberUtils.toInt; public final class AdminKill implements IAdminCommandHandler { @Override public boolean useAdminCommand(String comm, String[] wordList, String fullString, Player activeChar) { if (!activeChar.getPlayerAccess().CanEditNPC) return false; switch (comm) { case "admin_kill": if (wordList.length == 1) handleKill(activeChar); else handleKill(activeChar, wordList[1]); break; case "admin_damage": handleDamage(activeChar, toInt(wordList[1], 1)); break; } return true; } @Override public List<String> getAdminCommands() { return List.of( "admin_kill", "admin_damage"); } private void handleKill(Player activeChar) { handleKill(activeChar, null); } private void handleKill(Player activeChar, String player) { GameObject obj = activeChar.getTarget(); if (player != null) { Player plyr = World.getPlayer(player); if (plyr != null) obj = plyr; else { int radius = Math.max(toInt(player), 100); activeChar.getAroundCharacters(radius, 200) .filter(c -> !(c instanceof DoorInstance)) .forEach(c -> c.doDie(activeChar)); activeChar.sendMessage("Killed within " + radius + " unit radius."); return; } } if (obj instanceof Creature) { Creature target = (Creature) obj; target.doDie(activeChar); } else activeChar.sendPacket(SystemMsg.INVALID_TARGET); } private void handleDamage(Player activeChar, int damage) { GameObject obj = activeChar.getTarget(); if (obj == null) { activeChar.sendPacket(SystemMsg.SELECT_TARGET); return; } if (obj instanceof Creature) { Creature cha = (Creature) obj; cha.reduceCurrentHp(damage, activeChar, null, true, true, false, false, false, false, true); activeChar.sendMessage("You gave " + damage + " damage to " + cha.getName() + "."); } else { activeChar.sendPacket(SystemMsg.INVALID_TARGET); } } }
UTF-8
Java
2,879
java
AdminKill.java
Java
[]
null
[]
package l2trunk.gameserver.handler.admincommands.impl; import l2trunk.gameserver.handler.admincommands.IAdminCommandHandler; import l2trunk.gameserver.model.Creature; import l2trunk.gameserver.model.GameObject; import l2trunk.gameserver.model.Player; import l2trunk.gameserver.model.World; import l2trunk.gameserver.model.instances.DoorInstance; import l2trunk.gameserver.network.serverpackets.components.SystemMsg; import java.util.List; import static l2trunk.commons.lang.NumberUtils.toInt; public final class AdminKill implements IAdminCommandHandler { @Override public boolean useAdminCommand(String comm, String[] wordList, String fullString, Player activeChar) { if (!activeChar.getPlayerAccess().CanEditNPC) return false; switch (comm) { case "admin_kill": if (wordList.length == 1) handleKill(activeChar); else handleKill(activeChar, wordList[1]); break; case "admin_damage": handleDamage(activeChar, toInt(wordList[1], 1)); break; } return true; } @Override public List<String> getAdminCommands() { return List.of( "admin_kill", "admin_damage"); } private void handleKill(Player activeChar) { handleKill(activeChar, null); } private void handleKill(Player activeChar, String player) { GameObject obj = activeChar.getTarget(); if (player != null) { Player plyr = World.getPlayer(player); if (plyr != null) obj = plyr; else { int radius = Math.max(toInt(player), 100); activeChar.getAroundCharacters(radius, 200) .filter(c -> !(c instanceof DoorInstance)) .forEach(c -> c.doDie(activeChar)); activeChar.sendMessage("Killed within " + radius + " unit radius."); return; } } if (obj instanceof Creature) { Creature target = (Creature) obj; target.doDie(activeChar); } else activeChar.sendPacket(SystemMsg.INVALID_TARGET); } private void handleDamage(Player activeChar, int damage) { GameObject obj = activeChar.getTarget(); if (obj == null) { activeChar.sendPacket(SystemMsg.SELECT_TARGET); return; } if (obj instanceof Creature) { Creature cha = (Creature) obj; cha.reduceCurrentHp(damage, activeChar, null, true, true, false, false, false, false, true); activeChar.sendMessage("You gave " + damage + " damage to " + cha.getName() + "."); } else { activeChar.sendPacket(SystemMsg.INVALID_TARGET); } } }
2,879
0.59222
0.58562
88
31.727272
25.916267
106
false
false
0
0
0
0
0
0
0.647727
false
false
5
7751369dc0d8bf3a8f4615a3e9dcc8cb337c643e
5,781,025,993,914
692929f82c824aa6934daf4e7db572364ee15fb9
/OpenJMLTest/test/gitbug716/Test.java
a02115b6d8c180fc86e9793e3143a0013cc71e55
[]
no_license
OpenJML/OpenJML
https://github.com/OpenJML/OpenJML
091d71841c0808c55bacc6fa79d8b603dd1fb82f
41e97a1f19b8d9adc7d33cef81fbf814fd4a56c9
refs/heads/master
2023-04-08T15:43:21.452000
2021-12-07T21:46:16
2021-12-07T21:46:16
38,332,006
134
40
null
false
2022-06-28T21:54:20
2015-06-30T20:40:28
2022-06-22T23:59:44
2022-06-16T10:57:27
287,070
106
29
135
Java
false
false
import java.util.Arrays; public class Test { /*@ requires 0 <= l < m < r <= arr.length && arr.length > 1; //bounds //requires (\forall int k; l <= k && k < m;(\forall int j; k < j && j < m; arr[k] >= arr[j])); //requires (\forall int k; m <= k && k < r;(\forall int j; k < j && j < r; arr[k] >= arr[j])); //ensures \forall int k;l<= k && k < r; ( \forall int j;k < j && j < r; arr[k] >= arr[j] ); @*/ private static void merge(/*@ non_null @*/ int [] arr, final int l, final int m, final int r) { final int [] lCpy = Arrays.copyOfRange(arr, l, m), rCpy = Arrays.copyOfRange(arr,m, r); //@ assert \forall int k; 0 <= k && k < lCpy.length; lCpy[k] == arr[k+l]; //@ assert \forall int k; 0 <= k && k < rCpy.length; rCpy[k] == arr[k+m]; int l1 = 0, r1 = 0; /*@ loop_invariant 0 <= l1 && l1 <= lCpy.length; loop_invariant 0 <= r1 && r1 <= rCpy.length; loop_invariant l <= i && i <= r; loop_invariant i == l+l1+r1; //loop_invariant l1 == lCpy.length ==> r1 <= rCpy.length; //loop_invariant r1 == rCpy.length ==> l1 <= lCpy.length; //loop_invariant \forall int k;l<= k && k < i;(\forall int j; l1 <= j && j < lCpy.length;arr[k] >= lCpy[j]); //loop_invariant \forall int k;l<= k && k < i;(\forall int j; r1 <= j && j < rCpy.length;arr[k] >= rCpy[j]); //loop_invariant \forall int k;l<= k && k < i; ( \forall int j;k < j && j < i; arr[k] >= arr[j] ); decreasing r - i; @*/ for(int i=l;i < r;) { if(l1 < lCpy.length && (r1 >= rCpy.length || lCpy[l1] >= rCpy[r1])) { arr[i++] = lCpy[l1]; l1++; } else { arr[i++] = rCpy[r1]; r1++; } } }}
UTF-8
Java
1,625
java
Test.java
Java
[]
null
[]
import java.util.Arrays; public class Test { /*@ requires 0 <= l < m < r <= arr.length && arr.length > 1; //bounds //requires (\forall int k; l <= k && k < m;(\forall int j; k < j && j < m; arr[k] >= arr[j])); //requires (\forall int k; m <= k && k < r;(\forall int j; k < j && j < r; arr[k] >= arr[j])); //ensures \forall int k;l<= k && k < r; ( \forall int j;k < j && j < r; arr[k] >= arr[j] ); @*/ private static void merge(/*@ non_null @*/ int [] arr, final int l, final int m, final int r) { final int [] lCpy = Arrays.copyOfRange(arr, l, m), rCpy = Arrays.copyOfRange(arr,m, r); //@ assert \forall int k; 0 <= k && k < lCpy.length; lCpy[k] == arr[k+l]; //@ assert \forall int k; 0 <= k && k < rCpy.length; rCpy[k] == arr[k+m]; int l1 = 0, r1 = 0; /*@ loop_invariant 0 <= l1 && l1 <= lCpy.length; loop_invariant 0 <= r1 && r1 <= rCpy.length; loop_invariant l <= i && i <= r; loop_invariant i == l+l1+r1; //loop_invariant l1 == lCpy.length ==> r1 <= rCpy.length; //loop_invariant r1 == rCpy.length ==> l1 <= lCpy.length; //loop_invariant \forall int k;l<= k && k < i;(\forall int j; l1 <= j && j < lCpy.length;arr[k] >= lCpy[j]); //loop_invariant \forall int k;l<= k && k < i;(\forall int j; r1 <= j && j < rCpy.length;arr[k] >= rCpy[j]); //loop_invariant \forall int k;l<= k && k < i; ( \forall int j;k < j && j < i; arr[k] >= arr[j] ); decreasing r - i; @*/ for(int i=l;i < r;) { if(l1 < lCpy.length && (r1 >= rCpy.length || lCpy[l1] >= rCpy[r1])) { arr[i++] = lCpy[l1]; l1++; } else { arr[i++] = rCpy[r1]; r1++; } } }}
1,625
0.513846
0.495385
39
40.692307
35.618458
111
false
false
0
0
0
0
0
0
3.615385
false
false
5
8152ea5f913337bd64678e45e141f78c3a1b80bf
28,535,762,737,102
847994122ac38091b80044b3c259a9dc22203197
/src/main/java/com/philips/Pet/PetRepository.java
775190997b1e30f18f5b32fe74112827b9267e57
[]
no_license
ArupMukherjee/SpringBootEmbeddedMongodb
https://github.com/ArupMukherjee/SpringBootEmbeddedMongodb
2dfc38056b247b1619d6ae6f45c97c7cfa0899dd
18fa37f5737674038808b93eaf02321bf8ab091c
refs/heads/master
2021-08-17T10:12:24.128000
2017-11-21T03:43:11
2017-11-21T03:43:11
111,360,414
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.philips.Pet; import java.util.ArrayList; import java.util.List; import org.springframework.data.mongodb.repository.MongoRepository; public interface PetRepository extends MongoRepository<Pet, String> { List<Visit> findByVisits(ArrayList name); }
UTF-8
Java
264
java
PetRepository.java
Java
[]
null
[]
package com.philips.Pet; import java.util.ArrayList; import java.util.List; import org.springframework.data.mongodb.repository.MongoRepository; public interface PetRepository extends MongoRepository<Pet, String> { List<Visit> findByVisits(ArrayList name); }
264
0.810606
0.810606
11
23
25.20101
69
false
false
0
0
0
0
0
0
0.727273
false
false
5
e9c08868457a8e3a9ad96537c535c63526d33ec5
31,679,678,808,172
9f55c3fa5b1f9a0472a6cdbe5476d411a75f0d5d
/DocumentSimilarity/src/ie/gmit/db/ObjectStorageAccessController.java
ec4ea3ef9e0efb2bd9fb0f432402fad0389fd8ca
[ "MIT" ]
permissive
rndmized/JEE-Application-for-Document-Similarity
https://github.com/rndmized/JEE-Application-for-Document-Similarity
4c054ae0cfc280d6b3adde1187b2af28d091c19c
26d203ba820eb11d1a10c67e1b05ed04fcd47c17
refs/heads/master
2021-09-10T21:34:50.360000
2018-04-02T17:02:19
2018-04-02T17:02:19
114,878,556
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ie.gmit.db; import java.util.ArrayList; import java.util.List; import java.util.concurrent.BlockingQueue; import ie.gmit.sw.Document; /** * Runnable class using a BlockingQueue to control access Object Database. * Maintains a cached list of Document objects from the database. * * @author RnDMizeD * @version 1.0b */ public class ObjectStorageAccessController implements Runnable { private BlockingQueue<ObjectStorageAccessRequest> queue; private ObjectStorage db; private volatile boolean keepRunning; private volatile List<Document> dbDocs; /** * Instantiate ObjectStorageAccessController * * @param queue */ public ObjectStorageAccessController(BlockingQueue<ObjectStorageAccessRequest> queue) { this.queue = queue; keepRunning = true; db = new ObjectStorageImplementation("documents"); dbDocs = new ArrayList<>(); } @Override public void run() { while (keepRunning) { ObjectStorageAccessRequest req; try { // Take request from queue req = queue.take(); //Depending on the request type if (req instanceof PoisonRequest) { //finish loop keepRunning = false; } else if (req instanceof AdditionRequest){ //add document to db db.addDocument(((AdditionRequest) req).getDocument()); // update instance of list dbDocs = db.loadDocumentList(); } else { // update instance of list dbDocs = db.loadDocumentList(); } } catch (InterruptedException e1) { e1.printStackTrace(); } } } /** * Add request to queue. * * @param ObjectStorageAccessRequest request */ public void query(ObjectStorageAccessRequest request) { try { queue.put(request); } catch (InterruptedException e) { e.printStackTrace(); } } /** * Returns List of documents in the database * * @return List<Document> */ public List<Document> getDocumentList(){ return this.dbDocs; } }
UTF-8
Java
2,001
java
ObjectStorageAccessController.java
Java
[ { "context": "cument objects from the database.\r\n * \r\n * @author RnDMizeD\r\n * @version 1.0b\r\n */\r\npublic class ObjectStorag", "end": 327, "score": 0.9995668530464172, "start": 319, "tag": "USERNAME", "value": "RnDMizeD" } ]
null
[]
package ie.gmit.db; import java.util.ArrayList; import java.util.List; import java.util.concurrent.BlockingQueue; import ie.gmit.sw.Document; /** * Runnable class using a BlockingQueue to control access Object Database. * Maintains a cached list of Document objects from the database. * * @author RnDMizeD * @version 1.0b */ public class ObjectStorageAccessController implements Runnable { private BlockingQueue<ObjectStorageAccessRequest> queue; private ObjectStorage db; private volatile boolean keepRunning; private volatile List<Document> dbDocs; /** * Instantiate ObjectStorageAccessController * * @param queue */ public ObjectStorageAccessController(BlockingQueue<ObjectStorageAccessRequest> queue) { this.queue = queue; keepRunning = true; db = new ObjectStorageImplementation("documents"); dbDocs = new ArrayList<>(); } @Override public void run() { while (keepRunning) { ObjectStorageAccessRequest req; try { // Take request from queue req = queue.take(); //Depending on the request type if (req instanceof PoisonRequest) { //finish loop keepRunning = false; } else if (req instanceof AdditionRequest){ //add document to db db.addDocument(((AdditionRequest) req).getDocument()); // update instance of list dbDocs = db.loadDocumentList(); } else { // update instance of list dbDocs = db.loadDocumentList(); } } catch (InterruptedException e1) { e1.printStackTrace(); } } } /** * Add request to queue. * * @param ObjectStorageAccessRequest request */ public void query(ObjectStorageAccessRequest request) { try { queue.put(request); } catch (InterruptedException e) { e.printStackTrace(); } } /** * Returns List of documents in the database * * @return List<Document> */ public List<Document> getDocumentList(){ return this.dbDocs; } }
2,001
0.668666
0.666667
84
21.821428
19.981039
88
false
false
0
0
0
0
0
0
1.964286
false
false
5
bd31982f4d30a80c88e91f4f67e5a5ec35f2ffd8
7,155,415,543,696
e7a777e1014ca43066f5d43019390ea8de95b297
/src/model/Component.java
325b1241981c9f25f81d6a25262fb737ca3ab5d6
[ "Apache-2.0" ]
permissive
bybardo/android-etymon-plugin
https://github.com/bybardo/android-etymon-plugin
fd40e92f60c645d998d8c41495f0b30eca9a3e4b
105694ea501b8bfd9bc136152f2266cd92491630
refs/heads/master
2020-08-31T21:43:45.682000
2019-11-07T11:46:13
2019-11-07T11:46:13
218,793,082
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package model; import java.util.List; public class Component { private String marker; private String name; private String description; private List<String> paths; private List<String> sharedPaths; public Component(String marker, String name, String description, List<String> paths, List<String> sharedPaths) { this.marker = marker; this.name = name; this.description = description; this.paths = paths; this.sharedPaths = sharedPaths; } public String getMarker() { return marker; } public String getName() { return name; } public String getDescription() { return description; } public List<String> getPaths() { return paths; } public List<String> getSharedPaths() { return sharedPaths; } }
UTF-8
Java
845
java
Component.java
Java
[]
null
[]
package model; import java.util.List; public class Component { private String marker; private String name; private String description; private List<String> paths; private List<String> sharedPaths; public Component(String marker, String name, String description, List<String> paths, List<String> sharedPaths) { this.marker = marker; this.name = name; this.description = description; this.paths = paths; this.sharedPaths = sharedPaths; } public String getMarker() { return marker; } public String getName() { return name; } public String getDescription() { return description; } public List<String> getPaths() { return paths; } public List<String> getSharedPaths() { return sharedPaths; } }
845
0.628402
0.628402
39
20.666666
20.833076
116
false
false
0
0
0
0
0
0
0.538462
false
false
5
eaf5d8cdeddd28d93778a8d6616bdfd6654b29d1
3,642,132,295,689
f28f5c6f239ee091d61c70c80171dd7c51f09d02
/Ambroise_JEE/src/test/java/fr/alten/ambroiseJEE/controller/business/ApplicantForumBusinessControllerTest.java
8573a271939a7535f284ce90e39235346035f187
[]
no_license
ambroisealten/back_end
https://github.com/ambroisealten/back_end
bc1ebc7f9ba9807709f5bab2d10aefd0aa84f84a
ae9d5c933d7f1d1d7f411b7840cb0106ffca6fd2
refs/heads/master
2023-05-11T01:15:42.006000
2019-07-08T06:45:14
2019-07-08T06:45:14
178,816,062
1
0
null
false
2023-04-27T23:54:09
2019-04-01T08:12:12
2019-07-08T06:46:35
2023-04-27T23:54:08
1,476
1
0
1
Java
false
false
package fr.alten.ambroiseJEE.controller.business; public class ApplicantForumBusinessControllerTest { }
UTF-8
Java
106
java
ApplicantForumBusinessControllerTest.java
Java
[]
null
[]
package fr.alten.ambroiseJEE.controller.business; public class ApplicantForumBusinessControllerTest { }
106
0.849057
0.849057
5
20.200001
24.342556
51
false
false
0
0
0
0
0
0
0.2
false
false
5
b4338be014a9611c24fc1f8ace720ee50badffbe
17,944,373,420,204
1fb5b7c874b99ee12a5ffaf638ea22ceed2fdad5
/src/main/java/com/lyrics/qq/shardingerror/commonenum/StatusEnum.java
c542253d96acb0e8ebc22de0b9073bd66f610d1c
[]
no_license
lyricsqq/shardingerror
https://github.com/lyricsqq/shardingerror
96290f8b1fd28857ca5c561c581cc17116ee2835
c2d9819db82a27340b3b921051b24c5fead8dccc
refs/heads/master
2022-07-01T03:37:57.885000
2019-11-12T09:05:02
2019-11-12T09:05:02
221,163,055
0
0
null
false
2022-06-17T02:39:25
2019-11-12T08:05:16
2019-11-12T09:05:19
2022-06-17T02:39:22
40
0
0
3
Java
false
false
package com.lyrics.qq.shardingerror.commonenum; import com.baomidou.mybatisplus.annotation.EnumValue; import lombok.Getter; /** * 删除状态码 */ @Getter public enum StatusEnum { DELETE(0,"删除"), //删除 NORMAL(1,"正常"); //正常 @EnumValue private Integer value; private String des; StatusEnum(Integer value, String des) { this.value = value; this.des = des; } }
UTF-8
Java
425
java
StatusEnum.java
Java
[]
null
[]
package com.lyrics.qq.shardingerror.commonenum; import com.baomidou.mybatisplus.annotation.EnumValue; import lombok.Getter; /** * 删除状态码 */ @Getter public enum StatusEnum { DELETE(0,"删除"), //删除 NORMAL(1,"正常"); //正常 @EnumValue private Integer value; private String des; StatusEnum(Integer value, String des) { this.value = value; this.des = des; } }
425
0.646617
0.641604
21
18
15.653996
53
false
false
0
0
0
0
0
0
0.571429
false
false
5
8dbd6a6c53654505cb7e243e3bd17a89acd8ffe0
24,498,493,477,914
2c9a73c03d7f683b3cc2469249d4bd5176ef9630
/app/src/main/java/com/suman/topic4/CapitalActivity.java
7604758c7442beb8f834d2abc02aeb1bd247e8b8
[]
no_license
SumanKhadka777/Topic4
https://github.com/SumanKhadka777/Topic4
83057023706b8432da27a69e65b86027cfc20cfc
f01104a04f187b9d5d5b8a3e216c252fabd03bad
refs/heads/master
2020-08-27T17:49:52.767000
2019-10-25T06:00:14
2019-10-25T06:00:14
217,450,152
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.suman.topic4; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.widget.TextView; import android.widget.Toast; public class CapitalActivity extends AppCompatActivity { TextView txtcapital; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_capital); TextView txtCapital = findViewById(R.id.txtCapital); Bundle bundle = getIntent().getExtras(); if (bundle!=null){ String capital = bundle.getString("Capital"); txtCapital.setText(capital); } else { Toast.makeText(this, "Not Found", Toast.LENGTH_SHORT).show(); } } }
UTF-8
Java
776
java
CapitalActivity.java
Java
[]
null
[]
package com.suman.topic4; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.widget.TextView; import android.widget.Toast; public class CapitalActivity extends AppCompatActivity { TextView txtcapital; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_capital); TextView txtCapital = findViewById(R.id.txtCapital); Bundle bundle = getIntent().getExtras(); if (bundle!=null){ String capital = bundle.getString("Capital"); txtCapital.setText(capital); } else { Toast.makeText(this, "Not Found", Toast.LENGTH_SHORT).show(); } } }
776
0.666237
0.664948
35
21.171429
22.752689
73
false
false
0
0
0
0
0
0
0.428571
false
false
5
db6a15e2fc1d983ca24844c6b15bdf6607279000
24,498,493,479,335
f743575fb52fef3f882a96e10990ad2e23c1026a
/app/src/main/java/com/a000webhostapp/dogspott/dogspottapp/PrincipalActivity.java
96cbcb8504f07a1488833931ec8fb6f71c88e124
[]
no_license
DanyDolphin/DogspottApp
https://github.com/DanyDolphin/DogspottApp
e2f51327e13f75bd4eba5d6993766d9e7dc204bb
4e9a95b23adb99505146d47cb8a7fe99668b5c68
refs/heads/master
2022-03-23T12:35:36.491000
2019-12-03T01:15:37
2019-12-03T01:15:37
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.a000webhostapp.dogspott.dogspottapp; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; /* La clase es para mostrar el contenido en un perfil después de haber iniciado sesión exitosamente en una cuenta */ public class PrincipalActivity extends AppCompatActivity{ /* Despliega el visor de contenido de una cuenta*/ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.content_login); } }
UTF-8
Java
532
java
PrincipalActivity.java
Java
[]
null
[]
package com.a000webhostapp.dogspott.dogspottapp; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; /* La clase es para mostrar el contenido en un perfil después de haber iniciado sesión exitosamente en una cuenta */ public class PrincipalActivity extends AppCompatActivity{ /* Despliega el visor de contenido de una cuenta*/ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.content_login); } }
532
0.766038
0.760377
18
28.444445
24.886904
70
false
false
0
0
0
0
0
0
0.277778
false
false
5
3c823e87186199da0eee5fd35a146722208b0700
1,331,439,895,883
95210013654275c1f1930954085e2608c8acb8ab
/libgdx-graph/src/com/gempukku/libgdx/graph/shader/node/ConfigurationCommonShaderNodeBuilder.java
df6751c0776c267443db8b5e61fee11148501001
[ "MIT" ]
permissive
Mr00Anderson/libgdx-graph
https://github.com/Mr00Anderson/libgdx-graph
8e7e9a83e35ac4c81f80119007f26f03862f6464
cf7f7bb734a68c22821c6cdf01425cfebeffdbfa
refs/heads/master
2022-12-15T21:27:06.201000
2020-09-10T05:56:13
2020-09-10T05:56:13
294,509,208
1
0
MIT
true
2020-09-10T19:55:47
2020-09-10T19:55:46
2020-09-10T05:56:23
2020-09-10T05:56:21
3,900
0
0
0
null
false
false
package com.gempukku.libgdx.graph.shader.node; import com.gempukku.libgdx.graph.data.NodeConfiguration; import com.gempukku.libgdx.graph.shader.GraphShader; import com.gempukku.libgdx.graph.shader.GraphShaderContext; import com.gempukku.libgdx.graph.shader.ShaderFieldType; import com.gempukku.libgdx.graph.shader.builder.CommonShaderBuilder; import com.gempukku.libgdx.graph.shader.builder.FragmentShaderBuilder; import com.gempukku.libgdx.graph.shader.builder.VertexShaderBuilder; import org.json.simple.JSONObject; import java.util.Map; import java.util.Set; public abstract class ConfigurationCommonShaderNodeBuilder extends ConfigurationShaderNodeBuilder { public ConfigurationCommonShaderNodeBuilder(NodeConfiguration<ShaderFieldType> configuration) { super(configuration); } protected abstract Map<String, ? extends FieldOutput> buildCommonNode(boolean designTime, String nodeId, JSONObject data, Map<String, FieldOutput> inputs, Set<String> producedOutputs, CommonShaderBuilder commonShaderBuilder, GraphShaderContext graphShaderContext, GraphShader graphShader); @Override public Map<String, ? extends FieldOutput> buildVertexNode(boolean designTime, String nodeId, JSONObject data, Map<String, FieldOutput> inputs, Set<String> producedOutputs, VertexShaderBuilder vertexShaderBuilder, GraphShaderContext graphShaderContext, GraphShader graphShader) { return buildCommonNode(designTime, nodeId, data, inputs, producedOutputs, vertexShaderBuilder, graphShaderContext, graphShader); } @Override public Map<String, ? extends FieldOutput> buildFragmentNode(boolean designTime, String nodeId, JSONObject data, Map<String, FieldOutput> inputs, Set<String> producedOutputs, VertexShaderBuilder vertexShaderBuilder, FragmentShaderBuilder fragmentShaderBuilder, GraphShaderContext graphShaderContext, GraphShader graphShader) { return buildCommonNode(designTime, nodeId, data, inputs, producedOutputs, fragmentShaderBuilder, graphShaderContext, graphShader); } }
UTF-8
Java
2,103
java
ConfigurationCommonShaderNodeBuilder.java
Java
[]
null
[]
package com.gempukku.libgdx.graph.shader.node; import com.gempukku.libgdx.graph.data.NodeConfiguration; import com.gempukku.libgdx.graph.shader.GraphShader; import com.gempukku.libgdx.graph.shader.GraphShaderContext; import com.gempukku.libgdx.graph.shader.ShaderFieldType; import com.gempukku.libgdx.graph.shader.builder.CommonShaderBuilder; import com.gempukku.libgdx.graph.shader.builder.FragmentShaderBuilder; import com.gempukku.libgdx.graph.shader.builder.VertexShaderBuilder; import org.json.simple.JSONObject; import java.util.Map; import java.util.Set; public abstract class ConfigurationCommonShaderNodeBuilder extends ConfigurationShaderNodeBuilder { public ConfigurationCommonShaderNodeBuilder(NodeConfiguration<ShaderFieldType> configuration) { super(configuration); } protected abstract Map<String, ? extends FieldOutput> buildCommonNode(boolean designTime, String nodeId, JSONObject data, Map<String, FieldOutput> inputs, Set<String> producedOutputs, CommonShaderBuilder commonShaderBuilder, GraphShaderContext graphShaderContext, GraphShader graphShader); @Override public Map<String, ? extends FieldOutput> buildVertexNode(boolean designTime, String nodeId, JSONObject data, Map<String, FieldOutput> inputs, Set<String> producedOutputs, VertexShaderBuilder vertexShaderBuilder, GraphShaderContext graphShaderContext, GraphShader graphShader) { return buildCommonNode(designTime, nodeId, data, inputs, producedOutputs, vertexShaderBuilder, graphShaderContext, graphShader); } @Override public Map<String, ? extends FieldOutput> buildFragmentNode(boolean designTime, String nodeId, JSONObject data, Map<String, FieldOutput> inputs, Set<String> producedOutputs, VertexShaderBuilder vertexShaderBuilder, FragmentShaderBuilder fragmentShaderBuilder, GraphShaderContext graphShaderContext, GraphShader graphShader) { return buildCommonNode(designTime, nodeId, data, inputs, producedOutputs, fragmentShaderBuilder, graphShaderContext, graphShader); } }
2,103
0.798859
0.798859
32
64.71875
80.98967
329
false
false
0
0
0
0
0
0
1.78125
false
false
5
9949b0beb4b4678aefeafda03beacda9b5c24738
20,169,166,430,590
babd26f0f070af66d7ef803344c448feebd90cf2
/APS/src/main/java/br/com/aps/unip/service/FuncaoEmpregadoService.java
aee578f0a7aef5ba9b3edd33ffd11b39120bc400
[]
no_license
gabrielgonoring/aps
https://github.com/gabrielgonoring/aps
154584ee11f3cec42a845233193143773be31ec5
2c1bb923d974b4c2ce7cd7563fe6191ddfa00ed4
refs/heads/master
2020-05-24T23:00:02.610000
2019-05-19T17:57:45
2019-05-19T17:57:45
187,506,467
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.aps.unip.service; import java.util.List; import javax.persistence.EntityManager; import br.com.aps.unip.data.FuncaoEmpregadoDAO; import br.com.aps.unip.exception.ValorInvalidoException; import br.com.aps.unip.model.Compra; import br.com.aps.unip.model.FuncaoEmpregado; import br.com.aps.unip.model.ItemCompra; public class FuncaoEmpregadoService { private FuncaoEmpregadoDAO dao; private EntityManager em; public FuncaoEmpregadoService(EntityManager em) { dao = new FuncaoEmpregadoDAO(em); this.em=em; } public boolean save(FuncaoEmpregado funcaoEmpregado) throws Exception { try { checkIllegalArguments(funcaoEmpregado); em.getTransaction().begin(); dao.save(funcaoEmpregado); em.getTransaction().commit(); return true; }catch (Exception e) { // TODO: handle exception em.getTransaction().rollback(); throw new Exception(e.getMessage()); } } public List<FuncaoEmpregado>getList() { return dao.getList(); } public boolean update(FuncaoEmpregado funcaoEmpregado) throws Exception { try { checkIllegalArguments(funcaoEmpregado); em.getTransaction().begin(); dao.update(funcaoEmpregado); em.getTransaction().commit(); return true; } catch (Exception e) { // TODO Auto-generated catch block em.getTransaction().rollback(); throw new Exception(e.getMessage()); } } public boolean delete(FuncaoEmpregado funcaoEmpregado)throws Exception{ try { em.getTransaction().begin(); dao.delete(funcaoEmpregado); em.getTransaction().commit(); return true; } catch (Exception e) { // TODO: handle exception em.getTransaction().rollback(); throw new Exception(e.getMessage()); } } private void checkIllegalArguments(FuncaoEmpregado funcaoEmpregado) { if(funcaoEmpregado.getAtivo() == null) throw new ValorInvalidoException("ativo não pode ser nulo"); if(funcaoEmpregado.getAtivo() == false) throw new ValorInvalidoException("ativo não pode ser false"); if(funcaoEmpregado.getNome() == null) throw new ValorInvalidoException("o nome não pode ser nulo"); if(funcaoEmpregado.getSalario() == null) throw new ValorInvalidoException("o salário não pode ser nulo"); } }
UTF-8
Java
2,317
java
FuncaoEmpregadoService.java
Java
[]
null
[]
package br.com.aps.unip.service; import java.util.List; import javax.persistence.EntityManager; import br.com.aps.unip.data.FuncaoEmpregadoDAO; import br.com.aps.unip.exception.ValorInvalidoException; import br.com.aps.unip.model.Compra; import br.com.aps.unip.model.FuncaoEmpregado; import br.com.aps.unip.model.ItemCompra; public class FuncaoEmpregadoService { private FuncaoEmpregadoDAO dao; private EntityManager em; public FuncaoEmpregadoService(EntityManager em) { dao = new FuncaoEmpregadoDAO(em); this.em=em; } public boolean save(FuncaoEmpregado funcaoEmpregado) throws Exception { try { checkIllegalArguments(funcaoEmpregado); em.getTransaction().begin(); dao.save(funcaoEmpregado); em.getTransaction().commit(); return true; }catch (Exception e) { // TODO: handle exception em.getTransaction().rollback(); throw new Exception(e.getMessage()); } } public List<FuncaoEmpregado>getList() { return dao.getList(); } public boolean update(FuncaoEmpregado funcaoEmpregado) throws Exception { try { checkIllegalArguments(funcaoEmpregado); em.getTransaction().begin(); dao.update(funcaoEmpregado); em.getTransaction().commit(); return true; } catch (Exception e) { // TODO Auto-generated catch block em.getTransaction().rollback(); throw new Exception(e.getMessage()); } } public boolean delete(FuncaoEmpregado funcaoEmpregado)throws Exception{ try { em.getTransaction().begin(); dao.delete(funcaoEmpregado); em.getTransaction().commit(); return true; } catch (Exception e) { // TODO: handle exception em.getTransaction().rollback(); throw new Exception(e.getMessage()); } } private void checkIllegalArguments(FuncaoEmpregado funcaoEmpregado) { if(funcaoEmpregado.getAtivo() == null) throw new ValorInvalidoException("ativo não pode ser nulo"); if(funcaoEmpregado.getAtivo() == false) throw new ValorInvalidoException("ativo não pode ser false"); if(funcaoEmpregado.getNome() == null) throw new ValorInvalidoException("o nome não pode ser nulo"); if(funcaoEmpregado.getSalario() == null) throw new ValorInvalidoException("o salário não pode ser nulo"); } }
2,317
0.701557
0.701557
84
25.523809
21.131941
74
false
false
0
0
0
0
0
0
2.261905
false
false
5
1f72bbe6710ad38dc207f72be1854af0830f5b7d
18,537,078,859,901
6af1e337ad178aa5b5a574ec0bf940b34ec852b2
/app/src/main/java/choiyh1006/example/com/seouldal2/foodMapPage.java
6ac88a6d78a6dbd052e74c4d832b90213cc01434
[ "MIT" ]
permissive
MobileSeoul/2015seoul-03
https://github.com/MobileSeoul/2015seoul-03
1a0670f757794482f7f9d28c2aac778ac744ec5e
ba8f695ecdd3409b3fc753a15e3441ef5119bec3
refs/heads/master
2021-05-16T11:14:02.981000
2017-09-27T01:00:23
2017-09-27T01:00:23
104,954,005
4
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package choiyh1006.example.com.seouldal2; import android.content.Context; import android.content.Intent; import android.graphics.Typeface; import android.location.LocationManager; import android.os.AsyncTask; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.util.Log; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.Marker; import com.google.android.gms.maps.model.MarkerOptions; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; public class foodMapPage extends FragmentActivity { SupportMapFragment fragment; GoogleMap googleMap; Marker marker; TextView title, t_name, t_desc, t_loc1, t_loc2, t_call; LocationManager locationManager; RelativeLayout photo; String name= ""; String desc = ""; String loc1 = ""; String loc2 = ""; String call = ""; double longi, lati; int likes; int pos, now_pos; Typeface typeRe; Typeface typeBo; Typeface typeLi; phpDown task; @Override protected void onCreate(Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN); super.onCreate(savedInstanceState); setContentView(R.layout.activity_food_map_page); typeRe = Typeface.createFromAsset(getAssets(), "titi_regular.otf"); typeBo = Typeface.createFromAsset(getAssets(), "titi_bold.otf"); typeLi = Typeface.createFromAsset(getAssets(), "titi_light.otf"); photo =(RelativeLayout)findViewById(R.id.photo); t_name = (TextView)findViewById(R.id.name); t_desc = (TextView)findViewById(R.id.desc); t_loc1= (TextView)findViewById(R.id.loc1); t_loc2 = (TextView)findViewById(R.id.loc2); t_call = (TextView)findViewById(R.id.call); Intent intent = getIntent(); name = intent.getExtras().getString("name"); desc = intent.getExtras().getString("desc"); loc1 = intent.getExtras().getString("loc1"); loc2 = intent.getExtras().getString("loc2"); call = intent.getExtras().getString("call"); longi = intent.getExtras().getDouble("longi"); lati = intent.getExtras().getDouble("lati"); likes = intent.getExtras().getInt("like"); pos = intent.getExtras().getInt("pos"); now_pos = intent.getExtras().getInt("now"); switch(now_pos){ case 0: if(pos == 0) photo.setBackgroundResource(R.drawable.f0101); else if(pos == 1) photo.setBackgroundResource(R.drawable.f0102); else if(pos == 2) photo.setBackgroundResource(R.drawable.f0103); else if(pos == 3) photo.setBackgroundResource(R.drawable.f0104); else if(pos == 4) photo.setBackgroundResource(R.drawable.f0105); else if(pos == 5) photo.setBackgroundResource(R.drawable.f0106); else if(pos == 6) photo.setBackgroundResource(R.drawable.f0107); else if(pos == 7) photo.setBackgroundResource(R.drawable.f0108); else if(pos == 8) photo.setBackgroundResource(R.drawable.f0109); else if(pos == 9) photo.setBackgroundResource(R.drawable.f0110); break; case 1: if(pos == 0) photo.setBackgroundResource(R.drawable.f0201); else if(pos == 1) photo.setBackgroundResource(R.drawable.f0202); else if(pos == 2) photo.setBackgroundResource(R.drawable.f0203); else if(pos == 3) photo.setBackgroundResource(R.drawable.f0204); else if(pos == 4) photo.setBackgroundResource(R.drawable.f0205); else if(pos == 5) photo.setBackgroundResource(R.drawable.f0206); else if(pos == 6) photo.setBackgroundResource(R.drawable.f0207); else if(pos == 7) photo.setBackgroundResource(R.drawable.f0208); else if(pos == 8) photo.setBackgroundResource(R.drawable.f0210); break; case 2: if(pos == 0) photo.setBackgroundResource(R.drawable.f0301); else if(pos == 1) photo.setBackgroundResource(R.drawable.f0302); else if(pos == 2) photo.setBackgroundResource(R.drawable.f0303); else if(pos == 3) photo.setBackgroundResource(R.drawable.f0304); else if(pos == 4) photo.setBackgroundResource(R.drawable.f0305); else if(pos == 5) photo.setBackgroundResource(R.drawable.f0306); else if(pos == 6) photo.setBackgroundResource(R.drawable.f0307); else if(pos == 7) photo.setBackgroundResource(R.drawable.f0308); else if(pos == 8) photo.setBackgroundResource(R.drawable.f0309); else if(pos == 9) photo.setBackgroundResource(R.drawable.f0310); break; case 3: if(pos == 0) photo.setBackgroundResource(R.drawable.f0401); else if(pos == 1) photo.setBackgroundResource(R.drawable.f0402); else if(pos == 2) photo.setBackgroundResource(R.drawable.f0403); else if(pos == 3) photo.setBackgroundResource(R.drawable.f0404); else if(pos == 4) photo.setBackgroundResource(R.drawable.f0405); else if(pos == 5) photo.setBackgroundResource(R.drawable.f0406); else if(pos == 6) photo.setBackgroundResource(R.drawable.f0407); else if(pos == 7) photo.setBackgroundResource(R.drawable.f0408); else if(pos == 8) photo.setBackgroundResource(R.drawable.f0409); break; case 4: if(pos == 0) photo.setBackgroundResource(R.drawable.f0501); else if(pos == 1) photo.setBackgroundResource(R.drawable.f0502); else if(pos == 2) photo.setBackgroundResource(R.drawable.f0503); else if(pos == 3) photo.setBackgroundResource(R.drawable.f0504); else if(pos == 4) photo.setBackgroundResource(R.drawable.f0505); else if(pos == 5) photo.setBackgroundResource(R.drawable.f0506); else if(pos == 6) photo.setBackgroundResource(R.drawable.f0507); else if(pos == 7) photo.setBackgroundResource(R.drawable.f0508); else if(pos == 8) photo.setBackgroundResource(R.drawable.f0509); else if(pos == 9) photo.setBackgroundResource(R.drawable.f0510); break; case 5: if(pos == 0) photo.setBackgroundResource(R.drawable.f0601); else if(pos == 1) photo.setBackgroundResource(R.drawable.f0602); else if(pos == 2) photo.setBackgroundResource(R.drawable.f0603); else if(pos == 3) photo.setBackgroundResource(R.drawable.f0604); else if(pos == 4) photo.setBackgroundResource(R.drawable.f0605); else if(pos == 5) photo.setBackgroundResource(R.drawable.f0606); else if(pos == 6) photo.setBackgroundResource(R.drawable.f0607); else if(pos == 7) photo.setBackgroundResource(R.drawable.f0608); else if(pos == 8) photo.setBackgroundResource(R.drawable.f0609); else if(pos == 9) photo.setBackgroundResource(R.drawable.f0610); break; case 6: if(pos == 0) photo.setBackgroundResource(R.drawable.f0701); else if(pos == 1) photo.setBackgroundResource(R.drawable.f0702); else if(pos == 2) photo.setBackgroundResource(R.drawable.f0703); else if(pos == 3) photo.setBackgroundResource(R.drawable.f0704); else if(pos == 4) photo.setBackgroundResource(R.drawable.f0705); else if(pos == 5) photo.setBackgroundResource(R.drawable.f0706); else if(pos == 6) photo.setBackgroundResource(R.drawable.f0707); else if(pos == 7) photo.setBackgroundResource(R.drawable.f0708); else if(pos == 8) photo.setBackgroundResource(R.drawable.f0709); else if(pos == 9) photo.setBackgroundResource(R.drawable.f0710); break; case 7: if(pos == 0) photo.setBackgroundResource(R.drawable.f0801); else if(pos == 1) photo.setBackgroundResource(R.drawable.f0802); else if(pos == 2) photo.setBackgroundResource(R.drawable.f0803); else if(pos == 3) photo.setBackgroundResource(R.drawable.f0804); else if(pos == 4) photo.setBackgroundResource(R.drawable.f0805); else if(pos == 5) photo.setBackgroundResource(R.drawable.f0806); else if(pos == 6) photo.setBackgroundResource(R.drawable.f0807); else if(pos == 7) photo.setBackgroundResource(R.drawable.f0808); else if(pos == 8) photo.setBackgroundResource(R.drawable.f0809); else if(pos == 9) photo.setBackgroundResource(R.drawable.f0810); break; case 8: if(pos == 0) photo.setBackgroundResource(R.drawable.f0901); else if(pos == 1) photo.setBackgroundResource(R.drawable.f0902); else if(pos == 2) photo.setBackgroundResource(R.drawable.f0903); else if(pos == 3) photo.setBackgroundResource(R.drawable.f0904); else if(pos == 4) photo.setBackgroundResource(R.drawable.f0905); else if(pos == 5) photo.setBackgroundResource(R.drawable.f0906); else if(pos == 6) photo.setBackgroundResource(R.drawable.f0907); else if(pos == 7) photo.setBackgroundResource(R.drawable.f0908); else if(pos == 8) photo.setBackgroundResource(R.drawable.f0909); else if(pos == 9) photo.setBackgroundResource(R.drawable.f0910); break; case 9: if(pos == 0) photo.setBackgroundResource(R.drawable.f1001); else if(pos == 1) photo.setBackgroundResource(R.drawable.f1002); else if(pos == 2) photo.setBackgroundResource(R.drawable.f1003); else if(pos == 3) photo.setBackgroundResource(R.drawable.f1004); else if(pos == 4) photo.setBackgroundResource(R.drawable.f1005); else if(pos == 5) photo.setBackgroundResource(R.drawable.f1006); else if(pos == 6) photo.setBackgroundResource(R.drawable.f1007); else if(pos == 7) photo.setBackgroundResource(R.drawable.f1008); else if(pos == 8) photo.setBackgroundResource(R.drawable.f1009); else if(pos == 9) photo.setBackgroundResource(R.drawable.f1010); break; } t_name.setText(name); t_desc.setText(desc); t_loc1.setText(loc1); t_loc2.setText(loc2); t_call.setText(call); t_name.setTypeface(typeRe); t_desc.setTypeface(typeLi); t_loc1.setTypeface(typeLi); t_loc2.setTypeface(typeLi); t_call.setTypeface(typeLi); title = (TextView)findViewById(R.id.title); title.setTypeface(typeBo); title.setText(name); // 위치정보 관리자를 생성한다. locationManager = (LocationManager) getSystemService( Context.LOCATION_SERVICE); // fragment = (SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.fragment); fragment =(SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.fragment); googleMap = fragment.getMap(); GpsInfo gps = new GpsInfo(foodMapPage.this); double latitude = gps.getLatitude(); double longitude = gps.getLongitude(); // Creating a LatLng object for the current location LatLng latLng = new LatLng(lati, longi); // Showing the current location in Google Map googleMap.moveCamera(CameraUpdateFactory.newLatLng(latLng)); // Map 을 zoom 합니다. googleMap.animateCamera(CameraUpdateFactory.zoomTo(17)); MarkerOptions optFirst = new MarkerOptions(); optFirst.position(latLng);// 위도 • 경도 optFirst.title(name);// 제목 미리보기 optFirst.snippet(desc); // optFirst.icon(BitmapDescriptorFactory.fromResource( // R.drawable.ic_launcher)); googleMap.addMarker(optFirst).showInfoWindow(); } public void onClick(View v){ switch(v.getId()){ case R.id.back_btn: finish(); break; case R.id.like_btn: task = new phpDown(); String like = String.valueOf(likes+1); String[] n_name = name.split(" "); name = delete_space(n_name); task.execute("http://toad45.mireene.com/save_like.php?name="+name+"&like="+like); Toast.makeText(foodMapPage.this, "Success!", Toast.LENGTH_SHORT).show(); break; } } public String delete_space(String[] str){ String new_str = ""; for(int j=0; j<str.length; j++){ new_str+=str[j]; if(j!=str.length-1){ new_str+="%20"; } } return new_str; } private class phpDown extends AsyncTask<String, Integer,String> { @Override protected String doInBackground(String... urls) { StringBuilder jsonHtml = new StringBuilder(); try{ // 연결 url 설정 URL url = new URL(urls[0]); // 커넥션 객체 생성 HttpURLConnection conn = (HttpURLConnection)url.openConnection(); // 연결되었으면. if(conn != null){ conn.setConnectTimeout(10000); conn.setUseCaches(false); // 연결되었음 코드가 리턴되면. if(conn.getResponseCode() == HttpURLConnection.HTTP_OK){ BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8")); for(;;){ // 웹상에 보여지는 텍스트를 라인단위로 읽어 저장. String line = br.readLine(); if(line == null) break; // 저장된 텍스트 라인을 jsonHtml에 붙여넣음 jsonHtml.append(line + "\n"); } br.close(); } conn.disconnect(); } } catch(Exception ex){ ex.printStackTrace(); } return jsonHtml.toString(); } protected void onPostExecute(String str){ Log.d("str", str); //txtView.setText(str); } } }
UTF-8
Java
17,385
java
foodMapPage.java
Java
[]
null
[]
package choiyh1006.example.com.seouldal2; import android.content.Context; import android.content.Intent; import android.graphics.Typeface; import android.location.LocationManager; import android.os.AsyncTask; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.util.Log; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.Marker; import com.google.android.gms.maps.model.MarkerOptions; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; public class foodMapPage extends FragmentActivity { SupportMapFragment fragment; GoogleMap googleMap; Marker marker; TextView title, t_name, t_desc, t_loc1, t_loc2, t_call; LocationManager locationManager; RelativeLayout photo; String name= ""; String desc = ""; String loc1 = ""; String loc2 = ""; String call = ""; double longi, lati; int likes; int pos, now_pos; Typeface typeRe; Typeface typeBo; Typeface typeLi; phpDown task; @Override protected void onCreate(Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN); super.onCreate(savedInstanceState); setContentView(R.layout.activity_food_map_page); typeRe = Typeface.createFromAsset(getAssets(), "titi_regular.otf"); typeBo = Typeface.createFromAsset(getAssets(), "titi_bold.otf"); typeLi = Typeface.createFromAsset(getAssets(), "titi_light.otf"); photo =(RelativeLayout)findViewById(R.id.photo); t_name = (TextView)findViewById(R.id.name); t_desc = (TextView)findViewById(R.id.desc); t_loc1= (TextView)findViewById(R.id.loc1); t_loc2 = (TextView)findViewById(R.id.loc2); t_call = (TextView)findViewById(R.id.call); Intent intent = getIntent(); name = intent.getExtras().getString("name"); desc = intent.getExtras().getString("desc"); loc1 = intent.getExtras().getString("loc1"); loc2 = intent.getExtras().getString("loc2"); call = intent.getExtras().getString("call"); longi = intent.getExtras().getDouble("longi"); lati = intent.getExtras().getDouble("lati"); likes = intent.getExtras().getInt("like"); pos = intent.getExtras().getInt("pos"); now_pos = intent.getExtras().getInt("now"); switch(now_pos){ case 0: if(pos == 0) photo.setBackgroundResource(R.drawable.f0101); else if(pos == 1) photo.setBackgroundResource(R.drawable.f0102); else if(pos == 2) photo.setBackgroundResource(R.drawable.f0103); else if(pos == 3) photo.setBackgroundResource(R.drawable.f0104); else if(pos == 4) photo.setBackgroundResource(R.drawable.f0105); else if(pos == 5) photo.setBackgroundResource(R.drawable.f0106); else if(pos == 6) photo.setBackgroundResource(R.drawable.f0107); else if(pos == 7) photo.setBackgroundResource(R.drawable.f0108); else if(pos == 8) photo.setBackgroundResource(R.drawable.f0109); else if(pos == 9) photo.setBackgroundResource(R.drawable.f0110); break; case 1: if(pos == 0) photo.setBackgroundResource(R.drawable.f0201); else if(pos == 1) photo.setBackgroundResource(R.drawable.f0202); else if(pos == 2) photo.setBackgroundResource(R.drawable.f0203); else if(pos == 3) photo.setBackgroundResource(R.drawable.f0204); else if(pos == 4) photo.setBackgroundResource(R.drawable.f0205); else if(pos == 5) photo.setBackgroundResource(R.drawable.f0206); else if(pos == 6) photo.setBackgroundResource(R.drawable.f0207); else if(pos == 7) photo.setBackgroundResource(R.drawable.f0208); else if(pos == 8) photo.setBackgroundResource(R.drawable.f0210); break; case 2: if(pos == 0) photo.setBackgroundResource(R.drawable.f0301); else if(pos == 1) photo.setBackgroundResource(R.drawable.f0302); else if(pos == 2) photo.setBackgroundResource(R.drawable.f0303); else if(pos == 3) photo.setBackgroundResource(R.drawable.f0304); else if(pos == 4) photo.setBackgroundResource(R.drawable.f0305); else if(pos == 5) photo.setBackgroundResource(R.drawable.f0306); else if(pos == 6) photo.setBackgroundResource(R.drawable.f0307); else if(pos == 7) photo.setBackgroundResource(R.drawable.f0308); else if(pos == 8) photo.setBackgroundResource(R.drawable.f0309); else if(pos == 9) photo.setBackgroundResource(R.drawable.f0310); break; case 3: if(pos == 0) photo.setBackgroundResource(R.drawable.f0401); else if(pos == 1) photo.setBackgroundResource(R.drawable.f0402); else if(pos == 2) photo.setBackgroundResource(R.drawable.f0403); else if(pos == 3) photo.setBackgroundResource(R.drawable.f0404); else if(pos == 4) photo.setBackgroundResource(R.drawable.f0405); else if(pos == 5) photo.setBackgroundResource(R.drawable.f0406); else if(pos == 6) photo.setBackgroundResource(R.drawable.f0407); else if(pos == 7) photo.setBackgroundResource(R.drawable.f0408); else if(pos == 8) photo.setBackgroundResource(R.drawable.f0409); break; case 4: if(pos == 0) photo.setBackgroundResource(R.drawable.f0501); else if(pos == 1) photo.setBackgroundResource(R.drawable.f0502); else if(pos == 2) photo.setBackgroundResource(R.drawable.f0503); else if(pos == 3) photo.setBackgroundResource(R.drawable.f0504); else if(pos == 4) photo.setBackgroundResource(R.drawable.f0505); else if(pos == 5) photo.setBackgroundResource(R.drawable.f0506); else if(pos == 6) photo.setBackgroundResource(R.drawable.f0507); else if(pos == 7) photo.setBackgroundResource(R.drawable.f0508); else if(pos == 8) photo.setBackgroundResource(R.drawable.f0509); else if(pos == 9) photo.setBackgroundResource(R.drawable.f0510); break; case 5: if(pos == 0) photo.setBackgroundResource(R.drawable.f0601); else if(pos == 1) photo.setBackgroundResource(R.drawable.f0602); else if(pos == 2) photo.setBackgroundResource(R.drawable.f0603); else if(pos == 3) photo.setBackgroundResource(R.drawable.f0604); else if(pos == 4) photo.setBackgroundResource(R.drawable.f0605); else if(pos == 5) photo.setBackgroundResource(R.drawable.f0606); else if(pos == 6) photo.setBackgroundResource(R.drawable.f0607); else if(pos == 7) photo.setBackgroundResource(R.drawable.f0608); else if(pos == 8) photo.setBackgroundResource(R.drawable.f0609); else if(pos == 9) photo.setBackgroundResource(R.drawable.f0610); break; case 6: if(pos == 0) photo.setBackgroundResource(R.drawable.f0701); else if(pos == 1) photo.setBackgroundResource(R.drawable.f0702); else if(pos == 2) photo.setBackgroundResource(R.drawable.f0703); else if(pos == 3) photo.setBackgroundResource(R.drawable.f0704); else if(pos == 4) photo.setBackgroundResource(R.drawable.f0705); else if(pos == 5) photo.setBackgroundResource(R.drawable.f0706); else if(pos == 6) photo.setBackgroundResource(R.drawable.f0707); else if(pos == 7) photo.setBackgroundResource(R.drawable.f0708); else if(pos == 8) photo.setBackgroundResource(R.drawable.f0709); else if(pos == 9) photo.setBackgroundResource(R.drawable.f0710); break; case 7: if(pos == 0) photo.setBackgroundResource(R.drawable.f0801); else if(pos == 1) photo.setBackgroundResource(R.drawable.f0802); else if(pos == 2) photo.setBackgroundResource(R.drawable.f0803); else if(pos == 3) photo.setBackgroundResource(R.drawable.f0804); else if(pos == 4) photo.setBackgroundResource(R.drawable.f0805); else if(pos == 5) photo.setBackgroundResource(R.drawable.f0806); else if(pos == 6) photo.setBackgroundResource(R.drawable.f0807); else if(pos == 7) photo.setBackgroundResource(R.drawable.f0808); else if(pos == 8) photo.setBackgroundResource(R.drawable.f0809); else if(pos == 9) photo.setBackgroundResource(R.drawable.f0810); break; case 8: if(pos == 0) photo.setBackgroundResource(R.drawable.f0901); else if(pos == 1) photo.setBackgroundResource(R.drawable.f0902); else if(pos == 2) photo.setBackgroundResource(R.drawable.f0903); else if(pos == 3) photo.setBackgroundResource(R.drawable.f0904); else if(pos == 4) photo.setBackgroundResource(R.drawable.f0905); else if(pos == 5) photo.setBackgroundResource(R.drawable.f0906); else if(pos == 6) photo.setBackgroundResource(R.drawable.f0907); else if(pos == 7) photo.setBackgroundResource(R.drawable.f0908); else if(pos == 8) photo.setBackgroundResource(R.drawable.f0909); else if(pos == 9) photo.setBackgroundResource(R.drawable.f0910); break; case 9: if(pos == 0) photo.setBackgroundResource(R.drawable.f1001); else if(pos == 1) photo.setBackgroundResource(R.drawable.f1002); else if(pos == 2) photo.setBackgroundResource(R.drawable.f1003); else if(pos == 3) photo.setBackgroundResource(R.drawable.f1004); else if(pos == 4) photo.setBackgroundResource(R.drawable.f1005); else if(pos == 5) photo.setBackgroundResource(R.drawable.f1006); else if(pos == 6) photo.setBackgroundResource(R.drawable.f1007); else if(pos == 7) photo.setBackgroundResource(R.drawable.f1008); else if(pos == 8) photo.setBackgroundResource(R.drawable.f1009); else if(pos == 9) photo.setBackgroundResource(R.drawable.f1010); break; } t_name.setText(name); t_desc.setText(desc); t_loc1.setText(loc1); t_loc2.setText(loc2); t_call.setText(call); t_name.setTypeface(typeRe); t_desc.setTypeface(typeLi); t_loc1.setTypeface(typeLi); t_loc2.setTypeface(typeLi); t_call.setTypeface(typeLi); title = (TextView)findViewById(R.id.title); title.setTypeface(typeBo); title.setText(name); // 위치정보 관리자를 생성한다. locationManager = (LocationManager) getSystemService( Context.LOCATION_SERVICE); // fragment = (SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.fragment); fragment =(SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.fragment); googleMap = fragment.getMap(); GpsInfo gps = new GpsInfo(foodMapPage.this); double latitude = gps.getLatitude(); double longitude = gps.getLongitude(); // Creating a LatLng object for the current location LatLng latLng = new LatLng(lati, longi); // Showing the current location in Google Map googleMap.moveCamera(CameraUpdateFactory.newLatLng(latLng)); // Map 을 zoom 합니다. googleMap.animateCamera(CameraUpdateFactory.zoomTo(17)); MarkerOptions optFirst = new MarkerOptions(); optFirst.position(latLng);// 위도 • 경도 optFirst.title(name);// 제목 미리보기 optFirst.snippet(desc); // optFirst.icon(BitmapDescriptorFactory.fromResource( // R.drawable.ic_launcher)); googleMap.addMarker(optFirst).showInfoWindow(); } public void onClick(View v){ switch(v.getId()){ case R.id.back_btn: finish(); break; case R.id.like_btn: task = new phpDown(); String like = String.valueOf(likes+1); String[] n_name = name.split(" "); name = delete_space(n_name); task.execute("http://toad45.mireene.com/save_like.php?name="+name+"&like="+like); Toast.makeText(foodMapPage.this, "Success!", Toast.LENGTH_SHORT).show(); break; } } public String delete_space(String[] str){ String new_str = ""; for(int j=0; j<str.length; j++){ new_str+=str[j]; if(j!=str.length-1){ new_str+="%20"; } } return new_str; } private class phpDown extends AsyncTask<String, Integer,String> { @Override protected String doInBackground(String... urls) { StringBuilder jsonHtml = new StringBuilder(); try{ // 연결 url 설정 URL url = new URL(urls[0]); // 커넥션 객체 생성 HttpURLConnection conn = (HttpURLConnection)url.openConnection(); // 연결되었으면. if(conn != null){ conn.setConnectTimeout(10000); conn.setUseCaches(false); // 연결되었음 코드가 리턴되면. if(conn.getResponseCode() == HttpURLConnection.HTTP_OK){ BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8")); for(;;){ // 웹상에 보여지는 텍스트를 라인단위로 읽어 저장. String line = br.readLine(); if(line == null) break; // 저장된 텍스트 라인을 jsonHtml에 붙여넣음 jsonHtml.append(line + "\n"); } br.close(); } conn.disconnect(); } } catch(Exception ex){ ex.printStackTrace(); } return jsonHtml.toString(); } protected void onPostExecute(String str){ Log.d("str", str); //txtView.setText(str); } } }
17,385
0.52909
0.497704
422
39.765404
22.086311
118
false
false
0
0
0
0
0
0
0.601896
false
false
5
d2c19d97881c1701a24cb8d1c40ced977fa55616
31,808,527,812,001
59decc79374bee2c81c1f2df2c044d683512be9b
/Composite/src/Pessoa.java
02be3c9579f2b196bb7a2e56241f869111fcce46
[]
no_license
jrhenriquerf/PadroesDeProjetos
https://github.com/jrhenriquerf/PadroesDeProjetos
fc06e5c3034022511445b0f0eefa94afa68d593f
b28b57b4b3e89c35165a9d150862d926edb8922e
refs/heads/master
2020-07-02T21:27:41.420000
2019-08-10T19:54:55
2019-08-10T19:54:55
201,671,324
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.ArrayList; public abstract class Pessoa { String nomeDaPessoa; public void printNomePessoa() { System.out.println(this.nomeDaPessoa); } public String getNomeDaPessoa() { return this.nomeDaPessoa; } public void adicionarFilho(Pessoa filho) throws Exception { throw new Exception("Não pode ter filhos!"); } public ArrayList<Pessoa> verificarFilhos() throws Exception { throw new Exception("Não possui filhos!"); } }
UTF-8
Java
506
java
Pessoa.java
Java
[]
null
[]
import java.util.ArrayList; public abstract class Pessoa { String nomeDaPessoa; public void printNomePessoa() { System.out.println(this.nomeDaPessoa); } public String getNomeDaPessoa() { return this.nomeDaPessoa; } public void adicionarFilho(Pessoa filho) throws Exception { throw new Exception("Não pode ter filhos!"); } public ArrayList<Pessoa> verificarFilhos() throws Exception { throw new Exception("Não possui filhos!"); } }
506
0.670635
0.670635
21
23
22.247526
65
false
false
0
0
0
0
0
0
0.285714
false
false
5
8376eb274733c89eb63eb348e45d690405b8233f
31,241,592,146,514
cae842ee80875bf7d9787c9835edc64e50ee3d04
/src/main/java/com/opensc/cryptopunksserver/service/CryptoPunkService.java
7a34a6e83956d8dc1eed56387b2d7a0c58ff35a4
[]
no_license
mithuns/cryptopunks-server
https://github.com/mithuns/cryptopunks-server
7b1f48fd98b9a2220144a7e3af7315f317550cff
e5df2e1a92d8e94649fe72fa178f61c53134bece
refs/heads/master
2020-07-27T00:20:26.281000
2019-09-17T05:57:28
2019-09-17T05:57:28
208,807,142
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.opensc.cryptopunksserver.service; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.web3j.protocol.Web3j; import org.web3j.protocol.core.methods.response.Web3ClientVersion; import javax.annotation.PostConstruct; import java.io.IOException; @Service public class CryptoPunkService { @Autowired private Web3j web3j; private Logger logger = LoggerFactory.getLogger(getClass()); public String getClientVersion() throws IOException { Web3ClientVersion web3ClientVersion = web3j.web3ClientVersion().send(); return web3ClientVersion.getWeb3ClientVersion(); } /*@PostConstruct public void listen() { web3j.transactionFlowable().subscribe(tx -> { logger.info("BlockHash: {}, BlockNumber:{},Input: {}, Creates: {}, Gas: {}", tx.getBlockHash(), tx.getBlockNumber(), tx.getInput(),tx.getCreates(),tx.getGas()); }); }*/ }
UTF-8
Java
1,073
java
CryptoPunkService.java
Java
[]
null
[]
package com.opensc.cryptopunksserver.service; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.web3j.protocol.Web3j; import org.web3j.protocol.core.methods.response.Web3ClientVersion; import javax.annotation.PostConstruct; import java.io.IOException; @Service public class CryptoPunkService { @Autowired private Web3j web3j; private Logger logger = LoggerFactory.getLogger(getClass()); public String getClientVersion() throws IOException { Web3ClientVersion web3ClientVersion = web3j.web3ClientVersion().send(); return web3ClientVersion.getWeb3ClientVersion(); } /*@PostConstruct public void listen() { web3j.transactionFlowable().subscribe(tx -> { logger.info("BlockHash: {}, BlockNumber:{},Input: {}, Creates: {}, Gas: {}", tx.getBlockHash(), tx.getBlockNumber(), tx.getInput(),tx.getCreates(),tx.getGas()); }); }*/ }
1,073
0.700839
0.686859
35
29.657143
27.240665
107
false
false
0
0
0
0
0
0
0.685714
false
false
5
12b214cb5a903636ca258c9d50f55a5130adb8a6
532,575,984,004
f2372a581ece07af896951e31a6cbf3d46c403dd
/src/main/java/com/mkyong/common/GanttRow.java
aae6573ea28d76ad1b61612082a9f2f65ef35285
[]
no_license
vantrong291/JSF2
https://github.com/vantrong291/JSF2
523f041695523732616c0de483913881a253359b
2dfe80635c174010b23dbff7a2d098fb99d2d171
refs/heads/master
2020-03-27T23:19:11.778000
2018-10-18T05:40:50
2018-10-18T05:40:50
147,309,247
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mkyong.common; import java.util.ArrayList; public class GanttRow { private String name; private int height = 3; private String color = "#fff"; private ArrayList<Task> tasks; public String toJson(){ String ganttRowJson = "{"; ganttRowJson += "\"name\":\"" + this.name.toString() + "\","; ganttRowJson += "\"height\":\"" + Integer.toString(this.height) + "em\","; ganttRowJson += "\"color\":\"" + this.color.toString() + "\","; ganttRowJson += "\"tasks\":["; for(Task task : this.tasks) { ganttRowJson += task.toJson() + ","; } ganttRowJson = ganttRowJson.substring(0, ganttRowJson.length() - 1); ganttRowJson += "]"; ganttRowJson += "}"; return ganttRowJson; } public ArrayList<Task> getTasks() { return tasks; } public void setTasks(ArrayList<Task> tasks) { this.tasks = tasks; } public String getColor() { return color; } public void setColor(String color) { this.color = color; } public int getHeight() { return height; } public void setHeight(int height) { this.height = height; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
UTF-8
Java
1,357
java
GanttRow.java
Java
[]
null
[]
package com.mkyong.common; import java.util.ArrayList; public class GanttRow { private String name; private int height = 3; private String color = "#fff"; private ArrayList<Task> tasks; public String toJson(){ String ganttRowJson = "{"; ganttRowJson += "\"name\":\"" + this.name.toString() + "\","; ganttRowJson += "\"height\":\"" + Integer.toString(this.height) + "em\","; ganttRowJson += "\"color\":\"" + this.color.toString() + "\","; ganttRowJson += "\"tasks\":["; for(Task task : this.tasks) { ganttRowJson += task.toJson() + ","; } ganttRowJson = ganttRowJson.substring(0, ganttRowJson.length() - 1); ganttRowJson += "]"; ganttRowJson += "}"; return ganttRowJson; } public ArrayList<Task> getTasks() { return tasks; } public void setTasks(ArrayList<Task> tasks) { this.tasks = tasks; } public String getColor() { return color; } public void setColor(String color) { this.color = color; } public int getHeight() { return height; } public void setHeight(int height) { this.height = height; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
1,357
0.551953
0.549742
58
22.413794
20.374964
82
false
false
0
0
0
0
0
0
0.5
false
false
5
0ba926e58bb0d78f3dc70d6755cf297ce81df38c
2,018,634,677,752
7501dec28e5620ed2873daf40846f75470ea3f45
/FractalTreeLab/TreeFractalPanel.java
7f00b197d015437316e66ca61f8dc157e989d3dd
[]
no_license
Kalevyx/unit8RecursionSortsSearches
https://github.com/Kalevyx/unit8RecursionSortsSearches
da81c0fcb0fc9ef2bfe3c8c63e9e73340821f074
7dda1e1ac44a30e0eed19f5601570bb60b281d84
refs/heads/master
2020-12-31T01:02:55.616000
2016-04-07T20:09:12
2016-04-07T20:09:12
53,356,233
0
0
null
true
2016-03-07T20:21:02
2016-03-07T20:21:02
2016-03-07T16:05:28
2016-03-07T20:18:14
2,136
0
0
0
null
null
null
import java.awt.*; import java.awt.geom.Line2D; import javax.swing.JPanel; public class TreeFractalPanel extends JPanel{ private final int PANEL_WIDTH = 500; private final int PANEL_HEIGHT = 500; private final int BOTTOM_X = 250, BOTTOM_Y = 450; private final int TOP_X = 250, TOP_Y = 350; private final double ANGLE_RELATIVE_VERTICAL = 90; private double angle = 15; private double fractionLength = .75; private double smallestBranch; private double length = 100; private double angle1 = 0; private double angle2 = 0; private final double THETA = 15; private int endX1, endY1; private int endX2, endY2; private double startX = 250; private double startY = 350; private int current; public TreeFractalPanel(int currentOrder){ current = currentOrder; setBackground(Color.black); setPreferredSize(new Dimension(PANEL_WIDTH,PANEL_HEIGHT));} public void drawFractal(int order, Graphics2D g2, double startX, double startY, double length, double angle){ if(order == 1){ return;} else{ //angle1 += angle; //angle2 -= angle; length *= fractionLength; int endX1 = (int) (startX+length*Math.sin(Math.toRadians(angle))); int endY1 = (int) (startY-length*Math.cos(Math.toRadians(angle))); //int endX2 = (int) (startX-length*Math.sin(Math.toRadians(angle2))); //int endY2 = (int) (startY-length*Math.cos(Math.toRadians(angle2))); g2.draw(new Line2D.Double(startX, startY, endX1, endY1)); g2.draw(new Line2D.Double(startX, startY, endX1, endY1)); drawFractal(order-1, g2, endX1, endY1, length, angle+THETA); drawFractal(order-1, g2, endX1, endY1, length, angle-THETA);}} public void paintComponent(Graphics g){ super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; g2.setColor(Color.blue); drawFractal(current, g2, startX, startY, length, Math.toRadians(ANGLE_RELATIVE_VERTICAL));} //g2.draw(new Line2D.Double(100, endX1, endY1, 0));} public void setOrder(int order){current = order;} public int getOrder(){return current;}}
UTF-8
Java
2,281
java
TreeFractalPanel.java
Java
[]
null
[]
import java.awt.*; import java.awt.geom.Line2D; import javax.swing.JPanel; public class TreeFractalPanel extends JPanel{ private final int PANEL_WIDTH = 500; private final int PANEL_HEIGHT = 500; private final int BOTTOM_X = 250, BOTTOM_Y = 450; private final int TOP_X = 250, TOP_Y = 350; private final double ANGLE_RELATIVE_VERTICAL = 90; private double angle = 15; private double fractionLength = .75; private double smallestBranch; private double length = 100; private double angle1 = 0; private double angle2 = 0; private final double THETA = 15; private int endX1, endY1; private int endX2, endY2; private double startX = 250; private double startY = 350; private int current; public TreeFractalPanel(int currentOrder){ current = currentOrder; setBackground(Color.black); setPreferredSize(new Dimension(PANEL_WIDTH,PANEL_HEIGHT));} public void drawFractal(int order, Graphics2D g2, double startX, double startY, double length, double angle){ if(order == 1){ return;} else{ //angle1 += angle; //angle2 -= angle; length *= fractionLength; int endX1 = (int) (startX+length*Math.sin(Math.toRadians(angle))); int endY1 = (int) (startY-length*Math.cos(Math.toRadians(angle))); //int endX2 = (int) (startX-length*Math.sin(Math.toRadians(angle2))); //int endY2 = (int) (startY-length*Math.cos(Math.toRadians(angle2))); g2.draw(new Line2D.Double(startX, startY, endX1, endY1)); g2.draw(new Line2D.Double(startX, startY, endX1, endY1)); drawFractal(order-1, g2, endX1, endY1, length, angle+THETA); drawFractal(order-1, g2, endX1, endY1, length, angle-THETA);}} public void paintComponent(Graphics g){ super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; g2.setColor(Color.blue); drawFractal(current, g2, startX, startY, length, Math.toRadians(ANGLE_RELATIVE_VERTICAL));} //g2.draw(new Line2D.Double(100, endX1, endY1, 0));} public void setOrder(int order){current = order;} public int getOrder(){return current;}}
2,281
0.631302
0.594476
59
37.661018
25.514111
113
false
false
0
0
0
0
0
0
1.288136
false
false
5
34f7f8379828686732cabe5ac0ab55847824f3eb
19,396,072,315,590
d740bbacc3c5a14f53277c06be3ef22f033528bc
/app/src/main/java/com/appacitive/khelkund/fragments/fantasy/TeamSquadFragment.java
750a3584837d66f14b50e6626fe97751d188b1ba
[ "Apache-2.0" ]
permissive
sathley/khelkund
https://github.com/sathley/khelkund
a5983891601cdb3def22ee4e4ba3b6773b9b380b
8204ed3d1081ec77fe21515fca797f94dadcde51
refs/heads/master
2016-09-15T16:42:54.299000
2016-03-21T03:18:20
2016-03-21T03:18:20
32,861,864
0
4
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.appacitive.khelkund.fragments.fantasy; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.support.v4.app.Fragment; import android.support.v7.app.ActionBarActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import com.appacitive.khelkund.R; import com.appacitive.khelkund.activities.fantasy.EditTeamActivity; import com.appacitive.khelkund.activities.misc.LoginActivity; import com.appacitive.khelkund.adapters.SquadAdapter; import com.appacitive.khelkund.infra.SharedPreferencesManager; import com.appacitive.khelkund.infra.StorageManager; import com.appacitive.khelkund.model.KhelkundUser; import com.appacitive.khelkund.model.Team; import com.getbase.floatingactionbutton.FloatingActionButton; import com.github.amlcurran.showcaseview.ShowcaseView; import com.github.amlcurran.showcaseview.targets.ViewTarget; import butterknife.ButterKnife; import butterknife.InjectView; import jp.wasabeef.recyclerview.animators.adapters.AlphaInAnimationAdapter; public class TeamSquadFragment extends Fragment { @InjectView(R.id.rv_squad) public RecyclerView mRecyclerView; public RecyclerView.Adapter mAdapter; public RecyclerView.LayoutManager mLayoutManager; @InjectView(R.id.fab_edit) public FloatingActionButton mFab; private KhelkundUser mUser; private Team mTeam; public TeamSquadFragment() { // Required empty public constructor } public static TeamSquadFragment newInstance() { return new TeamSquadFragment(); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_team_squad, container, false); ButterKnife.inject(this, rootView); String userId = SharedPreferencesManager.ReadUserId(); if (userId == null) { Intent loginIntent = new Intent(getActivity(), LoginActivity.class); startActivity(loginIntent); getActivity().finish(); } StorageManager storageManager = new StorageManager(); mTeam = storageManager.GetTeam(userId); ((ActionBarActivity) getActivity()).getSupportActionBar().setTitle(mTeam.getName()); mRecyclerView.setHasFixedSize(true); mLayoutManager = new LinearLayoutManager(getActivity()); mRecyclerView.setLayoutManager(mLayoutManager); mAdapter = new AlphaInAnimationAdapter(new SquadAdapter(mTeam.getPlayers(), mTeam.getCaptainId())); mRecyclerView.setAdapter(mAdapter); mFab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent editTeamIntent = new Intent(getActivity(), EditTeamActivity.class); startActivity(editTeamIntent); getActivity().overridePendingTransition(R.anim.slide_in_right_fast, R.anim.slide_out_left_fast); } }); return rootView; } @Override public void onResume() { super.onResume(); } @Override public void setUserVisibleHint(final boolean isVisibleToUser) { super.setUserVisibleHint(isVisibleToUser); Runnable runnable = new Runnable() { @Override public void run() { if (isVisibleToUser && mFab != null) { new ShowcaseView.Builder(getActivity()) .setTarget(new ViewTarget(mFab)) .setContentTitle("Click here to edit your team") .hideOnTouchOutside() .singleShot(22) .build().hideButton(); } } }; new Handler().postDelayed(runnable, 500); } @Override public void onDestroyView() { super.onDestroyView(); ButterKnife.reset(this); } }
UTF-8
Java
4,151
java
TeamSquadFragment.java
Java
[ { "context": "ionbutton.FloatingActionButton;\nimport com.github.amlcurran.showcaseview.ShowcaseView;\nimport com.github.amlc", "end": 968, "score": 0.9986841082572937, "start": 959, "tag": "USERNAME", "value": "amlcurran" }, { "context": "rran.showcaseview.ShowcaseView;\nimport com.github.amlcurran.showcaseview.targets.ViewTarget;\n\nimport butterkn", "end": 1023, "score": 0.9987871050834656, "start": 1014, "tag": "USERNAME", "value": "amlcurran" } ]
null
[]
package com.appacitive.khelkund.fragments.fantasy; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.support.v4.app.Fragment; import android.support.v7.app.ActionBarActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import com.appacitive.khelkund.R; import com.appacitive.khelkund.activities.fantasy.EditTeamActivity; import com.appacitive.khelkund.activities.misc.LoginActivity; import com.appacitive.khelkund.adapters.SquadAdapter; import com.appacitive.khelkund.infra.SharedPreferencesManager; import com.appacitive.khelkund.infra.StorageManager; import com.appacitive.khelkund.model.KhelkundUser; import com.appacitive.khelkund.model.Team; import com.getbase.floatingactionbutton.FloatingActionButton; import com.github.amlcurran.showcaseview.ShowcaseView; import com.github.amlcurran.showcaseview.targets.ViewTarget; import butterknife.ButterKnife; import butterknife.InjectView; import jp.wasabeef.recyclerview.animators.adapters.AlphaInAnimationAdapter; public class TeamSquadFragment extends Fragment { @InjectView(R.id.rv_squad) public RecyclerView mRecyclerView; public RecyclerView.Adapter mAdapter; public RecyclerView.LayoutManager mLayoutManager; @InjectView(R.id.fab_edit) public FloatingActionButton mFab; private KhelkundUser mUser; private Team mTeam; public TeamSquadFragment() { // Required empty public constructor } public static TeamSquadFragment newInstance() { return new TeamSquadFragment(); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_team_squad, container, false); ButterKnife.inject(this, rootView); String userId = SharedPreferencesManager.ReadUserId(); if (userId == null) { Intent loginIntent = new Intent(getActivity(), LoginActivity.class); startActivity(loginIntent); getActivity().finish(); } StorageManager storageManager = new StorageManager(); mTeam = storageManager.GetTeam(userId); ((ActionBarActivity) getActivity()).getSupportActionBar().setTitle(mTeam.getName()); mRecyclerView.setHasFixedSize(true); mLayoutManager = new LinearLayoutManager(getActivity()); mRecyclerView.setLayoutManager(mLayoutManager); mAdapter = new AlphaInAnimationAdapter(new SquadAdapter(mTeam.getPlayers(), mTeam.getCaptainId())); mRecyclerView.setAdapter(mAdapter); mFab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent editTeamIntent = new Intent(getActivity(), EditTeamActivity.class); startActivity(editTeamIntent); getActivity().overridePendingTransition(R.anim.slide_in_right_fast, R.anim.slide_out_left_fast); } }); return rootView; } @Override public void onResume() { super.onResume(); } @Override public void setUserVisibleHint(final boolean isVisibleToUser) { super.setUserVisibleHint(isVisibleToUser); Runnable runnable = new Runnable() { @Override public void run() { if (isVisibleToUser && mFab != null) { new ShowcaseView.Builder(getActivity()) .setTarget(new ViewTarget(mFab)) .setContentTitle("Click here to edit your team") .hideOnTouchOutside() .singleShot(22) .build().hideButton(); } } }; new Handler().postDelayed(runnable, 500); } @Override public void onDestroyView() { super.onDestroyView(); ButterKnife.reset(this); } }
4,151
0.684895
0.682727
114
35.412281
25.685278
112
false
false
0
0
0
0
0
0
0.605263
false
false
5
2113571d812b6359f431676cb32072ca424ce488
13,443,247,651,742
52adf59ea5dddf6fcf24daa3243ec8114e8f67d4
/business/src/main/java/com/kevinguanchedarias/owgejava/business/TimeSpecialBo.java
133b9de417f5e36f1622678c79ddfecab76a8dfb
[]
no_license
gitter-badger/owge
https://github.com/gitter-badger/owge
2fc62895aecdf6507791dac01494ebf80a15b566
ca16a3ce3e5f941a35f21057016f29c5921b7320
refs/heads/master
2020-09-16T14:16:59.824000
2019-11-19T18:23:22
2019-11-19T18:23:22
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * */ package com.kevinguanchedarias.owgejava.business; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.kevinguanchedarias.owgejava.dto.TimeSpecialDto; import com.kevinguanchedarias.owgejava.entity.TimeSpecial; import com.kevinguanchedarias.owgejava.repository.TimeSpecialRepository; import com.kevinguanchedarias.owgejava.util.ValidationUtil; /** * * @since 0.8.0 * @author Kevin Guanche Darias <kevin@kevinguanchedarias.com> */ @Service public class TimeSpecialBo extends AbstractWithImageBo<Integer, TimeSpecial, TimeSpecialDto> implements WithNameBo<Integer, TimeSpecial, TimeSpecialDto> { static final long serialVersionUID = -2736277577264790898L; @Autowired private ImprovementBo improvementBo; @Autowired private ActiveTimeSpecialBo activeTimeSpecialBo; @Autowired private transient TimeSpecialRepository repository; /* * (non-Javadoc) * * @see com.kevinguanchedarias.owgejava.business.BaseBo#getRepository() */ @Override public JpaRepository<TimeSpecial, Integer> getRepository() { return repository; } /* * (non-Javadoc) * * @see com.kevinguanchedarias.owgejava.business.BaseBo#getDtoClass() */ @Override public Class<TimeSpecialDto> getDtoClass() { return TimeSpecialDto.class; } /* * (non-Javadoc) * * @see com.kevinguanchedarias.owgejava.business.AbstractWithImageBo#save(com. * kevinguanchedarias.owgejava.entity.CommonEntityWithImageStore) */ @Override public TimeSpecial save(TimeSpecial entity) { ValidationUtil.getInstance().requireNonEmptyString(entity.getName(), "name") .requirePositiveNumber(entity.getDuration(), "duration") .requirePositiveNumber(entity.getRechargeTime(), "rechargeTime"); improvementBo.clearCacheEntriesIfRequired(entity, activeTimeSpecialBo); return super.save(entity); } /* * (non-Javadoc) * * @see com.kevinguanchedarias.owgejava.business.BaseBo#save(java.util.List) */ @Override public void save(List<TimeSpecial> entities) { improvementBo.clearCacheEntries(activeTimeSpecialBo); super.save(entities); } /* * (non-Javadoc) * * @see * com.kevinguanchedarias.owgejava.business.BaseBo#delete(com.kevinguanchedarias * .owgejava.entity.EntityWithId) */ @Override @Transactional public void delete(TimeSpecial entity) { activeTimeSpecialBo.deleteByTimeSpecial(entity); super.delete(entity); } /* * (non-Javadoc) * * @see * com.kevinguanchedarias.owgejava.business.BaseBo#delete(java.io.Serializable) */ @Override @Transactional public void delete(Integer id) { // Only adds the transaction super.delete(id); } }
UTF-8
Java
2,826
java
TimeSpecialBo.java
Java
[ { "context": "ValidationUtil;\n\n/**\n *\n * @since 0.8.0\n * @author Kevin Guanche Darias <kevin@kevinguanchedarias.com>\n */\n@Service\npubli", "end": 631, "score": 0.9998869895935059, "start": 611, "tag": "NAME", "value": "Kevin Guanche Darias" }, { "context": "\n * @since 0.8.0\n * @author Kevin Guanche Darias <kevin@kevinguanchedarias.com>\n */\n@Service\npublic class TimeSpecialBo extends ", "end": 661, "score": 0.9999327063560486, "start": 633, "tag": "EMAIL", "value": "kevin@kevinguanchedarias.com" } ]
null
[]
/** * */ package com.kevinguanchedarias.owgejava.business; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.kevinguanchedarias.owgejava.dto.TimeSpecialDto; import com.kevinguanchedarias.owgejava.entity.TimeSpecial; import com.kevinguanchedarias.owgejava.repository.TimeSpecialRepository; import com.kevinguanchedarias.owgejava.util.ValidationUtil; /** * * @since 0.8.0 * @author <NAME> <<EMAIL>> */ @Service public class TimeSpecialBo extends AbstractWithImageBo<Integer, TimeSpecial, TimeSpecialDto> implements WithNameBo<Integer, TimeSpecial, TimeSpecialDto> { static final long serialVersionUID = -2736277577264790898L; @Autowired private ImprovementBo improvementBo; @Autowired private ActiveTimeSpecialBo activeTimeSpecialBo; @Autowired private transient TimeSpecialRepository repository; /* * (non-Javadoc) * * @see com.kevinguanchedarias.owgejava.business.BaseBo#getRepository() */ @Override public JpaRepository<TimeSpecial, Integer> getRepository() { return repository; } /* * (non-Javadoc) * * @see com.kevinguanchedarias.owgejava.business.BaseBo#getDtoClass() */ @Override public Class<TimeSpecialDto> getDtoClass() { return TimeSpecialDto.class; } /* * (non-Javadoc) * * @see com.kevinguanchedarias.owgejava.business.AbstractWithImageBo#save(com. * kevinguanchedarias.owgejava.entity.CommonEntityWithImageStore) */ @Override public TimeSpecial save(TimeSpecial entity) { ValidationUtil.getInstance().requireNonEmptyString(entity.getName(), "name") .requirePositiveNumber(entity.getDuration(), "duration") .requirePositiveNumber(entity.getRechargeTime(), "rechargeTime"); improvementBo.clearCacheEntriesIfRequired(entity, activeTimeSpecialBo); return super.save(entity); } /* * (non-Javadoc) * * @see com.kevinguanchedarias.owgejava.business.BaseBo#save(java.util.List) */ @Override public void save(List<TimeSpecial> entities) { improvementBo.clearCacheEntries(activeTimeSpecialBo); super.save(entities); } /* * (non-Javadoc) * * @see * com.kevinguanchedarias.owgejava.business.BaseBo#delete(com.kevinguanchedarias * .owgejava.entity.EntityWithId) */ @Override @Transactional public void delete(TimeSpecial entity) { activeTimeSpecialBo.deleteByTimeSpecial(entity); super.delete(entity); } /* * (non-Javadoc) * * @see * com.kevinguanchedarias.owgejava.business.BaseBo#delete(java.io.Serializable) */ @Override @Transactional public void delete(Integer id) { // Only adds the transaction super.delete(id); } }
2,791
0.768224
0.760439
110
24.690908
26.713886
92
false
false
0
0
0
0
0
0
1.145455
false
false
5
60639c06571ea05dd1fc6316d0db1d9ee88b17d3
36,464,272,381,089
eb476abce99456b681605c3ccf0706a59a77a45b
/erp_parent/erp_biz/src/main/java/cn/itcast/erp/biz/impl/StoreoperBiz.java
ca0f606d81a12c1a0b0340b4ec68aa4b441d6507
[]
no_license
coderCzzz/ERP_TEST
https://github.com/coderCzzz/ERP_TEST
e16976341868ab4c60a33d051bf6879bc1f743a4
d4bbb1fb2075dd742f4aee312fe6bd4b7ab7f4ae
refs/heads/master
2020-04-21T19:55:05.169000
2019-02-25T08:45:54
2019-02-25T08:45:54
169,823,696
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.itcast.erp.biz.impl; import java.util.HashMap; import java.util.List; import java.util.Map; import cn.itcast.erp.biz.IStoreoperBiz; import cn.itcast.erp.dao.IEmpDao; import cn.itcast.erp.dao.IGoodsDao; import cn.itcast.erp.dao.IStoreDao; import cn.itcast.erp.dao.IStoreoperDao; import cn.itcast.erp.entity.Storeoper; /** * 仓库操作记录业务逻辑类 * @author Administrator * */ public class StoreoperBiz extends BaseBiz<Storeoper> implements IStoreoperBiz { private IStoreoperDao storeoperDao; private IEmpDao empDao; private IGoodsDao goodsDao; private IStoreDao storeDao; public IEmpDao getEmpDao() { return empDao; } public void setEmpDao(IEmpDao empDao) { this.empDao = empDao; } public IGoodsDao getGoodsDao() { return goodsDao; } public void setGoodsDao(IGoodsDao goodsDao) { this.goodsDao = goodsDao; } public IStoreDao getStoreDao() { return storeDao; } public void setStoreDao(IStoreDao storeDao) { this.storeDao = storeDao; } public void setStoreoperDao(IStoreoperDao storeoperDao) { this.storeoperDao = storeoperDao; setBaseDao(storeoperDao); } @Override public List<Storeoper> getListByPage(Storeoper t1, Storeoper t2, Object param, int firstResult, int maxResults) { // TODO Auto-generated method stub List<Storeoper> logList = super.getListByPage(t1, t2, param, firstResult, maxResults); Map<Long,String> empNameMap=new HashMap<Long,String>(); Map<Long,String> goodsNameMap=new HashMap<Long,String>(); Map<Long,String> storeNameMap=new HashMap<Long,String>(); for(Storeoper log:logList){ log.setEmpName(getEmpName(log.getEmpuuid(), empNameMap, empDao)); log.setGoodsName(getGoodsName(log.getGoodsuuid(), goodsNameMap, goodsDao)); log.setStoreName(getStoreName(log.getStoreuuid(), storeNameMap, storeDao)); } return logList; } }
UTF-8
Java
1,841
java
StoreoperBiz.java
Java
[ { "context": "rp.entity.Storeoper;\n/**\n * 仓库操作记录业务逻辑类\n * @author Administrator\n *\n */\npublic class StoreoperBiz extends BaseBiz<", "end": 372, "score": 0.9339936375617981, "start": 359, "tag": "USERNAME", "value": "Administrator" } ]
null
[]
package cn.itcast.erp.biz.impl; import java.util.HashMap; import java.util.List; import java.util.Map; import cn.itcast.erp.biz.IStoreoperBiz; import cn.itcast.erp.dao.IEmpDao; import cn.itcast.erp.dao.IGoodsDao; import cn.itcast.erp.dao.IStoreDao; import cn.itcast.erp.dao.IStoreoperDao; import cn.itcast.erp.entity.Storeoper; /** * 仓库操作记录业务逻辑类 * @author Administrator * */ public class StoreoperBiz extends BaseBiz<Storeoper> implements IStoreoperBiz { private IStoreoperDao storeoperDao; private IEmpDao empDao; private IGoodsDao goodsDao; private IStoreDao storeDao; public IEmpDao getEmpDao() { return empDao; } public void setEmpDao(IEmpDao empDao) { this.empDao = empDao; } public IGoodsDao getGoodsDao() { return goodsDao; } public void setGoodsDao(IGoodsDao goodsDao) { this.goodsDao = goodsDao; } public IStoreDao getStoreDao() { return storeDao; } public void setStoreDao(IStoreDao storeDao) { this.storeDao = storeDao; } public void setStoreoperDao(IStoreoperDao storeoperDao) { this.storeoperDao = storeoperDao; setBaseDao(storeoperDao); } @Override public List<Storeoper> getListByPage(Storeoper t1, Storeoper t2, Object param, int firstResult, int maxResults) { // TODO Auto-generated method stub List<Storeoper> logList = super.getListByPage(t1, t2, param, firstResult, maxResults); Map<Long,String> empNameMap=new HashMap<Long,String>(); Map<Long,String> goodsNameMap=new HashMap<Long,String>(); Map<Long,String> storeNameMap=new HashMap<Long,String>(); for(Storeoper log:logList){ log.setEmpName(getEmpName(log.getEmpuuid(), empNameMap, empDao)); log.setGoodsName(getGoodsName(log.getGoodsuuid(), goodsNameMap, goodsDao)); log.setStoreName(getStoreName(log.getStoreuuid(), storeNameMap, storeDao)); } return logList; } }
1,841
0.758659
0.75646
69
25.362318
25.252333
114
false
false
0
0
0
0
0
0
1.652174
false
false
5
47284e708cde4e4e87e1d2f3ab9064248116f604
9,904,194,646,340
590c0d552152ddd59ad51345029c6dd1ec5b5361
/training_core_java/src/com/nissan/trainingcorejava/SynchronisedAssg2.java
333b5fe20950719fe7e95abf150c0241d47b75cb
[]
no_license
smfelix11/rishabh_new
https://github.com/smfelix11/rishabh_new
927a91fa20d0a1fbe98906e094b37a3d682eb332
20923c59359ce275708179b3af1fea0c537247a7
refs/heads/master
2020-04-03T08:54:44.272000
2018-10-29T04:09:09
2018-10-29T04:09:09
155,148,859
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * */ package com.nissan.trainingcorejava; /** * @author Rishabh Dev Gupta * */ class Print1 { //Synchronized method.. void printValue(int a) { int arr[]=new int[4]; synchronized(this) { for(int i=1;i<5;i++) { arr[i-1]=a*i; try { Thread.sleep(500); // System.out.println("Input-"); // Scanner s= new Scanner(System.in); // System.out.println(""+s.nextLine()); } catch(Exception e) { System.out.println(e); } } for(int i:arr) { System.out.println(i); } } } } class Thread1 extends Thread { Print1 p; Thread1(Print1 p) { this.p=p; } public void run() { p.printValue(5); } } class Thread4 extends Thread { Print1 p; Thread4(Print1 p) { this.p=p; } public void run() { p.printValue(100); } } public class SynchronisedAssg2 { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Print1 obj= new Print1(); Thread1 t1= new Thread1(obj); Thread4 t2= new Thread4(obj); t1.start(); t2.start(); } }
UTF-8
Java
1,145
java
SynchronisedAssg2.java
Java
[ { "context": "ge com.nissan.trainingcorejava;\r\n\r\n/**\r\n * @author Rishabh Dev Gupta\r\n *\r\n */\r\nclass Print1\r\n{\r\n\t//Synchronized method", "end": 88, "score": 0.9997645020484924, "start": 71, "tag": "NAME", "value": "Rishabh Dev Gupta" } ]
null
[]
/** * */ package com.nissan.trainingcorejava; /** * @author <NAME> * */ class Print1 { //Synchronized method.. void printValue(int a) { int arr[]=new int[4]; synchronized(this) { for(int i=1;i<5;i++) { arr[i-1]=a*i; try { Thread.sleep(500); // System.out.println("Input-"); // Scanner s= new Scanner(System.in); // System.out.println(""+s.nextLine()); } catch(Exception e) { System.out.println(e); } } for(int i:arr) { System.out.println(i); } } } } class Thread1 extends Thread { Print1 p; Thread1(Print1 p) { this.p=p; } public void run() { p.printValue(5); } } class Thread4 extends Thread { Print1 p; Thread4(Print1 p) { this.p=p; } public void run() { p.printValue(100); } } public class SynchronisedAssg2 { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Print1 obj= new Print1(); Thread1 t1= new Thread1(obj); Thread4 t2= new Thread4(obj); t1.start(); t2.start(); } }
1,134
0.542358
0.515284
83
11.79518
12.152405
42
false
false
0
0
0
0
0
0
1.614458
false
false
5
e73cc472b7cf4fca86f5e266b4c1d9835e8fe6b6
39,290,360,869,649
ab270be6c49b3830841982a7e2e85c31b123d450
/src/main/java/com/sm/web/ReceiptController.java
2a79d50e550dab257971a61b676736d2759e42ed
[]
no_license
HelloWorld8080/SuperMarket
https://github.com/HelloWorld8080/SuperMarket
773b741a551f15de80518dec8260578b1079bf58
f1941a3aba73c1c9420ed1fdca9ff50eb530fcb9
refs/heads/master
2020-04-05T08:27:25.933000
2018-11-07T14:22:52
2018-11-07T14:22:52
156,716,573
1
0
null
true
2018-11-08T14:10:18
2018-11-08T14:10:18
2018-11-07T14:23:39
2018-11-07T14:23:37
51,592
0
0
0
null
false
null
package com.sm.web; import com.sm.entity.RechildAndName; import com.sm.service.ReceiptService; import com.sm.Tools.StringToJson; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.http.HttpServletRequest; import java.util.List; import java.util.Map; @Controller @RequestMapping("/rec") public class ReceiptController { @Autowired ReceiptService receiptService; @ResponseBody @RequestMapping(value = "/query", method = RequestMethod.POST) public synchronized List<RechildAndName> test(HttpServletRequest request) { Map<String, String> map = StringToJson.getString(request); for (String name : map.keySet()) { System.out.println(map.get(name)); } return receiptService.query(map); } @RequestMapping(value = "/{page}") public String addPage(@PathVariable("page") String page) { return "Receipt/" + page; } }
UTF-8
Java
1,228
java
ReceiptController.java
Java
[]
null
[]
package com.sm.web; import com.sm.entity.RechildAndName; import com.sm.service.ReceiptService; import com.sm.Tools.StringToJson; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.http.HttpServletRequest; import java.util.List; import java.util.Map; @Controller @RequestMapping("/rec") public class ReceiptController { @Autowired ReceiptService receiptService; @ResponseBody @RequestMapping(value = "/query", method = RequestMethod.POST) public synchronized List<RechildAndName> test(HttpServletRequest request) { Map<String, String> map = StringToJson.getString(request); for (String name : map.keySet()) { System.out.println(map.get(name)); } return receiptService.query(map); } @RequestMapping(value = "/{page}") public String addPage(@PathVariable("page") String page) { return "Receipt/" + page; } }
1,228
0.747557
0.747557
37
32.18919
23.293472
79
false
false
0
0
0
0
0
0
0.540541
false
false
5
16824eee67c6f7341eb3a146deb6c3ee380789c8
37,606,733,674,783
c2294b1d26c50b7f5210cd7f9be5c142db9964df
/core/src/main/java/com/adobe/aem/rmit/core/models/NewsTags.java
28bbf5d879f7547da2e771b2d50e7140dfa17db7
[]
no_license
vishi9/sample-aem
https://github.com/vishi9/sample-aem
565e06deb7596509d32245f64636f458c8a7fd37
1c12a9adecaa6594586967bbf65ed9f74e1891fe
refs/heads/master
2023-01-27T13:29:57.834000
2019-06-12T13:57:24
2019-06-12T13:57:24
162,641,482
0
1
null
false
2023-01-12T04:48:54
2018-12-20T23:22:38
2019-06-12T13:57:28
2023-01-12T04:48:54
14,981
0
1
18
CSS
false
false
package com.adobe.aem.rmit.core.models; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Iterator; import javax.annotation.PostConstruct; import javax.inject.Inject; import org.apache.sling.api.SlingHttpServletRequest; import org.apache.sling.api.resource.ResourceResolver; import org.apache.sling.api.resource.ValueMap; import org.apache.sling.models.annotations.Model; import org.apache.sling.models.annotations.injectorspecific.SlingObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.adobe.aem.rmit.core.components.RmitTags; import com.adobe.aem.rmit.core.components.NewsArticleTags; import com.day.cq.tagging.Tag; import com.day.cq.wcm.api.Page; import com.day.cq.wcm.api.PageManager; @Model(adaptables = SlingHttpServletRequest.class) /** * The NewsTags class implements an application that return the tag list object * of News Article template page in which the News date component has been added * * @author Soorya Sreedharan * @since 11-09-2018 */ public class NewsTags { private static final Logger LOG = LoggerFactory.getLogger(NewsTags.class); private Date newsTemplateDate = new Date(); private String newsDate; private String dateFormat = "dd MMMM YYYY"; private SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dateFormat); private String pagePath = null; ResourceResolver resolver = null; PageManager pageManager = null; /** Injecting the service **/ @Inject NewsArticleTags newsArticleTags; @Inject private Page currentPage; @SlingObject private SlingHttpServletRequest request; /** * In this method ,calling the doInit() from service "NewsArticleTags" by * passing parameter as currentPage. Getting the News date property value from * the current page in which News date component. * * @param currentPage. * @return Nothing. * @exception ParseException. */ @PostConstruct public void init() throws ParseException { try { if (!currentPage.getPath().startsWith("/content")) { ResourceResolver resourceResolver = request.getResourceResolver(); PageManager pageManager = resourceResolver.adaptTo(PageManager.class); pagePath = currentPage.getTemplate().getPath() + "/initial"; currentPage = pageManager.getPage(pagePath); } newsArticleTags.doInit(currentPage); if (currentPage.getPath().startsWith("/content")) { ValueMap pageProps = currentPage.getProperties(); newsTemplateDate = pageProps.get("newsDate", Date.class); newsDate = simpleDateFormat.format(newsTemplateDate); } else newsDate = ""; } catch (Exception e) { LOG.error("Error in NewsTags:", e); } } /** * This method will call the categoryList from newsArticleTags service and * return the list * * @param args * unused. * @return categoryList. */ public List<RmitTags> getCategoryList() { return newsArticleTags.getCategoryList(); } /** * This method will call the TopicList from newsArticleTags service and return * the list * * @param args * unused. * @return topicList. */ public List<String> getTopicList() { return newsArticleTags.getTopicList(); } /** * This method will call the TypeList from newsArticleTags service and return * the list * * @param args * unused. * @return typeList. */ public List<String> getTypeList() { return newsArticleTags.getTypeList(); } /** * This method will call the pageList from newsArticleTags service and return * the list * * @param args * unused. * @return pageList. */ public List<String> getPageList() { return newsArticleTags.getPageList(); } /** * This method will get the news date property value from the current page and * return * * @param args * unused. * @return newsdate. */ public String getNewsDate() { return newsDate; } /** * This method will call the tagList from newsArticleTags service and return the * list * * @param args * unused. * @return pageList. */ public List<String> getTagList() { return newsArticleTags.getTagList(); } }
UTF-8
Java
4,213
java
NewsTags.java
Java
[ { "context": " News date component has been added\n * \n * @author Soorya Sreedharan\n * @since 11-09-2018\n */\npublic class NewsTags {\n", "end": 1074, "score": 0.9998363852500916, "start": 1057, "tag": "NAME", "value": "Soorya Sreedharan" } ]
null
[]
package com.adobe.aem.rmit.core.models; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Iterator; import javax.annotation.PostConstruct; import javax.inject.Inject; import org.apache.sling.api.SlingHttpServletRequest; import org.apache.sling.api.resource.ResourceResolver; import org.apache.sling.api.resource.ValueMap; import org.apache.sling.models.annotations.Model; import org.apache.sling.models.annotations.injectorspecific.SlingObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.adobe.aem.rmit.core.components.RmitTags; import com.adobe.aem.rmit.core.components.NewsArticleTags; import com.day.cq.tagging.Tag; import com.day.cq.wcm.api.Page; import com.day.cq.wcm.api.PageManager; @Model(adaptables = SlingHttpServletRequest.class) /** * The NewsTags class implements an application that return the tag list object * of News Article template page in which the News date component has been added * * @author <NAME> * @since 11-09-2018 */ public class NewsTags { private static final Logger LOG = LoggerFactory.getLogger(NewsTags.class); private Date newsTemplateDate = new Date(); private String newsDate; private String dateFormat = "dd MMMM YYYY"; private SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dateFormat); private String pagePath = null; ResourceResolver resolver = null; PageManager pageManager = null; /** Injecting the service **/ @Inject NewsArticleTags newsArticleTags; @Inject private Page currentPage; @SlingObject private SlingHttpServletRequest request; /** * In this method ,calling the doInit() from service "NewsArticleTags" by * passing parameter as currentPage. Getting the News date property value from * the current page in which News date component. * * @param currentPage. * @return Nothing. * @exception ParseException. */ @PostConstruct public void init() throws ParseException { try { if (!currentPage.getPath().startsWith("/content")) { ResourceResolver resourceResolver = request.getResourceResolver(); PageManager pageManager = resourceResolver.adaptTo(PageManager.class); pagePath = currentPage.getTemplate().getPath() + "/initial"; currentPage = pageManager.getPage(pagePath); } newsArticleTags.doInit(currentPage); if (currentPage.getPath().startsWith("/content")) { ValueMap pageProps = currentPage.getProperties(); newsTemplateDate = pageProps.get("newsDate", Date.class); newsDate = simpleDateFormat.format(newsTemplateDate); } else newsDate = ""; } catch (Exception e) { LOG.error("Error in NewsTags:", e); } } /** * This method will call the categoryList from newsArticleTags service and * return the list * * @param args * unused. * @return categoryList. */ public List<RmitTags> getCategoryList() { return newsArticleTags.getCategoryList(); } /** * This method will call the TopicList from newsArticleTags service and return * the list * * @param args * unused. * @return topicList. */ public List<String> getTopicList() { return newsArticleTags.getTopicList(); } /** * This method will call the TypeList from newsArticleTags service and return * the list * * @param args * unused. * @return typeList. */ public List<String> getTypeList() { return newsArticleTags.getTypeList(); } /** * This method will call the pageList from newsArticleTags service and return * the list * * @param args * unused. * @return pageList. */ public List<String> getPageList() { return newsArticleTags.getPageList(); } /** * This method will get the news date property value from the current page and * return * * @param args * unused. * @return newsdate. */ public String getNewsDate() { return newsDate; } /** * This method will call the tagList from newsArticleTags service and return the * list * * @param args * unused. * @return pageList. */ public List<String> getTagList() { return newsArticleTags.getTagList(); } }
4,202
0.720627
0.718253
157
25.834394
23.486504
81
false
false
0
0
0
0
0
0
1.312102
false
false
5
5ede2a9af8eb6f0fb083cc05300c86966121c616
39,573,828,683,432
304bd7c472f0956e06af61a606d147429b9a2af6
/src/main/java/com/menglin/controller/CourseController.java
3abf2654d901c7dbb8e25dbf9af0ec3d106ee4ed
[ "MIT" ]
permissive
LeonemZhang/SSM_systemDemo
https://github.com/LeonemZhang/SSM_systemDemo
abb9d2d3bef1ef2f0e30ee7bf63dc0a68ac462cc
0136ac164ee52e3af15b1efaeece1adba221e236
refs/heads/master
2021-09-15T17:42:52.956000
2018-06-07T12:10:00
2018-06-07T12:10:00
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.menglin.controller; import com.alibaba.fastjson.JSONObject; import com.github.pagehelper.PageInfo; import com.menglin.common.ActionResult; import com.menglin.common.CommonConst; import com.menglin.dto.CourseDto; import com.menglin.dto.JWTPayloadDto; import com.menglin.dto.SearchConditionsDto; import com.menglin.service.CourseService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; @Controller @RequestMapping("/course") @ResponseBody public class CourseController extends BaseController { private Logger logger = LoggerFactory.getLogger(CourseController.class); @Resource private CourseService courseService; @RequestMapping(value = "", method = RequestMethod.GET) public ActionResult<?> list( HttpServletRequest request, @RequestParam(value = "page") int page, @RequestParam(value = "pageSize") int pageSize, SearchConditionsDto searchConditionsDto) { validateCurrentUserIdentity(request, CommonConst.ADMIN_IDENTITY); PageInfo<CourseDto> pageInfo = courseService.getCoursesByPage(page, pageSize, searchConditionsDto); return getQueryByPageResult(pageInfo, "分页查询的课程不存在"); } @RequestMapping(value = "", method = RequestMethod.POST) public ActionResult<?> add(HttpServletRequest request, @RequestBody CourseDto courseDto) { JWTPayloadDto JWTPayloadDto = validateCurrentUserIdentityAndGetPayloadInfoFromRequest(request, CommonConst.ADMIN_IDENTITY); courseDto.setCreator(JWTPayloadDto.getUsername()); int insertId = courseService.addCourse(courseDto); logger.info("request: course/add , course:{}, insertId:{}", JSONObject.toJSONString(courseDto.convertToCourse()), insertId); return insertId > 0 ? createSuccessActionResult("添加成功") : createFailActionResult("添加失败"); } @RequestMapping(value = "", method = RequestMethod.PUT) public ActionResult<?> update(HttpServletRequest request, @RequestBody CourseDto courseDto) { JWTPayloadDto JWTPayloadDto = validateCurrentUserIdentityAndGetPayloadInfoFromRequest(request, CommonConst.ADMIN_IDENTITY); courseDto.setModifier(JWTPayloadDto.getUsername()); int updateId = courseService.updateCourse(courseDto); logger.info("request: course/update , course:{}, updateId:{}", JSONObject.toJSONString(courseDto.convertToCourse()), updateId); return updateId > 0 ? createSuccessActionResult("修改成功") : createFailActionResult("修改失败"); } @RequestMapping(value = "/{ids}", method = RequestMethod.DELETE) public ActionResult<?> delete(HttpServletRequest request, @PathVariable String ids) { validateCurrentUserIdentity(request, CommonConst.ADMIN_IDENTITY); courseService.batchDeleteCoursesByIds(ids); logger.info("request: course/delete , ids:{}", ids); return createSuccessActionResult("删除成功"); } @RequestMapping(value = "/id/{id}", method = RequestMethod.GET) public ActionResult<?> queryById(HttpServletRequest request, @PathVariable Long id) { validateCurrentUserIdentity(request, CommonConst.ADMIN_IDENTITY); CourseDto courseDto = courseService.getCourseById(id); return courseDto != null ? createSuccessActionResult(courseDto) : createFailActionResult("查询的课程不存在"); } }
UTF-8
Java
3,578
java
CourseController.java
Java
[]
null
[]
package com.menglin.controller; import com.alibaba.fastjson.JSONObject; import com.github.pagehelper.PageInfo; import com.menglin.common.ActionResult; import com.menglin.common.CommonConst; import com.menglin.dto.CourseDto; import com.menglin.dto.JWTPayloadDto; import com.menglin.dto.SearchConditionsDto; import com.menglin.service.CourseService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; @Controller @RequestMapping("/course") @ResponseBody public class CourseController extends BaseController { private Logger logger = LoggerFactory.getLogger(CourseController.class); @Resource private CourseService courseService; @RequestMapping(value = "", method = RequestMethod.GET) public ActionResult<?> list( HttpServletRequest request, @RequestParam(value = "page") int page, @RequestParam(value = "pageSize") int pageSize, SearchConditionsDto searchConditionsDto) { validateCurrentUserIdentity(request, CommonConst.ADMIN_IDENTITY); PageInfo<CourseDto> pageInfo = courseService.getCoursesByPage(page, pageSize, searchConditionsDto); return getQueryByPageResult(pageInfo, "分页查询的课程不存在"); } @RequestMapping(value = "", method = RequestMethod.POST) public ActionResult<?> add(HttpServletRequest request, @RequestBody CourseDto courseDto) { JWTPayloadDto JWTPayloadDto = validateCurrentUserIdentityAndGetPayloadInfoFromRequest(request, CommonConst.ADMIN_IDENTITY); courseDto.setCreator(JWTPayloadDto.getUsername()); int insertId = courseService.addCourse(courseDto); logger.info("request: course/add , course:{}, insertId:{}", JSONObject.toJSONString(courseDto.convertToCourse()), insertId); return insertId > 0 ? createSuccessActionResult("添加成功") : createFailActionResult("添加失败"); } @RequestMapping(value = "", method = RequestMethod.PUT) public ActionResult<?> update(HttpServletRequest request, @RequestBody CourseDto courseDto) { JWTPayloadDto JWTPayloadDto = validateCurrentUserIdentityAndGetPayloadInfoFromRequest(request, CommonConst.ADMIN_IDENTITY); courseDto.setModifier(JWTPayloadDto.getUsername()); int updateId = courseService.updateCourse(courseDto); logger.info("request: course/update , course:{}, updateId:{}", JSONObject.toJSONString(courseDto.convertToCourse()), updateId); return updateId > 0 ? createSuccessActionResult("修改成功") : createFailActionResult("修改失败"); } @RequestMapping(value = "/{ids}", method = RequestMethod.DELETE) public ActionResult<?> delete(HttpServletRequest request, @PathVariable String ids) { validateCurrentUserIdentity(request, CommonConst.ADMIN_IDENTITY); courseService.batchDeleteCoursesByIds(ids); logger.info("request: course/delete , ids:{}", ids); return createSuccessActionResult("删除成功"); } @RequestMapping(value = "/id/{id}", method = RequestMethod.GET) public ActionResult<?> queryById(HttpServletRequest request, @PathVariable Long id) { validateCurrentUserIdentity(request, CommonConst.ADMIN_IDENTITY); CourseDto courseDto = courseService.getCourseById(id); return courseDto != null ? createSuccessActionResult(courseDto) : createFailActionResult("查询的课程不存在"); } }
3,578
0.747287
0.746145
81
42.246914
37.301418
135
false
false
0
0
0
0
0
0
0.82716
false
false
5
8783aa8c9a59d6879d6b663e519511154ea1ecd1
38,053,410,273,493
0dfe5c5b11b7289848c3e304bf76bacbff60fce3
/src/main/java/com/potato/study/leetcode/p0488/Solution.java
7d390aadcb28f3104ec352cafb7b47af35949780
[]
no_license
potatobeancox5/potato-leetcode-solution-java
https://github.com/potatobeancox5/potato-leetcode-solution-java
e6a308b362155ee5f73e65956ddc9ce1125f55be
953dd522aad3ed76a596943cf7c3439be001bcbb
refs/heads/master
2021-12-23T10:52:59.345000
2021-08-13T15:25:26
2021-08-13T15:25:26
170,109,169
0
0
null
false
2020-10-13T16:10:09
2019-02-11T10:22:58
2020-10-04T11:42:19
2020-10-13T16:10:08
2,577
0
0
1
Java
false
false
package com.potato.study.leetcode.p0488; import org.junit.Assert; /** * * @author liuzhao11 * * 488. Zuma Game * * Think about Zuma Game. You have a row of balls on the table, colored red(R), yellow(Y), blue(B), green(G), and white(W). You also have several balls in your hand. Each time, you may choose a ball in your hand, and insert it into the row (including the leftmost place and rightmost place). Then, if there is a group of 3 or more balls in the same color touching, remove these balls. Keep doing this until no more balls can be removed. Find the minimal balls you have to insert to remove all the balls on the table. If you cannot remove all the balls, output -1. Examples: Input: "WRRBBW", "RB" Output: -1 Explanation: WRRBBW -> WRR[R]BBW -> WBBW -> WBB[B]W -> WW Input: "WWRRBBWW", "WRBRW" Output: 2 Explanation: WWRRBBWW -> WWRR[R]BBWW -> WWBBWW -> WWBB[B]WW -> WWWW -> empty Input:"G", "GGGGG" Output: 2 Explanation: G -> G[G] -> GG[G] -> empty Input: "RBYYBBRRB", "YRBGB" Output: 3 Explanation: RBYYBBRRB -> RBYY[Y]BBRRB -> RBBBRRB -> RRRB -> B -> B[B] -> BB[B] -> empty Note: You may assume that the initial row of balls on the table won’t have any 3 or more consecutive balls with the same color. The number of balls on the table won't exceed 20, and the string represents these balls is called "board" in the input. The number of balls in your hand won't exceed 5, and the string represents these balls is called "hand" in the input. Both input strings will be non-empty and only contain characters 'R','Y','B','G','W'. * * 思路: * https://blog.csdn.net/xdhc304/article/details/79374908 * 思想 对每个移除的字符串进行移除 * * * */ public class Solution { public int findMinStep(String board, String hand) { // 1. 统计手中的字符个数 int[] chNum = new int[26]; for (char ch : hand.toCharArray()) { chNum[ch - 'A']++; } // 2. 获取结果 ,内部回溯法实现 末尾加 # 方便判断 int minStep = getMinStep(board + "#", chNum); if (minStep > 5) { return -1; } return minStep; } /** * 回溯法 获取消除s 的最小步骤 * @param s * @param charCount * @return */ private int getMinStep(String s, int[] charCount) { // 进来的时候就要先消除一下,因为有可能组装的时候造成了3消除的场景 s = removeThribleCharactors(s); // 对s 进行遍历,每次消除其中一种字符,然后将消除后的串再进行判断 if ("#".equals(s)) { return 0; } int i = 0; int minSteps = 6; for (int j = 0; j < s.length(); j++) { if (s.charAt(j) == s.charAt(i)) { continue; } int needPopCount = 3 - (j - i); char ch = s.charAt(i); if (charCount[ch - 'A'] >= needPopCount) { charCount[ch - 'A'] -= needPopCount; // 回溯的逻辑 将这个字符串干掉 minSteps = Math.min(minSteps, getMinStep(s.substring(0, i) + s.substring(j), charCount) + needPopCount); charCount[ch - 'A'] += needPopCount; } i = j; } return minSteps; } /** * 删除 target 中所有的3连字符串 * @param target * @return */ private String removeThribleCharactors(String target) { int i = 0; for (int j = 0; j < target.length(); j++) { if (target.charAt(j) == target.charAt(i)) { continue; } // bigger than 3 if (j - i >= 3) { return removeThribleCharactors(target.substring(0, i) + target.substring(j)); } i = j; } return target; } public static void main(String[] args) { Solution solution = new Solution(); String board = "WRRBBW"; String hand = "RB"; int minStep = solution.findMinStep(board, hand); System.out.println(minStep); Assert.assertEquals(-1, minStep); board = "WWRRBBWW"; hand = "WRBRW"; minStep = solution.findMinStep(board, hand); System.out.println(minStep); Assert.assertEquals(2, minStep); board = "G"; hand = "GGGGG"; minStep = solution.findMinStep(board, hand); System.out.println(minStep); Assert.assertEquals(2, minStep); board = "RBYYBBRRB"; hand = "YRBGB"; minStep = solution.findMinStep(board, hand); System.out.println(minStep); Assert.assertEquals(3, minStep); } }
UTF-8
Java
4,750
java
Solution.java
Java
[ { "context": "488;\n\nimport org.junit.Assert;\n\n/**\n * \n * @author liuzhao11\n * \n * 488. Zuma Game\n * \n * Think", "end": 96, "score": 0.9995647072792053, "start": 87, "tag": "USERNAME", "value": "liuzhao11" }, { "context": " \n * 思路:\n * https://blog.csdn.net/xdhc304/article/details/79374908\n * 思想 对每个移除的字符串进", "end": 1633, "score": 0.999626636505127, "start": 1626, "tag": "USERNAME", "value": "xdhc304" } ]
null
[]
package com.potato.study.leetcode.p0488; import org.junit.Assert; /** * * @author liuzhao11 * * 488. Zuma Game * * Think about Zuma Game. You have a row of balls on the table, colored red(R), yellow(Y), blue(B), green(G), and white(W). You also have several balls in your hand. Each time, you may choose a ball in your hand, and insert it into the row (including the leftmost place and rightmost place). Then, if there is a group of 3 or more balls in the same color touching, remove these balls. Keep doing this until no more balls can be removed. Find the minimal balls you have to insert to remove all the balls on the table. If you cannot remove all the balls, output -1. Examples: Input: "WRRBBW", "RB" Output: -1 Explanation: WRRBBW -> WRR[R]BBW -> WBBW -> WBB[B]W -> WW Input: "WWRRBBWW", "WRBRW" Output: 2 Explanation: WWRRBBWW -> WWRR[R]BBWW -> WWBBWW -> WWBB[B]WW -> WWWW -> empty Input:"G", "GGGGG" Output: 2 Explanation: G -> G[G] -> GG[G] -> empty Input: "RBYYBBRRB", "YRBGB" Output: 3 Explanation: RBYYBBRRB -> RBYY[Y]BBRRB -> RBBBRRB -> RRRB -> B -> B[B] -> BB[B] -> empty Note: You may assume that the initial row of balls on the table won’t have any 3 or more consecutive balls with the same color. The number of balls on the table won't exceed 20, and the string represents these balls is called "board" in the input. The number of balls in your hand won't exceed 5, and the string represents these balls is called "hand" in the input. Both input strings will be non-empty and only contain characters 'R','Y','B','G','W'. * * 思路: * https://blog.csdn.net/xdhc304/article/details/79374908 * 思想 对每个移除的字符串进行移除 * * * */ public class Solution { public int findMinStep(String board, String hand) { // 1. 统计手中的字符个数 int[] chNum = new int[26]; for (char ch : hand.toCharArray()) { chNum[ch - 'A']++; } // 2. 获取结果 ,内部回溯法实现 末尾加 # 方便判断 int minStep = getMinStep(board + "#", chNum); if (minStep > 5) { return -1; } return minStep; } /** * 回溯法 获取消除s 的最小步骤 * @param s * @param charCount * @return */ private int getMinStep(String s, int[] charCount) { // 进来的时候就要先消除一下,因为有可能组装的时候造成了3消除的场景 s = removeThribleCharactors(s); // 对s 进行遍历,每次消除其中一种字符,然后将消除后的串再进行判断 if ("#".equals(s)) { return 0; } int i = 0; int minSteps = 6; for (int j = 0; j < s.length(); j++) { if (s.charAt(j) == s.charAt(i)) { continue; } int needPopCount = 3 - (j - i); char ch = s.charAt(i); if (charCount[ch - 'A'] >= needPopCount) { charCount[ch - 'A'] -= needPopCount; // 回溯的逻辑 将这个字符串干掉 minSteps = Math.min(minSteps, getMinStep(s.substring(0, i) + s.substring(j), charCount) + needPopCount); charCount[ch - 'A'] += needPopCount; } i = j; } return minSteps; } /** * 删除 target 中所有的3连字符串 * @param target * @return */ private String removeThribleCharactors(String target) { int i = 0; for (int j = 0; j < target.length(); j++) { if (target.charAt(j) == target.charAt(i)) { continue; } // bigger than 3 if (j - i >= 3) { return removeThribleCharactors(target.substring(0, i) + target.substring(j)); } i = j; } return target; } public static void main(String[] args) { Solution solution = new Solution(); String board = "WRRBBW"; String hand = "RB"; int minStep = solution.findMinStep(board, hand); System.out.println(minStep); Assert.assertEquals(-1, minStep); board = "WWRRBBWW"; hand = "WRBRW"; minStep = solution.findMinStep(board, hand); System.out.println(minStep); Assert.assertEquals(2, minStep); board = "G"; hand = "GGGGG"; minStep = solution.findMinStep(board, hand); System.out.println(minStep); Assert.assertEquals(2, minStep); board = "RBYYBBRRB"; hand = "YRBGB"; minStep = solution.findMinStep(board, hand); System.out.println(minStep); Assert.assertEquals(3, minStep); } }
4,750
0.5681
0.556228
146
29.575342
35.366928
270
false
false
0
0
0
0
0
0
0.636986
false
false
5
84bf30ab654cfa70a023c1995a065bf013f71616
8,650,064,164,493
acd2a86f6ac875916b27f7cdfb3c0797bf435abf
/core/src/main/java/org/apache/calcite/rel/rules/materialize/MaterializedViewRules.java
991cdd72ef788de3c8df4b314f1a128f30e7b08e
[ "Apache-2.0", "MIT" ]
permissive
letsflyinthesky/calcite
https://github.com/letsflyinthesky/calcite
53ea4faecec391155abc0a85adfef940eca844e7
efa325e5c6d16ef01d9fa5a2b92461a6b5e7d363
refs/heads/master
2022-12-14T03:56:36.315000
2020-09-08T00:48:41
2020-09-08T00:48:41
282,887,750
0
0
Apache-2.0
true
2020-07-27T12:13:31
2020-07-27T12:13:30
2020-07-27T05:10:34
2020-07-27T10:18:53
64,046
0
0
0
null
false
false
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to you under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.calcite.rel.rules.materialize; import org.apache.calcite.rel.core.Aggregate; import org.apache.calcite.rel.core.Filter; import org.apache.calcite.rel.core.Join; import org.apache.calcite.rel.core.Project; import org.apache.calcite.rel.core.RelFactories; import org.apache.calcite.rel.core.TableScan; import org.apache.calcite.rel.rules.MaterializedViewFilterScanRule; /** * Collection of rules pertaining to materialized views. * * <p>Also may contain utilities for {@link MaterializedViewRule}. */ public abstract class MaterializedViewRules { private MaterializedViewRules() {} /** Rule that matches {@link Project} on {@link Aggregate}. */ public static final MaterializedViewProjectAggregateRule PROJECT_AGGREGATE = new MaterializedViewProjectAggregateRule(RelFactories.LOGICAL_BUILDER, true, null); /** Rule that matches {@link Aggregate}. */ public static final MaterializedViewOnlyAggregateRule AGGREGATE = new MaterializedViewOnlyAggregateRule(RelFactories.LOGICAL_BUILDER, true, null); /** Rule that matches {@link Filter}. */ public static final MaterializedViewOnlyFilterRule FILTER = new MaterializedViewOnlyFilterRule(RelFactories.LOGICAL_BUILDER, true, null, true); /** Rule that matches {@link Join}. */ public static final MaterializedViewOnlyJoinRule JOIN = new MaterializedViewOnlyJoinRule(RelFactories.LOGICAL_BUILDER, true, null, true); /** Rule that matches {@link Project} on {@link Filter}. */ public static final MaterializedViewProjectFilterRule PROJECT_FILTER = new MaterializedViewProjectFilterRule(RelFactories.LOGICAL_BUILDER, true, null, true); /** Rule that matches {@link Project} on {@link Join}. */ public static final MaterializedViewProjectJoinRule PROJECT_JOIN = new MaterializedViewProjectJoinRule(RelFactories.LOGICAL_BUILDER, true, null, true); /** Rule that converts a {@link Filter} on a {@link TableScan} * to a {@link Filter} on a Materialized View. */ public static final MaterializedViewFilterScanRule FILTER_SCAN = new MaterializedViewFilterScanRule(RelFactories.LOGICAL_BUILDER); }
UTF-8
Java
2,995
java
MaterializedViewRules.java
Java
[]
null
[]
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to you under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.calcite.rel.rules.materialize; import org.apache.calcite.rel.core.Aggregate; import org.apache.calcite.rel.core.Filter; import org.apache.calcite.rel.core.Join; import org.apache.calcite.rel.core.Project; import org.apache.calcite.rel.core.RelFactories; import org.apache.calcite.rel.core.TableScan; import org.apache.calcite.rel.rules.MaterializedViewFilterScanRule; /** * Collection of rules pertaining to materialized views. * * <p>Also may contain utilities for {@link MaterializedViewRule}. */ public abstract class MaterializedViewRules { private MaterializedViewRules() {} /** Rule that matches {@link Project} on {@link Aggregate}. */ public static final MaterializedViewProjectAggregateRule PROJECT_AGGREGATE = new MaterializedViewProjectAggregateRule(RelFactories.LOGICAL_BUILDER, true, null); /** Rule that matches {@link Aggregate}. */ public static final MaterializedViewOnlyAggregateRule AGGREGATE = new MaterializedViewOnlyAggregateRule(RelFactories.LOGICAL_BUILDER, true, null); /** Rule that matches {@link Filter}. */ public static final MaterializedViewOnlyFilterRule FILTER = new MaterializedViewOnlyFilterRule(RelFactories.LOGICAL_BUILDER, true, null, true); /** Rule that matches {@link Join}. */ public static final MaterializedViewOnlyJoinRule JOIN = new MaterializedViewOnlyJoinRule(RelFactories.LOGICAL_BUILDER, true, null, true); /** Rule that matches {@link Project} on {@link Filter}. */ public static final MaterializedViewProjectFilterRule PROJECT_FILTER = new MaterializedViewProjectFilterRule(RelFactories.LOGICAL_BUILDER, true, null, true); /** Rule that matches {@link Project} on {@link Join}. */ public static final MaterializedViewProjectJoinRule PROJECT_JOIN = new MaterializedViewProjectJoinRule(RelFactories.LOGICAL_BUILDER, true, null, true); /** Rule that converts a {@link Filter} on a {@link TableScan} * to a {@link Filter} on a Materialized View. */ public static final MaterializedViewFilterScanRule FILTER_SCAN = new MaterializedViewFilterScanRule(RelFactories.LOGICAL_BUILDER); }
2,995
0.753923
0.752588
69
42.405796
27.48666
78
false
false
0
0
0
0
0
0
0.521739
false
false
5
78eecb250192b9ac0c05184fa06841e94e76fce6
240,518,170,765
d5cace40d435e48f5e5691a76cb56a1a1b3ba748
/AP_Lesson_04/APLab_4.1/CompInterest.java
426e2b97dc99e5d9b4c81303adb5a903fb2558ae
[]
no_license
Opwoa/Hornilla_Joshua
https://github.com/Opwoa/Hornilla_Joshua
07079483296a568617b247bf90696df39d54d01b
d82551156e841e5a2816c209ffe0f71e3983906b
refs/heads/master
2021-06-17T18:02:37.902000
2017-05-31T18:08:17
2017-05-31T18:08:17
67,533,191
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Scanner; public class CompInterest { public static void main(String[]args) { CompInterest interest = new CompInterest(); Scanner keyboard = new Scanner(System.in); System.out.println("What is your interest rate?"); double rate = keyboard.nextDouble(); System.out.println("How much do you intend to borrow?"); double principle = keyboard.nextDouble(); System.out.println("How many times is the loan compounded per year?"); double number = keyboard.nextInt(); System.out.println("In how many years will you pay off this loan?"); double time = keyboard.nextInt(); double totalCost = interest.calcInterest(rate, principle, number, time); System.out.printf("Your total monthly payment is $%-5.2f\n", interest.monthPay(totalCost, time)); } public double calcInterest(double r, double p, double n, double t) { double base = (1 + (r / n)); double exponent = n * t; return p * Math.pow(base, exponent); } public double monthPay(double total, double t) { return total / (t * 12); } }
UTF-8
Java
1,037
java
CompInterest.java
Java
[]
null
[]
import java.util.Scanner; public class CompInterest { public static void main(String[]args) { CompInterest interest = new CompInterest(); Scanner keyboard = new Scanner(System.in); System.out.println("What is your interest rate?"); double rate = keyboard.nextDouble(); System.out.println("How much do you intend to borrow?"); double principle = keyboard.nextDouble(); System.out.println("How many times is the loan compounded per year?"); double number = keyboard.nextInt(); System.out.println("In how many years will you pay off this loan?"); double time = keyboard.nextInt(); double totalCost = interest.calcInterest(rate, principle, number, time); System.out.printf("Your total monthly payment is $%-5.2f\n", interest.monthPay(totalCost, time)); } public double calcInterest(double r, double p, double n, double t) { double base = (1 + (r / n)); double exponent = n * t; return p * Math.pow(base, exponent); } public double monthPay(double total, double t) { return total / (t * 12); } }
1,037
0.703954
0.699132
30
33.599998
26.607769
99
false
false
0
0
0
0
0
0
2.3
false
false
5
45b231cc8cb8409b74a3f29b2ef955a5645a28bc
3,032,246,916,897
4cf388824e831fd3f38d7cdb6878eb1e51105032
/src/main/java/com/example/sptest/bean/dto/OrderCreateRequest.java
a6f0704be5429e3b78d1fa4a23d7d161068c229e
[]
no_license
cderlearner/sprintboot-test
https://github.com/cderlearner/sprintboot-test
dc8076d13c43a4da8765261396554c4f9592da12
5ed764d65b461c3c9d70b53fe2da5258c18bcb8a
refs/heads/master
2022-06-29T07:16:29.306000
2020-07-26T13:53:54
2020-07-26T13:53:54
178,645,652
0
0
null
false
2022-06-17T02:07:39
2019-03-31T05:14:42
2020-07-26T13:54:17
2022-06-17T02:07:38
110
0
0
2
Java
false
false
package com.example.sptest.bean.dto; import lombok.Builder; import lombok.Data; import javax.validation.constraints.*; /** * Author: linjx * Date: 2019/3/28 */ @Data @Builder public class OrderCreateRequest extends Pojo{ private String appId; @NotNull @Size(min = 1, max = 32) private String outOrderNo; @NotNull @Pattern(regexp = "^\\+0086[0-9]{11}$") private String mobile; @Pattern(regexp = "^(SVIP|INSTABOOK)$") private String vipType = "INSTABOOK"; @NotNull @Min(1) @Max(1095) private Integer buyDays; @NotNull @Pattern(regexp = "^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$") private String openTime; private String contractId; private String orderFee; // @Data // public static class ORequest { // private String appId; // private String outOrderNo; // private String mobile; // private String vipType = "INSTABOOK"; // private Integer buyDays; // private String openTime; // private String contractId; // private String orderFee; // } // public static void main(String[] args) throws IOException { // String param = "[{\"app_id\":\"100041236812531729838455\",\"out_order_no\":\"134343470191611494222\",\"mobile\":\"+008615608036305\",\"vip_type\":\"INSTABOOK\",\"buy_days\":365,\"open_time\":\"2019-04-13 12:29:26\",\"contract_id\":\"0\",\"order_fee\":\"zhihu123\"}]"; // ObjectMapper mapper = new ObjectMapper() // .setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE) // .setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY) // .configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false) // .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) // .setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE); // ArrayNode arrayNode = (ArrayNode) mapper.readTree(param); // ORequest req = mapper.convertValue(arrayNode.get(0), ORequest.class); // System.out.println(req); // } }
UTF-8
Java
2,113
java
OrderCreateRequest.java
Java
[ { "context": "rt javax.validation.constraints.*;\n\n/**\n * Author: linjx\n * Date: 2019/3/28\n */\n@Data\n@Builder\npublic clas", "end": 142, "score": 0.9996551275253296, "start": 137, "tag": "USERNAME", "value": "linjx" } ]
null
[]
package com.example.sptest.bean.dto; import lombok.Builder; import lombok.Data; import javax.validation.constraints.*; /** * Author: linjx * Date: 2019/3/28 */ @Data @Builder public class OrderCreateRequest extends Pojo{ private String appId; @NotNull @Size(min = 1, max = 32) private String outOrderNo; @NotNull @Pattern(regexp = "^\\+0086[0-9]{11}$") private String mobile; @Pattern(regexp = "^(SVIP|INSTABOOK)$") private String vipType = "INSTABOOK"; @NotNull @Min(1) @Max(1095) private Integer buyDays; @NotNull @Pattern(regexp = "^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$") private String openTime; private String contractId; private String orderFee; // @Data // public static class ORequest { // private String appId; // private String outOrderNo; // private String mobile; // private String vipType = "INSTABOOK"; // private Integer buyDays; // private String openTime; // private String contractId; // private String orderFee; // } // public static void main(String[] args) throws IOException { // String param = "[{\"app_id\":\"100041236812531729838455\",\"out_order_no\":\"134343470191611494222\",\"mobile\":\"+008615608036305\",\"vip_type\":\"INSTABOOK\",\"buy_days\":365,\"open_time\":\"2019-04-13 12:29:26\",\"contract_id\":\"0\",\"order_fee\":\"zhihu123\"}]"; // ObjectMapper mapper = new ObjectMapper() // .setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE) // .setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY) // .configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false) // .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) // .setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE); // ArrayNode arrayNode = (ArrayNode) mapper.readTree(param); // ORequest req = mapper.convertValue(arrayNode.get(0), ORequest.class); // System.out.println(req); // } }
2,113
0.630383
0.572172
63
32.539684
39.9006
277
false
false
0
0
0
0
0
0
0.619048
false
false
5
785c217b0ef15f9eeec9a8a0ea21900dd76c8b3c
4,483,945,864,072
8733f77e92d09d7ec2c4b9304ff7703f29d77ef8
/fun/archware/impl/events/EventMoveRelative.java
413d66cf0ee0cb2b1b99d11840a0ae3092652c61
[]
no_license
kiril2frq/archware
https://github.com/kiril2frq/archware
7a231da56483f273dffb230cfd49b1d0d693d265
27788f9d60254936595c336e7ea1f6853eaea647
refs/heads/master
2023-08-16T05:27:07.561000
2021-10-03T14:57:13
2021-10-03T14:57:13
415,099,339
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package fun.archware.impl.events; import fun.archware.base.event.Event; public class EventMoveRelative extends Event { public float strafe, up, forward, friction; public float yaw; public EventMoveRelative(float strafe, float up, float forward, float friction, float yaw) { this.strafe = strafe; this.up = up; this.forward = forward; this.friction = friction; this.yaw = yaw; } }
UTF-8
Java
439
java
EventMoveRelative.java
Java
[]
null
[]
package fun.archware.impl.events; import fun.archware.base.event.Event; public class EventMoveRelative extends Event { public float strafe, up, forward, friction; public float yaw; public EventMoveRelative(float strafe, float up, float forward, float friction, float yaw) { this.strafe = strafe; this.up = up; this.forward = forward; this.friction = friction; this.yaw = yaw; } }
439
0.667426
0.667426
16
26.4375
23.905985
96
false
false
0
0
0
0
0
0
1
false
false
5