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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
83a675621fca86833c11125e7f569721f9ba8b55
| 35,502,199,671,277 |
aa9e5f7ec6e696a7786e4ce3fa41b24b8ae08f8f
|
/app/src/main/java/id/web/androidhyper/bakingapp/ui/stepssegment/StepsActivity.java
|
97c67f37bbbc362622a8fa4153d60b70a8acefc6
|
[] |
no_license
|
Wildhansatriady/BakingApps
|
https://github.com/Wildhansatriady/BakingApps
|
e405d27480b47e8e4767ab12a51d50ad4253f916
|
ea002da317401916bdc427b34103de6d797a1ba6
|
refs/heads/master
| 2021-06-29T04:38:27.697000 | 2017-09-18T03:29:41 | 2017-09-18T03:29:41 | 103,836,387 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package id.web.androidhyper.bakingapp.ui.stepssegment;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import id.web.androidhyper.bakingapp.AppUtils;
import id.web.androidhyper.bakingapp.ConstantUtils;
import id.web.androidhyper.bakingapp.R;
import id.web.androidhyper.bakingapp.model.MainModel;
import id.web.androidhyper.bakingapp.ui.stepssegment.detailstep.DetailStepsFragment;
import id.web.androidhyper.bakingapp.ui.stepssegment.liststeps.StepsListFragment;
import static id.web.androidhyper.bakingapp.ConstantUtils.STEPS_LIST_FRAGMENT_NAME;
public class StepsActivity extends AppCompatActivity implements FragmentManager.OnBackStackChangedListener {
MainModel mData;
Unbinder unbinder;
StepsListFragment stepsFragment;
DetailStepsFragment detailStepsFragment;
boolean isTablet =false;
boolean canback=false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_steps);
unbinder = ButterKnife.bind(this);
getSupportFragmentManager().addOnBackStackChangedListener(this);
if(findViewById(R.id.container_detail)!=null){
isTablet = true;
}
Bundle bundle = getIntent().getExtras().getBundle(ConstantUtils.KEY_PASSMAINDATA);
if (bundle != null) {
mData = bundle.getParcelable(ConstantUtils.KEY_SELECTED_RECEIVE);
if (mData != null) {
AppUtils.setUpHomeButton(this,"Steps How to Make "+mData.getName());
initFragmentSteps(savedInstanceState,bundle);
}
}
}
public boolean isTablet() {
return isTablet;
}
public boolean isLandscape(){
return AppUtils.isDefaultLandscape(this);
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
getSupportFragmentManager().putFragment(outState, STEPS_LIST_FRAGMENT_NAME, stepsFragment);
//getSupportFragmentManager().putFragment(outState, "detailStepsFragment", stepsFragment);
}
void initFragmentSteps(Bundle savedState,Bundle bundle){
if(savedState!=null){
if(getSupportFragmentManager().getFragment(savedState, STEPS_LIST_FRAGMENT_NAME) instanceof StepsListFragment) {
stepsFragment
= (StepsListFragment) getSupportFragmentManager().getFragment(savedState, STEPS_LIST_FRAGMENT_NAME);
}
}else {
stepsFragment = new StepsListFragment();
stepsFragment.setArguments(bundle);
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.container_steps, stepsFragment);
transaction.commit();
if(isTablet){
detailStepsFragment = new DetailStepsFragment();
// TODO: 9/13/2017
}
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if(canback) {
getSupportFragmentManager().popBackStack();
return true;
}else
return AppUtils.backUpButtonAction(item, this);
//return super.onOptionsItemSelected(item);
}
@Override
public void onBackStackChanged() {
canback = getSupportFragmentManager().getBackStackEntryCount()>0;
}
}
|
UTF-8
|
Java
| 3,633 |
java
|
StepsActivity.java
|
Java
|
[] | null |
[] |
package id.web.androidhyper.bakingapp.ui.stepssegment;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import id.web.androidhyper.bakingapp.AppUtils;
import id.web.androidhyper.bakingapp.ConstantUtils;
import id.web.androidhyper.bakingapp.R;
import id.web.androidhyper.bakingapp.model.MainModel;
import id.web.androidhyper.bakingapp.ui.stepssegment.detailstep.DetailStepsFragment;
import id.web.androidhyper.bakingapp.ui.stepssegment.liststeps.StepsListFragment;
import static id.web.androidhyper.bakingapp.ConstantUtils.STEPS_LIST_FRAGMENT_NAME;
public class StepsActivity extends AppCompatActivity implements FragmentManager.OnBackStackChangedListener {
MainModel mData;
Unbinder unbinder;
StepsListFragment stepsFragment;
DetailStepsFragment detailStepsFragment;
boolean isTablet =false;
boolean canback=false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_steps);
unbinder = ButterKnife.bind(this);
getSupportFragmentManager().addOnBackStackChangedListener(this);
if(findViewById(R.id.container_detail)!=null){
isTablet = true;
}
Bundle bundle = getIntent().getExtras().getBundle(ConstantUtils.KEY_PASSMAINDATA);
if (bundle != null) {
mData = bundle.getParcelable(ConstantUtils.KEY_SELECTED_RECEIVE);
if (mData != null) {
AppUtils.setUpHomeButton(this,"Steps How to Make "+mData.getName());
initFragmentSteps(savedInstanceState,bundle);
}
}
}
public boolean isTablet() {
return isTablet;
}
public boolean isLandscape(){
return AppUtils.isDefaultLandscape(this);
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
getSupportFragmentManager().putFragment(outState, STEPS_LIST_FRAGMENT_NAME, stepsFragment);
//getSupportFragmentManager().putFragment(outState, "detailStepsFragment", stepsFragment);
}
void initFragmentSteps(Bundle savedState,Bundle bundle){
if(savedState!=null){
if(getSupportFragmentManager().getFragment(savedState, STEPS_LIST_FRAGMENT_NAME) instanceof StepsListFragment) {
stepsFragment
= (StepsListFragment) getSupportFragmentManager().getFragment(savedState, STEPS_LIST_FRAGMENT_NAME);
}
}else {
stepsFragment = new StepsListFragment();
stepsFragment.setArguments(bundle);
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.container_steps, stepsFragment);
transaction.commit();
if(isTablet){
detailStepsFragment = new DetailStepsFragment();
// TODO: 9/13/2017
}
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if(canback) {
getSupportFragmentManager().popBackStack();
return true;
}else
return AppUtils.backUpButtonAction(item, this);
//return super.onOptionsItemSelected(item);
}
@Override
public void onBackStackChanged() {
canback = getSupportFragmentManager().getBackStackEntryCount()>0;
}
}
| 3,633 | 0.693917 | 0.690889 | 106 | 33.273586 | 30.751755 | 124 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.54717 | false | false |
5
|
24989ce8bf4ff86248d2d4d23e475483e7ecc027
| 29,154,238,059,017 |
fcc2b22dcc08462b5433829163af962097582848
|
/src/main/java/top/vnelinpe/management/vo/sys/RuntimeVO.java
|
2984c52b1fdf903dd5d1a2566cfce90d678eec86
|
[] |
no_license
|
VNElinpe/monomer-management
|
https://github.com/VNElinpe/monomer-management
|
e204e81a618f9f4839ffca6e069d0fcced9bf952
|
a2ca3d7258e4955f0262768c5c280917d65aaf52
|
refs/heads/master
| 2023-04-21T17:24:48.029000 | 2021-05-03T00:22:04 | 2021-05-03T00:22:04 | 363,776,922 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package top.vnelinpe.management.vo.sys;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 运行时信息模型
*
* @author VNElinpe
* @version 1.0
* @date 2020/10/23 8:42
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("运行时信息模型")
public class RuntimeVO {
@ApiModelProperty("虚拟机名称")
private String name;
@ApiModelProperty("虚拟机供应商")
private String vendor;
@ApiModelProperty("虚拟机版本")
private String version;
@ApiModelProperty("开启时间")
private String startTime;
@ApiModelProperty("运行时长")
private String upTime;
}
|
UTF-8
|
Java
| 792 |
java
|
RuntimeVO.java
|
Java
|
[
{
"context": "k.NoArgsConstructor;\n\n/**\n * 运行时信息模型\n *\n * @author VNElinpe\n * @version 1.0\n * @date 2020/10/23 8:42\n */\n@Dat",
"end": 277,
"score": 0.9996742010116577,
"start": 269,
"tag": "USERNAME",
"value": "VNElinpe"
}
] | null |
[] |
package top.vnelinpe.management.vo.sys;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 运行时信息模型
*
* @author VNElinpe
* @version 1.0
* @date 2020/10/23 8:42
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("运行时信息模型")
public class RuntimeVO {
@ApiModelProperty("虚拟机名称")
private String name;
@ApiModelProperty("虚拟机供应商")
private String vendor;
@ApiModelProperty("虚拟机版本")
private String version;
@ApiModelProperty("开启时间")
private String startTime;
@ApiModelProperty("运行时长")
private String upTime;
}
| 792 | 0.740223 | 0.722067 | 33 | 20.69697 | 12.36928 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.363636 | false | false |
5
|
d22d16e72159a64f789e7debb8587927fe256e91
| 9,517,647,593,823 |
64d99c640ef53cc4f98338b1ec5c65af8fa9669a
|
/app/src/main/java/com/messagitory/SplashActivity.java
|
c554ef8af86f9429f210ac97f1740cc93ffff2a4
|
[
"Apache-2.0"
] |
permissive
|
ajajpatel24/memories
|
https://github.com/ajajpatel24/memories
|
5add674d5cfea3bf1131ba3758e477b7e2ac5345
|
cef584a40d11c2752b0894eecafbf2454e2bb64d
|
refs/heads/master
| 2020-06-10T22:05:53.429000 | 2017-02-16T16:47:20 | 2017-02-16T16:48:31 | 75,859,648 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.messagitory;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.widget.ImageView;
public class SplashActivity extends AppCompatActivity {
ImageView gif;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
gif = (ImageView) findViewById(R.id.my_image_view);
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
Intent intent = new Intent(SplashActivity.this, Main.class);
startActivity(intent);
finish();
}
}, 1000);
}
}
|
UTF-8
|
Java
| 822 |
java
|
SplashActivity.java
|
Java
|
[] | null |
[] |
package com.messagitory;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.widget.ImageView;
public class SplashActivity extends AppCompatActivity {
ImageView gif;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
gif = (ImageView) findViewById(R.id.my_image_view);
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
Intent intent = new Intent(SplashActivity.this, Main.class);
startActivity(intent);
finish();
}
}, 1000);
}
}
| 822 | 0.649635 | 0.643552 | 27 | 29.444445 | 20.059788 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.62963 | false | false |
5
|
0865c8de64fa59bf0b198ebf54bc7e0bbae24b9f
| 9,517,647,590,136 |
5f667b764b33e9522f2d118a71268ae1dc005c21
|
/spark/src/main/java/test/XMethodTest.java
|
4d23444ea9910f3fe15fbae0c5af01c88d09da35
|
[] |
no_license
|
omoby/workLearing
|
https://github.com/omoby/workLearing
|
92839d72e79efae792b0fd05b3d2092b8e6e3ee5
|
7fb665cff5f5e669d16e7d989e0f988f334afb67
|
refs/heads/master
| 2022-05-30T00:37:55.769000 | 2020-03-26T04:34:06 | 2020-03-26T04:34:06 | 200,325,016 | 0 | 0 | null | false | 2022-04-12T21:57:12 | 2019-08-03T03:05:29 | 2020-03-26T04:34:44 | 2022-04-12T21:57:11 | 230 | 0 | 0 | 6 |
Java
| false | false |
package test;
/**
* @ClassName XMethodTest
* @Author zhangqx02
* @Date 2019/12/5 9:30
* @Description
*/
public class XMethodTest {
public static void main(String[] args){
int x = 1;
int y = 2;
xMethod(x, y);
}
public static void xMethod(int x,int y){
System.out.println(x+y);
// return x+y;
}
}
|
UTF-8
|
Java
| 358 |
java
|
XMethodTest.java
|
Java
|
[
{
"context": "e test;\n\n\n/**\n * @ClassName XMethodTest\n * @Author zhangqx02\n * @Date 2019/12/5 9:30\n * @Description\n */\n\npubl",
"end": 66,
"score": 0.999588668346405,
"start": 57,
"tag": "USERNAME",
"value": "zhangqx02"
}
] | null |
[] |
package test;
/**
* @ClassName XMethodTest
* @Author zhangqx02
* @Date 2019/12/5 9:30
* @Description
*/
public class XMethodTest {
public static void main(String[] args){
int x = 1;
int y = 2;
xMethod(x, y);
}
public static void xMethod(int x,int y){
System.out.println(x+y);
// return x+y;
}
}
| 358 | 0.555866 | 0.51676 | 21 | 16.047619 | 13.214264 | 44 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.380952 | false | false |
5
|
d95a3c1f80f982d22c91df568dab6e1cedece7e9
| 60,129,561,537 |
064f69430263161ace984b051e5b4300a2626342
|
/src/exceptions/ParameterValidationException.java
|
4729691ea425f0892d3f1a27b62c3c7ca3222ddc
|
[] |
no_license
|
dpauli/ePRESTClient
|
https://github.com/dpauli/ePRESTClient
|
5cccf846d61381432b3cac7430c6d3e5d4c4c064
|
0868d8d7c0a432287e3a56efeba2448e940d7c52
|
refs/heads/master
| 2016-06-07T02:56:20.031000 | 2015-06-28T20:20:27 | 2015-06-28T20:20:27 | 36,874,726 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package exceptions;
public class ParameterValidationException extends Exception {
}
|
UTF-8
|
Java
| 86 |
java
|
ParameterValidationException.java
|
Java
|
[] | null |
[] |
package exceptions;
public class ParameterValidationException extends Exception {
}
| 86 | 0.837209 | 0.837209 | 5 | 16.200001 | 23.540604 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | false | false |
5
|
36a35ca21d2093142ef1b0808e7df6012a81b743
| 17,145,509,508,111 |
069d2e6b9712037e683c35eebc4f37e68735bb1a
|
/app/src/main/java/com/bxtrade/boxfarming/Activity/CustomerChatActivity.java
|
fc476734de32295ae4ca8cc26e92a6664f1ff7ad
|
[] |
no_license
|
Rahul-Routh/box-farming
|
https://github.com/Rahul-Routh/box-farming
|
e34299f80f94f19a93dfdb90aca79dd5e198f4a4
|
8976960e5249b00d24686019076e2d009da341bb
|
refs/heads/master
| 2023-06-23T16:33:23.120000 | 2021-07-19T06:21:53 | 2021-07-19T06:21:53 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.bxtrade.boxfarming.Activity;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;
import com.bxtrade.boxfarming.Adapter.CustomerChatAdapter;
import com.bxtrade.boxfarming.R;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import java.util.ArrayList;
import java.util.List;
public class CustomerChatActivity extends AppCompatActivity {
private RecyclerView customerChatRecycleView;
private CustomerChatAdapter customerChatAdapter;
private List<String> respondCodeArray;
private List<String> cropNameArray;
private List<String> productQuantityArray;
private List<String> rateArray;
private List<String> expectedDateArray;
private List<String> farmer_nameArray;
private List<String> productDistributorPhoneNoArray;
private List<String> offerRateArray;
private List<String> demandQuantityArray;
private List<String> date_demandArray;
private List<String> repeatArray;
private List<String> modifyArray;
private List<String> respondArray;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_customer_chat);
customerChatRecycleView = findViewById(R.id.customerChatRecycleView);
navigation();
customerChat();
customerChatAdapter = new CustomerChatAdapter(this,
respondCodeArray, cropNameArray, productQuantityArray, rateArray,expectedDateArray, farmer_nameArray, productDistributorPhoneNoArray,
offerRateArray, demandQuantityArray, date_demandArray, repeatArray, modifyArray, respondArray);
GridLayoutManager gridLayoutManager = new GridLayoutManager(this,1,GridLayoutManager.VERTICAL,false);
customerChatRecycleView.setLayoutManager(gridLayoutManager);
customerChatRecycleView.setAdapter(customerChatAdapter);
}
private void customerChat(){
respondCodeArray = new ArrayList<>();
cropNameArray = new ArrayList<>();
productQuantityArray = new ArrayList<>();
rateArray = new ArrayList<>();
expectedDateArray = new ArrayList<>();
farmer_nameArray = new ArrayList<>();
productDistributorPhoneNoArray = new ArrayList<>();
offerRateArray = new ArrayList<>();
demandQuantityArray = new ArrayList<>();
date_demandArray = new ArrayList<>();
repeatArray = new ArrayList<>();
modifyArray = new ArrayList<>();
respondArray = new ArrayList<>();
respondCodeArray.add("QT-2000077BM");
cropNameArray.add("Tomato-Desi");
productQuantityArray.add("200 Ton");
rateArray.add("240 Per/Ton");
expectedDateArray.add("Feb 2020");
farmer_nameArray.add("Amit Kumar");
productDistributorPhoneNoArray.add("3120001055");
offerRateArray.add("200 Per/Ton");
demandQuantityArray.add("50 Ton");
date_demandArray.add("22 Dec 2020");
repeatArray.add("REPEAT");
modifyArray.add("MODIFY");
respondArray.add("RESPOND");
}
public void navigation(){
//Initialize and assign variable
BottomNavigationView bottomNavigationView = findViewById(R.id.bottom_navigation);
//set home selected
bottomNavigationView.setSelectedItemId(R.id.chat);
//perform itemSelectedListener
bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
switch (menuItem.getItemId()){
case R.id.home:
startActivity(new Intent(getApplicationContext(),
MainActivity.class));
overridePendingTransition(0,0);
return true;
case R.id.chat:
return true;
case R.id.gallery:
startActivity(new Intent(getApplicationContext(),
ProductListActivity.class));
overridePendingTransition(0,0);
return true;
case R.id.favourite:
startActivity(new Intent(getApplicationContext(),
FavoriteActivity.class));
overridePendingTransition(0,0);
return true;
case R.id.profile:
startActivity(new Intent(getApplicationContext(),
ProfileActivity.class));
overridePendingTransition(0,0);
return true;
}
return false;
}
});
}
}
|
UTF-8
|
Java
| 5,107 |
java
|
CustomerChatActivity.java
|
Java
|
[
{
"context": "y.add(\"QT-2000077BM\");\n cropNameArray.add(\"Tomato-Desi\");\n productQuantityArray.add(\"200 Ton\");\n ",
"end": 2851,
"score": 0.999779224395752,
"start": 2840,
"tag": "NAME",
"value": "Tomato-Desi"
},
{
"context": "ay.add(\"Feb 2020\");\n farmer_nameArray.add(\"Amit Kumar\");\n productDistributorPhoneNoArray.add(\"31",
"end": 3021,
"score": 0.9998486042022705,
"start": 3011,
"tag": "NAME",
"value": "Amit Kumar"
}
] | null |
[] |
package com.bxtrade.boxfarming.Activity;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;
import com.bxtrade.boxfarming.Adapter.CustomerChatAdapter;
import com.bxtrade.boxfarming.R;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import java.util.ArrayList;
import java.util.List;
public class CustomerChatActivity extends AppCompatActivity {
private RecyclerView customerChatRecycleView;
private CustomerChatAdapter customerChatAdapter;
private List<String> respondCodeArray;
private List<String> cropNameArray;
private List<String> productQuantityArray;
private List<String> rateArray;
private List<String> expectedDateArray;
private List<String> farmer_nameArray;
private List<String> productDistributorPhoneNoArray;
private List<String> offerRateArray;
private List<String> demandQuantityArray;
private List<String> date_demandArray;
private List<String> repeatArray;
private List<String> modifyArray;
private List<String> respondArray;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_customer_chat);
customerChatRecycleView = findViewById(R.id.customerChatRecycleView);
navigation();
customerChat();
customerChatAdapter = new CustomerChatAdapter(this,
respondCodeArray, cropNameArray, productQuantityArray, rateArray,expectedDateArray, farmer_nameArray, productDistributorPhoneNoArray,
offerRateArray, demandQuantityArray, date_demandArray, repeatArray, modifyArray, respondArray);
GridLayoutManager gridLayoutManager = new GridLayoutManager(this,1,GridLayoutManager.VERTICAL,false);
customerChatRecycleView.setLayoutManager(gridLayoutManager);
customerChatRecycleView.setAdapter(customerChatAdapter);
}
private void customerChat(){
respondCodeArray = new ArrayList<>();
cropNameArray = new ArrayList<>();
productQuantityArray = new ArrayList<>();
rateArray = new ArrayList<>();
expectedDateArray = new ArrayList<>();
farmer_nameArray = new ArrayList<>();
productDistributorPhoneNoArray = new ArrayList<>();
offerRateArray = new ArrayList<>();
demandQuantityArray = new ArrayList<>();
date_demandArray = new ArrayList<>();
repeatArray = new ArrayList<>();
modifyArray = new ArrayList<>();
respondArray = new ArrayList<>();
respondCodeArray.add("QT-2000077BM");
cropNameArray.add("Tomato-Desi");
productQuantityArray.add("200 Ton");
rateArray.add("240 Per/Ton");
expectedDateArray.add("Feb 2020");
farmer_nameArray.add("<NAME>");
productDistributorPhoneNoArray.add("3120001055");
offerRateArray.add("200 Per/Ton");
demandQuantityArray.add("50 Ton");
date_demandArray.add("22 Dec 2020");
repeatArray.add("REPEAT");
modifyArray.add("MODIFY");
respondArray.add("RESPOND");
}
public void navigation(){
//Initialize and assign variable
BottomNavigationView bottomNavigationView = findViewById(R.id.bottom_navigation);
//set home selected
bottomNavigationView.setSelectedItemId(R.id.chat);
//perform itemSelectedListener
bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
switch (menuItem.getItemId()){
case R.id.home:
startActivity(new Intent(getApplicationContext(),
MainActivity.class));
overridePendingTransition(0,0);
return true;
case R.id.chat:
return true;
case R.id.gallery:
startActivity(new Intent(getApplicationContext(),
ProductListActivity.class));
overridePendingTransition(0,0);
return true;
case R.id.favourite:
startActivity(new Intent(getApplicationContext(),
FavoriteActivity.class));
overridePendingTransition(0,0);
return true;
case R.id.profile:
startActivity(new Intent(getApplicationContext(),
ProfileActivity.class));
overridePendingTransition(0,0);
return true;
}
return false;
}
});
}
}
| 5,103 | 0.645584 | 0.636381 | 134 | 37.119404 | 26.901712 | 149 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.776119 | false | false |
5
|
d14b532782eeb5992a278601242064be9151b36c
| 17,145,509,510,977 |
f6f9e28bfdf599b0021fd8ae0e6909615003af66
|
/greendaotest/src/main/java/com/example/greendaotest/module/one/Customer.java
|
fa885c9b4875e00b031d721acae7ea68ff0da011
|
[] |
no_license
|
Springwu1/Testdemo
|
https://github.com/Springwu1/Testdemo
|
bb97637bd7e70b7058cf39747662a7a4d23ff5dd
|
2001af547013bdc73ea72b78d7f59fc3b647e3f4
|
refs/heads/master
| 2020-03-18T12:21:16.297000 | 2020-01-15T08:56:02 | 2020-01-15T08:56:02 | 134,722,352 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.greendaotest.module.one;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Property;
import org.greenrobot.greendao.annotation.Generated;
/**
* <pre>
* author : wujiangming
* e-mail : jiangmingwu@ecarx.com.cn
* time : 2018/11/19
* desc : 1对1关系表,Customer 顾客
* version: 1.0
* </pre>
*/
@Entity
public class Customer {
@Id
private Long id;
//如果不修改列名,可以不加@Property
private String name;
@Generated(hash = 855149052)
public Customer(Long id, String name) {
this.id = id;
this.name = name;
}
@Generated(hash = 60841032)
public Customer() {
}
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
return "Customer{" +
"id=" + id +
", name='" + name + '\'' +
'}';
}
}
|
UTF-8
|
Java
| 1,204 |
java
|
Customer.java
|
Java
|
[
{
"context": "nnotation.Generated;\n\n/**\n * <pre>\n * author : wujiangming\n * e-mail : jiangmingwu@ecarx.com.cn\n * t",
"end": 288,
"score": 0.8704298138618469,
"start": 277,
"tag": "USERNAME",
"value": "wujiangming"
},
{
"context": " <pre>\n * author : wujiangming\n * e-mail : jiangmingwu@ecarx.com.cn\n * time : 2018/11/19\n * desc : 1对1关系表",
"end": 329,
"score": 0.9999342560768127,
"start": 305,
"tag": "EMAIL",
"value": "jiangmingwu@ecarx.com.cn"
}
] | null |
[] |
package com.example.greendaotest.module.one;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Property;
import org.greenrobot.greendao.annotation.Generated;
/**
* <pre>
* author : wujiangming
* e-mail : <EMAIL>
* time : 2018/11/19
* desc : 1对1关系表,Customer 顾客
* version: 1.0
* </pre>
*/
@Entity
public class Customer {
@Id
private Long id;
//如果不修改列名,可以不加@Property
private String name;
@Generated(hash = 855149052)
public Customer(Long id, String name) {
this.id = id;
this.name = name;
}
@Generated(hash = 60841032)
public Customer() {
}
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
return "Customer{" +
"id=" + id +
", name='" + name + '\'' +
'}';
}
}
| 1,187 | 0.571184 | 0.546312 | 58 | 19.103449 | 15.579263 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.275862 | false | false |
5
|
f435bd5eb44df824dbf35d6a1027f51cd288c174
| 22,608,707,905,694 |
0d67036f3c12a6cad911b7bf26bc4dc5f165b75d
|
/BankProject/src/main/java/com/cpg/BankPro/ui/Presentation.java
|
0176aeb5b7bac41d6570b373ae309771bfcb173f
|
[] |
no_license
|
Pallaviburoju/B.Pallavi
|
https://github.com/Pallaviburoju/B.Pallavi
|
b8e655ae95b028084dcd76b5969f8241ddd4a0c8
|
74608284ee44749c1bd707bbcc1bc8fd4bad5e1d
|
refs/heads/master
| 2022-07-06T03:37:03.009000 | 2019-09-13T14:11:05 | 2019-09-13T14:11:05 | 172,669,875 | 0 | 0 | null | false | 2022-05-25T06:37:27 | 2019-02-26T08:31:04 | 2019-09-13T14:11:08 | 2022-05-25T06:37:25 | 129 | 0 | 0 | 2 |
Java
| false | false |
package com.cpg.BankPro.ui;
import java.util.Scanner;
import com.cpg.BankPro.dto.Customerpojo;
import com.cpg.BankPro.service.CustomerServiceImpl;
import com.cpg.BankPro.service.ICustomerService;
public class Presentation {
static Customerpojo dto=new Customerpojo();
ICustomerService service=new CustomerServiceImpl();
//obtaining details from customer to register
public Customerpojo customerDetails() {
Scanner scan=new Scanner(System.in);
System.out.println("Enter first name:");
dto.setFirstName(scan.next());
System.out.println("Enter last name:");
dto.setLastName(scan.next());
System.out.println("Enter email_id:");
dto.setEmailId(scan.next());
System.out.println("Enter pancard no:");
dto.setPancardNo(scan.next());
System.out.println("Enter aadhar card no:");
dto.setAadharNo(scan.next());
System.out.println("Enter address:");
dto.setAddress(scan.next());
System.out.println("Enter mobile no:");
dto.setMobileNo(scan.next());
service.registration(dto);
return dto;
}
public static void main(String args[]) {
Presentation object=new Presentation();
Scanner scan=new Scanner(System.in);
System.out.println("Select option\n1. Register\n2.Login");
String ch;
ch=scan.next();
switch(ch) {
case "1": object.customerDetails();
System.out.println("You are successfully registered and your account number is "+dto.getAccountNo());
case "2":
}
}
}
|
UTF-8
|
Java
| 1,485 |
java
|
Presentation.java
|
Java
|
[] | null |
[] |
package com.cpg.BankPro.ui;
import java.util.Scanner;
import com.cpg.BankPro.dto.Customerpojo;
import com.cpg.BankPro.service.CustomerServiceImpl;
import com.cpg.BankPro.service.ICustomerService;
public class Presentation {
static Customerpojo dto=new Customerpojo();
ICustomerService service=new CustomerServiceImpl();
//obtaining details from customer to register
public Customerpojo customerDetails() {
Scanner scan=new Scanner(System.in);
System.out.println("Enter first name:");
dto.setFirstName(scan.next());
System.out.println("Enter last name:");
dto.setLastName(scan.next());
System.out.println("Enter email_id:");
dto.setEmailId(scan.next());
System.out.println("Enter pancard no:");
dto.setPancardNo(scan.next());
System.out.println("Enter aadhar card no:");
dto.setAadharNo(scan.next());
System.out.println("Enter address:");
dto.setAddress(scan.next());
System.out.println("Enter mobile no:");
dto.setMobileNo(scan.next());
service.registration(dto);
return dto;
}
public static void main(String args[]) {
Presentation object=new Presentation();
Scanner scan=new Scanner(System.in);
System.out.println("Select option\n1. Register\n2.Login");
String ch;
ch=scan.next();
switch(ch) {
case "1": object.customerDetails();
System.out.println("You are successfully registered and your account number is "+dto.getAccountNo());
case "2":
}
}
}
| 1,485 | 0.69697 | 0.694276 | 55 | 26 | 21.297033 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.309091 | false | false |
5
|
1e80135513a8d0657d1a582813f169698b2ca5f9
| 35,313,221,118,433 |
304c1c5b8736a93962a82dad39de43818426b8ff
|
/workload/mwbd-admin/src/main/java/com/mwbd/modular/system/service/SparkService.java
|
d1c1a79b6b5e3c3a101f009a7c4af71727115189
|
[
"Apache-2.0"
] |
permissive
|
tianyun515/manwei
|
https://github.com/tianyun515/manwei
|
a5a3843217872a9c964225dff8abb256780e96aa
|
6912278e002f5b86efa211828deab4fbf44f7b6e
|
refs/heads/master
| 2020-03-18T13:29:38.062000 | 2018-05-25T06:14:35 | 2018-05-25T06:14:35 | 134,786,948 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.mwbd.modular.system.service;
/**
* @author make
* @creare 31/01/2018
*/
public interface SparkService {
public void addTask() throws Exception;
}
|
UTF-8
|
Java
| 169 |
java
|
SparkService.java
|
Java
|
[
{
"context": "e com.mwbd.modular.system.service;\n\n/**\n * @author make\n * @creare 31/01/2018\n */\npublic interface SparkS",
"end": 61,
"score": 0.9916663765907288,
"start": 57,
"tag": "USERNAME",
"value": "make"
}
] | null |
[] |
package com.mwbd.modular.system.service;
/**
* @author make
* @creare 31/01/2018
*/
public interface SparkService {
public void addTask() throws Exception;
}
| 169 | 0.692308 | 0.64497 | 12 | 13.083333 | 15.918848 | 43 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | false | false |
5
|
e306ad4de17b7e83340989bc0995d107a4878996
| 34,961,033,796,338 |
364d5053d103f48db88ebab664661c8254bf04f9
|
/app/src/main/java/com/diablo/dt/diablo/fragment/stock/StockOutUpdate.java
|
2c715a819853c8ade3f84d2a682bf18b317a73d5
|
[] |
no_license
|
LonelyPriest/AndroidDiablo
|
https://github.com/LonelyPriest/AndroidDiablo
|
35aadeec3f880779c59389036d63d29dcad0fe28
|
7d0f31549c75c0484a67b22278b50bc9fe362d72
|
refs/heads/master
| 2021-06-29T05:24:25.352000 | 2021-01-05T01:42:42 | 2021-01-05T01:42:42 | 82,514,734 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.diablo.dt.diablo.fragment.stock;
import static com.diablo.dt.diablo.R.string.amount;
import android.graphics.Typeface;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.util.SparseArray;
import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import android.widget.Toast;
import com.diablo.dt.diablo.R;
import com.diablo.dt.diablo.client.StockClient;
import com.diablo.dt.diablo.controller.DiabloStockCalcController;
import com.diablo.dt.diablo.controller.DiabloStockRowController;
import com.diablo.dt.diablo.controller.DiabloStockTableController;
import com.diablo.dt.diablo.entity.DiabloButton;
import com.diablo.dt.diablo.entity.Firm;
import com.diablo.dt.diablo.entity.MatchStock;
import com.diablo.dt.diablo.entity.Profile;
import com.diablo.dt.diablo.model.sale.SaleUtils;
import com.diablo.dt.diablo.model.stock.EntryStock;
import com.diablo.dt.diablo.model.stock.EntryStockAmount;
import com.diablo.dt.diablo.model.stock.StockCalc;
import com.diablo.dt.diablo.model.stock.StockUtils;
import com.diablo.dt.diablo.request.stock.NewStockRequest;
import com.diablo.dt.diablo.response.stock.GetStockNewResponse;
import com.diablo.dt.diablo.response.stock.NewStockResponse;
import com.diablo.dt.diablo.response.stock.StockDetailResponse;
import com.diablo.dt.diablo.rest.StockInterface;
import com.diablo.dt.diablo.utils.DiabloAlertDialog;
import com.diablo.dt.diablo.utils.DiabloEnum;
import com.diablo.dt.diablo.utils.DiabloError;
import com.diablo.dt.diablo.utils.DiabloUtils;
import com.diablo.dt.diablo.view.DiabloCellLabel;
import com.diablo.dt.diablo.view.DiabloCellView;
import com.diablo.dt.diablo.view.DiabloRowView;
import com.diablo.dt.diablo.view.stock.DiabloStockCalcView;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
import retrofit2.Call;
import retrofit2.Callback;
public class StockOutUpdate extends Fragment {
private final static DiabloUtils UTILS = DiabloUtils.instance();
private final static String LOG_TAG = "StockOutUpdate:";
private DiabloCellLabel[] mLabels;
private String [] mSeasons;
private SparseArray<DiabloButton> mButtons;
private DiabloStockCalcView mStockCalcView;
private DiabloStockCalcController mStockCalcController;
private DiabloStockTableController mStockTableController;
private StockCalc mOldStockCalc;
private List<EntryStock> mOldEntryStocks;
private TableRow mCurrentSelectedRow;
private View mFragment;
private StockOutUpdateHandler mHandler = new StockOutUpdateHandler(this);
private GoodSelect.OnNoFreeGoodSelectListener mOnNoFreeGoodSelectListener;
private Integer mBackFrom = R.string.back_from_unknown;
private String mRSN;
private String mLastRSN;
private Integer mRSNId;
public void setNoFreeGoodSelectListener(GoodSelect.OnNoFreeGoodSelectListener listener){
mOnNoFreeGoodSelectListener = listener;
}
public void setBackFrom(Integer form){
mBackFrom = form;
}
public StockOutUpdate() {
// Required empty public constructor
}
public static StockOutUpdate newInstance(String param1, String param2) {
StockOutUpdate fragment = new StockOutUpdate();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
private void initTitle() {
String title = getResources().getString(R.string.stock_out_update);
ActionBar bar = ((AppCompatActivity)getActivity()).getSupportActionBar();
if (null != bar) {
bar.setTitle(title);
}
}
private void initLabel() {
mButtons = new SparseArray<>();
mButtons.put(R.id.stock_out_update_save, new DiabloButton(getContext(), R.id.stock_out_update_save));
mSeasons = getResources().getStringArray(R.array.seasons);
mLabels = StockUtils.createStockLabelsFromTitle(getContext());
}
private void initCalcView(View view) {
mStockCalcView = new DiabloStockCalcView();
mStockCalcView.setViewFirm(view.findViewById(R.id.stock_select_firm));
mStockCalcView.setViewShop(view.findViewById(R.id.stock_select_shop));
mStockCalcView.setViewDatetime(view.findViewById(R.id.stock_selected_date));
mStockCalcView.setViewEmployee(view.findViewById(R.id.stock_select_employee));
mStockCalcView.setViewStockTotal(view.findViewById(R.id.stock_total));
mStockCalcView.setViewShouldPay(view.findViewById(R.id.stock_should_pay));
// mStockCalcView.setViewCash(view.findViewById(R.id.stock_cash));
mStockCalcView.setViewComment(view.findViewById(R.id.stock_comment));
mStockCalcView.setViewBalance(view.findViewById(R.id.firm_balance));
// mStockCalcView.setViewHasPay(view.findViewById(R.id.stock_has_pay));
// mStockCalcView.setViewCard(view.findViewById(R.id.stock_card));
mStockCalcView.setViewExtraCostType(view.findViewById(R.id.stock_select_extra_cost));
mStockCalcView.setViewAccBalance(view.findViewById(R.id.firm_accBalance));
mStockCalcView.setViewVerificate(view.findViewById(R.id.stock_verificate));
// mStockCalcView.setViewWire(view.findViewById(R.id.stock_wire));
mStockCalcView.setViewExtraCost(view.findViewById(R.id.stock_extra_cost));
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mRSN = getArguments().getString(DiabloEnum.BUNDLE_PARAM_RSN);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
initTitle();
// Inflate the layout for this fragment
mFragment = inflater.inflate(R.layout.fragment_stock_out_update, container, false);
setHasOptionsMenu(true);
getActivity().supportInvalidateOptionsMenu();
initLabel();
((TableLayout)mFragment.findViewById(R.id.t_stock_head)).addView(addHead());
init();
return mFragment;
}
public void setRSN(String rsn) {
this.mRSN = rsn;
}
private TableRow addHead(){
TableRow row = new TableRow(getContext());
for (DiabloCellLabel label: mLabels) {
TextView cell = new TextView(getContext());
cell.setLayoutParams(label.getTableRowLayoutParams());
cell.setTypeface(null, Typeface.BOLD);
cell.setTextColor(ContextCompat.getColor(getContext(), R.color.black));
cell.setTextSize(label.getSize());
cell.setText(label.getLabel());
row.addView(cell);
}
return row;
}
private void init() {
mLastRSN = mRSN;
if (null != mStockTableController) {
mStockTableController.clear();
}
mStockTableController = new DiabloStockTableController((TableLayout) mFragment.findViewById(R.id.t_stock));
initCalcView(mFragment);
getStockOutFromServer();
}
private void recoverFromResponse(StockDetailResponse.StockDetail detail,
List<GetStockNewResponse.StockNote> notes) {
mOldStockCalc = new StockCalc(detail.getType());
mOldStockCalc.setFirm(detail.getFirm());
mOldStockCalc.setShop(detail.getShop());
mOldStockCalc.setDatetime(detail.getEntryDate());
mOldStockCalc.setEmployee(detail.getEmployee());
mOldStockCalc.setComment(detail.getComment());
mOldStockCalc.setBalance(detail.getBalance());
mOldStockCalc.setVerificate(detail.getVerificate());
mOldStockCalc.setShouldPay(Math.abs(detail.getShouldPay()));
mOldStockCalc.setExtraCostType(detail.getEPayType());
mOldStockCalc.setExtraCost(detail.getEPay());
// mOldStockCalc.calcHasPay();
mOldStockCalc.calcAccBalance();
mOldEntryStocks = new ArrayList<>();
Integer orderId = 0;
for (GetStockNewResponse.StockNote n: notes) {
String styleNumber = n.getStyleNumber();
Integer brandId = n.getBrandId();
EntryStock stock = StockUtils.getEntryStock(mOldEntryStocks, styleNumber, brandId);
if (null == stock) {
MatchStock matchStock = Profile.instance().getMatchStock(styleNumber, brandId);
EntryStock s = new EntryStock();
s.init(matchStock);
orderId++;
s.setOrderId(orderId);
s.setState(StockUtils.FINISHED_STOCK);
s.setDiscount(n.getDiscount());
EntryStockAmount amount = new EntryStockAmount(n.getColorId(), n.getSize());
amount.setCount(Math.abs(n.getAmount()));
s.addAmount(amount);
s.setTotal(Math.abs(n.getAmount()));
mOldEntryStocks.add(s);
} else {
EntryStockAmount amount = new EntryStockAmount(n.getColorId(), n.getSize());
amount.setCount(Math.abs(n.getAmount()));
stock.setTotal(stock.getTotal() + Math.abs(n.getAmount()));
stock.addAmount(amount);
}
}
buildContent(new StockCalc(mOldStockCalc), mOldEntryStocks);
}
private void buildContent(final StockCalc calc, final List<EntryStock> stocks) {
mStockCalcController = new DiabloStockCalcController(calc, mStockCalcView);
mStockCalcController.setShop(calc.getShop());
mStockCalcController.setDatetime(calc.getDatetime());
// listener when select firm
Firm firm = Profile.instance().getFirm(calc.getFirm());
mStockCalcController.setFirm(firm);
mStockCalcController.setBalance(mOldStockCalc.getBalance());
mStockCalcController.setFirmWatcher();
mStockCalcController.setFirmClickListener(getContext());
mStockCalcController.setOnFirmChangedListener(mFirmChangedListener);
// mStockCalcView.setCashValue(calc.getCash());
// mStockCalcView.setCardValue(calc.getCard());
// mStockCalcView.setWireValue(calc.getWire());
mStockCalcView.setVerificateValue(calc.getVerificate());
mStockCalcView.setExtraCostValue(calc.getExtraCost());
mStockCalcController.setStockCalcView(mStockCalcView);
mStockCalcController.setEmployeeClickListener();
mStockCalcController.setCommentWatcher();
// mStockCalcController.setCashWatcher();
// mStockCalcController.setCardWatcher();
// mStockCalcController.setWireWatcher();
mStockCalcController.setVerificateWatcher();
mStockCalcController.setExtraCostWatcher();
mStockCalcController.setExtraCostTypeListener();
// adapter
mStockCalcController.setEmployeeAdapter(getContext());
mStockCalcController.setExtraCostTypeAdapter(getContext());
for (EntryStock s: stocks) {
DiabloStockRowController controller = createRowWithStock(s);
mStockTableController.addRowControllerAtTop(controller);
}
mStockTableController.addRowControllerAtTop(addEmptyRow());
calcShouldPay();
}
private DiabloStockRowController createRowWithStock(EntryStock stock) {
TableRow row = new TableRow(getContext());
DiabloStockRowController controller = new DiabloStockRowController(
new DiabloRowView(row), new EntryStock(stock));
for (DiabloCellLabel label: mLabels) {
DiabloCellView cell = new DiabloCellView(label.createCell(getContext()), label);
controller.addCell(cell);
if (R.string.order_id == cell.getCellId()) {
controller.setCellText(cell.getCellId(), UTILS.toString(stock.getOrderId()));
}
else if (R.string.good == cell.getCellId()){
controller.setCellText(cell.getCellId(), stock.getName());
}
else if (R.string.year == cell.getCellId()) {
controller.setCellText(cell.getCellId(), UTILS.toString(stock.getYear()));
}
else if (R.string.season == cell.getCellId()) {
controller.setCellText(cell.getCellId(), mSeasons[stock.getSeason()]);
}
else if (R.string.org_price == cell.getCellId()) {
controller.setCellText(cell.getCellId(), UTILS.toString(stock.getOrgPrice()));
}
else if (R.string.amount == cell.getCellId()) {
controller.setCellText(cell.getCellId(), UTILS.toString(stock.getTotal()));
if (DiabloEnum.DIABLO_FREE.equals(stock.getFree())) {
controller.getView().getCell(amount).setCellFocusable(true);
}
}
else if (R.string.calculate == cell.getCellId()) {
controller.setCellText(cell.getCellId(), UTILS.toString(stock.calcStockPrice()));
}
}
controller.getView().setOnLongClickListener(this);
controller.setAmountWatcher(mHandler, controller);
controller.addListenerOfAmountChange();
return controller;
}
private DiabloStockRowController addEmptyRow() {
TableRow row = new TableRow(getContext());
DiabloStockRowController controller = new DiabloStockRowController(
new DiabloRowView(row),
new EntryStock());
for (DiabloCellLabel label: mLabels) {
DiabloCellView cell = new DiabloCellView(label.createCell(getContext()), label);
controller.addCell(cell);
}
controller.setAmountWatcher(mHandler, controller);
controller.setAutoCompleteStockListener(
getContext(),
mStockCalcController.getFirm(),
mLabels,
mOnActionAfterSelectGood);
return controller;
}
/**
* should change the adapter when the firm changed by the user
*/
private DiabloStockCalcController.OnDiabloFirmChangedListener mFirmChangedListener =
new DiabloStockCalcController.OnDiabloFirmChangedListener() {
@Override
public void onFirmChanged(Firm selectFirm) {
if (0 != mStockTableController.getControllers().size()) {
mStockTableController.getControllers().get(0).setAutoCompleteStockAdapter(
getContext(), selectFirm.getId());
if (selectFirm.getId().equals(mOldStockCalc.getFirm())) {
mStockCalcController.setBalance(mOldStockCalc.getBalance());
} else {
mStockCalcController.setBalance(selectFirm.getBalance());
}
// change focus to input good
mStockTableController.getControllers().get(0).focusStyleNumber();
}
}
};
private DiabloStockRowController.OnActionAfterSelectGood mOnActionAfterSelectGood =
new DiabloStockRowController.OnActionAfterSelectGood(){
@Override
public void onActionOfAmount(DiabloStockRowController controller, DiabloCellView cell) {
if (!mStockTableController.checkSameFirm(mStockCalcController.getFirm())) {
controller.setCellText(R.string.good, DiabloEnum.EMPTY_STRING);
UTILS.makeToast(
getContext(),
getResources().getString(R.string.different_good),
Toast.LENGTH_SHORT);
}
else {
Integer orderId = mStockTableController.contains(controller);
if (!DiabloEnum.INVALID_INDEX.equals(orderId)) {
controller.setCellText(R.string.good, DiabloEnum.EMPTY_STRING);
UTILS.makeToast(
getContext(),
getContext().getResources().getString(R.string.sale_stock_exist)
+ UTILS.toString(orderId),
Toast.LENGTH_SHORT);
} else {
EntryStock stock = controller.getModel();
DiabloRowView row = controller.getView();
if ( DiabloEnum.DIABLO_FREE.equals(stock.getFree()) ){
cell.setCellFocusable(true);
cell.requestFocus();
row.getCell(R.string.good).setCellFocusable(false);
} else {
switchToStockSelectFrame(controller.getModel(), R.string.add);
}
}
}
}
};
private void switchToStockSelectFrame(EntryStock stock, Integer operation) {
StockUtils.switchToStockSelectFrame(
mStockCalcController.getShop(),
stock,
operation,
DiabloEnum.STOCK_OUT_UPDATE,
this);
}
private void calcShouldPay() {
mStockTableController.calcStockShouldPay(mStockCalcController);
}
private static class StockOutUpdateHandler extends Handler {
WeakReference<Fragment> mFragment;
StockOutUpdateHandler(Fragment fragment){
mFragment = new WeakReference<>(fragment);
}
@Override
public void handleMessage(Message msg) {
if (msg.what == StockUtils.STOCK_TOTAL_CHANGED){
Log.d(LOG_TAG, "receive message->" + msg.toString());
DiabloStockRowController controller = (DiabloStockRowController) msg.obj;
EntryStock stock = controller.getModel();
DiabloRowView row = controller.getView();
stock.setTotal(msg.arg1);
row.setCellText(R.string.calculate, stock.calcStockPrice());
if (DiabloEnum.DIABLO_FREE.equals(stock.getFree())){
if (0 != stock.getAmounts().size()) {
for (EntryStockAmount amount: stock.getAmounts()) {
amount.setCount(msg.arg1);
}
} else {
EntryStockAmount amount = new EntryStockAmount(
DiabloEnum.DIABLO_FREE_COLOR,
DiabloEnum.DIABLO_FREE_SIZE);
amount.setCount(msg.arg1);
stock.clearAmounts();
stock.addAmount(amount);
}
}
final StockOutUpdate f = ((StockOutUpdate)mFragment.get());
if (StockUtils.STARTING_STOCK.equals(stock.getState())) {
if (0 != stock.getTotal()) {
stock.setState(StockUtils.FINISHED_STOCK);
Integer orderId = f.mStockTableController.getCurrentRows();
controller.setOrderId(orderId);
row.setOnLongClickListener(f);
// if (1 == f.mStockTableController.size()){
// f.mButtons.get(R.id.stock_in_update_save).enable();
// }
f.mStockTableController.addRowControllerAtTop(f.addEmptyRow());
}
}
// recalculate
f.calcShouldPay();
}
}
}
private void getStockOutFromServer() {
StockUtils.getStockNewInfoFormServer(getContext(), mRSN, new StockUtils.OnGetStockNewFormSeverListener() {
@Override
public void afterGet(GetStockNewResponse response) {
mRSNId = response.getStockCalc().getId();
recoverFromResponse(response.getStockCalc(), response.getStockNotes());
}
});
}
@Override
public void onHiddenChanged(boolean hidden) {
super.onHiddenChanged(hidden);
if (!hidden){
initTitle();
if (mBackFrom.equals(R.string.back_from_good_select)){
EntryStock s = mOnNoFreeGoodSelectListener.afterSelectGood();
switch (mOnNoFreeGoodSelectListener.getCurrentOperation()){
case R.string.action_save:
mStockTableController.replaceRowController(s);
break;
case R.string.action_cancel:
if (s.getOrderId().equals(0)){
mStockTableController.removeRowAtTop();
mStockTableController.addRowControllerAtTop(addEmptyRow());
}
break;
default:
break;
}
}
else {
if (!mLastRSN.equals(mRSN)) {
init();
} else {
focusStyleNumber();
}
}
mBackFrom = R.string.back_from_unknown;
}
}
private void focusStyleNumber() {
if (0 != mStockTableController.size()) {
mStockTableController.getControllers().get(0).focusStyleNumber();
}
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
mCurrentSelectedRow = (TableRow) v;
MenuInflater inflater = getActivity().getMenuInflater();
inflater.inflate(R.menu.context_on_stock, menu);
}
@Override
public boolean onContextItemSelected(MenuItem item) {
EntryStock stock = (EntryStock)mCurrentSelectedRow.getTag();
Integer orderId = stock.getOrderId();
// DiabloSaleRowController controller = mSaleTableController.getControllerByOrderId(orderId);
if (getResources().getString(R.string.delete) == item.getTitle()){
// delete
mStockTableController.removeByOrderId(orderId);
// reorder
mStockTableController.reorder();
// if (1 == mStockTableController.size()){
// mButtons.get(R.id.stock_in_update_save).disable();
// }
calcShouldPay();
}
else if (getResources().getString(R.string.modify) == item.getTitle()){
if (!DiabloEnum.DIABLO_FREE.equals(stock.getFree())){
switchToStockSelectFrame(stock, R.string.modify);
}
}
return true;
}
/**
* option menu
*/
@Override
public void onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
for (Integer i=0; i<mButtons.size(); i++){
Integer key = mButtons.keyAt(i);
DiabloButton button = mButtons.get(key);
menu.findItem(button.getResId()).setEnabled(button.isEnabled());
}
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
// menu.clear();
inflater.inflate(R.menu.action_on_stock_out_update, menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()){
case R.id.stock_out_update_back:
SaleUtils.switchToSlideMenu(this, DiabloEnum.TAG_STOCK_DETAIL);
break;
case R.id.stock_out_update_save:
mButtons.get(R.id.stock_out_update_save).disable();
if (DiabloEnum.INVALID_INDEX.equals(mStockCalcController.getFirm())) {
UTILS.makeToast(
getContext(),
getContext().getString(R.string.firm_should_comes_from_auto_complete_list),
Toast.LENGTH_SHORT);
mButtons.get(R.id.sale_in_save).enable();
} else {
startUpdate();
}
break;
default:
// return super.onOptionsItemSelected(item);
break;
}
return true;
}
public List<EntryStockAmount> getUpdateEntryStockAmounts (List<EntryStockAmount> newAmounts,
List<EntryStockAmount> oldAmounts) {
List<EntryStockAmount> entryStockAmounts = new ArrayList<>();
for (EntryStockAmount n: newAmounts) {
EntryStockAmount found = StockUtils.getEntryStockAmounts(oldAmounts, n.getColorId(), n.getSize());
// new
if (null == found) {
EntryStockAmount add = new EntryStockAmount(n, DiabloEnum.ADD_THE_STOCK);
entryStockAmounts.add(add);
}
else {
// update
EntryStockAmount update = new EntryStockAmount(n, DiabloEnum.UPDATE_THE_STOCK);
update.setCount(n.getCount() - found.getCount());
if (0 != update.getCount()) {
entryStockAmounts.add(update);
}
}
}
// delete
for (EntryStockAmount old: oldAmounts) {
EntryStockAmount found = StockUtils.getEntryStockAmounts(newAmounts, old.getColorId(), old.getSize());
if (null == found) {
EntryStockAmount delete = new EntryStockAmount(old, DiabloEnum.DELETE_THE_STOCK);
entryStockAmounts.add(delete);
}
}
return entryStockAmounts;
}
public List<EntryStock> getUpdateEntryStocks() {
List<DiabloStockRowController> controllers = mStockTableController.getControllers();
List<EntryStock> updateEntryStocks = new ArrayList<>();
List<EntryStock> newEntryStocks = new ArrayList<>();
for (DiabloStockRowController controller: controllers) {
if (0 != controller.getOrderId()) {
newEntryStocks.add(controller.getModel());
}
}
for (EntryStock stock: newEntryStocks) {
EntryStock found = StockUtils.getEntryStock(mOldEntryStocks, stock.getStyleNumber(), stock.getBrandId());
// new
if (null == found) {
EntryStock add = new EntryStock(stock);
add.setOperation(DiabloEnum.ADD_THE_STOCK);
updateEntryStocks.add(add);
}
else {
// get updated
List<EntryStockAmount> updateEntryStockAmounts = getUpdateEntryStockAmounts(
stock.getAmounts(), found.getAmounts());
if (0 != updateEntryStockAmounts.size()) {
EntryStock update = new EntryStock(stock);
update.setOperation(DiabloEnum.UPDATE_THE_STOCK);
update.setAmounts(updateEntryStockAmounts);
updateEntryStocks.add(update);
}
else {
if (!stock.getDiscount().equals(found.getDiscount())
|| !stock.getOrgPrice().equals(found.getOrgPrice())) {
EntryStock update = new EntryStock(stock);
// only change price, discount, so the amount should be clear
update.clearAmounts();
update.setOperation(DiabloEnum.UPDATE_THE_STOCK);
updateEntryStocks.add(update);
}
}
}
}
// get delete
for (EntryStock oldStock: mOldEntryStocks) {
EntryStock found = StockUtils.getEntryStock(newEntryStocks, oldStock.getStyleNumber(), oldStock.getBrandId());
if (null == found) {
EntryStock delete = new EntryStock(oldStock);
delete.setOperation(DiabloEnum.DELETE_THE_STOCK);
updateEntryStocks.add(delete);
}
}
return updateEntryStocks;
}
private void startUpdate() {
List<EntryStock> updateStocks = getUpdateEntryStocks();
NewStockRequest stockRequest = new NewStockRequest();
for (EntryStock u: updateStocks) {
NewStockRequest.DiabloEntryStock d = new NewStockRequest.DiabloEntryStock();
d.setStyleNumber(u.getStyleNumber());
d.setBrandId(u.getBrandId());
d.setTypeId(u.getTypeId());
d.setSex(u.getSex());
d.setSeason(u.getSeason());
d.setOperation(u.getOperation());
d.setsGroup(u.getsGroup());
d.setFree(u.getFree());
d.setOrgPrice(u.getOrgPrice());
d.setTagPrice(u.getTagPrice());
d.setPkgPrice(u.getPkgPrice());
d.setPrice3(u.getPrice3());
d.setPrice4(u.getPrice4());
d.setPrice5(u.getPrice5());
d.setDiscount(u.getDiscount());
d.setTotal(-u.getTotal());
List<NewStockRequest.DiabloEntryStockAmount> uAmounts = new ArrayList<>();
for (EntryStockAmount a: u.getAmounts()) {
if ( a.getCount() != 0 ){
NewStockRequest.DiabloEntryStockAmount stockAmount = new NewStockRequest.DiabloEntryStockAmount();
stockAmount.setColorId(a.getColorId());
stockAmount.setSize(a.getSize());
stockAmount.setCount(-a.getCount());
stockAmount.setOperation(a.getOperation());
uAmounts.add(stockAmount);
}
}
d.setChangedAmounts(uAmounts);
if (DiabloEnum.DELETE_THE_STOCK.equals(u.getOperation())
|| DiabloEnum.ADD_THE_STOCK.equals(u.getOperation())) {
uAmounts.clear();
for (EntryStockAmount a: u.getAmounts()) {
if ( a.getCount() != 0 ){
NewStockRequest.DiabloEntryStockAmount saleAmount = new NewStockRequest.DiabloEntryStockAmount();
saleAmount.setColorId(a.getColorId());
saleAmount.setSize(a.getSize());
saleAmount.setCount(-a.getCount());
saleAmount.setOperation(a.getOperation());
uAmounts.add(saleAmount);
}
}
d.setEntryStockAmounts(uAmounts);
}
stockRequest.addEntryStock(d);
}
NewStockRequest.DiabloStockCalc dCalc = new NewStockRequest.DiabloStockCalc();
StockCalc calc = mStockCalcController.getStockCalc();
dCalc.setRsnId(mRSNId);
dCalc.setRsn(mRSN);
dCalc.setFirmId(calc.getFirm());
dCalc.setShopId(calc.getShop());
dCalc.setDatetime(calc.getDatetime());
dCalc.setEmployeeId(calc.getEmployee());
dCalc.setComment(calc.getComment());
dCalc.setTotal(-calc.getTotal());
dCalc.setBalance(calc.getBalance());
dCalc.setVerificate(calc.getVerificate());
dCalc.setExtraCost(calc.getExtraCost());
dCalc.setShouldPay(-calc.getShouldPay());
dCalc.setOldFirm(mOldStockCalc.getFirm());
dCalc.setOldBalance(mOldStockCalc.getBalance());
dCalc.setOldVerificate(mOldStockCalc.getVerificate());
dCalc.setOldShouldPay(-mOldStockCalc.getShouldPay());
dCalc.setOldDatetime(mOldStockCalc.getDatetime());
stockRequest.setStockCalc(dCalc);
if (0 == updateStocks.size()
&& dCalc.getFirmId().equals(mOldStockCalc.getFirm())
&& dCalc.getDatetime().equals(mOldStockCalc.getDatetime())
&& dCalc.getVerificate().equals(mOldStockCalc.getVerificate())
&& dCalc.getComment().equals(mOldStockCalc.getComment())) {
new DiabloAlertDialog(
getContext(),
getResources().getString(R.string.sale_out_update),
DiabloError.getError(2699)).create();
} else {
startRequest(stockRequest);
}
}
private void startRequest(NewStockRequest request) {
final StockInterface face = StockClient.getClient().create(StockInterface.class);
Call<NewStockResponse> call = face.updateStock(Profile.instance().getToken(), request);
call.enqueue(new Callback<NewStockResponse>() {
@Override
public void onResponse(Call<NewStockResponse> call, retrofit2.Response<NewStockResponse> response) {
mButtons.get(R.id.stock_out_update_save).enable();
final NewStockResponse res = response.body();
if (DiabloEnum.HTTP_OK == response.code() && res.getCode().equals(DiabloEnum.SUCCESS)) {
// reset firm balance
Firm firm = Profile.instance().getFirm(mStockCalcController.getFirm());
Firm oldFirm = Profile.instance().getFirm(mOldStockCalc.getFirm());
firm.setBalance(mStockCalcController.getStockCalc().calcAccBalance());
if ( !firm.getId().equals(oldFirm.getId()) ) {
oldFirm.setBalance(
oldFirm.getBalance()
+ mOldStockCalc.getShouldPay()
+ mOldStockCalc.getExtraCost()
- mOldStockCalc.getVerificate()
);
}
new DiabloAlertDialog(
getContext(),
false,
getResources().getString(R.string.stock_out_update),
getContext().getString(R.string.stock_out_update_success) + res.getRsn(),
new DiabloAlertDialog.OnOkClickListener() {
@Override
public void onOk() {
mLastRSN = DiabloEnum.DIABLO_INVALID_RSN;
init();
SaleUtils.switchToSlideMenu(StockOutUpdate.this, DiabloEnum.TAG_STOCK_DETAIL);
}
}).create();
} else {
mButtons.get(R.id.stock_out_update_save).enable();
Integer errorCode = response.code() == 0 ? res.getCode() : response.code();
String extraMessage = res == null ? "" : res.getError();
new DiabloAlertDialog(
getContext(),
getResources().getString(R.string.stock_in_update),
DiabloError.getError(errorCode) + extraMessage).create();
}
}
@Override
public void onFailure(Call<NewStockResponse> call, Throwable t) {
mButtons.get(R.id.stock_out_update_save).enable();
new DiabloAlertDialog(
getContext(),
getResources().getString(R.string.stock_in_update),
DiabloError.getError(99)).create();
}
});
}
}
|
UTF-8
|
Java
| 35,674 |
java
|
StockOutUpdate.java
|
Java
|
[] | null |
[] |
package com.diablo.dt.diablo.fragment.stock;
import static com.diablo.dt.diablo.R.string.amount;
import android.graphics.Typeface;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.util.SparseArray;
import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import android.widget.Toast;
import com.diablo.dt.diablo.R;
import com.diablo.dt.diablo.client.StockClient;
import com.diablo.dt.diablo.controller.DiabloStockCalcController;
import com.diablo.dt.diablo.controller.DiabloStockRowController;
import com.diablo.dt.diablo.controller.DiabloStockTableController;
import com.diablo.dt.diablo.entity.DiabloButton;
import com.diablo.dt.diablo.entity.Firm;
import com.diablo.dt.diablo.entity.MatchStock;
import com.diablo.dt.diablo.entity.Profile;
import com.diablo.dt.diablo.model.sale.SaleUtils;
import com.diablo.dt.diablo.model.stock.EntryStock;
import com.diablo.dt.diablo.model.stock.EntryStockAmount;
import com.diablo.dt.diablo.model.stock.StockCalc;
import com.diablo.dt.diablo.model.stock.StockUtils;
import com.diablo.dt.diablo.request.stock.NewStockRequest;
import com.diablo.dt.diablo.response.stock.GetStockNewResponse;
import com.diablo.dt.diablo.response.stock.NewStockResponse;
import com.diablo.dt.diablo.response.stock.StockDetailResponse;
import com.diablo.dt.diablo.rest.StockInterface;
import com.diablo.dt.diablo.utils.DiabloAlertDialog;
import com.diablo.dt.diablo.utils.DiabloEnum;
import com.diablo.dt.diablo.utils.DiabloError;
import com.diablo.dt.diablo.utils.DiabloUtils;
import com.diablo.dt.diablo.view.DiabloCellLabel;
import com.diablo.dt.diablo.view.DiabloCellView;
import com.diablo.dt.diablo.view.DiabloRowView;
import com.diablo.dt.diablo.view.stock.DiabloStockCalcView;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
import retrofit2.Call;
import retrofit2.Callback;
public class StockOutUpdate extends Fragment {
private final static DiabloUtils UTILS = DiabloUtils.instance();
private final static String LOG_TAG = "StockOutUpdate:";
private DiabloCellLabel[] mLabels;
private String [] mSeasons;
private SparseArray<DiabloButton> mButtons;
private DiabloStockCalcView mStockCalcView;
private DiabloStockCalcController mStockCalcController;
private DiabloStockTableController mStockTableController;
private StockCalc mOldStockCalc;
private List<EntryStock> mOldEntryStocks;
private TableRow mCurrentSelectedRow;
private View mFragment;
private StockOutUpdateHandler mHandler = new StockOutUpdateHandler(this);
private GoodSelect.OnNoFreeGoodSelectListener mOnNoFreeGoodSelectListener;
private Integer mBackFrom = R.string.back_from_unknown;
private String mRSN;
private String mLastRSN;
private Integer mRSNId;
public void setNoFreeGoodSelectListener(GoodSelect.OnNoFreeGoodSelectListener listener){
mOnNoFreeGoodSelectListener = listener;
}
public void setBackFrom(Integer form){
mBackFrom = form;
}
public StockOutUpdate() {
// Required empty public constructor
}
public static StockOutUpdate newInstance(String param1, String param2) {
StockOutUpdate fragment = new StockOutUpdate();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
private void initTitle() {
String title = getResources().getString(R.string.stock_out_update);
ActionBar bar = ((AppCompatActivity)getActivity()).getSupportActionBar();
if (null != bar) {
bar.setTitle(title);
}
}
private void initLabel() {
mButtons = new SparseArray<>();
mButtons.put(R.id.stock_out_update_save, new DiabloButton(getContext(), R.id.stock_out_update_save));
mSeasons = getResources().getStringArray(R.array.seasons);
mLabels = StockUtils.createStockLabelsFromTitle(getContext());
}
private void initCalcView(View view) {
mStockCalcView = new DiabloStockCalcView();
mStockCalcView.setViewFirm(view.findViewById(R.id.stock_select_firm));
mStockCalcView.setViewShop(view.findViewById(R.id.stock_select_shop));
mStockCalcView.setViewDatetime(view.findViewById(R.id.stock_selected_date));
mStockCalcView.setViewEmployee(view.findViewById(R.id.stock_select_employee));
mStockCalcView.setViewStockTotal(view.findViewById(R.id.stock_total));
mStockCalcView.setViewShouldPay(view.findViewById(R.id.stock_should_pay));
// mStockCalcView.setViewCash(view.findViewById(R.id.stock_cash));
mStockCalcView.setViewComment(view.findViewById(R.id.stock_comment));
mStockCalcView.setViewBalance(view.findViewById(R.id.firm_balance));
// mStockCalcView.setViewHasPay(view.findViewById(R.id.stock_has_pay));
// mStockCalcView.setViewCard(view.findViewById(R.id.stock_card));
mStockCalcView.setViewExtraCostType(view.findViewById(R.id.stock_select_extra_cost));
mStockCalcView.setViewAccBalance(view.findViewById(R.id.firm_accBalance));
mStockCalcView.setViewVerificate(view.findViewById(R.id.stock_verificate));
// mStockCalcView.setViewWire(view.findViewById(R.id.stock_wire));
mStockCalcView.setViewExtraCost(view.findViewById(R.id.stock_extra_cost));
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mRSN = getArguments().getString(DiabloEnum.BUNDLE_PARAM_RSN);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
initTitle();
// Inflate the layout for this fragment
mFragment = inflater.inflate(R.layout.fragment_stock_out_update, container, false);
setHasOptionsMenu(true);
getActivity().supportInvalidateOptionsMenu();
initLabel();
((TableLayout)mFragment.findViewById(R.id.t_stock_head)).addView(addHead());
init();
return mFragment;
}
public void setRSN(String rsn) {
this.mRSN = rsn;
}
private TableRow addHead(){
TableRow row = new TableRow(getContext());
for (DiabloCellLabel label: mLabels) {
TextView cell = new TextView(getContext());
cell.setLayoutParams(label.getTableRowLayoutParams());
cell.setTypeface(null, Typeface.BOLD);
cell.setTextColor(ContextCompat.getColor(getContext(), R.color.black));
cell.setTextSize(label.getSize());
cell.setText(label.getLabel());
row.addView(cell);
}
return row;
}
private void init() {
mLastRSN = mRSN;
if (null != mStockTableController) {
mStockTableController.clear();
}
mStockTableController = new DiabloStockTableController((TableLayout) mFragment.findViewById(R.id.t_stock));
initCalcView(mFragment);
getStockOutFromServer();
}
private void recoverFromResponse(StockDetailResponse.StockDetail detail,
List<GetStockNewResponse.StockNote> notes) {
mOldStockCalc = new StockCalc(detail.getType());
mOldStockCalc.setFirm(detail.getFirm());
mOldStockCalc.setShop(detail.getShop());
mOldStockCalc.setDatetime(detail.getEntryDate());
mOldStockCalc.setEmployee(detail.getEmployee());
mOldStockCalc.setComment(detail.getComment());
mOldStockCalc.setBalance(detail.getBalance());
mOldStockCalc.setVerificate(detail.getVerificate());
mOldStockCalc.setShouldPay(Math.abs(detail.getShouldPay()));
mOldStockCalc.setExtraCostType(detail.getEPayType());
mOldStockCalc.setExtraCost(detail.getEPay());
// mOldStockCalc.calcHasPay();
mOldStockCalc.calcAccBalance();
mOldEntryStocks = new ArrayList<>();
Integer orderId = 0;
for (GetStockNewResponse.StockNote n: notes) {
String styleNumber = n.getStyleNumber();
Integer brandId = n.getBrandId();
EntryStock stock = StockUtils.getEntryStock(mOldEntryStocks, styleNumber, brandId);
if (null == stock) {
MatchStock matchStock = Profile.instance().getMatchStock(styleNumber, brandId);
EntryStock s = new EntryStock();
s.init(matchStock);
orderId++;
s.setOrderId(orderId);
s.setState(StockUtils.FINISHED_STOCK);
s.setDiscount(n.getDiscount());
EntryStockAmount amount = new EntryStockAmount(n.getColorId(), n.getSize());
amount.setCount(Math.abs(n.getAmount()));
s.addAmount(amount);
s.setTotal(Math.abs(n.getAmount()));
mOldEntryStocks.add(s);
} else {
EntryStockAmount amount = new EntryStockAmount(n.getColorId(), n.getSize());
amount.setCount(Math.abs(n.getAmount()));
stock.setTotal(stock.getTotal() + Math.abs(n.getAmount()));
stock.addAmount(amount);
}
}
buildContent(new StockCalc(mOldStockCalc), mOldEntryStocks);
}
private void buildContent(final StockCalc calc, final List<EntryStock> stocks) {
mStockCalcController = new DiabloStockCalcController(calc, mStockCalcView);
mStockCalcController.setShop(calc.getShop());
mStockCalcController.setDatetime(calc.getDatetime());
// listener when select firm
Firm firm = Profile.instance().getFirm(calc.getFirm());
mStockCalcController.setFirm(firm);
mStockCalcController.setBalance(mOldStockCalc.getBalance());
mStockCalcController.setFirmWatcher();
mStockCalcController.setFirmClickListener(getContext());
mStockCalcController.setOnFirmChangedListener(mFirmChangedListener);
// mStockCalcView.setCashValue(calc.getCash());
// mStockCalcView.setCardValue(calc.getCard());
// mStockCalcView.setWireValue(calc.getWire());
mStockCalcView.setVerificateValue(calc.getVerificate());
mStockCalcView.setExtraCostValue(calc.getExtraCost());
mStockCalcController.setStockCalcView(mStockCalcView);
mStockCalcController.setEmployeeClickListener();
mStockCalcController.setCommentWatcher();
// mStockCalcController.setCashWatcher();
// mStockCalcController.setCardWatcher();
// mStockCalcController.setWireWatcher();
mStockCalcController.setVerificateWatcher();
mStockCalcController.setExtraCostWatcher();
mStockCalcController.setExtraCostTypeListener();
// adapter
mStockCalcController.setEmployeeAdapter(getContext());
mStockCalcController.setExtraCostTypeAdapter(getContext());
for (EntryStock s: stocks) {
DiabloStockRowController controller = createRowWithStock(s);
mStockTableController.addRowControllerAtTop(controller);
}
mStockTableController.addRowControllerAtTop(addEmptyRow());
calcShouldPay();
}
private DiabloStockRowController createRowWithStock(EntryStock stock) {
TableRow row = new TableRow(getContext());
DiabloStockRowController controller = new DiabloStockRowController(
new DiabloRowView(row), new EntryStock(stock));
for (DiabloCellLabel label: mLabels) {
DiabloCellView cell = new DiabloCellView(label.createCell(getContext()), label);
controller.addCell(cell);
if (R.string.order_id == cell.getCellId()) {
controller.setCellText(cell.getCellId(), UTILS.toString(stock.getOrderId()));
}
else if (R.string.good == cell.getCellId()){
controller.setCellText(cell.getCellId(), stock.getName());
}
else if (R.string.year == cell.getCellId()) {
controller.setCellText(cell.getCellId(), UTILS.toString(stock.getYear()));
}
else if (R.string.season == cell.getCellId()) {
controller.setCellText(cell.getCellId(), mSeasons[stock.getSeason()]);
}
else if (R.string.org_price == cell.getCellId()) {
controller.setCellText(cell.getCellId(), UTILS.toString(stock.getOrgPrice()));
}
else if (R.string.amount == cell.getCellId()) {
controller.setCellText(cell.getCellId(), UTILS.toString(stock.getTotal()));
if (DiabloEnum.DIABLO_FREE.equals(stock.getFree())) {
controller.getView().getCell(amount).setCellFocusable(true);
}
}
else if (R.string.calculate == cell.getCellId()) {
controller.setCellText(cell.getCellId(), UTILS.toString(stock.calcStockPrice()));
}
}
controller.getView().setOnLongClickListener(this);
controller.setAmountWatcher(mHandler, controller);
controller.addListenerOfAmountChange();
return controller;
}
private DiabloStockRowController addEmptyRow() {
TableRow row = new TableRow(getContext());
DiabloStockRowController controller = new DiabloStockRowController(
new DiabloRowView(row),
new EntryStock());
for (DiabloCellLabel label: mLabels) {
DiabloCellView cell = new DiabloCellView(label.createCell(getContext()), label);
controller.addCell(cell);
}
controller.setAmountWatcher(mHandler, controller);
controller.setAutoCompleteStockListener(
getContext(),
mStockCalcController.getFirm(),
mLabels,
mOnActionAfterSelectGood);
return controller;
}
/**
* should change the adapter when the firm changed by the user
*/
private DiabloStockCalcController.OnDiabloFirmChangedListener mFirmChangedListener =
new DiabloStockCalcController.OnDiabloFirmChangedListener() {
@Override
public void onFirmChanged(Firm selectFirm) {
if (0 != mStockTableController.getControllers().size()) {
mStockTableController.getControllers().get(0).setAutoCompleteStockAdapter(
getContext(), selectFirm.getId());
if (selectFirm.getId().equals(mOldStockCalc.getFirm())) {
mStockCalcController.setBalance(mOldStockCalc.getBalance());
} else {
mStockCalcController.setBalance(selectFirm.getBalance());
}
// change focus to input good
mStockTableController.getControllers().get(0).focusStyleNumber();
}
}
};
private DiabloStockRowController.OnActionAfterSelectGood mOnActionAfterSelectGood =
new DiabloStockRowController.OnActionAfterSelectGood(){
@Override
public void onActionOfAmount(DiabloStockRowController controller, DiabloCellView cell) {
if (!mStockTableController.checkSameFirm(mStockCalcController.getFirm())) {
controller.setCellText(R.string.good, DiabloEnum.EMPTY_STRING);
UTILS.makeToast(
getContext(),
getResources().getString(R.string.different_good),
Toast.LENGTH_SHORT);
}
else {
Integer orderId = mStockTableController.contains(controller);
if (!DiabloEnum.INVALID_INDEX.equals(orderId)) {
controller.setCellText(R.string.good, DiabloEnum.EMPTY_STRING);
UTILS.makeToast(
getContext(),
getContext().getResources().getString(R.string.sale_stock_exist)
+ UTILS.toString(orderId),
Toast.LENGTH_SHORT);
} else {
EntryStock stock = controller.getModel();
DiabloRowView row = controller.getView();
if ( DiabloEnum.DIABLO_FREE.equals(stock.getFree()) ){
cell.setCellFocusable(true);
cell.requestFocus();
row.getCell(R.string.good).setCellFocusable(false);
} else {
switchToStockSelectFrame(controller.getModel(), R.string.add);
}
}
}
}
};
private void switchToStockSelectFrame(EntryStock stock, Integer operation) {
StockUtils.switchToStockSelectFrame(
mStockCalcController.getShop(),
stock,
operation,
DiabloEnum.STOCK_OUT_UPDATE,
this);
}
private void calcShouldPay() {
mStockTableController.calcStockShouldPay(mStockCalcController);
}
private static class StockOutUpdateHandler extends Handler {
WeakReference<Fragment> mFragment;
StockOutUpdateHandler(Fragment fragment){
mFragment = new WeakReference<>(fragment);
}
@Override
public void handleMessage(Message msg) {
if (msg.what == StockUtils.STOCK_TOTAL_CHANGED){
Log.d(LOG_TAG, "receive message->" + msg.toString());
DiabloStockRowController controller = (DiabloStockRowController) msg.obj;
EntryStock stock = controller.getModel();
DiabloRowView row = controller.getView();
stock.setTotal(msg.arg1);
row.setCellText(R.string.calculate, stock.calcStockPrice());
if (DiabloEnum.DIABLO_FREE.equals(stock.getFree())){
if (0 != stock.getAmounts().size()) {
for (EntryStockAmount amount: stock.getAmounts()) {
amount.setCount(msg.arg1);
}
} else {
EntryStockAmount amount = new EntryStockAmount(
DiabloEnum.DIABLO_FREE_COLOR,
DiabloEnum.DIABLO_FREE_SIZE);
amount.setCount(msg.arg1);
stock.clearAmounts();
stock.addAmount(amount);
}
}
final StockOutUpdate f = ((StockOutUpdate)mFragment.get());
if (StockUtils.STARTING_STOCK.equals(stock.getState())) {
if (0 != stock.getTotal()) {
stock.setState(StockUtils.FINISHED_STOCK);
Integer orderId = f.mStockTableController.getCurrentRows();
controller.setOrderId(orderId);
row.setOnLongClickListener(f);
// if (1 == f.mStockTableController.size()){
// f.mButtons.get(R.id.stock_in_update_save).enable();
// }
f.mStockTableController.addRowControllerAtTop(f.addEmptyRow());
}
}
// recalculate
f.calcShouldPay();
}
}
}
private void getStockOutFromServer() {
StockUtils.getStockNewInfoFormServer(getContext(), mRSN, new StockUtils.OnGetStockNewFormSeverListener() {
@Override
public void afterGet(GetStockNewResponse response) {
mRSNId = response.getStockCalc().getId();
recoverFromResponse(response.getStockCalc(), response.getStockNotes());
}
});
}
@Override
public void onHiddenChanged(boolean hidden) {
super.onHiddenChanged(hidden);
if (!hidden){
initTitle();
if (mBackFrom.equals(R.string.back_from_good_select)){
EntryStock s = mOnNoFreeGoodSelectListener.afterSelectGood();
switch (mOnNoFreeGoodSelectListener.getCurrentOperation()){
case R.string.action_save:
mStockTableController.replaceRowController(s);
break;
case R.string.action_cancel:
if (s.getOrderId().equals(0)){
mStockTableController.removeRowAtTop();
mStockTableController.addRowControllerAtTop(addEmptyRow());
}
break;
default:
break;
}
}
else {
if (!mLastRSN.equals(mRSN)) {
init();
} else {
focusStyleNumber();
}
}
mBackFrom = R.string.back_from_unknown;
}
}
private void focusStyleNumber() {
if (0 != mStockTableController.size()) {
mStockTableController.getControllers().get(0).focusStyleNumber();
}
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
mCurrentSelectedRow = (TableRow) v;
MenuInflater inflater = getActivity().getMenuInflater();
inflater.inflate(R.menu.context_on_stock, menu);
}
@Override
public boolean onContextItemSelected(MenuItem item) {
EntryStock stock = (EntryStock)mCurrentSelectedRow.getTag();
Integer orderId = stock.getOrderId();
// DiabloSaleRowController controller = mSaleTableController.getControllerByOrderId(orderId);
if (getResources().getString(R.string.delete) == item.getTitle()){
// delete
mStockTableController.removeByOrderId(orderId);
// reorder
mStockTableController.reorder();
// if (1 == mStockTableController.size()){
// mButtons.get(R.id.stock_in_update_save).disable();
// }
calcShouldPay();
}
else if (getResources().getString(R.string.modify) == item.getTitle()){
if (!DiabloEnum.DIABLO_FREE.equals(stock.getFree())){
switchToStockSelectFrame(stock, R.string.modify);
}
}
return true;
}
/**
* option menu
*/
@Override
public void onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
for (Integer i=0; i<mButtons.size(); i++){
Integer key = mButtons.keyAt(i);
DiabloButton button = mButtons.get(key);
menu.findItem(button.getResId()).setEnabled(button.isEnabled());
}
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
// menu.clear();
inflater.inflate(R.menu.action_on_stock_out_update, menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()){
case R.id.stock_out_update_back:
SaleUtils.switchToSlideMenu(this, DiabloEnum.TAG_STOCK_DETAIL);
break;
case R.id.stock_out_update_save:
mButtons.get(R.id.stock_out_update_save).disable();
if (DiabloEnum.INVALID_INDEX.equals(mStockCalcController.getFirm())) {
UTILS.makeToast(
getContext(),
getContext().getString(R.string.firm_should_comes_from_auto_complete_list),
Toast.LENGTH_SHORT);
mButtons.get(R.id.sale_in_save).enable();
} else {
startUpdate();
}
break;
default:
// return super.onOptionsItemSelected(item);
break;
}
return true;
}
public List<EntryStockAmount> getUpdateEntryStockAmounts (List<EntryStockAmount> newAmounts,
List<EntryStockAmount> oldAmounts) {
List<EntryStockAmount> entryStockAmounts = new ArrayList<>();
for (EntryStockAmount n: newAmounts) {
EntryStockAmount found = StockUtils.getEntryStockAmounts(oldAmounts, n.getColorId(), n.getSize());
// new
if (null == found) {
EntryStockAmount add = new EntryStockAmount(n, DiabloEnum.ADD_THE_STOCK);
entryStockAmounts.add(add);
}
else {
// update
EntryStockAmount update = new EntryStockAmount(n, DiabloEnum.UPDATE_THE_STOCK);
update.setCount(n.getCount() - found.getCount());
if (0 != update.getCount()) {
entryStockAmounts.add(update);
}
}
}
// delete
for (EntryStockAmount old: oldAmounts) {
EntryStockAmount found = StockUtils.getEntryStockAmounts(newAmounts, old.getColorId(), old.getSize());
if (null == found) {
EntryStockAmount delete = new EntryStockAmount(old, DiabloEnum.DELETE_THE_STOCK);
entryStockAmounts.add(delete);
}
}
return entryStockAmounts;
}
public List<EntryStock> getUpdateEntryStocks() {
List<DiabloStockRowController> controllers = mStockTableController.getControllers();
List<EntryStock> updateEntryStocks = new ArrayList<>();
List<EntryStock> newEntryStocks = new ArrayList<>();
for (DiabloStockRowController controller: controllers) {
if (0 != controller.getOrderId()) {
newEntryStocks.add(controller.getModel());
}
}
for (EntryStock stock: newEntryStocks) {
EntryStock found = StockUtils.getEntryStock(mOldEntryStocks, stock.getStyleNumber(), stock.getBrandId());
// new
if (null == found) {
EntryStock add = new EntryStock(stock);
add.setOperation(DiabloEnum.ADD_THE_STOCK);
updateEntryStocks.add(add);
}
else {
// get updated
List<EntryStockAmount> updateEntryStockAmounts = getUpdateEntryStockAmounts(
stock.getAmounts(), found.getAmounts());
if (0 != updateEntryStockAmounts.size()) {
EntryStock update = new EntryStock(stock);
update.setOperation(DiabloEnum.UPDATE_THE_STOCK);
update.setAmounts(updateEntryStockAmounts);
updateEntryStocks.add(update);
}
else {
if (!stock.getDiscount().equals(found.getDiscount())
|| !stock.getOrgPrice().equals(found.getOrgPrice())) {
EntryStock update = new EntryStock(stock);
// only change price, discount, so the amount should be clear
update.clearAmounts();
update.setOperation(DiabloEnum.UPDATE_THE_STOCK);
updateEntryStocks.add(update);
}
}
}
}
// get delete
for (EntryStock oldStock: mOldEntryStocks) {
EntryStock found = StockUtils.getEntryStock(newEntryStocks, oldStock.getStyleNumber(), oldStock.getBrandId());
if (null == found) {
EntryStock delete = new EntryStock(oldStock);
delete.setOperation(DiabloEnum.DELETE_THE_STOCK);
updateEntryStocks.add(delete);
}
}
return updateEntryStocks;
}
private void startUpdate() {
List<EntryStock> updateStocks = getUpdateEntryStocks();
NewStockRequest stockRequest = new NewStockRequest();
for (EntryStock u: updateStocks) {
NewStockRequest.DiabloEntryStock d = new NewStockRequest.DiabloEntryStock();
d.setStyleNumber(u.getStyleNumber());
d.setBrandId(u.getBrandId());
d.setTypeId(u.getTypeId());
d.setSex(u.getSex());
d.setSeason(u.getSeason());
d.setOperation(u.getOperation());
d.setsGroup(u.getsGroup());
d.setFree(u.getFree());
d.setOrgPrice(u.getOrgPrice());
d.setTagPrice(u.getTagPrice());
d.setPkgPrice(u.getPkgPrice());
d.setPrice3(u.getPrice3());
d.setPrice4(u.getPrice4());
d.setPrice5(u.getPrice5());
d.setDiscount(u.getDiscount());
d.setTotal(-u.getTotal());
List<NewStockRequest.DiabloEntryStockAmount> uAmounts = new ArrayList<>();
for (EntryStockAmount a: u.getAmounts()) {
if ( a.getCount() != 0 ){
NewStockRequest.DiabloEntryStockAmount stockAmount = new NewStockRequest.DiabloEntryStockAmount();
stockAmount.setColorId(a.getColorId());
stockAmount.setSize(a.getSize());
stockAmount.setCount(-a.getCount());
stockAmount.setOperation(a.getOperation());
uAmounts.add(stockAmount);
}
}
d.setChangedAmounts(uAmounts);
if (DiabloEnum.DELETE_THE_STOCK.equals(u.getOperation())
|| DiabloEnum.ADD_THE_STOCK.equals(u.getOperation())) {
uAmounts.clear();
for (EntryStockAmount a: u.getAmounts()) {
if ( a.getCount() != 0 ){
NewStockRequest.DiabloEntryStockAmount saleAmount = new NewStockRequest.DiabloEntryStockAmount();
saleAmount.setColorId(a.getColorId());
saleAmount.setSize(a.getSize());
saleAmount.setCount(-a.getCount());
saleAmount.setOperation(a.getOperation());
uAmounts.add(saleAmount);
}
}
d.setEntryStockAmounts(uAmounts);
}
stockRequest.addEntryStock(d);
}
NewStockRequest.DiabloStockCalc dCalc = new NewStockRequest.DiabloStockCalc();
StockCalc calc = mStockCalcController.getStockCalc();
dCalc.setRsnId(mRSNId);
dCalc.setRsn(mRSN);
dCalc.setFirmId(calc.getFirm());
dCalc.setShopId(calc.getShop());
dCalc.setDatetime(calc.getDatetime());
dCalc.setEmployeeId(calc.getEmployee());
dCalc.setComment(calc.getComment());
dCalc.setTotal(-calc.getTotal());
dCalc.setBalance(calc.getBalance());
dCalc.setVerificate(calc.getVerificate());
dCalc.setExtraCost(calc.getExtraCost());
dCalc.setShouldPay(-calc.getShouldPay());
dCalc.setOldFirm(mOldStockCalc.getFirm());
dCalc.setOldBalance(mOldStockCalc.getBalance());
dCalc.setOldVerificate(mOldStockCalc.getVerificate());
dCalc.setOldShouldPay(-mOldStockCalc.getShouldPay());
dCalc.setOldDatetime(mOldStockCalc.getDatetime());
stockRequest.setStockCalc(dCalc);
if (0 == updateStocks.size()
&& dCalc.getFirmId().equals(mOldStockCalc.getFirm())
&& dCalc.getDatetime().equals(mOldStockCalc.getDatetime())
&& dCalc.getVerificate().equals(mOldStockCalc.getVerificate())
&& dCalc.getComment().equals(mOldStockCalc.getComment())) {
new DiabloAlertDialog(
getContext(),
getResources().getString(R.string.sale_out_update),
DiabloError.getError(2699)).create();
} else {
startRequest(stockRequest);
}
}
private void startRequest(NewStockRequest request) {
final StockInterface face = StockClient.getClient().create(StockInterface.class);
Call<NewStockResponse> call = face.updateStock(Profile.instance().getToken(), request);
call.enqueue(new Callback<NewStockResponse>() {
@Override
public void onResponse(Call<NewStockResponse> call, retrofit2.Response<NewStockResponse> response) {
mButtons.get(R.id.stock_out_update_save).enable();
final NewStockResponse res = response.body();
if (DiabloEnum.HTTP_OK == response.code() && res.getCode().equals(DiabloEnum.SUCCESS)) {
// reset firm balance
Firm firm = Profile.instance().getFirm(mStockCalcController.getFirm());
Firm oldFirm = Profile.instance().getFirm(mOldStockCalc.getFirm());
firm.setBalance(mStockCalcController.getStockCalc().calcAccBalance());
if ( !firm.getId().equals(oldFirm.getId()) ) {
oldFirm.setBalance(
oldFirm.getBalance()
+ mOldStockCalc.getShouldPay()
+ mOldStockCalc.getExtraCost()
- mOldStockCalc.getVerificate()
);
}
new DiabloAlertDialog(
getContext(),
false,
getResources().getString(R.string.stock_out_update),
getContext().getString(R.string.stock_out_update_success) + res.getRsn(),
new DiabloAlertDialog.OnOkClickListener() {
@Override
public void onOk() {
mLastRSN = DiabloEnum.DIABLO_INVALID_RSN;
init();
SaleUtils.switchToSlideMenu(StockOutUpdate.this, DiabloEnum.TAG_STOCK_DETAIL);
}
}).create();
} else {
mButtons.get(R.id.stock_out_update_save).enable();
Integer errorCode = response.code() == 0 ? res.getCode() : response.code();
String extraMessage = res == null ? "" : res.getError();
new DiabloAlertDialog(
getContext(),
getResources().getString(R.string.stock_in_update),
DiabloError.getError(errorCode) + extraMessage).create();
}
}
@Override
public void onFailure(Call<NewStockResponse> call, Throwable t) {
mButtons.get(R.id.stock_out_update_save).enable();
new DiabloAlertDialog(
getContext(),
getResources().getString(R.string.stock_in_update),
DiabloError.getError(99)).create();
}
});
}
}
| 35,674 | 0.598419 | 0.597214 | 886 | 39.264107 | 29.07995 | 122 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.577878 | false | false |
5
|
8cd33bd9f3265628d8a578fe0119e1d13a45e1c9
| 188,978,625,340 |
14403d9ca8bf8a1c000e8e67693e5acf6ea224d2
|
/gfg/src/main/java/org/prakash/bitmagic/IsKthBitSet.java
|
5df15b3cc2d4cb9014f68e7c5611b4594f41e66f
|
[] |
no_license
|
psbhakuni/java
|
https://github.com/psbhakuni/java
|
4905594d09b3fce063a34a355cefb2cd1602052d
|
e212219836f114142970f6b406de1c6788610b0e
|
refs/heads/main
| 2023-07-04T14:11:34.536000 | 2021-08-18T11:34:37 | 2021-08-18T11:34:37 | 350,593,182 | 0 | 0 | null | false | 2021-03-25T11:55:50 | 2021-03-23T05:44:04 | 2021-03-24T13:58:00 | 2021-03-25T11:55:50 | 11 | 0 | 0 | 1 |
Java
| false | false |
package org.prakash.bitmagic;
public class IsKthBitSet {
public static void main(String[] args) {
//Scanner scanner = new Scanner(System.in);
//System.out.println("Please enter the number: ");
//scanner.nextInt();
int n = 4; int k = 0;
// int n = 4; int k = 2;
//int n = 500; int k = 3;
System.out.println(checkKthBit(n, k));
}
static boolean checkKthBit(int n, int k){
System.out.println("(n, k) : ("+ n + ", "+ k+")");
long twoPowerK = (long)Math.pow(2,k);
System.out.println("twoPowerK : "+ twoPowerK);
System.out.println("(n|twoPowerK) : "+ (n|twoPowerK));
if((n|twoPowerK) > n) {
return false;
}
return true;
}
}
|
UTF-8
|
Java
| 777 |
java
|
IsKthBitSet.java
|
Java
|
[] | null |
[] |
package org.prakash.bitmagic;
public class IsKthBitSet {
public static void main(String[] args) {
//Scanner scanner = new Scanner(System.in);
//System.out.println("Please enter the number: ");
//scanner.nextInt();
int n = 4; int k = 0;
// int n = 4; int k = 2;
//int n = 500; int k = 3;
System.out.println(checkKthBit(n, k));
}
static boolean checkKthBit(int n, int k){
System.out.println("(n, k) : ("+ n + ", "+ k+")");
long twoPowerK = (long)Math.pow(2,k);
System.out.println("twoPowerK : "+ twoPowerK);
System.out.println("(n|twoPowerK) : "+ (n|twoPowerK));
if((n|twoPowerK) > n) {
return false;
}
return true;
}
}
| 777 | 0.517375 | 0.505791 | 30 | 24.9 | 21.325024 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.833333 | false | false |
5
|
a1709fb52d5a8bc2dca2477bbda7ab25790db8b6
| 1,752,346,720,751 |
f8f8e5a5023dffb2359db85540446ae6893b7159
|
/Mini Projects/MDBMiniProject2-Pokedex/app/src/main/java/com/example/joey/pokedex/PointFilter.java
|
36b9eefb784978f40094333051b816d2ea0b1111
|
[] |
no_license
|
swethapraba/Mobile-Developers-Berkeley
|
https://github.com/swethapraba/Mobile-Developers-Berkeley
|
32bea57478f79b5b8c9f0adb02fa244e3886eaef
|
cf64bab3af9116e1563c73d9eb24d62736d200c4
|
refs/heads/master
| 2021-08-18T16:22:26.463000 | 2017-11-23T08:00:00 | 2017-11-23T08:00:00 | 104,606,874 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.joey.pokedex;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.EditText;
public class PointFilter extends AppCompatActivity {
private EditText editAP;
private EditText editDP;
private EditText editHP;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_point_filter);
editAP = (EditText) findViewById(R.id.attackPointsInput);
editHP = (EditText) findViewById(R.id.healthPointsInput);
editDP = (EditText) findViewById(R.id.defensePointsInput);
}
@Override
protected void onResume() {
super.onResume();
editAP.setText(getIntent().getStringExtra("apcutoff"));
editHP.setText(getIntent().getStringExtra("hpcutoff"));
editDP.setText(getIntent().getStringExtra("dpcutoff"));
}
@Override
public void onBackPressed() {
Intent intent = new Intent();
intent.putExtra("apcutoff", checkNull(editAP.getText().toString()));
intent.putExtra("dpcutoff", checkNull(editDP.getText().toString()));
intent.putExtra("hpcutoff", checkNull(editHP.getText().toString()));
Log.d("CREATION", checkNull(editHP.getText().toString()));
setResult(RESULT_OK, intent);
finish();
}
private static String checkNull(String s){
if(isInteger(s)){
return s;
}else{
return "0";
}
}
private static boolean isInteger(String s) {
try {
Integer.parseInt(s);
} catch(NumberFormatException e) {
return false;
} catch(NullPointerException e) {
return false;
}
// only got here if we didn't return false
return true;
}
}
|
UTF-8
|
Java
| 1,915 |
java
|
PointFilter.java
|
Java
|
[] | null |
[] |
package com.example.joey.pokedex;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.EditText;
public class PointFilter extends AppCompatActivity {
private EditText editAP;
private EditText editDP;
private EditText editHP;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_point_filter);
editAP = (EditText) findViewById(R.id.attackPointsInput);
editHP = (EditText) findViewById(R.id.healthPointsInput);
editDP = (EditText) findViewById(R.id.defensePointsInput);
}
@Override
protected void onResume() {
super.onResume();
editAP.setText(getIntent().getStringExtra("apcutoff"));
editHP.setText(getIntent().getStringExtra("hpcutoff"));
editDP.setText(getIntent().getStringExtra("dpcutoff"));
}
@Override
public void onBackPressed() {
Intent intent = new Intent();
intent.putExtra("apcutoff", checkNull(editAP.getText().toString()));
intent.putExtra("dpcutoff", checkNull(editDP.getText().toString()));
intent.putExtra("hpcutoff", checkNull(editHP.getText().toString()));
Log.d("CREATION", checkNull(editHP.getText().toString()));
setResult(RESULT_OK, intent);
finish();
}
private static String checkNull(String s){
if(isInteger(s)){
return s;
}else{
return "0";
}
}
private static boolean isInteger(String s) {
try {
Integer.parseInt(s);
} catch(NumberFormatException e) {
return false;
} catch(NullPointerException e) {
return false;
}
// only got here if we didn't return false
return true;
}
}
| 1,915 | 0.639687 | 0.638642 | 67 | 27.58209 | 23.321983 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.537313 | false | false |
5
|
efc3086309526073bfaa4092f68d4fbda28ce0fe
| 36,215,164,250,199 |
622e5d0ea9510213f0f0e9322c253e87093e720e
|
/app/src/main/java/org/fs/dictionary/core/BeepManager.java
|
83bf9079efbd135dafa8c19b734c751989bcca00
|
[] |
no_license
|
droideveloper/SnapDictionaryAndroid
|
https://github.com/droideveloper/SnapDictionaryAndroid
|
bcc7ff7645627296c2933b84c70ccf89689741f3
|
78f073ad8d401caad228fa80b9a2d455a3bb70e8
|
refs/heads/master
| 2021-01-11T03:48:49.221000 | 2016-10-19T18:21:39 | 2016-10-19T18:21:39 | 71,386,457 | 2 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.fs.dictionary.core;
import android.content.Context;
import android.content.Intent;
import android.content.res.AssetFileDescriptor;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.os.Vibrator;
import org.fs.dictionary.R;
import java.io.IOException;
/**
* Created by Fatih on 27/11/14.
*/
public class BeepManager {
private final static float BEEP_VALUME = 0.10F;
private final static long VIBRATION = 200L;
private Context mContext;
private MediaPlayer mMediaPlayer;
private Vibrator mVibrator;
private boolean mShouldInitialize = true;
public BeepManager(Context mContext) {
this.mContext = mContext;
this.mMediaPlayer = new MediaPlayer();
this.mVibrator = (Vibrator)mContext.getSystemService(Context.VIBRATOR_SERVICE);
}
private void initialize() throws IOException {
notifyMusicIfPlaying();
mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mMediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mediaPlayer) {
mMediaPlayer.seekTo(0);//first position
}
});
AssetFileDescriptor mAssetFileDescriptor = mContext.getResources().openRawResourceFd(R.raw.beep);
mMediaPlayer.setDataSource(mAssetFileDescriptor.getFileDescriptor(), mAssetFileDescriptor.getStartOffset(), mAssetFileDescriptor.getLength());
mAssetFileDescriptor.close();
mMediaPlayer.setVolume(BEEP_VALUME, BEEP_VALUME);
mMediaPlayer.prepareAsync();
}
private void notifyMusicIfPlaying() {
Intent intent = new Intent("com.android.music.musicservicecommand");
intent.putExtra("command", "pause");
mContext.sendBroadcast(intent);
}
public void notification() {
boolean shouldPlaySound = true; //do get it from PreferanceManager
boolean shouldVibrate = true; //do get it from PreferanceManager
if(shouldPlaySound) {
mMediaPlayer.start();
if(shouldVibrate) {
mVibrator.vibrate(VIBRATION);
}
}
}
}
|
UTF-8
|
Java
| 2,222 |
java
|
BeepManager.java
|
Java
|
[
{
"context": ";\n\nimport java.io.IOException;\n\n\n/**\n * Created by Fatih on 27/11/14.\n */\npublic class BeepManager {\n\n ",
"end": 324,
"score": 0.9943172931671143,
"start": 319,
"tag": "USERNAME",
"value": "Fatih"
}
] | null |
[] |
package org.fs.dictionary.core;
import android.content.Context;
import android.content.Intent;
import android.content.res.AssetFileDescriptor;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.os.Vibrator;
import org.fs.dictionary.R;
import java.io.IOException;
/**
* Created by Fatih on 27/11/14.
*/
public class BeepManager {
private final static float BEEP_VALUME = 0.10F;
private final static long VIBRATION = 200L;
private Context mContext;
private MediaPlayer mMediaPlayer;
private Vibrator mVibrator;
private boolean mShouldInitialize = true;
public BeepManager(Context mContext) {
this.mContext = mContext;
this.mMediaPlayer = new MediaPlayer();
this.mVibrator = (Vibrator)mContext.getSystemService(Context.VIBRATOR_SERVICE);
}
private void initialize() throws IOException {
notifyMusicIfPlaying();
mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mMediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mediaPlayer) {
mMediaPlayer.seekTo(0);//first position
}
});
AssetFileDescriptor mAssetFileDescriptor = mContext.getResources().openRawResourceFd(R.raw.beep);
mMediaPlayer.setDataSource(mAssetFileDescriptor.getFileDescriptor(), mAssetFileDescriptor.getStartOffset(), mAssetFileDescriptor.getLength());
mAssetFileDescriptor.close();
mMediaPlayer.setVolume(BEEP_VALUME, BEEP_VALUME);
mMediaPlayer.prepareAsync();
}
private void notifyMusicIfPlaying() {
Intent intent = new Intent("com.android.music.musicservicecommand");
intent.putExtra("command", "pause");
mContext.sendBroadcast(intent);
}
public void notification() {
boolean shouldPlaySound = true; //do get it from PreferanceManager
boolean shouldVibrate = true; //do get it from PreferanceManager
if(shouldPlaySound) {
mMediaPlayer.start();
if(shouldVibrate) {
mVibrator.vibrate(VIBRATION);
}
}
}
}
| 2,222 | 0.687669 | 0.681818 | 67 | 32.164181 | 28.915005 | 150 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.567164 | false | false |
5
|
03708372339aa97d28109906191657c597e50329
| 33,131,377,789,230 |
d3993fa621ac9f7d1fbfba19332fa9a6c6650399
|
/AvroImporter/src/main/java/aksw/org/sdw/importer/avro/annotations/GlobalConfig.java
|
780a8ab5b59ff78ae87313132a3021df42f9b0ff
|
[
"Apache-2.0"
] |
permissive
|
AKSW/SmartDataWebKG
|
https://github.com/AKSW/SmartDataWebKG
|
894a4e80562ade4eb933a81167555996869610f0
|
cd2a48c86f66bc59841805406bcb3e8168038859
|
refs/heads/master
| 2023-01-07T21:33:05.892000 | 2017-12-13T15:29:14 | 2017-12-13T15:29:14 | 49,487,841 | 2 | 1 |
Apache-2.0
| false | 2023-01-02T22:13:06 | 2016-01-12T09:02:50 | 2018-02-07T18:16:01 | 2023-01-02T22:13:03 | 3,835 | 2 | 1 | 16 |
Java
| false | false |
package aksw.org.sdw.importer.avro.annotations;
import java.security.MessageDigest;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
public class GlobalConfig {
private static GlobalConfig instance = null;
private String nifid = null;
private String wasAttributedTo = null;
public static synchronized GlobalConfig getInstance() {
if (instance == null) {
instance = new GlobalConfig();
}
return instance;
}
public String getNifid() {
return nifid;
}
public void setNifid(String nifid) {
this.nifid = nifid;
}
public String getWasAttributedTo() {
return wasAttributedTo;
}
public void setWasAttributedTo(String str) {
this.wasAttributedTo = str;
}
/*
nif:anchorOf "Beacon Capital Management" ;
nif:beginIndex "1858"^^xsd:nonNegativeInteger ;
nif:endIndex "1883"^^xsd:nonNegativeInteger ;
nif:referenceContext <http://www.watchlistnews.com/on-semiconductor-corp-on-cfo-bernard-gutmann-sells-30000-shares-of-stock/582309.html/#offset_0_4865> ;
:taAnnotatorsRef <http://corp.dbpedia.org/annotator#Stanford%20CoreNLP%203.7.0> ;
:taClassRef org:Organization , dbo:Organisation ;
:taConfidence "1.0"^^xsd:double ;
:taIdentRef
*/
public String makeNifHash(Mention mention, Document document) {
String hashsum = "";
try {
hashsum += String.format("%064x", new java.math.BigInteger(1, MessageDigest.getInstance("SHA-256").digest(mention.textNormalized.getBytes())));
hashsum += String.format("%064x", new java.math.BigInteger(1, MessageDigest.getInstance("SHA-256").digest(String.valueOf(mention.span.start).getBytes())));
hashsum += String.format("%064x", new java.math.BigInteger(1, MessageDigest.getInstance("SHA-256").digest(String.valueOf(mention.span.end).getBytes())));
hashsum += String.format("%064x", new java.math.BigInteger(1, MessageDigest.getInstance("SHA-256").digest(document.uri.getBytes())));
for( Provenance provenance : mention.provenanceSet) {
if( null != provenance.annotator)
hashsum += String.format("%064x", new java.math.BigInteger(1, MessageDigest.getInstance("SHA-256").digest(provenance.annotator.getBytes())));
if( -1.0f != provenance.score)
hashsum += String.format("%064x", new java.math.BigInteger(1, MessageDigest.getInstance("SHA-256").digest(String.valueOf(provenance.score).getBytes())));
}
for( String type : mention.types ) {
if( null != type )
hashsum += String.format("%064x", new java.math.BigInteger(1, MessageDigest.getInstance("SHA-256").digest(type.getBytes())));
}
hashsum = String.format("%064x", new java.math.BigInteger(1, MessageDigest.getInstance("SHA-256").digest(hashsum.getBytes())));
} catch (Exception e) {
e.printStackTrace();
}
return hashsum;
}
// public String makeNifHash(Set<Provenance> provenanceSet, String docid) {
// Iterator<Provenance> provenanceIt = provenanceSet.iterator();
// String hashed = "";
// try {
// while (provenanceIt.hasNext()) {
// Provenance provenance = provenanceIt.next();
// hashed += String.format("%064x", new java.math.BigInteger(1, MessageDigest.getInstance("SHA-256").digest(provenance.toString().getBytes())));
// }
// hashed += String.format("%064x", new java.math.BigInteger(1, MessageDigest.getInstance("SHA-256").digest(docid.getBytes())));
// } catch ( Exception e ) {
// e.printStackTrace();
// }
// return hashed;
// }
}
|
UTF-8
|
Java
| 3,808 |
java
|
GlobalConfig.java
|
Java
|
[] | null |
[] |
package aksw.org.sdw.importer.avro.annotations;
import java.security.MessageDigest;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
public class GlobalConfig {
private static GlobalConfig instance = null;
private String nifid = null;
private String wasAttributedTo = null;
public static synchronized GlobalConfig getInstance() {
if (instance == null) {
instance = new GlobalConfig();
}
return instance;
}
public String getNifid() {
return nifid;
}
public void setNifid(String nifid) {
this.nifid = nifid;
}
public String getWasAttributedTo() {
return wasAttributedTo;
}
public void setWasAttributedTo(String str) {
this.wasAttributedTo = str;
}
/*
nif:anchorOf "Beacon Capital Management" ;
nif:beginIndex "1858"^^xsd:nonNegativeInteger ;
nif:endIndex "1883"^^xsd:nonNegativeInteger ;
nif:referenceContext <http://www.watchlistnews.com/on-semiconductor-corp-on-cfo-bernard-gutmann-sells-30000-shares-of-stock/582309.html/#offset_0_4865> ;
:taAnnotatorsRef <http://corp.dbpedia.org/annotator#Stanford%20CoreNLP%203.7.0> ;
:taClassRef org:Organization , dbo:Organisation ;
:taConfidence "1.0"^^xsd:double ;
:taIdentRef
*/
public String makeNifHash(Mention mention, Document document) {
String hashsum = "";
try {
hashsum += String.format("%064x", new java.math.BigInteger(1, MessageDigest.getInstance("SHA-256").digest(mention.textNormalized.getBytes())));
hashsum += String.format("%064x", new java.math.BigInteger(1, MessageDigest.getInstance("SHA-256").digest(String.valueOf(mention.span.start).getBytes())));
hashsum += String.format("%064x", new java.math.BigInteger(1, MessageDigest.getInstance("SHA-256").digest(String.valueOf(mention.span.end).getBytes())));
hashsum += String.format("%064x", new java.math.BigInteger(1, MessageDigest.getInstance("SHA-256").digest(document.uri.getBytes())));
for( Provenance provenance : mention.provenanceSet) {
if( null != provenance.annotator)
hashsum += String.format("%064x", new java.math.BigInteger(1, MessageDigest.getInstance("SHA-256").digest(provenance.annotator.getBytes())));
if( -1.0f != provenance.score)
hashsum += String.format("%064x", new java.math.BigInteger(1, MessageDigest.getInstance("SHA-256").digest(String.valueOf(provenance.score).getBytes())));
}
for( String type : mention.types ) {
if( null != type )
hashsum += String.format("%064x", new java.math.BigInteger(1, MessageDigest.getInstance("SHA-256").digest(type.getBytes())));
}
hashsum = String.format("%064x", new java.math.BigInteger(1, MessageDigest.getInstance("SHA-256").digest(hashsum.getBytes())));
} catch (Exception e) {
e.printStackTrace();
}
return hashsum;
}
// public String makeNifHash(Set<Provenance> provenanceSet, String docid) {
// Iterator<Provenance> provenanceIt = provenanceSet.iterator();
// String hashed = "";
// try {
// while (provenanceIt.hasNext()) {
// Provenance provenance = provenanceIt.next();
// hashed += String.format("%064x", new java.math.BigInteger(1, MessageDigest.getInstance("SHA-256").digest(provenance.toString().getBytes())));
// }
// hashed += String.format("%064x", new java.math.BigInteger(1, MessageDigest.getInstance("SHA-256").digest(docid.getBytes())));
// } catch ( Exception e ) {
// e.printStackTrace();
// }
// return hashed;
// }
}
| 3,808 | 0.639443 | 0.61187 | 86 | 43.279068 | 47.117283 | 173 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.895349 | false | false |
5
|
787e59024e2586a49cf48bb75a0ac81c71506717
| 35,570,919,145,779 |
153764cb10ac36f3f50d3cc42548d3c947fc4282
|
/MyEclipse 2015/tydm_gh/src/com/ninemax/jpa/code/action/OnLinceAction.java
|
d2a5d2fa91d62c40033c86244c035030b958009a
|
[] |
no_license
|
Lee979797/Workspaces
|
https://github.com/Lee979797/Workspaces
|
3075387b29ee9b8a51a60d40830f4eaf220d63a8
|
8476f9078d67d8dba7d1869acd868cb07d50a7e6
|
refs/heads/master
| 2020-03-27T22:52:03.687000 | 2018-11-13T09:34:17 | 2018-11-13T09:34:17 | 147,265,614 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.ninemax.jpa.code.action;
import com.ninemax.jpa.code.bus.*;
import com.ninemax.jpa.code.model.*;
import com.ninemax.jpa.code.model.vo.*;
import com.ninemax.jpa.global.EntityManagerHelper;
import com.ninemax.jpa.global.InitSysParams;
import com.ninemax.jpa.global.WsbzEntityManagerHelper;
import com.ninemax.jpa.system.model.User;
import com.ninemax.jpa.util.ActionUtils;
import com.ninemax.jpa.util.BeanUtilsEx;
import com.ninemax.jpa.util.DateUtil;
import com.ninemax.jpa.util.clsPageComponent;
import com.ninemax.jpa.util.clsStringTool;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import net.sf.cglib.beans.BeanCopier;
import nl.justobjects.pushlet.util.Log;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.interceptor.SessionAware;
import javax.persistence.EntityManager;
import javax.persistence.EntityTransaction;
import javax.servlet.http.HttpServletRequest;
import java.sql.SQLException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by IntelliJ IDEA.
* User: zhaoxun
* Date: 13-5-22
* Time: 下午1:27
*/
public class OnLinceAction extends ActionSupport implements SessionAware{
private Map<String, Object> session;
private String currentPath = "";
private String dm;
private String ywlx;
private String zt;
private String id;
private List<OnLineVO> list;
private List<Wnj> wnjList;
private List<Wgs> wgsList;
private List<Wzcyh> wzcyhList;
private String pstate = "";
private String npstate = "";
private String state;
private String tjr;
private String txnr;
private String txbt;
private String message;
private String url;
private String type;
private TJgdmSave jgdmSave;
private Wnj wnj;
//登记号列表
private List<String> djhs;
//提醒列表
private List<TxnrVO> txnrList;
private TJgdm jgdm;
private TJgdm wjgdm;
private TjgdmOnLineVO onLineVO;
private Wgs wgs;
private Wba wba;
private Wzx wzx;
private WXb wxb;
private Wzcyh wzcyh;
private String djh;
private Boolean needAudit;
//是否已经审核
private Boolean audit;
//审核依据
protected String shyj;
//审核结果
protected String shresult;
//提示信息
private String prompt;
//新办处理
private String[] infos;
//分页数据
private clsPageComponent pages;
private Integer rowNumsView = 20;
private Integer pageno = 1;
//业务类
private OnlineBus onlineBus;
private TjgdmBus tjgdmBus;
private WsbzXbBus wsbzBus;
private TJgdmSaveBus saveBus;
private TSpBus tSpBus;
private String jgmc;
private Integer back;
private String fn;
public OnLinceAction() {
onlineBus = new OnlineBus();
tjgdmBus = new TjgdmBus();
wsbzBus = new WsbzXbBus();
saveBus = new TJgdmSaveBus();
tSpBus = new TSpBus();
}
//前置审批or申报表审批
private String opt;
public Map<String, Object> getSession() {
return session;
}
public void setSession(Map<String, Object> session) {
this.session = session;
}
public String choose() {
currentPath = "/product/jsp/online/SP100100.jsp";
return this.SUCCESS;
}
public String jdChoose() {
currentPath = "/product/jsp/online/SP100101.jsp";
return this.SUCCESS;
}
public String list(){
User user = (User) session.get("sysUser");
if (pages == null)
pages = new clsPageComponent();
currentPath = "/product/jsp/online/SPQuerylist_new.jsp";
//4 挂失业务 5备案业务 6注销 其它 新办里面的业务
if("4".equals(ywlx)){
list = onlineBus.getGsList(dm,user,zt,pageno, rowNumsView, pages);
}else if("5".equals(ywlx)){
list = onlineBus.getBaList(dm,user,zt,pageno, rowNumsView, pages);
}else if("6".equals(ywlx)){
list = onlineBus.getZxList(dm,user,zt,pageno, rowNumsView, pages);
}else{
list = onlineBus.getXbList(dm,user,zt,ywlx,pageno, rowNumsView, pages);
}
return this.SUCCESS;
}
/**
* 年度申报
* @return
*/
public String nbList(){
User user = (User) session.get("sysUser");
if (pages == null)
pages = new clsPageComponent();
currentPath = "/product/jsp/online/SPnbQuerylist_new.jsp";
wnjList = onlineBus.getNjList(dm,user,zt,pageno, rowNumsView, pages);
return this.SUCCESS;
}
/**
* 处理年度申报
* @return
*/
public String nbUpdate(){
message="年度申报更新成功!";
User user = (User) session.get("sysUser");
if (pages == null)
pages = new clsPageComponent();
currentPath = "/product/jsp/online/success.jsp";
TZrxzqh zrxzqh = InitSysParams.zrxzqhMap2.get(user.getBzjgdm().trim());
// 1是定期年检 0是办证日期加一年
String dateLimit = "";
if (zrxzqh != null) {
if ("0".equals(zrxzqh.getNjfs())) {
dateLimit = DateUtil.addMonth(DateUtil.dateToStr(new Date()), 12);
} else {
dateLimit = DateUtil.addMonth(DateUtil.getCurrentDateTime().substring(0, 4) + "-" + zrxzqh.getNjjzrq().substring(0, 2) + "-" + zrxzqh.getNjjzrq().substring(2), 12);
}
}
Date uDate=clsStringTool.getStringDate(dateLimit);
onlineBus.nbUpdate(dm,id,uDate);
return this.SUCCESS;
}
public String ndbg_print() throws SQLException {
currentPath = "/product/jsp/online/ndbg_print.jsp";
TjgdmBus bus=new TjgdmBus();
OnlineBus online=new OnlineBus();
jgdm=bus.findById(dm);
wnj=online.getNj(id);
Calendar calendar = Calendar.getInstance();
Calendar calendar2 = Calendar.getInstance();
Calendar calendar3 = Calendar.getInstance();
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
calendar2.setTime(jgdm.getZfrq());
calendar2.add(Calendar.DAY_OF_YEAR, -30);
calendar3.add(Calendar.YEAR,1);
if (calendar.getTime().after(calendar2.getTime())) {
message="您应于Y年X月到代码窗口办理换证".replace("X", calendar2.get(calendar.MONTH)+2 + "").replace("Y", calendar2.get(Calendar.YEAR) + "");
//isPrint = false;
}else{
calendar3.setTime(jgdm.getNjqx());
message="您应于Y年12月31日前进行年度报告".replace("Y", calendar3.get(Calendar.YEAR)+1 + "");
}
return this.SUCCESS;
}
/**
* 网上业务修改分页列表页面
* TengWuChao 2014-04-11
* @return
*/
public String wsywList(){
User user = (User) session.get("sysUser");
if (pages == null)
pages = new clsPageComponent();
currentPath = "/product/jsp/online/wsywList.jsp";
//4 挂失业务 5备案业务 6注销 其它 新办里面的业务
list = onlineBus.getWsywList(jgmc,user,"1",ywlx,pageno, rowNumsView, pages);
return this.SUCCESS;
}
/**
* 重置密码
*/
public String initPassWord(){
User user = (User) session.get("sysUser");
if (pages == null)
pages = new clsPageComponent();
currentPath = "/product/jsp/online/PasswordList.jsp";
//4 挂失业务 5备案业务 6注销 其它 新办里面的业务
wzcyhList = onlineBus.initPassWord(jgmc, user, dm, ywlx, pageno, rowNumsView, pages);
return this.SUCCESS;
}
public String createPassWord(){
currentPath = "/bsweb/onLine_initPassWord.action";
onlineBus.createPassWord(wzcyh.getZcyhId());
message="重置密码成功!密码为123456";
return this.SUCCESS;
}
/**
* 跳转修改网上业务页面
* TengWuChao 2014-04-11
* @return
*/
public String toWsywUpdate(){
currentPath = "/product/jsp/online/wsywUpdate.jsp";
WXb xb = onlineBus.getWxb(id);
ActionContext.getContext().put("jgdm",xb );
// BeanUtilsEx.copyProperties(jgdm,xb);
return this.SUCCESS;
}
/**
* 修改网上数据
* TengWuChao 2014-04-11
* @return
*/
public String wsywUpdate(){
EntityManager em = WsbzEntityManagerHelper.getEntityManager();
currentPath = "/product/jsp/online/wsywList.jsp";
EntityTransaction tx = null;
try{
if(wxb==null){
wxb=new WXb();
}
tx = em.getTransaction();
tx.begin();
BeanUtilsEx.copyProperties(wxb, jgdm);
wxb.setId(Integer.valueOf(id));
wxb.setDjh(djh);
wxb.setZt(zt);
em.merge(wxb);
// em.flush();
tx.commit();
ActionContext.getContext().put("message", "修改网上数据成功!");
} catch (Exception e) {
currentPath = "/product/jsp/online/wsywUpdate.jsp";
ActionContext.getContext().put("message", "修改网上数据失败!");
if (tx != null && tx.isActive()) {
tx.rollback();
}
} finally {
WsbzEntityManagerHelper.closeEntityManager();
}
return wsywList();
}
/**
* 挂失审批
* @return
*/
public String gsSp(){
currentPath = "/product/jsp/online/gsSp.jsp";
getStatus();
jgdm = tjgdmBus.findById(dm);
djhs = onlineBus.getDjhs(dm);
session.put("djhs", djhs);
if(djhs==null){
currentPath = "/product/jsp/online/prompt.jsp";
prompt = "机构代码("+dm+")无网上预约挂失的证书,无法进行证书确认挂失操作!";
}
infos = onlineBus.getXbclInfo(id);
wgs = onlineBus.getWgs(id);
return this.SUCCESS;
}
/**
* 备案审批
* @return
*/
public String baSp(){
currentPath = "/product/jsp/online/baSp.jsp";
getStatus();
jgdm = tjgdmBus.findById(dm);
infos = onlineBus.getXbclInfo(id);
wba = onlineBus.getWba(id);
return this.SUCCESS;
}
/**
* 注销审批
*/
public String zxSp(){
currentPath = "/product/jsp/online/zxSp.jsp";
getStatus();
jgdm = tjgdmBus.findById(dm);
// infos = onlineBus.getXbclInfo(id);
infos = onlineBus.getZxclInfo(dm);
wzx = onlineBus.getWzx(id);
return this.SUCCESS;
}
public String jdList(){
User user = (User) session.get("sysUser");
if (pages == null)
pages = new clsPageComponent();
currentPath = "/product/jsp/online/JDQuerylist_new.jsp";
//4 挂失业务 5备案业务 6注销 其它 新办里面的业务
if("4".equals(ywlx)){
zt = "3";
list = onlineBus.getGsList(dm,user,zt,pageno, rowNumsView, pages);
}else if("5".equals(ywlx)){
zt = "2";
list = onlineBus.getBaList(dm,user,zt,pageno, rowNumsView, pages);
}else if("6".equals(ywlx)){
zt = "3";
list = onlineBus.getZxList(dm,user,zt,pageno, rowNumsView, pages);
}else if("0".equals(ywlx)){
List<OnLineVO> xbs = onlineBus.getXbList(dm,user,zt,ywlx,pageno, rowNumsView, pages);
if(xbs!=null && xbs.size()>0){
list = new ArrayList<OnLineVO>(xbs.size());
for(OnLineVO vo : xbs){
if(wsbzBus.isWsyw(vo.getDjh(),ywlx)){
vo.setFlag("1");
}else{
vo.setFlag("0");
}
list.add(vo);
}
}
}else{
list = onlineBus.getXbList(dm,user,zt,ywlx,pageno, rowNumsView, pages);
}
return this.SUCCESS;
}
/**
* 年检批量通过
* @return
* Tengwuchao
* 2014-07-04
*/
public String checkAll(){
User user = (User) session.get("sysUser");
EntityManager em = EntityManagerHelper.getEntityManager();
EntityManager checkem = WsbzEntityManagerHelper.getEntityManager();
EntityTransaction tx = em.getTransaction();
EntityTransaction tx1 = checkem.getTransaction();
try {
tx1.begin();
String strsql = "from WXb where zt = '3' and lb = '1' "+((user.getUserName()!=null && user.getUserName().contains("admin"))?"":" and bzjgdm = '"+user.getBzjgdm()+"' ");
List<WXb> list=checkem.createQuery(strsql).getResultList();
checkem.createNativeQuery("update w_xb set w_xb_zt='4' where w_xb_zt = '3'"+((user.getUserName()!=null && user.getUserName().contains("admin"))?"":" and w_xb_bzjgdm = '"+user.getBzjgdm()+"' ")).executeUpdate();
if(list!=null&&list.size()>0){
for (WXb xb : list) {
tx.begin();
jgdm = em.find(TJgdm.class, xb.getJgdm());
///////////////
TBgk bgk = new TBgk();
BeanUtilsEx.copyProperties(bgk, jgdm);
bgk.setBgsj(new Date());
em.persist(bgk);
BeanUtilsEx.copyProperties(jgdm,xb);
jgdm.setNjrq(new Date());
jgdm.setLastdate(new Date());
jgdm.setBgrq(new Date());
jgdm.setNjr(user.getUserName());
jgdm.setNnjjhy(xb.getJjhy());
jgdm.setZgmc(xb.getZgjgmc());
jgdm.setJjhy("");
if(jgdm.getFksl()!=null && jgdm.getFksl()>0){
jgdm.setFkbz("1");
}else{
jgdm.setFkbz("0");
}
String jflyName = new OnlineBus().getJflyName(jgdm.getJfly());
jgdm.setJfly(jflyName);
if(jgdm.getEmail()!=null&&jgdm.getEmail().equals("null")){
jgdm.setEmail(null);
}
//jgdm.setZfrq(t2.getZfrq());jgdm.setBzrq(t2.getBzrq());
TZrxzqh xzqh = em.find(TZrxzqh.class, user.getBzjgdm());
em.clear();
Date real;
if (xzqh.getNjfs().equals("0")) {
real = DateUtil.yearAfter(jgdm.getNjrq() == null ? new Date() : jgdm.getNjrq(), 1);
jgdm.setNjqx(real);
} else {
Date date = DateUtil.strToDate(Calendar.getInstance().get(Calendar.YEAR) + "-" + xzqh.getNjqsrq().substring(0, 2) + "-" + xzqh.getNjqsrq().substring(2, 4));
if (date.after(new Date())) {
jgdm.setNjqx(DateUtil.strToDate(Calendar.getInstance().get(Calendar.YEAR) + "-" + xzqh.getNjjzrq().substring(0, 2) + "-" + xzqh.getNjjzrq().substring(2, 4)));
} else {
jgdm.setNjqx(DateUtil.strToDate((Calendar.getInstance().get(Calendar.YEAR) + 1) + "-" + xzqh.getNjjzrq().substring(0, 2) + "-" + xzqh.getNjjzrq().substring(2, 4)));
}
}
if (!InitSysParams.njjhyMap.containsKey(jgdm.getNjjhy())) {
message = "输入的经济行业不存在与码表中,请更正!";
}
em.merge(jgdm);
if(InitSysParams.system.getNjSmTask()){
addrw(em,SmTaskType.年检);
}
addCzjl(em, jgdm, "年检", "6", null);
//deleteSp(em, jgdm.getJgdm(), "12");
////////////////
tx.commit();
em.clear();
}
}
tx1.commit();
//tx1.commit();
} catch (Exception e) {
if(tx!=null){
tx.rollback();
}
if(tx1!=null){
tx1.rollback();
}
// TODO: handle exception
System.out.println("批量处理出错"+e);
message="批量处理出错,原因"+e;
return null;
}finally{
WsbzEntityManagerHelper.closeEntityManager();
em.close();
}
message="批量处理完成";
setYwlx("1");
setZt("3");
return jdList();
}
/**
* 根据机构代码 和审核类型获取 审核处理的数据
*
* @param em
* @param jgdm
* @param type
* @return
*/
protected TSpdmtemp getSpdm(EntityManager em, String jgdm, String type) {
String nameQuery = "select model from TSp model where model.jgdm='" + jgdm + "' and model.ywlx = '" + type + "' and model.flag='1' ";
List<TSp> sps = em.createQuery(nameQuery).getResultList();
if (sps == null || sps.isEmpty() || sps.size() > 1) {
return null;
}
TSp sp = sps.get(0);
if ("1".equals(sp.getShflag().trim())) {
audit = true;
} else {
audit = false;
}
shyj = sp.getShreason();
shresult = sp.getShflag().trim();
TSpdmtemp spdm = em.find(TSpdmtemp.class, sps.get(0).getGllsh());
return spdm;
}
private void addrw(EntityManager em, SmTaskType type) {
User user = (User) session.get("sysUser");
List<TSmrw> rws = em.createQuery("select model from TSmrw model where model.type=?1 and model.createTime >= ?2 and model.jgdm=?3 ")
.setParameter(1, type.getValue().toString())
.setParameter(2, DateUtil.strToDate(DateUtil.dateToStr(new Date())))
.setParameter(3, jgdm.getJgdm()).getResultList();
if (rws.isEmpty() || rws.size() <= 0) {
TSmrw task = new TSmrw();
BeanUtilsEx.copyProperties(task, jgdm);
task.setId(null);
task.setCreateTime(new Date());
task.setStatus(false);
task.setType(type.getValue().toString());
task.setCzr(user.getUserName());
em.persist(task);
}
/* if (InitSysParams.system.getQzsm() == null || !InitSysParams.system.getQzsm()) {
} else {
List<TQzsm> rws = em.createQuery("select model from TQzsm model where model.type=?1 and model.createTime >= ?2 and model.jgdm=?3 ").setParameter(1, type.getValue().toString())
.setParameter(2, DateUtil.strToDate(DateUtil.dateToStr(new Date())))
.setParameter(3, jgdm.getJgdm()).getResultList();
if (!rws.isEmpty() && rws.size() > 0) {
TQzsm qzsm = rws.get(0);
makeDfile(em, qzsm);
}
}*/
}
/**
* 清楚对应的 不需要的审核信息
*
* @param em
* @param jgdm
* @param ywlx
*/
protected void deleteSp(EntityManager em, String jgdm, String ywlx) {
em.createQuery("delete from TSpdmtemp where lsh in (select model.gllsh from TSp model where model.jgdm=:jgdm and (model.ywlx =:ywlx or (model.flag='1' and model.shflag <> '1')))")
.setParameter("jgdm", jgdm).setParameter("ywlx", ywlx).executeUpdate();
em.createQuery("update TSp model set model.flag='2' where model.jgdm=:jgdm and (model.ywlx =:ywlx or (model.flag='1' and model.shflag <> '1'))")
.setParameter("jgdm", jgdm).setParameter("ywlx", ywlx).executeUpdate();
}
protected boolean addCzjl(EntityManager em, TJgdm jgdm, String memo, String type, Long lsh) {
TCzjl czjl = new TCzjl();
User user = (User) session.get("sysUser");
czjl.setJgdm(jgdm.getJgdm());
czjl.setMemo(memo);
czjl.setName(user.getUserName());
czjl.setType(type);
czjl.setDate(new Date());
czjl.setXzqh(user.getBzjgdm());
if (lsh != null)
czjl.setKlsh(lsh);
try {
em.persist(czjl);
} catch (EnumConstantNotPresentException e) {
return false;
}
return true;
}
public String xbJd(){
//网上业务新办
if("0".equals(ywlx)){
jgdmSave = wsbzBus.findById(Integer.parseInt(id));
currentPath = "/product/jsp/online/addinfomationOnline.jsp";
/* //如果是申请表修改,并且需要重名审核并通过,需要从审核表中调用数据
TSpdmtemp spdm = new TSpdmtempBus().getSpdm(id, "'10','11','15'");
if (spdm != null) {
currentPath = "/product/jsp/certificate/updateEnterInfoView.jsp";
jgdmSave = saveBus.findById(Integer.valueOf(id));
BeanCopier copier = BeanCopier.create(TSpdmtemp.class, TJgdmSave.class, false);
copier.copy(spdm, jgdmSave, null);
String ywType = "10";
List<TSp> sps = tSpBus.getTspList("", ywType);
if (sps != null && !sps.isEmpty()) {
shyj = sps.get(0).getShreason();
shresult = sps.get(0).getShflag().trim();
}
audit = true;
needAudit = false;
} else{
jgdmSave = wsbzBus.findById(Integer.parseInt(id));
currentPath = "/product/jsp/online/addinfomationOnline.jsp";
}
*/
}
return this.SUCCESS;
}
/**
* 新办审批
*/
public String xbSp(){
//首次新办
if("0".equals(ywlx)){
currentPath = "/product/jsp/online/xbSp.jsp";
}
//年检
if("1".equals(ywlx)){
currentPath = "/product/jsp/online/njSp.jsp";
wjgdm = tjgdmBus.findById(dm);
jgdm=tjgdmBus.findById(dm);
//wjgdm=jgdm;
//setJgdm(wjgdm);
}
//变更
if("2".equals(ywlx)){
currentPath = "/product/jsp/online/bgSp.jsp";
}
//换证
if("3".equals(ywlx)){
currentPath = "/product/jsp/online/hzSp.jsp";
}
getStatus();
infos = onlineBus.getXbclInfo(id);
wxb = onlineBus.getWxb(id);
if(wxb!=null){
String jflyName = onlineBus.getJflyName(wxb.getJfly());
wxb.setJfly(jflyName);
}
if(jgdm==null){
jgdm = new TJgdm();
jgdm.setZbsl(1);
}
if(wxb!=null){
if(wxb.getFksl()>0){
jgdm.setFkbz("1");
}else
jgdm.setFkbz("0");
}
BeanCopier beanCopier = BeanCopier.create(WXb.class,TJgdm.class,false);
beanCopier.copy(wxb,jgdm,null);
jgdm.setNnjjhy(wxb.getJjhy());
jgdm.setZgmc(wxb.getZgjgmc());
jgdm.setJjhy("");
return this.SUCCESS;
}
private void getStatus() {
if(opt.equals("qzsp")){
pstate = "3";
npstate = "0";
}else{
pstate = "3";
npstate = "2";
}
}
public String spNote(){
HttpServletRequest request = ServletActionContext.getRequest();
url = request.getRequestURI();
if (request.getQueryString() != null) {
url = url + "?" + request.getQueryString();
}
currentPath = "/product/jsp/online/spNote.jsp";
User user = (User) session.get("sysUser");
String userName = user.getUserName();
txnrList = onlineBus.getTxnrList(userName);
if("4".equals(ywlx)){
djhs = (List<String>)session.get("djhs");
String strDjh = "";
if(djhs!=null&&djhs.size()>0){
for(String djh:djhs){
strDjh += djh.trim()+";";
}
strDjh = strDjh.substring(0, strDjh.length() - 1);
}
onLineVO = new TjgdmOnLineVO();
onLineVO.setDjh(strDjh);
}
session.put("onLineVO",onLineVO);
String jgdmmc="";
if("4".equals(ywlx)||"5".equals(ywlx)||"6".equals(ywlx)){
jgdmmc=onlineBus.getWxbMc(dm);
}else{
WXb wxb2 = onlineBus.getWxb(request.getParameter("id"));
jgdmmc=wxb2.getJgmc();
}
ActionContext.getContext().put("jgdmmc", jgdmmc);
return this.SUCCESS;
}
public String spNoteView(){
currentPath = "/product/jsp/online/spNoteView.jsp";
String[] strs = onlineBus.getNoteView(dm,ywlx);
if(strs!=null&&strs.length>0){
txbt = strs[0];
txnr = strs[1];
}else{
txbt = "";
txnr = "无提醒内容";
}
return this.SUCCESS;
}
public String spNoteHandle(){
currentPath = "/product/jsp/online/spNotePrompt.jsp";
User user = (User) session.get("sysUser");
String userName = user.getUserName();
if("save".equals(fn)){
boolean flag = onlineBus.saveSpNote(txbt, txnr, userName);
if(flag){
message = "添加成功!";
}else
message = "添加失败!";
currentPath=url;
return SUCCESS;
}else if("delete".equals(fn)){
boolean flag = onlineBus.delSpNote(txbt, userName);
if(flag){
message = "删除成功!";
}else
message = "删除失败!提醒内容为上级机构设置";
currentPath=url;
return SUCCESS;
}else{
if(clsStringTool.isEmpty(id)){
message = "非法请求参数,请重新登录!";
}else{
boolean flag = false;
if("0".equals(ywlx)){
flag = onlineBus.updateXB(id,state,session);
message = "新办审核成功!";
}
if("1".equals(ywlx)){
flag = onlineBus.updateNJ(id,state,dm,session);
message = "年检审核成功!";
}
if("2".equals(ywlx)){
flag = onlineBus.updateBG(id,state,dm,session);
message = "变更审核成功!";
}
if("3".equals(ywlx)){
flag = onlineBus.updateHZ(id,state,dm,session);
message = "换证审核成功!";
}
if("4".equals(ywlx)){
flag = onlineBus.updateGS(id,state,dm,session);
message = "挂失审核成功!";
}
if("5".equals(ywlx)){
flag = onlineBus.updateBA(id,state,dm,session);
message = "备案审核成功!";
}
if("6".equals(ywlx)){
flag = onlineBus.updateZX(id,state,dm,session);
message = "注销审核成功!";
}
if(flag){
boolean updateFlag = onlineBus.updateData(tjr,dm,txbt,txnr,opt,userName);
}
if("qzsp".equals(opt)&& "2".equals(state) || "0".equals(state)){
zt = "1";
}else if("3".equals(state) || (!"qzsp".equals(opt))&&"2".equals(state)){
zt = "5";
}
currentPath = "/product/jsp/online/auditSuccess.jsp";
}
}
return this.SUCCESS;
}
public String getCurrentPath() {
return currentPath;
}
public void setCurrentPath(String currentPath) {
this.currentPath = currentPath;
}
public String getDm() {
return dm;
}
public void setDm(String dm) {
this.dm = dm;
}
public String getYwlx() {
return ywlx;
}
public void setYwlx(String ywlx) {
this.ywlx = ywlx;
}
public String getZt() {
return zt;
}
public void setZt(String zt) {
this.zt = zt;
}
public String getOpt() {
return opt;
}
public void setOpt(String opt) {
this.opt = opt;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public List<OnLineVO> getList() {
return list;
}
public void setList(List<OnLineVO> list) {
this.list = list;
}
public Integer getPageno() {
return pageno;
}
public void setPageno(Integer pageno) {
this.pageno = pageno;
}
public Integer getRowNumsView() {
return rowNumsView;
}
public void setRowNumsView(Integer rowNumsView) {
this.rowNumsView = rowNumsView;
}
public clsPageComponent getPages() {
return pages;
}
public void setPages(clsPageComponent pages) {
this.pages = pages;
}
public TJgdm getJgdm() {
return jgdm;
}
public void setJgdm(TJgdm jgdm) {
this.jgdm = jgdm;
}
public List<String> getDjhs() {
return djhs;
}
public void setDjhs(List<String> djhs) {
this.djhs = djhs;
}
public String getPrompt() {
return prompt;
}
public void setPrompt(String prompt) {
this.prompt = prompt;
}
public String getPstate() {
return pstate;
}
public void setPstate(String pstate) {
this.pstate = pstate;
}
public String getNpstate() {
return npstate;
}
public void setNpstate(String npstate) {
this.npstate = npstate;
}
public String[] getInfos() {
return infos;
}
public void setInfos(String[] infos) {
this.infos = infos;
}
public List<Wgs> getWgsList() {
return wgsList;
}
public void setWgsList(List<Wgs> wgsList) {
this.wgsList = wgsList;
}
public Wgs getWgs() {
return wgs;
}
public void setWgs(Wgs wgs) {
this.wgs = wgs;
}
public Wba getWba() {
return wba;
}
public void setWba(Wba wba) {
this.wba = wba;
}
public Wzx getWzx() {
return wzx;
}
public void setWzx(Wzx wzx) {
this.wzx = wzx;
}
public WXb getWxb() {
return wxb;
}
public void setWxb(WXb wxb) {
this.wxb = wxb;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getTjr() {
return tjr;
}
public void setTjr(String tjr) {
this.tjr = tjr;
}
public List<TxnrVO> getTxnrList() {
return txnrList;
}
public void setTxnrList(List<TxnrVO> txnrList) {
this.txnrList = txnrList;
}
public TjgdmOnLineVO getOnLineVO() {
return onLineVO;
}
public void setOnLineVO(TjgdmOnLineVO onLineVO) {
this.onLineVO = onLineVO;
}
public String getTxbt() {
return txbt;
}
public void setTxbt(String txbt) {
this.txbt = txbt;
}
public String getTxnr() {
return txnr;
}
public void setTxnr(String txnr) {
this.txnr = txnr;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public TJgdmSave getJgdmSave() {
return jgdmSave;
}
public void setJgdmSave(TJgdmSave jgdmSave) {
this.jgdmSave = jgdmSave;
}
public Boolean getNeedAudit() {
return needAudit;
}
public void setNeedAudit(Boolean needAudit) {
this.needAudit = needAudit;
}
public Boolean getAudit() {
return audit;
}
public void setAudit(Boolean audit) {
this.audit = audit;
}
public String getShyj() {
return shyj;
}
public void setShyj(String shyj) {
this.shyj = shyj;
}
public String getShresult() {
return shresult;
}
public void setShresult(String shresult) {
this.shresult = shresult;
}
public String getDjh() {
return djh;
}
public void setDjh(String djh) {
this.djh = djh;
}
public void setJgmc(String jgmc) {
this.jgmc = jgmc;
}
public String getJgmc() {
return jgmc;
}
public Integer getBack() {
return back;
}
public void setBack(Integer back) {
this.back = back;
}
public List<Wzcyh> getWzcyhList() {
return wzcyhList;
}
public void setWzcyhList(List<Wzcyh> wzcyhList) {
this.wzcyhList = wzcyhList;
}
public Wzcyh getWzcyh() {
return wzcyh;
}
public void setWzcyh(Wzcyh wzcyh) {
this.wzcyh = wzcyh;
}
public List<Wnj> getWnjList() {
return wnjList;
}
public void setWnjList(List<Wnj> wnjList) {
this.wnjList = wnjList;
}
public Wnj getWnj() {
return wnj;
}
public void setWnj(Wnj wnj) {
this.wnj = wnj;
}
public String getFn() {
return fn;
}
public void setFn(String fn) {
this.fn = fn;
}
public TJgdm getWjgdm() {
return wjgdm;
}
public void setWjgdm(TJgdm wjgdm) {
this.wjgdm = wjgdm;
}
}
|
GB18030
|
Java
| 33,975 |
java
|
OnLinceAction.java
|
Java
|
[
{
"context": "il.Map;\n\n/**\n * Created by IntelliJ IDEA.\n * User: zhaoxun\n * Date: 13-5-22\n * Time: 下午1:27\n */\npublic class",
"end": 1281,
"score": 0.9996887445449829,
"start": 1274,
"tag": "USERNAME",
"value": "zhaoxun"
},
{
"context": "S;\n\n }\n \n /**\n * 网上业务修改分页列表页面\n * TengWuChao 2014-04-11\n * @return\n */\n public Stri",
"end": 6807,
"score": 0.9997129440307617,
"start": 6797,
"tag": "NAME",
"value": "TengWuChao"
},
{
"context": "sWord(wzcyh.getZcyhId());\n \tmessage=\"重置密码成功!密码为123456\";\n \treturn this.SUCCESS;\n \t\n }\n /**\n ",
"end": 7779,
"score": 0.9979691505432129,
"start": 7773,
"tag": "PASSWORD",
"value": "123456"
},
{
"context": "ESS;\n \t\n }\n /**\n * 跳转修改网上业务页面\n * TengWuChao 2014-04-11\n * @return\n */\n publi",
"end": 7858,
"score": 0.5748049020767212,
"start": 7854,
"tag": "NAME",
"value": "Teng"
},
{
"context": " this.SUCCESS;\n }\n /**\n * 修改网上数据\n * TengWuChao 2014-04-11\n * @return\n */\n pu",
"end": 8185,
"score": 0.6350815892219543,
"start": 8184,
"tag": "NAME",
"value": "T"
},
{
"context": "jdList(){\n User user = (User) session.get(\"sysUser\");\n if (pages == null)\n pages =",
"end": 10382,
"score": 0.667677104473114,
"start": 10375,
"tag": "USERNAME",
"value": "sysUser"
},
{
"context": "\n }\n /**\n * 年检批量通过\n * @return\n * Tengwuchao \n * 2014-07-04\n */\n public String chec",
"end": 11695,
"score": 0.9962867498397827,
"start": 11685,
"tag": "NAME",
"value": "Tengwuchao"
},
{
"context": "on.get(\"sysUser\");\n String userName = user.getUserName();\n txnrList = onlineBus.getTxnrList(userN",
"end": 23254,
"score": 0.8181647658348083,
"start": 23243,
"tag": "USERNAME",
"value": "getUserName"
},
{
"context": "mpt.jsp\";\n User user = (User) session.get(\"sysUser\");\n String userName = user.getUserName();\n",
"end": 24654,
"score": 0.9517980813980103,
"start": 24647,
"tag": "USERNAME",
"value": "sysUser"
}
] | null |
[] |
package com.ninemax.jpa.code.action;
import com.ninemax.jpa.code.bus.*;
import com.ninemax.jpa.code.model.*;
import com.ninemax.jpa.code.model.vo.*;
import com.ninemax.jpa.global.EntityManagerHelper;
import com.ninemax.jpa.global.InitSysParams;
import com.ninemax.jpa.global.WsbzEntityManagerHelper;
import com.ninemax.jpa.system.model.User;
import com.ninemax.jpa.util.ActionUtils;
import com.ninemax.jpa.util.BeanUtilsEx;
import com.ninemax.jpa.util.DateUtil;
import com.ninemax.jpa.util.clsPageComponent;
import com.ninemax.jpa.util.clsStringTool;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import net.sf.cglib.beans.BeanCopier;
import nl.justobjects.pushlet.util.Log;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.interceptor.SessionAware;
import javax.persistence.EntityManager;
import javax.persistence.EntityTransaction;
import javax.servlet.http.HttpServletRequest;
import java.sql.SQLException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by IntelliJ IDEA.
* User: zhaoxun
* Date: 13-5-22
* Time: 下午1:27
*/
public class OnLinceAction extends ActionSupport implements SessionAware{
private Map<String, Object> session;
private String currentPath = "";
private String dm;
private String ywlx;
private String zt;
private String id;
private List<OnLineVO> list;
private List<Wnj> wnjList;
private List<Wgs> wgsList;
private List<Wzcyh> wzcyhList;
private String pstate = "";
private String npstate = "";
private String state;
private String tjr;
private String txnr;
private String txbt;
private String message;
private String url;
private String type;
private TJgdmSave jgdmSave;
private Wnj wnj;
//登记号列表
private List<String> djhs;
//提醒列表
private List<TxnrVO> txnrList;
private TJgdm jgdm;
private TJgdm wjgdm;
private TjgdmOnLineVO onLineVO;
private Wgs wgs;
private Wba wba;
private Wzx wzx;
private WXb wxb;
private Wzcyh wzcyh;
private String djh;
private Boolean needAudit;
//是否已经审核
private Boolean audit;
//审核依据
protected String shyj;
//审核结果
protected String shresult;
//提示信息
private String prompt;
//新办处理
private String[] infos;
//分页数据
private clsPageComponent pages;
private Integer rowNumsView = 20;
private Integer pageno = 1;
//业务类
private OnlineBus onlineBus;
private TjgdmBus tjgdmBus;
private WsbzXbBus wsbzBus;
private TJgdmSaveBus saveBus;
private TSpBus tSpBus;
private String jgmc;
private Integer back;
private String fn;
public OnLinceAction() {
onlineBus = new OnlineBus();
tjgdmBus = new TjgdmBus();
wsbzBus = new WsbzXbBus();
saveBus = new TJgdmSaveBus();
tSpBus = new TSpBus();
}
//前置审批or申报表审批
private String opt;
public Map<String, Object> getSession() {
return session;
}
public void setSession(Map<String, Object> session) {
this.session = session;
}
public String choose() {
currentPath = "/product/jsp/online/SP100100.jsp";
return this.SUCCESS;
}
public String jdChoose() {
currentPath = "/product/jsp/online/SP100101.jsp";
return this.SUCCESS;
}
public String list(){
User user = (User) session.get("sysUser");
if (pages == null)
pages = new clsPageComponent();
currentPath = "/product/jsp/online/SPQuerylist_new.jsp";
//4 挂失业务 5备案业务 6注销 其它 新办里面的业务
if("4".equals(ywlx)){
list = onlineBus.getGsList(dm,user,zt,pageno, rowNumsView, pages);
}else if("5".equals(ywlx)){
list = onlineBus.getBaList(dm,user,zt,pageno, rowNumsView, pages);
}else if("6".equals(ywlx)){
list = onlineBus.getZxList(dm,user,zt,pageno, rowNumsView, pages);
}else{
list = onlineBus.getXbList(dm,user,zt,ywlx,pageno, rowNumsView, pages);
}
return this.SUCCESS;
}
/**
* 年度申报
* @return
*/
public String nbList(){
User user = (User) session.get("sysUser");
if (pages == null)
pages = new clsPageComponent();
currentPath = "/product/jsp/online/SPnbQuerylist_new.jsp";
wnjList = onlineBus.getNjList(dm,user,zt,pageno, rowNumsView, pages);
return this.SUCCESS;
}
/**
* 处理年度申报
* @return
*/
public String nbUpdate(){
message="年度申报更新成功!";
User user = (User) session.get("sysUser");
if (pages == null)
pages = new clsPageComponent();
currentPath = "/product/jsp/online/success.jsp";
TZrxzqh zrxzqh = InitSysParams.zrxzqhMap2.get(user.getBzjgdm().trim());
// 1是定期年检 0是办证日期加一年
String dateLimit = "";
if (zrxzqh != null) {
if ("0".equals(zrxzqh.getNjfs())) {
dateLimit = DateUtil.addMonth(DateUtil.dateToStr(new Date()), 12);
} else {
dateLimit = DateUtil.addMonth(DateUtil.getCurrentDateTime().substring(0, 4) + "-" + zrxzqh.getNjjzrq().substring(0, 2) + "-" + zrxzqh.getNjjzrq().substring(2), 12);
}
}
Date uDate=clsStringTool.getStringDate(dateLimit);
onlineBus.nbUpdate(dm,id,uDate);
return this.SUCCESS;
}
public String ndbg_print() throws SQLException {
currentPath = "/product/jsp/online/ndbg_print.jsp";
TjgdmBus bus=new TjgdmBus();
OnlineBus online=new OnlineBus();
jgdm=bus.findById(dm);
wnj=online.getNj(id);
Calendar calendar = Calendar.getInstance();
Calendar calendar2 = Calendar.getInstance();
Calendar calendar3 = Calendar.getInstance();
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
calendar2.setTime(jgdm.getZfrq());
calendar2.add(Calendar.DAY_OF_YEAR, -30);
calendar3.add(Calendar.YEAR,1);
if (calendar.getTime().after(calendar2.getTime())) {
message="您应于Y年X月到代码窗口办理换证".replace("X", calendar2.get(calendar.MONTH)+2 + "").replace("Y", calendar2.get(Calendar.YEAR) + "");
//isPrint = false;
}else{
calendar3.setTime(jgdm.getNjqx());
message="您应于Y年12月31日前进行年度报告".replace("Y", calendar3.get(Calendar.YEAR)+1 + "");
}
return this.SUCCESS;
}
/**
* 网上业务修改分页列表页面
* TengWuChao 2014-04-11
* @return
*/
public String wsywList(){
User user = (User) session.get("sysUser");
if (pages == null)
pages = new clsPageComponent();
currentPath = "/product/jsp/online/wsywList.jsp";
//4 挂失业务 5备案业务 6注销 其它 新办里面的业务
list = onlineBus.getWsywList(jgmc,user,"1",ywlx,pageno, rowNumsView, pages);
return this.SUCCESS;
}
/**
* 重置密码
*/
public String initPassWord(){
User user = (User) session.get("sysUser");
if (pages == null)
pages = new clsPageComponent();
currentPath = "/product/jsp/online/PasswordList.jsp";
//4 挂失业务 5备案业务 6注销 其它 新办里面的业务
wzcyhList = onlineBus.initPassWord(jgmc, user, dm, ywlx, pageno, rowNumsView, pages);
return this.SUCCESS;
}
public String createPassWord(){
currentPath = "/bsweb/onLine_initPassWord.action";
onlineBus.createPassWord(wzcyh.getZcyhId());
message="重置密码成功!密码为<PASSWORD>";
return this.SUCCESS;
}
/**
* 跳转修改网上业务页面
* TengWuChao 2014-04-11
* @return
*/
public String toWsywUpdate(){
currentPath = "/product/jsp/online/wsywUpdate.jsp";
WXb xb = onlineBus.getWxb(id);
ActionContext.getContext().put("jgdm",xb );
// BeanUtilsEx.copyProperties(jgdm,xb);
return this.SUCCESS;
}
/**
* 修改网上数据
* TengWuChao 2014-04-11
* @return
*/
public String wsywUpdate(){
EntityManager em = WsbzEntityManagerHelper.getEntityManager();
currentPath = "/product/jsp/online/wsywList.jsp";
EntityTransaction tx = null;
try{
if(wxb==null){
wxb=new WXb();
}
tx = em.getTransaction();
tx.begin();
BeanUtilsEx.copyProperties(wxb, jgdm);
wxb.setId(Integer.valueOf(id));
wxb.setDjh(djh);
wxb.setZt(zt);
em.merge(wxb);
// em.flush();
tx.commit();
ActionContext.getContext().put("message", "修改网上数据成功!");
} catch (Exception e) {
currentPath = "/product/jsp/online/wsywUpdate.jsp";
ActionContext.getContext().put("message", "修改网上数据失败!");
if (tx != null && tx.isActive()) {
tx.rollback();
}
} finally {
WsbzEntityManagerHelper.closeEntityManager();
}
return wsywList();
}
/**
* 挂失审批
* @return
*/
public String gsSp(){
currentPath = "/product/jsp/online/gsSp.jsp";
getStatus();
jgdm = tjgdmBus.findById(dm);
djhs = onlineBus.getDjhs(dm);
session.put("djhs", djhs);
if(djhs==null){
currentPath = "/product/jsp/online/prompt.jsp";
prompt = "机构代码("+dm+")无网上预约挂失的证书,无法进行证书确认挂失操作!";
}
infos = onlineBus.getXbclInfo(id);
wgs = onlineBus.getWgs(id);
return this.SUCCESS;
}
/**
* 备案审批
* @return
*/
public String baSp(){
currentPath = "/product/jsp/online/baSp.jsp";
getStatus();
jgdm = tjgdmBus.findById(dm);
infos = onlineBus.getXbclInfo(id);
wba = onlineBus.getWba(id);
return this.SUCCESS;
}
/**
* 注销审批
*/
public String zxSp(){
currentPath = "/product/jsp/online/zxSp.jsp";
getStatus();
jgdm = tjgdmBus.findById(dm);
// infos = onlineBus.getXbclInfo(id);
infos = onlineBus.getZxclInfo(dm);
wzx = onlineBus.getWzx(id);
return this.SUCCESS;
}
public String jdList(){
User user = (User) session.get("sysUser");
if (pages == null)
pages = new clsPageComponent();
currentPath = "/product/jsp/online/JDQuerylist_new.jsp";
//4 挂失业务 5备案业务 6注销 其它 新办里面的业务
if("4".equals(ywlx)){
zt = "3";
list = onlineBus.getGsList(dm,user,zt,pageno, rowNumsView, pages);
}else if("5".equals(ywlx)){
zt = "2";
list = onlineBus.getBaList(dm,user,zt,pageno, rowNumsView, pages);
}else if("6".equals(ywlx)){
zt = "3";
list = onlineBus.getZxList(dm,user,zt,pageno, rowNumsView, pages);
}else if("0".equals(ywlx)){
List<OnLineVO> xbs = onlineBus.getXbList(dm,user,zt,ywlx,pageno, rowNumsView, pages);
if(xbs!=null && xbs.size()>0){
list = new ArrayList<OnLineVO>(xbs.size());
for(OnLineVO vo : xbs){
if(wsbzBus.isWsyw(vo.getDjh(),ywlx)){
vo.setFlag("1");
}else{
vo.setFlag("0");
}
list.add(vo);
}
}
}else{
list = onlineBus.getXbList(dm,user,zt,ywlx,pageno, rowNumsView, pages);
}
return this.SUCCESS;
}
/**
* 年检批量通过
* @return
* Tengwuchao
* 2014-07-04
*/
public String checkAll(){
User user = (User) session.get("sysUser");
EntityManager em = EntityManagerHelper.getEntityManager();
EntityManager checkem = WsbzEntityManagerHelper.getEntityManager();
EntityTransaction tx = em.getTransaction();
EntityTransaction tx1 = checkem.getTransaction();
try {
tx1.begin();
String strsql = "from WXb where zt = '3' and lb = '1' "+((user.getUserName()!=null && user.getUserName().contains("admin"))?"":" and bzjgdm = '"+user.getBzjgdm()+"' ");
List<WXb> list=checkem.createQuery(strsql).getResultList();
checkem.createNativeQuery("update w_xb set w_xb_zt='4' where w_xb_zt = '3'"+((user.getUserName()!=null && user.getUserName().contains("admin"))?"":" and w_xb_bzjgdm = '"+user.getBzjgdm()+"' ")).executeUpdate();
if(list!=null&&list.size()>0){
for (WXb xb : list) {
tx.begin();
jgdm = em.find(TJgdm.class, xb.getJgdm());
///////////////
TBgk bgk = new TBgk();
BeanUtilsEx.copyProperties(bgk, jgdm);
bgk.setBgsj(new Date());
em.persist(bgk);
BeanUtilsEx.copyProperties(jgdm,xb);
jgdm.setNjrq(new Date());
jgdm.setLastdate(new Date());
jgdm.setBgrq(new Date());
jgdm.setNjr(user.getUserName());
jgdm.setNnjjhy(xb.getJjhy());
jgdm.setZgmc(xb.getZgjgmc());
jgdm.setJjhy("");
if(jgdm.getFksl()!=null && jgdm.getFksl()>0){
jgdm.setFkbz("1");
}else{
jgdm.setFkbz("0");
}
String jflyName = new OnlineBus().getJflyName(jgdm.getJfly());
jgdm.setJfly(jflyName);
if(jgdm.getEmail()!=null&&jgdm.getEmail().equals("null")){
jgdm.setEmail(null);
}
//jgdm.setZfrq(t2.getZfrq());jgdm.setBzrq(t2.getBzrq());
TZrxzqh xzqh = em.find(TZrxzqh.class, user.getBzjgdm());
em.clear();
Date real;
if (xzqh.getNjfs().equals("0")) {
real = DateUtil.yearAfter(jgdm.getNjrq() == null ? new Date() : jgdm.getNjrq(), 1);
jgdm.setNjqx(real);
} else {
Date date = DateUtil.strToDate(Calendar.getInstance().get(Calendar.YEAR) + "-" + xzqh.getNjqsrq().substring(0, 2) + "-" + xzqh.getNjqsrq().substring(2, 4));
if (date.after(new Date())) {
jgdm.setNjqx(DateUtil.strToDate(Calendar.getInstance().get(Calendar.YEAR) + "-" + xzqh.getNjjzrq().substring(0, 2) + "-" + xzqh.getNjjzrq().substring(2, 4)));
} else {
jgdm.setNjqx(DateUtil.strToDate((Calendar.getInstance().get(Calendar.YEAR) + 1) + "-" + xzqh.getNjjzrq().substring(0, 2) + "-" + xzqh.getNjjzrq().substring(2, 4)));
}
}
if (!InitSysParams.njjhyMap.containsKey(jgdm.getNjjhy())) {
message = "输入的经济行业不存在与码表中,请更正!";
}
em.merge(jgdm);
if(InitSysParams.system.getNjSmTask()){
addrw(em,SmTaskType.年检);
}
addCzjl(em, jgdm, "年检", "6", null);
//deleteSp(em, jgdm.getJgdm(), "12");
////////////////
tx.commit();
em.clear();
}
}
tx1.commit();
//tx1.commit();
} catch (Exception e) {
if(tx!=null){
tx.rollback();
}
if(tx1!=null){
tx1.rollback();
}
// TODO: handle exception
System.out.println("批量处理出错"+e);
message="批量处理出错,原因"+e;
return null;
}finally{
WsbzEntityManagerHelper.closeEntityManager();
em.close();
}
message="批量处理完成";
setYwlx("1");
setZt("3");
return jdList();
}
/**
* 根据机构代码 和审核类型获取 审核处理的数据
*
* @param em
* @param jgdm
* @param type
* @return
*/
protected TSpdmtemp getSpdm(EntityManager em, String jgdm, String type) {
String nameQuery = "select model from TSp model where model.jgdm='" + jgdm + "' and model.ywlx = '" + type + "' and model.flag='1' ";
List<TSp> sps = em.createQuery(nameQuery).getResultList();
if (sps == null || sps.isEmpty() || sps.size() > 1) {
return null;
}
TSp sp = sps.get(0);
if ("1".equals(sp.getShflag().trim())) {
audit = true;
} else {
audit = false;
}
shyj = sp.getShreason();
shresult = sp.getShflag().trim();
TSpdmtemp spdm = em.find(TSpdmtemp.class, sps.get(0).getGllsh());
return spdm;
}
private void addrw(EntityManager em, SmTaskType type) {
User user = (User) session.get("sysUser");
List<TSmrw> rws = em.createQuery("select model from TSmrw model where model.type=?1 and model.createTime >= ?2 and model.jgdm=?3 ")
.setParameter(1, type.getValue().toString())
.setParameter(2, DateUtil.strToDate(DateUtil.dateToStr(new Date())))
.setParameter(3, jgdm.getJgdm()).getResultList();
if (rws.isEmpty() || rws.size() <= 0) {
TSmrw task = new TSmrw();
BeanUtilsEx.copyProperties(task, jgdm);
task.setId(null);
task.setCreateTime(new Date());
task.setStatus(false);
task.setType(type.getValue().toString());
task.setCzr(user.getUserName());
em.persist(task);
}
/* if (InitSysParams.system.getQzsm() == null || !InitSysParams.system.getQzsm()) {
} else {
List<TQzsm> rws = em.createQuery("select model from TQzsm model where model.type=?1 and model.createTime >= ?2 and model.jgdm=?3 ").setParameter(1, type.getValue().toString())
.setParameter(2, DateUtil.strToDate(DateUtil.dateToStr(new Date())))
.setParameter(3, jgdm.getJgdm()).getResultList();
if (!rws.isEmpty() && rws.size() > 0) {
TQzsm qzsm = rws.get(0);
makeDfile(em, qzsm);
}
}*/
}
/**
* 清楚对应的 不需要的审核信息
*
* @param em
* @param jgdm
* @param ywlx
*/
protected void deleteSp(EntityManager em, String jgdm, String ywlx) {
em.createQuery("delete from TSpdmtemp where lsh in (select model.gllsh from TSp model where model.jgdm=:jgdm and (model.ywlx =:ywlx or (model.flag='1' and model.shflag <> '1')))")
.setParameter("jgdm", jgdm).setParameter("ywlx", ywlx).executeUpdate();
em.createQuery("update TSp model set model.flag='2' where model.jgdm=:jgdm and (model.ywlx =:ywlx or (model.flag='1' and model.shflag <> '1'))")
.setParameter("jgdm", jgdm).setParameter("ywlx", ywlx).executeUpdate();
}
protected boolean addCzjl(EntityManager em, TJgdm jgdm, String memo, String type, Long lsh) {
TCzjl czjl = new TCzjl();
User user = (User) session.get("sysUser");
czjl.setJgdm(jgdm.getJgdm());
czjl.setMemo(memo);
czjl.setName(user.getUserName());
czjl.setType(type);
czjl.setDate(new Date());
czjl.setXzqh(user.getBzjgdm());
if (lsh != null)
czjl.setKlsh(lsh);
try {
em.persist(czjl);
} catch (EnumConstantNotPresentException e) {
return false;
}
return true;
}
public String xbJd(){
//网上业务新办
if("0".equals(ywlx)){
jgdmSave = wsbzBus.findById(Integer.parseInt(id));
currentPath = "/product/jsp/online/addinfomationOnline.jsp";
/* //如果是申请表修改,并且需要重名审核并通过,需要从审核表中调用数据
TSpdmtemp spdm = new TSpdmtempBus().getSpdm(id, "'10','11','15'");
if (spdm != null) {
currentPath = "/product/jsp/certificate/updateEnterInfoView.jsp";
jgdmSave = saveBus.findById(Integer.valueOf(id));
BeanCopier copier = BeanCopier.create(TSpdmtemp.class, TJgdmSave.class, false);
copier.copy(spdm, jgdmSave, null);
String ywType = "10";
List<TSp> sps = tSpBus.getTspList("", ywType);
if (sps != null && !sps.isEmpty()) {
shyj = sps.get(0).getShreason();
shresult = sps.get(0).getShflag().trim();
}
audit = true;
needAudit = false;
} else{
jgdmSave = wsbzBus.findById(Integer.parseInt(id));
currentPath = "/product/jsp/online/addinfomationOnline.jsp";
}
*/
}
return this.SUCCESS;
}
/**
* 新办审批
*/
public String xbSp(){
//首次新办
if("0".equals(ywlx)){
currentPath = "/product/jsp/online/xbSp.jsp";
}
//年检
if("1".equals(ywlx)){
currentPath = "/product/jsp/online/njSp.jsp";
wjgdm = tjgdmBus.findById(dm);
jgdm=tjgdmBus.findById(dm);
//wjgdm=jgdm;
//setJgdm(wjgdm);
}
//变更
if("2".equals(ywlx)){
currentPath = "/product/jsp/online/bgSp.jsp";
}
//换证
if("3".equals(ywlx)){
currentPath = "/product/jsp/online/hzSp.jsp";
}
getStatus();
infos = onlineBus.getXbclInfo(id);
wxb = onlineBus.getWxb(id);
if(wxb!=null){
String jflyName = onlineBus.getJflyName(wxb.getJfly());
wxb.setJfly(jflyName);
}
if(jgdm==null){
jgdm = new TJgdm();
jgdm.setZbsl(1);
}
if(wxb!=null){
if(wxb.getFksl()>0){
jgdm.setFkbz("1");
}else
jgdm.setFkbz("0");
}
BeanCopier beanCopier = BeanCopier.create(WXb.class,TJgdm.class,false);
beanCopier.copy(wxb,jgdm,null);
jgdm.setNnjjhy(wxb.getJjhy());
jgdm.setZgmc(wxb.getZgjgmc());
jgdm.setJjhy("");
return this.SUCCESS;
}
private void getStatus() {
if(opt.equals("qzsp")){
pstate = "3";
npstate = "0";
}else{
pstate = "3";
npstate = "2";
}
}
public String spNote(){
HttpServletRequest request = ServletActionContext.getRequest();
url = request.getRequestURI();
if (request.getQueryString() != null) {
url = url + "?" + request.getQueryString();
}
currentPath = "/product/jsp/online/spNote.jsp";
User user = (User) session.get("sysUser");
String userName = user.getUserName();
txnrList = onlineBus.getTxnrList(userName);
if("4".equals(ywlx)){
djhs = (List<String>)session.get("djhs");
String strDjh = "";
if(djhs!=null&&djhs.size()>0){
for(String djh:djhs){
strDjh += djh.trim()+";";
}
strDjh = strDjh.substring(0, strDjh.length() - 1);
}
onLineVO = new TjgdmOnLineVO();
onLineVO.setDjh(strDjh);
}
session.put("onLineVO",onLineVO);
String jgdmmc="";
if("4".equals(ywlx)||"5".equals(ywlx)||"6".equals(ywlx)){
jgdmmc=onlineBus.getWxbMc(dm);
}else{
WXb wxb2 = onlineBus.getWxb(request.getParameter("id"));
jgdmmc=wxb2.getJgmc();
}
ActionContext.getContext().put("jgdmmc", jgdmmc);
return this.SUCCESS;
}
public String spNoteView(){
currentPath = "/product/jsp/online/spNoteView.jsp";
String[] strs = onlineBus.getNoteView(dm,ywlx);
if(strs!=null&&strs.length>0){
txbt = strs[0];
txnr = strs[1];
}else{
txbt = "";
txnr = "无提醒内容";
}
return this.SUCCESS;
}
public String spNoteHandle(){
currentPath = "/product/jsp/online/spNotePrompt.jsp";
User user = (User) session.get("sysUser");
String userName = user.getUserName();
if("save".equals(fn)){
boolean flag = onlineBus.saveSpNote(txbt, txnr, userName);
if(flag){
message = "添加成功!";
}else
message = "添加失败!";
currentPath=url;
return SUCCESS;
}else if("delete".equals(fn)){
boolean flag = onlineBus.delSpNote(txbt, userName);
if(flag){
message = "删除成功!";
}else
message = "删除失败!提醒内容为上级机构设置";
currentPath=url;
return SUCCESS;
}else{
if(clsStringTool.isEmpty(id)){
message = "非法请求参数,请重新登录!";
}else{
boolean flag = false;
if("0".equals(ywlx)){
flag = onlineBus.updateXB(id,state,session);
message = "新办审核成功!";
}
if("1".equals(ywlx)){
flag = onlineBus.updateNJ(id,state,dm,session);
message = "年检审核成功!";
}
if("2".equals(ywlx)){
flag = onlineBus.updateBG(id,state,dm,session);
message = "变更审核成功!";
}
if("3".equals(ywlx)){
flag = onlineBus.updateHZ(id,state,dm,session);
message = "换证审核成功!";
}
if("4".equals(ywlx)){
flag = onlineBus.updateGS(id,state,dm,session);
message = "挂失审核成功!";
}
if("5".equals(ywlx)){
flag = onlineBus.updateBA(id,state,dm,session);
message = "备案审核成功!";
}
if("6".equals(ywlx)){
flag = onlineBus.updateZX(id,state,dm,session);
message = "注销审核成功!";
}
if(flag){
boolean updateFlag = onlineBus.updateData(tjr,dm,txbt,txnr,opt,userName);
}
if("qzsp".equals(opt)&& "2".equals(state) || "0".equals(state)){
zt = "1";
}else if("3".equals(state) || (!"qzsp".equals(opt))&&"2".equals(state)){
zt = "5";
}
currentPath = "/product/jsp/online/auditSuccess.jsp";
}
}
return this.SUCCESS;
}
public String getCurrentPath() {
return currentPath;
}
public void setCurrentPath(String currentPath) {
this.currentPath = currentPath;
}
public String getDm() {
return dm;
}
public void setDm(String dm) {
this.dm = dm;
}
public String getYwlx() {
return ywlx;
}
public void setYwlx(String ywlx) {
this.ywlx = ywlx;
}
public String getZt() {
return zt;
}
public void setZt(String zt) {
this.zt = zt;
}
public String getOpt() {
return opt;
}
public void setOpt(String opt) {
this.opt = opt;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public List<OnLineVO> getList() {
return list;
}
public void setList(List<OnLineVO> list) {
this.list = list;
}
public Integer getPageno() {
return pageno;
}
public void setPageno(Integer pageno) {
this.pageno = pageno;
}
public Integer getRowNumsView() {
return rowNumsView;
}
public void setRowNumsView(Integer rowNumsView) {
this.rowNumsView = rowNumsView;
}
public clsPageComponent getPages() {
return pages;
}
public void setPages(clsPageComponent pages) {
this.pages = pages;
}
public TJgdm getJgdm() {
return jgdm;
}
public void setJgdm(TJgdm jgdm) {
this.jgdm = jgdm;
}
public List<String> getDjhs() {
return djhs;
}
public void setDjhs(List<String> djhs) {
this.djhs = djhs;
}
public String getPrompt() {
return prompt;
}
public void setPrompt(String prompt) {
this.prompt = prompt;
}
public String getPstate() {
return pstate;
}
public void setPstate(String pstate) {
this.pstate = pstate;
}
public String getNpstate() {
return npstate;
}
public void setNpstate(String npstate) {
this.npstate = npstate;
}
public String[] getInfos() {
return infos;
}
public void setInfos(String[] infos) {
this.infos = infos;
}
public List<Wgs> getWgsList() {
return wgsList;
}
public void setWgsList(List<Wgs> wgsList) {
this.wgsList = wgsList;
}
public Wgs getWgs() {
return wgs;
}
public void setWgs(Wgs wgs) {
this.wgs = wgs;
}
public Wba getWba() {
return wba;
}
public void setWba(Wba wba) {
this.wba = wba;
}
public Wzx getWzx() {
return wzx;
}
public void setWzx(Wzx wzx) {
this.wzx = wzx;
}
public WXb getWxb() {
return wxb;
}
public void setWxb(WXb wxb) {
this.wxb = wxb;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getTjr() {
return tjr;
}
public void setTjr(String tjr) {
this.tjr = tjr;
}
public List<TxnrVO> getTxnrList() {
return txnrList;
}
public void setTxnrList(List<TxnrVO> txnrList) {
this.txnrList = txnrList;
}
public TjgdmOnLineVO getOnLineVO() {
return onLineVO;
}
public void setOnLineVO(TjgdmOnLineVO onLineVO) {
this.onLineVO = onLineVO;
}
public String getTxbt() {
return txbt;
}
public void setTxbt(String txbt) {
this.txbt = txbt;
}
public String getTxnr() {
return txnr;
}
public void setTxnr(String txnr) {
this.txnr = txnr;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public TJgdmSave getJgdmSave() {
return jgdmSave;
}
public void setJgdmSave(TJgdmSave jgdmSave) {
this.jgdmSave = jgdmSave;
}
public Boolean getNeedAudit() {
return needAudit;
}
public void setNeedAudit(Boolean needAudit) {
this.needAudit = needAudit;
}
public Boolean getAudit() {
return audit;
}
public void setAudit(Boolean audit) {
this.audit = audit;
}
public String getShyj() {
return shyj;
}
public void setShyj(String shyj) {
this.shyj = shyj;
}
public String getShresult() {
return shresult;
}
public void setShresult(String shresult) {
this.shresult = shresult;
}
public String getDjh() {
return djh;
}
public void setDjh(String djh) {
this.djh = djh;
}
public void setJgmc(String jgmc) {
this.jgmc = jgmc;
}
public String getJgmc() {
return jgmc;
}
public Integer getBack() {
return back;
}
public void setBack(Integer back) {
this.back = back;
}
public List<Wzcyh> getWzcyhList() {
return wzcyhList;
}
public void setWzcyhList(List<Wzcyh> wzcyhList) {
this.wzcyhList = wzcyhList;
}
public Wzcyh getWzcyh() {
return wzcyh;
}
public void setWzcyh(Wzcyh wzcyh) {
this.wzcyh = wzcyh;
}
public List<Wnj> getWnjList() {
return wnjList;
}
public void setWnjList(List<Wnj> wnjList) {
this.wnjList = wnjList;
}
public Wnj getWnj() {
return wnj;
}
public void setWnj(Wnj wnj) {
this.wnj = wnj;
}
public String getFn() {
return fn;
}
public void setFn(String fn) {
this.fn = fn;
}
public TJgdm getWjgdm() {
return wjgdm;
}
public void setWjgdm(TJgdm wjgdm) {
this.wjgdm = wjgdm;
}
}
| 33,979 | 0.534834 | 0.527797 | 1,169 | 27.204449 | 25.671715 | 227 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.893071 | false | false |
5
|
f1966ea4fcdc3dade0c90406f6f48eac477f299b
| 28,492,813,060,554 |
fba48da873e45f9fcb32c2a258e99dc162fda453
|
/src/main/java/TestObjects/StepDefinitions/FillAddressesInString.java
|
ffe107b894d44984b96c5c323f4cddfca37b7349
|
[] |
no_license
|
sa-brovin/nzpost_ui_tests
|
https://github.com/sa-brovin/nzpost_ui_tests
|
68958732ebaf489e6a98d60fed8e5610f34b7d28
|
ec863a351cc125a07d1f1b7622ff78a2e3a6d74e
|
refs/heads/master
| 2020-03-22T11:36:26.605000 | 2018-07-06T12:36:38 | 2018-07-06T12:36:38 | 139,982,278 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package TestObjects.StepDefinitions;
import TestObjects.Controls.AddressChecker;
import TestObjects.InteractionObjects.Hold.HoldAddressDetailsPage;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.When;
public class FillAddressesInString {
HoldAddressDetailsPage holdAddressDetailsPage = new HoldAddressDetailsPage();
String addressString = "";
@When("^Fill address field \"([^\"]*)\"$")
public void fill_address_field(String addressForInput) throws Throwable {
holdAddressDetailsPage.setFromDate("today + 5");
holdAddressDetailsPage.setRestartDate("today + 10");
holdAddressDetailsPage.setFirstEligibleAddress(addressForInput);
}
@When("^Fill address field \"([^\"]*)\" without confirm$")
public void fill_address_field_without_confirm(String addressForInput) throws Throwable {
holdAddressDetailsPage.setFromDate("today + 5");
holdAddressDetailsPage.setRestartDate("today + 10");
holdAddressDetailsPage.setAddressWithoutConfirm(addressForInput);
}
@When("^Fill address field with select \"([^\"]*)\" \"([^\"]*)\"$")
public void fill_address_field_with_select(String addressForInput, String addressForSelect) throws Throwable {
holdAddressDetailsPage.setFromDate("today + 5");
holdAddressDetailsPage.setRestartDate("today + 10");
holdAddressDetailsPage.setAddressWithoutConfirm(addressForInput);
new AddressChecker().selectAddressCheckerItem(addressForSelect);
}
@Given("^I have address strings \"([^\"]*)\" \"([^\"]*)\" \"([^\"]*)\" \"([^\"]*)\" \"([^\"]*)\"$")
public void i_have_address_strings(String line1, String line2, String line3, String line4, String line5) throws Throwable {
if (!line1.isEmpty())
addressString = String.format("%s", line1);
if (!line2.isEmpty())
addressString = String.format("%s, %s", addressString, line2);
if (!line3.isEmpty())
addressString = String.format("%s, %s", addressString, line3);
if (!line4.isEmpty())
addressString = String.format("%s, %s", addressString, line4);
if (!line5.isEmpty())
addressString = String.format("%s, %s", addressString, line5);
}
@When("^Fill address field with real address$")
public void fill_address_field_with_real_address() throws Throwable {
//holdAddressDetailsPage.setFromDate("today + 5");
//holdAddressDetailsPage.setRestartDate("today + 10");
holdAddressDetailsPage.setAddressWithoutConfirm(addressString);
}
}
|
UTF-8
|
Java
| 2,582 |
java
|
FillAddressesInString.java
|
Java
|
[] | null |
[] |
package TestObjects.StepDefinitions;
import TestObjects.Controls.AddressChecker;
import TestObjects.InteractionObjects.Hold.HoldAddressDetailsPage;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.When;
public class FillAddressesInString {
HoldAddressDetailsPage holdAddressDetailsPage = new HoldAddressDetailsPage();
String addressString = "";
@When("^Fill address field \"([^\"]*)\"$")
public void fill_address_field(String addressForInput) throws Throwable {
holdAddressDetailsPage.setFromDate("today + 5");
holdAddressDetailsPage.setRestartDate("today + 10");
holdAddressDetailsPage.setFirstEligibleAddress(addressForInput);
}
@When("^Fill address field \"([^\"]*)\" without confirm$")
public void fill_address_field_without_confirm(String addressForInput) throws Throwable {
holdAddressDetailsPage.setFromDate("today + 5");
holdAddressDetailsPage.setRestartDate("today + 10");
holdAddressDetailsPage.setAddressWithoutConfirm(addressForInput);
}
@When("^Fill address field with select \"([^\"]*)\" \"([^\"]*)\"$")
public void fill_address_field_with_select(String addressForInput, String addressForSelect) throws Throwable {
holdAddressDetailsPage.setFromDate("today + 5");
holdAddressDetailsPage.setRestartDate("today + 10");
holdAddressDetailsPage.setAddressWithoutConfirm(addressForInput);
new AddressChecker().selectAddressCheckerItem(addressForSelect);
}
@Given("^I have address strings \"([^\"]*)\" \"([^\"]*)\" \"([^\"]*)\" \"([^\"]*)\" \"([^\"]*)\"$")
public void i_have_address_strings(String line1, String line2, String line3, String line4, String line5) throws Throwable {
if (!line1.isEmpty())
addressString = String.format("%s", line1);
if (!line2.isEmpty())
addressString = String.format("%s, %s", addressString, line2);
if (!line3.isEmpty())
addressString = String.format("%s, %s", addressString, line3);
if (!line4.isEmpty())
addressString = String.format("%s, %s", addressString, line4);
if (!line5.isEmpty())
addressString = String.format("%s, %s", addressString, line5);
}
@When("^Fill address field with real address$")
public void fill_address_field_with_real_address() throws Throwable {
//holdAddressDetailsPage.setFromDate("today + 5");
//holdAddressDetailsPage.setRestartDate("today + 10");
holdAddressDetailsPage.setAddressWithoutConfirm(addressString);
}
}
| 2,582 | 0.675833 | 0.665376 | 55 | 45.945454 | 32.581322 | 127 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.781818 | false | false |
5
|
0aec4969cd3e799ebba87946ff4c7f748eab0189
| 18,605,798,355,208 |
93e0c60cfcaabee0499eb7bc41e91dfed0150794
|
/src/com/chap01/EuclidAlgo.java
|
e1cc597c41cd335e4d9f0eced2da819f99f5fb5c
|
[] |
no_license
|
naveenaju/Algorithms4
|
https://github.com/naveenaju/Algorithms4
|
329e4f5260baf5d5d8af269c0a4b6f59d4db9104
|
f6333ffd4c29991a581994381c1beaa04482ecf2
|
refs/heads/master
| 2021-05-24T02:58:32.088000 | 2017-04-05T14:17:19 | 2017-04-05T14:17:19 | 15,115,424 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.chap01;
public class EuclidAlgo {
public static int getGcd(int a, int b){
if(a==0 || b==0){
return 0;
}
if(b> a){
int temp = a;
a=b;
b=temp;
}
int remainder = a%b;
if(remainder == 0 ){
return b;
}
return getGcd(b, remainder);
}
public static void main(String[] args) {
System.out.println(getGcd(1071, 462));
System.out.println(getGcd(1234567,1111111));
}
}
|
UTF-8
|
Java
| 415 |
java
|
EuclidAlgo.java
|
Java
|
[] | null |
[] |
package com.chap01;
public class EuclidAlgo {
public static int getGcd(int a, int b){
if(a==0 || b==0){
return 0;
}
if(b> a){
int temp = a;
a=b;
b=temp;
}
int remainder = a%b;
if(remainder == 0 ){
return b;
}
return getGcd(b, remainder);
}
public static void main(String[] args) {
System.out.println(getGcd(1071, 462));
System.out.println(getGcd(1234567,1111111));
}
}
| 415 | 0.59759 | 0.53253 | 26 | 14.961538 | 14.205852 | 46 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.230769 | false | false |
5
|
be03c085f8a838d8172ccfaee3d9860de2c27f53
| 30,975,304,147,432 |
b6078bff90f09f88f7490f931dc4a1906ecf3df9
|
/src/main/java/proyectoAdministradorVuelos/service/VueloServiceImpl.java
|
bdcc23edf2bd4b956e1e8cf208e812f1bffab28c
|
[] |
no_license
|
ricardomgarciaf/ProyectoAdministradorVuelos
|
https://github.com/ricardomgarciaf/ProyectoAdministradorVuelos
|
4081f7acded4a2e1878dad7f1e39553a7f43a5e6
|
185a3dc9d7b1298bf0445f28791b3716ea84d888
|
refs/heads/master
| 2021-01-10T05:09:27.250000 | 2016-02-22T05:26:04 | 2016-02-22T05:26:04 | 52,248,753 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package proyectoAdministradorVuelos.service;
import java.sql.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import proyectoAdministradorVuelos.dao.VueloDAO;
import proyectoAdministradorVuelos.model.Avion;
import proyectoAdministradorVuelos.model.Pasajero;
import proyectoAdministradorVuelos.model.Reporte;
import proyectoAdministradorVuelos.model.Vuelo;
@Service("vueloService")
@Transactional
public class VueloServiceImpl implements VueloService {
@Autowired
private VueloDAO dao;
@Override
public void agregarVuelo(Vuelo vuelo) {
dao.agregarVuelo(vuelo);
}
@Override
public void modificarVuelo(Vuelo vuelo) {
Vuelo v=dao.getVuelo(vuelo.getId());
if(v!=null){
v.setAvion(vuelo.getAvion());
v.setFecha(vuelo.getFecha());
v.setHorafin(vuelo.getHorafin());
v.setHorainicio(vuelo.getHorainicio());
v.setRuta(vuelo.getRuta());
v.setPasajeros(vuelo.getPasajeros());
}
}
@Override
public List<Vuelo> listaVuelos() {
return dao.listaVuelos();
}
@Override
public Vuelo getVuelo(int idvuelo) {
return dao.getVuelo(idvuelo);
}
@Override
public void borrarVuelo(int idvuelo) {
dao.borrarVuelo(idvuelo);
}
@Override
public boolean reservarVuelo(int idvuelo, Pasajero pasajero) {
Vuelo vuelo=getVuelo(idvuelo);
if(vuelo!=null){
System.out.println(vuelo.getAvion().getCapacidad()+"-"+vuelo.getPasajeros().size());
if(vuelo.getAvion().getCapacidad()>vuelo.getPasajeros().size()){
vuelo.getPasajeros().add(pasajero);
return true;
}
}
return false;
}
@Override
public List<Reporte> generarReporte(Date inicio, Date fin, Avion avion) {
return dao.generarReporte(inicio, fin, avion);
}
}
|
UTF-8
|
Java
| 1,827 |
java
|
VueloServiceImpl.java
|
Java
|
[] | null |
[] |
package proyectoAdministradorVuelos.service;
import java.sql.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import proyectoAdministradorVuelos.dao.VueloDAO;
import proyectoAdministradorVuelos.model.Avion;
import proyectoAdministradorVuelos.model.Pasajero;
import proyectoAdministradorVuelos.model.Reporte;
import proyectoAdministradorVuelos.model.Vuelo;
@Service("vueloService")
@Transactional
public class VueloServiceImpl implements VueloService {
@Autowired
private VueloDAO dao;
@Override
public void agregarVuelo(Vuelo vuelo) {
dao.agregarVuelo(vuelo);
}
@Override
public void modificarVuelo(Vuelo vuelo) {
Vuelo v=dao.getVuelo(vuelo.getId());
if(v!=null){
v.setAvion(vuelo.getAvion());
v.setFecha(vuelo.getFecha());
v.setHorafin(vuelo.getHorafin());
v.setHorainicio(vuelo.getHorainicio());
v.setRuta(vuelo.getRuta());
v.setPasajeros(vuelo.getPasajeros());
}
}
@Override
public List<Vuelo> listaVuelos() {
return dao.listaVuelos();
}
@Override
public Vuelo getVuelo(int idvuelo) {
return dao.getVuelo(idvuelo);
}
@Override
public void borrarVuelo(int idvuelo) {
dao.borrarVuelo(idvuelo);
}
@Override
public boolean reservarVuelo(int idvuelo, Pasajero pasajero) {
Vuelo vuelo=getVuelo(idvuelo);
if(vuelo!=null){
System.out.println(vuelo.getAvion().getCapacidad()+"-"+vuelo.getPasajeros().size());
if(vuelo.getAvion().getCapacidad()>vuelo.getPasajeros().size()){
vuelo.getPasajeros().add(pasajero);
return true;
}
}
return false;
}
@Override
public List<Reporte> generarReporte(Date inicio, Date fin, Avion avion) {
return dao.generarReporte(inicio, fin, avion);
}
}
| 1,827 | 0.755337 | 0.755337 | 76 | 23.039474 | 21.86829 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.565789 | false | false |
5
|
d7009b4f51e77189f6e20226914bdb39421ba734
| 8,014,408,978,235 |
880dcafce5553ffbd732c6fd1dad4bc5202996fa
|
/SwingProjecy/src/swing/project/Mainn.java
|
ee4d078d3d389bdc374c755800756c507c506719
|
[] |
no_license
|
Mariusz12345/100815
|
https://github.com/Mariusz12345/100815
|
1f7d529212b78dfdcd103b174b6faee7b7bf304c
|
b39053d808baab84ce2b654e92b78eed134dd8eb
|
refs/heads/master
| 2021-01-25T08:32:14.553000 | 2015-08-10T12:23:41 | 2015-08-10T12:23:41 | 40,463,352 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package swing.project;
public class Mainn {
public static void main(String[] args) {
new Test();
}
}
|
UTF-8
|
Java
| 107 |
java
|
Mainn.java
|
Java
|
[] | null |
[] |
package swing.project;
public class Mainn {
public static void main(String[] args) {
new Test();
}
}
| 107 | 0.672897 | 0.672897 | 7 | 14.142858 | 13.82987 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.857143 | false | false |
5
|
b5a74caa1ea8f3da42fdf0dc2855f65f01d26cf3
| 26,731,876,456,026 |
d3ab0be3c2c87832dbf60a1e8c7eafa25582b577
|
/src/com/zhouhaoisme/BinarySearchTree.java
|
d45025c7c9e2a07de371b3e2893e42b59e6c5cfa
|
[] |
no_license
|
469434849/Algorithms
|
https://github.com/469434849/Algorithms
|
30e5951bca8ffc2d4e37bbc72c938104ba92af55
|
b04e026ecaec5ca2f67b6edb642f7699feb38be2
|
refs/heads/master
| 2019-04-08T16:07:30.376000 | 2017-04-25T13:00:03 | 2017-04-25T13:00:03 | 88,343,330 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.zhouhaoisme;
import java.util.LinkedList;
import java.util.Queue;
/*
*
* 节点的前驱:是该节点的左子树中的最大节点。
* 节点的后继:是该节点的右子树中的最小节点
*/
public class BinarySearchTree<T extends Comparable<T>> {
private BSTNode<T> mRoot;
public BinarySearchTree() {
mRoot = null;
}
class BSTNode<T extends Comparable<T>> {
T key;
BSTNode<T> left;
BSTNode<T> right;
BSTNode<T> parent;
public BSTNode(T key, BSTNode<T> left, BSTNode<T> right, BSTNode<T> parent) {
this.key = key;
this.left = left;
this.right = right;
this.parent = parent;
}
}
private void insert(BinarySearchTree<T> tree, BSTNode<T> node) {
int cmp;
BSTNode<T> temp = null;
BSTNode<T> root = tree.mRoot;
// while 结束的时候意味着node插入的位置
while (root != null) {
temp = root;
cmp = node.key.compareTo(root.key);
if (cmp < 0) {
root = root.left;
} else {
root = root.right;
}
}
node.parent = temp;
// 空树
if (temp == null) {
tree.mRoot = node;
} else {
// ???????????
// root=node;
cmp = node.key.compareTo(temp.key);
if (cmp < 0) {
temp.left = node;
} else {
temp.right = node;
}
}
}
public void insert(T key) {
BSTNode<T> node = new BSTNode<T>(key, null, null, null);
if (node != null) {
insert(this, node);
}
}
/*
* 找结点的前驱结点。即,查找"二叉树中数据值小于该结点"的"最大结点"。
*/
public BSTNode<T> predecessor(BSTNode<T> node) {
if (node.left != null) {
return maxinumNode(node);
}
// 如果x没有左孩子。则x有以下两种可能:
// (01) x是"一个右孩子",则"x的前驱结点"为 "它的父结点"。
// (01) x是"一个左孩子",则查找"x的最低的父结点,并且该父结点要具有右孩子",找到的这个"最低的父结点"就是"x的前驱结点"。
BSTNode<T> temp = node.parent;
while ((temp != null) && (node == temp.left)) {
node = temp;
temp = temp.parent;
}
return temp;
}
/*
* 删除结点(z),并返回被删除的结点
*
* 参数说明:
* bst 二叉树
* z 删除的结点
*/
private BSTNode<T> remove(BinarySearchTree<T> bst, BSTNode<T> z) {
BSTNode<T> x=null;
BSTNode<T> y=null;
if ((z.left == null) || (z.right == null) )
y = z;
else
y = successor(z);
if (y.left != null)
x = y.left;
else
x = y.right;
if (x != null)
x.parent = y.parent;
if (y.parent == null)
bst.mRoot = x;
else if (y == y.parent.left)
y.parent.left = x;
else
y.parent.right = x;
if (y != z)
z.key = y.key;
return y;
}
/*
* 删除结点(z),并返回被删除的结点
*
* 参数说明:
* tree 二叉树的根结点
* z 删除的结点
*/
public void remove(T key) {
BSTNode<T> z, node;
if ((z = iterativeSearch(mRoot, key)) != null)
if ( (node = remove(this, z)) != null)
node = null;
}
/*
* 找结点(x)的后继结点。即,查找"二叉树中数据值大于该结点"的"最小结点"。
*/
public BSTNode<T> successor(BSTNode<T> x) {
// 如果x存在右孩子,则"x的后继结点"为 "以其右孩子为根的子树的最小结点"。
if (x.right != null)
return mininumNode(x.right);
// 如果x没有右孩子。则x有以下两种可能:
// (01) x是"一个左孩子",则"x的后继结点"为 "它的父结点"。
// (02) x是"一个右孩子",则查找"x的最低的父结点,并且该父结点要具有左孩子",找到的这个"最低的父结点"就是"x的后继结点"。
BSTNode<T> y = x.parent;
while ((y!=null) && (x==y.right)) {
x = y;
y = y.parent;
}
return y;
}
private void preOrder(BSTNode<T> tree) {
if (tree != null) {
System.out.print(tree.key + " ");
preOrder(tree.left);
preOrder(tree.right);
}
}
public void preOrder() {
preOrder(mRoot);
}
private void inOrder(BSTNode<T> tree) {
if (tree != null) {
inOrder(tree.left);
System.out.print(tree.key + " ");
inOrder(tree.right);
}
}
public void inOrder() {
inOrder(mRoot);
}
private void postOrder(BSTNode<T> tree) {
if (tree != null) {
postOrder(tree.left);
postOrder(tree.right);
System.out.print(tree.key + " ");
}
}
public void postOrder() {
postOrder(mRoot);
}
// 递归查找
private BSTNode<T> recursiveSearch(BSTNode<T> root, T key) {
if (root == null) {
return root;
}
int cmp = root.key.compareTo(key);
if (cmp < 0)
return recursiveSearch(root.left, key);
else if (cmp > 0)
return recursiveSearch(root.right, key);
return root;
}
public BSTNode<T> recursiveSearch(T key) {
return recursiveSearch(mRoot, key);
}
// 迭代查找
private BSTNode<T> iterativeSearch(BSTNode<T> root, T key) {
while (root != null) {
int cmp = root.key.compareTo(key);
if (cmp < 0)
root = root.left;
else if (cmp > 0)
root = root.right;
else
return root;
}
return root;
}
public BSTNode<T> iterativeSearch(T key) {
return iterativeSearch(mRoot, key);
}
// 查找二叉树中最大节点
private BSTNode<T> maxinumNode(BSTNode<T> root) {
if (root == null)
return root;
while (root.right != null) {
root = root.right;
}
return root;
}
public T maxinumNode() {
BSTNode<T> node = maxinumNode(mRoot);
if (node != null)
return node.key;
return null;
}
// 查找二叉树中的最小节点
private BSTNode<T> mininumNode(BSTNode<T> root) {
if (root == null)
return null;
while (root.left != null) {
root = root.left;
}
return root;
}
public T mininumNode() {
BSTNode<T> node = mininumNode(mRoot);
if (node != null) {
return node.key;
}
return null;
}
/*
* direction 0:root -1:left 1:right key 父节点的值
*/
private void printTree(BSTNode<T> root, T key, int direction) {
if (root != null) {
if (direction == 0) {
System.out.printf("%2d is root node\n", root.key);
} else {
System.out.printf("%2d is %2d's %6s child\n", root.key, key, direction == 1 ? "right" : "left");
}
printTree(root.left, root.key, -1);
printTree(root.right, root.key, 1);
}
}
public void printTree() {
if (mRoot != null) {
printTree(mRoot, mRoot.key, 0);
}
}
private void leverPrint(BSTNode<T> root) {
if (root == null) {
return;
}
Queue<BSTNode<T>> queue = new LinkedList<BSTNode<T>>();
queue.offer(root);
BSTNode<T> temp;
while (!queue.isEmpty()) {
temp = queue.poll();
System.out.print(temp.key + " ");
if (temp.left != null) {
queue.offer(temp.left);
}
if (temp.right != null) {
queue.offer(temp.right);
}
}
}
public void leverPrint() {
if (mRoot != null) {
leverPrint(mRoot);
System.out.println();
}
}
private void destroyTree(BSTNode<T> root){
if(root==null){
return;
}
if(root.left!=null){
destroyTree(root.left);
}
if(root.right!=null){
destroyTree(root.right);
}
root=null;
}
public void clear(){
destroyTree(mRoot);
mRoot=null;
}
}
|
GB18030
|
Java
| 7,547 |
java
|
BinarySearchTree.java
|
Java
|
[] | null |
[] |
package com.zhouhaoisme;
import java.util.LinkedList;
import java.util.Queue;
/*
*
* 节点的前驱:是该节点的左子树中的最大节点。
* 节点的后继:是该节点的右子树中的最小节点
*/
public class BinarySearchTree<T extends Comparable<T>> {
private BSTNode<T> mRoot;
public BinarySearchTree() {
mRoot = null;
}
class BSTNode<T extends Comparable<T>> {
T key;
BSTNode<T> left;
BSTNode<T> right;
BSTNode<T> parent;
public BSTNode(T key, BSTNode<T> left, BSTNode<T> right, BSTNode<T> parent) {
this.key = key;
this.left = left;
this.right = right;
this.parent = parent;
}
}
private void insert(BinarySearchTree<T> tree, BSTNode<T> node) {
int cmp;
BSTNode<T> temp = null;
BSTNode<T> root = tree.mRoot;
// while 结束的时候意味着node插入的位置
while (root != null) {
temp = root;
cmp = node.key.compareTo(root.key);
if (cmp < 0) {
root = root.left;
} else {
root = root.right;
}
}
node.parent = temp;
// 空树
if (temp == null) {
tree.mRoot = node;
} else {
// ???????????
// root=node;
cmp = node.key.compareTo(temp.key);
if (cmp < 0) {
temp.left = node;
} else {
temp.right = node;
}
}
}
public void insert(T key) {
BSTNode<T> node = new BSTNode<T>(key, null, null, null);
if (node != null) {
insert(this, node);
}
}
/*
* 找结点的前驱结点。即,查找"二叉树中数据值小于该结点"的"最大结点"。
*/
public BSTNode<T> predecessor(BSTNode<T> node) {
if (node.left != null) {
return maxinumNode(node);
}
// 如果x没有左孩子。则x有以下两种可能:
// (01) x是"一个右孩子",则"x的前驱结点"为 "它的父结点"。
// (01) x是"一个左孩子",则查找"x的最低的父结点,并且该父结点要具有右孩子",找到的这个"最低的父结点"就是"x的前驱结点"。
BSTNode<T> temp = node.parent;
while ((temp != null) && (node == temp.left)) {
node = temp;
temp = temp.parent;
}
return temp;
}
/*
* 删除结点(z),并返回被删除的结点
*
* 参数说明:
* bst 二叉树
* z 删除的结点
*/
private BSTNode<T> remove(BinarySearchTree<T> bst, BSTNode<T> z) {
BSTNode<T> x=null;
BSTNode<T> y=null;
if ((z.left == null) || (z.right == null) )
y = z;
else
y = successor(z);
if (y.left != null)
x = y.left;
else
x = y.right;
if (x != null)
x.parent = y.parent;
if (y.parent == null)
bst.mRoot = x;
else if (y == y.parent.left)
y.parent.left = x;
else
y.parent.right = x;
if (y != z)
z.key = y.key;
return y;
}
/*
* 删除结点(z),并返回被删除的结点
*
* 参数说明:
* tree 二叉树的根结点
* z 删除的结点
*/
public void remove(T key) {
BSTNode<T> z, node;
if ((z = iterativeSearch(mRoot, key)) != null)
if ( (node = remove(this, z)) != null)
node = null;
}
/*
* 找结点(x)的后继结点。即,查找"二叉树中数据值大于该结点"的"最小结点"。
*/
public BSTNode<T> successor(BSTNode<T> x) {
// 如果x存在右孩子,则"x的后继结点"为 "以其右孩子为根的子树的最小结点"。
if (x.right != null)
return mininumNode(x.right);
// 如果x没有右孩子。则x有以下两种可能:
// (01) x是"一个左孩子",则"x的后继结点"为 "它的父结点"。
// (02) x是"一个右孩子",则查找"x的最低的父结点,并且该父结点要具有左孩子",找到的这个"最低的父结点"就是"x的后继结点"。
BSTNode<T> y = x.parent;
while ((y!=null) && (x==y.right)) {
x = y;
y = y.parent;
}
return y;
}
private void preOrder(BSTNode<T> tree) {
if (tree != null) {
System.out.print(tree.key + " ");
preOrder(tree.left);
preOrder(tree.right);
}
}
public void preOrder() {
preOrder(mRoot);
}
private void inOrder(BSTNode<T> tree) {
if (tree != null) {
inOrder(tree.left);
System.out.print(tree.key + " ");
inOrder(tree.right);
}
}
public void inOrder() {
inOrder(mRoot);
}
private void postOrder(BSTNode<T> tree) {
if (tree != null) {
postOrder(tree.left);
postOrder(tree.right);
System.out.print(tree.key + " ");
}
}
public void postOrder() {
postOrder(mRoot);
}
// 递归查找
private BSTNode<T> recursiveSearch(BSTNode<T> root, T key) {
if (root == null) {
return root;
}
int cmp = root.key.compareTo(key);
if (cmp < 0)
return recursiveSearch(root.left, key);
else if (cmp > 0)
return recursiveSearch(root.right, key);
return root;
}
public BSTNode<T> recursiveSearch(T key) {
return recursiveSearch(mRoot, key);
}
// 迭代查找
private BSTNode<T> iterativeSearch(BSTNode<T> root, T key) {
while (root != null) {
int cmp = root.key.compareTo(key);
if (cmp < 0)
root = root.left;
else if (cmp > 0)
root = root.right;
else
return root;
}
return root;
}
public BSTNode<T> iterativeSearch(T key) {
return iterativeSearch(mRoot, key);
}
// 查找二叉树中最大节点
private BSTNode<T> maxinumNode(BSTNode<T> root) {
if (root == null)
return root;
while (root.right != null) {
root = root.right;
}
return root;
}
public T maxinumNode() {
BSTNode<T> node = maxinumNode(mRoot);
if (node != null)
return node.key;
return null;
}
// 查找二叉树中的最小节点
private BSTNode<T> mininumNode(BSTNode<T> root) {
if (root == null)
return null;
while (root.left != null) {
root = root.left;
}
return root;
}
public T mininumNode() {
BSTNode<T> node = mininumNode(mRoot);
if (node != null) {
return node.key;
}
return null;
}
/*
* direction 0:root -1:left 1:right key 父节点的值
*/
private void printTree(BSTNode<T> root, T key, int direction) {
if (root != null) {
if (direction == 0) {
System.out.printf("%2d is root node\n", root.key);
} else {
System.out.printf("%2d is %2d's %6s child\n", root.key, key, direction == 1 ? "right" : "left");
}
printTree(root.left, root.key, -1);
printTree(root.right, root.key, 1);
}
}
public void printTree() {
if (mRoot != null) {
printTree(mRoot, mRoot.key, 0);
}
}
private void leverPrint(BSTNode<T> root) {
if (root == null) {
return;
}
Queue<BSTNode<T>> queue = new LinkedList<BSTNode<T>>();
queue.offer(root);
BSTNode<T> temp;
while (!queue.isEmpty()) {
temp = queue.poll();
System.out.print(temp.key + " ");
if (temp.left != null) {
queue.offer(temp.left);
}
if (temp.right != null) {
queue.offer(temp.right);
}
}
}
public void leverPrint() {
if (mRoot != null) {
leverPrint(mRoot);
System.out.println();
}
}
private void destroyTree(BSTNode<T> root){
if(root==null){
return;
}
if(root.left!=null){
destroyTree(root.left);
}
if(root.right!=null){
destroyTree(root.right);
}
root=null;
}
public void clear(){
destroyTree(mRoot);
mRoot=null;
}
}
| 7,547 | 0.550246 | 0.546375 | 332 | 18.231928 | 16.700691 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2 | false | false |
5
|
5737eabd528e6a9db3d875606b57340de08c5e36
| 21,071,109,622,401 |
235fd6669a3bcede32b02c602ac97064c9782196
|
/src/by/belhard/j19/Homeworks/Homework4/Task2/Gamer.java
|
7ee2ba485b70d9b188426cecf1088653adbfe1d1
|
[] |
no_license
|
nastia-lucky/NastiaShafalovich
|
https://github.com/nastia-lucky/NastiaShafalovich
|
0cfe8aeeafc588fe1e8e4709fdaf1e970beaf2b7
|
2f4b06f47e2ab7af6a1b5087260530c0e4cba622
|
refs/heads/master
| 2020-09-30T03:02:52.007000 | 2020-05-22T23:04:00 | 2020-05-22T23:04:00 | 227,186,222 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package by.belhard.j19.HomeWorks.Homework4.Task2;
public class Gamer {
String name;
double x;
double y;
double c;
Gamer(String name, double x, double y) {
this.name = name;
this.x = x;
this.y = y;
}
void setLocation(double x1, double y1) {
x = x1;
y = y1;
System.out.println("The new coordinates are: x= " + x + ", y= " + y);
}
void printLocation() {
System.out.println("The new coordinates are: x= " + x + ", y= " + y);
}
double calculateDistance(double x1, double y1) {
double a = x1 - x;
double b = y1 - y;
c = Math.sqrt((Math.pow(a, 2) + Math.pow(b, 2)));
System.out.println(c);
return c;
}
}
|
UTF-8
|
Java
| 747 |
java
|
Gamer.java
|
Java
|
[] | null |
[] |
package by.belhard.j19.HomeWorks.Homework4.Task2;
public class Gamer {
String name;
double x;
double y;
double c;
Gamer(String name, double x, double y) {
this.name = name;
this.x = x;
this.y = y;
}
void setLocation(double x1, double y1) {
x = x1;
y = y1;
System.out.println("The new coordinates are: x= " + x + ", y= " + y);
}
void printLocation() {
System.out.println("The new coordinates are: x= " + x + ", y= " + y);
}
double calculateDistance(double x1, double y1) {
double a = x1 - x;
double b = y1 - y;
c = Math.sqrt((Math.pow(a, 2) + Math.pow(b, 2)));
System.out.println(c);
return c;
}
}
| 747 | 0.516734 | 0.497992 | 33 | 21.636364 | 21.258608 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.757576 | false | false |
5
|
8af3e09b4432f3c0f178fd466d7c3fdd60f8e2e1
| 21,071,109,623,346 |
7ec0194c493e63b18ab17b33fe69a39ed6af6696
|
/masterlock/app_decompiled/sources/com/masterlock/ble/app/service/$$Lambda$LockService$dyMbBzfGZ2Sf3m6luceX5HoK67Q.java
|
9854776586f03ec5ba97a975da09956947694e3e
|
[] |
no_license
|
rasaford/CS3235
|
https://github.com/rasaford/CS3235
|
5626a6e7e05a2a57e7641e525b576b0b492d9154
|
44d393fb3afb5d131ad9d6317458c5f8081b0c04
|
refs/heads/master
| 2020-07-24T16:00:57.203000 | 2019-11-05T13:00:09 | 2019-11-05T13:00:09 | 207,975,557 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.masterlock.ble.app.service;
import java.util.List;
import p009rx.functions.Func1;
/* renamed from: com.masterlock.ble.app.service.-$$Lambda$LockService$dyMbBzfGZ2Sf3m6luceX5HoK67Q reason: invalid class name */
/* compiled from: lambda */
public final /* synthetic */ class $$Lambda$LockService$dyMbBzfGZ2Sf3m6luceX5HoK67Q implements Func1 {
public static final /* synthetic */ $$Lambda$LockService$dyMbBzfGZ2Sf3m6luceX5HoK67Q INSTANCE = new $$Lambda$LockService$dyMbBzfGZ2Sf3m6luceX5HoK67Q();
private /* synthetic */ $$Lambda$LockService$dyMbBzfGZ2Sf3m6luceX5HoK67Q() {
}
public final Object call(Object obj) {
return LockService.lambda$getAllForSort$16((List) obj);
}
}
|
UTF-8
|
Java
| 715 |
java
|
$$Lambda$LockService$dyMbBzfGZ2Sf3m6luceX5HoK67Q.java
|
Java
|
[] | null |
[] |
package com.masterlock.ble.app.service;
import java.util.List;
import p009rx.functions.Func1;
/* renamed from: com.masterlock.ble.app.service.-$$Lambda$LockService$dyMbBzfGZ2Sf3m6luceX5HoK67Q reason: invalid class name */
/* compiled from: lambda */
public final /* synthetic */ class $$Lambda$LockService$dyMbBzfGZ2Sf3m6luceX5HoK67Q implements Func1 {
public static final /* synthetic */ $$Lambda$LockService$dyMbBzfGZ2Sf3m6luceX5HoK67Q INSTANCE = new $$Lambda$LockService$dyMbBzfGZ2Sf3m6luceX5HoK67Q();
private /* synthetic */ $$Lambda$LockService$dyMbBzfGZ2Sf3m6luceX5HoK67Q() {
}
public final Object call(Object obj) {
return LockService.lambda$getAllForSort$16((List) obj);
}
}
| 715 | 0.758042 | 0.706294 | 17 | 41.058823 | 47.102478 | 155 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.294118 | false | false |
5
|
11444de2d8517e00bffcfd9d43e6b4c4414e6ba3
| 816,043,815,170 |
d5d67101231af163886d5d17f7cb3246c0d2e9e1
|
/JavaSource/domain/recoup/SysDeDatarange.java
|
3fd17f1e4cc2929be0061338ebd9bd5fd06c7293
|
[] |
no_license
|
shamoxiaoniqiu2008/recoup
|
https://github.com/shamoxiaoniqiu2008/recoup
|
8dec9fd99ddd7d677b96bd3d88e888c4a5f1e1cb
|
511a823b5e70600afa6e50d1f6da28fff7b63e4e
|
refs/heads/master
| 2016-09-06T16:17:59.969000 | 2014-07-16T15:36:41 | 2014-07-16T15:36:41 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package domain.recoup;
import java.io.Serializable;
public class SysDeDatarange implements Serializable {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_de_datarange.ID
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
private String id;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_de_datarange.RANGE_CODE
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
private String rangeCode;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_de_datarange.RANGE_NAME
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
private String rangeName;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_de_datarange.AUDI_FLAG
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
private String audiFlag;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_de_datarange.USE_FLAG
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
private String useFlag;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_de_datarange.CREAT_DATE
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
private String creatDate;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_de_datarange.CREATE_PERSON
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
private String createPerson;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table sys_de_datarange
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
private static final long serialVersionUID = 1L;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_de_datarange.ID
*
* @return the value of sys_de_datarange.ID
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
public String getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_de_datarange.ID
*
* @param id the value for sys_de_datarange.ID
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
public void setId(String id) {
this.id = id == null ? null : id.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_de_datarange.RANGE_CODE
*
* @return the value of sys_de_datarange.RANGE_CODE
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
public String getRangeCode() {
return rangeCode;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_de_datarange.RANGE_CODE
*
* @param rangeCode the value for sys_de_datarange.RANGE_CODE
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
public void setRangeCode(String rangeCode) {
this.rangeCode = rangeCode == null ? null : rangeCode.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_de_datarange.RANGE_NAME
*
* @return the value of sys_de_datarange.RANGE_NAME
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
public String getRangeName() {
return rangeName;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_de_datarange.RANGE_NAME
*
* @param rangeName the value for sys_de_datarange.RANGE_NAME
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
public void setRangeName(String rangeName) {
this.rangeName = rangeName == null ? null : rangeName.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_de_datarange.AUDI_FLAG
*
* @return the value of sys_de_datarange.AUDI_FLAG
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
public String getAudiFlag() {
return audiFlag;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_de_datarange.AUDI_FLAG
*
* @param audiFlag the value for sys_de_datarange.AUDI_FLAG
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
public void setAudiFlag(String audiFlag) {
this.audiFlag = audiFlag == null ? null : audiFlag.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_de_datarange.USE_FLAG
*
* @return the value of sys_de_datarange.USE_FLAG
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
public String getUseFlag() {
return useFlag;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_de_datarange.USE_FLAG
*
* @param useFlag the value for sys_de_datarange.USE_FLAG
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
public void setUseFlag(String useFlag) {
this.useFlag = useFlag == null ? null : useFlag.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_de_datarange.CREAT_DATE
*
* @return the value of sys_de_datarange.CREAT_DATE
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
public String getCreatDate() {
return creatDate;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_de_datarange.CREAT_DATE
*
* @param creatDate the value for sys_de_datarange.CREAT_DATE
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
public void setCreatDate(String creatDate) {
this.creatDate = creatDate == null ? null : creatDate.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_de_datarange.CREATE_PERSON
*
* @return the value of sys_de_datarange.CREATE_PERSON
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
public String getCreatePerson() {
return createPerson;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_de_datarange.CREATE_PERSON
*
* @param createPerson the value for sys_de_datarange.CREATE_PERSON
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
public void setCreatePerson(String createPerson) {
this.createPerson = createPerson == null ? null : createPerson.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_de_datarange
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
SysDeDatarange other = (SysDeDatarange) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getRangeCode() == null ? other.getRangeCode() == null : this.getRangeCode().equals(other.getRangeCode()))
&& (this.getRangeName() == null ? other.getRangeName() == null : this.getRangeName().equals(other.getRangeName()))
&& (this.getAudiFlag() == null ? other.getAudiFlag() == null : this.getAudiFlag().equals(other.getAudiFlag()))
&& (this.getUseFlag() == null ? other.getUseFlag() == null : this.getUseFlag().equals(other.getUseFlag()))
&& (this.getCreatDate() == null ? other.getCreatDate() == null : this.getCreatDate().equals(other.getCreatDate()))
&& (this.getCreatePerson() == null ? other.getCreatePerson() == null : this.getCreatePerson().equals(other.getCreatePerson()));
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_de_datarange
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getRangeCode() == null) ? 0 : getRangeCode().hashCode());
result = prime * result + ((getRangeName() == null) ? 0 : getRangeName().hashCode());
result = prime * result + ((getAudiFlag() == null) ? 0 : getAudiFlag().hashCode());
result = prime * result + ((getUseFlag() == null) ? 0 : getUseFlag().hashCode());
result = prime * result + ((getCreatDate() == null) ? 0 : getCreatDate().hashCode());
result = prime * result + ((getCreatePerson() == null) ? 0 : getCreatePerson().hashCode());
return result;
}
}
|
UTF-8
|
Java
| 9,876 |
java
|
SysDeDatarange.java
|
Java
|
[] | null |
[] |
package domain.recoup;
import java.io.Serializable;
public class SysDeDatarange implements Serializable {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_de_datarange.ID
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
private String id;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_de_datarange.RANGE_CODE
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
private String rangeCode;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_de_datarange.RANGE_NAME
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
private String rangeName;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_de_datarange.AUDI_FLAG
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
private String audiFlag;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_de_datarange.USE_FLAG
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
private String useFlag;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_de_datarange.CREAT_DATE
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
private String creatDate;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_de_datarange.CREATE_PERSON
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
private String createPerson;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table sys_de_datarange
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
private static final long serialVersionUID = 1L;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_de_datarange.ID
*
* @return the value of sys_de_datarange.ID
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
public String getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_de_datarange.ID
*
* @param id the value for sys_de_datarange.ID
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
public void setId(String id) {
this.id = id == null ? null : id.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_de_datarange.RANGE_CODE
*
* @return the value of sys_de_datarange.RANGE_CODE
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
public String getRangeCode() {
return rangeCode;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_de_datarange.RANGE_CODE
*
* @param rangeCode the value for sys_de_datarange.RANGE_CODE
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
public void setRangeCode(String rangeCode) {
this.rangeCode = rangeCode == null ? null : rangeCode.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_de_datarange.RANGE_NAME
*
* @return the value of sys_de_datarange.RANGE_NAME
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
public String getRangeName() {
return rangeName;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_de_datarange.RANGE_NAME
*
* @param rangeName the value for sys_de_datarange.RANGE_NAME
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
public void setRangeName(String rangeName) {
this.rangeName = rangeName == null ? null : rangeName.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_de_datarange.AUDI_FLAG
*
* @return the value of sys_de_datarange.AUDI_FLAG
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
public String getAudiFlag() {
return audiFlag;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_de_datarange.AUDI_FLAG
*
* @param audiFlag the value for sys_de_datarange.AUDI_FLAG
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
public void setAudiFlag(String audiFlag) {
this.audiFlag = audiFlag == null ? null : audiFlag.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_de_datarange.USE_FLAG
*
* @return the value of sys_de_datarange.USE_FLAG
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
public String getUseFlag() {
return useFlag;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_de_datarange.USE_FLAG
*
* @param useFlag the value for sys_de_datarange.USE_FLAG
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
public void setUseFlag(String useFlag) {
this.useFlag = useFlag == null ? null : useFlag.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_de_datarange.CREAT_DATE
*
* @return the value of sys_de_datarange.CREAT_DATE
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
public String getCreatDate() {
return creatDate;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_de_datarange.CREAT_DATE
*
* @param creatDate the value for sys_de_datarange.CREAT_DATE
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
public void setCreatDate(String creatDate) {
this.creatDate = creatDate == null ? null : creatDate.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_de_datarange.CREATE_PERSON
*
* @return the value of sys_de_datarange.CREATE_PERSON
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
public String getCreatePerson() {
return createPerson;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_de_datarange.CREATE_PERSON
*
* @param createPerson the value for sys_de_datarange.CREATE_PERSON
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
public void setCreatePerson(String createPerson) {
this.createPerson = createPerson == null ? null : createPerson.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_de_datarange
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
SysDeDatarange other = (SysDeDatarange) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getRangeCode() == null ? other.getRangeCode() == null : this.getRangeCode().equals(other.getRangeCode()))
&& (this.getRangeName() == null ? other.getRangeName() == null : this.getRangeName().equals(other.getRangeName()))
&& (this.getAudiFlag() == null ? other.getAudiFlag() == null : this.getAudiFlag().equals(other.getAudiFlag()))
&& (this.getUseFlag() == null ? other.getUseFlag() == null : this.getUseFlag().equals(other.getUseFlag()))
&& (this.getCreatDate() == null ? other.getCreatDate() == null : this.getCreatDate().equals(other.getCreatDate()))
&& (this.getCreatePerson() == null ? other.getCreatePerson() == null : this.getCreatePerson().equals(other.getCreatePerson()));
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_de_datarange
*
* @mbggenerated Fri Jul 04 09:34:37 CST 2014
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getRangeCode() == null) ? 0 : getRangeCode().hashCode());
result = prime * result + ((getRangeName() == null) ? 0 : getRangeName().hashCode());
result = prime * result + ((getAudiFlag() == null) ? 0 : getAudiFlag().hashCode());
result = prime * result + ((getUseFlag() == null) ? 0 : getUseFlag().hashCode());
result = prime * result + ((getCreatDate() == null) ? 0 : getCreatDate().hashCode());
result = prime * result + ((getCreatePerson() == null) ? 0 : getCreatePerson().hashCode());
return result;
}
}
| 9,876 | 0.606825 | 0.576549 | 284 | 32.781689 | 31.284838 | 139 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.137324 | false | false |
5
|
44ad9bb22619c5d3f6840c377841266961d0a93d
| 27,685,359,196,786 |
df417fb19fb3b535c946f6333d8e0fa1c931c145
|
/Winter_Base/src/week6/Code_2581.java
|
5c746ceaf65a196ae7b12a28e6efcb54cc40dd3f
|
[] |
no_license
|
kje6445/algorithm
|
https://github.com/kje6445/algorithm
|
47570f3c8d4ebda2730880261dc686745a25e976
|
39bc878b512dad8771d82a7aab9a83ed0d6c70b3
|
refs/heads/master
| 2021-06-26T20:13:57.040000 | 2019-07-26T06:39:49 | 2019-07-26T06:39:49 | 150,244,604 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package week6;
import java.util.ArrayList;
import java.util.Scanner;
/*소수
문제
자연수 M과 N이 주어질 때 M이상 N이하의 자연수 중 소수인 것을 모두 골라 이들 소수의 합과 최솟값을 찾는 프로그램을 작성하시오.
예를 들어 M=60, N=100인 경우 60이상 100이하의 자연수 중 소수는 61, 67, 71, 73, 79, 83, 89, 97 총 8개가 있으므로, 이들 소수의 합은 620이고, 최솟값은 61이 된다.
입력
입력의 첫째 줄에 M이, 둘째 줄에 N이 주어진다.
M과 N은 10,000이하의 자연수이며, M은 N보다 작거나 같다.
출력
M이상 N이하의 자연수 중 소수인 것을 모두 찾아 첫째 줄에 그 합을, 둘째 줄에 그 중 최솟값을 출력한다.
단, M이상 N이하의 자연수 중 소수가 없을 경우는 첫째 줄에 -1을 출력한다.
예제 입력 1 복사
60
100
예제 출력 1 복사
620
61
예제 입력 2 복사
64
65
예제 출력 2 복사
-1
*/
public class Code_2581 {
public static void main(String[] args) {
// TODO Auto-generated method stub
// * 문제 풀이 방식 -> 소수를 먼저 구한뒤 구한 소수를 배열에 입력해 넣고 합을 구할 때는 더하면서 출력, 최소값을 구할 때는 배열의
// 제일 앞 수를 출력한다.
Scanner sc = new Scanner(System.in);
int M = sc.nextInt(); // 시작하는 수
int N = sc.nextInt(); // 끝나는 수
int check = 0; // 소수 여부 판별 값
ArrayList primeNum = new ArrayList(); // 소수 저장할 ArrayList
int sum = 0; // 소수들의 합
for (int i = M; i <= N; i++) { // 입력받은 값 N 부터 입력 받은 값 M까지의 반복
if ((i == 1)||(i==2)) {
check = 1;
} // 1일 경우 소수가 아니기 떄문
for (int j = 2; j < i; j++) { // 2부터 자기보다 작은것으로 나누기 -> 나눠지면 소수가 아니다._소수 판별 위함
if (i % j == 0) { // 나눠지게 되면 소수가 아니기 때문에
check = 1;// 체크해 주기
break; // if문 나가기
}
}
if (check == 0) { // 내부 반복문 후에도 계속 check가 0으로 유지되면 소수이다.
primeNum.add(i); // ArrayList에 소수를 추가해 입력 받아 저장한다.
System.out.println("소수값 " + i);
sum += i; // sum에 소수를 더해준다.
System.out.println("합 " + sum);
}
check = 0; // check를 0으로 초기화
}
if (primeNum.size() == 0) { // 소수값이 없을 경우 -> ArrayList의 크기가 0
System.out.println("-1"); // -1를 출력한다.
} else {
System.out.println(sum); // 합을 출력
System.out.println(primeNum.get(0)); // 처음값
}
}
}
|
UTF-8
|
Java
| 2,741 |
java
|
Code_2581.java
|
Java
|
[] | null |
[] |
package week6;
import java.util.ArrayList;
import java.util.Scanner;
/*소수
문제
자연수 M과 N이 주어질 때 M이상 N이하의 자연수 중 소수인 것을 모두 골라 이들 소수의 합과 최솟값을 찾는 프로그램을 작성하시오.
예를 들어 M=60, N=100인 경우 60이상 100이하의 자연수 중 소수는 61, 67, 71, 73, 79, 83, 89, 97 총 8개가 있으므로, 이들 소수의 합은 620이고, 최솟값은 61이 된다.
입력
입력의 첫째 줄에 M이, 둘째 줄에 N이 주어진다.
M과 N은 10,000이하의 자연수이며, M은 N보다 작거나 같다.
출력
M이상 N이하의 자연수 중 소수인 것을 모두 찾아 첫째 줄에 그 합을, 둘째 줄에 그 중 최솟값을 출력한다.
단, M이상 N이하의 자연수 중 소수가 없을 경우는 첫째 줄에 -1을 출력한다.
예제 입력 1 복사
60
100
예제 출력 1 복사
620
61
예제 입력 2 복사
64
65
예제 출력 2 복사
-1
*/
public class Code_2581 {
public static void main(String[] args) {
// TODO Auto-generated method stub
// * 문제 풀이 방식 -> 소수를 먼저 구한뒤 구한 소수를 배열에 입력해 넣고 합을 구할 때는 더하면서 출력, 최소값을 구할 때는 배열의
// 제일 앞 수를 출력한다.
Scanner sc = new Scanner(System.in);
int M = sc.nextInt(); // 시작하는 수
int N = sc.nextInt(); // 끝나는 수
int check = 0; // 소수 여부 판별 값
ArrayList primeNum = new ArrayList(); // 소수 저장할 ArrayList
int sum = 0; // 소수들의 합
for (int i = M; i <= N; i++) { // 입력받은 값 N 부터 입력 받은 값 M까지의 반복
if ((i == 1)||(i==2)) {
check = 1;
} // 1일 경우 소수가 아니기 떄문
for (int j = 2; j < i; j++) { // 2부터 자기보다 작은것으로 나누기 -> 나눠지면 소수가 아니다._소수 판별 위함
if (i % j == 0) { // 나눠지게 되면 소수가 아니기 때문에
check = 1;// 체크해 주기
break; // if문 나가기
}
}
if (check == 0) { // 내부 반복문 후에도 계속 check가 0으로 유지되면 소수이다.
primeNum.add(i); // ArrayList에 소수를 추가해 입력 받아 저장한다.
System.out.println("소수값 " + i);
sum += i; // sum에 소수를 더해준다.
System.out.println("합 " + sum);
}
check = 0; // check를 0으로 초기화
}
if (primeNum.size() == 0) { // 소수값이 없을 경우 -> ArrayList의 크기가 0
System.out.println("-1"); // -1를 출력한다.
} else {
System.out.println(sum); // 합을 출력
System.out.println(primeNum.get(0)); // 처음값
}
}
}
| 2,741 | 0.568093 | 0.523068 | 115 | 14.643478 | 22.440332 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.217391 | false | false |
5
|
1a0981abb8b9d96c8884fc698511cea616d72e60
| 15,650,860,871,254 |
4d9c11e6d569010159c7da225a47c282260e6310
|
/service-management-front/src/main/java/fr/orange/ddr/sympa/repositories/QsTechniqueRepository.java
|
53750ca2fabb797058a3fda4cd05e63afec71367
|
[] |
no_license
|
Zouhairhajji/hypervision-bigdata
|
https://github.com/Zouhairhajji/hypervision-bigdata
|
0c37c696ced3d98455fe67e3ba894541e8fad6a2
|
87e72120937effe61f3569d550abb1ecb2305b03
|
refs/heads/master
| 2020-03-29T05:39:01.712000 | 2018-09-13T14:01:25 | 2018-09-13T14:01:25 | 136,483,459 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package fr.orange.ddr.sympa.repositories;
import fr.orange.ddr.sympa.entities.postgresql.hhd.QsTechnique;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
/**
*
* @author fqlh0717
*/
public interface QsTechniqueRepository extends JpaRepository<QsTechnique, Long>{
@Override
public List<QsTechnique> findAll() ;
}
|
UTF-8
|
Java
| 586 |
java
|
QsTechniqueRepository.java
|
Java
|
[
{
"context": "a.repository.JpaRepository;\r\n\r\n/**\r\n *\r\n * @author fqlh0717\r\n */\r\npublic interface QsTechniqueRepository exte",
"end": 417,
"score": 0.999487042427063,
"start": 409,
"tag": "USERNAME",
"value": "fqlh0717"
}
] | null |
[] |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package fr.orange.ddr.sympa.repositories;
import fr.orange.ddr.sympa.entities.postgresql.hhd.QsTechnique;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
/**
*
* @author fqlh0717
*/
public interface QsTechniqueRepository extends JpaRepository<QsTechnique, Long>{
@Override
public List<QsTechnique> findAll() ;
}
| 586 | 0.715017 | 0.708191 | 23 | 23.47826 | 27.027956 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.391304 | false | false |
5
|
dee10c85af3f98eba3d589a1e746464bcb7409c6
| 14,027,363,211,607 |
637e0602ce6d601e191963fa1cc0b6e2b27d6bb3
|
/console-quartz/src/test/java/com/snoweagle/console/quartz/AppTest.java
|
796ca74f0639e04a3a3b6346acc1f1d6cc8e9d04
|
[] |
no_license
|
ggic/console-system
|
https://github.com/ggic/console-system
|
4ce2d29fedf84fdedcd71e2ed243b1632902f52d
|
639d3bcfe2729cb37e7c5bc88f7e706738b4dff4
|
refs/heads/master
| 2021-05-16T02:39:59.827000 | 2016-12-12T06:30:41 | 2016-12-12T06:30:41 | 37,312,440 | 2 | 1 | null | false | 2015-09-01T07:29:26 | 2015-06-12T08:59:26 | 2015-06-17T10:15:30 | 2015-09-01T07:29:26 | 17,792 | 0 | 1 | 0 |
Java
| null | null |
package com.snoweagle.console.quartz;
import org.quartz.SchedulerException;
import org.springframework.context.support.ClassPathXmlApplicationContext;
//@RunWith(SpringJUnit4ClassRunner.class)
//@ContextConfiguration(locations = { "/META-INF/spring/applicationContext.xml" })
public class AppTest
{
public static void main(String[] args) throws SchedulerException, InterruptedException{
// StdScheduler quartzScheduler = (StdScheduler)applicationContext.getBean("startQuertz");
// quartzScheduler.start();
new ClassPathXmlApplicationContext("/META-INF/spring/applicationContext.xml");
}
}
|
UTF-8
|
Java
| 647 |
java
|
AppTest.java
|
Java
|
[] | null |
[] |
package com.snoweagle.console.quartz;
import org.quartz.SchedulerException;
import org.springframework.context.support.ClassPathXmlApplicationContext;
//@RunWith(SpringJUnit4ClassRunner.class)
//@ContextConfiguration(locations = { "/META-INF/spring/applicationContext.xml" })
public class AppTest
{
public static void main(String[] args) throws SchedulerException, InterruptedException{
// StdScheduler quartzScheduler = (StdScheduler)applicationContext.getBean("startQuertz");
// quartzScheduler.start();
new ClassPathXmlApplicationContext("/META-INF/spring/applicationContext.xml");
}
}
| 647 | 0.749614 | 0.748068 | 16 | 39.4375 | 36.527332 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4375 | false | false |
5
|
c7599e2be517460ce790a497ec6c05de79f26ec3
| 24,352,464,609,932 |
39eb128f36b6b8e5128cd917b95e7f9dbf0c96b1
|
/vidaas3/trunk/vidaas/src/hot/uk/ac/ox/oucs/vidaas/delete/DeleteWebApplication.java
|
3c87b40674d844d0907f21ca3b891b9e294541cd
|
[] |
no_license
|
jpchnz/vidaas
|
https://github.com/jpchnz/vidaas
|
f4d3f9b70f50ee9a1934ebe68c2259fdce79315a
|
c40f6a0462cfb308e97d54519c62785f28b00b56
|
refs/heads/master
| 2016-08-10T15:07:57.429000 | 2012-11-23T14:21:08 | 2012-11-23T14:21:08 | 43,930,660 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package uk.ac.ox.oucs.vidaas.delete;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import uk.ac.ox.oucs.vidaas.utility.SystemCommandExecutor;
public class DeleteWebApplication {
public boolean undeployWebApplication(String webApplicationName){
int status = -88;
String serverLocationTemp = System.getProperty("serverLocation");
status = removeWebApplication(webApplicationName + ".war", serverLocationTemp + "/server/default/deploy/");
if(status == 0){
status = removeWebApplication(webApplicationName + "-ds.xml", serverLocationTemp + "/server/default/deploy/");
}
if(status == 0){
return true;
}
return false;
}
private int removeWebApplication(String webApplicationName, String webApplicationLocation) {
int result = -99;
List<String> command = new ArrayList<String>();
command.add("rm");
command.add("-r");
command.add(webApplicationLocation + webApplicationName);
SystemCommandExecutor commandExecutor = new SystemCommandExecutor(command);
try {
result = commandExecutor.executeCommand();
StringBuilder stdout = commandExecutor.getStandardOutputFromCommand();
StringBuilder stderr = commandExecutor.getStandardErrorFromCommand();
// print the output from the command
System.out.println("STDOUT");
System.out.println(stdout);
System.out.println("STDERR");
System.out.println(stderr);
} catch (Exception e) {
System.out.println("Failed to undeploy the Web Application");
//dataHolder.setOkButton(false);
}
return result;
}
}
|
UTF-8
|
Java
| 1,705 |
java
|
DeleteWebApplication.java
|
Java
|
[] | null |
[] |
package uk.ac.ox.oucs.vidaas.delete;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import uk.ac.ox.oucs.vidaas.utility.SystemCommandExecutor;
public class DeleteWebApplication {
public boolean undeployWebApplication(String webApplicationName){
int status = -88;
String serverLocationTemp = System.getProperty("serverLocation");
status = removeWebApplication(webApplicationName + ".war", serverLocationTemp + "/server/default/deploy/");
if(status == 0){
status = removeWebApplication(webApplicationName + "-ds.xml", serverLocationTemp + "/server/default/deploy/");
}
if(status == 0){
return true;
}
return false;
}
private int removeWebApplication(String webApplicationName, String webApplicationLocation) {
int result = -99;
List<String> command = new ArrayList<String>();
command.add("rm");
command.add("-r");
command.add(webApplicationLocation + webApplicationName);
SystemCommandExecutor commandExecutor = new SystemCommandExecutor(command);
try {
result = commandExecutor.executeCommand();
StringBuilder stdout = commandExecutor.getStandardOutputFromCommand();
StringBuilder stderr = commandExecutor.getStandardErrorFromCommand();
// print the output from the command
System.out.println("STDOUT");
System.out.println(stdout);
System.out.println("STDERR");
System.out.println(stderr);
} catch (Exception e) {
System.out.println("Failed to undeploy the Web Application");
//dataHolder.setOkButton(false);
}
return result;
}
}
| 1,705 | 0.673314 | 0.669795 | 54 | 30.574074 | 30.450689 | 113 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.296296 | false | false |
5
|
d0e66615268422150bc4429f250ebad4f9a4670d
| 1,554,778,202,400 |
cf43d48836e5fe9bd08c41bdc3d58c3a22c2c960
|
/Flightcontroller/src/main/java/com/zensar/services/FlightDetailsServiceImpl.java
|
5b2e4dd9ea3b8bbb1bb8b952fffc1c191bac4533
|
[] |
no_license
|
kavyakh/controller
|
https://github.com/kavyakh/controller
|
c87756f49faa586c869d387fd95a936f3c349cde
|
495432235f77fc593be6e152ad063bb0054d86a5
|
refs/heads/master
| 2022-12-23T16:38:53.387000 | 2019-10-12T13:05:17 | 2019-10-12T13:05:17 | 211,823,117 | 0 | 0 | null | false | 2022-12-15T23:27:22 | 2019-09-30T09:22:57 | 2019-10-12T13:05:20 | 2022-12-15T23:27:19 | 81 | 0 | 0 | 6 |
Java
| false | false |
package com.zensar.services;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zensar.dao.FlightDetailsDao;
import com.zensar.entities.FlightDetails;
@Service
public class FlightDetailsServiceImpl implements FlightDetailService {
@Autowired
private FlightDetailsDao flightdetailsDao;
@Override
public List<FlightDetails> findAllFlightDetails() {
// TODO Auto-generated method stub
return flightdetailsDao.getAll();
}
@Override
public FlightDetails findFlightDetailsByflightId(int flightId) {
// TODO Auto-generated method stub
return flightdetailsDao.getByflightId(flightId);
}
@Override
public void addFlightDetails(FlightDetails flightdetails) {
// TODO Auto-generated method stub
flightdetailsDao.insert(flightdetails);
}
@Override
public void updateFlightDetails(FlightDetails flightdetails) {
// TODO Auto-generated method stub
flightdetailsDao.update(flightdetails);
}
@Override
public void removeFlightDetails(FlightDetails flightdetails) {
// TODO Auto-generated method stub
flightdetailsDao.delete(flightdetails);
}
}
|
UTF-8
|
Java
| 1,219 |
java
|
FlightDetailsServiceImpl.java
|
Java
|
[] | null |
[] |
package com.zensar.services;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zensar.dao.FlightDetailsDao;
import com.zensar.entities.FlightDetails;
@Service
public class FlightDetailsServiceImpl implements FlightDetailService {
@Autowired
private FlightDetailsDao flightdetailsDao;
@Override
public List<FlightDetails> findAllFlightDetails() {
// TODO Auto-generated method stub
return flightdetailsDao.getAll();
}
@Override
public FlightDetails findFlightDetailsByflightId(int flightId) {
// TODO Auto-generated method stub
return flightdetailsDao.getByflightId(flightId);
}
@Override
public void addFlightDetails(FlightDetails flightdetails) {
// TODO Auto-generated method stub
flightdetailsDao.insert(flightdetails);
}
@Override
public void updateFlightDetails(FlightDetails flightdetails) {
// TODO Auto-generated method stub
flightdetailsDao.update(flightdetails);
}
@Override
public void removeFlightDetails(FlightDetails flightdetails) {
// TODO Auto-generated method stub
flightdetailsDao.delete(flightdetails);
}
}
| 1,219 | 0.771124 | 0.771124 | 47 | 23.936171 | 22.913717 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.106383 | false | false |
5
|
83adb2958e0812dadaedfd7ddbcfcd1c8b2633fa
| 32,100,585,616,010 |
0c74c865e1244fa449c9dde887afa536a9cc378b
|
/PizzaHTest/src/test/java/com/pizzhut/qa/testcases/CarryoutPageTest.java
|
615e54649e19ba0627382fb00b342ee1fcf677ba
|
[] |
no_license
|
nsroopa/PizzaHFinal
|
https://github.com/nsroopa/PizzaHFinal
|
885fde1d666cc59a8ecca689225eb36403f09e41
|
c10bf348fc8ace475d3284506ee2eecc5fc29b01
|
refs/heads/master
| 2022-11-11T18:40:39.138000 | 2020-07-01T15:54:23 | 2020-07-01T15:54:23 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.pizzhut.qa.testcases;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import com.pizzahut.qa.pages.CarryoutPage;
import com.pizzahut.qa.pages.HomePage;
import com.pizzahut.qa.pages.OrderPage;
import com.pizzahut.qa.pages.PizzaPage;
import com.pizzhut.qa.base.TestBase;
public class CarryoutPageTest extends TestBase {
HomePage homePage;
PizzaPage pizzaPage;
OrderPage orderPage;
CarryoutPage carryoutPage;
public CarryoutPageTest() {
super();
}
@BeforeMethod
public void setUp() {
initialization();
homePage=new HomePage();
pizzaPage = new PizzaPage();
orderPage = new OrderPage();
carryoutPage = new CarryoutPage();
}
@Test(priority=1)
public void validateZipCodeLink() {
homePage.clickOnMenuLink();
pizzaPage=homePage.clickOnPizzaLink();
orderPage=pizzaPage.clickOnOrderNowButton();
carryoutPage=orderPage.clickOnCarryoutLink();
boolean zipcodetab = carryoutPage.validatezipCodeTab();
Assert.assertTrue(zipcodetab);
}
@Test(priority=2)
public void enterZipCode() {
homePage.clickOnMenuLink();
pizzaPage=homePage.clickOnPizzaLink();
orderPage=pizzaPage.clickOnOrderNowButton();
carryoutPage=orderPage.clickOnCarryoutLink();
carryoutPage.enterValueInZipCodeLink();
}
@AfterMethod
public void tearDown() {
driver.quit();
}
}
|
UTF-8
|
Java
| 1,415 |
java
|
CarryoutPageTest.java
|
Java
|
[] | null |
[] |
package com.pizzhut.qa.testcases;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import com.pizzahut.qa.pages.CarryoutPage;
import com.pizzahut.qa.pages.HomePage;
import com.pizzahut.qa.pages.OrderPage;
import com.pizzahut.qa.pages.PizzaPage;
import com.pizzhut.qa.base.TestBase;
public class CarryoutPageTest extends TestBase {
HomePage homePage;
PizzaPage pizzaPage;
OrderPage orderPage;
CarryoutPage carryoutPage;
public CarryoutPageTest() {
super();
}
@BeforeMethod
public void setUp() {
initialization();
homePage=new HomePage();
pizzaPage = new PizzaPage();
orderPage = new OrderPage();
carryoutPage = new CarryoutPage();
}
@Test(priority=1)
public void validateZipCodeLink() {
homePage.clickOnMenuLink();
pizzaPage=homePage.clickOnPizzaLink();
orderPage=pizzaPage.clickOnOrderNowButton();
carryoutPage=orderPage.clickOnCarryoutLink();
boolean zipcodetab = carryoutPage.validatezipCodeTab();
Assert.assertTrue(zipcodetab);
}
@Test(priority=2)
public void enterZipCode() {
homePage.clickOnMenuLink();
pizzaPage=homePage.clickOnPizzaLink();
orderPage=pizzaPage.clickOnOrderNowButton();
carryoutPage=orderPage.clickOnCarryoutLink();
carryoutPage.enterValueInZipCodeLink();
}
@AfterMethod
public void tearDown() {
driver.quit();
}
}
| 1,415 | 0.767491 | 0.766078 | 61 | 22.196722 | 16.91136 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.590164 | false | false |
5
|
db53d7b5c6ddf9ca0e7dd10c482221da980f2c57
| 32,100,585,617,605 |
927854e38a9693f07c0db5be1621772740305666
|
/src/main/java/org/se2/model/objects/dto/VertrieblerDTO.java
|
cfc7d2be3ace3fb88487df10d34304b355fe0d36
|
[] |
no_license
|
WeltHerr/SE2
|
https://github.com/WeltHerr/SE2
|
026e2b836fe4d68b65b7819407d92800f837bb55
|
4fb2ad866692bce45dfdc4b5f43471582d0215b3
|
refs/heads/master
| 2022-12-21T05:15:54.238000 | 2020-09-20T11:05:45 | 2020-09-20T11:05:45 | 288,757,302 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.se2.model.objects.dto;
public class VertrieblerDTO extends UserDTO {
public VertrieblerDTO(UserDTO userDTO) {
super(userDTO);
}
}
|
UTF-8
|
Java
| 160 |
java
|
VertrieblerDTO.java
|
Java
|
[] | null |
[] |
package org.se2.model.objects.dto;
public class VertrieblerDTO extends UserDTO {
public VertrieblerDTO(UserDTO userDTO) {
super(userDTO);
}
}
| 160 | 0.70625 | 0.7 | 8 | 19 | 18.654758 | 45 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false |
5
|
487e1863e55345fcc2ba80d2a45c82d390878ddc
| 25,589,415,193,617 |
d21935ce8e9325d0f9937c32ccaa8c554a0b3bb1
|
/FdAndroidPork/src/com/wondersgroup/pork/activity/dealer/BillDetailActivity.java
|
0b1110e4fbdac9d795e7f8c327c50d5afa8f869d
|
[] |
no_license
|
bjy-23/njgs
|
https://github.com/bjy-23/njgs
|
6af025a58016c30a04506c4661c46ab5a97abfec
|
88bc8332e53877a3c5e72fedb2a13df1f4485478
|
refs/heads/master
| 2016-09-13T06:08:43.767000 | 2016-05-21T17:19:29 | 2016-05-21T17:19:29 | 59,372,547 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.wondersgroup.pork.activity.dealer;
import java.util.ArrayList;
import java.util.List;
import com.wondersgroup.pork.R;
import com.wondersgroup.pork.activity.AbstractActivity;
import com.wondersgroup.pork.activity.AbstractAdapter;
import com.wondersgroup.pork.activity.dealer.adapter.BillAdapter;
import com.wondersgroup.pork.activity.dealer.adapter.CertBillGoodsAdapter;
import com.wondersgroup.pork.activity.view.ScrollListView;
import com.wondersgroup.pork.constant.Constant;
import com.wondersgroup.pork.constant.Constant.Extra;
import com.wondersgroup.pork.constant.UrlConstant;
import com.wondersgroup.pork.entity.dealer.CertBillDetail;
import com.wondersgroup.pork.entity.dealer.SupplierData;
import com.wondersgroup.pork.model.dealer.CertBillModel;
import com.wondersgroup.pork.util.ImageSyncUtils;
import com.wondersgroup.pork.util.Utils;
import com.wondersgroup.pork.view.IObjView;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ImageView;
import android.widget.TextView;
/**
* 票据详情
*
*/
public class BillDetailActivity extends AbstractActivity implements IObjView<CertBillDetail> {
private Resources res;
private TextView mTextBillNum; //票据编号
private TextView mTextBillName; //票据名称
private TextView mTextSupplierName; //销售/生产单位
private TextView mTextBuyerName; //购货方
private TextView mTextPurchase; //进货摊位
private TextView mTextSellArea; //销售区域
private ScrollListView listViewGoods;//产品列表
private ScrollListView listViewBill; //票据列表
private CertBillGoodsAdapter goodsAdapter;
private BillAdapter billAdapter;
private List<String> photoList = new ArrayList<String>();
private List<String> titleList = new ArrayList<String>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initData();
initViews();
initViewsData();
}
@Override
protected void setContentView() {
setContentView(R.layout.activity_bill_detail);
}
private void initData() {
res = getResources();
}
private void initViews() {
mTextBillNum = this.findView(R.id.text_bill_number);
mTextBillName = this.findView(R.id.text_bill_name);
mTextSupplierName = this.findView(R.id.text_supplier_name);
mTextBuyerName = this.findView(R.id.text_buyer_name);
mTextPurchase = this.findView(R.id.text_purchase);
mTextSellArea = this.findView(R.id.text_sell_area);
listViewGoods = (ScrollListView)this.findViewById(R.id.listview_goods);
listViewBill = (ScrollListView)this.findViewById(R.id.listview_photo);
}
private void initViewsData() {
super.mTextTitle.setText(R.string.bill_detail);
final String id = getIntent().getStringExtra(Extra.ID);
final CertBillModel model = new CertBillModel(this);
goodsAdapter = new CertBillGoodsAdapter(this);
model.getInfo(id);
}
private void initDetailData(final CertBillDetail object) {
if (object == null) {
return;
}
if(object.getCertNum()!=null)
mTextBillNum.setText(mTextBillNum.getText().toString() + object.getCertNum());
if(object.getCertName()!=null)
mTextBillName.setText(mTextBillName.getText().toString() + object.getCertName());
if(object.getSupplierName()!=null)
mTextSupplierName.setText(mTextSupplierName.getText().toString() + object.getSupplierName());
if(object.getStaffName()!=null)
mTextBuyerName.setText(mTextBuyerName.getText().toString() + object.getStaffName());
if(object.getStaffName()!=null)
mTextBuyerName.setText(mTextBuyerName.getText().toString() + object.getStaffName());
if(object.getBoothNum()!=null)
mTextPurchase.setText(mTextPurchase.getText().toString() + object.getBoothNum());
if(object.getArea()!=null)
mTextSellArea.setText(mTextSellArea.getText().toString() + object.getArea());
if(object.getCertGoodsList()!=null){
goodsAdapter.addItems(object.getCertGoodsList());
listViewGoods.setAdapter(goodsAdapter);
listViewGoods.setOnItemClickListener(new OnItemClickListener(){
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
// TODO Auto-generated method stub
//显示猪肉的详细信息
Intent intent = new Intent(BillDetailActivity.this, MeatDetailActivity.class);
Bundle bundle = new Bundle();
bundle.putSerializable("CertBillGoods", object.getCertGoodsList().get(position));
intent.putExtras(bundle);
startActivity(intent);
}});
}
// if(object.getCertGoodsList()){
// billAdapter = new BillAdapter(this, titleList);
// billAdapter.addItems(photoList);
// listViewBill.setAdapter(billAdapter);
// }
final String billTypeId = object.getCertTypeId();
if (!Constant.MEAT_UUID.equals(billTypeId)) {
// mTextRedBillNum.setVisibility(View.GONE);
// mTextWhiteBillNum.setVisibility(View.GONE);
// mTextQuarantineNo.setVisibility(View.GONE);
// mTextCertificateConformity.setVisibility(View.GONE);
/** 判断票据图片 */
final String photoPath = object.getWhitePhotoPath();
if (!TextUtils.isEmpty(photoPath)) {
findView(R.id.layout_red_bill).setVisibility(View.VISIBLE);
final ImageView icon = findView(R.id.image_red_bill);
final TextView title = findView(R.id.text_red_bill_title);
title.setText("票据图片");
String url = UrlConstant.IMAGE_PATH + photoPath;
ImageSyncUtils.displayImage(url, icon);
}
} else {
// mTextRedBillNum.setText("红票编号:" + object.getRedNum());
// mTextWhiteBillNum.setText("白票编号:" + object.getWhiteNum());
// mTextQuarantineNo.setText("检疫证号:" + object.getQuarNum());
// mTextCertificateConformity.setText("合格证号:" + object.getQualiNum());
/** 判断红票图片 */
final String redPhotoPath = object.getRedPhotoPath();
if (!TextUtils.isEmpty(redPhotoPath)) {
findView(R.id.layout_red_bill).setVisibility(View.VISIBLE);
final ImageView icon = findView(R.id.image_red_bill);
String url = UrlConstant.IMAGE_PATH + redPhotoPath;
ImageSyncUtils.displayImage(url, icon);
}
/** 判断白票图片 */
final String whitePhotoPath = object.getWhitePhotoPath();
if (!TextUtils.isEmpty(whitePhotoPath)) {
findView(R.id.layout_white_bill).setVisibility(View.VISIBLE);
final ImageView icon = findView(R.id.image_white_bill);
String url = UrlConstant.IMAGE_PATH + whitePhotoPath;
ImageSyncUtils.displayImage(url, icon);
}
}
}
@Override
public void failure(String text) {
handlerFailure(text);
}
@Override
public void success(final CertBillDetail t) {
runOnUiThread(new Runnable() {
@Override
public void run() {
initDetailData(t);
}
});
}
@Override
public void relogin(String text) {
reLogin(text);
}
}
|
UTF-8
|
Java
| 6,955 |
java
|
BillDetailActivity.java
|
Java
|
[] | null |
[] |
package com.wondersgroup.pork.activity.dealer;
import java.util.ArrayList;
import java.util.List;
import com.wondersgroup.pork.R;
import com.wondersgroup.pork.activity.AbstractActivity;
import com.wondersgroup.pork.activity.AbstractAdapter;
import com.wondersgroup.pork.activity.dealer.adapter.BillAdapter;
import com.wondersgroup.pork.activity.dealer.adapter.CertBillGoodsAdapter;
import com.wondersgroup.pork.activity.view.ScrollListView;
import com.wondersgroup.pork.constant.Constant;
import com.wondersgroup.pork.constant.Constant.Extra;
import com.wondersgroup.pork.constant.UrlConstant;
import com.wondersgroup.pork.entity.dealer.CertBillDetail;
import com.wondersgroup.pork.entity.dealer.SupplierData;
import com.wondersgroup.pork.model.dealer.CertBillModel;
import com.wondersgroup.pork.util.ImageSyncUtils;
import com.wondersgroup.pork.util.Utils;
import com.wondersgroup.pork.view.IObjView;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ImageView;
import android.widget.TextView;
/**
* 票据详情
*
*/
public class BillDetailActivity extends AbstractActivity implements IObjView<CertBillDetail> {
private Resources res;
private TextView mTextBillNum; //票据编号
private TextView mTextBillName; //票据名称
private TextView mTextSupplierName; //销售/生产单位
private TextView mTextBuyerName; //购货方
private TextView mTextPurchase; //进货摊位
private TextView mTextSellArea; //销售区域
private ScrollListView listViewGoods;//产品列表
private ScrollListView listViewBill; //票据列表
private CertBillGoodsAdapter goodsAdapter;
private BillAdapter billAdapter;
private List<String> photoList = new ArrayList<String>();
private List<String> titleList = new ArrayList<String>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initData();
initViews();
initViewsData();
}
@Override
protected void setContentView() {
setContentView(R.layout.activity_bill_detail);
}
private void initData() {
res = getResources();
}
private void initViews() {
mTextBillNum = this.findView(R.id.text_bill_number);
mTextBillName = this.findView(R.id.text_bill_name);
mTextSupplierName = this.findView(R.id.text_supplier_name);
mTextBuyerName = this.findView(R.id.text_buyer_name);
mTextPurchase = this.findView(R.id.text_purchase);
mTextSellArea = this.findView(R.id.text_sell_area);
listViewGoods = (ScrollListView)this.findViewById(R.id.listview_goods);
listViewBill = (ScrollListView)this.findViewById(R.id.listview_photo);
}
private void initViewsData() {
super.mTextTitle.setText(R.string.bill_detail);
final String id = getIntent().getStringExtra(Extra.ID);
final CertBillModel model = new CertBillModel(this);
goodsAdapter = new CertBillGoodsAdapter(this);
model.getInfo(id);
}
private void initDetailData(final CertBillDetail object) {
if (object == null) {
return;
}
if(object.getCertNum()!=null)
mTextBillNum.setText(mTextBillNum.getText().toString() + object.getCertNum());
if(object.getCertName()!=null)
mTextBillName.setText(mTextBillName.getText().toString() + object.getCertName());
if(object.getSupplierName()!=null)
mTextSupplierName.setText(mTextSupplierName.getText().toString() + object.getSupplierName());
if(object.getStaffName()!=null)
mTextBuyerName.setText(mTextBuyerName.getText().toString() + object.getStaffName());
if(object.getStaffName()!=null)
mTextBuyerName.setText(mTextBuyerName.getText().toString() + object.getStaffName());
if(object.getBoothNum()!=null)
mTextPurchase.setText(mTextPurchase.getText().toString() + object.getBoothNum());
if(object.getArea()!=null)
mTextSellArea.setText(mTextSellArea.getText().toString() + object.getArea());
if(object.getCertGoodsList()!=null){
goodsAdapter.addItems(object.getCertGoodsList());
listViewGoods.setAdapter(goodsAdapter);
listViewGoods.setOnItemClickListener(new OnItemClickListener(){
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
// TODO Auto-generated method stub
//显示猪肉的详细信息
Intent intent = new Intent(BillDetailActivity.this, MeatDetailActivity.class);
Bundle bundle = new Bundle();
bundle.putSerializable("CertBillGoods", object.getCertGoodsList().get(position));
intent.putExtras(bundle);
startActivity(intent);
}});
}
// if(object.getCertGoodsList()){
// billAdapter = new BillAdapter(this, titleList);
// billAdapter.addItems(photoList);
// listViewBill.setAdapter(billAdapter);
// }
final String billTypeId = object.getCertTypeId();
if (!Constant.MEAT_UUID.equals(billTypeId)) {
// mTextRedBillNum.setVisibility(View.GONE);
// mTextWhiteBillNum.setVisibility(View.GONE);
// mTextQuarantineNo.setVisibility(View.GONE);
// mTextCertificateConformity.setVisibility(View.GONE);
/** 判断票据图片 */
final String photoPath = object.getWhitePhotoPath();
if (!TextUtils.isEmpty(photoPath)) {
findView(R.id.layout_red_bill).setVisibility(View.VISIBLE);
final ImageView icon = findView(R.id.image_red_bill);
final TextView title = findView(R.id.text_red_bill_title);
title.setText("票据图片");
String url = UrlConstant.IMAGE_PATH + photoPath;
ImageSyncUtils.displayImage(url, icon);
}
} else {
// mTextRedBillNum.setText("红票编号:" + object.getRedNum());
// mTextWhiteBillNum.setText("白票编号:" + object.getWhiteNum());
// mTextQuarantineNo.setText("检疫证号:" + object.getQuarNum());
// mTextCertificateConformity.setText("合格证号:" + object.getQualiNum());
/** 判断红票图片 */
final String redPhotoPath = object.getRedPhotoPath();
if (!TextUtils.isEmpty(redPhotoPath)) {
findView(R.id.layout_red_bill).setVisibility(View.VISIBLE);
final ImageView icon = findView(R.id.image_red_bill);
String url = UrlConstant.IMAGE_PATH + redPhotoPath;
ImageSyncUtils.displayImage(url, icon);
}
/** 判断白票图片 */
final String whitePhotoPath = object.getWhitePhotoPath();
if (!TextUtils.isEmpty(whitePhotoPath)) {
findView(R.id.layout_white_bill).setVisibility(View.VISIBLE);
final ImageView icon = findView(R.id.image_white_bill);
String url = UrlConstant.IMAGE_PATH + whitePhotoPath;
ImageSyncUtils.displayImage(url, icon);
}
}
}
@Override
public void failure(String text) {
handlerFailure(text);
}
@Override
public void success(final CertBillDetail t) {
runOnUiThread(new Runnable() {
@Override
public void run() {
initDetailData(t);
}
});
}
@Override
public void relogin(String text) {
reLogin(text);
}
}
| 6,955 | 0.749521 | 0.749521 | 199 | 33.065327 | 25.179173 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.40201 | false | false |
5
|
dbda0d40de082f6dee01636f3f6e551312a6808d
| 17,051,020,206,963 |
37caae530708e831ab47930edf97172871e5ae1a
|
/src/main/java/kr/co/webmill/recipe/repository/IngredientRepository.java
|
853094064a26d276b13cf380594d3cffb4084928
|
[] |
no_license
|
jusjuke/recipe
|
https://github.com/jusjuke/recipe
|
ff0f788212c338f4ea515ecdde0bf1fe47209f6b
|
a7201921d6184ead750afc27f7a727d91df5cabe
|
refs/heads/master
| 2022-03-21T08:25:43.209000 | 2022-02-15T10:36:03 | 2022-02-15T10:36:03 | 173,532,709 | 0 | 0 | null | false | 2022-02-15T10:51:52 | 2019-03-03T04:58:52 | 2022-02-15T10:51:29 | 2022-02-15T10:51:51 | 63 | 0 | 0 | 1 |
Java
| false | false |
package kr.co.webmill.recipe.repository;
import kr.co.webmill.recipe.domains.Ingredient;
import org.springframework.data.repository.CrudRepository;
public interface IngredientRepository extends CrudRepository<Ingredient, Long> {
}
|
UTF-8
|
Java
| 233 |
java
|
IngredientRepository.java
|
Java
|
[] | null |
[] |
package kr.co.webmill.recipe.repository;
import kr.co.webmill.recipe.domains.Ingredient;
import org.springframework.data.repository.CrudRepository;
public interface IngredientRepository extends CrudRepository<Ingredient, Long> {
}
| 233 | 0.841202 | 0.841202 | 7 | 32.285713 | 29.946211 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.571429 | false | false |
5
|
61445654c7dd55989f6d8cb6edefc35d359c683f
| 4,372,276,732,550 |
3c45ef1bb3b404e3ddb0791f5139043eac48a79e
|
/SDK/liferay-plugins-sdk/portlets/rev-portlet/docroot/WEB-INF/src/com/hitss/layer/model/impl/LogOperacionesCacheModel.java
|
ac44878f9ab2a1d5c7886f7101f267212e36e493
|
[] |
no_license
|
danieldelgado/ProyectoInformatico-Reporsitorio
|
https://github.com/danieldelgado/ProyectoInformatico-Reporsitorio
|
216d91ca6f8a4598bcad27bfc5f018e5ba5f6561
|
2ac768ae4d41e7b566a521b5cef976a78271e336
|
refs/heads/master
| 2021-04-09T17:15:19.944000 | 2017-02-26T05:52:04 | 2017-02-26T05:52:04 | 55,432,714 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library 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 Lesser General Public License for more
* details.
*/
package com.hitss.layer.model.impl;
import com.hitss.layer.model.LogOperaciones;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.Date;
/**
* The cache model class for representing LogOperaciones in entity cache.
*
* @author Danielle Delgado
* @see LogOperaciones
* @generated
*/
public class LogOperacionesCacheModel implements CacheModel<LogOperaciones>,
Externalizable {
@Override
public String toString() {
StringBundler sb = new StringBundler(19);
sb.append("{logOperacionesId=");
sb.append(logOperacionesId);
sb.append(", tipoActividad=");
sb.append(tipoActividad);
sb.append(", actividad=");
sb.append(actividad);
sb.append(", usuario=");
sb.append(usuario);
sb.append(", activo=");
sb.append(activo);
sb.append(", usuariocrea=");
sb.append(usuariocrea);
sb.append(", fechacrea=");
sb.append(fechacrea);
sb.append(", usuariomodifica=");
sb.append(usuariomodifica);
sb.append(", fechamodifica=");
sb.append(fechamodifica);
sb.append("}");
return sb.toString();
}
@Override
public LogOperaciones toEntityModel() {
LogOperacionesImpl logOperacionesImpl = new LogOperacionesImpl();
logOperacionesImpl.setLogOperacionesId(logOperacionesId);
logOperacionesImpl.setTipoActividad(tipoActividad);
if (actividad == null) {
logOperacionesImpl.setActividad(StringPool.BLANK);
}
else {
logOperacionesImpl.setActividad(actividad);
}
if (usuario == null) {
logOperacionesImpl.setUsuario(StringPool.BLANK);
}
else {
logOperacionesImpl.setUsuario(usuario);
}
logOperacionesImpl.setActivo(activo);
logOperacionesImpl.setUsuariocrea(usuariocrea);
if (fechacrea == Long.MIN_VALUE) {
logOperacionesImpl.setFechacrea(null);
}
else {
logOperacionesImpl.setFechacrea(new Date(fechacrea));
}
logOperacionesImpl.setUsuariomodifica(usuariomodifica);
if (fechamodifica == Long.MIN_VALUE) {
logOperacionesImpl.setFechamodifica(null);
}
else {
logOperacionesImpl.setFechamodifica(new Date(fechamodifica));
}
logOperacionesImpl.resetOriginalValues();
return logOperacionesImpl;
}
@Override
public void readExternal(ObjectInput objectInput) throws IOException {
logOperacionesId = objectInput.readLong();
tipoActividad = objectInput.readLong();
actividad = objectInput.readUTF();
usuario = objectInput.readUTF();
activo = objectInput.readBoolean();
usuariocrea = objectInput.readLong();
fechacrea = objectInput.readLong();
usuariomodifica = objectInput.readLong();
fechamodifica = objectInput.readLong();
}
@Override
public void writeExternal(ObjectOutput objectOutput)
throws IOException {
objectOutput.writeLong(logOperacionesId);
objectOutput.writeLong(tipoActividad);
if (actividad == null) {
objectOutput.writeUTF(StringPool.BLANK);
}
else {
objectOutput.writeUTF(actividad);
}
if (usuario == null) {
objectOutput.writeUTF(StringPool.BLANK);
}
else {
objectOutput.writeUTF(usuario);
}
objectOutput.writeBoolean(activo);
objectOutput.writeLong(usuariocrea);
objectOutput.writeLong(fechacrea);
objectOutput.writeLong(usuariomodifica);
objectOutput.writeLong(fechamodifica);
}
public long logOperacionesId;
public long tipoActividad;
public String actividad;
public String usuario;
public boolean activo;
public long usuariocrea;
public long fechacrea;
public long usuariomodifica;
public long fechamodifica;
}
|
UTF-8
|
Java
| 4,238 |
java
|
LogOperacionesCacheModel.java
|
Java
|
[
{
"context": "ting LogOperaciones in entity cache.\n *\n * @author Danielle Delgado\n * @see LogOperaciones\n * @generated\n */\npublic c",
"end": 1073,
"score": 0.9998475909233093,
"start": 1057,
"tag": "NAME",
"value": "Danielle Delgado"
}
] | null |
[] |
/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library 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 Lesser General Public License for more
* details.
*/
package com.hitss.layer.model.impl;
import com.hitss.layer.model.LogOperaciones;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.Date;
/**
* The cache model class for representing LogOperaciones in entity cache.
*
* @author <NAME>
* @see LogOperaciones
* @generated
*/
public class LogOperacionesCacheModel implements CacheModel<LogOperaciones>,
Externalizable {
@Override
public String toString() {
StringBundler sb = new StringBundler(19);
sb.append("{logOperacionesId=");
sb.append(logOperacionesId);
sb.append(", tipoActividad=");
sb.append(tipoActividad);
sb.append(", actividad=");
sb.append(actividad);
sb.append(", usuario=");
sb.append(usuario);
sb.append(", activo=");
sb.append(activo);
sb.append(", usuariocrea=");
sb.append(usuariocrea);
sb.append(", fechacrea=");
sb.append(fechacrea);
sb.append(", usuariomodifica=");
sb.append(usuariomodifica);
sb.append(", fechamodifica=");
sb.append(fechamodifica);
sb.append("}");
return sb.toString();
}
@Override
public LogOperaciones toEntityModel() {
LogOperacionesImpl logOperacionesImpl = new LogOperacionesImpl();
logOperacionesImpl.setLogOperacionesId(logOperacionesId);
logOperacionesImpl.setTipoActividad(tipoActividad);
if (actividad == null) {
logOperacionesImpl.setActividad(StringPool.BLANK);
}
else {
logOperacionesImpl.setActividad(actividad);
}
if (usuario == null) {
logOperacionesImpl.setUsuario(StringPool.BLANK);
}
else {
logOperacionesImpl.setUsuario(usuario);
}
logOperacionesImpl.setActivo(activo);
logOperacionesImpl.setUsuariocrea(usuariocrea);
if (fechacrea == Long.MIN_VALUE) {
logOperacionesImpl.setFechacrea(null);
}
else {
logOperacionesImpl.setFechacrea(new Date(fechacrea));
}
logOperacionesImpl.setUsuariomodifica(usuariomodifica);
if (fechamodifica == Long.MIN_VALUE) {
logOperacionesImpl.setFechamodifica(null);
}
else {
logOperacionesImpl.setFechamodifica(new Date(fechamodifica));
}
logOperacionesImpl.resetOriginalValues();
return logOperacionesImpl;
}
@Override
public void readExternal(ObjectInput objectInput) throws IOException {
logOperacionesId = objectInput.readLong();
tipoActividad = objectInput.readLong();
actividad = objectInput.readUTF();
usuario = objectInput.readUTF();
activo = objectInput.readBoolean();
usuariocrea = objectInput.readLong();
fechacrea = objectInput.readLong();
usuariomodifica = objectInput.readLong();
fechamodifica = objectInput.readLong();
}
@Override
public void writeExternal(ObjectOutput objectOutput)
throws IOException {
objectOutput.writeLong(logOperacionesId);
objectOutput.writeLong(tipoActividad);
if (actividad == null) {
objectOutput.writeUTF(StringPool.BLANK);
}
else {
objectOutput.writeUTF(actividad);
}
if (usuario == null) {
objectOutput.writeUTF(StringPool.BLANK);
}
else {
objectOutput.writeUTF(usuario);
}
objectOutput.writeBoolean(activo);
objectOutput.writeLong(usuariocrea);
objectOutput.writeLong(fechacrea);
objectOutput.writeLong(usuariomodifica);
objectOutput.writeLong(fechamodifica);
}
public long logOperacionesId;
public long tipoActividad;
public String actividad;
public String usuario;
public boolean activo;
public long usuariocrea;
public long fechacrea;
public long usuariomodifica;
public long fechamodifica;
}
| 4,228 | 0.751062 | 0.749174 | 160 | 25.49375 | 21.754597 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.80625 | false | false |
5
|
9b1b93e4aba0397a63ef32c8ed7310f0ddf88e84
| 11,166,914,975,525 |
dd63851a3a2ae9178be9d551fc8314eff2f78fa5
|
/Data Structure & Algorithms/Assign2/Ass2.java
|
0bb2013dcf2b70c18feb15f76bdd41e9b48b4219
|
[] |
no_license
|
jonibaki/Year-2
|
https://github.com/jonibaki/Year-2
|
1d269882f857dd2874e00fd71399e1065c233985
|
64e92608e85e8574858bb741c362472ff168b2e9
|
refs/heads/master
| 2022-04-08T19:00:02.602000 | 2020-03-02T20:28:34 | 2020-03-02T20:28:34 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* Programmed by Md Abu Joni
* Reg NO-1606072
* Assignment 2
* Submission date- 20/03/2018
*/
public class Ass2 {
public static void main (String []args){
ExpTree myTree=null;
System.out.println("Md Abu Joni 1606072");
System.out.println("Welcome to Joni's expression evaluation program. Please type an expression");
String userInput = "";
Parser p = new Parser();
do {
try {
myTree = p.parseLine();
//check for the let tree first
if (myTree.value == null){
myTree.post_order(myTree.lChild);
System.out.println("Post-order: "+ myTree.post_order(myTree.rChild));
System.out.println("In-order: "+myTree.toString(myTree));
System.out.println("Result of the expression: "+myTree.evaluate_express(myTree.rChild));
}else{
System.out.println("Post-order: "+ myTree.post_order(myTree));
System.out.println("In-order: "+myTree.toString(myTree));
try {
System.out.println("Result of the expression: "+myTree.evaluate_express(myTree));
}catch (ArithmeticException e){
System.out.println(e.getMessage());
}
}
}catch(ParseException e){
System.out.println(e.getMessage());
}
System.out.println();
System.out.println("Another expression (y/n)? OR any output to terminate!!");
userInput=p.getLine();
if(userInput.equalsIgnoreCase("y")){
System.out.println("Please type an expression");
}else if (userInput.equalsIgnoreCase("n")) {
break;
}else{
System.out.println("Program Terminating... ");
}
}while (userInput.equalsIgnoreCase("y"));
System.out.println("___END OF PROGRAM___ ");
}
}
|
UTF-8
|
Java
| 2,091 |
java
|
Ass2.java
|
Java
|
[
{
"context": "/*\r\n* Programmed by Md Abu Joni\r\n* Reg NO-1606072\r\n* Assignment 2\r\n* Submission d",
"end": 31,
"score": 0.9998832941055298,
"start": 20,
"tag": "NAME",
"value": "Md Abu Joni"
},
{
"context": "ExpTree myTree=null;\r\n System.out.println(\"Md Abu Joni 1606072\");\r\n System.out.println(\"Welcome t",
"end": 240,
"score": 0.9998582601547241,
"start": 229,
"tag": "NAME",
"value": "Md Abu Joni"
}
] | null |
[] |
/*
* Programmed by <NAME>
* Reg NO-1606072
* Assignment 2
* Submission date- 20/03/2018
*/
public class Ass2 {
public static void main (String []args){
ExpTree myTree=null;
System.out.println("<NAME> 1606072");
System.out.println("Welcome to Joni's expression evaluation program. Please type an expression");
String userInput = "";
Parser p = new Parser();
do {
try {
myTree = p.parseLine();
//check for the let tree first
if (myTree.value == null){
myTree.post_order(myTree.lChild);
System.out.println("Post-order: "+ myTree.post_order(myTree.rChild));
System.out.println("In-order: "+myTree.toString(myTree));
System.out.println("Result of the expression: "+myTree.evaluate_express(myTree.rChild));
}else{
System.out.println("Post-order: "+ myTree.post_order(myTree));
System.out.println("In-order: "+myTree.toString(myTree));
try {
System.out.println("Result of the expression: "+myTree.evaluate_express(myTree));
}catch (ArithmeticException e){
System.out.println(e.getMessage());
}
}
}catch(ParseException e){
System.out.println(e.getMessage());
}
System.out.println();
System.out.println("Another expression (y/n)? OR any output to terminate!!");
userInput=p.getLine();
if(userInput.equalsIgnoreCase("y")){
System.out.println("Please type an expression");
}else if (userInput.equalsIgnoreCase("n")) {
break;
}else{
System.out.println("Program Terminating... ");
}
}while (userInput.equalsIgnoreCase("y"));
System.out.println("___END OF PROGRAM___ ");
}
}
| 2,081 | 0.512673 | 0.501196 | 52 | 38.21154 | 29.149044 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.442308 | false | false |
5
|
020dd3b332ea35b526b85e7535c40bac46f60ff3
| 30,167,850,319,810 |
0e3043ec36e6138aa1c75e83e3c9c16bb75b6da7
|
/src/main/java/com/projeto/repository/EtapaProducaoRepository.java
|
a3d0b21cdd96b515f66c09d98a6c4a10a4d229ae
|
[] |
no_license
|
GabrielFrederico/DyOpe_Assistant
|
https://github.com/GabrielFrederico/DyOpe_Assistant
|
eef1bd5361e1dc31a11dbf43823b2bf61d52435b
|
eccb77f96ea9c93e0b49e1bd8529bc9d261f7128
|
refs/heads/master
| 2020-06-20T10:18:24.572000 | 2019-07-05T13:59:46 | 2019-07-05T13:59:46 | 197,088,692 | 1 | 0 | null | true | 2019-07-16T00:07:42 | 2019-07-16T00:07:42 | 2019-07-05T14:00:28 | 2019-07-05T14:00:26 | 18,755 | 0 | 0 | 0 | null | false | false |
package com.projeto.repository;
import com.projeto.models.EtapaProducao;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import java.io.Serializable;
import org.springframework.data.jpa.repository.JpaRepository;
public interface EtapaProducaoRepository extends CrudRepository<EtapaProducao, Serializable> {
EtapaProducao findById(long id);
EtapaProducao findByEtapaProducao(String etapaProducao);
@Query(value = "SELECT * FROM etapa_producao WHERE predefinidas = 1", nativeQuery = true)
Iterable<EtapaProducao> listaEtapasPredefinidas();
}
|
UTF-8
|
Java
| 628 |
java
|
EtapaProducaoRepository.java
|
Java
|
[] | null |
[] |
package com.projeto.repository;
import com.projeto.models.EtapaProducao;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import java.io.Serializable;
import org.springframework.data.jpa.repository.JpaRepository;
public interface EtapaProducaoRepository extends CrudRepository<EtapaProducao, Serializable> {
EtapaProducao findById(long id);
EtapaProducao findByEtapaProducao(String etapaProducao);
@Query(value = "SELECT * FROM etapa_producao WHERE predefinidas = 1", nativeQuery = true)
Iterable<EtapaProducao> listaEtapasPredefinidas();
}
| 628 | 0.812102 | 0.81051 | 18 | 33.888889 | 31.239023 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false |
5
|
00fb9f7abdc7b73a31acd9a94f4a88a60212f3cc
| 27,608,049,792,651 |
7a41efe13bc749301f300f8defd8c3c29862eb98
|
/core/src/com/cncoderx/game/magictower/Resources.java
|
e0f38489bc7925b7d2e6fdeaa42f6f7ca826f189
|
[] |
no_license
|
CNCoderX/MagicTower
|
https://github.com/CNCoderX/MagicTower
|
43177056d9a749605b73b370a231372648ad3cbf
|
767b13af278646a3c248ead492c2f26e1d97f3ce
|
refs/heads/master
| 2021-01-24T04:29:04.417000 | 2018-02-26T09:31:12 | 2018-02-26T09:31:12 | 122,941,642 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.cncoderx.game.magictower;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Animation;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.utils.Drawable;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Disposable;
import com.cncoderx.game.magictower.data.DataManager;
import com.cncoderx.game.magictower.data.FileLoader;
import com.cncoderx.game.magictower.data.Strings;
import com.cncoderx.game.magictower.drawable.DrawableContainer;
/**
* Created by admin on 2017/4/7.
*/
public class Resources implements Disposable {
private boolean isLoaded = false;
private AssetManager assetManager;
Resources() {
assetManager = new AssetManager();
assetManager.setLoader(Strings.class, new FileLoader<Strings>(
Strings.class, assetManager.getFileHandleResolver()));
assetManager.setLoader(DataManager.class, new FileLoader<DataManager>(
DataManager.class, assetManager.getFileHandleResolver()));
}
public void load() {
if (!isLoaded) {
assetManager.load("logo.jpg", Texture.class);
assetManager.load("bg.jpg", Texture.class);
assetManager.load("battle_bg.jpg", Texture.class);
assetManager.load("default.fnt", BitmapFont.class);
assetManager.load("default2.fnt", BitmapFont.class);
assetManager.load("ui.atlas", TextureAtlas.class);
assetManager.load("characters.atlas", TextureAtlas.class);
assetManager.load("strings", Strings.class);
assetManager.load("data", DataManager.class);
assetManager.load("stream.mp3", Music.class);
assetManager.load("bgm01.mp3", Music.class);
assetManager.load("bgm02.mp3", Music.class);
assetManager.load("bgm03.mp3", Music.class);
assetManager.load("bgm04.mp3", Music.class);
assetManager.load("bgm05.mp3", Music.class);
assetManager.load("access.mp3", Sound.class);
assetManager.load("attack01.mp3", Sound.class);
assetManager.load("attack02.mp3", Sound.class);
assetManager.load("collect.mp3", Sound.class);
assetManager.load("flip_over.mp3", Sound.class);
assetManager.load("negative.mp3", Sound.class);
assetManager.load("positive.mp3", Sound.class);
assetManager.load("reward.mp3", Sound.class);
assetManager.load("suck01.mp3", Sound.class);
assetManager.load("suck02.mp3", Sound.class);
assetManager.load("suck03.mp3", Sound.class);
assetManager.load("suck04.mp3", Sound.class);
assetManager.load("switch.mp3", Sound.class);
isLoaded = true;
}
}
public void unload(String fileName) {
assetManager.unload(fileName);
}
public float update() {
return isLoaded ? (assetManager.update() ? 1f : assetManager.getProgress()) : 0f;
}
public Music getMusic(String fileName) {
Music music = null;
if (isLoaded && assetManager.isLoaded(fileName)) {
music = assetManager.get(fileName, Music.class);
}
return music;
}
public Sound getSound(String fileName) {
Sound sound = null;
if (isLoaded && assetManager.isLoaded(fileName)) {
sound = assetManager.get(fileName, Sound.class);
}
return sound;
}
public BitmapFont getBitmapFont(String fileName) {
BitmapFont font = null;
if (isLoaded && assetManager.isLoaded(fileName)) {
font = assetManager.get(fileName, BitmapFont.class);
font.getRegion().getTexture().setFilter(
Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
}
return font;
}
public BitmapFont getBitmapFont(String fileName, float scale) {
BitmapFont font = null;
if (isLoaded && assetManager.isLoaded(fileName)) {
font = assetManager.get(fileName, BitmapFont.class);
font.getData().scale(scale);
font.getRegion().getTexture().setFilter(
Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
}
return font;
}
public Texture getTexture(String fileName) {
Texture texture = null;
if (isLoaded && assetManager.isLoaded(fileName)) {
texture = assetManager.get(fileName, Texture.class);
texture.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
}
return texture;
}
public TextureRegion getRegion(String atlas, String fileName) {
TextureRegion textureRegion = null;
TextureAtlas textureAtlas = null;
if (isLoaded && assetManager.isLoaded(atlas)) {
textureAtlas = assetManager.get(atlas, TextureAtlas.class);
textureRegion = textureAtlas.findRegion(fileName);
}
return textureRegion;
}
public TextureRegion getRegion(String atlas, String fileName, int index) {
TextureRegion textureRegion = null;
TextureAtlas textureAtlas = null;
if (isLoaded && assetManager.isLoaded(atlas)) {
textureAtlas = assetManager.get(atlas, TextureAtlas.class);
textureRegion = textureAtlas.findRegion(fileName, index);
}
return textureRegion;
}
public Drawable getDrawable(String atlas, String fileName) {
Drawable drawable = null;
TextureAtlas textureAtlas = null;
if (isLoaded && assetManager.isLoaded(atlas)) {
textureAtlas = assetManager.get(atlas, TextureAtlas.class);
Array<TextureAtlas.AtlasRegion> regions = textureAtlas.findRegions(fileName);
int size = regions.size;
if (size == 1) {
drawable = new TextureRegionDrawable(regions.get(0));
} else if (size > 1) {
Array<Drawable> drawables = new Array<Drawable>(size);
for (TextureAtlas.AtlasRegion region : regions) {
drawables.add(new TextureRegionDrawable(region));
}
drawable = new DrawableContainer(drawables);
}
}
return drawable;
}
public Animation<Drawable> getAnimation(String atlas, String fileName, float frameDuration) {
Animation<Drawable> animation = null;
TextureAtlas textureAtlas = null;
if (isLoaded && assetManager.isLoaded(atlas)) {
textureAtlas = assetManager.get(atlas, TextureAtlas.class);
Array<Drawable> drawables = new Array<Drawable>();
Array<TextureAtlas.AtlasRegion> regions = textureAtlas.findRegions(fileName);
for (TextureAtlas.AtlasRegion region : regions) {
drawables.add(new TextureRegionDrawable(region));
}
animation = new Animation<Drawable>(frameDuration, drawables);
}
return animation;
}
public String getString(int id) {
if (isLoaded && assetManager.isLoaded("strings")) {
Strings strings = assetManager.get("strings", Strings.class);
return strings.getString(id);
}
return "";
}
public String getString(int id, Object... args) {
if (isLoaded && assetManager.isLoaded("strings")) {
Strings strings = assetManager.get("strings", Strings.class);
return String.format(strings.getString(id), args);
}
return "";
}
public DataManager getDataManager() {
DataManager dataManager = null;
if (isLoaded && assetManager.isLoaded("data")) {
dataManager = assetManager.get("data", DataManager.class);
}
return dataManager;
}
@Override
public void dispose() {
if (isLoaded) {
isLoaded = false;
assetManager.dispose();
}
}
public static interface atlas {
String ui = "ui.atlas";
String character = "characters.atlas";
}
}
|
UTF-8
|
Java
| 8,413 |
java
|
Resources.java
|
Java
|
[] | null |
[] |
package com.cncoderx.game.magictower;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Animation;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.utils.Drawable;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Disposable;
import com.cncoderx.game.magictower.data.DataManager;
import com.cncoderx.game.magictower.data.FileLoader;
import com.cncoderx.game.magictower.data.Strings;
import com.cncoderx.game.magictower.drawable.DrawableContainer;
/**
* Created by admin on 2017/4/7.
*/
public class Resources implements Disposable {
private boolean isLoaded = false;
private AssetManager assetManager;
Resources() {
assetManager = new AssetManager();
assetManager.setLoader(Strings.class, new FileLoader<Strings>(
Strings.class, assetManager.getFileHandleResolver()));
assetManager.setLoader(DataManager.class, new FileLoader<DataManager>(
DataManager.class, assetManager.getFileHandleResolver()));
}
public void load() {
if (!isLoaded) {
assetManager.load("logo.jpg", Texture.class);
assetManager.load("bg.jpg", Texture.class);
assetManager.load("battle_bg.jpg", Texture.class);
assetManager.load("default.fnt", BitmapFont.class);
assetManager.load("default2.fnt", BitmapFont.class);
assetManager.load("ui.atlas", TextureAtlas.class);
assetManager.load("characters.atlas", TextureAtlas.class);
assetManager.load("strings", Strings.class);
assetManager.load("data", DataManager.class);
assetManager.load("stream.mp3", Music.class);
assetManager.load("bgm01.mp3", Music.class);
assetManager.load("bgm02.mp3", Music.class);
assetManager.load("bgm03.mp3", Music.class);
assetManager.load("bgm04.mp3", Music.class);
assetManager.load("bgm05.mp3", Music.class);
assetManager.load("access.mp3", Sound.class);
assetManager.load("attack01.mp3", Sound.class);
assetManager.load("attack02.mp3", Sound.class);
assetManager.load("collect.mp3", Sound.class);
assetManager.load("flip_over.mp3", Sound.class);
assetManager.load("negative.mp3", Sound.class);
assetManager.load("positive.mp3", Sound.class);
assetManager.load("reward.mp3", Sound.class);
assetManager.load("suck01.mp3", Sound.class);
assetManager.load("suck02.mp3", Sound.class);
assetManager.load("suck03.mp3", Sound.class);
assetManager.load("suck04.mp3", Sound.class);
assetManager.load("switch.mp3", Sound.class);
isLoaded = true;
}
}
public void unload(String fileName) {
assetManager.unload(fileName);
}
public float update() {
return isLoaded ? (assetManager.update() ? 1f : assetManager.getProgress()) : 0f;
}
public Music getMusic(String fileName) {
Music music = null;
if (isLoaded && assetManager.isLoaded(fileName)) {
music = assetManager.get(fileName, Music.class);
}
return music;
}
public Sound getSound(String fileName) {
Sound sound = null;
if (isLoaded && assetManager.isLoaded(fileName)) {
sound = assetManager.get(fileName, Sound.class);
}
return sound;
}
public BitmapFont getBitmapFont(String fileName) {
BitmapFont font = null;
if (isLoaded && assetManager.isLoaded(fileName)) {
font = assetManager.get(fileName, BitmapFont.class);
font.getRegion().getTexture().setFilter(
Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
}
return font;
}
public BitmapFont getBitmapFont(String fileName, float scale) {
BitmapFont font = null;
if (isLoaded && assetManager.isLoaded(fileName)) {
font = assetManager.get(fileName, BitmapFont.class);
font.getData().scale(scale);
font.getRegion().getTexture().setFilter(
Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
}
return font;
}
public Texture getTexture(String fileName) {
Texture texture = null;
if (isLoaded && assetManager.isLoaded(fileName)) {
texture = assetManager.get(fileName, Texture.class);
texture.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
}
return texture;
}
public TextureRegion getRegion(String atlas, String fileName) {
TextureRegion textureRegion = null;
TextureAtlas textureAtlas = null;
if (isLoaded && assetManager.isLoaded(atlas)) {
textureAtlas = assetManager.get(atlas, TextureAtlas.class);
textureRegion = textureAtlas.findRegion(fileName);
}
return textureRegion;
}
public TextureRegion getRegion(String atlas, String fileName, int index) {
TextureRegion textureRegion = null;
TextureAtlas textureAtlas = null;
if (isLoaded && assetManager.isLoaded(atlas)) {
textureAtlas = assetManager.get(atlas, TextureAtlas.class);
textureRegion = textureAtlas.findRegion(fileName, index);
}
return textureRegion;
}
public Drawable getDrawable(String atlas, String fileName) {
Drawable drawable = null;
TextureAtlas textureAtlas = null;
if (isLoaded && assetManager.isLoaded(atlas)) {
textureAtlas = assetManager.get(atlas, TextureAtlas.class);
Array<TextureAtlas.AtlasRegion> regions = textureAtlas.findRegions(fileName);
int size = regions.size;
if (size == 1) {
drawable = new TextureRegionDrawable(regions.get(0));
} else if (size > 1) {
Array<Drawable> drawables = new Array<Drawable>(size);
for (TextureAtlas.AtlasRegion region : regions) {
drawables.add(new TextureRegionDrawable(region));
}
drawable = new DrawableContainer(drawables);
}
}
return drawable;
}
public Animation<Drawable> getAnimation(String atlas, String fileName, float frameDuration) {
Animation<Drawable> animation = null;
TextureAtlas textureAtlas = null;
if (isLoaded && assetManager.isLoaded(atlas)) {
textureAtlas = assetManager.get(atlas, TextureAtlas.class);
Array<Drawable> drawables = new Array<Drawable>();
Array<TextureAtlas.AtlasRegion> regions = textureAtlas.findRegions(fileName);
for (TextureAtlas.AtlasRegion region : regions) {
drawables.add(new TextureRegionDrawable(region));
}
animation = new Animation<Drawable>(frameDuration, drawables);
}
return animation;
}
public String getString(int id) {
if (isLoaded && assetManager.isLoaded("strings")) {
Strings strings = assetManager.get("strings", Strings.class);
return strings.getString(id);
}
return "";
}
public String getString(int id, Object... args) {
if (isLoaded && assetManager.isLoaded("strings")) {
Strings strings = assetManager.get("strings", Strings.class);
return String.format(strings.getString(id), args);
}
return "";
}
public DataManager getDataManager() {
DataManager dataManager = null;
if (isLoaded && assetManager.isLoaded("data")) {
dataManager = assetManager.get("data", DataManager.class);
}
return dataManager;
}
@Override
public void dispose() {
if (isLoaded) {
isLoaded = false;
assetManager.dispose();
}
}
public static interface atlas {
String ui = "ui.atlas";
String character = "characters.atlas";
}
}
| 8,413 | 0.633306 | 0.626293 | 214 | 38.313084 | 25.444279 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.799065 | false | false |
5
|
5d5de1494c326babd23759a672ecba03054178cf
| 28,552,942,599,865 |
087136b0ead4dde00b557a02a181be6ea7081c9a
|
/SupetsCamera/thirdlib/MotuSDKLib/src_sdk/cn/jingling/lib/filters/partial/BlackEyeRemove.java
|
ee8021c73a1e86eb96e767ab86f577b28c22049c
|
[] |
no_license
|
JiShangShiDai/supets-camera
|
https://github.com/JiShangShiDai/supets-camera
|
34fb32d16ebeb8de5d0271dbc9fa83314998895c
|
4976922fd77cfc62afbe64836185faa03642254f
|
refs/heads/master
| 2021-05-14T10:59:44.532000 | 2017-08-09T03:57:56 | 2017-08-09T03:57:56 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cn.jingling.lib.filters.partial;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Point;
import cn.jingling.lib.filters.PartialFilter;
import cn.jingling.lib.filters.SmoothSkinProcessor;
public class BlackEyeRemove extends PartialFilter{
public BlackEyeRemove() {
setNeededPointNumber(2);
}
@Override
public Bitmap apply(Bitmap bm, Point[] point) {
int w = bm.getWidth();
int h = bm.getHeight();
Point left = point[0];
Point right = point[1];
int radius = Math.abs((right.x - left.x)) / 3;
int[] pixels = new int[w * h];
bm.getPixels(pixels, 0, w, 0, 0, w, h);
SmoothSkinProcessor.InitializeCircle(left.y, left.x, radius, right.y,
right.x, radius, pixels, w, h, mRadius);
bm.setPixels(pixels, 0, w, 0, 0, w, h);
return bm;
}
}
|
UTF-8
|
Java
| 815 |
java
|
BlackEyeRemove.java
|
Java
|
[] | null |
[] |
package cn.jingling.lib.filters.partial;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Point;
import cn.jingling.lib.filters.PartialFilter;
import cn.jingling.lib.filters.SmoothSkinProcessor;
public class BlackEyeRemove extends PartialFilter{
public BlackEyeRemove() {
setNeededPointNumber(2);
}
@Override
public Bitmap apply(Bitmap bm, Point[] point) {
int w = bm.getWidth();
int h = bm.getHeight();
Point left = point[0];
Point right = point[1];
int radius = Math.abs((right.x - left.x)) / 3;
int[] pixels = new int[w * h];
bm.getPixels(pixels, 0, w, 0, 0, w, h);
SmoothSkinProcessor.InitializeCircle(left.y, left.x, radius, right.y,
right.x, radius, pixels, w, h, mRadius);
bm.setPixels(pixels, 0, w, 0, 0, w, h);
return bm;
}
}
| 815 | 0.699386 | 0.687117 | 34 | 22.970589 | 19.990417 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.088235 | false | false |
5
|
6c1468d1740991fdc41200b9ce11f4e1f2adbb48
| 601,295,447,077 |
2f8ad6871bc39b6e1b58e152ed4a44fe65282e79
|
/dcc-marketing/domainservice/src/main/java/io/wexchain/dcc/marketing/domainservice/impl/RewardRoundServiceImpl.java
|
eec4f7e9f94903c6cd1eaf79832fc8af76fa5f6b
|
[] |
no_license
|
DistributedBanking/DCC
|
https://github.com/DistributedBanking/DCC
|
a3bad7c55cb475299a266048da2fd2ba7a51e6b8
|
e7c788ce42f38abb0aeece11a15004168ebd61e9
|
refs/heads/master
| 2019-07-02T16:25:24.333000 | 2019-06-27T07:32:40 | 2019-06-27T07:32:40 | 122,952,621 | 30 | 8 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package io.wexchain.dcc.marketing.domainservice.impl;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import org.apache.commons.lang3.exception.ContextedRuntimeException;
import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.godmonth.status.executor.intf.OrderExecutor;
import com.wexmarket.topia.commons.basic.exception.CustomeValidate;
import io.wexchain.dcc.marketing.api.constant.MarketingErrorCode;
import io.wexchain.dcc.marketing.api.constant.RewardRoundStatus;
import io.wexchain.dcc.marketing.api.model.EcoRewardRankVo;
import io.wexchain.dcc.marketing.api.model.EcoRewardStatisticsInfo;
import io.wexchain.dcc.marketing.domain.Activity;
import io.wexchain.dcc.marketing.domain.RewardDelivery;
import io.wexchain.dcc.marketing.domain.RewardRound;
import io.wexchain.dcc.marketing.domainservice.ActivityService;
import io.wexchain.dcc.marketing.domainservice.RewardRoundService;
import io.wexchain.dcc.marketing.domainservice.function.cah.CahFunction;
import io.wexchain.dcc.marketing.domainservice.function.web3.Web3Function;
import io.wexchain.dcc.marketing.domainservice.processor.order.rewardround.RewardRoundInstruction;
import io.wexchain.dcc.marketing.repository.RewardActionRecordRepository;
import io.wexchain.dcc.marketing.repository.RewardDeliveryRepository;
import io.wexchain.dcc.marketing.repository.RewardRoundRepository;
/**
* RewardRoundServiceImpl
*
* @author zhengpeng
*/
@Service
public class RewardRoundServiceImpl implements RewardRoundService {
@Autowired
private CahFunction cahFunction;
@Autowired
private Web3Function web3Function;
@Autowired
private ActivityService activityService;
@Autowired
private RewardRoundRepository rewardRoundRepository;
@Resource(name = "rewardRoundExecutor")
private OrderExecutor<RewardRound, RewardRoundInstruction> rewardRoundExecutor;
private static final String ECO_REWARD_ACTIVITY_CODE = "10003";
@Autowired
private RewardActionRecordRepository rewardActionRecordRepository;
@Autowired
private RewardDeliveryRepository rewardDeliveryRepository;
@Override
public RewardRound createRewardRound(Date bonusDay) {
Date bd = new DateTime(bonusDay).withTimeAtStartOfDay().toDate();
RewardRound rewardRound = findRewardRoundByBonusDay(bd).orElseGet(() -> {
checkEcoRewardPoolBalance();
RewardRound rr = new RewardRound();
rr.setStartBlock(getStartBlockNumber(bd));
rr.setEndBlock(getEndBlockNumber(bd));
rr.setStatus(RewardRoundStatus.CREATED);
rr.setActivity(activityService.getActivityByCode(ECO_REWARD_ACTIVITY_CODE));
rr.setBonusDay(bd);
return rewardRoundRepository.save(rr);
});
rewardRoundExecutor.executeAsync(rewardRound, null ,null);
return rewardRound;
}
@Override
public Optional<RewardRound> findRewardRoundByBonusDay(Date bonusDay) {
return Optional.ofNullable(rewardRoundRepository.findByBonusDay(bonusDay));
}
@Override
public EcoRewardStatisticsInfo getEcoRewardStatisticsInfo(String address) {
Date yesterday = DateTime.now().minusDays(1).withTimeAtStartOfDay().toDate();
EcoRewardStatisticsInfo info = new EcoRewardStatisticsInfo();
info.setYesterdayAmount(BigDecimal.ZERO);
info.setYesterdayScore(BigDecimal.ZERO);
findRewardRoundByBonusDay(yesterday).ifPresent(rewardRound -> {
CustomeValidate.isTrue(rewardRound.getStatus() == RewardRoundStatus.DELIVERED,
MarketingErrorCode.INVALID_STATUS.name(), "奖励发放中,请稍候重试");
BigDecimal score = Optional.ofNullable(rewardActionRecordRepository.sumScoreByAddress(rewardRound.getId(), address))
.orElse(BigDecimal.ZERO);
BigDecimal amount = Optional.ofNullable(rewardDeliveryRepository.sumAmountByAddress(rewardRound.getId(), address))
.orElse(BigDecimal.ZERO);
info.setYesterdayScore(score);
info.setYesterdayAmount(amount);
});
return info;
}
@Override
public BigDecimal getEcoScore() {
Date yesterday = DateTime.now().minusDays(1).withTimeAtStartOfDay().toDate();
Optional<RewardRound> rewardRoundByBonusDay = findRewardRoundByBonusDay(yesterday);
if(rewardRoundByBonusDay.isPresent()){
return Optional.ofNullable(rewardActionRecordRepository.sumScore(rewardRoundByBonusDay.get().getId()))
.orElse(BigDecimal.ZERO);
}
return BigDecimal.ZERO;
}
@Override
public List<EcoRewardRankVo> queryEcoRewardRankList(DateTime roundTime) {
DateTime trimRoundTime = roundTime.withTimeAtStartOfDay();
RewardRound rewardRound = findRewardRoundByBonusDay(trimRoundTime.toDate())
.orElseThrow(() -> new ContextedRuntimeException("轮次不存在"));
List<RewardDelivery> rewardDeliveryList =
rewardDeliveryRepository.findTop10ByRewardRoundIdOrderByAmountDesc(rewardRound.getId());
List<String> addressList = rewardDeliveryList.stream().map(RewardDelivery::getBeneficiaryAddress)
.collect(Collectors.toList());
List<Map<String, Object>> actionList = rewardActionRecordRepository.sumScoreGroupByAddressAndAddressIn(
rewardRound.getId(), addressList);
List<EcoRewardRankVo> voList = new ArrayList<>();
for (RewardDelivery delivery : rewardDeliveryList) {
EcoRewardRankVo vo = new EcoRewardRankVo();
vo.setAddress(delivery.getBeneficiaryAddress());
actionList.forEach(map -> {
if (map.get("address").toString().equalsIgnoreCase(delivery.getBeneficiaryAddress())) {
vo.setScore(new BigDecimal(map.get("totalScore") + ""));
}
});
vo.setAmount(delivery.getAmount());
voList.add(vo);
}
return voList;
}
private Long getStartBlockNumber(Date bonusDay) {
/*Page<RewardRound> lastRewardRound = rewardRoundRepository.findAll(
PageRequest.of(1, 1, Sort.by(Sort.Direction.DESC, "createdTime")));
if (CollectionUtils.isNotEmpty(lastRewardRound.getContent())) {
return lastRewardRound.getContent().get(0).getEndBlock();
}*/
return web3Function.getBlockNumberAfterTime(bonusDay);
}
private Long getEndBlockNumber(Date bonusDay) {
DateTime day = new DateTime(bonusDay).plusDays(1);
return web3Function.getBlockNumberAfterTime(day.toDate());
}
private void checkEcoRewardPoolBalance() {
Activity activity = activityService.getActivityByCode(ECO_REWARD_ACTIVITY_CODE);
BigInteger juzixDccBalance = cahFunction.getJuzixDccBalance(activity.getSupplierAddress());
}
}
|
UTF-8
|
Java
| 7,188 |
java
|
RewardRoundServiceImpl.java
|
Java
|
[
{
"context": "tory;\n\n/**\n * RewardRoundServiceImpl\n *\n * @author zhengpeng\n */\n@Service\npublic class RewardRoundServiceImpl ",
"end": 1705,
"score": 0.9980996251106262,
"start": 1696,
"tag": "USERNAME",
"value": "zhengpeng"
}
] | null |
[] |
package io.wexchain.dcc.marketing.domainservice.impl;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import org.apache.commons.lang3.exception.ContextedRuntimeException;
import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.godmonth.status.executor.intf.OrderExecutor;
import com.wexmarket.topia.commons.basic.exception.CustomeValidate;
import io.wexchain.dcc.marketing.api.constant.MarketingErrorCode;
import io.wexchain.dcc.marketing.api.constant.RewardRoundStatus;
import io.wexchain.dcc.marketing.api.model.EcoRewardRankVo;
import io.wexchain.dcc.marketing.api.model.EcoRewardStatisticsInfo;
import io.wexchain.dcc.marketing.domain.Activity;
import io.wexchain.dcc.marketing.domain.RewardDelivery;
import io.wexchain.dcc.marketing.domain.RewardRound;
import io.wexchain.dcc.marketing.domainservice.ActivityService;
import io.wexchain.dcc.marketing.domainservice.RewardRoundService;
import io.wexchain.dcc.marketing.domainservice.function.cah.CahFunction;
import io.wexchain.dcc.marketing.domainservice.function.web3.Web3Function;
import io.wexchain.dcc.marketing.domainservice.processor.order.rewardround.RewardRoundInstruction;
import io.wexchain.dcc.marketing.repository.RewardActionRecordRepository;
import io.wexchain.dcc.marketing.repository.RewardDeliveryRepository;
import io.wexchain.dcc.marketing.repository.RewardRoundRepository;
/**
* RewardRoundServiceImpl
*
* @author zhengpeng
*/
@Service
public class RewardRoundServiceImpl implements RewardRoundService {
@Autowired
private CahFunction cahFunction;
@Autowired
private Web3Function web3Function;
@Autowired
private ActivityService activityService;
@Autowired
private RewardRoundRepository rewardRoundRepository;
@Resource(name = "rewardRoundExecutor")
private OrderExecutor<RewardRound, RewardRoundInstruction> rewardRoundExecutor;
private static final String ECO_REWARD_ACTIVITY_CODE = "10003";
@Autowired
private RewardActionRecordRepository rewardActionRecordRepository;
@Autowired
private RewardDeliveryRepository rewardDeliveryRepository;
@Override
public RewardRound createRewardRound(Date bonusDay) {
Date bd = new DateTime(bonusDay).withTimeAtStartOfDay().toDate();
RewardRound rewardRound = findRewardRoundByBonusDay(bd).orElseGet(() -> {
checkEcoRewardPoolBalance();
RewardRound rr = new RewardRound();
rr.setStartBlock(getStartBlockNumber(bd));
rr.setEndBlock(getEndBlockNumber(bd));
rr.setStatus(RewardRoundStatus.CREATED);
rr.setActivity(activityService.getActivityByCode(ECO_REWARD_ACTIVITY_CODE));
rr.setBonusDay(bd);
return rewardRoundRepository.save(rr);
});
rewardRoundExecutor.executeAsync(rewardRound, null ,null);
return rewardRound;
}
@Override
public Optional<RewardRound> findRewardRoundByBonusDay(Date bonusDay) {
return Optional.ofNullable(rewardRoundRepository.findByBonusDay(bonusDay));
}
@Override
public EcoRewardStatisticsInfo getEcoRewardStatisticsInfo(String address) {
Date yesterday = DateTime.now().minusDays(1).withTimeAtStartOfDay().toDate();
EcoRewardStatisticsInfo info = new EcoRewardStatisticsInfo();
info.setYesterdayAmount(BigDecimal.ZERO);
info.setYesterdayScore(BigDecimal.ZERO);
findRewardRoundByBonusDay(yesterday).ifPresent(rewardRound -> {
CustomeValidate.isTrue(rewardRound.getStatus() == RewardRoundStatus.DELIVERED,
MarketingErrorCode.INVALID_STATUS.name(), "奖励发放中,请稍候重试");
BigDecimal score = Optional.ofNullable(rewardActionRecordRepository.sumScoreByAddress(rewardRound.getId(), address))
.orElse(BigDecimal.ZERO);
BigDecimal amount = Optional.ofNullable(rewardDeliveryRepository.sumAmountByAddress(rewardRound.getId(), address))
.orElse(BigDecimal.ZERO);
info.setYesterdayScore(score);
info.setYesterdayAmount(amount);
});
return info;
}
@Override
public BigDecimal getEcoScore() {
Date yesterday = DateTime.now().minusDays(1).withTimeAtStartOfDay().toDate();
Optional<RewardRound> rewardRoundByBonusDay = findRewardRoundByBonusDay(yesterday);
if(rewardRoundByBonusDay.isPresent()){
return Optional.ofNullable(rewardActionRecordRepository.sumScore(rewardRoundByBonusDay.get().getId()))
.orElse(BigDecimal.ZERO);
}
return BigDecimal.ZERO;
}
@Override
public List<EcoRewardRankVo> queryEcoRewardRankList(DateTime roundTime) {
DateTime trimRoundTime = roundTime.withTimeAtStartOfDay();
RewardRound rewardRound = findRewardRoundByBonusDay(trimRoundTime.toDate())
.orElseThrow(() -> new ContextedRuntimeException("轮次不存在"));
List<RewardDelivery> rewardDeliveryList =
rewardDeliveryRepository.findTop10ByRewardRoundIdOrderByAmountDesc(rewardRound.getId());
List<String> addressList = rewardDeliveryList.stream().map(RewardDelivery::getBeneficiaryAddress)
.collect(Collectors.toList());
List<Map<String, Object>> actionList = rewardActionRecordRepository.sumScoreGroupByAddressAndAddressIn(
rewardRound.getId(), addressList);
List<EcoRewardRankVo> voList = new ArrayList<>();
for (RewardDelivery delivery : rewardDeliveryList) {
EcoRewardRankVo vo = new EcoRewardRankVo();
vo.setAddress(delivery.getBeneficiaryAddress());
actionList.forEach(map -> {
if (map.get("address").toString().equalsIgnoreCase(delivery.getBeneficiaryAddress())) {
vo.setScore(new BigDecimal(map.get("totalScore") + ""));
}
});
vo.setAmount(delivery.getAmount());
voList.add(vo);
}
return voList;
}
private Long getStartBlockNumber(Date bonusDay) {
/*Page<RewardRound> lastRewardRound = rewardRoundRepository.findAll(
PageRequest.of(1, 1, Sort.by(Sort.Direction.DESC, "createdTime")));
if (CollectionUtils.isNotEmpty(lastRewardRound.getContent())) {
return lastRewardRound.getContent().get(0).getEndBlock();
}*/
return web3Function.getBlockNumberAfterTime(bonusDay);
}
private Long getEndBlockNumber(Date bonusDay) {
DateTime day = new DateTime(bonusDay).plusDays(1);
return web3Function.getBlockNumberAfterTime(day.toDate());
}
private void checkEcoRewardPoolBalance() {
Activity activity = activityService.getActivityByCode(ECO_REWARD_ACTIVITY_CODE);
BigInteger juzixDccBalance = cahFunction.getJuzixDccBalance(activity.getSupplierAddress());
}
}
| 7,188 | 0.727362 | 0.724567 | 166 | 42.108433 | 32.133385 | 128 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.596386 | false | false |
5
|
47aaa221a35aee8229ea13103923cbcfadde70ff
| 3,848,290,722,001 |
c746c1cf829d16955c2f42882afef90353954853
|
/login.java
|
a9951c0bba71aa9ee7779d85f81577c73ae6732a
|
[] |
no_license
|
mahesh577-dell/mergeconflict
|
https://github.com/mahesh577-dell/mergeconflict
|
1e70e5d9ff2010cd4267f859bb9bfbe88fa1792b
|
0a504e83b9c2b91cec021f0975614a43c24e05a4
|
refs/heads/master
| 2023-06-12T10:13:23.833000 | 2021-07-06T13:30:49 | 2021-07-06T13:30:49 | 383,474,065 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class login
{
public static void main(String args[])
{
a=200;
}
}
|
UTF-8
|
Java
| 85 |
java
|
login.java
|
Java
|
[] | null |
[] |
public class login
{
public static void main(String args[])
{
a=200;
}
}
| 85 | 0.588235 | 0.552941 | 7 | 11 | 13.005493 | 40 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.857143 | false | false |
5
|
bae9d2102aa212b18a6d7fb85f62b55986b532d1
| 2,061,584,329,199 |
653bd81e4886bd75bb672dadc60c9c998f3c1ab1
|
/takin-web-biz-service/src/main/java/io/shulie/takin/cloud/biz/collector/collector/CollectorServerService.java
|
d5c6a898ae874ee61c32a2778c9b310a52146884
|
[] |
no_license
|
shulieTech/Takin-web
|
https://github.com/shulieTech/Takin-web
|
f7fc06b4e5bcab366a60f64934cc3de495b9917e
|
f00bcd31e6fea795d8d718e59011b0c05fd6daf7
|
refs/heads/main
| 2023-08-31T07:38:15.352000 | 2023-07-03T03:03:47 | 2023-07-03T03:03:47 | 398,989,630 | 18 | 60 | null | false | 2023-08-22T09:50:23 | 2021-08-23T05:58:15 | 2023-07-25T02:37:03 | 2023-08-22T09:50:23 | 24,611 | 19 | 45 | 4 |
Java
| false | false |
package io.shulie.takin.cloud.biz.collector.collector;
import java.util.List;
import io.shulie.takin.cloud.biz.collector.bean.DiskUsage;
import io.shulie.takin.cloud.biz.collector.bean.LoadInfo;
import io.shulie.takin.cloud.biz.collector.bean.ServerStatusInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* 计算压测引擎上报的服务器状态。用于弹性伸缩
*
* @author <a href="tangyuhan@shulie.io">yuhan.tang</a>
* @date 2020-05-11 14:26
*/
@Slf4j
@Service
public class CollectorServerService {
public void collector(ServerStatusInfo serverStatusInfo) {
int cpu = collectorCpu(serverStatusInfo.getCpu());
int memory = collectorMemory(serverStatusInfo.getMemery());
int io = collectorIo(serverStatusInfo.getIo());
int disk = collectorDisk(serverStatusInfo.getDiskUsages());
int loader = collectorLoader(serverStatusInfo.getLoadInfo());
}
/**
* 计算CPU使用率
* -1 缩容
* 0 正常
* 1 扩容
*
* @param cpu -
* @return -
*/
public int collectorCpu(float cpu) {
return 0;
}
/**
* 计算内存使用率
* -1 缩容
* 0 正常
* 1 扩容
*
* @param memory -
* @return -
*/
public int collectorMemory(long memory) {
return 0;
}
/**
* 计算io使用率
* -1 缩容
* 0 正常
* 1 扩容
*
* @param io -
* @return -
*/
public int collectorIo(String io) {
return 0;
}
/**
* 计算loader使用率
* -1 缩容
* 0 正常
* 1 扩容
*
* @param loadInfo -
* @return -
*/
public int collectorLoader(LoadInfo loadInfo) {
return 0;
}
/**
* 计算磁盘使用率
* -1 缩容
* 0 正常
* 1 扩容
*
* @param diskUsages -
* @return -
*/
public int collectorDisk(List<DiskUsage> diskUsages) {
return 0;
}
}
|
UTF-8
|
Java
| 2,022 |
java
|
CollectorServerService.java
|
Java
|
[
{
"context": "*\n * 计算压测引擎上报的服务器状态。用于弹性伸缩\n *\n * @author <a href=\"tangyuhan@shulie.io\">yuhan.tang</a>\n * @date 2020-05-11 14:26\n */\n@Sl",
"end": 416,
"score": 0.9999209642410278,
"start": 397,
"tag": "EMAIL",
"value": "tangyuhan@shulie.io"
},
{
"context": "于弹性伸缩\n *\n * @author <a href=\"tangyuhan@shulie.io\">yuhan.tang</a>\n * @date 2020-05-11 14:26\n */\n@Slf4j\n@Ser",
"end": 423,
"score": 0.7789896130561829,
"start": 418,
"tag": "USERNAME",
"value": "yuhan"
},
{
"context": " *\n * @author <a href=\"tangyuhan@shulie.io\">yuhan.tang</a>\n * @date 2020-05-11 14:26\n */\n@Slf4j\n@Service",
"end": 428,
"score": 0.4975666105747223,
"start": 424,
"tag": "NAME",
"value": "tang"
}
] | null |
[] |
package io.shulie.takin.cloud.biz.collector.collector;
import java.util.List;
import io.shulie.takin.cloud.biz.collector.bean.DiskUsage;
import io.shulie.takin.cloud.biz.collector.bean.LoadInfo;
import io.shulie.takin.cloud.biz.collector.bean.ServerStatusInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* 计算压测引擎上报的服务器状态。用于弹性伸缩
*
* @author <a href="<EMAIL>">yuhan.tang</a>
* @date 2020-05-11 14:26
*/
@Slf4j
@Service
public class CollectorServerService {
public void collector(ServerStatusInfo serverStatusInfo) {
int cpu = collectorCpu(serverStatusInfo.getCpu());
int memory = collectorMemory(serverStatusInfo.getMemery());
int io = collectorIo(serverStatusInfo.getIo());
int disk = collectorDisk(serverStatusInfo.getDiskUsages());
int loader = collectorLoader(serverStatusInfo.getLoadInfo());
}
/**
* 计算CPU使用率
* -1 缩容
* 0 正常
* 1 扩容
*
* @param cpu -
* @return -
*/
public int collectorCpu(float cpu) {
return 0;
}
/**
* 计算内存使用率
* -1 缩容
* 0 正常
* 1 扩容
*
* @param memory -
* @return -
*/
public int collectorMemory(long memory) {
return 0;
}
/**
* 计算io使用率
* -1 缩容
* 0 正常
* 1 扩容
*
* @param io -
* @return -
*/
public int collectorIo(String io) {
return 0;
}
/**
* 计算loader使用率
* -1 缩容
* 0 正常
* 1 扩容
*
* @param loadInfo -
* @return -
*/
public int collectorLoader(LoadInfo loadInfo) {
return 0;
}
/**
* 计算磁盘使用率
* -1 缩容
* 0 正常
* 1 扩容
*
* @param diskUsages -
* @return -
*/
public int collectorDisk(List<DiskUsage> diskUsages) {
return 0;
}
}
| 2,010 | 0.570354 | 0.551557 | 93 | 19.021505 | 19.080463 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.182796 | false | false |
5
|
9c4e10643ec8141370d2c2478c412bd5422261a5
| 10,239,202,059,935 |
a660d186e6bf2319925cd5ba7f8dd1f7bdaaeed1
|
/core/src/com/tubbbe/mapgenerator/utils/WrapInt.java
|
30dc7c3dbb94f8fa5d709e3d4095d306b3b39e2f
|
[] |
no_license
|
Tubbbe/Projet3DPerso
|
https://github.com/Tubbbe/Projet3DPerso
|
3faa6ae37f996bffe7bdab246c56082cdc63d070
|
f632fa8513b0f557b881755774ec35a5e8d67189
|
refs/heads/master
| 2020-01-30T22:07:53.110000 | 2016-06-17T11:23:11 | 2016-06-17T11:23:11 | 61,243,500 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.tubbbe.mapgenerator.utils;
public class WrapInt
{
private Integer val;
public WrapInt(int val)
{
this.setVal(val);
}
public void add(int val)
{
this.val += val;
}
public int getVal() {
return val;
}
public void setVal(int val) {
this.val = val;
}
public String toString() { return val.toString(); }
}
|
UTF-8
|
Java
| 343 |
java
|
WrapInt.java
|
Java
|
[] | null |
[] |
package com.tubbbe.mapgenerator.utils;
public class WrapInt
{
private Integer val;
public WrapInt(int val)
{
this.setVal(val);
}
public void add(int val)
{
this.val += val;
}
public int getVal() {
return val;
}
public void setVal(int val) {
this.val = val;
}
public String toString() { return val.toString(); }
}
| 343 | 0.64723 | 0.64723 | 26 | 12.192307 | 13.758967 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.153846 | false | false |
5
|
80631405b70ccc90f662df07561fb7491e8c60b4
| 5,866,925,347,590 |
2e0423d635890c3e569c7b095a9591c65604cbb8
|
/app/src/main/java/com/cdv/sampling/widget/InputLayout.java
|
d6583fbe85981d266dccd380e4929908021e0124
|
[] |
no_license
|
cliliang/sampling
|
https://github.com/cliliang/sampling
|
b924a13ee32406681e681039802465c4884129a5
|
b3e49a9e20200f48ce46ecdbc70b16de9d060b34
|
refs/heads/master
| 2021-06-18T08:13:03.264000 | 2019-08-19T07:27:28 | 2019-08-19T07:27:28 | 103,739,999 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.cdv.sampling.widget;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray;
import android.preference.PreferenceManager;
import android.text.Editable;
import android.text.InputFilter;
import android.text.InputType;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.cdv.sampling.R;
import com.cdv.sampling.activity.BaseActivity;
import com.cdv.sampling.activity.ScanActivity;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class InputLayout extends RelativeLayout {
private EditText etInput;
private TextView tvLeft;
private ImageView ivClear;
private ImageView ivScan;
private String validator;
private boolean scanEnable;
private String presetText;
public InputLayout(Context context) {
super(context);
init(context, null);
}
public InputLayout(Context context, AttributeSet attrs) {
super(context, attrs);
init(context, attrs);
}
public InputLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context, attrs);
}
private void init(Context context, AttributeSet attrs) {
LayoutInflater.from(context).inflate(R.layout.view_input_cell, this, true);
tvLeft = (TextView) findViewById(R.id.tv_left);
ivClear = (ImageView) findViewById(R.id.iv_clear);
ivScan = (ImageView) findViewById(R.id.iv_scan);
etInput = (EditText) findViewById(R.id.et_content);
etInput.setRawInputType(InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS);
etInput.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
boolean isShowClear = findFocus() == etInput && isEnabled() && s.length() > 0;
ivClear.setVisibility(isShowClear ? VISIBLE : INVISIBLE);
if (!isShowClear && canShowCan()) {
ivScan.setVisibility(VISIBLE);
} else {
ivScan.setVisibility(GONE);
}
}
});
ivClear.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
etInput.setText("");
}
});
if (attrs == null) {
return;
}
TypedArray type = context.getTheme().obtainStyledAttributes(attrs, R.styleable.InputLayout, 0, 0);
int maxLength = type.getInteger(R.styleable.InputLayout_maxLength, 20);
String hint = type.getString(R.styleable.InputLayout_textHint);
presetText = type.getString(R.styleable.InputLayout_inputText);
int inputType = type.getInt(R.styleable.InputLayout_cdv_inputType, -1);
int maxLines = type.getInteger(R.styleable.InputLayout_inputMaxLine, 1);
final String leftTitle = type.getString(R.styleable.InputLayout_left_title);
validator = type.getString(R.styleable.InputLayout_validator);
scanEnable = type.getBoolean(R.styleable.InputLayout_scanEnable, false);
etInput.setText(presetText);
tvLeft.setText(leftTitle);
etInput.setMaxLines(maxLines);
etInput.setSingleLine(maxLines <= 1);
if (inputType > 0) {
switch (inputType) {
case 0:
etInput.setInputType(InputType.TYPE_CLASS_TEXT);
break;
case 1:
etInput.setInputType(InputType.TYPE_CLASS_NUMBER);
break;
case 2:
etInput.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
break;
case 3:
etInput.setInputType(InputType.TYPE_CLASS_PHONE);
break;
}
}
ivClear.setVisibility(INVISIBLE);
if (scanEnable) {
ivScan.setVisibility(VISIBLE);
}
etInput.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View view, boolean focus) {
boolean isShowClear = focus && isEnabled() && !TextUtils.isEmpty(etInput.getText().toString());
ivClear.setVisibility(isShowClear ? VISIBLE : INVISIBLE);
if (!isShowClear && scanEnable && canShowCan()) {
ivScan.setVisibility(VISIBLE);
} else {
ivScan.setVisibility(GONE);
}
}
});
ivScan.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
BaseActivity activity = (BaseActivity) getContext();
final int finalRequestCode = 1000;
activity.startActivityForResult(new Intent(activity, ScanActivity.class), finalRequestCode, new PreferenceManager.OnActivityResultListener(){
@Override
public boolean onActivityResult(int requestCode, int resultCode, Intent data) {
if (finalRequestCode == requestCode && resultCode == Activity.RESULT_OK){
String str = data.getStringExtra(ScanActivity.EXTRA_SCAN_RESULT);
if (str != null){
str = str.replace("\n", "").trim();
}
if (tvLeft.getText().toString().equals("批准文号")){
String[] param = str.split(",");
if (param.length >= 3){
setContent(param[2]);
}
}else{
setContent(str);
}
return true;
}
return false;
}
});
}
});
etInput.setHint(hint);
etInput.setFilters(new InputFilter[]{new InputFilter.LengthFilter(maxLength)});
}
@Override
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
etInput.setEnabled(enabled);
if (!enabled) {
ivClear.setVisibility(INVISIBLE);
}
}
public boolean validate() {
if (TextUtils.isEmpty(validator)) {
return true;
}
Pattern pattern = Pattern.compile(validator);
Matcher isNum = pattern.matcher(etInput.getText().toString());
if (!isNum.matches()) {
return false;
}
return true;
}
public void setContent(String content) {
if (TextUtils.isEmpty(content)){
etInput.setText(presetText);
return;
}else{
etInput.setText(content);
}
etInput.setSelection(etInput.getText().length());
}
public String getContent() {
if (etInput.getText().toString().equals(presetText)){
return "";
}
return etInput.getText().toString();
}
public EditText getEtInput() {
return etInput;
}
public ImageView getIvClear() {
return ivClear;
}
public String getTitle(){
return tvLeft.getText().toString();
}
private boolean canShowCan(){
if (!scanEnable){
return false;
}
return TextUtils.isEmpty(etInput.getText().toString()) || etInput.getText().toString().equals(presetText);
}
}
|
UTF-8
|
Java
| 8,120 |
java
|
InputLayout.java
|
Java
|
[] | null |
[] |
package com.cdv.sampling.widget;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray;
import android.preference.PreferenceManager;
import android.text.Editable;
import android.text.InputFilter;
import android.text.InputType;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.cdv.sampling.R;
import com.cdv.sampling.activity.BaseActivity;
import com.cdv.sampling.activity.ScanActivity;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class InputLayout extends RelativeLayout {
private EditText etInput;
private TextView tvLeft;
private ImageView ivClear;
private ImageView ivScan;
private String validator;
private boolean scanEnable;
private String presetText;
public InputLayout(Context context) {
super(context);
init(context, null);
}
public InputLayout(Context context, AttributeSet attrs) {
super(context, attrs);
init(context, attrs);
}
public InputLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context, attrs);
}
private void init(Context context, AttributeSet attrs) {
LayoutInflater.from(context).inflate(R.layout.view_input_cell, this, true);
tvLeft = (TextView) findViewById(R.id.tv_left);
ivClear = (ImageView) findViewById(R.id.iv_clear);
ivScan = (ImageView) findViewById(R.id.iv_scan);
etInput = (EditText) findViewById(R.id.et_content);
etInput.setRawInputType(InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS);
etInput.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
boolean isShowClear = findFocus() == etInput && isEnabled() && s.length() > 0;
ivClear.setVisibility(isShowClear ? VISIBLE : INVISIBLE);
if (!isShowClear && canShowCan()) {
ivScan.setVisibility(VISIBLE);
} else {
ivScan.setVisibility(GONE);
}
}
});
ivClear.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
etInput.setText("");
}
});
if (attrs == null) {
return;
}
TypedArray type = context.getTheme().obtainStyledAttributes(attrs, R.styleable.InputLayout, 0, 0);
int maxLength = type.getInteger(R.styleable.InputLayout_maxLength, 20);
String hint = type.getString(R.styleable.InputLayout_textHint);
presetText = type.getString(R.styleable.InputLayout_inputText);
int inputType = type.getInt(R.styleable.InputLayout_cdv_inputType, -1);
int maxLines = type.getInteger(R.styleable.InputLayout_inputMaxLine, 1);
final String leftTitle = type.getString(R.styleable.InputLayout_left_title);
validator = type.getString(R.styleable.InputLayout_validator);
scanEnable = type.getBoolean(R.styleable.InputLayout_scanEnable, false);
etInput.setText(presetText);
tvLeft.setText(leftTitle);
etInput.setMaxLines(maxLines);
etInput.setSingleLine(maxLines <= 1);
if (inputType > 0) {
switch (inputType) {
case 0:
etInput.setInputType(InputType.TYPE_CLASS_TEXT);
break;
case 1:
etInput.setInputType(InputType.TYPE_CLASS_NUMBER);
break;
case 2:
etInput.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
break;
case 3:
etInput.setInputType(InputType.TYPE_CLASS_PHONE);
break;
}
}
ivClear.setVisibility(INVISIBLE);
if (scanEnable) {
ivScan.setVisibility(VISIBLE);
}
etInput.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View view, boolean focus) {
boolean isShowClear = focus && isEnabled() && !TextUtils.isEmpty(etInput.getText().toString());
ivClear.setVisibility(isShowClear ? VISIBLE : INVISIBLE);
if (!isShowClear && scanEnable && canShowCan()) {
ivScan.setVisibility(VISIBLE);
} else {
ivScan.setVisibility(GONE);
}
}
});
ivScan.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
BaseActivity activity = (BaseActivity) getContext();
final int finalRequestCode = 1000;
activity.startActivityForResult(new Intent(activity, ScanActivity.class), finalRequestCode, new PreferenceManager.OnActivityResultListener(){
@Override
public boolean onActivityResult(int requestCode, int resultCode, Intent data) {
if (finalRequestCode == requestCode && resultCode == Activity.RESULT_OK){
String str = data.getStringExtra(ScanActivity.EXTRA_SCAN_RESULT);
if (str != null){
str = str.replace("\n", "").trim();
}
if (tvLeft.getText().toString().equals("批准文号")){
String[] param = str.split(",");
if (param.length >= 3){
setContent(param[2]);
}
}else{
setContent(str);
}
return true;
}
return false;
}
});
}
});
etInput.setHint(hint);
etInput.setFilters(new InputFilter[]{new InputFilter.LengthFilter(maxLength)});
}
@Override
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
etInput.setEnabled(enabled);
if (!enabled) {
ivClear.setVisibility(INVISIBLE);
}
}
public boolean validate() {
if (TextUtils.isEmpty(validator)) {
return true;
}
Pattern pattern = Pattern.compile(validator);
Matcher isNum = pattern.matcher(etInput.getText().toString());
if (!isNum.matches()) {
return false;
}
return true;
}
public void setContent(String content) {
if (TextUtils.isEmpty(content)){
etInput.setText(presetText);
return;
}else{
etInput.setText(content);
}
etInput.setSelection(etInput.getText().length());
}
public String getContent() {
if (etInput.getText().toString().equals(presetText)){
return "";
}
return etInput.getText().toString();
}
public EditText getEtInput() {
return etInput;
}
public ImageView getIvClear() {
return ivClear;
}
public String getTitle(){
return tvLeft.getText().toString();
}
private boolean canShowCan(){
if (!scanEnable){
return false;
}
return TextUtils.isEmpty(etInput.getText().toString()) || etInput.getText().toString().equals(presetText);
}
}
| 8,120 | 0.574969 | 0.572626 | 227 | 34.726871 | 26.918139 | 157 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.634361 | false | false |
5
|
df83682b94afb86fe5a6e7c34245d1e2490da3c7
| 5,866,925,349,375 |
3448c9939b378be42af626fde7dcd94a758f8846
|
/app/src/main/java/com/valkyrie/nabeshimamac/lightsout/adapter/SharedQuestionAdapter.java
|
c83fe27951889af1fd93309d9a520efd706ee4c2
|
[] |
no_license
|
valjapan/LightsOut
|
https://github.com/valjapan/LightsOut
|
7c5969e3d10baf50b052c23abda0290f193f43e2
|
cd37b34405ed39d0c9967b63962d50c169fd0da9
|
refs/heads/master
| 2021-06-24T04:34:49.517000 | 2017-01-29T21:02:46 | 2017-01-29T21:02:46 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.valkyrie.nabeshimamac.lightsout.adapter;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import com.valkyrie.nabeshimamac.lightsout.R;
import com.valkyrie.nabeshimamac.lightsout.model.SharedQuestion;
import java.util.Locale;
/**
* ListViewのAdapter
*/
public class SharedQuestionAdapter extends ArrayAdapter<SharedQuestion> {
LayoutInflater inflater;
private Locale locale = Locale.getDefault();
public SharedQuestionAdapter(Context context) {
super(context, 0);
inflater = LayoutInflater.from(context);
}
public static Intent createIntent(Context context) {
return new Intent(context, SharedQuestionAdapter.class);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
final ViewHolder viewHolder;
if (convertView == null) {
convertView = inflater.inflate(R.layout.item_shared_question, parent, false);
viewHolder = new ViewHolder();
viewHolder.titleTextView = (TextView) convertView.findViewById(R.id.textTitle);
viewHolder.detailTextView = (TextView) convertView.findViewById(R.id.textDetail);
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
final SharedQuestion item = getItem(position);
viewHolder.titleTextView.setText(item.title);
int emptyCount = 0;
for (int i = 0; i < item.board.length(); i++) {
if (item.board.charAt(i) == '0') {
emptyCount++;
}
}
if (locale.equals(Locale.JAPAN)) {
viewHolder.detailTextView.setText("・盤面のサイズ : " + item.width + "×" + item.height +
" \n・空のマス : " + emptyCount);
} else {
viewHolder.detailTextView.setText("・Size : " + item.width + "×" + item.height +
" \n・Empty Board : " + emptyCount);
}
//盤面の情報
return convertView;
}
class ViewHolder {
TextView titleTextView;
TextView detailTextView;
}
}
|
UTF-8
|
Java
| 2,320 |
java
|
SharedQuestionAdapter.java
|
Java
|
[] | null |
[] |
package com.valkyrie.nabeshimamac.lightsout.adapter;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import com.valkyrie.nabeshimamac.lightsout.R;
import com.valkyrie.nabeshimamac.lightsout.model.SharedQuestion;
import java.util.Locale;
/**
* ListViewのAdapter
*/
public class SharedQuestionAdapter extends ArrayAdapter<SharedQuestion> {
LayoutInflater inflater;
private Locale locale = Locale.getDefault();
public SharedQuestionAdapter(Context context) {
super(context, 0);
inflater = LayoutInflater.from(context);
}
public static Intent createIntent(Context context) {
return new Intent(context, SharedQuestionAdapter.class);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
final ViewHolder viewHolder;
if (convertView == null) {
convertView = inflater.inflate(R.layout.item_shared_question, parent, false);
viewHolder = new ViewHolder();
viewHolder.titleTextView = (TextView) convertView.findViewById(R.id.textTitle);
viewHolder.detailTextView = (TextView) convertView.findViewById(R.id.textDetail);
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
final SharedQuestion item = getItem(position);
viewHolder.titleTextView.setText(item.title);
int emptyCount = 0;
for (int i = 0; i < item.board.length(); i++) {
if (item.board.charAt(i) == '0') {
emptyCount++;
}
}
if (locale.equals(Locale.JAPAN)) {
viewHolder.detailTextView.setText("・盤面のサイズ : " + item.width + "×" + item.height +
" \n・空のマス : " + emptyCount);
} else {
viewHolder.detailTextView.setText("・Size : " + item.width + "×" + item.height +
" \n・Empty Board : " + emptyCount);
}
//盤面の情報
return convertView;
}
class ViewHolder {
TextView titleTextView;
TextView detailTextView;
}
}
| 2,320 | 0.64223 | 0.640474 | 69 | 32.014492 | 26.425993 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.57971 | false | false |
5
|
553abf1b1db1c986eac1d75e3f42e0e7fbd7321a
| 8,134,668,079,211 |
1c4c030059c34c087243122e7a64a4f3a408dccd
|
/app/src/main/java/com/icofficeapp/adapter/ICofficeBaseAdapter.java
|
897aec4fe4044efc1423426c1b6025ae331b6565
|
[] |
no_license
|
juggist/LYFMachine
|
https://github.com/juggist/LYFMachine
|
72f3bf68073f5b8c33f79e0abab760cc3570c5e2
|
6cf0e8433a925023a84856982469af5d838348fd
|
refs/heads/master
| 2020-04-05T12:41:33.413000 | 2018-11-09T14:54:47 | 2018-11-09T14:54:47 | 156,876,349 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.icofficeapp.adapter;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import com.icoffice.library.moudle.control.ImageLoaderControl;
import com.icofficeapp.R;
public class ICofficeBaseAdapter extends BaseAdapter{
protected ImageLoaderControl mImageLoaderControl;
public ICofficeBaseAdapter(){
mImageLoaderControl = ImageLoaderControl.getInstance();
}
protected void displayImage(String url,ImageView iv){
mImageLoaderControl.displayImageBig(url, iv,R.drawable.empty_detail);
}
protected void displayImage(int url,ImageView iv){
mImageLoaderControl.displayImage(url, iv);
}
@Override
public int getCount() {
return 0;
}
@Override
public Object getItem(int arg0) {
return null;
}
@Override
public long getItemId(int arg0) {
return 0;
}
@Override
public View getView(int arg0, View arg1, ViewGroup arg2) {
return null;
}
}
|
UTF-8
|
Java
| 957 |
java
|
ICofficeBaseAdapter.java
|
Java
|
[] | null |
[] |
package com.icofficeapp.adapter;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import com.icoffice.library.moudle.control.ImageLoaderControl;
import com.icofficeapp.R;
public class ICofficeBaseAdapter extends BaseAdapter{
protected ImageLoaderControl mImageLoaderControl;
public ICofficeBaseAdapter(){
mImageLoaderControl = ImageLoaderControl.getInstance();
}
protected void displayImage(String url,ImageView iv){
mImageLoaderControl.displayImageBig(url, iv,R.drawable.empty_detail);
}
protected void displayImage(int url,ImageView iv){
mImageLoaderControl.displayImage(url, iv);
}
@Override
public int getCount() {
return 0;
}
@Override
public Object getItem(int arg0) {
return null;
}
@Override
public long getItemId(int arg0) {
return 0;
}
@Override
public View getView(int arg0, View arg1, ViewGroup arg2) {
return null;
}
}
| 957 | 0.77116 | 0.763845 | 44 | 20.75 | 21.136059 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.409091 | false | false |
5
|
b00474c7b7a954d7bf21ab2a29b16708e31df7b9
| 12,713,103,196,717 |
f7153e85ce8a019220b79963688266900df8d85c
|
/app/src/main/java/com/example/weatheralarm/alarm/service/LoaderReceiver.java
|
118bcc7d546db27a22cc369f4b799d5229442a80
|
[] |
no_license
|
andreimardare05/weather-alarm
|
https://github.com/andreimardare05/weather-alarm
|
b799aa4c155555cd0859a54358c05a9a5e7c9488
|
1cfabe198cfc4504fc4328196e0bde62b106d8ca
|
refs/heads/master
| 2022-11-29T15:09:53.279000 | 2020-07-15T21:33:12 | 2020-07-15T21:33:12 | 255,150,836 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.weatheralarm.alarm.service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.example.weatheralarm.alarm.model.Alarm;
import java.util.ArrayList;
public final class LoaderReceiver extends BroadcastReceiver {
private OnAlarmsLoadedListener mListener;
public LoaderReceiver(OnAlarmsLoadedListener listener){
mListener = listener;
}
@Override
public void onReceive(Context context, Intent intent) {
final ArrayList<Alarm> alarms =
intent.getParcelableArrayListExtra(LoaderService.ALARMS_EXTRA);
mListener.onAlarmsLoaded(alarms);
}
public interface OnAlarmsLoadedListener {
void onAlarmsLoaded(ArrayList<Alarm> alarms);
}
}
|
UTF-8
|
Java
| 795 |
java
|
LoaderReceiver.java
|
Java
|
[] | null |
[] |
package com.example.weatheralarm.alarm.service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.example.weatheralarm.alarm.model.Alarm;
import java.util.ArrayList;
public final class LoaderReceiver extends BroadcastReceiver {
private OnAlarmsLoadedListener mListener;
public LoaderReceiver(OnAlarmsLoadedListener listener){
mListener = listener;
}
@Override
public void onReceive(Context context, Intent intent) {
final ArrayList<Alarm> alarms =
intent.getParcelableArrayListExtra(LoaderService.ALARMS_EXTRA);
mListener.onAlarmsLoaded(alarms);
}
public interface OnAlarmsLoadedListener {
void onAlarmsLoaded(ArrayList<Alarm> alarms);
}
}
| 795 | 0.748428 | 0.748428 | 30 | 25.5 | 24.182293 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false |
5
|
d4af6b7c172fef62e7d05ba90e7a27733f9258bd
| 3,736,621,601,342 |
1c2fbbf2f69447b005e77c0a00648ea7277e6b2b
|
/src/main/java/ilia/nemankov/model/Hotel.java
|
67d30b984d2aaa66ec1de27d1b0070191cca907c
|
[] |
no_license
|
Speedwag00n/BisunesLogicOfProgramSystemsLab1
|
https://github.com/Speedwag00n/BisunesLogicOfProgramSystemsLab1
|
598500af299402e321dde2c4b975b45085487268
|
b271f13f19b531072c4644a2edf691300fe3d418
|
refs/heads/master
| 2023-05-13T01:17:46.787000 | 2021-04-04T20:14:25 | 2021-04-04T20:14:25 | 341,260,790 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ilia.nemankov.model;
import com.vladmihalcea.hibernate.type.basic.PostgreSQLEnumType;
import lombok.Data;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;
import javax.persistence.*;
import java.util.List;
@Entity
@Data
@TypeDef(name = "pgsql_enum", typeClass = PostgreSQLEnumType.class)
public class Hotel {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String name;
@ManyToOne
@JoinColumn(name = "CITY")
private City city;
private String address;
@Column(name = "HOTEL_TYPE")
@Enumerated(EnumType.STRING)
@Type(type = "pgsql_enum")
private HotelType hotelType;
private String description;
private Integer stars;
@OneToMany(mappedBy = "hotel")
private List<Rooms> rooms;
private String owner;
}
|
UTF-8
|
Java
| 855 |
java
|
Hotel.java
|
Java
|
[] | null |
[] |
package ilia.nemankov.model;
import com.vladmihalcea.hibernate.type.basic.PostgreSQLEnumType;
import lombok.Data;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;
import javax.persistence.*;
import java.util.List;
@Entity
@Data
@TypeDef(name = "pgsql_enum", typeClass = PostgreSQLEnumType.class)
public class Hotel {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String name;
@ManyToOne
@JoinColumn(name = "CITY")
private City city;
private String address;
@Column(name = "HOTEL_TYPE")
@Enumerated(EnumType.STRING)
@Type(type = "pgsql_enum")
private HotelType hotelType;
private String description;
private Integer stars;
@OneToMany(mappedBy = "hotel")
private List<Rooms> rooms;
private String owner;
}
| 855 | 0.718129 | 0.718129 | 42 | 19.357143 | 17.983883 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.404762 | false | false |
5
|
25fc9adee69fa5a7bfd7e66b9e79975e45518aea
| 2,130,303,780,914 |
0940d1f2b2a9947886d850a34b3fba01a3618a4d
|
/core/src/main/java/com/smdev/smsj/core/database/dao/CoreEntityTestRepository.java
|
995595b516b15cd4bb323245ed185ec356bf0edf
|
[] |
no_license
|
SamML/seed-spring-mvn-multi-module-w-security
|
https://github.com/SamML/seed-spring-mvn-multi-module-w-security
|
0079544da625deca8b7ca77a038ee02f7dc22e59
|
251e9111b1550a397ac11b37c434c4901bfccfa2
|
refs/heads/master
| 2020-03-18T03:56:42.637000 | 2018-05-26T13:51:15 | 2018-05-26T13:51:15 | 134,260,641 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.smdev.smsj.core.database.dao;
import org.springframework.data.jpa.repository.JpaRepository;
import com.smdev.smsj.core.database.entities.CoreEntityTest;
/**
* @author sm, in 2018
*
* |> CoreEntityTestRepository ~~ [com.smdev.smsj.core.database.dao]
*
*/
public interface CoreEntityTestRepository extends JpaRepository<CoreEntityTest, String>{
}
|
UTF-8
|
Java
| 367 |
java
|
CoreEntityTestRepository.java
|
Java
|
[
{
"context": ".database.entities.CoreEntityTest;\n\n/**\n * @author sm, in 2018\n *\n * |> CoreEntityTestRepository ~~ [co",
"end": 185,
"score": 0.9988821148872375,
"start": 183,
"tag": "USERNAME",
"value": "sm"
}
] | null |
[] |
package com.smdev.smsj.core.database.dao;
import org.springframework.data.jpa.repository.JpaRepository;
import com.smdev.smsj.core.database.entities.CoreEntityTest;
/**
* @author sm, in 2018
*
* |> CoreEntityTestRepository ~~ [com.smdev.smsj.core.database.dao]
*
*/
public interface CoreEntityTestRepository extends JpaRepository<CoreEntityTest, String>{
}
| 367 | 0.773842 | 0.762943 | 15 | 23.466667 | 30.13938 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false |
5
|
3e3dad0d19d601e384894e738c8084986087c1d7
| 30,442,728,198,032 |
30db680a2234f63bbba29fb56d8845e5a87ab08a
|
/src/main/java/com/zyt/service/impl/thirdSupport/impl/WeiBoLoginManagerServiceImpl.java
|
bac8d6e8458632941393b26b1cea8ed6399b8557
|
[] |
no_license
|
gerker/onlineMall
|
https://github.com/gerker/onlineMall
|
350536f2d2e9431d7b5c13f65e663572f8b74ef1
|
5c7cebdbe673842dce85863b2fe078dbc4f98d73
|
refs/heads/master
| 2023-08-24T21:20:50.489000 | 2021-10-18T13:15:23 | 2021-10-18T13:15:23 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.zyt.service.impl.thirdSupport.impl;
import com.zyt.entity.SocailUser;
import com.zyt.entity.VipMember;
import com.zyt.entity.vo.UserFinishLoginResult;
import com.zyt.mapper.MemberLeaveMapper;
import com.zyt.service.memberService.addMemberInfoByWeiBo.AddMemberInfoFromSocialUserService;
import com.zyt.service.thirdSupport.WeiBoLoginManagerService;
import com.zyt.utils.ChangeJsonTools;
import com.zyt.utils.HttpUtils;
import org.apache.http.HttpResponse;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
/**
* @ProjectName: online_drink_mall
* @Package: com.zyt.service.impl.thirdSupport.impl
* @ClassName: WeiBoLoginManagerServiceImpl
* @Author: zhou_yangtao@yeah.net
* @Description: 微博登录服务层实现模块
* @Date: 12:56 2021/2/21
* @Version: 1.0
*/
@Service(value = "weiBoLoginManagerService")
public class WeiBoLoginManagerServiceImpl implements WeiBoLoginManagerService {
private Logger logger = LoggerFactory.getLogger(WeiBoLoginManagerService.class);
@Autowired
private AddMemberInfoFromSocialUserService addMemberInfoFromSocialUserService;
@Autowired
private MemberLeaveMapper memberLeaveMapper;
/**
* @Method: WeiBoAuthorize
* @Author: zhou_yangtao@yeah.net
* @Version 1.0
* @Description:微博授权成功后完成对所需数据的组装
* @Return: com.zyt.entity.SocailUser
* @Exception:
* @Date: 2021/2/21 14:17
* @Param: * @param code
* @Return: com.zyt.entity.SocailUser
*/
@Override
public UserFinishLoginResult WeiBoAuthorize(String code) {
//根据code获得对应的access code
//https://api.weibo.com/oauth2/access_token?client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET&grant_type=authorization_code&redirect_uri=YOUR_REGISTERED_REDIRECT_URI&code=CODE
/*
* host:api.weibo.com
* path:/oauth2/access_token
* client_id:2349338179
* client_secret:5722376ad9a6e686a988c9480d412a38
* grant_type:authorization_code
* redirect_uri:http://127.0.0.1:9000/oauth2/weibo/success
* code:code
* */
Map<String,String> header = new HashMap<>();
Map<String,String> query = new HashMap<>();
//跳转到其他页面
Map<String,String> map = new HashMap<>();
map.put("client_id","2349338179");
map.put("client_secret","5722376ad9a6e686a988c9480d412a38");
map.put("grant_type","authorization_code");
map.put("redirect_uri","http://127.0.0.1:9000/oauth2/weibo/success");
map.put("code",code);
SocailUser socailUser =null;
HttpResponse response = null;
try {
response = HttpUtils.doPost("https://api.weibo.com","/oauth2/access_token","post",header,query,map);
} catch (Exception e) {
e.printStackTrace();
}
if(response.getStatusLine().getStatusCode() == 200){
//成功获取到了accessToken
String jsonStr = null;
try {
jsonStr = EntityUtils.toString(response.getEntity());
} catch (IOException e) {
e.printStackTrace();
}
//获取的结果转化为对象格式
socailUser = ChangeJsonTools.stringToObj(jsonStr, SocailUser.class);
System.out.println("返回结果为:"+socailUser);
//获得了当前授权登录的用户信息
//1.若当前用户是第一次进入网站,自动注册进来 => 为当前社交用户生成一个会员信息账号,以后这个社交账号就对应对应的会员
VipMember vipMember = this.addMemberInfoFromSocialUserService.addMemberInfoFromWeibo(socailUser);
if (vipMember == null){
return null;
}
//不为空 就封装用户登录信息
UserFinishLoginResult userFinishLoginResult = new UserFinishLoginResult();
//设置编号
String uid = UUID.randomUUID().toString().replaceAll("-","");
userFinishLoginResult.setUid(uid);
//拿到第三方登录用户的昵称
userFinishLoginResult.setUserName(vipMember.getNickname());
//拿到第三方登录用户的头像
userFinishLoginResult.setUserHeader(vipMember.getHeader());
//拿到第三方登录用户
Double currGrouthProportion = this.memberLeaveMapper.getCurrGroupProportion(vipMember.getLevelId());
logger.info("评分:"+currGrouthProportion);
logger.info("获得评分比例:"+currGrouthProportion * 100);
userFinishLoginResult.setCurrGrouthproportion(currGrouthProportion * 100);
//拿到第三方登录用户的等级名称
String leaveName = this.memberLeaveMapper.getLeaveNameOfCurrSocialUser(vipMember.getLevelId());
userFinishLoginResult.setUserMemberLname(leaveName);
logger.info("封装后的结果为:"+userFinishLoginResult);
return userFinishLoginResult;
}else{
return null;
}
}
}
|
UTF-8
|
Java
| 5,380 |
java
|
WeiBoLoginManagerServiceImpl.java
|
Java
|
[
{
"context": "lassName: WeiBoLoginManagerServiceImpl\n * @Author: zhou_yangtao@yeah.net\n * @Description: 微博登录服务层实现模块\n * @Date: 12:56 2021",
"end": 945,
"score": 0.9999082684516907,
"start": 924,
"tag": "EMAIL",
"value": "zhou_yangtao@yeah.net"
},
{
"context": "/**\n * @Method: WeiBoAuthorize\n * @Author: zhou_yangtao@yeah.net\n * @Version 1.0\n * @Description:微博授权成功后完",
"end": 1472,
"score": 0.9999200701713562,
"start": 1451,
"tag": "EMAIL",
"value": "zhou_yangtao@yeah.net"
},
{
"context": " * client_id:2349338179\n * client_secret:5722376ad9a6e686a988c9480d412a38\n * grant_type:authorization_code\n ",
"end": 2174,
"score": 0.999640166759491,
"start": 2142,
"tag": "KEY",
"value": "5722376ad9a6e686a988c9480d412a38"
},
{
"context": "\",\"2349338179\");\n map.put(\"client_secret\",\"5722376ad9a6e686a988c9480d412a38\");\n map.put(\"grant_type\",\"authorization_co",
"end": 2599,
"score": 0.9996541738510132,
"start": 2567,
"tag": "KEY",
"value": "5722376ad9a6e686a988c9480d412a38"
}
] | null |
[] |
package com.zyt.service.impl.thirdSupport.impl;
import com.zyt.entity.SocailUser;
import com.zyt.entity.VipMember;
import com.zyt.entity.vo.UserFinishLoginResult;
import com.zyt.mapper.MemberLeaveMapper;
import com.zyt.service.memberService.addMemberInfoByWeiBo.AddMemberInfoFromSocialUserService;
import com.zyt.service.thirdSupport.WeiBoLoginManagerService;
import com.zyt.utils.ChangeJsonTools;
import com.zyt.utils.HttpUtils;
import org.apache.http.HttpResponse;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
/**
* @ProjectName: online_drink_mall
* @Package: com.zyt.service.impl.thirdSupport.impl
* @ClassName: WeiBoLoginManagerServiceImpl
* @Author: <EMAIL>
* @Description: 微博登录服务层实现模块
* @Date: 12:56 2021/2/21
* @Version: 1.0
*/
@Service(value = "weiBoLoginManagerService")
public class WeiBoLoginManagerServiceImpl implements WeiBoLoginManagerService {
private Logger logger = LoggerFactory.getLogger(WeiBoLoginManagerService.class);
@Autowired
private AddMemberInfoFromSocialUserService addMemberInfoFromSocialUserService;
@Autowired
private MemberLeaveMapper memberLeaveMapper;
/**
* @Method: WeiBoAuthorize
* @Author: <EMAIL>
* @Version 1.0
* @Description:微博授权成功后完成对所需数据的组装
* @Return: com.zyt.entity.SocailUser
* @Exception:
* @Date: 2021/2/21 14:17
* @Param: * @param code
* @Return: com.zyt.entity.SocailUser
*/
@Override
public UserFinishLoginResult WeiBoAuthorize(String code) {
//根据code获得对应的access code
//https://api.weibo.com/oauth2/access_token?client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET&grant_type=authorization_code&redirect_uri=YOUR_REGISTERED_REDIRECT_URI&code=CODE
/*
* host:api.weibo.com
* path:/oauth2/access_token
* client_id:2349338179
* client_secret:5722376ad9a6e686a988c9480d412a38
* grant_type:authorization_code
* redirect_uri:http://127.0.0.1:9000/oauth2/weibo/success
* code:code
* */
Map<String,String> header = new HashMap<>();
Map<String,String> query = new HashMap<>();
//跳转到其他页面
Map<String,String> map = new HashMap<>();
map.put("client_id","2349338179");
map.put("client_secret","5722376ad9a6e686a988c9480d412a38");
map.put("grant_type","authorization_code");
map.put("redirect_uri","http://127.0.0.1:9000/oauth2/weibo/success");
map.put("code",code);
SocailUser socailUser =null;
HttpResponse response = null;
try {
response = HttpUtils.doPost("https://api.weibo.com","/oauth2/access_token","post",header,query,map);
} catch (Exception e) {
e.printStackTrace();
}
if(response.getStatusLine().getStatusCode() == 200){
//成功获取到了accessToken
String jsonStr = null;
try {
jsonStr = EntityUtils.toString(response.getEntity());
} catch (IOException e) {
e.printStackTrace();
}
//获取的结果转化为对象格式
socailUser = ChangeJsonTools.stringToObj(jsonStr, SocailUser.class);
System.out.println("返回结果为:"+socailUser);
//获得了当前授权登录的用户信息
//1.若当前用户是第一次进入网站,自动注册进来 => 为当前社交用户生成一个会员信息账号,以后这个社交账号就对应对应的会员
VipMember vipMember = this.addMemberInfoFromSocialUserService.addMemberInfoFromWeibo(socailUser);
if (vipMember == null){
return null;
}
//不为空 就封装用户登录信息
UserFinishLoginResult userFinishLoginResult = new UserFinishLoginResult();
//设置编号
String uid = UUID.randomUUID().toString().replaceAll("-","");
userFinishLoginResult.setUid(uid);
//拿到第三方登录用户的昵称
userFinishLoginResult.setUserName(vipMember.getNickname());
//拿到第三方登录用户的头像
userFinishLoginResult.setUserHeader(vipMember.getHeader());
//拿到第三方登录用户
Double currGrouthProportion = this.memberLeaveMapper.getCurrGroupProportion(vipMember.getLevelId());
logger.info("评分:"+currGrouthProportion);
logger.info("获得评分比例:"+currGrouthProportion * 100);
userFinishLoginResult.setCurrGrouthproportion(currGrouthProportion * 100);
//拿到第三方登录用户的等级名称
String leaveName = this.memberLeaveMapper.getLeaveNameOfCurrSocialUser(vipMember.getLevelId());
userFinishLoginResult.setUserMemberLname(leaveName);
logger.info("封装后的结果为:"+userFinishLoginResult);
return userFinishLoginResult;
}else{
return null;
}
}
}
| 5,352 | 0.668952 | 0.64254 | 124 | 39 | 29.27346 | 191 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.572581 | false | false |
5
|
109667ad6aee8edcfe1618bc44b3b7307b0e5857
| 28,209,345,216,463 |
f7a1ebf0c6afcb3bf7d4ffe7449b6f31265b1bf4
|
/app/src/main/java/com/example/tommy/demoapp10/StreamServer.java
|
c47e343b0f182a406c25f3a3d6b8017f5e8c68e4
|
[] |
no_license
|
OverGrounder/ICP-Demo
|
https://github.com/OverGrounder/ICP-Demo
|
3b02027e5188f678b61f32a075c07e07618b85df
|
48a00aeeb3741cbba0a753b021f6b6fa8770ed75
|
refs/heads/master
| 2020-03-24T23:45:40.203000 | 2018-08-06T01:07:23 | 2018-08-06T01:07:23 | 143,153,236 | 0 | 0 | null | false | 2018-08-06T01:07:24 | 2018-08-01T12:29:51 | 2018-08-06T01:06:03 | 2018-08-06T01:07:24 | 277 | 0 | 0 | 0 |
Java
| false | null |
package com.example.tommy.demoapp10;
import android.os.Parcel;
import android.os.Parcelable;
public class StreamServer implements Parcelable {
public String IP, app_names;
boolean in_use, req_auth;
StreamServer() {}
public static final Creator<StreamServer> CREATOR = new Creator<StreamServer>() {
@Override
public StreamServer createFromParcel(Parcel in) {
return new StreamServer(in);
}
@Override
public StreamServer[] newArray(int size) {
return new StreamServer[size];
}
};
protected StreamServer(Parcel in) {
IP = in.readString();
app_names = in.readString();
in_use = in.readByte() != 0;
req_auth = in.readByte() != 0;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel parcel, int i) {
parcel.writeString(IP);
parcel.writeString(app_names);
parcel.writeByte((byte) (in_use ? 1 : 0));
parcel.writeByte((byte) (req_auth ? 1 : 0));
}
}
|
UTF-8
|
Java
| 1,091 |
java
|
StreamServer.java
|
Java
|
[
{
"context": "package com.example.tommy.demoapp10;\n\nimport android.os.Parcel;\nimport andr",
"end": 25,
"score": 0.9844163656234741,
"start": 20,
"tag": "USERNAME",
"value": "tommy"
}
] | null |
[] |
package com.example.tommy.demoapp10;
import android.os.Parcel;
import android.os.Parcelable;
public class StreamServer implements Parcelable {
public String IP, app_names;
boolean in_use, req_auth;
StreamServer() {}
public static final Creator<StreamServer> CREATOR = new Creator<StreamServer>() {
@Override
public StreamServer createFromParcel(Parcel in) {
return new StreamServer(in);
}
@Override
public StreamServer[] newArray(int size) {
return new StreamServer[size];
}
};
protected StreamServer(Parcel in) {
IP = in.readString();
app_names = in.readString();
in_use = in.readByte() != 0;
req_auth = in.readByte() != 0;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel parcel, int i) {
parcel.writeString(IP);
parcel.writeString(app_names);
parcel.writeByte((byte) (in_use ? 1 : 0));
parcel.writeByte((byte) (req_auth ? 1 : 0));
}
}
| 1,091 | 0.604033 | 0.595784 | 43 | 24.39535 | 20.309397 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.465116 | false | false |
5
|
01b66b2316237403f8d1ba688c71d5a71076ba49
| 28,209,345,216,197 |
10f303e4776e859c6a30bef4b2cba16c1a7ed386
|
/src/com/kaminsky/nio/NIOPractice.java
|
8edc8e636cd16b6a20f025e295abe7d57ac6073c
|
[] |
no_license
|
dazz4/practice-java-core
|
https://github.com/dazz4/practice-java-core
|
4d2e4c05426538bc99ec00050dc7df270d59e56c
|
d227cedd2f55cb93a3cad394ef906468d678e2f5
|
refs/heads/master
| 2020-06-11T14:02:51.405000 | 2019-06-26T23:40:30 | 2019-06-26T23:40:30 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.kaminsky.nio;
import java.io.File;
import java.io.IOException;
import java.nio.channels.FileChannel;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.nio.file.attribute.BasicFileAttributes;
public class NIOPractice {
public static void main(String[] args) {
try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(Path.of("C:\\Users\\kamin\\IdeaProjects"))) {
for (Path entry : directoryStream) {
BasicFileAttributes attrs = Files.readAttributes(entry, BasicFileAttributes.class);
for (int i = 0; i < entry.getNameCount(); i++)
System.out.println(entry.getName(i));
}
} catch (IOException e) {
System.out.println(e.getMessage());
}
}
}
|
UTF-8
|
Java
| 883 |
java
|
NIOPractice.java
|
Java
|
[] | null |
[] |
package com.kaminsky.nio;
import java.io.File;
import java.io.IOException;
import java.nio.channels.FileChannel;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.nio.file.attribute.BasicFileAttributes;
public class NIOPractice {
public static void main(String[] args) {
try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(Path.of("C:\\Users\\kamin\\IdeaProjects"))) {
for (Path entry : directoryStream) {
BasicFileAttributes attrs = Files.readAttributes(entry, BasicFileAttributes.class);
for (int i = 0; i < entry.getNameCount(); i++)
System.out.println(entry.getName(i));
}
} catch (IOException e) {
System.out.println(e.getMessage());
}
}
}
| 883 | 0.664779 | 0.663647 | 30 | 28.433332 | 29.392384 | 123 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
5
|
597f05b0a50d42b08004e24b1a714056caba3d0e
| 20,383,914,846,560 |
fe8f2cf3b98624405a4266783e0aea19ebea261f
|
/module-common/src/main/java/com/zzikza/springboot/web/service/StorageServiceImpl.java
|
6d5ea2d9497515132c806d3428e3d6ab96270daf
|
[] |
no_license
|
dydgus2433/zzikza-webservice
|
https://github.com/dydgus2433/zzikza-webservice
|
861b7ee156ca05ea07d8fe5979cc236b77164ba6
|
e8842c1683855e96242a0bf7da797d5593b7b200
|
refs/heads/master
| 2021-02-09T19:37:55.755000 | 2020-06-08T08:04:49 | 2020-06-08T08:04:49 | 244,318,614 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.zzikza.springboot.web.service;
import com.amazonaws.AmazonClientException;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
import com.amazonaws.services.s3.model.*;
import com.amazonaws.util.IOUtils;
import com.mortennobel.imagescaling.AdvancedResizeOp;
import com.mortennobel.imagescaling.ResampleOp;
import com.zzikza.springboot.web.domain.FileAttribute;
import com.zzikza.springboot.web.util.FileNameUtil;
import lombok.RequiredArgsConstructor;
import org.imgscalr.Scalr;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.ByteArrayResource;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.PostConstruct;
import javax.imageio.IIOException;
import javax.imageio.ImageIO;
import javax.imageio.ImageReader;
import javax.imageio.metadata.IIOMetadata;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.UUID;
@RequiredArgsConstructor
@Service
public class StorageServiceImpl implements StorageService {
private AmazonS3 s3Client;
@Value("${service.fileupload.basedirectory}")
private String FILE_PATH;
@Value("${service.fileupload.editordirectory}")
private String FILE_EDITOR_PATH;
@Value("${service.fileupload.thumb.directory}")
private String FILE_THUMB_PATH;
@Value("${service.fileupload.midsize.directory}")
private String FILE_MIDSIZE_PATH;
@Value("${service.fileupload.large.directory}")
private String FILE_LARGE_PATH;
@Value("${cloud.aws.credentials.accessKey}")
private String accessKey;
@Value("${cloud.aws.credentials.secretKey}")
private String secretKey;
@Value("${cloud.aws.s3.bucket}")
private String bucket;
@Value("${cloud.aws.region.static}")
private String region;
@PostConstruct
public void setS3Client() {
AWSCredentials credentials = new BasicAWSCredentials(this.accessKey, this.secretKey);
s3Client = AmazonS3ClientBuilder.standard()
.withCredentials(new AWSStaticCredentialsProvider(credentials))
.withRegion(this.region)
.build();
}
@Override
public Resource loadAsResource(String filePath) throws IOException {
S3Object s3Object = s3Client.getObject(new GetObjectRequest(bucket, FILE_PATH + filePath));
S3ObjectInputStream s3ObjectInputStream = s3Object.getObjectContent();
byte[] bytes = IOUtils.toByteArray(s3ObjectInputStream);
Resource resource = new ByteArrayResource(bytes);
return resource;
}
@Override
public void delete(String filePath) {
s3Client.deleteObject(new DeleteObjectRequest(bucket, filePath));
}
@Override
public FileAttribute fileUpload(MultipartFile file) throws IOException, AmazonClientException {
FileAttribute fileAttribute = getMultipartFileToFileAttribute(file);
String randomName = getRandomFileName(file);
fileAttribute.setFileName(randomName);
try {
randomName = FILE_PATH + randomName;
String urlPath = putObjectByS3ClientWithMultipartFile(file, randomName);
fileAttribute.setFilePath(urlPath);
} catch (AmazonClientException | IOException e) {
throw e;
}
return fileAttribute;
}
public FileAttribute fileUpload(MultipartFile file, String type) throws IOException, AmazonClientException {
FileAttribute fileAttribute = getMultipartFileToFileAttribute(file);
String randomName = getRandomFileName(file);
fileAttribute.setFileName(randomName);
String filePath = FILE_PATH + randomName;
if ("business".equals(type)) {
filePath = FILE_PATH + "business/" + randomName;
}
String urlPath = putObjectByS3ClientWithMultipartFile(file, filePath);
fileAttribute.setFilePath(urlPath);
try {
if ("studio".equals(type)) {
fileAttribute.setFileThumbPath(makeThumbnail(file, FILE_THUMB_PATH + randomName, 200, 172));
fileAttribute.setFileMidsizePath(makeThumbnail(file, FILE_MIDSIZE_PATH + randomName, 600, 520));
fileAttribute.setFileLargePath(makeThumbnail(file, FILE_LARGE_PATH + randomName, 1400, 1000));
} else if ("product_temp".equals(type)) {
fileAttribute.setFileThumbPath(makeThumbnail(file, FILE_THUMB_PATH + randomName, 200, 172));
fileAttribute.setFileMidsizePath(makeThumbnail(file, FILE_MIDSIZE_PATH + randomName, 600, 520));
fileAttribute.setFileLargePath(makeThumbnail(file, FILE_LARGE_PATH + randomName, 1400, 1000));
} else if ("product".equals(type)) {
fileAttribute.setFileThumbPath(makeThumbnail(file, FILE_THUMB_PATH + randomName, 200, 172));
fileAttribute.setFileMidsizePath(makeThumbnail(file, FILE_MIDSIZE_PATH + randomName, 600, 520));
fileAttribute.setFileLargePath(makeThumbnail(file, FILE_LARGE_PATH + randomName, 1400, 1000));
} else if ("request_product_temp".equals(type)) {
fileAttribute.setFileThumbPath(makeThumbnail(file, FILE_THUMB_PATH + randomName, 200, 172));
fileAttribute.setFileMidsizePath(makeThumbnail(file, FILE_MIDSIZE_PATH + randomName, 600, 520));
fileAttribute.setFileLargePath(makeThumbnail(file, FILE_LARGE_PATH + randomName, 1400, 1000));
} else if ("request_product".equals(type)) {
fileAttribute.setFileThumbPath(makeThumbnail(file, FILE_THUMB_PATH + randomName, 200, 172));
fileAttribute.setFileMidsizePath(makeThumbnail(file, FILE_MIDSIZE_PATH + randomName, 600, 520));
fileAttribute.setFileLargePath(makeThumbnail(file, FILE_LARGE_PATH + randomName, 1400, 1000));
} else if("business".equals(type)){ //"business"
}
} catch (AmazonClientException | IOException e) {
throw e;
}
return fileAttribute;
}
private String makeThumbnail(MultipartFile file, String fileName, int dw, int dh) throws IOException {
String ext = FileNameUtil.getExtension(fileName);
BufferedImage srcImg = ImageIO.read(file.getInputStream());
BufferedImage destImg = getCropBufferedImage(srcImg, dw, dh);
return putObjectByS3ClientWithBufferedImage(destImg, ext, fileName);
}
private String putObjectByS3ClientWithBufferedImage(BufferedImage destImg, String fileExt, String pathName) throws IOException {
ByteArrayOutputStream os = new ByteArrayOutputStream();
ImageIO.write(destImg, fileExt, os);
byte[] buffer = os.toByteArray();
InputStream bis = new ByteArrayInputStream(buffer);
ObjectMetadata meta = new ObjectMetadata();
meta.setContentLength(buffer.length);
PutObjectRequest request = new PutObjectRequest(bucket, pathName, bis, meta);
s3Client.putObject(request.withCannedAcl(CannedAccessControlList.PublicRead));
return s3Client.getUrl(bucket, pathName).toString();
}
private String putObjectByS3ClientWithMultipartFile(MultipartFile file, String randomName) throws IOException {
ObjectMetadata objectMetadata = new ObjectMetadata();
objectMetadata.setContentLength(file.getSize());
s3Client.putObject(new PutObjectRequest(bucket, randomName, file.getInputStream(), objectMetadata)
.withCannedAcl(CannedAccessControlList.PublicRead));
return s3Client.getUrl(bucket, randomName).toString();
}
/**
* 확장자 포함된 파일 이름 반환
*
* @param file
* @return
*/
private String getRandomFileName(MultipartFile file) {
String uid = UUID.randomUUID().toString();
String fileName = file.getOriginalFilename();
String ext = FileNameUtil.getExtension(fileName);
return uid + "." + ext;
}
/**
* 멀티 파트 파일 어트리뷰트로 전환
*
* @param file
* @return
*/
private FileAttribute getMultipartFileToFileAttribute(MultipartFile file) {
String fileName = file.getOriginalFilename();
String ext = FileNameUtil.getExtension(fileName);
FileAttribute fileAttribute = new FileAttribute();
fileAttribute.setFileName(file.getOriginalFilename());
fileAttribute.setFileExt(ext);
fileAttribute.setFileSourceName(file.getOriginalFilename());
fileAttribute.setFileSize(file.getSize());
return fileAttribute;
}
private IIOMetadata readJPEGMetadataSafe(ImageReader reader) throws IOException {
try {
return reader.getImageMetadata(0);
} catch (IIOException e) {
// processWarningOccurred("Could not read metadata metadata JPEG compressed TIFF: " + e.getMessage() + " colors may look incorrect");
return null;
}
}
private BufferedImage getCropBufferedImage(BufferedImage srcImg, int targetWidth, int targetHeight) throws IOException {
// 원본 이미지의 너비와 높이 입니다.
int originWidth = srcImg.getWidth();
int originHeight = srcImg.getHeight();
// 원본 너비를 기준으로 하여 썸네일의 비율로 높이를 계산합니다.
BufferedImage destImg = null;
BufferedImage cropImg = null;
if (targetWidth >= originWidth && targetHeight >= originHeight) {
cropImg = srcImg;
} else {
// 원본 이미지의 너비와 높이 입니다.
int ow = srcImg.getWidth();
int oh = srcImg.getHeight();
// 원본 너비를 기준으로 하여 썸네일의 비율로 높이를 계산합니다.
int nw = ow;
int nh = (ow * targetHeight) / targetWidth;
// 계산된 높이가 원본보다 높다면 crop이 안되므로
// 원본 높이를 기준으로 썸네일의 비율로 너비를 계산합니다.
if (nh > oh) {
nw = (oh * targetWidth) / targetHeight;
nh = oh;
}
// 계산된 크기로 원본이미지를 가운데에서 crop 합니다.
cropImg = Scalr.crop(srcImg, (ow - nw) / 2, (oh - nh) / 2, nw, nh);
// // crop된 이미지로 썸네일을 생성합니다.
// destImg = Scalr.resize(cropImg, updateWidth, updateHeight);
}
ResampleOp resampleOp = new ResampleOp(targetWidth, targetHeight);
resampleOp.setUnsharpenMask(AdvancedResizeOp.UnsharpenMask.None);
destImg = resampleOp.filter(cropImg, null);
return destImg;
}
}
|
UTF-8
|
Java
| 11,076 |
java
|
StorageServiceImpl.java
|
Java
|
[] | null |
[] |
package com.zzikza.springboot.web.service;
import com.amazonaws.AmazonClientException;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
import com.amazonaws.services.s3.model.*;
import com.amazonaws.util.IOUtils;
import com.mortennobel.imagescaling.AdvancedResizeOp;
import com.mortennobel.imagescaling.ResampleOp;
import com.zzikza.springboot.web.domain.FileAttribute;
import com.zzikza.springboot.web.util.FileNameUtil;
import lombok.RequiredArgsConstructor;
import org.imgscalr.Scalr;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.ByteArrayResource;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.PostConstruct;
import javax.imageio.IIOException;
import javax.imageio.ImageIO;
import javax.imageio.ImageReader;
import javax.imageio.metadata.IIOMetadata;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.UUID;
@RequiredArgsConstructor
@Service
public class StorageServiceImpl implements StorageService {
private AmazonS3 s3Client;
@Value("${service.fileupload.basedirectory}")
private String FILE_PATH;
@Value("${service.fileupload.editordirectory}")
private String FILE_EDITOR_PATH;
@Value("${service.fileupload.thumb.directory}")
private String FILE_THUMB_PATH;
@Value("${service.fileupload.midsize.directory}")
private String FILE_MIDSIZE_PATH;
@Value("${service.fileupload.large.directory}")
private String FILE_LARGE_PATH;
@Value("${cloud.aws.credentials.accessKey}")
private String accessKey;
@Value("${cloud.aws.credentials.secretKey}")
private String secretKey;
@Value("${cloud.aws.s3.bucket}")
private String bucket;
@Value("${cloud.aws.region.static}")
private String region;
@PostConstruct
public void setS3Client() {
AWSCredentials credentials = new BasicAWSCredentials(this.accessKey, this.secretKey);
s3Client = AmazonS3ClientBuilder.standard()
.withCredentials(new AWSStaticCredentialsProvider(credentials))
.withRegion(this.region)
.build();
}
@Override
public Resource loadAsResource(String filePath) throws IOException {
S3Object s3Object = s3Client.getObject(new GetObjectRequest(bucket, FILE_PATH + filePath));
S3ObjectInputStream s3ObjectInputStream = s3Object.getObjectContent();
byte[] bytes = IOUtils.toByteArray(s3ObjectInputStream);
Resource resource = new ByteArrayResource(bytes);
return resource;
}
@Override
public void delete(String filePath) {
s3Client.deleteObject(new DeleteObjectRequest(bucket, filePath));
}
@Override
public FileAttribute fileUpload(MultipartFile file) throws IOException, AmazonClientException {
FileAttribute fileAttribute = getMultipartFileToFileAttribute(file);
String randomName = getRandomFileName(file);
fileAttribute.setFileName(randomName);
try {
randomName = FILE_PATH + randomName;
String urlPath = putObjectByS3ClientWithMultipartFile(file, randomName);
fileAttribute.setFilePath(urlPath);
} catch (AmazonClientException | IOException e) {
throw e;
}
return fileAttribute;
}
public FileAttribute fileUpload(MultipartFile file, String type) throws IOException, AmazonClientException {
FileAttribute fileAttribute = getMultipartFileToFileAttribute(file);
String randomName = getRandomFileName(file);
fileAttribute.setFileName(randomName);
String filePath = FILE_PATH + randomName;
if ("business".equals(type)) {
filePath = FILE_PATH + "business/" + randomName;
}
String urlPath = putObjectByS3ClientWithMultipartFile(file, filePath);
fileAttribute.setFilePath(urlPath);
try {
if ("studio".equals(type)) {
fileAttribute.setFileThumbPath(makeThumbnail(file, FILE_THUMB_PATH + randomName, 200, 172));
fileAttribute.setFileMidsizePath(makeThumbnail(file, FILE_MIDSIZE_PATH + randomName, 600, 520));
fileAttribute.setFileLargePath(makeThumbnail(file, FILE_LARGE_PATH + randomName, 1400, 1000));
} else if ("product_temp".equals(type)) {
fileAttribute.setFileThumbPath(makeThumbnail(file, FILE_THUMB_PATH + randomName, 200, 172));
fileAttribute.setFileMidsizePath(makeThumbnail(file, FILE_MIDSIZE_PATH + randomName, 600, 520));
fileAttribute.setFileLargePath(makeThumbnail(file, FILE_LARGE_PATH + randomName, 1400, 1000));
} else if ("product".equals(type)) {
fileAttribute.setFileThumbPath(makeThumbnail(file, FILE_THUMB_PATH + randomName, 200, 172));
fileAttribute.setFileMidsizePath(makeThumbnail(file, FILE_MIDSIZE_PATH + randomName, 600, 520));
fileAttribute.setFileLargePath(makeThumbnail(file, FILE_LARGE_PATH + randomName, 1400, 1000));
} else if ("request_product_temp".equals(type)) {
fileAttribute.setFileThumbPath(makeThumbnail(file, FILE_THUMB_PATH + randomName, 200, 172));
fileAttribute.setFileMidsizePath(makeThumbnail(file, FILE_MIDSIZE_PATH + randomName, 600, 520));
fileAttribute.setFileLargePath(makeThumbnail(file, FILE_LARGE_PATH + randomName, 1400, 1000));
} else if ("request_product".equals(type)) {
fileAttribute.setFileThumbPath(makeThumbnail(file, FILE_THUMB_PATH + randomName, 200, 172));
fileAttribute.setFileMidsizePath(makeThumbnail(file, FILE_MIDSIZE_PATH + randomName, 600, 520));
fileAttribute.setFileLargePath(makeThumbnail(file, FILE_LARGE_PATH + randomName, 1400, 1000));
} else if("business".equals(type)){ //"business"
}
} catch (AmazonClientException | IOException e) {
throw e;
}
return fileAttribute;
}
private String makeThumbnail(MultipartFile file, String fileName, int dw, int dh) throws IOException {
String ext = FileNameUtil.getExtension(fileName);
BufferedImage srcImg = ImageIO.read(file.getInputStream());
BufferedImage destImg = getCropBufferedImage(srcImg, dw, dh);
return putObjectByS3ClientWithBufferedImage(destImg, ext, fileName);
}
private String putObjectByS3ClientWithBufferedImage(BufferedImage destImg, String fileExt, String pathName) throws IOException {
ByteArrayOutputStream os = new ByteArrayOutputStream();
ImageIO.write(destImg, fileExt, os);
byte[] buffer = os.toByteArray();
InputStream bis = new ByteArrayInputStream(buffer);
ObjectMetadata meta = new ObjectMetadata();
meta.setContentLength(buffer.length);
PutObjectRequest request = new PutObjectRequest(bucket, pathName, bis, meta);
s3Client.putObject(request.withCannedAcl(CannedAccessControlList.PublicRead));
return s3Client.getUrl(bucket, pathName).toString();
}
private String putObjectByS3ClientWithMultipartFile(MultipartFile file, String randomName) throws IOException {
ObjectMetadata objectMetadata = new ObjectMetadata();
objectMetadata.setContentLength(file.getSize());
s3Client.putObject(new PutObjectRequest(bucket, randomName, file.getInputStream(), objectMetadata)
.withCannedAcl(CannedAccessControlList.PublicRead));
return s3Client.getUrl(bucket, randomName).toString();
}
/**
* 확장자 포함된 파일 이름 반환
*
* @param file
* @return
*/
private String getRandomFileName(MultipartFile file) {
String uid = UUID.randomUUID().toString();
String fileName = file.getOriginalFilename();
String ext = FileNameUtil.getExtension(fileName);
return uid + "." + ext;
}
/**
* 멀티 파트 파일 어트리뷰트로 전환
*
* @param file
* @return
*/
private FileAttribute getMultipartFileToFileAttribute(MultipartFile file) {
String fileName = file.getOriginalFilename();
String ext = FileNameUtil.getExtension(fileName);
FileAttribute fileAttribute = new FileAttribute();
fileAttribute.setFileName(file.getOriginalFilename());
fileAttribute.setFileExt(ext);
fileAttribute.setFileSourceName(file.getOriginalFilename());
fileAttribute.setFileSize(file.getSize());
return fileAttribute;
}
private IIOMetadata readJPEGMetadataSafe(ImageReader reader) throws IOException {
try {
return reader.getImageMetadata(0);
} catch (IIOException e) {
// processWarningOccurred("Could not read metadata metadata JPEG compressed TIFF: " + e.getMessage() + " colors may look incorrect");
return null;
}
}
private BufferedImage getCropBufferedImage(BufferedImage srcImg, int targetWidth, int targetHeight) throws IOException {
// 원본 이미지의 너비와 높이 입니다.
int originWidth = srcImg.getWidth();
int originHeight = srcImg.getHeight();
// 원본 너비를 기준으로 하여 썸네일의 비율로 높이를 계산합니다.
BufferedImage destImg = null;
BufferedImage cropImg = null;
if (targetWidth >= originWidth && targetHeight >= originHeight) {
cropImg = srcImg;
} else {
// 원본 이미지의 너비와 높이 입니다.
int ow = srcImg.getWidth();
int oh = srcImg.getHeight();
// 원본 너비를 기준으로 하여 썸네일의 비율로 높이를 계산합니다.
int nw = ow;
int nh = (ow * targetHeight) / targetWidth;
// 계산된 높이가 원본보다 높다면 crop이 안되므로
// 원본 높이를 기준으로 썸네일의 비율로 너비를 계산합니다.
if (nh > oh) {
nw = (oh * targetWidth) / targetHeight;
nh = oh;
}
// 계산된 크기로 원본이미지를 가운데에서 crop 합니다.
cropImg = Scalr.crop(srcImg, (ow - nw) / 2, (oh - nh) / 2, nw, nh);
// // crop된 이미지로 썸네일을 생성합니다.
// destImg = Scalr.resize(cropImg, updateWidth, updateHeight);
}
ResampleOp resampleOp = new ResampleOp(targetWidth, targetHeight);
resampleOp.setUnsharpenMask(AdvancedResizeOp.UnsharpenMask.None);
destImg = resampleOp.filter(cropImg, null);
return destImg;
}
}
| 11,076 | 0.684186 | 0.671957 | 265 | 39.422642 | 33.076851 | 144 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.833962 | false | false |
5
|
ca7d02060d7c7b9205718413d6f8be8c1d868f06
| 17,317,308,203,710 |
2d39386ca61d7ded987418b3f37457fc1d2854af
|
/EEPE2013/src/com/fafica/dao/GenericDAO.java
|
ca5950d5b7e85f771bedbabd4e5e310a995e7101
|
[] |
no_license
|
pliniomos/eepe-13
|
https://github.com/pliniomos/eepe-13
|
7422babc3bf6fbb1c2a621be73de8ade62334dd8
|
3e242fcf88d4d343d56f2c957fbd3749e06da2fb
|
refs/heads/master
| 2016-08-02T22:16:47.983000 | 2013-11-08T21:37:18 | 2013-11-08T21:37:18 | 41,513,272 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.fafica.dao;
import java.util.List;
import org.hibernate.CacheMode;
import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.criterion.MatchMode;
import org.hibernate.criterion.Restrictions;
import com.fafica.util.Constantes;
import com.fafica.util.HibernateUtil;
public abstract class GenericDAO <T> {
protected Session sessao;
protected Transaction tx;
protected Class<T> clazz;
protected GenericDAO(Class<T> clazz){
this.clazz = clazz;
}
protected T buscarPorId(Long id){
try{
sessao = HibernateUtil.getSession();
T object = (T) sessao.get(clazz, id);
return object;
}catch(Exception e){
e.printStackTrace();
return null;
}finally{
sessao.close();
}
}
protected T buscarPorChaveUnicaLong(Long longo, String coluna){
try{
sessao = HibernateUtil.getSession();
T object = (T) sessao.createCriteria(clazz).add(Restrictions.eq(coluna, longo)).uniqueResult();
return object;
}catch(Exception e){
e.printStackTrace();
return null;
}finally{
sessao.close();
}
}
protected T buscarPorChaveUnicaString(String stringi, String coluna){
try{
sessao = HibernateUtil.getSession();
T object = (T) sessao.createCriteria(clazz).add(Restrictions.eq(coluna, stringi)).uniqueResult();
return object;
}catch(Exception e){
e.printStackTrace();
return null;
}finally{
sessao.close();
}
}
protected List<T> buscarPorChaveEstrangeira(Long chaveEstrangeira, String coluna){
try{
sessao = HibernateUtil.getSession();
List<T> objects = sessao.createCriteria(clazz).add(Restrictions.eq(coluna, chaveEstrangeira)).list();
return objects;
}catch(Exception e){
e.printStackTrace();
return null;
}finally{
sessao.close();
}
}
protected boolean salvarObjeto(T objeto){
try{
sessao = HibernateUtil.getSession();
tx = sessao.beginTransaction();
sessao.save(objeto);
tx.commit();
return true;
}catch(Exception e){
e.printStackTrace();
return false;
}finally{
if(sessao!=null)
sessao.close();
}
}
protected boolean salvarOuAtualizarObjeto(T objeto){
try{
sessao = HibernateUtil.getSession();
tx = sessao.beginTransaction();
sessao.saveOrUpdate(objeto);
tx.commit();
return true;
}catch(Exception e){
e.printStackTrace();
return false;
}finally{
sessao.close();
}
}
protected boolean atualizarObjeto(T objeto){
try{
sessao = HibernateUtil.getSession();
sessao.setCacheMode(CacheMode.IGNORE);
tx = sessao.beginTransaction();
sessao.update(objeto);
tx.commit();
return true;
}catch(Exception e){
e.printStackTrace();
return false;
}finally{
sessao.close();
}
}
protected boolean mesclarObjeto(T objeto){
try{
sessao = HibernateUtil.getSession();
tx = sessao.beginTransaction();
sessao.merge(objeto);
tx.commit();
return true;
}catch(Exception e){
e.printStackTrace();
return false;
}finally{
sessao.close();
}
}
protected boolean deletarObjeto(T objeto){
try{
sessao = HibernateUtil.getSession();
tx = sessao.beginTransaction();
sessao.delete(objeto);
tx.commit();
return true;
}catch(Exception e){
e.printStackTrace();
return false;
}finally{
sessao.close();
}
}
protected List<T> listarObjetos(){
try{
sessao = HibernateUtil.getSession();
Criteria criteria = sessao.createCriteria(clazz);
return criteria.list();
}catch(Exception e){
e.printStackTrace();
return null;
}finally{
sessao.close();
}
}
protected List<T> criarQuery(String query){
try{
sessao = HibernateUtil.getSession();
Query select = sessao.createQuery(query);
return select.list();
}catch(Exception e){
e.printStackTrace();
return null;
}finally{
sessao.close();
}
}
protected T selectObjeto(String query){
try{
sessao = HibernateUtil.getSession();
T obj = (T) sessao.createQuery(query).uniqueResult();
return obj;
}catch(Exception e){
e.printStackTrace();
return null;
}finally{
sessao.close();
}
}
protected List<T> buscarPorLike(String coluna, String queryPart){
try{
sessao = HibernateUtil.getSession();
Criteria c = sessao.createCriteria(clazz);
c.add(Restrictions.like(coluna, queryPart, MatchMode.ANYWHERE));
c.add(Restrictions.like("status", Constantes.ATIVO));
List<T> objets = c.list();
return objets;
}catch(Exception e){
e.printStackTrace();
return null;
}finally{
sessao.close();
}
}
protected List<T> buscarPorLikeIlimitado(String [] colunas, String [] querys){
try{
sessao = HibernateUtil.getSession();
Criteria c = sessao.createCriteria(clazz);
for(int i = 0; i < colunas.length; i++){
c.add(Restrictions.like(colunas[i], querys[i], MatchMode.ANYWHERE));
}
List<T> objets = c.list();
return objets;
}catch(Exception e){
e.printStackTrace();
return null;
}finally{
sessao.close();
}
}
protected List<T> buscarPorLikeIgnoreCase(String coluna, String queryPart){
try{
sessao = HibernateUtil.getSession();
List<T> objets = sessao.createCriteria(clazz).add(Restrictions.ilike(coluna, queryPart, MatchMode.ANYWHERE)).list();
return objets;
}catch(Exception e){
e.printStackTrace();
return null;
}finally{
sessao.close();
}
}
}
|
UTF-8
|
Java
| 5,628 |
java
|
GenericDAO.java
|
Java
|
[] | null |
[] |
package com.fafica.dao;
import java.util.List;
import org.hibernate.CacheMode;
import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.criterion.MatchMode;
import org.hibernate.criterion.Restrictions;
import com.fafica.util.Constantes;
import com.fafica.util.HibernateUtil;
public abstract class GenericDAO <T> {
protected Session sessao;
protected Transaction tx;
protected Class<T> clazz;
protected GenericDAO(Class<T> clazz){
this.clazz = clazz;
}
protected T buscarPorId(Long id){
try{
sessao = HibernateUtil.getSession();
T object = (T) sessao.get(clazz, id);
return object;
}catch(Exception e){
e.printStackTrace();
return null;
}finally{
sessao.close();
}
}
protected T buscarPorChaveUnicaLong(Long longo, String coluna){
try{
sessao = HibernateUtil.getSession();
T object = (T) sessao.createCriteria(clazz).add(Restrictions.eq(coluna, longo)).uniqueResult();
return object;
}catch(Exception e){
e.printStackTrace();
return null;
}finally{
sessao.close();
}
}
protected T buscarPorChaveUnicaString(String stringi, String coluna){
try{
sessao = HibernateUtil.getSession();
T object = (T) sessao.createCriteria(clazz).add(Restrictions.eq(coluna, stringi)).uniqueResult();
return object;
}catch(Exception e){
e.printStackTrace();
return null;
}finally{
sessao.close();
}
}
protected List<T> buscarPorChaveEstrangeira(Long chaveEstrangeira, String coluna){
try{
sessao = HibernateUtil.getSession();
List<T> objects = sessao.createCriteria(clazz).add(Restrictions.eq(coluna, chaveEstrangeira)).list();
return objects;
}catch(Exception e){
e.printStackTrace();
return null;
}finally{
sessao.close();
}
}
protected boolean salvarObjeto(T objeto){
try{
sessao = HibernateUtil.getSession();
tx = sessao.beginTransaction();
sessao.save(objeto);
tx.commit();
return true;
}catch(Exception e){
e.printStackTrace();
return false;
}finally{
if(sessao!=null)
sessao.close();
}
}
protected boolean salvarOuAtualizarObjeto(T objeto){
try{
sessao = HibernateUtil.getSession();
tx = sessao.beginTransaction();
sessao.saveOrUpdate(objeto);
tx.commit();
return true;
}catch(Exception e){
e.printStackTrace();
return false;
}finally{
sessao.close();
}
}
protected boolean atualizarObjeto(T objeto){
try{
sessao = HibernateUtil.getSession();
sessao.setCacheMode(CacheMode.IGNORE);
tx = sessao.beginTransaction();
sessao.update(objeto);
tx.commit();
return true;
}catch(Exception e){
e.printStackTrace();
return false;
}finally{
sessao.close();
}
}
protected boolean mesclarObjeto(T objeto){
try{
sessao = HibernateUtil.getSession();
tx = sessao.beginTransaction();
sessao.merge(objeto);
tx.commit();
return true;
}catch(Exception e){
e.printStackTrace();
return false;
}finally{
sessao.close();
}
}
protected boolean deletarObjeto(T objeto){
try{
sessao = HibernateUtil.getSession();
tx = sessao.beginTransaction();
sessao.delete(objeto);
tx.commit();
return true;
}catch(Exception e){
e.printStackTrace();
return false;
}finally{
sessao.close();
}
}
protected List<T> listarObjetos(){
try{
sessao = HibernateUtil.getSession();
Criteria criteria = sessao.createCriteria(clazz);
return criteria.list();
}catch(Exception e){
e.printStackTrace();
return null;
}finally{
sessao.close();
}
}
protected List<T> criarQuery(String query){
try{
sessao = HibernateUtil.getSession();
Query select = sessao.createQuery(query);
return select.list();
}catch(Exception e){
e.printStackTrace();
return null;
}finally{
sessao.close();
}
}
protected T selectObjeto(String query){
try{
sessao = HibernateUtil.getSession();
T obj = (T) sessao.createQuery(query).uniqueResult();
return obj;
}catch(Exception e){
e.printStackTrace();
return null;
}finally{
sessao.close();
}
}
protected List<T> buscarPorLike(String coluna, String queryPart){
try{
sessao = HibernateUtil.getSession();
Criteria c = sessao.createCriteria(clazz);
c.add(Restrictions.like(coluna, queryPart, MatchMode.ANYWHERE));
c.add(Restrictions.like("status", Constantes.ATIVO));
List<T> objets = c.list();
return objets;
}catch(Exception e){
e.printStackTrace();
return null;
}finally{
sessao.close();
}
}
protected List<T> buscarPorLikeIlimitado(String [] colunas, String [] querys){
try{
sessao = HibernateUtil.getSession();
Criteria c = sessao.createCriteria(clazz);
for(int i = 0; i < colunas.length; i++){
c.add(Restrictions.like(colunas[i], querys[i], MatchMode.ANYWHERE));
}
List<T> objets = c.list();
return objets;
}catch(Exception e){
e.printStackTrace();
return null;
}finally{
sessao.close();
}
}
protected List<T> buscarPorLikeIgnoreCase(String coluna, String queryPart){
try{
sessao = HibernateUtil.getSession();
List<T> objets = sessao.createCriteria(clazz).add(Restrictions.ilike(coluna, queryPart, MatchMode.ANYWHERE)).list();
return objets;
}catch(Exception e){
e.printStackTrace();
return null;
}finally{
sessao.close();
}
}
}
| 5,628 | 0.655473 | 0.655295 | 240 | 21.450001 | 19.927933 | 119 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.675 | false | false |
5
|
7393722215504aca7161a1ca6b52c85b2a6f3b73
| 11,811,160,108,852 |
f5290791ca16285a58ade01f6dd1c04c58f511c6
|
/app/src/main/java/edu/kvcc/cis298/cis298inclass1/Question.java
|
42e171662a34c535ea123cc98807325c5387d83b
|
[] |
no_license
|
grantfar/cis298inclass2
|
https://github.com/grantfar/cis298inclass2
|
fc8c540efd02efd93efca02d91d2e941abe2a795
|
c05ebcc3906b1f93727365ccc8617a2425b9a587
|
refs/heads/master
| 2021-01-23T17:19:59.205000 | 2016-09-28T20:39:42 | 2016-09-28T20:39:42 | 68,635,687 | 0 | 0 | null | true | 2016-09-19T18:47:43 | 2016-09-19T18:47:42 | 2016-09-19T02:31:08 | 2016-09-19T02:31:06 | 80 | 0 | 0 | 0 | null | null | null |
package edu.kvcc.cis298.cis298inclass1;
/**
* Created by gfarnsworth6886 on 9/19/2016.
*/
public class Question {
private boolean mIsCorrect;
private int mTheQuestion;
public Question(int theQuestion, boolean isCorrect)
{
mTheQuestion = theQuestion;
mIsCorrect = isCorrect;
}
public boolean isCorrect() {
return mIsCorrect;
}
public void setCorrect(boolean correct) {
mIsCorrect = correct;
}
public int getTheQuestion() {
return mTheQuestion;
}
public void setTheQuestion(int theQuestion) {
mTheQuestion = theQuestion;
}
public int testAnswer(boolean theirAnswer)
{
if(theirAnswer==mIsCorrect)
return R.string.correct_toast;
else
return R.string.incorrect_toast;
}
}
|
UTF-8
|
Java
| 828 |
java
|
Question.java
|
Java
|
[
{
"context": "edu.kvcc.cis298.cis298inclass1;\n\n/**\n * Created by gfarnsworth6886 on 9/19/2016.\n */\npublic class Question {\n pri",
"end": 74,
"score": 0.9995705485343933,
"start": 59,
"tag": "USERNAME",
"value": "gfarnsworth6886"
}
] | null |
[] |
package edu.kvcc.cis298.cis298inclass1;
/**
* Created by gfarnsworth6886 on 9/19/2016.
*/
public class Question {
private boolean mIsCorrect;
private int mTheQuestion;
public Question(int theQuestion, boolean isCorrect)
{
mTheQuestion = theQuestion;
mIsCorrect = isCorrect;
}
public boolean isCorrect() {
return mIsCorrect;
}
public void setCorrect(boolean correct) {
mIsCorrect = correct;
}
public int getTheQuestion() {
return mTheQuestion;
}
public void setTheQuestion(int theQuestion) {
mTheQuestion = theQuestion;
}
public int testAnswer(boolean theirAnswer)
{
if(theirAnswer==mIsCorrect)
return R.string.correct_toast;
else
return R.string.incorrect_toast;
}
}
| 828 | 0.634058 | 0.612319 | 39 | 20.23077 | 17.844717 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.307692 | false | false |
5
|
c1b9af45f1134edb5dc6d0ab8d3f28edfe3d3688
| 32,899,449,505,318 |
520a6a3e31cb6e54f45be44441b5a4a34ce5e1f4
|
/exotourier/src/main/java/com/exotourier/exotourier/exception/CityAlreadyExistException.java
|
6bc9cca9597acc8c08e6aa94deeb3a2ae04df4e2
|
[] |
no_license
|
calandrajose/ExoTurier
|
https://github.com/calandrajose/ExoTurier
|
edd34552ac3c381572c684c9117c4e9541d7970a
|
6cdf1141f398a63644bbe3b94e7a81d8eeacf3df
|
refs/heads/master
| 2022-07-19T01:05:59.726000 | 2020-05-28T00:16:06 | 2020-05-28T00:16:06 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.exotourier.exotourier.exception;
public class CityAlreadyExistException extends Throwable {
}
|
UTF-8
|
Java
| 107 |
java
|
CityAlreadyExistException.java
|
Java
|
[] | null |
[] |
package com.exotourier.exotourier.exception;
public class CityAlreadyExistException extends Throwable {
}
| 107 | 0.850467 | 0.850467 | 4 | 25.75 | 25.733004 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false |
5
|
c78bfc87573e28b84793db70af9c7f051b3931d8
| 11,914,239,311,270 |
a2667caf4fa07e2f58871e609e0bac4fe07c5a51
|
/src/test/java/ru/job4j/tracker/ItemTest.java
|
d04f8ccd71aa12316625b9f503740087e150e274
|
[] |
no_license
|
Anatoly-D/job4j_tracker
|
https://github.com/Anatoly-D/job4j_tracker
|
a5cc0b02b88323ce9db9fdc383af0bb84a9826aa
|
7c363a4963bf68395ebda92695fd825f5b25b86b
|
refs/heads/master
| 2022-11-26T19:15:49.482000 | 2020-08-02T08:26:15 | 2020-08-02T08:26:15 | 280,183,015 | 0 | 0 | null | true | 2020-07-16T14:59:40 | 2020-07-16T14:59:40 | 2020-06-17T05:20:00 | 2020-06-17T05:19:58 | 6 | 0 | 0 | 0 | null | false | false |
package ru.job4j.tracker;
import org.junit.Test;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.*;
public class ItemTest {
@Test
public void sortByIdAsc() {
List<Item> items = Arrays.asList(new Item(3, "third"),
new Item(2, "second"),
new Item(5, "fifth"),
new Item(1, "first"));
List<Item> itemsExpected = Arrays.asList(new Item(1, "first"),
new Item(2, "second"),
new Item(3, "third"),
new Item(5, "fifth")
);
Collections.sort(items);
assertThat(items, is(itemsExpected));
}
}
|
UTF-8
|
Java
| 744 |
java
|
ItemTest.java
|
Java
|
[] | null |
[] |
package ru.job4j.tracker;
import org.junit.Test;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.*;
public class ItemTest {
@Test
public void sortByIdAsc() {
List<Item> items = Arrays.asList(new Item(3, "third"),
new Item(2, "second"),
new Item(5, "fifth"),
new Item(1, "first"));
List<Item> itemsExpected = Arrays.asList(new Item(1, "first"),
new Item(2, "second"),
new Item(3, "third"),
new Item(5, "fifth")
);
Collections.sort(items);
assertThat(items, is(itemsExpected));
}
}
| 744 | 0.563172 | 0.551075 | 31 | 23.032259 | 19.054224 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.83871 | false | false |
5
|
cd407dceeae8e7d6dea39ee009a207104235a390
| 9,088,150,822,366 |
998ac102e73a9d160b5992adcb5b62039f2a434f
|
/zheye/src/main/java/com/zheye/domain/Question.java
|
d375da4e1764c47439429bfe34bddbcf5aa00c80
|
[] |
no_license
|
3374202040/zheye
|
https://github.com/3374202040/zheye
|
a7c5ad5a90bc5ff02cfa46d407c3ea43cfd3ab2d
|
d1f82c3df31d6ca9c79f619b50a46770c5319ff7
|
refs/heads/master
| 2022-06-27T19:00:33.602000 | 2019-09-06T03:37:28 | 2019-09-06T03:37:28 | 205,861,892 | 1 | 1 | null | false | 2022-06-21T01:47:52 | 2019-09-02T13:21:23 | 2019-09-06T03:38:07 | 2022-06-21T01:47:49 | 9,451 | 1 | 1 | 4 |
JavaScript
| false | false |
package com.zheye.domain;
import java.io.Serializable;
import java.sql.Date;
import java.util.ArrayList;
import java.util.List;
public class Question implements Serializable {
private Integer id;
private String title;//问题标题
private String content;//问题内容
private Date createtime;
// private UserInfo questioner;
private Integer questionerId;//问题人id
private Integer subject;//所属主题
private List<Answer> answers;//问题的回答集合
private Integer readerTimes;//阅读数
private Integer agreeTimes;//点赞数
private Integer disagressTimes;//反对数
public Integer getQuestionerId() {
return questionerId;
}
public void setQuestionerId(Integer questionerId) {
this.questionerId = questionerId;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Date getCreatetime() {
return createtime;
}
public void setCreatetime(Date createtime) {
this.createtime = createtime;
}
// public UserInfo getQuestioner() {
// return questioner;
// }
//
// public void setQuestioner(UserInfo questioner) {
// this.questioner = questioner;
// }
public Integer getSubject() {
return subject;
}
public void setSubject(Integer subject) {
this.subject = subject;
}
public List<Answer> getAnswers() {
return answers;
}
public void setAnswers(List<Answer> answers) {
this.answers = answers;
}
public Integer getReaderTimes() {
return readerTimes;
}
public void setReaderTimes(Integer readerTimes) {
this.readerTimes = readerTimes;
}
public Integer getAgreeTimes() {
return agreeTimes;
}
public void setAgreeTimes(Integer agreeTimes) {
this.agreeTimes = agreeTimes;
}
public Integer getDisagressTimes() {
return disagressTimes;
}
public void setDisagressTimes(Integer disagressTimes) {
this.disagressTimes = disagressTimes;
}
@Override
public String toString() {
return "Question{" +
"id=" + id +
", title='" + title + '\'' +
", content='" + content + '\'' +
", createtime=" + createtime +
", questionerId=" + questionerId +
", subject=" + subject +
", answers=" + answers +
", readerTimes=" + readerTimes +
", agreeTimes=" + agreeTimes +
", disagressTimes=" + disagressTimes +
'}';
}
}
|
UTF-8
|
Java
| 2,961 |
java
|
Question.java
|
Java
|
[] | null |
[] |
package com.zheye.domain;
import java.io.Serializable;
import java.sql.Date;
import java.util.ArrayList;
import java.util.List;
public class Question implements Serializable {
private Integer id;
private String title;//问题标题
private String content;//问题内容
private Date createtime;
// private UserInfo questioner;
private Integer questionerId;//问题人id
private Integer subject;//所属主题
private List<Answer> answers;//问题的回答集合
private Integer readerTimes;//阅读数
private Integer agreeTimes;//点赞数
private Integer disagressTimes;//反对数
public Integer getQuestionerId() {
return questionerId;
}
public void setQuestionerId(Integer questionerId) {
this.questionerId = questionerId;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Date getCreatetime() {
return createtime;
}
public void setCreatetime(Date createtime) {
this.createtime = createtime;
}
// public UserInfo getQuestioner() {
// return questioner;
// }
//
// public void setQuestioner(UserInfo questioner) {
// this.questioner = questioner;
// }
public Integer getSubject() {
return subject;
}
public void setSubject(Integer subject) {
this.subject = subject;
}
public List<Answer> getAnswers() {
return answers;
}
public void setAnswers(List<Answer> answers) {
this.answers = answers;
}
public Integer getReaderTimes() {
return readerTimes;
}
public void setReaderTimes(Integer readerTimes) {
this.readerTimes = readerTimes;
}
public Integer getAgreeTimes() {
return agreeTimes;
}
public void setAgreeTimes(Integer agreeTimes) {
this.agreeTimes = agreeTimes;
}
public Integer getDisagressTimes() {
return disagressTimes;
}
public void setDisagressTimes(Integer disagressTimes) {
this.disagressTimes = disagressTimes;
}
@Override
public String toString() {
return "Question{" +
"id=" + id +
", title='" + title + '\'' +
", content='" + content + '\'' +
", createtime=" + createtime +
", questionerId=" + questionerId +
", subject=" + subject +
", answers=" + answers +
", readerTimes=" + readerTimes +
", agreeTimes=" + agreeTimes +
", disagressTimes=" + disagressTimes +
'}';
}
}
| 2,961 | 0.590204 | 0.590204 | 124 | 22.379032 | 17.950016 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.387097 | false | false |
5
|
1f3ea05473d78944e087b370d943593190555c66
| 9,088,150,819,158 |
ede7cd37fe33b6847aa555d7a0e5169eb996a7d6
|
/outapi.webservice/src/main/java/com/mine/product/czmtr/ram/outapi/dto/AssetCodeBean.java
|
b7303fa15eaada1dbba8c8d464f80db0a751e5a9
|
[] |
no_license
|
yeahoLee/ram
|
https://github.com/yeahoLee/ram
|
20e90266f561d4e7470281a68e25eea389fe4258
|
1a71a607a9e80a7f4c4daf3f16a59e4e9b504dd2
|
refs/heads/master
| 2022-12-12T04:03:05.100000 | 2020-09-04T07:12:11 | 2020-09-04T07:12:11 | 292,213,167 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.mine.product.czmtr.ram.outapi.dto;
import java.io.Serializable;
public class AssetCodeBean implements Serializable {
private static final long serialVersionUID = -922297093807185509L;
//资产编码
private String assetCode;
//验证码
private String validateCode;
public String getAssetCode() {
return assetCode;
}
public void setAssetCode(String assetCode) {
this.assetCode = assetCode;
}
public String getValidateCode() {
return validateCode;
}
public void setValidateCode(String validateCode) {
this.validateCode = validateCode;
}
}
|
UTF-8
|
Java
| 643 |
java
|
AssetCodeBean.java
|
Java
|
[] | null |
[] |
package com.mine.product.czmtr.ram.outapi.dto;
import java.io.Serializable;
public class AssetCodeBean implements Serializable {
private static final long serialVersionUID = -922297093807185509L;
//资产编码
private String assetCode;
//验证码
private String validateCode;
public String getAssetCode() {
return assetCode;
}
public void setAssetCode(String assetCode) {
this.assetCode = assetCode;
}
public String getValidateCode() {
return validateCode;
}
public void setValidateCode(String validateCode) {
this.validateCode = validateCode;
}
}
| 643 | 0.688394 | 0.659777 | 30 | 19.966667 | 20.61631 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.3 | false | false |
5
|
fd49e201a424221074f77a0aa1720fed7547e875
| 10,703,058,504,554 |
959b22937112f04c5ef654386d80c8cdd9c9f269
|
/src/ru/cyberspace/plugin/context/Settings.java
|
f562fe14a3755574691066a8acd3810ebe4712f1
|
[
"Apache-2.0"
] |
permissive
|
cyberspaceru/cx-plugin
|
https://github.com/cyberspaceru/cx-plugin
|
8b0d559f79e86273dbbb2b84c96b19e79e88f7c8
|
d62f3c04dbf6768bd12f6be0d27c7fae5c6fc7b7
|
refs/heads/master
| 2020-03-30T21:54:24.273000 | 2018-10-07T18:46:03 | 2018-10-07T18:46:03 | 151,645,946 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ru.cyberspace.plugin.context;
import ru.cyberspace.plugin.context.support.entry.ActionEntryStep;
import ru.cyberspace.plugin.context.support.entry.EntryStep;
import ru.cyberspace.plugin.context.support.entry.PageEntryStep;
import java.util.ArrayList;
import java.util.List;
public class Settings {
public static List<EntryStep> pageSteps = new ArrayList<>();
public static List<EntryStep> actionSteps = new ArrayList<>();
static {
pageSteps.add(new PageEntryStep("пользователь находится на странице \"${page-entry}\""));
actionSteps.add(new ActionEntryStep("он (${action-entry})"));
}
private Settings() {
}
}
|
UTF-8
|
Java
| 700 |
java
|
Settings.java
|
Java
|
[] | null |
[] |
package ru.cyberspace.plugin.context;
import ru.cyberspace.plugin.context.support.entry.ActionEntryStep;
import ru.cyberspace.plugin.context.support.entry.EntryStep;
import ru.cyberspace.plugin.context.support.entry.PageEntryStep;
import java.util.ArrayList;
import java.util.List;
public class Settings {
public static List<EntryStep> pageSteps = new ArrayList<>();
public static List<EntryStep> actionSteps = new ArrayList<>();
static {
pageSteps.add(new PageEntryStep("пользователь находится на странице \"${page-entry}\""));
actionSteps.add(new ActionEntryStep("он (${action-entry})"));
}
private Settings() {
}
}
| 700 | 0.728636 | 0.728636 | 23 | 28 | 30.062254 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.434783 | false | false |
5
|
dbf0161b3d9a00054ff112a8dd6a2eabd7edc1b9
| 11,476,152,642,908 |
7010cba36133dcf319beaaa57755439092a7cd81
|
/nowcoder/src/practice/MergeSort.java
|
b798a5467105c28f3fc4703ab70a61938b20007b
|
[] |
no_license
|
hzruandd/coding-guide_i3geek
|
https://github.com/hzruandd/coding-guide_i3geek
|
f345c8ee5b8125597b69a7ad78237fa7c8540d47
|
3affd653a75ebe45fbf61e647b348eff66b5b5a0
|
refs/heads/master
| 2021-01-09T06:04:53.099000 | 2017-01-16T11:14:03 | 2017-01-16T11:14:03 | 80,908,201 | 4 | 1 | null | true | 2017-02-04T09:13:24 | 2017-02-04T09:13:24 | 2016-12-29T02:12:36 | 2017-01-16T11:17:00 | 144 | 0 | 0 | 0 | null | null | null |
package practice;
public class MergeSort {
//将有二个有序数列a[first...mid]和a[mid...last]合并。
void mergearray(int a[], int first, int mid, int last, int temp[])
{
int i = first, j = mid + 1;
int m = mid, n = last;
int k = 0;
while (i <= m && j <= n)
{
if (a[i] <= a[j])
temp[k++] = a[i++];
else
temp[k++] = a[j++];
}
while (i <= m)
temp[k++] = a[i++];
while (j <= n)
temp[k++] = a[j++];
for (i = 0; i < k; i++)
a[first + i] = temp[i];
}
void mergesort(int a[], int first, int last, int temp[])
{
if (first < last)
{
int mid = (first + last) / 2;
mergesort(a, first, mid, temp); //左边有序
mergesort(a, mid + 1, last, temp); //右边有序
mergearray(a, first, mid, last, temp); //再将二个有序数列合并
}
}
boolean MergeSort(int a[], int n)
{
int[] p = new int[n];
mergesort(a, 0, n - 1, p);
return true;
}
}
|
UTF-8
|
Java
| 1,261 |
java
|
MergeSort.java
|
Java
|
[] | null |
[] |
package practice;
public class MergeSort {
//将有二个有序数列a[first...mid]和a[mid...last]合并。
void mergearray(int a[], int first, int mid, int last, int temp[])
{
int i = first, j = mid + 1;
int m = mid, n = last;
int k = 0;
while (i <= m && j <= n)
{
if (a[i] <= a[j])
temp[k++] = a[i++];
else
temp[k++] = a[j++];
}
while (i <= m)
temp[k++] = a[i++];
while (j <= n)
temp[k++] = a[j++];
for (i = 0; i < k; i++)
a[first + i] = temp[i];
}
void mergesort(int a[], int first, int last, int temp[])
{
if (first < last)
{
int mid = (first + last) / 2;
mergesort(a, first, mid, temp); //左边有序
mergesort(a, mid + 1, last, temp); //右边有序
mergearray(a, first, mid, last, temp); //再将二个有序数列合并
}
}
boolean MergeSort(int a[], int n)
{
int[] p = new int[n];
mergesort(a, 0, n - 1, p);
return true;
}
}
| 1,261 | 0.362198 | 0.35637 | 46 | 25.108696 | 18.026825 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.891304 | false | false |
5
|
e697d1c4067a46879cbb9243b3c197484b848982
| 3,195,455,711,036 |
94d59d36cd33642613c33fecbb83e5ac4ae5683d
|
/src/main/java/com/javainuse/service/JewelleryShopService.java
|
9cf575a26e9b6abda361eaa1e30892bbcfe0be04
|
[] |
no_license
|
EvgenJin/boot-drools-flow
|
https://github.com/EvgenJin/boot-drools-flow
|
d4bb494f09fc805c8268f9109a9d5efae832b4cd
|
554a11d2b2efb4cc6e517183a4a8cfb7e76f5c37
|
refs/heads/master
| 2022-06-25T20:50:18.232000 | 2019-06-25T21:33:14 | 2019-06-25T21:33:14 | 193,396,787 | 1 | 0 | null | false | 2023-09-12T13:54:58 | 2019-06-23T21:23:08 | 2019-07-11T21:02:29 | 2023-09-12T13:54:55 | 32 | 1 | 0 | 1 |
Java
| false | false |
package com.javainuse.service;
import com.javainuse.model.Customer;
import com.javainuse.model.Message;
import org.kie.api.runtime.KieContainer;
import org.kie.api.runtime.KieSession;
import org.kie.api.runtime.rule.FactHandle;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.javainuse.model.Product;
import java.util.HashMap;
import java.util.Map;
@Service
public class JewelleryShopService {
private final KieContainer kieContainer;
@Autowired
public JewelleryShopService(KieContainer kieContainer) {
this.kieContainer = kieContainer;
}
// public Product getProductDiscount(Product product) {
// KieSession kieSession = kieContainer.newKieSession("rulesSession");
// kieSession.insert(product);
// kieSession.fireAllRules();
// kieSession.dispose();
// return product;
// }
public Message getProductDiscount(Message message) {
KieSession kieSession = kieContainer.newKieSession("ksession-process");
// message.setMessage("Rule is fired");
// message.setStatus(Message.HELLO);
Map<String, Object> mess = new HashMap<String, Object>();
mess.put("message", message);
// в session совать объект в процесс хашмап, иначе проверки не будут робить.
Customer customer1 = new Customer("Frank");
customer1.setAge(4);
customer1.setCat_id(82);
customer1.setProduct_code("03.01.00");
Customer customer2 = new Customer("John");
customer2.setAge(1);
customer2.setCat_id(0);
customer2.setProduct_code("03.01.00");
FactHandle fact1 = kieSession.insert(customer1);
FactHandle fact2 = kieSession.insert(customer2);
kieSession.fireAllRules();
System.out.println("The discount for the Customer " + customer1.getName() + " is " + customer1.getDiscount());
System.out.println("The discount for the Customer " + customer2.getName() + " is " + customer2.getDiscount());
// kieSession.insert(message);
// kieSession.startProcess("com.javacodegeeks.drools", mess);
// kieSession.fireAllRules();
kieSession.dispose();
return message;
}
// public static final void main(String[] args) {
// try {
// // load up the knowledge base
// KieServices ks = KieServices.Factory.get();
// KieContainer kContainer = ks.getKieClasspathContainer();
// KieSession kSession = kContainer.newKieSession("ksession-process");
// Message message = new Message();
// message.setMessage("Rule is fired");
// message.setStatus(Message.HELLO);
// kSession.insert(message);
//
// // start a new process instance
// kSession.startProcess("com.javacodegeeks.drools", null);
// kSession.fireAllRules();
// } catch (Throwable t) {
// t.printStackTrace();
// }
// }
}
|
UTF-8
|
Java
| 3,048 |
java
|
JewelleryShopService.java
|
Java
|
[
{
"context": "т робить.\n\n\n\t\t\tCustomer customer1 = new Customer(\"Frank\");\n\t\t\tcustomer1.setAge(4);\n\t\t\tcustomer1.setCat_id",
"end": 1390,
"score": 0.9997423887252808,
"start": 1385,
"tag": "NAME",
"value": "Frank"
},
{
"context": "3.01.00\");\n\n\t\t\tCustomer customer2 = new Customer(\"John\");\n\t\t\tcustomer2.setAge(1);\n\t\t\tcustomer2.setCat_id",
"end": 1531,
"score": 0.9998012185096741,
"start": 1527,
"tag": "NAME",
"value": "John"
}
] | null |
[] |
package com.javainuse.service;
import com.javainuse.model.Customer;
import com.javainuse.model.Message;
import org.kie.api.runtime.KieContainer;
import org.kie.api.runtime.KieSession;
import org.kie.api.runtime.rule.FactHandle;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.javainuse.model.Product;
import java.util.HashMap;
import java.util.Map;
@Service
public class JewelleryShopService {
private final KieContainer kieContainer;
@Autowired
public JewelleryShopService(KieContainer kieContainer) {
this.kieContainer = kieContainer;
}
// public Product getProductDiscount(Product product) {
// KieSession kieSession = kieContainer.newKieSession("rulesSession");
// kieSession.insert(product);
// kieSession.fireAllRules();
// kieSession.dispose();
// return product;
// }
public Message getProductDiscount(Message message) {
KieSession kieSession = kieContainer.newKieSession("ksession-process");
// message.setMessage("Rule is fired");
// message.setStatus(Message.HELLO);
Map<String, Object> mess = new HashMap<String, Object>();
mess.put("message", message);
// в session совать объект в процесс хашмап, иначе проверки не будут робить.
Customer customer1 = new Customer("Frank");
customer1.setAge(4);
customer1.setCat_id(82);
customer1.setProduct_code("03.01.00");
Customer customer2 = new Customer("John");
customer2.setAge(1);
customer2.setCat_id(0);
customer2.setProduct_code("03.01.00");
FactHandle fact1 = kieSession.insert(customer1);
FactHandle fact2 = kieSession.insert(customer2);
kieSession.fireAllRules();
System.out.println("The discount for the Customer " + customer1.getName() + " is " + customer1.getDiscount());
System.out.println("The discount for the Customer " + customer2.getName() + " is " + customer2.getDiscount());
// kieSession.insert(message);
// kieSession.startProcess("com.javacodegeeks.drools", mess);
// kieSession.fireAllRules();
kieSession.dispose();
return message;
}
// public static final void main(String[] args) {
// try {
// // load up the knowledge base
// KieServices ks = KieServices.Factory.get();
// KieContainer kContainer = ks.getKieClasspathContainer();
// KieSession kSession = kContainer.newKieSession("ksession-process");
// Message message = new Message();
// message.setMessage("Rule is fired");
// message.setStatus(Message.HELLO);
// kSession.insert(message);
//
// // start a new process instance
// kSession.startProcess("com.javacodegeeks.drools", null);
// kSession.fireAllRules();
// } catch (Throwable t) {
// t.printStackTrace();
// }
// }
}
| 3,048 | 0.657429 | 0.646411 | 84 | 34.666668 | 26.390083 | 113 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.5 | false | false |
5
|
752def98a5e9f7dbdd9ca437eec5f99a17c14371
| 7,009,386,682,345 |
0f71f83ee3597e1b733f3b5d1a3cf677d396ecfa
|
/JavaStrong/src/Day06/set/LinkedHashSetDemo.java
|
53029ce2b41a4cf3e212536827ba3efebfe2c756
|
[] |
no_license
|
yeyshengge/allmyself
|
https://github.com/yeyshengge/allmyself
|
a9514aa3abe88f3dc4711fc4d003200de8b0d031
|
0a45fc836a03e3ab7ce456381eb12382caed6ffb
|
refs/heads/master
| 2022-05-17T13:57:12.135000 | 2020-02-12T10:33:01 | 2020-02-12T10:33:01 | 239,975,581 | 0 | 0 | null | false | 2022-04-23T02:34:25 | 2020-02-12T09:38:52 | 2020-02-12T10:50:56 | 2022-04-23T02:34:23 | 166,687 | 0 | 0 | 54 |
JavaScript
| false | false |
package Day06.set;
import java.util.LinkedHashSet;
/*LinkedHashSet集合的特点:
哈希表和链表实现的Set接口,具有可预测的迭代次序
有链表保证元素有序,存储跟取出的元素顺序一样
哈希表保证元素唯一,没有重复元素
*/
public class LinkedHashSetDemo {
public static void main(String[] args) {
LinkedHashSet<String> lhs = new LinkedHashSet<>();
lhs.add("迪丽热巴");
lhs.add("古力娜扎");
lhs.add("马尔扎哈");
lhs.add("迪丽热巴");//hash保证元素的唯一性
for (String s : lhs) {
System.out.println(s);
}
int sss = "ssss".compareTo("sss");
System.out.println(sss);
}
}
|
UTF-8
|
Java
| 738 |
java
|
LinkedHashSetDemo.java
|
Java
|
[] | null |
[] |
package Day06.set;
import java.util.LinkedHashSet;
/*LinkedHashSet集合的特点:
哈希表和链表实现的Set接口,具有可预测的迭代次序
有链表保证元素有序,存储跟取出的元素顺序一样
哈希表保证元素唯一,没有重复元素
*/
public class LinkedHashSetDemo {
public static void main(String[] args) {
LinkedHashSet<String> lhs = new LinkedHashSet<>();
lhs.add("迪丽热巴");
lhs.add("古力娜扎");
lhs.add("马尔扎哈");
lhs.add("迪丽热巴");//hash保证元素的唯一性
for (String s : lhs) {
System.out.println(s);
}
int sss = "ssss".compareTo("sss");
System.out.println(sss);
}
}
| 738 | 0.607527 | 0.603943 | 25 | 21.32 | 15.726971 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false |
5
|
3eda82502bc2dd99948e740ced876f1ae1dde230
| 6,313,601,963,332 |
697c302f2f116e17da4e4af6e2889b947852d4e0
|
/app/src/main/java/com/example/haitran/cura/fragments/AuthenticationFragment.java
|
28430f7f7b742a579294f92ad0d91cd6ae191608
|
[] |
no_license
|
honghai78/CURA
|
https://github.com/honghai78/CURA
|
78980d334c2c03cfdea3cf94f298a327218356c7
|
3ca1d39d6638e01094a782e8dd161d9702a0f7d0
|
refs/heads/master
| 2020-12-25T11:15:15.425000 | 2016-07-05T06:30:36 | 2016-07-05T06:30:36 | 62,109,155 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.haitran.cura.fragments;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;
import com.example.haitran.cura.KeyBoardEffect;
import com.example.haitran.cura.R;
import com.example.haitran.cura.activities.HomeActivity;
import java.util.ArrayList;
import java.util.List;
/**
* Created by kha.phan on 6/28/2016.
*/
public class AuthenticationFragment extends Fragment implements View.OnClickListener{
private String educatorName;
private TextView mTextHello;
private TextView mDigitFirst, mDigitSecond, mDigitThird,mDigitFourth;
private List<TextView> mListDigitInput;
private TextView mKey_1, mKey_2, mKey_3, mKey_4, mKey_5, mKey_6,
mKey_7, mKey_8, mKey_9, mKey_0;
private View mLayout;
private TextView mResendCode,mKeyClear, mKeyTick;
private int[] mDigitInput = {-1,-1,-1,-1};
private int mTextDigitSelected = 1;
private Toast mToast;
private KeyBoardEffect mKeyBoardEffect;
public void setNameEducator(String educatorName) {
this.educatorName = educatorName;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
// Defines the xml file for the fragment
AppCompatActivity appCompatActivity = (AppCompatActivity) getActivity();
appCompatActivity.getSupportActionBar().show();
appCompatActivity.getSupportActionBar().setTitle("Authentication");
appCompatActivity.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
appCompatActivity.getSupportActionBar().setDefaultDisplayHomeAsUpEnabled(true);
return inflater.inflate(R.layout.fragment_authentication, parent, false);
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
getWidgets(view);
addEvent();
addEffectKeyBoard();
changeBgTextViewSelected(mTextDigitSelected);
if (educatorName!=null) mTextHello.setText(mTextHello.getText() + " "+educatorName +",");
else mTextHello.setText(mTextHello.getText() + " Mrs.Kha" +",");
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mToast = Toast.makeText(getActivity(), "", Toast.LENGTH_SHORT);
}
private void getWidgets(View view){
mLayout = (View) view.findViewById(R.id.layout_full);
mTextHello = (TextView) view.findViewById(R.id.text_hello);
mDigitFirst = (TextView) view.findViewById(R.id.text_digit_first);
mDigitSecond = (TextView) view.findViewById(R.id.text_digit_second);
mDigitThird = (TextView) view.findViewById(R.id.text_digit_third);
mDigitFourth = (TextView) view.findViewById(R.id.text_digit_fourth);
mListDigitInput = new ArrayList<TextView>();
mListDigitInput.add(mDigitFirst);
mListDigitInput.add(mDigitSecond);
mListDigitInput.add(mDigitThird);
mListDigitInput.add(mDigitFourth);
mKey_0 = (TextView) view.findViewById(R.id.text_keyboard_0);
mKey_1 = (TextView) view.findViewById(R.id.text_keyboard_1);
mKey_2 = (TextView) view.findViewById(R.id.text_keyboard_2);
mKey_3 = (TextView) view.findViewById(R.id.text_keyboard_3);
mKey_4 = (TextView) view.findViewById(R.id.text_keyboard_4);
mKey_5 = (TextView) view.findViewById(R.id.text_keyboard_5);
mKey_6 = (TextView) view.findViewById(R.id.text_keyboard_6);
mKey_7 = (TextView) view.findViewById(R.id.text_keyboard_7);
mKey_8 = (TextView) view.findViewById(R.id.text_keyboard_8);
mKey_9 = (TextView) view.findViewById(R.id.text_keyboard_9);
mResendCode = (TextView) view.findViewById(R.id.text_resend_code);
mKeyClear = (TextView) view.findViewById(R.id.text_clear);
mKeyTick = (TextView) view.findViewById(R.id.text_tick);
}
private void addEffectKeyBoard(){
mKeyBoardEffect = new KeyBoardEffect();
mKeyBoardEffect.setButtonEffect(mKey_0);
mKeyBoardEffect.setButtonEffect(mKey_1);
mKeyBoardEffect.setButtonEffect(mKey_2);
mKeyBoardEffect.setButtonEffect(mKey_3);
mKeyBoardEffect.setButtonEffect(mKey_4);
mKeyBoardEffect.setButtonEffect(mKey_5);
mKeyBoardEffect.setButtonEffect(mKey_6);
mKeyBoardEffect.setButtonEffect(mKey_7);
mKeyBoardEffect.setButtonEffect(mKey_8);
mKeyBoardEffect.setButtonEffect(mKey_9);
mKeyBoardEffect.setButtonEffect(mKeyClear);
mKeyBoardEffect.setButtonEffect(mKeyTick);
}
private void addEvent(){
mDigitFirst.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mDigitFirst.setText("");
mTextDigitSelected = 1;
mDigitInput[mTextDigitSelected-1]=-1;
changeBgTextViewSelected(mTextDigitSelected);
}
});
mDigitSecond.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mDigitSecond.setText("");
mTextDigitSelected = 2;
mDigitInput[mTextDigitSelected-1]=-1;
changeBgTextViewSelected(mTextDigitSelected);
}
});
mDigitThird.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mDigitThird.setText("");
mTextDigitSelected = 3;
mDigitInput[mTextDigitSelected-1]=-1;
changeBgTextViewSelected(mTextDigitSelected);
}
});
mDigitFourth.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mDigitFourth.setText("");
mTextDigitSelected = 4;
mDigitInput[mTextDigitSelected-1]=-1;
changeBgTextViewSelected(mTextDigitSelected);
}
});
mKey_0.setOnClickListener(this);
mKey_1.setOnClickListener(this);
mKey_2.setOnClickListener(this);
mKey_3.setOnClickListener(this);
mKey_4.setOnClickListener(this);
mKey_5.setOnClickListener(this);
mKey_6.setOnClickListener(this);
mKey_7.setOnClickListener(this);
mKey_8.setOnClickListener(this);
mKey_9.setOnClickListener(this);
mLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
mKeyClear.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
clearDigitInput();
}
});
mKeyTick.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
logIn();
}
});
mResendCode.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
}
private void changeBgTextViewSelected(int textDigitSelected){
for (int i =0; i<mListDigitInput.size(); i++){
int index = i+1;
if (index == textDigitSelected) {
mListDigitInput.get(i).setBackgroundResource(R.drawable.bg_textview_selected);
}
else mListDigitInput.get(i).setBackgroundResource(R.drawable.bg_dashed_line);
}
}
private void inputDigit(int i) {
if (lengthDigitInput()==4) {
mToast.setText("You are typed enough 4 digit");
mToast.show();
}
switch (mTextDigitSelected){
case 1:
mDigitInput[0] = i;
mDigitFirst.setText("*");
mTextDigitSelected = nextInput();
changeBgTextViewSelected(mTextDigitSelected);
break;
case 2:
mDigitInput[1] = i;
mDigitSecond.setText("*");
mTextDigitSelected= nextInput();
changeBgTextViewSelected(mTextDigitSelected);
break;
case 3:
mDigitInput[2] = i;
mDigitThird.setText("*");
mTextDigitSelected= nextInput();
changeBgTextViewSelected(mTextDigitSelected);
break;
case 4:
mDigitInput[3] = i;
mDigitFourth.setText("*");
mTextDigitSelected= nextInput();
Log.d("+++backInput", ",Input: +" + mTextDigitSelected);
changeBgTextViewSelected(mTextDigitSelected);
break;
}
}
private void clearDigitInput(){
if(mTextDigitSelected==1&&lengthDigitInput()==0){
mToast.setText("You still not type any number yet");
mToast.show();
return;
}
if(mTextDigitSelected == 5){
mTextDigitSelected =4;
}
else {
mTextDigitSelected = backInput();
}
mDigitInput[mTextDigitSelected-1] = -1;
mListDigitInput.get(mTextDigitSelected-1).setText("");
changeBgTextViewSelected(mTextDigitSelected);
}
private void logIn() {
if (lengthDigitInput()<4){
mToast.setText("Please input 4 digit for login");
mToast.show();
return;
}
String passInput ="";
for(int code: mDigitInput){
passInput += code;
}
if(checkPassCode(passInput,"2016")){
Intent intent = new Intent(getActivity(),HomeActivity.class);
startActivity(intent);
getActivity().finish();
}
else {
mToast.setText("Incorrect password");
mToast.show();
reInput();
}
}
private int lengthDigitInput(){
int length = 0;
for (int digit : mDigitInput){
if(digit >=0) length ++;
}
return length;
}
private int nextInput(){
int index = 5;
for(int i = mTextDigitSelected-1; i< mDigitInput.length ; i++) {
if (mDigitInput[i]<0) return i+1;
}
for(int i=0; i<mTextDigitSelected-1;i++){
if (mDigitInput[i]<0) return i+1;
}
return index;
}
private int backInput(){
int index = 1;
Log.d("+++backInput", ",TextDigitSelected: +" + mTextDigitSelected);
for(int i = mTextDigitSelected-1; i>=0 ; i--) {
if (mDigitInput[i]>=0) return i+1;
}
for (int i = mDigitInput.length-1; i>mTextDigitSelected-1; i-- ){
if (mDigitInput[i]>=0) return i+1;
}
return index;
}
private void reInput() {
for(int i=0; i<mDigitInput.length;i++){
mDigitInput[i]=-1;
}
mTextDigitSelected= 1;
changeBgTextViewSelected(mTextDigitSelected);
mDigitFirst.setText("");
mDigitSecond.setText("");
mDigitThird.setText("");
mDigitFourth.setText("");
}
private boolean checkPassCode(String digitInput, String pass){
if(digitInput.equals(pass)) return true;
return false;
}
@Override
public void onResume() {
super.onResume();
getView().setFocusableInTouchMode(true);
getView().requestFocus();
getView().setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {
Fragment fragment = getActivity().getSupportFragmentManager().findFragmentByTag("PAGE_2");
if (fragment != null) {
FragmentTransaction fragmentTransaction = getActivity().getSupportFragmentManager().beginTransaction();
fragmentTransaction.setCustomAnimations(R.transition.sli_re_in, R.transition.sli_re_out);
fragmentTransaction.remove(fragment).commit();
((AppCompatActivity)getActivity()).getSupportActionBar().hide();
}
return true;
}
return false;
}
});
}
@Override
public void onClick(View v) {
String tittle = ((TextView) v).getText().toString();
switch (tittle) {
case "1":
inputDigit(1);
break;
case "2":
inputDigit(2);
break;
case "3":
inputDigit(3);
break;
case "4":
inputDigit(4);
break;
case "5":
inputDigit(5);
break;
case "6":
inputDigit(6);
break;
case "7":
inputDigit(7);
break;
case "8":
inputDigit(8);
break;
case "9":
inputDigit(9);
break;
case "0":
inputDigit(0);
break;
}
}
}
|
UTF-8
|
Java
| 13,807 |
java
|
AuthenticationFragment.java
|
Java
|
[
{
"context": "rayList;\nimport java.util.List;\n\n/**\n * Created by kha.phan on 6/28/2016.\n */\npublic class AuthenticationFrag",
"end": 715,
"score": 0.998629629611969,
"start": 707,
"tag": "USERNAME",
"value": "kha.phan"
},
{
"context": " else mTextHello.setText(mTextHello.getText() + \" Mrs.Kha\" +\",\");\n }\n\n @Override\n public void onAc",
"end": 2535,
"score": 0.9263450503349304,
"start": 2528,
"tag": "NAME",
"value": "Mrs.Kha"
}
] | null |
[] |
package com.example.haitran.cura.fragments;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;
import com.example.haitran.cura.KeyBoardEffect;
import com.example.haitran.cura.R;
import com.example.haitran.cura.activities.HomeActivity;
import java.util.ArrayList;
import java.util.List;
/**
* Created by kha.phan on 6/28/2016.
*/
public class AuthenticationFragment extends Fragment implements View.OnClickListener{
private String educatorName;
private TextView mTextHello;
private TextView mDigitFirst, mDigitSecond, mDigitThird,mDigitFourth;
private List<TextView> mListDigitInput;
private TextView mKey_1, mKey_2, mKey_3, mKey_4, mKey_5, mKey_6,
mKey_7, mKey_8, mKey_9, mKey_0;
private View mLayout;
private TextView mResendCode,mKeyClear, mKeyTick;
private int[] mDigitInput = {-1,-1,-1,-1};
private int mTextDigitSelected = 1;
private Toast mToast;
private KeyBoardEffect mKeyBoardEffect;
public void setNameEducator(String educatorName) {
this.educatorName = educatorName;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
// Defines the xml file for the fragment
AppCompatActivity appCompatActivity = (AppCompatActivity) getActivity();
appCompatActivity.getSupportActionBar().show();
appCompatActivity.getSupportActionBar().setTitle("Authentication");
appCompatActivity.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
appCompatActivity.getSupportActionBar().setDefaultDisplayHomeAsUpEnabled(true);
return inflater.inflate(R.layout.fragment_authentication, parent, false);
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
getWidgets(view);
addEvent();
addEffectKeyBoard();
changeBgTextViewSelected(mTextDigitSelected);
if (educatorName!=null) mTextHello.setText(mTextHello.getText() + " "+educatorName +",");
else mTextHello.setText(mTextHello.getText() + " Mrs.Kha" +",");
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mToast = Toast.makeText(getActivity(), "", Toast.LENGTH_SHORT);
}
private void getWidgets(View view){
mLayout = (View) view.findViewById(R.id.layout_full);
mTextHello = (TextView) view.findViewById(R.id.text_hello);
mDigitFirst = (TextView) view.findViewById(R.id.text_digit_first);
mDigitSecond = (TextView) view.findViewById(R.id.text_digit_second);
mDigitThird = (TextView) view.findViewById(R.id.text_digit_third);
mDigitFourth = (TextView) view.findViewById(R.id.text_digit_fourth);
mListDigitInput = new ArrayList<TextView>();
mListDigitInput.add(mDigitFirst);
mListDigitInput.add(mDigitSecond);
mListDigitInput.add(mDigitThird);
mListDigitInput.add(mDigitFourth);
mKey_0 = (TextView) view.findViewById(R.id.text_keyboard_0);
mKey_1 = (TextView) view.findViewById(R.id.text_keyboard_1);
mKey_2 = (TextView) view.findViewById(R.id.text_keyboard_2);
mKey_3 = (TextView) view.findViewById(R.id.text_keyboard_3);
mKey_4 = (TextView) view.findViewById(R.id.text_keyboard_4);
mKey_5 = (TextView) view.findViewById(R.id.text_keyboard_5);
mKey_6 = (TextView) view.findViewById(R.id.text_keyboard_6);
mKey_7 = (TextView) view.findViewById(R.id.text_keyboard_7);
mKey_8 = (TextView) view.findViewById(R.id.text_keyboard_8);
mKey_9 = (TextView) view.findViewById(R.id.text_keyboard_9);
mResendCode = (TextView) view.findViewById(R.id.text_resend_code);
mKeyClear = (TextView) view.findViewById(R.id.text_clear);
mKeyTick = (TextView) view.findViewById(R.id.text_tick);
}
private void addEffectKeyBoard(){
mKeyBoardEffect = new KeyBoardEffect();
mKeyBoardEffect.setButtonEffect(mKey_0);
mKeyBoardEffect.setButtonEffect(mKey_1);
mKeyBoardEffect.setButtonEffect(mKey_2);
mKeyBoardEffect.setButtonEffect(mKey_3);
mKeyBoardEffect.setButtonEffect(mKey_4);
mKeyBoardEffect.setButtonEffect(mKey_5);
mKeyBoardEffect.setButtonEffect(mKey_6);
mKeyBoardEffect.setButtonEffect(mKey_7);
mKeyBoardEffect.setButtonEffect(mKey_8);
mKeyBoardEffect.setButtonEffect(mKey_9);
mKeyBoardEffect.setButtonEffect(mKeyClear);
mKeyBoardEffect.setButtonEffect(mKeyTick);
}
private void addEvent(){
mDigitFirst.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mDigitFirst.setText("");
mTextDigitSelected = 1;
mDigitInput[mTextDigitSelected-1]=-1;
changeBgTextViewSelected(mTextDigitSelected);
}
});
mDigitSecond.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mDigitSecond.setText("");
mTextDigitSelected = 2;
mDigitInput[mTextDigitSelected-1]=-1;
changeBgTextViewSelected(mTextDigitSelected);
}
});
mDigitThird.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mDigitThird.setText("");
mTextDigitSelected = 3;
mDigitInput[mTextDigitSelected-1]=-1;
changeBgTextViewSelected(mTextDigitSelected);
}
});
mDigitFourth.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mDigitFourth.setText("");
mTextDigitSelected = 4;
mDigitInput[mTextDigitSelected-1]=-1;
changeBgTextViewSelected(mTextDigitSelected);
}
});
mKey_0.setOnClickListener(this);
mKey_1.setOnClickListener(this);
mKey_2.setOnClickListener(this);
mKey_3.setOnClickListener(this);
mKey_4.setOnClickListener(this);
mKey_5.setOnClickListener(this);
mKey_6.setOnClickListener(this);
mKey_7.setOnClickListener(this);
mKey_8.setOnClickListener(this);
mKey_9.setOnClickListener(this);
mLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
mKeyClear.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
clearDigitInput();
}
});
mKeyTick.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
logIn();
}
});
mResendCode.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
}
private void changeBgTextViewSelected(int textDigitSelected){
for (int i =0; i<mListDigitInput.size(); i++){
int index = i+1;
if (index == textDigitSelected) {
mListDigitInput.get(i).setBackgroundResource(R.drawable.bg_textview_selected);
}
else mListDigitInput.get(i).setBackgroundResource(R.drawable.bg_dashed_line);
}
}
private void inputDigit(int i) {
if (lengthDigitInput()==4) {
mToast.setText("You are typed enough 4 digit");
mToast.show();
}
switch (mTextDigitSelected){
case 1:
mDigitInput[0] = i;
mDigitFirst.setText("*");
mTextDigitSelected = nextInput();
changeBgTextViewSelected(mTextDigitSelected);
break;
case 2:
mDigitInput[1] = i;
mDigitSecond.setText("*");
mTextDigitSelected= nextInput();
changeBgTextViewSelected(mTextDigitSelected);
break;
case 3:
mDigitInput[2] = i;
mDigitThird.setText("*");
mTextDigitSelected= nextInput();
changeBgTextViewSelected(mTextDigitSelected);
break;
case 4:
mDigitInput[3] = i;
mDigitFourth.setText("*");
mTextDigitSelected= nextInput();
Log.d("+++backInput", ",Input: +" + mTextDigitSelected);
changeBgTextViewSelected(mTextDigitSelected);
break;
}
}
private void clearDigitInput(){
if(mTextDigitSelected==1&&lengthDigitInput()==0){
mToast.setText("You still not type any number yet");
mToast.show();
return;
}
if(mTextDigitSelected == 5){
mTextDigitSelected =4;
}
else {
mTextDigitSelected = backInput();
}
mDigitInput[mTextDigitSelected-1] = -1;
mListDigitInput.get(mTextDigitSelected-1).setText("");
changeBgTextViewSelected(mTextDigitSelected);
}
private void logIn() {
if (lengthDigitInput()<4){
mToast.setText("Please input 4 digit for login");
mToast.show();
return;
}
String passInput ="";
for(int code: mDigitInput){
passInput += code;
}
if(checkPassCode(passInput,"2016")){
Intent intent = new Intent(getActivity(),HomeActivity.class);
startActivity(intent);
getActivity().finish();
}
else {
mToast.setText("Incorrect password");
mToast.show();
reInput();
}
}
private int lengthDigitInput(){
int length = 0;
for (int digit : mDigitInput){
if(digit >=0) length ++;
}
return length;
}
private int nextInput(){
int index = 5;
for(int i = mTextDigitSelected-1; i< mDigitInput.length ; i++) {
if (mDigitInput[i]<0) return i+1;
}
for(int i=0; i<mTextDigitSelected-1;i++){
if (mDigitInput[i]<0) return i+1;
}
return index;
}
private int backInput(){
int index = 1;
Log.d("+++backInput", ",TextDigitSelected: +" + mTextDigitSelected);
for(int i = mTextDigitSelected-1; i>=0 ; i--) {
if (mDigitInput[i]>=0) return i+1;
}
for (int i = mDigitInput.length-1; i>mTextDigitSelected-1; i-- ){
if (mDigitInput[i]>=0) return i+1;
}
return index;
}
private void reInput() {
for(int i=0; i<mDigitInput.length;i++){
mDigitInput[i]=-1;
}
mTextDigitSelected= 1;
changeBgTextViewSelected(mTextDigitSelected);
mDigitFirst.setText("");
mDigitSecond.setText("");
mDigitThird.setText("");
mDigitFourth.setText("");
}
private boolean checkPassCode(String digitInput, String pass){
if(digitInput.equals(pass)) return true;
return false;
}
@Override
public void onResume() {
super.onResume();
getView().setFocusableInTouchMode(true);
getView().requestFocus();
getView().setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {
Fragment fragment = getActivity().getSupportFragmentManager().findFragmentByTag("PAGE_2");
if (fragment != null) {
FragmentTransaction fragmentTransaction = getActivity().getSupportFragmentManager().beginTransaction();
fragmentTransaction.setCustomAnimations(R.transition.sli_re_in, R.transition.sli_re_out);
fragmentTransaction.remove(fragment).commit();
((AppCompatActivity)getActivity()).getSupportActionBar().hide();
}
return true;
}
return false;
}
});
}
@Override
public void onClick(View v) {
String tittle = ((TextView) v).getText().toString();
switch (tittle) {
case "1":
inputDigit(1);
break;
case "2":
inputDigit(2);
break;
case "3":
inputDigit(3);
break;
case "4":
inputDigit(4);
break;
case "5":
inputDigit(5);
break;
case "6":
inputDigit(6);
break;
case "7":
inputDigit(7);
break;
case "8":
inputDigit(8);
break;
case "9":
inputDigit(9);
break;
case "0":
inputDigit(0);
break;
}
}
}
| 13,807 | 0.586587 | 0.576085 | 377 | 35.623341 | 23.638889 | 127 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.70557 | false | false |
5
|
373292b6d1756943dddd77645257995a8b90df4f
| 20,521,353,754,331 |
e1de50fdebcbedd7128574e1168b6c8b90c7073d
|
/main/java/com/serli/myhealthpartner/model/ProfileData.java
|
9b4a85ee8ebd62ad2d87b7cd27068db2fc45e820
|
[] |
no_license
|
salquier/my-health-partner-android
|
https://github.com/salquier/my-health-partner-android
|
44560376784d1c9586806dc1e52a876f9e1eb434
|
9571fd62ace10a64704ed0ec612d6463b5fd2d51
|
refs/heads/master
| 2020-06-29T03:32:55.550000 | 2016-11-22T16:37:50 | 2016-11-22T16:37:50 | 74,453,447 | 0 | 0 | null | true | 2016-11-22T08:57:55 | 2016-11-22T08:57:55 | 2016-11-21T13:58:32 | 2016-11-21T15:13:35 | 36 | 0 | 0 | 0 | null | null | null |
package com.serli.myhealthpartner.model;
import java.util.Date;
public class ProfileData {
private int weight;
private int size;
private int sex;
private Date birthday;
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
public int getSex() {
return sex;
}
public void setSex(int sex) {
this.sex = sex;
}
public int getWeight() {
return weight;
}
public void setWeight(int weight) {
this.weight = weight;
}
}
|
UTF-8
|
Java
| 718 |
java
|
ProfileData.java
|
Java
|
[] | null |
[] |
package com.serli.myhealthpartner.model;
import java.util.Date;
public class ProfileData {
private int weight;
private int size;
private int sex;
private Date birthday;
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
public int getSex() {
return sex;
}
public void setSex(int sex) {
this.sex = sex;
}
public int getWeight() {
return weight;
}
public void setWeight(int weight) {
this.weight = weight;
}
}
| 718 | 0.58078 | 0.58078 | 43 | 15.697675 | 13.75286 | 44 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.325581 | false | false |
5
|
1ccec0a407e619816b97ee45e9873940f54d8a06
| 10,651,518,898,982 |
252047155496dfc37c1f6db717f1b0527d4466c3
|
/src/controller/Controller.java
|
8a3d2eebc146154868625209f444314ace4c998d
|
[] |
no_license
|
rocmeister/Ball-World
|
https://github.com/rocmeister/Ball-World
|
6f6918e31ea2ad029c73b72af297dac7df37cf98
|
14c994a6e65eaab87df6a77d1a2cc500b673fb34
|
refs/heads/master
| 2020-05-02T11:57:00.764000 | 2019-03-27T08:01:22 | 2019-03-27T08:01:22 | 177,946,101 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package controller;
import java.awt.Component;
import java.awt.EventQueue;
import java.awt.Graphics;
import model.BallModel;
import model.IBallCmd;
import model.IM2VAdapter;
import model.IPaintStrategyFac;
import model.IUpdateStrategyFac;
import view.IV2MControlAdapter;
import view.IV2MUpdateAdapter;
import view.View;
/**
* This class contains the main method. Its job is to instantiate the model and view and to start them.
* @author Peter Dulworth (psd2), Sophia Jefferson (sgj1)
*/
public class Controller {
/**
* The view.
*/
private View<IUpdateStrategyFac<IBallCmd>, IPaintStrategyFac> view;
/**
* The model.
*/
private BallModel model;
/**
* Constructor that builds the system by instantiating the model and the view.
*/
public Controller() {
// instantiate model
model = new BallModel(new IM2VAdapter() {
@Override
public void update() {
view.update();
}
@Override
public Integer getPnlHeight() {
return view.getPanelHeight();
};
@Override
public Integer getPnlWidth() {
return view.getPanelWidth();
};
@Override
public Component getComponent() {
return view.getComponent();
}
});
// instantiate view
view = new View<IUpdateStrategyFac<IBallCmd>, IPaintStrategyFac>(new IV2MControlAdapter<IUpdateStrategyFac<IBallCmd>, IPaintStrategyFac>() {
@Override
public void clearBalls() {
model.clearBalls();
};
@Override
/**
* Returns an IUpdateStrategyFac that can instantiate the strategy specified
* by className. Returns null if className is null. The toString() of
* the returned factory is the className.
* @param classname Shortened name of desired strategy
* @return A factory to make that strategy
*/
public IUpdateStrategyFac<IBallCmd> addStrategy(String className) {
return model.makeUpdateStrategyFac(className);
}
@Override
/**
* Add a ball to the system with a strategy as given by the given IUpdateStrategyFac
* @param selectedItem The fully qualified name of the desired strategy.
*/
public void makeBall(IUpdateStrategyFac<IBallCmd> updateStratFac, IPaintStrategyFac paintStratFac) {
if (null != updateStratFac && null != paintStratFac) {
model.makeBall(updateStratFac.make(), paintStratFac.make()); // Here, loadBall takes a strategy object, but your method may take the strategy factory instead.
}
}
@Override
/**
* Returns an IUpdateStrategyFac that can instantiate a MultiStrategy with the
* two strategies made by the two given IUpdateStrategyFac objects. Returns
* null if either supplied factory is null. The toString() of the
* returned factory is the toString()'s of the two given factories,
* concatenated with "-". *
* @param selectedItem1 An IUpdateStrategyFac for a strategy
* @param selectedItem2 An IUpdateStrategyFac for a strategy
* @return An IUpdateStrategyFac for the composition of the two strategies
*/
public IUpdateStrategyFac<IBallCmd> combineStrategies(IUpdateStrategyFac<IBallCmd> selectedItem1, IUpdateStrategyFac<IBallCmd> selectedItem2) {
return model.combineStrategyFacs(selectedItem1, selectedItem2);
}
@Override
public void makeSwitcherBall(IPaintStrategyFac paintStratFac) {
model.makeBall(model.getSwitcherStrategy(), paintStratFac.make()); // Here, loadBall takes a strategy object, but your method may take the strategy factory instead.
}
@Override
public void switchStrategy(IUpdateStrategyFac<IBallCmd> selectedItem) {
model.switchSwitcherStrategy(selectedItem.make());
}
@Override
public IPaintStrategyFac addPaintStrategy(String className) {
return model.makePaintStrategyFac(className);
}
}, new IV2MUpdateAdapter() {
@Override
public void paint(Graphics g) {
model.update(g);
}
});
}
/**
* Start the system.
*/
public void start() {
view.start();
model.start();
}
/**
* This is the main entry point for the system. Executing this will instantiate
* the controller then start the controller.
*
* @param args No arguments are used at this time.
*/
public static void main(String[] args) {
EventQueue.invokeLater(() -> {
try {
(new Controller()).start();
} catch (Exception e) {
e.printStackTrace();
}
});
}
}
|
UTF-8
|
Java
| 4,337 |
java
|
Controller.java
|
Java
|
[
{
"context": "e the model and view and to start them.\n * @author Peter Dulworth (psd2), Sophia Jefferson (sgj1)\n */\npublic class ",
"end": 456,
"score": 0.9998883008956909,
"start": 442,
"tag": "NAME",
"value": "Peter Dulworth"
},
{
"context": "iew and to start them.\n * @author Peter Dulworth (psd2), Sophia Jefferson (sgj1)\n */\npublic class Contro",
"end": 462,
"score": 0.9991430640220642,
"start": 458,
"tag": "USERNAME",
"value": "psd2"
},
{
"context": "d to start them.\n * @author Peter Dulworth (psd2), Sophia Jefferson (sgj1)\n */\npublic class Controller {\n\n\t/**\n\t * Th",
"end": 481,
"score": 0.9998921751976013,
"start": 465,
"tag": "NAME",
"value": "Sophia Jefferson"
},
{
"context": " @author Peter Dulworth (psd2), Sophia Jefferson (sgj1)\n */\npublic class Controller {\n\n\t/**\n\t * The view",
"end": 487,
"score": 0.9987127184867859,
"start": 483,
"tag": "USERNAME",
"value": "sgj1"
}
] | null |
[] |
package controller;
import java.awt.Component;
import java.awt.EventQueue;
import java.awt.Graphics;
import model.BallModel;
import model.IBallCmd;
import model.IM2VAdapter;
import model.IPaintStrategyFac;
import model.IUpdateStrategyFac;
import view.IV2MControlAdapter;
import view.IV2MUpdateAdapter;
import view.View;
/**
* This class contains the main method. Its job is to instantiate the model and view and to start them.
* @author <NAME> (psd2), <NAME> (sgj1)
*/
public class Controller {
/**
* The view.
*/
private View<IUpdateStrategyFac<IBallCmd>, IPaintStrategyFac> view;
/**
* The model.
*/
private BallModel model;
/**
* Constructor that builds the system by instantiating the model and the view.
*/
public Controller() {
// instantiate model
model = new BallModel(new IM2VAdapter() {
@Override
public void update() {
view.update();
}
@Override
public Integer getPnlHeight() {
return view.getPanelHeight();
};
@Override
public Integer getPnlWidth() {
return view.getPanelWidth();
};
@Override
public Component getComponent() {
return view.getComponent();
}
});
// instantiate view
view = new View<IUpdateStrategyFac<IBallCmd>, IPaintStrategyFac>(new IV2MControlAdapter<IUpdateStrategyFac<IBallCmd>, IPaintStrategyFac>() {
@Override
public void clearBalls() {
model.clearBalls();
};
@Override
/**
* Returns an IUpdateStrategyFac that can instantiate the strategy specified
* by className. Returns null if className is null. The toString() of
* the returned factory is the className.
* @param classname Shortened name of desired strategy
* @return A factory to make that strategy
*/
public IUpdateStrategyFac<IBallCmd> addStrategy(String className) {
return model.makeUpdateStrategyFac(className);
}
@Override
/**
* Add a ball to the system with a strategy as given by the given IUpdateStrategyFac
* @param selectedItem The fully qualified name of the desired strategy.
*/
public void makeBall(IUpdateStrategyFac<IBallCmd> updateStratFac, IPaintStrategyFac paintStratFac) {
if (null != updateStratFac && null != paintStratFac) {
model.makeBall(updateStratFac.make(), paintStratFac.make()); // Here, loadBall takes a strategy object, but your method may take the strategy factory instead.
}
}
@Override
/**
* Returns an IUpdateStrategyFac that can instantiate a MultiStrategy with the
* two strategies made by the two given IUpdateStrategyFac objects. Returns
* null if either supplied factory is null. The toString() of the
* returned factory is the toString()'s of the two given factories,
* concatenated with "-". *
* @param selectedItem1 An IUpdateStrategyFac for a strategy
* @param selectedItem2 An IUpdateStrategyFac for a strategy
* @return An IUpdateStrategyFac for the composition of the two strategies
*/
public IUpdateStrategyFac<IBallCmd> combineStrategies(IUpdateStrategyFac<IBallCmd> selectedItem1, IUpdateStrategyFac<IBallCmd> selectedItem2) {
return model.combineStrategyFacs(selectedItem1, selectedItem2);
}
@Override
public void makeSwitcherBall(IPaintStrategyFac paintStratFac) {
model.makeBall(model.getSwitcherStrategy(), paintStratFac.make()); // Here, loadBall takes a strategy object, but your method may take the strategy factory instead.
}
@Override
public void switchStrategy(IUpdateStrategyFac<IBallCmd> selectedItem) {
model.switchSwitcherStrategy(selectedItem.make());
}
@Override
public IPaintStrategyFac addPaintStrategy(String className) {
return model.makePaintStrategyFac(className);
}
}, new IV2MUpdateAdapter() {
@Override
public void paint(Graphics g) {
model.update(g);
}
});
}
/**
* Start the system.
*/
public void start() {
view.start();
model.start();
}
/**
* This is the main entry point for the system. Executing this will instantiate
* the controller then start the controller.
*
* @param args No arguments are used at this time.
*/
public static void main(String[] args) {
EventQueue.invokeLater(() -> {
try {
(new Controller()).start();
} catch (Exception e) {
e.printStackTrace();
}
});
}
}
| 4,319 | 0.71086 | 0.707632 | 155 | 26.980644 | 32.897392 | 168 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.225806 | false | false |
5
|
baa416da92c694466c6a0157295ecb4e1bc752cd
| 31,095,563,274,036 |
a19f95777f03452b2d2acc41b3553118038be804
|
/collectors/scm/github/src/main/java/com/capitalone/dashboard/collector/GitHubSettings.java
|
9b176c055819b93ef3066f8aad83ae409c88b764
|
[
"Apache-2.0"
] |
permissive
|
walmartlabs/Hygieia
|
https://github.com/walmartlabs/Hygieia
|
891a10630255f87fca091d4f8d3ff5fa62daddde
|
64f47cc48c2c44ebb18e6fb45df0a07b4559a856
|
refs/heads/master
| 2023-07-24T10:20:39.072000 | 2023-07-18T21:40:33 | 2023-07-18T21:40:33 | 119,907,025 | 4 | 6 |
Apache-2.0
| true | 2020-04-23T21:52:21 | 2018-02-01T23:39:22 | 2019-07-02T22:21:54 | 2020-04-23T21:52:20 | 73,423 | 2 | 5 | 6 |
JavaScript
| false | false |
package com.capitalone.dashboard.collector;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* Bean to hold settings specific to the GitHub collector.
*/
@Component
@ConfigurationProperties(prefix = "github")
public class GitHubSettings {
private String proxy;
private String proxyPort;
private String proxyUser;
private String proxyPassword;
private String cron;
private String host;
private String key;
@Value("${github.firstRunHistoryDays:14}")
private int firstRunHistoryDays;
private List<String> notBuiltCommits;
@Value("${github.errorThreshold:2}")
private int errorThreshold;
@Value("${github.rateLimitThreshold:10}")
private int rateLimitThreshold;
private String personalAccessToken;
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public String getCron() {
return cron;
}
public void setCron(String cron) {
this.cron = cron;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public int getFirstRunHistoryDays() {
return firstRunHistoryDays;
}
public void setFirstRunHistoryDays(int firstRunHistoryDays) {
this.firstRunHistoryDays = firstRunHistoryDays;
}
public List<String> getNotBuiltCommits() {
return notBuiltCommits;
}
public void setNotBuiltCommits(List<String> notBuiltCommits) {
this.notBuiltCommits = notBuiltCommits;
}
public int getErrorThreshold() {
return errorThreshold;
}
public void setErrorThreshold(int errorThreshold) {
this.errorThreshold = errorThreshold;
}
public int getRateLimitThreshold() {
return rateLimitThreshold;
}
public void setRateLimitThreshold(int rateLimitThreshold) {
this.rateLimitThreshold = rateLimitThreshold;
}
public String getPersonalAccessToken() {
return personalAccessToken;
}
public void setPersonalAccessToken(String personalAccessToken) {
this.personalAccessToken = personalAccessToken;
}
public String getProxyUser(){ //getters and setters
return proxyUser;
}
public void setProxyUser(String proxyUser){
this.proxyUser=proxyUser;
}
public String getProxyPassword(){
return proxyPassword;
}
public void setProxyPassword(String proxyPassword){
this.proxyPassword=proxyPassword;
}
public String getProxyPort() {
return proxyPort;
}
public void setProxyPort(String proxyPort){
this.proxyPort=proxyPort;
}
public String getProxy() {
return proxy;
}
public void setProxy(String proxy) {
this.proxy = proxy;
}
}
|
UTF-8
|
Java
| 2,978 |
java
|
GitHubSettings.java
|
Java
|
[
{
"context": "roxyPassword){\n this.proxyPassword=proxyPassword;\n }\n\n public String getProxyPort() { ",
"end": 2607,
"score": 0.6650271415710449,
"start": 2594,
"tag": "PASSWORD",
"value": "proxyPassword"
}
] | null |
[] |
package com.capitalone.dashboard.collector;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* Bean to hold settings specific to the GitHub collector.
*/
@Component
@ConfigurationProperties(prefix = "github")
public class GitHubSettings {
private String proxy;
private String proxyPort;
private String proxyUser;
private String proxyPassword;
private String cron;
private String host;
private String key;
@Value("${github.firstRunHistoryDays:14}")
private int firstRunHistoryDays;
private List<String> notBuiltCommits;
@Value("${github.errorThreshold:2}")
private int errorThreshold;
@Value("${github.rateLimitThreshold:10}")
private int rateLimitThreshold;
private String personalAccessToken;
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public String getCron() {
return cron;
}
public void setCron(String cron) {
this.cron = cron;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public int getFirstRunHistoryDays() {
return firstRunHistoryDays;
}
public void setFirstRunHistoryDays(int firstRunHistoryDays) {
this.firstRunHistoryDays = firstRunHistoryDays;
}
public List<String> getNotBuiltCommits() {
return notBuiltCommits;
}
public void setNotBuiltCommits(List<String> notBuiltCommits) {
this.notBuiltCommits = notBuiltCommits;
}
public int getErrorThreshold() {
return errorThreshold;
}
public void setErrorThreshold(int errorThreshold) {
this.errorThreshold = errorThreshold;
}
public int getRateLimitThreshold() {
return rateLimitThreshold;
}
public void setRateLimitThreshold(int rateLimitThreshold) {
this.rateLimitThreshold = rateLimitThreshold;
}
public String getPersonalAccessToken() {
return personalAccessToken;
}
public void setPersonalAccessToken(String personalAccessToken) {
this.personalAccessToken = personalAccessToken;
}
public String getProxyUser(){ //getters and setters
return proxyUser;
}
public void setProxyUser(String proxyUser){
this.proxyUser=proxyUser;
}
public String getProxyPassword(){
return proxyPassword;
}
public void setProxyPassword(String proxyPassword){
this.proxyPassword=<PASSWORD>;
}
public String getProxyPort() {
return proxyPort;
}
public void setProxyPort(String proxyPort){
this.proxyPort=proxyPort;
}
public String getProxy() {
return proxy;
}
public void setProxy(String proxy) {
this.proxy = proxy;
}
}
| 2,975 | 0.682337 | 0.680658 | 128 | 22.265625 | 20.161646 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.75 | false | false |
5
|
4aa5aa96ac9996bd32bd7743fc156d4b4fffde86
| 33,174,327,466,064 |
a1bf073088c838e03ad0688be0b00ad45026d082
|
/microservice-fallback-with-feign/src/main/java/com/leepon/cloud/feign/OuterUserServiceFallback.java
|
01f5f7633066a9cead29a55a505d7c11f969e3b5
|
[] |
no_license
|
leeponlp/microservice-spring-cloud
|
https://github.com/leeponlp/microservice-spring-cloud
|
a6956cef77c23391cf6700f2ecd75e1986050275
|
ad9484c21a72b6f8e6db18833ea40817631b2d36
|
refs/heads/master
| 2022-06-30T21:18:35.633000 | 2020-04-22T08:47:59 | 2020-04-22T08:47:59 | 122,931,834 | 0 | 0 | null | false | 2022-06-21T01:02:15 | 2018-02-26T07:39:49 | 2021-08-31T07:11:40 | 2022-06-21T01:02:15 | 128 | 0 | 0 | 10 |
Java
| false | false |
package com.leepon.cloud.feign;
import com.leepon.cloud.entity.User;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.ArrayList;
import java.util.List;
/**
* @author leepon
*/
@Component
@RequestMapping("/fallback/demo")
public class OuterUserServiceFallback implements IOuterUserService {
@Override
public User findById(Integer id) {
User user = new User();
user.setId(0);
return user;
}
@Override
public List<User> findUserAll() {
List<User> users = new ArrayList<>();
User user = new User();
user.setId(0);
users.add(user);
return users;
}
}
|
UTF-8
|
Java
| 720 |
java
|
OuterUserServiceFallback.java
|
Java
|
[
{
"context": ".ArrayList;\nimport java.util.List;\n\n/**\n * @author leepon\n */\n@Component\n@RequestMapping(\"/fallback/demo\")\n",
"end": 256,
"score": 0.9996621608734131,
"start": 250,
"tag": "USERNAME",
"value": "leepon"
}
] | null |
[] |
package com.leepon.cloud.feign;
import com.leepon.cloud.entity.User;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.ArrayList;
import java.util.List;
/**
* @author leepon
*/
@Component
@RequestMapping("/fallback/demo")
public class OuterUserServiceFallback implements IOuterUserService {
@Override
public User findById(Integer id) {
User user = new User();
user.setId(0);
return user;
}
@Override
public List<User> findUserAll() {
List<User> users = new ArrayList<>();
User user = new User();
user.setId(0);
users.add(user);
return users;
}
}
| 720 | 0.666667 | 0.663889 | 33 | 20.848484 | 18.197771 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.424242 | false | false |
1
|
b0b8c71ce6fa87051bbe93dea32487358b6ddfb7
| 2,035,814,561,323 |
ef7eabdd5f9573050ef11d8c68055ab6cdb5da44
|
/euler/src/com/ferhatelmas/euler/page8/Question386.java
|
d41dc0015ae52ab61efede34fa17da00de2361b5
|
[
"WTFPL"
] |
permissive
|
gauravsingh58/algo
|
https://github.com/gauravsingh58/algo
|
cdbf68e28019ba7c3e4832e373d32c71902c9c0d
|
397859a53429e7a585e5f6964ad24146c6261326
|
refs/heads/master
| 2022-12-28T01:08:32.333000 | 2020-09-30T19:37:53 | 2020-09-30T19:37:53 | 300,037,652 | 1 | 1 |
WTFPL
| true | 2020-10-15T09:26:32 | 2020-09-30T19:29:29 | 2020-09-30T19:53:08 | 2020-09-30T19:37:54 | 1,714 | 1 | 1 | 1 |
Java
| false | false |
package com.ferhatelmas.euler.page8;
public class Question386 {
public static void main(String[] args) {
int primeFactorSieve[] = new int[100000001];
int multiplesSieve[] = new int[primeFactorSieve.length];
int sum = 1; // for 1
for(int i=2; i<primeFactorSieve.length; i++) {
if(primeFactorSieve[i] == 0) {
sum++; // handle primes
for(int j=i; j<primeFactorSieve.length; j+=i) {
primeFactorSieve[j] = i;
}
}
}
for(int i=2; i<primeFactorSieve.length; i++) {
int n = i, count = 0;
while(n > 1) {
n /= primeFactorSieve[n];
count++;
}
multiplesSieve[i] = count;
}
for(int i=2; i<multiplesSieve.length/2; i++) {
for(int j=2*i; j<multiplesSieve.length; j+=i) {
if(multiplesSieve[i] == multiplesSieve[j]/2) sum++;
}
}
System.out.println(sum);
}
}
|
UTF-8
|
Java
| 898 |
java
|
Question386.java
|
Java
|
[] | null |
[] |
package com.ferhatelmas.euler.page8;
public class Question386 {
public static void main(String[] args) {
int primeFactorSieve[] = new int[100000001];
int multiplesSieve[] = new int[primeFactorSieve.length];
int sum = 1; // for 1
for(int i=2; i<primeFactorSieve.length; i++) {
if(primeFactorSieve[i] == 0) {
sum++; // handle primes
for(int j=i; j<primeFactorSieve.length; j+=i) {
primeFactorSieve[j] = i;
}
}
}
for(int i=2; i<primeFactorSieve.length; i++) {
int n = i, count = 0;
while(n > 1) {
n /= primeFactorSieve[n];
count++;
}
multiplesSieve[i] = count;
}
for(int i=2; i<multiplesSieve.length/2; i++) {
for(int j=2*i; j<multiplesSieve.length; j+=i) {
if(multiplesSieve[i] == multiplesSieve[j]/2) sum++;
}
}
System.out.println(sum);
}
}
| 898 | 0.55902 | 0.532294 | 37 | 23.270269 | 20.211916 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.621622 | false | false |
1
|
bbbef993982e7aaab78ecc4445cee3a76e86e41c
| 8,177,617,793,482 |
885548223330a97d7b9eaf256988ad1528f43c88
|
/src/main/java/br/on/daed/mailer/services/controllers/MailerController.java
|
0f99372e11ecea29d86bd88f5102d600a32290df
|
[] |
no_license
|
csiqueirasilva/mailer-on
|
https://github.com/csiqueirasilva/mailer-on
|
178ee24c9f199604831c092df79e9b8dc4accb11
|
1da7876a4b050a78903436c97f3414c6e45c8858
|
refs/heads/master
| 2021-01-15T15:37:04.052000 | 2016-10-16T17:51:14 | 2016-10-16T17:51:14 | 52,165,066 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package br.on.daed.mailer.services.controllers;
import br.on.daed.mailer.services.mails.Mail;
import br.on.daed.mailer.services.mails.MailDLO;
import br.on.daed.mailer.services.contas.Conta;
import br.on.daed.mailer.services.contas.ContaDLO;
import br.on.daed.mailer.services.contas.tags.ContaTag;
import br.on.daed.mailer.services.contas.tags.ContaTagDLO;
import br.on.daed.mailer.services.jobs.EmailClick;
import br.on.daed.mailer.services.jobs.EmailLink;
import br.on.daed.mailer.services.jobs.Job;
import br.on.daed.mailer.services.jobs.JobDLO;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
/**
*
* @author csiqueira
*/
@RequestMapping("/")
@Controller
public class MailerController {
@Autowired
private ContaTagDLO contaTagDLO;
@Autowired
private MailDLO mailer;
@Autowired
private ContaDLO contaDLO;
@Autowired
private JobDLO jobDLO;
@Autowired
private HttpServletRequest request;
final private String DEFAULT_REMETENTE = "nao-responder@on.br";
final private String DEFAULT_SENHA = "";
final public static String REQUEST_MAPPING_URL = "url";
final public static String REQUEST_UNSUB_URL = "unsub";
final public static int PAGE_SIZE = 15;
private void setPagination(ModelMap map, String title, String url, Page page) {
int current = page.getNumber() + 1;
int begin = Math.max(1, current - 5);
int end = Math.min(begin + 10, page.getTotalPages());
map.addAttribute("paginationTitle", title);
map.addAttribute("paginationUrl", url);
map.addAttribute("page", page);
map.addAttribute("beginIndex", begin);
map.addAttribute("endIndex", end);
map.addAttribute("currentIndex", current);
map.addAttribute("queryString", request.getQueryString());
map.addAttribute("paginationSize", PAGE_SIZE);
map.addAttribute("pagina", "pagination");
}
@RequestMapping(value = "/click-list")
public String getClickList(ModelMap map) {
return getClickList(1, null, null, map);
}
@RequestMapping(value = "/click-list/{pageNumber}", method = RequestMethod.GET)
public String getClickList(@PathVariable Integer pageNumber, @RequestParam(required = false) String email, @RequestParam(required = false) String url, ModelMap map) {
Page<EmailClick> page = jobDLO.getClickLog(pageNumber, email, url);
setPagination(map, "Clicks efetuados", "click-list", page);
return "index";
}
@RequestMapping(value = "/link-list")
public String getLinkList(ModelMap map) {
return getLinkList(1, null, null, map);
}
@RequestMapping(value = "/link-list/{pageNumber}", method = RequestMethod.GET)
public String getLinkList(@PathVariable Integer pageNumber, @RequestParam(required = false) String url, @RequestParam(required = false) String assunto, ModelMap map) {
Page<EmailLink> page = jobDLO.getLinkLog(pageNumber, assunto, url);
setPagination(map, "Links gerados", "link-list", page);
return "index";
}
@RequestMapping(value = "/conta-list")
public String getContaList(ModelMap map) {
return getContaList(1, null, null, map);
}
@RequestMapping(value = "/conta-list/{pageNumber}", method = RequestMethod.GET)
public String getContaList(@PathVariable Integer pageNumber, @RequestParam(required = false) String email, @RequestParam(required = false) String tag, ModelMap map) {
Page<Conta> page;
if (tag != null) {
page = contaDLO.getContaLogByTag(pageNumber, tag);
} else {
page = contaDLO.getContaLog(pageNumber, email);
}
setPagination(map, "Emails cadastrados", "conta-list", page);
return "index";
}
@RequestMapping(value = "/job-list")
public String getJobList(ModelMap map) {
return getJobList(1, null, map);
}
@RequestMapping(value = "/job-list/{pageNumber}", method = RequestMethod.GET)
public String getJobList(@PathVariable Integer pageNumber, @RequestParam(required = false) String assunto, ModelMap map) {
Page<Job> page = jobDLO.getJobLog(pageNumber, assunto);
setPagination(map, "Jobs", "job-list", page);
return "index";
}
@RequestMapping(value = "/" + REQUEST_UNSUB_URL, method = RequestMethod.GET)
public String unsub(@RequestParam("d") String data) throws IOException {
contaDLO.setDisabled(data);
return "unsub";
}
@RequestMapping(value = "/" + REQUEST_MAPPING_URL, method = RequestMethod.GET)
public String url(@RequestParam("d") String data) throws IOException {
String url = jobDLO.persistUserClick(data);
return "redirect:" + url;
}
@RequestMapping("/estatisticas")
public String getEstatisticas(ModelMap map) {
contaDLO.indexStats(map);
jobDLO.indexStats(map);
map.addAttribute("pagina", "estatisticas");
return "index";
}
@RequestMapping("/carregar-base-dados")
public String getCarregarBaseDados(ModelMap map) {
map.addAttribute("pagina", "carregar-base-dados");
Iterable<ContaTag> tags = contaTagDLO.findAll();
map.addAttribute("tags", tags);
return "index";
}
@RequestMapping("/email-teste")
public String getEmailTeste(ModelMap map) {
map.addAttribute("pagina", "email-teste");
return "index";
}
@RequestMapping("/email-em-massa")
public String getEmailMassa(ModelMap map) {
map.addAttribute("pagina", "email-em-massa");
Iterable<ContaTag> tags = contaTagDLO.findAll();
map.addAttribute("tags", tags);
return "index";
}
@RequestMapping("/")
public String index(ModelMap map) throws IOException {
return "redirect:estatisticas";
}
@RequestMapping(value = "/received-mail-list", method = RequestMethod.POST)
public @ResponseBody
Boolean receiveMailList(@RequestParam("uuid") String uuid) throws UnsupportedOperationException, IOException {
//MailSender.enablePerform(uuid);
return true;
}
private String fromFileToString(MultipartFile arquivo) throws UnsupportedEncodingException, IOException {
File arquivoCorpo = new File(System.getProperty("java.io.tmpdir") + File.separator + "corpo" + System.currentTimeMillis());
arquivo.transferTo(arquivoCorpo);
byte[] encoded = Files.readAllBytes(Paths.get(arquivoCorpo.getAbsolutePath()));
String HTML = new String(encoded, "UTF-8");
return HTML;
}
@RequestMapping(value = "/send-debug-mail-list", method = RequestMethod.POST)
public @ResponseBody
String sendTestMail(
@RequestParam("destino") String destino,
@RequestParam("arquivo") MultipartFile arquivo,
@RequestParam("assunto") String assunto) throws IOException {
String ret = "null";
try {
String HTML = fromFileToString(arquivo);
Mail m = mailer.criarMail(destino, DEFAULT_REMETENTE, DEFAULT_SENHA, HTML, assunto);
if (m != null) {
jobDLO.createJob(m);
ret = "true";
}
} catch (Exception e) {
ret = "false";
e.printStackTrace();
}
return iframeReturn(ret, "alertaEmailTeste");
}
@RequestMapping(value = "/send-mail-list", method = RequestMethod.POST)
public @ResponseBody
String sendMailList(
@RequestParam("arquivo") MultipartFile arquivo,
@RequestParam("assunto") String assunto,
@RequestParam("tags") String tags) throws IOException {
String ret = "null";
try {
String HTML = fromFileToString(arquivo);
Mail m = mailer.criarMailWithTags(DEFAULT_REMETENTE, DEFAULT_SENHA, HTML, assunto, tags);
if (m != null) {
jobDLO.createJob(m);
ret = "true";
}
} catch (Exception e) {
e.printStackTrace();
ret = "false";
}
return iframeReturn(ret, "alertaEmailMassa");
}
@RequestMapping(value = "/load-mail-list", method = RequestMethod.POST)
public @ResponseBody
String loadMailList(@RequestParam("arquivo") final MultipartFile arquivo, @RequestParam("tags") String tags) throws IOException {
String ret = "null";
try {
File arquivoCorpo = new File(System.getProperty("java.io.tmpdir") + File.separator + "corpo" + System.currentTimeMillis());
arquivoCorpo.deleteOnExit();
arquivo.transferTo(arquivoCorpo);
List<String> listaEmail = Files.readAllLines(Paths.get(arquivoCorpo.getAbsolutePath()));
ret = contaDLO.inserirEmails(listaEmail, tags).toString();
} catch (Exception e) {
e.printStackTrace();
}
return iframeReturn(ret, "alertaCarregarBaseDeDados");
}
private String iframeReturn(String val, String funcao) {
return "<div id='retorno'>" + val + "</div><script>window.parent.window." + funcao + "(document.getElementById('retorno').innerHTML);</script>";
}
}
|
UTF-8
|
Java
| 10,286 |
java
|
MailerController.java
|
Java
|
[
{
"context": "eb.multipart.MultipartFile;\r\n\r\n/**\r\n *\r\n * @author csiqueira\r\n */\r\n@RequestMapping(\"/\")\r\n@Controller\r\npublic c",
"end": 1458,
"score": 0.9991714358329773,
"start": 1449,
"tag": "USERNAME",
"value": "csiqueira"
},
{
"context": "\r\n\r\n final private String DEFAULT_REMETENTE = \"nao-responder@on.br\";\r\n final private String DEFAULT_SENHA = \"\";\r\n",
"end": 1858,
"score": 0.99992835521698,
"start": 1839,
"tag": "EMAIL",
"value": "nao-responder@on.br"
}
] | null |
[] |
package br.on.daed.mailer.services.controllers;
import br.on.daed.mailer.services.mails.Mail;
import br.on.daed.mailer.services.mails.MailDLO;
import br.on.daed.mailer.services.contas.Conta;
import br.on.daed.mailer.services.contas.ContaDLO;
import br.on.daed.mailer.services.contas.tags.ContaTag;
import br.on.daed.mailer.services.contas.tags.ContaTagDLO;
import br.on.daed.mailer.services.jobs.EmailClick;
import br.on.daed.mailer.services.jobs.EmailLink;
import br.on.daed.mailer.services.jobs.Job;
import br.on.daed.mailer.services.jobs.JobDLO;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
/**
*
* @author csiqueira
*/
@RequestMapping("/")
@Controller
public class MailerController {
@Autowired
private ContaTagDLO contaTagDLO;
@Autowired
private MailDLO mailer;
@Autowired
private ContaDLO contaDLO;
@Autowired
private JobDLO jobDLO;
@Autowired
private HttpServletRequest request;
final private String DEFAULT_REMETENTE = "<EMAIL>";
final private String DEFAULT_SENHA = "";
final public static String REQUEST_MAPPING_URL = "url";
final public static String REQUEST_UNSUB_URL = "unsub";
final public static int PAGE_SIZE = 15;
private void setPagination(ModelMap map, String title, String url, Page page) {
int current = page.getNumber() + 1;
int begin = Math.max(1, current - 5);
int end = Math.min(begin + 10, page.getTotalPages());
map.addAttribute("paginationTitle", title);
map.addAttribute("paginationUrl", url);
map.addAttribute("page", page);
map.addAttribute("beginIndex", begin);
map.addAttribute("endIndex", end);
map.addAttribute("currentIndex", current);
map.addAttribute("queryString", request.getQueryString());
map.addAttribute("paginationSize", PAGE_SIZE);
map.addAttribute("pagina", "pagination");
}
@RequestMapping(value = "/click-list")
public String getClickList(ModelMap map) {
return getClickList(1, null, null, map);
}
@RequestMapping(value = "/click-list/{pageNumber}", method = RequestMethod.GET)
public String getClickList(@PathVariable Integer pageNumber, @RequestParam(required = false) String email, @RequestParam(required = false) String url, ModelMap map) {
Page<EmailClick> page = jobDLO.getClickLog(pageNumber, email, url);
setPagination(map, "Clicks efetuados", "click-list", page);
return "index";
}
@RequestMapping(value = "/link-list")
public String getLinkList(ModelMap map) {
return getLinkList(1, null, null, map);
}
@RequestMapping(value = "/link-list/{pageNumber}", method = RequestMethod.GET)
public String getLinkList(@PathVariable Integer pageNumber, @RequestParam(required = false) String url, @RequestParam(required = false) String assunto, ModelMap map) {
Page<EmailLink> page = jobDLO.getLinkLog(pageNumber, assunto, url);
setPagination(map, "Links gerados", "link-list", page);
return "index";
}
@RequestMapping(value = "/conta-list")
public String getContaList(ModelMap map) {
return getContaList(1, null, null, map);
}
@RequestMapping(value = "/conta-list/{pageNumber}", method = RequestMethod.GET)
public String getContaList(@PathVariable Integer pageNumber, @RequestParam(required = false) String email, @RequestParam(required = false) String tag, ModelMap map) {
Page<Conta> page;
if (tag != null) {
page = contaDLO.getContaLogByTag(pageNumber, tag);
} else {
page = contaDLO.getContaLog(pageNumber, email);
}
setPagination(map, "Emails cadastrados", "conta-list", page);
return "index";
}
@RequestMapping(value = "/job-list")
public String getJobList(ModelMap map) {
return getJobList(1, null, map);
}
@RequestMapping(value = "/job-list/{pageNumber}", method = RequestMethod.GET)
public String getJobList(@PathVariable Integer pageNumber, @RequestParam(required = false) String assunto, ModelMap map) {
Page<Job> page = jobDLO.getJobLog(pageNumber, assunto);
setPagination(map, "Jobs", "job-list", page);
return "index";
}
@RequestMapping(value = "/" + REQUEST_UNSUB_URL, method = RequestMethod.GET)
public String unsub(@RequestParam("d") String data) throws IOException {
contaDLO.setDisabled(data);
return "unsub";
}
@RequestMapping(value = "/" + REQUEST_MAPPING_URL, method = RequestMethod.GET)
public String url(@RequestParam("d") String data) throws IOException {
String url = jobDLO.persistUserClick(data);
return "redirect:" + url;
}
@RequestMapping("/estatisticas")
public String getEstatisticas(ModelMap map) {
contaDLO.indexStats(map);
jobDLO.indexStats(map);
map.addAttribute("pagina", "estatisticas");
return "index";
}
@RequestMapping("/carregar-base-dados")
public String getCarregarBaseDados(ModelMap map) {
map.addAttribute("pagina", "carregar-base-dados");
Iterable<ContaTag> tags = contaTagDLO.findAll();
map.addAttribute("tags", tags);
return "index";
}
@RequestMapping("/email-teste")
public String getEmailTeste(ModelMap map) {
map.addAttribute("pagina", "email-teste");
return "index";
}
@RequestMapping("/email-em-massa")
public String getEmailMassa(ModelMap map) {
map.addAttribute("pagina", "email-em-massa");
Iterable<ContaTag> tags = contaTagDLO.findAll();
map.addAttribute("tags", tags);
return "index";
}
@RequestMapping("/")
public String index(ModelMap map) throws IOException {
return "redirect:estatisticas";
}
@RequestMapping(value = "/received-mail-list", method = RequestMethod.POST)
public @ResponseBody
Boolean receiveMailList(@RequestParam("uuid") String uuid) throws UnsupportedOperationException, IOException {
//MailSender.enablePerform(uuid);
return true;
}
private String fromFileToString(MultipartFile arquivo) throws UnsupportedEncodingException, IOException {
File arquivoCorpo = new File(System.getProperty("java.io.tmpdir") + File.separator + "corpo" + System.currentTimeMillis());
arquivo.transferTo(arquivoCorpo);
byte[] encoded = Files.readAllBytes(Paths.get(arquivoCorpo.getAbsolutePath()));
String HTML = new String(encoded, "UTF-8");
return HTML;
}
@RequestMapping(value = "/send-debug-mail-list", method = RequestMethod.POST)
public @ResponseBody
String sendTestMail(
@RequestParam("destino") String destino,
@RequestParam("arquivo") MultipartFile arquivo,
@RequestParam("assunto") String assunto) throws IOException {
String ret = "null";
try {
String HTML = fromFileToString(arquivo);
Mail m = mailer.criarMail(destino, DEFAULT_REMETENTE, DEFAULT_SENHA, HTML, assunto);
if (m != null) {
jobDLO.createJob(m);
ret = "true";
}
} catch (Exception e) {
ret = "false";
e.printStackTrace();
}
return iframeReturn(ret, "alertaEmailTeste");
}
@RequestMapping(value = "/send-mail-list", method = RequestMethod.POST)
public @ResponseBody
String sendMailList(
@RequestParam("arquivo") MultipartFile arquivo,
@RequestParam("assunto") String assunto,
@RequestParam("tags") String tags) throws IOException {
String ret = "null";
try {
String HTML = fromFileToString(arquivo);
Mail m = mailer.criarMailWithTags(DEFAULT_REMETENTE, DEFAULT_SENHA, HTML, assunto, tags);
if (m != null) {
jobDLO.createJob(m);
ret = "true";
}
} catch (Exception e) {
e.printStackTrace();
ret = "false";
}
return iframeReturn(ret, "alertaEmailMassa");
}
@RequestMapping(value = "/load-mail-list", method = RequestMethod.POST)
public @ResponseBody
String loadMailList(@RequestParam("arquivo") final MultipartFile arquivo, @RequestParam("tags") String tags) throws IOException {
String ret = "null";
try {
File arquivoCorpo = new File(System.getProperty("java.io.tmpdir") + File.separator + "corpo" + System.currentTimeMillis());
arquivoCorpo.deleteOnExit();
arquivo.transferTo(arquivoCorpo);
List<String> listaEmail = Files.readAllLines(Paths.get(arquivoCorpo.getAbsolutePath()));
ret = contaDLO.inserirEmails(listaEmail, tags).toString();
} catch (Exception e) {
e.printStackTrace();
}
return iframeReturn(ret, "alertaCarregarBaseDeDados");
}
private String iframeReturn(String val, String funcao) {
return "<div id='retorno'>" + val + "</div><script>window.parent.window." + funcao + "(document.getElementById('retorno').innerHTML);</script>";
}
}
| 10,274 | 0.648357 | 0.64719 | 288 | 33.715279 | 32.770809 | 171 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.743056 | false | false |
1
|
cb0f96cf0979b082ead50b156b51c519131d8487
| 10,934,986,750,100 |
655063775bed5c0af811bdefad0fc59223eabe4a
|
/src/main/java/com/jpa/main/CreateDoctorMain.java
|
d5a454636e5ca8c92bf0114c70e71e7b6b6627b1
|
[] |
no_license
|
hadi-muz786/hibernatewithjpa
|
https://github.com/hadi-muz786/hibernatewithjpa
|
ae8498ed55925676fb8a9435c7ba1afe5d13462e
|
6be0b4a08a50ffff5d74c4affa118704fb1934b9
|
refs/heads/master
| 2020-12-05T03:01:32.942000 | 2020-01-05T23:45:28 | 2020-01-05T23:45:28 | 231,990,917 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.jpa.main;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.jpa.entities.DoctorEntity;
import com.jpa.repositories.DoctorRepository;
public class CreateDoctorMain {
public static void main(String[] args) {
ApplicationContext ctx = new ClassPathXmlApplicationContext("application-context.xml");
DoctorRepository dr = (DoctorRepository) ctx.getBean("doctorRepository");
DoctorEntity d1 = new DoctorEntity();
d1.setName("Dr. Hadi muz");
d1.setPhone("101010101010");
d1.setSpeciality("Orthopedics");
d1.setDepartment("Orthopedy");
dr.save(d1);
}
}
|
UTF-8
|
Java
| 674 |
java
|
CreateDoctorMain.java
|
Java
|
[
{
"context": "rEntity d1 = new DoctorEntity();\n\t\td1.setName(\"Dr. Hadi muz\");\n\t\td1.setPhone(\"101010101010\");\n\t\td1.setSpecial",
"end": 548,
"score": 0.9998708367347717,
"start": 540,
"tag": "NAME",
"value": "Hadi muz"
}
] | null |
[] |
package com.jpa.main;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.jpa.entities.DoctorEntity;
import com.jpa.repositories.DoctorRepository;
public class CreateDoctorMain {
public static void main(String[] args) {
ApplicationContext ctx = new ClassPathXmlApplicationContext("application-context.xml");
DoctorRepository dr = (DoctorRepository) ctx.getBean("doctorRepository");
DoctorEntity d1 = new DoctorEntity();
d1.setName("Dr. <NAME>");
d1.setPhone("101010101010");
d1.setSpeciality("Orthopedics");
d1.setDepartment("Orthopedy");
dr.save(d1);
}
}
| 672 | 0.778932 | 0.752226 | 26 | 24.923077 | 26.244301 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.192308 | false | false |
1
|
ac077fd8ff0c5b1c18588363328038df2bf74b07
| 26,654,567,039,583 |
eedfbc477f844ef0cab82aaa2ecdaec887754904
|
/java/src/test/java/com/techelevator/view/LogTest.java
|
800d66127570514178181e3bebe689d556652df2
|
[] |
no_license
|
MitchellPosney/VendingMachine
|
https://github.com/MitchellPosney/VendingMachine
|
96bba9de91df4596ad61fd44928c7e05905cd640
|
9f8b0d71df12a7e292a555e1969b9b6e2ee19b72
|
refs/heads/main
| 2023-08-23T00:29:36.219000 | 2021-10-12T19:24:31 | 2021-10-12T19:24:31 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.techelevator.view;
import com.techelevator.VendingMachine;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.io.*;
import java.math.BigDecimal;
public class LogTest {
VendingMachine vendingMachine;
File inventoryTemp = new File("log.txt");
public void fileLineCleanup() {
try {
RandomAccessFile f = new RandomAccessFile("log.txt", "rw");
long length = f.length() - 1;
do {
length -= 1;
f.seek(length);
} while (f.readByte() != 10);
f.setLength(length + 1);
f.close();
} catch (IOException e) {}
}
@Before
public void logStart() {
vendingMachine = new VendingMachine();
}
@Test
public void feedMoney() {
vendingMachine.getCustomerMoney("5");
try {
try {
BufferedReader input = new BufferedReader(new FileReader(inventoryTemp));
String last = null;
String line = null;
while ((line = input.readLine()) != null) {
last = line;
}
Assert.assertTrue(last.contains("(FEED MONEY) $0.00 $5"));
} catch (IOException e) {
}
} finally {
fileLineCleanup();
}
}
@Test
public void giveChange() {
vendingMachine.getCustomerMoney("5");
vendingMachine.cashOut();
try {
try {
BufferedReader input = new BufferedReader(new FileReader(inventoryTemp));
String last = null;
String line = null;
while ((line = input.readLine()) != null) {
last = line;
}
Assert.assertTrue(last.contains("(GIVE CHANGE) $5.00 $0"));
} catch (IOException e) {}
} finally {
fileLineCleanup();
fileLineCleanup();
}
}
@Test
public void itemSelect() {
vendingMachine.userBalance = new BigDecimal(500.00);
vendingMachine.itemSelectionProcess("a2");
try {
try {
BufferedReader input = new BufferedReader(new FileReader(inventoryTemp));
String last = null;
String line = null;
while ((line = input.readLine()) != null) {
last = line;
}
Assert.assertTrue(last.contains("(Kevin McCallister Brick)"));
} catch (IOException e) {}
} finally {
fileLineCleanup();
fileLineCleanup();
}
}
}
|
UTF-8
|
Java
| 2,816 |
java
|
LogTest.java
|
Java
|
[
{
"context": " Assert.assertTrue(last.contains(\"(Kevin McCallister Brick)\"));\n } catch (IOException e) {}\n ",
"end": 2668,
"score": 0.9996728301048279,
"start": 2645,
"tag": "NAME",
"value": "Kevin McCallister Brick"
}
] | null |
[] |
package com.techelevator.view;
import com.techelevator.VendingMachine;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.io.*;
import java.math.BigDecimal;
public class LogTest {
VendingMachine vendingMachine;
File inventoryTemp = new File("log.txt");
public void fileLineCleanup() {
try {
RandomAccessFile f = new RandomAccessFile("log.txt", "rw");
long length = f.length() - 1;
do {
length -= 1;
f.seek(length);
} while (f.readByte() != 10);
f.setLength(length + 1);
f.close();
} catch (IOException e) {}
}
@Before
public void logStart() {
vendingMachine = new VendingMachine();
}
@Test
public void feedMoney() {
vendingMachine.getCustomerMoney("5");
try {
try {
BufferedReader input = new BufferedReader(new FileReader(inventoryTemp));
String last = null;
String line = null;
while ((line = input.readLine()) != null) {
last = line;
}
Assert.assertTrue(last.contains("(FEED MONEY) $0.00 $5"));
} catch (IOException e) {
}
} finally {
fileLineCleanup();
}
}
@Test
public void giveChange() {
vendingMachine.getCustomerMoney("5");
vendingMachine.cashOut();
try {
try {
BufferedReader input = new BufferedReader(new FileReader(inventoryTemp));
String last = null;
String line = null;
while ((line = input.readLine()) != null) {
last = line;
}
Assert.assertTrue(last.contains("(GIVE CHANGE) $5.00 $0"));
} catch (IOException e) {}
} finally {
fileLineCleanup();
fileLineCleanup();
}
}
@Test
public void itemSelect() {
vendingMachine.userBalance = new BigDecimal(500.00);
vendingMachine.itemSelectionProcess("a2");
try {
try {
BufferedReader input = new BufferedReader(new FileReader(inventoryTemp));
String last = null;
String line = null;
while ((line = input.readLine()) != null) {
last = line;
}
Assert.assertTrue(last.contains("(<NAME>)"));
} catch (IOException e) {}
} finally {
fileLineCleanup();
fileLineCleanup();
}
}
}
| 2,799 | 0.480824 | 0.473366 | 95 | 28.642105 | 22.68499 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.452632 | false | false |
1
|
bc98ed7bc60d35aef09d53a8bcf105554995a050
| 24,154,896,080,984 |
2e36a77dbd8412bfcfdc88eb8f3beb52913ca5b4
|
/command-parent/command-base/src/main/java/com/command/base/command/Command.java
|
ae7cd3ec1470d6253296b1aa05c4bf6c9665d21b
|
[] |
no_license
|
nanjibingbang/command
|
https://github.com/nanjibingbang/command
|
cb706aa3c06883321c15833d8a8f2eacec16c01a
|
2c8ad9c92d927186589f7606460d6949ae46e1df
|
refs/heads/master
| 2021-08-15T01:24:14.400000 | 2017-11-17T03:58:17 | 2017-11-17T03:58:17 | 99,095,454 | 3 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.command.base.command;
import java.util.HashMap;
import java.util.Map;
public class Command {
private String commandLine;
private Map<String, String> params = new HashMap<String, String>();
public Command(String commandLine) {
this.commandLine = commandLine;
parseCommandLine(commandLine);
}
private void parseCommandLine(String commandLine) {
String[] split = commandLine.split(" ");
for (int i = 0; i < split.length; i++) {
String str = split[i];
if (str.startsWith("-") || str.startsWith("--")) {
params.put(str, split[i + 1]);
}
}
}
public String getParam(String key) {
return params.get(key);
}
public String getCommandLine() {
return commandLine;
}
public boolean is(String sign) {
return commandLine.startsWith(sign);
}
}
|
UTF-8
|
Java
| 953 |
java
|
Command.java
|
Java
|
[] | null |
[] |
package com.command.base.command;
import java.util.HashMap;
import java.util.Map;
public class Command {
private String commandLine;
private Map<String, String> params = new HashMap<String, String>();
public Command(String commandLine) {
this.commandLine = commandLine;
parseCommandLine(commandLine);
}
private void parseCommandLine(String commandLine) {
String[] split = commandLine.split(" ");
for (int i = 0; i < split.length; i++) {
String str = split[i];
if (str.startsWith("-") || str.startsWith("--")) {
params.put(str, split[i + 1]);
}
}
}
public String getParam(String key) {
return params.get(key);
}
public String getCommandLine() {
return commandLine;
}
public boolean is(String sign) {
return commandLine.startsWith(sign);
}
}
| 953 | 0.567681 | 0.565582 | 39 | 22.435898 | 20.579794 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.512821 | false | false |
1
|
bf8032fd6986a5f8644ab839fd1f9325c56e2ae5
| 18,837,726,573,130 |
3ad944eeeaeb2056d5d0938f9de44e9cd280e236
|
/src/test/java/wooteco/chess/domain/chessPiece/pieceState/InitialStateTest.java
|
fa02bb1d77f3024f8dbca573b2519cfd4356e28d
|
[] |
no_license
|
lxxjn0/java-chess
|
https://github.com/lxxjn0/java-chess
|
3016cc5e61e0d03e5249e2a5b3e492a715fc12d2
|
7227672f7edf82dd14ef525fb9c27a0de820d7ce
|
refs/heads/main
| 2022-07-09T03:46:13.928000 | 2020-06-30T05:24:39 | 2020-11-15T03:34:27 | 249,713,996 | 0 | 0 | null | true | 2020-03-24T13:22:13 | 2020-03-24T13:22:12 | 2020-02-24T05:44:51 | 2020-03-24T06:26:47 | 11,861 | 0 | 0 | 0 | null | false | false |
package wooteco.chess.domain.chessPiece.pieceState;
import static org.assertj.core.api.Assertions.*;
import org.junit.jupiter.api.Test;
class InitialStateTest {
@Test
void shiftNextState_InitialState_ReturnMovedState() {
assertThat(new InitialState().shiftNextState()).isInstanceOf(MovedState.class);
}
@Test
void getPawnMovableRange_ReturnInitialStatePawnMovableRange() {
assertThat(new InitialState().getPawnMovableRange()).isEqualTo(2);
}
}
|
UTF-8
|
Java
| 459 |
java
|
InitialStateTest.java
|
Java
|
[] | null |
[] |
package wooteco.chess.domain.chessPiece.pieceState;
import static org.assertj.core.api.Assertions.*;
import org.junit.jupiter.api.Test;
class InitialStateTest {
@Test
void shiftNextState_InitialState_ReturnMovedState() {
assertThat(new InitialState().shiftNextState()).isInstanceOf(MovedState.class);
}
@Test
void getPawnMovableRange_ReturnInitialStatePawnMovableRange() {
assertThat(new InitialState().getPawnMovableRange()).isEqualTo(2);
}
}
| 459 | 0.793028 | 0.79085 | 19 | 23.210526 | 27.795454 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.789474 | false | false |
1
|
a9779bf1d11fd722f903b414f9a07e1c9c0019fd
| 15,333,033,259,200 |
abecb383b4cd7396fea0fef0b10c5a2bc98ee98b
|
/src/main/java/masrshals/App.java
|
92c044151ded278e88511bbc4b9d3a849ba2b725
|
[] |
no_license
|
bhaskar28/marshals
|
https://github.com/bhaskar28/marshals
|
f804e8473dd24b0a5227dd0e878f932151ae614e
|
1224165868b01a15b4542d223fd7a64f35401bc1
|
refs/heads/master
| 2020-03-21T16:14:44.103000 | 2018-06-26T15:43:08 | 2018-06-26T15:43:08 | 138,756,052 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package masrshals;
public class App {
public String sample()
{
return "sample demo program";
}
}
|
UTF-8
|
Java
| 100 |
java
|
App.java
|
Java
|
[] | null |
[] |
package masrshals;
public class App {
public String sample()
{
return "sample demo program";
}
}
| 100 | 0.71 | 0.71 | 9 | 10.111111 | 11.129984 | 30 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false |
1
|
d7ce68cd4f60fff8383a3bd64f14f8724290beda
| 15,333,033,260,041 |
84aaa59a94a78494bb9379bb89dab891cc9a46b0
|
/src/main/java/com/example/demo/controller/SystemController.java
|
83d9caca4dbdb8f117cc7881c8b69ba314745d82
|
[] |
no_license
|
vacqq/test_back
|
https://github.com/vacqq/test_back
|
81e68fe3edfb1054fafd20825b810103767f7ffe
|
e24877a83d10dad48d0efc8db57e4f2bee98ae01
|
refs/heads/master
| 2023-01-10T16:10:59.558000 | 2020-11-19T07:40:22 | 2020-11-19T07:40:22 | 296,505,148 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.demo.controller;
import com.example.demo.base.bean.utils.BackFormatUtils;
import com.example.demo.bean.User;
import com.example.demo.service.UserService;
import org.apache.shiro.crypto.hash.SimpleHash;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.Map;
/**
* 系统管理
*
* @author lcz 2020/6/4 14:53
*/
@Controller
@RequestMapping("/systemCon")
public class SystemController {
@Autowired
private UserService userService;
/**
* 登陆校验
*
* @param
* @return
*/
@CrossOrigin
@ResponseBody
@RequestMapping(value = "/loginForm", method = RequestMethod.POST)
public HashMap loginForm(@RequestBody User useInput) {
Map<String, Object> map = new HashMap<String, Object>(10);
System.out.println(useInput.getUsername() + useInput.getPassword());
if (null != useInput.getUsername() && !"".equals(useInput.getUsername())) {
User user = userService.getUserByUserName(useInput.getUsername());
if (null != user) {
String userPassword = user.getPassword();
//获取盐值
String pwSalt = "HBHQKJHJJCGFJTYXGS";
String str = pwSalt + useInput.getPassword() + pwSalt;
String hashAlgorithmName = "MD5";
int hashIterations = 1024;
Object result = new SimpleHash(hashAlgorithmName, pwSalt, str, hashIterations);
//比对数据库hash值和散列后的hash值是否相等 如果相等则登录成功不过不相等则登陆失败
if (userPassword.equals(result.toString())) {
//校验成功获取用户信息+权限信息并返回
String token = "token";
map.put("code", 200);
map.put("message", "success");
map.put("data", user);
map.put("token", token);
} else {
map.put("code", 1);
map.put("message", "账户或密码错误");
map.put("data", "no");
}
} else {
map.put("code", 401);
map.put("message", "账户或密码错误");
map.put("data", "no");
}
} else {
map.put("code", 1);
map.put("message", "账户或密码错误");
map.put("data", "no");
}
return BackFormatUtils.builder(map.get("data"), map.get("message"), map.get("code"), map.get("token"));
}
/**
* 登录成功后获取用户信息(临时)
*
* @param
* @return
*/
@RequestMapping(value = "/getUserDetail", method = RequestMethod.POST)
@CrossOrigin
@ResponseBody
public HashMap getUserDetail(@RequestBody HashMap<String, String> jsonString) {
HashMap<String, Object> user = userService.getUserByUserNameMap(jsonString.get("user_name"));
String chineseNames = user.get("chinese_names").toString();
String placeId = user.get("place_id").toString();
return BackFormatUtils.getUserDetail(jsonString.get("user_name"), chineseNames, placeId);
}
}
|
UTF-8
|
Java
| 3,362 |
java
|
SystemController.java
|
Java
|
[
{
"context": ";\nimport java.util.Map;\n\n/**\n * 系统管理\n *\n * @author lcz 2020/6/4 14:53\n */\n@Controller\n@RequestMapping(\"/",
"end": 465,
"score": 0.9994995594024658,
"start": 462,
"tag": "USERNAME",
"value": "lcz"
},
{
"context": "取用户信息+权限信息并返回\n String token = \"token\";\n map.put(\"code\", 200);\n ",
"end": 1784,
"score": 0.733668863773346,
"start": 1779,
"tag": "KEY",
"value": "token"
}
] | null |
[] |
package com.example.demo.controller;
import com.example.demo.base.bean.utils.BackFormatUtils;
import com.example.demo.bean.User;
import com.example.demo.service.UserService;
import org.apache.shiro.crypto.hash.SimpleHash;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.Map;
/**
* 系统管理
*
* @author lcz 2020/6/4 14:53
*/
@Controller
@RequestMapping("/systemCon")
public class SystemController {
@Autowired
private UserService userService;
/**
* 登陆校验
*
* @param
* @return
*/
@CrossOrigin
@ResponseBody
@RequestMapping(value = "/loginForm", method = RequestMethod.POST)
public HashMap loginForm(@RequestBody User useInput) {
Map<String, Object> map = new HashMap<String, Object>(10);
System.out.println(useInput.getUsername() + useInput.getPassword());
if (null != useInput.getUsername() && !"".equals(useInput.getUsername())) {
User user = userService.getUserByUserName(useInput.getUsername());
if (null != user) {
String userPassword = user.getPassword();
//获取盐值
String pwSalt = "HBHQKJHJJCGFJTYXGS";
String str = pwSalt + useInput.getPassword() + pwSalt;
String hashAlgorithmName = "MD5";
int hashIterations = 1024;
Object result = new SimpleHash(hashAlgorithmName, pwSalt, str, hashIterations);
//比对数据库hash值和散列后的hash值是否相等 如果相等则登录成功不过不相等则登陆失败
if (userPassword.equals(result.toString())) {
//校验成功获取用户信息+权限信息并返回
String token = "token";
map.put("code", 200);
map.put("message", "success");
map.put("data", user);
map.put("token", token);
} else {
map.put("code", 1);
map.put("message", "账户或密码错误");
map.put("data", "no");
}
} else {
map.put("code", 401);
map.put("message", "账户或密码错误");
map.put("data", "no");
}
} else {
map.put("code", 1);
map.put("message", "账户或密码错误");
map.put("data", "no");
}
return BackFormatUtils.builder(map.get("data"), map.get("message"), map.get("code"), map.get("token"));
}
/**
* 登录成功后获取用户信息(临时)
*
* @param
* @return
*/
@RequestMapping(value = "/getUserDetail", method = RequestMethod.POST)
@CrossOrigin
@ResponseBody
public HashMap getUserDetail(@RequestBody HashMap<String, String> jsonString) {
HashMap<String, Object> user = userService.getUserByUserNameMap(jsonString.get("user_name"));
String chineseNames = user.get("chinese_names").toString();
String placeId = user.get("place_id").toString();
return BackFormatUtils.getUserDetail(jsonString.get("user_name"), chineseNames, placeId);
}
}
| 3,362 | 0.578964 | 0.571068 | 93 | 33.043011 | 27.284212 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.709677 | false | false |
1
|
6cb0f2162cfd81e794c1cc87e640591a00d5543f
| 20,005,957,676,199 |
ee4a559476dffb90de92e82e5807b09c1b11204f
|
/spring/faturista/src/main/java/com/faturista/dominio/bo/ClienteBO.java
|
b0fe8d8b3809a14eea674baedf796b5096a61663
|
[
"MIT"
] |
permissive
|
lourencoccc/lab-java
|
https://github.com/lourencoccc/lab-java
|
05cc54771b461050ac0152aa0c2b0b91bea47cd5
|
48dc92f137362c7576c45d3474a3357bd5038d2a
|
refs/heads/master
| 2020-01-24T21:37:50.281000 | 2019-11-06T19:50:14 | 2019-11-06T19:50:14 | 73,419,545 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.faturista.dominio.bo;
import com.faturista.dominio.calculo.CalculoBandeiraFactory;
import com.faturista.dominio.calculo.CalculoBandeiraStrategy;
import com.faturista.dominio.model.Cliente;
import com.faturista.dominio.model.Fatura;
import com.faturista.integracao.ClienteDao;
import com.faturista.integracao.FaturaDao;
import com.faturista.integracao.po.ClienteEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
@Component(value = "clienteBO")
public class ClienteBO {
private final ClienteDao clienteDao;
private final CalculoBandeiraFactory calculoBandeiraFactory;
@Autowired
public ClienteBO(ClienteDao clienteDao,
CalculoBandeiraFactory calculoBandeiraFactory) {
this.clienteDao = clienteDao;
this.calculoBandeiraFactory = calculoBandeiraFactory;
}
public List<Cliente> buscarTodos() {
List<Cliente> clientes = new ArrayList<>();
for (ClienteEntity entity : clienteDao.findAll()) {
clientes.add(new Cliente(entity.getId(),
entity.getDocumento(), entity.getNome(),
entity.getEmail()));
}
return clientes;
}
public Cliente salvar(Cliente cliente) {
return null;
}
}
|
UTF-8
|
Java
| 1,316 |
java
|
ClienteBO.java
|
Java
|
[] | null |
[] |
package com.faturista.dominio.bo;
import com.faturista.dominio.calculo.CalculoBandeiraFactory;
import com.faturista.dominio.calculo.CalculoBandeiraStrategy;
import com.faturista.dominio.model.Cliente;
import com.faturista.dominio.model.Fatura;
import com.faturista.integracao.ClienteDao;
import com.faturista.integracao.FaturaDao;
import com.faturista.integracao.po.ClienteEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
@Component(value = "clienteBO")
public class ClienteBO {
private final ClienteDao clienteDao;
private final CalculoBandeiraFactory calculoBandeiraFactory;
@Autowired
public ClienteBO(ClienteDao clienteDao,
CalculoBandeiraFactory calculoBandeiraFactory) {
this.clienteDao = clienteDao;
this.calculoBandeiraFactory = calculoBandeiraFactory;
}
public List<Cliente> buscarTodos() {
List<Cliente> clientes = new ArrayList<>();
for (ClienteEntity entity : clienteDao.findAll()) {
clientes.add(new Cliente(entity.getId(),
entity.getDocumento(), entity.getNome(),
entity.getEmail()));
}
return clientes;
}
public Cliente salvar(Cliente cliente) {
return null;
}
}
| 1,316 | 0.770517 | 0.770517 | 45 | 28.244444 | 21.527405 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.555556 | false | false |
1
|
b87877a5409ff09cfedb0e0da56ee82b3e9d8e26
| 20,005,957,677,631 |
278495b61fad4658b518e8b51285ecaf23c4c189
|
/src/main/java/com/longz/moonpie/domian/request/BaseRequest.java
|
e9177b893f2c35a7341cbd60ceefb719b2cb0bef
|
[
"Apache-2.0"
] |
permissive
|
LeoBy93th/moonpie
|
https://github.com/LeoBy93th/moonpie
|
17304e61876c21450769940a39c83e677a169282
|
70189a8fbff2e6aaf116d85259ff1e9a2623ca4f
|
refs/heads/master
| 2023-03-20T12:13:38.317000 | 2021-03-09T09:41:59 | 2021-03-09T09:41:59 | 343,373,824 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.longz.moonpie.domian.request;
import java.io.Serializable;
/**
* @author: sichen.yuan
* @date: 2021/3/8 11:11
*/
public class BaseRequest implements Serializable {
private static final long serialVersionUID = -5392581415117611747L;
}
|
UTF-8
|
Java
| 258 |
java
|
BaseRequest.java
|
Java
|
[
{
"context": "st;\n\nimport java.io.Serializable;\n\n/**\n * @author: sichen.yuan\n * @date: 2021/3/8 11:11\n */\npublic class BaseReq",
"end": 100,
"score": 0.9971920251846313,
"start": 89,
"tag": "NAME",
"value": "sichen.yuan"
}
] | null |
[] |
package com.longz.moonpie.domian.request;
import java.io.Serializable;
/**
* @author: sichen.yuan
* @date: 2021/3/8 11:11
*/
public class BaseRequest implements Serializable {
private static final long serialVersionUID = -5392581415117611747L;
}
| 258 | 0.74031 | 0.627907 | 14 | 17.428572 | 22.164045 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.214286 | false | false |
1
|
08c31df8205257cd47f095b058121eee1d8f0071
| 23,493,471,118,692 |
fa2e3055253e427f8384a73c9dea673d56f6737b
|
/wtcwebapp/src/main/java/ru/pacifica/wtc/bean/UserSortField.java
|
6d0beffc9530cc6156cf6ee33630fa440d700264
|
[] |
no_license
|
DonkeyHot/wtc
|
https://github.com/DonkeyHot/wtc
|
ea4484110423bcd89c9cea4fdc5eca0c8b253826
|
ea45b70f70748e40fbf3898331c4f6a116b90105
|
refs/heads/master
| 2016-08-04T20:56:26.751000 | 2015-05-14T08:09:18 | 2015-05-14T08:09:18 | 35,546,682 | 0 | 0 | null | false | 2015-05-13T12:07:34 | 2015-05-13T12:04:39 | 2015-05-13T12:05:06 | 2015-05-13T12:07:34 | 0 | 0 | 0 | 0 |
Java
| null | null |
package ru.pacifica.wtc.bean;
import ru.pacifica.system.*;
public enum UserSortField implements SortField {
USR_LOGIN(0), USR_LASTNAME(1);
private int ID;
UserSortField(int id) {
this.ID = id;
}
public int getID() {
return ID;
}
}
|
UTF-8
|
Java
| 263 |
java
|
UserSortField.java
|
Java
|
[] | null |
[] |
package ru.pacifica.wtc.bean;
import ru.pacifica.system.*;
public enum UserSortField implements SortField {
USR_LOGIN(0), USR_LASTNAME(1);
private int ID;
UserSortField(int id) {
this.ID = id;
}
public int getID() {
return ID;
}
}
| 263 | 0.642586 | 0.634981 | 18 | 13.611111 | 14.499575 | 48 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
1
|
bab298a7b9ebd24a0eda3a6f0b380b9138e25fce
| 23,493,471,121,945 |
336fc3d0adbb83cc8cd45e7a20c50bc1afcfd46d
|
/kifp2/src-pay/com/kingdom/payment/service/cfca/ZJNoticeMsgService.java
|
3d2e27704a8147f3ecd043c5fb38191234b5f8f5
|
[
"Apache-2.0"
] |
permissive
|
tong12580/kifp
|
https://github.com/tong12580/kifp
|
31e8c64856c40ba9b109994fac2656984d8f56f9
|
b2671ed49556d64898b4c2e91a2c9965284a20d9
|
refs/heads/master
| 2016-08-31T20:35:07.626000 | 2016-06-24T08:03:01 | 2016-06-24T08:03:01 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* <pre>
* Copyright Notice:
* Copyright (c) 2005-2009 China Financial Certification Authority(CFCA)
* A-1 You An Men Nei Xin An Nan Li, Xuanwu District, Beijing ,100054, China
* All rights reserved.
*
* This software is the confidential and proprietary information of
* China Financial Certification Authority ("Confidential Information").
* You shall not disclose such Confidential Information and shall use
* it only in accordance with the terms of the license agreement you
* entered into with CFCA.
* </pre>
*/
package com.kingdom.payment.service.cfca;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import payment.api.notice.Notice1318Request;
import payment.api.notice.Notice1348Request;
import payment.api.notice.Notice1363Request;
import payment.api.notice.Notice4522Request;
import payment.api.notice.NoticeRequest;
import payment.api.notice.NoticeResponse;
import payment.tools.util.Base64;
import com.alibaba.fastjson.JSONObject;
import com.websuites.core.response.IResult;
import com.websuites.core.response.Result;
import com.websuites.utils.LogUtil;
import com.kingdom.payment.inf.IDefineMsg;
import com.kingdom.payment.kesb.KesbBexTool;
import com.kingdom.payment.utils.CommonQuery;
import com.kingdom.payment.utils.UpdateCommon;
import com.kingdom.payment.utils.UtilTools;
/**
* 接收中金平台支付状态变更通知
* @author Raymond
*
*/
@Scope("prototype")
@Service("noticeMsgService")
public class ZJNoticeMsgService{
@Autowired
@Qualifier("payCommonQuery")
private CommonQuery commonQuery;
@Autowired
@Qualifier("payUpdateCommon")
private UpdateCommon updateCommon;
@SuppressWarnings({"rawtypes","unchecked"})
public IResult noticeMsg(HashMap mapParam){
IResult rs = new Result();
HashMap updPayAckMap = new HashMap();
try {
LogUtil.info("---------- Begin [ReceiveNotice] process......");
// 1 获得参数message和signature
String message = UtilTools.valueOf(mapParam.get("message"));
String signature = UtilTools.valueOf(mapParam.get("signature"));
//系统参数
String paytype = UtilTools.valueOf(mapParam.get("paytype"));
String channel = UtilTools.valueOf(mapParam.get("channel"));
String channelno = UtilTools.valueOf(mapParam.get("channelno"));
String sendflag = "1";//发起方向(0从内部发出,1从外不发出)
// 2 生成交易结果对象
NoticeRequest noticeRequest = new NoticeRequest(message, signature);
// 3 业务处理
if ("1318".equals(noticeRequest.getTxCode())) {
Notice1318Request nr = new Notice1318Request(noticeRequest.getDocument());
//判断应答流水是否重复
HashMap reqAckMap = new HashMap();
reqAckMap.put("paymentno", nr.getPaymentNo());
try {
IResult rsQuery = commonQuery.getPayAckCapital(reqAckMap);
if(!UtilTools.isNull(rsQuery)){
List<Map> list = (List<Map>) rsQuery.getResult();
if(list != null && list.size() > 0){
rs = UtilTools.makerResults(IDefineMsg.CODE_ERROR,
IDefineMsg.FAILE_QRY_ACK);
return rs;
}
}
} catch (Exception e) {
e.printStackTrace();
}
//三方支付应答流水
HashMap param = new HashMap();
param.put("paymentno", nr.getPaymentNo());
param.put("paychannel", channelno);
param.put("payversion", channel);
param.put("paytype", noticeRequest.getTxCode());
param.put("receivedata", noticeRequest.getPlainText());
param.put("sendflag", sendflag);
param.put("sendaddress", "");
param.put("orderno", "");
param.put("receivetime", nr.getBankNotificationTime());
param.put("amount", BigDecimal.valueOf(nr.getAmount()).divide(new BigDecimal(100)).toString());
param.put("status", nr.getStatus());
param.put("institutionid", nr.getInstitutionID());
if(updateCommon.addPayAckCapital(param)){
updPayAckMap.put("paymentno", nr.getPaymentNo());
updPayAckMap.put("specification", IDefineMsg.PAY_ACK_CAPITAL_STATUS_101);
updateCommon.updPayAckCapital(updPayAckMap);
LogUtil.info("[市场订单支付状态变更通知(1318)支付交易号:" + nr.getPaymentNo() + "应答日志写入成功]");
}else{
LogUtil.info("[市场订单支付状态变更通知(1318)支付交易号:" + nr.getPaymentNo() + "应答日志写入失败]");
}
HashMap reqAppMap = new HashMap();
reqAppMap.put("paymentno", nr.getPaymentNo());
String batchno = new String();
try {
IResult res = commonQuery.getAppCapital(reqAppMap);// 查询三方支付申请流水,返回资金流水号
if (res.isSuccessful()) {
List<Map> listMap = (List<Map>) res.getResult();
if (listMap != null && listMap.size() > 0) {
Map map = listMap.get(0);
batchno = UtilTools.valueOf(map.get("batchno"));
}
updPayAckMap.put("paymentno", nr.getPaymentNo());
updPayAckMap.put("specification", IDefineMsg.PAY_ACK_CAPITAL_STATUS_103+"【"+batchno+"】");
updateCommon.updPayAckCapital(updPayAckMap);
}else{
updPayAckMap.put("paymentno", nr.getPaymentNo());
updPayAckMap.put("specification", IDefineMsg.PAY_ACK_CAPITAL_STATUS_104);
updateCommon.updPayAckCapital(updPayAckMap);
rs = UtilTools.makerResults(IDefineMsg.CODE_ERROR,
IDefineMsg.NULL_QRY_APP);
return rs;
}
} catch (Exception e) {
e.printStackTrace();
updPayAckMap.put("paymentno", nr.getPaymentNo());
updPayAckMap.put("specification", IDefineMsg.PAY_ACK_CAPITAL_STATUS_104);
updateCommon.updPayAckCapital(updPayAckMap);
rs = UtilTools.makerResults(IDefineMsg.CODE_ERROR,
IDefineMsg.NULL_QRY_APP);
return rs;
}
if(20 == nr.getStatus()){
updPayAckMap.put("paymentno", nr.getPaymentNo());
updPayAckMap.put("specification", "105:中金支付订单支付成功");
updateCommon.updPayAckCapital(updPayAckMap);
}else{
updPayAckMap.put("paymentno", nr.getPaymentNo());
updPayAckMap.put("specification", "106:中金支付订单支付失败");
updateCommon.updPayAckCapital(updPayAckMap);
rs = UtilTools.makerResults(IDefineMsg.CODE_ERROR, "支付失败");
return rs;
}
if (20 == nr.getStatus()) {
//T+1结算给商户虚拟账户(珠海)
String amount = BigDecimal.valueOf(Long.valueOf(nr.getAmount()))
.divide(new BigDecimal(100)).toString();
HashMap reqClearMap = new HashMap();
reqClearMap.put("Amount", amount);
reqClearMap.put("AccountType", "20");
reqClearMap.put("BankID", "");
reqClearMap.put("AccountName", "");
reqClearMap.put("AccountNumber", "");
reqClearMap.put("BranchName", "");
reqClearMap.put("Province", "");
reqClearMap.put("City", "");
rs = KesbBexTool.doBex("api_set_order_clear_account", reqClearMap);
if(rs.isSuccessful()){
updPayAckMap.put("paymentno", nr.getPaymentNo());
updPayAckMap.put("specification", IDefineMsg.PAY_ACK_CAPITAL_STATUS_109
+"【订单结算接口:"+rs.getErrorMessage()+"】");
updateCommon.updPayAckCapital(updPayAckMap);
}else{
updPayAckMap.put("paymentno", nr.getPaymentNo());
updPayAckMap.put("specification", IDefineMsg.PAY_ACK_CAPITAL_STATUS_110
+"【订单结算接口:"+rs.getErrorMessage()+"】");
updateCommon.updPayAckCapital(updPayAckMap);
}
// TODO 商户订单处理
HashMap reqConfirmPay = new HashMap();
String Amount = BigDecimal.valueOf(Long.valueOf(nr.getAmount()))
.divide(new BigDecimal(100)).toString();
String transactioncfmdate = nr.getBankNotificationTime().substring(0, 8);
String transactioncfmtime = nr.getBankNotificationTime().substring(8, 14);
reqConfirmPay.put("batchno", batchno);
reqConfirmPay.put("transactioncfmdate", transactioncfmdate);
reqConfirmPay.put("transactioncfmtime", transactioncfmtime);
reqConfirmPay.put("taserialno", nr.getPaymentNo());
reqConfirmPay.put("confirmedamount", Amount);
rs = comfirmPayStatus(reqConfirmPay);// 通知资金网关确认支付
if(rs.isSuccessful()){
updPayAckMap.put("paymentno", nr.getPaymentNo());
updPayAckMap.put("specification", IDefineMsg.PAY_ACK_CAPITAL_STATUS_107
+"【kifp:"+rs.getErrorMessage()+"】");
updateCommon.updPayAckCapital(updPayAckMap);
}else{
updPayAckMap.put("paymentno", nr.getPaymentNo());
updPayAckMap.put("specification", IDefineMsg.PAY_ACK_CAPITAL_STATUS_108
+"【kifp:"+rs.getErrorMessage()+"】");
updateCommon.updPayAckCapital(updPayAckMap);
}
}
} else if ("1348".equals(noticeRequest.getTxCode())) {
Notice1348Request nr = new Notice1348Request(noticeRequest.getDocument());
HashMap reqMap = new HashMap();
String Amount = BigDecimal.valueOf(Long.valueOf(nr.getAmount()))
.divide(new BigDecimal(100)).toString();
//判断应答流水是否重复
HashMap reqAckMap = new HashMap();
reqAckMap.put("paymentno", nr.getSerialNumber());
try {
IResult rsQuery = commonQuery.getPayAckCapital(reqAckMap);
if(!UtilTools.isNull(rsQuery)){
List<Map> list = (List<Map>) rsQuery.getResult();
if(list != null && list.size() > 0){
String status = UtilTools.valueOf(list.get(0).get("status"));
if(status.equalsIgnoreCase("OK.") || status.equalsIgnoreCase("ERROR.")){
rs = UtilTools.makerResults(IDefineMsg.CODE_ERROR,
IDefineMsg.FAILE_QRY_ACK);
return rs;
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
LogUtil.info("[TxCode] = [1348]");
LogUtil.info("[TxName] = [市场订单结算状态变更通知]");
LogUtil.info("[InstitutionID]= [" + nr.getInstitutionID() + "]");
LogUtil.info("[OrderNo] = [" + nr.getOrderNo() + "]");
LogUtil.info("[SerialNumber] = [" + nr.getSerialNumber() + "]");
LogUtil.info("[Amount] = [" + nr.getAmount() + "]");
LogUtil.info("[Status] = [" + nr.getStatus() + "]");
LogUtil.info("[TransferTime] = [" + nr.getTransferTime() + "]");
if (40 == nr.getStatus()) {
//更新fms_applypay
reqMap.put("paymentno", nr.getSerialNumber());
reqMap.put("status", "5");
updateCommon.updFmsApplypay(reqMap);
//更新pay_ack_capital
updPayAckMap.put("paymentno", nr.getSerialNumber());
updPayAckMap.put("status", "OK.");
updPayAckMap.put("specification",
"103:订单金额【"+ Amount +"】已经结算");
updateCommon.updPayAckCapital(updPayAckMap);
List<Map> list = new ArrayList<Map>();
HashMap appMap = new HashMap();
appMap.put("paymentno", nr.getSerialNumber());
list = commonQuery.getApplyNo(appMap);
if(list != null && list.size() > 0){
String applyid = UtilTools.valueOf(list.get(0).get("applyid"));
appMap.put("applyid", applyid);
//变更提现状态
rs = callCapitalChange(appMap);
if(rs.isSuccessful()){
updPayAckMap.put("paymentno", nr.getOrderNo());
updPayAckMap.put("specification", "105:资金网关最终变动提现状态"
+"【kifp:"+rs.getErrorMessage()+"】");
updateCommon.updPayAckCapital(updPayAckMap);
}else{
updPayAckMap.put("paymentno", nr.getOrderNo());
updPayAckMap.put("specification", "106:资金网关最终变动提现状态失败"
+"【kifp:"+rs.getErrorMessage()+"】");
updateCommon.updPayAckCapital(updPayAckMap);
}
}
rs = UtilTools.makerResults(IDefineMsg.CODE_SUCCESS, "市场订单结算状态变更通知");
}
if (50 == nr.getStatus()) {
//更新fms_applypay
reqMap.put("paymentno", nr.getSerialNumber());
reqMap.put("status", "6");
updateCommon.updFmsApplypay(reqMap);
//更新pay_ack_capital
updPayAckMap.put("paymentno", nr.getSerialNumber());
updPayAckMap.put("status", "ERROR.");
updPayAckMap.put("specification", "104:订单结算结果异常【"+rs.getErrorMessage()+"】");
updateCommon.updPayAckCapital(updPayAckMap);
List<Map> list = new ArrayList<Map>();
HashMap appMap = new HashMap();
appMap.put("paymentno", nr.getSerialNumber());
list = commonQuery.getApplyNo(appMap);
if(list != null && list.size() > 0){
String applyid = UtilTools.valueOf(list.get(0).get("applyid"));
appMap.put("applyid", applyid);
//变更提现状态
rs = callCapitalChange(appMap);
if(rs.isSuccessful()){
updPayAckMap.put("paymentno", nr.getOrderNo());
updPayAckMap.put("specification", "105:资金网关最终变动提现状态"
+"【kifp:"+rs.getErrorMessage()+"】");
updateCommon.updPayAckCapital(updPayAckMap);
}else{
updPayAckMap.put("paymentno", nr.getOrderNo());
updPayAckMap.put("specification", "106:资金网关最终变动提现状态失败"
+"【kifp:"+rs.getErrorMessage()+"】");
updateCommon.updPayAckCapital(updPayAckMap);
}
}
rs = UtilTools.makerResults(IDefineMsg.CODE_SUCCESS, "市场订单结算状态变更通知");
}
}else if ("1363".equals(noticeRequest.getTxCode())) {
Notice1363Request nr = new Notice1363Request(noticeRequest.getDocument());
LogUtil.info("[TxName] = [单笔代收结果通知]");
LogUtil.info("[TxCode] = [1363]");
LogUtil.info("[InstitutionID]= [" + nr.getInstitutionID() + "]");
LogUtil.info("[TxSN] = [" + nr.getTxSN() + "]");
LogUtil.info("[OrderNo] = [" + nr.getOrderNo() + "]");
LogUtil.info("[Amount] = [" + nr.getAmount() + "]");
LogUtil.info("[Status] = [" + nr.getStatus() + "]");
LogUtil.info("[BankTxTime] = [" + nr.getBankTxTime() + "]");
LogUtil.info("[ResponseCode] = [" + nr.getResponseCode() + "]");
LogUtil.info("[ResponseMessage] = [" + nr.getResponseMessage() + "]");
if (30 == nr.getStatus() || 40 == nr.getStatus()) {
LogUtil.info("receive 1363 notification success");
rs = UtilTools.makerResults(IDefineMsg.CODE_SUCCESS, "单笔代收结果通知");
}
}else if ("4522".equals(noticeRequest.getTxCode())) {
Notice4522Request nr = new Notice4522Request(noticeRequest.getDocument());
LogUtil.info("[TxCode] = [4522]");
LogUtil.info("[TxName] = [机构支付账户网银充值成功通知]");
LogUtil.info("[InstitutionID]=[" + nr.getInstitutionID() + "]");
LogUtil.info("[PaymentAccountName]=[" + nr.getPaymentAccountName() + "]");
LogUtil.info("[PaymentAccountNumber]=[" + nr.getPaymentAccountNumber() + "]");
LogUtil.info("[Amount]=[" + nr.getAmount() + "]");
LogUtil.info("[BankTxTime]=[" + nr.getBankTxTime() + "]");
LogUtil.info("[PaymentNo]=[" + nr.getPaymentNo() + "]");
LogUtil.info("[Remark]=[" + nr.getRemark() + "]");
LogUtil.info("[Status]=[" + nr.getStatus() + "]");
//判断应答流水是否重复
HashMap reqAckMap = new HashMap();
reqAckMap.put("paymentno", nr.getPaymentNo());
try {
IResult rsQuery = commonQuery.getPayAckCapital(reqAckMap);
if(!UtilTools.isNull(rsQuery)){
List<Map> list = (List<Map>) rsQuery.getResult();
if(list != null && list.size() > 0){
rs = UtilTools.makerResults(IDefineMsg.CODE_ERROR,
IDefineMsg.FAILE_QRY_ACK);
return rs;
}
}
} catch (Exception e) {
e.printStackTrace();
}
//三方支付应答流水
HashMap param = new HashMap();
param.put("paymentno", nr.getPaymentNo());
param.put("paychannel", channelno);
param.put("payversion", channel);
param.put("paytype", noticeRequest.getTxCode());
param.put("receivedata", noticeRequest.getPlainText());
param.put("sendflag", sendflag);
param.put("sendaddress", "");
param.put("orderno", "");
param.put("receivetime", nr.getBankTxTime());
param.put("amount", BigDecimal.valueOf(nr.getAmount()).divide(new BigDecimal(100)).toString());
param.put("status", nr.getStatus());
param.put("institutionid", nr.getInstitutionID());
if(updateCommon.addPayAckCapital(param)){
updPayAckMap.put("paymentno", nr.getPaymentNo());
updPayAckMap.put("specification", IDefineMsg.PAY_ACK_CAPITAL_STATUS_101);
updateCommon.updPayAckCapital(updPayAckMap);
LogUtil.info("[机构支付账户网银充值成功通知(4522)支付交易号:" + nr.getPaymentNo() + "应答日志写入成功]");
}else{
LogUtil.info("[机构支付账户网银充值成功通知(4522)支付交易号:" + nr.getPaymentNo() + "应答日志写入失败]");
}
HashMap reqAppMap = new HashMap();
reqAppMap.put("paymentno", nr.getPaymentNo());
String batchno = new String();
try {
IResult res = commonQuery.getAppCapital(reqAppMap);// 查询三方支付申请流水,返回资金流水号
if (res.isSuccessful()) {
List<Map> listMap = (List<Map>) res.getResult();
if (listMap != null && listMap.size() > 0) {
Map map = listMap.get(0);
batchno = UtilTools.valueOf(map.get("batchno"));
}
updPayAckMap.put("paymentno", nr.getPaymentNo());
updPayAckMap.put("specification", IDefineMsg.PAY_ACK_CAPITAL_STATUS_103+"【"+batchno+"】");
updateCommon.updPayAckCapital(updPayAckMap);
}else{
updPayAckMap.put("paymentno", nr.getPaymentNo());
updPayAckMap.put("specification", IDefineMsg.PAY_ACK_CAPITAL_STATUS_104);
updateCommon.updPayAckCapital(updPayAckMap);
rs = UtilTools.makerResults(IDefineMsg.CODE_ERROR,
IDefineMsg.NULL_QRY_APP);
return rs;
}
} catch (Exception e) {
e.printStackTrace();
updPayAckMap.put("paymentno", nr.getPaymentNo());
updPayAckMap.put("specification", IDefineMsg.PAY_ACK_CAPITAL_STATUS_104);
updateCommon.updPayAckCapital(updPayAckMap);
rs = UtilTools.makerResults(IDefineMsg.CODE_ERROR,
IDefineMsg.NULL_QRY_APP);
return rs;
}
if(20 == nr.getStatus()){
updPayAckMap.put("paymentno", nr.getPaymentNo());
updPayAckMap.put("specification", "105:中金支付订单支付成功");
updateCommon.updPayAckCapital(updPayAckMap);
}else{
updPayAckMap.put("paymentno", nr.getPaymentNo());
updPayAckMap.put("specification", "106:中金支付订单支付失败");
updateCommon.updPayAckCapital(updPayAckMap);
rs = UtilTools.makerResults(IDefineMsg.CODE_ERROR, "支付失败");
return rs;
}
if (20 == nr.getStatus()) {
// TODO 商户订单处理
HashMap reqConfirmPay = new HashMap();
String Amount = BigDecimal.valueOf(Long.valueOf(nr.getAmount()))
.divide(new BigDecimal(100)).toString();
String transactioncfmdate = nr.getBankTxTime().substring(0, 8);
String transactioncfmtime = nr.getBankTxTime().substring(8, 14);
reqConfirmPay.put("batchno", batchno);
reqConfirmPay.put("transactioncfmdate", transactioncfmdate);
reqConfirmPay.put("transactioncfmtime", transactioncfmtime);
reqConfirmPay.put("taserialno", nr.getPaymentNo());
reqConfirmPay.put("confirmedamount", Amount);
rs = comfirmPayStatus(reqConfirmPay);// 通知资金网关确认支付
if(rs.isSuccessful()){
updPayAckMap.put("paymentno", nr.getPaymentNo());
updPayAckMap.put("specification", IDefineMsg.PAY_ACK_CAPITAL_STATUS_107
+"【kifp:"+rs.getErrorMessage()+"】");
updateCommon.updPayAckCapital(updPayAckMap);
}else{
updPayAckMap.put("paymentno", nr.getPaymentNo());
updPayAckMap.put("specification", IDefineMsg.PAY_ACK_CAPITAL_STATUS_108
+"【kifp:"+rs.getErrorMessage()+"】");
updateCommon.updPayAckCapital(updPayAckMap);
}
}
} else {
LogUtil.info("!!! 错误的通知 !!!");
LogUtil.info("[txCode] = [????]");
LogUtil.info("[txName] = [未知通知类型]");
rs = UtilTools.makerResults(IDefineMsg.CODE_ERROR, "错误的通知");
}
// 4 响应支付平台 特别说明:为避免重复发通知,必须要求商户给予响应,响应的内容是固定的new String(Base64.encode(new NoticeResponse().getMessage().getBytes("UTF-8")));
String xmlString = new NoticeResponse().getMessage();
String base64String = new String(Base64.encode(xmlString.getBytes("UTF-8")));
rs = UtilTools.makerResults(rs, "base64String", base64String);
LogUtil.info("---------- End [ReceiveNotice] process.");
} catch (Exception e) {
e.printStackTrace();
rs = UtilTools.makerResults(IDefineMsg.CODE_ERROR, "后台通知状态变更异常");
}
return rs;
}
@SuppressWarnings({ "rawtypes","unchecked" })
private IResult comfirmPayStatus(HashMap mapParam) {
IResult rs = new Result();
mapParam.put("kifpbexid", "api_confirm_pay_status");
rs = KesbBexTool.doCommonKifpBex(mapParam);
if(rs.isSuccessful()){
rs = UtilTools.makerResults(IDefineMsg.CODE_SUCCESS, rs.getErrorMessage());
}else{
rs = UtilTools.makerResults(IDefineMsg.CODE_ERROR, rs.getErrorMessage());
}
return rs;
}
/**
* 最终变更提现状态(直接调kifp接口)
* @param mapParam
* @return
*/
@SuppressWarnings({ "rawtypes","unchecked","unused" })
private IResult callCapitalChange(HashMap mapParam) {
IResult rs = new Result();
mapParam.put("kifpbexid", "api_capital_change_for_paycent");
rs = KesbBexTool.doCommonKifpBex(mapParam);
if(rs.isSuccessful()){
rs = UtilTools.makerResults(IDefineMsg.CODE_SUCCESS, rs.getErrorMessage());
}else{
rs = UtilTools.makerResults(IDefineMsg.CODE_ERROR, rs.getErrorMessage());
}
return rs;
}
}
|
UTF-8
|
Java
| 24,360 |
java
|
ZJNoticeMsgService.java
|
Java
|
[
{
"context": "ertification Authority(CFCA)\r\n * A-1 You An Men Nei Xin An Nan Li, Xuanwu District, Beijing ,100054, Chin",
"end": 142,
"score": 0.7135371565818787,
"start": 135,
"tag": "NAME",
"value": "Nei Xin"
},
{
"context": "n Authority(CFCA)\r\n * A-1 You An Men Nei Xin An Nan Li, Xuanwu District, Beijing ,100054, China\r\n * A",
"end": 152,
"score": 0.6466120481491089,
"start": 146,
"tag": "NAME",
"value": "Nan Li"
},
{
"context": "s.UtilTools;\r\n\r\n/**\r\n * 接收中金平台支付状态变更通知\r\n * @author Raymond\r\n *\r\n */\r\n@Scope(\"prototype\")\r\n@Service(\"noticeMs",
"end": 1745,
"score": 0.9988306760787964,
"start": 1738,
"tag": "NAME",
"value": "Raymond"
}
] | null |
[] |
/**
* <pre>
* Copyright Notice:
* Copyright (c) 2005-2009 China Financial Certification Authority(CFCA)
* A-1 You An Men <NAME> An <NAME>, Xuanwu District, Beijing ,100054, China
* All rights reserved.
*
* This software is the confidential and proprietary information of
* China Financial Certification Authority ("Confidential Information").
* You shall not disclose such Confidential Information and shall use
* it only in accordance with the terms of the license agreement you
* entered into with CFCA.
* </pre>
*/
package com.kingdom.payment.service.cfca;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import payment.api.notice.Notice1318Request;
import payment.api.notice.Notice1348Request;
import payment.api.notice.Notice1363Request;
import payment.api.notice.Notice4522Request;
import payment.api.notice.NoticeRequest;
import payment.api.notice.NoticeResponse;
import payment.tools.util.Base64;
import com.alibaba.fastjson.JSONObject;
import com.websuites.core.response.IResult;
import com.websuites.core.response.Result;
import com.websuites.utils.LogUtil;
import com.kingdom.payment.inf.IDefineMsg;
import com.kingdom.payment.kesb.KesbBexTool;
import com.kingdom.payment.utils.CommonQuery;
import com.kingdom.payment.utils.UpdateCommon;
import com.kingdom.payment.utils.UtilTools;
/**
* 接收中金平台支付状态变更通知
* @author Raymond
*
*/
@Scope("prototype")
@Service("noticeMsgService")
public class ZJNoticeMsgService{
@Autowired
@Qualifier("payCommonQuery")
private CommonQuery commonQuery;
@Autowired
@Qualifier("payUpdateCommon")
private UpdateCommon updateCommon;
@SuppressWarnings({"rawtypes","unchecked"})
public IResult noticeMsg(HashMap mapParam){
IResult rs = new Result();
HashMap updPayAckMap = new HashMap();
try {
LogUtil.info("---------- Begin [ReceiveNotice] process......");
// 1 获得参数message和signature
String message = UtilTools.valueOf(mapParam.get("message"));
String signature = UtilTools.valueOf(mapParam.get("signature"));
//系统参数
String paytype = UtilTools.valueOf(mapParam.get("paytype"));
String channel = UtilTools.valueOf(mapParam.get("channel"));
String channelno = UtilTools.valueOf(mapParam.get("channelno"));
String sendflag = "1";//发起方向(0从内部发出,1从外不发出)
// 2 生成交易结果对象
NoticeRequest noticeRequest = new NoticeRequest(message, signature);
// 3 业务处理
if ("1318".equals(noticeRequest.getTxCode())) {
Notice1318Request nr = new Notice1318Request(noticeRequest.getDocument());
//判断应答流水是否重复
HashMap reqAckMap = new HashMap();
reqAckMap.put("paymentno", nr.getPaymentNo());
try {
IResult rsQuery = commonQuery.getPayAckCapital(reqAckMap);
if(!UtilTools.isNull(rsQuery)){
List<Map> list = (List<Map>) rsQuery.getResult();
if(list != null && list.size() > 0){
rs = UtilTools.makerResults(IDefineMsg.CODE_ERROR,
IDefineMsg.FAILE_QRY_ACK);
return rs;
}
}
} catch (Exception e) {
e.printStackTrace();
}
//三方支付应答流水
HashMap param = new HashMap();
param.put("paymentno", nr.getPaymentNo());
param.put("paychannel", channelno);
param.put("payversion", channel);
param.put("paytype", noticeRequest.getTxCode());
param.put("receivedata", noticeRequest.getPlainText());
param.put("sendflag", sendflag);
param.put("sendaddress", "");
param.put("orderno", "");
param.put("receivetime", nr.getBankNotificationTime());
param.put("amount", BigDecimal.valueOf(nr.getAmount()).divide(new BigDecimal(100)).toString());
param.put("status", nr.getStatus());
param.put("institutionid", nr.getInstitutionID());
if(updateCommon.addPayAckCapital(param)){
updPayAckMap.put("paymentno", nr.getPaymentNo());
updPayAckMap.put("specification", IDefineMsg.PAY_ACK_CAPITAL_STATUS_101);
updateCommon.updPayAckCapital(updPayAckMap);
LogUtil.info("[市场订单支付状态变更通知(1318)支付交易号:" + nr.getPaymentNo() + "应答日志写入成功]");
}else{
LogUtil.info("[市场订单支付状态变更通知(1318)支付交易号:" + nr.getPaymentNo() + "应答日志写入失败]");
}
HashMap reqAppMap = new HashMap();
reqAppMap.put("paymentno", nr.getPaymentNo());
String batchno = new String();
try {
IResult res = commonQuery.getAppCapital(reqAppMap);// 查询三方支付申请流水,返回资金流水号
if (res.isSuccessful()) {
List<Map> listMap = (List<Map>) res.getResult();
if (listMap != null && listMap.size() > 0) {
Map map = listMap.get(0);
batchno = UtilTools.valueOf(map.get("batchno"));
}
updPayAckMap.put("paymentno", nr.getPaymentNo());
updPayAckMap.put("specification", IDefineMsg.PAY_ACK_CAPITAL_STATUS_103+"【"+batchno+"】");
updateCommon.updPayAckCapital(updPayAckMap);
}else{
updPayAckMap.put("paymentno", nr.getPaymentNo());
updPayAckMap.put("specification", IDefineMsg.PAY_ACK_CAPITAL_STATUS_104);
updateCommon.updPayAckCapital(updPayAckMap);
rs = UtilTools.makerResults(IDefineMsg.CODE_ERROR,
IDefineMsg.NULL_QRY_APP);
return rs;
}
} catch (Exception e) {
e.printStackTrace();
updPayAckMap.put("paymentno", nr.getPaymentNo());
updPayAckMap.put("specification", IDefineMsg.PAY_ACK_CAPITAL_STATUS_104);
updateCommon.updPayAckCapital(updPayAckMap);
rs = UtilTools.makerResults(IDefineMsg.CODE_ERROR,
IDefineMsg.NULL_QRY_APP);
return rs;
}
if(20 == nr.getStatus()){
updPayAckMap.put("paymentno", nr.getPaymentNo());
updPayAckMap.put("specification", "105:中金支付订单支付成功");
updateCommon.updPayAckCapital(updPayAckMap);
}else{
updPayAckMap.put("paymentno", nr.getPaymentNo());
updPayAckMap.put("specification", "106:中金支付订单支付失败");
updateCommon.updPayAckCapital(updPayAckMap);
rs = UtilTools.makerResults(IDefineMsg.CODE_ERROR, "支付失败");
return rs;
}
if (20 == nr.getStatus()) {
//T+1结算给商户虚拟账户(珠海)
String amount = BigDecimal.valueOf(Long.valueOf(nr.getAmount()))
.divide(new BigDecimal(100)).toString();
HashMap reqClearMap = new HashMap();
reqClearMap.put("Amount", amount);
reqClearMap.put("AccountType", "20");
reqClearMap.put("BankID", "");
reqClearMap.put("AccountName", "");
reqClearMap.put("AccountNumber", "");
reqClearMap.put("BranchName", "");
reqClearMap.put("Province", "");
reqClearMap.put("City", "");
rs = KesbBexTool.doBex("api_set_order_clear_account", reqClearMap);
if(rs.isSuccessful()){
updPayAckMap.put("paymentno", nr.getPaymentNo());
updPayAckMap.put("specification", IDefineMsg.PAY_ACK_CAPITAL_STATUS_109
+"【订单结算接口:"+rs.getErrorMessage()+"】");
updateCommon.updPayAckCapital(updPayAckMap);
}else{
updPayAckMap.put("paymentno", nr.getPaymentNo());
updPayAckMap.put("specification", IDefineMsg.PAY_ACK_CAPITAL_STATUS_110
+"【订单结算接口:"+rs.getErrorMessage()+"】");
updateCommon.updPayAckCapital(updPayAckMap);
}
// TODO 商户订单处理
HashMap reqConfirmPay = new HashMap();
String Amount = BigDecimal.valueOf(Long.valueOf(nr.getAmount()))
.divide(new BigDecimal(100)).toString();
String transactioncfmdate = nr.getBankNotificationTime().substring(0, 8);
String transactioncfmtime = nr.getBankNotificationTime().substring(8, 14);
reqConfirmPay.put("batchno", batchno);
reqConfirmPay.put("transactioncfmdate", transactioncfmdate);
reqConfirmPay.put("transactioncfmtime", transactioncfmtime);
reqConfirmPay.put("taserialno", nr.getPaymentNo());
reqConfirmPay.put("confirmedamount", Amount);
rs = comfirmPayStatus(reqConfirmPay);// 通知资金网关确认支付
if(rs.isSuccessful()){
updPayAckMap.put("paymentno", nr.getPaymentNo());
updPayAckMap.put("specification", IDefineMsg.PAY_ACK_CAPITAL_STATUS_107
+"【kifp:"+rs.getErrorMessage()+"】");
updateCommon.updPayAckCapital(updPayAckMap);
}else{
updPayAckMap.put("paymentno", nr.getPaymentNo());
updPayAckMap.put("specification", IDefineMsg.PAY_ACK_CAPITAL_STATUS_108
+"【kifp:"+rs.getErrorMessage()+"】");
updateCommon.updPayAckCapital(updPayAckMap);
}
}
} else if ("1348".equals(noticeRequest.getTxCode())) {
Notice1348Request nr = new Notice1348Request(noticeRequest.getDocument());
HashMap reqMap = new HashMap();
String Amount = BigDecimal.valueOf(Long.valueOf(nr.getAmount()))
.divide(new BigDecimal(100)).toString();
//判断应答流水是否重复
HashMap reqAckMap = new HashMap();
reqAckMap.put("paymentno", nr.getSerialNumber());
try {
IResult rsQuery = commonQuery.getPayAckCapital(reqAckMap);
if(!UtilTools.isNull(rsQuery)){
List<Map> list = (List<Map>) rsQuery.getResult();
if(list != null && list.size() > 0){
String status = UtilTools.valueOf(list.get(0).get("status"));
if(status.equalsIgnoreCase("OK.") || status.equalsIgnoreCase("ERROR.")){
rs = UtilTools.makerResults(IDefineMsg.CODE_ERROR,
IDefineMsg.FAILE_QRY_ACK);
return rs;
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
LogUtil.info("[TxCode] = [1348]");
LogUtil.info("[TxName] = [市场订单结算状态变更通知]");
LogUtil.info("[InstitutionID]= [" + nr.getInstitutionID() + "]");
LogUtil.info("[OrderNo] = [" + nr.getOrderNo() + "]");
LogUtil.info("[SerialNumber] = [" + nr.getSerialNumber() + "]");
LogUtil.info("[Amount] = [" + nr.getAmount() + "]");
LogUtil.info("[Status] = [" + nr.getStatus() + "]");
LogUtil.info("[TransferTime] = [" + nr.getTransferTime() + "]");
if (40 == nr.getStatus()) {
//更新fms_applypay
reqMap.put("paymentno", nr.getSerialNumber());
reqMap.put("status", "5");
updateCommon.updFmsApplypay(reqMap);
//更新pay_ack_capital
updPayAckMap.put("paymentno", nr.getSerialNumber());
updPayAckMap.put("status", "OK.");
updPayAckMap.put("specification",
"103:订单金额【"+ Amount +"】已经结算");
updateCommon.updPayAckCapital(updPayAckMap);
List<Map> list = new ArrayList<Map>();
HashMap appMap = new HashMap();
appMap.put("paymentno", nr.getSerialNumber());
list = commonQuery.getApplyNo(appMap);
if(list != null && list.size() > 0){
String applyid = UtilTools.valueOf(list.get(0).get("applyid"));
appMap.put("applyid", applyid);
//变更提现状态
rs = callCapitalChange(appMap);
if(rs.isSuccessful()){
updPayAckMap.put("paymentno", nr.getOrderNo());
updPayAckMap.put("specification", "105:资金网关最终变动提现状态"
+"【kifp:"+rs.getErrorMessage()+"】");
updateCommon.updPayAckCapital(updPayAckMap);
}else{
updPayAckMap.put("paymentno", nr.getOrderNo());
updPayAckMap.put("specification", "106:资金网关最终变动提现状态失败"
+"【kifp:"+rs.getErrorMessage()+"】");
updateCommon.updPayAckCapital(updPayAckMap);
}
}
rs = UtilTools.makerResults(IDefineMsg.CODE_SUCCESS, "市场订单结算状态变更通知");
}
if (50 == nr.getStatus()) {
//更新fms_applypay
reqMap.put("paymentno", nr.getSerialNumber());
reqMap.put("status", "6");
updateCommon.updFmsApplypay(reqMap);
//更新pay_ack_capital
updPayAckMap.put("paymentno", nr.getSerialNumber());
updPayAckMap.put("status", "ERROR.");
updPayAckMap.put("specification", "104:订单结算结果异常【"+rs.getErrorMessage()+"】");
updateCommon.updPayAckCapital(updPayAckMap);
List<Map> list = new ArrayList<Map>();
HashMap appMap = new HashMap();
appMap.put("paymentno", nr.getSerialNumber());
list = commonQuery.getApplyNo(appMap);
if(list != null && list.size() > 0){
String applyid = UtilTools.valueOf(list.get(0).get("applyid"));
appMap.put("applyid", applyid);
//变更提现状态
rs = callCapitalChange(appMap);
if(rs.isSuccessful()){
updPayAckMap.put("paymentno", nr.getOrderNo());
updPayAckMap.put("specification", "105:资金网关最终变动提现状态"
+"【kifp:"+rs.getErrorMessage()+"】");
updateCommon.updPayAckCapital(updPayAckMap);
}else{
updPayAckMap.put("paymentno", nr.getOrderNo());
updPayAckMap.put("specification", "106:资金网关最终变动提现状态失败"
+"【kifp:"+rs.getErrorMessage()+"】");
updateCommon.updPayAckCapital(updPayAckMap);
}
}
rs = UtilTools.makerResults(IDefineMsg.CODE_SUCCESS, "市场订单结算状态变更通知");
}
}else if ("1363".equals(noticeRequest.getTxCode())) {
Notice1363Request nr = new Notice1363Request(noticeRequest.getDocument());
LogUtil.info("[TxName] = [单笔代收结果通知]");
LogUtil.info("[TxCode] = [1363]");
LogUtil.info("[InstitutionID]= [" + nr.getInstitutionID() + "]");
LogUtil.info("[TxSN] = [" + nr.getTxSN() + "]");
LogUtil.info("[OrderNo] = [" + nr.getOrderNo() + "]");
LogUtil.info("[Amount] = [" + nr.getAmount() + "]");
LogUtil.info("[Status] = [" + nr.getStatus() + "]");
LogUtil.info("[BankTxTime] = [" + nr.getBankTxTime() + "]");
LogUtil.info("[ResponseCode] = [" + nr.getResponseCode() + "]");
LogUtil.info("[ResponseMessage] = [" + nr.getResponseMessage() + "]");
if (30 == nr.getStatus() || 40 == nr.getStatus()) {
LogUtil.info("receive 1363 notification success");
rs = UtilTools.makerResults(IDefineMsg.CODE_SUCCESS, "单笔代收结果通知");
}
}else if ("4522".equals(noticeRequest.getTxCode())) {
Notice4522Request nr = new Notice4522Request(noticeRequest.getDocument());
LogUtil.info("[TxCode] = [4522]");
LogUtil.info("[TxName] = [机构支付账户网银充值成功通知]");
LogUtil.info("[InstitutionID]=[" + nr.getInstitutionID() + "]");
LogUtil.info("[PaymentAccountName]=[" + nr.getPaymentAccountName() + "]");
LogUtil.info("[PaymentAccountNumber]=[" + nr.getPaymentAccountNumber() + "]");
LogUtil.info("[Amount]=[" + nr.getAmount() + "]");
LogUtil.info("[BankTxTime]=[" + nr.getBankTxTime() + "]");
LogUtil.info("[PaymentNo]=[" + nr.getPaymentNo() + "]");
LogUtil.info("[Remark]=[" + nr.getRemark() + "]");
LogUtil.info("[Status]=[" + nr.getStatus() + "]");
//判断应答流水是否重复
HashMap reqAckMap = new HashMap();
reqAckMap.put("paymentno", nr.getPaymentNo());
try {
IResult rsQuery = commonQuery.getPayAckCapital(reqAckMap);
if(!UtilTools.isNull(rsQuery)){
List<Map> list = (List<Map>) rsQuery.getResult();
if(list != null && list.size() > 0){
rs = UtilTools.makerResults(IDefineMsg.CODE_ERROR,
IDefineMsg.FAILE_QRY_ACK);
return rs;
}
}
} catch (Exception e) {
e.printStackTrace();
}
//三方支付应答流水
HashMap param = new HashMap();
param.put("paymentno", nr.getPaymentNo());
param.put("paychannel", channelno);
param.put("payversion", channel);
param.put("paytype", noticeRequest.getTxCode());
param.put("receivedata", noticeRequest.getPlainText());
param.put("sendflag", sendflag);
param.put("sendaddress", "");
param.put("orderno", "");
param.put("receivetime", nr.getBankTxTime());
param.put("amount", BigDecimal.valueOf(nr.getAmount()).divide(new BigDecimal(100)).toString());
param.put("status", nr.getStatus());
param.put("institutionid", nr.getInstitutionID());
if(updateCommon.addPayAckCapital(param)){
updPayAckMap.put("paymentno", nr.getPaymentNo());
updPayAckMap.put("specification", IDefineMsg.PAY_ACK_CAPITAL_STATUS_101);
updateCommon.updPayAckCapital(updPayAckMap);
LogUtil.info("[机构支付账户网银充值成功通知(4522)支付交易号:" + nr.getPaymentNo() + "应答日志写入成功]");
}else{
LogUtil.info("[机构支付账户网银充值成功通知(4522)支付交易号:" + nr.getPaymentNo() + "应答日志写入失败]");
}
HashMap reqAppMap = new HashMap();
reqAppMap.put("paymentno", nr.getPaymentNo());
String batchno = new String();
try {
IResult res = commonQuery.getAppCapital(reqAppMap);// 查询三方支付申请流水,返回资金流水号
if (res.isSuccessful()) {
List<Map> listMap = (List<Map>) res.getResult();
if (listMap != null && listMap.size() > 0) {
Map map = listMap.get(0);
batchno = UtilTools.valueOf(map.get("batchno"));
}
updPayAckMap.put("paymentno", nr.getPaymentNo());
updPayAckMap.put("specification", IDefineMsg.PAY_ACK_CAPITAL_STATUS_103+"【"+batchno+"】");
updateCommon.updPayAckCapital(updPayAckMap);
}else{
updPayAckMap.put("paymentno", nr.getPaymentNo());
updPayAckMap.put("specification", IDefineMsg.PAY_ACK_CAPITAL_STATUS_104);
updateCommon.updPayAckCapital(updPayAckMap);
rs = UtilTools.makerResults(IDefineMsg.CODE_ERROR,
IDefineMsg.NULL_QRY_APP);
return rs;
}
} catch (Exception e) {
e.printStackTrace();
updPayAckMap.put("paymentno", nr.getPaymentNo());
updPayAckMap.put("specification", IDefineMsg.PAY_ACK_CAPITAL_STATUS_104);
updateCommon.updPayAckCapital(updPayAckMap);
rs = UtilTools.makerResults(IDefineMsg.CODE_ERROR,
IDefineMsg.NULL_QRY_APP);
return rs;
}
if(20 == nr.getStatus()){
updPayAckMap.put("paymentno", nr.getPaymentNo());
updPayAckMap.put("specification", "105:中金支付订单支付成功");
updateCommon.updPayAckCapital(updPayAckMap);
}else{
updPayAckMap.put("paymentno", nr.getPaymentNo());
updPayAckMap.put("specification", "106:中金支付订单支付失败");
updateCommon.updPayAckCapital(updPayAckMap);
rs = UtilTools.makerResults(IDefineMsg.CODE_ERROR, "支付失败");
return rs;
}
if (20 == nr.getStatus()) {
// TODO 商户订单处理
HashMap reqConfirmPay = new HashMap();
String Amount = BigDecimal.valueOf(Long.valueOf(nr.getAmount()))
.divide(new BigDecimal(100)).toString();
String transactioncfmdate = nr.getBankTxTime().substring(0, 8);
String transactioncfmtime = nr.getBankTxTime().substring(8, 14);
reqConfirmPay.put("batchno", batchno);
reqConfirmPay.put("transactioncfmdate", transactioncfmdate);
reqConfirmPay.put("transactioncfmtime", transactioncfmtime);
reqConfirmPay.put("taserialno", nr.getPaymentNo());
reqConfirmPay.put("confirmedamount", Amount);
rs = comfirmPayStatus(reqConfirmPay);// 通知资金网关确认支付
if(rs.isSuccessful()){
updPayAckMap.put("paymentno", nr.getPaymentNo());
updPayAckMap.put("specification", IDefineMsg.PAY_ACK_CAPITAL_STATUS_107
+"【kifp:"+rs.getErrorMessage()+"】");
updateCommon.updPayAckCapital(updPayAckMap);
}else{
updPayAckMap.put("paymentno", nr.getPaymentNo());
updPayAckMap.put("specification", IDefineMsg.PAY_ACK_CAPITAL_STATUS_108
+"【kifp:"+rs.getErrorMessage()+"】");
updateCommon.updPayAckCapital(updPayAckMap);
}
}
} else {
LogUtil.info("!!! 错误的通知 !!!");
LogUtil.info("[txCode] = [????]");
LogUtil.info("[txName] = [未知通知类型]");
rs = UtilTools.makerResults(IDefineMsg.CODE_ERROR, "错误的通知");
}
// 4 响应支付平台 特别说明:为避免重复发通知,必须要求商户给予响应,响应的内容是固定的new String(Base64.encode(new NoticeResponse().getMessage().getBytes("UTF-8")));
String xmlString = new NoticeResponse().getMessage();
String base64String = new String(Base64.encode(xmlString.getBytes("UTF-8")));
rs = UtilTools.makerResults(rs, "base64String", base64String);
LogUtil.info("---------- End [ReceiveNotice] process.");
} catch (Exception e) {
e.printStackTrace();
rs = UtilTools.makerResults(IDefineMsg.CODE_ERROR, "后台通知状态变更异常");
}
return rs;
}
@SuppressWarnings({ "rawtypes","unchecked" })
private IResult comfirmPayStatus(HashMap mapParam) {
IResult rs = new Result();
mapParam.put("kifpbexid", "api_confirm_pay_status");
rs = KesbBexTool.doCommonKifpBex(mapParam);
if(rs.isSuccessful()){
rs = UtilTools.makerResults(IDefineMsg.CODE_SUCCESS, rs.getErrorMessage());
}else{
rs = UtilTools.makerResults(IDefineMsg.CODE_ERROR, rs.getErrorMessage());
}
return rs;
}
/**
* 最终变更提现状态(直接调kifp接口)
* @param mapParam
* @return
*/
@SuppressWarnings({ "rawtypes","unchecked","unused" })
private IResult callCapitalChange(HashMap mapParam) {
IResult rs = new Result();
mapParam.put("kifpbexid", "api_capital_change_for_paycent");
rs = KesbBexTool.doCommonKifpBex(mapParam);
if(rs.isSuccessful()){
rs = UtilTools.makerResults(IDefineMsg.CODE_SUCCESS, rs.getErrorMessage());
}else{
rs = UtilTools.makerResults(IDefineMsg.CODE_ERROR, rs.getErrorMessage());
}
return rs;
}
}
| 24,359 | 0.592829 | 0.581382 | 528 | 41.844696 | 25.297594 | 137 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.744318 | false | false |
1
|
f1afbe08bd1d6a2fb8a48bb8e953c01d6e6f1242
| 13,683,765,818,992 |
853066d0342b8a173c37c870ca664148ad0562c9
|
/app/src/main/java/com/starrynight/tourapiproject/alarmPage/Alarm.java
|
84c01e23530856415cea38d59cb5ded4cec5e10a
|
[] |
no_license
|
sein0211/AndroidApp
|
https://github.com/sein0211/AndroidApp
|
8f389e6870272b12feab36cce8c0cf70f03c5c41
|
b3716308e5cf3feeb9fefd2e8450ee1ad9375f99
|
refs/heads/master
| 2023-08-29T21:13:35.969000 | 2021-10-24T08:47:33 | 2021-10-24T08:47:33 | 384,373,417 | 0 | 0 | null | true | 2021-07-09T08:32:15 | 2021-07-09T08:32:14 | 2021-07-09T08:25:39 | 2021-07-08T08:13:26 | 2,305 | 0 | 0 | 0 | null | false | false |
package com.starrynight.tourapiproject.alarmPage;
import com.google.gson.annotations.SerializedName;
public class Alarm {
@SerializedName("alarmTitle")
private String alarmTitle;
@SerializedName("yearDate")
private String yearDate;
@SerializedName("alarmContent")
private String alarmContent;
public Alarm() {
}
public String getAlarmTitle() {
return alarmTitle;
}
public void setAlarmTitle(String alarmTitle) {
this.alarmTitle = alarmTitle;
}
public String getYearDate() {
return yearDate;
}
public void setYearDate(String yearDate) {
this.yearDate = yearDate;
}
public String getAlarmContent() {
return alarmContent;
}
public void setAlarmContent(String alarmContent) {
this.alarmContent = alarmContent;
}
public Alarm(String alarmTitle, String yearDate, String alarmContent) {
this.alarmTitle = alarmTitle;
this.yearDate = yearDate;
this.alarmContent = alarmContent;
}
}
|
UTF-8
|
Java
| 1,044 |
java
|
Alarm.java
|
Java
|
[] | null |
[] |
package com.starrynight.tourapiproject.alarmPage;
import com.google.gson.annotations.SerializedName;
public class Alarm {
@SerializedName("alarmTitle")
private String alarmTitle;
@SerializedName("yearDate")
private String yearDate;
@SerializedName("alarmContent")
private String alarmContent;
public Alarm() {
}
public String getAlarmTitle() {
return alarmTitle;
}
public void setAlarmTitle(String alarmTitle) {
this.alarmTitle = alarmTitle;
}
public String getYearDate() {
return yearDate;
}
public void setYearDate(String yearDate) {
this.yearDate = yearDate;
}
public String getAlarmContent() {
return alarmContent;
}
public void setAlarmContent(String alarmContent) {
this.alarmContent = alarmContent;
}
public Alarm(String alarmTitle, String yearDate, String alarmContent) {
this.alarmTitle = alarmTitle;
this.yearDate = yearDate;
this.alarmContent = alarmContent;
}
}
| 1,044 | 0.66954 | 0.66954 | 45 | 22.200001 | 19.356997 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.355556 | false | false |
1
|
22be07578b06ead031e468994098590b96e8fe3a
| 31,138,512,901,216 |
7b86353764a09390e807322c451ed5f99c50c2dc
|
/app/src/main/java/com/amator/store/base/Constants.java
|
0adff6c6d45eeb29490c38985daf45be0a0805b1
|
[] |
no_license
|
AmatorLee/Store
|
https://github.com/AmatorLee/Store
|
d402673f845c3dd316f26d921bcfe2f6b6d2efc1
|
a404f68d7fb2c2f9a3accbd57cc2dbacacf5bb87
|
refs/heads/master
| 2021-08-19T00:21:24.580000 | 2017-11-24T09:58:54 | 2017-11-24T09:58:54 | 111,823,745 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.amator.store.base;
import android.app.Activity;
/**
* Created by AmatorLee on 2017/11/23.
* 声明静态常量类
*/
public interface Constants {
String APPLICATION = "Application";
String ACTIVITY = "Activity";
String BASE_URL = "";
int HTTP_EX = 1001;/**网络错误等*/
int PARSE_EX = 1002;/**解析错误等*/
int UNKONWN_EX = 1004;/**未知错误*/
int SERVER_EX = 1005;/**服务器错误*/
/***
* BaseUrl
*/
String baseUrl = "http://112.124.22.238:8081/appstore/";
}
|
UTF-8
|
Java
| 540 |
java
|
Constants.java
|
Java
|
[
{
"context": ";\n\nimport android.app.Activity;\n\n/**\n * Created by AmatorLee on 2017/11/23.\n * 声明静态常量类\n */\n\npublic interface C",
"end": 89,
"score": 0.9300462007522583,
"start": 80,
"tag": "USERNAME",
"value": "AmatorLee"
},
{
"context": " * BaseUrl\n */\n String baseUrl = \"http://112.124.22.238:8081/appstore/\";\n}\n",
"end": 468,
"score": 0.9995649456977844,
"start": 454,
"tag": "IP_ADDRESS",
"value": "112.124.22.238"
}
] | null |
[] |
package com.amator.store.base;
import android.app.Activity;
/**
* Created by AmatorLee on 2017/11/23.
* 声明静态常量类
*/
public interface Constants {
String APPLICATION = "Application";
String ACTIVITY = "Activity";
String BASE_URL = "";
int HTTP_EX = 1001;/**网络错误等*/
int PARSE_EX = 1002;/**解析错误等*/
int UNKONWN_EX = 1004;/**未知错误*/
int SERVER_EX = 1005;/**服务器错误*/
/***
* BaseUrl
*/
String baseUrl = "http://172.16.58.3:8081/appstore/";
}
| 537 | 0.604508 | 0.52459 | 23 | 20.217392 | 16.926842 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.434783 | false | false |
1
|
7e055c5c2e77e20c4d92aa5809d072d20abfbe16
| 31,138,512,902,906 |
5f812edd56d3c7413c7961251895766fefe99b45
|
/src/main/java/com/skye8/elroykanye/hyrrebus/api/dto/BusDto.java
|
1c48a79ab22c862dd3fa6902e03ebb3c5eb323dd
|
[] |
no_license
|
Burnleydev1/hyrre-bus-sb
|
https://github.com/Burnleydev1/hyrre-bus-sb
|
1ec6ec574f22094abec631599491e86a9c404540
|
29bb9a69662a2b345d4ce8d96675fa23064c128e
|
refs/heads/main
| 2023-08-27T09:46:34.917000 | 2021-11-11T10:38:46 | 2021-11-11T10:38:46 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.skye8.elroykanye.hyrrebus.api.dto;
import com.skye8.elroykanye.hyrrebus.data.entity.Agency;
import com.skye8.elroykanye.hyrrebus.data.entity.enums.BusType;
import lombok.*;
/**
* @author Elroy Kanye
* created on: 06-11-21
*/
@Getter
@Setter
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class BusDto {
private Long busId;
private String busName;
private String plateNumber;
private Long busNumber;
private Integer busCapacity;
private Integer numberOfRows;
private Integer numberOfColumns;
private BusType busType;
}
|
UTF-8
|
Java
| 578 |
java
|
BusDto.java
|
Java
|
[
{
"context": "ty.enums.BusType;\nimport lombok.*;\n\n/**\n * @author Elroy Kanye\n * created on: 06-11-21\n */\n\n@Getter\n@Setter\n@Bui",
"end": 213,
"score": 0.9998981356620789,
"start": 202,
"tag": "NAME",
"value": "Elroy Kanye"
}
] | null |
[] |
package com.skye8.elroykanye.hyrrebus.api.dto;
import com.skye8.elroykanye.hyrrebus.data.entity.Agency;
import com.skye8.elroykanye.hyrrebus.data.entity.enums.BusType;
import lombok.*;
/**
* @author <NAME>
* created on: 06-11-21
*/
@Getter
@Setter
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class BusDto {
private Long busId;
private String busName;
private String plateNumber;
private Long busNumber;
private Integer busCapacity;
private Integer numberOfRows;
private Integer numberOfColumns;
private BusType busType;
}
| 573 | 0.754325 | 0.738754 | 28 | 19.642857 | 17.04451 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false |
1
|
459e6bcf75f67ad16811e7cbcb431fe07dc9aea8
| 31,138,512,901,835 |
4593b245898a1abd293460778a5525380bd7521e
|
/Pizzaria/src/pizzaria/Pizzaria.java
|
dd07b229a8fa5e1b92fa4926f77b60fc1cfca3a1
|
[] |
no_license
|
4pboss/pizzaria1
|
https://github.com/4pboss/pizzaria1
|
c2aeccf11411cd6d276c09879c973de9e683ec67
|
76dbefc93c24d7c44865e1ddb6457edec32cd74b
|
refs/heads/master
| 2020-03-27T22:48:38.471000 | 2018-09-03T21:47:38 | 2018-09-03T21:47:38 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package pizzaria;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import java.text.DecimalFormat;
import javax.swing.*;
import javax.swing.border.*;
public class Pizzaria extends JFrame implements ActionListener {
private static final long serialVersionUID = 1L;
private JPanel fundo1;
public String pepperoni;
public String mussarela;
public String supreme;
double valor = 0;
double valorAdicionais = 0;
double valorTotalGlobal = 0;
String[] sabores = new String[] { "Pepperoni", "Mussarela", "Supreme" };
public void calcularTotal() {
double valorTotal = valor + valorAdicionais;
valorTotalGlobal = valorTotal;
}
private BufferedImage applyAlpha(BufferedImage pb, float alpha) {
BufferedImage img = new BufferedImage(pb.getWidth(), pb.getHeight(), BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = (Graphics2D) img.getGraphics().create();
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha));
g2.drawImage(pb, 0, 0, null);
g2.dispose();
return img;
}
public Pizzaria() {
setFont(new Font("Freestyle Script", Font.ITALIC, 18));
setTitle("Pizzaria do Z\u00E9");
setForeground(Color.RED);
setBackground(Color.RED);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 584, 500);
fundo1 = new JPanel();
fundo1.setBackground(Color.BLACK);
fundo1.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(fundo1);
fundo1.setLayout(null);
// label
JLabel lbImagePizza = new JLabel("");
lbImagePizza.setIcon(
new ImageIcon("C:\\Users\\unip\\Desktop\\PizzariaGit\\Pizzaria\\src\\pizzaria\\topo_logoOpp.png"));
lbImagePizza.setBounds(36, 453, 478, 315);
fundo1.add(lbImagePizza);
JLabel lbPedidos = new JLabel("Pedidos :");
lbPedidos.setFont(new Font("Tahoma", Font.BOLD, 20));
lbPedidos.setForeground(Color.WHITE);
lbPedidos.setBounds(207, 13, 106, 16);
fundo1.add(lbPedidos);
JLabel lbAdicionais = new JLabel("Adicionais :");
lbAdicionais.setForeground(Color.WHITE);
lbAdicionais.setBounds(409, 34, 73, 16);
fundo1.add(lbAdicionais);
JLabel lbSabor = new JLabel("Sabor");
lbSabor.setForeground(Color.WHITE);
lbSabor.setBounds(84, 46, 37, 16);
fundo1.add(lbSabor);
JLabel lbQnt = new JLabel("Qnt");
lbQnt.setForeground(Color.WHITE);
lbQnt.setBounds(194, 46, 34, 16);
fundo1.add(lbQnt);
JLabel lbTipo = new JLabel("Tipo");
lbTipo.setForeground(Color.WHITE);
lbTipo.setBounds(84, 98, 37, 16);
fundo1.add(lbTipo);
JLabel lbTamanho = new JLabel("Tamanho");
lbTamanho.setForeground(Color.WHITE);
lbTamanho.setBounds(84, 154, 56, 16);
fundo1.add(lbTamanho);
JTextArea carrinho = new JTextArea();
carrinho.setBounds(84, 270, 345, 121);
fundo1.add(carrinho);
JSpinner qntPizza = new JSpinner();
qntPizza.setBounds(191, 63, 37, 22);
fundo1.add(qntPizza);
JComboBox listaSabores = new JComboBox(sabores);
listaSabores.addActionListener(this);
listaSabores.setBounds(84, 63, 106, 22);
fundo1.add(listaSabores);
JRadioButton rbInteira = new JRadioButton("Inteira");
rbInteira.setBounds(84, 120, 70, 25);
fundo1.add(rbInteira);
JRadioButton rbMeia = new JRadioButton("1/2");
rbMeia.setBounds(158, 120, 70, 25);
fundo1.add(rbMeia);
JRadioButton rbIndividual = new JRadioButton("Individual");
rbIndividual.setBounds(84, 177, 89, 25);
fundo1.add(rbIndividual);
JRadioButton rbRegular = new JRadioButton("Regular");
rbRegular.setBounds(177, 177, 73, 25);
fundo1.add(rbRegular);
JRadioButton rbFamilia = new JRadioButton("Familia");
rbFamilia.setBounds(254, 177, 70, 25);
fundo1.add(rbFamilia);
JCheckBox checkBacon = new JCheckBox("Bacon");
checkBacon.setBounds(386, 60, 113, 25);
fundo1.add(checkBacon);
JCheckBox checkCebola = new JCheckBox("Cebola");
checkCebola.setBounds(386, 90, 113, 25);
fundo1.add(checkCebola);
JCheckBox checkChampignon = new JCheckBox("Champignon");
checkChampignon.setBounds(386, 120, 113, 25);
fundo1.add(checkChampignon);
JCheckBox checkTomate = new JCheckBox("Tomate");
checkTomate.setBounds(386, 150, 113, 25);
fundo1.add(checkTomate);
JCheckBox checkCatupiry = new JCheckBox("Catupiry");
checkCatupiry.setBounds(386, 180, 113, 25);
fundo1.add(checkCatupiry);
JCheckBox checkPresunto = new JCheckBox("Presunto");
checkPresunto.setBounds(386, 210, 113, 25);
fundo1.add(checkPresunto);
JScrollBar scrollBar = new JScrollBar();
scrollBar.setBounds(430, 270, 21, 121);
fundo1.add(scrollBar);
JSlider slider = new JSlider();
slider.setBounds(84, 393, 367, 9);
fundo1.add(slider);
JButton adicionarCarrinho = new JButton("Adicionar ao Carrinho");
adicionarCarrinho.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent c) {
DecimalFormat df = new DecimalFormat("0.00");
double valorPepperoniI = 15.00, valorMussarelaI = 12.00, valorSupremeI = 17.00;
double valorPepperoniR = 27.00, valorMussarelaR = 21.60, valorSupremeR = 30.60;
double valorPepperoniF = 33.00, valorMussarelaF = 26.40, valorSupremeF = 37.40;
double valorBacon = 2.00, valorCebola = 1.50, valorChampignon = 2.50, valorTomate = 1.50,
valorCatupiry = 3.00, valorPresunto = 2.50;
String tipo = "";
String tamanho = "";
String adicionais = "";
double valor = 0;
double valorAdicionais = 0;
Integer quantidade = (Integer) qntPizza.getValue();
if (rbInteira.isSelected()) {
tipo = "Inteira";
} else if (rbMeia.isSelected())
tipo = "Meio a Meio";
if (rbIndividual.isSelected()) {
tamanho = "Individual";
if (listaSabores.getSelectedIndex() == 0) {
valor = valorPepperoniI;
} else if (listaSabores.getSelectedIndex() == 1) {
valor = valorMussarelaI;
} else if (listaSabores.getSelectedIndex() == 2) {
valor = valorSupremeI;
}
}
if (rbRegular.isSelected()) {
tamanho = "Regular";
if (listaSabores.getSelectedIndex() == 0) {
valor = valorPepperoniR;
} else if (listaSabores.getSelectedIndex() == 1) {
valor = valorMussarelaR;
} else if (listaSabores.getSelectedIndex() == 2) {
valor = valorSupremeR;
}
}
if (rbFamilia.isSelected()) {
tamanho = "Familia";
if (listaSabores.getSelectedIndex() == 0) {
valor = valorPepperoniF;
} else if (listaSabores.getSelectedIndex() == 1) {
valor = valorMussarelaF;
} else if (listaSabores.getSelectedIndex() == 2) {
valor = valorSupremeF;
}
}
/*
* if (rbIndividual.isSelected() && rbRegular.isSelected())
* carrinho.setText("\nVoce não pode ter 2 tamanhos diferentes de pizza"); if
* (rbIndividual.isSelected() && rbFamilia.isSelected())
* carrinho.setText("\nVoce não pode ter 2 tamanhos diferentes de pizza"); if
* (rbRegular.isSelected() && rbIndividual.isSelected())
* carrinho.setText("\nVoce não pode ter 2 tamanhos diferentes de pizza"); if
* (rbRegular.isSelected() && rbFamilia.isSelected())
* carrinho.setText("\nVoce não pode ter 2 tamanhos diferentes de pizza"); if
* (rbFamilia.isSelected() && rbIndividual.isSelected())
* carrinho.setText("\nVoce não pode ter 2 tamanhos diferentes de pizza"); if
* (rbFamilia.isSelected() && rbRegular.isSelected())
* carrinho.setText("\nVoce não pode ter 2 tamanhos diferentes de pizza");
*/
if (checkBacon.isSelected()) {
adicionais = "Bacon";
valorAdicionais = valorBacon;
} else if (checkCebola.isSelected()) {
adicionais = "Cebola";
valorAdicionais = valorCebola;
} else if (checkChampignon.isSelected()) {
adicionais = "Champignon";
valorAdicionais = valorChampignon;
} else if (checkTomate.isSelected()) {
adicionais = "Tomate";
valorAdicionais = valorTomate;
} else if (checkCatupiry.isSelected()) {
adicionais = "Catupiry";
valorAdicionais = valorCatupiry;
} else if (checkPresunto.isSelected()) {
adicionais = "Presunto";
valorAdicionais = valorPresunto;
}
carrinho.setText("\nQuantidade: " + quantidade + "\nTipo: " + tipo + "\nSabor: "
+ listaSabores.getSelectedItem() + "\nTamanho: " + tamanho + "\tValor: R$" + df.format(valor)
+ "\nAdicionais: " + adicionais + "\tValor: R$" + df.format(valorAdicionais));
}
});
adicionarCarrinho.setBounds(179, 232, 160, 25);
fundo1.add(adicionarCarrinho);
adicionarCarrinho.setOpaque(false);
JButton confirmarPedido = new JButton("Confirmar Pedido");
confirmarPedido.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent cf) {
double valorTotal = valor + valorAdicionais;
// carrinho.setText();
}
});
confirmarPedido.setBounds(177, 415, 162, 25);
fundo1.add(confirmarPedido);
}
@Override
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
}
}
|
ISO-8859-1
|
Java
| 9,163 |
java
|
Pizzaria.java
|
Java
|
[
{
"context": "\n\tString[] sabores = new String[] { \"Pepperoni\", \"Mussarela\", \"Supreme\" };\r\n\r\n\tpublic void calcularTotal",
"end": 558,
"score": 0.6854761838912964,
"start": 554,
"tag": "NAME",
"value": "Muss"
},
{
"context": "magePizza.setIcon(\r\n\t\t\t\tnew ImageIcon(\"C:\\\\Users\\\\unip\\\\Desktop\\\\PizzariaGit\\\\Pizzaria\\\\src\\\\pizzaria\\\\t",
"end": 1631,
"score": 0.7291353940963745,
"start": 1627,
"tag": "NAME",
"value": "unip"
}
] | null |
[] |
package pizzaria;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import java.text.DecimalFormat;
import javax.swing.*;
import javax.swing.border.*;
public class Pizzaria extends JFrame implements ActionListener {
private static final long serialVersionUID = 1L;
private JPanel fundo1;
public String pepperoni;
public String mussarela;
public String supreme;
double valor = 0;
double valorAdicionais = 0;
double valorTotalGlobal = 0;
String[] sabores = new String[] { "Pepperoni", "Mussarela", "Supreme" };
public void calcularTotal() {
double valorTotal = valor + valorAdicionais;
valorTotalGlobal = valorTotal;
}
private BufferedImage applyAlpha(BufferedImage pb, float alpha) {
BufferedImage img = new BufferedImage(pb.getWidth(), pb.getHeight(), BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = (Graphics2D) img.getGraphics().create();
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha));
g2.drawImage(pb, 0, 0, null);
g2.dispose();
return img;
}
public Pizzaria() {
setFont(new Font("Freestyle Script", Font.ITALIC, 18));
setTitle("Pizzaria do Z\u00E9");
setForeground(Color.RED);
setBackground(Color.RED);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 584, 500);
fundo1 = new JPanel();
fundo1.setBackground(Color.BLACK);
fundo1.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(fundo1);
fundo1.setLayout(null);
// label
JLabel lbImagePizza = new JLabel("");
lbImagePizza.setIcon(
new ImageIcon("C:\\Users\\unip\\Desktop\\PizzariaGit\\Pizzaria\\src\\pizzaria\\topo_logoOpp.png"));
lbImagePizza.setBounds(36, 453, 478, 315);
fundo1.add(lbImagePizza);
JLabel lbPedidos = new JLabel("Pedidos :");
lbPedidos.setFont(new Font("Tahoma", Font.BOLD, 20));
lbPedidos.setForeground(Color.WHITE);
lbPedidos.setBounds(207, 13, 106, 16);
fundo1.add(lbPedidos);
JLabel lbAdicionais = new JLabel("Adicionais :");
lbAdicionais.setForeground(Color.WHITE);
lbAdicionais.setBounds(409, 34, 73, 16);
fundo1.add(lbAdicionais);
JLabel lbSabor = new JLabel("Sabor");
lbSabor.setForeground(Color.WHITE);
lbSabor.setBounds(84, 46, 37, 16);
fundo1.add(lbSabor);
JLabel lbQnt = new JLabel("Qnt");
lbQnt.setForeground(Color.WHITE);
lbQnt.setBounds(194, 46, 34, 16);
fundo1.add(lbQnt);
JLabel lbTipo = new JLabel("Tipo");
lbTipo.setForeground(Color.WHITE);
lbTipo.setBounds(84, 98, 37, 16);
fundo1.add(lbTipo);
JLabel lbTamanho = new JLabel("Tamanho");
lbTamanho.setForeground(Color.WHITE);
lbTamanho.setBounds(84, 154, 56, 16);
fundo1.add(lbTamanho);
JTextArea carrinho = new JTextArea();
carrinho.setBounds(84, 270, 345, 121);
fundo1.add(carrinho);
JSpinner qntPizza = new JSpinner();
qntPizza.setBounds(191, 63, 37, 22);
fundo1.add(qntPizza);
JComboBox listaSabores = new JComboBox(sabores);
listaSabores.addActionListener(this);
listaSabores.setBounds(84, 63, 106, 22);
fundo1.add(listaSabores);
JRadioButton rbInteira = new JRadioButton("Inteira");
rbInteira.setBounds(84, 120, 70, 25);
fundo1.add(rbInteira);
JRadioButton rbMeia = new JRadioButton("1/2");
rbMeia.setBounds(158, 120, 70, 25);
fundo1.add(rbMeia);
JRadioButton rbIndividual = new JRadioButton("Individual");
rbIndividual.setBounds(84, 177, 89, 25);
fundo1.add(rbIndividual);
JRadioButton rbRegular = new JRadioButton("Regular");
rbRegular.setBounds(177, 177, 73, 25);
fundo1.add(rbRegular);
JRadioButton rbFamilia = new JRadioButton("Familia");
rbFamilia.setBounds(254, 177, 70, 25);
fundo1.add(rbFamilia);
JCheckBox checkBacon = new JCheckBox("Bacon");
checkBacon.setBounds(386, 60, 113, 25);
fundo1.add(checkBacon);
JCheckBox checkCebola = new JCheckBox("Cebola");
checkCebola.setBounds(386, 90, 113, 25);
fundo1.add(checkCebola);
JCheckBox checkChampignon = new JCheckBox("Champignon");
checkChampignon.setBounds(386, 120, 113, 25);
fundo1.add(checkChampignon);
JCheckBox checkTomate = new JCheckBox("Tomate");
checkTomate.setBounds(386, 150, 113, 25);
fundo1.add(checkTomate);
JCheckBox checkCatupiry = new JCheckBox("Catupiry");
checkCatupiry.setBounds(386, 180, 113, 25);
fundo1.add(checkCatupiry);
JCheckBox checkPresunto = new JCheckBox("Presunto");
checkPresunto.setBounds(386, 210, 113, 25);
fundo1.add(checkPresunto);
JScrollBar scrollBar = new JScrollBar();
scrollBar.setBounds(430, 270, 21, 121);
fundo1.add(scrollBar);
JSlider slider = new JSlider();
slider.setBounds(84, 393, 367, 9);
fundo1.add(slider);
JButton adicionarCarrinho = new JButton("Adicionar ao Carrinho");
adicionarCarrinho.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent c) {
DecimalFormat df = new DecimalFormat("0.00");
double valorPepperoniI = 15.00, valorMussarelaI = 12.00, valorSupremeI = 17.00;
double valorPepperoniR = 27.00, valorMussarelaR = 21.60, valorSupremeR = 30.60;
double valorPepperoniF = 33.00, valorMussarelaF = 26.40, valorSupremeF = 37.40;
double valorBacon = 2.00, valorCebola = 1.50, valorChampignon = 2.50, valorTomate = 1.50,
valorCatupiry = 3.00, valorPresunto = 2.50;
String tipo = "";
String tamanho = "";
String adicionais = "";
double valor = 0;
double valorAdicionais = 0;
Integer quantidade = (Integer) qntPizza.getValue();
if (rbInteira.isSelected()) {
tipo = "Inteira";
} else if (rbMeia.isSelected())
tipo = "Meio a Meio";
if (rbIndividual.isSelected()) {
tamanho = "Individual";
if (listaSabores.getSelectedIndex() == 0) {
valor = valorPepperoniI;
} else if (listaSabores.getSelectedIndex() == 1) {
valor = valorMussarelaI;
} else if (listaSabores.getSelectedIndex() == 2) {
valor = valorSupremeI;
}
}
if (rbRegular.isSelected()) {
tamanho = "Regular";
if (listaSabores.getSelectedIndex() == 0) {
valor = valorPepperoniR;
} else if (listaSabores.getSelectedIndex() == 1) {
valor = valorMussarelaR;
} else if (listaSabores.getSelectedIndex() == 2) {
valor = valorSupremeR;
}
}
if (rbFamilia.isSelected()) {
tamanho = "Familia";
if (listaSabores.getSelectedIndex() == 0) {
valor = valorPepperoniF;
} else if (listaSabores.getSelectedIndex() == 1) {
valor = valorMussarelaF;
} else if (listaSabores.getSelectedIndex() == 2) {
valor = valorSupremeF;
}
}
/*
* if (rbIndividual.isSelected() && rbRegular.isSelected())
* carrinho.setText("\nVoce não pode ter 2 tamanhos diferentes de pizza"); if
* (rbIndividual.isSelected() && rbFamilia.isSelected())
* carrinho.setText("\nVoce não pode ter 2 tamanhos diferentes de pizza"); if
* (rbRegular.isSelected() && rbIndividual.isSelected())
* carrinho.setText("\nVoce não pode ter 2 tamanhos diferentes de pizza"); if
* (rbRegular.isSelected() && rbFamilia.isSelected())
* carrinho.setText("\nVoce não pode ter 2 tamanhos diferentes de pizza"); if
* (rbFamilia.isSelected() && rbIndividual.isSelected())
* carrinho.setText("\nVoce não pode ter 2 tamanhos diferentes de pizza"); if
* (rbFamilia.isSelected() && rbRegular.isSelected())
* carrinho.setText("\nVoce não pode ter 2 tamanhos diferentes de pizza");
*/
if (checkBacon.isSelected()) {
adicionais = "Bacon";
valorAdicionais = valorBacon;
} else if (checkCebola.isSelected()) {
adicionais = "Cebola";
valorAdicionais = valorCebola;
} else if (checkChampignon.isSelected()) {
adicionais = "Champignon";
valorAdicionais = valorChampignon;
} else if (checkTomate.isSelected()) {
adicionais = "Tomate";
valorAdicionais = valorTomate;
} else if (checkCatupiry.isSelected()) {
adicionais = "Catupiry";
valorAdicionais = valorCatupiry;
} else if (checkPresunto.isSelected()) {
adicionais = "Presunto";
valorAdicionais = valorPresunto;
}
carrinho.setText("\nQuantidade: " + quantidade + "\nTipo: " + tipo + "\nSabor: "
+ listaSabores.getSelectedItem() + "\nTamanho: " + tamanho + "\tValor: R$" + df.format(valor)
+ "\nAdicionais: " + adicionais + "\tValor: R$" + df.format(valorAdicionais));
}
});
adicionarCarrinho.setBounds(179, 232, 160, 25);
fundo1.add(adicionarCarrinho);
adicionarCarrinho.setOpaque(false);
JButton confirmarPedido = new JButton("Confirmar Pedido");
confirmarPedido.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent cf) {
double valorTotal = valor + valorAdicionais;
// carrinho.setText();
}
});
confirmarPedido.setBounds(177, 415, 162, 25);
fundo1.add(confirmarPedido);
}
@Override
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
}
}
| 9,163 | 0.670962 | 0.628372 | 271 | 31.789667 | 23.010107 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.380074 | false | false |
1
|
a487fa634c07f28f13ead316d4fac97c073770eb
| 4,243,427,700,771 |
3f1aab770f7219810398749affe862128a097df9
|
/Document/Thesis/Usecase/bao cao 19-7/map/src/java/model/ChiTietHoSoChuyenLop.java
|
5e29c8d2e4c4a269a96353a562077143f17f4a5c
|
[] |
no_license
|
duychinhnguyenvn/portalproject
|
https://github.com/duychinhnguyenvn/portalproject
|
bfff57d51c97ed553277e89de20b3ac6e851298b
|
77514c64d14ac1ed28de19224e3fec682724519d
|
refs/heads/master
| 2021-01-18T15:16:31.692000 | 2013-11-09T15:52:07 | 2013-11-09T15:52:07 | 32,434,973 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package model;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
*
* @author nguyentanmo
*/
@Entity
@Table(name = "CHITIETHOSOCHUYENLOP")
public class ChiTietHoSoChuyenLop implements Serializable {
long id;
int hocKy;
String lopChuyenDi;
String lopChuyenDen;
Date ngayChuyenLop;
String lyDoChuyen;
HocSinh hocSinh;
public ChiTietHoSoChuyenLop() {
}
public ChiTietHoSoChuyenLop(int hocKy, String lopChuyenDi, String lopChuyenDen, Date ngayChuyenLop, String lyDoChuyen) {
this.hocKy = hocKy;
this.lopChuyenDi = lopChuyenDi;
this.lopChuyenDen = lopChuyenDen;
this.ngayChuyenLop = ngayChuyenLop;
this.lyDoChuyen = lyDoChuyen;
}
@Id
@GeneratedValue
@Column(name = "ID_CHITIETHOSOCHUYENLOP")
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public int getHocKy() {
return hocKy;
}
public void setHocKy(int hocKy) {
this.hocKy = hocKy;
}
public String getLopChuyenDen() {
return lopChuyenDen;
}
public void setLopChuyenDen(String lopChuyenDen) {
this.lopChuyenDen = lopChuyenDen;
}
public String getLopChuyenDi() {
return lopChuyenDi;
}
public void setLopChuyenDi(String lopChuyenDi) {
this.lopChuyenDi = lopChuyenDi;
}
public String getLyDoChuyen() {
return lyDoChuyen;
}
public void setLyDoChuyen(String lyDoChuyen) {
this.lyDoChuyen = lyDoChuyen;
}
@Temporal(TemporalType.DATE)
public Date getNgayChuyenLop() {
return ngayChuyenLop;
}
public void setNgayChuyenLop(Date ngayChuyenLop) {
this.ngayChuyenLop = ngayChuyenLop;
}
//quanhe chi tiet ho so chuyen lop chua hoc sinh
@OneToOne
@JoinColumn(name = "ID_HOCSINH")
public HocSinh getHocSinh() {
return hocSinh;
}
public void setHocSinh(HocSinh hocSinh) {
this.hocSinh = hocSinh;
}
}
|
UTF-8
|
Java
| 2,439 |
java
|
ChiTietHoSoChuyenLop.java
|
Java
|
[
{
"context": "javax.persistence.TemporalType;\n\n/**\n *\n * @author nguyentanmo\n */\n@Entity\n@Table(name = \"CHITIETHOSOCHUYENLOP\")",
"end": 512,
"score": 0.9995878338813782,
"start": 501,
"tag": "USERNAME",
"value": "nguyentanmo"
}
] | null |
[] |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package model;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
*
* @author nguyentanmo
*/
@Entity
@Table(name = "CHITIETHOSOCHUYENLOP")
public class ChiTietHoSoChuyenLop implements Serializable {
long id;
int hocKy;
String lopChuyenDi;
String lopChuyenDen;
Date ngayChuyenLop;
String lyDoChuyen;
HocSinh hocSinh;
public ChiTietHoSoChuyenLop() {
}
public ChiTietHoSoChuyenLop(int hocKy, String lopChuyenDi, String lopChuyenDen, Date ngayChuyenLop, String lyDoChuyen) {
this.hocKy = hocKy;
this.lopChuyenDi = lopChuyenDi;
this.lopChuyenDen = lopChuyenDen;
this.ngayChuyenLop = ngayChuyenLop;
this.lyDoChuyen = lyDoChuyen;
}
@Id
@GeneratedValue
@Column(name = "ID_CHITIETHOSOCHUYENLOP")
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public int getHocKy() {
return hocKy;
}
public void setHocKy(int hocKy) {
this.hocKy = hocKy;
}
public String getLopChuyenDen() {
return lopChuyenDen;
}
public void setLopChuyenDen(String lopChuyenDen) {
this.lopChuyenDen = lopChuyenDen;
}
public String getLopChuyenDi() {
return lopChuyenDi;
}
public void setLopChuyenDi(String lopChuyenDi) {
this.lopChuyenDi = lopChuyenDi;
}
public String getLyDoChuyen() {
return lyDoChuyen;
}
public void setLyDoChuyen(String lyDoChuyen) {
this.lyDoChuyen = lyDoChuyen;
}
@Temporal(TemporalType.DATE)
public Date getNgayChuyenLop() {
return ngayChuyenLop;
}
public void setNgayChuyenLop(Date ngayChuyenLop) {
this.ngayChuyenLop = ngayChuyenLop;
}
//quanhe chi tiet ho so chuyen lop chua hoc sinh
@OneToOne
@JoinColumn(name = "ID_HOCSINH")
public HocSinh getHocSinh() {
return hocSinh;
}
public void setHocSinh(HocSinh hocSinh) {
this.hocSinh = hocSinh;
}
}
| 2,439 | 0.671997 | 0.671997 | 108 | 21.583334 | 19.681786 | 124 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.407407 | false | false |
1
|
ccf592a4f98ff6012c634cf6e9b82186fe219204
| 30,837,865,198,794 |
922defe7fae8b80e169b026b74915a1fb9ba436a
|
/web/src/main/java/edu/dhu/auction/web/bean/dto/LotDTO.java
|
afe9f654d4de91fd3ff8ab35ce413287ad67b057
|
[
"Apache-2.0"
] |
permissive
|
QofFlower/blockchain-auction-server
|
https://github.com/QofFlower/blockchain-auction-server
|
6d7b91e07acc7d22b177482c13d06734ca2a1249
|
06a41af276cc2e50d1373fbec3011a540f5b1796
|
refs/heads/master
| 2023-05-11T00:21:48.947000 | 2021-05-23T12:17:41 | 2021-05-23T12:17:41 | 475,363,331 | 1 | 0 |
Apache-2.0
| true | 2022-03-29T09:05:46 | 2022-03-29T09:05:45 | 2022-03-25T06:08:53 | 2021-05-23T12:17:48 | 114 | 0 | 0 | 0 | null | false | false |
package edu.dhu.auction.web.bean.dto;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.UUID;
public class LotDTO {
private Long id;
private String name;
private BigDecimal deposit;
private BigDecimal scale;
private BigDecimal commission;
private BigDecimal basePrice;
private BigDecimal highestPrice;
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class)
private LocalDateTime createTime;
private UUID assetIdentifier;
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class)
private LocalDateTime auctionStartTime;
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class)
private LocalDateTime auctionEndTime;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public BigDecimal getDeposit() {
return deposit;
}
public void setDeposit(BigDecimal deposit) {
this.deposit = deposit;
}
public BigDecimal getScale() {
return scale;
}
public void setScale(BigDecimal scale) {
this.scale = scale;
}
public BigDecimal getCommission() {
return commission;
}
public void setCommission(BigDecimal commission) {
this.commission = commission;
}
public BigDecimal getBasePrice() {
return basePrice;
}
public void setBasePrice(BigDecimal basePrice) {
this.basePrice = basePrice;
}
public BigDecimal getHighestPrice() {
return highestPrice;
}
public void setHighestPrice(BigDecimal highestPrice) {
this.highestPrice = highestPrice;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public UUID getAssetIdentifier() {
return assetIdentifier;
}
public void setAssetIdentifier(UUID assetIdentifier) {
this.assetIdentifier = assetIdentifier;
}
public LocalDateTime getAuctionStartTime() {
return auctionStartTime;
}
public void setAuctionStartTime(LocalDateTime auctionStartTime) {
this.auctionStartTime = auctionStartTime;
}
public LocalDateTime getAuctionEndTime() {
return auctionEndTime;
}
public void setAuctionEndTime(LocalDateTime auctionEndTime) {
this.auctionEndTime = auctionEndTime;
}
}
|
UTF-8
|
Java
| 3,027 |
java
|
LotDTO.java
|
Java
|
[] | null |
[] |
package edu.dhu.auction.web.bean.dto;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.UUID;
public class LotDTO {
private Long id;
private String name;
private BigDecimal deposit;
private BigDecimal scale;
private BigDecimal commission;
private BigDecimal basePrice;
private BigDecimal highestPrice;
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class)
private LocalDateTime createTime;
private UUID assetIdentifier;
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class)
private LocalDateTime auctionStartTime;
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class)
private LocalDateTime auctionEndTime;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public BigDecimal getDeposit() {
return deposit;
}
public void setDeposit(BigDecimal deposit) {
this.deposit = deposit;
}
public BigDecimal getScale() {
return scale;
}
public void setScale(BigDecimal scale) {
this.scale = scale;
}
public BigDecimal getCommission() {
return commission;
}
public void setCommission(BigDecimal commission) {
this.commission = commission;
}
public BigDecimal getBasePrice() {
return basePrice;
}
public void setBasePrice(BigDecimal basePrice) {
this.basePrice = basePrice;
}
public BigDecimal getHighestPrice() {
return highestPrice;
}
public void setHighestPrice(BigDecimal highestPrice) {
this.highestPrice = highestPrice;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public UUID getAssetIdentifier() {
return assetIdentifier;
}
public void setAssetIdentifier(UUID assetIdentifier) {
this.assetIdentifier = assetIdentifier;
}
public LocalDateTime getAuctionStartTime() {
return auctionStartTime;
}
public void setAuctionStartTime(LocalDateTime auctionStartTime) {
this.auctionStartTime = auctionStartTime;
}
public LocalDateTime getAuctionEndTime() {
return auctionEndTime;
}
public void setAuctionEndTime(LocalDateTime auctionEndTime) {
this.auctionEndTime = auctionEndTime;
}
}
| 3,027 | 0.699703 | 0.697721 | 118 | 24.652542 | 21.668291 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.347458 | false | false |
1
|
4788b8ea086a06f4a790911445b2854adea341b9
| 7,103,875,923,274 |
6dc89699f9e02e6c3f7feec166ebaeb21e692ba0
|
/android/src/main/java/cn/waitwalker/flutter_socket_plugin/jt808_sdk/oksocket/interfaces/common_interfacies/server/IServerManagerPrivate.java
|
8661f0ff1453b2d0d21c858c3916b5bd75b33cb7
|
[
"MIT"
] |
permissive
|
waitwalker/flutter_socket_plugin
|
https://github.com/waitwalker/flutter_socket_plugin
|
8ea06de03a5c87a9b875f4da1d76bc1466b5353c
|
2630ed27ccc8b7348f78dfbd679dcede40ec2cef
|
refs/heads/master
| 2023-07-06T06:23:53.668000 | 2023-06-29T01:11:03 | 2023-06-29T01:11:03 | 203,282,893 | 16 | 11 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cn.waitwalker.flutter_socket_plugin.jt808_sdk.oksocket.interfaces.common_interfacies.server;
import cn.waitwalker.flutter_socket_plugin.jt808_sdk.oksocket.core.iocore.interfaces.IIOCoreOptions;
public interface IServerManagerPrivate<E extends IIOCoreOptions> extends IServerManager<E> {
void initServerPrivate(int serverPort);
}
|
UTF-8
|
Java
| 345 |
java
|
IServerManagerPrivate.java
|
Java
|
[] | null |
[] |
package cn.waitwalker.flutter_socket_plugin.jt808_sdk.oksocket.interfaces.common_interfacies.server;
import cn.waitwalker.flutter_socket_plugin.jt808_sdk.oksocket.core.iocore.interfaces.IIOCoreOptions;
public interface IServerManagerPrivate<E extends IIOCoreOptions> extends IServerManager<E> {
void initServerPrivate(int serverPort);
}
| 345 | 0.834783 | 0.817391 | 9 | 37.333332 | 44.434723 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false |
1
|
e65861b67583f1ce11176cbd4080a8ace5787e8e
| 31,233,002,194,900 |
fa91450deb625cda070e82d5c31770be5ca1dec6
|
/Diff-Raw-Data/29/29_bcc3f94a8c25a0ee9694d563fba9b60f92d1e56c/ResponseImpl/29_bcc3f94a8c25a0ee9694d563fba9b60f92d1e56c_ResponseImpl_t.java
|
4bea9b1082b7537feeee3b3f33fb85d15ee1ac11
|
[] |
no_license
|
zhongxingyu/Seer
|
https://github.com/zhongxingyu/Seer
|
48e7e5197624d7afa94d23f849f8ea2075bcaec0
|
c11a3109fdfca9be337e509ecb2c085b60076213
|
refs/heads/master
| 2023-07-06T12:48:55.516000 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | false | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | 2023-06-21T00:53:27 | 2023-06-22T07:55:57 | 2,849,868 | 2 | 2 | 0 | null | false | false |
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of the Common Development
* and Distribution License("CDDL") (the "License"). You may not use this file
* except in compliance with the License.
*
* You can obtain a copy of the License at:
* https://jersey.dev.java.net/license.txt
* See the License for the specific language governing permissions and
* limitations under the License.
*
* When distributing the Covered Code, include this CDDL Header Notice in each
* file and include the License file at:
* https://jersey.dev.java.net/license.txt
* If applicable, add the following below this CDDL Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*/
package com.sun.ws.rest.impl;
import com.sun.jersey.api.core.HttpRequestContext;
import java.net.URI;
import java.util.Iterator;
import java.util.List;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;
/**
*
* @author Paul.Sandoz@Sun.Com
*/
public final class ResponseImpl extends Response {
private final int status;
private final Object entity;
private final Object[] values;
private final List<Object> nameValuePairs;
private MultivaluedMap<String, Object> headers;
ResponseImpl(int status, Object entity, Object[] values, List<Object> nameValuePairs) {
this.status = status;
this.entity = entity;
this.values = values;
this.nameValuePairs = nameValuePairs;
}
// Response
public Object getEntity() {
return entity;
}
public int getStatus() {
return status;
}
public MultivaluedMap<String, Object> getMetadata() {
if (headers != null)
return headers;
headers = new ResponseHttpHeadersImpl();
for (int i = 0; i < values.length; i++)
if (values[i] != null)
headers.putSingle(ResponseBuilderImpl.getHeader(i), values[i]);
Iterator i = nameValuePairs.iterator();
while (i.hasNext()) {
headers.add((String)i.next(), i.next());
}
return headers;
}
public MultivaluedMap<String, Object> getMetadataOptimal(
HttpRequestContext request, MediaType contentType) {
if (headers != null)
return headers;
headers = new ResponseHttpHeadersImpl();
if (values.length == 0 && contentType != null) {
headers.putSingle(ResponseBuilderImpl.
getHeader(ResponseBuilderImpl.CONTENT_TYPE), contentType);
}
for (int i = 0; i < values.length; i++) {
switch(i) {
case ResponseBuilderImpl.CONTENT_TYPE:
if (values[i] != null)
headers.putSingle(ResponseBuilderImpl.getHeader(i), values[i]);
else if (contentType != null)
headers.putSingle(ResponseBuilderImpl.getHeader(i), contentType);
break;
case ResponseBuilderImpl.LOCATION:
Object location = values[i];
if (location != null) {
if (location instanceof URI) {
if (!((URI)location).isAbsolute()) {
String path = ((URI)location).getRawPath();
if (status == 201)
location = UriBuilder.fromUri(request.getAbsolutePath()).
encode(false).path(path).build();
else
location = UriBuilder.fromUri(request.getBaseUri()).
encode(false).path(path).build();
}
}
headers.putSingle(ResponseBuilderImpl.getHeader(i), location);
}
break;
default:
if (values[i] != null)
headers.putSingle(ResponseBuilderImpl.getHeader(i), values[i]);
}
}
Iterator i = nameValuePairs.iterator();
while (i.hasNext()) {
headers.add((String)i.next(), i.next());
}
return headers;
}
}
|
UTF-8
|
Java
| 4,763 |
java
|
29_bcc3f94a8c25a0ee9694d563fba9b60f92d1e56c_ResponseImpl_t.java
|
Java
|
[
{
"context": "avax.ws.rs.core.UriBuilder;\n \n /**\n *\n * @author Paul.Sandoz@Sun.Com\n */\n public final class ResponseImpl extends Res",
"end": 1296,
"score": 0.9992951154708862,
"start": 1277,
"tag": "EMAIL",
"value": "Paul.Sandoz@Sun.Com"
}
] | null |
[] |
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of the Common Development
* and Distribution License("CDDL") (the "License"). You may not use this file
* except in compliance with the License.
*
* You can obtain a copy of the License at:
* https://jersey.dev.java.net/license.txt
* See the License for the specific language governing permissions and
* limitations under the License.
*
* When distributing the Covered Code, include this CDDL Header Notice in each
* file and include the License file at:
* https://jersey.dev.java.net/license.txt
* If applicable, add the following below this CDDL Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*/
package com.sun.ws.rest.impl;
import com.sun.jersey.api.core.HttpRequestContext;
import java.net.URI;
import java.util.Iterator;
import java.util.List;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;
/**
*
* @author <EMAIL>
*/
public final class ResponseImpl extends Response {
private final int status;
private final Object entity;
private final Object[] values;
private final List<Object> nameValuePairs;
private MultivaluedMap<String, Object> headers;
ResponseImpl(int status, Object entity, Object[] values, List<Object> nameValuePairs) {
this.status = status;
this.entity = entity;
this.values = values;
this.nameValuePairs = nameValuePairs;
}
// Response
public Object getEntity() {
return entity;
}
public int getStatus() {
return status;
}
public MultivaluedMap<String, Object> getMetadata() {
if (headers != null)
return headers;
headers = new ResponseHttpHeadersImpl();
for (int i = 0; i < values.length; i++)
if (values[i] != null)
headers.putSingle(ResponseBuilderImpl.getHeader(i), values[i]);
Iterator i = nameValuePairs.iterator();
while (i.hasNext()) {
headers.add((String)i.next(), i.next());
}
return headers;
}
public MultivaluedMap<String, Object> getMetadataOptimal(
HttpRequestContext request, MediaType contentType) {
if (headers != null)
return headers;
headers = new ResponseHttpHeadersImpl();
if (values.length == 0 && contentType != null) {
headers.putSingle(ResponseBuilderImpl.
getHeader(ResponseBuilderImpl.CONTENT_TYPE), contentType);
}
for (int i = 0; i < values.length; i++) {
switch(i) {
case ResponseBuilderImpl.CONTENT_TYPE:
if (values[i] != null)
headers.putSingle(ResponseBuilderImpl.getHeader(i), values[i]);
else if (contentType != null)
headers.putSingle(ResponseBuilderImpl.getHeader(i), contentType);
break;
case ResponseBuilderImpl.LOCATION:
Object location = values[i];
if (location != null) {
if (location instanceof URI) {
if (!((URI)location).isAbsolute()) {
String path = ((URI)location).getRawPath();
if (status == 201)
location = UriBuilder.fromUri(request.getAbsolutePath()).
encode(false).path(path).build();
else
location = UriBuilder.fromUri(request.getBaseUri()).
encode(false).path(path).build();
}
}
headers.putSingle(ResponseBuilderImpl.getHeader(i), location);
}
break;
default:
if (values[i] != null)
headers.putSingle(ResponseBuilderImpl.getHeader(i), values[i]);
}
}
Iterator i = nameValuePairs.iterator();
while (i.hasNext()) {
headers.add((String)i.next(), i.next());
}
return headers;
}
}
| 4,751 | 0.546294 | 0.544195 | 134 | 34.537312 | 26.315155 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.485075 | false | false |
1
|
2fc835b32c8a931668b57b33a53076d5fce9995d
| 29,231,547,431,444 |
6811fd178ae01659b5d207b59edbe32acfed45cc
|
/jira-project/jira-components/jira-configurator/src/main/java/com/atlassian/jira/configurator/console/ConsoleToolkit.java
|
c269a4ca0d3e5436678d99b22ac219c1f382e7d5
|
[] |
no_license
|
xiezhifeng/mysource
|
https://github.com/xiezhifeng/mysource
|
540b09a1e3c62614fca819610841ddb73b12326e
|
44f29e397a6a2da9340a79b8a3f61b3d51e331d1
|
refs/heads/master
| 2023-04-14T00:55:23.536000 | 2018-04-19T11:08:38 | 2018-04-19T11:08:38 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.atlassian.jira.configurator.console;
import com.atlassian.jira.configurator.config.ValidationException;
import com.atlassian.jira.configurator.config.Validator;
import javax.annotation.Nonnull;
import java.io.IOException;
public class ConsoleToolkit
{
private final ConsoleProvider console;
public ConsoleToolkit(@Nonnull final ConsoleProvider console)
{
this.console = console;
}
public String menuItemAndValue(String label, Object value)
{
final StringBuilder sb = new StringBuilder(128).append(label);
while (sb.length() < 40)
{
sb.append(' ');
}
sb.append(": ");
if (value != null)
{
sb.append(value);
}
else
{
sb.append("(default)");
}
return (value != null) ? (label + " (" + value + ")") : label;
}
public void showMenuItem(char key, String label)
{
console.println(" [" + key + "] " + label);
}
public void showDefaultMenuItem(char key, String label)
{
console.println("* [" + key + "] " + label);
}
public void showMenuItem(char key, String label, char defaultKey)
{
if (key == defaultKey)
{
showDefaultMenuItem(key, label);
}
else
{
showMenuItem(key, label);
}
}
public char readMenuChoice(String menuName) throws IOException
{
return Character.toUpperCase(console.readFirstChar(menuName));
}
public <T> T askForPassword(@Nonnull final String label, @Nonnull final Validator<T> validator) throws IOException
{
while (true)
{
try
{
return validator.apply(label, console.readPassword(label));
}
catch (ValidationException e)
{
console.printErrorMessage(e);
}
}
}
public <T> T askFor(@Nonnull final String label, @Nonnull final Validator<T> validator) throws IOException
{
while (true)
{
try
{
return validator.apply(label, console.readLine(label));
}
catch (ValidationException e)
{
console.printErrorMessage(e);
}
}
}
}
|
UTF-8
|
Java
| 2,345 |
java
|
ConsoleToolkit.java
|
Java
|
[] | null |
[] |
package com.atlassian.jira.configurator.console;
import com.atlassian.jira.configurator.config.ValidationException;
import com.atlassian.jira.configurator.config.Validator;
import javax.annotation.Nonnull;
import java.io.IOException;
public class ConsoleToolkit
{
private final ConsoleProvider console;
public ConsoleToolkit(@Nonnull final ConsoleProvider console)
{
this.console = console;
}
public String menuItemAndValue(String label, Object value)
{
final StringBuilder sb = new StringBuilder(128).append(label);
while (sb.length() < 40)
{
sb.append(' ');
}
sb.append(": ");
if (value != null)
{
sb.append(value);
}
else
{
sb.append("(default)");
}
return (value != null) ? (label + " (" + value + ")") : label;
}
public void showMenuItem(char key, String label)
{
console.println(" [" + key + "] " + label);
}
public void showDefaultMenuItem(char key, String label)
{
console.println("* [" + key + "] " + label);
}
public void showMenuItem(char key, String label, char defaultKey)
{
if (key == defaultKey)
{
showDefaultMenuItem(key, label);
}
else
{
showMenuItem(key, label);
}
}
public char readMenuChoice(String menuName) throws IOException
{
return Character.toUpperCase(console.readFirstChar(menuName));
}
public <T> T askForPassword(@Nonnull final String label, @Nonnull final Validator<T> validator) throws IOException
{
while (true)
{
try
{
return validator.apply(label, console.readPassword(label));
}
catch (ValidationException e)
{
console.printErrorMessage(e);
}
}
}
public <T> T askFor(@Nonnull final String label, @Nonnull final Validator<T> validator) throws IOException
{
while (true)
{
try
{
return validator.apply(label, console.readLine(label));
}
catch (ValidationException e)
{
console.printErrorMessage(e);
}
}
}
}
| 2,345 | 0.550959 | 0.548827 | 93 | 24.215054 | 25.768553 | 118 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.354839 | false | false |
1
|
a3a61734bd1a7cdba60a93a9074669493c707b75
| 2,164,663,534,350 |
debae00d768e163e73b753c1f4bf881a60736578
|
/app/src/main/java/com/example/asus/dine_restaurant_finder/Server.java
|
a2a7f59795108bc3718c330e4dc38cc2952b3af6
|
[] |
no_license
|
caocaoapple110998/Dine_Restaurant_Finder
|
https://github.com/caocaoapple110998/Dine_Restaurant_Finder
|
38b4625f3dd7e041c329f6a13601720bedb24566
|
86a153df5f6951da9b4f6f61d28a93eba507730f
|
refs/heads/master
| 2020-03-26T20:56:06.190000 | 2018-08-31T07:15:52 | 2018-08-31T07:15:52 | 145,356,198 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.asus.dine_restaurant_finder;
public class Server {
public static String duongdan = "http://192.168.1.227/ThucTap/";
public static String duongdan1 = "http://192.168.1.15/ThucTap/";
public static String Favourites = duongdan1 + "getfavourites.php";
public static String Newlist = duongdan1 + "getnewlist.php";
public static String List1 = duongdan1 + "getlist1.php";
public static String List2 = duongdan1 + "getlist2.php";
public static String Comment = duongdan1 + "getcomment.php";
public static String NewGrid = duongdan1 + "getnewgrid.php";
public static String Login = duongdan1 + "login.php";
public static String Register = duongdan1 + "regisrer.php";
}
|
UTF-8
|
Java
| 732 |
java
|
Server.java
|
Java
|
[
{
"context": "ver {\n public static String duongdan = \"http://192.168.1.227/ThucTap/\";\n public static String duongdan1 = \"",
"end": 129,
"score": 0.9996136426925659,
"start": 116,
"tag": "IP_ADDRESS",
"value": "192.168.1.227"
},
{
"context": "p/\";\n public static String duongdan1 = \"http://192.168.1.15/ThucTap/\";\n\n public static String Favourites =",
"end": 198,
"score": 0.9995446801185608,
"start": 186,
"tag": "IP_ADDRESS",
"value": "192.168.1.15"
}
] | null |
[] |
package com.example.asus.dine_restaurant_finder;
public class Server {
public static String duongdan = "http://192.168.1.227/ThucTap/";
public static String duongdan1 = "http://192.168.1.15/ThucTap/";
public static String Favourites = duongdan1 + "getfavourites.php";
public static String Newlist = duongdan1 + "getnewlist.php";
public static String List1 = duongdan1 + "getlist1.php";
public static String List2 = duongdan1 + "getlist2.php";
public static String Comment = duongdan1 + "getcomment.php";
public static String NewGrid = duongdan1 + "getnewgrid.php";
public static String Login = duongdan1 + "login.php";
public static String Register = duongdan1 + "regisrer.php";
}
| 732 | 0.70765 | 0.663934 | 24 | 29.5 | 30.763885 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.458333 | false | false |
1
|
d03c95869c4b56dccaf5fc64b93409c9799ef810
| 3,410,204,065,677 |
17600aa46312cd43f516341fee495153ae1a35ed
|
/Vista.java
|
1b1fa2d3abe21e937a48e45cbb2741e0e462adbb
|
[] |
no_license
|
LINDAINES213/Ejercicio-4
|
https://github.com/LINDAINES213/Ejercicio-4
|
900b7e3cdba45116d9c4ceb20ffc42e240463945
|
82e95aea223edf3528805d45e5c9f7020ff9f834
|
refs/heads/main
| 2023-08-17T08:35:31.664000 | 2021-09-29T05:50:44 | 2021-09-29T05:50:44 | 411,005,852 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* Esta clase es la vista donde se muestran mensajes con impresiones
* @author: Linda Ines Jimenez Vides
* @version: 28 - septiembre - 2021
*/
import java.util.Scanner;
public class Vista {
//Objeto tipo scanner
Scanner sn = new Scanner(System.in);
//Objeto tipo enemigo
Enemigos enemigos = new Enemigos();
//Objeto tipo jefe
Jefe jefes = new Jefe();
//Objeto tipo guerrero
Guerrero guerreros = new Guerrero();
//Objeto tipo explorador
Explorador exploradores = new Explorador();
/**
* Texto del primer menu
*/
public int menu1(){
int opcion;
String menu1 = "\nBienvenido al juego. Elija una opción:\n" +
"1. Simulador de Juego\n" +
"2. Ver personajes disponibles\n" +
"3. Salir del Juego\n";
System.out.println(menu1);
opcion = sn.nextInt();
return opcion;
}
/**
* Texto del tercer menu
*/
public int menu3(){
int opcion3;
String menu3 = "1. Atacar\n" +
"2. Recuperar Vida\n";
System.out.println(menu3);
opcion3 = sn.nextInt();
return opcion3;
}
/**
* Texto del menu para elegir personajes
*/
public int personaje(){
int opcion2;
String personaje = "\nElija un personajes\n" +
"1. Guerrero\n" +
"2. Explorador\n";
System.out.println(personaje);
opcion2 = sn.nextInt();
return opcion2;
}
/**
* Crea e imprime un enemigo
*/
public void enemigo1(){
enemigos.Enemigos();
}
/**
* Crea e imprime un jefe
*/
public void jefe(){
jefes.Jefe();
}
/**
* Crea e imprime un guerrero
*/
public void guerrero(){
guerreros.Guerrero();
}
/**
* Crea e imprime un explorador
*/
public void explorador(){
exploradores.Explorador();
}
/**
* Crea e imprime el mensaje de despedida
*/
public String salir(){
String salir = "\nFin del Juego\n";
System.out.println(salir);
return salir;
}
}
|
UTF-8
|
Java
| 2,287 |
java
|
Vista.java
|
Java
|
[
{
"context": "e se muestran mensajes con impresiones\n * @author: Linda Ines Jimenez Vides\n * @version: 28 - septiembre - 2021\n */\n\nimport j",
"end": 109,
"score": 0.999862015247345,
"start": 85,
"tag": "NAME",
"value": "Linda Ines Jimenez Vides"
}
] | null |
[] |
/**
* Esta clase es la vista donde se muestran mensajes con impresiones
* @author: <NAME>
* @version: 28 - septiembre - 2021
*/
import java.util.Scanner;
public class Vista {
//Objeto tipo scanner
Scanner sn = new Scanner(System.in);
//Objeto tipo enemigo
Enemigos enemigos = new Enemigos();
//Objeto tipo jefe
Jefe jefes = new Jefe();
//Objeto tipo guerrero
Guerrero guerreros = new Guerrero();
//Objeto tipo explorador
Explorador exploradores = new Explorador();
/**
* Texto del primer menu
*/
public int menu1(){
int opcion;
String menu1 = "\nBienvenido al juego. Elija una opción:\n" +
"1. Simulador de Juego\n" +
"2. Ver personajes disponibles\n" +
"3. Salir del Juego\n";
System.out.println(menu1);
opcion = sn.nextInt();
return opcion;
}
/**
* Texto del tercer menu
*/
public int menu3(){
int opcion3;
String menu3 = "1. Atacar\n" +
"2. Recuperar Vida\n";
System.out.println(menu3);
opcion3 = sn.nextInt();
return opcion3;
}
/**
* Texto del menu para elegir personajes
*/
public int personaje(){
int opcion2;
String personaje = "\nElija un personajes\n" +
"1. Guerrero\n" +
"2. Explorador\n";
System.out.println(personaje);
opcion2 = sn.nextInt();
return opcion2;
}
/**
* Crea e imprime un enemigo
*/
public void enemigo1(){
enemigos.Enemigos();
}
/**
* Crea e imprime un jefe
*/
public void jefe(){
jefes.Jefe();
}
/**
* Crea e imprime un guerrero
*/
public void guerrero(){
guerreros.Guerrero();
}
/**
* Crea e imprime un explorador
*/
public void explorador(){
exploradores.Explorador();
}
/**
* Crea e imprime el mensaje de despedida
*/
public String salir(){
String salir = "\nFin del Juego\n";
System.out.println(salir);
return salir;
}
}
| 2,269 | 0.513123 | 0.50175 | 110 | 19.781818 | 16.854664 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.254545 | false | false |
1
|
d77a46b704b97ac3ea2b95ae08919c9da7e8d529
| 2,551,210,609,872 |
eff0149202e10413dde9024b26a488d324d5e75a
|
/src/main/java/com/ndpmedia/model/fbDB/dao/FbDBDao.java
|
3509f4041e39c7d8dec5117b4b8d8ee01d38c8a0
|
[] |
no_license
|
part-time-job/jenkinsUtil
|
https://github.com/part-time-job/jenkinsUtil
|
68c8b7397129d96763207b04ee9850756f86b94d
|
94ba718fd554396fe2ae6fe28d1445f318c2862b
|
refs/heads/master
| 2020-05-26T22:23:12.491000 | 2017-03-01T07:40:46 | 2017-03-01T07:40:46 | 82,509,792 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.ndpmedia.model.fbDB.dao;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.ndpmedia.bean.Fb_docker;
import com.ndpmedia.comm.Global;
import com.ndpmedia.comm.config.ConfigUtil;
import com.ndpmedia.comm.sql.DBManager;
public class FbDBDao {
private static final Logger logger = LoggerFactory.getLogger(FbDBDao.class);
private String sql = "";
public List<Fb_docker> selectArray(String condition) {
List<Fb_docker> attList = new ArrayList<Fb_docker>();
List<Map<String, Object>> dataList = new ArrayList<Map<String, Object>>();
if (condition == null || condition.isEmpty())
sql = "select * from fb_docker ";
else
sql = "select * from fb_docker " + condition;
dataList = DBManager.queryArray(sql);
logger.info(sql);
for (Map<String, Object> map : dataList) {
attList.add((Fb_docker) Global.convertMap(Fb_docker.class, map));
}
return attList;
}
@SuppressWarnings("unchecked")
public int update(Fb_docker fbdDocker, String condition) {
int result = 0;
String setString = Global.mapToSqlString(Global.convertBean(fbdDocker), "id", "creation_time", "environment",
"build_num");
if (!setString.equals("")) {
sql = "update fb_docker";
sql += " set " + setString;
sql += " " + condition;
logger.info(sql);
result = DBManager.update(sql);
} else {
logger.info("no update data");
}
return result;
}
public int save(Fb_docker fbdDocker) {
sql = "INSERT INTO fb_docker ";
sql += Global.valuesString(fbdDocker);
logger.info(sql);
return DBManager.update(sql);
}
public Fb_docker getFb_docker(String condition){
Fb_docker fbBean = null;
if (condition!=null) {
sql = "select * from fb_docker " + condition + " ORDER BY id DESC limit 1;";
logger.info(sql);
fbBean = (Fb_docker) DBManager.query(Fb_docker.class, sql);
}
return fbBean;
}
public static void main(String[] args) {
ConfigUtil.path="\\main\\resources\\resources\\sql";
ConfigUtil configUtil = new ConfigUtil("D:\\workspace\\jenkinsUtil\\src");
FbDBDao dao = new FbDBDao();
dao.getFb_docker("build_num='BOff_18'");
}
}
|
UTF-8
|
Java
| 2,517 |
java
|
FbDBDao.java
|
Java
|
[] | null |
[] |
package com.ndpmedia.model.fbDB.dao;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.ndpmedia.bean.Fb_docker;
import com.ndpmedia.comm.Global;
import com.ndpmedia.comm.config.ConfigUtil;
import com.ndpmedia.comm.sql.DBManager;
public class FbDBDao {
private static final Logger logger = LoggerFactory.getLogger(FbDBDao.class);
private String sql = "";
public List<Fb_docker> selectArray(String condition) {
List<Fb_docker> attList = new ArrayList<Fb_docker>();
List<Map<String, Object>> dataList = new ArrayList<Map<String, Object>>();
if (condition == null || condition.isEmpty())
sql = "select * from fb_docker ";
else
sql = "select * from fb_docker " + condition;
dataList = DBManager.queryArray(sql);
logger.info(sql);
for (Map<String, Object> map : dataList) {
attList.add((Fb_docker) Global.convertMap(Fb_docker.class, map));
}
return attList;
}
@SuppressWarnings("unchecked")
public int update(Fb_docker fbdDocker, String condition) {
int result = 0;
String setString = Global.mapToSqlString(Global.convertBean(fbdDocker), "id", "creation_time", "environment",
"build_num");
if (!setString.equals("")) {
sql = "update fb_docker";
sql += " set " + setString;
sql += " " + condition;
logger.info(sql);
result = DBManager.update(sql);
} else {
logger.info("no update data");
}
return result;
}
public int save(Fb_docker fbdDocker) {
sql = "INSERT INTO fb_docker ";
sql += Global.valuesString(fbdDocker);
logger.info(sql);
return DBManager.update(sql);
}
public Fb_docker getFb_docker(String condition){
Fb_docker fbBean = null;
if (condition!=null) {
sql = "select * from fb_docker " + condition + " ORDER BY id DESC limit 1;";
logger.info(sql);
fbBean = (Fb_docker) DBManager.query(Fb_docker.class, sql);
}
return fbBean;
}
public static void main(String[] args) {
ConfigUtil.path="\\main\\resources\\resources\\sql";
ConfigUtil configUtil = new ConfigUtil("D:\\workspace\\jenkinsUtil\\src");
FbDBDao dao = new FbDBDao();
dao.getFb_docker("build_num='BOff_18'");
}
}
| 2,517 | 0.600715 | 0.598331 | 76 | 32.11842 | 24.682173 | 117 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.723684 | false | false |
1
|
10d73bd87b40fbc12cbcc28b2de0d3601c8ade83
| 34,119,220,217,824 |
f06ecf3e6290ed97b3e2831ded3f8bbc71913265
|
/src/kr/co/command/MainPageCommand.java
|
75fc7f897240d375dd6054e0ebd34d38587536a0
|
[] |
no_license
|
sanghshlsh/ProjectBoard
|
https://github.com/sanghshlsh/ProjectBoard
|
5bc684c8986dd3b0ea5866373ae5a775d6699968
|
e99e323e83854e7d5833348db58571a244d7acc9
|
refs/heads/master
| 2022-11-16T01:06:06.042000 | 2020-06-29T08:41:30 | 2020-06-29T08:41:30 | 271,182,674 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package kr.co.command;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import kr.co.dao.BoardDAO;
import kr.co.domain.BoardDTO;
import kr.co.domain.CommandAction;
import kr.co.domain.PageDTO;
public class MainPageCommand implements Command {
@Override
public CommandAction execute(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
BoardDAO dao= new BoardDAO();
PageDTO to= dao.page(1,1,12,null,null);
List<BoardDTO> nolist =dao.noticeList();
request.setAttribute("to", to);
request.setAttribute("list",to.getList());
request.setAttribute("nolist",nolist);
List<BoardDTO> hList = dao.MainPageHotsalelist();
request.setAttribute("hList", hList);
return new CommandAction(false, "mainPage.jsp");
}
}
|
UTF-8
|
Java
| 939 |
java
|
MainPageCommand.java
|
Java
|
[] | null |
[] |
package kr.co.command;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import kr.co.dao.BoardDAO;
import kr.co.domain.BoardDTO;
import kr.co.domain.CommandAction;
import kr.co.domain.PageDTO;
public class MainPageCommand implements Command {
@Override
public CommandAction execute(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
BoardDAO dao= new BoardDAO();
PageDTO to= dao.page(1,1,12,null,null);
List<BoardDTO> nolist =dao.noticeList();
request.setAttribute("to", to);
request.setAttribute("list",to.getList());
request.setAttribute("nolist",nolist);
List<BoardDTO> hList = dao.MainPageHotsalelist();
request.setAttribute("hList", hList);
return new CommandAction(false, "mainPage.jsp");
}
}
| 939 | 0.751864 | 0.747604 | 42 | 21.357143 | 21.284716 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.738095 | false | false |
1
|
b4353bd90f2bbca94f1e82b79b11a6526c8f108f
| 37,340,445,680,495 |
4f2eee329369fddf484b9aa0bcb8dcd49c2e5b25
|
/EZChannel/src/com/wms/opensource/ezchannel/activity/PlayVideoActivity.java
|
7eeee33e4d6001a77dbe39069ae47cf32f129fcd
|
[
"Apache-2.0"
] |
permissive
|
didierganthier/EZChannel
|
https://github.com/didierganthier/EZChannel
|
3af716efce69ef49b637ddd7a48a27a89ea08e1c
|
723dd02cfe72cc1fad0b6ec72b4dfe0b54b82bba
|
refs/heads/master
| 2021-05-18T16:33:44.528000 | 2015-07-25T15:17:56 | 2015-07-25T15:17:56 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* Copyright 2012 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wms.opensource.ezchannel.activity;
import com.google.android.youtube.player.YouTubeBaseActivity;
import com.google.android.youtube.player.YouTubePlayer;
import com.google.android.youtube.player.YouTubePlayerView;
import com.wms.opensource.ezchannel.R;
import com.wms.opensource.ezchannel.youtube.ApplicationKey;
import android.os.Bundle;
/**
* A simple YouTube Android API demo application which shows how to create a simple application that
* displays a YouTube Video in a {@link YouTubePlayerView}.
* <p>
* Note, to use a {@link YouTubePlayerView}, your activity must extend {@link YouTubeBaseActivity}.
*
* Waterloo Mobile Studio enhancement: in EZChannel, before opening PlayVideoActivity, you need to provide a "videoId" parameter.
* See {@link com.wms.opensource.ezchannel.youtube.YouTubeUtil#gotoSingleYouTubeVideoActivity(android.content.Context, com.wms.opensource.ezchannel.youtube.YouTubeVideo)}.
*/
public class PlayVideoActivity extends YouTubeFailureRecoveryActivity {
private String videoId = "";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.youtube_playerview);
Bundle bundle = this.getIntent().getExtras();
videoId = (String) bundle.getString("videoId");
YouTubePlayerView youTubeView = (YouTubePlayerView) findViewById(R.id.youtube_view);
youTubeView.initialize(ApplicationKey.getApplicationKey(this), this);
}
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer player,
boolean wasRestored) {
if (!wasRestored) {
player.cueVideo(videoId);
}
}
@Override
protected YouTubePlayer.Provider getYouTubePlayerProvider() {
return (YouTubePlayerView) findViewById(R.id.youtube_view);
}
}
|
UTF-8
|
Java
| 2,432 |
java
|
PlayVideoActivity.java
|
Java
|
[] | null |
[] |
/*
* Copyright 2012 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wms.opensource.ezchannel.activity;
import com.google.android.youtube.player.YouTubeBaseActivity;
import com.google.android.youtube.player.YouTubePlayer;
import com.google.android.youtube.player.YouTubePlayerView;
import com.wms.opensource.ezchannel.R;
import com.wms.opensource.ezchannel.youtube.ApplicationKey;
import android.os.Bundle;
/**
* A simple YouTube Android API demo application which shows how to create a simple application that
* displays a YouTube Video in a {@link YouTubePlayerView}.
* <p>
* Note, to use a {@link YouTubePlayerView}, your activity must extend {@link YouTubeBaseActivity}.
*
* Waterloo Mobile Studio enhancement: in EZChannel, before opening PlayVideoActivity, you need to provide a "videoId" parameter.
* See {@link com.wms.opensource.ezchannel.youtube.YouTubeUtil#gotoSingleYouTubeVideoActivity(android.content.Context, com.wms.opensource.ezchannel.youtube.YouTubeVideo)}.
*/
public class PlayVideoActivity extends YouTubeFailureRecoveryActivity {
private String videoId = "";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.youtube_playerview);
Bundle bundle = this.getIntent().getExtras();
videoId = (String) bundle.getString("videoId");
YouTubePlayerView youTubeView = (YouTubePlayerView) findViewById(R.id.youtube_view);
youTubeView.initialize(ApplicationKey.getApplicationKey(this), this);
}
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer player,
boolean wasRestored) {
if (!wasRestored) {
player.cueVideo(videoId);
}
}
@Override
protected YouTubePlayer.Provider getYouTubePlayerProvider() {
return (YouTubePlayerView) findViewById(R.id.youtube_view);
}
}
| 2,432 | 0.766447 | 0.763158 | 65 | 36.415386 | 36.601341 | 171 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false |
1
|
61e1531b0e164d76c8c4946b99b632b2d64b40c2
| 1,898,375,593,567 |
0b79be28afb8e5abba95c4b42cee95b568ccc441
|
/Idade_26_03_21.java
|
1a55780a3d0542ae8241a7cb0c0d37d0a6586a7b
|
[] |
no_license
|
viciadaemgatos/Atividades_em_Java
|
https://github.com/viciadaemgatos/Atividades_em_Java
|
a3f4dc97e222c2cae940647909984086ecde02e4
|
d8f17a5136f99e301d37009cb71d1f685b01ec86
|
refs/heads/main
| 2023-04-20T01:07:20.108000 | 2021-09-28T00:06:41 | 2021-09-28T00:06:41 | 351,952,063 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package idade_26_03_21;
import java.time.LocalDateTime;
import java.util.Scanner;
public class Idade_26_03_21 {
public static void main(String[] args) {
int anonasci, anoatual;
Scanner teclado = new Scanner(System.in);
System.out.println("Digite o ano de nascimento: ");
anonasci = teclado.nextInt();
LocalDateTime data1 = LocalDateTime.now();
anoatual = data1.getYear();
System.out.println("A idade aproximada é: " + (anoatual - anonasci) + " anos");
teclado.close();
}
}
|
UTF-8
|
Java
| 615 |
java
|
Idade_26_03_21.java
|
Java
|
[] | null |
[] |
package idade_26_03_21;
import java.time.LocalDateTime;
import java.util.Scanner;
public class Idade_26_03_21 {
public static void main(String[] args) {
int anonasci, anoatual;
Scanner teclado = new Scanner(System.in);
System.out.println("Digite o ano de nascimento: ");
anonasci = teclado.nextInt();
LocalDateTime data1 = LocalDateTime.now();
anoatual = data1.getYear();
System.out.println("A idade aproximada é: " + (anoatual - anonasci) + " anos");
teclado.close();
}
}
| 615 | 0.566775 | 0.543974 | 24 | 23.583334 | 23.147924 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
1
|
ebf2866376ddc258e157d2021bbd56f8d6e2f1ee
| 26,087,631,408,110 |
8cb4c6614423eb5b813d85c289935985d971f99f
|
/src/main/java/org/pascalot/io/QueuedOutputMessageTask.java
|
a426b2e0655299bf9b3a4dbb18b2d7602886a331
|
[] |
no_license
|
npascal/horseTrack
|
https://github.com/npascal/horseTrack
|
1ae2f24fa7f2cfccd2993c424ca72e11304a8c32
|
89c12e1f030c2c87f0144781754c8a89e61d7881
|
refs/heads/master
| 2021-01-10T05:46:21.919000 | 2015-11-30T19:41:19 | 2015-11-30T19:41:19 | 46,819,156 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.pascalot.io;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.MessageFormat;
/**
* Created by hamisu on 11/25/15.
*/
public class QueuedOutputMessageTask implements Runnable
{
private static final String SELF = Thread.currentThread().getStackTrace()[1].getClassName();
private static final Logger logger = LoggerFactory.getLogger(SELF);
private long receivedStamp = System.currentTimeMillis();
private ConsoleDisplay consoleDisplay;
private Message message;
public QueuedOutputMessageTask(ConsoleDisplay consoleDisplay, Message message)
{
this.consoleDisplay = consoleDisplay;
this.message = message;
}
@Override
public void run()
{
logger.debug(MessageFormat.format("Displaying horse race park output message received at timestamp: {0,number}", receivedStamp));
consoleDisplay.displayUserMessage((UserOutput) message);
}
}
|
UTF-8
|
Java
| 949 |
java
|
QueuedOutputMessageTask.java
|
Java
|
[
{
"context": "import java.text.MessageFormat;\n\n/**\n * Created by hamisu on 11/25/15.\n */\npublic class QueuedOutputMessage",
"end": 141,
"score": 0.9996511340141296,
"start": 135,
"tag": "USERNAME",
"value": "hamisu"
}
] | null |
[] |
package org.pascalot.io;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.MessageFormat;
/**
* Created by hamisu on 11/25/15.
*/
public class QueuedOutputMessageTask implements Runnable
{
private static final String SELF = Thread.currentThread().getStackTrace()[1].getClassName();
private static final Logger logger = LoggerFactory.getLogger(SELF);
private long receivedStamp = System.currentTimeMillis();
private ConsoleDisplay consoleDisplay;
private Message message;
public QueuedOutputMessageTask(ConsoleDisplay consoleDisplay, Message message)
{
this.consoleDisplay = consoleDisplay;
this.message = message;
}
@Override
public void run()
{
logger.debug(MessageFormat.format("Displaying horse race park output message received at timestamp: {0,number}", receivedStamp));
consoleDisplay.displayUserMessage((UserOutput) message);
}
}
| 949 | 0.734457 | 0.72392 | 32 | 28.65625 | 32.94466 | 137 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
1
|
aada68e5c5b5ed209df6ab6973d5bd84eede4875
| 9,912,784,574,283 |
bd0023e0bc03ab90713d0b8b324ae338a16bd277
|
/src/main/java/ActivePlayer.java
|
74d1087ad878f1dde485c87fb69cf01437bdc34a
|
[] |
no_license
|
djka90/BlackJackWAR
|
https://github.com/djka90/BlackJackWAR
|
aeb2e00d98550dc9608309f5e7b5a1846993a243
|
d2dd071c3b57afe0cf67be9074a7a0d86cacf3e4
|
refs/heads/master
| 2020-04-15T18:30:42.884000 | 2019-02-01T18:00:31 | 2019-02-01T18:00:31 | 164,914,846 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import javax.websocket.Session;
public class ActivePlayer {
public Session session = null;
public String login = null;
public ActivePlayer(Session session, String login) {
this.session = session;
this.login = login;
}
}
|
UTF-8
|
Java
| 254 |
java
|
ActivePlayer.java
|
Java
|
[] | null |
[] |
import javax.websocket.Session;
public class ActivePlayer {
public Session session = null;
public String login = null;
public ActivePlayer(Session session, String login) {
this.session = session;
this.login = login;
}
}
| 254 | 0.669291 | 0.669291 | 11 | 22.09091 | 17.296635 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.545455 | false | false |
1
|
6a135fc9a092596708b7ac7d7afcc84809cfc2d2
| 8,280,697,000,371 |
67d5d5e4264216458b1ffbb41f50a2b9581d9e1e
|
/src/java/org/apache/hadoop/mapred/FileOutputCommitter.java
|
a448977d7c334befdc48f9e2ea8bcdf51ebcfb69
|
[
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
apache/hadoop-mapreduce
|
https://github.com/apache/hadoop-mapreduce
|
aad7c6bdbe2ce1180b12c6a4611ff13da2725f37
|
307cb5b316e10defdbbc228d8cdcdb627191ea15
|
refs/heads/trunk
| 2023-09-01T14:05:53.182000 | 2011-06-12T01:04:18 | 2011-06-12T01:04:18 | 25,507,372 | 120 | 113 |
Apache-2.0
| false | 2019-10-27T19:01:06 | 2014-10-21T07:00:09 | 2019-10-20T10:13:28 | 2019-02-26T03:48:00 | 35,534 | 81 | 71 | 2 |
Java
| 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.hadoop.mapred;
import java.io.IOException;
import java.net.URI;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
/** An {@link OutputCommitter} that commits files specified
* in job output directory i.e. ${mapreduce.output.fileoutputformat.outputdir}.
**/
@InterfaceAudience.Public
@InterfaceStability.Stable
public class FileOutputCommitter extends OutputCommitter {
public static final Log LOG = LogFactory.getLog(
"org.apache.hadoop.mapred.FileOutputCommitter");
/**
* Temporary directory name
*/
public static final String TEMP_DIR_NAME = "_temporary";
public static final String SUCCEEDED_FILE_NAME = "_SUCCESS";
static final String SUCCESSFUL_JOB_OUTPUT_DIR_MARKER =
"mapreduce.fileoutputcommitter.marksuccessfuljobs";
public void setupJob(JobContext context) throws IOException {
JobConf conf = context.getJobConf();
Path outputPath = FileOutputFormat.getOutputPath(conf);
if (outputPath != null) {
Path tmpDir = new Path(outputPath, FileOutputCommitter.TEMP_DIR_NAME);
FileSystem fileSys = tmpDir.getFileSystem(conf);
if (!fileSys.mkdirs(tmpDir)) {
LOG.error("Mkdirs failed to create " + tmpDir.toString());
}
}
}
// True if the job requires output.dir marked on successful job.
// Note that by default it is set to true.
private boolean shouldMarkOutputDir(JobConf conf) {
return conf.getBoolean(SUCCESSFUL_JOB_OUTPUT_DIR_MARKER, true);
}
public void commitJob(JobContext context) throws IOException {
// delete the _temporary folder in the output folder
cleanupJob(context);
// check if the output-dir marking is required
if (shouldMarkOutputDir(context.getJobConf())) {
// create a _success file in the output folder
markOutputDirSuccessful(context);
}
}
// Create a _success file in the job's output folder
private void markOutputDirSuccessful(JobContext context) throws IOException {
JobConf conf = context.getJobConf();
// get the o/p path
Path outputPath = FileOutputFormat.getOutputPath(conf);
if (outputPath != null) {
// get the filesys
FileSystem fileSys = outputPath.getFileSystem(conf);
// create a file in the output folder to mark the job completion
Path filePath = new Path(outputPath, SUCCEEDED_FILE_NAME);
fileSys.create(filePath).close();
}
}
@Override
@Deprecated
public void cleanupJob(JobContext context) throws IOException {
JobConf conf = context.getJobConf();
// do the clean up of temporary directory
Path outputPath = FileOutputFormat.getOutputPath(conf);
if (outputPath != null) {
Path tmpDir = new Path(outputPath, FileOutputCommitter.TEMP_DIR_NAME);
FileSystem fileSys = tmpDir.getFileSystem(conf);
context.getProgressible().progress();
if (fileSys.exists(tmpDir)) {
fileSys.delete(tmpDir, true);
} else {
LOG.warn("Output Path is Null in cleanup");
}
}
}
@Override
public void abortJob(JobContext context, int runState)
throws IOException {
// simply delete the _temporary dir from the o/p folder of the job
cleanupJob(context);
}
public void setupTask(TaskAttemptContext context) throws IOException {
// FileOutputCommitter's setupTask doesn't do anything. Because the
// temporary task directory is created on demand when the
// task is writing.
}
public void commitTask(TaskAttemptContext context)
throws IOException {
Path taskOutputPath = getTempTaskOutputPath(context);
TaskAttemptID attemptId = context.getTaskAttemptID();
JobConf job = context.getJobConf();
if (taskOutputPath != null) {
FileSystem fs = taskOutputPath.getFileSystem(job);
context.getProgressible().progress();
if (fs.exists(taskOutputPath)) {
Path jobOutputPath = taskOutputPath.getParent().getParent();
// Move the task outputs to their final place
moveTaskOutputs(context, fs, jobOutputPath, taskOutputPath);
// Delete the temporary task-specific output directory
if (!fs.delete(taskOutputPath, true)) {
LOG.info("Failed to delete the temporary output" +
" directory of task: " + attemptId + " - " + taskOutputPath);
}
LOG.info("Saved output of task '" + attemptId + "' to " +
jobOutputPath);
}
}
}
private void moveTaskOutputs(TaskAttemptContext context,
FileSystem fs,
Path jobOutputDir,
Path taskOutput)
throws IOException {
TaskAttemptID attemptId = context.getTaskAttemptID();
context.getProgressible().progress();
if (fs.isFile(taskOutput)) {
Path finalOutputPath = getFinalPath(jobOutputDir, taskOutput,
getTempTaskOutputPath(context));
if (!fs.rename(taskOutput, finalOutputPath)) {
if (!fs.delete(finalOutputPath, true)) {
throw new IOException("Failed to delete earlier output of task: " +
attemptId);
}
if (!fs.rename(taskOutput, finalOutputPath)) {
throw new IOException("Failed to save output of task: " +
attemptId);
}
}
LOG.debug("Moved " + taskOutput + " to " + finalOutputPath);
} else if(fs.getFileStatus(taskOutput).isDirectory()) {
FileStatus[] paths = fs.listStatus(taskOutput);
Path finalOutputPath = getFinalPath(jobOutputDir, taskOutput,
getTempTaskOutputPath(context));
fs.mkdirs(finalOutputPath);
if (paths != null) {
for (FileStatus path : paths) {
moveTaskOutputs(context, fs, jobOutputDir, path.getPath());
}
}
}
}
public void abortTask(TaskAttemptContext context) throws IOException {
Path taskOutputPath = getTempTaskOutputPath(context);
if (taskOutputPath != null) {
FileSystem fs = taskOutputPath.getFileSystem(context.getJobConf());
context.getProgressible().progress();
fs.delete(taskOutputPath, true);
}
}
private Path getFinalPath(Path jobOutputDir, Path taskOutput,
Path taskOutputPath) throws IOException {
URI taskOutputUri = taskOutput.toUri();
URI relativePath = taskOutputPath.toUri().relativize(taskOutputUri);
if (taskOutputUri == relativePath) {//taskOutputPath is not a parent of taskOutput
throw new IOException("Can not get the relative path: base = " +
taskOutputPath + " child = " + taskOutput);
}
if (relativePath.getPath().length() > 0) {
return new Path(jobOutputDir, relativePath.getPath());
} else {
return jobOutputDir;
}
}
public boolean needsTaskCommit(TaskAttemptContext context)
throws IOException {
Path taskOutputPath = getTempTaskOutputPath(context);
if (taskOutputPath != null) {
context.getProgressible().progress();
// Get the file-system for the task output directory
FileSystem fs = taskOutputPath.getFileSystem(context.getJobConf());
// since task output path is created on demand,
// if it exists, task needs a commit
if (fs.exists(taskOutputPath)) {
return true;
}
}
return false;
}
Path getTempTaskOutputPath(TaskAttemptContext taskContext) throws IOException {
JobConf conf = taskContext.getJobConf();
Path outputPath = FileOutputFormat.getOutputPath(conf);
if (outputPath != null) {
Path p = new Path(outputPath,
(FileOutputCommitter.TEMP_DIR_NAME + Path.SEPARATOR +
"_" + taskContext.getTaskAttemptID().toString()));
FileSystem fs = p.getFileSystem(conf);
return p.makeQualified(fs);
}
return null;
}
Path getWorkPath(TaskAttemptContext taskContext, Path basePath)
throws IOException {
// ${mapred.out.dir}/_temporary
Path jobTmpDir = new Path(basePath, FileOutputCommitter.TEMP_DIR_NAME);
FileSystem fs = jobTmpDir.getFileSystem(taskContext.getJobConf());
if (!fs.exists(jobTmpDir)) {
throw new IOException("The temporary job-output directory " +
jobTmpDir.toString() + " doesn't exist!");
}
// ${mapred.out.dir}/_temporary/_${taskid}
String taskid = taskContext.getTaskAttemptID().toString();
Path taskTmpDir = new Path(jobTmpDir, "_" + taskid);
if (!fs.mkdirs(taskTmpDir)) {
throw new IOException("Mkdirs failed to create "
+ taskTmpDir.toString());
}
return taskTmpDir;
}
}
|
UTF-8
|
Java
| 9,670 |
java
|
FileOutputCommitter.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.hadoop.mapred;
import java.io.IOException;
import java.net.URI;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
/** An {@link OutputCommitter} that commits files specified
* in job output directory i.e. ${mapreduce.output.fileoutputformat.outputdir}.
**/
@InterfaceAudience.Public
@InterfaceStability.Stable
public class FileOutputCommitter extends OutputCommitter {
public static final Log LOG = LogFactory.getLog(
"org.apache.hadoop.mapred.FileOutputCommitter");
/**
* Temporary directory name
*/
public static final String TEMP_DIR_NAME = "_temporary";
public static final String SUCCEEDED_FILE_NAME = "_SUCCESS";
static final String SUCCESSFUL_JOB_OUTPUT_DIR_MARKER =
"mapreduce.fileoutputcommitter.marksuccessfuljobs";
public void setupJob(JobContext context) throws IOException {
JobConf conf = context.getJobConf();
Path outputPath = FileOutputFormat.getOutputPath(conf);
if (outputPath != null) {
Path tmpDir = new Path(outputPath, FileOutputCommitter.TEMP_DIR_NAME);
FileSystem fileSys = tmpDir.getFileSystem(conf);
if (!fileSys.mkdirs(tmpDir)) {
LOG.error("Mkdirs failed to create " + tmpDir.toString());
}
}
}
// True if the job requires output.dir marked on successful job.
// Note that by default it is set to true.
private boolean shouldMarkOutputDir(JobConf conf) {
return conf.getBoolean(SUCCESSFUL_JOB_OUTPUT_DIR_MARKER, true);
}
public void commitJob(JobContext context) throws IOException {
// delete the _temporary folder in the output folder
cleanupJob(context);
// check if the output-dir marking is required
if (shouldMarkOutputDir(context.getJobConf())) {
// create a _success file in the output folder
markOutputDirSuccessful(context);
}
}
// Create a _success file in the job's output folder
private void markOutputDirSuccessful(JobContext context) throws IOException {
JobConf conf = context.getJobConf();
// get the o/p path
Path outputPath = FileOutputFormat.getOutputPath(conf);
if (outputPath != null) {
// get the filesys
FileSystem fileSys = outputPath.getFileSystem(conf);
// create a file in the output folder to mark the job completion
Path filePath = new Path(outputPath, SUCCEEDED_FILE_NAME);
fileSys.create(filePath).close();
}
}
@Override
@Deprecated
public void cleanupJob(JobContext context) throws IOException {
JobConf conf = context.getJobConf();
// do the clean up of temporary directory
Path outputPath = FileOutputFormat.getOutputPath(conf);
if (outputPath != null) {
Path tmpDir = new Path(outputPath, FileOutputCommitter.TEMP_DIR_NAME);
FileSystem fileSys = tmpDir.getFileSystem(conf);
context.getProgressible().progress();
if (fileSys.exists(tmpDir)) {
fileSys.delete(tmpDir, true);
} else {
LOG.warn("Output Path is Null in cleanup");
}
}
}
@Override
public void abortJob(JobContext context, int runState)
throws IOException {
// simply delete the _temporary dir from the o/p folder of the job
cleanupJob(context);
}
public void setupTask(TaskAttemptContext context) throws IOException {
// FileOutputCommitter's setupTask doesn't do anything. Because the
// temporary task directory is created on demand when the
// task is writing.
}
public void commitTask(TaskAttemptContext context)
throws IOException {
Path taskOutputPath = getTempTaskOutputPath(context);
TaskAttemptID attemptId = context.getTaskAttemptID();
JobConf job = context.getJobConf();
if (taskOutputPath != null) {
FileSystem fs = taskOutputPath.getFileSystem(job);
context.getProgressible().progress();
if (fs.exists(taskOutputPath)) {
Path jobOutputPath = taskOutputPath.getParent().getParent();
// Move the task outputs to their final place
moveTaskOutputs(context, fs, jobOutputPath, taskOutputPath);
// Delete the temporary task-specific output directory
if (!fs.delete(taskOutputPath, true)) {
LOG.info("Failed to delete the temporary output" +
" directory of task: " + attemptId + " - " + taskOutputPath);
}
LOG.info("Saved output of task '" + attemptId + "' to " +
jobOutputPath);
}
}
}
private void moveTaskOutputs(TaskAttemptContext context,
FileSystem fs,
Path jobOutputDir,
Path taskOutput)
throws IOException {
TaskAttemptID attemptId = context.getTaskAttemptID();
context.getProgressible().progress();
if (fs.isFile(taskOutput)) {
Path finalOutputPath = getFinalPath(jobOutputDir, taskOutput,
getTempTaskOutputPath(context));
if (!fs.rename(taskOutput, finalOutputPath)) {
if (!fs.delete(finalOutputPath, true)) {
throw new IOException("Failed to delete earlier output of task: " +
attemptId);
}
if (!fs.rename(taskOutput, finalOutputPath)) {
throw new IOException("Failed to save output of task: " +
attemptId);
}
}
LOG.debug("Moved " + taskOutput + " to " + finalOutputPath);
} else if(fs.getFileStatus(taskOutput).isDirectory()) {
FileStatus[] paths = fs.listStatus(taskOutput);
Path finalOutputPath = getFinalPath(jobOutputDir, taskOutput,
getTempTaskOutputPath(context));
fs.mkdirs(finalOutputPath);
if (paths != null) {
for (FileStatus path : paths) {
moveTaskOutputs(context, fs, jobOutputDir, path.getPath());
}
}
}
}
public void abortTask(TaskAttemptContext context) throws IOException {
Path taskOutputPath = getTempTaskOutputPath(context);
if (taskOutputPath != null) {
FileSystem fs = taskOutputPath.getFileSystem(context.getJobConf());
context.getProgressible().progress();
fs.delete(taskOutputPath, true);
}
}
private Path getFinalPath(Path jobOutputDir, Path taskOutput,
Path taskOutputPath) throws IOException {
URI taskOutputUri = taskOutput.toUri();
URI relativePath = taskOutputPath.toUri().relativize(taskOutputUri);
if (taskOutputUri == relativePath) {//taskOutputPath is not a parent of taskOutput
throw new IOException("Can not get the relative path: base = " +
taskOutputPath + " child = " + taskOutput);
}
if (relativePath.getPath().length() > 0) {
return new Path(jobOutputDir, relativePath.getPath());
} else {
return jobOutputDir;
}
}
public boolean needsTaskCommit(TaskAttemptContext context)
throws IOException {
Path taskOutputPath = getTempTaskOutputPath(context);
if (taskOutputPath != null) {
context.getProgressible().progress();
// Get the file-system for the task output directory
FileSystem fs = taskOutputPath.getFileSystem(context.getJobConf());
// since task output path is created on demand,
// if it exists, task needs a commit
if (fs.exists(taskOutputPath)) {
return true;
}
}
return false;
}
Path getTempTaskOutputPath(TaskAttemptContext taskContext) throws IOException {
JobConf conf = taskContext.getJobConf();
Path outputPath = FileOutputFormat.getOutputPath(conf);
if (outputPath != null) {
Path p = new Path(outputPath,
(FileOutputCommitter.TEMP_DIR_NAME + Path.SEPARATOR +
"_" + taskContext.getTaskAttemptID().toString()));
FileSystem fs = p.getFileSystem(conf);
return p.makeQualified(fs);
}
return null;
}
Path getWorkPath(TaskAttemptContext taskContext, Path basePath)
throws IOException {
// ${mapred.out.dir}/_temporary
Path jobTmpDir = new Path(basePath, FileOutputCommitter.TEMP_DIR_NAME);
FileSystem fs = jobTmpDir.getFileSystem(taskContext.getJobConf());
if (!fs.exists(jobTmpDir)) {
throw new IOException("The temporary job-output directory " +
jobTmpDir.toString() + " doesn't exist!");
}
// ${mapred.out.dir}/_temporary/_${taskid}
String taskid = taskContext.getTaskAttemptID().toString();
Path taskTmpDir = new Path(jobTmpDir, "_" + taskid);
if (!fs.mkdirs(taskTmpDir)) {
throw new IOException("Mkdirs failed to create "
+ taskTmpDir.toString());
}
return taskTmpDir;
}
}
| 9,670 | 0.677249 | 0.676732 | 250 | 37.68 | 25.044952 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.504 | false | false |
1
|
3376114761d135d8b47e29310c21d3d0d864fffc
| 23,441,931,544,920 |
61a49ab2e9372783e62a8fbf88265b08837408d9
|
/src/DB/DAO.java
|
7cb946fab9f4f9dbc7d42b1ebf935cdd25c35e7c
|
[] |
no_license
|
nalfein84/HeroesLife
|
https://github.com/nalfein84/HeroesLife
|
4e31514db3c3c13413938905a1bfd18d44ef18a5
|
cd004763c477b0f05911576ba7db0955d9c09779
|
refs/heads/master
| 2021-07-18T18:19:18.292000 | 2017-10-26T17:51:14 | 2017-10-26T17:51:14 | 108,427,775 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package DB;
import java.util.*;
/**
*
*/
public class DAO {
/**
* Default constructor
*/
public DAO() {
}
/**
* @param int
* @return
*/
public T getByID(void int) {
// TODO implement here
return null;
}
}
|
UTF-8
|
Java
| 280 |
java
|
DAO.java
|
Java
|
[] | null |
[] |
package DB;
import java.util.*;
/**
*
*/
public class DAO {
/**
* Default constructor
*/
public DAO() {
}
/**
* @param int
* @return
*/
public T getByID(void int) {
// TODO implement here
return null;
}
}
| 280 | 0.45 | 0.45 | 27 | 9.407408 | 9.688707 | 32 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.111111 | false | false |
1
|
1c63c6635e8600f600175bb481797bdd4342bf1d
| 25,701,084,351,607 |
1d0d280fba11261db5b532382616a27b045bec8d
|
/cn/tx/file/FileDemo.java
|
a0715f1b29fb85ee7707ea7259adcede9a311377
|
[] |
no_license
|
shasky2014/tx_online_class
|
https://github.com/shasky2014/tx_online_class
|
01bb1d54d683dbf4f06b2c4b66a812f9e019ffab
|
e93ecd61121128c4c2086bb74925b5bbf06c97b0
|
refs/heads/master
| 2020-03-11T15:28:09.521000 | 2018-05-08T02:55:17 | 2018-05-08T02:55:17 | 130,084,916 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cn.tx.file;
import java.io.File;
import java.io.IOException;
public class FileDemo {
public static void main(String[] args) throws IOException {
File a =new File("test.txt");
System.out.println(a);
a.createNewFile();
System.out.println(a);
a.delete();
}
}
|
UTF-8
|
Java
| 328 |
java
|
FileDemo.java
|
Java
|
[] | null |
[] |
package cn.tx.file;
import java.io.File;
import java.io.IOException;
public class FileDemo {
public static void main(String[] args) throws IOException {
File a =new File("test.txt");
System.out.println(a);
a.createNewFile();
System.out.println(a);
a.delete();
}
}
| 328 | 0.591463 | 0.591463 | 14 | 21.428572 | 16.456497 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.571429 | false | false |
1
|
6c23a644b9dae80218139c0ef094a20f5452423a
| 1,434,519,135,309 |
59dc0c556518f10d780458ee0cf8d8d25bd116bd
|
/modules/siddhi-core/src/main/java/org/wso2/siddhi/core/query/processor/stream/window/TimeWindowProcessor.java
|
84616a0d4b1c0aa6af4973e891e26c1c5cf682bd
|
[
"Apache-2.0"
] |
permissive
|
buddhiayesha2015/siddhi
|
https://github.com/buddhiayesha2015/siddhi
|
7cca34c30b663202e801365c99b03d38cc9a59b1
|
916982708bd8647653bfe03d33590ae7e5dc1ee8
|
refs/heads/master
| 2021-01-12T12:28:13.602000 | 2016-10-19T18:37:25 | 2016-10-19T18:37:25 | 72,505,487 | 3 | 0 | null | true | 2016-11-01T05:04:19 | 2016-11-01T05:04:19 | 2016-11-01T02:07:39 | 2016-10-19T18:37:32 | 15,700 | 0 | 0 | 0 | null | null | null |
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. 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.wso2.siddhi.core.query.processor.stream.window;
import org.wso2.siddhi.core.config.ExecutionPlanContext;
import org.wso2.siddhi.core.event.ComplexEventChunk;
import org.wso2.siddhi.core.event.state.StateEvent;
import org.wso2.siddhi.core.event.stream.StreamEvent;
import org.wso2.siddhi.core.event.stream.StreamEventCloner;
import org.wso2.siddhi.core.executor.ConstantExpressionExecutor;
import org.wso2.siddhi.core.executor.ExpressionExecutor;
import org.wso2.siddhi.core.executor.VariableExpressionExecutor;
import org.wso2.siddhi.core.query.processor.Processor;
import org.wso2.siddhi.core.query.processor.SchedulingProcessor;
import org.wso2.siddhi.core.table.EventTable;
import org.wso2.siddhi.core.util.Scheduler;
import org.wso2.siddhi.core.util.parser.OperatorParser;
import org.wso2.siddhi.core.util.collection.operator.Finder;
import org.wso2.siddhi.core.util.collection.operator.MatchingMetaStateHolder;
import org.wso2.siddhi.query.api.definition.Attribute;
import org.wso2.siddhi.query.api.exception.ExecutionPlanValidationException;
import org.wso2.siddhi.query.api.expression.Expression;
import java.util.List;
import java.util.Map;
public class TimeWindowProcessor extends WindowProcessor implements SchedulingProcessor, FindableProcessor {
private long timeInMilliSeconds;
private ComplexEventChunk<StreamEvent> expiredEventChunk;
private Scheduler scheduler;
private ExecutionPlanContext executionPlanContext;
private volatile long lastTimestamp = Long.MIN_VALUE;
public void setTimeInMilliSeconds(long timeInMilliSeconds) {
this.timeInMilliSeconds = timeInMilliSeconds;
}
@Override
public void setScheduler(Scheduler scheduler) {
this.scheduler = scheduler;
}
@Override
public Scheduler getScheduler() {
return scheduler;
}
@Override
protected void init(ExpressionExecutor[] attributeExpressionExecutors, ExecutionPlanContext executionPlanContext) {
this.executionPlanContext = executionPlanContext;
this.expiredEventChunk = new ComplexEventChunk<StreamEvent>(false);
if (attributeExpressionExecutors.length == 1) {
if (attributeExpressionExecutors[0] instanceof ConstantExpressionExecutor) {
if (attributeExpressionExecutors[0].getReturnType() == Attribute.Type.INT) {
timeInMilliSeconds = (Integer) ((ConstantExpressionExecutor) attributeExpressionExecutors[0]).getValue();
} else if (attributeExpressionExecutors[0].getReturnType() == Attribute.Type.LONG) {
timeInMilliSeconds = (Long) ((ConstantExpressionExecutor) attributeExpressionExecutors[0]).getValue();
} else {
throw new ExecutionPlanValidationException("Time window's parameter attribute should be either int or long, but found " + attributeExpressionExecutors[0].getReturnType());
}
} else {
throw new ExecutionPlanValidationException("Time window should have constant parameter attribute but found a dynamic attribute " + attributeExpressionExecutors[0].getClass().getCanonicalName());
}
} else {
throw new ExecutionPlanValidationException("Time window should only have one parameter (<int|long|time> windowTime), but found " + attributeExpressionExecutors.length + " input attributes");
}
}
@Override
protected void process(ComplexEventChunk<StreamEvent> streamEventChunk, Processor nextProcessor, StreamEventCloner streamEventCloner) {
synchronized (this) {
while (streamEventChunk.hasNext()) {
StreamEvent streamEvent = streamEventChunk.next();
long currentTime = executionPlanContext.getTimestampGenerator().currentTime();
expiredEventChunk.reset();
while (expiredEventChunk.hasNext()) {
StreamEvent expiredEvent = expiredEventChunk.next();
long timeDiff = expiredEvent.getTimestamp() - currentTime + timeInMilliSeconds;
if (timeDiff <= 0) {
expiredEventChunk.remove();
expiredEvent.setTimestamp(currentTime);
streamEventChunk.insertBeforeCurrent(expiredEvent);
} else {
break;
}
}
if (streamEvent.getType() == StreamEvent.Type.CURRENT) {
StreamEvent clonedEvent = streamEventCloner.copyStreamEvent(streamEvent);
clonedEvent.setType(StreamEvent.Type.EXPIRED);
this.expiredEventChunk.add(clonedEvent);
if (lastTimestamp < clonedEvent.getTimestamp()) {
scheduler.notifyAt(clonedEvent.getTimestamp() + timeInMilliSeconds);
lastTimestamp = clonedEvent.getTimestamp();
}
} else {
streamEventChunk.remove();
}
}
expiredEventChunk.reset();
}
nextProcessor.process(streamEventChunk);
}
@Override
public synchronized StreamEvent find(StateEvent matchingEvent, Finder finder) {
return finder.find(matchingEvent, expiredEventChunk, streamEventCloner);
}
@Override
public Finder constructFinder(Expression expression, MatchingMetaStateHolder matchingMetaStateHolder, ExecutionPlanContext executionPlanContext,
List<VariableExpressionExecutor> variableExpressionExecutors, Map<String, EventTable> eventTableMap) {
return OperatorParser.constructOperator(expiredEventChunk, expression, matchingMetaStateHolder, executionPlanContext, variableExpressionExecutors, eventTableMap);
}
@Override
public void start() {
//Do nothing
}
@Override
public void stop() {
//Do nothing
}
@Override
public Object[] currentState() {
return new Object[]{expiredEventChunk.getFirst()};
}
@Override
public void restoreState(Object[] state) {
expiredEventChunk.clear();
expiredEventChunk.add((StreamEvent) state[0]);
}
}
|
UTF-8
|
Java
| 6,924 |
java
|
TimeWindowProcessor.java
|
Java
|
[] | null |
[] |
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. 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.wso2.siddhi.core.query.processor.stream.window;
import org.wso2.siddhi.core.config.ExecutionPlanContext;
import org.wso2.siddhi.core.event.ComplexEventChunk;
import org.wso2.siddhi.core.event.state.StateEvent;
import org.wso2.siddhi.core.event.stream.StreamEvent;
import org.wso2.siddhi.core.event.stream.StreamEventCloner;
import org.wso2.siddhi.core.executor.ConstantExpressionExecutor;
import org.wso2.siddhi.core.executor.ExpressionExecutor;
import org.wso2.siddhi.core.executor.VariableExpressionExecutor;
import org.wso2.siddhi.core.query.processor.Processor;
import org.wso2.siddhi.core.query.processor.SchedulingProcessor;
import org.wso2.siddhi.core.table.EventTable;
import org.wso2.siddhi.core.util.Scheduler;
import org.wso2.siddhi.core.util.parser.OperatorParser;
import org.wso2.siddhi.core.util.collection.operator.Finder;
import org.wso2.siddhi.core.util.collection.operator.MatchingMetaStateHolder;
import org.wso2.siddhi.query.api.definition.Attribute;
import org.wso2.siddhi.query.api.exception.ExecutionPlanValidationException;
import org.wso2.siddhi.query.api.expression.Expression;
import java.util.List;
import java.util.Map;
public class TimeWindowProcessor extends WindowProcessor implements SchedulingProcessor, FindableProcessor {
private long timeInMilliSeconds;
private ComplexEventChunk<StreamEvent> expiredEventChunk;
private Scheduler scheduler;
private ExecutionPlanContext executionPlanContext;
private volatile long lastTimestamp = Long.MIN_VALUE;
public void setTimeInMilliSeconds(long timeInMilliSeconds) {
this.timeInMilliSeconds = timeInMilliSeconds;
}
@Override
public void setScheduler(Scheduler scheduler) {
this.scheduler = scheduler;
}
@Override
public Scheduler getScheduler() {
return scheduler;
}
@Override
protected void init(ExpressionExecutor[] attributeExpressionExecutors, ExecutionPlanContext executionPlanContext) {
this.executionPlanContext = executionPlanContext;
this.expiredEventChunk = new ComplexEventChunk<StreamEvent>(false);
if (attributeExpressionExecutors.length == 1) {
if (attributeExpressionExecutors[0] instanceof ConstantExpressionExecutor) {
if (attributeExpressionExecutors[0].getReturnType() == Attribute.Type.INT) {
timeInMilliSeconds = (Integer) ((ConstantExpressionExecutor) attributeExpressionExecutors[0]).getValue();
} else if (attributeExpressionExecutors[0].getReturnType() == Attribute.Type.LONG) {
timeInMilliSeconds = (Long) ((ConstantExpressionExecutor) attributeExpressionExecutors[0]).getValue();
} else {
throw new ExecutionPlanValidationException("Time window's parameter attribute should be either int or long, but found " + attributeExpressionExecutors[0].getReturnType());
}
} else {
throw new ExecutionPlanValidationException("Time window should have constant parameter attribute but found a dynamic attribute " + attributeExpressionExecutors[0].getClass().getCanonicalName());
}
} else {
throw new ExecutionPlanValidationException("Time window should only have one parameter (<int|long|time> windowTime), but found " + attributeExpressionExecutors.length + " input attributes");
}
}
@Override
protected void process(ComplexEventChunk<StreamEvent> streamEventChunk, Processor nextProcessor, StreamEventCloner streamEventCloner) {
synchronized (this) {
while (streamEventChunk.hasNext()) {
StreamEvent streamEvent = streamEventChunk.next();
long currentTime = executionPlanContext.getTimestampGenerator().currentTime();
expiredEventChunk.reset();
while (expiredEventChunk.hasNext()) {
StreamEvent expiredEvent = expiredEventChunk.next();
long timeDiff = expiredEvent.getTimestamp() - currentTime + timeInMilliSeconds;
if (timeDiff <= 0) {
expiredEventChunk.remove();
expiredEvent.setTimestamp(currentTime);
streamEventChunk.insertBeforeCurrent(expiredEvent);
} else {
break;
}
}
if (streamEvent.getType() == StreamEvent.Type.CURRENT) {
StreamEvent clonedEvent = streamEventCloner.copyStreamEvent(streamEvent);
clonedEvent.setType(StreamEvent.Type.EXPIRED);
this.expiredEventChunk.add(clonedEvent);
if (lastTimestamp < clonedEvent.getTimestamp()) {
scheduler.notifyAt(clonedEvent.getTimestamp() + timeInMilliSeconds);
lastTimestamp = clonedEvent.getTimestamp();
}
} else {
streamEventChunk.remove();
}
}
expiredEventChunk.reset();
}
nextProcessor.process(streamEventChunk);
}
@Override
public synchronized StreamEvent find(StateEvent matchingEvent, Finder finder) {
return finder.find(matchingEvent, expiredEventChunk, streamEventCloner);
}
@Override
public Finder constructFinder(Expression expression, MatchingMetaStateHolder matchingMetaStateHolder, ExecutionPlanContext executionPlanContext,
List<VariableExpressionExecutor> variableExpressionExecutors, Map<String, EventTable> eventTableMap) {
return OperatorParser.constructOperator(expiredEventChunk, expression, matchingMetaStateHolder, executionPlanContext, variableExpressionExecutors, eventTableMap);
}
@Override
public void start() {
//Do nothing
}
@Override
public void stop() {
//Do nothing
}
@Override
public Object[] currentState() {
return new Object[]{expiredEventChunk.getFirst()};
}
@Override
public void restoreState(Object[] state) {
expiredEventChunk.clear();
expiredEventChunk.add((StreamEvent) state[0]);
}
}
| 6,924 | 0.690497 | 0.68472 | 157 | 43.10191 | 41.430962 | 210 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.541401 | false | false |
1
|
26b33d6d6420b7e07ac27a303ccfbd56e1ed4ff7
| 15,710,990,426,031 |
19de2ffe2e96db4ff8d565db26296e270846f2dd
|
/OOP2/src/com/atguigu/java/OOPTest10.java
|
b663255a7e8f06e713331035e70ca709972660ee
|
[] |
no_license
|
wealuk/JavaBased
|
https://github.com/wealuk/JavaBased
|
82325a8ad2c90626022b5257d76d84ec1ab86250
|
4beb42891229dd9f69dede1d2c134ac6e076e8bc
|
refs/heads/master
| 2023-09-03T17:20:45.584000 | 2021-11-05T05:45:02 | 2021-11-05T05:45:02 | 424,838,903 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.atguigu.java;
/*
* line33开始逐渐了解向下转型以及instanceof的使用
* 具体看下面
*
* 个人总结:向下转型即为父类通过强转赋给子类;多态即为向上转型。正常情况下,没有强转,父类是不能赋给子类的
* 只有子类直接赋给父类。但是要注意,不是向下转型有强转就可以实现,需要先有多态(就是子类赋给父类)
* 父类只能强转为该子类,其他子类是无法强转的(当然,强转为该子类的父类也可以)。
* 总而言之,在多态的情况下(子类赋给父类),向下转型通过强转可以一直用到该子类到该父类以下的父类
* 到该父类就是正常的创建对象了,该对象以上的父类则就是多态了
* 比如ABCDE是依次继承的,A a = new E(); 那么a->bcde都是可以用向下转型实现的
* B b = new E(); b->CDE都可以向下转型;B b = new B();就是正常创建;A a = b;就是多态
*
* 而对于instanceof,子类是绝对属于父类的,所以 子类 instacneof 父类 返回的绝对是true
* 但父类不一定属于子类, 父类 instanceof 子类,看多态时如果有 父类 = new 该子类,那么
* 就返回true,没有 new 该子类就返回false
*
* 归纳:要么是向下转型,要么就是多态。instanceof是判断父类是否属于子类的,从而决定该子类能否
* 强转为该子类(向下转型)。而子类 instanceof 父类是没有意义的,总为true。
*
*/
import java.util.Date;
public class OOPTest10 {
public static void main(String[] args) {
Person p1 = new Person();
p1.eat();
Man man = new Man();
man.eat();
man.age = 25;
man.eartnMoney();
System.out.println("***********");
//对象的多态性,父类的引用指向子类的对象
Person p2 = new Man();
//Person p3 = new Woman();
//多态的使用:当调用子父类同名同参数的方法时,实际执行的是子类重写父类的方法--虚拟方法的调用
p2.eat(); //执行时运行的是子类的重写方法
p2.walk();
// p2.earnMoney报错, 编译时只能调用父类的属性和方法,p2是Person类
System.out.println(p2.id);//1001,属性不能被覆盖,所以是谁的编译就运行谁。编译运行都看左边
System.out.println("***********************");
//不能调用子类所特有的方法和属性:编译时,p2是Preson类
p2.name = "Tom";
// p2.earnMoney();无法调用
// p2.isSmoking();
//有了对象的多态性以后,内存中实际上是加载了子类所特有的属性和方法,但是由于变量声明为
//父类类型,导致编译时只能调用父类中声明的。子类特有的属性和方法无法调用
//如何才能调用子类所特有的属性和方法呢?
//向下转型:使用强制类型转换 notes:多态就是子类赋给父类,也称为向上转换,无需强转
Man m1 = (Man)p2;//Man m1 = p2;是无法实现,只有子类对象赋给父类;不能父类对象赋给子类
m1.eartnMoney();
m1.isSmoking = true;
//使用强转时,可能出现ClassCastException的异常
// Woman w1 = (Woman)p2; 无法转换,因为line16 是p2 = new Man() ,可以将p2转回Man
// w1.goShopping(); 但无法转为woman。(p2是类Man的实例)
/*
* instanceof关键字的使用 instance:实例
*
* a instanceof A :判断对象a是否是类A的实例。如果是则返回true;不是返回false
*
* 使用情景:为了避免向下转型时出现ClassCastException的异常,我们在向下转型之前
* 先进行instanceof的判断,一旦返回true,就进行向下转型。false不进行向下转型
*
* 如果 a instance A 返回true,则a instance B也返回true,其中类 B是类A的父类
* 也就是a属于类A,那么也属于类A的父类 比如p2 = new Man p2属于Man,同样更属于Person类
*/
if(p2 instanceof Woman){
Woman w1 = (Woman)p2;
w1.goShopping();
System.out.println("Woman");//false
}
if(p2 instanceof Man){//new Man所以为true。向下转型主要看父类是否是子类的实例
Man m2 = (Man)p2;//因为子类必定是父类的实例
m2.eartnMoney();
System.out.println("Man");//true
}
if(p2 instanceof Person){//同一级别,此时不再是向下转型
System.out.println("Person");//true
}
if(p2 instanceof Object){//子类属于父类,必为true,此时不再是向下转型
//任何对象都可以作为Object的实例,也就是任意的对象都可以赋给Object
System.out.println("Object");
}
//练习
//问题一:编译时通过,运行时不通过
// Person p3 = new Woman();
// Man m3 = (Man)p3;
//
// Person p4 = new Person();
// Man m4 = (Man)p4;
//问题二:编译通过,运行也通过
// Object obj = new Woman();//obj可以转换为Woman及其所有的父类
// Person p = (Person)obj;
}
//编译不通过
// Man m5 = new Woman();
// String str = new Date();
Object o = new Date();
String str1 = (String)o;//编译可以通过,但无法运行
}
|
UTF-8
|
Java
| 5,112 |
java
|
OOPTest10.java
|
Java
|
[
{
"context": ";\n\t\t//不能调用子类所特有的方法和属性:编译时,p2是Preson类\n\t\tp2.name = \"Tom\";\n//\t\tp2.earnMoney();无法调用\n//\t\tp2.isSmoking();\n\t\t\n",
"end": 1342,
"score": 0.9981028437614441,
"start": 1339,
"tag": "NAME",
"value": "Tom"
}
] | null |
[] |
package com.atguigu.java;
/*
* line33开始逐渐了解向下转型以及instanceof的使用
* 具体看下面
*
* 个人总结:向下转型即为父类通过强转赋给子类;多态即为向上转型。正常情况下,没有强转,父类是不能赋给子类的
* 只有子类直接赋给父类。但是要注意,不是向下转型有强转就可以实现,需要先有多态(就是子类赋给父类)
* 父类只能强转为该子类,其他子类是无法强转的(当然,强转为该子类的父类也可以)。
* 总而言之,在多态的情况下(子类赋给父类),向下转型通过强转可以一直用到该子类到该父类以下的父类
* 到该父类就是正常的创建对象了,该对象以上的父类则就是多态了
* 比如ABCDE是依次继承的,A a = new E(); 那么a->bcde都是可以用向下转型实现的
* B b = new E(); b->CDE都可以向下转型;B b = new B();就是正常创建;A a = b;就是多态
*
* 而对于instanceof,子类是绝对属于父类的,所以 子类 instacneof 父类 返回的绝对是true
* 但父类不一定属于子类, 父类 instanceof 子类,看多态时如果有 父类 = new 该子类,那么
* 就返回true,没有 new 该子类就返回false
*
* 归纳:要么是向下转型,要么就是多态。instanceof是判断父类是否属于子类的,从而决定该子类能否
* 强转为该子类(向下转型)。而子类 instanceof 父类是没有意义的,总为true。
*
*/
import java.util.Date;
public class OOPTest10 {
public static void main(String[] args) {
Person p1 = new Person();
p1.eat();
Man man = new Man();
man.eat();
man.age = 25;
man.eartnMoney();
System.out.println("***********");
//对象的多态性,父类的引用指向子类的对象
Person p2 = new Man();
//Person p3 = new Woman();
//多态的使用:当调用子父类同名同参数的方法时,实际执行的是子类重写父类的方法--虚拟方法的调用
p2.eat(); //执行时运行的是子类的重写方法
p2.walk();
// p2.earnMoney报错, 编译时只能调用父类的属性和方法,p2是Person类
System.out.println(p2.id);//1001,属性不能被覆盖,所以是谁的编译就运行谁。编译运行都看左边
System.out.println("***********************");
//不能调用子类所特有的方法和属性:编译时,p2是Preson类
p2.name = "Tom";
// p2.earnMoney();无法调用
// p2.isSmoking();
//有了对象的多态性以后,内存中实际上是加载了子类所特有的属性和方法,但是由于变量声明为
//父类类型,导致编译时只能调用父类中声明的。子类特有的属性和方法无法调用
//如何才能调用子类所特有的属性和方法呢?
//向下转型:使用强制类型转换 notes:多态就是子类赋给父类,也称为向上转换,无需强转
Man m1 = (Man)p2;//Man m1 = p2;是无法实现,只有子类对象赋给父类;不能父类对象赋给子类
m1.eartnMoney();
m1.isSmoking = true;
//使用强转时,可能出现ClassCastException的异常
// Woman w1 = (Woman)p2; 无法转换,因为line16 是p2 = new Man() ,可以将p2转回Man
// w1.goShopping(); 但无法转为woman。(p2是类Man的实例)
/*
* instanceof关键字的使用 instance:实例
*
* a instanceof A :判断对象a是否是类A的实例。如果是则返回true;不是返回false
*
* 使用情景:为了避免向下转型时出现ClassCastException的异常,我们在向下转型之前
* 先进行instanceof的判断,一旦返回true,就进行向下转型。false不进行向下转型
*
* 如果 a instance A 返回true,则a instance B也返回true,其中类 B是类A的父类
* 也就是a属于类A,那么也属于类A的父类 比如p2 = new Man p2属于Man,同样更属于Person类
*/
if(p2 instanceof Woman){
Woman w1 = (Woman)p2;
w1.goShopping();
System.out.println("Woman");//false
}
if(p2 instanceof Man){//new Man所以为true。向下转型主要看父类是否是子类的实例
Man m2 = (Man)p2;//因为子类必定是父类的实例
m2.eartnMoney();
System.out.println("Man");//true
}
if(p2 instanceof Person){//同一级别,此时不再是向下转型
System.out.println("Person");//true
}
if(p2 instanceof Object){//子类属于父类,必为true,此时不再是向下转型
//任何对象都可以作为Object的实例,也就是任意的对象都可以赋给Object
System.out.println("Object");
}
//练习
//问题一:编译时通过,运行时不通过
// Person p3 = new Woman();
// Man m3 = (Man)p3;
//
// Person p4 = new Person();
// Man m4 = (Man)p4;
//问题二:编译通过,运行也通过
// Object obj = new Woman();//obj可以转换为Woman及其所有的父类
// Person p = (Person)obj;
}
//编译不通过
// Man m5 = new Woman();
// String str = new Date();
Object o = new Date();
String str1 = (String)o;//编译可以通过,但无法运行
}
| 5,112 | 0.674013 | 0.655263 | 117 | 24.982906 | 19.706385 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.153846 | false | false |
1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.