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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0a8297f801467b779467912d50c1df79f889812a
| 10,874,857,232,537 |
bc18719ec3dd3d24e1482404827733d2ec92d559
|
/src/main/java/com/pmt/controller/RestController.java
|
8f22986251c7dbeea223b123572891b0b5b18a79
|
[] |
no_license
|
naveenanem22/ProjmgrApi
|
https://github.com/naveenanem22/ProjmgrApi
|
41c7406bd57e68839117b60ca85f4674ff36b3ed
|
d77593d4a986e0ba8d2c8fbf2e20d8f94cf3757d
|
refs/heads/master
| 2020-03-12T15:38:12.482000 | 2018-04-23T12:56:27 | 2018-04-23T12:56:27 | 130,695,357 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.pmt.controller;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
import org.springframework.stereotype.Component;
@Component
@Path("/transaction")
public class RestController {
@GET
@Path("/payment")
public Response savePayment() {
String result = "This is a sample text";
return Response.status(200).entity(result).build();
}
}
|
UTF-8
|
Java
| 400 |
java
|
RestController.java
|
Java
|
[] | null |
[] |
package com.pmt.controller;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
import org.springframework.stereotype.Component;
@Component
@Path("/transaction")
public class RestController {
@GET
@Path("/payment")
public Response savePayment() {
String result = "This is a sample text";
return Response.status(200).entity(result).build();
}
}
| 400 | 0.7175 | 0.71 | 28 | 13.285714 | 16.500772 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.678571 | false | false |
3
|
ff6564f214c3f09a1efcefe6665f2c3724cd97a5
| 31,396,210,963,919 |
5e1aa7903602fca78e136c20125d4d09a46b0125
|
/src/main/java/cn/tyrion/pagemonitor/service/WechatService.java
|
d017c0798bfb545d0cd2fd8dafd78e487466f064
|
[] |
no_license
|
Lvguangyuan/qibaozhai-assistance
|
https://github.com/Lvguangyuan/qibaozhai-assistance
|
d14b51a141baf319bd136d232e7aaaa3ddeb8414
|
64a069270bf182e0f5dcd85c41fa62056ad626bc
|
refs/heads/master
| 2020-03-28T13:59:01.396000 | 2018-09-20T08:44:58 | 2018-09-20T08:44:58 | 148,447,747 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cn.tyrion.pagemonitor.service;
import cn.tyrion.pagemonitor.domain.ApiAccessToken;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import java.util.Formatter;
@Service
public class WechatService {
@Value("${wechat.api.access.token.url}")
private String getAccessTokenUrl;
@Value("${wechat.app.id}")
private String appId;
@Value("${wechat.app.secret}")
private String appSecret;
public String getGlobalAccessToken() {
UriComponentsBuilder urlBuilder = UriComponentsBuilder
.fromHttpUrl(getAccessTokenUrl)
.queryParam("grant_type", "client_credential")
.queryParam("appid", appId)
.queryParam("secret", appSecret);
String URL = urlBuilder.build().toUriString();
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<ApiAccessToken> apiAccessTokenEntity = restTemplate.getForEntity(URL, ApiAccessToken.class);
if (apiAccessTokenEntity.getStatusCode() != HttpStatus.OK) {
return null;
}
System.out.println("access_token: "+apiAccessTokenEntity.getBody().getAccessToken());
return apiAccessTokenEntity.getBody().getAccessToken();
}
public boolean validate(String signature, String timestamp, String nonce, String publicAccountToken) {
String sortStr = this.sort(publicAccountToken, timestamp, nonce);
String myToken = this.sha1(sortStr);
return myToken.equals(signature);
}
private String sort(String token, String timestamp, String nonce) {
String[] strArray = {token, timestamp, nonce};
Arrays.sort(strArray);
StringBuilder sbuilder = new StringBuilder();
for (String str : strArray) {
sbuilder.append(str);
}
return sbuilder.toString();
}
private String sha1(String str) {
if (str == null || str.length() == 0)
return "";
try {
MessageDigest md = MessageDigest.getInstance("SHA1");
byte[] bytes = md.digest(str.getBytes());
return byteToHex(bytes);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
return "";
}
private String byteToHex(final byte[] hash) {
Formatter formatter = new Formatter();
for (byte b : hash) {
formatter.format("%02x", b);
}
String result = formatter.toString();
formatter.close();
return result;
}
}
|
UTF-8
|
Java
| 2,945 |
java
|
WechatService.java
|
Java
|
[] | null |
[] |
package cn.tyrion.pagemonitor.service;
import cn.tyrion.pagemonitor.domain.ApiAccessToken;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import java.util.Formatter;
@Service
public class WechatService {
@Value("${wechat.api.access.token.url}")
private String getAccessTokenUrl;
@Value("${wechat.app.id}")
private String appId;
@Value("${wechat.app.secret}")
private String appSecret;
public String getGlobalAccessToken() {
UriComponentsBuilder urlBuilder = UriComponentsBuilder
.fromHttpUrl(getAccessTokenUrl)
.queryParam("grant_type", "client_credential")
.queryParam("appid", appId)
.queryParam("secret", appSecret);
String URL = urlBuilder.build().toUriString();
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<ApiAccessToken> apiAccessTokenEntity = restTemplate.getForEntity(URL, ApiAccessToken.class);
if (apiAccessTokenEntity.getStatusCode() != HttpStatus.OK) {
return null;
}
System.out.println("access_token: "+apiAccessTokenEntity.getBody().getAccessToken());
return apiAccessTokenEntity.getBody().getAccessToken();
}
public boolean validate(String signature, String timestamp, String nonce, String publicAccountToken) {
String sortStr = this.sort(publicAccountToken, timestamp, nonce);
String myToken = this.sha1(sortStr);
return myToken.equals(signature);
}
private String sort(String token, String timestamp, String nonce) {
String[] strArray = {token, timestamp, nonce};
Arrays.sort(strArray);
StringBuilder sbuilder = new StringBuilder();
for (String str : strArray) {
sbuilder.append(str);
}
return sbuilder.toString();
}
private String sha1(String str) {
if (str == null || str.length() == 0)
return "";
try {
MessageDigest md = MessageDigest.getInstance("SHA1");
byte[] bytes = md.digest(str.getBytes());
return byteToHex(bytes);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
return "";
}
private String byteToHex(final byte[] hash) {
Formatter formatter = new Formatter();
for (byte b : hash) {
formatter.format("%02x", b);
}
String result = formatter.toString();
formatter.close();
return result;
}
}
| 2,945 | 0.664177 | 0.662139 | 85 | 33.64706 | 25.258059 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.682353 | false | false |
3
|
f15eff336dc1733a9d8783d734b85ce6f6791c07
| 20,959,440,420,570 |
8f3d04c783c1b65419dc32f2d2cbee30be0cbcfc
|
/TwsPluginDemo/src/main/java/com/example/plugindemo/activity/category/ShareWidgetSamples.java
|
8be830e561dd101fdae2b295586d3961f17a5523
|
[] |
no_license
|
rickdynasty/TwsPluginFramework
|
https://github.com/rickdynasty/TwsPluginFramework
|
ac338829eabb400b2269bae3e82ba4f107ce20c6
|
3eb6059af90c4bbf77ac14a5949d3db56b4edf24
|
refs/heads/master
| 2021-01-11T05:41:51.127000 | 2020-08-02T14:36:40 | 2020-08-02T14:36:40 | 81,816,592 | 376 | 112 | null | false | 2017-05-08T09:19:34 | 2017-02-13T11:12:27 | 2017-05-08T08:55:23 | 2017-05-08T09:19:34 | 45,861 | 278 | 76 | 1 |
Java
| null | null |
package com.example.plugindemo.activity.category;
import android.app.TwsActivity;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import com.example.plugindemo.R;
import com.example.plugindemo.activity.PreferenceActivityDemo;
import com.tencent.tws.assistant.app.ProgressDialog;
import com.tencent.tws.assistant.app.TwsDialog;
import com.tencent.tws.assistant.widget.Toast;
public class ShareWidgetSamples extends TwsActivity implements View.OnClickListener {
private ProgressDialog mProgressDialog;
private Handler mProgressHandler;
private int mProgress;
private static final int MAX_PROGRESS = 100;
private static final int DIALOG_PROGRESS = 1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test_share_widget);
findViewById(R.id.alert_dialog).setOnClickListener(this);
findViewById(R.id.widget_tab).setOnClickListener(this);
findViewById(R.id.widget_toast).setOnClickListener(this);
findViewById(R.id.widget_sidebar).setOnClickListener(this);
findViewById(R.id.tws_base_widget).setOnClickListener(this);
findViewById(R.id.tws_pickers_samples).setOnClickListener(this);
findViewById(R.id.preference_activity).setOnClickListener(this);
findViewById(R.id.listview_samples).setOnClickListener(this);
findViewById(R.id.twsbutton_samples).setOnClickListener(this);
getTwsActionBar().setTitle("共享控件");
mProgressHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
if (mProgress >= MAX_PROGRESS) {
mProgressDialog.dismiss();
} else {
mProgress++;
mProgressDialog.incrementProgressBy(1);
mProgressHandler.sendEmptyMessageDelayed(0, 100);
}
}
};
}
@Override
public void onClick(View view) {
Intent intent;
switch (view.getId()) {
case R.id.alert_dialog:
// 利用className打开共享控件的测试activity
intent = new Intent();
intent.setClassName(this, AlertDialogSamples.class.getName());
startActivity(intent);
break;
case R.id.widget_tab:
// 利用className打开共享控件的测试activity
intent = new Intent();
intent.setClassName(this, TabSamples.class.getName());
startActivity(intent);
break;
case R.id.widget_sidebar:
// 利用className打开共享控件的测试activity
intent = new Intent();
intent.setClassName(this, SideBarActivity.class.getName());
intent.putExtra("testParam", "testParam");
startActivity(intent);
break;
case R.id.widget_toast:
Toast.makeText(this, "哈哈~其实没有什么,就一个提示而已!", Toast.LENGTH_SHORT).show();
break;
case R.id.tws_base_widget:
intent = new Intent();
intent.setClassName(this, TwsBaseWidget.class.getName());
startActivity(intent);
break;
case R.id.tws_pickers_samples:
intent = new Intent();
intent.setClassName(this, PickersSamples.class.getName());
startActivity(intent);
break;
case R.id.preference_activity:
intent = new Intent();
intent.setClassName(this, PreferenceActivityDemo.class.getName());
startActivity(intent);
break;
case R.id.listview_samples:
intent = new Intent();
intent.setClassName(this, ListViewSamples.class.getName());
startActivity(intent);
break;
case R.id.twsbutton_samples:
intent = new Intent();
intent.setClassName(this, TwsButtonSimples.class.getName());
startActivity(intent);
break;
default:
break;
}
}
@Override
protected TwsDialog onCreateTwsDialog(int id) {
switch (id) {
case DIALOG_PROGRESS:
mProgressDialog = new ProgressDialog(ShareWidgetSamples.this);
mProgressDialog.setIconAttribute(android.R.attr.alertDialogIcon);
mProgressDialog.setTitle("Header title");
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
mProgressDialog.setMax(100);
mProgressDialog.setButton(DialogInterface.BUTTON_POSITIVE, "隐藏", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
}
});
mProgressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, "取消", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
}
});
return mProgressDialog;
default:
break;
}
return null;
}
}
|
UTF-8
|
Java
| 4,461 |
java
|
ShareWidgetSamples.java
|
Java
|
[] | null |
[] |
package com.example.plugindemo.activity.category;
import android.app.TwsActivity;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import com.example.plugindemo.R;
import com.example.plugindemo.activity.PreferenceActivityDemo;
import com.tencent.tws.assistant.app.ProgressDialog;
import com.tencent.tws.assistant.app.TwsDialog;
import com.tencent.tws.assistant.widget.Toast;
public class ShareWidgetSamples extends TwsActivity implements View.OnClickListener {
private ProgressDialog mProgressDialog;
private Handler mProgressHandler;
private int mProgress;
private static final int MAX_PROGRESS = 100;
private static final int DIALOG_PROGRESS = 1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test_share_widget);
findViewById(R.id.alert_dialog).setOnClickListener(this);
findViewById(R.id.widget_tab).setOnClickListener(this);
findViewById(R.id.widget_toast).setOnClickListener(this);
findViewById(R.id.widget_sidebar).setOnClickListener(this);
findViewById(R.id.tws_base_widget).setOnClickListener(this);
findViewById(R.id.tws_pickers_samples).setOnClickListener(this);
findViewById(R.id.preference_activity).setOnClickListener(this);
findViewById(R.id.listview_samples).setOnClickListener(this);
findViewById(R.id.twsbutton_samples).setOnClickListener(this);
getTwsActionBar().setTitle("共享控件");
mProgressHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
if (mProgress >= MAX_PROGRESS) {
mProgressDialog.dismiss();
} else {
mProgress++;
mProgressDialog.incrementProgressBy(1);
mProgressHandler.sendEmptyMessageDelayed(0, 100);
}
}
};
}
@Override
public void onClick(View view) {
Intent intent;
switch (view.getId()) {
case R.id.alert_dialog:
// 利用className打开共享控件的测试activity
intent = new Intent();
intent.setClassName(this, AlertDialogSamples.class.getName());
startActivity(intent);
break;
case R.id.widget_tab:
// 利用className打开共享控件的测试activity
intent = new Intent();
intent.setClassName(this, TabSamples.class.getName());
startActivity(intent);
break;
case R.id.widget_sidebar:
// 利用className打开共享控件的测试activity
intent = new Intent();
intent.setClassName(this, SideBarActivity.class.getName());
intent.putExtra("testParam", "testParam");
startActivity(intent);
break;
case R.id.widget_toast:
Toast.makeText(this, "哈哈~其实没有什么,就一个提示而已!", Toast.LENGTH_SHORT).show();
break;
case R.id.tws_base_widget:
intent = new Intent();
intent.setClassName(this, TwsBaseWidget.class.getName());
startActivity(intent);
break;
case R.id.tws_pickers_samples:
intent = new Intent();
intent.setClassName(this, PickersSamples.class.getName());
startActivity(intent);
break;
case R.id.preference_activity:
intent = new Intent();
intent.setClassName(this, PreferenceActivityDemo.class.getName());
startActivity(intent);
break;
case R.id.listview_samples:
intent = new Intent();
intent.setClassName(this, ListViewSamples.class.getName());
startActivity(intent);
break;
case R.id.twsbutton_samples:
intent = new Intent();
intent.setClassName(this, TwsButtonSimples.class.getName());
startActivity(intent);
break;
default:
break;
}
}
@Override
protected TwsDialog onCreateTwsDialog(int id) {
switch (id) {
case DIALOG_PROGRESS:
mProgressDialog = new ProgressDialog(ShareWidgetSamples.this);
mProgressDialog.setIconAttribute(android.R.attr.alertDialogIcon);
mProgressDialog.setTitle("Header title");
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
mProgressDialog.setMax(100);
mProgressDialog.setButton(DialogInterface.BUTTON_POSITIVE, "隐藏", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
}
});
mProgressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, "取消", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
}
});
return mProgressDialog;
default:
break;
}
return null;
}
}
| 4,461 | 0.749137 | 0.746375 | 140 | 30.035715 | 23.612167 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.785714 | false | false |
3
|
f3e4872b88018544fa99c85991bfe5b0c587fa82
| 429,496,781,814 |
7d10077de0b78fcd86c4d5ec24d2e956ba235eb0
|
/pay/src/main/java/com/internal/playment/pay/service/shortcut/NewPayOrderService.java
|
45df468ebd7bc2fbd1215422ec6cd99e093a880d
|
[] |
no_license
|
moutainhigh/internal_playment
|
https://github.com/moutainhigh/internal_playment
|
6fee73866e39a1a3988a87a3d7558d89b979fb26
|
0eeced3da830ee944ca7430e79e04a0de320f7f5
|
refs/heads/master
| 2022-10-24T21:57:32.590000 | 2019-11-22T09:10:28 | 2019-11-22T09:10:28 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.internal.playment.pay.service.shortcut;
import com.internal.playment.common.dto.CrossResponseMsgDTO;
import com.internal.playment.common.dto.MerNoAuthPayOrderApplyDTO;
import com.internal.playment.common.dto.MerPayOrderApplyDTO;
import com.internal.playment.common.inner.InnerPrintLogObject;
import com.internal.playment.common.inner.NewPayException;
import com.internal.playment.common.inner.ParamRule;
import com.internal.playment.common.table.business.MerchantCardTable;
import com.internal.playment.common.table.business.PayOrderInfoTable;
import com.internal.playment.common.table.business.RegisterCollectTable;
import com.internal.playment.common.table.channel.ChannelHistoryTable;
import com.internal.playment.common.table.channel.ChannelInfoTable;
import com.internal.playment.common.table.merchant.MerchantInfoTable;
import com.internal.playment.common.table.merchant.MerchantQuotaRiskTable;
import com.internal.playment.common.table.system.MerchantSettingTable;
import com.internal.playment.common.table.system.RiskQuotaTable;
import com.internal.playment.common.tuple.Tuple2;
import com.internal.playment.pay.service.CommonServiceInterface;
import java.util.List;
import java.util.Map;
import java.util.Set;
public interface NewPayOrderService extends CommonServiceInterface {
/**
* 支付下单申请
* @return
*/
Map<String, ParamRule> getParamMapByB7();
/**
*
* @return
*/
Map<String, ParamRule> getParamMapByB8();
/**
*
* @return
*/
Map<String, ParamRule> getParamMapByB9();
/**
*
* @return
*/
Map<String, ParamRule> getParamMapByB10();
/**
* 查看是否重复订单
* @param merOrderId
* @param ipo
*/
void multipleOrder(String merOrderId, InnerPrintLogObject ipo) throws NewPayException;
/**
* 获取商户风控信息
* @param merchantId
* @param ipo
* @return
*/
MerchantQuotaRiskTable getMerchantQuotaRiskByMerId(String merchantId, InnerPrintLogObject ipo) throws NewPayException;
/**
* 获取成功进件记录
* @param ipo
* @param
* @return
*/
List<RegisterCollectTable> getSuccessRegisterInfo(RegisterCollectTable registerCollectTable,InnerPrintLogObject ipo) throws NewPayException;
/**
* 根据进件信息获取邦卡记录
* @param registerCollectTableList
* @param ipo
* @return
*/
List<MerchantCardTable> getSuccessMerchantCardInfo(List<RegisterCollectTable> registerCollectTableList, InnerPrintLogObject ipo) throws NewPayException;
/**
* 查询通道使用记录
* @param ipo
* @param strings MerchantId TerminalMerId ProductId
* @return
*/
ChannelHistoryTable getChannelHistoryInfo(InnerPrintLogObject ipo, String... strings) throws NewPayException;
/**
* 获取风控交易量统计数据
* @param merInfoTable
* @param ipo
* @return
*/
Tuple2<RiskQuotaTable, RiskQuotaTable> getRiskQuotaInfoByMer(MerchantInfoTable merInfoTable, InnerPrintLogObject ipo) throws NewPayException;
/**
* 单笔风控
* @param amount
* @param merchantQuotaRiskTable
* @param ipo
*/
void checkSingleAmountRisk(String amount, MerchantQuotaRiskTable merchantQuotaRiskTable, InnerPrintLogObject ipo) throws NewPayException;
/**
* 执行平台风控
* @param merchantQuotaRiskTable
* @param merRiskQuota
*/
void executePlatformRisk(String amount, MerchantQuotaRiskTable merchantQuotaRiskTable, Tuple2<RiskQuotaTable, RiskQuotaTable> merRiskQuota, InnerPrintLogObject ipo) throws NewPayException;
/**
* 获取通道信息
* @param channelHistoryTable
* @param ipo
* @return
*/
ChannelInfoTable getChannelInfoByChannelHistory(ChannelHistoryTable channelHistoryTable, InnerPrintLogObject ipo) throws NewPayException;
/**
* 获取该通道历史统计交易量
* @param channelInfoTable
* @param ipo
* @return
*/
Tuple2<RiskQuotaTable, RiskQuotaTable> getRiskQuotaInfoByChannel(ChannelInfoTable channelInfoTable, InnerPrintLogObject ipo) throws NewPayException;
/**
*
* @param channelInfoTable
* @param channelRiskQuota
* @param ipo
* @param args
* @return
* @throws NewPayException
*/
ChannelInfoTable executeChannelRisk(ChannelInfoTable channelInfoTable, Tuple2<RiskQuotaTable, RiskQuotaTable> channelRiskQuota, InnerPrintLogObject ipo, String... args) throws NewPayException;
/**
* 获取一个可行性的通道
* @param channelInfoTableList
* @param ipo
* @return
*/
ChannelInfoTable getFeasibleChannel(List<ChannelInfoTable> channelInfoTableList, InnerPrintLogObject ipo, String... args) throws NewPayException;
/**
* 更新订单结果
* @param crossResponseMsgDTO
* @param crossResponseMsg
* @param payOrderInfoTable
*/
PayOrderInfoTable updateByPayOrderInfo(CrossResponseMsgDTO crossResponseMsgDTO, String crossResponseMsg, PayOrderInfoTable payOrderInfoTable, InnerPrintLogObject ipo) throws NewPayException;
/**
* 生成历史通道信息
* @param channelHistoryTable
* @param payOrderInfoTable
* @return
*/
ChannelHistoryTable updateByChannelHistoryInfo(ChannelHistoryTable channelHistoryTable, PayOrderInfoTable payOrderInfoTable);
/**
* 商户和通道使用汇总情况
* @param payOrderInfoTable
* @param merRiskQuota
* @param channelRiskQuota
* @return
*/
Set<RiskQuotaTable> updateByRiskQuotaInfo(PayOrderInfoTable payOrderInfoTable, Tuple2<RiskQuotaTable, RiskQuotaTable> merRiskQuota, Tuple2<RiskQuotaTable, RiskQuotaTable> channelRiskQuota);
/**
*
* @param payOrderInfoTable
* @param cht
* @param rqtSet
* @param ipo
*/
void batchUpdatePayOderCorrelationInfo(PayOrderInfoTable payOrderInfoTable, ChannelHistoryTable cht, Set<RiskQuotaTable> rqtSet, InnerPrintLogObject ipo) throws NewPayException;
/**
*
* @param platformOrderId
* @param ipo
* @return
*/
PayOrderInfoTable getPayOrderInfoByPlatformOrderId(String platformOrderId, String bussType, InnerPrintLogObject ipo) throws NewPayException;
/**
*
* @param merchantCardTableList
* @param ipo
* @param args
* @return
* @throws NewPayException
*/
List<MerchantCardTable> filterMerCardByPaymentMsg(List<MerchantCardTable> merchantCardTableList, InnerPrintLogObject ipo, String... args) throws NewPayException;
/**
*
* @param registerCollectTableList
* @param merchantCardTableList
* @param ipo
* @return
*/
List<RegisterCollectTable> filterRegCollectInfoByMerCard(List<RegisterCollectTable> registerCollectTableList, List<MerchantCardTable> merchantCardTableList, InnerPrintLogObject ipo) throws NewPayException;
/**
*
* @param registerCollectTableList
* @param ipo
* @param args
* @return
* @throws NewPayException
*/
List<ChannelInfoTable> getAllUsableChannelList(List<RegisterCollectTable> registerCollectTableList, InnerPrintLogObject ipo, String... args) throws NewPayException ;
/**
*
* @param channelInfoTable
* @param registerCollectTableList
* @param ipo
* @return
*/
RegisterCollectTable finallyFilterRegCollect(ChannelInfoTable channelInfoTable, List<RegisterCollectTable> registerCollectTableList, InnerPrintLogObject ipo) throws NewPayException;
/**
*
* @param merchantCardTableList
* @param ipo
* @param args
* @return
* @throws NewPayException
*/
MerchantCardTable finallyFilterMerCard(List<MerchantCardTable> merchantCardTableList, InnerPrintLogObject ipo, String... args) throws NewPayException;
/**
*
* @param channelInfoTable
* @param ipo
* @return
*/
RegisterCollectTable getSuccessRegInfoByChanInfo(ChannelInfoTable channelInfoTable, InnerPrintLogObject ipo) throws NewPayException;
/**
*
* @param channelInfoTable
* @param registerCollectTable
* @param ipo
* @return
*/
MerchantCardTable getMerCardByChanAndReg(ChannelInfoTable channelInfoTable, RegisterCollectTable registerCollectTable, InnerPrintLogObject ipo, String... args) throws NewPayException;
/**
*
* @param registerCollectTableList
* @param merchantSettingTableList
* @param ipo
* @return
*/
List<RegisterCollectTable> filterRegCollectByMerSet(List<RegisterCollectTable> registerCollectTableList, List<MerchantSettingTable> merchantSettingTableList, InnerPrintLogObject ipo) throws NewPayException;
/**
*
* @param channelInfoTableList
* @param channelInfoTable
* @param ipo
* @return
*/
List<ChannelInfoTable> subtractUnableChanInfo(List<ChannelInfoTable> channelInfoTableList, ChannelInfoTable channelInfoTable, InnerPrintLogObject ipo) throws NewPayException;
/**
*
* @param channelInfoTable
* @param merchantSettingTableList
* @return
*/
ChannelInfoTable judgeThisChannelUsable(ChannelInfoTable channelInfoTable, List<MerchantSettingTable> merchantSettingTableList);
/**
*
* @param merInfoTable
* @param merPayOrderApplyDTO
* @param channelInfoTable
* @param registerCollectTable
* @param merchantCardTable
* @param ipo
* @return
*/
PayOrderInfoTable savePayOrder(MerchantInfoTable merInfoTable, MerPayOrderApplyDTO merPayOrderApplyDTO, ChannelInfoTable channelInfoTable, RegisterCollectTable registerCollectTable, MerchantCardTable merchantCardTable, InnerPrintLogObject ipo) throws NewPayException;
/**
*
* @param payOrderInfoTable
* @param ipo
* @param args
* @return
* @throws NewPayException
*/
PayOrderInfoTable updateByPayOrderInfoByBefore(PayOrderInfoTable payOrderInfoTable, InnerPrintLogObject ipo, String... args) throws NewPayException;
/**
*
* @param payOrderInfoTable
* @return
*/
MerPayOrderApplyDTO getMerPayOrderApplyDTO(PayOrderInfoTable payOrderInfoTable);
/**
*
* @param payOrderInfoTable
* @param ipo
*/
void checkPayOrderInfoTableByB9(PayOrderInfoTable payOrderInfoTable, InnerPrintLogObject ipo) throws NewPayException;
/**
*
* @param crossResponseMsgDTO
* @param crossResponseMsg
* @param payOrderInfoTable
* @param ipo
* @return
*/
PayOrderInfoTable updateByPayOrderInfoByB9After(CrossResponseMsgDTO crossResponseMsgDTO, String crossResponseMsg, PayOrderInfoTable payOrderInfoTable, InnerPrintLogObject ipo) throws NewPayException;
/**
*
* @param merInfoTable
* @param merNoAuthPayOrderApplyDTO
* @param channelInfoTable
* @param registerCollectTable
* @param merchantCardTable
* @param ipo
* @return
*/
PayOrderInfoTable savePayOrderByNoAuth(MerchantInfoTable merInfoTable, MerNoAuthPayOrderApplyDTO merNoAuthPayOrderApplyDTO, ChannelInfoTable channelInfoTable, RegisterCollectTable registerCollectTable, MerchantCardTable merchantCardTable, InnerPrintLogObject ipo) throws NewPayException;
/**
*
* @param merNoAuthPayOrderApplyDTO
* @param ipo
* @throws NewPayException
*/
void checkProductTypeByB10(MerNoAuthPayOrderApplyDTO merNoAuthPayOrderApplyDTO, InnerPrintLogObject ipo) throws NewPayException;
/**
*
* @param merPayOrderApplyDTO
* @param ipo
*/
void checkProductTypeByB7(MerPayOrderApplyDTO merPayOrderApplyDTO, InnerPrintLogObject ipo) throws NewPayException;
/**
*
* @param merchantSettingTableList
* @param productType
* @param ipo
* @return
*/
List<MerchantSettingTable> filterMerchantSettingTableByProductType(List<MerchantSettingTable> merchantSettingTableList, String productType, InnerPrintLogObject ipo) throws NewPayException;
}
|
UTF-8
|
Java
| 12,106 |
java
|
NewPayOrderService.java
|
Java
|
[] | null |
[] |
package com.internal.playment.pay.service.shortcut;
import com.internal.playment.common.dto.CrossResponseMsgDTO;
import com.internal.playment.common.dto.MerNoAuthPayOrderApplyDTO;
import com.internal.playment.common.dto.MerPayOrderApplyDTO;
import com.internal.playment.common.inner.InnerPrintLogObject;
import com.internal.playment.common.inner.NewPayException;
import com.internal.playment.common.inner.ParamRule;
import com.internal.playment.common.table.business.MerchantCardTable;
import com.internal.playment.common.table.business.PayOrderInfoTable;
import com.internal.playment.common.table.business.RegisterCollectTable;
import com.internal.playment.common.table.channel.ChannelHistoryTable;
import com.internal.playment.common.table.channel.ChannelInfoTable;
import com.internal.playment.common.table.merchant.MerchantInfoTable;
import com.internal.playment.common.table.merchant.MerchantQuotaRiskTable;
import com.internal.playment.common.table.system.MerchantSettingTable;
import com.internal.playment.common.table.system.RiskQuotaTable;
import com.internal.playment.common.tuple.Tuple2;
import com.internal.playment.pay.service.CommonServiceInterface;
import java.util.List;
import java.util.Map;
import java.util.Set;
public interface NewPayOrderService extends CommonServiceInterface {
/**
* 支付下单申请
* @return
*/
Map<String, ParamRule> getParamMapByB7();
/**
*
* @return
*/
Map<String, ParamRule> getParamMapByB8();
/**
*
* @return
*/
Map<String, ParamRule> getParamMapByB9();
/**
*
* @return
*/
Map<String, ParamRule> getParamMapByB10();
/**
* 查看是否重复订单
* @param merOrderId
* @param ipo
*/
void multipleOrder(String merOrderId, InnerPrintLogObject ipo) throws NewPayException;
/**
* 获取商户风控信息
* @param merchantId
* @param ipo
* @return
*/
MerchantQuotaRiskTable getMerchantQuotaRiskByMerId(String merchantId, InnerPrintLogObject ipo) throws NewPayException;
/**
* 获取成功进件记录
* @param ipo
* @param
* @return
*/
List<RegisterCollectTable> getSuccessRegisterInfo(RegisterCollectTable registerCollectTable,InnerPrintLogObject ipo) throws NewPayException;
/**
* 根据进件信息获取邦卡记录
* @param registerCollectTableList
* @param ipo
* @return
*/
List<MerchantCardTable> getSuccessMerchantCardInfo(List<RegisterCollectTable> registerCollectTableList, InnerPrintLogObject ipo) throws NewPayException;
/**
* 查询通道使用记录
* @param ipo
* @param strings MerchantId TerminalMerId ProductId
* @return
*/
ChannelHistoryTable getChannelHistoryInfo(InnerPrintLogObject ipo, String... strings) throws NewPayException;
/**
* 获取风控交易量统计数据
* @param merInfoTable
* @param ipo
* @return
*/
Tuple2<RiskQuotaTable, RiskQuotaTable> getRiskQuotaInfoByMer(MerchantInfoTable merInfoTable, InnerPrintLogObject ipo) throws NewPayException;
/**
* 单笔风控
* @param amount
* @param merchantQuotaRiskTable
* @param ipo
*/
void checkSingleAmountRisk(String amount, MerchantQuotaRiskTable merchantQuotaRiskTable, InnerPrintLogObject ipo) throws NewPayException;
/**
* 执行平台风控
* @param merchantQuotaRiskTable
* @param merRiskQuota
*/
void executePlatformRisk(String amount, MerchantQuotaRiskTable merchantQuotaRiskTable, Tuple2<RiskQuotaTable, RiskQuotaTable> merRiskQuota, InnerPrintLogObject ipo) throws NewPayException;
/**
* 获取通道信息
* @param channelHistoryTable
* @param ipo
* @return
*/
ChannelInfoTable getChannelInfoByChannelHistory(ChannelHistoryTable channelHistoryTable, InnerPrintLogObject ipo) throws NewPayException;
/**
* 获取该通道历史统计交易量
* @param channelInfoTable
* @param ipo
* @return
*/
Tuple2<RiskQuotaTable, RiskQuotaTable> getRiskQuotaInfoByChannel(ChannelInfoTable channelInfoTable, InnerPrintLogObject ipo) throws NewPayException;
/**
*
* @param channelInfoTable
* @param channelRiskQuota
* @param ipo
* @param args
* @return
* @throws NewPayException
*/
ChannelInfoTable executeChannelRisk(ChannelInfoTable channelInfoTable, Tuple2<RiskQuotaTable, RiskQuotaTable> channelRiskQuota, InnerPrintLogObject ipo, String... args) throws NewPayException;
/**
* 获取一个可行性的通道
* @param channelInfoTableList
* @param ipo
* @return
*/
ChannelInfoTable getFeasibleChannel(List<ChannelInfoTable> channelInfoTableList, InnerPrintLogObject ipo, String... args) throws NewPayException;
/**
* 更新订单结果
* @param crossResponseMsgDTO
* @param crossResponseMsg
* @param payOrderInfoTable
*/
PayOrderInfoTable updateByPayOrderInfo(CrossResponseMsgDTO crossResponseMsgDTO, String crossResponseMsg, PayOrderInfoTable payOrderInfoTable, InnerPrintLogObject ipo) throws NewPayException;
/**
* 生成历史通道信息
* @param channelHistoryTable
* @param payOrderInfoTable
* @return
*/
ChannelHistoryTable updateByChannelHistoryInfo(ChannelHistoryTable channelHistoryTable, PayOrderInfoTable payOrderInfoTable);
/**
* 商户和通道使用汇总情况
* @param payOrderInfoTable
* @param merRiskQuota
* @param channelRiskQuota
* @return
*/
Set<RiskQuotaTable> updateByRiskQuotaInfo(PayOrderInfoTable payOrderInfoTable, Tuple2<RiskQuotaTable, RiskQuotaTable> merRiskQuota, Tuple2<RiskQuotaTable, RiskQuotaTable> channelRiskQuota);
/**
*
* @param payOrderInfoTable
* @param cht
* @param rqtSet
* @param ipo
*/
void batchUpdatePayOderCorrelationInfo(PayOrderInfoTable payOrderInfoTable, ChannelHistoryTable cht, Set<RiskQuotaTable> rqtSet, InnerPrintLogObject ipo) throws NewPayException;
/**
*
* @param platformOrderId
* @param ipo
* @return
*/
PayOrderInfoTable getPayOrderInfoByPlatformOrderId(String platformOrderId, String bussType, InnerPrintLogObject ipo) throws NewPayException;
/**
*
* @param merchantCardTableList
* @param ipo
* @param args
* @return
* @throws NewPayException
*/
List<MerchantCardTable> filterMerCardByPaymentMsg(List<MerchantCardTable> merchantCardTableList, InnerPrintLogObject ipo, String... args) throws NewPayException;
/**
*
* @param registerCollectTableList
* @param merchantCardTableList
* @param ipo
* @return
*/
List<RegisterCollectTable> filterRegCollectInfoByMerCard(List<RegisterCollectTable> registerCollectTableList, List<MerchantCardTable> merchantCardTableList, InnerPrintLogObject ipo) throws NewPayException;
/**
*
* @param registerCollectTableList
* @param ipo
* @param args
* @return
* @throws NewPayException
*/
List<ChannelInfoTable> getAllUsableChannelList(List<RegisterCollectTable> registerCollectTableList, InnerPrintLogObject ipo, String... args) throws NewPayException ;
/**
*
* @param channelInfoTable
* @param registerCollectTableList
* @param ipo
* @return
*/
RegisterCollectTable finallyFilterRegCollect(ChannelInfoTable channelInfoTable, List<RegisterCollectTable> registerCollectTableList, InnerPrintLogObject ipo) throws NewPayException;
/**
*
* @param merchantCardTableList
* @param ipo
* @param args
* @return
* @throws NewPayException
*/
MerchantCardTable finallyFilterMerCard(List<MerchantCardTable> merchantCardTableList, InnerPrintLogObject ipo, String... args) throws NewPayException;
/**
*
* @param channelInfoTable
* @param ipo
* @return
*/
RegisterCollectTable getSuccessRegInfoByChanInfo(ChannelInfoTable channelInfoTable, InnerPrintLogObject ipo) throws NewPayException;
/**
*
* @param channelInfoTable
* @param registerCollectTable
* @param ipo
* @return
*/
MerchantCardTable getMerCardByChanAndReg(ChannelInfoTable channelInfoTable, RegisterCollectTable registerCollectTable, InnerPrintLogObject ipo, String... args) throws NewPayException;
/**
*
* @param registerCollectTableList
* @param merchantSettingTableList
* @param ipo
* @return
*/
List<RegisterCollectTable> filterRegCollectByMerSet(List<RegisterCollectTable> registerCollectTableList, List<MerchantSettingTable> merchantSettingTableList, InnerPrintLogObject ipo) throws NewPayException;
/**
*
* @param channelInfoTableList
* @param channelInfoTable
* @param ipo
* @return
*/
List<ChannelInfoTable> subtractUnableChanInfo(List<ChannelInfoTable> channelInfoTableList, ChannelInfoTable channelInfoTable, InnerPrintLogObject ipo) throws NewPayException;
/**
*
* @param channelInfoTable
* @param merchantSettingTableList
* @return
*/
ChannelInfoTable judgeThisChannelUsable(ChannelInfoTable channelInfoTable, List<MerchantSettingTable> merchantSettingTableList);
/**
*
* @param merInfoTable
* @param merPayOrderApplyDTO
* @param channelInfoTable
* @param registerCollectTable
* @param merchantCardTable
* @param ipo
* @return
*/
PayOrderInfoTable savePayOrder(MerchantInfoTable merInfoTable, MerPayOrderApplyDTO merPayOrderApplyDTO, ChannelInfoTable channelInfoTable, RegisterCollectTable registerCollectTable, MerchantCardTable merchantCardTable, InnerPrintLogObject ipo) throws NewPayException;
/**
*
* @param payOrderInfoTable
* @param ipo
* @param args
* @return
* @throws NewPayException
*/
PayOrderInfoTable updateByPayOrderInfoByBefore(PayOrderInfoTable payOrderInfoTable, InnerPrintLogObject ipo, String... args) throws NewPayException;
/**
*
* @param payOrderInfoTable
* @return
*/
MerPayOrderApplyDTO getMerPayOrderApplyDTO(PayOrderInfoTable payOrderInfoTable);
/**
*
* @param payOrderInfoTable
* @param ipo
*/
void checkPayOrderInfoTableByB9(PayOrderInfoTable payOrderInfoTable, InnerPrintLogObject ipo) throws NewPayException;
/**
*
* @param crossResponseMsgDTO
* @param crossResponseMsg
* @param payOrderInfoTable
* @param ipo
* @return
*/
PayOrderInfoTable updateByPayOrderInfoByB9After(CrossResponseMsgDTO crossResponseMsgDTO, String crossResponseMsg, PayOrderInfoTable payOrderInfoTable, InnerPrintLogObject ipo) throws NewPayException;
/**
*
* @param merInfoTable
* @param merNoAuthPayOrderApplyDTO
* @param channelInfoTable
* @param registerCollectTable
* @param merchantCardTable
* @param ipo
* @return
*/
PayOrderInfoTable savePayOrderByNoAuth(MerchantInfoTable merInfoTable, MerNoAuthPayOrderApplyDTO merNoAuthPayOrderApplyDTO, ChannelInfoTable channelInfoTable, RegisterCollectTable registerCollectTable, MerchantCardTable merchantCardTable, InnerPrintLogObject ipo) throws NewPayException;
/**
*
* @param merNoAuthPayOrderApplyDTO
* @param ipo
* @throws NewPayException
*/
void checkProductTypeByB10(MerNoAuthPayOrderApplyDTO merNoAuthPayOrderApplyDTO, InnerPrintLogObject ipo) throws NewPayException;
/**
*
* @param merPayOrderApplyDTO
* @param ipo
*/
void checkProductTypeByB7(MerPayOrderApplyDTO merPayOrderApplyDTO, InnerPrintLogObject ipo) throws NewPayException;
/**
*
* @param merchantSettingTableList
* @param productType
* @param ipo
* @return
*/
List<MerchantSettingTable> filterMerchantSettingTableByProductType(List<MerchantSettingTable> merchantSettingTableList, String productType, InnerPrintLogObject ipo) throws NewPayException;
}
| 12,106 | 0.724152 | 0.722719 | 359 | 32.03064 | 48.362564 | 291 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.387187 | false | false |
3
|
7668aad3a4b4ceb1e76b4e808d993b582ed7ac06
| 6,055,903,948,603 |
34eddc093bf2249845882f7587c773f029494f51
|
/smgp3-protocol/src/main/java/win/sinno/smgp3/protocol/ISmgpProtocol.java
|
b1cc930dfeaf15de434425f5faac27e13815cf2b
|
[] |
no_license
|
wilesun/smgp3
|
https://github.com/wilesun/smgp3
|
e5e0c9298c7f948d640ada78f7a0612e29b71272
|
13047eb440f16359d7422e86b6b0be3fa4ca710e
|
refs/heads/master
| 2021-05-15T21:14:40.249000 | 2017-10-10T02:10:08 | 2017-10-10T02:10:08 | 106,351,397 | 0 | 0 | null | true | 2017-10-10T01:00:52 | 2017-10-10T01:00:52 | 2017-02-09T06:12:10 | 2017-02-22T03:39:36 | 161 | 0 | 0 | 0 | null | null | null |
package win.sinno.smgp3.protocol;
import java.io.Serializable;
/**
* smgp protocol
*
* @author : admin@chenlizhong.cn
* @version : 1.0
* @since : 2017/2/16 上午10:31
*/
public interface ISmgpProtocol extends Serializable {
}
|
UTF-8
|
Java
| 235 |
java
|
ISmgpProtocol.java
|
Java
|
[
{
"context": "erializable;\n\n/**\n * smgp protocol\n *\n * @author : admin@chenlizhong.cn\n * @version : 1.0\n * @since : 2017/2/16 上午10:31\n ",
"end": 122,
"score": 0.9999296069145203,
"start": 102,
"tag": "EMAIL",
"value": "admin@chenlizhong.cn"
}
] | null |
[] |
package win.sinno.smgp3.protocol;
import java.io.Serializable;
/**
* smgp protocol
*
* @author : <EMAIL>
* @version : 1.0
* @since : 2017/2/16 上午10:31
*/
public interface ISmgpProtocol extends Serializable {
}
| 222 | 0.701299 | 0.640693 | 13 | 16.76923 | 16.465132 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.153846 | false | false |
3
|
55e586dd5d156d91da218ee27b40aff3ecf7fcf3
| 33,380,485,857,949 |
fcf7a81eee684f31c5591bb9649740c12be60139
|
/박지수/3주차/_7793_오_나의_여신님.java
|
71b735080976e056276da96c87c72b72422c526a
|
[] |
no_license
|
KingBlackCow/study_hard-master
|
https://github.com/KingBlackCow/study_hard-master
|
5c356dd93d87f4c68f95a7a0b2e516b36f0528a1
|
bddb7f8ef777b1e874eefaaac894d7fc23000315
|
refs/heads/master
| 2023-03-20T10:20:26.033000 | 2021-02-28T13:44:05 | 2021-02-28T13:44:05 | 342,916,537 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
class xy_7793 {
int y;
int x;
xy_7793(int y, int x) {
this.y = y;
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
}
class move extends xy_7793 {
int cnt;
move(int y, int x, int cnt) {
super(y, x);
this.cnt = cnt;
}
public int getCnt() {
return cnt;
}
public void setCnt(int cnt) {
this.cnt = cnt;
}
}
public class _7793_오_나의_여신님 {
static final int MAX = 51;
static int H, W;
static int ay[] = { -1, 1, 0, 0 };
static int ax[] = { 0, 0, -1, 1 };
static char map[][];
static boolean visit_play[][] = new boolean[MAX][MAX];
static boolean visit_devil[][] = new boolean[MAX][MAX];
static void init() throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int tc = Integer.parseInt(br.readLine());
for (int t = 1; t <= tc; t++) {
String[] temp = br.readLine().split(" ");
H = Integer.parseInt(temp[0]);
W = Integer.parseInt(temp[1]);
map = new char[H][W];
xy_7793 player = null;
xy_7793 devil = null;
Queue<xy_7793> d = new LinkedList<xy_7793>();
Queue<move> p = new LinkedList<move>();
for (boolean[] item : visit_play)
Arrays.fill(item, false);
for (boolean[] item : visit_devil)
Arrays.fill(item, false);
for (int i = 0; i < H; i++) {
map[i] = br.readLine().toCharArray();
for (int j = 0; j < W; j++) {
//여신이 D인줄 알아서 틀린문제
if (map[i][j] == 'S') {
player = new xy_7793(i, j);
p.add(new move(player.getY(), player.getX(), 0));
visit_play[player.getY()][player.getX()] = true;
}
if (map[i][j] == '*') {
devil = new xy_7793(i, j);
d.add(new xy_7793(devil.getY(), devil.getX()));
visit_devil[devil.getY()][devil.getX()] = true;
}
}
}
int result = solve(d, p);
System.out.print("#" + t + " ");
if (result == -1)
System.out.println("GAME OVER");
else
System.out.println(result);
}
}
static int solve(Queue<xy_7793> d, Queue<move> p) {
while (!p.isEmpty()) {
// view();
int devilSize = d.size();
int playerSize = p.size();
if (playerSize==0) break;
while (devilSize-- > 0) {
xy_7793 out = d.poll();
int y = out.getY();
int x = out.getX();
for (int i = 0; i < 4; i++) {
int ny = y + ay[i];
int nx = x + ax[i];
if (!range(ny, nx)) {
if (!visit_devil[ny][nx] && map[ny][nx] != 'D') {
visit_devil[ny][nx] = true;
// map[ny][nx] = '*';
d.add(new xy_7793(ny, nx));
}
}
}
}
while (playerSize-- > 0) {
move out = p.poll();
int y = out.getY();
int x = out.getX();
int cnt = out.getCnt();
if (map[y][x] == 'D') {
return cnt;
}
for (int i = 0; i < 4; i++) {
int ny = y + ay[i];
int nx = x + ax[i];
if (!range(ny, nx)) {
if (!visit_play[ny][nx] && !visit_devil[ny][nx]) {
visit_play[ny][nx] = true;
// map[ny][nx] = 'D';
p.add(new move(ny, nx, cnt + 1));
}
}
}
}
}
return -1;
}
static boolean range(int y, int x) {
return y < 0 || x < 0 || y > H - 1 || x > W - 1 || map[y][x] == 'X';
}
static void view() {
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++)
System.out.print(map[i][j]);
System.out.println();
}
System.out.println();
}
public static void main(String[] args) throws NumberFormatException, IOException {
// TODO Auto-generated method stub
init();
}
}
|
UTF-8
|
Java
| 3,777 |
java
|
_7793_오_나의_여신님.java
|
Java
|
[] | null |
[] |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
class xy_7793 {
int y;
int x;
xy_7793(int y, int x) {
this.y = y;
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
}
class move extends xy_7793 {
int cnt;
move(int y, int x, int cnt) {
super(y, x);
this.cnt = cnt;
}
public int getCnt() {
return cnt;
}
public void setCnt(int cnt) {
this.cnt = cnt;
}
}
public class _7793_오_나의_여신님 {
static final int MAX = 51;
static int H, W;
static int ay[] = { -1, 1, 0, 0 };
static int ax[] = { 0, 0, -1, 1 };
static char map[][];
static boolean visit_play[][] = new boolean[MAX][MAX];
static boolean visit_devil[][] = new boolean[MAX][MAX];
static void init() throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int tc = Integer.parseInt(br.readLine());
for (int t = 1; t <= tc; t++) {
String[] temp = br.readLine().split(" ");
H = Integer.parseInt(temp[0]);
W = Integer.parseInt(temp[1]);
map = new char[H][W];
xy_7793 player = null;
xy_7793 devil = null;
Queue<xy_7793> d = new LinkedList<xy_7793>();
Queue<move> p = new LinkedList<move>();
for (boolean[] item : visit_play)
Arrays.fill(item, false);
for (boolean[] item : visit_devil)
Arrays.fill(item, false);
for (int i = 0; i < H; i++) {
map[i] = br.readLine().toCharArray();
for (int j = 0; j < W; j++) {
//여신이 D인줄 알아서 틀린문제
if (map[i][j] == 'S') {
player = new xy_7793(i, j);
p.add(new move(player.getY(), player.getX(), 0));
visit_play[player.getY()][player.getX()] = true;
}
if (map[i][j] == '*') {
devil = new xy_7793(i, j);
d.add(new xy_7793(devil.getY(), devil.getX()));
visit_devil[devil.getY()][devil.getX()] = true;
}
}
}
int result = solve(d, p);
System.out.print("#" + t + " ");
if (result == -1)
System.out.println("GAME OVER");
else
System.out.println(result);
}
}
static int solve(Queue<xy_7793> d, Queue<move> p) {
while (!p.isEmpty()) {
// view();
int devilSize = d.size();
int playerSize = p.size();
if (playerSize==0) break;
while (devilSize-- > 0) {
xy_7793 out = d.poll();
int y = out.getY();
int x = out.getX();
for (int i = 0; i < 4; i++) {
int ny = y + ay[i];
int nx = x + ax[i];
if (!range(ny, nx)) {
if (!visit_devil[ny][nx] && map[ny][nx] != 'D') {
visit_devil[ny][nx] = true;
// map[ny][nx] = '*';
d.add(new xy_7793(ny, nx));
}
}
}
}
while (playerSize-- > 0) {
move out = p.poll();
int y = out.getY();
int x = out.getX();
int cnt = out.getCnt();
if (map[y][x] == 'D') {
return cnt;
}
for (int i = 0; i < 4; i++) {
int ny = y + ay[i];
int nx = x + ax[i];
if (!range(ny, nx)) {
if (!visit_play[ny][nx] && !visit_devil[ny][nx]) {
visit_play[ny][nx] = true;
// map[ny][nx] = 'D';
p.add(new move(ny, nx, cnt + 1));
}
}
}
}
}
return -1;
}
static boolean range(int y, int x) {
return y < 0 || x < 0 || y > H - 1 || x > W - 1 || map[y][x] == 'X';
}
static void view() {
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++)
System.out.print(map[i][j]);
System.out.println();
}
System.out.println();
}
public static void main(String[] args) throws NumberFormatException, IOException {
// TODO Auto-generated method stub
init();
}
}
| 3,777 | 0.533814 | 0.510291 | 170 | 21.005882 | 17.19285 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.270588 | false | false |
3
|
587abe8963e869af968388752b6777d89a64edbc
| 18,047,452,612,086 |
9419483ec6673ce8894eb595ab93f9196ac9cf2c
|
/Practicas/EVA1/EVA1_7_RADIOGROUP/app/src/main/java/com/example/eva1_7_radiogroup/MainActivity.java
|
f7d7a1da34f55b67b9c5660ed0bd6f8ef9a0acc4
|
[] |
no_license
|
wolfieito/Desarrollo-de-aplicaciones-mobiles
|
https://github.com/wolfieito/Desarrollo-de-aplicaciones-mobiles
|
adf48f0368958f3ee63f4ab38eef98d1032909b0
|
e8b155bb4e0c67dff59520f39949105766a13731
|
refs/heads/main
| 2023-06-16T04:37:15.405000 | 2021-07-09T20:55:28 | 2021-07-09T20:55:28 | 344,925,818 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.eva1_7_radiogroup;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
RadioGroup rdGrpAnime;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
rdGrpAnime=findViewById(R.id.rdGrpAnime);
//asignar el listener, crear el listener
//por clase anonima
rdGrpAnime.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
//primero recivimos el radiogroup que genera el evento, despues es el ID del radiobutton seleccionado
//switch (checkedId){
// case R.id.radioButton5:
// Toast.makeText(getApplicationContext(),"Shonen",Toast.LENGTH_SHORT).show();
// break;
//case R.id.radioButton:
// Toast.makeText(getApplicationContext(),"Comedia",Toast.LENGTH_LONG).show();
// break;
//case R.id.radioButton2:
// Toast.makeText(getApplicationContext(),"Harem",Toast.LENGTH_SHORT).show();
//break;
//case R.id.radioButton3:
// Toast.makeText(getApplicationContext(),"Seinen",Toast.LENGTH_SHORT).show();
//break;
//case R.id.radioButton4:
// Toast.makeText(getApplicationContext(),"Shojo",Toast.LENGTH_SHORT).show();
//break;
//}
RadioButton rdBtnSel = findViewById(checkedId);//RadioButton seleccionado
Toast.makeText(getApplicationContext(),rdBtnSel.getText(),Toast.LENGTH_SHORT).show();
}
});
}
}
|
UTF-8
|
Java
| 2,077 |
java
|
MainActivity.java
|
Java
|
[
{
"context": " // Toast.makeText(getApplicationContext(),\"Shonen\",Toast.LENGTH_SHORT).show();\n ",
"end": 1048,
"score": 0.9478949308395386,
"start": 1042,
"tag": "NAME",
"value": "Shonen"
},
{
"context": " // Toast.makeText(getApplicationContext(),\"Harem\",Toast.LENGTH_SHORT).show();\n ",
"end": 1408,
"score": 0.9911267161369324,
"start": 1403,
"tag": "NAME",
"value": "Harem"
},
{
"context": " // Toast.makeText(getApplicationContext(),\"Seinen\",Toast.LENGTH_SHORT).show();\n ",
"end": 1589,
"score": 0.8041236400604248,
"start": 1583,
"tag": "NAME",
"value": "Seinen"
},
{
"context": " // Toast.makeText(getApplicationContext(),\"Shojo\",Toast.LENGTH_SHORT).show();\n ",
"end": 1769,
"score": 0.9987671971321106,
"start": 1764,
"tag": "NAME",
"value": "Shojo"
}
] | null |
[] |
package com.example.eva1_7_radiogroup;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
RadioGroup rdGrpAnime;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
rdGrpAnime=findViewById(R.id.rdGrpAnime);
//asignar el listener, crear el listener
//por clase anonima
rdGrpAnime.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
//primero recivimos el radiogroup que genera el evento, despues es el ID del radiobutton seleccionado
//switch (checkedId){
// case R.id.radioButton5:
// Toast.makeText(getApplicationContext(),"Shonen",Toast.LENGTH_SHORT).show();
// break;
//case R.id.radioButton:
// Toast.makeText(getApplicationContext(),"Comedia",Toast.LENGTH_LONG).show();
// break;
//case R.id.radioButton2:
// Toast.makeText(getApplicationContext(),"Harem",Toast.LENGTH_SHORT).show();
//break;
//case R.id.radioButton3:
// Toast.makeText(getApplicationContext(),"Seinen",Toast.LENGTH_SHORT).show();
//break;
//case R.id.radioButton4:
// Toast.makeText(getApplicationContext(),"Shojo",Toast.LENGTH_SHORT).show();
//break;
//}
RadioButton rdBtnSel = findViewById(checkedId);//RadioButton seleccionado
Toast.makeText(getApplicationContext(),rdBtnSel.getText(),Toast.LENGTH_SHORT).show();
}
});
}
}
| 2,077 | 0.590274 | 0.587386 | 46 | 44.173912 | 32.082981 | 117 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.826087 | false | false |
3
|
f0edb1fcb4dc76694b8710eeda38afec23acd590
| 6,828,998,046,420 |
f2a39043df82d29fcfdda482d148ee5926e96d33
|
/src/main/java/org/academiadecodigo/codezillas/resumeRest/service/summary/SummarySvcImpl.java
|
6ab36972b023712c239820e9439112cbeb2be436
|
[] |
no_license
|
rmcorre/folio-backend
|
https://github.com/rmcorre/folio-backend
|
728b3d9624fc2d4a68573d391027e0cfc363afe0
|
6aa86fcf1498b93226e2fbd9ad831cf2c8a9783b
|
refs/heads/main
| 2023-08-11T09:32:17.775000 | 2021-04-07T21:17:10 | 2021-04-07T21:17:10 | 355,681,648 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.academiadecodigo.codezillas.resumeRest.service.summary;
import org.academiadecodigo.codezillas.resumeRest.repository.SummaryJpaRepository;
import org.academiadecodigo.codezillas.resumeRest.domainModel.summary.Summary;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.util.List;
@Service
@Transactional
public class SummarySvcImpl implements SummarySvc {
private final SummaryJpaRepository summaryJpaRepository;
@Autowired
public SummarySvcImpl(SummaryJpaRepository summaryJpaRepository) {
this.summaryJpaRepository = summaryJpaRepository;
}
@Override
public List<Summary> getSummaries() {
return summaryJpaRepository.findAll();
}
}
|
UTF-8
|
Java
| 807 |
java
|
SummarySvcImpl.java
|
Java
|
[] | null |
[] |
package org.academiadecodigo.codezillas.resumeRest.service.summary;
import org.academiadecodigo.codezillas.resumeRest.repository.SummaryJpaRepository;
import org.academiadecodigo.codezillas.resumeRest.domainModel.summary.Summary;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.util.List;
@Service
@Transactional
public class SummarySvcImpl implements SummarySvc {
private final SummaryJpaRepository summaryJpaRepository;
@Autowired
public SummarySvcImpl(SummaryJpaRepository summaryJpaRepository) {
this.summaryJpaRepository = summaryJpaRepository;
}
@Override
public List<Summary> getSummaries() {
return summaryJpaRepository.findAll();
}
}
| 807 | 0.810409 | 0.810409 | 26 | 30.038462 | 28.165009 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.384615 | false | false |
3
|
bcc7bccd54f9adaeccac545c66ce3b03dd1374d5
| 11,038,065,983,159 |
8f1fbe5db74fd74f093bdf29096444bb5cf0dfbc
|
/plugins/src/org/lockss/plugin/copernicus/CopernicusArticleIteratorFactory.java
|
7d5098b4847969f0295d79377840aea00add85bc
|
[] |
no_license
|
bellmit/lockss-daemon
|
https://github.com/bellmit/lockss-daemon
|
432801ff9fe15ef0eb92ba17f34d2afd1f2ef29f
|
e1b9f0945fe7766d308d43070acf252e257befd7
|
refs/heads/master
| 2022-03-23T16:20:23.889000 | 2013-05-02T04:38:33 | 2013-05-02T04:38:33 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* $Id: CopernicusArticleIteratorFactory.java,v 1.2 2012/11/19 21:03:18 alexandraohlson Exp $
*/
/*
Copyright (c) 2000-2012 Board of Trustees of Leland Stanford Jr. University,
all rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
STANFORD UNIVERSITY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Stanford University shall not
be used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from Stanford University.
*/
package org.lockss.plugin.copernicus;
import java.util.Iterator;
import java.util.regex.*;
import org.lockss.daemon.*;
import org.lockss.extractor.*;
import org.lockss.plugin.*;
import org.lockss.util.Logger;
/*
* Article lives at: http://www.<base-url>/<volume>/<startpage#>/<year>/<alphanumericID>
* <article>.html is the abstract
* <article>.pdf is the full text pdf
* * there might additionally be an <article>-supplement.pdf
* <article>.bib, ris, xml are the citations
*/
public class CopernicusArticleIteratorFactory
implements ArticleIteratorFactory,
ArticleMetadataExtractorFactory {
protected static Logger log = Logger.getLogger("CopernicusArticleIteratorFactory");
protected static final String ROOT_TEMPLATE = "\"%s%s/\", base_url, volume_name"; // params from tdb file corresponding to AU
// In the pattern, the bit in parens (ending in supplement) excludes thos patterns that end in <blah>supplement.pdf, but takes other <blah>.pdf
// protected static final String PATTERN_TEMPLATE = "\"^%s%s/[0-9]+/[0-9]+/(?![A-Za-z0-9-]+supplement\\.pdf)[A-Za-z0-9-]+\\.pdf\", base_url,volume_name";
// pick up the abstract as the logical definition of one article
// although the format seems to be consistent, don't box in the alphanum sequence, just the depth
protected static final String PATTERN_TEMPLATE = "\"^%s%s/[^/]+/[^/]+/[^/]+\\.html\", base_url,volume_name";
@Override
public Iterator<ArticleFiles> createArticleIterator(ArchivalUnit au,
MetadataTarget target)
throws PluginException {
return new CopernicusArticleIterator(au,
new SubTreeArticleIterator.Spec()
.setTarget(target)
.setRootTemplate(ROOT_TEMPLATE)
.setPatternTemplate(PATTERN_TEMPLATE));
}
protected static class CopernicusArticleIterator extends SubTreeArticleIterator {
// Use parens to group the base article URL
protected Pattern ABSTRACT_PATTERN = Pattern.compile("(/[^/]+/[^/]+/[^/]+)\\.html$", Pattern.CASE_INSENSITIVE);
public CopernicusArticleIterator(ArchivalUnit au,
SubTreeArticleIterator.Spec spec) {
super(au, spec);
}
@Override
protected ArticleFiles createArticleFiles(CachedUrl cu) {
String url = cu.getUrl();
log.info("article url?: " + url);
Matcher mat = ABSTRACT_PATTERN.matcher(url);
if (mat.find()) {
return processAbstract(cu, mat);
}
log.warning("Mismatch between article iterator factory and article iterator: " + url);
return null;
}
protected ArticleFiles processAbstract(CachedUrl cu, Matcher mat) {
ArticleFiles af = new ArticleFiles();
af.setRoleCu(ArticleFiles.ROLE_ABSTRACT, cu);
af.setRoleCu(ArticleFiles.ROLE_FULL_TEXT_PDF_LANDING_PAGE, cu);
guessAdditionalFiles(af, mat);
return af;
}
protected void guessAdditionalFiles(ArticleFiles af, Matcher mat) {
CachedUrl pdfCu = au.makeCachedUrl(mat.replaceFirst("$1.pdf"));
CachedUrl risCu = au.makeCachedUrl(mat.replaceFirst("$1.ris"));
CachedUrl bibCu = au.makeCachedUrl(mat.replaceFirst("$1.bib"));
CachedUrl supCu = au.makeCachedUrl(mat.replaceFirst("$1-supplement.pdf"));
//.xml file is another version of metadata plus references & abstract. ignore it.
// note that if there is no PDF you will not have a ROLE_FULL_TEXT_CU!!
if (pdfCu != null && pdfCu.hasContent()) {
af.setFullTextCu(pdfCu);
af.setRoleCu(ArticleFiles.ROLE_FULL_TEXT_PDF, pdfCu);
}
AuUtil.safeRelease(pdfCu);
if (risCu != null && risCu.hasContent()) {
af.setRoleCu(ArticleFiles.ROLE_CITATION + "Ris", risCu);
af.setRoleCu(ArticleFiles.ROLE_ARTICLE_METADATA, risCu);
}
AuUtil.safeRelease(risCu);
if (bibCu != null && bibCu.hasContent()) {
af.setRoleCu(ArticleFiles.ROLE_CITATION + "Bibtex", bibCu);
}
AuUtil.safeRelease(bibCu);
if (supCu != null && supCu.hasContent()) {
af.setRoleCu(ArticleFiles.ROLE_SUPPLEMENTARY_MATERIALS, supCu);
}
AuUtil.safeRelease(supCu);
}
}
@Override
public ArticleMetadataExtractor createArticleMetadataExtractor(MetadataTarget target)
throws PluginException {
return new BaseArticleMetadataExtractor(ArticleFiles.ROLE_ARTICLE_METADATA);
}
}
|
UTF-8
|
Java
| 6,046 |
java
|
CopernicusArticleIteratorFactory.java
|
Java
|
[
{
"context": "icleIteratorFactory.java,v 1.2 2012/11/19 21:03:18 alexandraohlson Exp $\n */\n\n/*\n\nCopyright (c) 2000-2012 Board of T",
"end": 90,
"score": 0.9979036450386047,
"start": 75,
"tag": "USERNAME",
"value": "alexandraohlson"
}
] | null |
[] |
/*
* $Id: CopernicusArticleIteratorFactory.java,v 1.2 2012/11/19 21:03:18 alexandraohlson Exp $
*/
/*
Copyright (c) 2000-2012 Board of Trustees of Leland Stanford Jr. University,
all rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
STANFORD UNIVERSITY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Stanford University shall not
be used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from Stanford University.
*/
package org.lockss.plugin.copernicus;
import java.util.Iterator;
import java.util.regex.*;
import org.lockss.daemon.*;
import org.lockss.extractor.*;
import org.lockss.plugin.*;
import org.lockss.util.Logger;
/*
* Article lives at: http://www.<base-url>/<volume>/<startpage#>/<year>/<alphanumericID>
* <article>.html is the abstract
* <article>.pdf is the full text pdf
* * there might additionally be an <article>-supplement.pdf
* <article>.bib, ris, xml are the citations
*/
public class CopernicusArticleIteratorFactory
implements ArticleIteratorFactory,
ArticleMetadataExtractorFactory {
protected static Logger log = Logger.getLogger("CopernicusArticleIteratorFactory");
protected static final String ROOT_TEMPLATE = "\"%s%s/\", base_url, volume_name"; // params from tdb file corresponding to AU
// In the pattern, the bit in parens (ending in supplement) excludes thos patterns that end in <blah>supplement.pdf, but takes other <blah>.pdf
// protected static final String PATTERN_TEMPLATE = "\"^%s%s/[0-9]+/[0-9]+/(?![A-Za-z0-9-]+supplement\\.pdf)[A-Za-z0-9-]+\\.pdf\", base_url,volume_name";
// pick up the abstract as the logical definition of one article
// although the format seems to be consistent, don't box in the alphanum sequence, just the depth
protected static final String PATTERN_TEMPLATE = "\"^%s%s/[^/]+/[^/]+/[^/]+\\.html\", base_url,volume_name";
@Override
public Iterator<ArticleFiles> createArticleIterator(ArchivalUnit au,
MetadataTarget target)
throws PluginException {
return new CopernicusArticleIterator(au,
new SubTreeArticleIterator.Spec()
.setTarget(target)
.setRootTemplate(ROOT_TEMPLATE)
.setPatternTemplate(PATTERN_TEMPLATE));
}
protected static class CopernicusArticleIterator extends SubTreeArticleIterator {
// Use parens to group the base article URL
protected Pattern ABSTRACT_PATTERN = Pattern.compile("(/[^/]+/[^/]+/[^/]+)\\.html$", Pattern.CASE_INSENSITIVE);
public CopernicusArticleIterator(ArchivalUnit au,
SubTreeArticleIterator.Spec spec) {
super(au, spec);
}
@Override
protected ArticleFiles createArticleFiles(CachedUrl cu) {
String url = cu.getUrl();
log.info("article url?: " + url);
Matcher mat = ABSTRACT_PATTERN.matcher(url);
if (mat.find()) {
return processAbstract(cu, mat);
}
log.warning("Mismatch between article iterator factory and article iterator: " + url);
return null;
}
protected ArticleFiles processAbstract(CachedUrl cu, Matcher mat) {
ArticleFiles af = new ArticleFiles();
af.setRoleCu(ArticleFiles.ROLE_ABSTRACT, cu);
af.setRoleCu(ArticleFiles.ROLE_FULL_TEXT_PDF_LANDING_PAGE, cu);
guessAdditionalFiles(af, mat);
return af;
}
protected void guessAdditionalFiles(ArticleFiles af, Matcher mat) {
CachedUrl pdfCu = au.makeCachedUrl(mat.replaceFirst("$1.pdf"));
CachedUrl risCu = au.makeCachedUrl(mat.replaceFirst("$1.ris"));
CachedUrl bibCu = au.makeCachedUrl(mat.replaceFirst("$1.bib"));
CachedUrl supCu = au.makeCachedUrl(mat.replaceFirst("$1-supplement.pdf"));
//.xml file is another version of metadata plus references & abstract. ignore it.
// note that if there is no PDF you will not have a ROLE_FULL_TEXT_CU!!
if (pdfCu != null && pdfCu.hasContent()) {
af.setFullTextCu(pdfCu);
af.setRoleCu(ArticleFiles.ROLE_FULL_TEXT_PDF, pdfCu);
}
AuUtil.safeRelease(pdfCu);
if (risCu != null && risCu.hasContent()) {
af.setRoleCu(ArticleFiles.ROLE_CITATION + "Ris", risCu);
af.setRoleCu(ArticleFiles.ROLE_ARTICLE_METADATA, risCu);
}
AuUtil.safeRelease(risCu);
if (bibCu != null && bibCu.hasContent()) {
af.setRoleCu(ArticleFiles.ROLE_CITATION + "Bibtex", bibCu);
}
AuUtil.safeRelease(bibCu);
if (supCu != null && supCu.hasContent()) {
af.setRoleCu(ArticleFiles.ROLE_SUPPLEMENTARY_MATERIALS, supCu);
}
AuUtil.safeRelease(supCu);
}
}
@Override
public ArticleMetadataExtractor createArticleMetadataExtractor(MetadataTarget target)
throws PluginException {
return new BaseArticleMetadataExtractor(ArticleFiles.ROLE_ARTICLE_METADATA);
}
}
| 6,046 | 0.683923 | 0.677969 | 146 | 40.410957 | 35.264496 | 154 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.650685 | false | false |
3
|
3f334bd47cd380db7e95b02aad59d5f4a797b757
| 35,081,292,884,204 |
0050abbdd3b77dad0685b465ec9e50cec031aa78
|
/sport/src/main/java/task1/Application.java
|
c9f64a0cb41174888074566f9e460ecf38360fea
|
[] |
no_license
|
Tiger20111/algoritms
|
https://github.com/Tiger20111/algoritms
|
1d26ff5a4a17e3c8ccce41ef101f6f2ee02c30b3
|
99e3c2d512cf547b60902acb7a3b8a11f504dd68
|
refs/heads/master
| 2022-12-31T23:36:14.628000 | 2020-10-20T19:30:29 | 2020-10-20T19:30:29 | 305,760,504 | 0 | 1 | null | false | 2020-10-20T17:51:23 | 2020-10-20T15:56:44 | 2020-10-20T17:18:47 | 2020-10-20T17:51:22 | 1 | 0 | 1 | 0 |
Java
| false | false |
package task1;
import task1.tree.SuffixTree;
import java.io.*;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public class Application {
public static void main(String[] args) throws IOException, URISyntaxException {
File file = getFileFromResourceAsStream("input.txt");
FileReader fr = new FileReader(file);
BufferedReader reader = new BufferedReader(fr);
String AStr = reader.readLine();
String BStr = reader.readLine();
AStr = AStr.substring(1, AStr.length() - 1);
BStr = BStr.substring(1, BStr.length() - 1);
SolveTask(AStr, BStr);
}
private static File getFileFromResourceAsStream(String fileName) throws URISyntaxException {
ClassLoader classLoader = Application.class.getClassLoader();
URL resource = classLoader.getResource(fileName);
if (resource == null) {
throw new IllegalArgumentException("file not found! " + fileName);
} else {
return new File(resource.toURI());
}
}
private static void SolveTask(String AStr, String BStr) {
SuffixTree suffixTree = new SuffixTree();
String str = suffixTree.lsc(AStr.replaceAll(",", " "), BStr.replaceAll(",", " "));
List<Integer> pattern =Arrays.stream(str.split("\\s"))
.map(Integer::parseInt)
.collect(Collectors.toList());
System.out.println(pattern.size());
}
}
|
UTF-8
|
Java
| 1,534 |
java
|
Application.java
|
Java
|
[] | null |
[] |
package task1;
import task1.tree.SuffixTree;
import java.io.*;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public class Application {
public static void main(String[] args) throws IOException, URISyntaxException {
File file = getFileFromResourceAsStream("input.txt");
FileReader fr = new FileReader(file);
BufferedReader reader = new BufferedReader(fr);
String AStr = reader.readLine();
String BStr = reader.readLine();
AStr = AStr.substring(1, AStr.length() - 1);
BStr = BStr.substring(1, BStr.length() - 1);
SolveTask(AStr, BStr);
}
private static File getFileFromResourceAsStream(String fileName) throws URISyntaxException {
ClassLoader classLoader = Application.class.getClassLoader();
URL resource = classLoader.getResource(fileName);
if (resource == null) {
throw new IllegalArgumentException("file not found! " + fileName);
} else {
return new File(resource.toURI());
}
}
private static void SolveTask(String AStr, String BStr) {
SuffixTree suffixTree = new SuffixTree();
String str = suffixTree.lsc(AStr.replaceAll(",", " "), BStr.replaceAll(",", " "));
List<Integer> pattern =Arrays.stream(str.split("\\s"))
.map(Integer::parseInt)
.collect(Collectors.toList());
System.out.println(pattern.size());
}
}
| 1,534 | 0.646675 | 0.642764 | 46 | 32.347828 | 26.905001 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.73913 | false | false |
3
|
71198d282efa83638f7d061817468f3fd293ba79
| 14,980,845,984,322 |
d3e38a6272fdb543dc276377d86ea82d254fb8b0
|
/src/main/java/com/forum/forum_backend/exceptions/GlobalControllerAdvice.java
|
8c6dabebe4bc038aa759ea9e501a9069290ab73e
|
[] |
no_license
|
PiotrKaaminski/forum_backend
|
https://github.com/PiotrKaaminski/forum_backend
|
09afe192afa573a6667bfb5d8e43b6094bcd6d79
|
dccb1dc222f1b14dc3e35ef499fed53db8d65dbe
|
refs/heads/main
| 2023-04-08T20:49:55.790000 | 2021-04-19T09:43:41 | 2021-04-19T09:43:41 | 317,385,486 | 0 | 0 | null | false | 2021-04-06T17:45:14 | 2020-12-01T00:54:33 | 2021-01-31T17:29:45 | 2021-04-06T17:45:13 | 439 | 0 | 0 | 0 |
Java
| false | false |
package com.forum.forum_backend.exceptions;
import com.forum.forum_backend.dtos.ExceptionDto;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import javax.servlet.http.HttpServletRequest;
@ControllerAdvice
public class GlobalControllerAdvice {
@ExceptionHandler(UnauthorizedException.class)
public ResponseEntity<ExceptionDto> handleUnauthorizedException (UnauthorizedException ex, HttpServletRequest request) {
ExceptionDto exception = new ExceptionDto();
exception.setStatus(ex.getHttpStatus().value());
exception.setError(ex.getHttpStatus().toString().split(" ")[1]);
exception.setMessage(ex.getMessage());
exception.setPath(request.getRequestURI());
return new ResponseEntity<>(exception, ex.getHttpStatus());
}
@ExceptionHandler(NotFoundException.class)
public ResponseEntity<ExceptionDto> handleNotFoundException(NotFoundException ex, HttpServletRequest request) {
ExceptionDto exception = new ExceptionDto();
exception.setStatus(ex.getHttpStatus().value());
exception.setError(ex.getHttpStatus().toString().split(" ")[1]);
exception.setMessage(ex.getMessage());
exception.setPath(request.getRequestURI());
return new ResponseEntity<>(exception, ex.getHttpStatus());
}
@ExceptionHandler(BadRequestException.class)
public ResponseEntity<ExceptionDto> handleBadRequestException(BadRequestException ex, HttpServletRequest request) {
ExceptionDto exception = new ExceptionDto();
exception.setStatus(ex.getHttpStatus().value());
exception.setError(ex.getHttpStatus().toString().split(" ")[1]);
exception.setMessage(ex.getMessage());
exception.setPath(request.getRequestURI());
return new ResponseEntity<>(exception, ex.getHttpStatus());
}
@ExceptionHandler(MethodArgumentNotValidException.class)
public ResponseEntity<ExceptionDto> handleMethodArgumentNotValidException(MethodArgumentNotValidException ex, HttpServletRequest request) {
ExceptionDto exception = new ExceptionDto();
exception.setStatus(HttpStatus.BAD_REQUEST.value());
exception.setError(HttpStatus.BAD_REQUEST.toString().split(" ")[1]);
exception.setMessage(ex.getBindingResult().getFieldErrors().get(0).getDefaultMessage());
exception.setPath(request.getRequestURI());
return new ResponseEntity<>(exception, HttpStatus.BAD_REQUEST);
}
}
|
UTF-8
|
Java
| 2,515 |
java
|
GlobalControllerAdvice.java
|
Java
|
[] | null |
[] |
package com.forum.forum_backend.exceptions;
import com.forum.forum_backend.dtos.ExceptionDto;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import javax.servlet.http.HttpServletRequest;
@ControllerAdvice
public class GlobalControllerAdvice {
@ExceptionHandler(UnauthorizedException.class)
public ResponseEntity<ExceptionDto> handleUnauthorizedException (UnauthorizedException ex, HttpServletRequest request) {
ExceptionDto exception = new ExceptionDto();
exception.setStatus(ex.getHttpStatus().value());
exception.setError(ex.getHttpStatus().toString().split(" ")[1]);
exception.setMessage(ex.getMessage());
exception.setPath(request.getRequestURI());
return new ResponseEntity<>(exception, ex.getHttpStatus());
}
@ExceptionHandler(NotFoundException.class)
public ResponseEntity<ExceptionDto> handleNotFoundException(NotFoundException ex, HttpServletRequest request) {
ExceptionDto exception = new ExceptionDto();
exception.setStatus(ex.getHttpStatus().value());
exception.setError(ex.getHttpStatus().toString().split(" ")[1]);
exception.setMessage(ex.getMessage());
exception.setPath(request.getRequestURI());
return new ResponseEntity<>(exception, ex.getHttpStatus());
}
@ExceptionHandler(BadRequestException.class)
public ResponseEntity<ExceptionDto> handleBadRequestException(BadRequestException ex, HttpServletRequest request) {
ExceptionDto exception = new ExceptionDto();
exception.setStatus(ex.getHttpStatus().value());
exception.setError(ex.getHttpStatus().toString().split(" ")[1]);
exception.setMessage(ex.getMessage());
exception.setPath(request.getRequestURI());
return new ResponseEntity<>(exception, ex.getHttpStatus());
}
@ExceptionHandler(MethodArgumentNotValidException.class)
public ResponseEntity<ExceptionDto> handleMethodArgumentNotValidException(MethodArgumentNotValidException ex, HttpServletRequest request) {
ExceptionDto exception = new ExceptionDto();
exception.setStatus(HttpStatus.BAD_REQUEST.value());
exception.setError(HttpStatus.BAD_REQUEST.toString().split(" ")[1]);
exception.setMessage(ex.getBindingResult().getFieldErrors().get(0).getDefaultMessage());
exception.setPath(request.getRequestURI());
return new ResponseEntity<>(exception, HttpStatus.BAD_REQUEST);
}
}
| 2,515 | 0.804771 | 0.802783 | 54 | 45.574074 | 32.051811 | 140 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.851852 | false | false |
3
|
4109b827362c5f87c831e2a08dae0fd69b573d01
| 10,608,569,242,754 |
cfd6e3d19b4c3ac052f0d3b1c1eb4a4852c71c74
|
/Core/src/main/java/org/onestonesoup/core/constants/SizeConstants.java
|
604b1262081e4d50a874d0c45e7fce75968c2d67
|
[] |
no_license
|
nikcross/onestonesoup
|
https://github.com/nikcross/onestonesoup
|
9f887019c776586ae576df9b97a084a1e51958ed
|
88fa1effe5228ee838bf9d40e87f96e978e42cf8
|
refs/heads/master
| 2021-01-18T22:25:00.658000 | 2019-04-04T16:03:10 | 2019-04-04T16:03:10 | 32,462,425 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.onestonesoup.core.constants;
public class SizeConstants {
private SizeConstants(){};
public static final long KILOBYTE = 1000;
public static final long MEGABYTE = 1000000;
public static final long GIGABYTE = 1000000000;
}
|
UTF-8
|
Java
| 246 |
java
|
SizeConstants.java
|
Java
|
[] | null |
[] |
package org.onestonesoup.core.constants;
public class SizeConstants {
private SizeConstants(){};
public static final long KILOBYTE = 1000;
public static final long MEGABYTE = 1000000;
public static final long GIGABYTE = 1000000000;
}
| 246 | 0.760163 | 0.674797 | 10 | 23.6 | 19.779787 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.1 | false | false |
3
|
3d0069912a72304c47755cb31aa6157c0ec3892f
| 10,608,569,242,680 |
484fc7516f7417e3731c50573a8c181ffd81a0ea
|
/gca_spring_project/src/main/java/com/yedam/gca/admin/vo/PenaltyVO.java
|
642460553fc96af92212c775f53c34e50383d781
|
[] |
no_license
|
mihy0212/Exercise-project
|
https://github.com/mihy0212/Exercise-project
|
80bfcfb8ddb03115d186b46ad758a2fc8c74aaa6
|
50a0be86248355d7bf921df1c0dd0bd5129a9f28
|
refs/heads/master
| 2022-12-24T10:16:24.338000 | 2020-02-08T17:37:00 | 2020-02-08T17:37:00 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.yedam.gca.admin.vo;
import java.sql.Date;
import lombok.Data;
@Data
public class PenaltyVO {
private String pn_id; // 활동정지 받은 회원 ID
private Date pn_start_dttm; // 활동정지 시작
private Date pn_end_dttm; // 활동정지 끝
}
|
UTF-8
|
Java
| 283 |
java
|
PenaltyVO.java
|
Java
|
[] | null |
[] |
package com.yedam.gca.admin.vo;
import java.sql.Date;
import lombok.Data;
@Data
public class PenaltyVO {
private String pn_id; // 활동정지 받은 회원 ID
private Date pn_start_dttm; // 활동정지 시작
private Date pn_end_dttm; // 활동정지 끝
}
| 283 | 0.661224 | 0.661224 | 13 | 16.846153 | 15.994452 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.230769 | false | false |
3
|
adb741037ed7bde28dcbf813f7f121146b4d5482
| 32,624,571,649,542 |
3637342fa15a76e676dbfb90e824de331955edb5
|
/2s/pojo/src/main/java/com/bcgogo/camera/CameraRecordDTO.java
|
2544fa7b36cd7b91f6f63189c1ddba40424ba8c0
|
[] |
no_license
|
BAT6188/bo
|
https://github.com/BAT6188/bo
|
6147f20832263167101003bea45d33e221d0f534
|
a1d1885aed8cf9522485fd7e1d961746becb99c9
|
refs/heads/master
| 2023-05-31T03:36:26.438000 | 2016-11-03T04:43:05 | 2016-11-03T04:43:05 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.bcgogo.camera;
import java.io.Serializable;
public class CameraRecordDTO implements Serializable {
private String id;
private String camera_id;
private String vehicle_no;
private String arrive_date;
private String ref_order_type;
private String name;
private Long order_id;
private String shop_id;
private String order_idStr;
public Long getOrder_id() {
return order_id;
}
public void setOrder_id(Long order_id) {
this.order_id = order_id;
if(order_id != null){
setOrder_idStr(order_id.toString());
}else {
setOrder_idStr("");
}
}
public String getOrder_idStr() {
return order_idStr;
}
public void setOrder_idStr(String order_idStr) {
this.order_idStr = order_idStr;
}
public String getShop_id() {
return shop_id;
}
public void setShop_id(String shop_id) {
this.shop_id = shop_id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getCamera_id() {
return camera_id;
}
public void setCamera_id(String camera_id) {
this.camera_id = camera_id;
}
public String getVehicle_no() {
return vehicle_no;
}
public void setVehicle_no(String vehicle_no) {
this.vehicle_no = vehicle_no;
}
public String getArrive_date() {
return arrive_date;
}
public void setArrive_date(String arrive_date) {
this.arrive_date = arrive_date;
}
public String getRef_order_type() {
return ref_order_type;
}
public void setRef_order_type(String ref_order_type) {
this.ref_order_type = ref_order_type;
}
}
|
UTF-8
|
Java
| 1,739 |
java
|
CameraRecordDTO.java
|
Java
|
[] | null |
[] |
package com.bcgogo.camera;
import java.io.Serializable;
public class CameraRecordDTO implements Serializable {
private String id;
private String camera_id;
private String vehicle_no;
private String arrive_date;
private String ref_order_type;
private String name;
private Long order_id;
private String shop_id;
private String order_idStr;
public Long getOrder_id() {
return order_id;
}
public void setOrder_id(Long order_id) {
this.order_id = order_id;
if(order_id != null){
setOrder_idStr(order_id.toString());
}else {
setOrder_idStr("");
}
}
public String getOrder_idStr() {
return order_idStr;
}
public void setOrder_idStr(String order_idStr) {
this.order_idStr = order_idStr;
}
public String getShop_id() {
return shop_id;
}
public void setShop_id(String shop_id) {
this.shop_id = shop_id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getCamera_id() {
return camera_id;
}
public void setCamera_id(String camera_id) {
this.camera_id = camera_id;
}
public String getVehicle_no() {
return vehicle_no;
}
public void setVehicle_no(String vehicle_no) {
this.vehicle_no = vehicle_no;
}
public String getArrive_date() {
return arrive_date;
}
public void setArrive_date(String arrive_date) {
this.arrive_date = arrive_date;
}
public String getRef_order_type() {
return ref_order_type;
}
public void setRef_order_type(String ref_order_type) {
this.ref_order_type = ref_order_type;
}
}
| 1,739 | 0.652674 | 0.652674 | 96 | 17.114584 | 16.307507 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.322917 | false | false |
3
|
e757efdf155303d57ab710f60103c03d88df44f3
| 21,758,304,391,126 |
559bd5a128f92753625640aa8acee5c0e6e918a8
|
/app/src/main/java/com/valecom/yingul/main/myAccount/yingulPay/DetailCashFragment.java
|
5bfc8506427a271c622e8e0501ab8fb85b9b461d
|
[] |
no_license
|
ComunidadYingul/YingulApp
|
https://github.com/ComunidadYingul/YingulApp
|
c5b115e620d07b5ed825024f7d507750249ad47b
|
7474b71bb9bcccd0f910ab9fe3364b16f307f997
|
refs/heads/master
| 2020-03-18T21:42:20.253000 | 2018-11-16T13:26:43 | 2018-11-16T13:26:43 | 135,297,168 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.valecom.yingul.main.myAccount.yingulPay;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;
import com.afollestad.materialdialogs.MaterialDialog;
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkResponse;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonObjectRequest;
import com.valecom.yingul.R;
import com.valecom.yingul.main.LoginActivity;
import com.valecom.yingul.network.MySingleton;
import com.valecom.yingul.network.Network;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.HashMap;
import java.util.Map;
/**
* A simple {@link Fragment} subclass.
*/
public class DetailCashFragment extends Fragment {
public static final String TAG = "LoginActivity";
private MaterialDialog progressDialog;
TextView textTotalMoney,textAvailableMoney,textReleasedMoney;
Context mContext;
String username,authorization;
public DetailCashFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View v = inflater.inflate(R.layout.fragment_detail_cash, container, false);
SharedPreferences settings = getActivity().getSharedPreferences(LoginActivity.SESSION_USER, getActivity().MODE_PRIVATE);
username = settings.getString("username","");
authorization = settings.getString("password","");
Log.e("authorization",username+" "+authorization);
progressDialog = new MaterialDialog.Builder(getActivity())
.title(R.string.progress_dialog)
.content(R.string.please_wait)
.cancelable(false)
.progress(true, 0).build();
mContext = getActivity();
textTotalMoney = (TextView)v.findViewById(R.id.textTotalMoney);
textAvailableMoney = (TextView)v.findViewById(R.id.textAvailableMoney);
textReleasedMoney = (TextView)v.findViewById(R.id.textReleasedMoney);
RunGetAccount();
return v;
}
public void RunGetAccount()
{
progressDialog.show();
JsonObjectRequest postRequest = new JsonObjectRequest
(Request.Method.GET, Network.API_URL + "account/getAccountByUser/"+username, null, new Response.Listener<JSONObject>()
{
@Override
public void onResponse(JSONObject response)
{
if (progressDialog != null && progressDialog.isShowing()) {
progressDialog.dismiss();
}
try
{
Log.e("Response: " , response.toString());
double totalMoney=response.getDouble("availableMoney")+response.getDouble("releasedMoney")+response.getDouble("withheldMoney");
double availableMoney = response.getDouble("availableMoney");
double releasedMoney = response.getDouble("releasedMoney");
textTotalMoney.setText(String.format("%.2f", totalMoney));
textAvailableMoney.setText(String.format("%.2f", availableMoney));
textReleasedMoney.setText(String.format("%.2f", releasedMoney));
Log.e("Response:-- " , response.toString());
}
catch (Exception ex)
{
Toast.makeText(mContext, ex.getMessage(), Toast.LENGTH_SHORT).show();
}
}
}, new Response.ErrorListener()
{
@Override
public void onErrorResponse(VolleyError error)
{
// TODO Auto-generated method stub
if (progressDialog != null && progressDialog.isShowing()) {
// If the response is JSONObject instead of expected JSONArray
progressDialog.dismiss();
}
NetworkResponse response = error.networkResponse;
if (response != null && response.data != null)
{
try
{
JSONObject json = new JSONObject(new String(response.data));
Toast.makeText(mContext, json.has("message") ? json.getString("message")+"1" : json.getString("error")+"2", Toast.LENGTH_LONG).show();
}
catch (JSONException e)
{
Toast.makeText(mContext, R.string.error_try_again_support+"3", Toast.LENGTH_SHORT).show();
}
}
else
{
//Toast.makeText(LoginActivity.this, error != null && error.getMessage() != null ? error.getMessage()+"4" : error.toString()+"5", Toast.LENGTH_LONG).show();
Toast.makeText(mContext,"Usuario o contraseña incorrectos",Toast.LENGTH_SHORT).show();
}
}
})
{
@Override
public Map<String, String> getHeaders() throws AuthFailureError
{
Map<String, String> params = new HashMap<String, String>();
//params.put("X-API-KEY", Network.API_KEY);
params.put("Authorization",authorization);
return params;
}
};
// Get a RequestQueue
RequestQueue queue = MySingleton.getInstance(mContext.getApplicationContext()).getRequestQueue();
//Used to mark the request, so we can cancel it on our onStop method
postRequest.setTag(TAG);
MySingleton.getInstance(mContext).addToRequestQueue(postRequest);
}
}
|
UTF-8
|
Java
| 6,577 |
java
|
DetailCashFragment.java
|
Java
|
[] | null |
[] |
package com.valecom.yingul.main.myAccount.yingulPay;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;
import com.afollestad.materialdialogs.MaterialDialog;
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkResponse;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonObjectRequest;
import com.valecom.yingul.R;
import com.valecom.yingul.main.LoginActivity;
import com.valecom.yingul.network.MySingleton;
import com.valecom.yingul.network.Network;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.HashMap;
import java.util.Map;
/**
* A simple {@link Fragment} subclass.
*/
public class DetailCashFragment extends Fragment {
public static final String TAG = "LoginActivity";
private MaterialDialog progressDialog;
TextView textTotalMoney,textAvailableMoney,textReleasedMoney;
Context mContext;
String username,authorization;
public DetailCashFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View v = inflater.inflate(R.layout.fragment_detail_cash, container, false);
SharedPreferences settings = getActivity().getSharedPreferences(LoginActivity.SESSION_USER, getActivity().MODE_PRIVATE);
username = settings.getString("username","");
authorization = settings.getString("password","");
Log.e("authorization",username+" "+authorization);
progressDialog = new MaterialDialog.Builder(getActivity())
.title(R.string.progress_dialog)
.content(R.string.please_wait)
.cancelable(false)
.progress(true, 0).build();
mContext = getActivity();
textTotalMoney = (TextView)v.findViewById(R.id.textTotalMoney);
textAvailableMoney = (TextView)v.findViewById(R.id.textAvailableMoney);
textReleasedMoney = (TextView)v.findViewById(R.id.textReleasedMoney);
RunGetAccount();
return v;
}
public void RunGetAccount()
{
progressDialog.show();
JsonObjectRequest postRequest = new JsonObjectRequest
(Request.Method.GET, Network.API_URL + "account/getAccountByUser/"+username, null, new Response.Listener<JSONObject>()
{
@Override
public void onResponse(JSONObject response)
{
if (progressDialog != null && progressDialog.isShowing()) {
progressDialog.dismiss();
}
try
{
Log.e("Response: " , response.toString());
double totalMoney=response.getDouble("availableMoney")+response.getDouble("releasedMoney")+response.getDouble("withheldMoney");
double availableMoney = response.getDouble("availableMoney");
double releasedMoney = response.getDouble("releasedMoney");
textTotalMoney.setText(String.format("%.2f", totalMoney));
textAvailableMoney.setText(String.format("%.2f", availableMoney));
textReleasedMoney.setText(String.format("%.2f", releasedMoney));
Log.e("Response:-- " , response.toString());
}
catch (Exception ex)
{
Toast.makeText(mContext, ex.getMessage(), Toast.LENGTH_SHORT).show();
}
}
}, new Response.ErrorListener()
{
@Override
public void onErrorResponse(VolleyError error)
{
// TODO Auto-generated method stub
if (progressDialog != null && progressDialog.isShowing()) {
// If the response is JSONObject instead of expected JSONArray
progressDialog.dismiss();
}
NetworkResponse response = error.networkResponse;
if (response != null && response.data != null)
{
try
{
JSONObject json = new JSONObject(new String(response.data));
Toast.makeText(mContext, json.has("message") ? json.getString("message")+"1" : json.getString("error")+"2", Toast.LENGTH_LONG).show();
}
catch (JSONException e)
{
Toast.makeText(mContext, R.string.error_try_again_support+"3", Toast.LENGTH_SHORT).show();
}
}
else
{
//Toast.makeText(LoginActivity.this, error != null && error.getMessage() != null ? error.getMessage()+"4" : error.toString()+"5", Toast.LENGTH_LONG).show();
Toast.makeText(mContext,"Usuario o contraseña incorrectos",Toast.LENGTH_SHORT).show();
}
}
})
{
@Override
public Map<String, String> getHeaders() throws AuthFailureError
{
Map<String, String> params = new HashMap<String, String>();
//params.put("X-API-KEY", Network.API_KEY);
params.put("Authorization",authorization);
return params;
}
};
// Get a RequestQueue
RequestQueue queue = MySingleton.getInstance(mContext.getApplicationContext()).getRequestQueue();
//Used to mark the request, so we can cancel it on our onStop method
postRequest.setTag(TAG);
MySingleton.getInstance(mContext).addToRequestQueue(postRequest);
}
}
| 6,577 | 0.570712 | 0.569191 | 165 | 38.854546 | 34.920559 | 184 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.648485 | false | false |
3
|
4e8155f1a670803648b07b29b054d78d22adba95
| 34,969,623,740,529 |
3cd6c6d7d3b9f91ab225678628b3a64632ecbf42
|
/unify-core/src/main/java/com/tcdng/unify/core/util/StringUtils.java
|
e5ec28a377ef583610a24a10a87440d96129e9f3
|
[] |
no_license
|
edcode/tcdng-unifyframework
|
https://github.com/edcode/tcdng-unifyframework
|
c99590c58f2ef937a9c1ec875cfa1f58d2a4bb1f
|
740200f075ca13a276a85da6a6e6bc03c6a1510a
|
refs/heads/master
| 2016-12-13T06:33:37.764000 | 2016-11-24T14:25:27 | 2016-11-24T14:25:27 | 38,019,576 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* Copyright 2014 The Code Department
*
* 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.tcdng.unify.core.util;
import java.util.ArrayList;
import java.util.List;
import com.tcdng.unify.core.data.ListableData;
/**
* Provides utility methods for string manipulation.
*
* @author Lateef Ojulari
* @version 1.0
*/
public final class StringUtils {
private StringUtils() {
}
/**
* Removes duplicates from a string list.
*
* @param valueList
* the string list
* @return a new string list with no duplicates
*/
public static List<String> removeDuplicates(List<String> valueList) {
List<String> resultList = new ArrayList<String>();
if (valueList != null && !valueList.isEmpty()) {
for (String value : valueList) {
if (!resultList.contains(value)) {
resultList.add(value);
}
}
return resultList;
}
return valueList;
}
/**
* Split a string into tokens using the space character.
*
* @param string
* the string to split
* @return the result tokens
*/
public static String[] spaceSplit(String string) {
if (string != null) {
List<String> result = new ArrayList<String>();
String[] tokens = string.split(" ");
for (String token : tokens) {
if (!token.isEmpty()) {
result.add(token);
}
}
return result.toArray(new String[result.size()]);
}
return DataUtils.ZEROLEN_STRINGARRAY;
}
/**
* Builds a CSV string from an array of string. A CSV string is a string
* with tokens separated with the comma symbol. Any element of the string
* array with a comma is surrounded with a double quote.
*
* @param strings
* the supplied array
* @param includeBrackets
* indicates if enclosing brackets are to be included.
* @return the CSV string
*/
public static String buildCommaSeparatedString(String[] strings,
boolean includeBrackets) {
StringBuilder sb = new StringBuilder();
if (includeBrackets) {
sb.append('[');
}
boolean appendSym = false;
for (String string : strings) {
if (appendSym) {
sb.append(',');
} else {
appendSym = true;
}
if (string.indexOf(',') >= 0) {
sb.append('"').append(string).append('"');
} else {
sb.append(string);
}
}
if (includeBrackets) {
sb.append(']');
}
return sb.toString();
}
/**
* Builds a CSV string from an array of string. A CSV string is a string
* with tokens separated with the comma symbol. Any element of the string
* array with a comma is surrounded with a double quote.
*
* @param objects
* the object list
* @param includeBrackets
* indicates if enclosing brackets are to be included.
* @return the CSV string
*/
public static String buildCommaSeparatedString(List<Object> objects,
boolean includeBrackets) {
StringBuilder sb = new StringBuilder();
if (includeBrackets) {
sb.append('[');
}
boolean appendSym = false;
for (Object obj : objects) {
if (appendSym) {
sb.append(',');
} else {
appendSym = true;
}
if ((obj instanceof String) && ((String) obj).indexOf(',') >= 0) {
sb.append('"').append(obj).append('"');
} else {
sb.append(obj);
}
}
if (includeBrackets) {
sb.append(']');
}
return sb.toString();
}
/**
* Builds a CSV string from an array of string. A CSV string is a string
* with tokens separated with the comma symbol. Any element of the string
* array with a comma is surrounded with a double quote.
*
* @param values
* the supplied array
* @param includeBrackets
* indicates if enclosing brackets are to be included.
* @return the CSV string
*/
public static String buildCommaSeparatedString(Object[] values,
boolean includeBrackets) {
StringBuilder sb = new StringBuilder();
if (includeBrackets) {
sb.append('[');
}
boolean appendSym = false;
for (Object value : values) {
String string = String.valueOf(value);
if (appendSym) {
sb.append(',');
} else {
appendSym = true;
}
if (string.indexOf(',') >= 0) {
sb.append('"').append(string).append('"');
} else {
sb.append(string);
}
}
if (includeBrackets) {
sb.append(']');
}
return sb.toString();
}
/**
* Gets a list of string values from a CSV string.
*
* @param string
* the CSv string
* @return the string values
*/
public static String[] getCommaSeparatedValues(String string) {
List<String> values = new ArrayList<String>();
int index = 0;
int lastIndex = string.length() - 1;
while (index <= lastIndex) {
char ch = string.charAt(index);
if (ch == ',') {
values.add("");
index++;
} else if (index == lastIndex) {
values.add(String.valueOf(ch));
break;
} else if (ch == '"') {
int quoteIndex = string.indexOf("\",", index + 1);
if (quoteIndex < 0) {
if (ch == string.charAt(lastIndex)) {
values.add(string.substring(index + 1, lastIndex));
} else {
values.add(string.substring(index + 1));
}
break;
}
values.add(string.substring(index + 1, quoteIndex));
index = quoteIndex + 2;
} else {
int commaIndex = string.indexOf(',', index + 1);
if (commaIndex < 0) {
values.add(string.substring(index));
break;
} else {
values.add(string.substring(index, commaIndex));
index = commaIndex + 1;
}
}
}
if (lastIndex >= 0 && string.charAt(lastIndex) == ',') {
values.add("");
}
return values.toArray(new String[values.size()]);
}
/**
* Tests if supplied string is null or is blank.
*
* @param string
* the string to test
*/
public static boolean isBlank(String string) {
return string == null || string.trim().isEmpty();
}
/**
* Pads a string on the left with specified character until its as long as
* specified length. No padding occurs if length of supplied string is
* greater than or equal to specified length.
*
* @param string
* the string to pad
* @param ch
* the padding character
* @param length
* the length to pad supplied string to
* @return the padded string
*/
public static String padLeft(String string, char ch, int length) {
int left = length - string.length();
if (left > 0) {
StringBuilder sb = new StringBuilder();
while (--left >= 0) {
sb.append(ch);
}
sb.append(string);
return sb.toString();
}
return string;
}
/**
* Pads a string on the right with specified character until its as long as
* specified length. No padding occurs if length of supplied string is
* greater than or equal to specified length.
*
* @param string
* the string to pad
* @param ch
* the padding character
* @param length
* the length to pad supplied string to
* @return the padded string
*/
public static String padRight(String string, char ch, int length) {
int left = length - string.length();
if (left > 0) {
StringBuilder sb = new StringBuilder();
sb.append(string);
while (--left >= 0) {
sb.append(ch);
}
return sb.toString();
}
return string;
}
/**
* Reads a static list string into a listable data array. Static list should
* be in the format
*
* <pre>
* key1¬description1|key2¬description2|...keyN¬descriptionN
* </pre>
*
* @param string
* the static list
* @return the listable data array
*/
public static List<ListableData> readStaticList(String string) {
List<ListableData> list = new ArrayList<ListableData>();
String[] namevalues = string.split("\\|");
for (String namevalue : namevalues) {
String[] pair = namevalue.split("¬");
if (pair.length == 2) {
list.add(new ListableData(pair[0], pair[1]));
}
}
return list;
}
/**
* Ellipsizes a text if length is greater than supplied maximum length.
*
* @param text
* the text to ellipsize
* @param maxLen
* the maximum length
* @return the ellipsized text
*/
public static String ellipsize(String text, int maxLen) {
if (text != null && text.length() > maxLen) {
return text.substring(0, maxLen - 3) + "...";
}
return text;
}
/**
* Sets the first letter of a text to uppercase.
*
* @param text
* the input string
*/
public static String capitalize(String text) {
if (text != null && text.length() > 0) {
return Character.toUpperCase(text.charAt(0)) + text.substring(1);
}
return text;
}
/**
* Sets the first letter of a text to lowercase.
*
* @param text
* the input string
*/
public static String decapitalize(String text) {
if (text != null && text.length() > 0) {
return Character.toLowerCase(text.charAt(0)) + text.substring(1);
}
return text;
}
/**
* Flattens a string. Converts text to lower-case and replaces all white
* spaces with the underscore character '_'.
*
* @param text
* the string to flatten
* @return the flattened string
*/
public static String flatten(String text) {
if (text != null) {
return text.replaceAll(" ", "_").toLowerCase();
}
return null;
}
/**
* Replaces all white spaces in a text with the underscore character '_'.
*
* @param text
* the string to underscore
* @return the underscored string
*/
public static String underscore(String text) {
if (text != null) {
return text.replaceAll(" ", "_");
}
return null;
}
/**
* Builds a string by concatenating supplied objects.
*
* @param objects
* the compsing objects
* @return the built string
*/
public static String buildString(Object... objects) {
StringBuilder sb = new StringBuilder();
for (Object object : objects) {
sb.append(object);
}
return sb.toString();
}
}
|
ISO-8859-9
|
Java
| 10,772 |
java
|
StringUtils.java
|
Java
|
[
{
"context": " methods for string manipulation.\r\n * \r\n * @author Lateef Ojulari\r\n * @version 1.0\r\n */\r\npublic final class StringU",
"end": 849,
"score": 0.9998866319656372,
"start": 835,
"tag": "NAME",
"value": "Lateef Ojulari"
}
] | null |
[] |
/*
* Copyright 2014 The Code Department
*
* 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.tcdng.unify.core.util;
import java.util.ArrayList;
import java.util.List;
import com.tcdng.unify.core.data.ListableData;
/**
* Provides utility methods for string manipulation.
*
* @author <NAME>
* @version 1.0
*/
public final class StringUtils {
private StringUtils() {
}
/**
* Removes duplicates from a string list.
*
* @param valueList
* the string list
* @return a new string list with no duplicates
*/
public static List<String> removeDuplicates(List<String> valueList) {
List<String> resultList = new ArrayList<String>();
if (valueList != null && !valueList.isEmpty()) {
for (String value : valueList) {
if (!resultList.contains(value)) {
resultList.add(value);
}
}
return resultList;
}
return valueList;
}
/**
* Split a string into tokens using the space character.
*
* @param string
* the string to split
* @return the result tokens
*/
public static String[] spaceSplit(String string) {
if (string != null) {
List<String> result = new ArrayList<String>();
String[] tokens = string.split(" ");
for (String token : tokens) {
if (!token.isEmpty()) {
result.add(token);
}
}
return result.toArray(new String[result.size()]);
}
return DataUtils.ZEROLEN_STRINGARRAY;
}
/**
* Builds a CSV string from an array of string. A CSV string is a string
* with tokens separated with the comma symbol. Any element of the string
* array with a comma is surrounded with a double quote.
*
* @param strings
* the supplied array
* @param includeBrackets
* indicates if enclosing brackets are to be included.
* @return the CSV string
*/
public static String buildCommaSeparatedString(String[] strings,
boolean includeBrackets) {
StringBuilder sb = new StringBuilder();
if (includeBrackets) {
sb.append('[');
}
boolean appendSym = false;
for (String string : strings) {
if (appendSym) {
sb.append(',');
} else {
appendSym = true;
}
if (string.indexOf(',') >= 0) {
sb.append('"').append(string).append('"');
} else {
sb.append(string);
}
}
if (includeBrackets) {
sb.append(']');
}
return sb.toString();
}
/**
* Builds a CSV string from an array of string. A CSV string is a string
* with tokens separated with the comma symbol. Any element of the string
* array with a comma is surrounded with a double quote.
*
* @param objects
* the object list
* @param includeBrackets
* indicates if enclosing brackets are to be included.
* @return the CSV string
*/
public static String buildCommaSeparatedString(List<Object> objects,
boolean includeBrackets) {
StringBuilder sb = new StringBuilder();
if (includeBrackets) {
sb.append('[');
}
boolean appendSym = false;
for (Object obj : objects) {
if (appendSym) {
sb.append(',');
} else {
appendSym = true;
}
if ((obj instanceof String) && ((String) obj).indexOf(',') >= 0) {
sb.append('"').append(obj).append('"');
} else {
sb.append(obj);
}
}
if (includeBrackets) {
sb.append(']');
}
return sb.toString();
}
/**
* Builds a CSV string from an array of string. A CSV string is a string
* with tokens separated with the comma symbol. Any element of the string
* array with a comma is surrounded with a double quote.
*
* @param values
* the supplied array
* @param includeBrackets
* indicates if enclosing brackets are to be included.
* @return the CSV string
*/
public static String buildCommaSeparatedString(Object[] values,
boolean includeBrackets) {
StringBuilder sb = new StringBuilder();
if (includeBrackets) {
sb.append('[');
}
boolean appendSym = false;
for (Object value : values) {
String string = String.valueOf(value);
if (appendSym) {
sb.append(',');
} else {
appendSym = true;
}
if (string.indexOf(',') >= 0) {
sb.append('"').append(string).append('"');
} else {
sb.append(string);
}
}
if (includeBrackets) {
sb.append(']');
}
return sb.toString();
}
/**
* Gets a list of string values from a CSV string.
*
* @param string
* the CSv string
* @return the string values
*/
public static String[] getCommaSeparatedValues(String string) {
List<String> values = new ArrayList<String>();
int index = 0;
int lastIndex = string.length() - 1;
while (index <= lastIndex) {
char ch = string.charAt(index);
if (ch == ',') {
values.add("");
index++;
} else if (index == lastIndex) {
values.add(String.valueOf(ch));
break;
} else if (ch == '"') {
int quoteIndex = string.indexOf("\",", index + 1);
if (quoteIndex < 0) {
if (ch == string.charAt(lastIndex)) {
values.add(string.substring(index + 1, lastIndex));
} else {
values.add(string.substring(index + 1));
}
break;
}
values.add(string.substring(index + 1, quoteIndex));
index = quoteIndex + 2;
} else {
int commaIndex = string.indexOf(',', index + 1);
if (commaIndex < 0) {
values.add(string.substring(index));
break;
} else {
values.add(string.substring(index, commaIndex));
index = commaIndex + 1;
}
}
}
if (lastIndex >= 0 && string.charAt(lastIndex) == ',') {
values.add("");
}
return values.toArray(new String[values.size()]);
}
/**
* Tests if supplied string is null or is blank.
*
* @param string
* the string to test
*/
public static boolean isBlank(String string) {
return string == null || string.trim().isEmpty();
}
/**
* Pads a string on the left with specified character until its as long as
* specified length. No padding occurs if length of supplied string is
* greater than or equal to specified length.
*
* @param string
* the string to pad
* @param ch
* the padding character
* @param length
* the length to pad supplied string to
* @return the padded string
*/
public static String padLeft(String string, char ch, int length) {
int left = length - string.length();
if (left > 0) {
StringBuilder sb = new StringBuilder();
while (--left >= 0) {
sb.append(ch);
}
sb.append(string);
return sb.toString();
}
return string;
}
/**
* Pads a string on the right with specified character until its as long as
* specified length. No padding occurs if length of supplied string is
* greater than or equal to specified length.
*
* @param string
* the string to pad
* @param ch
* the padding character
* @param length
* the length to pad supplied string to
* @return the padded string
*/
public static String padRight(String string, char ch, int length) {
int left = length - string.length();
if (left > 0) {
StringBuilder sb = new StringBuilder();
sb.append(string);
while (--left >= 0) {
sb.append(ch);
}
return sb.toString();
}
return string;
}
/**
* Reads a static list string into a listable data array. Static list should
* be in the format
*
* <pre>
* key1¬description1|key2¬description2|...keyN¬descriptionN
* </pre>
*
* @param string
* the static list
* @return the listable data array
*/
public static List<ListableData> readStaticList(String string) {
List<ListableData> list = new ArrayList<ListableData>();
String[] namevalues = string.split("\\|");
for (String namevalue : namevalues) {
String[] pair = namevalue.split("¬");
if (pair.length == 2) {
list.add(new ListableData(pair[0], pair[1]));
}
}
return list;
}
/**
* Ellipsizes a text if length is greater than supplied maximum length.
*
* @param text
* the text to ellipsize
* @param maxLen
* the maximum length
* @return the ellipsized text
*/
public static String ellipsize(String text, int maxLen) {
if (text != null && text.length() > maxLen) {
return text.substring(0, maxLen - 3) + "...";
}
return text;
}
/**
* Sets the first letter of a text to uppercase.
*
* @param text
* the input string
*/
public static String capitalize(String text) {
if (text != null && text.length() > 0) {
return Character.toUpperCase(text.charAt(0)) + text.substring(1);
}
return text;
}
/**
* Sets the first letter of a text to lowercase.
*
* @param text
* the input string
*/
public static String decapitalize(String text) {
if (text != null && text.length() > 0) {
return Character.toLowerCase(text.charAt(0)) + text.substring(1);
}
return text;
}
/**
* Flattens a string. Converts text to lower-case and replaces all white
* spaces with the underscore character '_'.
*
* @param text
* the string to flatten
* @return the flattened string
*/
public static String flatten(String text) {
if (text != null) {
return text.replaceAll(" ", "_").toLowerCase();
}
return null;
}
/**
* Replaces all white spaces in a text with the underscore character '_'.
*
* @param text
* the string to underscore
* @return the underscored string
*/
public static String underscore(String text) {
if (text != null) {
return text.replaceAll(" ", "_");
}
return null;
}
/**
* Builds a string by concatenating supplied objects.
*
* @param objects
* the compsing objects
* @return the built string
*/
public static String buildString(Object... objects) {
StringBuilder sb = new StringBuilder();
for (Object object : objects) {
sb.append(object);
}
return sb.toString();
}
}
| 10,764 | 0.602247 | 0.598161 | 415 | 23.946987 | 21.658846 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.00241 | false | false |
3
|
ca0b1f0f5cb8e90e04dc321fbdffc55e294cb0cc
| 7,584,912,297,308 |
2770341c449fb85910c03e94631f7a762d087c4c
|
/BOJ_1987.java
|
e788bd3c42ca24c7af84fd8cb25f79a75d7dd349
|
[] |
no_license
|
dev-owen/Algorithms
|
https://github.com/dev-owen/Algorithms
|
ee2a8c461e8235eb203566d839dfdd99d3603228
|
d7459d381614675e9296de357ddea98f1c7519f4
|
refs/heads/master
| 2022-02-25T09:30:58.663000 | 2019-10-26T14:00:31 | 2019-10-26T14:00:31 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class BOJ_1987 {
static int R,C;
static char[][] board;
static int passing;
static int[] dx = {0,0,1,-1};
static int[] dy = {1,-1,0,0};
static boolean[] visited = new boolean[26];
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
R = Integer.parseInt(st.nextToken());
C = Integer.parseInt(st.nextToken());
board = new char[R+2][C+2];
for(int i=1; i<=R; i++) {
char[] chars = br.readLine().toCharArray();
for(int j=1; j<=C; j++) {
board[i][j] = chars[j-1];
}
}
passing = 1;
DFS(1,1,1, visited);
System.out.println(passing);
}
static void DFS(int x, int y, int pass, boolean[] visited) {
visited[(int)(board[x][y]-'A')] = true;
for(int i=0; i<4; i++) {
int nX = x+dx[i];
int nY = y+dy[i];
if(nX>= 1 && nX <= R && nY >= 1 && nY <= C && !visited[(int)(board[nX][nY]-'A')]) {
passing = Math.max(pass+1, passing);
DFS(nX, nY, pass+1, visited);
}
}
visited[(int)(board[x][y]-'A')] = false;
}
}
|
UTF-8
|
Java
| 1,255 |
java
|
BOJ_1987.java
|
Java
|
[] | null |
[] |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class BOJ_1987 {
static int R,C;
static char[][] board;
static int passing;
static int[] dx = {0,0,1,-1};
static int[] dy = {1,-1,0,0};
static boolean[] visited = new boolean[26];
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
R = Integer.parseInt(st.nextToken());
C = Integer.parseInt(st.nextToken());
board = new char[R+2][C+2];
for(int i=1; i<=R; i++) {
char[] chars = br.readLine().toCharArray();
for(int j=1; j<=C; j++) {
board[i][j] = chars[j-1];
}
}
passing = 1;
DFS(1,1,1, visited);
System.out.println(passing);
}
static void DFS(int x, int y, int pass, boolean[] visited) {
visited[(int)(board[x][y]-'A')] = true;
for(int i=0; i<4; i++) {
int nX = x+dx[i];
int nY = y+dy[i];
if(nX>= 1 && nX <= R && nY >= 1 && nY <= C && !visited[(int)(board[nX][nY]-'A')]) {
passing = Math.max(pass+1, passing);
DFS(nX, nY, pass+1, visited);
}
}
visited[(int)(board[x][y]-'A')] = false;
}
}
| 1,255 | 0.583267 | 0.560159 | 41 | 28.658537 | 20.167118 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.926829 | false | false |
3
|
908bbb5264cc3aed81cbb0e875895b08d7fb1fe2
| 34,832,184,792,549 |
67221081c1902d9039781da1e9e4e8c3190f8ca7
|
/src/main/java/fr/oxodao/cahbuilder/CardConfig.java
|
c1acf26fd2fcc49845a3e98156f6804be35d29db
|
[] |
no_license
|
oxodao/CAHBuilder
|
https://github.com/oxodao/CAHBuilder
|
5c80506cc3b8c854800478294b039e766322a2a2
|
e8fd4efe371335d6fe42f478e98eef5085e96f29
|
refs/heads/master
| 2020-06-02T05:01:15.458000 | 2019-07-18T17:55:06 | 2019-07-18T17:55:06 | 191,045,575 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package fr.oxodao.cahbuilder;
import java.awt.*;
public class CardConfig {
private Color fgColor;
private Color bgColor;
private Color separatorColor;
private boolean isQuestion;
private boolean isFrontSide;
public Color getFgColor() {
return this.fgColor;
}
public CardConfig setFgColor(Color fgColor) {
this.fgColor = fgColor;
return this;
}
public Color getBgColor() {
return bgColor;
}
public CardConfig setBgColor(Color bgColor) {
this.bgColor = bgColor;
return this;
}
public Color getSeparatorColor() {
return separatorColor;
}
public CardConfig setSeparatorColor(Color separatorColor) {
this.separatorColor = separatorColor;
return this;
}
public CardConfig setIsFrontSide(boolean isFrontSide) {
this.isFrontSide = isFrontSide;
return this;
}
public boolean isFrontSide() {
return this.isFrontSide;
}
public CardConfig setIsQuestion(boolean isQuestion) {
this.isQuestion = isQuestion;
return this;
}
public boolean isQuestion() {
return this.isQuestion;
}
}
|
UTF-8
|
Java
| 1,204 |
java
|
CardConfig.java
|
Java
|
[] | null |
[] |
package fr.oxodao.cahbuilder;
import java.awt.*;
public class CardConfig {
private Color fgColor;
private Color bgColor;
private Color separatorColor;
private boolean isQuestion;
private boolean isFrontSide;
public Color getFgColor() {
return this.fgColor;
}
public CardConfig setFgColor(Color fgColor) {
this.fgColor = fgColor;
return this;
}
public Color getBgColor() {
return bgColor;
}
public CardConfig setBgColor(Color bgColor) {
this.bgColor = bgColor;
return this;
}
public Color getSeparatorColor() {
return separatorColor;
}
public CardConfig setSeparatorColor(Color separatorColor) {
this.separatorColor = separatorColor;
return this;
}
public CardConfig setIsFrontSide(boolean isFrontSide) {
this.isFrontSide = isFrontSide;
return this;
}
public boolean isFrontSide() {
return this.isFrontSide;
}
public CardConfig setIsQuestion(boolean isQuestion) {
this.isQuestion = isQuestion;
return this;
}
public boolean isQuestion() {
return this.isQuestion;
}
}
| 1,204 | 0.639535 | 0.639535 | 58 | 19.758621 | 17.610058 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.37931 | false | false |
3
|
0ebd57638574dbe4b494b49b4f750502bf9b8f9f
| 22,058,952,084,168 |
5291efa4b6415064331e8efec9978a539a262d9a
|
/app/src/main/java/com/example/buttomnav/Adapters/LoginAdapter.java
|
d0f80f7542a74fc2ae7d894244a2c9235562d869
|
[] |
no_license
|
frederikagger/snapclone-android
|
https://github.com/frederikagger/snapclone-android
|
fcfc02d69a41b0d8f3a4ceac2d21bbe238601ee7
|
cf345ba7d086dd2b5480cb93d1e96f52bcdf1a4b
|
refs/heads/master
| 2023-02-22T02:13:59.694000 | 2021-01-19T16:53:46 | 2021-01-19T16:53:46 | 330,604,607 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.buttomnav.Adapters;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import com.example.buttomnav.Fragment.LoginFragment;
import com.example.buttomnav.Fragment.RegisterFragment;
public class LoginAdapter extends FragmentPagerAdapter {
private int totalTabs;
public LoginAdapter(@NonNull FragmentManager fm, int totalTabs) {
super(fm, totalTabs);
this.totalTabs = totalTabs;
}
@NonNull
@Override
public Fragment getItem(int position) {
switch (position){
case 0:
return new LoginFragment();
case 1:
return new RegisterFragment();
default:
return null;
}
}
@Override
public int getCount() {
return this.totalTabs;
}
}
|
UTF-8
|
Java
| 931 |
java
|
LoginAdapter.java
|
Java
|
[] | null |
[] |
package com.example.buttomnav.Adapters;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import com.example.buttomnav.Fragment.LoginFragment;
import com.example.buttomnav.Fragment.RegisterFragment;
public class LoginAdapter extends FragmentPagerAdapter {
private int totalTabs;
public LoginAdapter(@NonNull FragmentManager fm, int totalTabs) {
super(fm, totalTabs);
this.totalTabs = totalTabs;
}
@NonNull
@Override
public Fragment getItem(int position) {
switch (position){
case 0:
return new LoginFragment();
case 1:
return new RegisterFragment();
default:
return null;
}
}
@Override
public int getCount() {
return this.totalTabs;
}
}
| 931 | 0.663802 | 0.661654 | 38 | 23.5 | 19.709402 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.421053 | false | false |
3
|
f1c8e5a19add95e61a8671936006609766ded348
| 37,804,302,140,164 |
51a7cf05aad5e550aa1a2bdefd9aac0b0654315a
|
/src/main/java/com/ndlombar/entity/Image.java
|
c726f47cb07f51ccfa155fa843681e9c20336e92
|
[] |
no_license
|
ndlombar/heroku-deploy-test
|
https://github.com/ndlombar/heroku-deploy-test
|
bfa2785ee544799bda9d6ac4a33e9de8754286d4
|
0b7125a892d33512223ca6b8b252c40b0839c877
|
refs/heads/master
| 2020-09-03T19:35:26.226000 | 2019-12-09T23:05:08 | 2019-12-09T23:05:08 | 219,548,354 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.ndlombar.entity;
import java.sql.Timestamp;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.Id;
import javax.persistence.Table;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
@Entity
@EntityListeners(AuditingEntityListener.class)
@Table(name="image")
public class Image {
@Id
@Column(name = "imid") private Integer imid;
@Column(name = "link") private String link;
@Column(name = "aid") private Integer aid;
public Image() {}
public Image(int imid, String link, int aid) {
this.imid = imid;
this.link = link;
this.aid = aid;
}
public Integer getImid() {
return imid;
}
public void setImid(Integer imid) {
this.imid = imid;
}
public Integer getAid() {
return aid;
}
public void setAid(Integer aid) {
this.aid = aid;
}
public String getLink() {
return link;
}
public void setLink(String link) {
this.link = link;
}
}
|
UTF-8
|
Java
| 1,001 |
java
|
Image.java
|
Java
|
[] | null |
[] |
package com.ndlombar.entity;
import java.sql.Timestamp;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.Id;
import javax.persistence.Table;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
@Entity
@EntityListeners(AuditingEntityListener.class)
@Table(name="image")
public class Image {
@Id
@Column(name = "imid") private Integer imid;
@Column(name = "link") private String link;
@Column(name = "aid") private Integer aid;
public Image() {}
public Image(int imid, String link, int aid) {
this.imid = imid;
this.link = link;
this.aid = aid;
}
public Integer getImid() {
return imid;
}
public void setImid(Integer imid) {
this.imid = imid;
}
public Integer getAid() {
return aid;
}
public void setAid(Integer aid) {
this.aid = aid;
}
public String getLink() {
return link;
}
public void setLink(String link) {
this.link = link;
}
}
| 1,001 | 0.709291 | 0.709291 | 58 | 16.258621 | 17.034002 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.103448 | false | false |
3
|
28620d692fd5ef86b1a8b920d4a9d7f7f5777ec8
| 15,796,889,762,299 |
25c76ccfb64dbd88ae1868ab4b401db7b7bc85fb
|
/src/main/java/bank/local/LocalAccount.java
|
da9adf9eb62ab805e5c7ab564b126ab9370b1eaf
|
[] |
no_license
|
Im-a-Train/FHNW_VESYS_BANK
|
https://github.com/Im-a-Train/FHNW_VESYS_BANK
|
42e0341b033e3657d407a010d9f5428ca26d13a1
|
e169c2e3e843464d464b4835bbfdd13c588ef3e3
|
refs/heads/master
| 2022-11-18T06:18:26.755000 | 2020-07-06T10:49:34 | 2020-07-06T10:49:34 | 277,366,365 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package bank.local;
import bank.InactiveException;
import bank.OverdrawException;
import java.io.Serializable;
import java.util.UUID;
public class LocalAccount implements bank.Account, Serializable {
private String number;
private String owner;
private double balance;
private boolean active = true;
LocalAccount(String owner) {
this.owner = owner;
this.number = UUID.randomUUID().toString();
}
@Override
public double getBalance() {
return balance;
}
@Override
public String getOwner() {
return owner;
}
@Override
public String getNumber() {
return number;
}
@Override
public boolean isActive() {
return active;
}
public boolean close() throws InactiveException {
if(active){
if(balance == 0.0){
active = false;
return true;
}else{
System.out.println("Account could not be closed, balance is not null");
return false;
}
}else{
throw new InactiveException("The account is already inactive");
}
}
@Override
public void deposit(double amount) throws InactiveException, IllegalArgumentException {
if(amount < 0){
throw new IllegalArgumentException();
}
if(active){
balance += amount;
System.out.println("Deposit: "+amount+" on Account: "+number+", new balance: "+balance);
}else{
throw new InactiveException("The account is inactive.");
}
}
@Override
public void withdraw(double amount) throws InactiveException, OverdrawException, IllegalArgumentException {
if(amount < 0){
throw new IllegalArgumentException();
}
if(active){
if(balance-amount < 0){
throw new OverdrawException("The expected withdraw is higher than the current account balance");
}else{
balance -= amount;
System.out.println("Withdaw: "+amount+" on Account: "+number+", new balance: "+balance);
}
}else{
throw new InactiveException("The account is inactive");
}
}
}
|
UTF-8
|
Java
| 2,267 |
java
|
LocalAccount.java
|
Java
|
[] | null |
[] |
package bank.local;
import bank.InactiveException;
import bank.OverdrawException;
import java.io.Serializable;
import java.util.UUID;
public class LocalAccount implements bank.Account, Serializable {
private String number;
private String owner;
private double balance;
private boolean active = true;
LocalAccount(String owner) {
this.owner = owner;
this.number = UUID.randomUUID().toString();
}
@Override
public double getBalance() {
return balance;
}
@Override
public String getOwner() {
return owner;
}
@Override
public String getNumber() {
return number;
}
@Override
public boolean isActive() {
return active;
}
public boolean close() throws InactiveException {
if(active){
if(balance == 0.0){
active = false;
return true;
}else{
System.out.println("Account could not be closed, balance is not null");
return false;
}
}else{
throw new InactiveException("The account is already inactive");
}
}
@Override
public void deposit(double amount) throws InactiveException, IllegalArgumentException {
if(amount < 0){
throw new IllegalArgumentException();
}
if(active){
balance += amount;
System.out.println("Deposit: "+amount+" on Account: "+number+", new balance: "+balance);
}else{
throw new InactiveException("The account is inactive.");
}
}
@Override
public void withdraw(double amount) throws InactiveException, OverdrawException, IllegalArgumentException {
if(amount < 0){
throw new IllegalArgumentException();
}
if(active){
if(balance-amount < 0){
throw new OverdrawException("The expected withdraw is higher than the current account balance");
}else{
balance -= amount;
System.out.println("Withdaw: "+amount+" on Account: "+number+", new balance: "+balance);
}
}else{
throw new InactiveException("The account is inactive");
}
}
}
| 2,267 | 0.581826 | 0.579621 | 84 | 25.988094 | 26.790409 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false |
3
|
998f0cd7571113b1724bf8fd6210b04b0b6180aa
| 962,072,744,437 |
ae2497903fbdffae78e5da3708befc5313382bf0
|
/6355846/src/main/java/nl/bve/uva/oberon/ast/types/IOberonTypeNode.java
|
1c789075bfbbd624b52caa8a42963022bab3cfde
|
[] |
no_license
|
tvdstorm/sea-of-oberon0
|
https://github.com/tvdstorm/sea-of-oberon0
|
88cdf8ace2f039050d1a6879bd90962bd1326f42
|
1ad75a7aeb7367af5a9854b38584561a7df5f5d1
|
refs/heads/master
| 2021-01-10T18:38:25.532000 | 2011-03-06T22:07:55 | 2011-03-06T22:07:55 | 33,249,217 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package nl.bve.uva.oberon.ast.types;
import nl.bve.uva.oberon.env.Environment;
import nl.bve.uva.oberon.env.values.OberonValue;
public interface IOberonTypeNode {
public OberonValue initializeNew(Environment env);
}
|
UTF-8
|
Java
| 227 |
java
|
IOberonTypeNode.java
|
Java
|
[] | null |
[] |
package nl.bve.uva.oberon.ast.types;
import nl.bve.uva.oberon.env.Environment;
import nl.bve.uva.oberon.env.values.OberonValue;
public interface IOberonTypeNode {
public OberonValue initializeNew(Environment env);
}
| 227 | 0.779736 | 0.779736 | 8 | 26.375 | 20.838291 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.625 | false | false |
3
|
ab763d93dda4049355fa72611261e0cdc9218f3c
| 21,638,045,248,125 |
3a660a6557c03d1ca44d83d7558196fd5ae995b6
|
/src/bank/Bank.java
|
73e44ef2fb4846409aedd5d47f27ee451b2359b4
|
[] |
no_license
|
leonidkiritschenko/Bank
|
https://github.com/leonidkiritschenko/Bank
|
6426a63a819e04941a3248e6a311104148af0477
|
07a372fb758d3d61499afbf6d97a6c61d0f4c815
|
refs/heads/master
| 2020-08-30T12:16:14.117000 | 2019-11-08T11:07:05 | 2019-11-08T11:07:05 | 218,377,911 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package bank;
import bank.account.Account;
import bank.customer.ContanctPerson;
import bank.customer.CompanyCustomer;
import bank.customer.Customer;
import bank.address.Address;
import bank.customer.PrivateCustomer;
import bank.util.ConsoleReader;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* Bank is the main class of the bank application.
* run() is used to start the
*/
public class Bank {
private static final Bank INSTANCE = new Bank();
private String name = "";
private String BIC = "";
private Address address;
private ArrayList<PrivateCustomer> privateCustomers = new ArrayList<>();
private ArrayList<CompanyCustomer> companyCustomers = new ArrayList<>();
private ArrayList<Account> accounts = new ArrayList<>();
private Bank() {
}
/**
* Singleton getInstance
*
* @return bank instance
*/
public static Bank getInstance() {
return INSTANCE;
}
/**
* Singleton getInstance with parameters
*
* @param name of the bank
* @param BIC of the bank
* @param address of the bank
* @return bank instance
*/
public static Bank getInstance(String name, String BIC, Address address) {
INSTANCE.name = name;
INSTANCE.BIC = BIC;
INSTANCE.address = address;
return INSTANCE;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getBIC() {
return BIC;
}
public void setBIC(String BIC) {
this.BIC = BIC;
}
public Address getAddress() {
return new Address(address);
}
public void setAddress(Address address) {
this.address = new Address(address);
}
/**
* Execute run to work with the bank
*/
public void run() {
int input;
while (true) {
showMenu();
List<Integer> options = List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
input = ConsoleReader.readNumber("Bitte eine Zahl zwischen 1 und 10", options);
pickMenu(input);
}
}
/**
* Helper method to show the menu
*/
private void showMenu() {
System.out.println("(01) Privatkunde anlegen");
System.out.println("(02) Firmenkunde anlegen");
System.out.println("(03) Konto anlegen und Kundennummer zuordnen");
System.out.println("(04) Kunde mit Konten anzeigen (Auswahl durch Kundennummer)");
System.out.println("(05) Kunde mit Konten anzeigen (Auswahl durch Name)");
System.out.println("(06) Konto anzeigen (Auswahl durch IBAN)");
System.out.println("(07) Alle Kunden unsortiert anzeigen");
System.out.println("(08) Alle Kunden sortiert nach aufsteigender Kundenummer anzeigen");
System.out.println("(09) Alle Konten unsortiert anzeigen");
System.out.println("(10) Beenden");
}
/**
* Input helper method to pick option from menu
*/
private void pickMenu(int input) {
switch (input) {
case 1:
createPrivateCustomer();
break;
case 2:
createCompanyCustomer();
break;
case 3:
createAccount();
break;
case 4:
showCustomerAccountOfCustomerNumber();
break;
case 5:
showCustomerAccountOfName();
break;
case 6:
showAccountOfIBAN();
break;
case 7:
showAllCustomers();
break;
case 8:
showAllCustomersSorted();
break;
case 9:
showAllAccounts();
break;
case 10:
shutDown();
break;
}
}
/**
* Input helper method to create a private customer
*/
private void createPrivateCustomer() {
System.out.println("Für einen neuen Privatkunden brauchen wir folgende Angaben:");
System.out.println("Vorname: ");
String firstName = ConsoleReader.readString("Bitte Vorname angeben.");
System.out.println("Nachname: ");
String lastName = ConsoleReader.readString("Bitte Nachnamen angeben.");
System.out.println("Telefonnummer: ");
String phone = ConsoleReader.readString("Bitte Telefonnummer angeben.");
System.out.println("Email: ");
String email = ConsoleReader.readString("Bitte Email angeben.");
System.out.println("Geburtsdatum (yyyy-mm-dd): ");
LocalDate birthday = ConsoleReader.readDate("Bitte Geburtsdatum angeben.");
while (true) {
System.out.println("Wollen Sie die Angaben korrigieren? (j/n)");
List<String> options = List.of("j", "n");
String input = ConsoleReader.readString("Bitte 'j' oder 'n'.", options);
if (input.equalsIgnoreCase("j")) {
System.out.println("Welche Angaben wollen Sie korrigieren?");
System.out.println("(01) Vorname: " + firstName);
System.out.println("(02) Nachname: " + lastName);
System.out.println("(03) Telefonnummer: " + phone);
System.out.println("(04) Email: " + email);
System.out.println("(05) Geburtsdatum: " + birthday);
List<Integer> optionsNum = List.of(1, 2, 3, 4, 5);
int inputNum = ConsoleReader.readNumber("Bitte 1-5 als Option angeben.", optionsNum);
switch (inputNum) {
case 1:
System.out.println("Vorname: ");
firstName = ConsoleReader.readString("Bitte Vorname angeben.");
break;
case 2:
System.out.println("Nachname: ");
lastName = ConsoleReader.readString("Bitte Nachname angeben.");
break;
case 3:
System.out.println("Telefonnummer: ");
phone = ConsoleReader.readString("Bitte Telefonnummer angeben.");
break;
case 4:
System.out.println("Email: ");
email = ConsoleReader.readString("Bitte Email angeben.");
break;
case 5:
System.out.println("Geburtsdatum: ");
birthday = ConsoleReader.readDate("Bitte Geburtsdatum angeben.");
break;
default:
assert false;
}
} else {
System.out.println("Die Angaben zum Privatkunden werden übernommen.");
break;
}
}
Address address = createAddress();
PrivateCustomer privateCustomer = new PrivateCustomer(firstName, lastName, phone, email, birthday, address);
this.privateCustomers.add(privateCustomer);
System.out.println("Neuen Privatkunden mit Kundennumer " + privateCustomer.getCustomernumber() +
" erfolgreich angelet.");
}
/**
* Input helper method to create a company customer
*/
private void createCompanyCustomer() {
System.out.println("Für einen neuen Firmenkunde brauchen wir folgende Angaben:");
System.out.println("Firmennamen: ");
String companyName = ConsoleReader.readString("Bitte Firmennamen angeben.");
System.out.println("Telefonnummer: ");
String phone = ConsoleReader.readString("Bitte Telefonnummer angeben.");
System.out.println("Email: ");
String email = ConsoleReader.readString("Bitte Email angeben.");
while (true) {
System.out.println("Wollen Sie die Angaben korrigieren? (j/n)");
List<String> options = List.of("j", "n");
String input = ConsoleReader.readString("Bitte 'j' oder 'n'.", options);
if (input.equalsIgnoreCase("j")) {
System.out.println("Welche Angaben wollen Sie korrigieren?");
System.out.println("(01) Firmenname: " + companyName);
System.out.println("(02) Telefonnummer: " + phone);
System.out.println("(03) Email: " + email);
List<Integer> optionsNum = List.of(1, 2, 3);
int inputNum = ConsoleReader.readNumber("Bitte 1-3 als Option angeben.", optionsNum);
switch (inputNum) {
case 1:
System.out.println("Firmenname: ");
companyName = ConsoleReader.readString("Bitte Firmenname angeben.");
break;
case 2:
System.out.println("Telefonnummer: ");
phone = ConsoleReader.readString("Bitte Telefonnummer angeben.");
break;
case 3:
System.out.println("Email: ");
email = ConsoleReader.readString("Bitte Email angeben.");
break;
default:
assert false;
}
} else {
System.out.println("Die Angaben zum Firmenkunde werden übernommen.");
break;
}
}
ContanctPerson contanctPerson = createContactPerson();
Address address = createAddress();
CompanyCustomer companyCustomer = new CompanyCustomer(companyName, contanctPerson, phone, email, address);
this.companyCustomers.add(companyCustomer);
System.out.println("Neuer Firmenkunde mit Kundennumer " + companyCustomer.getCustomernumber() +
" erfolgreich angelet.");
}
/**
* Input helper method to create an account and assign to customer by customer number
*/
private void createAccount() {
System.out.println("Konto anlegen.");
System.out.println("Zu welchem Kunden wird das Konto zugeordnet?");
System.out.println("Kundennummer fängt mit 'P' oder 'F' an: ");
String input = ConsoleReader.readString("Kundennummer fängt mit 'P' oder 'F' an.");
Customer customer = searchCustomerByCustomerNumber(input);
PrivateCustomer pKunde;
CompanyCustomer fKunde;
if (customer != null) {
System.out.println("Bitte geben sie die IBAN an: ");
String iban = ConsoleReader.readString("Bitte IBAN angeben.");
Account account = new Account(iban);
customer.addAccount(account);
accounts.add(account);
System.out.println("Konto mit IBAN " + account.getIBAN() + " erfolgreich hinzugefügt.");
} else {
System.out.println("Keinen Kunden mit der Kundennummer " + input + " gefunden!");
}
}
/**
* Input helper method to show account with customer number and corresponding accounts
*/
private void showCustomerAccountOfCustomerNumber() {
System.out.println("Kunde mit Konten anzeigen (Auswahl durch Kundennummer).");
System.out.println("Zu welchem Kunden das Konto anzeigen?");
System.out.println("Kundennummer fängt mit 'P' oder 'F' an: ");
String input = ConsoleReader.readString("Kundennummer fängt mit 'P' oder 'F' an.");
Customer customer = searchCustomerByCustomerNumber(input);
if (customer != null) {
if (customer instanceof PrivateCustomer) {
showPrivateCustomers((PrivateCustomer) customer);
}
if (customer instanceof CompanyCustomer) {
showCompanyCustomers((CompanyCustomer) customer);
}
showAccounts(customer.getAccounts().toArray(Account[]::new));
} else {
System.out.println("Keinen Kunden mit der Kundennummer " + input + " gefunden!");
}
}
/**
* Input helper method to show account with specific name and corresponding accounts
*/
private void showCustomerAccountOfName() {
System.out.println("Kunde mit Konten anzeigen (Auswahl durch Name)");
System.out.println("Zu welchem Kunden das Konto anzeigen?");
System.out.println("Kundenname (Firma, Vor-, Nachname): ");
String input = ConsoleReader.readString("Kundenname (Firma, Vor-, Nachname): ");
Customer customer = searchCustomerByName(input);
if (customer != null) {
if (customer instanceof PrivateCustomer) {
showPrivateCustomers((PrivateCustomer) customer);
}
if (customer instanceof CompanyCustomer) {
showCompanyCustomers((CompanyCustomer) customer);
}
showAccounts(customer.getAccounts().toArray(Account[]::new));
} else {
System.out.println("Keinen Kunden mit dem Namen " + input + " gefunden!");
}
}
/**
* Input helper method to show account with specific IBAN
*/
private void showAccountOfIBAN() {
System.out.println("Konto anzeigen (Auswahl durch IBAN)");
System.out.println("Zu welcher IBAN suchen Sie das Konto?");
System.out.println("IBAN: ");
String input = ConsoleReader.readString("IBAN bitte.");
Account account = searchAccountsByIBAN(input);
if (account != null) {
showAccounts(account);
} else {
System.out.println("Kein Konto mit der IBAN " + input + " gefunden!");
}
}
/**
* Shows all customers (private & company) unsorted
*/
private void showAllCustomers() {
System.out.println("Alle Kunden unsortiert anzeigen");
showPrivateCustomers(privateCustomers.toArray(PrivateCustomer[]::new));
showCompanyCustomers(companyCustomers.toArray(CompanyCustomer[]::new));
}
/**
* Shows all customers (private & company) sorted by the customer number
*/
private void showAllCustomersSorted() {
System.out.println("Alle Kunden sortiert nach aufsteigender Kundenummer anzeigen");
Collections.sort(privateCustomers);
showPrivateCustomers(privateCustomers.toArray(PrivateCustomer[]::new));
Collections.sort(companyCustomers);
showCompanyCustomers(companyCustomers.toArray(CompanyCustomer[]::new));
}
/**
* Shows all accounts unsorted
*/
private void showAllAccounts() {
System.out.println("Alle Konten unsortiert anzeigen");
showAccounts(accounts.toArray(Account[]::new));
}
/**
* Input helper method to shut down the bank
*/
private void shutDown() {
System.out.println("Wollen Sie wirklich das Programm beenden? (j/n)");
List<String> options = List.of("j", "n");
String input = ConsoleReader.readString("Bitte 'j' oder 'n'.", options);
if (input.equalsIgnoreCase("j")) {
System.out.println("Bis zum nächsten Mal.");
System.exit(0);
}
}
/**
* Input helper method to create an address
* @return Address object
*/
private Address createAddress() {
System.out.println("Für eine neue Adresse brauchen wir folgende Angaben:");
System.out.println("Straße: ");
String street = ConsoleReader.readString("Bitte Straße angeben.");
System.out.println("Hausnummer: ");
String houseNr = ConsoleReader.readString("Bitte Hausnummer angeben.");
System.out.println("Ort");
String city = ConsoleReader.readString("Bitte Ort angeben.");
while (true) {
System.out.println("Wollen Sie die Angaben korrigieren? (j/n)");
List<String> options = List.of("j", "n");
String input = ConsoleReader.readString("Bitte 'j' oder 'n'.", options);
if (input.equalsIgnoreCase("j")) {
System.out.println("Welche Angaben wollen Sie korrigieren?");
System.out.println("(01) Straße: " + street);
System.out.println("(02) Hausnummer: " + houseNr);
System.out.println("(03) Ort: " + city);
List<Integer> optionsNum = List.of(1, 2, 3);
int inputNum = ConsoleReader.readNumber("Bitte 1-3 als Option angeben.", optionsNum);
switch (inputNum) {
case 1:
System.out.println("Straße: ");
street = ConsoleReader.readString("Bitte Straße angeben.");
break;
case 2:
System.out.println("Hausnummer: ");
houseNr = ConsoleReader.readString("Bitte Hausnummer angeben.");
break;
case 3:
System.out.println("Ort: ");
city = ConsoleReader.readString("Bitte Ort angeben.");
break;
default:
assert false;
}
} else {
System.out.println("Die Angaben zur Adresse werden übernommen.");
break;
}
}
return new Address(street, houseNr, city);
}
/**
* Input helper method to create a contact person
* @return Customer object
*/
private ContanctPerson createContactPerson() {
System.out.println("Für einen neuen Ansprechpartner brauchen wir folgende Angaben:");
System.out.println("Vorname: ");
String vorname = ConsoleReader.readString("Bitte Vorname angeben.");
System.out.println("Nachname: ");
String nachname = ConsoleReader.readString("Bitte Nachnamen angeben.");
System.out.println("Telefonnummer: ");
String telefon = ConsoleReader.readString("Bitte Telefonnummer angeben.");
while (true) {
System.out.println("Wollen Sie die Angaben korrigieren? (j/n)");
List<String> options = List.of("j", "n");
String input = ConsoleReader.readString("Bitte 'j' oder 'n'.", options);
if (input.equalsIgnoreCase("j")) {
System.out.println("Welche Angaben wollen Sie korrigieren?");
System.out.println("(01) Vorname: " + vorname);
System.out.println("(02) Nachname: " + nachname);
System.out.println("(03) Telefonnummer: " + telefon);
List<Integer> optionsNum = List.of(1, 2, 3);
int inputNum = ConsoleReader.readNumber("Bitte 1-3 als Option angeben.", optionsNum);
switch (inputNum) {
case 1:
System.out.println("Vorname: ");
vorname = ConsoleReader.readString("Bitte Vorname angeben.");
break;
case 2:
System.out.println("Nachname: ");
nachname = ConsoleReader.readString("Bitte Nachname angeben.");
break;
case 3:
System.out.println("Telefonnummer: ");
telefon = ConsoleReader.readString("Bitte Telefonnummer angeben.");
break;
default:
assert false;
}
} else {
System.out.println("Die Angaben zum Ansprechpartner werden übernommen.");
break;
}
}
return new ContanctPerson(vorname, nachname, telefon);
}
/**
* Searches for a customer (private and company) based on customer number
* @param customerNumber for the search in List with private and company customers
* @return customer with the customer number or null if not existing
*/
private Customer searchCustomerByCustomerNumber(String customerNumber) {
for (Customer customer : privateCustomers) {
if (customer.getCustomernumber().equalsIgnoreCase(customerNumber)) {
return customer;
}
}
for (Customer customer : companyCustomers) {
if (customer.getCustomernumber().equalsIgnoreCase(customerNumber)) {
return customer;
}
}
return null;
}
/**
* Searches for customers with matching name
*
* @param name of the customer (private: Vorname, Nachname) (company: Firmennamme)
* @return found customer or null
*/
private Customer searchCustomerByName(String name) {
for (CompanyCustomer kunde : companyCustomers) {
if (kunde.getCompanyName().equalsIgnoreCase(name)) {
return kunde;
}
}
for (PrivateCustomer kunde : privateCustomers) {
if (kunde.getFirstName().equalsIgnoreCase(name) || kunde.getLastName().equalsIgnoreCase(name)) {
return kunde;
}
}
return null;
}
/**
* Search for konto with matching IBAN.
*
* @param iban of the konto
* @return konto with IBAN or null
*/
private Account searchAccountsByIBAN(String iban) {
for (Account account : accounts) {
if (account.getIBAN().equalsIgnoreCase(iban)) {
return account;
}
}
return null;
}
/**
* Prints out a variable number of private customers
* @param customers is a single customer or an array of customers to be printed
*/
private void showPrivateCustomers(PrivateCustomer... customers) {
System.out.println("Kundennummer | Vorname | Nachname | Telefon | Email | Geburtsdatum | Ort | Straße | Nr.");
for (PrivateCustomer kunde : customers) {
Address address = kunde.getAddress();
System.out.println(
kunde.getCustomernumber() + " | " +
kunde.getFirstName() + " | " +
kunde.getLastName() + " | " +
kunde.getPhone() + " | " +
kunde.getEmail() + " | " +
kunde.getBirthday() + " | " +
address.getCity() + " | " +
address.getStreet() + " | " +
address.getHouseNr()
);
}
System.out.println();
}
/**
* Prints out a variable number of company customers
* @param customers is a single customer or an array of customers to be printed
*/
private void showCompanyCustomers(CompanyCustomer... customers) {
System.out.println("Kundennummer | Firmenname | Ansprechpartner Name & Nummer | Telefon | Email | Geburtsdatum | Ort | Straße | Nr.");
for (CompanyCustomer kunde : customers) {
Address address = kunde.getAddress();
ContanctPerson partner = kunde.getContanctPerson();
System.out.println(
kunde.getCustomernumber() + " | " +
kunde.getCompanyName() + " | " +
partner.getFirstName() + " " +
partner.getLastName() + " & " +
partner.getPhone() + " | " +
kunde.getPhone() + " | " +
kunde.getEmail() + " | " +
address.getCity() + " | " +
address.getStreet() + " | " +
address.getHouseNr()
);
}
System.out.println();
}
/**
* Prints out a variable number of accounts
* @param accounts is a single account or an array of accounts to be printed
*/
private void showAccounts(Account... accounts) {
System.out.println("IBAN | Kontostand");
for (Account account : accounts) {
System.out.println(
account.getIBAN() + " | " +
account.getBalance()
);
}
System.out.println();
}
}
|
UTF-8
|
Java
| 21,297 |
java
|
Bank.java
|
Java
|
[
{
"context": "ateCustomer privateCustomer = new PrivateCustomer(firstName, lastName, phone, email, birthday, address);\n ",
"end": 6192,
"score": 0.9996304512023926,
"start": 6183,
"tag": "NAME",
"value": "firstName"
},
{
"context": "r privateCustomer = new PrivateCustomer(firstName, lastName, phone, email, birthday, address);\n this.priva",
"end": 6202,
"score": 0.9985408782958984,
"start": 6194,
"tag": "NAME",
"value": "lastName"
},
{
"context": "me\n *\n * @param name of the customer (private: Vorname, Nachname) (company: Firmennamme)\n * @retur",
"end": 18144,
"score": 0.5674673914909363,
"start": 18141,
"tag": "NAME",
"value": "Vor"
}
] | null |
[] |
package bank;
import bank.account.Account;
import bank.customer.ContanctPerson;
import bank.customer.CompanyCustomer;
import bank.customer.Customer;
import bank.address.Address;
import bank.customer.PrivateCustomer;
import bank.util.ConsoleReader;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* Bank is the main class of the bank application.
* run() is used to start the
*/
public class Bank {
private static final Bank INSTANCE = new Bank();
private String name = "";
private String BIC = "";
private Address address;
private ArrayList<PrivateCustomer> privateCustomers = new ArrayList<>();
private ArrayList<CompanyCustomer> companyCustomers = new ArrayList<>();
private ArrayList<Account> accounts = new ArrayList<>();
private Bank() {
}
/**
* Singleton getInstance
*
* @return bank instance
*/
public static Bank getInstance() {
return INSTANCE;
}
/**
* Singleton getInstance with parameters
*
* @param name of the bank
* @param BIC of the bank
* @param address of the bank
* @return bank instance
*/
public static Bank getInstance(String name, String BIC, Address address) {
INSTANCE.name = name;
INSTANCE.BIC = BIC;
INSTANCE.address = address;
return INSTANCE;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getBIC() {
return BIC;
}
public void setBIC(String BIC) {
this.BIC = BIC;
}
public Address getAddress() {
return new Address(address);
}
public void setAddress(Address address) {
this.address = new Address(address);
}
/**
* Execute run to work with the bank
*/
public void run() {
int input;
while (true) {
showMenu();
List<Integer> options = List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
input = ConsoleReader.readNumber("Bitte eine Zahl zwischen 1 und 10", options);
pickMenu(input);
}
}
/**
* Helper method to show the menu
*/
private void showMenu() {
System.out.println("(01) Privatkunde anlegen");
System.out.println("(02) Firmenkunde anlegen");
System.out.println("(03) Konto anlegen und Kundennummer zuordnen");
System.out.println("(04) Kunde mit Konten anzeigen (Auswahl durch Kundennummer)");
System.out.println("(05) Kunde mit Konten anzeigen (Auswahl durch Name)");
System.out.println("(06) Konto anzeigen (Auswahl durch IBAN)");
System.out.println("(07) Alle Kunden unsortiert anzeigen");
System.out.println("(08) Alle Kunden sortiert nach aufsteigender Kundenummer anzeigen");
System.out.println("(09) Alle Konten unsortiert anzeigen");
System.out.println("(10) Beenden");
}
/**
* Input helper method to pick option from menu
*/
private void pickMenu(int input) {
switch (input) {
case 1:
createPrivateCustomer();
break;
case 2:
createCompanyCustomer();
break;
case 3:
createAccount();
break;
case 4:
showCustomerAccountOfCustomerNumber();
break;
case 5:
showCustomerAccountOfName();
break;
case 6:
showAccountOfIBAN();
break;
case 7:
showAllCustomers();
break;
case 8:
showAllCustomersSorted();
break;
case 9:
showAllAccounts();
break;
case 10:
shutDown();
break;
}
}
/**
* Input helper method to create a private customer
*/
private void createPrivateCustomer() {
System.out.println("Für einen neuen Privatkunden brauchen wir folgende Angaben:");
System.out.println("Vorname: ");
String firstName = ConsoleReader.readString("Bitte Vorname angeben.");
System.out.println("Nachname: ");
String lastName = ConsoleReader.readString("Bitte Nachnamen angeben.");
System.out.println("Telefonnummer: ");
String phone = ConsoleReader.readString("Bitte Telefonnummer angeben.");
System.out.println("Email: ");
String email = ConsoleReader.readString("Bitte Email angeben.");
System.out.println("Geburtsdatum (yyyy-mm-dd): ");
LocalDate birthday = ConsoleReader.readDate("Bitte Geburtsdatum angeben.");
while (true) {
System.out.println("Wollen Sie die Angaben korrigieren? (j/n)");
List<String> options = List.of("j", "n");
String input = ConsoleReader.readString("Bitte 'j' oder 'n'.", options);
if (input.equalsIgnoreCase("j")) {
System.out.println("Welche Angaben wollen Sie korrigieren?");
System.out.println("(01) Vorname: " + firstName);
System.out.println("(02) Nachname: " + lastName);
System.out.println("(03) Telefonnummer: " + phone);
System.out.println("(04) Email: " + email);
System.out.println("(05) Geburtsdatum: " + birthday);
List<Integer> optionsNum = List.of(1, 2, 3, 4, 5);
int inputNum = ConsoleReader.readNumber("Bitte 1-5 als Option angeben.", optionsNum);
switch (inputNum) {
case 1:
System.out.println("Vorname: ");
firstName = ConsoleReader.readString("Bitte Vorname angeben.");
break;
case 2:
System.out.println("Nachname: ");
lastName = ConsoleReader.readString("Bitte Nachname angeben.");
break;
case 3:
System.out.println("Telefonnummer: ");
phone = ConsoleReader.readString("Bitte Telefonnummer angeben.");
break;
case 4:
System.out.println("Email: ");
email = ConsoleReader.readString("Bitte Email angeben.");
break;
case 5:
System.out.println("Geburtsdatum: ");
birthday = ConsoleReader.readDate("Bitte Geburtsdatum angeben.");
break;
default:
assert false;
}
} else {
System.out.println("Die Angaben zum Privatkunden werden übernommen.");
break;
}
}
Address address = createAddress();
PrivateCustomer privateCustomer = new PrivateCustomer(firstName, lastName, phone, email, birthday, address);
this.privateCustomers.add(privateCustomer);
System.out.println("Neuen Privatkunden mit Kundennumer " + privateCustomer.getCustomernumber() +
" erfolgreich angelet.");
}
/**
* Input helper method to create a company customer
*/
private void createCompanyCustomer() {
System.out.println("Für einen neuen Firmenkunde brauchen wir folgende Angaben:");
System.out.println("Firmennamen: ");
String companyName = ConsoleReader.readString("Bitte Firmennamen angeben.");
System.out.println("Telefonnummer: ");
String phone = ConsoleReader.readString("Bitte Telefonnummer angeben.");
System.out.println("Email: ");
String email = ConsoleReader.readString("Bitte Email angeben.");
while (true) {
System.out.println("Wollen Sie die Angaben korrigieren? (j/n)");
List<String> options = List.of("j", "n");
String input = ConsoleReader.readString("Bitte 'j' oder 'n'.", options);
if (input.equalsIgnoreCase("j")) {
System.out.println("Welche Angaben wollen Sie korrigieren?");
System.out.println("(01) Firmenname: " + companyName);
System.out.println("(02) Telefonnummer: " + phone);
System.out.println("(03) Email: " + email);
List<Integer> optionsNum = List.of(1, 2, 3);
int inputNum = ConsoleReader.readNumber("Bitte 1-3 als Option angeben.", optionsNum);
switch (inputNum) {
case 1:
System.out.println("Firmenname: ");
companyName = ConsoleReader.readString("Bitte Firmenname angeben.");
break;
case 2:
System.out.println("Telefonnummer: ");
phone = ConsoleReader.readString("Bitte Telefonnummer angeben.");
break;
case 3:
System.out.println("Email: ");
email = ConsoleReader.readString("Bitte Email angeben.");
break;
default:
assert false;
}
} else {
System.out.println("Die Angaben zum Firmenkunde werden übernommen.");
break;
}
}
ContanctPerson contanctPerson = createContactPerson();
Address address = createAddress();
CompanyCustomer companyCustomer = new CompanyCustomer(companyName, contanctPerson, phone, email, address);
this.companyCustomers.add(companyCustomer);
System.out.println("Neuer Firmenkunde mit Kundennumer " + companyCustomer.getCustomernumber() +
" erfolgreich angelet.");
}
/**
* Input helper method to create an account and assign to customer by customer number
*/
private void createAccount() {
System.out.println("Konto anlegen.");
System.out.println("Zu welchem Kunden wird das Konto zugeordnet?");
System.out.println("Kundennummer fängt mit 'P' oder 'F' an: ");
String input = ConsoleReader.readString("Kundennummer fängt mit 'P' oder 'F' an.");
Customer customer = searchCustomerByCustomerNumber(input);
PrivateCustomer pKunde;
CompanyCustomer fKunde;
if (customer != null) {
System.out.println("Bitte geben sie die IBAN an: ");
String iban = ConsoleReader.readString("Bitte IBAN angeben.");
Account account = new Account(iban);
customer.addAccount(account);
accounts.add(account);
System.out.println("Konto mit IBAN " + account.getIBAN() + " erfolgreich hinzugefügt.");
} else {
System.out.println("Keinen Kunden mit der Kundennummer " + input + " gefunden!");
}
}
/**
* Input helper method to show account with customer number and corresponding accounts
*/
private void showCustomerAccountOfCustomerNumber() {
System.out.println("Kunde mit Konten anzeigen (Auswahl durch Kundennummer).");
System.out.println("Zu welchem Kunden das Konto anzeigen?");
System.out.println("Kundennummer fängt mit 'P' oder 'F' an: ");
String input = ConsoleReader.readString("Kundennummer fängt mit 'P' oder 'F' an.");
Customer customer = searchCustomerByCustomerNumber(input);
if (customer != null) {
if (customer instanceof PrivateCustomer) {
showPrivateCustomers((PrivateCustomer) customer);
}
if (customer instanceof CompanyCustomer) {
showCompanyCustomers((CompanyCustomer) customer);
}
showAccounts(customer.getAccounts().toArray(Account[]::new));
} else {
System.out.println("Keinen Kunden mit der Kundennummer " + input + " gefunden!");
}
}
/**
* Input helper method to show account with specific name and corresponding accounts
*/
private void showCustomerAccountOfName() {
System.out.println("Kunde mit Konten anzeigen (Auswahl durch Name)");
System.out.println("Zu welchem Kunden das Konto anzeigen?");
System.out.println("Kundenname (Firma, Vor-, Nachname): ");
String input = ConsoleReader.readString("Kundenname (Firma, Vor-, Nachname): ");
Customer customer = searchCustomerByName(input);
if (customer != null) {
if (customer instanceof PrivateCustomer) {
showPrivateCustomers((PrivateCustomer) customer);
}
if (customer instanceof CompanyCustomer) {
showCompanyCustomers((CompanyCustomer) customer);
}
showAccounts(customer.getAccounts().toArray(Account[]::new));
} else {
System.out.println("Keinen Kunden mit dem Namen " + input + " gefunden!");
}
}
/**
* Input helper method to show account with specific IBAN
*/
private void showAccountOfIBAN() {
System.out.println("Konto anzeigen (Auswahl durch IBAN)");
System.out.println("Zu welcher IBAN suchen Sie das Konto?");
System.out.println("IBAN: ");
String input = ConsoleReader.readString("IBAN bitte.");
Account account = searchAccountsByIBAN(input);
if (account != null) {
showAccounts(account);
} else {
System.out.println("Kein Konto mit der IBAN " + input + " gefunden!");
}
}
/**
* Shows all customers (private & company) unsorted
*/
private void showAllCustomers() {
System.out.println("Alle Kunden unsortiert anzeigen");
showPrivateCustomers(privateCustomers.toArray(PrivateCustomer[]::new));
showCompanyCustomers(companyCustomers.toArray(CompanyCustomer[]::new));
}
/**
* Shows all customers (private & company) sorted by the customer number
*/
private void showAllCustomersSorted() {
System.out.println("Alle Kunden sortiert nach aufsteigender Kundenummer anzeigen");
Collections.sort(privateCustomers);
showPrivateCustomers(privateCustomers.toArray(PrivateCustomer[]::new));
Collections.sort(companyCustomers);
showCompanyCustomers(companyCustomers.toArray(CompanyCustomer[]::new));
}
/**
* Shows all accounts unsorted
*/
private void showAllAccounts() {
System.out.println("Alle Konten unsortiert anzeigen");
showAccounts(accounts.toArray(Account[]::new));
}
/**
* Input helper method to shut down the bank
*/
private void shutDown() {
System.out.println("Wollen Sie wirklich das Programm beenden? (j/n)");
List<String> options = List.of("j", "n");
String input = ConsoleReader.readString("Bitte 'j' oder 'n'.", options);
if (input.equalsIgnoreCase("j")) {
System.out.println("Bis zum nächsten Mal.");
System.exit(0);
}
}
/**
* Input helper method to create an address
* @return Address object
*/
private Address createAddress() {
System.out.println("Für eine neue Adresse brauchen wir folgende Angaben:");
System.out.println("Straße: ");
String street = ConsoleReader.readString("Bitte Straße angeben.");
System.out.println("Hausnummer: ");
String houseNr = ConsoleReader.readString("Bitte Hausnummer angeben.");
System.out.println("Ort");
String city = ConsoleReader.readString("Bitte Ort angeben.");
while (true) {
System.out.println("Wollen Sie die Angaben korrigieren? (j/n)");
List<String> options = List.of("j", "n");
String input = ConsoleReader.readString("Bitte 'j' oder 'n'.", options);
if (input.equalsIgnoreCase("j")) {
System.out.println("Welche Angaben wollen Sie korrigieren?");
System.out.println("(01) Straße: " + street);
System.out.println("(02) Hausnummer: " + houseNr);
System.out.println("(03) Ort: " + city);
List<Integer> optionsNum = List.of(1, 2, 3);
int inputNum = ConsoleReader.readNumber("Bitte 1-3 als Option angeben.", optionsNum);
switch (inputNum) {
case 1:
System.out.println("Straße: ");
street = ConsoleReader.readString("Bitte Straße angeben.");
break;
case 2:
System.out.println("Hausnummer: ");
houseNr = ConsoleReader.readString("Bitte Hausnummer angeben.");
break;
case 3:
System.out.println("Ort: ");
city = ConsoleReader.readString("Bitte Ort angeben.");
break;
default:
assert false;
}
} else {
System.out.println("Die Angaben zur Adresse werden übernommen.");
break;
}
}
return new Address(street, houseNr, city);
}
/**
* Input helper method to create a contact person
* @return Customer object
*/
private ContanctPerson createContactPerson() {
System.out.println("Für einen neuen Ansprechpartner brauchen wir folgende Angaben:");
System.out.println("Vorname: ");
String vorname = ConsoleReader.readString("Bitte Vorname angeben.");
System.out.println("Nachname: ");
String nachname = ConsoleReader.readString("Bitte Nachnamen angeben.");
System.out.println("Telefonnummer: ");
String telefon = ConsoleReader.readString("Bitte Telefonnummer angeben.");
while (true) {
System.out.println("Wollen Sie die Angaben korrigieren? (j/n)");
List<String> options = List.of("j", "n");
String input = ConsoleReader.readString("Bitte 'j' oder 'n'.", options);
if (input.equalsIgnoreCase("j")) {
System.out.println("Welche Angaben wollen Sie korrigieren?");
System.out.println("(01) Vorname: " + vorname);
System.out.println("(02) Nachname: " + nachname);
System.out.println("(03) Telefonnummer: " + telefon);
List<Integer> optionsNum = List.of(1, 2, 3);
int inputNum = ConsoleReader.readNumber("Bitte 1-3 als Option angeben.", optionsNum);
switch (inputNum) {
case 1:
System.out.println("Vorname: ");
vorname = ConsoleReader.readString("Bitte Vorname angeben.");
break;
case 2:
System.out.println("Nachname: ");
nachname = ConsoleReader.readString("Bitte Nachname angeben.");
break;
case 3:
System.out.println("Telefonnummer: ");
telefon = ConsoleReader.readString("Bitte Telefonnummer angeben.");
break;
default:
assert false;
}
} else {
System.out.println("Die Angaben zum Ansprechpartner werden übernommen.");
break;
}
}
return new ContanctPerson(vorname, nachname, telefon);
}
/**
* Searches for a customer (private and company) based on customer number
* @param customerNumber for the search in List with private and company customers
* @return customer with the customer number or null if not existing
*/
private Customer searchCustomerByCustomerNumber(String customerNumber) {
for (Customer customer : privateCustomers) {
if (customer.getCustomernumber().equalsIgnoreCase(customerNumber)) {
return customer;
}
}
for (Customer customer : companyCustomers) {
if (customer.getCustomernumber().equalsIgnoreCase(customerNumber)) {
return customer;
}
}
return null;
}
/**
* Searches for customers with matching name
*
* @param name of the customer (private: Vorname, Nachname) (company: Firmennamme)
* @return found customer or null
*/
private Customer searchCustomerByName(String name) {
for (CompanyCustomer kunde : companyCustomers) {
if (kunde.getCompanyName().equalsIgnoreCase(name)) {
return kunde;
}
}
for (PrivateCustomer kunde : privateCustomers) {
if (kunde.getFirstName().equalsIgnoreCase(name) || kunde.getLastName().equalsIgnoreCase(name)) {
return kunde;
}
}
return null;
}
/**
* Search for konto with matching IBAN.
*
* @param iban of the konto
* @return konto with IBAN or null
*/
private Account searchAccountsByIBAN(String iban) {
for (Account account : accounts) {
if (account.getIBAN().equalsIgnoreCase(iban)) {
return account;
}
}
return null;
}
/**
* Prints out a variable number of private customers
* @param customers is a single customer or an array of customers to be printed
*/
private void showPrivateCustomers(PrivateCustomer... customers) {
System.out.println("Kundennummer | Vorname | Nachname | Telefon | Email | Geburtsdatum | Ort | Straße | Nr.");
for (PrivateCustomer kunde : customers) {
Address address = kunde.getAddress();
System.out.println(
kunde.getCustomernumber() + " | " +
kunde.getFirstName() + " | " +
kunde.getLastName() + " | " +
kunde.getPhone() + " | " +
kunde.getEmail() + " | " +
kunde.getBirthday() + " | " +
address.getCity() + " | " +
address.getStreet() + " | " +
address.getHouseNr()
);
}
System.out.println();
}
/**
* Prints out a variable number of company customers
* @param customers is a single customer or an array of customers to be printed
*/
private void showCompanyCustomers(CompanyCustomer... customers) {
System.out.println("Kundennummer | Firmenname | Ansprechpartner Name & Nummer | Telefon | Email | Geburtsdatum | Ort | Straße | Nr.");
for (CompanyCustomer kunde : customers) {
Address address = kunde.getAddress();
ContanctPerson partner = kunde.getContanctPerson();
System.out.println(
kunde.getCustomernumber() + " | " +
kunde.getCompanyName() + " | " +
partner.getFirstName() + " " +
partner.getLastName() + " & " +
partner.getPhone() + " | " +
kunde.getPhone() + " | " +
kunde.getEmail() + " | " +
address.getCity() + " | " +
address.getStreet() + " | " +
address.getHouseNr()
);
}
System.out.println();
}
/**
* Prints out a variable number of accounts
* @param accounts is a single account or an array of accounts to be printed
*/
private void showAccounts(Account... accounts) {
System.out.println("IBAN | Kontostand");
for (Account account : accounts) {
System.out.println(
account.getIBAN() + " | " +
account.getBalance()
);
}
System.out.println();
}
}
| 21,297 | 0.634048 | 0.628878 | 640 | 32.243752 | 27.832085 | 138 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.567187 | false | false |
3
|
c78211326c4911cd0abbb6fe3e8a5cf0427d39df
| 15,831,249,468,238 |
7b2c3b4c25123b1eb3b2a6e0736b27cdc33c6b79
|
/java/5_InitializationCleanup/FinalizeTest.java
|
19333f905f1595781154eb8f1587d35ed3d3a317
|
[] |
no_license
|
ironreality/coding
|
https://github.com/ironreality/coding
|
10018b412b20dc77716c556af0b2df436326801a
|
4929058fdbd4d633c4fcaf9d458912a6584a4f90
|
refs/heads/master
| 2015-08-22T22:57:11.305000 | 2015-08-04T17:59:02 | 2015-08-04T17:59:02 | 33,414,391 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import static net.mindview.util.Print.*;
public class FinalizeTest {
protected void finalize() {
print("finalize() is called!");
}
public static void main(String[] args) {
while ( true ) {
FinalizeTest myclass = new FinalizeTest();
System.gc();
}
}
}
|
UTF-8
|
Java
| 288 |
java
|
FinalizeTest.java
|
Java
|
[] | null |
[] |
import static net.mindview.util.Print.*;
public class FinalizeTest {
protected void finalize() {
print("finalize() is called!");
}
public static void main(String[] args) {
while ( true ) {
FinalizeTest myclass = new FinalizeTest();
System.gc();
}
}
}
| 288 | 0.618056 | 0.618056 | 15 | 18.133333 | 17.700722 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.266667 | false | false |
3
|
70becb8610cf2db07d26bc943b161a0e19fc2f85
| 20,718,922,263,442 |
75f5be576b27e802754ba71600008dead218420a
|
/selenium_project/Activity5.java
|
18dbf130613fc69f66692ed5232bddeff569794f
|
[] |
no_license
|
ANKITkundu/sdet
|
https://github.com/ANKITkundu/sdet
|
ef1ebe6af654dac97d0de750991909140a42e044
|
7872131ac9eb5721e909e029a161f155affb6db6
|
refs/heads/main
| 2023-04-03T00:36:37.994000 | 2021-04-01T12:56:39 | 2021-04-01T12:56:39 | 333,317,800 | 0 | 0 | null | true | 2021-01-27T05:49:13 | 2021-01-27T05:49:13 | 2021-01-05T03:38:39 | 2021-01-27T05:46:52 | 8 | 0 | 0 | 0 | null | false | false |
import org.testng.annotations.Test;
import org.testng.annotations.BeforeMethod;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;
import org.testng.annotations.AfterMethod;
public class Activity5 {
WebDriver driver;
@Test
public void f() {
WebElement j=driver.findElement(By.xpath("//input[@id='txtUsername']"));
j.sendKeys("orange");
WebElement s=driver.findElement(By.xpath("//input[@id='txtPassword']"));
s.sendKeys("orangepassword123");
WebElement u=driver.findElement(By.xpath("//input[@id='btnLogin']"));
u.click();
WebElement m1=driver.findElement(By.cssSelector("#menu_pim_viewMyDetails > b:nth-child(1)"));
m1.click();
WebElement h2= driver.findElement(By.id("btnSave"));
h2.click();
WebElement s2=driver.findElement(By.id("personal_txtEmpFirstName"));
s2.clear();
s2.sendKeys("Ankit");
WebElement s6=driver.findElement(By.id("personal_txtEmpMiddleName"));
s6.clear();
WebElement s3=driver.findElement(By.id("personal_txtEmpLastName"));
s3.clear();
s3.sendKeys("Kundu");
WebElement s4=driver.findElement(By.id("personal_DOB"));
s4.clear();
s4.sendKeys("1989-05-29");
WebElement s5= driver.findElement(By.id("personal_optGender_1"));
s5.click();
Select select = new Select(driver.findElement(By.id("personal_cmbNation")));
select.selectByValue("82");
h2.click();
WebElement u1= driver.findElement(By.id("welcome"));
u1.click();
WebElement g2= driver.findElement(By.linkText("Logout"));
g2.click();
}
@BeforeMethod
public void beforeMethod() {
driver=new FirefoxDriver();
driver.get("http://alchemy.hguy.co/orangehrm");
}
@AfterMethod
public void afterMethod() {
driver.close();
}
}
|
UTF-8
|
Java
| 1,986 |
java
|
Activity5.java
|
Java
|
[
{
"context": "th(\"//input[@id='txtUsername']\"));\n\t j.sendKeys(\"orange\");\n\t WebElement s=driver.findElement(By.xpath(\"/",
"end": 544,
"score": 0.5435507893562317,
"start": 538,
"tag": "USERNAME",
"value": "orange"
},
{
"context": "\"//input[@id='txtPassword']\"));\n s.sendKeys(\"orangepassword123\");\n WebElement u=driver.findElement(By.xpath",
"end": 659,
"score": 0.9993877410888672,
"start": 642,
"tag": "PASSWORD",
"value": "orangepassword123"
},
{
"context": "irstName\"));\n s2.clear();\n s2.sendKeys(\"Ankit\");\n WebElement s6=driver.findElement(By.id(\"",
"end": 1065,
"score": 0.999672532081604,
"start": 1060,
"tag": "NAME",
"value": "Ankit"
},
{
"context": "LastName\"));\n s3.clear();\n s3.sendKeys(\"Kundu\");\n WebElement s4=driver.findElement(By.id(\"",
"end": 1279,
"score": 0.9996775984764099,
"start": 1274,
"tag": "NAME",
"value": "Kundu"
}
] | null |
[] |
import org.testng.annotations.Test;
import org.testng.annotations.BeforeMethod;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;
import org.testng.annotations.AfterMethod;
public class Activity5 {
WebDriver driver;
@Test
public void f() {
WebElement j=driver.findElement(By.xpath("//input[@id='txtUsername']"));
j.sendKeys("orange");
WebElement s=driver.findElement(By.xpath("//input[@id='txtPassword']"));
s.sendKeys("<PASSWORD>");
WebElement u=driver.findElement(By.xpath("//input[@id='btnLogin']"));
u.click();
WebElement m1=driver.findElement(By.cssSelector("#menu_pim_viewMyDetails > b:nth-child(1)"));
m1.click();
WebElement h2= driver.findElement(By.id("btnSave"));
h2.click();
WebElement s2=driver.findElement(By.id("personal_txtEmpFirstName"));
s2.clear();
s2.sendKeys("Ankit");
WebElement s6=driver.findElement(By.id("personal_txtEmpMiddleName"));
s6.clear();
WebElement s3=driver.findElement(By.id("personal_txtEmpLastName"));
s3.clear();
s3.sendKeys("Kundu");
WebElement s4=driver.findElement(By.id("personal_DOB"));
s4.clear();
s4.sendKeys("1989-05-29");
WebElement s5= driver.findElement(By.id("personal_optGender_1"));
s5.click();
Select select = new Select(driver.findElement(By.id("personal_cmbNation")));
select.selectByValue("82");
h2.click();
WebElement u1= driver.findElement(By.id("welcome"));
u1.click();
WebElement g2= driver.findElement(By.linkText("Logout"));
g2.click();
}
@BeforeMethod
public void beforeMethod() {
driver=new FirefoxDriver();
driver.get("http://alchemy.hguy.co/orangehrm");
}
@AfterMethod
public void afterMethod() {
driver.close();
}
}
| 1,979 | 0.685801 | 0.666667 | 58 | 33.241379 | 24.770193 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.862069 | false | false |
3
|
4208f08ec457275bf22d43b93386ce3f7d96e81f
| 12,189,117,189,174 |
2a41682f54be3ce56ada6ddd3e34ebbcc229d57d
|
/app/src/main/java/com/example/zengcanwen/xplayer/online/presenter/OnlinePresenter.java
|
f69a0b9a525023e375a48eee991db0175353e9d7
|
[] |
no_license
|
SammyZeng/XPlayer
|
https://github.com/SammyZeng/XPlayer
|
5b560459d1e97ffb81ac1de5bd18ba1dbe2476bb
|
f6804c3780b361284f0bd0705c130958e20cb7f1
|
refs/heads/master
| 2021-05-16T14:35:50.501000 | 2018-02-28T15:58:50 | 2018-02-28T15:58:50 | 118,423,278 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.zengcanwen.xplayer.online.presenter;
import android.view.View;
import com.example.zengcanwen.xplayer.Bean.EventBusServiceBean;
/**
* 在线视频Fragment的presenter层接口
* Created by zengcanwen on 2018/1/26.
*/
public interface OnlinePresenter {
void init();
void updataPic(String url, int position);
void initProgress(int position);
void listViewrecycle(View view);
void listViewScroll(int firstItemVisiable, int lastItemVisiable);
void progressClick(int position);
void lLayoutClick(int position);
boolean eventBusHandler(EventBusServiceBean eventBusServiceBean);
boolean destory();
}
|
UTF-8
|
Java
| 664 |
java
|
OnlinePresenter.java
|
Java
|
[
{
"context": "n;\n\n/**\n * 在线视频Fragment的presenter层接口\n * Created by zengcanwen on 2018/1/26.\n */\n\npublic interface OnlinePresent",
"end": 206,
"score": 0.9980786442756653,
"start": 196,
"tag": "USERNAME",
"value": "zengcanwen"
}
] | null |
[] |
package com.example.zengcanwen.xplayer.online.presenter;
import android.view.View;
import com.example.zengcanwen.xplayer.Bean.EventBusServiceBean;
/**
* 在线视频Fragment的presenter层接口
* Created by zengcanwen on 2018/1/26.
*/
public interface OnlinePresenter {
void init();
void updataPic(String url, int position);
void initProgress(int position);
void listViewrecycle(View view);
void listViewScroll(int firstItemVisiable, int lastItemVisiable);
void progressClick(int position);
void lLayoutClick(int position);
boolean eventBusHandler(EventBusServiceBean eventBusServiceBean);
boolean destory();
}
| 664 | 0.756173 | 0.74537 | 31 | 19.903225 | 22.998394 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.451613 | false | false |
3
|
87bb65c6f4be72557010538fd059266eca14a805
| 25,769,803,778,485 |
f7aaa97533893cab422c7d55397a21424d70866f
|
/src/Lesson_6/LAB6/LR_1/Run.java
|
394731ee0e0c0e12a78215a5c12b4ed8ea9ae7b2
|
[] |
no_license
|
13voron777/Java-Advanced
|
https://github.com/13voron777/Java-Advanced
|
5d8dde92dbb7758abf1ecf338638acdc94acff3f
|
452def3ca8a9cc566e563af9b3289cdb76dae0be
|
refs/heads/main
| 2023-09-05T12:08:07.086000 | 2021-11-24T00:46:58 | 2021-11-24T00:46:58 | 418,717,384 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package Lesson_6.LAB6.LR_1;
import java.io.*;
public class Run {
public static void main(String[] args) {
File file = new File("src\\Lesson_6\\LAB6\\LR_1\\test.txt");
Animal animal = new Animal("Wolf", 10, true);
try (ObjectOutputStream os = new ObjectOutputStream(new FileOutputStream(file))) {
ObjectInputStream oi = new ObjectInputStream(new FileInputStream(file));
os.writeObject(animal);
Animal animal1 = (Animal) oi.readObject();
System.out.println(animal1);
} catch (IOException | ClassNotFoundException e) {
e.printStackTrace();
}
}
}
|
UTF-8
|
Java
| 655 |
java
|
Run.java
|
Java
|
[] | null |
[] |
package Lesson_6.LAB6.LR_1;
import java.io.*;
public class Run {
public static void main(String[] args) {
File file = new File("src\\Lesson_6\\LAB6\\LR_1\\test.txt");
Animal animal = new Animal("Wolf", 10, true);
try (ObjectOutputStream os = new ObjectOutputStream(new FileOutputStream(file))) {
ObjectInputStream oi = new ObjectInputStream(new FileInputStream(file));
os.writeObject(animal);
Animal animal1 = (Animal) oi.readObject();
System.out.println(animal1);
} catch (IOException | ClassNotFoundException e) {
e.printStackTrace();
}
}
}
| 655 | 0.615267 | 0.6 | 20 | 31.75 | 28.232738 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false |
3
|
108a627510009d39b5c366c55791e34b3f43d2c0
| 25,769,803,776,316 |
57f7f563cfcdd806c64644e90d2e3edac08c5f39
|
/src/main/java/com/twitter/aurora/scheduler/state/ImmediateJobManager.java
|
a085d7df9ddc09d31025c88b113de2e8b9d071b8
|
[
"Apache-2.0"
] |
permissive
|
shaunstanislaus/incubator-aurora
|
https://github.com/shaunstanislaus/incubator-aurora
|
6b9d6b5884b1876eb61e265e71ef73a642e192cf
|
e8a4db11ce177bfd2681da00d153a8ee44c89ec1
|
refs/heads/master
| 2018-05-12T18:19:45.866000 | 2013-12-27T21:20:21 | 2013-12-27T21:20:38 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* Copyright 2013 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.twitter.aurora.scheduler.state;
import java.util.logging.Logger;
import javax.inject.Inject;
import com.twitter.aurora.scheduler.base.Query;
import com.twitter.aurora.scheduler.configuration.SanitizedConfiguration;
import com.twitter.aurora.scheduler.storage.Storage;
import com.twitter.aurora.scheduler.storage.entities.IJobKey;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Job scheduler that accepts any job and executes it immediately.
*/
class ImmediateJobManager extends JobManager {
private static final Logger LOG = Logger.getLogger(ImmediateJobManager.class.getName());
private final StateManager stateManager;
private final Storage storage;
@Inject
ImmediateJobManager(StateManager stateManager, Storage storage) {
this.stateManager = checkNotNull(stateManager);
this.storage = checkNotNull(storage);
}
@Override
public String getUniqueKey() {
return "IMMEDIATE";
}
@Override
public boolean receiveJob(SanitizedConfiguration config) {
LOG.info("Launching " + config.getTaskConfigs().size() + " tasks.");
stateManager.insertPendingTasks(config.getTaskConfigs());
return true;
}
@Override
public boolean hasJob(final IJobKey jobKey) {
return !Storage.Util.consistentFetchTasks(storage, Query.jobScoped(jobKey).active()).isEmpty();
}
}
|
UTF-8
|
Java
| 1,948 |
java
|
ImmediateJobManager.java
|
Java
|
[
{
"context": "de\n public String getUniqueKey() {\n return \"IMMEDIATE\";\n }\n\n @Override\n public boolean receiveJob(Sa",
"end": 1544,
"score": 0.48501110076904297,
"start": 1537,
"tag": "KEY",
"value": "MEDIATE"
}
] | null |
[] |
/*
* Copyright 2013 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.twitter.aurora.scheduler.state;
import java.util.logging.Logger;
import javax.inject.Inject;
import com.twitter.aurora.scheduler.base.Query;
import com.twitter.aurora.scheduler.configuration.SanitizedConfiguration;
import com.twitter.aurora.scheduler.storage.Storage;
import com.twitter.aurora.scheduler.storage.entities.IJobKey;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Job scheduler that accepts any job and executes it immediately.
*/
class ImmediateJobManager extends JobManager {
private static final Logger LOG = Logger.getLogger(ImmediateJobManager.class.getName());
private final StateManager stateManager;
private final Storage storage;
@Inject
ImmediateJobManager(StateManager stateManager, Storage storage) {
this.stateManager = checkNotNull(stateManager);
this.storage = checkNotNull(storage);
}
@Override
public String getUniqueKey() {
return "IMMEDIATE";
}
@Override
public boolean receiveJob(SanitizedConfiguration config) {
LOG.info("Launching " + config.getTaskConfigs().size() + " tasks.");
stateManager.insertPendingTasks(config.getTaskConfigs());
return true;
}
@Override
public boolean hasJob(final IJobKey jobKey) {
return !Storage.Util.consistentFetchTasks(storage, Query.jobScoped(jobKey).active()).isEmpty();
}
}
| 1,948 | 0.760267 | 0.75616 | 61 | 30.934425 | 29.021116 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.42623 | false | false |
3
|
d3d23e53805e7887838e92d307df333cf1aa33d0
| 31,559,419,731,340 |
896b4982f31252d0bab45d2007d2af7286ba3cda
|
/src/main/java/com/newgig/logic/ApplicationLogic.java
|
0b0692750c78c1adda9d7f01bac60d4ba5c99272
|
[] |
no_license
|
hm1rafael/oneconfig
|
https://github.com/hm1rafael/oneconfig
|
4e8d57322ca1f65e3773ed9c2ab299f6203d448f
|
2bc77fb9d70cb7709b74e0f9c522845df338028d
|
refs/heads/master
| 2020-05-17T11:10:34.021000 | 2015-01-07T01:55:42 | 2015-01-07T01:55:42 | 28,229,863 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.newgig.logic;
import java.util.Collection;
import java.util.List;
import org.springframework.stereotype.Service;
import com.newgig.dao.ConfigDAO;
import com.newgig.logic.annotation.Lock;
import com.newgig.model.Application;
@Service
public class ApplicationLogic {
private ConfigDAO<Application> applicationDAO;
private DataSourceLogic dataSourceLogic;
@Lock
public void add(String applicationName, List<String> aliasNames) {
Application application = new Application(applicationName);
for (String aliasName : aliasNames) {
application.addDatasource(aliasName);
}
this.applicationDAO.add(applicationName, application);
}
@Lock
public void remove(String applicationName) {
this.applicationDAO.remove(applicationName);
}
public Collection<Application> list() {
return applicationDAO.list();
}
@Lock
public void addDatasource(String applicationName, List<String> aliasNames) {
doDatasourceLogic("removeDatasource", applicationName, aliasNames);
}
@Lock
public void removeDatasource(String applicationName, List<String> aliasNames) {
doDatasourceLogic("addDatasource", applicationName, aliasNames);
}
private void doDatasourceLogic(String method, String applicationName, List<String> aliasNames) {
Application application = getApplication(applicationName);
for (String aliasName : aliasNames) {
this.dataSourceLogic.verifyExisting(aliasName);
executeMethod(method, application);
}
this.applicationDAO.edit(application.getName(), application);
}
private void executeMethod(String method, Application application) {
try {
application.getClass()
.getMethod(method, String.class)
.invoke(application);
} catch (Exception e) {
throw new IllegalStateException("Invalid state", e);
}
}
private Application getApplication(String applicationName) {
Application application = applicationDAO.get(applicationName);
if (application == null) {
throw new IllegalArgumentException("Application not found");
}
return application;
}
}
|
UTF-8
|
Java
| 2,030 |
java
|
ApplicationLogic.java
|
Java
|
[] | null |
[] |
package com.newgig.logic;
import java.util.Collection;
import java.util.List;
import org.springframework.stereotype.Service;
import com.newgig.dao.ConfigDAO;
import com.newgig.logic.annotation.Lock;
import com.newgig.model.Application;
@Service
public class ApplicationLogic {
private ConfigDAO<Application> applicationDAO;
private DataSourceLogic dataSourceLogic;
@Lock
public void add(String applicationName, List<String> aliasNames) {
Application application = new Application(applicationName);
for (String aliasName : aliasNames) {
application.addDatasource(aliasName);
}
this.applicationDAO.add(applicationName, application);
}
@Lock
public void remove(String applicationName) {
this.applicationDAO.remove(applicationName);
}
public Collection<Application> list() {
return applicationDAO.list();
}
@Lock
public void addDatasource(String applicationName, List<String> aliasNames) {
doDatasourceLogic("removeDatasource", applicationName, aliasNames);
}
@Lock
public void removeDatasource(String applicationName, List<String> aliasNames) {
doDatasourceLogic("addDatasource", applicationName, aliasNames);
}
private void doDatasourceLogic(String method, String applicationName, List<String> aliasNames) {
Application application = getApplication(applicationName);
for (String aliasName : aliasNames) {
this.dataSourceLogic.verifyExisting(aliasName);
executeMethod(method, application);
}
this.applicationDAO.edit(application.getName(), application);
}
private void executeMethod(String method, Application application) {
try {
application.getClass()
.getMethod(method, String.class)
.invoke(application);
} catch (Exception e) {
throw new IllegalStateException("Invalid state", e);
}
}
private Application getApplication(String applicationName) {
Application application = applicationDAO.get(applicationName);
if (application == null) {
throw new IllegalArgumentException("Application not found");
}
return application;
}
}
| 2,030 | 0.771921 | 0.771921 | 73 | 26.80822 | 26.085558 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.79452 | false | false |
3
|
95899810f8ad84eff03d826113e62766670eb3cf
| 20,418,274,594,534 |
e698f85e1aefc7bf6e215780802248b916a0405b
|
/src/test/java/uk/ac/ucl/jsh/CatTest.java
|
b2f4c5724d2e365489208273cf2857c891b33166
|
[] |
no_license
|
GCHeroes1/jsh-team-32
|
https://github.com/GCHeroes1/jsh-team-32
|
7a0fac334fafdfd3be55d0e77662436ea1610164
|
1c0d563af1d8ef114507beca25a4d562206c8c7f
|
refs/heads/master
| 2023-01-20T06:28:22.005000 | 2020-01-05T20:29:46 | 2020-01-05T20:29:46 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package uk.ac.ucl.jsh;
import org.apache.commons.io.FileUtils;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.rules.TemporaryFolder;
import java.io.*;
// import java.nio.file.NoSuchFileException;
// import java.util.ArrayList;
// import java.util.Arrays;
import static org.junit.Assert.*;
public class CatTest {
private Jsh jsh;
private File workingDir;
private ByteArrayOutputStream out = new ByteArrayOutputStream();
public CatTest() {
//jsh = new Jsh(System.getProperty("user.dir"));
out.reset();
}
@Rule
public TemporaryFolder temporaryFolder = new TemporaryFolder();
@Before
public void setup_file_env() throws IOException {
workingDir = temporaryFolder.newFolder("testfolder");
//System.out.println(workingDir.getCanonicalPath());
FileUtils.copyDirectory(new File("src/test/test_template"), workingDir);
jsh = new Jsh(workingDir.getCanonicalPath());
}
@Test
public void test_cat() {
try {
jsh.eval("cat dir1/file1.txt dir1/file2.txt", out);
} catch (Exception e) {
fail(e.toString());
}
String output = new String(out.toByteArray());
output = output.strip();
// can be just \n, but added \r\n because a pleb is using windows...
assertArrayEquals(new String[]{"AAA", "BBB", "AAA", "CCC"}, output.split("\r\n|\n"));
}
@Test
public void test_cat_stdin() throws IOException
{
jsh.eval("cat < dir1/file1.txt", out);
String output = new String(out.toByteArray());
output = output.strip();
// can be just \n, but added \r\n because a pleb is using windows...
assertArrayEquals(new String[]{"AAA", "BBB", "AAA"}, output.split("\r\n|\n"));
}
//=====================================
@Rule
public ExpectedException thrown = ExpectedException.none();
@Test
public void test_cat_file_not_exist() throws IOException
{
thrown.expect(IOException.class);
jsh.eval("cat badfile.txt", out);
}
}
|
UTF-8
|
Java
| 2,159 |
java
|
CatTest.java
|
Java
|
[] | null |
[] |
package uk.ac.ucl.jsh;
import org.apache.commons.io.FileUtils;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.rules.TemporaryFolder;
import java.io.*;
// import java.nio.file.NoSuchFileException;
// import java.util.ArrayList;
// import java.util.Arrays;
import static org.junit.Assert.*;
public class CatTest {
private Jsh jsh;
private File workingDir;
private ByteArrayOutputStream out = new ByteArrayOutputStream();
public CatTest() {
//jsh = new Jsh(System.getProperty("user.dir"));
out.reset();
}
@Rule
public TemporaryFolder temporaryFolder = new TemporaryFolder();
@Before
public void setup_file_env() throws IOException {
workingDir = temporaryFolder.newFolder("testfolder");
//System.out.println(workingDir.getCanonicalPath());
FileUtils.copyDirectory(new File("src/test/test_template"), workingDir);
jsh = new Jsh(workingDir.getCanonicalPath());
}
@Test
public void test_cat() {
try {
jsh.eval("cat dir1/file1.txt dir1/file2.txt", out);
} catch (Exception e) {
fail(e.toString());
}
String output = new String(out.toByteArray());
output = output.strip();
// can be just \n, but added \r\n because a pleb is using windows...
assertArrayEquals(new String[]{"AAA", "BBB", "AAA", "CCC"}, output.split("\r\n|\n"));
}
@Test
public void test_cat_stdin() throws IOException
{
jsh.eval("cat < dir1/file1.txt", out);
String output = new String(out.toByteArray());
output = output.strip();
// can be just \n, but added \r\n because a pleb is using windows...
assertArrayEquals(new String[]{"AAA", "BBB", "AAA"}, output.split("\r\n|\n"));
}
//=====================================
@Rule
public ExpectedException thrown = ExpectedException.none();
@Test
public void test_cat_file_not_exist() throws IOException
{
thrown.expect(IOException.class);
jsh.eval("cat badfile.txt", out);
}
}
| 2,159 | 0.622974 | 0.620195 | 74 | 28.175676 | 25.385864 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.662162 | false | false |
3
|
12da1dc9a70da127d91527b7e274cfbc74d5bfb1
| 33,131,377,766,169 |
688100d310bb135bd189b70a52a063ab0864ea54
|
/src/org/Algorithm/Chapter9Algorithm/WordBreak.java
|
36641aa4dfb79cee9b00d26ebf8099131a48b40b
|
[] |
no_license
|
lovepandababy/Algorithms
|
https://github.com/lovepandababy/Algorithms
|
4d4d77dc912f8b4e90b86e2a12485489d15fc8dc
|
b4bb09da8494b7730591c053f75e65713e9b2ca1
|
refs/heads/master
| 2021-01-20T12:33:47.781000 | 2017-09-11T01:20:54 | 2017-09-11T01:20:54 | 90,376,413 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.Algorithm.Chapter9Algorithm;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
/**
* Created by Ellen on 2017/6/16.
* Gieve s = lintcode,
* dict = ["de", "ding", "co", "code", "lint"].
* A solution is ["lint code", "lint co de"].
*/
public class WordBreak {
private void search(int index, String s, List<Integer> path,
boolean[][] isWord, boolean[] possible,
List<String> result) {
if (!possible[index]) {
return;
}
if (index == s.length()) {
StringBuilder sb = new StringBuilder();
int lastIndex = 0;
for (int i = 0; i < path.size(); i++) {
sb.append(s.substring(lastIndex, path.get(i)));
if (i != path.size() - 1) sb.append(" ");
lastIndex = path.get(i);
}
result.add(sb.toString());
return;
}
for (int i = index; i < s.length(); i++) {
if (!isWord[index][i]) {
continue;
}
path.add(i + 1);
search(i + 1, s, path, isWord, possible, result);
path.remove(path.size() - 1);
}
}
public List<String> wordBreak(String s, Set<String> wordDict) {
ArrayList<String> result = new ArrayList<String>();
if (s.length() == 0) {
return result;
}
boolean[][] isWord = new boolean[s.length()][s.length()];
for (int i = 0; i < s.length(); i++) {
for (int j = i; j < s.length(); j++) {
String word = s.substring(i, j + 1);
isWord[i][j] = wordDict.contains(word);
}
}
boolean[] possible = new boolean[s.length() + 1];
possible[s.length()] = true;
for (int i = s.length() - 1; i >= 0; i--) {
for (int j = i; j < s.length(); j++) {
if (isWord[i][j] && possible[j + 1]) {
possible[i] = true;
break;
}
}
}
List<Integer> path = new ArrayList<Integer>();
search(0, s, path, isWord, possible, result);
return result;
}
}
|
UTF-8
|
Java
| 2,235 |
java
|
WordBreak.java
|
Java
|
[
{
"context": "til.List;\nimport java.util.Set;\n\n/**\n * Created by Ellen on 2017/6/16.\n * Gieve s = lintcode,\n * dict = [\"",
"end": 139,
"score": 0.9980883598327637,
"start": 134,
"tag": "NAME",
"value": "Ellen"
}
] | null |
[] |
package org.Algorithm.Chapter9Algorithm;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
/**
* Created by Ellen on 2017/6/16.
* Gieve s = lintcode,
* dict = ["de", "ding", "co", "code", "lint"].
* A solution is ["lint code", "lint co de"].
*/
public class WordBreak {
private void search(int index, String s, List<Integer> path,
boolean[][] isWord, boolean[] possible,
List<String> result) {
if (!possible[index]) {
return;
}
if (index == s.length()) {
StringBuilder sb = new StringBuilder();
int lastIndex = 0;
for (int i = 0; i < path.size(); i++) {
sb.append(s.substring(lastIndex, path.get(i)));
if (i != path.size() - 1) sb.append(" ");
lastIndex = path.get(i);
}
result.add(sb.toString());
return;
}
for (int i = index; i < s.length(); i++) {
if (!isWord[index][i]) {
continue;
}
path.add(i + 1);
search(i + 1, s, path, isWord, possible, result);
path.remove(path.size() - 1);
}
}
public List<String> wordBreak(String s, Set<String> wordDict) {
ArrayList<String> result = new ArrayList<String>();
if (s.length() == 0) {
return result;
}
boolean[][] isWord = new boolean[s.length()][s.length()];
for (int i = 0; i < s.length(); i++) {
for (int j = i; j < s.length(); j++) {
String word = s.substring(i, j + 1);
isWord[i][j] = wordDict.contains(word);
}
}
boolean[] possible = new boolean[s.length() + 1];
possible[s.length()] = true;
for (int i = s.length() - 1; i >= 0; i--) {
for (int j = i; j < s.length(); j++) {
if (isWord[i][j] && possible[j + 1]) {
possible[i] = true;
break;
}
}
}
List<Integer> path = new ArrayList<Integer>();
search(0, s, path, isWord, possible, result);
return result;
}
}
| 2,235 | 0.457271 | 0.447427 | 75 | 28.799999 | 21.299139 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.853333 | false | false |
3
|
8d70e4640d3949fff4ddf7ef1b1b31fdd1b344e1
| 28,999,619,205,527 |
6e7649fbb75f4e1b428fd9f9ed76468b23f7558f
|
/WebApp/MeVenkWebApp/src/main/java/com/mevenk/webapp/cache/authorization/AuthorizationCache.java
|
3800c93c1499b85f93d7e2b3a28a9ce3198243ef
|
[] |
no_license
|
mevenk/MeVenk
|
https://github.com/mevenk/MeVenk
|
5749c01080033f7dc1a5038256db36575e3678fc
|
24ee4709072879edb2d882b1ea8cbc0a5ce92d78
|
refs/heads/master
| 2023-01-13T14:02:42.257000 | 2020-04-21T21:47:21 | 2020-04-21T21:47:21 | 145,596,943 | 1 | 0 | null | false | 2023-01-07T17:05:13 | 2018-08-21T17:26:54 | 2020-04-21T21:47:25 | 2023-01-07T17:05:12 | 182,649 | 1 | 0 | 72 |
Java
| false | false |
/**
*
*/
package com.mevenk.webapp.cache.authorization;
/**
* @author venky
*
*/
public final class AuthorizationCache {
}
|
UTF-8
|
Java
| 131 |
java
|
AuthorizationCache.java
|
Java
|
[
{
"context": "mevenk.webapp.cache.authorization;\n\n/**\n * @author venky\n *\n */\npublic final class AuthorizationCache {\n\n}",
"end": 80,
"score": 0.9995597004890442,
"start": 75,
"tag": "USERNAME",
"value": "venky"
}
] | null |
[] |
/**
*
*/
package com.mevenk.webapp.cache.authorization;
/**
* @author venky
*
*/
public final class AuthorizationCache {
}
| 131 | 0.648855 | 0.648855 | 12 | 9.916667 | 15.173762 | 46 | true | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.083333 | false | false |
3
|
08bbf2da447cf958c268195e65a10937e07e4fbe
| 30,219,389,907,465 |
9374db0d9178b66452a393e5122b7c5bbdedb64a
|
/service/src/main/java/org/openo/auth/service/impl/CheckUserInfoRule.java
|
865afbfe7106ecec6542577d13bbb9a298caf217
|
[] |
no_license
|
openov2/common-services-auth
|
https://github.com/openov2/common-services-auth
|
7648ec4b7be43f2d51c50e1932a9fa6f2acb026a
|
540ce2abf145c3a0f8742c15e06a3937fa68bde4
|
refs/heads/master
| 2021-08-31T19:57:13.218000 | 2017-02-19T12:01:45 | 2017-02-19T12:02:10 | 115,135,363 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* Copyright 2016-2017 Huawei Technologies Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.openo.auth.service.impl;
import java.util.regex.Pattern;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.openo.auth.constant.ErrorCode;
import org.openo.auth.entity.RoleResponse;
import org.openo.auth.entity.UserDetailsUI;
import org.openo.auth.exception.AuthException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Check the user name and password rule.
* <br/>
*
* @author
* @version
*/
public class CheckUserInfoRule {
private static final Logger LOGGER = LoggerFactory.getLogger(CheckUserInfoRule.class);
/**
* Constructor<br/>
*
* @since
*/
private CheckUserInfoRule() {
super();
}
/**
* Check all the user info rule.
* <br/>
*
* @param userInfo
* @since
*/
public static void checkInfo(UserDetailsUI userInfo) {
checkUserNameRule(userInfo.getUserName());
checkPassword(userInfo.getPassword(), userInfo.getUserName());
if(null == userInfo.getRoles() || userInfo.getRoles().isEmpty()) {
LOGGER.error("no role info provided.");
throw new AuthException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.FAILURE_INFORMATION);
}
for(RoleResponse role : userInfo.getRoles()) {
checkRoleValidity(role);
}
}
/**
* <br/>
*
* @param role
* @since
*/
public static void checkRoleValidity(RoleResponse role) {
if(null != role) {
checkRoleNameRule(role.getName());
} else {
LOGGER.error("role name is empty.");
throw new AuthException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.FAILURE_INFORMATION);
}
}
/**
* Check the user name rule:
* 1. Length should between 5 to 30;
* 2. Only contain A-Z, a-z, 0-9, and "_";
* 3. "_" must between the words
* 4. can not contain space.
* <br/>
*
* @param userName
* @since
*/
private static void checkUserNameRule(String userName) {
if(!checkLength(5, 30, userName)) {
LOGGER.error("User name length is invali.");
throw new AuthException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.FAILURE_INFORMATION);
}
if(!checkNameCharacters(userName)) {
LOGGER.error("User name have illegal characters.");
throw new AuthException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.FAILURE_INFORMATION);
}
if(!checkUnderScore(userName)) {
LOGGER.error("'_' must between the words.");
throw new AuthException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.FAILURE_INFORMATION);
}
if(!checkNoSpace(userName)) {
LOGGER.error("User name should not have space.");
throw new AuthException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.FAILURE_INFORMATION);
}
}
/**
* <br/>
*
* @param roleName
* @since
*/
private static void checkRoleNameRule(String roleName) {
if(StringUtils.isEmpty(roleName)) {
LOGGER.error("role name is empty.");
throw new AuthException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.FAILURE_INFORMATION);
}
if(!checkLength(5, 20, roleName)) {
LOGGER.error("role name length is invali.");
throw new AuthException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.FAILURE_INFORMATION);
}
if(!checkName(roleName)) {
LOGGER.error("role name have illegal characters.");
throw new AuthException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.FAILURE_INFORMATION);
}
if(!checkNoSpace(roleName)) {
LOGGER.error("role name should not have space.");
throw new AuthException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.FAILURE_INFORMATION);
}
}
/**
* Check for the password's rule:
* 1. Length should between 8 to 32;
* 2. At least contains: one lower case letter(a-z), and one digit(0-9), one special character:
* ~`@#$%^&*-_=+|\?/()<>[]{}",.;'!
* 3. Can not contain any the user name or user name in reverse order;
* 4. Can not contain space.
* <br/>
*
* @param password
* @param userName
* @since
*/
public static void checkPassword(String password, String userName) {
if(!checkLength(8, 32, password)) {
LOGGER.error("password length should between 8 to 32.");
throw new AuthException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.FAILURE_INFORMATION);
}
if(!checkPasswordCharacter(password)) {
LOGGER.error(
"At least contains: one lowercase letter(a-z), and one digit(0-9), and one special character.");
throw new AuthException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.FAILURE_INFORMATION);
}
if(!checkNoNameOrReverse(password, userName)) {
LOGGER.error("Password should not contain user name or reverse.");
throw new AuthException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.FAILURE_INFORMATION);
}
if(!checkNoSpace(password)) {
LOGGER.error("Password should not have space.");
throw new AuthException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.FAILURE_INFORMATION);
}
}
/**
* check the string's length
* <br/>
*
* @param min
* @param max
* @param string
* @return true: only the string's length is equal or between the min and max.
* @since
*/
private static boolean checkLength(int min, int max, String string) {
return string.length() >= min && string.length() <= max;
}
/**
* check the user name 's character
* <br/>
*
* @param string
* @return true: only contain a-z, A-Z, 0-9, and "_"
* @since
*/
private static boolean checkNameCharacters(String string) {
return Pattern.matches("^[a-zA-Z0-9_]+", string);
}
/**
* <br/>
*
* @param string
* @return
* @since
*/
private static boolean checkName(String string) {
return Pattern.matches("^[a-zA-Z]+", string);
}
/**
* check the under score;
* <br/>
*
* @param string
* @return false: the "_" is in the first or in the end.
* @since
*/
private static boolean checkUnderScore(String string) {
return !(Pattern.matches("^[a-zA-Z0-9_]+_$", string) || Pattern.matches("^_[a-zA-Z1-9_]+", string));
}
/**
* check string have no space .
* <br/>
*
* @param userName
* @return true: no space in the string.
* @since
*/
private static boolean checkNoSpace(String userName) {
return !userName.contains(" ");
}
/**
* check the password's special character.
* <br/>
*
* @param password
* @return true: contain at least: one lower case letter(a-z), and one digit(0-9), one special
* character: ~`@#$%^&*-_=+|\?/()<>[]{}",.;'!
* @since
*/
private static boolean checkPasswordCharacter(String string) {
return Pattern.matches(".*[A-Z]+.*$", string) && Pattern.matches(".*[a-z]+.*$", string)
&& Pattern.matches(".*[0-9]+.*$", string)
&& Pattern.matches(".*[~`@#$%^&\\*\\-_=\\+|\\?/\\(\\)<>\\[\\]{}\",\\.;'!]+.*$", string);
}
/**
* check password not contain the user name and user name reverse.
* <br/>
*
* @param password
* @param userName
* @return true: password do not contain the user name and user name reverse.
* @since
*/
private static boolean checkNoNameOrReverse(String password, String userName) {
return !password.contains(userName) && !password.contains(reverse(userName));
}
/**
* reverse the string.
* <br/>
*
* @param password
* @return
* @since
*/
private static String reverse(String password) {
int length = password.length();
char temp;
char[] array = password.toCharArray();
for(int i = 0; i < length / 2; i++) {
temp = array[i];
array[i] = array[length - 1 - i];
array[length - 1 - i] = temp;
}
return String.valueOf(array);
}
}
|
UTF-8
|
Java
| 9,086 |
java
|
CheckUserInfoRule.java
|
Java
|
[
{
"context": " contain space.\n * <br/>\n * \n * @param userName\n * @since\n */\n private static void che",
"end": 2627,
"score": 0.5294720530509949,
"start": 2619,
"tag": "USERNAME",
"value": "userName"
},
{
"context": "<br/>\n * \n * @param password\n * @param userName\n * @since\n */\n public static void chec",
"end": 4983,
"score": 0.9810853600502014,
"start": 4975,
"tag": "USERNAME",
"value": "userName"
},
{
"context": "have no space .\n * <br/>\n * \n * @param userName\n * @return true: no space in the string.\n ",
"end": 7379,
"score": 0.5236583352088928,
"start": 7371,
"tag": "USERNAME",
"value": "userName"
},
{
"context": "<br/>\n * \n * @param password\n * @param userName\n * @return true: password do not contain the ",
"end": 8309,
"score": 0.9961197376251221,
"start": 8301,
"tag": "USERNAME",
"value": "userName"
}
] | null |
[] |
/*
* Copyright 2016-2017 Huawei Technologies Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.openo.auth.service.impl;
import java.util.regex.Pattern;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.openo.auth.constant.ErrorCode;
import org.openo.auth.entity.RoleResponse;
import org.openo.auth.entity.UserDetailsUI;
import org.openo.auth.exception.AuthException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Check the user name and password rule.
* <br/>
*
* @author
* @version
*/
public class CheckUserInfoRule {
private static final Logger LOGGER = LoggerFactory.getLogger(CheckUserInfoRule.class);
/**
* Constructor<br/>
*
* @since
*/
private CheckUserInfoRule() {
super();
}
/**
* Check all the user info rule.
* <br/>
*
* @param userInfo
* @since
*/
public static void checkInfo(UserDetailsUI userInfo) {
checkUserNameRule(userInfo.getUserName());
checkPassword(userInfo.getPassword(), userInfo.getUserName());
if(null == userInfo.getRoles() || userInfo.getRoles().isEmpty()) {
LOGGER.error("no role info provided.");
throw new AuthException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.FAILURE_INFORMATION);
}
for(RoleResponse role : userInfo.getRoles()) {
checkRoleValidity(role);
}
}
/**
* <br/>
*
* @param role
* @since
*/
public static void checkRoleValidity(RoleResponse role) {
if(null != role) {
checkRoleNameRule(role.getName());
} else {
LOGGER.error("role name is empty.");
throw new AuthException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.FAILURE_INFORMATION);
}
}
/**
* Check the user name rule:
* 1. Length should between 5 to 30;
* 2. Only contain A-Z, a-z, 0-9, and "_";
* 3. "_" must between the words
* 4. can not contain space.
* <br/>
*
* @param userName
* @since
*/
private static void checkUserNameRule(String userName) {
if(!checkLength(5, 30, userName)) {
LOGGER.error("User name length is invali.");
throw new AuthException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.FAILURE_INFORMATION);
}
if(!checkNameCharacters(userName)) {
LOGGER.error("User name have illegal characters.");
throw new AuthException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.FAILURE_INFORMATION);
}
if(!checkUnderScore(userName)) {
LOGGER.error("'_' must between the words.");
throw new AuthException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.FAILURE_INFORMATION);
}
if(!checkNoSpace(userName)) {
LOGGER.error("User name should not have space.");
throw new AuthException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.FAILURE_INFORMATION);
}
}
/**
* <br/>
*
* @param roleName
* @since
*/
private static void checkRoleNameRule(String roleName) {
if(StringUtils.isEmpty(roleName)) {
LOGGER.error("role name is empty.");
throw new AuthException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.FAILURE_INFORMATION);
}
if(!checkLength(5, 20, roleName)) {
LOGGER.error("role name length is invali.");
throw new AuthException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.FAILURE_INFORMATION);
}
if(!checkName(roleName)) {
LOGGER.error("role name have illegal characters.");
throw new AuthException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.FAILURE_INFORMATION);
}
if(!checkNoSpace(roleName)) {
LOGGER.error("role name should not have space.");
throw new AuthException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.FAILURE_INFORMATION);
}
}
/**
* Check for the password's rule:
* 1. Length should between 8 to 32;
* 2. At least contains: one lower case letter(a-z), and one digit(0-9), one special character:
* ~`@#$%^&*-_=+|\?/()<>[]{}",.;'!
* 3. Can not contain any the user name or user name in reverse order;
* 4. Can not contain space.
* <br/>
*
* @param password
* @param userName
* @since
*/
public static void checkPassword(String password, String userName) {
if(!checkLength(8, 32, password)) {
LOGGER.error("password length should between 8 to 32.");
throw new AuthException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.FAILURE_INFORMATION);
}
if(!checkPasswordCharacter(password)) {
LOGGER.error(
"At least contains: one lowercase letter(a-z), and one digit(0-9), and one special character.");
throw new AuthException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.FAILURE_INFORMATION);
}
if(!checkNoNameOrReverse(password, userName)) {
LOGGER.error("Password should not contain user name or reverse.");
throw new AuthException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.FAILURE_INFORMATION);
}
if(!checkNoSpace(password)) {
LOGGER.error("Password should not have space.");
throw new AuthException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.FAILURE_INFORMATION);
}
}
/**
* check the string's length
* <br/>
*
* @param min
* @param max
* @param string
* @return true: only the string's length is equal or between the min and max.
* @since
*/
private static boolean checkLength(int min, int max, String string) {
return string.length() >= min && string.length() <= max;
}
/**
* check the user name 's character
* <br/>
*
* @param string
* @return true: only contain a-z, A-Z, 0-9, and "_"
* @since
*/
private static boolean checkNameCharacters(String string) {
return Pattern.matches("^[a-zA-Z0-9_]+", string);
}
/**
* <br/>
*
* @param string
* @return
* @since
*/
private static boolean checkName(String string) {
return Pattern.matches("^[a-zA-Z]+", string);
}
/**
* check the under score;
* <br/>
*
* @param string
* @return false: the "_" is in the first or in the end.
* @since
*/
private static boolean checkUnderScore(String string) {
return !(Pattern.matches("^[a-zA-Z0-9_]+_$", string) || Pattern.matches("^_[a-zA-Z1-9_]+", string));
}
/**
* check string have no space .
* <br/>
*
* @param userName
* @return true: no space in the string.
* @since
*/
private static boolean checkNoSpace(String userName) {
return !userName.contains(" ");
}
/**
* check the password's special character.
* <br/>
*
* @param password
* @return true: contain at least: one lower case letter(a-z), and one digit(0-9), one special
* character: ~`@#$%^&*-_=+|\?/()<>[]{}",.;'!
* @since
*/
private static boolean checkPasswordCharacter(String string) {
return Pattern.matches(".*[A-Z]+.*$", string) && Pattern.matches(".*[a-z]+.*$", string)
&& Pattern.matches(".*[0-9]+.*$", string)
&& Pattern.matches(".*[~`@#$%^&\\*\\-_=\\+|\\?/\\(\\)<>\\[\\]{}\",\\.;'!]+.*$", string);
}
/**
* check password not contain the user name and user name reverse.
* <br/>
*
* @param password
* @param userName
* @return true: password do not contain the user name and user name reverse.
* @since
*/
private static boolean checkNoNameOrReverse(String password, String userName) {
return !password.contains(userName) && !password.contains(reverse(userName));
}
/**
* reverse the string.
* <br/>
*
* @param password
* @return
* @since
*/
private static String reverse(String password) {
int length = password.length();
char temp;
char[] array = password.toCharArray();
for(int i = 0; i < length / 2; i++) {
temp = array[i];
array[i] = array[length - 1 - i];
array[length - 1 - i] = temp;
}
return String.valueOf(array);
}
}
| 9,086 | 0.59322 | 0.586287 | 296 | 29.695946 | 29.881672 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.439189 | false | false |
3
|
6e8bb3d4646db9edfe0795e88257e03edbe16b97
| 32,959,579,071,969 |
c14d7516eb5ec86a89a0bbc43e2e0936c1852bce
|
/src/by/minsler/oracle/concurrent/Sample.java
|
8226e1a841670cfbcf5cc3a7ae7e4319d75e7923
|
[] |
no_license
|
minsler/by.minsler.oracle
|
https://github.com/minsler/by.minsler.oracle
|
1cad06097e9693751b470826a7d44966ae4f909d
|
7fbe1d39df0bfe1724ccb5e9254985ab9f5b58de
|
refs/heads/master
| 2021-01-25T08:48:45.900000 | 2012-06-26T11:15:45 | 2012-06-26T11:15:45 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package by.minsler.oracle.concurrent;
public class Sample {
public static void main(String[] args) throws InterruptedException {
ThreadUtil.threadMessage("Starting thread in main()");
Thread t = new Thread(new MessageLoop());
long patience = 1000 * 6;
long startTime = System.currentTimeMillis();
ThreadUtil.threadMessage("Start MessageLoop Thread");
t.start();
ThreadUtil.threadMessage("Waiting for message loop to finish");
while (t.isAlive()) {
ThreadUtil.threadMessage("Waiting...");
t.join(1000);
if ((System.currentTimeMillis() - startTime) > patience
&& t.isAlive()) {
ThreadUtil.threadMessage("Tired waiting");
t.interrupt();
t.join(); // why?
}
}
ThreadUtil.threadMessage("finally");
}
}
|
UTF-8
|
Java
| 756 |
java
|
Sample.java
|
Java
|
[] | null |
[] |
package by.minsler.oracle.concurrent;
public class Sample {
public static void main(String[] args) throws InterruptedException {
ThreadUtil.threadMessage("Starting thread in main()");
Thread t = new Thread(new MessageLoop());
long patience = 1000 * 6;
long startTime = System.currentTimeMillis();
ThreadUtil.threadMessage("Start MessageLoop Thread");
t.start();
ThreadUtil.threadMessage("Waiting for message loop to finish");
while (t.isAlive()) {
ThreadUtil.threadMessage("Waiting...");
t.join(1000);
if ((System.currentTimeMillis() - startTime) > patience
&& t.isAlive()) {
ThreadUtil.threadMessage("Tired waiting");
t.interrupt();
t.join(); // why?
}
}
ThreadUtil.threadMessage("finally");
}
}
| 756 | 0.686508 | 0.674603 | 31 | 23.387096 | 22.426477 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.096774 | false | false |
3
|
6ed723b5cc12a169dc50c6278915e17d99186d4f
| 32,959,579,071,976 |
e2ff875beb65a9a6b2d16f10682a01c6e92f65f8
|
/src/main/java/com/amap/api/maps/model/BuildingOverlayOptions.java
|
277ad4e15889f40dce01852022d1fbb249f2aeca
|
[] |
no_license
|
gaoluhua99/hud20220723
|
https://github.com/gaoluhua99/hud20220723
|
3f56abce85e3348b116801a88148530ac23cd35c
|
803a209919d63001f998a61d17072b0f8e5c0e05
|
refs/heads/master
| 2023-03-15T23:55:24.290000 | 2021-03-12T04:13:37 | 2021-03-12T04:13:37 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.amap.api.maps.model;
import android.graphics.Point;
import com.autonavi.amap.mapcore.VirtualEarthProjection;
import java.util.ArrayList;
import java.util.List;
public class BuildingOverlayOptions {
private int a = -1;
private int b = 1;
private int c = -7829368;
private int d = -7829368;
private boolean e = true;
private float f;
private List<LatLng> g = new ArrayList();
public float getZIndex() {
return this.f;
}
public void setZIndex(float f2) {
this.f = f2;
}
public void setVisible(boolean z) {
this.e = z;
}
public boolean isVisible() {
return this.e;
}
public BuildingOverlayOptions setBuildingHeightScale(int i) {
this.b = i;
return this;
}
public int getBuildingHeightScale() {
return this.b;
}
public BuildingOverlayOptions setBuildingTopColor(int i) {
this.c = i;
return this;
}
public BuildingOverlayOptions setBuildingSideColor(int i) {
this.d = i;
return this;
}
public int getBuildingSideColor() {
return this.d;
}
public int getBuildingTopColor() {
return this.c;
}
public BuildingOverlayOptions setBuildingHeight(int i) {
this.a = i;
return this;
}
public int getBuildingHeight() {
return this.a;
}
public List<LatLng> getBuildingLatlngs() {
return this.g;
}
public int[] getPoints() {
List<LatLng> list = this.g;
if (list == null || list.size() <= 0) {
return new int[0];
}
int[] iArr = new int[(this.g.size() * 2)];
int i = 0;
for (int i2 = 0; i2 < this.g.size(); i2++) {
LatLng latLng = this.g.get(i2);
Point latLongToPixels = VirtualEarthProjection.latLongToPixels(latLng.latitude, latLng.longitude, 20);
int i3 = i + 1;
iArr[i] = latLongToPixels.x;
i = i3 + 1;
iArr[i3] = latLongToPixels.y;
}
return iArr;
}
public BuildingOverlayOptions setBuildingLatlngs(List<LatLng> list) {
this.g = list;
return this;
}
}
|
UTF-8
|
Java
| 2,212 |
java
|
BuildingOverlayOptions.java
|
Java
|
[] | null |
[] |
package com.amap.api.maps.model;
import android.graphics.Point;
import com.autonavi.amap.mapcore.VirtualEarthProjection;
import java.util.ArrayList;
import java.util.List;
public class BuildingOverlayOptions {
private int a = -1;
private int b = 1;
private int c = -7829368;
private int d = -7829368;
private boolean e = true;
private float f;
private List<LatLng> g = new ArrayList();
public float getZIndex() {
return this.f;
}
public void setZIndex(float f2) {
this.f = f2;
}
public void setVisible(boolean z) {
this.e = z;
}
public boolean isVisible() {
return this.e;
}
public BuildingOverlayOptions setBuildingHeightScale(int i) {
this.b = i;
return this;
}
public int getBuildingHeightScale() {
return this.b;
}
public BuildingOverlayOptions setBuildingTopColor(int i) {
this.c = i;
return this;
}
public BuildingOverlayOptions setBuildingSideColor(int i) {
this.d = i;
return this;
}
public int getBuildingSideColor() {
return this.d;
}
public int getBuildingTopColor() {
return this.c;
}
public BuildingOverlayOptions setBuildingHeight(int i) {
this.a = i;
return this;
}
public int getBuildingHeight() {
return this.a;
}
public List<LatLng> getBuildingLatlngs() {
return this.g;
}
public int[] getPoints() {
List<LatLng> list = this.g;
if (list == null || list.size() <= 0) {
return new int[0];
}
int[] iArr = new int[(this.g.size() * 2)];
int i = 0;
for (int i2 = 0; i2 < this.g.size(); i2++) {
LatLng latLng = this.g.get(i2);
Point latLongToPixels = VirtualEarthProjection.latLongToPixels(latLng.latitude, latLng.longitude, 20);
int i3 = i + 1;
iArr[i] = latLongToPixels.x;
i = i3 + 1;
iArr[i3] = latLongToPixels.y;
}
return iArr;
}
public BuildingOverlayOptions setBuildingLatlngs(List<LatLng> list) {
this.g = list;
return this;
}
}
| 2,212 | 0.575949 | 0.560579 | 95 | 22.28421 | 20.37215 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.505263 | false | false |
3
|
04e93a7730598302787ec40e06134bef9c4f8871
| 32,959,579,070,005 |
78c65f6506c0f93c1e443bafd938cfcccf86f4b2
|
/pl/otekplay/drop/listeners/EntityExplodeListener.java
|
410ce82e745909bf865f6fb96ddb9dac19ac45c2
|
[] |
no_license
|
RikoDEV/OtekDrop_Stara_Wersja
|
https://github.com/RikoDEV/OtekDrop_Stara_Wersja
|
4b11e1b252606d756045fb9a25b1eacddc6bfca4
|
eef91dec91a1b033be436fefc2af32bc2cc01a9f
|
refs/heads/master
| 2019-04-08T00:14:25.655000 | 2017-03-19T12:16:06 | 2017-03-19T12:16:06 | 80,994,208 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package pl.otekplay.drop.listeners;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityExplodeEvent;
import pl.otekplay.drop.managers.BlockManager;
public class EntityExplodeListener
implements Listener
{
public EntityExplodeListener() {}
@EventHandler
public void onEntityExplodeEvent(EntityExplodeEvent e)
{
for (Block block : e.blockList()) {
if (BlockManager.isBlocked(block)) {
block.setType(Material.AIR);
}
}
}
}
|
UTF-8
|
Java
| 582 |
java
|
EntityExplodeListener.java
|
Java
|
[] | null |
[] |
package pl.otekplay.drop.listeners;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityExplodeEvent;
import pl.otekplay.drop.managers.BlockManager;
public class EntityExplodeListener
implements Listener
{
public EntityExplodeListener() {}
@EventHandler
public void onEntityExplodeEvent(EntityExplodeEvent e)
{
for (Block block : e.blockList()) {
if (BlockManager.isBlocked(block)) {
block.setType(Material.AIR);
}
}
}
}
| 582 | 0.745704 | 0.745704 | 24 | 23.25 | 18.046814 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false |
3
|
203aaacecb9dd7526b123a8d7a86447e33d1976e
| 37,546,604,133,552 |
12b39de50fcea6f3af90b684019c73cd72b0d2eb
|
/Metodologia_E_Linguagem_de_Programacao_Avancada/br/unipe/mlpa/exercicioHeranca_2/TestaOperario.java
|
317c44441555d5300ff86000f2b09e83f37dc7db
|
[] |
no_license
|
jeffersonguanabara/Java
|
https://github.com/jeffersonguanabara/Java
|
1f4e5a771fc90141bce32d95a0b59c54566be362
|
b208d4f0c559c3345aa0d2fcbd590e821f7f231b
|
refs/heads/master
| 2020-03-21T16:35:44.419000 | 2019-08-02T01:10:32 | 2019-08-02T01:10:32 | 73,425,548 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package br.unipe.mlpa.exercicioHeranca_2;
public class TestaOperario {
public static void main(String[] args) {
Operario operario = new Operario();
operario.setNome("João");
operario.setEndereco("Rua Barão");
operario.setTelefone("98633-5294");
operario.setCodigoSetor(01);
operario.setSalarioBase(3000.00f);
operario.setImposto(0.01f);
operario.setValorProducao(15000.00f);
operario.setComissao(0.03f);
System.out.println(operario.getNome());
System.out.println(operario.getEndereco());
System.out.println(operario.getTelefone());
System.out.println(operario.getCodigoSetor());
System.out.println(operario.getSalarioBase());
System.out.println(operario.getImposto());
System.out.println(operario.getValorProducao());
System.out.println(operario.getComissao());
System.out.println(operario.calculaSalario());
System.out.println(operario);
}
}
|
ISO-8859-1
|
Java
| 929 |
java
|
TestaOperario.java
|
Java
|
[
{
"context": "erario = new Operario();\r\n\t\t\r\n\t\toperario.setNome(\"João\");\r\n\t\toperario.setEndereco(\"Rua Barão\");\r\n\t\topera",
"end": 191,
"score": 0.9997963905334473,
"start": 187,
"tag": "NAME",
"value": "João"
},
{
"context": "perario.setNome(\"João\");\r\n\t\toperario.setEndereco(\"Rua Barão\");\r\n\t\toperario.setTelefone(\"98633-5294\");\r\n\t\toper",
"end": 229,
"score": 0.9997750520706177,
"start": 220,
"tag": "NAME",
"value": "Rua Barão"
}
] | null |
[] |
package br.unipe.mlpa.exercicioHeranca_2;
public class TestaOperario {
public static void main(String[] args) {
Operario operario = new Operario();
operario.setNome("João");
operario.setEndereco("<NAME>");
operario.setTelefone("98633-5294");
operario.setCodigoSetor(01);
operario.setSalarioBase(3000.00f);
operario.setImposto(0.01f);
operario.setValorProducao(15000.00f);
operario.setComissao(0.03f);
System.out.println(operario.getNome());
System.out.println(operario.getEndereco());
System.out.println(operario.getTelefone());
System.out.println(operario.getCodigoSetor());
System.out.println(operario.getSalarioBase());
System.out.println(operario.getImposto());
System.out.println(operario.getValorProducao());
System.out.println(operario.getComissao());
System.out.println(operario.calculaSalario());
System.out.println(operario);
}
}
| 925 | 0.720604 | 0.687163 | 30 | 28.9 | 17.698116 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.266667 | false | false |
3
|
c9cc14c2140c69b90a111aa84b91a0bda6f77415
| 32,573,031,976,562 |
26fdf1d8bdfef6569407307e838bdd821db8be31
|
/src/test/java/org/sagebionetworks/web/unitclient/place/SynapsePlaceTest.java
|
26b887374dadca3b0175c960393ded38a1dee4f7
|
[] |
no_license
|
katrinleinweber/SynapseWebClient
|
https://github.com/katrinleinweber/SynapseWebClient
|
09a2bc5c5a2a89db7087374fbe31ef067f8cad7f
|
57d39fd2eb72dddb51d65e71107ddc6f1a63e824
|
refs/heads/develop
| 2020-04-06T06:52:59.942000 | 2016-04-01T17:03:05 | 2016-04-01T17:03:05 | 55,293,289 | 0 | 0 | null | true | 2020-10-27T07:39:23 | 2016-04-02T12:27:56 | 2016-04-02T12:28:06 | 2020-10-27T07:39:23 | 56,230 | 0 | 0 | 7 |
JavaScript
| false | false |
package org.sagebionetworks.web.unitclient.place;
import static org.junit.Assert.*;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.sagebionetworks.web.client.place.Synapse;
/**
* Synapse Place token testing
* @author jayhodgson
*
*/
public class SynapsePlaceTest {
Synapse.Tokenizer tokenizer = new Synapse.Tokenizer();
String testEntityId, testAreaToken;
Long testVersionNumber;
@Before
public void setup(){
testAreaToken = "42";
testEntityId = "syn1234";
testVersionNumber = 9l;
}
@Test
public void testEntityOnlyCase() {
String testToken = testEntityId;
Synapse place = tokenizer.getPlace(testToken);
Assert.assertEquals(testEntityId, place.getEntityId());
Assert.assertNull(place.getVersionNumber());
Assert.assertNull(place.getAreaToken());
Assert.assertNull(place.getArea());
Assert.assertEquals(testToken, tokenizer.getToken(place));
}
@Test
public void testEntityVersionCase() {
String testToken = testEntityId + Synapse.VERSION_DELIMITER + testVersionNumber;
Synapse place = tokenizer.getPlace(testToken);
Assert.assertEquals(testEntityId, place.getEntityId());
Assert.assertEquals(testVersionNumber, place.getVersionNumber());
Assert.assertNull(place.getAreaToken());
Assert.assertNull(place.getArea());
Assert.assertEquals(testToken, tokenizer.getToken(place));
}
@Test
public void testFilesVersionCase() {
String testToken = testEntityId + Synapse.VERSION_DELIMITER + testVersionNumber + Synapse.FILES_DELIMITER;
Synapse place = tokenizer.getPlace(testToken);
Assert.assertEquals(testEntityId, place.getEntityId());
Assert.assertEquals(testVersionNumber, place.getVersionNumber());
Assert.assertEquals(Synapse.EntityArea.FILES, place.getArea());
Assert.assertNull(place.getAreaToken());
Assert.assertEquals(testToken, tokenizer.getToken(place));
}
@Test
public void testAdminVersionCase() {
String testToken = testEntityId + Synapse.VERSION_DELIMITER + testVersionNumber + Synapse.ADMIN_DELIMITER;
Synapse place = tokenizer.getPlace(testToken);
Assert.assertEquals(testEntityId, place.getEntityId());
Assert.assertEquals(testVersionNumber, place.getVersionNumber());
Assert.assertEquals(Synapse.EntityArea.ADMIN, place.getArea());
Assert.assertNull(place.getAreaToken());
Assert.assertEquals(testToken, tokenizer.getToken(place));
}
@Test
public void testDiscussionVersionCase() {
String testToken = testEntityId + Synapse.VERSION_DELIMITER + testVersionNumber + Synapse.DISCUSSION_DELIMITER;
Synapse place = tokenizer.getPlace(testToken);
Assert.assertEquals(testEntityId, place.getEntityId());
Assert.assertEquals(testVersionNumber, place.getVersionNumber());
Assert.assertEquals(Synapse.EntityArea.DISCUSSION, place.getArea());
Assert.assertNull(place.getAreaToken());
Assert.assertEquals(testToken, tokenizer.getToken(place));
}
@Test
public void testWikiVersionCase() {
String testToken = testEntityId + Synapse.VERSION_DELIMITER + testVersionNumber + Synapse.WIKI_DELIMITER + testAreaToken;
Synapse place = tokenizer.getPlace(testToken);
Assert.assertEquals(testEntityId, place.getEntityId());
Assert.assertEquals(testVersionNumber, place.getVersionNumber());
Assert.assertEquals(Synapse.EntityArea.WIKI, place.getArea());
Assert.assertEquals(testAreaToken, place.getAreaToken());
Assert.assertEquals(testToken, tokenizer.getToken(place));
}
@Test
public void testFilesCase() {
String testToken = testEntityId + Synapse.FILES_DELIMITER;
Synapse place = tokenizer.getPlace(testToken);
Assert.assertEquals(testEntityId, place.getEntityId());
Assert.assertNull(place.getVersionNumber());
Assert.assertEquals(Synapse.EntityArea.FILES, place.getArea());
Assert.assertNull(place.getAreaToken());
Assert.assertEquals(testToken, tokenizer.getToken(place));
}
@Test
public void testAdminCase() {
String testToken = testEntityId + Synapse.ADMIN_DELIMITER;
Synapse place = tokenizer.getPlace(testToken);
Assert.assertEquals(testEntityId, place.getEntityId());
Assert.assertNull(place.getVersionNumber());
Assert.assertEquals(Synapse.EntityArea.ADMIN, place.getArea());
Assert.assertNull(place.getAreaToken());
Assert.assertEquals(testToken, tokenizer.getToken(place));
}
@Test
public void testDiscussionCase() {
String testToken = testEntityId + Synapse.DISCUSSION_DELIMITER;
Synapse place = tokenizer.getPlace(testToken);
Assert.assertEquals(testEntityId, place.getEntityId());
Assert.assertNull(place.getVersionNumber());
Assert.assertEquals(Synapse.EntityArea.DISCUSSION, place.getArea());
Assert.assertNull(place.getAreaToken());
Assert.assertEquals(testToken, tokenizer.getToken(place));
}
@Test
public void testWikiCase() {
String testToken = testEntityId + Synapse.WIKI_DELIMITER + testAreaToken;
Synapse place = tokenizer.getPlace(testToken);
Assert.assertEquals(testEntityId, place.getEntityId());
Assert.assertNull(place.getVersionNumber());
Assert.assertEquals(Synapse.EntityArea.WIKI, place.getArea());
Assert.assertEquals(testAreaToken, place.getAreaToken());
Assert.assertEquals(testToken, tokenizer.getToken(place));
}
@Test
public void testGetHrefForDotVersionNull(){
assertEquals(null, Synapse.getHrefForDotVersion(null));
}
@Test
public void testGetTokenForDotVersionEmpty(){
assertEquals(null, Synapse.getHrefForDotVersion(""));
}
@Test
public void testGetTokenForDotVersionNoVersion(){
assertEquals("#!Synapse:syn123", Synapse.getHrefForDotVersion("SYN123"));
}
@Test
public void testGetTokenForDotVersionWithVersion(){
assertEquals("#!Synapse:syn123/version/3", Synapse.getHrefForDotVersion("syn123.3"));
}
}
|
UTF-8
|
Java
| 5,910 |
java
|
SynapsePlaceTest.java
|
Java
|
[
{
"context": "\n\r\n/**\r\n * Synapse Place token testing\r\n * @author jayhodgson\r\n *\r\n */\r\npublic class SynapsePlaceTest {\r\n\t\r\n\tSy",
"end": 280,
"score": 0.9994014501571655,
"start": 270,
"tag": "USERNAME",
"value": "jayhodgson"
},
{
"context": "Before\r\n\tpublic void setup(){\r\n\t\ttestAreaToken = \"42\";\r\n\t\ttestEntityId = \"syn1234\";\r\n\t\ttestVersionNumb",
"end": 502,
"score": 0.7988726496696472,
"start": 500,
"tag": "KEY",
"value": "42"
},
{
"context": "estDiscussionVersionCase() {\r\n\t\tString testToken = testEntityId + Synapse.VERSION_DELIMITER + testVersion",
"end": 2544,
"score": 0.49078506231307983,
"start": 2540,
"tag": "USERNAME",
"value": "test"
},
{
"context": "scussionVersionCase() {\r\n\t\tString testToken = testEntityId + Synapse.VERSION_DELIMITER + testVersionNumber +",
"end": 2552,
"score": 0.6496429443359375,
"start": 2544,
"tag": "PASSWORD",
"value": "EntityId"
},
{
"context": "void testWikiVersionCase() {\r\n\t\tString testToken = testEntityId + Synapse.VERSION_DELIMITER + testVersionNumber +",
"end": 3080,
"score": 0.5970607995986938,
"start": 3068,
"tag": "USERNAME",
"value": "testEntityId"
},
{
"context": "ublic void testFilesCase() {\r\n\t\tString testToken = testEntityId + Synapse.FILES_DELIMITER;\r\n\t\tSynapse pl",
"end": 3615,
"score": 0.6945903301239014,
"start": 3611,
"tag": "USERNAME",
"value": "test"
},
{
"context": " void testFilesCase() {\r\n\t\tString testToken = testEntityId + Synapse.FILES_DELIMITER;\r\n\t\tSynapse place = to",
"end": 3623,
"score": 0.35960233211517334,
"start": 3615,
"tag": "PASSWORD",
"value": "EntityId"
}
] | null |
[] |
package org.sagebionetworks.web.unitclient.place;
import static org.junit.Assert.*;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.sagebionetworks.web.client.place.Synapse;
/**
* Synapse Place token testing
* @author jayhodgson
*
*/
public class SynapsePlaceTest {
Synapse.Tokenizer tokenizer = new Synapse.Tokenizer();
String testEntityId, testAreaToken;
Long testVersionNumber;
@Before
public void setup(){
testAreaToken = "42";
testEntityId = "syn1234";
testVersionNumber = 9l;
}
@Test
public void testEntityOnlyCase() {
String testToken = testEntityId;
Synapse place = tokenizer.getPlace(testToken);
Assert.assertEquals(testEntityId, place.getEntityId());
Assert.assertNull(place.getVersionNumber());
Assert.assertNull(place.getAreaToken());
Assert.assertNull(place.getArea());
Assert.assertEquals(testToken, tokenizer.getToken(place));
}
@Test
public void testEntityVersionCase() {
String testToken = testEntityId + Synapse.VERSION_DELIMITER + testVersionNumber;
Synapse place = tokenizer.getPlace(testToken);
Assert.assertEquals(testEntityId, place.getEntityId());
Assert.assertEquals(testVersionNumber, place.getVersionNumber());
Assert.assertNull(place.getAreaToken());
Assert.assertNull(place.getArea());
Assert.assertEquals(testToken, tokenizer.getToken(place));
}
@Test
public void testFilesVersionCase() {
String testToken = testEntityId + Synapse.VERSION_DELIMITER + testVersionNumber + Synapse.FILES_DELIMITER;
Synapse place = tokenizer.getPlace(testToken);
Assert.assertEquals(testEntityId, place.getEntityId());
Assert.assertEquals(testVersionNumber, place.getVersionNumber());
Assert.assertEquals(Synapse.EntityArea.FILES, place.getArea());
Assert.assertNull(place.getAreaToken());
Assert.assertEquals(testToken, tokenizer.getToken(place));
}
@Test
public void testAdminVersionCase() {
String testToken = testEntityId + Synapse.VERSION_DELIMITER + testVersionNumber + Synapse.ADMIN_DELIMITER;
Synapse place = tokenizer.getPlace(testToken);
Assert.assertEquals(testEntityId, place.getEntityId());
Assert.assertEquals(testVersionNumber, place.getVersionNumber());
Assert.assertEquals(Synapse.EntityArea.ADMIN, place.getArea());
Assert.assertNull(place.getAreaToken());
Assert.assertEquals(testToken, tokenizer.getToken(place));
}
@Test
public void testDiscussionVersionCase() {
String testToken = test<PASSWORD> + Synapse.VERSION_DELIMITER + testVersionNumber + Synapse.DISCUSSION_DELIMITER;
Synapse place = tokenizer.getPlace(testToken);
Assert.assertEquals(testEntityId, place.getEntityId());
Assert.assertEquals(testVersionNumber, place.getVersionNumber());
Assert.assertEquals(Synapse.EntityArea.DISCUSSION, place.getArea());
Assert.assertNull(place.getAreaToken());
Assert.assertEquals(testToken, tokenizer.getToken(place));
}
@Test
public void testWikiVersionCase() {
String testToken = testEntityId + Synapse.VERSION_DELIMITER + testVersionNumber + Synapse.WIKI_DELIMITER + testAreaToken;
Synapse place = tokenizer.getPlace(testToken);
Assert.assertEquals(testEntityId, place.getEntityId());
Assert.assertEquals(testVersionNumber, place.getVersionNumber());
Assert.assertEquals(Synapse.EntityArea.WIKI, place.getArea());
Assert.assertEquals(testAreaToken, place.getAreaToken());
Assert.assertEquals(testToken, tokenizer.getToken(place));
}
@Test
public void testFilesCase() {
String testToken = test<PASSWORD> + Synapse.FILES_DELIMITER;
Synapse place = tokenizer.getPlace(testToken);
Assert.assertEquals(testEntityId, place.getEntityId());
Assert.assertNull(place.getVersionNumber());
Assert.assertEquals(Synapse.EntityArea.FILES, place.getArea());
Assert.assertNull(place.getAreaToken());
Assert.assertEquals(testToken, tokenizer.getToken(place));
}
@Test
public void testAdminCase() {
String testToken = testEntityId + Synapse.ADMIN_DELIMITER;
Synapse place = tokenizer.getPlace(testToken);
Assert.assertEquals(testEntityId, place.getEntityId());
Assert.assertNull(place.getVersionNumber());
Assert.assertEquals(Synapse.EntityArea.ADMIN, place.getArea());
Assert.assertNull(place.getAreaToken());
Assert.assertEquals(testToken, tokenizer.getToken(place));
}
@Test
public void testDiscussionCase() {
String testToken = testEntityId + Synapse.DISCUSSION_DELIMITER;
Synapse place = tokenizer.getPlace(testToken);
Assert.assertEquals(testEntityId, place.getEntityId());
Assert.assertNull(place.getVersionNumber());
Assert.assertEquals(Synapse.EntityArea.DISCUSSION, place.getArea());
Assert.assertNull(place.getAreaToken());
Assert.assertEquals(testToken, tokenizer.getToken(place));
}
@Test
public void testWikiCase() {
String testToken = testEntityId + Synapse.WIKI_DELIMITER + testAreaToken;
Synapse place = tokenizer.getPlace(testToken);
Assert.assertEquals(testEntityId, place.getEntityId());
Assert.assertNull(place.getVersionNumber());
Assert.assertEquals(Synapse.EntityArea.WIKI, place.getArea());
Assert.assertEquals(testAreaToken, place.getAreaToken());
Assert.assertEquals(testToken, tokenizer.getToken(place));
}
@Test
public void testGetHrefForDotVersionNull(){
assertEquals(null, Synapse.getHrefForDotVersion(null));
}
@Test
public void testGetTokenForDotVersionEmpty(){
assertEquals(null, Synapse.getHrefForDotVersion(""));
}
@Test
public void testGetTokenForDotVersionNoVersion(){
assertEquals("#!Synapse:syn123", Synapse.getHrefForDotVersion("SYN123"));
}
@Test
public void testGetTokenForDotVersionWithVersion(){
assertEquals("#!Synapse:syn123/version/3", Synapse.getHrefForDotVersion("syn123.3"));
}
}
| 5,914 | 0.750254 | 0.746701 | 166 | 33.602409 | 28.142469 | 123 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.174699 | false | false |
3
|
c01d5333e560786f8ed1ed05c224fad24ff7a669
| 24,635,932,460,431 |
eab6ef11673c45e40fb7c935b16dc29599612d7a
|
/Task3/Student.java
|
d2e9e484c6bdfd0cb7eb55ec2346a99b21ca284f
|
[] |
no_license
|
1kvin/JavaLabs
|
https://github.com/1kvin/JavaLabs
|
9fd80023113fc09ebd48d68666c1680c1157e47b
|
aa6b9cfc70ec8e0d6a10c521e86375053587cb09
|
refs/heads/master
| 2022-11-18T11:29:14.367000 | 2020-07-09T17:19:00 | 2020-07-09T17:19:00 | 278,424,646 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.company;
public class Student {
private int labsCount;
private String subjectName;
public Student(int labsCount, String subjectName) throws IllegalArgumentException{
if (labsCount == 10 || labsCount == 20 || labsCount == 100) {
this.labsCount = labsCount;
} else {
throw new IllegalArgumentException("count can be 10 or 20 or 100");
}
if (!subjectName.equals("")) {
this.subjectName = subjectName;
} else {
throw new IllegalArgumentException("Empty subject field");
}
}
public int getCount() {
return labsCount;
}
public void acceptWork(int quantity) {
labsCount -= quantity;
if (labsCount <= 0) {
System.out.println("ПАЦАНЫ я сдал!!!");
} else {
System.out.println("Фух, осталось " + labsCount + " лаб по " + subjectName);
}
}
public boolean countCheck() {
return labsCount > 0;
}
public String getSubject() {
return subjectName;
}
}
|
UTF-8
|
Java
| 1,105 |
java
|
Student.java
|
Java
|
[] | null |
[] |
package com.company;
public class Student {
private int labsCount;
private String subjectName;
public Student(int labsCount, String subjectName) throws IllegalArgumentException{
if (labsCount == 10 || labsCount == 20 || labsCount == 100) {
this.labsCount = labsCount;
} else {
throw new IllegalArgumentException("count can be 10 or 20 or 100");
}
if (!subjectName.equals("")) {
this.subjectName = subjectName;
} else {
throw new IllegalArgumentException("Empty subject field");
}
}
public int getCount() {
return labsCount;
}
public void acceptWork(int quantity) {
labsCount -= quantity;
if (labsCount <= 0) {
System.out.println("ПАЦАНЫ я сдал!!!");
} else {
System.out.println("Фух, осталось " + labsCount + " лаб по " + subjectName);
}
}
public boolean countCheck() {
return labsCount > 0;
}
public String getSubject() {
return subjectName;
}
}
| 1,105 | 0.571429 | 0.556586 | 41 | 25.292683 | 24.409359 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.463415 | false | false |
3
|
ccb9469ab44bd3563d1f6bd242503f18fd9a4a52
| 7,078,106,150,743 |
f8c2aba6ff2495cb2ee6d2affbae092e2a4aaeb9
|
/src/entity/Chapter.java
|
27121449ed71eeace260786a2c6ecb26b4c762ca
|
[] |
no_license
|
linhdanit1512/BookStore
|
https://github.com/linhdanit1512/BookStore
|
a437dc2b97f6a79ae985298e84034f24cd8c0117
|
f221cae433d3159e05df1a1ff5790fd56a121502
|
refs/heads/master
| 2021-09-12T07:03:00.070000 | 2018-04-15T07:07:27 | 2018-04-15T07:07:27 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package entity;
// Generated May 22, 2017 7:24:23 PM by Hibernate Tools 5.2.3.Final
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
/**
* Chapter generated by hbm2java
*/
public class Chapter implements java.io.Serializable {
private static final long serialVersionUID = -1650943527020983949L;
private Integer chapterId;
private Book book;
private Integer orders;
private String chapterName;
private String slug;
private Date postDate;
private Boolean isRead;
private Integer likes;
private Set<ChapterContent> chapterContents = new HashSet<ChapterContent>(0);
private Set<Exchanges> exchangeses = new HashSet<Exchanges>(0);
public Chapter() {
}
public Chapter(Date postDate) {
this.postDate = postDate;
}
public Chapter(Integer chapterId, Book book, Integer orders, String chapterName, String slug, Date postDate,
Boolean isRead, Integer likes, Set<ChapterContent> chapterContents, Set<Exchanges> exchangeses) {
super();
this.chapterId = chapterId;
this.book = book;
this.orders = orders;
this.chapterName = chapterName;
this.slug = slug;
this.postDate = postDate;
this.isRead = isRead;
this.likes = likes;
this.chapterContents = chapterContents;
this.exchangeses = exchangeses;
}
public Chapter(Book book, Integer orders, String chapterName, String slug, Date postDate, Boolean isRead,
Integer likes, Set<ChapterContent> chapterContents, Set<Exchanges> exchangeses) {
super();
this.book = book;
this.orders = orders;
this.chapterName = chapterName;
this.slug = slug;
this.postDate = postDate;
this.isRead = isRead;
this.likes = likes;
this.chapterContents = chapterContents;
this.exchangeses = exchangeses;
}
public Integer getChapterId() {
return chapterId;
}
public void setChapterId(Integer chapterId) {
this.chapterId = chapterId;
}
public Book getBook() {
return book;
}
public void setBook(Book book) {
this.book = book;
}
public Integer getOrders() {
return orders;
}
public void setOrders(Integer orders) {
this.orders = orders;
}
public String getChapterName() {
return chapterName;
}
public void setChapterName(String chapterName) {
this.chapterName = chapterName;
}
public String getSlug() {
return slug;
}
public void setSlug(String slug) {
this.slug = slug;
}
public Date getPostDate() {
return postDate;
}
public void setPostDate(Date postDate) {
this.postDate = postDate;
}
public Boolean getIsRead() {
return isRead;
}
public void setIsRead(Boolean isRead) {
this.isRead = isRead;
}
public Integer getLikes() {
return likes;
}
public void setLikes(Integer likes) {
this.likes = likes;
}
public Set<ChapterContent> getChapterContents() {
return chapterContents;
}
public void setChapterContents(Set<ChapterContent> chapterContents) {
this.chapterContents = chapterContents;
}
public Set<Exchanges> getExchangeses() {
return exchangeses;
}
public void setExchangeses(Set<Exchanges> exchangeses) {
this.exchangeses = exchangeses;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("Chapter [chapterId=");
builder.append(chapterId);
builder.append(", book=");
builder.append(book);
builder.append(", orders=");
builder.append(orders);
builder.append(", chapterName=");
builder.append(chapterName);
builder.append(", slug=");
builder.append(slug);
builder.append(", postDate=");
builder.append(postDate);
builder.append(", isRead=");
builder.append(isRead);
builder.append(", likes=");
builder.append(likes);
builder.append(", chapterContents=");
builder.append(chapterContents);
builder.append("]");
return builder.toString();
}
}
|
UTF-8
|
Java
| 3,742 |
java
|
Chapter.java
|
Java
|
[] | null |
[] |
package entity;
// Generated May 22, 2017 7:24:23 PM by Hibernate Tools 5.2.3.Final
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
/**
* Chapter generated by hbm2java
*/
public class Chapter implements java.io.Serializable {
private static final long serialVersionUID = -1650943527020983949L;
private Integer chapterId;
private Book book;
private Integer orders;
private String chapterName;
private String slug;
private Date postDate;
private Boolean isRead;
private Integer likes;
private Set<ChapterContent> chapterContents = new HashSet<ChapterContent>(0);
private Set<Exchanges> exchangeses = new HashSet<Exchanges>(0);
public Chapter() {
}
public Chapter(Date postDate) {
this.postDate = postDate;
}
public Chapter(Integer chapterId, Book book, Integer orders, String chapterName, String slug, Date postDate,
Boolean isRead, Integer likes, Set<ChapterContent> chapterContents, Set<Exchanges> exchangeses) {
super();
this.chapterId = chapterId;
this.book = book;
this.orders = orders;
this.chapterName = chapterName;
this.slug = slug;
this.postDate = postDate;
this.isRead = isRead;
this.likes = likes;
this.chapterContents = chapterContents;
this.exchangeses = exchangeses;
}
public Chapter(Book book, Integer orders, String chapterName, String slug, Date postDate, Boolean isRead,
Integer likes, Set<ChapterContent> chapterContents, Set<Exchanges> exchangeses) {
super();
this.book = book;
this.orders = orders;
this.chapterName = chapterName;
this.slug = slug;
this.postDate = postDate;
this.isRead = isRead;
this.likes = likes;
this.chapterContents = chapterContents;
this.exchangeses = exchangeses;
}
public Integer getChapterId() {
return chapterId;
}
public void setChapterId(Integer chapterId) {
this.chapterId = chapterId;
}
public Book getBook() {
return book;
}
public void setBook(Book book) {
this.book = book;
}
public Integer getOrders() {
return orders;
}
public void setOrders(Integer orders) {
this.orders = orders;
}
public String getChapterName() {
return chapterName;
}
public void setChapterName(String chapterName) {
this.chapterName = chapterName;
}
public String getSlug() {
return slug;
}
public void setSlug(String slug) {
this.slug = slug;
}
public Date getPostDate() {
return postDate;
}
public void setPostDate(Date postDate) {
this.postDate = postDate;
}
public Boolean getIsRead() {
return isRead;
}
public void setIsRead(Boolean isRead) {
this.isRead = isRead;
}
public Integer getLikes() {
return likes;
}
public void setLikes(Integer likes) {
this.likes = likes;
}
public Set<ChapterContent> getChapterContents() {
return chapterContents;
}
public void setChapterContents(Set<ChapterContent> chapterContents) {
this.chapterContents = chapterContents;
}
public Set<Exchanges> getExchangeses() {
return exchangeses;
}
public void setExchangeses(Set<Exchanges> exchangeses) {
this.exchangeses = exchangeses;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("Chapter [chapterId=");
builder.append(chapterId);
builder.append(", book=");
builder.append(book);
builder.append(", orders=");
builder.append(orders);
builder.append(", chapterName=");
builder.append(chapterName);
builder.append(", slug=");
builder.append(slug);
builder.append(", postDate=");
builder.append(postDate);
builder.append(", isRead=");
builder.append(isRead);
builder.append(", likes=");
builder.append(likes);
builder.append(", chapterContents=");
builder.append(chapterContents);
builder.append("]");
return builder.toString();
}
}
| 3,742 | 0.723143 | 0.713522 | 167 | 21.407187 | 20.962515 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.784431 | false | false |
3
|
8900c27bef33918526f28af990fcc914f682fe6a
| 609,885,415,491 |
59ab07901739cbde155efc88dc812718cb75be3a
|
/lib-jctrl/src/main/java/com/atea/ictrl/io/CommandWriter.java
|
ef8055b73a439fac277d2337bb30d92f77ea1425
|
[
"Apache-2.0"
] |
permissive
|
jctrl-project/lib-jctrl
|
https://github.com/jctrl-project/lib-jctrl
|
f5791a7b278bfcde9d7a3221d7c4cf47d04ee33d
|
33784bbcb21d70520648be9567fbcd4fc8dc48e3
|
refs/heads/master
| 2023-04-29T14:08:04.657000 | 2021-11-18T13:01:48 | 2021-11-18T13:01:48 | 188,405,521 | 0 | 0 |
Apache-2.0
| false | 2023-04-14T17:23:50 | 2019-05-24T10:49:34 | 2021-11-18T13:01:52 | 2023-04-14T17:23:49 | 69 | 0 | 0 | 2 |
Java
| false | false |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.atea.ictrl.io;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStream;
import java.util.concurrent.LinkedBlockingQueue;
/**
*
* @author Martin
*/
public abstract class CommandWriter extends Thread implements Runnable {
public OutputStream rawTx;
public BufferedWriter tx;
private LinkedBlockingQueue<Command> txQueue =
new LinkedBlockingQueue<Command>(); // Commandqueue
public long txTime = 0; // When latest tx occured
private long sleepTime; // Time between flushing commands
public String deviceName = "";
public boolean runThread;
public boolean debugMode = false;
public boolean rawMode; // Use raw I/O-streams.
public boolean writeError; // Write-thread has been terminated
public CommandWriter(OutputStream rawTx, BufferedWriter tx) {
this.rawTx = rawTx;
this.tx = tx;
this.setName("CommandWriter");
setRunThread(true);
}
public class Command { // Defines command structure
private byte[] command;
private Integer executionTime;
public Command(byte[] command, int executionTime) {
this.command = command;
this.executionTime = executionTime;
}
public byte[] getCommand() {
return command;
}
public int getExecutionTime() {
return executionTime;
}
}
private void sendCommand(Command command) {
txTime = System.currentTimeMillis();
try {
txQueue.put(command);
} catch (InterruptedException e) {
// IOexception something has failed during writing to the buffer
}
}
private Command popNextCommand() {
try {
return (Command) txQueue.take();
} catch (InterruptedException e) {
return null;
//throw new RuntimeException(e);
}
}
public int getTxQueueSize() {
if(txQueue != null) {
return txQueue.size();
} else {
return 0;
}
}
public void clearTxQueue() {
txQueue.clear();
}
public void sendCommand(byte[] command, int executionTime) {
Command cmd = new Command(command, executionTime);
sendCommand(cmd);
}
public void sendHexCommand(String hexString, int executionTime) {
Command cmd = new Command(HexStringToByteArray(hexString),
executionTime);
sendCommand(cmd);
}
public void sendCommand(String command, int executionTime) {
Command cmd = new Command(command.getBytes(), executionTime);
sendCommand(cmd);
}
public void sendCommandNow(String command) {
txTime = System.currentTimeMillis();
try {
tx.write(command);
tx.flush();
debugMessage("TX: " + command);
} catch (Exception ex) {}
}
public void sendCommandNow(byte[] command) {
txTime = System.currentTimeMillis();
try {
rawTx.write(command);
rawTx.flush();
if(debugMode) {
System.out.print(deviceName + " TX: ");
for(int i=0;i<command.length;i++) {
System.out.print(Integer.toString((
command[i] & 0xff ) +
0x100, 16).substring(1).
toUpperCase() + " ");
}
System.out.print("\n");
}
} catch (Exception ex) {}
}
// Stop I/O-threads
public void close() {
setRunThread(false);
try {
//To unlock the write thread
tx.write("");
}
catch (IOException e) {}
catch (Exception e) {}
}
private void setRunThread(boolean runThread) {
this.runThread = runThread;
}
public void debugMessage(String message) {
if(debugMode)
System.out.println(deviceName + "> " + message);
}
public void setDebugMode(boolean modeOn) {
debugMode = modeOn;
}
public void setDeviceName(String name) {
this.deviceName = name;
}
public void setRawMode(boolean on) {
rawMode = on;
}
public abstract void writeException(Exception e);
public static byte[] HexStringToByteArray(String hexString) {
hexString = hexString.replaceAll(" ", "");
byte data[] = new byte[hexString.length()/2];
for(int i=0;i < hexString.length();i+=2) {
data[i/2] = (Integer.decode("0x"+hexString.charAt(i) +
hexString.charAt(i+1))).byteValue();
}
return data;
}
@Override
public void run() {
while (runThread) {
try {
Command cmd = popNextCommand();
sleepTime = cmd.getExecutionTime();
if(rawMode) { // Raw byte-by-byte write
if(debugMode) {
System.out.print(deviceName + " TX: ");
for(int i=0;i<cmd.getCommand().length;i++) {
System.out.print(Integer.toString((
cmd.getCommand()[i] & 0xff ) +
0x100, 16).substring(1).
toUpperCase() + " ");
}
System.out.print("\n");
}
rawTx.write(cmd.getCommand());
txTime = System.currentTimeMillis();
rawTx.flush();
} else { // Regular line write
debugMessage("TX: " + new String(
cmd.getCommand()));
tx.write(new String(cmd.getCommand()));
txTime = System.currentTimeMillis();
tx.flush();
}
} catch (IOException e) {
writeError = true;
debugMessage("Skrivfel: " + e);
close();
writeException(e);
break;
} catch (NullPointerException e) {
writeError = true;
debugMessage("Skrivfel: " + e);
close();
writeException(e);
break;
}
try {
Thread.sleep(sleepTime);
} catch(Exception e) {
writeError = true;
close();
writeException(e);
break;
}
}
}
}
|
UTF-8
|
Java
| 6,701 |
java
|
CommandWriter.java
|
Java
|
[
{
"context": "concurrent.LinkedBlockingQueue;\n\n/**\n *\n * @author Martin\n */\npublic abstract class CommandWriter extends T",
"end": 291,
"score": 0.9975088238716125,
"start": 285,
"tag": "NAME",
"value": "Martin"
}
] | null |
[] |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.atea.ictrl.io;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStream;
import java.util.concurrent.LinkedBlockingQueue;
/**
*
* @author Martin
*/
public abstract class CommandWriter extends Thread implements Runnable {
public OutputStream rawTx;
public BufferedWriter tx;
private LinkedBlockingQueue<Command> txQueue =
new LinkedBlockingQueue<Command>(); // Commandqueue
public long txTime = 0; // When latest tx occured
private long sleepTime; // Time between flushing commands
public String deviceName = "";
public boolean runThread;
public boolean debugMode = false;
public boolean rawMode; // Use raw I/O-streams.
public boolean writeError; // Write-thread has been terminated
public CommandWriter(OutputStream rawTx, BufferedWriter tx) {
this.rawTx = rawTx;
this.tx = tx;
this.setName("CommandWriter");
setRunThread(true);
}
public class Command { // Defines command structure
private byte[] command;
private Integer executionTime;
public Command(byte[] command, int executionTime) {
this.command = command;
this.executionTime = executionTime;
}
public byte[] getCommand() {
return command;
}
public int getExecutionTime() {
return executionTime;
}
}
private void sendCommand(Command command) {
txTime = System.currentTimeMillis();
try {
txQueue.put(command);
} catch (InterruptedException e) {
// IOexception something has failed during writing to the buffer
}
}
private Command popNextCommand() {
try {
return (Command) txQueue.take();
} catch (InterruptedException e) {
return null;
//throw new RuntimeException(e);
}
}
public int getTxQueueSize() {
if(txQueue != null) {
return txQueue.size();
} else {
return 0;
}
}
public void clearTxQueue() {
txQueue.clear();
}
public void sendCommand(byte[] command, int executionTime) {
Command cmd = new Command(command, executionTime);
sendCommand(cmd);
}
public void sendHexCommand(String hexString, int executionTime) {
Command cmd = new Command(HexStringToByteArray(hexString),
executionTime);
sendCommand(cmd);
}
public void sendCommand(String command, int executionTime) {
Command cmd = new Command(command.getBytes(), executionTime);
sendCommand(cmd);
}
public void sendCommandNow(String command) {
txTime = System.currentTimeMillis();
try {
tx.write(command);
tx.flush();
debugMessage("TX: " + command);
} catch (Exception ex) {}
}
public void sendCommandNow(byte[] command) {
txTime = System.currentTimeMillis();
try {
rawTx.write(command);
rawTx.flush();
if(debugMode) {
System.out.print(deviceName + " TX: ");
for(int i=0;i<command.length;i++) {
System.out.print(Integer.toString((
command[i] & 0xff ) +
0x100, 16).substring(1).
toUpperCase() + " ");
}
System.out.print("\n");
}
} catch (Exception ex) {}
}
// Stop I/O-threads
public void close() {
setRunThread(false);
try {
//To unlock the write thread
tx.write("");
}
catch (IOException e) {}
catch (Exception e) {}
}
private void setRunThread(boolean runThread) {
this.runThread = runThread;
}
public void debugMessage(String message) {
if(debugMode)
System.out.println(deviceName + "> " + message);
}
public void setDebugMode(boolean modeOn) {
debugMode = modeOn;
}
public void setDeviceName(String name) {
this.deviceName = name;
}
public void setRawMode(boolean on) {
rawMode = on;
}
public abstract void writeException(Exception e);
public static byte[] HexStringToByteArray(String hexString) {
hexString = hexString.replaceAll(" ", "");
byte data[] = new byte[hexString.length()/2];
for(int i=0;i < hexString.length();i+=2) {
data[i/2] = (Integer.decode("0x"+hexString.charAt(i) +
hexString.charAt(i+1))).byteValue();
}
return data;
}
@Override
public void run() {
while (runThread) {
try {
Command cmd = popNextCommand();
sleepTime = cmd.getExecutionTime();
if(rawMode) { // Raw byte-by-byte write
if(debugMode) {
System.out.print(deviceName + " TX: ");
for(int i=0;i<cmd.getCommand().length;i++) {
System.out.print(Integer.toString((
cmd.getCommand()[i] & 0xff ) +
0x100, 16).substring(1).
toUpperCase() + " ");
}
System.out.print("\n");
}
rawTx.write(cmd.getCommand());
txTime = System.currentTimeMillis();
rawTx.flush();
} else { // Regular line write
debugMessage("TX: " + new String(
cmd.getCommand()));
tx.write(new String(cmd.getCommand()));
txTime = System.currentTimeMillis();
tx.flush();
}
} catch (IOException e) {
writeError = true;
debugMessage("Skrivfel: " + e);
close();
writeException(e);
break;
} catch (NullPointerException e) {
writeError = true;
debugMessage("Skrivfel: " + e);
close();
writeException(e);
break;
}
try {
Thread.sleep(sleepTime);
} catch(Exception e) {
writeError = true;
close();
writeException(e);
break;
}
}
}
}
| 6,701 | 0.514998 | 0.511118 | 202 | 32.173267 | 19.341248 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.529703 | false | false |
3
|
817000c885cb49e8304bba4aaae4f4ed033406c7
| 26,577,257,697,668 |
cac76e0b9292863a363cef398d23bd87fd3ab3da
|
/checkers-core/src/test/java/fr/dude/isen/CheckersApplicationTest.java
|
0c9438a7b99e2a6825c273271a2ba3d7f0bd90f7
|
[] |
no_license
|
pierredfc/checkers-jee
|
https://github.com/pierredfc/checkers-jee
|
2547071bf1c0ca8777f8586cf3f0ca700eec2824
|
6fdbf6a92e51a9838927e7c15810c0809a2dc3b7
|
refs/heads/master
| 2021-01-12T01:45:08.781000 | 2017-02-12T14:41:12 | 2017-02-12T14:41:12 | 78,427,394 | 0 | 0 | null | false | 2017-01-31T16:21:26 | 2017-01-09T12:37:29 | 2017-01-09T13:07:07 | 2017-01-31T16:21:26 | 163 | 0 | 0 | 0 |
Java
| null | null |
package fr.dude.isen;
import com.google.inject.Guice;
import com.google.inject.Injector;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.junit.Before;
import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
/**
* Created by Clement on 09/01/2017.
*/
public class CheckersApplicationTest {
private CheckersGame game;
@Before
public void doBefore() {
Injector injector = Guice.createInjector(new CheckersModule());
game = injector.getInstance(CheckersGameImpl.class);
game.init();
}
@Test
public void gameIsCheckersGameImpl() throws Exception {
assertEquals(CheckersGameImpl.class, game.getClass()); // assertThat(CheckersGameImpl.class).isEqualTo(game.getClass());
}
@Test
public void gameHasCorrectProperties() throws Exception {
assertEquals(10, (int)game.getNbColumns());
assertEquals(10, (int)game.getNbRows());
}
}
|
UTF-8
|
Java
| 1,019 |
java
|
CheckersApplicationTest.java
|
Java
|
[
{
"context": "org.junit.Assert.assertEquals;\n\n\n/**\n * Created by Clement on 09/01/2017.\n */\npublic class CheckersApplicati",
"end": 337,
"score": 0.7739365100860596,
"start": 330,
"tag": "NAME",
"value": "Clement"
}
] | null |
[] |
package fr.dude.isen;
import com.google.inject.Guice;
import com.google.inject.Injector;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.junit.Before;
import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
/**
* Created by Clement on 09/01/2017.
*/
public class CheckersApplicationTest {
private CheckersGame game;
@Before
public void doBefore() {
Injector injector = Guice.createInjector(new CheckersModule());
game = injector.getInstance(CheckersGameImpl.class);
game.init();
}
@Test
public void gameIsCheckersGameImpl() throws Exception {
assertEquals(CheckersGameImpl.class, game.getClass()); // assertThat(CheckersGameImpl.class).isEqualTo(game.getClass());
}
@Test
public void gameHasCorrectProperties() throws Exception {
assertEquals(10, (int)game.getNbColumns());
assertEquals(10, (int)game.getNbRows());
}
}
| 1,019 | 0.714426 | 0.700687 | 39 | 25.128204 | 27.12571 | 128 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.512821 | false | false |
3
|
42fa6eb36698b4487253f8185fe7d3e953c25e61
| 24,068,996,765,729 |
f30590c45e647823d920f6d5761f920533251b6d
|
/hadoop/mapreduce-api/src/main/java/com/mapreduce/writablesort/FlowRed.java
|
03010026ae52be77ce2715a690ba05ecd64eb229
|
[] |
no_license
|
hengyufxh1/hadoop
|
https://github.com/hengyufxh1/hadoop
|
e8bf49185777350bf0b239d33b9fb8c311274c44
|
7439c514531937282606ffa937a41fc0a218c592
|
refs/heads/master
| 2022-07-08T23:29:47.908000 | 2020-10-30T09:52:14 | 2020-10-30T09:52:14 | 193,515,306 | 0 | 0 | null | false | 2022-06-17T02:28:49 | 2019-06-24T13:53:12 | 2020-10-30T09:52:18 | 2022-06-17T02:28:47 | 1,200 | 0 | 0 | 14 |
Java
| false | false |
package com.mapreduce.writablesort;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;
import java.io.IOException;
/**
* $功能描述: FlowRed
*
* @author :smart-dxw
* @version : 2019/6/14 22:35 v1.0
*/
public class FlowRed extends Reducer<FlowBean, Text, Text, FlowBean> {
@Override
protected void reduce(FlowBean flowBean, Iterable<Text> values, Context context) throws IOException, InterruptedException {
for (Text text : values){
// 输出
context.write(text, flowBean);
}
}
}
|
UTF-8
|
Java
| 576 |
java
|
FlowRed.java
|
Java
|
[
{
"context": "OException;\n\n/**\n * $功能描述: FlowRed\n *\n * @author :smart-dxw\n * @version : 2019/6/14 22:35 v1.0\n */\npublic cla",
"end": 191,
"score": 0.9996917247772217,
"start": 182,
"tag": "USERNAME",
"value": "smart-dxw"
}
] | null |
[] |
package com.mapreduce.writablesort;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;
import java.io.IOException;
/**
* $功能描述: FlowRed
*
* @author :smart-dxw
* @version : 2019/6/14 22:35 v1.0
*/
public class FlowRed extends Reducer<FlowBean, Text, Text, FlowBean> {
@Override
protected void reduce(FlowBean flowBean, Iterable<Text> values, Context context) throws IOException, InterruptedException {
for (Text text : values){
// 输出
context.write(text, flowBean);
}
}
}
| 576 | 0.672043 | 0.648746 | 23 | 23.26087 | 28.591908 | 127 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.521739 | false | false |
3
|
8654861b0530b98e8b12dbed879e7976bff99d39
| 15,083,925,187,333 |
785946833e3627821948f1560746b7bd731176c1
|
/SQLite/app/src/main/java/feliperodalves/com/sqlite/Adaptador.java
|
6d2a49c403eb739e0d8751e4e8abbf5173854e11
|
[] |
no_license
|
feliperodalves/cursoAndroid
|
https://github.com/feliperodalves/cursoAndroid
|
d7f02e7fa8d844891ef8b9f6b58772009f9c8027
|
d2dc7d332bae37d842e7cf8c5c5df1bc6c0befef
|
refs/heads/master
| 2020-04-05T22:03:53.557000 | 2016-06-18T16:21:59 | 2016-06-18T16:21:59 | 56,281,222 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package feliperodalves.com.sqlite;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
public class Adaptador extends RecyclerView.Adapter<PessoasViewHolder> {
private PessoasDAO acesso;
private Context c;
private ArrayList<Pessoas> pessoas;
public Adaptador(Context c, ArrayList<Pessoas> pessoas) {
this.c = c;
this.pessoas = pessoas;
}
@Override
public PessoasViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(c).inflate(R.layout.item, parent, false);
PessoasViewHolder vh = new PessoasViewHolder(c, v);
return vh;
}
@Override
public void onBindViewHolder(PessoasViewHolder holder, int position) {
final Pessoas pessoa = pessoas.get(position);
holder.tv_nomeSobrenome.setText(pessoa.getNome() + " " + pessoa.getSobrenome());
holder.tv_nomeSobrenome.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
acesso = new PessoasDAO(c);
acesso.open();
acesso.delete(pessoa);
pessoas.clear();
pessoas.addAll(acesso.selectAll());
notifyDataSetChanged();
acesso.close();
}
});
}
@Override
public int getItemCount() {
return pessoas.size();
}
}
|
UTF-8
|
Java
| 1,555 |
java
|
Adaptador.java
|
Java
|
[] | null |
[] |
package feliperodalves.com.sqlite;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
public class Adaptador extends RecyclerView.Adapter<PessoasViewHolder> {
private PessoasDAO acesso;
private Context c;
private ArrayList<Pessoas> pessoas;
public Adaptador(Context c, ArrayList<Pessoas> pessoas) {
this.c = c;
this.pessoas = pessoas;
}
@Override
public PessoasViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(c).inflate(R.layout.item, parent, false);
PessoasViewHolder vh = new PessoasViewHolder(c, v);
return vh;
}
@Override
public void onBindViewHolder(PessoasViewHolder holder, int position) {
final Pessoas pessoa = pessoas.get(position);
holder.tv_nomeSobrenome.setText(pessoa.getNome() + " " + pessoa.getSobrenome());
holder.tv_nomeSobrenome.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
acesso = new PessoasDAO(c);
acesso.open();
acesso.delete(pessoa);
pessoas.clear();
pessoas.addAll(acesso.selectAll());
notifyDataSetChanged();
acesso.close();
}
});
}
@Override
public int getItemCount() {
return pessoas.size();
}
}
| 1,555 | 0.639871 | 0.639228 | 52 | 28.903847 | 24.535109 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.615385 | false | false |
3
|
2712a4eed595754e3427c49f1cc99716a3666d55
| 32,822,140,123,228 |
6cf34dff5a4c7adcf33e456e23ca072ec1ff21ef
|
/src/main/java/com/company/mapper/OrdersMapper.java
|
65fe94f76b192803a089bbb3dd9ba077f5cfa387
|
[] |
no_license
|
GuoFa-Liu/Common-CRUD
|
https://github.com/GuoFa-Liu/Common-CRUD
|
a33a0f55b1f5aa270630f8c60e3f1444089fd5a2
|
d9ae19b1ed3eb5e76c0e0ebdcec90e11bd88c0bf
|
refs/heads/master
| 2022-07-06T02:04:44.682000 | 2022-07-01T06:48:48 | 2022-07-01T06:48:48 | 157,666,495 | 0 | 1 | null | false | 2022-07-01T06:48:49 | 2018-11-15T06:58:41 | 2018-12-05T16:28:01 | 2022-07-01T06:48:48 | 50 | 1 | 0 | 0 |
Java
| false | false |
package com.company.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.company.model.Orders;
/**
* @author guofa.liu
* @create 2018/11/15 15:23
* @description
*/
public interface OrdersMapper extends BaseMapper<Orders> {
}
|
UTF-8
|
Java
| 253 |
java
|
OrdersMapper.java
|
Java
|
[
{
"context": ";\nimport com.company.model.Orders;\n\n/**\n * @author guofa.liu\n * @create 2018/11/15 15:23\n * @description\n ",
"end": 139,
"score": 0.7891056537628174,
"start": 134,
"tag": "NAME",
"value": "guofa"
},
{
"context": "rt com.company.model.Orders;\n\n/**\n * @author guofa.liu\n * @create 2018/11/15 15:23\n * @description\n *",
"end": 139,
"score": 0.6426149606704712,
"start": 139,
"tag": "USERNAME",
"value": ""
},
{
"context": "t com.company.model.Orders;\n\n/**\n * @author guofa.liu\n * @create 2018/11/15 15:23\n * @description\n */\np",
"end": 143,
"score": 0.6348049640655518,
"start": 140,
"tag": "NAME",
"value": "liu"
}
] | null |
[] |
package com.company.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.company.model.Orders;
/**
* @author guofa.liu
* @create 2018/11/15 15:23
* @description
*/
public interface OrdersMapper extends BaseMapper<Orders> {
}
| 253 | 0.754941 | 0.70751 | 12 | 20.083334 | 19.73769 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false |
3
|
a72d0d8faf66c3c5f84f1e4e46565a3d6d3f0b83
| 25,409,026,569,249 |
2509e417d567fb45a830cbcc2f672934576676eb
|
/src/test/java/com/epam/ta/pages/menu/CreateMenu.java
|
5c02aa58647ef947dea44df453f2ec4ee27bb8c7
|
[] |
no_license
|
KarneyenkaDzmitry/Github_test
|
https://github.com/KarneyenkaDzmitry/Github_test
|
e8fdd55c32e7bb30f0ed7ca29a3eb220f789e684
|
eab179f35a4a6b2cb2f7a14d9701cadc79e70bea
|
refs/heads/master
| 2020-03-25T00:02:55.098000 | 2018-08-01T14:25:01 | 2018-08-01T14:25:01 | 143,166,572 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.epam.ta.pages.menu;
import com.epam.ta.pages.AbstractPage;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.CacheLookup;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
public class CreateMenu extends AbstractPage implements MenuBars {
private final String BASE_URL = "https://github.com/";
@FindBy(xpath = "//summary[contains(@aria-label, 'Create new…')]")
@CacheLookup
private WebElement buttonCreateNew;
@FindBy(xpath = "//a[contains(text(), 'New repository')]")
@CacheLookup
private WebElement linkNewRepository;
@Override
public void openPage() {
driver.get(BASE_URL);
}
public CreateMenu(WebDriver driver) {
super(driver);
PageFactory.initElements(driver, this);
}
public void chooseNewRepository () {
buttonCreateNew.click();
linkNewRepository.click();
}
}
|
UTF-8
|
Java
| 988 |
java
|
CreateMenu.java
|
Java
|
[] | null |
[] |
package com.epam.ta.pages.menu;
import com.epam.ta.pages.AbstractPage;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.CacheLookup;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
public class CreateMenu extends AbstractPage implements MenuBars {
private final String BASE_URL = "https://github.com/";
@FindBy(xpath = "//summary[contains(@aria-label, 'Create new…')]")
@CacheLookup
private WebElement buttonCreateNew;
@FindBy(xpath = "//a[contains(text(), 'New repository')]")
@CacheLookup
private WebElement linkNewRepository;
@Override
public void openPage() {
driver.get(BASE_URL);
}
public CreateMenu(WebDriver driver) {
super(driver);
PageFactory.initElements(driver, this);
}
public void chooseNewRepository () {
buttonCreateNew.click();
linkNewRepository.click();
}
}
| 988 | 0.703854 | 0.703854 | 36 | 26.388889 | 21.429831 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
3
|
02f8d9998b9cbe9bf17333431adfde4e6cf2a434
| 3,599,182,646,074 |
7cb1a1da9fc2969e88180b432d9d73c1b1a30b2a
|
/app/src/main/java/custom_class/DirectMessage.java
|
19bb8bd83a58bcab15709823999f0803dc636b08
|
[] |
no_license
|
dbondi/Jabber
|
https://github.com/dbondi/Jabber
|
a216478ce8fa100e3b31de7c29b133f23c8ffd5f
|
133385ad12e5bbe5626138ef500cb86376cc78fc
|
refs/heads/master
| 2022-11-06T17:46:19.526000 | 2020-07-04T18:21:24 | 2020-07-04T18:21:24 | 263,539,107 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package custom_class;
import com.google.firebase.Timestamp;
import com.google.firebase.storage.StorageReference;
public class DirectMessage {
String content;
String photo;
String gifURL;
Boolean boolContent;
Boolean boolPhoto;
Boolean boolGifURL;
String sender;
Timestamp timestamp;
public DirectMessage(String content, String photo, String gifURL, Boolean boolContent, Boolean boolPhoto, Boolean boolGifURL, String sender, Timestamp timestamp) {
this.content = content;
this.photo = photo;
this.gifURL = gifURL;
this.boolContent = boolContent;
this.boolPhoto = boolPhoto;
this.boolGifURL = boolGifURL;
this.sender = sender;
this.timestamp = timestamp;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getPhoto() {
return photo;
}
public void setPhoto(String photo) {
this.photo = photo;
}
public String getGifURL() {
return gifURL;
}
public void setGifURL(String gifURL) {
this.gifURL = gifURL;
}
public Boolean getBoolContent() {
return boolContent;
}
public void setBoolContent(Boolean boolContent) {
this.boolContent = boolContent;
}
public Boolean getBoolPhoto() {
return boolPhoto;
}
public void setBoolPhoto(Boolean boolPhoto) {
this.boolPhoto = boolPhoto;
}
public Boolean getBoolGifURL() {
return boolGifURL;
}
public void setBoolGifURL(Boolean boolGifURL) {
this.boolGifURL = boolGifURL;
}
public String getSender() {
return sender;
}
public void setSender(String sender) {
this.sender = sender;
}
public Timestamp getTimestamp() {
return timestamp;
}
public void setTimestamp(Timestamp timestamp) {
this.timestamp = timestamp;
}
}
|
UTF-8
|
Java
| 2,002 |
java
|
DirectMessage.java
|
Java
|
[] | null |
[] |
package custom_class;
import com.google.firebase.Timestamp;
import com.google.firebase.storage.StorageReference;
public class DirectMessage {
String content;
String photo;
String gifURL;
Boolean boolContent;
Boolean boolPhoto;
Boolean boolGifURL;
String sender;
Timestamp timestamp;
public DirectMessage(String content, String photo, String gifURL, Boolean boolContent, Boolean boolPhoto, Boolean boolGifURL, String sender, Timestamp timestamp) {
this.content = content;
this.photo = photo;
this.gifURL = gifURL;
this.boolContent = boolContent;
this.boolPhoto = boolPhoto;
this.boolGifURL = boolGifURL;
this.sender = sender;
this.timestamp = timestamp;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getPhoto() {
return photo;
}
public void setPhoto(String photo) {
this.photo = photo;
}
public String getGifURL() {
return gifURL;
}
public void setGifURL(String gifURL) {
this.gifURL = gifURL;
}
public Boolean getBoolContent() {
return boolContent;
}
public void setBoolContent(Boolean boolContent) {
this.boolContent = boolContent;
}
public Boolean getBoolPhoto() {
return boolPhoto;
}
public void setBoolPhoto(Boolean boolPhoto) {
this.boolPhoto = boolPhoto;
}
public Boolean getBoolGifURL() {
return boolGifURL;
}
public void setBoolGifURL(Boolean boolGifURL) {
this.boolGifURL = boolGifURL;
}
public String getSender() {
return sender;
}
public void setSender(String sender) {
this.sender = sender;
}
public Timestamp getTimestamp() {
return timestamp;
}
public void setTimestamp(Timestamp timestamp) {
this.timestamp = timestamp;
}
}
| 2,002 | 0.635864 | 0.635864 | 90 | 21.244444 | 22.374247 | 167 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.466667 | false | false |
3
|
a4d25e452cc2f1cce0b90c5679439ff498115efe
| 4,922,032,582,735 |
084b587332dabc83ce894a69adf51e0d17bf37c5
|
/weimeng-lbd-soa-provder-server/src/main/java/com/weimob/arch/demo/facade/ArchDemoFacadeService.java
|
6ca15ba1ecc89208a0c3605557bc4ae76f489bff
|
[] |
no_license
|
maderjlbd/weimeng-lbd-soa-provder-parent
|
https://github.com/maderjlbd/weimeng-lbd-soa-provder-parent
|
2873eb95a3ba31d5699247df006653ec5488a30b
|
4f2ad67f2b8f05c94af3de076426314c744266c0
|
refs/heads/master
| 2021-01-24T08:08:30.611000 | 2017-06-05T07:49:57 | 2017-06-05T07:49:57 | 93,377,688 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.weimob.arch.demo.facade;
import java.util.Arrays;
import java.util.List;
import com.weimob.arch.demo.exception.DemoBizException;
import com.weimob.arch.demo.exception.DemoErrorCode;
import com.weimob.arch.demo.model.Partner;
import com.weimob.arch.demo.model.request.FindArchPartnerBySexRequestVo;
import com.weimob.arch.demo.model.response.FindArchPartnerBySexResponseVo;
import com.weimob.arch.demo.model.response.PartnerBaseInfoVo;
import com.weimob.arch.demo.service.base.PartnerBaseService;
import com.weimob.arch.demo.utils.DemoUtil;
public class ArchDemoFacadeService {
private PartnerBaseService partnerBaseService;
public void setPartnerBaseService(PartnerBaseService partnerBaseService) {
this.partnerBaseService = partnerBaseService;
}
/**
* 根据性别查询架构部小伙伴
*
* @author nengfei.liu
* @param requestVo
* @return
*/
public FindArchPartnerBySexResponseVo findArchPartnerBySex(FindArchPartnerBySexRequestVo requestVo){
//参数校验
validateFindArchPartnerBySexRequestVo(requestVo);
//查询架构部小伙伴
List<Partner> partnerList = partnerBaseService.findPartnerListBySex(requestVo.getSex());
//构造出参并返回
FindArchPartnerBySexResponseVo responseVo = new FindArchPartnerBySexResponseVo();
responseVo.setPartnerList(DemoUtil.copyList(partnerList, PartnerBaseInfoVo.class));
return responseVo;
}
private void validateFindArchPartnerBySexRequestVo(FindArchPartnerBySexRequestVo requestVo) {
if(requestVo == null){
throw new DemoBizException(DemoErrorCode.REQUEST_PARAM_IS_NULL);
}
if(requestVo.getSex()!=null && Arrays.binarySearch(new int[]{1,2}, requestVo.getSex()) < 0){
throw new DemoBizException(DemoErrorCode.REQUEST_SEX_IS_NULL_OR_1_2);
}
}
}
|
UTF-8
|
Java
| 1,774 |
java
|
ArchDemoFacadeService.java
|
Java
|
[
{
"context": "ervice;\n\t}\n\n\t/**\n\t * 根据性别查询架构部小伙伴\n\t * \n\t * @author nengfei.liu\n\t * @param requestVo\n\t * @return\n\t */\n\tpublic Fin",
"end": 821,
"score": 0.9983476996421814,
"start": 810,
"tag": "NAME",
"value": "nengfei.liu"
}
] | null |
[] |
package com.weimob.arch.demo.facade;
import java.util.Arrays;
import java.util.List;
import com.weimob.arch.demo.exception.DemoBizException;
import com.weimob.arch.demo.exception.DemoErrorCode;
import com.weimob.arch.demo.model.Partner;
import com.weimob.arch.demo.model.request.FindArchPartnerBySexRequestVo;
import com.weimob.arch.demo.model.response.FindArchPartnerBySexResponseVo;
import com.weimob.arch.demo.model.response.PartnerBaseInfoVo;
import com.weimob.arch.demo.service.base.PartnerBaseService;
import com.weimob.arch.demo.utils.DemoUtil;
public class ArchDemoFacadeService {
private PartnerBaseService partnerBaseService;
public void setPartnerBaseService(PartnerBaseService partnerBaseService) {
this.partnerBaseService = partnerBaseService;
}
/**
* 根据性别查询架构部小伙伴
*
* @author nengfei.liu
* @param requestVo
* @return
*/
public FindArchPartnerBySexResponseVo findArchPartnerBySex(FindArchPartnerBySexRequestVo requestVo){
//参数校验
validateFindArchPartnerBySexRequestVo(requestVo);
//查询架构部小伙伴
List<Partner> partnerList = partnerBaseService.findPartnerListBySex(requestVo.getSex());
//构造出参并返回
FindArchPartnerBySexResponseVo responseVo = new FindArchPartnerBySexResponseVo();
responseVo.setPartnerList(DemoUtil.copyList(partnerList, PartnerBaseInfoVo.class));
return responseVo;
}
private void validateFindArchPartnerBySexRequestVo(FindArchPartnerBySexRequestVo requestVo) {
if(requestVo == null){
throw new DemoBizException(DemoErrorCode.REQUEST_PARAM_IS_NULL);
}
if(requestVo.getSex()!=null && Arrays.binarySearch(new int[]{1,2}, requestVo.getSex()) < 0){
throw new DemoBizException(DemoErrorCode.REQUEST_SEX_IS_NULL_OR_1_2);
}
}
}
| 1,774 | 0.79965 | 0.796729 | 52 | 31.923077 | 31.952396 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.461538 | false | false |
3
|
187a17e55d28cdb3e96b6bdc7a95a85f0413db2f
| 2,130,303,823,131 |
1c5e8605c1a4821bc2a759da670add762d0a94a2
|
/src/dahua/fdc/contract/ContractExecInfosInfo.java
|
61bf9cb32c097b447b4075e6d4381c5684df882b
|
[] |
no_license
|
shxr/NJG
|
https://github.com/shxr/NJG
|
8195cfebfbda1e000c30081399c5fbafc61bb7be
|
1b60a4a7458da48991de4c2d04407c26ccf2f277
|
refs/heads/master
| 2020-12-24T06:51:18.392000 | 2016-04-25T03:09:27 | 2016-04-25T03:09:27 | 19,804,797 | 0 | 3 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.kingdee.eas.fdc.contract;
import java.io.Serializable;
public class ContractExecInfosInfo extends AbstractContractExecInfosInfo implements Serializable
{
public ContractExecInfosInfo()
{
super();
}
protected ContractExecInfosInfo(String pkField)
{
super(pkField);
}
/**
* 更新单据时参数type的四个状态 : audit审批、unAudit反审批、pay付款、unPay反付款
*/
//审批
public static final String EXECINFO_AUDIT = "audit";
//反审批
public static final String EXECINFO_UNAUDIT = "unAudit";
//付款
public static final String EXECINFO_PAY = "pay";
//反付款
public static final String EXECINFO_UNPAY = "unPay";
}
|
GB18030
|
Java
| 703 |
java
|
ContractExecInfosInfo.java
|
Java
|
[] | null |
[] |
package com.kingdee.eas.fdc.contract;
import java.io.Serializable;
public class ContractExecInfosInfo extends AbstractContractExecInfosInfo implements Serializable
{
public ContractExecInfosInfo()
{
super();
}
protected ContractExecInfosInfo(String pkField)
{
super(pkField);
}
/**
* 更新单据时参数type的四个状态 : audit审批、unAudit反审批、pay付款、unPay反付款
*/
//审批
public static final String EXECINFO_AUDIT = "audit";
//反审批
public static final String EXECINFO_UNAUDIT = "unAudit";
//付款
public static final String EXECINFO_PAY = "pay";
//反付款
public static final String EXECINFO_UNPAY = "unPay";
}
| 703 | 0.71406 | 0.71406 | 27 | 22.481482 | 25.179901 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.740741 | false | false |
3
|
66b4e6fae2e81896574cc9941dcbca60b635c93f
| 10,024,453,670,754 |
81e50f20e4a178a1978a1536393305db9d51ea53
|
/SmallestRectangleEnclosingBlackPixels.java
|
148cfa4633fc8c937ffcd299d044e7f5e42b9bb9
|
[] |
no_license
|
sunjq0407/leetcode-java
|
https://github.com/sunjq0407/leetcode-java
|
db5d41901e3c9f8255000d8face1e9665138a977
|
9515b5b283fa1a7bb8a4531ccd118bcd1057db68
|
refs/heads/master
| 2020-04-11T12:36:51.699000 | 2017-10-05T21:17:34 | 2017-10-05T21:17:34 | 42,544,734 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class Solution {
public int minArea(char[][] image, int x, int y) {
int left = searchCol(image, 0, y, true);
int right = searchCol(image, y + 1, image[0].length, false);
int top = searchRow(image, 0, x, true);
int bot = searchRow(image, x + 1, image.length, false);
return (right - left) * (bot - top);
}
private int searchCol(char[][] image, int l, int r, boolean small) {
while(l < r) {
int mid = (l + r) / 2;
int i = 0;
for(; i < image.length; i++)
if(image[i][mid] == '1') break;
if(small) {
if(i < image.length) r = mid;
else l = mid + 1;
} else {
if(i < image.length) l = mid + 1;
else r = mid;
}
}
return l;
}
private int searchRow(char[][] image, int l, int r, boolean small) {
while(l < r) {
int mid = (l + r) / 2;
int i = 0;
for(; i < image[0].length; i++)
if(image[mid][i] == '1') break;
if(small) {
if(i < image[0].length) r = mid;
else l = mid + 1;
} else {
if(i < image[0].length) l = mid + 1;
else r = mid;
}
}
return l;
}
}
|
UTF-8
|
Java
| 1,372 |
java
|
SmallestRectangleEnclosingBlackPixels.java
|
Java
|
[] | null |
[] |
public class Solution {
public int minArea(char[][] image, int x, int y) {
int left = searchCol(image, 0, y, true);
int right = searchCol(image, y + 1, image[0].length, false);
int top = searchRow(image, 0, x, true);
int bot = searchRow(image, x + 1, image.length, false);
return (right - left) * (bot - top);
}
private int searchCol(char[][] image, int l, int r, boolean small) {
while(l < r) {
int mid = (l + r) / 2;
int i = 0;
for(; i < image.length; i++)
if(image[i][mid] == '1') break;
if(small) {
if(i < image.length) r = mid;
else l = mid + 1;
} else {
if(i < image.length) l = mid + 1;
else r = mid;
}
}
return l;
}
private int searchRow(char[][] image, int l, int r, boolean small) {
while(l < r) {
int mid = (l + r) / 2;
int i = 0;
for(; i < image[0].length; i++)
if(image[mid][i] == '1') break;
if(small) {
if(i < image[0].length) r = mid;
else l = mid + 1;
} else {
if(i < image[0].length) l = mid + 1;
else r = mid;
}
}
return l;
}
}
| 1,372 | 0.405248 | 0.392128 | 43 | 30.930233 | 19.392393 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.046512 | false | false |
3
|
7eeadcf6e5ec86f9f0945c944a88b371ece752ba
| 22,849,226,038,776 |
632c6dd9e527333af623c8df6f0b5bb7972d6565
|
/Entite.java
|
82716024af94f11efadcd877840a18fe8742a325
|
[] |
no_license
|
TheRealSamsam/PVZ
|
https://github.com/TheRealSamsam/PVZ
|
132c9366a7f7c38f13f48e17d309002d456b73e8
|
50f9cd242a348b182eee03ad9c6fff4f81450c42
|
refs/heads/master
| 2020-04-09T17:51:17.513000 | 2018-12-05T21:16:37 | 2018-12-05T21:16:37 | 160,493,525 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public abstract class Entite {
protected Position position;
public Entite(Position p) {
position=p;
}
public Entite(double x, double y) {
position = new Position(x, y);
}
public double getPX() {
return position.getPX();
}
public double getPY() {
return this.position.getPY();
}
public void setPosition(Position p){
this.position = p;
}
public abstract void step();
public abstract void dessine();
}
|
UTF-8
|
Java
| 483 |
java
|
Entite.java
|
Java
|
[] | null |
[] |
public abstract class Entite {
protected Position position;
public Entite(Position p) {
position=p;
}
public Entite(double x, double y) {
position = new Position(x, y);
}
public double getPX() {
return position.getPX();
}
public double getPY() {
return this.position.getPY();
}
public void setPosition(Position p){
this.position = p;
}
public abstract void step();
public abstract void dessine();
}
| 483 | 0.606625 | 0.606625 | 34 | 12.147058 | 13.775794 | 37 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.294118 | false | false |
3
|
be049e06e1c9bc753036a29023f14c0d42cb9d5c
| 33,131,377,783,370 |
c6f0fa8c18b1d32cc685040df95ad8f28ee5da6a
|
/src/main/java/com/gsw/wechat/util/RemoteUtils.java
|
b3355bd0526d327940bb3fe19faedf1c6690d91f
|
[] |
no_license
|
zmj2734/wechat
|
https://github.com/zmj2734/wechat
|
838faf35b347544734c36c0141f9f871f784f430
|
71451d590a7ab3aa2d0e2a7b4dca8004e4339c72
|
refs/heads/master
| 2021-08-26T09:47:24.963000 | 2017-11-23T07:33:01 | 2017-11-23T07:33:01 | 111,775,525 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.gsw.wechat.util;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.codec.binary.Base64;
import org.apache.http.HttpEntity;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.entity.mime.content.StringBody;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import com.soecode.wxtools.util.RandomUtils;
public class RemoteUtils {
/**
* 上传文件
*
* @return
*/
public static String upload(File file) throws Exception {
String respStr = null;
CloseableHttpClient httpclient = HttpClients.createDefault();
try {
HttpPost httppost = new HttpPost(Constants.REMOTE_URL);
MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create();
String fileName = RandomUtils.getRandomStr(16);
String timestamp = String.valueOf(new Date().getTime());
String app_type = "weixin";
String interface_version = "2.0";
String operate_type = "10013";
multipartEntityBuilder.addPart("IMAGE", new StringBody(fileToBase64(file), ContentType.TEXT_PLAIN));
multipartEntityBuilder.addPart("OPERATE_TYPE", new StringBody(operate_type, ContentType.TEXT_PLAIN));
multipartEntityBuilder.addPart("NAME", new StringBody(fileName, ContentType.TEXT_PLAIN));
multipartEntityBuilder.addPart("app_type", new StringBody(app_type, ContentType.TEXT_PLAIN));
multipartEntityBuilder.addPart("timestamp", new StringBody(timestamp, ContentType.TEXT_PLAIN));
multipartEntityBuilder.addPart("interface_version",
new StringBody(interface_version, ContentType.TEXT_PLAIN));
multipartEntityBuilder.addPart("sign", new StringBody(
AESUtils.encrypt(interface_version + app_type + timestamp + operate_type), ContentType.TEXT_PLAIN));
HttpEntity reqEntity = multipartEntityBuilder.build();
httppost.setEntity(reqEntity);
CloseableHttpResponse response = httpclient.execute(httppost);
try {
HttpEntity resEntity = response.getEntity();
respStr = getRespString(resEntity);
EntityUtils.consume(resEntity);
} finally {
response.close();
}
} finally {
httpclient.close();
}
return respStr;
}
/**
* Post 请求到指定服务器
* 不通用
* @param params
* @return
*/
public static String post(Map<String, Object> params) throws Exception {
String respStr = null;
CloseableHttpClient httpclient = HttpClients.createDefault();
try {
HttpPost httppost = new HttpPost(Constants.REMOTE_URL);
MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create();
setUploadParams(multipartEntityBuilder, params);
HttpEntity reqEntity = multipartEntityBuilder.build();
httppost.setEntity(reqEntity);
CloseableHttpResponse response = httpclient.execute(httppost);
try {
HttpEntity resEntity = response.getEntity();
respStr = getRespString(resEntity);
EntityUtils.consume(resEntity);
} finally {
response.close();
}
} finally {
httpclient.close();
}
return respStr;
}
/**
* 通用
* @param url
* @param params
* @return
* @throws Exception
*/
public static String post(String url, Map<String, String> params) throws Exception {
String respStr = null;
CloseableHttpClient httpclient = HttpClients.createDefault();
try {
HttpPost httppost = new HttpPost(url);
MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create();
HttpEntity reqEntity = multipartEntityBuilder.build();
httppost.setEntity(reqEntity);
CloseableHttpResponse response = httpclient.execute(httppost);
try {
HttpEntity resEntity = response.getEntity();
respStr = getRespString(resEntity);
EntityUtils.consume(resEntity);
} finally {
response.close();
}
} finally {
httpclient.close();
}
return respStr;
}
private static void setUploadParams(MultipartEntityBuilder multipartEntityBuilder, Map<String, Object> params) {
if (params != null && params.size() > 0) {
Set<String> keys = params.keySet();
for (String key : keys) {
multipartEntityBuilder.addPart(key, new StringBody(params.get(key).toString(), ContentType.TEXT_PLAIN));
}
}
}
/**
* 将返回结果转化为String
*
* @param entity
* @return
* @throws Exception
*/
private static String getRespString(HttpEntity entity) throws Exception {
if (entity == null) {
return null;
}
InputStream is = entity.getContent();
StringBuffer strBuf = new StringBuffer();
byte[] buffer = new byte[4096];
int r = 0;
while ((r = is.read(buffer)) > 0) {
strBuf.append(new String(buffer, 0, r, "UTF-8"));
}
return strBuf.toString();
}
public static Map<String, Object> toMap(HttpServletRequest request) {
Map<String, Object> result = new HashMap<>();
Map<String, String[]> reqMap = request.getParameterMap();
if (reqMap == null || reqMap.size() == 0) {
return null;
}
Object[] keys = reqMap.keySet().toArray();
for (int i = 0; i < keys.length; i++) {
result.put(keys[i].toString(), reqMap.get(keys[i].toString())[0]);
}
return result;
}
/**
* file to Base64
* @param file
* @return
* @throws Exception
*/
public static String fileToBase64(File file) throws Exception {
FileInputStream inputFile = new FileInputStream(file);
byte[] buffer = new byte[(int) file.length()];
inputFile.read(buffer);
inputFile.close();
return new String(Base64.encodeBase64(buffer)) ;
}
}
|
UTF-8
|
Java
| 5,967 |
java
|
RemoteUtils.java
|
Java
|
[] | null |
[] |
package com.gsw.wechat.util;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.codec.binary.Base64;
import org.apache.http.HttpEntity;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.entity.mime.content.StringBody;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import com.soecode.wxtools.util.RandomUtils;
public class RemoteUtils {
/**
* 上传文件
*
* @return
*/
public static String upload(File file) throws Exception {
String respStr = null;
CloseableHttpClient httpclient = HttpClients.createDefault();
try {
HttpPost httppost = new HttpPost(Constants.REMOTE_URL);
MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create();
String fileName = RandomUtils.getRandomStr(16);
String timestamp = String.valueOf(new Date().getTime());
String app_type = "weixin";
String interface_version = "2.0";
String operate_type = "10013";
multipartEntityBuilder.addPart("IMAGE", new StringBody(fileToBase64(file), ContentType.TEXT_PLAIN));
multipartEntityBuilder.addPart("OPERATE_TYPE", new StringBody(operate_type, ContentType.TEXT_PLAIN));
multipartEntityBuilder.addPart("NAME", new StringBody(fileName, ContentType.TEXT_PLAIN));
multipartEntityBuilder.addPart("app_type", new StringBody(app_type, ContentType.TEXT_PLAIN));
multipartEntityBuilder.addPart("timestamp", new StringBody(timestamp, ContentType.TEXT_PLAIN));
multipartEntityBuilder.addPart("interface_version",
new StringBody(interface_version, ContentType.TEXT_PLAIN));
multipartEntityBuilder.addPart("sign", new StringBody(
AESUtils.encrypt(interface_version + app_type + timestamp + operate_type), ContentType.TEXT_PLAIN));
HttpEntity reqEntity = multipartEntityBuilder.build();
httppost.setEntity(reqEntity);
CloseableHttpResponse response = httpclient.execute(httppost);
try {
HttpEntity resEntity = response.getEntity();
respStr = getRespString(resEntity);
EntityUtils.consume(resEntity);
} finally {
response.close();
}
} finally {
httpclient.close();
}
return respStr;
}
/**
* Post 请求到指定服务器
* 不通用
* @param params
* @return
*/
public static String post(Map<String, Object> params) throws Exception {
String respStr = null;
CloseableHttpClient httpclient = HttpClients.createDefault();
try {
HttpPost httppost = new HttpPost(Constants.REMOTE_URL);
MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create();
setUploadParams(multipartEntityBuilder, params);
HttpEntity reqEntity = multipartEntityBuilder.build();
httppost.setEntity(reqEntity);
CloseableHttpResponse response = httpclient.execute(httppost);
try {
HttpEntity resEntity = response.getEntity();
respStr = getRespString(resEntity);
EntityUtils.consume(resEntity);
} finally {
response.close();
}
} finally {
httpclient.close();
}
return respStr;
}
/**
* 通用
* @param url
* @param params
* @return
* @throws Exception
*/
public static String post(String url, Map<String, String> params) throws Exception {
String respStr = null;
CloseableHttpClient httpclient = HttpClients.createDefault();
try {
HttpPost httppost = new HttpPost(url);
MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create();
HttpEntity reqEntity = multipartEntityBuilder.build();
httppost.setEntity(reqEntity);
CloseableHttpResponse response = httpclient.execute(httppost);
try {
HttpEntity resEntity = response.getEntity();
respStr = getRespString(resEntity);
EntityUtils.consume(resEntity);
} finally {
response.close();
}
} finally {
httpclient.close();
}
return respStr;
}
private static void setUploadParams(MultipartEntityBuilder multipartEntityBuilder, Map<String, Object> params) {
if (params != null && params.size() > 0) {
Set<String> keys = params.keySet();
for (String key : keys) {
multipartEntityBuilder.addPart(key, new StringBody(params.get(key).toString(), ContentType.TEXT_PLAIN));
}
}
}
/**
* 将返回结果转化为String
*
* @param entity
* @return
* @throws Exception
*/
private static String getRespString(HttpEntity entity) throws Exception {
if (entity == null) {
return null;
}
InputStream is = entity.getContent();
StringBuffer strBuf = new StringBuffer();
byte[] buffer = new byte[4096];
int r = 0;
while ((r = is.read(buffer)) > 0) {
strBuf.append(new String(buffer, 0, r, "UTF-8"));
}
return strBuf.toString();
}
public static Map<String, Object> toMap(HttpServletRequest request) {
Map<String, Object> result = new HashMap<>();
Map<String, String[]> reqMap = request.getParameterMap();
if (reqMap == null || reqMap.size() == 0) {
return null;
}
Object[] keys = reqMap.keySet().toArray();
for (int i = 0; i < keys.length; i++) {
result.put(keys[i].toString(), reqMap.get(keys[i].toString())[0]);
}
return result;
}
/**
* file to Base64
* @param file
* @return
* @throws Exception
*/
public static String fileToBase64(File file) throws Exception {
FileInputStream inputFile = new FileInputStream(file);
byte[] buffer = new byte[(int) file.length()];
inputFile.read(buffer);
inputFile.close();
return new String(Base64.encodeBase64(buffer)) ;
}
}
| 5,967 | 0.727227 | 0.721649 | 187 | 30.64171 | 26.773659 | 113 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.470588 | false | false |
3
|
0347b68627b2d3578b43bcee93c8d98b7349a452
| 22,127,671,546,739 |
bd48bf9d985cdb9b8b103c9cbf9e7e3e69c776ad
|
/app/src/main/java/com/strmeasy/adapter/LanguageListAdapter.java
|
f779a774e55eb0ebaccdb0a3dbedad9d3ebfdc27
|
[] |
no_license
|
NikitaTouchFone/StrmEasy
|
https://github.com/NikitaTouchFone/StrmEasy
|
168f979c0e27e566e0b32d158cb542db53e4c632
|
77f38b04ddc2ca57331abe2f2f3de7967a0b9e06
|
refs/heads/master
| 2020-12-25T14:13:33.376000 | 2016-08-22T12:32:11 | 2016-08-22T12:32:11 | 66,265,752 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.strmeasy.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.strmeasy.R;
import java.util.ArrayList;
/**
* Created by nikita on 13/7/16.
*/
public class LanguageListAdapter extends BaseAdapter {
Context mcontext;
ArrayList<String> languageArray;
LayoutInflater inflater;
public LanguageListAdapter(Context context, ArrayList<String> langArray)
{
this.mcontext = context;
this.languageArray = langArray;
inflater = (LayoutInflater.from(mcontext));
}
@Override
public int getCount() {
return languageArray.size();
}
@Override
public Object getItem(int i) {
return languageArray.get(i);
}
@Override
public long getItemId(int i) {
return 0;
}
@Override
public View getView(int i, View convertView, ViewGroup viewGroup) {
ViewHolder viewHolder;
if(convertView==null){
convertView = inflater.inflate(R.layout.lang_item, null);
viewHolder = new ViewHolder();
viewHolder.langName = (TextView) convertView.findViewById(R.id.langname);
convertView.setTag(viewHolder);
}else{
viewHolder = (ViewHolder) convertView.getTag();
}
viewHolder.langName.setText(String.valueOf(languageArray.get(i).toString()));
return convertView;
}
static class ViewHolder {
public TextView langName;
public ImageView langLogo;
}
}
|
UTF-8
|
Java
| 1,670 |
java
|
LanguageListAdapter.java
|
Java
|
[
{
"context": "R;\n\nimport java.util.ArrayList;\n\n/**\n * Created by nikita on 13/7/16.\n */\npublic class LanguageListAdapter ",
"end": 334,
"score": 0.999477207660675,
"start": 328,
"tag": "USERNAME",
"value": "nikita"
}
] | null |
[] |
package com.strmeasy.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.strmeasy.R;
import java.util.ArrayList;
/**
* Created by nikita on 13/7/16.
*/
public class LanguageListAdapter extends BaseAdapter {
Context mcontext;
ArrayList<String> languageArray;
LayoutInflater inflater;
public LanguageListAdapter(Context context, ArrayList<String> langArray)
{
this.mcontext = context;
this.languageArray = langArray;
inflater = (LayoutInflater.from(mcontext));
}
@Override
public int getCount() {
return languageArray.size();
}
@Override
public Object getItem(int i) {
return languageArray.get(i);
}
@Override
public long getItemId(int i) {
return 0;
}
@Override
public View getView(int i, View convertView, ViewGroup viewGroup) {
ViewHolder viewHolder;
if(convertView==null){
convertView = inflater.inflate(R.layout.lang_item, null);
viewHolder = new ViewHolder();
viewHolder.langName = (TextView) convertView.findViewById(R.id.langname);
convertView.setTag(viewHolder);
}else{
viewHolder = (ViewHolder) convertView.getTag();
}
viewHolder.langName.setText(String.valueOf(languageArray.get(i).toString()));
return convertView;
}
static class ViewHolder {
public TextView langName;
public ImageView langLogo;
}
}
| 1,670 | 0.667066 | 0.663473 | 67 | 23.925373 | 21.842936 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.492537 | false | false |
3
|
bf51aaea1f21a5a858235ce8aedba420aecae66e
| 34,900,904,259,219 |
b2d5628c05b8a364a6e1580b8ed1bbd6af8788e9
|
/src/test/java/io/github/xhanin/jarup/commands/AddCommandTest.java
|
70317698061c82cfd41d163a79070c4b4ba850b1
|
[
"Apache-2.0"
] |
permissive
|
xhanin/jarup
|
https://github.com/xhanin/jarup
|
1e8d4815ab24eca0babb67f6110130d70c65c487
|
1734b49a70616d6beefd9eb102f6f2c93c3b88f4
|
refs/heads/master
| 2021-01-19T05:46:59.563000 | 2015-10-21T14:52:40 | 2015-10-21T14:52:40 | 15,772,747 | 3 | 2 |
Apache-2.0
| false | 2021-07-06T12:54:48 | 2014-01-09T16:50:55 | 2020-09-03T15:22:20 | 2020-08-27T19:04:52 | 486 | 12 | 2 | 0 |
Java
| false | false |
package io.github.xhanin.jarup.commands;
import io.github.xhanin.jarup.WorkingCopyRule;
import org.junit.Rule;
import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Date: 10/1/14
* Time: 17:23
*/
public class AddCommandTest {
@Rule
public WorkingCopyRule wc = WorkingCopyRule.with("example.jar");
@Test
public void should_replace() throws Exception {
new AddCommand().baseOn(wc.getWorkingCopy())
.from("src/test/resources/example.xml").to("example1.xml")
.execute();
assertThat(wc.getWorkingCopy().readFile("example1.xml", "UTF-8"))
.isEqualTo("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<myxml>\n" +
" <tag>val</tag>\n" +
"</myxml>");
}
@Test
public void should_add() throws Exception {
new AddCommand().baseOn(wc.getWorkingCopy())
.from("src/test/resources/example.xml").to("example-new.xml")
.execute();
assertThat(wc.getWorkingCopy().readFile("example-new.xml", "UTF-8"))
.isEqualTo("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<myxml>\n" +
" <tag>val</tag>\n" +
"</myxml>");
}
@Test
public void should_add_in_new_directory() throws Exception {
new AddCommand().baseOn(wc.getWorkingCopy())
.from("src/test/resources/example.xml").to("new/example-new.xml")
.execute();
assertThat(wc.getWorkingCopy().readFile("new/example-new.xml", "UTF-8"))
.isEqualTo("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<myxml>\n" +
" <tag>val</tag>\n" +
"</myxml>");
}
@Test
public void should_parse_params() throws Exception {
new AddCommand().baseOn(wc.getWorkingCopy())
.parse(new String[] {"--from=src/test/resources/example.xml", "--to=example1.xml"})
.execute();
assertThat(wc.getWorkingCopy().readFile("example1.xml", "UTF-8"))
.isEqualTo("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<myxml>\n" +
" <tag>val</tag>\n" +
"</myxml>");
}
}
|
UTF-8
|
Java
| 2,405 |
java
|
AddCommandTest.java
|
Java
|
[
{
"context": "package io.github.xhanin.jarup.commands;\n\nimport io.github.xhanin.jarup.Wo",
"end": 24,
"score": 0.9991447329521179,
"start": 18,
"tag": "USERNAME",
"value": "xhanin"
},
{
"context": "o.github.xhanin.jarup.commands;\n\nimport io.github.xhanin.jarup.WorkingCopyRule;\nimport org.junit.Rule;\nimp",
"end": 65,
"score": 0.9988724589347839,
"start": 59,
"tag": "USERNAME",
"value": "xhanin"
}
] | null |
[] |
package io.github.xhanin.jarup.commands;
import io.github.xhanin.jarup.WorkingCopyRule;
import org.junit.Rule;
import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Date: 10/1/14
* Time: 17:23
*/
public class AddCommandTest {
@Rule
public WorkingCopyRule wc = WorkingCopyRule.with("example.jar");
@Test
public void should_replace() throws Exception {
new AddCommand().baseOn(wc.getWorkingCopy())
.from("src/test/resources/example.xml").to("example1.xml")
.execute();
assertThat(wc.getWorkingCopy().readFile("example1.xml", "UTF-8"))
.isEqualTo("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<myxml>\n" +
" <tag>val</tag>\n" +
"</myxml>");
}
@Test
public void should_add() throws Exception {
new AddCommand().baseOn(wc.getWorkingCopy())
.from("src/test/resources/example.xml").to("example-new.xml")
.execute();
assertThat(wc.getWorkingCopy().readFile("example-new.xml", "UTF-8"))
.isEqualTo("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<myxml>\n" +
" <tag>val</tag>\n" +
"</myxml>");
}
@Test
public void should_add_in_new_directory() throws Exception {
new AddCommand().baseOn(wc.getWorkingCopy())
.from("src/test/resources/example.xml").to("new/example-new.xml")
.execute();
assertThat(wc.getWorkingCopy().readFile("new/example-new.xml", "UTF-8"))
.isEqualTo("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<myxml>\n" +
" <tag>val</tag>\n" +
"</myxml>");
}
@Test
public void should_parse_params() throws Exception {
new AddCommand().baseOn(wc.getWorkingCopy())
.parse(new String[] {"--from=src/test/resources/example.xml", "--to=example1.xml"})
.execute();
assertThat(wc.getWorkingCopy().readFile("example1.xml", "UTF-8"))
.isEqualTo("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<myxml>\n" +
" <tag>val</tag>\n" +
"</myxml>");
}
}
| 2,405 | 0.506861 | 0.494803 | 68 | 34.367645 | 27.867283 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.279412 | false | false |
3
|
11292dab930e42e32e3bdfcfce4b5b5819150231
| 11,184,094,874,521 |
58caaadb314acdff29c23633741895f1aee462c4
|
/tipi/com.dexels.navajo.tipi.swing/src/com/dexels/navajo/tipi/components/swingimpl/TipiActivityBar.java
|
b60af08116bf7f6d272fefec1fb28baed0c5e1c5
|
[] |
no_license
|
mvdhorst/navajo
|
https://github.com/mvdhorst/navajo
|
5c26314cc5a9a4ecb337d81604e941f9239ea9f2
|
21e1ed205d5995ae7aa3bdc645124885448bf867
|
refs/heads/master
| 2021-01-10T22:28:23.051000 | 2015-02-27T08:48:52 | 2015-02-27T08:48:52 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.dexels.navajo.tipi.components.swingimpl;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;
import com.dexels.navajo.tipi.TipiActivityListener;
/**
* <p>
* Title:
* </p>
* <p>
* Description:
* </p>
* <p>
* Copyright: Copyright (c) 2003
* </p>
* <p>
* Company:
* </p>
*
* @author not attributable
* @version 1.0
*/
public class TipiActivityBar extends TipiLabel implements TipiActivityListener {
/**
*
*/
private static final long serialVersionUID = 2210075056492345394L;
private boolean amIActive = false;
private ImageIcon busyIcon = null;
private ImageIcon freeIcon = null;
public TipiActivityBar() {
}
@Override
public boolean isActive() {
return amIActive;
}
@Override
public void setActive(final boolean state) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
amIActive = state;
// setComponentValue("indeterminate", new Boolean(amIActive));
if (amIActive) {
((JLabel) getSwingContainer()).setIcon(busyIcon);
} else {
((JLabel) getSwingContainer()).setIcon(freeIcon);
}
}
});
}
@Override
public void setComponentValue(String name, Object object) {
super.setComponentValue(name, object);
if (name.equals("freeicon")) {
freeIcon = getIcon(object);
}
if (name.equals("busyicon")) {
busyIcon = getIcon(object);
}
}
@Override
public void setActiveThreads(int i) {
setComponentValue("text", "Active operations: " + i);
}
/**
* createContainer
*
* @return Object
* @todo Implement this
* com.dexels.navajo.tipi.components.core.TipiComponentImpl method
*/
@Override
public Object createContainer() {
Object o = super.createContainer();
myContext.addTipiActivityListener(this);
return o;
}
}
|
UTF-8
|
Java
| 1,810 |
java
|
TipiActivityBar.java
|
Java
|
[] | null |
[] |
package com.dexels.navajo.tipi.components.swingimpl;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;
import com.dexels.navajo.tipi.TipiActivityListener;
/**
* <p>
* Title:
* </p>
* <p>
* Description:
* </p>
* <p>
* Copyright: Copyright (c) 2003
* </p>
* <p>
* Company:
* </p>
*
* @author not attributable
* @version 1.0
*/
public class TipiActivityBar extends TipiLabel implements TipiActivityListener {
/**
*
*/
private static final long serialVersionUID = 2210075056492345394L;
private boolean amIActive = false;
private ImageIcon busyIcon = null;
private ImageIcon freeIcon = null;
public TipiActivityBar() {
}
@Override
public boolean isActive() {
return amIActive;
}
@Override
public void setActive(final boolean state) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
amIActive = state;
// setComponentValue("indeterminate", new Boolean(amIActive));
if (amIActive) {
((JLabel) getSwingContainer()).setIcon(busyIcon);
} else {
((JLabel) getSwingContainer()).setIcon(freeIcon);
}
}
});
}
@Override
public void setComponentValue(String name, Object object) {
super.setComponentValue(name, object);
if (name.equals("freeicon")) {
freeIcon = getIcon(object);
}
if (name.equals("busyicon")) {
busyIcon = getIcon(object);
}
}
@Override
public void setActiveThreads(int i) {
setComponentValue("text", "Active operations: " + i);
}
/**
* createContainer
*
* @return Object
* @todo Implement this
* com.dexels.navajo.tipi.components.core.TipiComponentImpl method
*/
@Override
public Object createContainer() {
Object o = super.createContainer();
myContext.addTipiActivityListener(this);
return o;
}
}
| 1,810 | 0.683425 | 0.669613 | 88 | 19.568182 | 19.830988 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.431818 | false | false |
3
|
823d63ed6ad2bf9d6f6a545a10f2ef25705143a1
| 39,367,670,246,206 |
2cd0d540f30d8da7ea66a121d4536e075d6eb273
|
/src/main/java/br/com/pep/bean/UsuarioBean.java
|
5197f4a495f8b4eb51c8eeb581564641f61d6e26
|
[] |
no_license
|
Glaubenobrega/pp-pep
|
https://github.com/Glaubenobrega/pp-pep
|
549805343a368d4180d644ce229f2c0f429f23b7
|
8bf6ad0cb72a5b3248b1fd916a4d5ca09ff90269
|
refs/heads/master
| 2016-08-06T23:41:06.607000 | 2014-12-11T12:53:57 | 2014-12-11T12:53:57 | 39,857,007 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package br.com.pep.bean;
import java.sql.SQLException;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import br.com.pep.DAO.EnderecoDAO;
import br.com.pep.DAO.UsuarioDAO;
import br.com.pep.model.Endereco;
import br.com.pep.model.Usuario;
import br.com.pep.util.JSFUtil;
/**
* Classse responsavel por fazer a ligação dos arquivos xhtml com as classes
* model
*
* @author Lorranz
*
*/
@ManagedBean(name = "MBUsuario")
@SessionScoped
public class UsuarioBean {
private static final Logger LOGGER = LogManager
.getLogger(UsuarioBean.class);
private static final Logger LOGGER_PADRAO = LogManager.getRootLogger();
private Usuario user = new Usuario();
private Endereco end = new Endereco();
private List<Usuario> usuarios;
private List<Usuario> userFiltrados;
private EnderecoDAO daoEn = new EnderecoDAO();
public Endereco getEnd() {
return end;
}
public void setEnd(Endereco end) {
this.end = end;
}
public Usuario getUser() {
return user;
}
public void setUser(Usuario user) {
this.user = user;
}
public List<Usuario> getUsuarios() {
return usuarios;
}
public void setUsuarios(List<Usuario> usuarios) {
this.usuarios = usuarios;
}
public List<Usuario> getUserFiltrados() {
return userFiltrados;
}
public void setUserFiltrados(List<Usuario> userFiltrados) {
this.userFiltrados = userFiltrados;
}
/**
* Metodo responsavel por carregar todos os usuarios
*/
@PostConstruct
public void prepararPesquisa() {
try {
UsuarioDAO dao = new UsuarioDAO();
usuarios = dao.listar();
LOGGER.info("Usuario Listado com sucesso");
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
JSFUtil.mensagemDeErro(e.getMessage());
}
}
/**
* Metodo responsavel por instanciar um novo usuario
*
* @see Usuario
*/
public void prepararUsuario() {
this.user = new Usuario();
}
/**
* Metodo responsavel por buscar um endereco
*
* @see Endereco
*/
public void prepararEndereco() {
Long id = user.getEndereco().getIdEndereco();
try {
this.end = daoEn.buscaEndereco(id);
LOGGER.info("Endereço achado com sucesso");
} catch (SQLException e) {
LOGGER.error(e.getMessage(), e);
}
}
/**
* Metodo responsavel por Salvar um novo endereco
*
* @see Endereco
*/
public void novoEndereco() {
try {
EnderecoDAO dao = new EnderecoDAO();
dao.salvar(end);
LOGGER.info("Endereço salvo com sucesso");
} catch (SQLException e) {
LOGGER.error(e.getMessage(), e);
}
}
/**
* Metodo responsavel por salvar um novo usuario
*
* @see Usuario
*/
public void novoUsuario() {
try {
UsuarioDAO dao = new UsuarioDAO();
user.setEndereco(end);
dao.salvar(user);
usuarios = dao.listar();
this.user = new Usuario();
LOGGER.info("Usuario salvo com sucesso!");
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
JSFUtil.mensagemDeErro(e.getMessage());
}
}
/**
* Metodo responsavel por excluir um usuario
*
* @see Usuario
*/
public void excluir() {
try {
UsuarioDAO dao = new UsuarioDAO();
dao.excluir(user);
usuarios = dao.listar();
JSFUtil.adicionarMensagemSucesso("Usuario removido com sucesso!");
this.user = new Usuario();
LOGGER.info("Usuario removido com sucesso!");
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
JSFUtil.mensagemDeErro(e.getMessage());
}
}
/**
* mMetodo responsavel por editar um endereco
*
* @see Endereco
*/
public void editarEnd() {
try {
daoEn.atualizar(end);
JSFUtil.adicionarMensagemSucesso("Usuario editado com sucesso");
end = new Endereco();
LOGGER.info("Endereço editado com sucesso!");
} catch (SQLException e) {
LOGGER.error(e.getMessage(), e);
}
}
/**
* Metodo responsavel por editar um Usuario
*
* @see Usuario
*/
public void editar() {
try {
EnderecoDAO endDao = new EnderecoDAO();
UsuarioDAO dao = new UsuarioDAO();
endDao.atualizar(user.getEndereco());
dao.atualizar(user);
usuarios = dao.listar();
JSFUtil.adicionarMensagemSucesso("Usuario editado com sucesso");
this.user = new Usuario();
LOGGER.info("Usuario editado com sucesso!");
} catch (SQLException e) {
LOGGER.error(e.getMessage(), e);
JSFUtil.mensagemDeErro(e.getMessage());
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
}
}
public String home() {
return "principal";
}
}
|
ISO-8859-1
|
Java
| 4,787 |
java
|
UsuarioBean.java
|
Java
|
[
{
"context": "os xhtml com as classes\r\n * model\r\n * \r\n * @author Lorranz\r\n *\r\n */\r\n@ManagedBean(name = \"MBUsuario\")\r\n@Sess",
"end": 584,
"score": 0.992702841758728,
"start": 577,
"tag": "NAME",
"value": "Lorranz"
}
] | null |
[] |
package br.com.pep.bean;
import java.sql.SQLException;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import br.com.pep.DAO.EnderecoDAO;
import br.com.pep.DAO.UsuarioDAO;
import br.com.pep.model.Endereco;
import br.com.pep.model.Usuario;
import br.com.pep.util.JSFUtil;
/**
* Classse responsavel por fazer a ligação dos arquivos xhtml com as classes
* model
*
* @author Lorranz
*
*/
@ManagedBean(name = "MBUsuario")
@SessionScoped
public class UsuarioBean {
private static final Logger LOGGER = LogManager
.getLogger(UsuarioBean.class);
private static final Logger LOGGER_PADRAO = LogManager.getRootLogger();
private Usuario user = new Usuario();
private Endereco end = new Endereco();
private List<Usuario> usuarios;
private List<Usuario> userFiltrados;
private EnderecoDAO daoEn = new EnderecoDAO();
public Endereco getEnd() {
return end;
}
public void setEnd(Endereco end) {
this.end = end;
}
public Usuario getUser() {
return user;
}
public void setUser(Usuario user) {
this.user = user;
}
public List<Usuario> getUsuarios() {
return usuarios;
}
public void setUsuarios(List<Usuario> usuarios) {
this.usuarios = usuarios;
}
public List<Usuario> getUserFiltrados() {
return userFiltrados;
}
public void setUserFiltrados(List<Usuario> userFiltrados) {
this.userFiltrados = userFiltrados;
}
/**
* Metodo responsavel por carregar todos os usuarios
*/
@PostConstruct
public void prepararPesquisa() {
try {
UsuarioDAO dao = new UsuarioDAO();
usuarios = dao.listar();
LOGGER.info("Usuario Listado com sucesso");
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
JSFUtil.mensagemDeErro(e.getMessage());
}
}
/**
* Metodo responsavel por instanciar um novo usuario
*
* @see Usuario
*/
public void prepararUsuario() {
this.user = new Usuario();
}
/**
* Metodo responsavel por buscar um endereco
*
* @see Endereco
*/
public void prepararEndereco() {
Long id = user.getEndereco().getIdEndereco();
try {
this.end = daoEn.buscaEndereco(id);
LOGGER.info("Endereço achado com sucesso");
} catch (SQLException e) {
LOGGER.error(e.getMessage(), e);
}
}
/**
* Metodo responsavel por Salvar um novo endereco
*
* @see Endereco
*/
public void novoEndereco() {
try {
EnderecoDAO dao = new EnderecoDAO();
dao.salvar(end);
LOGGER.info("Endereço salvo com sucesso");
} catch (SQLException e) {
LOGGER.error(e.getMessage(), e);
}
}
/**
* Metodo responsavel por salvar um novo usuario
*
* @see Usuario
*/
public void novoUsuario() {
try {
UsuarioDAO dao = new UsuarioDAO();
user.setEndereco(end);
dao.salvar(user);
usuarios = dao.listar();
this.user = new Usuario();
LOGGER.info("Usuario salvo com sucesso!");
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
JSFUtil.mensagemDeErro(e.getMessage());
}
}
/**
* Metodo responsavel por excluir um usuario
*
* @see Usuario
*/
public void excluir() {
try {
UsuarioDAO dao = new UsuarioDAO();
dao.excluir(user);
usuarios = dao.listar();
JSFUtil.adicionarMensagemSucesso("Usuario removido com sucesso!");
this.user = new Usuario();
LOGGER.info("Usuario removido com sucesso!");
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
JSFUtil.mensagemDeErro(e.getMessage());
}
}
/**
* mMetodo responsavel por editar um endereco
*
* @see Endereco
*/
public void editarEnd() {
try {
daoEn.atualizar(end);
JSFUtil.adicionarMensagemSucesso("Usuario editado com sucesso");
end = new Endereco();
LOGGER.info("Endereço editado com sucesso!");
} catch (SQLException e) {
LOGGER.error(e.getMessage(), e);
}
}
/**
* Metodo responsavel por editar um Usuario
*
* @see Usuario
*/
public void editar() {
try {
EnderecoDAO endDao = new EnderecoDAO();
UsuarioDAO dao = new UsuarioDAO();
endDao.atualizar(user.getEndereco());
dao.atualizar(user);
usuarios = dao.listar();
JSFUtil.adicionarMensagemSucesso("Usuario editado com sucesso");
this.user = new Usuario();
LOGGER.info("Usuario editado com sucesso!");
} catch (SQLException e) {
LOGGER.error(e.getMessage(), e);
JSFUtil.mensagemDeErro(e.getMessage());
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
}
}
public String home() {
return "principal";
}
}
| 4,787 | 0.650565 | 0.650146 | 216 | 20.138889 | 18.360565 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.685185 | false | false |
3
|
2099ffcf46158c54364df38a075ab3de07493c3c
| 26,869,315,451,585 |
cc4d3ce068a354cbf6f70c66b2c0eb5d49c659b8
|
/swing_10 - Text Fields & Labels/src/swing_10/Toolbar.java
|
a50784b7e29fe0f554aac8393285e4c165396041
|
[] |
no_license
|
EnjoiPandaCow/swing
|
https://github.com/EnjoiPandaCow/swing
|
f8cf624c38d7892b68450b34fec72ac13f69e17b
|
6a9275f2e83416239b7a9ca78ab0e092de13a976
|
refs/heads/master
| 2021-09-04T18:58:29.098000 | 2018-01-21T11:36:27 | 2018-01-21T11:36:27 | 118,230,259 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package swing_10;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JPanel;
public class Toolbar extends JPanel implements ActionListener {
private JButton helloButton;
private JButton goodbyeButton;
private StringListener textListener;
public Toolbar () {
// Added border to the tool bar
setBorder(BorderFactory.createEtchedBorder());
helloButton = new JButton("Hello");
goodbyeButton = new JButton("Goodbye");
helloButton.addActionListener(this);
goodbyeButton.addActionListener(this);
// To get the buttons to move to the left we pass an argument like -- FlowLayout.LEFT -- below
setLayout(new FlowLayout(FlowLayout.LEFT));
add(helloButton);
add(goodbyeButton);
}
// Accepts any object that implements the string listener, it saves a reference to listener above in textListener
public void setStringListener(StringListener listener) {
this.textListener = listener;
}
// The actionPerformed method receives an ActionEvent called "e"
public void actionPerformed(ActionEvent e) {
// Retrieves the actual source of the event
JButton clicked = (JButton)e.getSource();
if(clicked == helloButton) {
if(textListener != null) {
textListener.textEmitted("Hello\n");
}
}
else if(clicked == goodbyeButton) {
if(textListener != null) {
textListener.textEmitted("Goodbye\n");
}
}
}
}
|
UTF-8
|
Java
| 1,518 |
java
|
Toolbar.java
|
Java
|
[] | null |
[] |
package swing_10;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JPanel;
public class Toolbar extends JPanel implements ActionListener {
private JButton helloButton;
private JButton goodbyeButton;
private StringListener textListener;
public Toolbar () {
// Added border to the tool bar
setBorder(BorderFactory.createEtchedBorder());
helloButton = new JButton("Hello");
goodbyeButton = new JButton("Goodbye");
helloButton.addActionListener(this);
goodbyeButton.addActionListener(this);
// To get the buttons to move to the left we pass an argument like -- FlowLayout.LEFT -- below
setLayout(new FlowLayout(FlowLayout.LEFT));
add(helloButton);
add(goodbyeButton);
}
// Accepts any object that implements the string listener, it saves a reference to listener above in textListener
public void setStringListener(StringListener listener) {
this.textListener = listener;
}
// The actionPerformed method receives an ActionEvent called "e"
public void actionPerformed(ActionEvent e) {
// Retrieves the actual source of the event
JButton clicked = (JButton)e.getSource();
if(clicked == helloButton) {
if(textListener != null) {
textListener.textEmitted("Hello\n");
}
}
else if(clicked == goodbyeButton) {
if(textListener != null) {
textListener.textEmitted("Goodbye\n");
}
}
}
}
| 1,518 | 0.729249 | 0.727931 | 63 | 23.095238 | 24.022947 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.809524 | false | false |
3
|
b5e6de0eb5bd71da265d4c3fe7bc020359c94599
| 31,499,290,213,351 |
e2d2d7770b9f024e3b7262696dcbc229cb4f8529
|
/Materiały/10. SebastianKonradApp/TKCLN/src/main/java/teki/clean/app/dao/UserDAO.java
|
45ea221fe4c8201033f3335d9657fbc639d58638
|
[] |
no_license
|
kkluwak/TEKIClean
|
https://github.com/kkluwak/TEKIClean
|
7030442d50ef85f5c76eaa2b5aab2bf3f9bbcb03
|
8b1e09a417603f9a30ec79aac1b993316de3bc9f
|
refs/heads/master
| 2021-05-29T16:08:26.572000 | 2015-06-06T21:18:22 | 2015-06-06T21:18:22 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package teki.clean.app.dao;
import java.util.List;
import teki.clean.app.model.User;
public interface UserDAO {
public List<User> list();
public User get(int user_id);
public void saveOrUpdate(User user);
public void delete(int user_id);
//Potrzebne do logowania - Dokończ!
//public boolean logIn(String login, String password);
//public int getAuthLvl();
//public boolean checkPassword( String userPassword, String Password);
}
|
WINDOWS-1250
|
Java
| 442 |
java
|
UserDAO.java
|
Java
|
[] | null |
[] |
package teki.clean.app.dao;
import java.util.List;
import teki.clean.app.model.User;
public interface UserDAO {
public List<User> list();
public User get(int user_id);
public void saveOrUpdate(User user);
public void delete(int user_id);
//Potrzebne do logowania - Dokończ!
//public boolean logIn(String login, String password);
//public int getAuthLvl();
//public boolean checkPassword( String userPassword, String Password);
}
| 442 | 0.750567 | 0.750567 | 16 | 26.5625 | 19.065573 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.3125 | false | false |
3
|
f3da483fd748d20b049c01f2c397dfa239f1cabf
| 14,843,407,036,192 |
006960edb6b89e91d72e92c9c07d67ddd9c79cc6
|
/demoa/src/main/java/com/example/demo/test/test.java
|
44c1561f6abd19a15745489913c474a44eb3d0ca
|
[] |
no_license
|
zlbbaseproject/main
|
https://github.com/zlbbaseproject/main
|
e5ce5b329b6fea6beeeae474c3f16a1106650975
|
1044884cca72babec2bf28905273ab7aab94a562
|
refs/heads/master
| 2022-07-01T04:56:23.643000 | 2019-07-11T03:40:03 | 2019-07-11T03:40:03 | 162,301,290 | 0 | 0 | null | false | 2022-06-17T02:02:58 | 2018-12-18T14:35:01 | 2019-07-11T03:44:46 | 2022-06-17T02:02:57 | 7,980 | 0 | 0 | 3 |
Java
| false | false |
package com.example.demo.test;
import java.util.UUID;
/**
* Created by TDW on 2019/2/13.
*/
public class test {
public static void main(String[] args) {
System.out.println(sub());
}
public static int sub(){
int i = 1;
try{
return ++i;
}catch(Exception e){
}finally{ ++i;}
return i;
}
}
|
UTF-8
|
Java
| 355 |
java
|
test.java
|
Java
|
[
{
"context": "o.test;\n\nimport java.util.UUID;\n\n/**\n * Created by TDW on 2019/2/13.\n */\npublic class test {\n public ",
"end": 77,
"score": 0.9990402460098267,
"start": 74,
"tag": "USERNAME",
"value": "TDW"
}
] | null |
[] |
package com.example.demo.test;
import java.util.UUID;
/**
* Created by TDW on 2019/2/13.
*/
public class test {
public static void main(String[] args) {
System.out.println(sub());
}
public static int sub(){
int i = 1;
try{
return ++i;
}catch(Exception e){
}finally{ ++i;}
return i;
}
}
| 355 | 0.538028 | 0.515493 | 22 | 15.181818 | 13.394831 | 44 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.318182 | false | false |
3
|
db1a674e7c3576a2eddba6afde0d6f14b89b297a
| 18,391,049,971,044 |
605dd8235a9d4ccde0a0eb9268599702b04e836c
|
/Dangdang/src/com/dangdang/servce/UserServce.java
|
e4ee219e56a8e7fd086885826000194f2dc09f0d
|
[] |
no_license
|
HIbian/GitStudy
|
https://github.com/HIbian/GitStudy
|
37900082e14e38dbaa8da79917b0b767a1ed3813
|
e9a638c9b43caf9f741c7c0289205ded29d3188d
|
refs/heads/master
| 2020-03-27T12:04:02.019000 | 2018-11-17T07:39:50 | 2018-11-17T07:39:50 | 146,523,329 | 3 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.dangdang.servce;
import com.dangdang.bean.User;
public interface UserServce {
//查询用户是否重复
public boolean isRegisted(User u);
//注册用户
public int userRegister(User u);
//判断用户名是否合法
public boolean isUserName(String username);
//判断密码是否合法
public boolean isPassword(String password);
//判断邮箱是否合法
public boolean isEmail(String email);
public User userLogin(String username, String password);
}
|
UTF-8
|
Java
| 482 |
java
|
UserServce.java
|
Java
|
[] | null |
[] |
package com.dangdang.servce;
import com.dangdang.bean.User;
public interface UserServce {
//查询用户是否重复
public boolean isRegisted(User u);
//注册用户
public int userRegister(User u);
//判断用户名是否合法
public boolean isUserName(String username);
//判断密码是否合法
public boolean isPassword(String password);
//判断邮箱是否合法
public boolean isEmail(String email);
public User userLogin(String username, String password);
}
| 482 | 0.776961 | 0.776961 | 17 | 23 | 17.094891 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.176471 | false | false |
3
|
bca522d7eca785bc8c124f49e746d0bae5b4289a
| 19,164,144,144,135 |
a252d1c9a871f93e9187bfbe019d2acc5a443397
|
/LastOccurOfChar.java
|
a7367a9f8395bda4c78ff4caa56ce22d12723955
|
[] |
no_license
|
Karthikchary04/JAVA-LOGICAL-PROGRAMMING
|
https://github.com/Karthikchary04/JAVA-LOGICAL-PROGRAMMING
|
f66039ff52d93efc14524d9a64c6f2df4202ce60
|
b27c0957b7869ed6d4b0fa31283f37d755f7a11f
|
refs/heads/master
| 2021-02-08T07:51:17.562000 | 2020-03-27T16:13:11 | 2020-03-27T16:13:11 | 244,126,234 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package stringPrograms;
import java.util.Scanner;
public class LastOccurOfChar
{
public void lastOccur(String str,char search)
{
char ch[]=str.toCharArray();
for(int i=ch.length-1;i>=0;i--)
{
if(search==ch[i])
{
System.out.println("last occurance of"+ch[i]+" "+i);
break;
}
}
}
public static void main(String[] args)
{
LastOccurOfChar lc=new LastOccurOfChar();
Scanner s=new Scanner(System.in);
System.out.println("enter string");
String str=s.nextLine();
System.out.println("enter search element");
char search=s.next().charAt(0);
lc.lastOccur(str,search);
}
}
|
UTF-8
|
Java
| 713 |
java
|
LastOccurOfChar.java
|
Java
|
[] | null |
[] |
package stringPrograms;
import java.util.Scanner;
public class LastOccurOfChar
{
public void lastOccur(String str,char search)
{
char ch[]=str.toCharArray();
for(int i=ch.length-1;i>=0;i--)
{
if(search==ch[i])
{
System.out.println("last occurance of"+ch[i]+" "+i);
break;
}
}
}
public static void main(String[] args)
{
LastOccurOfChar lc=new LastOccurOfChar();
Scanner s=new Scanner(System.in);
System.out.println("enter string");
String str=s.nextLine();
System.out.println("enter search element");
char search=s.next().charAt(0);
lc.lastOccur(str,search);
}
}
| 713 | 0.57223 | 0.568022 | 28 | 23.464285 | 17.998972 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.464286 | false | false |
3
|
1ee3c7aff73f9c18fcfdb107a5982b1f5224312f
| 33,663,953,723,558 |
7811ba377c4bb3b7d441a61c4b031f171821e0b3
|
/site/page/src/src/uk/ac/ebi/interpro/exchange/compress/Input.java
|
1dd8b03cfab267a35b0979eea910f0701ee8833c
|
[] |
no_license
|
wikiselev/GO-ancestor-chart
|
https://github.com/wikiselev/GO-ancestor-chart
|
9426434dbaf2d730ebfb8d423a5004c321cfb994
|
aaefb7310648f14aed091d985579be6be9780600
|
refs/heads/master
| 2021-01-10T20:57:29.458000 | 2015-01-22T16:44:00 | 2015-01-22T16:44:00 | 25,304,983 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package uk.ac.ebi.interpro.exchange.compress;
import java.io.*;
public interface Input<X> {
X read() throws IOException;
}
|
UTF-8
|
Java
| 129 |
java
|
Input.java
|
Java
|
[] | null |
[] |
package uk.ac.ebi.interpro.exchange.compress;
import java.io.*;
public interface Input<X> {
X read() throws IOException;
}
| 129 | 0.72093 | 0.72093 | 7 | 17.428572 | 16.654963 | 45 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false |
3
|
9302f14ff1bd0bae7806cfd1d15ea74e8d3afc57
| 33,663,953,725,656 |
f34602b407107a11ce0f3e7438779a4aa0b1833e
|
/professor/dvl/roadnet-client/src/main/java/org/datacontract/schemas/_2004/_07/roadnet_apex_server_services_wcfshared_datacontracts/DataWarehouseCleansingResult.java
|
ef5522ce695e8e0a8d5e81c479d563dc17f77f5f
|
[] |
no_license
|
ggmoura/treinar_11836
|
https://github.com/ggmoura/treinar_11836
|
a447887dc65c78d4bd87a70aab2ec9b72afd5d87
|
0a91f3539ccac703d9f59b3d6208bf31632ddf1c
|
refs/heads/master
| 2022-06-14T13:01:27.958000 | 2020-04-04T01:41:57 | 2020-04-04T01:41:57 | 237,103,996 | 0 | 2 | null | false | 2022-05-20T21:24:49 | 2020-01-29T23:36:21 | 2020-04-04T01:42:21 | 2022-05-20T21:24:48 | 2,745 | 0 | 2 | 1 |
Java
| false | false |
package org.datacontract.schemas._2004._07.roadnet_apex_server_services_wcfshared_datacontracts;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import org.datacontract.schemas._2004._07.roadnet_apex_server_services.DataTransferObject;
/**
* <p>Classe Java de DataWarehouseCleansingResult complex type.
*
* <p>O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe.
*
* <pre>
* <complexType name="DataWarehouseCleansingResult">
* <complexContent>
* <extension base="{http://schemas.datacontract.org/2004/07/Roadnet.Apex.Server.Services.DataTransferObjectMapping}DataTransferObject">
* <sequence>
* <element name="RemovedRoutesCount" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
* <element name="TotalRoutesCount" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "DataWarehouseCleansingResult", propOrder = {
"removedRoutesCount",
"totalRoutesCount"
})
public class DataWarehouseCleansingResult
extends DataTransferObject
{
@XmlElement(name = "RemovedRoutesCount")
protected Long removedRoutesCount;
@XmlElement(name = "TotalRoutesCount")
protected Long totalRoutesCount;
/**
* Obtém o valor da propriedade removedRoutesCount.
*
* @return
* possible object is
* {@link Long }
*
*/
public Long getRemovedRoutesCount() {
return removedRoutesCount;
}
/**
* Define o valor da propriedade removedRoutesCount.
*
* @param value
* allowed object is
* {@link Long }
*
*/
public void setRemovedRoutesCount(Long value) {
this.removedRoutesCount = value;
}
/**
* Obtém o valor da propriedade totalRoutesCount.
*
* @return
* possible object is
* {@link Long }
*
*/
public Long getTotalRoutesCount() {
return totalRoutesCount;
}
/**
* Define o valor da propriedade totalRoutesCount.
*
* @param value
* allowed object is
* {@link Long }
*
*/
public void setTotalRoutesCount(Long value) {
this.totalRoutesCount = value;
}
}
|
UTF-8
|
Java
| 2,679 |
java
|
DataWarehouseCleansingResult.java
|
Java
|
[] | null |
[] |
package org.datacontract.schemas._2004._07.roadnet_apex_server_services_wcfshared_datacontracts;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import org.datacontract.schemas._2004._07.roadnet_apex_server_services.DataTransferObject;
/**
* <p>Classe Java de DataWarehouseCleansingResult complex type.
*
* <p>O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe.
*
* <pre>
* <complexType name="DataWarehouseCleansingResult">
* <complexContent>
* <extension base="{http://schemas.datacontract.org/2004/07/Roadnet.Apex.Server.Services.DataTransferObjectMapping}DataTransferObject">
* <sequence>
* <element name="RemovedRoutesCount" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
* <element name="TotalRoutesCount" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "DataWarehouseCleansingResult", propOrder = {
"removedRoutesCount",
"totalRoutesCount"
})
public class DataWarehouseCleansingResult
extends DataTransferObject
{
@XmlElement(name = "RemovedRoutesCount")
protected Long removedRoutesCount;
@XmlElement(name = "TotalRoutesCount")
protected Long totalRoutesCount;
/**
* Obtém o valor da propriedade removedRoutesCount.
*
* @return
* possible object is
* {@link Long }
*
*/
public Long getRemovedRoutesCount() {
return removedRoutesCount;
}
/**
* Define o valor da propriedade removedRoutesCount.
*
* @param value
* allowed object is
* {@link Long }
*
*/
public void setRemovedRoutesCount(Long value) {
this.removedRoutesCount = value;
}
/**
* Obtém o valor da propriedade totalRoutesCount.
*
* @return
* possible object is
* {@link Long }
*
*/
public Long getTotalRoutesCount() {
return totalRoutesCount;
}
/**
* Define o valor da propriedade totalRoutesCount.
*
* @param value
* allowed object is
* {@link Long }
*
*/
public void setTotalRoutesCount(Long value) {
this.totalRoutesCount = value;
}
}
| 2,679 | 0.629297 | 0.618087 | 92 | 27.065218 | 28.331425 | 146 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.369565 | false | false |
3
|
c02b106ba56055ad4fb6404607ff57660f1a0e4a
| 4,690,104,331,998 |
cb681bafe20704dd3a6b01ff0e625f5ea2f0ae45
|
/src/de/advancedplatformer/config/Config.java
|
436fe6b6425c5b3b6735d630889044f98833d357
|
[
"BSD-2-Clause"
] |
permissive
|
SelfGamer/AdvancedPlatformer
|
https://github.com/SelfGamer/AdvancedPlatformer
|
4a9482a66fd8fe601878e05e8b56ea92e67b1d7d
|
fc9188210adcb30078425ebe53d3b89cda4c1ae5
|
refs/heads/master
| 2018-01-08T07:17:16.872000 | 2015-10-04T19:30:57 | 2015-10-04T19:30:57 | 43,093,082 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package de.advancedplatformer.config;
public class Config<T> {
public static Config<Integer> ASPECT_RATIO_X = new Config<Integer>(16);
public static Config<Integer> ASPECT_RATIO_Y = new Config<Integer>(9);
public static Config<Float> ASPECT_CORRECT_X = new Config<Float>(1f);
public static Config<Float> ASPECT_CORRECT_Y = new Config<Float>(1f);
public static Config<Integer> SIZE_X = new Config<Integer>(1280);
public static Config<Integer> SIZE_Y = new Config<Integer>(720);
public static Config<Integer> MAX_FPS = new Config<Integer>(144);
private T value;
public Config(T initialValue){
this.value = initialValue;
}
public static <T> void modifyConfig(Config<T> setting, T value){
setting.value = value;
}
public static <T> T getConfig(Config<T> setting){
return setting.value;
}
}
|
UTF-8
|
Java
| 822 |
java
|
Config.java
|
Java
|
[] | null |
[] |
package de.advancedplatformer.config;
public class Config<T> {
public static Config<Integer> ASPECT_RATIO_X = new Config<Integer>(16);
public static Config<Integer> ASPECT_RATIO_Y = new Config<Integer>(9);
public static Config<Float> ASPECT_CORRECT_X = new Config<Float>(1f);
public static Config<Float> ASPECT_CORRECT_Y = new Config<Float>(1f);
public static Config<Integer> SIZE_X = new Config<Integer>(1280);
public static Config<Integer> SIZE_Y = new Config<Integer>(720);
public static Config<Integer> MAX_FPS = new Config<Integer>(144);
private T value;
public Config(T initialValue){
this.value = initialValue;
}
public static <T> void modifyConfig(Config<T> setting, T value){
setting.value = value;
}
public static <T> T getConfig(Config<T> setting){
return setting.value;
}
}
| 822 | 0.723844 | 0.705596 | 30 | 26.4 | 28.21418 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.3 | false | false |
3
|
fa64ba0d827ddbe22ed58d43cea0b6cef647748d
| 9,560,597,204,175 |
242fa1556c8ea550f3a0cae6f434175f24c11597
|
/workspaceNW5/mdm_api_enhanced/.svn/pristine/fa/fa64ba0d827ddbe22ed58d43cea0b6cef647748d.svn-base
|
f31b8c382acf8435a8e1fd48b96047b0cecbe769
|
[] |
no_license
|
jamesvelez/IBM_MasterDataManagement
|
https://github.com/jamesvelez/IBM_MasterDataManagement
|
a9a28c153cd8728654ced006e90e0e34ba72974c
|
930986f838cef0d84e73886c32d38c78c49b740b
|
refs/heads/master
| 2022-04-08T09:00:03.063000 | 2020-03-22T19:00:07 | 2020-03-22T19:00:07 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/* _______________________________________________________ {COPYRIGHT-TOP} _____
* IBM Confidential
* OCO Source Materials
*
* 5725-E59
*
* (C) Copyright IBM Corp. 2013 All Rights Reserved.
*
* The source code for this program is not published or otherwise
* divested of its trade secrets, irrespective of what has been
* deposited with the U.S. Copyright Office.
* ________________________________________________________ {COPYRIGHT-END} _____*/
package com.ibm.mdm.mds.api.example;
import madison.mpi.IxnMemUnmerge;
import madison.mpi.MemHead;
import madison.mpi.MemRowList;
/**
* This example shows how IxnMemUnmerge interaction object can be used to
* unmerge one or more members out of a supercession-set.
*
* Run the ExMemMerge example first in order to merge the members we will be
* attempting to unmerge.
*/
public class ExMemUnmerge extends BaseExample
{
public static final String copyright = "Licensed Materials -- Property of IBM\n(c) Copyright IBM Corp. 2013\nUS Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.";
private static final String intrName = "IxnMemUnmerge";
public static void main(String[] args) throws Exception
{
// Create the interaction object.
IxnMemUnmerge memUnmerge = new IxnMemUnmerge(getContext());
// Create a member rowlist to hold input member row(s)
MemRowList inpRL = new MemRowList();
// Set the member type as PERSON.
// Member types are listed in mpi_memtype table.
memUnmerge.setMemType("PERSON");
// Set entity type as Identity (id)
// Entity types are listed in mpi_enttype table.
memUnmerge.setEntType("id");
// MemHead models the Initiate database table
// mpi_memhead
MemHead obsolete = new MemHead();
obsolete.setSrcCode("RMC");
obsolete.setMemIdnum("300067");
inpRL.addRow(obsolete);
waitForQueues(obsolete.getSrcCode(), obsolete.getMemIdnum());
// Execute the interaction
boolean status = memUnmerge.execute(inpRL);
if (status)
info("The " + intrName + " interaction worked, was successful.");
else
{
// Disconnect from Master Data Engine server
disconnect();
ixnError("The " + intrName + " interaction failed.", memUnmerge.getErrCode().toString(), memUnmerge.getErrText());
}
// Disconnect from Master Data Engine server
disconnect();
}
}
|
UTF-8
|
Java
| 2,422 |
fa64ba0d827ddbe22ed58d43cea0b6cef647748d.svn-base
|
Java
|
[] | null |
[] |
/* _______________________________________________________ {COPYRIGHT-TOP} _____
* IBM Confidential
* OCO Source Materials
*
* 5725-E59
*
* (C) Copyright IBM Corp. 2013 All Rights Reserved.
*
* The source code for this program is not published or otherwise
* divested of its trade secrets, irrespective of what has been
* deposited with the U.S. Copyright Office.
* ________________________________________________________ {COPYRIGHT-END} _____*/
package com.ibm.mdm.mds.api.example;
import madison.mpi.IxnMemUnmerge;
import madison.mpi.MemHead;
import madison.mpi.MemRowList;
/**
* This example shows how IxnMemUnmerge interaction object can be used to
* unmerge one or more members out of a supercession-set.
*
* Run the ExMemMerge example first in order to merge the members we will be
* attempting to unmerge.
*/
public class ExMemUnmerge extends BaseExample
{
public static final String copyright = "Licensed Materials -- Property of IBM\n(c) Copyright IBM Corp. 2013\nUS Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.";
private static final String intrName = "IxnMemUnmerge";
public static void main(String[] args) throws Exception
{
// Create the interaction object.
IxnMemUnmerge memUnmerge = new IxnMemUnmerge(getContext());
// Create a member rowlist to hold input member row(s)
MemRowList inpRL = new MemRowList();
// Set the member type as PERSON.
// Member types are listed in mpi_memtype table.
memUnmerge.setMemType("PERSON");
// Set entity type as Identity (id)
// Entity types are listed in mpi_enttype table.
memUnmerge.setEntType("id");
// MemHead models the Initiate database table
// mpi_memhead
MemHead obsolete = new MemHead();
obsolete.setSrcCode("RMC");
obsolete.setMemIdnum("300067");
inpRL.addRow(obsolete);
waitForQueues(obsolete.getSrcCode(), obsolete.getMemIdnum());
// Execute the interaction
boolean status = memUnmerge.execute(inpRL);
if (status)
info("The " + intrName + " interaction worked, was successful.");
else
{
// Disconnect from Master Data Engine server
disconnect();
ixnError("The " + intrName + " interaction failed.", memUnmerge.getErrCode().toString(), memUnmerge.getErrText());
}
// Disconnect from Master Data Engine server
disconnect();
}
}
| 2,422 | 0.676301 | 0.668043 | 70 | 33.599998 | 36.57415 | 241 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.371429 | false | false |
3
|
|
f873a67db5973f6791775238c55ee3f8282f27aa
| 15,668,040,713,281 |
0183b5b84ad72de4ae06cf141dc0f258d82291e4
|
/src/programmers/level3/타일_장식물.java
|
3a4fd5bfc8e90ff165499320893b3ac627158f15
|
[] |
no_license
|
sunday-hangout/sunyoung-repository
|
https://github.com/sunday-hangout/sunyoung-repository
|
ecf96032005c15ed1357a56513d3472e6542c6e3
|
6ef4c554bff7b9ad1d093935a042bc6e83d961cc
|
refs/heads/master
| 2021-02-26T21:35:56.339000 | 2020-11-01T12:22:04 | 2020-11-01T12:22:04 | 245,554,292 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package programmers.level3;
import org.junit.Assert;
import org.junit.Test;
public class 타일_장식물 {
public long solution(int n) {
long answer = 2;
long pibo[] = new long[80];
pibo[0] = 1;
pibo[1] = 1;
for (int i = 2; i < 80; i++) {
pibo[i] = pibo[i - 1] + pibo[i - 2];
}
if (n > 2) {
answer = pibo[n - 1] + pibo[n];
}
return answer * 2;
}
@Test
public void 정답() {
Assert.assertEquals(26, solution(5));
Assert.assertEquals(42, solution(6));
}
}
|
UTF-8
|
Java
| 531 |
java
|
타일_장식물.java
|
Java
|
[] | null |
[] |
package programmers.level3;
import org.junit.Assert;
import org.junit.Test;
public class 타일_장식물 {
public long solution(int n) {
long answer = 2;
long pibo[] = new long[80];
pibo[0] = 1;
pibo[1] = 1;
for (int i = 2; i < 80; i++) {
pibo[i] = pibo[i - 1] + pibo[i - 2];
}
if (n > 2) {
answer = pibo[n - 1] + pibo[n];
}
return answer * 2;
}
@Test
public void 정답() {
Assert.assertEquals(26, solution(5));
Assert.assertEquals(42, solution(6));
}
}
| 531 | 0.535783 | 0.49323 | 32 | 15.15625 | 14.38556 | 42 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
3
|
f6e6c22766307da5be0bb6fc659525d86543b5e8
| 17,360,257,813,301 |
fc5671c0622a69e9a9419abe5f80f957f805c474
|
/src/com/ldlj/test/sdeThread.java
|
9694190673e68b22535645a5c0201d54acafb87d
|
[] |
no_license
|
bigjokeryo/sde_test
|
https://github.com/bigjokeryo/sde_test
|
d009030ee5e23db7915c2cf1403bd8d7159e30ea
|
da2c2255f9de6120d209c62ad230b593b07e5dd7
|
refs/heads/master
| 2016-09-10T17:47:35.610000 | 2014-07-03T07:53:55 | 2014-07-03T07:53:55 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.ldlj.test;
import java.util.List;
import com.esri.sde.sdk.client.SeException;
import com.esri.sde.sdk.client.SeQuery;
public class sdeThread extends Thread{
private int num;
private List<SdeJob> jobs;
String status;
String jobId;
sdeThread(int num, List<SdeJob> jobs) {
this.num = num;
this.jobs = jobs;
this.status = "idle";
}
public void run(){
System.out.println("thread " + num + " started.");
SdeUtils su = new SdeUtils();
while(!this.status.equals("stop")) {
if(this.status.equals("running")) {
System.out.println("thread " + num + ": " + jobId + " running");
try {
SeQuery query = su.query("select count(*) from XIAN_" + jobId + " where mian_ji>2.0");
int n = query.fetch().getDouble(0).intValue();
System.out.println(jobId + ":" + n + " rows");
query.close();
} catch (SeException e) {
e.printStackTrace();
}
for(SdeJob job : jobs) {
if(job.jobId.equals(jobId)) {
job.status = "finished";
}
}
this.status = "idle";
} else {
try {
this.sleep(1000);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
}
}
}
}
|
UTF-8
|
Java
| 1,228 |
java
|
sdeThread.java
|
Java
|
[] | null |
[] |
package com.ldlj.test;
import java.util.List;
import com.esri.sde.sdk.client.SeException;
import com.esri.sde.sdk.client.SeQuery;
public class sdeThread extends Thread{
private int num;
private List<SdeJob> jobs;
String status;
String jobId;
sdeThread(int num, List<SdeJob> jobs) {
this.num = num;
this.jobs = jobs;
this.status = "idle";
}
public void run(){
System.out.println("thread " + num + " started.");
SdeUtils su = new SdeUtils();
while(!this.status.equals("stop")) {
if(this.status.equals("running")) {
System.out.println("thread " + num + ": " + jobId + " running");
try {
SeQuery query = su.query("select count(*) from XIAN_" + jobId + " where mian_ji>2.0");
int n = query.fetch().getDouble(0).intValue();
System.out.println(jobId + ":" + n + " rows");
query.close();
} catch (SeException e) {
e.printStackTrace();
}
for(SdeJob job : jobs) {
if(job.jobId.equals(jobId)) {
job.status = "finished";
}
}
this.status = "idle";
} else {
try {
this.sleep(1000);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
}
}
}
}
| 1,228 | 0.57329 | 0.565961 | 52 | 21.615385 | 19.192501 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3 | false | false |
3
|
d84793cf7d26e49e6ace4ab8d605eca1378cbeb1
| 2,697,239,485,380 |
3cea85965954c3ec62687c75d18771f31ec69663
|
/src/main/java/com/uz/laboratory/statistical/controller/remark/ponab/PonabRemarkViewController.java
|
a10873a412b912af4d6e8b717d0fa957a0fc153e
|
[] |
no_license
|
alexeycrystal/ponab-statistical-reports
|
https://github.com/alexeycrystal/ponab-statistical-reports
|
3f319cf272d489867397df8d62d94a573e08bb0b
|
a9bb9e515350a408ce61322b8bc41b659de9dcf3
|
refs/heads/master
| 2021-01-20T08:01:52.946000 | 2016-08-24T17:22:41 | 2016-08-24T17:22:41 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.uz.laboratory.statistical.controller.remark.ponab;
import com.uz.laboratory.statistical.dict.Constants;
import com.uz.laboratory.statistical.dto.ponab.PonabRemarkDto;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import java.net.URL;
import java.time.ZoneId;
import java.time.format.DateTimeFormatterBuilder;
import java.util.ResourceBundle;
@Controller
public class PonabRemarkViewController implements Initializable {
@FXML
public Button ponabRemarkViewCloseButton;
@FXML
public TreeView ponabRemarkTreeView;
@Autowired
private PonabRemarkDto ponabRemarkDto;
@Override
public void initialize(URL location, ResourceBundle resources) {
initTreeView();
}
private void initTreeView() {
TreeItem<String> treeRootItem = new TreeItem<>(Constants.REMARK_VIEW_TREE_TITLE + ponabRemarkDto.getId());
TreeItem<String> dateRootItem = new TreeItem<>(Constants.REMARK_VIEW_DATE_TITLE);
TreeItem<String> dateItem = new TreeItem<>(ponabRemarkDto.getCreationDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate().format(new DateTimeFormatterBuilder().appendPattern("dd.MM.yyyy").toFormatter()));
dateRootItem.getChildren().addAll(dateItem);
TreeItem<String> sectorRootItem = new TreeItem<>(Constants.REMARK_VIEW_SECTOR_TITLE);
TreeItem<String> sectorItem = new TreeItem<>(ponabRemarkDto.getInspectionTrip().getTripSector().getTitle());
sectorRootItem.getChildren().addAll(sectorItem);
TreeItem<String> stageRootItem = new TreeItem<>(Constants.REMARK_VIEW_STAGE_TITLE);
TreeItem<String> stageItem = new TreeItem<>(ponabRemarkDto.getPonabSystem().getStage().getName());
stageRootItem.getChildren().addAll(stageItem);
TreeItem<String> noteRootItem = new TreeItem<>(Constants.REMARK_VIEW_NOTE_TITLE);
TreeItem<String> noteItem = new TreeItem<>(ponabRemarkDto.getNote());
noteRootItem.getChildren().addAll(noteItem);
TreeItem<String> ponabSystemItem = new TreeItem<>(Constants.REMARK_VIEW_SYSTEM_TITLE);
TreeItem<String> ponabSystemTitleRootItem = new TreeItem<>(Constants.REMARK_VIEW_SYSTEM_NAME);
TreeItem<String> ponabSystemTitleItem = new TreeItem<>(ponabRemarkDto.getPonabSystem().getTitle());
ponabSystemTitleRootItem.getChildren().addAll(ponabSystemTitleItem);
TreeItem<String> ponabSystemOptionRootItem = new TreeItem<>(Constants.REMARK_VIEW_SYSTEM_OPTION);
TreeItem<String> ponabSystemOptionItem = new TreeItem<>(ponabRemarkDto.getPonabSystem().getOption());
ponabSystemOptionRootItem.getChildren().addAll(ponabSystemOptionItem);
TreeItem<String> ponabSystemSpeachInfoRootItem = new TreeItem<>(Constants.REMARK_VIEW_SYSTEM_INFORMER);
TreeItem<String> ponabSystemSpeachInfoItem = new TreeItem<>(ponabRemarkDto.getPonabSystem().isSpeachInformer() ? Constants.REMARK_VIEW_SYSTEM_INFORMER_TRUE : Constants.REMARK_VIEW_SYSTEM_INFORMER_FALSE);
ponabSystemSpeachInfoRootItem.getChildren().addAll(ponabSystemSpeachInfoItem);
ponabSystemItem.getChildren().addAll(ponabSystemTitleRootItem, ponabSystemOptionRootItem, ponabSystemSpeachInfoRootItem);
TreeItem<String> directionOfMovementRootItem = new TreeItem<>(Constants.REMARK_VIEW_SYSTEM_DIRECTION);
TreeItem<String> directionOfMovementItem = ponabRemarkDto.getEven() ? new TreeItem<>(Constants.REMARK_VIEW_SYSTEM_DIRECTION_EVEN) : new TreeItem<>(Constants.REMARK_VIEW_SYSTEM_DIRECTION_UNEVEN);
directionOfMovementRootItem.getChildren().addAll(directionOfMovementItem);
TreeItem<String> repeatRootItem = new TreeItem<>(Constants.REMARK_VIEW_REPEAT_TITLE);
TreeItem<String> repeatItem = new TreeItem<>(ponabRemarkDto.getRepeatable() ? Constants.REMARK_VIEW_REPEAT_TRUE : Constants.REMARK_VIEW_REPEAT_FALSE);
repeatRootItem.getChildren().addAll(repeatItem);
treeRootItem.getChildren().addAll(
dateRootItem,
repeatRootItem,
sectorRootItem,
stageRootItem,
noteRootItem,
ponabSystemItem,
directionOfMovementRootItem);
treeRootItem.setExpanded(true);
dateRootItem.setExpanded(true);
repeatRootItem.setExpanded(true);
sectorRootItem.setExpanded(true);
stageRootItem.setExpanded(true);
noteRootItem.setExpanded(true);
ponabSystemItem.setExpanded(true);
ponabSystemTitleRootItem.setExpanded(true);
ponabSystemOptionRootItem.setExpanded(true);
ponabSystemSpeachInfoRootItem.setExpanded(true);
directionOfMovementRootItem.setExpanded(true);
ponabRemarkTreeView.setRoot(treeRootItem);
}
@FXML
public void closeButtonListener(ActionEvent actionEvent) {
((javafx.stage.Stage) ponabRemarkViewCloseButton.getScene().getWindow()).close();
}
}
|
UTF-8
|
Java
| 5,195 |
java
|
PonabRemarkViewController.java
|
Java
|
[] | null |
[] |
package com.uz.laboratory.statistical.controller.remark.ponab;
import com.uz.laboratory.statistical.dict.Constants;
import com.uz.laboratory.statistical.dto.ponab.PonabRemarkDto;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import java.net.URL;
import java.time.ZoneId;
import java.time.format.DateTimeFormatterBuilder;
import java.util.ResourceBundle;
@Controller
public class PonabRemarkViewController implements Initializable {
@FXML
public Button ponabRemarkViewCloseButton;
@FXML
public TreeView ponabRemarkTreeView;
@Autowired
private PonabRemarkDto ponabRemarkDto;
@Override
public void initialize(URL location, ResourceBundle resources) {
initTreeView();
}
private void initTreeView() {
TreeItem<String> treeRootItem = new TreeItem<>(Constants.REMARK_VIEW_TREE_TITLE + ponabRemarkDto.getId());
TreeItem<String> dateRootItem = new TreeItem<>(Constants.REMARK_VIEW_DATE_TITLE);
TreeItem<String> dateItem = new TreeItem<>(ponabRemarkDto.getCreationDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate().format(new DateTimeFormatterBuilder().appendPattern("dd.MM.yyyy").toFormatter()));
dateRootItem.getChildren().addAll(dateItem);
TreeItem<String> sectorRootItem = new TreeItem<>(Constants.REMARK_VIEW_SECTOR_TITLE);
TreeItem<String> sectorItem = new TreeItem<>(ponabRemarkDto.getInspectionTrip().getTripSector().getTitle());
sectorRootItem.getChildren().addAll(sectorItem);
TreeItem<String> stageRootItem = new TreeItem<>(Constants.REMARK_VIEW_STAGE_TITLE);
TreeItem<String> stageItem = new TreeItem<>(ponabRemarkDto.getPonabSystem().getStage().getName());
stageRootItem.getChildren().addAll(stageItem);
TreeItem<String> noteRootItem = new TreeItem<>(Constants.REMARK_VIEW_NOTE_TITLE);
TreeItem<String> noteItem = new TreeItem<>(ponabRemarkDto.getNote());
noteRootItem.getChildren().addAll(noteItem);
TreeItem<String> ponabSystemItem = new TreeItem<>(Constants.REMARK_VIEW_SYSTEM_TITLE);
TreeItem<String> ponabSystemTitleRootItem = new TreeItem<>(Constants.REMARK_VIEW_SYSTEM_NAME);
TreeItem<String> ponabSystemTitleItem = new TreeItem<>(ponabRemarkDto.getPonabSystem().getTitle());
ponabSystemTitleRootItem.getChildren().addAll(ponabSystemTitleItem);
TreeItem<String> ponabSystemOptionRootItem = new TreeItem<>(Constants.REMARK_VIEW_SYSTEM_OPTION);
TreeItem<String> ponabSystemOptionItem = new TreeItem<>(ponabRemarkDto.getPonabSystem().getOption());
ponabSystemOptionRootItem.getChildren().addAll(ponabSystemOptionItem);
TreeItem<String> ponabSystemSpeachInfoRootItem = new TreeItem<>(Constants.REMARK_VIEW_SYSTEM_INFORMER);
TreeItem<String> ponabSystemSpeachInfoItem = new TreeItem<>(ponabRemarkDto.getPonabSystem().isSpeachInformer() ? Constants.REMARK_VIEW_SYSTEM_INFORMER_TRUE : Constants.REMARK_VIEW_SYSTEM_INFORMER_FALSE);
ponabSystemSpeachInfoRootItem.getChildren().addAll(ponabSystemSpeachInfoItem);
ponabSystemItem.getChildren().addAll(ponabSystemTitleRootItem, ponabSystemOptionRootItem, ponabSystemSpeachInfoRootItem);
TreeItem<String> directionOfMovementRootItem = new TreeItem<>(Constants.REMARK_VIEW_SYSTEM_DIRECTION);
TreeItem<String> directionOfMovementItem = ponabRemarkDto.getEven() ? new TreeItem<>(Constants.REMARK_VIEW_SYSTEM_DIRECTION_EVEN) : new TreeItem<>(Constants.REMARK_VIEW_SYSTEM_DIRECTION_UNEVEN);
directionOfMovementRootItem.getChildren().addAll(directionOfMovementItem);
TreeItem<String> repeatRootItem = new TreeItem<>(Constants.REMARK_VIEW_REPEAT_TITLE);
TreeItem<String> repeatItem = new TreeItem<>(ponabRemarkDto.getRepeatable() ? Constants.REMARK_VIEW_REPEAT_TRUE : Constants.REMARK_VIEW_REPEAT_FALSE);
repeatRootItem.getChildren().addAll(repeatItem);
treeRootItem.getChildren().addAll(
dateRootItem,
repeatRootItem,
sectorRootItem,
stageRootItem,
noteRootItem,
ponabSystemItem,
directionOfMovementRootItem);
treeRootItem.setExpanded(true);
dateRootItem.setExpanded(true);
repeatRootItem.setExpanded(true);
sectorRootItem.setExpanded(true);
stageRootItem.setExpanded(true);
noteRootItem.setExpanded(true);
ponabSystemItem.setExpanded(true);
ponabSystemTitleRootItem.setExpanded(true);
ponabSystemOptionRootItem.setExpanded(true);
ponabSystemSpeachInfoRootItem.setExpanded(true);
directionOfMovementRootItem.setExpanded(true);
ponabRemarkTreeView.setRoot(treeRootItem);
}
@FXML
public void closeButtonListener(ActionEvent actionEvent) {
((javafx.stage.Stage) ponabRemarkViewCloseButton.getScene().getWindow()).close();
}
}
| 5,195 | 0.743985 | 0.743985 | 103 | 49.436893 | 46.12513 | 223 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.699029 | false | false |
3
|
81592b20f139cef22751e12d6731f3086f2cca98
| 15,487,652,073,472 |
821fa96cdc50f442c5c402ca3527e6f7a6b59f7b
|
/usecases/src/test/java/com/zeyad/usecases/db/RealmManagerTest.java
|
9044cb78b60657031abb8084c0ff04772a9ff871
|
[
"Apache-2.0"
] |
permissive
|
miroslavign/UseCases
|
https://github.com/miroslavign/UseCases
|
20abb73fe427e787b2a1bdae120c3bcbeb62c0c1
|
9904f5930e04333e8485958da701ade3225355ae
|
refs/heads/master
| 2021-05-15T04:01:16.536000 | 2017-06-15T19:52:22 | 2017-06-15T19:52:22 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.zeyad.usecases.db;
import android.support.test.rule.BuildConfig;
import com.google.gson.Gson;
import com.zeyad.usecases.TestRealmModel;
import org.json.JSONArray;
import org.json.JSONObject;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.rule.PowerMockRule;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import java.util.ArrayList;
import io.reactivex.Flowable;
import io.reactivex.Single;
import io.reactivex.observers.TestObserver;
import io.reactivex.subscribers.TestSubscriber;
import io.realm.Realm;
import io.realm.RealmConfiguration;
import io.realm.RealmQuery;
import io.realm.RealmResults;
import rx.Observable;
import static org.powermock.api.mockito.PowerMockito.mock;
/**
* @author by ZIaDo on 2/15/17.
*/
@RunWith(RobolectricTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 19)
@PowerMockIgnore({"org.mockito.*", "org.robolectric.*", "android.*"})
@PrepareForTest({Realm.class, RealmQuery.class, RealmResults.class})
public class RealmManagerTest {
@Rule
public PowerMockRule rule = new PowerMockRule();
private RealmManager mRealmManager;
public Realm mockRealm() {
PowerMockito.mockStatic(Realm.class);
Realm mockRealm = mock(Realm.class);
RealmQuery<TestRealmModel> realmQuery = mock(RealmQuery.class);
RealmResults<TestRealmModel> realmResults = mock(RealmResults.class);
Observable observable = Observable.just(realmResults);
PowerMockito.when(mockRealm.where(TestRealmModel.class)).thenReturn(realmQuery);
PowerMockito.when(mockRealm.where(TestRealmModel.class).equalTo("id", 1L))
.thenReturn(realmQuery);
TestRealmModel value = new TestRealmModel();
PowerMockito.when(mockRealm.where(TestRealmModel.class).equalTo("id", 1L).findFirst())
.thenReturn(value);
PowerMockito.when(mockRealm.where(TestRealmModel.class).findAll()).thenReturn(realmResults);
PowerMockito.when(mockRealm.where(TestRealmModel.class).findAll().asObservable())
.thenReturn(observable);
PowerMockito.when(Realm.getDefaultInstance()).thenReturn(mockRealm);
RealmConfiguration realmConfiguration = mock(RealmConfiguration.class);
PowerMockito.when(mockRealm.getConfiguration()).thenReturn(realmConfiguration);
PowerMockito.when(Realm.getInstance(realmConfiguration)).thenReturn(mockRealm);
PowerMockito.when(mockRealm.copyFromRealm(value)).thenReturn(value);
return mockRealm;
}
@Before
public void before() {
mockRealm();
mRealmManager = new RealmManager();
}
@Test
public void getById() throws Exception {
// Flowable flowable = mRealmManager.getById("id", 1L, long.class, TestRealmModel.class);
//
// applyTestSubscriber(flowable);
//
// assertEquals(flowable.firstElement().blockingGet().getClass(), TestRealmModel.class);
}
@Test
public void getAll() throws Exception {
// Flowable flowable = mRealmManager.getAll(TestRealmModel.class);
//
// applyTestSubscriber(flowable);
//
// assertEquals(flowable.firstElement().blockingGet().getClass(), TestRealmModel.class);
}
private void applyTestSubscriber(Flowable flowable) {
TestSubscriber testSubscriber = new TestSubscriber<>();
flowable.subscribe(testSubscriber);
testSubscriber.assertNoErrors();
testSubscriber.assertSubscribed();
testSubscriber.assertComplete();
// testSubscriber.assertNotComplete();
// testSubscriber.assertNotTerminated();
}
@Test
public void getQuery() throws Exception {
// Flowable flowable = mRealmManager.getQuery(realm -> realm.where(TestRealmModel.class));
//
// applyTestSubscriber(flowable);
//
// assertEquals(flowable.firstElement().blockingGet().getClass(), TestRealmModel.class);
}
@Test
public void putJSONObject() throws Exception {
Single<Boolean> completable = mRealmManager.put(new JSONObject(new Gson()
.toJson(new TestRealmModel())), "id", int.class, TestRealmModel.class);
applyTestSubscriber(completable);
}
private void applyTestSubscriber(Single<Boolean> single) {
TestObserver<Boolean> testSubscriber = new TestObserver<>();
single.subscribe(testSubscriber);
testSubscriber.assertComplete();
}
@Test
public void putRealmModel() throws Exception {
Single<Boolean> completable = mRealmManager.put(new TestRealmModel(), TestRealmModel.class);
applyTestSubscriber(completable);
}
@Test
public void putAllJSONArray() throws Exception {
Single<Boolean> completable = mRealmManager.putAll(new JSONArray(), "id", int.class,
TestRealmModel.class);
applyTestSubscriber(completable);
}
@Test
public void putAllRealmObject() throws Exception {
Single<Boolean> completable = mRealmManager.putAll(new ArrayList<>(), TestRealmModel.class);
applyTestSubscriber(completable);
}
@Test
public void evictAll() throws Exception {
Single<Boolean> completable = mRealmManager.evictAll(TestRealmModel.class);
applyTestSubscriber(completable);
}
@Test
public void evictCollection() throws Exception {
Single<Boolean> completable =
mRealmManager.evictCollection("id", new ArrayList<>(), TestRealmModel.class);
applyTestSubscriber(completable);
}
@Test
public void evictById() throws Exception {
// assertEquals(mRealmManager.evictById(TestRealmModel.class, "id", 1), true);
}
}
|
UTF-8
|
Java
| 5,968 |
java
|
RealmManagerTest.java
|
Java
|
[
{
"context": ".api.mockito.PowerMockito.mock;\n\n/**\n * @author by ZIaDo on 2/15/17.\n */\n@RunWith(RobolectricTestRunner.cl",
"end": 1037,
"score": 0.9907070994377136,
"start": 1032,
"tag": "USERNAME",
"value": "ZIaDo"
}
] | null |
[] |
package com.zeyad.usecases.db;
import android.support.test.rule.BuildConfig;
import com.google.gson.Gson;
import com.zeyad.usecases.TestRealmModel;
import org.json.JSONArray;
import org.json.JSONObject;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.rule.PowerMockRule;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import java.util.ArrayList;
import io.reactivex.Flowable;
import io.reactivex.Single;
import io.reactivex.observers.TestObserver;
import io.reactivex.subscribers.TestSubscriber;
import io.realm.Realm;
import io.realm.RealmConfiguration;
import io.realm.RealmQuery;
import io.realm.RealmResults;
import rx.Observable;
import static org.powermock.api.mockito.PowerMockito.mock;
/**
* @author by ZIaDo on 2/15/17.
*/
@RunWith(RobolectricTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 19)
@PowerMockIgnore({"org.mockito.*", "org.robolectric.*", "android.*"})
@PrepareForTest({Realm.class, RealmQuery.class, RealmResults.class})
public class RealmManagerTest {
@Rule
public PowerMockRule rule = new PowerMockRule();
private RealmManager mRealmManager;
public Realm mockRealm() {
PowerMockito.mockStatic(Realm.class);
Realm mockRealm = mock(Realm.class);
RealmQuery<TestRealmModel> realmQuery = mock(RealmQuery.class);
RealmResults<TestRealmModel> realmResults = mock(RealmResults.class);
Observable observable = Observable.just(realmResults);
PowerMockito.when(mockRealm.where(TestRealmModel.class)).thenReturn(realmQuery);
PowerMockito.when(mockRealm.where(TestRealmModel.class).equalTo("id", 1L))
.thenReturn(realmQuery);
TestRealmModel value = new TestRealmModel();
PowerMockito.when(mockRealm.where(TestRealmModel.class).equalTo("id", 1L).findFirst())
.thenReturn(value);
PowerMockito.when(mockRealm.where(TestRealmModel.class).findAll()).thenReturn(realmResults);
PowerMockito.when(mockRealm.where(TestRealmModel.class).findAll().asObservable())
.thenReturn(observable);
PowerMockito.when(Realm.getDefaultInstance()).thenReturn(mockRealm);
RealmConfiguration realmConfiguration = mock(RealmConfiguration.class);
PowerMockito.when(mockRealm.getConfiguration()).thenReturn(realmConfiguration);
PowerMockito.when(Realm.getInstance(realmConfiguration)).thenReturn(mockRealm);
PowerMockito.when(mockRealm.copyFromRealm(value)).thenReturn(value);
return mockRealm;
}
@Before
public void before() {
mockRealm();
mRealmManager = new RealmManager();
}
@Test
public void getById() throws Exception {
// Flowable flowable = mRealmManager.getById("id", 1L, long.class, TestRealmModel.class);
//
// applyTestSubscriber(flowable);
//
// assertEquals(flowable.firstElement().blockingGet().getClass(), TestRealmModel.class);
}
@Test
public void getAll() throws Exception {
// Flowable flowable = mRealmManager.getAll(TestRealmModel.class);
//
// applyTestSubscriber(flowable);
//
// assertEquals(flowable.firstElement().blockingGet().getClass(), TestRealmModel.class);
}
private void applyTestSubscriber(Flowable flowable) {
TestSubscriber testSubscriber = new TestSubscriber<>();
flowable.subscribe(testSubscriber);
testSubscriber.assertNoErrors();
testSubscriber.assertSubscribed();
testSubscriber.assertComplete();
// testSubscriber.assertNotComplete();
// testSubscriber.assertNotTerminated();
}
@Test
public void getQuery() throws Exception {
// Flowable flowable = mRealmManager.getQuery(realm -> realm.where(TestRealmModel.class));
//
// applyTestSubscriber(flowable);
//
// assertEquals(flowable.firstElement().blockingGet().getClass(), TestRealmModel.class);
}
@Test
public void putJSONObject() throws Exception {
Single<Boolean> completable = mRealmManager.put(new JSONObject(new Gson()
.toJson(new TestRealmModel())), "id", int.class, TestRealmModel.class);
applyTestSubscriber(completable);
}
private void applyTestSubscriber(Single<Boolean> single) {
TestObserver<Boolean> testSubscriber = new TestObserver<>();
single.subscribe(testSubscriber);
testSubscriber.assertComplete();
}
@Test
public void putRealmModel() throws Exception {
Single<Boolean> completable = mRealmManager.put(new TestRealmModel(), TestRealmModel.class);
applyTestSubscriber(completable);
}
@Test
public void putAllJSONArray() throws Exception {
Single<Boolean> completable = mRealmManager.putAll(new JSONArray(), "id", int.class,
TestRealmModel.class);
applyTestSubscriber(completable);
}
@Test
public void putAllRealmObject() throws Exception {
Single<Boolean> completable = mRealmManager.putAll(new ArrayList<>(), TestRealmModel.class);
applyTestSubscriber(completable);
}
@Test
public void evictAll() throws Exception {
Single<Boolean> completable = mRealmManager.evictAll(TestRealmModel.class);
applyTestSubscriber(completable);
}
@Test
public void evictCollection() throws Exception {
Single<Boolean> completable =
mRealmManager.evictCollection("id", new ArrayList<>(), TestRealmModel.class);
applyTestSubscriber(completable);
}
@Test
public void evictById() throws Exception {
// assertEquals(mRealmManager.evictById(TestRealmModel.class, "id", 1), true);
}
}
| 5,968 | 0.712466 | 0.710456 | 164 | 35.390244 | 29.971636 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.646341 | false | false |
3
|
5e31d14ca5c3365a594c18a2ce38a4d51ca563f3
| 27,814,208,226,664 |
a389971e315e60ed5a43fdd874010c63a5de1af7
|
/trunk/src/com/businesshaps/am/server/user/UserManagerDAO.java
|
65c4216df7c2a7007eae8e855f3bba4932436c1b
|
[] |
no_license
|
ParkerHReed90/BattleNation
|
https://github.com/ParkerHReed90/BattleNation
|
c35b1f97c9967f99e03a475f7b86b0dc9f5c10ed
|
e98ab730190414e9aa92794bea7869b1e301cac1
|
refs/heads/master
| 2020-03-05T23:55:08.119000 | 2017-06-08T02:52:41 | 2017-06-08T02:52:41 | 93,700,449 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* <p>Title: UserManagerDAO</p>
* <p>Description:</p>
* @author bgude
* @version 1.0
*/
package com.businesshaps.am.server.user;
import com.businesshaps.am.businessobjects.AppUser;
import com.businesshaps.am.server.AppProperties;
import com.businesshaps.am.tools.GEncrypt;
import com.businesshaps.oi.ObInject;
import java.util.Arrays;
import java.util.Comparator;
public class UserManagerDAO implements UserManager {
private AppProperties props;
private ObInject obInject;
public UserManagerDAO(AppProperties props, String jdbc) {
this.props = props;
obInject = ObInject.getInstance(jdbc);
}
public AppUser[] getUser() {
AppUser[] rtns = (AppUser[]) obInject.get(AppUser.class, "");
for (AppUser u : rtns) {
u.setPassword(GEncrypt.decrypt(u.getPassword()));
}
Arrays.sort(rtns, new Comparator<AppUser>() {
public int compare(AppUser o1, AppUser o2) {
return new Integer(o2.getId()).compareTo(o1.getId());
}
});
return rtns;
}
public AppUser setUser(AppUser user) {
user.setPassword(GEncrypt.encrypt(user.getPassword()));
user = (AppUser) obInject.set(user);
user.setPassword(GEncrypt.decrypt(user.getPassword()));
return user;
}
public AppUser getUserByUserId(Integer userId) {
AppUser u = (AppUser) obInject.get(AppUser.class, userId);
if (u!=null) {
u.setPassword(GEncrypt.decrypt(u.getPassword()));
}
return u;
}
public AppUser getUserByUsername(String username) {
AppUser[] rtns = (AppUser[]) obInject.get(AppUser.class, " where username='"+username+"'");
for (AppUser u : rtns) {
u.setPassword(GEncrypt.decrypt(u.getPassword()));
}
if (rtns.length>0) {
return rtns[0];
}
return null;
}
public AppUser getUserByEmail(String email) {
AppUser[] rtns = (AppUser[]) obInject.get(AppUser.class, " where email='"+email+"'");
for (AppUser u : rtns) {
u.setPassword(GEncrypt.decrypt(u.getPassword()));
}
if (rtns.length>0) {
return rtns[0];
}
return null;
}
public void reload() {
}
public AppUser[] getUserBySupervisorUsername(String username) {
return new AppUser[0];
}
public AppUser[] getUserByFilter(String departments, String groupAlphaIds, String jobTitles, String softwareAccessGroupAlphaIds, String supervisorUsernames, String textSearch, boolean beingProvisioned) {
return new AppUser[0];
}
public void delete(AppUser user) {
}
}
|
UTF-8
|
Java
| 2,769 |
java
|
UserManagerDAO.java
|
Java
|
[
{
"context": "ManagerDAO</p>\r\n * <p>Description:</p>\r\n * @author bgude\r\n * @version 1.0\r\n */\r\n\r\npackage com.businesshaps",
"end": 78,
"score": 0.9997001886367798,
"start": 73,
"tag": "USERNAME",
"value": "bgude"
},
{
"context": "r (AppUser u : rtns) {\r\n u.setPassword(GEncrypt.decrypt(u.getPassword()));\r\n }\r\n \tif (rtns.leng",
"end": 2193,
"score": 0.6433145999908447,
"start": 2177,
"tag": "PASSWORD",
"value": "GEncrypt.decrypt"
}
] | null |
[] |
/**
* <p>Title: UserManagerDAO</p>
* <p>Description:</p>
* @author bgude
* @version 1.0
*/
package com.businesshaps.am.server.user;
import com.businesshaps.am.businessobjects.AppUser;
import com.businesshaps.am.server.AppProperties;
import com.businesshaps.am.tools.GEncrypt;
import com.businesshaps.oi.ObInject;
import java.util.Arrays;
import java.util.Comparator;
public class UserManagerDAO implements UserManager {
private AppProperties props;
private ObInject obInject;
public UserManagerDAO(AppProperties props, String jdbc) {
this.props = props;
obInject = ObInject.getInstance(jdbc);
}
public AppUser[] getUser() {
AppUser[] rtns = (AppUser[]) obInject.get(AppUser.class, "");
for (AppUser u : rtns) {
u.setPassword(GEncrypt.decrypt(u.getPassword()));
}
Arrays.sort(rtns, new Comparator<AppUser>() {
public int compare(AppUser o1, AppUser o2) {
return new Integer(o2.getId()).compareTo(o1.getId());
}
});
return rtns;
}
public AppUser setUser(AppUser user) {
user.setPassword(GEncrypt.encrypt(user.getPassword()));
user = (AppUser) obInject.set(user);
user.setPassword(GEncrypt.decrypt(user.getPassword()));
return user;
}
public AppUser getUserByUserId(Integer userId) {
AppUser u = (AppUser) obInject.get(AppUser.class, userId);
if (u!=null) {
u.setPassword(GEncrypt.decrypt(u.getPassword()));
}
return u;
}
public AppUser getUserByUsername(String username) {
AppUser[] rtns = (AppUser[]) obInject.get(AppUser.class, " where username='"+username+"'");
for (AppUser u : rtns) {
u.setPassword(GEncrypt.decrypt(u.getPassword()));
}
if (rtns.length>0) {
return rtns[0];
}
return null;
}
public AppUser getUserByEmail(String email) {
AppUser[] rtns = (AppUser[]) obInject.get(AppUser.class, " where email='"+email+"'");
for (AppUser u : rtns) {
u.setPassword(<PASSWORD>(u.getPassword()));
}
if (rtns.length>0) {
return rtns[0];
}
return null;
}
public void reload() {
}
public AppUser[] getUserBySupervisorUsername(String username) {
return new AppUser[0];
}
public AppUser[] getUserByFilter(String departments, String groupAlphaIds, String jobTitles, String softwareAccessGroupAlphaIds, String supervisorUsernames, String textSearch, boolean beingProvisioned) {
return new AppUser[0];
}
public void delete(AppUser user) {
}
}
| 2,763 | 0.607801 | 0.603467 | 94 | 27.457447 | 30.336996 | 207 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.585106 | false | false |
3
|
b00931ce519473bde671e3711e2b7be04c294e84
| 30,760,555,786,107 |
1bd1359976252eb8f8776580e4fff6771ac434bd
|
/HotelCheckIn/src/org/academiadecodigo/stormrooters/hotelcheckin/Client.java
|
918b53b3b0d90cf519436f6e1e51bdf94886cf4b
|
[] |
no_license
|
fabioferreirajc/bootcamp
|
https://github.com/fabioferreirajc/bootcamp
|
55ec9532078bcad1f096f9756e6e970dca8b0be4
|
d772cb0f5dda88b51a0510efbdc7ecd8b4c54506
|
refs/heads/master
| 2020-03-17T06:30:30.358000 | 2018-08-01T11:46:51 | 2018-08-01T11:46:51 | 133,358,621 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.academiadecodigo.stormrooters.hotelcheckin;
public class Client {
private String name;
private Hotel hotel;
public Person (String name) {
this.name=name;
}
}
|
UTF-8
|
Java
| 203 |
java
|
Client.java
|
Java
|
[] | null |
[] |
package org.academiadecodigo.stormrooters.hotelcheckin;
public class Client {
private String name;
private Hotel hotel;
public Person (String name) {
this.name=name;
}
}
| 203 | 0.665025 | 0.665025 | 17 | 10.941176 | 15.768436 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.235294 | false | false |
3
|
ad4c7fbd86ba18dcb3d0e95e7b95c94b559745bb
| 11,141,145,185,581 |
88d7a96e0daac19208c4230f4871b980b0bb5055
|
/.svn/pristine/07/07b37333843502b732da2310e34b39976db33978.svn-base
|
1e0046f4954089c7e0ba6d02ca173ecf87c4f999
|
[] |
no_license
|
maomspring/workspace
|
https://github.com/maomspring/workspace
|
2101e9873033f2ddf2cfa7d5a39c99d1dca8f95b
|
18027ebeca0385aa42e91813c7c6e276fc1ad6ea
|
refs/heads/master
| 2018-02-09T15:52:37.062000 | 2016-10-27T10:31:55 | 2016-10-27T10:31:55 | 48,180,641 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.transnal.lwz.goods.promotion.repository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;
import com.transnal.lwz.goods.promotion.entity.Promotion;
/**
* 版权所有:2015-传世科技
* 项目名称:lwz-jpa
*
* 类描述:
* 类名称:com.transnal.lwz.weigh.equipment.repository.EquipmentRepository
* 创建人:刘宏强
* 创建时间:2015年6月3日 下午6:01:25
* 修改人:
* 修改时间:2015年6月3日 下午6:01:25
* 修改备注:
* @version V1.0
*/
@Repository
public interface PromotionRepository extends PagingAndSortingRepository<Promotion, String> {
@Query("from Promotion where promotionCode = ?1")
Promotion findByPromotionCode(String promotionCode);
}
|
UTF-8
|
Java
| 877 |
07b37333843502b732da2310e34b39976db33978.svn-base
|
Java
|
[
{
"context": "ipment.repository.EquipmentRepository \n * 创建人:刘宏强 \n * 创建时间:2015年6月3日 下午6:01:25 \n * 修改人:\n * 修改时间:2",
"end": 434,
"score": 0.9998922348022461,
"start": 431,
"tag": "NAME",
"value": "刘宏强"
}
] | null |
[] |
package com.transnal.lwz.goods.promotion.repository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;
import com.transnal.lwz.goods.promotion.entity.Promotion;
/**
* 版权所有:2015-传世科技
* 项目名称:lwz-jpa
*
* 类描述:
* 类名称:com.transnal.lwz.weigh.equipment.repository.EquipmentRepository
* 创建人:刘宏强
* 创建时间:2015年6月3日 下午6:01:25
* 修改人:
* 修改时间:2015年6月3日 下午6:01:25
* 修改备注:
* @version V1.0
*/
@Repository
public interface PromotionRepository extends PagingAndSortingRepository<Promotion, String> {
@Query("from Promotion where promotionCode = ?1")
Promotion findByPromotionCode(String promotionCode);
}
| 877 | 0.751643 | 0.713535 | 31 | 23.548388 | 26.447561 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.290323 | false | false |
3
|
|
4e6451842b594823d534075572d98f51f2ddaff1
| 7,352,984,026,432 |
693d9d06bf003ff6911e47b154dc675c9ed7a544
|
/core/src/com/mygdx/game/tiledworld/Player.java
|
8c1452fb764aef9ff8d18c9d2e1b263e080e2f5d
|
[] |
no_license
|
C0d3GGz/CreationQuest
|
https://github.com/C0d3GGz/CreationQuest
|
9d17372be4878e770d1a9fa8db7716c6be4e94ee
|
c3ee54535de4d5c58d02546184da362b41fce8a1
|
refs/heads/master
| 2020-03-05T18:07:02.023000 | 2017-03-16T11:52:45 | 2017-03-16T11:52:45 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.mygdx.game.tiledworld;
import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.controllers.ControllerListener;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.maps.MapObject;
/**
* Main character class, instantiated and managed by {@link TiledWorld}.
*
*
* @author Matthias Gross
*
*/
public class Player extends Entity {
@SuppressWarnings("unused")
private static final String TAG = Player.class.getName();
/**
* Instantiates a {@link Player} with the given coordinates, movement speed,
* {@link Direction} to face, {@link Sprite} to be represented by and
* {@link TiledWorld} to be present in.
*
* @param x
* Cell-based x coordinate
* @param y
* Cell-based y coordinate
* @param sprt
* {@link Sprite} the {@link Player} will be represented by
* @param moveSpeed
* Speed the {@link Player} will move with, 1 meaning 100% or
* "normal" speed
* @param facing
* {@link Direction} the {@link Player} will be facing
* @param world
* {@link TiledWorld} the {@link Player} will be present in
*/
public Player(int x, int y, Sprite sprt, float moveSpeed, Direction facing, TiledWorld world) {
super(x, y, sprt, moveSpeed, facing, world);
}
/**
* Instantiates a Player at Position [0,0] with the specified Player
* {@link Sprite} in the {@link TiledWorld}.
*
* @param sprt
* {@link Sprite} the player will be represented by
* @param world
* {@link TiledWorld} to spawn the player in
*/
public Player(Sprite sprt, TiledWorld world) {
super(sprt, world);
}
/**
* Instantiates a Player at Position [0,0] with the specified Player
* {@link Texture} as a {@link Sprite} in the {@link TiledWorld}.
*
* @param tex
* {@link Texture} will be transformed into a {@link Sprite} the
* player will be represented by
* @param world
* {@link TiledWorld} to spawn the player in
*/
public Player(Texture tex, TiledWorld world) {
super(tex, world);
}
/**
* Instantiates a Player at the specified Position, represented by the
* {@link Sprite} in the {@link TiledWorld}.
*
* @param x
* Cell-based x coordinate
* @param y
* Cell-based y coordinate
* @param sprt
* {@link Sprite} the player will be represented by
* @param world
* {@link TiledWorld} to spawn the player in
*/
public Player(int x, int y, Sprite sprt, TiledWorld world) {
super(x, y, sprt, world);
}
/**
* Instantiates a Player at the specified Position, represented by the
* {@link Texture} as a {@link Sprite} in the {@link TiledWorld}.
*
* @param x
* Cell-based x coordinate
* @param y
* Cell-based y coordinate
* @param tex
* {@link Texture} will be transformed into a {@link Sprite} the
* player will be represented by
* @param world
* {@link TiledWorld} to spawn the player in
*/
public Player(int x, int y, Texture tex, TiledWorld world) {
super(x, y, tex, world);
// TODO FIX THIS not to be the only functioning constructor
comGen = new PlayerInputHandler(this);
}
public Player(MapObject mapObject, TiledWorld world) {
super(mapObject, world);
// TODO FIX THIS not to be the only functioning constructor
comGen = new PlayerInputHandler(this);
}
public InputProcessor getInputProcessor() {
return ((PlayerInputHandler) comGen).getPlayerInpAd();
}
public ControllerListener getControllerListener() {
return ((PlayerInputHandler) comGen).getPlayerContAd();
}
/*
* (non-Javadoc)
*
* @see com.mygdx.game.Entity#move(com.mygdx.game.Direction)
*/
@Override
public boolean move(Direction dir) {
// if (facing != dir)
boolean hasMoved = super.move(dir);
if (hasMoved) {
this.setChanged();
this.notifyObservers(PlayerEvents.PLAYER_MOVED);
}
return hasMoved;
}
/*
* (non-Javadoc)
*
* @see com.mygdx.game.Entity#isPlayer()
*/
@Override
public boolean isPlayer() {
return true;
}
@Override
public void reset() {
((PlayerInputHandler) comGen).reset();
super.reset();
}
}
|
UTF-8
|
Java
| 4,263 |
java
|
Player.java
|
Java
|
[
{
"context": " managed by {@link TiledWorld}.\n * \n * \n * @author Matthias Gross\n *\n */\npublic class Player extends Entity {\n\n\t@Su",
"end": 370,
"score": 0.999820351600647,
"start": 356,
"tag": "NAME",
"value": "Matthias Gross"
}
] | null |
[] |
package com.mygdx.game.tiledworld;
import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.controllers.ControllerListener;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.maps.MapObject;
/**
* Main character class, instantiated and managed by {@link TiledWorld}.
*
*
* @author <NAME>
*
*/
public class Player extends Entity {
@SuppressWarnings("unused")
private static final String TAG = Player.class.getName();
/**
* Instantiates a {@link Player} with the given coordinates, movement speed,
* {@link Direction} to face, {@link Sprite} to be represented by and
* {@link TiledWorld} to be present in.
*
* @param x
* Cell-based x coordinate
* @param y
* Cell-based y coordinate
* @param sprt
* {@link Sprite} the {@link Player} will be represented by
* @param moveSpeed
* Speed the {@link Player} will move with, 1 meaning 100% or
* "normal" speed
* @param facing
* {@link Direction} the {@link Player} will be facing
* @param world
* {@link TiledWorld} the {@link Player} will be present in
*/
public Player(int x, int y, Sprite sprt, float moveSpeed, Direction facing, TiledWorld world) {
super(x, y, sprt, moveSpeed, facing, world);
}
/**
* Instantiates a Player at Position [0,0] with the specified Player
* {@link Sprite} in the {@link TiledWorld}.
*
* @param sprt
* {@link Sprite} the player will be represented by
* @param world
* {@link TiledWorld} to spawn the player in
*/
public Player(Sprite sprt, TiledWorld world) {
super(sprt, world);
}
/**
* Instantiates a Player at Position [0,0] with the specified Player
* {@link Texture} as a {@link Sprite} in the {@link TiledWorld}.
*
* @param tex
* {@link Texture} will be transformed into a {@link Sprite} the
* player will be represented by
* @param world
* {@link TiledWorld} to spawn the player in
*/
public Player(Texture tex, TiledWorld world) {
super(tex, world);
}
/**
* Instantiates a Player at the specified Position, represented by the
* {@link Sprite} in the {@link TiledWorld}.
*
* @param x
* Cell-based x coordinate
* @param y
* Cell-based y coordinate
* @param sprt
* {@link Sprite} the player will be represented by
* @param world
* {@link TiledWorld} to spawn the player in
*/
public Player(int x, int y, Sprite sprt, TiledWorld world) {
super(x, y, sprt, world);
}
/**
* Instantiates a Player at the specified Position, represented by the
* {@link Texture} as a {@link Sprite} in the {@link TiledWorld}.
*
* @param x
* Cell-based x coordinate
* @param y
* Cell-based y coordinate
* @param tex
* {@link Texture} will be transformed into a {@link Sprite} the
* player will be represented by
* @param world
* {@link TiledWorld} to spawn the player in
*/
public Player(int x, int y, Texture tex, TiledWorld world) {
super(x, y, tex, world);
// TODO FIX THIS not to be the only functioning constructor
comGen = new PlayerInputHandler(this);
}
public Player(MapObject mapObject, TiledWorld world) {
super(mapObject, world);
// TODO FIX THIS not to be the only functioning constructor
comGen = new PlayerInputHandler(this);
}
public InputProcessor getInputProcessor() {
return ((PlayerInputHandler) comGen).getPlayerInpAd();
}
public ControllerListener getControllerListener() {
return ((PlayerInputHandler) comGen).getPlayerContAd();
}
/*
* (non-Javadoc)
*
* @see com.mygdx.game.Entity#move(com.mygdx.game.Direction)
*/
@Override
public boolean move(Direction dir) {
// if (facing != dir)
boolean hasMoved = super.move(dir);
if (hasMoved) {
this.setChanged();
this.notifyObservers(PlayerEvents.PLAYER_MOVED);
}
return hasMoved;
}
/*
* (non-Javadoc)
*
* @see com.mygdx.game.Entity#isPlayer()
*/
@Override
public boolean isPlayer() {
return true;
}
@Override
public void reset() {
((PlayerInputHandler) comGen).reset();
super.reset();
}
}
| 4,255 | 0.645789 | 0.643678 | 157 | 26.152866 | 24.76981 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.33121 | false | false |
3
|
7aefb7ad8c557614ef57f5e14095137625758bb9
| 11,493,332,500,508 |
c34fff80fab4b5aef8a36cbecf6192c88306eada
|
/thinking/src/com/wjs/critical/CriticalSection.java
|
1d6d05d91ab1364d152df375602fc2045cbcbe0b
|
[] |
no_license
|
wangjsh/thinking
|
https://github.com/wangjsh/thinking
|
c809377b6439de2e65afeba269905715323201aa
|
befd1450053dd266b4e5ab99978f67b7ab558c6a
|
refs/heads/master
| 2020-07-21T22:36:31.563000 | 2014-11-04T07:52:24 | 2014-11-04T07:52:24 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.wjs.critical;
import java.util.ArrayList;
import java.util.Collections;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
class Pair{
//not thread-safe
private int x,y;
public Pair(int x,int y)
{
this.x=x;
this.y=y;
}
public Pair()
{
this(0,0);
}
public int getX()
{
return x;
}
public int getY()
{
return y;
}
public void IncrementX()
{
x++;
}
public void IncrementY()
{
y++;
}
public String toString()
{
return "x: "+x+",y: "+y;
}
public class PairValuesNotEqualException extends RuntimeException{
public PairValuesNotEqualException()
{
super("Pair values not equal:"+Pair.this);
}
}
public void checkState()
{
if(x!=y)
{
throw new PairValuesNotEqualException();
}
}
}
// protect a Pair inside a thread-safe class:
abstract class PairManager{
AtomicInteger checkCounter=new AtomicInteger(0);
protected Pair p=new Pair();
private java.util.List<Pair> storage=Collections.synchronizedList(new ArrayList<Pair>());
public synchronized Pair getPair()
{
//Make a copy to keep the original safe
return new Pair(p.getX(),p.getY());
}
//assume this is a time consuming operation
protected void store(Pair p)
{
storage.add(p);
try {
TimeUnit.MILLISECONDS.sleep(50);
} catch (Exception e) {
// TODO: handle exception
}
}
public abstract void increment();
}
//synchronize the entire method:
class PairManager1 extends PairManager{
@Override
public synchronized void increment() {
// TODO Auto-generated method stub
p.IncrementX();
p.IncrementY();
store(getPair());
}
}
class PairManager2 extends PairManager{
@Override
public void increment() {
// TODO Auto-generated method stub
Pair temp;
synchronized(this)
{
p.IncrementX();
p.IncrementY();
temp=getPair();
}
store(temp);
}
}
class PairManipulator implements Runnable{
private PairManager pm;
public PairManipulator(PairManager pm) {
// TODO Auto-generated constructor stub
this.pm=pm;
}
@Override
public void run() {
// TODO Auto-generated method stub
while(true)
{
pm.increment();
}
}
public String toString()
{
return "Pair: "+pm.getPair()+" checkCounter= "+pm.checkCounter.get();
}
}
class PairChecker implements Runnable{
private PairManager pm;
public PairChecker(PairManager pm)
{
this.pm=pm;
}
@Override
public void run() {
// TODO Auto-generated method stub
while(true)
{
pm.checkCounter.incrementAndGet();
pm.getPair().checkState();
}
}
}
public class CriticalSection {
//test the two different approaches
static void testApproaches(PairManager pman1,PairManager pman2)
{
ExecutorService exec=Executors.newCachedThreadPool();
PairManipulator pm1=new PairManipulator(pman1),
pm2=new PairManipulator(pman2);
PairChecker pcheck1=new PairChecker(pman1),
pcheck2=new PairChecker(pman2);
exec.execute(pm1);
exec.execute(pm2);
exec.execute(pcheck1);
exec.execute(pcheck2);
try {
TimeUnit.MILLISECONDS.sleep(500);
} catch (Exception e) {
// TODO: handle exception
System.out.println("Sleep interrupted");
}
System.out.println("pm1: "+pm1+"\npm2: "+pm2);
System.exit(0);
}
public static void main(String[] args)
{
PairManager pman1=new PairManager1(),
pman2=new PairManager2();
testApproaches(pman1,pman2);
}
}
|
UTF-8
|
Java
| 3,444 |
java
|
CriticalSection.java
|
Java
|
[] | null |
[] |
package com.wjs.critical;
import java.util.ArrayList;
import java.util.Collections;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
class Pair{
//not thread-safe
private int x,y;
public Pair(int x,int y)
{
this.x=x;
this.y=y;
}
public Pair()
{
this(0,0);
}
public int getX()
{
return x;
}
public int getY()
{
return y;
}
public void IncrementX()
{
x++;
}
public void IncrementY()
{
y++;
}
public String toString()
{
return "x: "+x+",y: "+y;
}
public class PairValuesNotEqualException extends RuntimeException{
public PairValuesNotEqualException()
{
super("Pair values not equal:"+Pair.this);
}
}
public void checkState()
{
if(x!=y)
{
throw new PairValuesNotEqualException();
}
}
}
// protect a Pair inside a thread-safe class:
abstract class PairManager{
AtomicInteger checkCounter=new AtomicInteger(0);
protected Pair p=new Pair();
private java.util.List<Pair> storage=Collections.synchronizedList(new ArrayList<Pair>());
public synchronized Pair getPair()
{
//Make a copy to keep the original safe
return new Pair(p.getX(),p.getY());
}
//assume this is a time consuming operation
protected void store(Pair p)
{
storage.add(p);
try {
TimeUnit.MILLISECONDS.sleep(50);
} catch (Exception e) {
// TODO: handle exception
}
}
public abstract void increment();
}
//synchronize the entire method:
class PairManager1 extends PairManager{
@Override
public synchronized void increment() {
// TODO Auto-generated method stub
p.IncrementX();
p.IncrementY();
store(getPair());
}
}
class PairManager2 extends PairManager{
@Override
public void increment() {
// TODO Auto-generated method stub
Pair temp;
synchronized(this)
{
p.IncrementX();
p.IncrementY();
temp=getPair();
}
store(temp);
}
}
class PairManipulator implements Runnable{
private PairManager pm;
public PairManipulator(PairManager pm) {
// TODO Auto-generated constructor stub
this.pm=pm;
}
@Override
public void run() {
// TODO Auto-generated method stub
while(true)
{
pm.increment();
}
}
public String toString()
{
return "Pair: "+pm.getPair()+" checkCounter= "+pm.checkCounter.get();
}
}
class PairChecker implements Runnable{
private PairManager pm;
public PairChecker(PairManager pm)
{
this.pm=pm;
}
@Override
public void run() {
// TODO Auto-generated method stub
while(true)
{
pm.checkCounter.incrementAndGet();
pm.getPair().checkState();
}
}
}
public class CriticalSection {
//test the two different approaches
static void testApproaches(PairManager pman1,PairManager pman2)
{
ExecutorService exec=Executors.newCachedThreadPool();
PairManipulator pm1=new PairManipulator(pman1),
pm2=new PairManipulator(pman2);
PairChecker pcheck1=new PairChecker(pman1),
pcheck2=new PairChecker(pman2);
exec.execute(pm1);
exec.execute(pm2);
exec.execute(pcheck1);
exec.execute(pcheck2);
try {
TimeUnit.MILLISECONDS.sleep(500);
} catch (Exception e) {
// TODO: handle exception
System.out.println("Sleep interrupted");
}
System.out.println("pm1: "+pm1+"\npm2: "+pm2);
System.exit(0);
}
public static void main(String[] args)
{
PairManager pman1=new PairManager1(),
pman2=new PairManager2();
testApproaches(pman1,pman2);
}
}
| 3,444 | 0.697735 | 0.687573 | 175 | 18.68 | 17.466389 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.708571 | false | false |
3
|
4a62319e614d51ee16244d0effb297ce43c43d83
| 12,713,103,218,318 |
f78316e518baa388b7adf79a08b7cab118042775
|
/tp1/01-nesmid-shared/src/nesmid/util/Func.java
|
7f380328b742a8c5dbe13da20407606aea2cda07
|
[] |
no_license
|
zakariaouh/nsy208
|
https://github.com/zakariaouh/nsy208
|
652cf442a7fa9c290510fda46b45af07d6347a18
|
c82ef39e8414fb8adc6bfae9462325b624d87ebd
|
refs/heads/master
| 2020-03-31T06:43:31.018000 | 2018-10-07T23:08:06 | 2018-10-07T23:08:06 | 151,992,695 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package nesmid.util;
/**
*
* @author djamel bellebia
*
*/
import java.util.Calendar;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Stack;
public class Func extends Logger
{
public static byte[] resizeByteArray(byte[] _array, int _newSize)
{
byte[] newArray=new byte[_newSize];
System.arraycopy(_array,0,newArray,0,(_array.length < _newSize ? _array.length : _newSize));
return newArray;
}
public static String[] stringToArray(String a,String delimeter)
{
String c[] =null;
if(a!=null)
{
c =new String[0];
String b=a;
while (true)
{
int i=b.indexOf(delimeter);
String d=b;
if (i>=0)
d=b.substring(0,i);
String e[]=new String[c.length+1];
for (int k=0;k<c.length;k++)
e[k]=c[k];
e[e.length-1]=d;
c=e;
b=b.substring(i+delimeter.length(),b.length());
if (b.length()<=0 || i<0 )
break;
}
}
return c;
}
public static Hashtable stringToHashtable(String a,String delimeter)
{
Hashtable c = new Hashtable();
try
{
String b=a;
while (true)
{
int i=b.indexOf(delimeter);
String d=b;
if (i>=0)
d=b.substring(0,i);
c.put(new String(d), new String(d));
b=b.substring(i+delimeter.length(),b.length());
if (b.length()<=0 || i<0 )
break;
}
}
catch(Exception e)
{
System.out.println("Exception @ Functions.stringToHashtable" + e );
}
return c;
}
public static String getCurrentDate()
{
Calendar calendar = Calendar.getInstance();
return calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH)+1) + "-" + calendar.get(Calendar.DAY_OF_MONTH) ;
}
public static String getCurrentTime()
{
StringBuffer valRet = new StringBuffer("");
Calendar calendar = Calendar.getInstance();
int hour = calendar.get(Calendar.HOUR_OF_DAY);
int minute = calendar.get(Calendar.MINUTE);
int second = calendar.get(Calendar.SECOND);
valRet.append(hour + ":");
if(minute < 10)
valRet.append("0");
valRet.append(Integer.toString(minute));
valRet.append(":");
if(second < 10)
valRet.append("0");
valRet.append(Integer.toString(second));
return valRet.toString();
}
public static String arrayToString(Object[] array)
{
StringBuffer valRet = new StringBuffer("{");
for(int i= 0; i < array.length; i++)
{
if(i>0)
valRet.append("," + array[i].toString());
else
valRet.append(array[i].toString());
}
valRet.append("}");
return valRet.toString();
}
public static String stackToString(Stack table)
{
StringBuffer valRet = new StringBuffer("");
int i =0;
for(Enumeration e = table.elements(); e.hasMoreElements();)
{
if(i>0)
valRet.append( " ; " + e.nextElement() ) ;
else
valRet.append( e.nextElement() ) ;
i++;
}
valRet.append("");
return valRet.toString();
}
public static String hastableToString(Hashtable table)
{
StringBuffer valRet = new StringBuffer("");
int i =0;
for(Enumeration e = table.elements(); e.hasMoreElements();)
{
if(i>0)
valRet.append( " ; " + e.nextElement() ) ;
else
valRet.append( e.nextElement() ) ;
i++;
}
valRet.append("");
return valRet.toString();
}
public static String hastableWithKeysToString(Hashtable table)
{
StringBuffer valRet = new StringBuffer("");
int i =0;
Enumeration keys = table.keys();
for(Enumeration e = table.elements(); e.hasMoreElements();)
{
if(i>0)
valRet.append( " ;\n" + keys.nextElement() +"=" + e.nextElement() ) ;
else
valRet.append( keys.nextElement() +"=" + e.nextElement() ) ;
i++;
}
valRet.append("");
return valRet.toString();
}
public static String dump(byte[] data) throws Exception
{
StringBuffer valRet = new StringBuffer();
for(int i=0; i < data.length; i++)
{
valRet.append((char)data[i]);
}
return valRet.toString();
}
public void println(String str)
{
System.out.println(str);
}
}
|
UTF-8
|
Java
| 4,110 |
java
|
Func.java
|
Java
|
[
{
"context": "package nesmid.util;\n/**\n * \n * @author djamel bellebia\n *\n */\nimport java.util.Calendar;\nimport java.uti",
"end": 55,
"score": 0.998879611492157,
"start": 40,
"tag": "NAME",
"value": "djamel bellebia"
}
] | null |
[] |
package nesmid.util;
/**
*
* @author <NAME>
*
*/
import java.util.Calendar;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Stack;
public class Func extends Logger
{
public static byte[] resizeByteArray(byte[] _array, int _newSize)
{
byte[] newArray=new byte[_newSize];
System.arraycopy(_array,0,newArray,0,(_array.length < _newSize ? _array.length : _newSize));
return newArray;
}
public static String[] stringToArray(String a,String delimeter)
{
String c[] =null;
if(a!=null)
{
c =new String[0];
String b=a;
while (true)
{
int i=b.indexOf(delimeter);
String d=b;
if (i>=0)
d=b.substring(0,i);
String e[]=new String[c.length+1];
for (int k=0;k<c.length;k++)
e[k]=c[k];
e[e.length-1]=d;
c=e;
b=b.substring(i+delimeter.length(),b.length());
if (b.length()<=0 || i<0 )
break;
}
}
return c;
}
public static Hashtable stringToHashtable(String a,String delimeter)
{
Hashtable c = new Hashtable();
try
{
String b=a;
while (true)
{
int i=b.indexOf(delimeter);
String d=b;
if (i>=0)
d=b.substring(0,i);
c.put(new String(d), new String(d));
b=b.substring(i+delimeter.length(),b.length());
if (b.length()<=0 || i<0 )
break;
}
}
catch(Exception e)
{
System.out.println("Exception @ Functions.stringToHashtable" + e );
}
return c;
}
public static String getCurrentDate()
{
Calendar calendar = Calendar.getInstance();
return calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH)+1) + "-" + calendar.get(Calendar.DAY_OF_MONTH) ;
}
public static String getCurrentTime()
{
StringBuffer valRet = new StringBuffer("");
Calendar calendar = Calendar.getInstance();
int hour = calendar.get(Calendar.HOUR_OF_DAY);
int minute = calendar.get(Calendar.MINUTE);
int second = calendar.get(Calendar.SECOND);
valRet.append(hour + ":");
if(minute < 10)
valRet.append("0");
valRet.append(Integer.toString(minute));
valRet.append(":");
if(second < 10)
valRet.append("0");
valRet.append(Integer.toString(second));
return valRet.toString();
}
public static String arrayToString(Object[] array)
{
StringBuffer valRet = new StringBuffer("{");
for(int i= 0; i < array.length; i++)
{
if(i>0)
valRet.append("," + array[i].toString());
else
valRet.append(array[i].toString());
}
valRet.append("}");
return valRet.toString();
}
public static String stackToString(Stack table)
{
StringBuffer valRet = new StringBuffer("");
int i =0;
for(Enumeration e = table.elements(); e.hasMoreElements();)
{
if(i>0)
valRet.append( " ; " + e.nextElement() ) ;
else
valRet.append( e.nextElement() ) ;
i++;
}
valRet.append("");
return valRet.toString();
}
public static String hastableToString(Hashtable table)
{
StringBuffer valRet = new StringBuffer("");
int i =0;
for(Enumeration e = table.elements(); e.hasMoreElements();)
{
if(i>0)
valRet.append( " ; " + e.nextElement() ) ;
else
valRet.append( e.nextElement() ) ;
i++;
}
valRet.append("");
return valRet.toString();
}
public static String hastableWithKeysToString(Hashtable table)
{
StringBuffer valRet = new StringBuffer("");
int i =0;
Enumeration keys = table.keys();
for(Enumeration e = table.elements(); e.hasMoreElements();)
{
if(i>0)
valRet.append( " ;\n" + keys.nextElement() +"=" + e.nextElement() ) ;
else
valRet.append( keys.nextElement() +"=" + e.nextElement() ) ;
i++;
}
valRet.append("");
return valRet.toString();
}
public static String dump(byte[] data) throws Exception
{
StringBuffer valRet = new StringBuffer();
for(int i=0; i < data.length; i++)
{
valRet.append((char)data[i]);
}
return valRet.toString();
}
public void println(String str)
{
System.out.println(str);
}
}
| 4,101 | 0.599757 | 0.592457 | 219 | 17.767124 | 20.777702 | 123 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.47032 | false | false |
3
|
5a125e4e18f6ac4555da97d1bac620d4f331a746
| 21,251,498,205,882 |
4d66a64ca080287543f4c269f6c08c20a05e16ac
|
/src/main/java/com/ice/leetcode/TrapSolution.java
|
d53063d2696b0cef86e58b70d6d640c9add816e9
|
[] |
no_license
|
wangice/leetcode
|
https://github.com/wangice/leetcode
|
664879c4c415b1b77858034118c67ad7c7a3b081
|
344d05befb71504218d2b49a44f7f9ea482e7270
|
refs/heads/master
| 2020-05-02T05:28:14.823000 | 2019-03-28T02:28:36 | 2019-03-28T02:28:36 | 177,772,119 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.ice.leetcode;
/**
* @author ice
* @Date 2019/1/31 10:19
*/
public class TrapSolution {
public static void main(String[] args) {
TrapSolution trap = new TrapSolution();
int[] nums = {0, 1, 0, 2, 1, 0, 1, 3, 2, 1, 2, 1};
int sum = trap.trap(nums);
System.out.println(sum);
}
public int trap(int[] height) {
int x = 10;
;
int sum = 0;
int len = height.length;
if (len < 3)
return 0;
int leftHign = height[0];
int rightHgin = height[len - 1];
int left = 1;
int right = len - 2;
while (left <= right) {
if (leftHign < rightHgin) {
if (leftHign < height[left])
leftHign = height[left];
else
sum += leftHign - height[left];
left++;
} else {
if (rightHgin < height[right])
rightHgin = height[right];
else
sum += rightHgin - height[right];
right--;
}
}
return sum;
}
}
|
UTF-8
|
Java
| 1,146 |
java
|
TrapSolution.java
|
Java
|
[
{
"context": "package com.ice.leetcode;\n\n/**\n * @author ice\n * @Date 2019/1/31 10:19\n */\npublic class TrapSol",
"end": 45,
"score": 0.9955676794052124,
"start": 42,
"tag": "USERNAME",
"value": "ice"
}
] | null |
[] |
package com.ice.leetcode;
/**
* @author ice
* @Date 2019/1/31 10:19
*/
public class TrapSolution {
public static void main(String[] args) {
TrapSolution trap = new TrapSolution();
int[] nums = {0, 1, 0, 2, 1, 0, 1, 3, 2, 1, 2, 1};
int sum = trap.trap(nums);
System.out.println(sum);
}
public int trap(int[] height) {
int x = 10;
;
int sum = 0;
int len = height.length;
if (len < 3)
return 0;
int leftHign = height[0];
int rightHgin = height[len - 1];
int left = 1;
int right = len - 2;
while (left <= right) {
if (leftHign < rightHgin) {
if (leftHign < height[left])
leftHign = height[left];
else
sum += leftHign - height[left];
left++;
} else {
if (rightHgin < height[right])
rightHgin = height[right];
else
sum += rightHgin - height[right];
right--;
}
}
return sum;
}
}
| 1,146 | 0.434555 | 0.406632 | 44 | 25.045454 | 15.841479 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.727273 | false | false |
3
|
1f43a83d646edb593d88b3c7a9090ddb76e5d9f4
| 31,593,779,458,230 |
4efafadc04ac04770cc82b6220ae750fbf73cbb6
|
/src/classes/LoginClass.java
|
6ac194779c0d1615345f3df45391a4a7694e04ad
|
[] |
no_license
|
hansaniperera/LERM
|
https://github.com/hansaniperera/LERM
|
553240e968b6ab33625b9ebcd9d03104aa9fac12
|
718e34c1d306b511fcceb3c361eef8de1298b302
|
refs/heads/master
| 2020-12-01T07:39:15.451000 | 2019-12-28T08:51:47 | 2019-12-28T08:51:47 | 230,583,836 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package classes;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
*
* @author Hansani Perera
*/
public class LoginClass {
private static int loginStatus=0; //0-no one, 1-officer, 2-admin
private static String userName;
private static PreparedStatement pst1;
private static PreparedStatement pst2;
private static ResultSet rs1;
private static ResultSet rs2;
public static boolean login(String userName,String password) throws SQLException{
pst1=Db.connection().prepareStatement("select * from officer where username=? and pwd=?");
pst1.setString(1, userName);
pst1.setString(2, password);
rs1=pst1.executeQuery();
pst2=Db.connection().prepareStatement("select * from admin where username=? and password=?");
pst2.setString(1, userName);
pst2.setString(2, password);
rs2=pst2.executeQuery();
LoginClass.userName=userName;
if(rs1.next()){
loginStatus=1;
return true;
}else if(rs2.next()){
loginStatus=2;
return true;
}else{
return false;
}
}
public static String getUsername(){
return userName;
}
public static int getLoginStatus(){
return loginStatus;
}
public static void setUserName(String name){
LoginClass.userName = name;
}
public static void logout(){
userName=null;
loginStatus=0;
}
}
|
UTF-8
|
Java
| 1,799 |
java
|
LoginClass.java
|
Java
|
[
{
"context": ";\nimport java.sql.SQLException;\n\n/**\n *\n * @author Hansani Perera\n */\npublic class LoginClass {\n \n private st",
"end": 328,
"score": 0.9998846054077148,
"start": 314,
"tag": "NAME",
"value": "Hansani Perera"
},
{
"context": "name=? and password=?\");\n pst2.setString(1, userName);\n pst2.setString(2, password);\n rs",
"end": 1065,
"score": 0.8204664587974548,
"start": 1057,
"tag": "USERNAME",
"value": "userName"
},
{
"context": "cuteQuery();\n \n LoginClass.userName=userName;\n if(rs1.next()){\n loginStatus=",
"end": 1183,
"score": 0.885934591293335,
"start": 1175,
"tag": "USERNAME",
"value": "userName"
},
{
"context": "public static String getUsername(){\n return userName;\n }\n public static int getLoginStatus(){\n ",
"end": 1529,
"score": 0.7477391362190247,
"start": 1521,
"tag": "USERNAME",
"value": "userName"
}
] | 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 classes;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
*
* @author <NAME>
*/
public class LoginClass {
private static int loginStatus=0; //0-no one, 1-officer, 2-admin
private static String userName;
private static PreparedStatement pst1;
private static PreparedStatement pst2;
private static ResultSet rs1;
private static ResultSet rs2;
public static boolean login(String userName,String password) throws SQLException{
pst1=Db.connection().prepareStatement("select * from officer where username=? and pwd=?");
pst1.setString(1, userName);
pst1.setString(2, password);
rs1=pst1.executeQuery();
pst2=Db.connection().prepareStatement("select * from admin where username=? and password=?");
pst2.setString(1, userName);
pst2.setString(2, password);
rs2=pst2.executeQuery();
LoginClass.userName=userName;
if(rs1.next()){
loginStatus=1;
return true;
}else if(rs2.next()){
loginStatus=2;
return true;
}else{
return false;
}
}
public static String getUsername(){
return userName;
}
public static int getLoginStatus(){
return loginStatus;
}
public static void setUserName(String name){
LoginClass.userName = name;
}
public static void logout(){
userName=null;
loginStatus=0;
}
}
| 1,791 | 0.609783 | 0.594775 | 66 | 26.257576 | 22.479156 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.590909 | false | false |
3
|
6d2b0bcbf342f8cc1b91b425dfd3800d280a5fe6
| 26,955,214,789,100 |
e04450a2a874d0607dff8c6efcfd650bfd31b3bb
|
/src/main/java/im.vinci/server/search/controller/MusicSearchController.java
|
eaf2057d9943c57a6d1c563af9f7f6c63eed13df
|
[] |
no_license
|
ZhangshanWork/zsRep
|
https://github.com/ZhangshanWork/zsRep
|
3423327d8688405f9480eeb0bbdcf8ff1107a48c
|
b6d3b4ad705f9495dba036b12151418acb6c68cb
|
refs/heads/master
| 2020-07-25T14:37:50.780000 | 2016-11-11T11:11:00 | 2016-11-11T11:11:00 | 73,774,076 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package im.vinci.server.search.controller;
import com.google.common.collect.Lists;
import im.vinci.server.common.exceptions.VinciException;
import im.vinci.server.search.domain.music.MusicAlbum;
import im.vinci.server.search.domain.music.MusicSong;
import im.vinci.server.search.domain.music.MusicUserTags;
import im.vinci.server.search.service.XiamiMusicSearchService;
import im.vinci.server.utils.apiresp.APIResponse;
import im.vinci.server.utils.apiresp.ResponsePageVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Created by tim@vinci on 15/11/26.
* 歌曲搜索接口
*/
@RestController
@RequestMapping(
value = {"","/vinci/music"},
produces = "application/json;charset=UTF-8"
)
public class MusicSearchController {
private Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private XiamiMusicSearchService musicSearch;
@RequestMapping(value = "/song/{song_id}", method = RequestMethod.GET)
public APIResponse<MusicSong> searchMusicSong(@PathVariable("song_id") long songId)
throws Exception {
MusicSong song = musicSearch.getSongDetailById(songId);
if (song != null) {
try {
List<MusicUserTags> tags = musicSearch.getTagTags("song",songId);
if (tags != null) {
song.setTags(Lists.newArrayList());
song.setTagCounts(Lists.newArrayList());
for (MusicUserTags t : tags) {
if (t != null && StringUtils.hasText(t.getTagName())) {
song.getTags().add(t.getTagName());
song.getTagCounts().add(t.getCount());
}
}
}
}catch (Exception e) {
logger.warn("获取音乐tag({})出错:{}",songId,e.toString());
}
}
return APIResponse.returnSuccess(song);
}
@RequestMapping(value = "/album/{album_id}", method = RequestMethod.GET)
public APIResponse<MusicAlbum> searchMusicAlbum(@PathVariable("album_id") long albumId)
throws Exception {
return APIResponse.returnSuccess(musicSearch.getAlbumDetailById(albumId));
}
@RequestMapping(value = "/song/search/{keyword}", method = RequestMethod.GET)
public APIResponse<ResponsePageVo<MusicSong>> searchMusicSongByKeyword(@PathVariable("keyword") String keyword,
@RequestParam(value = "page",defaultValue = "1") int page,
@RequestParam(value = "page_size",defaultValue = "10") int pageSize)
throws Exception {
return APIResponse.returnSuccess(musicSearch.searchSongsByKeyword(keyword,page,pageSize));
}
@RequestMapping(value = "/album/search/{keyword}", method = RequestMethod.GET)
public APIResponse<ResponsePageVo<MusicAlbum>> searchMusicAlbumByKeyword(@PathVariable("keyword") String keyword,
@RequestParam(value = "page",defaultValue = "1") int page,
@RequestParam(value = "page_size",defaultValue = "10") int pageSize)
throws Exception {
return APIResponse.returnSuccess(musicSearch.searchAlbumsByKeyword(keyword, page, pageSize));
}
@RequestMapping(value = "/search/tags", method = RequestMethod.GET)
public APIResponse<List<MusicUserTags>> getTagTags(@RequestParam("type") String type,
@RequestParam("id") long id)
throws Exception {
return APIResponse.returnSuccess(musicSearch.getTagTags(type, id));
}
@ExceptionHandler(value = VinciException.class)
@ResponseStatus(value = HttpStatus.OK)
@ResponseBody
public APIResponse handleDeviceExceptions(VinciException ex) {
return APIResponse.returnFail(ex.getErrorCode(),ex.getErrorMsgToUser());
}
}
|
UTF-8
|
Java
| 4,335 |
java
|
MusicSearchController.java
|
Java
|
[
{
"context": "ation.*;\n\nimport java.util.List;\n/**\n * Created by tim@vinci on 15/11/26.\n * 歌曲搜索接口\n */\n@RestController\n@Reque",
"end": 784,
"score": 0.9941094517707825,
"start": 775,
"tag": "USERNAME",
"value": "tim@vinci"
}
] | null |
[] |
package im.vinci.server.search.controller;
import com.google.common.collect.Lists;
import im.vinci.server.common.exceptions.VinciException;
import im.vinci.server.search.domain.music.MusicAlbum;
import im.vinci.server.search.domain.music.MusicSong;
import im.vinci.server.search.domain.music.MusicUserTags;
import im.vinci.server.search.service.XiamiMusicSearchService;
import im.vinci.server.utils.apiresp.APIResponse;
import im.vinci.server.utils.apiresp.ResponsePageVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Created by tim@vinci on 15/11/26.
* 歌曲搜索接口
*/
@RestController
@RequestMapping(
value = {"","/vinci/music"},
produces = "application/json;charset=UTF-8"
)
public class MusicSearchController {
private Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private XiamiMusicSearchService musicSearch;
@RequestMapping(value = "/song/{song_id}", method = RequestMethod.GET)
public APIResponse<MusicSong> searchMusicSong(@PathVariable("song_id") long songId)
throws Exception {
MusicSong song = musicSearch.getSongDetailById(songId);
if (song != null) {
try {
List<MusicUserTags> tags = musicSearch.getTagTags("song",songId);
if (tags != null) {
song.setTags(Lists.newArrayList());
song.setTagCounts(Lists.newArrayList());
for (MusicUserTags t : tags) {
if (t != null && StringUtils.hasText(t.getTagName())) {
song.getTags().add(t.getTagName());
song.getTagCounts().add(t.getCount());
}
}
}
}catch (Exception e) {
logger.warn("获取音乐tag({})出错:{}",songId,e.toString());
}
}
return APIResponse.returnSuccess(song);
}
@RequestMapping(value = "/album/{album_id}", method = RequestMethod.GET)
public APIResponse<MusicAlbum> searchMusicAlbum(@PathVariable("album_id") long albumId)
throws Exception {
return APIResponse.returnSuccess(musicSearch.getAlbumDetailById(albumId));
}
@RequestMapping(value = "/song/search/{keyword}", method = RequestMethod.GET)
public APIResponse<ResponsePageVo<MusicSong>> searchMusicSongByKeyword(@PathVariable("keyword") String keyword,
@RequestParam(value = "page",defaultValue = "1") int page,
@RequestParam(value = "page_size",defaultValue = "10") int pageSize)
throws Exception {
return APIResponse.returnSuccess(musicSearch.searchSongsByKeyword(keyword,page,pageSize));
}
@RequestMapping(value = "/album/search/{keyword}", method = RequestMethod.GET)
public APIResponse<ResponsePageVo<MusicAlbum>> searchMusicAlbumByKeyword(@PathVariable("keyword") String keyword,
@RequestParam(value = "page",defaultValue = "1") int page,
@RequestParam(value = "page_size",defaultValue = "10") int pageSize)
throws Exception {
return APIResponse.returnSuccess(musicSearch.searchAlbumsByKeyword(keyword, page, pageSize));
}
@RequestMapping(value = "/search/tags", method = RequestMethod.GET)
public APIResponse<List<MusicUserTags>> getTagTags(@RequestParam("type") String type,
@RequestParam("id") long id)
throws Exception {
return APIResponse.returnSuccess(musicSearch.getTagTags(type, id));
}
@ExceptionHandler(value = VinciException.class)
@ResponseStatus(value = HttpStatus.OK)
@ResponseBody
public APIResponse handleDeviceExceptions(VinciException ex) {
return APIResponse.returnFail(ex.getErrorCode(),ex.getErrorMsgToUser());
}
}
| 4,335 | 0.623985 | 0.620506 | 95 | 44.378948 | 36.385704 | 145 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false |
3
|
b7c77784a11c69bb1f4e5683b97df08d88822a8e
| 28,484,223,143,609 |
cb2e0b45e47ebeb518f1c8d7d12dfa0680aed01c
|
/openbanking-api-client/src/main/gen/com/laegler/openbanking/model/OBReadProduct2DataOtherProductTypeRepayment.java
|
a10ed9f4835168f7ccecf4e63b44bca4f0bc0de1
|
[
"MIT"
] |
permissive
|
thlaegler/openbanking
|
https://github.com/thlaegler/openbanking
|
4909cc9e580210267874c231a79979c7c6ec64d8
|
924a29ac8c0638622fba7a5674c21c803d6dc5a9
|
refs/heads/develop
| 2022-12-23T15:50:28.827000 | 2019-10-30T09:11:26 | 2019-10-31T05:43:04 | 213,506,933 | 1 | 0 |
MIT
| false | 2022-11-16T11:55:44 | 2019-10-07T23:39:49 | 2019-10-31T05:43:21 | 2022-11-16T11:55:41 | 17,605 | 0 | 0 | 5 |
HTML
| false | false |
package com.laegler.openbanking.model;
import com.laegler.openbanking.model.OBReadProduct2DataOtherProductTypeRepaymentOtherAmountType;
import com.laegler.openbanking.model.OBReadProduct2DataOtherProductTypeRepaymentOtherRepaymentFrequency;
import com.laegler.openbanking.model.OBReadProduct2DataOtherProductTypeRepaymentOtherRepaymentType;
import com.laegler.openbanking.model.OBReadProduct2DataOtherProductTypeRepaymentRepaymentFeeCharges;
import com.laegler.openbanking.model.OBReadProduct2DataOtherProductTypeRepaymentRepaymentHoliday;
import io.swagger.annotations.ApiModel;
import java.util.ArrayList;
import java.util.List;
import io.swagger.annotations.ApiModelProperty;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Repayment details of the Loan product
**/
@ApiModel(description="Repayment details of the Loan product")
public class OBReadProduct2DataOtherProductTypeRepayment {
@XmlType(name="AmountTypeEnum")
@XmlEnum(String.class)
public enum AmountTypeEnum {
@XmlEnumValue("RABD") RABD(String.valueOf("RABD")), @XmlEnumValue("RABL") RABL(String.valueOf("RABL")), @XmlEnumValue("RACI") RACI(String.valueOf("RACI")), @XmlEnumValue("RAFC") RAFC(String.valueOf("RAFC")), @XmlEnumValue("RAIO") RAIO(String.valueOf("RAIO")), @XmlEnumValue("RALT") RALT(String.valueOf("RALT")), @XmlEnumValue("USOT") USOT(String.valueOf("USOT"));
private String value;
AmountTypeEnum (String v) {
value = v;
}
public String value() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static AmountTypeEnum fromValue(String v) {
for (AmountTypeEnum b : AmountTypeEnum.values()) {
if (String.valueOf(b.value).equals(v)) {
return b;
}
}
return null;
}
}
@ApiModelProperty(value = "The repayment is for paying just the interest only or both interest and capital or bullet amount or balance to date etc")
/**
* The repayment is for paying just the interest only or both interest and capital or bullet amount or balance to date etc
**/
private AmountTypeEnum amountType = null;
@ApiModelProperty(value = "")
private List<String> notes = null;
@ApiModelProperty(value = "")
private OBReadProduct2DataOtherProductTypeRepaymentOtherAmountType otherAmountType = null;
@ApiModelProperty(value = "")
private OBReadProduct2DataOtherProductTypeRepaymentOtherRepaymentFrequency otherRepaymentFrequency = null;
@ApiModelProperty(value = "")
private OBReadProduct2DataOtherProductTypeRepaymentOtherRepaymentType otherRepaymentType = null;
@ApiModelProperty(value = "")
private OBReadProduct2DataOtherProductTypeRepaymentRepaymentFeeCharges repaymentFeeCharges = null;
@XmlType(name="RepaymentFrequencyEnum")
@XmlEnum(String.class)
public enum RepaymentFrequencyEnum {
@XmlEnumValue("SMDA") SMDA(String.valueOf("SMDA")), @XmlEnumValue("SMFL") SMFL(String.valueOf("SMFL")), @XmlEnumValue("SMFO") SMFO(String.valueOf("SMFO")), @XmlEnumValue("SMHY") SMHY(String.valueOf("SMHY")), @XmlEnumValue("SMMO") SMMO(String.valueOf("SMMO")), @XmlEnumValue("SMOT") SMOT(String.valueOf("SMOT")), @XmlEnumValue("SMQU") SMQU(String.valueOf("SMQU")), @XmlEnumValue("SMWE") SMWE(String.valueOf("SMWE")), @XmlEnumValue("SMYE") SMYE(String.valueOf("SMYE"));
private String value;
RepaymentFrequencyEnum (String v) {
value = v;
}
public String value() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static RepaymentFrequencyEnum fromValue(String v) {
for (RepaymentFrequencyEnum b : RepaymentFrequencyEnum.values()) {
if (String.valueOf(b.value).equals(v)) {
return b;
}
}
return null;
}
}
@ApiModelProperty(value = "Repayment frequency")
/**
* Repayment frequency
**/
private RepaymentFrequencyEnum repaymentFrequency = null;
@ApiModelProperty(value = "")
private List<OBReadProduct2DataOtherProductTypeRepaymentRepaymentHoliday> repaymentHoliday = null;
@XmlType(name="RepaymentTypeEnum")
@XmlEnum(String.class)
public enum RepaymentTypeEnum {
@XmlEnumValue("USBA") USBA(String.valueOf("USBA")), @XmlEnumValue("USBU") USBU(String.valueOf("USBU")), @XmlEnumValue("USCI") USCI(String.valueOf("USCI")), @XmlEnumValue("USCS") USCS(String.valueOf("USCS")), @XmlEnumValue("USER") USER(String.valueOf("USER")), @XmlEnumValue("USFA") USFA(String.valueOf("USFA")), @XmlEnumValue("USFB") USFB(String.valueOf("USFB")), @XmlEnumValue("USFI") USFI(String.valueOf("USFI")), @XmlEnumValue("USIO") USIO(String.valueOf("USIO")), @XmlEnumValue("USOT") USOT(String.valueOf("USOT")), @XmlEnumValue("USPF") USPF(String.valueOf("USPF")), @XmlEnumValue("USRW") USRW(String.valueOf("USRW")), @XmlEnumValue("USSL") USSL(String.valueOf("USSL"));
private String value;
RepaymentTypeEnum (String v) {
value = v;
}
public String value() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static RepaymentTypeEnum fromValue(String v) {
for (RepaymentTypeEnum b : RepaymentTypeEnum.values()) {
if (String.valueOf(b.value).equals(v)) {
return b;
}
}
return null;
}
}
@ApiModelProperty(value = "Repayment type")
/**
* Repayment type
**/
private RepaymentTypeEnum repaymentType = null;
/**
* The repayment is for paying just the interest only or both interest and capital or bullet amount or balance to date etc
* @return amountType
**/
@JsonProperty("AmountType")
public String getAmountType() {
if (amountType == null) {
return null;
}
return amountType.value();
}
public void setAmountType(AmountTypeEnum amountType) {
this.amountType = amountType;
}
public OBReadProduct2DataOtherProductTypeRepayment amountType(AmountTypeEnum amountType) {
this.amountType = amountType;
return this;
}
/**
* Get notes
* @return notes
**/
@JsonProperty("Notes")
public List<String> getNotes() {
return notes;
}
public void setNotes(List<String> notes) {
this.notes = notes;
}
public OBReadProduct2DataOtherProductTypeRepayment notes(List<String> notes) {
this.notes = notes;
return this;
}
public OBReadProduct2DataOtherProductTypeRepayment addNotesItem(String notesItem) {
this.notes.add(notesItem);
return this;
}
/**
* Get otherAmountType
* @return otherAmountType
**/
@JsonProperty("OtherAmountType")
public OBReadProduct2DataOtherProductTypeRepaymentOtherAmountType getOtherAmountType() {
return otherAmountType;
}
public void setOtherAmountType(OBReadProduct2DataOtherProductTypeRepaymentOtherAmountType otherAmountType) {
this.otherAmountType = otherAmountType;
}
public OBReadProduct2DataOtherProductTypeRepayment otherAmountType(OBReadProduct2DataOtherProductTypeRepaymentOtherAmountType otherAmountType) {
this.otherAmountType = otherAmountType;
return this;
}
/**
* Get otherRepaymentFrequency
* @return otherRepaymentFrequency
**/
@JsonProperty("OtherRepaymentFrequency")
public OBReadProduct2DataOtherProductTypeRepaymentOtherRepaymentFrequency getOtherRepaymentFrequency() {
return otherRepaymentFrequency;
}
public void setOtherRepaymentFrequency(OBReadProduct2DataOtherProductTypeRepaymentOtherRepaymentFrequency otherRepaymentFrequency) {
this.otherRepaymentFrequency = otherRepaymentFrequency;
}
public OBReadProduct2DataOtherProductTypeRepayment otherRepaymentFrequency(OBReadProduct2DataOtherProductTypeRepaymentOtherRepaymentFrequency otherRepaymentFrequency) {
this.otherRepaymentFrequency = otherRepaymentFrequency;
return this;
}
/**
* Get otherRepaymentType
* @return otherRepaymentType
**/
@JsonProperty("OtherRepaymentType")
public OBReadProduct2DataOtherProductTypeRepaymentOtherRepaymentType getOtherRepaymentType() {
return otherRepaymentType;
}
public void setOtherRepaymentType(OBReadProduct2DataOtherProductTypeRepaymentOtherRepaymentType otherRepaymentType) {
this.otherRepaymentType = otherRepaymentType;
}
public OBReadProduct2DataOtherProductTypeRepayment otherRepaymentType(OBReadProduct2DataOtherProductTypeRepaymentOtherRepaymentType otherRepaymentType) {
this.otherRepaymentType = otherRepaymentType;
return this;
}
/**
* Get repaymentFeeCharges
* @return repaymentFeeCharges
**/
@JsonProperty("RepaymentFeeCharges")
public OBReadProduct2DataOtherProductTypeRepaymentRepaymentFeeCharges getRepaymentFeeCharges() {
return repaymentFeeCharges;
}
public void setRepaymentFeeCharges(OBReadProduct2DataOtherProductTypeRepaymentRepaymentFeeCharges repaymentFeeCharges) {
this.repaymentFeeCharges = repaymentFeeCharges;
}
public OBReadProduct2DataOtherProductTypeRepayment repaymentFeeCharges(OBReadProduct2DataOtherProductTypeRepaymentRepaymentFeeCharges repaymentFeeCharges) {
this.repaymentFeeCharges = repaymentFeeCharges;
return this;
}
/**
* Repayment frequency
* @return repaymentFrequency
**/
@JsonProperty("RepaymentFrequency")
public String getRepaymentFrequency() {
if (repaymentFrequency == null) {
return null;
}
return repaymentFrequency.value();
}
public void setRepaymentFrequency(RepaymentFrequencyEnum repaymentFrequency) {
this.repaymentFrequency = repaymentFrequency;
}
public OBReadProduct2DataOtherProductTypeRepayment repaymentFrequency(RepaymentFrequencyEnum repaymentFrequency) {
this.repaymentFrequency = repaymentFrequency;
return this;
}
/**
* Get repaymentHoliday
* @return repaymentHoliday
**/
@JsonProperty("RepaymentHoliday")
public List<OBReadProduct2DataOtherProductTypeRepaymentRepaymentHoliday> getRepaymentHoliday() {
return repaymentHoliday;
}
public void setRepaymentHoliday(List<OBReadProduct2DataOtherProductTypeRepaymentRepaymentHoliday> repaymentHoliday) {
this.repaymentHoliday = repaymentHoliday;
}
public OBReadProduct2DataOtherProductTypeRepayment repaymentHoliday(List<OBReadProduct2DataOtherProductTypeRepaymentRepaymentHoliday> repaymentHoliday) {
this.repaymentHoliday = repaymentHoliday;
return this;
}
public OBReadProduct2DataOtherProductTypeRepayment addRepaymentHolidayItem(OBReadProduct2DataOtherProductTypeRepaymentRepaymentHoliday repaymentHolidayItem) {
this.repaymentHoliday.add(repaymentHolidayItem);
return this;
}
/**
* Repayment type
* @return repaymentType
**/
@JsonProperty("RepaymentType")
public String getRepaymentType() {
if (repaymentType == null) {
return null;
}
return repaymentType.value();
}
public void setRepaymentType(RepaymentTypeEnum repaymentType) {
this.repaymentType = repaymentType;
}
public OBReadProduct2DataOtherProductTypeRepayment repaymentType(RepaymentTypeEnum repaymentType) {
this.repaymentType = repaymentType;
return this;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class OBReadProduct2DataOtherProductTypeRepayment {\n");
sb.append(" amountType: ").append(toIndentedString(amountType)).append("\n");
sb.append(" notes: ").append(toIndentedString(notes)).append("\n");
sb.append(" otherAmountType: ").append(toIndentedString(otherAmountType)).append("\n");
sb.append(" otherRepaymentFrequency: ").append(toIndentedString(otherRepaymentFrequency)).append("\n");
sb.append(" otherRepaymentType: ").append(toIndentedString(otherRepaymentType)).append("\n");
sb.append(" repaymentFeeCharges: ").append(toIndentedString(repaymentFeeCharges)).append("\n");
sb.append(" repaymentFrequency: ").append(toIndentedString(repaymentFrequency)).append("\n");
sb.append(" repaymentHoliday: ").append(toIndentedString(repaymentHoliday)).append("\n");
sb.append(" repaymentType: ").append(toIndentedString(repaymentType)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private static String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
|
UTF-8
|
Java
| 12,817 |
java
|
OBReadProduct2DataOtherProductTypeRepayment.java
|
Java
|
[] | null |
[] |
package com.laegler.openbanking.model;
import com.laegler.openbanking.model.OBReadProduct2DataOtherProductTypeRepaymentOtherAmountType;
import com.laegler.openbanking.model.OBReadProduct2DataOtherProductTypeRepaymentOtherRepaymentFrequency;
import com.laegler.openbanking.model.OBReadProduct2DataOtherProductTypeRepaymentOtherRepaymentType;
import com.laegler.openbanking.model.OBReadProduct2DataOtherProductTypeRepaymentRepaymentFeeCharges;
import com.laegler.openbanking.model.OBReadProduct2DataOtherProductTypeRepaymentRepaymentHoliday;
import io.swagger.annotations.ApiModel;
import java.util.ArrayList;
import java.util.List;
import io.swagger.annotations.ApiModelProperty;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Repayment details of the Loan product
**/
@ApiModel(description="Repayment details of the Loan product")
public class OBReadProduct2DataOtherProductTypeRepayment {
@XmlType(name="AmountTypeEnum")
@XmlEnum(String.class)
public enum AmountTypeEnum {
@XmlEnumValue("RABD") RABD(String.valueOf("RABD")), @XmlEnumValue("RABL") RABL(String.valueOf("RABL")), @XmlEnumValue("RACI") RACI(String.valueOf("RACI")), @XmlEnumValue("RAFC") RAFC(String.valueOf("RAFC")), @XmlEnumValue("RAIO") RAIO(String.valueOf("RAIO")), @XmlEnumValue("RALT") RALT(String.valueOf("RALT")), @XmlEnumValue("USOT") USOT(String.valueOf("USOT"));
private String value;
AmountTypeEnum (String v) {
value = v;
}
public String value() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static AmountTypeEnum fromValue(String v) {
for (AmountTypeEnum b : AmountTypeEnum.values()) {
if (String.valueOf(b.value).equals(v)) {
return b;
}
}
return null;
}
}
@ApiModelProperty(value = "The repayment is for paying just the interest only or both interest and capital or bullet amount or balance to date etc")
/**
* The repayment is for paying just the interest only or both interest and capital or bullet amount or balance to date etc
**/
private AmountTypeEnum amountType = null;
@ApiModelProperty(value = "")
private List<String> notes = null;
@ApiModelProperty(value = "")
private OBReadProduct2DataOtherProductTypeRepaymentOtherAmountType otherAmountType = null;
@ApiModelProperty(value = "")
private OBReadProduct2DataOtherProductTypeRepaymentOtherRepaymentFrequency otherRepaymentFrequency = null;
@ApiModelProperty(value = "")
private OBReadProduct2DataOtherProductTypeRepaymentOtherRepaymentType otherRepaymentType = null;
@ApiModelProperty(value = "")
private OBReadProduct2DataOtherProductTypeRepaymentRepaymentFeeCharges repaymentFeeCharges = null;
@XmlType(name="RepaymentFrequencyEnum")
@XmlEnum(String.class)
public enum RepaymentFrequencyEnum {
@XmlEnumValue("SMDA") SMDA(String.valueOf("SMDA")), @XmlEnumValue("SMFL") SMFL(String.valueOf("SMFL")), @XmlEnumValue("SMFO") SMFO(String.valueOf("SMFO")), @XmlEnumValue("SMHY") SMHY(String.valueOf("SMHY")), @XmlEnumValue("SMMO") SMMO(String.valueOf("SMMO")), @XmlEnumValue("SMOT") SMOT(String.valueOf("SMOT")), @XmlEnumValue("SMQU") SMQU(String.valueOf("SMQU")), @XmlEnumValue("SMWE") SMWE(String.valueOf("SMWE")), @XmlEnumValue("SMYE") SMYE(String.valueOf("SMYE"));
private String value;
RepaymentFrequencyEnum (String v) {
value = v;
}
public String value() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static RepaymentFrequencyEnum fromValue(String v) {
for (RepaymentFrequencyEnum b : RepaymentFrequencyEnum.values()) {
if (String.valueOf(b.value).equals(v)) {
return b;
}
}
return null;
}
}
@ApiModelProperty(value = "Repayment frequency")
/**
* Repayment frequency
**/
private RepaymentFrequencyEnum repaymentFrequency = null;
@ApiModelProperty(value = "")
private List<OBReadProduct2DataOtherProductTypeRepaymentRepaymentHoliday> repaymentHoliday = null;
@XmlType(name="RepaymentTypeEnum")
@XmlEnum(String.class)
public enum RepaymentTypeEnum {
@XmlEnumValue("USBA") USBA(String.valueOf("USBA")), @XmlEnumValue("USBU") USBU(String.valueOf("USBU")), @XmlEnumValue("USCI") USCI(String.valueOf("USCI")), @XmlEnumValue("USCS") USCS(String.valueOf("USCS")), @XmlEnumValue("USER") USER(String.valueOf("USER")), @XmlEnumValue("USFA") USFA(String.valueOf("USFA")), @XmlEnumValue("USFB") USFB(String.valueOf("USFB")), @XmlEnumValue("USFI") USFI(String.valueOf("USFI")), @XmlEnumValue("USIO") USIO(String.valueOf("USIO")), @XmlEnumValue("USOT") USOT(String.valueOf("USOT")), @XmlEnumValue("USPF") USPF(String.valueOf("USPF")), @XmlEnumValue("USRW") USRW(String.valueOf("USRW")), @XmlEnumValue("USSL") USSL(String.valueOf("USSL"));
private String value;
RepaymentTypeEnum (String v) {
value = v;
}
public String value() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static RepaymentTypeEnum fromValue(String v) {
for (RepaymentTypeEnum b : RepaymentTypeEnum.values()) {
if (String.valueOf(b.value).equals(v)) {
return b;
}
}
return null;
}
}
@ApiModelProperty(value = "Repayment type")
/**
* Repayment type
**/
private RepaymentTypeEnum repaymentType = null;
/**
* The repayment is for paying just the interest only or both interest and capital or bullet amount or balance to date etc
* @return amountType
**/
@JsonProperty("AmountType")
public String getAmountType() {
if (amountType == null) {
return null;
}
return amountType.value();
}
public void setAmountType(AmountTypeEnum amountType) {
this.amountType = amountType;
}
public OBReadProduct2DataOtherProductTypeRepayment amountType(AmountTypeEnum amountType) {
this.amountType = amountType;
return this;
}
/**
* Get notes
* @return notes
**/
@JsonProperty("Notes")
public List<String> getNotes() {
return notes;
}
public void setNotes(List<String> notes) {
this.notes = notes;
}
public OBReadProduct2DataOtherProductTypeRepayment notes(List<String> notes) {
this.notes = notes;
return this;
}
public OBReadProduct2DataOtherProductTypeRepayment addNotesItem(String notesItem) {
this.notes.add(notesItem);
return this;
}
/**
* Get otherAmountType
* @return otherAmountType
**/
@JsonProperty("OtherAmountType")
public OBReadProduct2DataOtherProductTypeRepaymentOtherAmountType getOtherAmountType() {
return otherAmountType;
}
public void setOtherAmountType(OBReadProduct2DataOtherProductTypeRepaymentOtherAmountType otherAmountType) {
this.otherAmountType = otherAmountType;
}
public OBReadProduct2DataOtherProductTypeRepayment otherAmountType(OBReadProduct2DataOtherProductTypeRepaymentOtherAmountType otherAmountType) {
this.otherAmountType = otherAmountType;
return this;
}
/**
* Get otherRepaymentFrequency
* @return otherRepaymentFrequency
**/
@JsonProperty("OtherRepaymentFrequency")
public OBReadProduct2DataOtherProductTypeRepaymentOtherRepaymentFrequency getOtherRepaymentFrequency() {
return otherRepaymentFrequency;
}
public void setOtherRepaymentFrequency(OBReadProduct2DataOtherProductTypeRepaymentOtherRepaymentFrequency otherRepaymentFrequency) {
this.otherRepaymentFrequency = otherRepaymentFrequency;
}
public OBReadProduct2DataOtherProductTypeRepayment otherRepaymentFrequency(OBReadProduct2DataOtherProductTypeRepaymentOtherRepaymentFrequency otherRepaymentFrequency) {
this.otherRepaymentFrequency = otherRepaymentFrequency;
return this;
}
/**
* Get otherRepaymentType
* @return otherRepaymentType
**/
@JsonProperty("OtherRepaymentType")
public OBReadProduct2DataOtherProductTypeRepaymentOtherRepaymentType getOtherRepaymentType() {
return otherRepaymentType;
}
public void setOtherRepaymentType(OBReadProduct2DataOtherProductTypeRepaymentOtherRepaymentType otherRepaymentType) {
this.otherRepaymentType = otherRepaymentType;
}
public OBReadProduct2DataOtherProductTypeRepayment otherRepaymentType(OBReadProduct2DataOtherProductTypeRepaymentOtherRepaymentType otherRepaymentType) {
this.otherRepaymentType = otherRepaymentType;
return this;
}
/**
* Get repaymentFeeCharges
* @return repaymentFeeCharges
**/
@JsonProperty("RepaymentFeeCharges")
public OBReadProduct2DataOtherProductTypeRepaymentRepaymentFeeCharges getRepaymentFeeCharges() {
return repaymentFeeCharges;
}
public void setRepaymentFeeCharges(OBReadProduct2DataOtherProductTypeRepaymentRepaymentFeeCharges repaymentFeeCharges) {
this.repaymentFeeCharges = repaymentFeeCharges;
}
public OBReadProduct2DataOtherProductTypeRepayment repaymentFeeCharges(OBReadProduct2DataOtherProductTypeRepaymentRepaymentFeeCharges repaymentFeeCharges) {
this.repaymentFeeCharges = repaymentFeeCharges;
return this;
}
/**
* Repayment frequency
* @return repaymentFrequency
**/
@JsonProperty("RepaymentFrequency")
public String getRepaymentFrequency() {
if (repaymentFrequency == null) {
return null;
}
return repaymentFrequency.value();
}
public void setRepaymentFrequency(RepaymentFrequencyEnum repaymentFrequency) {
this.repaymentFrequency = repaymentFrequency;
}
public OBReadProduct2DataOtherProductTypeRepayment repaymentFrequency(RepaymentFrequencyEnum repaymentFrequency) {
this.repaymentFrequency = repaymentFrequency;
return this;
}
/**
* Get repaymentHoliday
* @return repaymentHoliday
**/
@JsonProperty("RepaymentHoliday")
public List<OBReadProduct2DataOtherProductTypeRepaymentRepaymentHoliday> getRepaymentHoliday() {
return repaymentHoliday;
}
public void setRepaymentHoliday(List<OBReadProduct2DataOtherProductTypeRepaymentRepaymentHoliday> repaymentHoliday) {
this.repaymentHoliday = repaymentHoliday;
}
public OBReadProduct2DataOtherProductTypeRepayment repaymentHoliday(List<OBReadProduct2DataOtherProductTypeRepaymentRepaymentHoliday> repaymentHoliday) {
this.repaymentHoliday = repaymentHoliday;
return this;
}
public OBReadProduct2DataOtherProductTypeRepayment addRepaymentHolidayItem(OBReadProduct2DataOtherProductTypeRepaymentRepaymentHoliday repaymentHolidayItem) {
this.repaymentHoliday.add(repaymentHolidayItem);
return this;
}
/**
* Repayment type
* @return repaymentType
**/
@JsonProperty("RepaymentType")
public String getRepaymentType() {
if (repaymentType == null) {
return null;
}
return repaymentType.value();
}
public void setRepaymentType(RepaymentTypeEnum repaymentType) {
this.repaymentType = repaymentType;
}
public OBReadProduct2DataOtherProductTypeRepayment repaymentType(RepaymentTypeEnum repaymentType) {
this.repaymentType = repaymentType;
return this;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class OBReadProduct2DataOtherProductTypeRepayment {\n");
sb.append(" amountType: ").append(toIndentedString(amountType)).append("\n");
sb.append(" notes: ").append(toIndentedString(notes)).append("\n");
sb.append(" otherAmountType: ").append(toIndentedString(otherAmountType)).append("\n");
sb.append(" otherRepaymentFrequency: ").append(toIndentedString(otherRepaymentFrequency)).append("\n");
sb.append(" otherRepaymentType: ").append(toIndentedString(otherRepaymentType)).append("\n");
sb.append(" repaymentFeeCharges: ").append(toIndentedString(repaymentFeeCharges)).append("\n");
sb.append(" repaymentFrequency: ").append(toIndentedString(repaymentFrequency)).append("\n");
sb.append(" repaymentHoliday: ").append(toIndentedString(repaymentHoliday)).append("\n");
sb.append(" repaymentType: ").append(toIndentedString(repaymentType)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private static String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| 12,817 | 0.74409 | 0.740969 | 372 | 33.451614 | 56.165321 | 675 | false | false | 0 | 0 | 0 | 0 | 66 | 0.025747 | 0.357527 | false | false |
3
|
4a4a8d237d0be4af80d41e8628c5d2c0e1a85d8e
| 28,484,223,141,598 |
bc9aa6cfe18c7868296a169b386a1268f246acb5
|
/src/com/kingdee/eas/custom/dx/baseset/ChangepackingFactory.java
|
362991935309c1cf7bdc08cfcc5ac88c3a5be2a3
|
[] |
no_license
|
wangzz-yt/DXeas
|
https://github.com/wangzz-yt/DXeas
|
1c75f880a4851d4b5f4f4b9eb97a53fdd24c7560
|
a9b7de611a08fc2f95d4ee9594416345aec7df51
|
refs/heads/master
| 2021-04-13T22:30:35.127000 | 2020-05-09T00:04:10 | 2020-05-09T00:04:10 | 249,191,805 | 2 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.kingdee.eas.custom.dx.baseset;
import com.kingdee.bos.BOSException;
import com.kingdee.bos.BOSObjectFactory;
import com.kingdee.bos.util.BOSObjectType;
import com.kingdee.bos.Context;
public class ChangepackingFactory
{
private ChangepackingFactory()
{
}
public static com.kingdee.eas.custom.dx.baseset.IChangepacking getRemoteInstance() throws BOSException
{
return (com.kingdee.eas.custom.dx.baseset.IChangepacking)BOSObjectFactory.createRemoteBOSObject(new BOSObjectType("35D43EAD") ,com.kingdee.eas.custom.dx.baseset.IChangepacking.class);
}
public static com.kingdee.eas.custom.dx.baseset.IChangepacking getRemoteInstanceWithObjectContext(Context objectCtx) throws BOSException
{
return (com.kingdee.eas.custom.dx.baseset.IChangepacking)BOSObjectFactory.createRemoteBOSObjectWithObjectContext(new BOSObjectType("35D43EAD") ,com.kingdee.eas.custom.dx.baseset.IChangepacking.class, objectCtx);
}
public static com.kingdee.eas.custom.dx.baseset.IChangepacking getLocalInstance(Context ctx) throws BOSException
{
return (com.kingdee.eas.custom.dx.baseset.IChangepacking)BOSObjectFactory.createBOSObject(ctx, new BOSObjectType("35D43EAD"));
}
public static com.kingdee.eas.custom.dx.baseset.IChangepacking getLocalInstance(String sessionID) throws BOSException
{
return (com.kingdee.eas.custom.dx.baseset.IChangepacking)BOSObjectFactory.createBOSObject(sessionID, new BOSObjectType("35D43EAD"));
}
}
|
UTF-8
|
Java
| 1,510 |
java
|
ChangepackingFactory.java
|
Java
|
[] | null |
[] |
package com.kingdee.eas.custom.dx.baseset;
import com.kingdee.bos.BOSException;
import com.kingdee.bos.BOSObjectFactory;
import com.kingdee.bos.util.BOSObjectType;
import com.kingdee.bos.Context;
public class ChangepackingFactory
{
private ChangepackingFactory()
{
}
public static com.kingdee.eas.custom.dx.baseset.IChangepacking getRemoteInstance() throws BOSException
{
return (com.kingdee.eas.custom.dx.baseset.IChangepacking)BOSObjectFactory.createRemoteBOSObject(new BOSObjectType("35D43EAD") ,com.kingdee.eas.custom.dx.baseset.IChangepacking.class);
}
public static com.kingdee.eas.custom.dx.baseset.IChangepacking getRemoteInstanceWithObjectContext(Context objectCtx) throws BOSException
{
return (com.kingdee.eas.custom.dx.baseset.IChangepacking)BOSObjectFactory.createRemoteBOSObjectWithObjectContext(new BOSObjectType("35D43EAD") ,com.kingdee.eas.custom.dx.baseset.IChangepacking.class, objectCtx);
}
public static com.kingdee.eas.custom.dx.baseset.IChangepacking getLocalInstance(Context ctx) throws BOSException
{
return (com.kingdee.eas.custom.dx.baseset.IChangepacking)BOSObjectFactory.createBOSObject(ctx, new BOSObjectType("35D43EAD"));
}
public static com.kingdee.eas.custom.dx.baseset.IChangepacking getLocalInstance(String sessionID) throws BOSException
{
return (com.kingdee.eas.custom.dx.baseset.IChangepacking)BOSObjectFactory.createBOSObject(sessionID, new BOSObjectType("35D43EAD"));
}
}
| 1,510 | 0.787417 | 0.776821 | 30 | 49.366665 | 62.641033 | 219 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.466667 | false | false |
3
|
7d7dc68ae0b5f9adbed3eae9a24f94bb6ffc76ee
| 30,391,188,612,385 |
2ed7c4c05df3e2bdcb88caa0a993033e047fb29a
|
/common/com.raytheon.uf.common.serialization.comm/src/com/raytheon/uf/common/serialization/comm/RequestWrapper.java
|
1e4df10d07d0f3eb3b1b54a2dd899370c288f964
|
[] |
no_license
|
Unidata/awips2-core
|
https://github.com/Unidata/awips2-core
|
d378a50c78994f85a27b481e6f77c792d1fe0684
|
ab00755b9e158ce66821b6fc05dee5d902421ab8
|
refs/heads/unidata_18.2.1
| 2023-07-22T12:41:05.308000 | 2023-02-13T20:02:40 | 2023-02-13T20:02:40 | 34,124,839 | 3 | 7 | null | false | 2023-07-06T15:40:45 | 2015-04-17T15:39:56 | 2021-12-27T21:53:59 | 2023-07-06T15:40:43 | 18,778 | 3 | 4 | 1 |
Java
| false | false |
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.serialization.comm;
import java.util.UUID;
import com.raytheon.uf.common.message.WsId;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* Wraps an IServerRequest so it can be tracked on both client applications and
* the server. Contains a unique identifier for this particular request and a
* workstation ID which has the network address and process id.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 24, 2012 njensen Initial creation
* Aug 15, 2014 3541 mschenke Made implement IServerRequest since sent
* as one
* Aug 25, 2017 6316 njensen Improved toString()
*
* </pre>
*
* @author njensen
*/
@DynamicSerialize
public class RequestWrapper implements IServerRequest {
@DynamicSerializeElement
private IServerRequest request;
@DynamicSerializeElement
private WsId wsId;
@DynamicSerializeElement
private String uniqueId;
public RequestWrapper() {
}
public RequestWrapper(IServerRequest request, WsId workstationId) {
if (request == null) {
throw new IllegalArgumentException("request must not be null");
}
if (workstationId == null) {
throw new IllegalArgumentException(
"workstationId must not be null");
}
this.request = request;
this.wsId = workstationId;
this.uniqueId = UUID.randomUUID().toString();
}
public IServerRequest getRequest() {
return request;
}
public void setRequest(IServerRequest request) {
this.request = request;
}
public WsId getWsId() {
return wsId;
}
public void setWsId(WsId wsId) {
this.wsId = wsId;
}
public String getUniqueId() {
return uniqueId;
}
public void setUniqueId(String uniqueId) {
this.uniqueId = uniqueId;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder(125);
sb.append("Request[");
if (wsId != null) {
sb.append(wsId.toPrettyString());
} else {
sb.append("null wsId");
}
sb.append("][").append(uniqueId).append("] ");
if (request != null) {
sb.append(request.getClass().getSimpleName());
} else {
sb.append("null request");
}
return sb.toString();
}
}
|
UTF-8
|
Java
| 3,434 |
java
|
RequestWrapper.java
|
Java
|
[
{
"context": "-----------------------\n * Jul 24, 2012 njensen Initial creation\n * Aug 15, 2014 3541 m",
"end": 1468,
"score": 0.9997096657752991,
"start": 1461,
"tag": "USERNAME",
"value": "njensen"
},
{
"context": "en Initial creation\n * Aug 15, 2014 3541 mschenke Made implement IServerRequest since sent\n * ",
"end": 1525,
"score": 0.9994106888771057,
"start": 1517,
"tag": "USERNAME",
"value": "mschenke"
},
{
"context": " as one \n * Aug 25, 2017 6316 njensen Improved toString()\n * \n * </pre>\n * \n * @aut",
"end": 1651,
"score": 0.9997227191925049,
"start": 1644,
"tag": "USERNAME",
"value": "njensen"
},
{
"context": " Improved toString()\n * \n * </pre>\n * \n * @author njensen\n */\n\n@DynamicSerialize\npublic class RequestWrappe",
"end": 1712,
"score": 0.9995613098144531,
"start": 1705,
"tag": "USERNAME",
"value": "njensen"
}
] | null |
[] |
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.serialization.comm;
import java.util.UUID;
import com.raytheon.uf.common.message.WsId;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* Wraps an IServerRequest so it can be tracked on both client applications and
* the server. Contains a unique identifier for this particular request and a
* workstation ID which has the network address and process id.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 24, 2012 njensen Initial creation
* Aug 15, 2014 3541 mschenke Made implement IServerRequest since sent
* as one
* Aug 25, 2017 6316 njensen Improved toString()
*
* </pre>
*
* @author njensen
*/
@DynamicSerialize
public class RequestWrapper implements IServerRequest {
@DynamicSerializeElement
private IServerRequest request;
@DynamicSerializeElement
private WsId wsId;
@DynamicSerializeElement
private String uniqueId;
public RequestWrapper() {
}
public RequestWrapper(IServerRequest request, WsId workstationId) {
if (request == null) {
throw new IllegalArgumentException("request must not be null");
}
if (workstationId == null) {
throw new IllegalArgumentException(
"workstationId must not be null");
}
this.request = request;
this.wsId = workstationId;
this.uniqueId = UUID.randomUUID().toString();
}
public IServerRequest getRequest() {
return request;
}
public void setRequest(IServerRequest request) {
this.request = request;
}
public WsId getWsId() {
return wsId;
}
public void setWsId(WsId wsId) {
this.wsId = wsId;
}
public String getUniqueId() {
return uniqueId;
}
public void setUniqueId(String uniqueId) {
this.uniqueId = uniqueId;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder(125);
sb.append("Request[");
if (wsId != null) {
sb.append(wsId.toPrettyString());
} else {
sb.append("null wsId");
}
sb.append("][").append(uniqueId).append("] ");
if (request != null) {
sb.append(request.getClass().getSimpleName());
} else {
sb.append("null request");
}
return sb.toString();
}
}
| 3,434 | 0.614735 | 0.596971 | 120 | 27.616667 | 24.115067 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.283333 | false | false |
3
|
8ebf0f3a5f6f4f00212455884ef0846c14424043
| 27,427,661,187,841 |
24a2837a3412c0192aca73e8df547b229c51d5f6
|
/src/main/java/cn/datacharm/factory/MidCar.java
|
2c0e998214186594153981daab2adda41bd0fe8f
|
[] |
no_license
|
feihb123/DesignPattern
|
https://github.com/feihb123/DesignPattern
|
e2a497e1d69e5d64d2a3d432e1ba13b168942a2d
|
bc583af4d335a5163e53994628e9b05cb6b2614e
|
refs/heads/master
| 2021-06-15T00:10:21.751000 | 2019-06-23T12:27:59 | 2019-06-23T12:27:59 | 185,717,236 | 3 | 0 | null | false | 2021-04-22T18:17:32 | 2019-05-09T03:08:30 | 2019-07-09T07:14:15 | 2021-04-22T18:17:32 | 95 | 3 | 0 | 2 |
Java
| false | false |
package cn.datacharm.factory;
public class MidCar implements ICar {
public String getType() {
return "MidCar";
}
public void run() {
System.out.println("MidCar run!");
}
}
|
UTF-8
|
Java
| 206 |
java
|
MidCar.java
|
Java
|
[] | null |
[] |
package cn.datacharm.factory;
public class MidCar implements ICar {
public String getType() {
return "MidCar";
}
public void run() {
System.out.println("MidCar run!");
}
}
| 206 | 0.606796 | 0.606796 | 11 | 17.727272 | 15.118266 | 42 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.272727 | false | false |
3
|
8af603cd7b7533761957f27ba31259a557ddd377
| 33,285,996,574,920 |
7220f171139892a8b95049879895c6c1d3c33536
|
/src/main/java/GoogleDetector.java
|
54fea6dcf3e08948fd4ec5b7400d420f229b783a
|
[] |
no_license
|
mbrc12/patterns-test
|
https://github.com/mbrc12/patterns-test
|
351745e9f6b75935ee0c1b94bb1b7819ae7c18f5
|
709accdb609236ec12243e1c93055045aa6d4e4b
|
refs/heads/master
| 2022-07-07T01:06:59.401000 | 2020-05-14T19:52:48 | 2020-05-14T19:52:48 | 263,944,297 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.util.concurrent.atomic.AtomicReference;
public class GoogleDetector extends LangDetectorUtils {
private static GoogleDetector instance;
// Provide an Object to lock on
private static final Object lock = new Object();
public static GoogleDetector getInstance() {
// Two threads cannot simultaneously set instance.
synchronized (lock) {
if (instance == null) {
instance = new GoogleDetector();
}
}
return instance;
}
@Override
public String name() {
return "google";
}
public static void register() {
LangDetectorFactory.register(getInstance());
}
private GoogleDetector() {
}
String detectValid(String text) {
// Write business logic to detect non-null text
return "english";
}
}
|
UTF-8
|
Java
| 859 |
java
|
GoogleDetector.java
|
Java
|
[] | null |
[] |
import java.util.concurrent.atomic.AtomicReference;
public class GoogleDetector extends LangDetectorUtils {
private static GoogleDetector instance;
// Provide an Object to lock on
private static final Object lock = new Object();
public static GoogleDetector getInstance() {
// Two threads cannot simultaneously set instance.
synchronized (lock) {
if (instance == null) {
instance = new GoogleDetector();
}
}
return instance;
}
@Override
public String name() {
return "google";
}
public static void register() {
LangDetectorFactory.register(getInstance());
}
private GoogleDetector() {
}
String detectValid(String text) {
// Write business logic to detect non-null text
return "english";
}
}
| 859 | 0.619325 | 0.619325 | 36 | 22.861111 | 20.308937 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.222222 | false | false |
3
|
96d6a9fef94b8f52eba0a32c2fb328cde644eed5
| 33,285,996,575,144 |
aad82f53c79bb1b0fa0523ca0b9dd18d8f39ec6d
|
/Sreelakshmy V/28 Jan 2020/a28_5.java
|
6be7f8ea6462e1b403d2efc59152df789f1b5fc3
|
[] |
no_license
|
Cognizant-Training-Coimbatore/Lab-Excercise-Batch-2
|
https://github.com/Cognizant-Training-Coimbatore/Lab-Excercise-Batch-2
|
54b4d87238949f3ffa0b3f0209089a1beb93befe
|
58d65b309377b1b86a54d541c3d1ef5acb868381
|
refs/heads/master
| 2020-12-22T06:12:23.330000 | 2020-03-17T12:32:29 | 2020-03-17T12:32:29 | 236,676,704 | 1 | 0 | null | false | 2020-10-13T19:56:02 | 2020-01-28T07:00:34 | 2020-03-17T12:32:32 | 2020-10-13T19:56:00 | 166,778 | 0 | 0 | 1 |
Java
| false | false |
import java.util.ArrayList;
import java.util.List;
public class a28_5 {
public static void main(String[] args) {
List<String> arrlist=new ArrayList<String>();
arrlist.add("Sunday");
arrlist.add("Monday");
arrlist.add("Tuesday");
arrlist.add("Wednesday");
arrlist.add("Thursday");
arrlist.add("Friday");
arrlist.add("Saturday");
arrlist.remove(5);
arrlist.add(5,"Sree");
System.out.println(arrlist);
}
}
|
UTF-8
|
Java
| 452 |
java
|
a28_5.java
|
Java
|
[] | null |
[] |
import java.util.ArrayList;
import java.util.List;
public class a28_5 {
public static void main(String[] args) {
List<String> arrlist=new ArrayList<String>();
arrlist.add("Sunday");
arrlist.add("Monday");
arrlist.add("Tuesday");
arrlist.add("Wednesday");
arrlist.add("Thursday");
arrlist.add("Friday");
arrlist.add("Saturday");
arrlist.remove(5);
arrlist.add(5,"Sree");
System.out.println(arrlist);
}
}
| 452 | 0.64823 | 0.637168 | 21 | 19.523809 | 13.475265 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.809524 | false | false |
3
|
3b918bb71b471f22a556e67440df35c8af6c7d13
| 9,062,381,028,778 |
3bccc93bbfe5fd90a91344182bf55be15599094c
|
/app/src/main/java/com/ydlm/app/model/entity/me/UserPhotos.java
|
89ea3b19900714030bc69c71ee16b3481e41671f
|
[
"Apache-2.0"
] |
permissive
|
liuyongfeng90/EDAllianc
|
https://github.com/liuyongfeng90/EDAllianc
|
2f7699f5c420530ed99a0a391b6de2bf3cb6c8aa
|
eb124416ed8d45c22ef6f41a950621365341d780
|
refs/heads/master
| 2020-04-09T04:55:22.003000 | 2018-12-12T08:51:04 | 2018-12-12T08:51:04 | 160,043,368 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.ydlm.app.model.entity.me;
import java.io.Serializable;
/**
* 用户头像上传
* Created by caisongl on 2018/4/26.
*/
public class UserPhotos {
/**
* STATUS : true
* MESSAGE : 更换成功!
* CODE : 200
* DATA : {"url":"http://192.168.0.101:8080/Mall_File/","image_path":"upload/2000/123123123123.jpg"}
*/
private String STATUS;
private String MESSAGE;
private String CODE;
private DATABean DATA;
public String getSTATUS() {
return STATUS;
}
public void setSTATUS(String STATUS) {
this.STATUS = STATUS;
}
public String getMESSAGE() {
return MESSAGE;
}
public void setMESSAGE(String MESSAGE) {
this.MESSAGE = MESSAGE;
}
public String getCODE() {
return CODE;
}
public void setCODE(String CODE) {
this.CODE = CODE;
}
public DATABean getDATA() {
return DATA;
}
public void setDATA(DATABean DATA) {
this.DATA = DATA;
}
public static class DATABean implements Serializable{
/**
* url : http://192.168.0.101:8080/Mall_File/
* image_path : upload/2000/123123123123.jpg
*/
private String url;
private String image_path;
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getImage_path() {
return image_path;
}
public void setImage_path(String image_path) {
this.image_path = image_path;
}
}
}
|
UTF-8
|
Java
| 1,702 |
java
|
UserPhotos.java
|
Java
|
[
{
"context": ".io.Serializable;\r\n\r\n/**\r\n * 用户头像上传\r\n * Created by caisongl on 2018/4/26.\r\n */\r\n\r\npublic class UserPhotos {\r\n",
"end": 111,
"score": 0.9996988773345947,
"start": 103,
"tag": "USERNAME",
"value": "caisongl"
},
{
"context": "\r\n * CODE : 200\r\n * DATA : {\"url\":\"http://192.168.0.101:8080/Mall_File/\",\"image_path\":\"upload/2000/123123",
"end": 281,
"score": 0.9493277072906494,
"start": 268,
"tag": "IP_ADDRESS",
"value": "192.168.0.101"
},
{
"context": "rializable{\r\n /**\r\n * url : http://192.168.0.101:8080/Mall_File/\r\n * image_path : upload/2",
"end": 1164,
"score": 0.9980472326278687,
"start": 1151,
"tag": "IP_ADDRESS",
"value": "192.168.0.101"
}
] | null |
[] |
package com.ydlm.app.model.entity.me;
import java.io.Serializable;
/**
* 用户头像上传
* Created by caisongl on 2018/4/26.
*/
public class UserPhotos {
/**
* STATUS : true
* MESSAGE : 更换成功!
* CODE : 200
* DATA : {"url":"http://192.168.0.101:8080/Mall_File/","image_path":"upload/2000/123123123123.jpg"}
*/
private String STATUS;
private String MESSAGE;
private String CODE;
private DATABean DATA;
public String getSTATUS() {
return STATUS;
}
public void setSTATUS(String STATUS) {
this.STATUS = STATUS;
}
public String getMESSAGE() {
return MESSAGE;
}
public void setMESSAGE(String MESSAGE) {
this.MESSAGE = MESSAGE;
}
public String getCODE() {
return CODE;
}
public void setCODE(String CODE) {
this.CODE = CODE;
}
public DATABean getDATA() {
return DATA;
}
public void setDATA(DATABean DATA) {
this.DATA = DATA;
}
public static class DATABean implements Serializable{
/**
* url : http://192.168.0.101:8080/Mall_File/
* image_path : upload/2000/123123123123.jpg
*/
private String url;
private String image_path;
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getImage_path() {
return image_path;
}
public void setImage_path(String image_path) {
this.image_path = image_path;
}
}
}
| 1,702 | 0.530357 | 0.48869 | 82 | 18.487804 | 18.683659 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.256098 | false | false |
13
|
0e43cfb21caaeaf049f793acd0aef5af6496bb5b
| 10,539,849,777,696 |
22c06ce39649e70f5eee3b77a2f355f064a51c74
|
/testsuite/integration-arquillian/util/src/main/java/org/keycloak/testsuite/utils/undertow/SimpleWebXmlParser.java
|
45f0623399d63df660bf6c7249ba1404570db267
|
[
"Apache-2.0"
] |
permissive
|
keycloak/keycloak
|
https://github.com/keycloak/keycloak
|
fa71d8b0712c388faeb89ade03ea5f1073ffb837
|
a317f78e65c1ee63eb166c61767f34f72be0a891
|
refs/heads/main
| 2023-09-01T20:04:48.392000 | 2023-09-01T17:12:35 | 2023-09-01T17:12:35 | 11,125,589 | 17,920 | 7,045 |
Apache-2.0
| false | 2023-09-14T19:48:31 | 2013-07-02T13:38:51 | 2023-09-14T19:35:04 | 2023-09-14T19:48:30 | 470,763 | 17,358 | 5,705 | 1,965 |
Java
| false | false |
/*
* Copyright 2016 Red Hat, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.keycloak.testsuite.utils.undertow;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import jakarta.servlet.DispatcherType;
import jakarta.servlet.Filter;
import jakarta.servlet.Servlet;
import io.undertow.servlet.api.DeploymentInfo;
import io.undertow.servlet.api.ErrorPage;
import io.undertow.servlet.api.FilterInfo;
import io.undertow.servlet.api.LoginConfig;
import io.undertow.servlet.api.SecurityConstraint;
import io.undertow.servlet.api.SecurityInfo;
import io.undertow.servlet.api.ServletInfo;
import io.undertow.servlet.api.ServletSessionConfig;
import io.undertow.servlet.api.WebResourceCollection;
import org.jboss.logging.Logger;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
* Simple web.xml parser just to handle our test deployments
*
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
*/
class SimpleWebXmlParser {
private static final Logger log = Logger.getLogger(SimpleWebXmlParser.class);
void parseWebXml(Document webXml, DeploymentInfo di) {
try {
DocumentWrapper document = new DocumentWrapper(webXml);
if (di.getServlets().get("ResteasyServlet") == null) {
// SERVLETS
Map<String, String> servletMappings = new HashMap<>();
List<ElementWrapper> sm = document.getElementsByTagName("servlet-mapping");
for (ElementWrapper mapping : sm) {
String servletName = mapping.getElementByTagName("servlet-name").getText();
String path = mapping.getElementByTagName("url-pattern").getText();
servletMappings.put(servletName, path);
}
List<ElementWrapper> servlets = document.getElementsByTagName("servlet");
for (ElementWrapper servlet : servlets) {
String servletName = servlet.getElementByTagName("servlet-name").getText();
ElementWrapper servletClassEw = servlet.getElementByTagName("servlet-class");
String servletClass = servletClassEw == null ? servletName : servletClassEw.getText();
ElementWrapper loadOnStartupEw = servlet.getElementByTagName("load-on-startup");
Integer loadOnStartup = loadOnStartupEw == null ? null : Integer.valueOf(loadOnStartupEw.getText());
Class<? extends Servlet> servletClazz = (Class<? extends Servlet>) Class.forName(servletClass, false, di.getClassLoader());
ServletInfo undertowServlet = new ServletInfo(servletName, servletClazz);
if (servletMappings.containsKey(servletName)) {
undertowServlet.addMapping(servletMappings.get(servletName));
undertowServlet.setLoadOnStartup(loadOnStartup);
di.addServlet(undertowServlet);
} else {
log.warnf("Missing servlet-mapping for '%s'", servletName);
}
}
}
// FILTERS
Map<String, String> filterMappings = new HashMap<>();
List<ElementWrapper> fm = document.getElementsByTagName("filter-mapping");
for (ElementWrapper mapping : fm) {
String filterName = mapping.getElementByTagName("filter-name").getText();
String path = mapping.getElementByTagName("url-pattern").getText();
filterMappings.put(filterName, path);
}
List<ElementWrapper> filters = document.getElementsByTagName("filter");
for (ElementWrapper filter : filters) {
String filterName = filter.getElementByTagName("filter-name").getText();
String filterClass = filter.getElementByTagName("filter-class").getText();
Class<? extends Filter> filterClazz = (Class<? extends Filter>) Class.forName(filterClass, false, di.getClassLoader());
FilterInfo undertowFilter = new FilterInfo(filterName, filterClazz);
List<ElementWrapper> initParams = filter.getElementsByTagName("init-param");
for (ElementWrapper initParam : initParams) {
String paramName = initParam.getElementByTagName("param-name").getText();
String paramValue = initParam.getElementByTagName("param-value").getText();
undertowFilter.addInitParam(paramName, paramValue);
}
di.addFilter(undertowFilter);
if (filterMappings.containsKey(filterName)) {
di.addFilterUrlMapping(filterName, filterMappings.get(filterName), DispatcherType.REQUEST);
} else {
log.warnf("Missing filter-mapping for '%s'", filterName);
}
}
// CONTEXT PARAMS
List<ElementWrapper> contextParams = document.getElementsByTagName("context-param");
for (ElementWrapper param : contextParams) {
String paramName = param.getElementByTagName("param-name").getText();
String paramValue = param.getElementByTagName("param-value").getText();
di.addInitParameter(paramName, paramValue);
}
// ROLES
List<ElementWrapper> securityRoles = document.getElementsByTagName("security-role");
for (ElementWrapper sr : securityRoles) {
String roleName = sr.getElementByTagName("role-name").getText();
di.addSecurityRole(roleName);
}
// SECURITY CONSTRAINTS
List<ElementWrapper> secConstraints = document.getElementsByTagName("security-constraint");
for (ElementWrapper constraint : secConstraints) {
String urlPattern = constraint.getElementByTagName("web-resource-collection")
.getElementByTagName("url-pattern")
.getText();
ElementWrapper authCsnt = constraint.getElementByTagName("auth-constraint");
String roleName = authCsnt==null ? null : authCsnt
.getElementByTagName("role-name")
.getText();
SecurityConstraint undertowConstraint = new SecurityConstraint();
WebResourceCollection collection = new WebResourceCollection();
collection.addUrlPattern(urlPattern);
undertowConstraint.addWebResourceCollection(collection);
if (roleName != null) {
undertowConstraint.addRoleAllowed(roleName);
} else {
undertowConstraint.setEmptyRoleSemantic(SecurityInfo.EmptyRoleSemantic.PERMIT);
}
di.addSecurityConstraint(undertowConstraint);
}
// LOGIN CONFIG
ElementWrapper loginCfg = document.getElementByTagName("login-config");
if (loginCfg != null) {
String mech = loginCfg.getElementByTagName("auth-method").getText();
String realmName = loginCfg.getElementByTagName("realm-name").getText();
ElementWrapper form = loginCfg.getElementByTagName("form-login-config");
if (form != null) {
String loginPage = form.getElementByTagName("form-login-page").getText();
String errorPage = form.getElementByTagName("form-error-page").getText();
di.setLoginConfig(new LoginConfig(mech, realmName, loginPage, errorPage));
} else {
di.setLoginConfig(new LoginConfig(realmName).addFirstAuthMethod(mech));
}
}
// COOKIE CONFIG
ElementWrapper sessionCfg = document.getElementByTagName("session-config");
if (sessionCfg != null) {
ElementWrapper cookieConfig = sessionCfg.getElementByTagName("cookie-config");
String cookieName = cookieConfig.getElementByTagName("name").getText();
ServletSessionConfig cfg = new ServletSessionConfig();
if (cookieConfig.getElementByTagName("http-only") != null) {
cfg.setHttpOnly(Boolean.parseBoolean(cookieConfig.getElementByTagName("http-only").getText()));
}
cfg.setName(cookieName);
di.setServletSessionConfig(cfg);
}
// ERROR PAGES
List<ElementWrapper> errorPages = document.getElementsByTagName("error-page");
for (ElementWrapper errorPageWrapper : errorPages) {
String location = errorPageWrapper.getElementByTagName("location").getText();
ErrorPage errorPage;
if (errorPageWrapper.getElementByTagName("error-code") != null) {
errorPage = new ErrorPage(location, Integer.parseInt(errorPageWrapper.getElementByTagName("error-code").getText()));
} else {
errorPage = new ErrorPage(location);
}
di.addErrorPage(errorPage);
}
} catch (ClassNotFoundException cnfe) {
throw new RuntimeException(cnfe);
} catch (NullPointerException npe) {
throw new RuntimeException("Error parsing web.xml of " + di.getDeploymentName(), npe);
}
}
private static abstract class XmlWrapper {
abstract List<ElementWrapper> getElementsByTagName(String tagName);
abstract ElementWrapper getElementByTagName(String tagName);
List<ElementWrapper> getElementsFromNodeList(NodeList nl) {
List<ElementWrapper> result = new LinkedList<>();
for (int i=0; i<nl.getLength() ; i++) {
Node node = nl.item(i);
if (node instanceof Element) {
result.add(new ElementWrapper((Element) node));
}
}
return result;
}
ElementWrapper getElementFromNodeList(NodeList nl) {
if (nl.getLength() > 0) {
return new ElementWrapper((Element) nl.item(0));
} else {
return null;
}
}
}
private static class ElementWrapper extends XmlWrapper {
private final Element element;
public ElementWrapper(Element element) {
this.element = element;
}
@Override
public List<ElementWrapper> getElementsByTagName(String tagName) {
NodeList nl = element.getElementsByTagName(tagName);
return getElementsFromNodeList(nl);
}
@Override
public ElementWrapper getElementByTagName(String tagName) {
NodeList nl = element.getElementsByTagName(tagName);
return getElementFromNodeList(nl);
}
public String getText() {
return this.element.getTextContent();
}
}
private static class DocumentWrapper extends XmlWrapper {
private final Document document;
public DocumentWrapper(Document document) {
this.document = document;
}
@Override
List<ElementWrapper> getElementsByTagName(String tagName) {
NodeList nl = document.getElementsByTagName(tagName);
return getElementsFromNodeList(nl);
}
@Override
ElementWrapper getElementByTagName(String tagName) {
NodeList nl = document.getElementsByTagName(tagName);
return getElementFromNodeList(nl);
}
}
}
|
UTF-8
|
Java
| 12,416 |
java
|
SimpleWebXmlParser.java
|
Java
|
[
{
"context": "ur test deployments\n *\n * @author <a href=\"mailto:mposolda@redhat.com\">Marek Posolda</a>\n */\nclass SimpleWebXmlParser {",
"end": 1611,
"score": 0.9999229907989502,
"start": 1592,
"tag": "EMAIL",
"value": "mposolda@redhat.com"
},
{
"context": "*\n * @author <a href=\"mailto:mposolda@redhat.com\">Marek Posolda</a>\n */\nclass SimpleWebXmlParser {\n\n private s",
"end": 1626,
"score": 0.9998859763145447,
"start": 1613,
"tag": "NAME",
"value": "Marek Posolda"
}
] | null |
[] |
/*
* Copyright 2016 Red Hat, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.keycloak.testsuite.utils.undertow;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import jakarta.servlet.DispatcherType;
import jakarta.servlet.Filter;
import jakarta.servlet.Servlet;
import io.undertow.servlet.api.DeploymentInfo;
import io.undertow.servlet.api.ErrorPage;
import io.undertow.servlet.api.FilterInfo;
import io.undertow.servlet.api.LoginConfig;
import io.undertow.servlet.api.SecurityConstraint;
import io.undertow.servlet.api.SecurityInfo;
import io.undertow.servlet.api.ServletInfo;
import io.undertow.servlet.api.ServletSessionConfig;
import io.undertow.servlet.api.WebResourceCollection;
import org.jboss.logging.Logger;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
* Simple web.xml parser just to handle our test deployments
*
* @author <a href="mailto:<EMAIL>"><NAME></a>
*/
class SimpleWebXmlParser {
private static final Logger log = Logger.getLogger(SimpleWebXmlParser.class);
void parseWebXml(Document webXml, DeploymentInfo di) {
try {
DocumentWrapper document = new DocumentWrapper(webXml);
if (di.getServlets().get("ResteasyServlet") == null) {
// SERVLETS
Map<String, String> servletMappings = new HashMap<>();
List<ElementWrapper> sm = document.getElementsByTagName("servlet-mapping");
for (ElementWrapper mapping : sm) {
String servletName = mapping.getElementByTagName("servlet-name").getText();
String path = mapping.getElementByTagName("url-pattern").getText();
servletMappings.put(servletName, path);
}
List<ElementWrapper> servlets = document.getElementsByTagName("servlet");
for (ElementWrapper servlet : servlets) {
String servletName = servlet.getElementByTagName("servlet-name").getText();
ElementWrapper servletClassEw = servlet.getElementByTagName("servlet-class");
String servletClass = servletClassEw == null ? servletName : servletClassEw.getText();
ElementWrapper loadOnStartupEw = servlet.getElementByTagName("load-on-startup");
Integer loadOnStartup = loadOnStartupEw == null ? null : Integer.valueOf(loadOnStartupEw.getText());
Class<? extends Servlet> servletClazz = (Class<? extends Servlet>) Class.forName(servletClass, false, di.getClassLoader());
ServletInfo undertowServlet = new ServletInfo(servletName, servletClazz);
if (servletMappings.containsKey(servletName)) {
undertowServlet.addMapping(servletMappings.get(servletName));
undertowServlet.setLoadOnStartup(loadOnStartup);
di.addServlet(undertowServlet);
} else {
log.warnf("Missing servlet-mapping for '%s'", servletName);
}
}
}
// FILTERS
Map<String, String> filterMappings = new HashMap<>();
List<ElementWrapper> fm = document.getElementsByTagName("filter-mapping");
for (ElementWrapper mapping : fm) {
String filterName = mapping.getElementByTagName("filter-name").getText();
String path = mapping.getElementByTagName("url-pattern").getText();
filterMappings.put(filterName, path);
}
List<ElementWrapper> filters = document.getElementsByTagName("filter");
for (ElementWrapper filter : filters) {
String filterName = filter.getElementByTagName("filter-name").getText();
String filterClass = filter.getElementByTagName("filter-class").getText();
Class<? extends Filter> filterClazz = (Class<? extends Filter>) Class.forName(filterClass, false, di.getClassLoader());
FilterInfo undertowFilter = new FilterInfo(filterName, filterClazz);
List<ElementWrapper> initParams = filter.getElementsByTagName("init-param");
for (ElementWrapper initParam : initParams) {
String paramName = initParam.getElementByTagName("param-name").getText();
String paramValue = initParam.getElementByTagName("param-value").getText();
undertowFilter.addInitParam(paramName, paramValue);
}
di.addFilter(undertowFilter);
if (filterMappings.containsKey(filterName)) {
di.addFilterUrlMapping(filterName, filterMappings.get(filterName), DispatcherType.REQUEST);
} else {
log.warnf("Missing filter-mapping for '%s'", filterName);
}
}
// CONTEXT PARAMS
List<ElementWrapper> contextParams = document.getElementsByTagName("context-param");
for (ElementWrapper param : contextParams) {
String paramName = param.getElementByTagName("param-name").getText();
String paramValue = param.getElementByTagName("param-value").getText();
di.addInitParameter(paramName, paramValue);
}
// ROLES
List<ElementWrapper> securityRoles = document.getElementsByTagName("security-role");
for (ElementWrapper sr : securityRoles) {
String roleName = sr.getElementByTagName("role-name").getText();
di.addSecurityRole(roleName);
}
// SECURITY CONSTRAINTS
List<ElementWrapper> secConstraints = document.getElementsByTagName("security-constraint");
for (ElementWrapper constraint : secConstraints) {
String urlPattern = constraint.getElementByTagName("web-resource-collection")
.getElementByTagName("url-pattern")
.getText();
ElementWrapper authCsnt = constraint.getElementByTagName("auth-constraint");
String roleName = authCsnt==null ? null : authCsnt
.getElementByTagName("role-name")
.getText();
SecurityConstraint undertowConstraint = new SecurityConstraint();
WebResourceCollection collection = new WebResourceCollection();
collection.addUrlPattern(urlPattern);
undertowConstraint.addWebResourceCollection(collection);
if (roleName != null) {
undertowConstraint.addRoleAllowed(roleName);
} else {
undertowConstraint.setEmptyRoleSemantic(SecurityInfo.EmptyRoleSemantic.PERMIT);
}
di.addSecurityConstraint(undertowConstraint);
}
// LOGIN CONFIG
ElementWrapper loginCfg = document.getElementByTagName("login-config");
if (loginCfg != null) {
String mech = loginCfg.getElementByTagName("auth-method").getText();
String realmName = loginCfg.getElementByTagName("realm-name").getText();
ElementWrapper form = loginCfg.getElementByTagName("form-login-config");
if (form != null) {
String loginPage = form.getElementByTagName("form-login-page").getText();
String errorPage = form.getElementByTagName("form-error-page").getText();
di.setLoginConfig(new LoginConfig(mech, realmName, loginPage, errorPage));
} else {
di.setLoginConfig(new LoginConfig(realmName).addFirstAuthMethod(mech));
}
}
// COOKIE CONFIG
ElementWrapper sessionCfg = document.getElementByTagName("session-config");
if (sessionCfg != null) {
ElementWrapper cookieConfig = sessionCfg.getElementByTagName("cookie-config");
String cookieName = cookieConfig.getElementByTagName("name").getText();
ServletSessionConfig cfg = new ServletSessionConfig();
if (cookieConfig.getElementByTagName("http-only") != null) {
cfg.setHttpOnly(Boolean.parseBoolean(cookieConfig.getElementByTagName("http-only").getText()));
}
cfg.setName(cookieName);
di.setServletSessionConfig(cfg);
}
// ERROR PAGES
List<ElementWrapper> errorPages = document.getElementsByTagName("error-page");
for (ElementWrapper errorPageWrapper : errorPages) {
String location = errorPageWrapper.getElementByTagName("location").getText();
ErrorPage errorPage;
if (errorPageWrapper.getElementByTagName("error-code") != null) {
errorPage = new ErrorPage(location, Integer.parseInt(errorPageWrapper.getElementByTagName("error-code").getText()));
} else {
errorPage = new ErrorPage(location);
}
di.addErrorPage(errorPage);
}
} catch (ClassNotFoundException cnfe) {
throw new RuntimeException(cnfe);
} catch (NullPointerException npe) {
throw new RuntimeException("Error parsing web.xml of " + di.getDeploymentName(), npe);
}
}
private static abstract class XmlWrapper {
abstract List<ElementWrapper> getElementsByTagName(String tagName);
abstract ElementWrapper getElementByTagName(String tagName);
List<ElementWrapper> getElementsFromNodeList(NodeList nl) {
List<ElementWrapper> result = new LinkedList<>();
for (int i=0; i<nl.getLength() ; i++) {
Node node = nl.item(i);
if (node instanceof Element) {
result.add(new ElementWrapper((Element) node));
}
}
return result;
}
ElementWrapper getElementFromNodeList(NodeList nl) {
if (nl.getLength() > 0) {
return new ElementWrapper((Element) nl.item(0));
} else {
return null;
}
}
}
private static class ElementWrapper extends XmlWrapper {
private final Element element;
public ElementWrapper(Element element) {
this.element = element;
}
@Override
public List<ElementWrapper> getElementsByTagName(String tagName) {
NodeList nl = element.getElementsByTagName(tagName);
return getElementsFromNodeList(nl);
}
@Override
public ElementWrapper getElementByTagName(String tagName) {
NodeList nl = element.getElementsByTagName(tagName);
return getElementFromNodeList(nl);
}
public String getText() {
return this.element.getTextContent();
}
}
private static class DocumentWrapper extends XmlWrapper {
private final Document document;
public DocumentWrapper(Document document) {
this.document = document;
}
@Override
List<ElementWrapper> getElementsByTagName(String tagName) {
NodeList nl = document.getElementsByTagName(tagName);
return getElementsFromNodeList(nl);
}
@Override
ElementWrapper getElementByTagName(String tagName) {
NodeList nl = document.getElementsByTagName(tagName);
return getElementFromNodeList(nl);
}
}
}
| 12,397 | 0.617751 | 0.616543 | 301 | 40.249168 | 34.3554 | 143 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.498339 | false | false |
13
|
684b610c5f91f139087ba9e6856864b9d6204e14
| 19,516,331,427,954 |
716b231c89805b3e1217c6fc0a4ff9fbcdcdb688
|
/train19eManage/src/com/l9e/transaction/service/AccountService.java
|
6f95a3d7d15e55e9e26a5a8ed862c52dbae0fa8e
|
[] |
no_license
|
d0l1u/train_ticket
|
https://github.com/d0l1u/train_ticket
|
32b831e441e3df73d55559bc416446276d7580be
|
c385cb36908f0a6e9e4a6ebb9b3ad737edb664d7
|
refs/heads/master
| 2020-06-14T09:00:34.760000 | 2019-07-03T00:30:46 | 2019-07-03T00:30:46 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.l9e.transaction.service;
import java.util.List;
import java.util.Map;
import com.l9e.transaction.vo.AccountVo;
import com.l9e.transaction.vo.AcquireVo;
import com.l9e.transaction.vo.AreaVo;
public interface AccountService {
List<Map<String, String>> queryAccountList(Map<String, Object> paramMap);
List<Map<String, String>> queryAccountExcel(Map<String, Object> paramMap);
int queryAccountListCount(Map<String, Object> paramMap);
Map<String, String> queryAccount(String acc_id);
void updateAccount(AccountVo account);
void insertAccount(AccountVo account);
void deleteAccount(AccountVo account);
/**
* 获取省份
* @return
*/
public List<AreaVo> getProvince();
/**
* 获取城市
* @return
*/
public List<AreaVo> getCity(String provinceid);
/**
* 获取区县
* @return
*/
public List<AreaVo> getArea(String cityid);
String queryAcc_username(String acc_username);
int addRegistersBatch(Map<String, Object> paramMap);
int startRegistersBatch(Map<String, Object> paramMap);
void updateStopStatus();
void updateAbatchStop(AccountVo accountVo);
}
|
UTF-8
|
Java
| 1,132 |
java
|
AccountService.java
|
Java
|
[] | null |
[] |
package com.l9e.transaction.service;
import java.util.List;
import java.util.Map;
import com.l9e.transaction.vo.AccountVo;
import com.l9e.transaction.vo.AcquireVo;
import com.l9e.transaction.vo.AreaVo;
public interface AccountService {
List<Map<String, String>> queryAccountList(Map<String, Object> paramMap);
List<Map<String, String>> queryAccountExcel(Map<String, Object> paramMap);
int queryAccountListCount(Map<String, Object> paramMap);
Map<String, String> queryAccount(String acc_id);
void updateAccount(AccountVo account);
void insertAccount(AccountVo account);
void deleteAccount(AccountVo account);
/**
* 获取省份
* @return
*/
public List<AreaVo> getProvince();
/**
* 获取城市
* @return
*/
public List<AreaVo> getCity(String provinceid);
/**
* 获取区县
* @return
*/
public List<AreaVo> getArea(String cityid);
String queryAcc_username(String acc_username);
int addRegistersBatch(Map<String, Object> paramMap);
int startRegistersBatch(Map<String, Object> paramMap);
void updateStopStatus();
void updateAbatchStop(AccountVo accountVo);
}
| 1,132 | 0.731949 | 0.728339 | 58 | 18.103449 | 21.711025 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.155172 | false | false |
13
|
7cef4897f08aa50b9a075abc59df128efe45b0d6
| 8,108,898,319,717 |
972418da3b3b6a57f6cc7e85e10adf842ce7d73c
|
/unitecore-parent/unitecore/unitecore-client/src/main/java/com/unitcode/client/Reqv.java
|
3909fad4740341d8b15206b1aa59cfc111485cff
|
[
"Unlicense"
] |
permissive
|
lewjeen/framework
|
https://github.com/lewjeen/framework
|
f00964e17dc44be571ea9e151217485363009ff7
|
25ef0a5eb2764f0cd4cf4cdc2844ca10ddcb54b4
|
refs/heads/master
| 2021-01-17T11:28:21.895000 | 2014-09-25T10:28:14 | 2014-09-25T10:28:14 | 22,959,196 | 1 | 1 | null | false | 2016-03-11T06:44:41 | 2014-08-14T15:39:43 | 2014-09-09T12:07:47 | 2016-03-10T00:13:32 | 792 | 0 | 1 | 0 |
Java
| null | null |
package com.unitcode.client;
import com.alibaba.fastjson.JSON;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
import com.rabbitmq.client.QueueingConsumer;
/**
* <strong>Title : Reqv </strong>. <br>
* <strong>Description : 类的描述信息.</strong> <br>
* <strong>Create on : 2014年8月6日 下午3:35:42 </strong>. <br>
* <p>
* <strong>Copyright (C) Mocha Software Co.,Ltd.</strong> <br>
* </p>
* @author 刘军 liujun1@mochasoft.com.cn <br>
* @version <strong>Mocha JavaOA v7.0.0</strong> <br>
* <br>
* <strong>修改历史: .</strong> <br>
* 修改人 修改日期 修改描述<br>
* -------------------------------------------<br>
* <br>
* <br>
*/
public class Reqv {
private final static String QUEUE_NAME = "hello";
public static void main(String[] argv) throws Exception {
ConnectionFactory factory = new ConnectionFactory();
factory.setHost("localhost");
Connection connection = factory.newConnection();
Channel channel = connection.createChannel();
channel.queueDeclare(QUEUE_NAME, false, false, false, null);
System.out.println(" [*] Waiting for messages. To exit press CTRL+C");
QueueingConsumer consumer = new QueueingConsumer(channel);
channel.basicConsume(QUEUE_NAME, true, consumer);
while (true) {
QueueingConsumer.Delivery delivery = consumer.nextDelivery();
String message = new String(delivery.getBody());
User user=JSON.parseObject(message, User.class);
System.out.println(" [x] Received '" + message + "'");
System.out.println(" [x] user getUserid'" + user.getUserid() + "'");
System.out.println(" [x] getUsername '" + user.getUsername() + "'");
}
}
}
|
UTF-8
|
Java
| 1,932 |
java
|
Reqv.java
|
Java
|
[
{
"context": "tware Co.,Ltd.</strong> <br>\r\n * </p>\r\n * @author 刘军 liujun1@mochasoft.com.cn <br>\r\n * @version <stro",
"end": 487,
"score": 0.9998219013214111,
"start": 485,
"tag": "NAME",
"value": "刘军"
},
{
"context": "re Co.,Ltd.</strong> <br>\r\n * </p>\r\n * @author 刘军 liujun1@mochasoft.com.cn <br>\r\n * @version <strong>Mocha JavaOA v7.0.0</st",
"end": 513,
"score": 0.9999185800552368,
"start": 489,
"tag": "EMAIL",
"value": "liujun1@mochasoft.com.cn"
}
] | null |
[] |
package com.unitcode.client;
import com.alibaba.fastjson.JSON;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
import com.rabbitmq.client.QueueingConsumer;
/**
* <strong>Title : Reqv </strong>. <br>
* <strong>Description : 类的描述信息.</strong> <br>
* <strong>Create on : 2014年8月6日 下午3:35:42 </strong>. <br>
* <p>
* <strong>Copyright (C) Mocha Software Co.,Ltd.</strong> <br>
* </p>
* @author 刘军 <EMAIL> <br>
* @version <strong>Mocha JavaOA v7.0.0</strong> <br>
* <br>
* <strong>修改历史: .</strong> <br>
* 修改人 修改日期 修改描述<br>
* -------------------------------------------<br>
* <br>
* <br>
*/
public class Reqv {
private final static String QUEUE_NAME = "hello";
public static void main(String[] argv) throws Exception {
ConnectionFactory factory = new ConnectionFactory();
factory.setHost("localhost");
Connection connection = factory.newConnection();
Channel channel = connection.createChannel();
channel.queueDeclare(QUEUE_NAME, false, false, false, null);
System.out.println(" [*] Waiting for messages. To exit press CTRL+C");
QueueingConsumer consumer = new QueueingConsumer(channel);
channel.basicConsume(QUEUE_NAME, true, consumer);
while (true) {
QueueingConsumer.Delivery delivery = consumer.nextDelivery();
String message = new String(delivery.getBody());
User user=JSON.parseObject(message, User.class);
System.out.println(" [x] Received '" + message + "'");
System.out.println(" [x] user getUserid'" + user.getUserid() + "'");
System.out.println(" [x] getUsername '" + user.getUsername() + "'");
}
}
}
| 1,915 | 0.597015 | 0.589019 | 52 | 34.076923 | 26.88068 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.557692 | false | false |
13
|
eaf0a60843de9c324a0ea85fd0a01c0ec3621def
| 23,098,334,141,727 |
32f38cd53372ba374c6dab6cc27af78f0a1b0190
|
/app/src/main/java/com/alipay/mobile/common/nbnet/biz/exception/NBNetCancelException.java
|
26df85c111264cb45fa4d8e051a8700435d1d980
|
[] |
no_license
|
shuixi2013/AmapCode
|
https://github.com/shuixi2013/AmapCode
|
9ea7aefb42e0413f348f238f0721c93245f4eac6
|
1a3a8d4dddfcc5439df8df570000cca12b15186a
|
refs/heads/master
| 2023-06-06T23:08:57.391000 | 2019-08-29T04:36:02 | 2019-08-29T04:36:02 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.alipay.mobile.common.nbnet.biz.exception;
import com.alipay.mobile.common.nbnet.api.NBNetException;
public class NBNetCancelException extends NBNetException {
public NBNetCancelException(String detailMessage) {
super(detailMessage, -8);
}
}
|
UTF-8
|
Java
| 271 |
java
|
NBNetCancelException.java
|
Java
|
[] | null |
[] |
package com.alipay.mobile.common.nbnet.biz.exception;
import com.alipay.mobile.common.nbnet.api.NBNetException;
public class NBNetCancelException extends NBNetException {
public NBNetCancelException(String detailMessage) {
super(detailMessage, -8);
}
}
| 271 | 0.774908 | 0.771218 | 9 | 29.111111 | 25.679411 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false |
13
|
bf827ac387e813f8a3f527b61dc3e74526ac6b9f
| 23,098,334,140,898 |
8cadf3a2cdb872afab82606c7eca338e7d494f86
|
/src/main/java/yk/jcommon/collections/YCollections.java
|
ecbbad9b60924e2e15cc29b60917a1e835c98147
|
[
"MIT"
] |
permissive
|
kravchik/jcommon
|
https://github.com/kravchik/jcommon
|
1d9b2d6721e7c860ea1886dea16fea05ac2edbb6
|
de3e4e3bf278484da27edfe2d1ac8b7f42f3b4df
|
refs/heads/master
| 2023-08-31T13:49:16.838000 | 2023-08-12T08:58:36 | 2023-08-12T08:58:36 | 25,888,668 | 17 | 2 |
MIT
| false | 2020-10-13T00:29:24 | 2014-10-28T20:28:39 | 2020-06-10T12:24:33 | 2020-10-13T00:29:23 | 385 | 15 | 1 | 1 |
Java
| false | false |
package yk.jcommon.collections;
import java.util.*;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Predicate;
import static yk.jcommon.collections.YArrayList.al;
import static yk.jcommon.collections.YArrayList.toYList;
/**
* Created with IntelliJ IDEA.
* User: yuri
* Date: 8/12/14
* Time: 5:48 PM
*/
public class YCollections {
public static <T> YArrayList<T> filterList(List<T> l, Predicate<? super T> predicate) {
YArrayList result = new YArrayList();
for (int i = 0, lSize = l.size(); i < lSize; i++) {
T t = l.get(i);
if (predicate.test(t)) result.add(t);
}
return result;
}
public static <T> YHashSet<T> filterSet(Collection<T> l, Predicate<? super T> predicate) {
YHashSet result = new YHashSet();
for (T t : l) if (predicate.test(t)) result.add(t);
return result;
}
static <T, R> YArrayList<R> mapList(List<T> source, Function<? super T, ? extends R> mapper) {
YArrayList<R> result = new YArrayList();
for (int i = 0, sourceSize = source.size(); i < sourceSize; i++) {
result.add(mapper.apply(source.get(i)));
}
return result;
}
static <T, R> YSet<R> mapSet(Set<T> source, Function<? super T, ? extends R> mapper) {
YHashSet<R> result = new YHashSet();
for (T t : source) result.add(mapper.apply(t));
return result;
}
static <T, R> YArrayList<R> flatMapList(List<T> source, Function<? super T, ? extends Collection<? extends R>> mapper) {
YArrayList<R> result = new YArrayList();
for (int i = 0, sourceSize = source.size(); i < sourceSize; i++) {
for (R r : mapper.apply(source.get(i))) result.add(r);
}
return result;
}
static <T, R> YHashSet<R> flatMapSet(Set<T> source, Function<? super T, ? extends Collection<? extends R>> mapper) {
YHashSet<R> result = new YHashSet();
for (T t : source) {
for (R r : mapper.apply(t)) result.add(r);
}
return result;
}
static <T> YList<T> sortedCollection(Collection<T> source) {
YList<T> result = toYList(source);
Collections.sort((List)result);
return result;
}
static <T> YList<T> sortedCollection(Collection<T> source, Comparator<? super T> comparator) {
YList<T> result = toYList(source);
Collections.sort(result, comparator);
return result;
}
static <T> T maxFromList(List<T> source) {
if (source.isEmpty()) throw new RuntimeException("can't get max on empty collection");
T result = null;
for (int i = 0, sourceSize = source.size(); i < sourceSize; i++) {
T t = source.get(i);
if (result == null || ((Comparable<T>)t).compareTo(result) > 0) result = t;
}
return result;
}
static <T> T maxFromList(List<T> source, Comparator<? super T> comparator) {
if (source.isEmpty()) throw new RuntimeException("can't get max on empty collection");
T result = null;
for (int i = 0, sourceSize = source.size(); i < sourceSize; i++) {
T t = source.get(i);
if (result == null || comparator.compare(t, result) > 0) result = t;
}
return result;
}
static <T> T maxFromCollection(Collection<T> source, Comparator<? super T> comparator) {
if (source.isEmpty()) throw new RuntimeException("can't get max on empty collection");
T result = null;
for (T t : source) {
if (result == null || comparator.compare(t, result) > 0) result = t;
}
return result;
}
static <T> T minFromList(List<T> source, Comparator<? super T> comparator) {
if (source.isEmpty()) throw new RuntimeException("can't get max on empty collection");
T result = null;
for (int i = 0, sourceSize = source.size(); i < sourceSize; i++) {
T t = source.get(i);
if (result == null || comparator.compare(t, result) < 0) result = t;
}
return result;
}
static <T> T minFromCollection(Collection<T> source, Comparator<? super T> comparator) {
if (source.isEmpty()) throw new RuntimeException("can't get min on empty collection");
T result = null;
for (T t : source) {
if (result == null || comparator.compare(t, result) < 0) result = t;
}
return result;
}
static <T> T maxFromCollection(Collection<T> source) {
if (source.isEmpty()) throw new RuntimeException("can't get max on empty collection");
T result = null;
for (T t : source) if (result == null || ((Comparable<T>)t).compareTo(result) > 0) result = t;
return result;
}
static <T> T minFromList(List<T> source) {
if (source.isEmpty()) throw new RuntimeException("can't get min on empty collection");
T result = null;
for (int i = 0, sourceSize = source.size(); i < sourceSize; i++) {
T t = source.get(i);
if (result == null || ((Comparable<T>)t).compareTo(result) < 0) result = t;
}
return result;
}
static <T> T minFromCollection(Collection<T> source) {
if (source.isEmpty()) throw new RuntimeException("can't get min on empty collection");
T result = null;
for (T t : source) if (result == null || ((Comparable<T>)t).compareTo(result) < 0) result = t;
return result;
}
public static <T> YArrayList<T> cdr(List<T> source) {
YArrayList<T> result = new YArrayList();
for (int i = 1, sourceSize = source.size(); i < sourceSize; i++) {
result.add(source.get(i));
}
return result;
}
static <T> YArrayList<T> subListFromList(List<T> source, int fromIndex, int toIndex) {
YArrayList<T> result = YArrayList.al();
for (int i = fromIndex; i < toIndex; i++) result.add(source.get(i));
return result;
}
public static <A, B, R> YArrayList<R> eachToEach(Collection<A> aa, Collection<B> bb, BiFunction<A, B, R> combinator) {
YArrayList<R> result = new YArrayList<>();
for (A a : aa) {
for (B b : bb) {
result.add(combinator.apply(a, b));
}
}
return result;
}
public static <T> YSet subSet(Collection<T> c, T t) {
YHashSet<T> result = new YHashSet<>();
for (T t1 : c) if (!t1.equals(t)) result.add(t1);
return result;
}
public static <T> YSet subSet(Collection<T> c, Collection<T> t) {
YHashSet<T> result = new YHashSet<>();
for (T t1 : c) if (!t.contains(t1)) result.add(t1);
return result;
}
public static <T> YSet<T> appendSet(Collection<T> ts, Collection<T> tt) {
YHashSet<T> result = new YHashSet<>();
result.addAll(ts);
result.addAll(tt);
return result;
}
public static <T> YSet<T> appendSet(Collection<T> ts, T t) {
YHashSet<T> result = new YHashSet<>();
result.addAll(ts);
result.add(t);
return result;
}
public static <T> YSet<YMap<T, T>> scramble(YSet<T> aa, YSet<T> bb) {
return scramble(aa, bb, YHashMap.hm());
}
public static <T> YSet<YMap<T, T>> scramble(YSet<T> aa, YSet<T> bb, YMap<T, T> prev) {
if (aa.isEmpty() || bb.isEmpty()) return YHashSet.hs(prev);
YSet<YMap<T, T>> result = YHashSet.hs();
T car = aa.car();
YSet<T> cdr = aa.cdr();
for (T b : bb) result.addAll(scramble(cdr, bb.without(b), prev.with(car, b)));
return result;
}
public static <T1, T2, T3> YList<T3> zip(YList<T1> a, YList<T2> b, BiFunction<T1, T2, T3> f) {
YList<T3> result = al();
for (int i = 0; i < a.size(); i++) {
if (b.size() <= i) break;
result.add(f.apply(a.get(i), b.get(i)));
}
return result;
}
}
|
UTF-8
|
Java
| 7,996 |
java
|
YCollections.java
|
Java
|
[
{
"context": "List;\n\n/**\n * Created with IntelliJ IDEA.\n * User: yuri\n * Date: 8/12/14\n * Time: 5:48 PM\n */\npublic clas",
"end": 323,
"score": 0.9878635406494141,
"start": 319,
"tag": "USERNAME",
"value": "yuri"
}
] | null |
[] |
package yk.jcommon.collections;
import java.util.*;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Predicate;
import static yk.jcommon.collections.YArrayList.al;
import static yk.jcommon.collections.YArrayList.toYList;
/**
* Created with IntelliJ IDEA.
* User: yuri
* Date: 8/12/14
* Time: 5:48 PM
*/
public class YCollections {
public static <T> YArrayList<T> filterList(List<T> l, Predicate<? super T> predicate) {
YArrayList result = new YArrayList();
for (int i = 0, lSize = l.size(); i < lSize; i++) {
T t = l.get(i);
if (predicate.test(t)) result.add(t);
}
return result;
}
public static <T> YHashSet<T> filterSet(Collection<T> l, Predicate<? super T> predicate) {
YHashSet result = new YHashSet();
for (T t : l) if (predicate.test(t)) result.add(t);
return result;
}
static <T, R> YArrayList<R> mapList(List<T> source, Function<? super T, ? extends R> mapper) {
YArrayList<R> result = new YArrayList();
for (int i = 0, sourceSize = source.size(); i < sourceSize; i++) {
result.add(mapper.apply(source.get(i)));
}
return result;
}
static <T, R> YSet<R> mapSet(Set<T> source, Function<? super T, ? extends R> mapper) {
YHashSet<R> result = new YHashSet();
for (T t : source) result.add(mapper.apply(t));
return result;
}
static <T, R> YArrayList<R> flatMapList(List<T> source, Function<? super T, ? extends Collection<? extends R>> mapper) {
YArrayList<R> result = new YArrayList();
for (int i = 0, sourceSize = source.size(); i < sourceSize; i++) {
for (R r : mapper.apply(source.get(i))) result.add(r);
}
return result;
}
static <T, R> YHashSet<R> flatMapSet(Set<T> source, Function<? super T, ? extends Collection<? extends R>> mapper) {
YHashSet<R> result = new YHashSet();
for (T t : source) {
for (R r : mapper.apply(t)) result.add(r);
}
return result;
}
static <T> YList<T> sortedCollection(Collection<T> source) {
YList<T> result = toYList(source);
Collections.sort((List)result);
return result;
}
static <T> YList<T> sortedCollection(Collection<T> source, Comparator<? super T> comparator) {
YList<T> result = toYList(source);
Collections.sort(result, comparator);
return result;
}
static <T> T maxFromList(List<T> source) {
if (source.isEmpty()) throw new RuntimeException("can't get max on empty collection");
T result = null;
for (int i = 0, sourceSize = source.size(); i < sourceSize; i++) {
T t = source.get(i);
if (result == null || ((Comparable<T>)t).compareTo(result) > 0) result = t;
}
return result;
}
static <T> T maxFromList(List<T> source, Comparator<? super T> comparator) {
if (source.isEmpty()) throw new RuntimeException("can't get max on empty collection");
T result = null;
for (int i = 0, sourceSize = source.size(); i < sourceSize; i++) {
T t = source.get(i);
if (result == null || comparator.compare(t, result) > 0) result = t;
}
return result;
}
static <T> T maxFromCollection(Collection<T> source, Comparator<? super T> comparator) {
if (source.isEmpty()) throw new RuntimeException("can't get max on empty collection");
T result = null;
for (T t : source) {
if (result == null || comparator.compare(t, result) > 0) result = t;
}
return result;
}
static <T> T minFromList(List<T> source, Comparator<? super T> comparator) {
if (source.isEmpty()) throw new RuntimeException("can't get max on empty collection");
T result = null;
for (int i = 0, sourceSize = source.size(); i < sourceSize; i++) {
T t = source.get(i);
if (result == null || comparator.compare(t, result) < 0) result = t;
}
return result;
}
static <T> T minFromCollection(Collection<T> source, Comparator<? super T> comparator) {
if (source.isEmpty()) throw new RuntimeException("can't get min on empty collection");
T result = null;
for (T t : source) {
if (result == null || comparator.compare(t, result) < 0) result = t;
}
return result;
}
static <T> T maxFromCollection(Collection<T> source) {
if (source.isEmpty()) throw new RuntimeException("can't get max on empty collection");
T result = null;
for (T t : source) if (result == null || ((Comparable<T>)t).compareTo(result) > 0) result = t;
return result;
}
static <T> T minFromList(List<T> source) {
if (source.isEmpty()) throw new RuntimeException("can't get min on empty collection");
T result = null;
for (int i = 0, sourceSize = source.size(); i < sourceSize; i++) {
T t = source.get(i);
if (result == null || ((Comparable<T>)t).compareTo(result) < 0) result = t;
}
return result;
}
static <T> T minFromCollection(Collection<T> source) {
if (source.isEmpty()) throw new RuntimeException("can't get min on empty collection");
T result = null;
for (T t : source) if (result == null || ((Comparable<T>)t).compareTo(result) < 0) result = t;
return result;
}
public static <T> YArrayList<T> cdr(List<T> source) {
YArrayList<T> result = new YArrayList();
for (int i = 1, sourceSize = source.size(); i < sourceSize; i++) {
result.add(source.get(i));
}
return result;
}
static <T> YArrayList<T> subListFromList(List<T> source, int fromIndex, int toIndex) {
YArrayList<T> result = YArrayList.al();
for (int i = fromIndex; i < toIndex; i++) result.add(source.get(i));
return result;
}
public static <A, B, R> YArrayList<R> eachToEach(Collection<A> aa, Collection<B> bb, BiFunction<A, B, R> combinator) {
YArrayList<R> result = new YArrayList<>();
for (A a : aa) {
for (B b : bb) {
result.add(combinator.apply(a, b));
}
}
return result;
}
public static <T> YSet subSet(Collection<T> c, T t) {
YHashSet<T> result = new YHashSet<>();
for (T t1 : c) if (!t1.equals(t)) result.add(t1);
return result;
}
public static <T> YSet subSet(Collection<T> c, Collection<T> t) {
YHashSet<T> result = new YHashSet<>();
for (T t1 : c) if (!t.contains(t1)) result.add(t1);
return result;
}
public static <T> YSet<T> appendSet(Collection<T> ts, Collection<T> tt) {
YHashSet<T> result = new YHashSet<>();
result.addAll(ts);
result.addAll(tt);
return result;
}
public static <T> YSet<T> appendSet(Collection<T> ts, T t) {
YHashSet<T> result = new YHashSet<>();
result.addAll(ts);
result.add(t);
return result;
}
public static <T> YSet<YMap<T, T>> scramble(YSet<T> aa, YSet<T> bb) {
return scramble(aa, bb, YHashMap.hm());
}
public static <T> YSet<YMap<T, T>> scramble(YSet<T> aa, YSet<T> bb, YMap<T, T> prev) {
if (aa.isEmpty() || bb.isEmpty()) return YHashSet.hs(prev);
YSet<YMap<T, T>> result = YHashSet.hs();
T car = aa.car();
YSet<T> cdr = aa.cdr();
for (T b : bb) result.addAll(scramble(cdr, bb.without(b), prev.with(car, b)));
return result;
}
public static <T1, T2, T3> YList<T3> zip(YList<T1> a, YList<T2> b, BiFunction<T1, T2, T3> f) {
YList<T3> result = al();
for (int i = 0; i < a.size(); i++) {
if (b.size() <= i) break;
result.add(f.apply(a.get(i), b.get(i)));
}
return result;
}
}
| 7,996 | 0.56941 | 0.564282 | 222 | 35.018017 | 31.920362 | 124 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.918919 | false | false |
13
|
68273781769a0919cec19619dfe7cc28a08a0980
| 15,066,745,275,159 |
a094a935f9a6401b2149ff5ab9eaafdd71063aeb
|
/Sample project/src/test/java/Test/ReverseNumber.java
|
5f9fd4fa2449a76f2c9119f0944d83c9ef44e00e
|
[] |
no_license
|
santhoshkumarv646/CucumberTrainingProject
|
https://github.com/santhoshkumarv646/CucumberTrainingProject
|
42869b465f6da557836d45706275e6f2a162bed3
|
23a87598e2c8022e99370088ad87415c1cef2e7f
|
refs/heads/master
| 2023-04-11T07:35:11.532000 | 2020-12-14T14:59:42 | 2020-12-14T14:59:42 | 256,186,000 | 0 | 0 | null | false | 2021-04-26T20:10:40 | 2020-04-16T10:45:56 | 2020-12-14T14:59:53 | 2021-04-26T20:10:40 | 4,344 | 0 | 0 | 2 |
Java
| false | false |
package Test;
public class ReverseNumber {
public static void main(String[] args) {
int n =1234,digit;
int c=0;
while(n!=0)
{
digit=n%10;
c= c*10 + digit;
n=n/10;
}
System.out.println(c);
}
}
|
UTF-8
|
Java
| 256 |
java
|
ReverseNumber.java
|
Java
|
[] | null |
[] |
package Test;
public class ReverseNumber {
public static void main(String[] args) {
int n =1234,digit;
int c=0;
while(n!=0)
{
digit=n%10;
c= c*10 + digit;
n=n/10;
}
System.out.println(c);
}
}
| 256 | 0.5 | 0.453125 | 18 | 12.222222 | 11.252435 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.833333 | false | false |
13
|
af17f54945ef9b957c4dcb60853ed70ffc4f17cc
| 3,642,132,290,078 |
18f6b9da3f12b5b8b6788db68dadd93abc79415f
|
/src/com/UF4_6i7/Rectangle2.java
|
85d929aee10d9983d567a5b3a4c6ff5350eeb1e4
|
[] |
no_license
|
saidaHF/practicas_class_java
|
https://github.com/saidaHF/practicas_class_java
|
3a3566485d3356ab9def1747ca1a271568652d55
|
1ab65ceb4e283b3b65fa6eb064728675ebd12dc5
|
refs/heads/master
| 2023-04-22T03:46:51.559000 | 2021-05-18T13:45:28 | 2021-05-18T13:45:28 | 313,303,144 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.UF4_6i7;
public class Rectangle2 extends Figura2 {
// L’àrea del rectangle és base per altura
public int calcularArea(int amplada, int altura) {
return amplada * altura;
}
/*
Genera un mètode a la classe Rectangle anomenat TipusRectangle, que no tingui paràmetres d’entrada ni de sortida ni retorni cap valor,
que mostri per pantalla el literal “No sé si sóc un quadrat”.
*/
public void tipusRectangle() {
System.out.println("No sé si sóc un quadrat");
}
}
|
WINDOWS-1252
|
Java
| 513 |
java
|
Rectangle2.java
|
Java
|
[] | null |
[] |
package com.UF4_6i7;
public class Rectangle2 extends Figura2 {
// L’àrea del rectangle és base per altura
public int calcularArea(int amplada, int altura) {
return amplada * altura;
}
/*
Genera un mètode a la classe Rectangle anomenat TipusRectangle, que no tingui paràmetres d’entrada ni de sortida ni retorni cap valor,
que mostri per pantalla el literal “No sé si sóc un quadrat”.
*/
public void tipusRectangle() {
System.out.println("No sé si sóc un quadrat");
}
}
| 513 | 0.720322 | 0.710262 | 19 | 25.157894 | 33.493538 | 137 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.210526 | false | false |
13
|
9674082083f6ab8996bf659f296de6e45788e131
| 22,797,686,425,581 |
a26d42803f26bab3a9d5a6b8cbf5487c5ad50fda
|
/src/gui/controles/ImpuestoSelector.java
|
5ef33cc9fe7d38372e19997b2e167aea1cb276f0
|
[] |
no_license
|
GAMASH/EON-FASTFOOD
|
https://github.com/GAMASH/EON-FASTFOOD
|
20102d3bdbcdcdbd2213012c8f469f0c8da4a462
|
8085510525a549f0f516352ed76f75bd136dbd3b
|
refs/heads/master
| 2021-01-19T07:07:16.349000 | 2016-10-13T22:25:57 | 2016-10-13T22:25:57 | 60,911,636 | 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 gui.controles;
import abstractt.visual.ComboBox;
import domain.tabla.Impuesto;
/**
*
* @author Developer GAGS
*/
public class ImpuestoSelector extends ComboBox{
Impuesto impuesto;
public ImpuestoSelector() {
impuesto = new Impuesto();
}
public void cargar() {
addArray(Impuesto.cargarImpuesto());
}
public Impuesto getImpuesto() {
try {
impuesto.cargarPorDescripcion(this.getSelectedItem().toString());
} catch (Exception e) {
}
return impuesto;
}
public void setImpuesto(Impuesto aimpuesto){
impuesto = aimpuesto;
setSelectedItem(impuesto.descripcion);
}
}
|
UTF-8
|
Java
| 926 |
java
|
ImpuestoSelector.java
|
Java
|
[
{
"context": ";\nimport domain.tabla.Impuesto;\n\n/**\n *\n * @author Developer GAGS\n */\npublic class ImpuestoSelector extends Co",
"end": 302,
"score": 0.8037843704223633,
"start": 293,
"tag": "NAME",
"value": "Developer"
},
{
"context": "omain.tabla.Impuesto;\n\n/**\n *\n * @author Developer GAGS\n */\npublic class ImpuestoSelector extends ComboBo",
"end": 307,
"score": 0.976963996887207,
"start": 303,
"tag": "NAME",
"value": "GAGS"
}
] | 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 gui.controles;
import abstractt.visual.ComboBox;
import domain.tabla.Impuesto;
/**
*
* @author Developer GAGS
*/
public class ImpuestoSelector extends ComboBox{
Impuesto impuesto;
public ImpuestoSelector() {
impuesto = new Impuesto();
}
public void cargar() {
addArray(Impuesto.cargarImpuesto());
}
public Impuesto getImpuesto() {
try {
impuesto.cargarPorDescripcion(this.getSelectedItem().toString());
} catch (Exception e) {
}
return impuesto;
}
public void setImpuesto(Impuesto aimpuesto){
impuesto = aimpuesto;
setSelectedItem(impuesto.descripcion);
}
}
| 926 | 0.62095 | 0.62095 | 50 | 17.52 | 20.370802 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.26 | false | false |
13
|
09bf8a353b32515b631e331b24e9e54616110084
| 11,682,311,065,532 |
2997aeb97460db8d1d0a8c2085adb613750cfc44
|
/app/src/main/java/com/example/dllo/bestgift/search/SearchListViewAdapter.java
|
85e0c5ceeef0d54042bf9f87bcb831d85653fc61
|
[] |
no_license
|
Saode/BestGift
|
https://github.com/Saode/BestGift
|
fab947b612516991413122e6a9c2ff6c1729d101
|
c5ce0148e86467eb2ee529170580f976ff3d2488
|
refs/heads/master
| 2018-01-02T01:47:38.786000 | 2016-11-16T14:52:12 | 2016-11-16T14:52:12 | 71,782,968 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.dllo.bestgift.search;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import com.example.dllo.bestgift.R;
import com.example.dllo.bestgift.bean.SearchListViewBean;
import com.example.dllo.bestgift.tools.CommonVH;
/**
* Created by dllo on 16/11/9.
*/
public class SearchListViewAdapter extends BaseAdapter {
private Context context;
private SearchListViewBean searchListViewBean;
public void setSearchListViewBean(SearchListViewBean searchListViewBean) {
this.searchListViewBean = searchListViewBean;
}
@Override
public int getCount() {
return searchListViewBean == null ? 0 : searchListViewBean.getData().getPosts().size();
}
@Override
public Object getItem(int i) {
return searchListViewBean.getData().getPosts().get(i);
}
@Override
public long getItemId(int i) {
return i;
}
@Override
public View getView(int i, View view, final ViewGroup viewGroup) {
final CommonVH commonVH = CommonVH.getViewHolder(view,viewGroup,R.layout.item_search_listview);
commonVH.setText(R.id.item_select_list_tv,searchListViewBean.getData().getPosts().get(i).getTitle());
commonVH.setImage(R.id.item_select_list_iv, searchListViewBean.getData().getPosts().get(i).getCover_webp_url());
return commonVH.getItemView();
}
}
|
UTF-8
|
Java
| 1,442 |
java
|
SearchListViewAdapter.java
|
Java
|
[
{
"context": ".dllo.bestgift.tools.CommonVH;\n\n\n/**\n * Created by dllo on 16/11/9.\n */\n\npublic class SearchListViewAdapt",
"end": 335,
"score": 0.9995743632316589,
"start": 331,
"tag": "USERNAME",
"value": "dllo"
}
] | null |
[] |
package com.example.dllo.bestgift.search;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import com.example.dllo.bestgift.R;
import com.example.dllo.bestgift.bean.SearchListViewBean;
import com.example.dllo.bestgift.tools.CommonVH;
/**
* Created by dllo on 16/11/9.
*/
public class SearchListViewAdapter extends BaseAdapter {
private Context context;
private SearchListViewBean searchListViewBean;
public void setSearchListViewBean(SearchListViewBean searchListViewBean) {
this.searchListViewBean = searchListViewBean;
}
@Override
public int getCount() {
return searchListViewBean == null ? 0 : searchListViewBean.getData().getPosts().size();
}
@Override
public Object getItem(int i) {
return searchListViewBean.getData().getPosts().get(i);
}
@Override
public long getItemId(int i) {
return i;
}
@Override
public View getView(int i, View view, final ViewGroup viewGroup) {
final CommonVH commonVH = CommonVH.getViewHolder(view,viewGroup,R.layout.item_search_listview);
commonVH.setText(R.id.item_select_list_tv,searchListViewBean.getData().getPosts().get(i).getTitle());
commonVH.setImage(R.id.item_select_list_iv, searchListViewBean.getData().getPosts().get(i).getCover_webp_url());
return commonVH.getItemView();
}
}
| 1,442 | 0.71706 | 0.712899 | 53 | 26.207546 | 31.372599 | 120 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.45283 | false | false |
13
|
45fc1997e9c3c4be5a0e6480d1da991b55364893
| 5,634,997,161,915 |
3850a13a808fe1fe918a0a6d2f396f15ab750de6
|
/cms_jd1911/src/main/java/com/example/demo/bean/extend/UserRole.java
|
c84805ece1789d92e470a76f23227922e5c91c32
|
[] |
no_license
|
moth-orchid/moth
|
https://github.com/moth-orchid/moth
|
ffe2dc2e0e0a3d8e2e574ff5c918b804f77b8c53
|
bcb4dd6ad1d2241328d999dd86f7389e640d2ba7
|
refs/heads/master
| 2022-06-22T16:02:11.779000 | 2019-11-19T01:59:09 | 2019-11-19T01:59:09 | 221,856,791 | 2 | 0 | null | false | 2022-06-21T02:15:44 | 2019-11-15T06:14:25 | 2019-11-20T03:38:18 | 2022-06-21T02:15:41 | 3,960 | 0 | 0 | 4 |
Java
| false | false |
package com.example.demo.bean.extend;
import java.util.List;
import com.example.demo.bean.Role;
import com.example.demo.bean.User;
public class UserRole extends User{
private List<Role> list;
public List<Role> getList() {
return list;
}
public void setList(List<Role> list) {
this.list = list;
}
}
|
UTF-8
|
Java
| 314 |
java
|
UserRole.java
|
Java
|
[] | null |
[] |
package com.example.demo.bean.extend;
import java.util.List;
import com.example.demo.bean.Role;
import com.example.demo.bean.User;
public class UserRole extends User{
private List<Role> list;
public List<Role> getList() {
return list;
}
public void setList(List<Role> list) {
this.list = list;
}
}
| 314 | 0.719745 | 0.719745 | 19 | 15.526316 | 15.256986 | 39 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.894737 | false | false |
13
|
090c322a9cca048147d8dd1877de15d856c8e95f
| 11,063,835,790,690 |
0cba17dd8e66164abb0e4bb1fd82c1dd519f3eef
|
/bytecub-mqtt/bytecub-mqtt-service/src/main/java/com/bytecub/mqtt/service/state/AuthManager.java
|
f8e38d227f37b23410b7071514f3caa65e8d1270
|
[
"Apache-2.0"
] |
permissive
|
songbin/bytecub
|
https://github.com/songbin/bytecub
|
0e45c541e6a3f916faba3103b13ee717870ce281
|
33121064cdf5fcefb2b2196119ece49d45486fef
|
refs/heads/main
| 2023-03-24T13:48:25.681000 | 2023-03-23T07:29:49 | 2023-03-23T07:29:49 | 348,561,479 | 35 | 11 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.bytecub.mqtt.service.state;
import com.bytecub.common.constants.BCConstants;
import com.bytecub.common.domain.dto.response.device.DevicePageResDto;
import com.bytecub.mdm.service.IDeviceService;
import com.bytecub.mqtt.domain.config.BrokerProperties;
import com.bytecub.utils.Md5Utils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
/**
* 授权管理
* Created by songbin on 2020-11-25.
* @Author
*/
@Service("authManager")
@Slf4j
public class AuthManager {
@Autowired IDeviceService deviceService;
@Autowired BrokerProperties brokerProperties;
public Boolean checkValid( String clientId, String userName, String password){
if(StringUtils.isEmpty(userName) || StringUtils.isEmpty(password)){
return false;
}
try{
return this.verify(clientId, userName, password);
}catch (Exception e){
log.warn("[{}:{}]授权检验异常", userName, password, e);
return false;
}
}
private Boolean verify(String clientId, String userName, String password){
String[] ret = this.parseUserName(userName);
String devCode = ret[0];
if(!this.verifyExpired(ret[1])){
log.warn("MQTT签名过期:username =>{} password=>{}", userName, password);
return false;
}
DevicePageResDto resDto = deviceService.queryByDevCode(clientId);
if(resDto.getEnableStatus() != 1){
log.warn("{}设备未激活,不能连接", devCode);
return false;
}
String srand = userName + BCConstants.AUTH.SIGN_SPLIT + resDto.getDeviceSecret();
String sign = Md5Utils.md5(srand);
if(sign.equals(password)){
return true;
}
log.warn("MQTT密码错误:username =>{} password=>{}", userName, password);
return false;
}
private final String[] parseUserName(String userName){
return userName.split("\\" + BCConstants.AUTH.SIGN_SPLIT);
}
private final Boolean verifyExpired(String timestamp){
if(-1 == brokerProperties.getPasswordExpired()){
return true;
}
Long signTime = Long.valueOf(timestamp);
Long curr = System.currentTimeMillis();
if((curr - signTime) > brokerProperties.getPasswordExpired()){
log.warn("MQTT签名时间[原始字符串=>{} 转化后:{}] 系统当前时间:{}", timestamp, signTime, curr);
return false;
}
return true;
}
public static void main(String[] args){
String userName = "yr1bw0ytbt4uqmfp|123456789";
String srand = userName + BCConstants.AUTH.SIGN_SPLIT + "bbn7mxhw6sjodn9hvaap";
String sign = Md5Utils.md5(srand);
System.out.println(sign);
}
}
|
UTF-8
|
Java
| 2,973 |
java
|
AuthManager.java
|
Java
|
[
{
"context": "ework.util.StringUtils;\n\n/**\n * 授权管理\n * Created by songbin on 2020-11-25.\n * @Author\n */\n@Service(\"authManag",
"end": 581,
"score": 0.9996334314346313,
"start": 574,
"tag": "USERNAME",
"value": "songbin"
},
{
"context": "d main(String[] args){\n String userName = \"yr1bw0ytbt4uqmfp|123456789\";\n String srand = userName + BCC",
"end": 2695,
"score": 0.9220479726791382,
"start": 2679,
"tag": "USERNAME",
"value": "yr1bw0ytbt4uqmfp"
},
{
"context": "rgs){\n String userName = \"yr1bw0ytbt4uqmfp|123456789\";\n String srand = userName + BCConstants.A",
"end": 2705,
"score": 0.9002686738967896,
"start": 2696,
"tag": "PASSWORD",
"value": "123456789"
}
] | null |
[] |
package com.bytecub.mqtt.service.state;
import com.bytecub.common.constants.BCConstants;
import com.bytecub.common.domain.dto.response.device.DevicePageResDto;
import com.bytecub.mdm.service.IDeviceService;
import com.bytecub.mqtt.domain.config.BrokerProperties;
import com.bytecub.utils.Md5Utils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
/**
* 授权管理
* Created by songbin on 2020-11-25.
* @Author
*/
@Service("authManager")
@Slf4j
public class AuthManager {
@Autowired IDeviceService deviceService;
@Autowired BrokerProperties brokerProperties;
public Boolean checkValid( String clientId, String userName, String password){
if(StringUtils.isEmpty(userName) || StringUtils.isEmpty(password)){
return false;
}
try{
return this.verify(clientId, userName, password);
}catch (Exception e){
log.warn("[{}:{}]授权检验异常", userName, password, e);
return false;
}
}
private Boolean verify(String clientId, String userName, String password){
String[] ret = this.parseUserName(userName);
String devCode = ret[0];
if(!this.verifyExpired(ret[1])){
log.warn("MQTT签名过期:username =>{} password=>{}", userName, password);
return false;
}
DevicePageResDto resDto = deviceService.queryByDevCode(clientId);
if(resDto.getEnableStatus() != 1){
log.warn("{}设备未激活,不能连接", devCode);
return false;
}
String srand = userName + BCConstants.AUTH.SIGN_SPLIT + resDto.getDeviceSecret();
String sign = Md5Utils.md5(srand);
if(sign.equals(password)){
return true;
}
log.warn("MQTT密码错误:username =>{} password=>{}", userName, password);
return false;
}
private final String[] parseUserName(String userName){
return userName.split("\\" + BCConstants.AUTH.SIGN_SPLIT);
}
private final Boolean verifyExpired(String timestamp){
if(-1 == brokerProperties.getPasswordExpired()){
return true;
}
Long signTime = Long.valueOf(timestamp);
Long curr = System.currentTimeMillis();
if((curr - signTime) > brokerProperties.getPasswordExpired()){
log.warn("MQTT签名时间[原始字符串=>{} 转化后:{}] 系统当前时间:{}", timestamp, signTime, curr);
return false;
}
return true;
}
public static void main(String[] args){
String userName = "yr1bw0ytbt4uqmfp|<PASSWORD>";
String srand = userName + BCConstants.AUTH.SIGN_SPLIT + "bbn7mxhw6sjodn9hvaap";
String sign = Md5Utils.md5(srand);
System.out.println(sign);
}
}
| 2,974 | 0.653593 | 0.641444 | 78 | 35.935898 | 25.588629 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.769231 | false | false |
13
|
cc47a9d568bea6eecde37bc08cc8822afae76995
| 25,409,026,565,128 |
cf7e81fb29c818d9f3f63b6317b5ce352856c47d
|
/src/main/java/links/tools/ljv/TutorialDemo1.java
|
f009069791252016c91d8e7fafea00a7862cb3cc
|
[] |
no_license
|
DenisPavlov/work_project
|
https://github.com/DenisPavlov/work_project
|
f7a8d6bf310733fca2666c2c1018d603dcc84485
|
a32e9b0b9f9ef693103143d5c5e9e9d5cdaa4228
|
refs/heads/master
| 2022-09-19T17:45:39.639000 | 2021-05-25T06:08:26 | 2021-05-25T06:08:26 | 113,023,764 | 3 | 0 | null | false | 2022-09-08T01:04:13 | 2017-12-04T09:40:20 | 2021-05-25T06:08:29 | 2022-09-08T01:04:11 | 23,754 | 1 | 0 | 5 |
Java
| false | false |
package links.tools.ljv;
public class TutorialDemo1 {
public static void main(String[] args) {
String[] animals = new String[5];
animals[0] = "bird";
animals[3] = "horse";
animals[4] = animals[3].substring(1,3);
LJV.drawGraph( animals );
}
}
|
UTF-8
|
Java
| 292 |
java
|
TutorialDemo1.java
|
Java
|
[] | null |
[] |
package links.tools.ljv;
public class TutorialDemo1 {
public static void main(String[] args) {
String[] animals = new String[5];
animals[0] = "bird";
animals[3] = "horse";
animals[4] = animals[3].substring(1,3);
LJV.drawGraph( animals );
}
}
| 292 | 0.575342 | 0.547945 | 12 | 23.333334 | 16.814346 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.583333 | false | false |
13
|
593f8704cbe1e30ff8cc8eee6ce93271e4422777
| 2,680,059,657,499 |
4129ea4b5788d8b55a2474e70f645929179ab426
|
/src/InMemoryFile/Path.java
|
8c4003ad4cc6a4ea5b0ebb696d19b2f7cc12a96d
|
[] |
no_license
|
jianyuz/CopyGraph
|
https://github.com/jianyuz/CopyGraph
|
51bad1a4915b3f2b954d22c3e90c4bb60393e3e1
|
60a5982eb0453330bfcaebe1cba988bfc715c604
|
refs/heads/master
| 2021-01-17T17:01:01.741000 | 2014-08-20T05:46:57 | 2014-08-20T05:46:57 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package InMemoryFile;
public class Path {
public Path getFilePath(String input){
return null;
}
public String getFileName(){
return null;
}
public String getName(int index){
return null;
}
public int getNameCount(){
return 0;
}
public String subPath(int x, int y){
return null;
}
public String getParent(){
return null;
}
public String getRoot(){
return null;
}
public Path toAbsolutePath(){
return null;
}
public Path toRealPath(){
return null;
}
public Path resolvePath(String path){
return null;
}
public Path relativize(Path p1, Path p2){
return null;
}
public boolean startsWith(Path path){
return true;
}
public boolean endsWith(Path path){
return true;
}
}
|
UTF-8
|
Java
| 749 |
java
|
Path.java
|
Java
|
[] | null |
[] |
package InMemoryFile;
public class Path {
public Path getFilePath(String input){
return null;
}
public String getFileName(){
return null;
}
public String getName(int index){
return null;
}
public int getNameCount(){
return 0;
}
public String subPath(int x, int y){
return null;
}
public String getParent(){
return null;
}
public String getRoot(){
return null;
}
public Path toAbsolutePath(){
return null;
}
public Path toRealPath(){
return null;
}
public Path resolvePath(String path){
return null;
}
public Path relativize(Path p1, Path p2){
return null;
}
public boolean startsWith(Path path){
return true;
}
public boolean endsWith(Path path){
return true;
}
}
| 749 | 0.664887 | 0.660881 | 59 | 11.694915 | 12.868638 | 42 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.423729 | false | false |
13
|
d08d17dfe15ab3ac256f9c1ea6172486bc9cfdf6
| 3,891,240,409,858 |
1064c459df0c59a4fb169d6f17a82ba8bd2c6c1a
|
/trunk/bbs/src/service/cn/itcast/bbs/service/privilege/impl/GroupServiceImpl.java
|
69656825bfe2df2c8a6f40f87f5bad49684ee067
|
[] |
no_license
|
BGCX261/zju-svn-to-git
|
https://github.com/BGCX261/zju-svn-to-git
|
ad87ed4a95cea540299df6ce2d68b34093bcaef7
|
549378a9899b303cb7ac24a4b00da465b6ccebab
|
refs/heads/master
| 2021-01-20T05:53:28.829000 | 2015-08-25T15:46:49 | 2015-08-25T15:46:49 | 41,600,366 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cn.itcast.bbs.service.privilege.impl;
import java.util.List;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import cn.itcast.bbs.entities.privilege.Group;
import cn.itcast.bbs.exception.checked.ItcastNotEmptyException;
import cn.itcast.bbs.service.base.BaseService;
import cn.itcast.bbs.service.privilege.GroupService;
/**
* @author 传智播客.汤阳光 Jun 6
*/
@Service("groupService")
@Transactional(readOnly = true)
public class GroupServiceImpl extends BaseService implements GroupService {
public Group getGroup(int id) {
return groupDao.get(id);
}
public List<Group> findAll() {
return groupDao.findAll();
}
@Transactional
public void addNew(Group group) {
groupDao.save(group);
}
@Transactional
public void deleteGroup(int id) throws ItcastNotEmptyException {
Group group = groupDao.get(id);
if(group == null){
return;
}
if (userDao.findByGroup(group, 0, 1).getTotal() > 0) {
throw new ItcastNotEmptyException("组[id=" + id + ",name=" + group.getName() + "]中含有用户, 不能删除");
}
groupDao.delete(group);
}
@Transactional
public void updateGroup(Group group) {
groupDao.update(group);
}
}
|
UTF-8
|
Java
| 1,291 |
java
|
GroupServiceImpl.java
|
Java
|
[
{
"context": "rvice.privilege.GroupService;\r\n\r\n/**\r\n * @author 传智播客.汤阳光 Jun 6\r\n */\r\n@Service(\"groupService\")\r\n@Tran",
"end": 426,
"score": 0.5664796233177185,
"start": 425,
"tag": "USERNAME",
"value": "智"
},
{
"context": "e.privilege.GroupService;\r\n\r\n/**\r\n * @author 传智播客.汤阳光 Jun 6\r\n */\r\n@Service(\"groupService\")\r\n@Transactio",
"end": 432,
"score": 0.9579439759254456,
"start": 429,
"tag": "NAME",
"value": "汤阳光"
}
] | null |
[] |
package cn.itcast.bbs.service.privilege.impl;
import java.util.List;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import cn.itcast.bbs.entities.privilege.Group;
import cn.itcast.bbs.exception.checked.ItcastNotEmptyException;
import cn.itcast.bbs.service.base.BaseService;
import cn.itcast.bbs.service.privilege.GroupService;
/**
* @author 传智播客.汤阳光 Jun 6
*/
@Service("groupService")
@Transactional(readOnly = true)
public class GroupServiceImpl extends BaseService implements GroupService {
public Group getGroup(int id) {
return groupDao.get(id);
}
public List<Group> findAll() {
return groupDao.findAll();
}
@Transactional
public void addNew(Group group) {
groupDao.save(group);
}
@Transactional
public void deleteGroup(int id) throws ItcastNotEmptyException {
Group group = groupDao.get(id);
if(group == null){
return;
}
if (userDao.findByGroup(group, 0, 1).getTotal() > 0) {
throw new ItcastNotEmptyException("组[id=" + id + ",name=" + group.getName() + "]中含有用户, 不能删除");
}
groupDao.delete(group);
}
@Transactional
public void updateGroup(Group group) {
groupDao.update(group);
}
}
| 1,291 | 0.708831 | 0.705648 | 52 | 22.173077 | 23.55168 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.173077 | false | false |
13
|
a961df6ccebc89cbb7e315ada15655669b69a4db
| 11,089,605,624,044 |
65cb8403c43a69aefc58312d3f623a9293653f31
|
/ch16/StreamPipelineExample.java
|
bde6afab79d575b85724c1ba7b2f53c01dc34051
|
[] |
no_license
|
hyeriii/ezen_java
|
https://github.com/hyeriii/ezen_java
|
3d7773903e18a1d946a51d83553cb7df132d59ff
|
33dc8800365bfacc473e209d7da5bd01d1eae75e
|
refs/heads/main
| 2023-07-15T18:53:25.874000 | 2021-09-06T09:34:58 | 2021-09-06T09:34:58 | 383,202,371 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ch16;
import java.util.Arrays;
import java.util.List;
import java.util.stream.DoubleStream;
import java.util.stream.Stream;
public class StreamPipelineExample {
public static void main(String[] args) {
List<Member> list = Arrays.asList(
new Member("홍길동", Member.MALE, 30),
new Member("김나리", Member.FEMALE, 20),
new Member("신용권", Member.MALE, 45),
new Member("박수미", Member.FEMALE, 27)
);
//스트림 파이프라인을 이용하여 list 남자 평균 나이 구하기
//1.파이프라인 사용 X
Stream<Member> s = list .stream();
//filer() 호출한 스트림에서 true를 리턴하는 원소들로 새로운 스트림 반환
Stream<Member>fs = s.filter((m)->{
if(m.getGender()==0) {
return true;
}else {
return false;
}
});
//남자인 member의 나이값만 구해오기
DoubleStream ds = fs.mapToDouble((m1)->{return m1.getAge();});
//평균 구하기
double result = ds.average().getAsDouble();
System.out.println(result);
}
}
|
UHC
|
Java
| 1,071 |
java
|
StreamPipelineExample.java
|
Java
|
[
{
"context": "ist<Member> list = Arrays.asList(\n\t\t\t\tnew Member(\"홍길동\", Member.MALE, 30),\n\t\t\t\tnew Member(\"김나리\", Member.",
"end": 273,
"score": 0.9998428225517273,
"start": 270,
"tag": "NAME",
"value": "홍길동"
},
{
"context": "w Member(\"홍길동\", Member.MALE, 30),\n\t\t\t\tnew Member(\"김나리\", Member.FEMALE, 20),\n\t\t\t\tnew Member(\"신용권\", Membe",
"end": 313,
"score": 0.9998278617858887,
"start": 310,
"tag": "NAME",
"value": "김나리"
},
{
"context": "Member(\"김나리\", Member.FEMALE, 20),\n\t\t\t\tnew Member(\"신용권\", Member.MALE, 45),\n\t\t\t\tnew Member(\"박수미\", Member.",
"end": 355,
"score": 0.9998341798782349,
"start": 352,
"tag": "NAME",
"value": "신용권"
},
{
"context": "w Member(\"신용권\", Member.MALE, 45),\n\t\t\t\tnew Member(\"박수미\", Member.FEMALE, 27)\n\t\t\t\t);\n\t\t\n\t\t//스트림 파이프라인을 이용하",
"end": 395,
"score": 0.999825119972229,
"start": 392,
"tag": "NAME",
"value": "박수미"
}
] | null |
[] |
package ch16;
import java.util.Arrays;
import java.util.List;
import java.util.stream.DoubleStream;
import java.util.stream.Stream;
public class StreamPipelineExample {
public static void main(String[] args) {
List<Member> list = Arrays.asList(
new Member("홍길동", Member.MALE, 30),
new Member("김나리", Member.FEMALE, 20),
new Member("신용권", Member.MALE, 45),
new Member("박수미", Member.FEMALE, 27)
);
//스트림 파이프라인을 이용하여 list 남자 평균 나이 구하기
//1.파이프라인 사용 X
Stream<Member> s = list .stream();
//filer() 호출한 스트림에서 true를 리턴하는 원소들로 새로운 스트림 반환
Stream<Member>fs = s.filter((m)->{
if(m.getGender()==0) {
return true;
}else {
return false;
}
});
//남자인 member의 나이값만 구해오기
DoubleStream ds = fs.mapToDouble((m1)->{return m1.getAge();});
//평균 구하기
double result = ds.average().getAsDouble();
System.out.println(result);
}
}
| 1,071 | 0.626519 | 0.61105 | 43 | 20.046511 | 17.627876 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.697675 | false | false |
13
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.