blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3542d5b11dbd533fab0d49b74413fa26ca6b0a2d | 5417124e8aff763063677d79ae4ff0dde95c983d | /src/com/lsd/testToken/exception/ExpiredException.java | 0138e025b4c6a08cf55883e1f6af0cf1ea976fe3 | [] | no_license | jianghuabin/testToken | 71cfac3f84c02a212c60029b3e9b71c15dcd94b0 | d86694d42b52db5b78931da0c22c0de8a167cc0e | refs/heads/master | 2021-01-11T11:58:20.858673 | 2017-01-19T05:48:42 | 2017-01-19T05:48:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 743 | java | package com.lsd.testToken.exception;
public class ExpiredException extends TokenException {
public ExpiredException() {
// TODO Auto-generated constructor stub
}
public ExpiredException(String message) {
super(message);
// TODO Auto-generated constructor stub
}
public ExpiredException(Throwable cause) {
super(cause);
// TODO Auto-generated constructor stub
}
public ExpiredException(String message, Throwable cause) {
super(message, cause);
// TODO Auto-generated constructor stub
}
public ExpiredException(String message, Throwable cause,
boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
// TODO Auto-generated constructor stub
}
}
| [
"2964833024@qq.com"
] | 2964833024@qq.com |
44d8304b78d6d3c8cf0be0fa1aafcfe09287cf16 | edffe52b2220ec128d190a28222a417bbcb43bf8 | /owl-transformer/src/main/java/com/owl/trans/etl/mr/ald/AnalyserLogDataMapper.java | ba282f608b46f5909e540ce2989b7597133b18cf | [] | no_license | tangxc227/bd-owl | b75fe7550d42d49af5b5a6c795c2a5cf59ed1fae | 3311d2f3a01d634ef9029f0bbd2f2f53dda4507d | refs/heads/master | 2020-04-12T02:20:10.126515 | 2018-12-24T09:07:46 | 2018-12-24T09:07:46 | 156,675,754 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,596 | java | package com.owl.trans.etl.mr.ald;
import com.owl.trans.common.EventEnum;
import com.owl.trans.common.EventLogConstants;
import com.owl.trans.etl.util.LoggerUtil;
import org.apache.commons.lang.StringUtils;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.log4j.Logger;
import java.io.IOException;
import java.util.Map;
import java.util.zip.CRC32;
/**
* @Author: tangxc
* @Description:
* @Date: Created in 11:07 2018/12/24
* @Modified by:
*/
public class AnalyserLogDataMapper extends Mapper<Object, Text, NullWritable, Put> {
private static final Logger LOGGER = Logger.getLogger(AnalyserLogDataMapper.class);
// 主要用于标志,方便查看过滤数据
private int inputRecords, filterRecords, outputRecords;
private byte[] family = Bytes.toBytes(EventLogConstants.EVENT_LOGS_FAMILY_NAME);
private CRC32 crc32 = new CRC32();
@Override
protected void map(Object key, Text value, Context context) throws IOException, InterruptedException {
this.inputRecords++;
LOGGER.debug("处理数据:" + value.toString());
try {
// 解析日志
Map<String, String> clientInfo = LoggerUtil.handleLog(value.toString());
if (clientInfo.isEmpty()) {
this.filterRecords++;
return;
}
String eventAliasName = clientInfo.get(EventLogConstants.LOG_COLUMN_NAME_EVENT_NAME);
EventEnum eventEnum = EventEnum.valueOfAlias(eventAliasName);
switch (eventEnum) {
case LAUNCH:
case PAGEVIEW:
case CHARGEREQUEST:
case CHARGESUCCESS:
case CHARGEREFUND:
case EVENT:
// 处理数据
this.handleData(clientInfo, eventEnum, context);
break;
default:
this.filterRecords++;
LOGGER.warn("该事件没法进行解析,事件名称为:" + eventAliasName);
}
} catch (Exception e) {
this.filterRecords++;
LOGGER.error("处理数据发生异常, 数据:" + value, e);
}
}
@Override
protected void cleanup(Context context) throws IOException, InterruptedException {
super.cleanup(context);
LOGGER.info("输入数据:" + this.inputRecords + ";输出数据:" + this.outputRecords + ";过滤数据:" + this.filterRecords);
}
private void handleData(Map<String, String> clientInfo, EventEnum eventEnum, Context context) throws IOException, InterruptedException {
String uuid = clientInfo.get(EventLogConstants.LOG_COLUMN_NAME_UUID);
String memberId = clientInfo.get(EventLogConstants.LOG_COLUMN_NAME_MEMBER_ID);
String serverTime = clientInfo.get(EventLogConstants.LOG_COLUMN_NAME_SERVER_TIME);
if (StringUtils.isNotBlank(serverTime)) {
// 去掉浏览器信息
clientInfo.remove(EventLogConstants.LOG_COLUMN_NAME_USER_AGENT);
String rowKey = this.generateRowKey(uuid, memberId, eventEnum.alias, serverTime);
Put put = new Put(Bytes.toBytes(rowKey));
for (Map.Entry<String, String> entry : clientInfo.entrySet()) {
if (StringUtils.isNotBlank(entry.getKey()) && StringUtils.isNotBlank(entry.getValue())) {
put.add(family, Bytes.toBytes(entry.getKey()), Bytes.toBytes(entry.getValue()));
}
}
context.write(NullWritable.get(), put);
this.outputRecords++;
} else {
this.filterRecords++;
}
}
/**
* 根据uuid memberid servertime创建rowkey
*
* @param uuid
* @param memberId
* @param alias
* @param serverTime
* @return
*/
private String generateRowKey(String uuid, String memberId, String alias, String serverTime) {
StringBuilder builder = new StringBuilder();
builder.append(serverTime).append("_");
this.crc32.reset();
if (StringUtils.isNotBlank(uuid)) {
this.crc32.update(uuid.getBytes());
}
if (StringUtils.isNotBlank(memberId)) {
this.crc32.update(memberId.getBytes());
}
this.crc32.update(alias.getBytes());
builder.append(this.crc32.getValue() % 100000000L);
return builder.toString();
}
}
| [
"tang.xicheng@zhimatech.com"
] | tang.xicheng@zhimatech.com |
f88ddc23723ba2d1874c0d7b986a1c0c005053c8 | 7dfb1538fd074b79a0f6a62674d4979c7c55fd6d | /src/repl_it/Android.java | 49b1a59d436aff50220df1568094ca99c46c69c1 | [] | no_license | kutluduman/Java-Programming | 424a4ad92e14f2d4cc700c8a9352ff7408aa993f | d55b8a61ab3a654f954e33db1cb244e36bbcc7da | refs/heads/master | 2022-04-18T03:54:50.219846 | 2020-04-18T05:45:45 | 2020-04-18T05:45:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,353 | java | package repl_it;
import java.util.Scanner;
public class Android {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
double version = scanner.nextDouble();
if (version == 1.5 ) {
System.out.println("Cupcake ");
} else if (version == 1.6) {
System.out.println("Donut ");
} else if (version == 2.1) {
System.out.println("Eclair ");
} else if (version == 2.2) {
System.out.println("Froyo ");
} else if ( version == 2.3) {
System.out.println("Gingerbread ");
} else if ( version == 3.1 ) {
System.out.println("Honeycomb ");
} else if ( version == 4.0 ) {
System.out.println("Ice Cream Sandwich ");
} else if ( version>=4.1 && version<=4.31) {
System.out.println("Jelly Bean ");
} else if (version>=4.4 && version<=4.4) {
System.out.println("KitKat ");
} else if (version>=5.0 && version<=5.1) {
System.out.println("Lollipop ");
} else if (version>=8.0 && version<=8.1) {
System.out.println("Oreo");
} else if (version == 9.0) {
System.out.println("Pie ");
} else {
System.out.println("Sorry, I don't know this version! ");
}
}
} | [
"58450274+kutluduman@users.noreply.github.com"
] | 58450274+kutluduman@users.noreply.github.com |
62494eae573850e73d75ffef91255871b7e8ffeb | 574ab1524deab1ef482c8e307f3390cdd493246f | /src/main/java/com/tictac/co/App.java | 8a5bf3d57993e33cb4717299d410957661b51bcf | [] | no_license | tictac-app/tictacapp | 64c58e1a40c762a31539ad7813721b0ddb8d34ae | 66c2a7375f9433321d0c04acc47f002ca2b4a6f1 | refs/heads/master | 2022-12-01T08:36:56.508174 | 2020-08-05T21:57:35 | 2020-08-05T21:57:35 | 283,319,234 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 176 | java | package com.tictac.co;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}
| [
"harathilohit12@gmail.com"
] | harathilohit12@gmail.com |
bbb0fd3cf3398e7ab6c2e8b3c75761ab8a627a94 | 5ef16fb742e57d55117de7f30586d67d74d531e4 | /NIO and Socket Programming/Spring Boot In Action/spring-boot-demo-21-1/src/main/java/com/roncoo/example/component/RoncooJmsComponent.java | 4a62ae532203678d0e60ef874ef67607aec9a390 | [] | no_license | frankdevhub/Coding-Laboratory | 58f7c146b44b46b04d0cc4b825938c2dc3f8dd6d | 651b4976a014368ab87e2cc4642096118e82d96b | refs/heads/master | 2022-04-10T19:12:26.880040 | 2020-03-26T18:57:02 | 2020-03-26T18:57:02 | 115,873,337 | 5 | 1 | null | null | null | null | UTF-8 | Java | false | false | 700 | java | package com.roncoo.example.component;
import javax.jms.Queue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Component;
/**
*
* @author wujing
*/
@Component
public class RoncooJmsComponent {
@Autowired
private JmsMessagingTemplate jmsMessagingTemplate;
@Autowired
private Queue queue;
public void send(String msg) {
this.jmsMessagingTemplate.convertAndSend(this.queue, msg);
}
@JmsListener(destination = "roncoo.queue")
public void receiveQueue(String text) {
System.out.println("接受到:" + text);
}
}
| [
"frankdevhub@163.com"
] | frankdevhub@163.com |
96d48ea3e89ea1d2daaeb41aae34cffe1e1d5f54 | 1d1055343e529037008939423e1c75aa04d68870 | /TC/app/src/main/java/com/example/tc/MainActivity.java | cdd4f55e6fafe5af819ce15112b900f1f0248278 | [] | no_license | Hassad1916/Android-studio-3 | 526d78ca73e3d39cdea67184aeda7c9c94d71742 | 38334f25a894b81855953327dc1fe3c1dd0c2615 | refs/heads/main | 2023-01-09T18:56:07.201757 | 2020-11-12T06:45:18 | 2020-11-12T06:45:18 | 312,190,973 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,853 | java | package com.example.tc;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import java.text.DecimalFormat;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button button = (Button)findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
DecimalFormat nf = new DecimalFormat("0.00");//小數後兩位
EditText tmpc = (EditText)findViewById(R.id.editTextTextPersonName);
//華氏
double c = Double.parseDouble(tmpc.getText().toString());
double f = (c * 9 / 5) + 32;
TextView trans_Ans = (TextView)findViewById(R.id.textView4);
trans_Ans.setText(""
+ nf.format(f) + " F");
}
});
Button button1 = (Button)findViewById(R.id.button2);
button1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
DecimalFormat nf = new DecimalFormat("0.00");//小數後兩位
EditText tmpf = (EditText)findViewById(R.id.editTextTextPersonName);
//攝氏
double f = Double.parseDouble(tmpf.getText().toString());
double c = (f - 32) * 5 / 9;
TextView trans_Ans = (TextView)findViewById(R.id.textView4);
trans_Ans.setText(""
+ nf.format(c)+" C");
}
});
}
}
| [
"72906611+Hassad1916@users.noreply.github.com"
] | 72906611+Hassad1916@users.noreply.github.com |
8b4498ca8d3c4fcb54b06f9ed67dd7e36b94f4f7 | 6b8481e0fa05e6f6201d02de44dbbb4132c1d675 | /app/src/main/java/com/roman/tihai/lab_021/TextOneActivity.java | 8b7b20619523bc55bed6649de144678ebce4d218 | [] | no_license | Rtihai/Lab_02.1Challenge | 523298733485549e4a461077be9e8a58c2643f3f | c4b101edf40ae2c75cad4fed95b3a6094c4ca5ad | refs/heads/master | 2020-05-16T23:06:23.632703 | 2019-04-27T18:40:45 | 2019-04-27T18:40:45 | 183,355,177 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 341 | java | package com.roman.tihai.lab_021;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class TextOneActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_text1);
}
}
| [
"rtihai@gmail.com"
] | rtihai@gmail.com |
8e5e9b1bf249a5c2dd88c1b0bdfd154043e31e0f | c79d32b780dccf68c66a693ccc93969bae805d9c | /PO/lab4/AviaoMedio.java | 3cb39dc0c4d707e70eb043fc5a486578ec965f94 | [] | no_license | Tiburso/Trabalhos-IST | 1ac065bd1328f37ff8d3d90960cae25ddafd5d27 | 2e473c3bf8a536899304c58b24e45f433962f2a4 | refs/heads/master | 2021-01-15T00:56:00.603234 | 2021-01-03T15:51:34 | 2021-01-03T15:51:34 | 242,820,217 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 178 | java | public class AviaoMedio extends Aviao {
public AviaoMedio(Motor motor) {
super(motor);
}
public void trocarMotor(Motor motor) {
setMotor(motor);
setMotor(motor);
}
} | [
"manuelmariamtc@gmail.com"
] | manuelmariamtc@gmail.com |
e2dbde519915b364b5c9cba04d8ee40729e3d630 | 702375a246be24f8613cda292ff4423c0457fa94 | /LawyerProject/app/src/main/java/com/lawyer/android/adapter/MenuAdapter.java | 4969748170229d8e1f94d0470e5cc2b2c926d201 | [] | no_license | hczcgq/0825 | 7e47a805cdddf97763f604cfb46a2e3aedb120e6 | 329770b0c386764476a4c8f34edd4fb536c87852 | refs/heads/master | 2016-09-10T14:38:15.541270 | 2015-09-14T15:49:25 | 2015-09-14T15:49:25 | 41,426,600 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,183 | java | package com.lawyer.android.adapter;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.lawyer.android.R;
import com.lawyer.android.bean.MenuEntity;
import java.util.List;
/**
* Created by hm-soft on 2015/8/26.
*/
public class MenuAdapter extends BaseAdapterHelpter<MenuEntity>{
private Context context;
private List<MenuEntity> datas;
public MenuAdapter(Context context, List<MenuEntity> datas) {
super(context, datas);
this.context=context;
this.datas=datas;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolderHelper holder = ViewHolderHelper.get(context, convertView,
parent, R.layout.view_menu_item, position);
ImageView iconImageView=holder.getView(R.id.iconImageView);
TextView nameTextView=holder.getView(R.id.nameTextView);
MenuEntity item=datas.get(position);
iconImageView.setImageResource(item.getIcon());
nameTextView.setText(item.getName());
return holder.getConvertView();
}
}
| [
"hczcgq@gmail.com"
] | hczcgq@gmail.com |
301656616d26f201a243f93c7f8fbfa690636e02 | 7596630710b96589a5bc867a67332ebf2f05fda1 | /src/WeightedGraph/UnionFind.java | ecba8fa4211d7e47788eb54e5784fc5864ca4164 | [] | no_license | frankwuyue/Algorithm | 41dd093c126a796000f1cd781832e1cb031a40f8 | 926005058802de8b82b927b66eace21c7ec62ac8 | refs/heads/master | 2022-06-07T13:12:10.700024 | 2020-05-05T06:14:13 | 2020-05-05T06:14:13 | 261,376,113 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,248 | java | package WeightedGraph;
public class UnionFind {
private int[] parent;
private int count;
private int[] rank; // rank[i] stands for rank/depth of union rooted by i
UnionFind(int n) {
this.count = n;
parent = new int[n];
rank = new int[n];
for (int i = 0; i < n; i++) {
parent[i] = i;
rank[i] = 1;
}
}
public int find(int n) {
if (n >= count) {
throw new IllegalArgumentException("Over Capacity!");
}
// while (parent[n] != n) {
// parent[n] = parent[parent[n]];
// n = parent[n];
// }
// return n;
if (parent[n] != n) {
parent[n] = find(parent[n]);
}
return parent[n];
}
public boolean isConnected(int p, int q) {
return find(p) == find(q);
}
public void union(int p, int q) {
int pId = find(p);
int qId = find(q);
if (pId == qId) {
return;
}
if (rank[pId] < rank[qId]) {
parent[pId] = qId;
} else if (rank[qId] < rank[pId]) {
parent[qId] = pId;
} else {
parent[pId] = qId;
rank[qId] += 1;
}
}
}
| [
"wuyuefrank@gmail.com"
] | wuyuefrank@gmail.com |
909a5103bab2ebdaf7cfc523a50b74468f7822bc | 39b7e86a2b5a61a1f7befb47653f63f72e9e4092 | /src/main/java/com/alipay/api/response/KoubeiMarketingMallShoppromoinfoQueryResponse.java | 0f356c5932ffb29daac3b606b6438a5e5711da7c | [
"Apache-2.0"
] | permissive | slin1972/alipay-sdk-java-all | dbec0604c2d0b76d8a1ebf3fd8b64d4dd5d21708 | 63095792e900bbcc0e974fc242d69231ec73689a | refs/heads/master | 2020-08-12T14:18:07.203276 | 2019-10-13T09:00:11 | 2019-10-13T09:00:11 | 214,782,009 | 0 | 0 | Apache-2.0 | 2019-10-13T07:56:34 | 2019-10-13T07:56:34 | null | UTF-8 | Java | false | false | 918 | java | package com.alipay.api.response;
import java.util.List;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.internal.mapping.ApiListField;
import com.alipay.api.domain.ShopPromoInfo;
import com.alipay.api.AlipayResponse;
/**
* ALIPAY API: koubei.marketing.mall.shoppromoinfo.query response.
*
* @author auto create
* @since 1.0, 2019-01-07 20:51:15
*/
public class KoubeiMarketingMallShoppromoinfoQueryResponse extends AlipayResponse {
private static final long serialVersionUID = 3246426675613355777L;
/**
* 店铺营销信息详情
*/
@ApiListField("shop_promo_infos")
@ApiField("shop_promo_info")
private List<ShopPromoInfo> shopPromoInfos;
public void setShopPromoInfos(List<ShopPromoInfo> shopPromoInfos) {
this.shopPromoInfos = shopPromoInfos;
}
public List<ShopPromoInfo> getShopPromoInfos( ) {
return this.shopPromoInfos;
}
}
| [
"ben.zy@antfin.com"
] | ben.zy@antfin.com |
31f8dba3c15f52b7f7e41e94dcddb1317e6c9e0b | be9cdf2d59aa7a33e6dc09f70da07418ae8b05f0 | /src/tryings/TipDonusum.java | 6c4f8d56f45faeeee2fc068b37a4bcb459b5e9e5 | [] | no_license | ZaferKok/MyProject | e9381adab8d102b724bc8be0ee076d1a6ea02e4a | bf13bc398f6fa9198731ffa842d29a6f46bac24d | refs/heads/master | 2022-04-22T23:09:28.192595 | 2020-04-24T00:42:31 | 2020-04-24T00:42:31 | 258,226,786 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 609 | java | package tryings;
public class TipDonusum {
public static void main(String[] args) {
// First way;
int num1 = 32;
int num2 = 18;
System.out.println("Toplam integer olarak : " + (num1+num2));
String newNum1 = "" + num1;
String newNum2 = "" + num2;
System.out.println(newNum1); // It writes as String
System.out.println(newNum2);
System.out.println(newNum1 + newNum2); // result is concatinating. not adding.
// Second way;
String newNum3 = String.valueOf(num1);
String newNum4 = String.valueOf(num2);
}
}
| [
"62161849+ZaferKok@users.noreply.github.com"
] | 62161849+ZaferKok@users.noreply.github.com |
1b8cc65fbd5fc669eb19aa755484a6e21e81b0c9 | 621bb1f04bd65faf94d62e56a035eff450b15b7a | /src/com/Main.java | 867613bc93dcd430fb1b81132c0e9df2f1ffde15 | [] | no_license | shevtsod/ENSE374LabProject | 7cfdd028ff01ca5a685d178c76886ce7ab7793df | 9c34c283f1c6755183e770423ee72b7c2faf8d8b | refs/heads/master | 2021-01-12T14:40:48.403861 | 2017-03-16T00:29:42 | 2017-03-16T00:29:42 | 72,047,286 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,988 | java | package com;
/*
* FILENAME: Main.java
* COURSE: ENSE 374
* AUTHOR: Daniel Shevtsov
*/
import com.shevtsod.Simulator.BoardManager;
import java.util.InputMismatchException;
import java.util.Scanner;
/**
* <p>
* The primary entry point for the program
* </p>
*
* @author Daniel Shevtsov
*/
public class Main {
/**
* The primary entry point for the program.
* Currently, this method simply passes control of the program to a
* BoardManager object after it is initialized with an x,y board size.
* The current version does not use parameters passed by args.
* @param args Arguments from command line
*/
public static void main(String args[]) {
int sizeX = 0,
sizeY = 0,
min = 2,
max = 10;
boolean correctInput;
//Print welcome screen.
//Generated using http://patorjk.com/software/taag/
System.out.println(
"\n" +
"*****************************************************************\n" +
" / \\ _ __ (_)_ __ ___ __ _| / ___|(_)_ __ ___ \n" +
" / _ \\ | '_ \\| | '_ ` _ \\ / _` | \\___ \\| | '_ ` _ \\ \n" +
" / ___ \\| | | | | | | | | | (_| | |___) | | | | | | |\n" +
" /_/ \\_\\_| |_|_|_| |_| |_|\\__,_|_|____/|_|_| |_| |_|\n" +
"Animal Habitat Simulator created by Daniel Shevtsov for ENSE 374" +
"\n*****************************************************************\n"
);
Scanner input = new Scanner(System.in, "UTF-8");
// Get number of horizontal cells from min to max from keyboard input
System.out.println("Enter number of horizontal cells (" + min + " to " + max + "): ");
correctInput = false;
do {
System.out.print("\tINPUT: ");
try {
sizeX = input.nextInt();
if(sizeX >= min && sizeX <= max) {
correctInput = true;
} else {
System.out.println(
"ERROR: The value given for number of horizontal cells " +
"must be between 3 and 10"
);
input.nextLine();
}
} catch(InputMismatchException e) {
System.out.println(
"ERROR: The value given for number of horizontal cells " +
"must be between 3 and 10"
);
input.nextLine();
}
} while(!correctInput);
// Get number of vertical cells from min to max from keyboard input
System.out.println("Enter number of vertical cells (" + min + " to " + max + "): ");
correctInput = false;
do {
System.out.print("\tINPUT: ");
try {
sizeY = input.nextInt();
if(sizeY >= min && sizeY <= max) {
correctInput = true;
} else {
System.out.println(
"ERROR: The value given for number of vertical " +
"cells must be between " + min + " and " + max
);
input.nextLine();
}
} catch(InputMismatchException e) {
System.out.println(
"ERROR: The value given for number of vertical cells " +
"must be between " + min + " and " + max
);
input.nextLine();
}
} while(!correctInput);
System.out.println(
"Starting simulator with board of size (" +
sizeX + " x " + sizeY + ")"
);
BoardManager mainBM = new BoardManager(sizeX, sizeY);
//Pass control of the program to the BoardManager
mainBM.simulate();
input.close();
}
}
| [
"daniel.shevtsov@gmail.com"
] | daniel.shevtsov@gmail.com |
5bbf9b3ebda5d3f9811426100094827aa63df2cf | 4e3f175b329973f32d9a284219ea6343ea5b6b26 | /src/main/java/org/example/exerciseOne/model/Truck.java | 376104db6ac0905eb2fe3de0c254a655e2ed9cd8 | [] | no_license | Benjamineboson/Inheritance_Exercises_Lexicon | 1c77fdbded72895b975d240ee9a4342e074fdbe3 | d4bf6420d3eef3d156fdfbddb0b50ccb070232f9 | refs/heads/master | 2023-01-02T12:18:02.824434 | 2020-04-17T09:39:08 | 2020-04-17T09:39:08 | 256,461,646 | 0 | 2 | null | 2020-10-13T21:16:22 | 2020-04-17T09:36:34 | Java | UTF-8 | Java | false | false | 443 | java | package org.example.exerciseOne.model;
public class Truck extends Vehicle {
private double maxWeight;
private int maxSpeed;
public Truck(int vehicleId, String brand, String regNum, double maxWeight, int maxSpeed){
super(vehicleId,brand,regNum);
this.maxWeight = maxWeight;
this.maxSpeed = maxSpeed;
}
@Override
public void drive() {
System.out.println("Truck is driving...");
}
}
| [
"benjamineboson@gmail.com"
] | benjamineboson@gmail.com |
b63585c13d750e7691a6b6588fb9c0e6406d2f15 | b648206752b73eb20db7b9c3a0c403927237041b | /java/SyncCases/app/src/main/java/com/example/olivermensah/synccases/SplashActivity.java | 24d3b62dc7fba03bf4b73bc14fab7aa3d4ce32d0 | [] | no_license | OliverMensahDev/Android | e22cbdea32f43bcb190437001dc75289104cbf75 | 84062e4b8fc4d9cad0246f5fb159f9bdfb7b05f3 | refs/heads/master | 2021-10-22T08:26:39.923971 | 2019-03-09T10:01:50 | 2019-03-09T10:01:50 | 135,918,934 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,382 | java | package com.example.olivermensah.synccases;
/**
* Created by olivermensah on 12/3/17.
*/
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
public class SplashActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
FirebaseUser currentUser = FirebaseAuth.getInstance().getCurrentUser();
if(currentUser != null){
Intent homeIntent = new Intent(SplashActivity.this, SignedInActivity.class);
finish();
startActivity(homeIntent);
}else{
Intent homeIntent = new Intent(SplashActivity.this, LoginActivity.class);
finish();
startActivity(homeIntent);
}
}
}, 3000);
}
// [START on_start_check_user]
@Override
public void onStart() {
super.onStart();
}
// [END on_start_check_user]
}
| [
"olivermensah96@gmail.com"
] | olivermensah96@gmail.com |
f444311dcff8b8669747e7c2072de0d07123527a | 4e1e5e2518e2d9e43fe35b245cd9680b8a88ec32 | /src/java/com/yitong/app/action/judicial/dxzpzfdj/ZfdjAction.java | 9b25c9aaa951a27e85e826501e39f96904243ff9 | [] | no_license | MoonLuckSir/MoonRepository | df0592f2f43bb04bcfa4cdbd0f02582f2743604c | 12ad3b4dcbcbc639d90e11366dbd81ab8ba2c172 | refs/heads/master | 2021-01-12T15:41:00.492001 | 2016-10-25T01:56:00 | 2016-10-25T01:56:00 | 71,849,484 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 64,829 | java | package com.yitong.app.action.judicial.dxzpzfdj;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFPatriarch;
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFSimpleShape;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import cfca.safeguard.Result;
import cfca.safeguard.api.bank.ClientEnvironment;
import cfca.safeguard.api.bank.Constants;
import cfca.safeguard.api.bank.SGBusiness;
import cfca.safeguard.api.bank.bean.tx.upstream.Tx100401;
import cfca.safeguard.api.bank.bean.tx.upstream.Tx100403;
import cfca.safeguard.api.bank.bean.tx.upstream.Tx100404;
import cfca.safeguard.api.bank.bean.tx.upstream.Tx100405;
import cfca.safeguard.api.bank.util.ResultUtil;
import cfca.safeguard.tx.Attachment;
import cfca.safeguard.tx.Transaction;
import cfca.safeguard.tx.business.bank.TxCaseReport_Transaction;
import cfca.safeguard.tx.business.bank.TxExceptionalEvent_Account;
import cfca.safeguard.tx.business.bank.TxExceptionalEvent_Accounts;
import cfca.safeguard.tx.business.bank.TxExceptionalEvent_Transaction;
import cfca.safeguard.tx.business.bank.TxInvolvedAccount_Account;
import cfca.safeguard.tx.business.bank.TxUnusualOpencard_Accounts;
import com.oreilly.servlet.ServletUtils;
import com.yitong.app.service.judicial.dxzpzfdj.ZfdjService;
import com.yitong.commons.action.BaseAction;
import com.yitong.commons.model.IListPage;
import com.yitong.commons.util.ParamUtil;
import com.yitong.commons.util.StringUtil;
public class ZfdjAction extends BaseAction {
protected static final Logger logger = Logger.getLogger(ZfdjAction.class);
private ZfdjService zfdjService;
public ZfdjService getZfdjService() {
return zfdjService;
}
public void setZfdjService(ZfdjService zfdjService) {
this.zfdjService = zfdjService;
}
/**
* 司法查询:止付查询
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws UnsupportedEncodingException
*/
@SuppressWarnings("unchecked")
public ActionForward toZfTaskList(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
Map params = new HashMap();
ParamUtil.putStr2Map(request, "APPLICATIONID", params);
ParamUtil.putStr2Map(request, "STATUS", params);
ParamUtil.putStr2Map(request, "ksr", params);
ParamUtil.putStr2Map(request, "jsr", params);
int pageNo = ParamUtil.getInt(request, "pageNo", 1);
IListPage page = zfdjService.pageQueryZfTask(params, pageNo);
request.setAttribute("page", page);
return mapping.findForward("list");
}
@SuppressWarnings("unchecked")
public ActionForward toView(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String APPLICATIONID = ParamUtil.get(request, "APPLICATIONID");
Map params = new HashMap();
ParamUtil.putStr2Map(request, "APPLICATIONID", params);
Map entry = zfdjService.load(APPLICATIONID);
request.setAttribute("rst", entry);
return mapping.findForward("view");
}
/**
* 司法查询:止付反馈查询
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws UnsupportedEncodingException
*/
@SuppressWarnings("unchecked")
public ActionForward toZffkTaskList(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
Map params = new HashMap();
ParamUtil.putStr2Map(request, "APPLICATIONID", params);
int pageNo = ParamUtil.getInt(request, "pageNo", 1);
IListPage page = zfdjService.pageQueryZffkTask(params, pageNo);
request.setAttribute("page", page);
return mapping.findForward("zffklist");
}
@SuppressWarnings("unchecked")
public ActionForward toZffkView(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String APPLICATIONID = ParamUtil.get(request, "APPLICATIONID");
Map params = new HashMap();
ParamUtil.putStr2Map(request, "APPLICATIONID", params);
Map entry = zfdjService.zffkload(APPLICATIONID);
request.setAttribute("rst", entry);
return mapping.findForward("zffkview");
}
/**
* 司法查询:止付解除查询
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws UnsupportedEncodingException
*/
@SuppressWarnings("unchecked")
public ActionForward toJcTaskList(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
Map params = new HashMap();
ParamUtil.putStr2Map(request, "APPLICATIONID", params);
ParamUtil.putStr2Map(request, "STATUS", params);
ParamUtil.putStr2Map(request, "ksr", params);
ParamUtil.putStr2Map(request, "jsr", params);
int pageNo = ParamUtil.getInt(request, "pageNo", 1);
IListPage page = zfdjService.pageQueryJcTask(params, pageNo);
request.setAttribute("page", page);
return mapping.findForward("jclist");
}
@SuppressWarnings("unchecked")
public ActionForward toJcView(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String APPLICATIONID = ParamUtil.get(request, "APPLICATIONID");
Map params = new HashMap();
ParamUtil.putStr2Map(request, "APPLICATIONID", params);
Map entry = zfdjService.jcload(APPLICATIONID);
request.setAttribute("rst", entry);
return mapping.findForward("jcview");
}
/**
* 司法查询:止付解除反馈查询
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws UnsupportedEncodingException
*/
@SuppressWarnings("unchecked")
public ActionForward toJcfkTaskList(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
Map params = new HashMap();
ParamUtil.putStr2Map(request, "APPLICATIONID", params);
int pageNo = ParamUtil.getInt(request, "pageNo", 1);
IListPage page = zfdjService.pageQueryJcfkTask(params, pageNo);
request.setAttribute("page", page);
return mapping.findForward("jcfklist");
}
@SuppressWarnings("unchecked")
public ActionForward toJcfkView(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String APPLICATIONID = ParamUtil.get(request, "APPLICATIONID");
Map params = new HashMap();
ParamUtil.putStr2Map(request, "APPLICATIONID", params);
Map entry = zfdjService.jcfkload(APPLICATIONID);
request.setAttribute("rst", entry);
return mapping.findForward("jcfkview");
}
/**
* 司法查询:止付延期查询
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws UnsupportedEncodingException
*/
@SuppressWarnings("unchecked")
public ActionForward toYqTaskList(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
Map params = new HashMap();
ParamUtil.putStr2Map(request, "APPLICATIONID", params);
ParamUtil.putStr2Map(request, "STATUS", params);
ParamUtil.putStr2Map(request, "ksr", params);
ParamUtil.putStr2Map(request, "jsr", params);
int pageNo = ParamUtil.getInt(request, "pageNo", 1);
IListPage page = zfdjService.pageQueryYqTask(params, pageNo);
request.setAttribute("page", page);
return mapping.findForward("yqlist");
}
@SuppressWarnings("unchecked")
public ActionForward toYqView(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String APPLICATIONID = ParamUtil.get(request, "APPLICATIONID");
Map params = new HashMap();
ParamUtil.putStr2Map(request, "APPLICATIONID", params);
Map entry = zfdjService.yqload(APPLICATIONID);
request.setAttribute("rst", entry);
return mapping.findForward("yqview");
}
/**
* 司法查询:止付延期反馈查询
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws UnsupportedEncodingException
*/
@SuppressWarnings("unchecked")
public ActionForward toYqfkTaskList(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
Map params = new HashMap();
ParamUtil.putStr2Map(request, "APPLICATIONID", params);
int pageNo = ParamUtil.getInt(request, "pageNo", 1);
IListPage page = zfdjService.pageQueryYqfkTask(params, pageNo);
request.setAttribute("page", page);
return mapping.findForward("yqfklist");
}
@SuppressWarnings("unchecked")
public ActionForward toYqfkView(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String APPLICATIONID = ParamUtil.get(request, "APPLICATIONID");
Map params = new HashMap();
ParamUtil.putStr2Map(request, "APPLICATIONID", params);
Map entry = zfdjService.yqfkload(APPLICATIONID);
request.setAttribute("rst", entry);
return mapping.findForward("yqfkview");
}
/**
* 司法查询:冻结查询
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws UnsupportedEncodingException
*/
@SuppressWarnings("unchecked")
public ActionForward toDjTaskList(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
Map params = new HashMap();
ParamUtil.putStr2Map(request, "APPLICATIONID", params);
ParamUtil.putStr2Map(request, "ACCOUNTNUMBER", params);
ParamUtil.putStr2Map(request, "STATUS", params);
ParamUtil.putStr2Map(request, "ksr", params);
ParamUtil.putStr2Map(request, "jsr", params);
int pageNo = ParamUtil.getInt(request, "pageNo", 1);
IListPage page = zfdjService.pageQueryDjTask(params, pageNo);
request.setAttribute("page", page);
return mapping.findForward("djlist");
}
@SuppressWarnings("unchecked")
public ActionForward toDjView(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String APPLICATIONID = ParamUtil.get(request, "APPLICATIONID");
Map params = new HashMap();
ParamUtil.putStr2Map(request, "APPLICATIONID", params);
Map entry = zfdjService.djload(APPLICATIONID);
request.setAttribute("rst", entry);
return mapping.findForward("djview");
}
/**
* 司法查询:冻结反馈查询
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws UnsupportedEncodingException
*/
@SuppressWarnings("unchecked")
public ActionForward toDjfkTaskList(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
Map params = new HashMap();
ParamUtil.putStr2Map(request, "APPLICATIONID", params);
int pageNo = ParamUtil.getInt(request, "pageNo", 1);
IListPage page = zfdjService.pageQueryDjfkTask(params, pageNo);
request.setAttribute("page", page);
return mapping.findForward("djfklist");
}
@SuppressWarnings("unchecked")
public ActionForward toDjfkView(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String APPLICATIONID = ParamUtil.get(request, "APPLICATIONID");
Map params = new HashMap();
ParamUtil.putStr2Map(request, "APPLICATIONID", params);
Map entry = zfdjService.djfkload(APPLICATIONID);
request.setAttribute("rst", entry);
return mapping.findForward("djfkview");
}
/**
* 司法查询:冻结解除查询
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws UnsupportedEncodingException
*/
@SuppressWarnings("unchecked")
public ActionForward toDjjcTaskList(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
Map params = new HashMap();
ParamUtil.putStr2Map(request, "APPLICATIONID", params);
ParamUtil.putStr2Map(request, "ORIGINALAPPLICATIONID", params);
ParamUtil.putStr2Map(request, "ACCOUNTNUMBER", params);
ParamUtil.putStr2Map(request, "STATUS", params);
ParamUtil.putStr2Map(request, "ksr", params);
ParamUtil.putStr2Map(request, "jsr", params);
int pageNo = ParamUtil.getInt(request, "pageNo", 1);
IListPage page = zfdjService.pageQueryDjjcTask(params, pageNo);
request.setAttribute("page", page);
return mapping.findForward("djjclist");
}
@SuppressWarnings("unchecked")
public ActionForward toDjjcView(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String APPLICATIONID = ParamUtil.get(request, "APPLICATIONID");
Map params = new HashMap();
ParamUtil.putStr2Map(request, "APPLICATIONID", params);
Map entry = zfdjService.djjcload(APPLICATIONID);
request.setAttribute("rst", entry);
return mapping.findForward("djjcview");
}
/**
* 司法查询:冻结解除反馈查询
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws UnsupportedEncodingException
*/
@SuppressWarnings("unchecked")
public ActionForward toDjjcfkTaskList(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
Map params = new HashMap();
ParamUtil.putStr2Map(request, "APPLICATIONID", params);
int pageNo = ParamUtil.getInt(request, "pageNo", 1);
IListPage page = zfdjService.pageQueryDjjcfkTask(params, pageNo);
request.setAttribute("page", page);
return mapping.findForward("djjcfklist");
}
@SuppressWarnings("unchecked")
public ActionForward toDjjcfkView(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String APPLICATIONID = ParamUtil.get(request, "APPLICATIONID");
Map params = new HashMap();
ParamUtil.putStr2Map(request, "APPLICATIONID", params);
Map entry = zfdjService.djjcfkload(APPLICATIONID);
request.setAttribute("rst", entry);
return mapping.findForward("djjcfkview");
}
/**
* 司法查询:冻结延期查询
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws UnsupportedEncodingException
*/
@SuppressWarnings("unchecked")
public ActionForward toDjyqTaskList(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
Map params = new HashMap();
ParamUtil.putStr2Map(request, "APPLICATIONID", params);
ParamUtil.putStr2Map(request, "ORIGINALAPPLICATIONID", params);
ParamUtil.putStr2Map(request, "ACCOUNTNUMBER", params);
ParamUtil.putStr2Map(request, "STATUS", params);
ParamUtil.putStr2Map(request, "ksr", params);
ParamUtil.putStr2Map(request, "jsr", params);
int pageNo = ParamUtil.getInt(request, "pageNo", 1);
IListPage page = zfdjService.pageQueryDjyqTask(params, pageNo);
request.setAttribute("page", page);
return mapping.findForward("djyqlist");
}
@SuppressWarnings("unchecked")
public ActionForward toDjyqView(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String APPLICATIONID = ParamUtil.get(request, "APPLICATIONID");
Map params = new HashMap();
ParamUtil.putStr2Map(request, "APPLICATIONID", params);
Map entry = zfdjService.djyqload(APPLICATIONID);
request.setAttribute("rst", entry);
return mapping.findForward("djyqview");
}
/**
* 司法查询:冻结延期反馈查询
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws UnsupportedEncodingException
*/
@SuppressWarnings("unchecked")
public ActionForward toDjyqfkTaskList(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
Map params = new HashMap();
ParamUtil.putStr2Map(request, "APPLICATIONID", params);
int pageNo = ParamUtil.getInt(request, "pageNo", 1);
IListPage page = zfdjService.pageQueryDjyqfkTask(params, pageNo);
request.setAttribute("page", page);
return mapping.findForward("djyqfklist");
}
@SuppressWarnings("unchecked")
public ActionForward toDjyqfkView(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String APPLICATIONID = ParamUtil.get(request, "APPLICATIONID");
Map params = new HashMap();
ParamUtil.putStr2Map(request, "APPLICATIONID", params);
Map entry = zfdjService.djyqfkload(APPLICATIONID);
request.setAttribute("rst", entry);
return mapping.findForward("djyqfkview");
}
/**
* 司法查询:司法查控业务统计表
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws UnsupportedEncodingException
*/
public ActionForward toYwtjOperation(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
return mapping.findForward("ywtjview");
}
/**
* 司法查询:生成业务统计表
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws ParseException
* @throws UnsupportedEncodingException
*/
public ActionForward makeYwtjExcel(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws ParseException {
response.setContentType("application/x-msdownload");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd 00:00:00");
Map params = new HashMap();
String startDay = request.getParameter("ksr");
String endDay = request.getParameter("jsr");
params.put("ksr", startDay+" 00:00:00");
params.put("jsr", endDay+" 23:59:59");
Map<String, String> map = zfdjService.dxzpSfckAddUp(params);
//开始生成Excel统计表
int totalColNum = 4;
//这里是poi操作excel的基本导入命令 思路 创建工作簿 工作簿创建工作表 工作表创建行 行创建单元格
HSSFWorkbook wk = new HSSFWorkbook();
HSSFSheet sheet = wk.createSheet("业务统计表");
//设置四个列宽
sheet.setColumnWidth(0, 6000) ;
sheet.setColumnWidth(1, 6000) ;
sheet.setColumnWidth(2, 6000) ;
sheet.setColumnWidth(3, 6000) ;
//标题单元格样式
HSSFCellStyle titleCellStyle = wk.createCellStyle() ;
HSSFFont titleCellfont = wk.createFont();
titleCellStyle.setAlignment(CellStyle.ALIGN_CENTER);//水平居中
titleCellStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);//垂直居中
titleCellfont.setFontHeightInPoints((short) 14);// 设置字体大小
titleCellfont.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL);//加粗
//第二行单元格样式
HSSFCellStyle secCellStyle = wk.createCellStyle();
secCellStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
//斜线单元格样式
HSSFCellStyle patriarchCellStyle = wk.createCellStyle() ;
HSSFFont patriarchCellfont = wk.createFont();
patriarchCellfont.setFontHeightInPoints((short) 9);// 设置字体大小
patriarchCellStyle.setAlignment(CellStyle.ALIGN_CENTER);//水平居中
patriarchCellStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);//垂直居中
patriarchCellStyle.setFont(patriarchCellfont);
//其他单元格样式
HSSFCellStyle otherCellStyle = wk.createCellStyle() ;
otherCellStyle.setWrapText(true); //设置自动换行
otherCellStyle.setAlignment(CellStyle.ALIGN_CENTER);//水平居中
otherCellStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);//垂直居中
//设置标题
HSSFRow titleRow = sheet.createRow(0);
HSSFCell titleCell = titleRow.createCell(0);
titleCell.setCellValue("业务统计表");
titleCell.setCellStyle(titleCellStyle);
titleRow.setHeight((short) 1000);
sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 3));
//设置第二行
HSSFRow secRow = sheet.createRow(1);
secRow.setHeight((short)400);
HSSFCell unitCell = secRow.createCell(0);
HSSFCell dateCell = secRow.createCell(3);
unitCell.setCellValue("填报单位:(公章)");
unitCell.setCellStyle(secCellStyle);
dateCell.setCellValue("日期:");
dateCell.setCellStyle(secCellStyle);
//设置表头行
HSSFRow tableHeaderRow = sheet.createRow(2);
tableHeaderRow.setHeight((short) 700) ;
//将表头所有列设置成数组
HSSFCell[] tableHeaderCell = new HSSFCell[totalColNum];
//将第一行所有列名写入到一个string数组里
String[] colNames = new String[totalColNum];
colNames[0] = "";
colNames[1] = "业务笔数\r(单位:笔)";
colNames[2] = "账户数量\r(单位:笔)";
colNames[3] = "金额\r(单位:元)";
//循环遍历第二行所有列
for(int i=0;i<totalColNum;i++){
//挨个创建表头单元格
tableHeaderCell[i] = tableHeaderRow.createCell(i);
if(i == 0){
tableHeaderCell[0].setCellValue("业务种类 处理结果") ;
tableHeaderCell[0].setCellStyle(patriarchCellStyle) ;
}else{
//设置第一行单元格的值 也就是表头的名称 这里的new HSSFRichTextString(colNames[i]) 是把值都转换为文本类型
tableHeaderCell[i].setCellValue(new HSSFRichTextString(colNames[i]));
tableHeaderCell[i].setCellStyle(otherCellStyle) ;
}
}
//画线(由左上到右下的斜线)
HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
HSSFClientAnchor a = new HSSFClientAnchor(0, 0, 1023, 255, (short)0, 2, (short)0, 2);
HSSFSimpleShape shape1 = patriarch.createSimpleShape(a);
shape1.setShapeType(HSSFSimpleShape.OBJECT_TYPE_LINE);
shape1.setLineStyle(HSSFSimpleShape.LINESTYLE_SOLID) ;
HSSFClientAnchor b = new HSSFClientAnchor(0, 0, 1023, 255, (short)3, 5, (short)3, 5);
HSSFSimpleShape shape2 = patriarch.createSimpleShape(b);
shape2.setShapeType(HSSFSimpleShape.OBJECT_TYPE_LINE);
shape2.setLineStyle(HSSFSimpleShape.LINESTYLE_SOLID) ;
//下面的一段代码是将结果集里的值插入到excel中去
for(int k=3;k<7;k++){//设置行
//循环创建行 从第二行开始
HSSFRow row = sheet.createRow(k);
row.setHeight((short) 700) ;
for(int i=0;i<totalColNum;i++){//设置列
//创建每个单元格
HSSFCell cell = row.createCell(i);
cell.setCellStyle(otherCellStyle);
//为单元格赋值 同样的使用new HSSFRichTextString()是为了将值都转化为文本格式处理
//rs.getString(i+1)结果集是从1开始遍历值的
if(k == 3 && i == 0){//第二行第一列
cell.setCellValue(new HSSFRichTextString("紧急止付"));
}
if(k == 3 && i == 1){//第二行第二列 紧急止付业务笔数
cell.setCellValue(new HSSFRichTextString( map.get("zfBizNum")));
}
if(k == 3 && i == 2){//第二行第三列 紧急止付账户数量
cell.setCellValue(new HSSFRichTextString(map.get("zfAcctNum")));
}
if(k == 3 && i == 3){//第二行第四列 紧急止付金额
cell.setCellValue(new HSSFRichTextString(map.get("zfAcctBalance")));
}
if(k == 4 && i == 0){//第三行第一列
cell.setCellValue(new HSSFRichTextString("快速冻结"));
}
if(k == 4 && i == 1){//第三行第二列 快速冻结业务笔数
cell.setCellValue(new HSSFRichTextString( map.get("djBizNum")));
}
if(k == 4 && i == 2){//第三行第三列 快速冻结账户数量
cell.setCellValue(new HSSFRichTextString( map.get("djAcctNum")));
}
if(k == 4 && i == 3){//第三行第四列 快速冻结金额
cell.setCellValue(new HSSFRichTextString( map.get("djAcctBalance")));
}
if(k == 5 && i == 0){//第四行第一列 快速查询
cell.setCellValue(new HSSFRichTextString("快速查询"));
}
if(k == 5 && i == 1){//第四行第二列 快速查询业务笔数
cell.setCellValue(new HSSFRichTextString( map.get("qryBizNum")));
}
if(k == 5 && i == 2){//第四行第三列 快速查询账户数量
cell.setCellValue(new HSSFRichTextString( map.get("qryAcctNum")));
}
if(k == 5 && i == 3){//第四行第四列 快速查询金额 无效
cell.setCellValue(new HSSFRichTextString(""));
cell.setCellStyle(patriarchCellStyle);
}
if(k == 6 && i == 0){//第五行第一列
cell.setCellValue(new HSSFRichTextString("合计"));
}
if(k == 6 && i == 1){//第五行第二列 合计业务笔数
cell.setCellValue(new HSSFRichTextString( map.get("totalBizNum")));
}
if(k == 6 && i == 2){//第五行第三列 合计账户数量
cell.setCellValue(new HSSFRichTextString(map.get("totalAcctNum")));
}
if(k == 6 && i == 3){//第五行第四列 合计金额
cell.setCellValue(new HSSFRichTextString(map.get("totalAcctBalance")));
}
}
}
System.out.println("模板生成成功");
String filename = "sfckywtjbb_"+startDay+"_"+endDay+".xls";
OutputStream os= null;
try {
response.setHeader("Content-Disposition","attachment;"+"filename="+new String(filename.getBytes(), "ISO-8859-1"));
os=response.getOutputStream();
wk.write(os);
os.flush();
} catch (Exception e) {
e.getStackTrace();
}finally{
if(os != null){
try {
os.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
return null;
}
/**
* 司法查询:跳转到出错信息
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws UnsupportedEncodingException
*/
public ActionForward toErrorInfo(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws UnsupportedEncodingException {
System.out.println(ParamUtil.get(request, "errorInfo"));
String errorInfo = URLDecoder.decode(ParamUtil.get(request, "errorInfo"), "utf-8") ;
request.setAttribute("errorInfo", errorInfo);
return mapping.findForward("errorInfo");
}
/**
* 法律文书下载
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
public ActionForward downLoadFile(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
String savePath = request.getParameter("savePath");
File file = new File(savePath);
if(!file.exists()){
request.setAttribute("msg", "无法下载,"+savePath+"路径下文件未找到!");
return mapping.findForward(FAILURE);
}
String[] filenames = savePath.split("/");
System.out.println(filenames[filenames.length-1]);
try {
response.reset();
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(filenames[filenames.length-1], "UTF-8"));
ServletOutputStream out = null;
out = response.getOutputStream();
ServletUtils.returnFile(savePath, out);// 下载文件
out.close();
} catch (UnsupportedEncodingException ex) {// iso8559_1编码异常
ex.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
}
return null;
}
/**
* 异常开卡可疑名单上报页面
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
@SuppressWarnings("unchecked")
public ActionForward toSendCard(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
return mapping.findForward("toSendCard");
}
/**
* 异常开卡可疑名单上报方法
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
@SuppressWarnings("unchecked")
public ActionForward sendCard(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
Tx100403 tx100403 = new Tx100403();
String featureCode = request.getParameter("featureCode");//事件特征码
String IDType = request.getParameter("IDType");//证件类型
String IDNumber = request.getParameter("IDNumber");//证件号
String IDName = request.getParameter("IDName");//姓名
String cardNumber = request.getParameter("cardNumber");//卡/折号
String accountOpenTime = request.getParameter("accountOpenTime");//开卡时间
String accountOpenPlace = request.getParameter("accountOpenPlace");//开卡地点
String operatorName = request.getParameter("operatorName");//经办人姓名
String operatorPhoneNumber = request.getParameter("operatorPhoneNumber");//经办人电话
String transSerialNumber = StringUtil.getTransSerialNumber();//传输报文流水号
//String newTransSerialNumber = StringUtil.getTransSerialNumber();//传输报文流水号
String applicationId = StringUtil.getApplicationID();//业务申请编号
Map params = new HashMap();
params.put("TRANSSERIALNUMBER", transSerialNumber);
params.put("JSJG", "111111000000");//接收机构ID
params.put("FROMTGORGANIZATIONID", "402361018886");//托管机构编码
params.put("TXCODE", "100403");//交易编码
params.put("APPLICATIONID", applicationId);//业务申请编号
params.put("FEATURECODE", featureCode);//事件特征码
params.put("BANKID", "402361018886");//上报结构
params.put("IDTYPE", IDType);//证件类型
params.put("IDNUMBER", IDNumber);//证件号
params.put("IDNAME", IDName);//姓名
params.put("CARDNUMBER", cardNumber);//卡/折号
params.put("ACCOUNTOPENTIME", accountOpenTime);//开卡时间
params.put("ACCOUNTOPENPLACE", accountOpenPlace);//开卡地点
params.put("OPERATORNAME", operatorName);//经办人姓名
params.put("OPERATORPHONENUMBER", operatorPhoneNumber);//经办人电话
params.put("STATUS", "0");
//params.put("ERRORINFO", "");
tx100403.setTxCode("100403");//交易编码
tx100403.setMessageFrom("111111000000");//接收机构ID,默认值为 111111000000
tx100403.setTransSerialNumber(transSerialNumber);//传输报文流水号
tx100403.setApplicationID(applicationId);//业务申请编号
tx100403.setFeatureCode(featureCode);//事件特征码
tx100403.setIdType(IDType);//证件类型
tx100403.setIdNumber(IDNumber);//证件号
tx100403.setIdName(IDName);//姓名
tx100403.setOperatorName(operatorName);//经办人姓名
tx100403.setOperatorPhoneNumber(operatorPhoneNumber);//经办人电话
List<TxUnusualOpencard_Accounts> list = new ArrayList<TxUnusualOpencard_Accounts>();
TxUnusualOpencard_Accounts txUnusualOpencard_Accounts = new TxUnusualOpencard_Accounts();
txUnusualOpencard_Accounts.setCardNumber(cardNumber);
txUnusualOpencard_Accounts.setAccountOpenTime(accountOpenTime);
txUnusualOpencard_Accounts.setAccountOpenPlace(accountOpenPlace);
list.add(txUnusualOpencard_Accounts);
tx100403.setAccountsList(list);
String requestXML= "";
//String requestXML = sgBusiness.tx100403(tx100403,fromTGOrganizationId);
try {
ClientEnvironment.initTxClientEnvironment("../cfca");
SGBusiness sgBusiness = new SGBusiness();
requestXML = sgBusiness.tx100403(tx100403, tx100403.getMessageFrom());
String responseXML = sgBusiness.sendPackagedRequestXML(requestXML);
Result result = ResultUtil.chageXMLToResult(responseXML);
System.out.println(result.getCode());
if (Constants.SUCCESS_CODE_VALUE.equals(result.getCode())) {//成功
//params.put("NEWTRANSSERIALNUMBER", newTransSerialNumber);
//params.put("CODE", "100000");//返回码
params.put("ERRORINFO", "100000" + "");//返回消息
}else{//失败
//params.put("NEWTRANSSERIALNUMBER", newTransSerialNumber);
//params.put("CODE", "111111");//返回码失败
params.put("ERRORINFO", "111111" + result.getDescription());//返回消息
}
} catch (Exception e) {
e.printStackTrace();
}
zfdjService.insertYckk(params);
request.setAttribute("msg", "发送成功!");
return mapping.findForward(SUCCESS);
}
/**
* 涉案账户可疑名单上报页面
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
@SuppressWarnings("unchecked")
public ActionForward toSendAccount(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
return mapping.findForward("toSendAccount");
}
/**
* 涉案账户可疑名单上报方法
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
@SuppressWarnings("unchecked")
public ActionForward sendAccount(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
Tx100404 tx100404 = new Tx100404();
String FEATURECODE = request.getParameter("FEATURECODE");//事件特征码
String CARDNUMBER = request.getParameter("CARDNUMBER");//卡/折号
String ACCOUNTNAME = request.getParameter("ACCOUNTNAME");//账户名
String IDTYPE = request.getParameter("IDTYPE");//证件类型
String IDNUMBER = request.getParameter("IDNUMBER");//证件号
String PHONENUMBER = request.getParameter("PHONENUMBER");//联系电话
String ADDRESS = request.getParameter("ADDRESS");//通讯地址
String POSTCODE = request.getParameter("POSTCODE");//邮政编码
String ACCOUNTOPENPLACE = request.getParameter("ACCOUNTOPENPLACE");//开卡地点
String ACCOUNTNUMBER = request.getParameter("ACCOUNTNUMBER");//定位账户账号
String ACCOUNTSERIAL = request.getParameter("ACCOUNTSERIAL");//一般(子)账户序号
String ACCOUNTTYPE = request.getParameter("ACCOUNTTYPE");//一般(子)账户类别
String ACCOUNTSTATUS = request.getParameter("ACCOUNTSTATUS");//账户状态
String CURRENCY = request.getParameter("CURRENCY");//币种
String CASHREMIT = request.getParameter("CASHREMIT");//钞汇标志
String TRANSACTIONSERIAL = request.getParameter("TRANSACTIONSERIAL");//交易流水号
String TRANSACTIONTIME = request.getParameter("TRANSACTIONTIME");//交易时间
String TRANSACTIONTYPE = request.getParameter("TRANSACTIONTYPE");//交易类型
String BORROWINGSIGNS = request.getParameter("BORROWINGSIGNS");//借贷标志
String TRANSACTIONAMOUNT = request.getParameter("TRANSACTIONAMOUNT");//交易金额
String ACCOUNTBALANCE = request.getParameter("ACCOUNTBALANCE");//交易余额
String OPPONENTNAME = request.getParameter("OPPONENTNAME");//交易对方名称
String OPPONENTACCOUNTNUMBER = request.getParameter("OPPONENTACCOUNTNUMBER");//交易对方账卡号
String OPPONENTCREDENTIALNUMBER = request.getParameter("OPPONENTCREDENTIALNUMBER");//交易对方证件号码
String OPPONENTDEPOSITBANKID = request.getParameter("OPPONENTDEPOSITBANKID");//交易对方账号开户行
String TRANSACTIONREMARK = request.getParameter("TRANSACTIONREMARK");//交易摘要
String TRANSACTIONBRANCHNAME = request.getParameter("TRANSACTIONBRANCHNAME");//交易网点名称
String TRANSACTIONBRANCHCODE = request.getParameter("TRANSACTIONBRANCHCODE");//交易网点代码
String LOGNUMBER = request.getParameter("LOGNUMBER");//日志号
String SUMMONSNUMBER = request.getParameter("SUMMONSNUMBER");//传票号
String VOUCHERTYPE = request.getParameter("VOUCHERTYPE");//凭证种类
String VOUCHERCODE = request.getParameter("VOUCHERCODE");//凭证号
String CASHMARK = request.getParameter("CASHMARK");//现金标志
String TERMINALNUMBER = request.getParameter("TERMINALNUMBER");//终端号
String TRANSACTIONSTATUS = request.getParameter("TRANSACTIONSTATUS");//交易是否成功
String TRANSACTIONADDRESS = request.getParameter("TRANSACTIONADDRESS");//交易发生地
String MERCHANTNAME = request.getParameter("MERCHANTNAME");//商户名称
String MERCHANTCODE = request.getParameter("MERCHANTCODE");//商户号
String IPADDRESS = request.getParameter("IPADDRESS");//IP地址
String MAC = request.getParameter("MAC");//MAC地址
String TELLERCODE = request.getParameter("TELLERCODE");//交易柜员号
String REPORTORGNAME = request.getParameter("REPORTORGNAME");//上报机构名称
String OPERATORNAME = request.getParameter("OPERATORNAME");//经办人姓名
String OPERATORPHONENUMBER = request.getParameter("OPERATORPHONENUMBER");//经办人电话
String REMARK = request.getParameter("REMARK");//备注
String transSerialNumber = StringUtil.getTransSerialNumber();//传输报文流水号
//String newTransSerialNumber = StringUtil.getTransSerialNumber();//传输报文流水号
String applicationId = StringUtil.getApplicationID();//业务申请编号
tx100404.setTransSerialNumber(transSerialNumber);
tx100404.setTxCode("100404");
tx100404.setMessageFrom("111111000000");
tx100404.setApplicationID(applicationId);
tx100404.setFeatureCode(FEATURECODE);
tx100404.setBankID("402361018886");
tx100404.setCardNumber(CARDNUMBER);
tx100404.setAccountName(ACCOUNTNAME);
tx100404.setIdType(IDTYPE);
tx100404.setIdNumber(IDNUMBER);
tx100404.setPhoneNumber(PHONENUMBER);
tx100404.setAddress(ADDRESS);
tx100404.setPostCode(POSTCODE);
tx100404.setAccountOpenPlace(ACCOUNTOPENPLACE);
List<TxInvolvedAccount_Account> accountList = new ArrayList<TxInvolvedAccount_Account>();
TxInvolvedAccount_Account txInvolvedAccount_Account = new TxInvolvedAccount_Account();
txInvolvedAccount_Account.setAccountNumber(ACCOUNTNAME);
txInvolvedAccount_Account.setAccountType(ACCOUNTTYPE);
txInvolvedAccount_Account.setAccountStatus(ACCOUNTSTATUS);
txInvolvedAccount_Account.setCurrency(CURRENCY);
txInvolvedAccount_Account.setCashRemit(CASHREMIT);
List<Transaction> transactionList = new ArrayList<Transaction>();
Transaction transaction = new Transaction();
transaction.setTransactionType(TRANSACTIONTYPE);
transaction.setBorrowingSigns(BORROWINGSIGNS);
transaction.setCurrency(CURRENCY);
transaction.setTransactionAmount(TRANSACTIONAMOUNT);
transaction.setAccountBalance(ACCOUNTBALANCE);
transaction.setTransactionTime(TRANSACTIONTIME);
transaction.setTransactionSerial(TRANSACTIONSERIAL);
transaction.setOpponentName(OPPONENTNAME);
transaction.setOpponentAccountNumber(OPPONENTACCOUNTNUMBER);
transaction.setOpponentCredentialNumber(OPPONENTCREDENTIALNUMBER);
transaction.setOpponentDepositBankID(OPPONENTDEPOSITBANKID);
transaction.setTransactionRemark(TRANSACTIONREMARK);
transaction.setTransactionBranchName(TRANSACTIONBRANCHNAME);
transaction.setTransactionBranchCode(TRANSACTIONBRANCHCODE);
transaction.setLogNumber(LOGNUMBER);
transaction.setSummonsNumber(SUMMONSNUMBER);
transaction.setVoucherType(VOUCHERTYPE);
transaction.setVoucherCode(VOUCHERCODE);
transaction.setCashMark(CASHMARK);
transaction.setTerminalNumber(TERMINALNUMBER);
transaction.setTransactionStatus(TRANSACTIONSTATUS);
transaction.setTransactionAddress(TRANSACTIONADDRESS);
transaction.setMerchantName(MERCHANTNAME);
transaction.setMerchantCode(MERCHANTCODE);
transaction.setIpAddress(IPADDRESS);
transaction.setMac(MAC);
transaction.setTellerCode(TELLERCODE);
transaction.setRemark(REMARK);
transactionList.add(transaction);
txInvolvedAccount_Account.setTransactionList(transactionList);
accountList.add(txInvolvedAccount_Account);
tx100404.setAccountList(accountList);
tx100404.setReportOrgName(REPORTORGNAME);
tx100404.setOperatorName(OPERATORNAME);
tx100404.setOperatorPhoneNumber(OPERATORPHONENUMBER);
Map params = new HashMap();
params.put("TRANSSERIALNUMBER", transSerialNumber);
params.put("JSJG", "111111000000");
params.put("FROMTGORGANIZATIONID", "");
params.put("TXCODE", "100404");
params.put("APPLICATIONID", applicationId);
params.put("FEATURECODE", FEATURECODE);
params.put("BANKID", "402361018886");
params.put("CARDNUMBER", CARDNUMBER);
params.put("ACCOUNTNAME", ACCOUNTNAME);
params.put("IDTYPE", IDTYPE);
params.put("IDNUMBER", IDNUMBER);
params.put("PHONENUMBER", PHONENUMBER);
params.put("ADDRESS", ADDRESS);
params.put("POSTCODE", POSTCODE);
params.put("ACCOUNTOPENPLACE", ACCOUNTOPENPLACE);
params.put("ACCOUNTNUMBER", ACCOUNTNUMBER);
params.put("ACCOUNTSERIAL", ACCOUNTSERIAL);
params.put("ACCOUNTTYPE", ACCOUNTTYPE);
params.put("ACCOUNTSTATUS", ACCOUNTSTATUS);
params.put("CURRENCY", CURRENCY);
params.put("CASHREMIT", CASHREMIT);
params.put("TRANSACTIONTYPE", TRANSACTIONTYPE);
params.put("BORROWINGSIGNS", BORROWINGSIGNS);
params.put("TRANSACTIONAMOUNT", TRANSACTIONAMOUNT);
params.put("ACCOUNTBALANCE", ACCOUNTBALANCE);
params.put("TRANSACTIONTIME", TRANSACTIONTIME);
params.put("TRANSACTIONSERIAL", TRANSACTIONSERIAL);
params.put("OPPONENTNAME", OPPONENTNAME);
params.put("OPPONENTACCOUNTNUMBER", OPPONENTACCOUNTNUMBER);
params.put("OPPONENTCREDENTIALNUMBER", OPPONENTCREDENTIALNUMBER);
params.put("OPPONENTDEPOSITBANKID", OPPONENTDEPOSITBANKID);
params.put("TRANSACTIONREMARK", TRANSACTIONREMARK);
params.put("TRANSACTIONBRANCHNAME", TRANSACTIONBRANCHNAME);
params.put("TRANSACTIONBRANCHCODE", TRANSACTIONBRANCHCODE);
params.put("LOGNUMBER", LOGNUMBER);
params.put("SUMMONSNUMBER", SUMMONSNUMBER);
params.put("VOUCHERTYPE", VOUCHERTYPE);
params.put("VOUCHERCODE", VOUCHERCODE);
params.put("CASHMARK", CASHMARK);
params.put("TERMINALNUMBER", TERMINALNUMBER);
params.put("TRANSACTIONSTATUS", TRANSACTIONSTATUS);
params.put("TRANSACTIONADDRESS", TRANSACTIONADDRESS);
params.put("MERCHANTNAME", MERCHANTNAME);
params.put("MERCHANTCODE", MERCHANTCODE);
params.put("IPADDRESS", IPADDRESS);
params.put("MAC", MAC);
params.put("TELLERCODE", TELLERCODE);
params.put("REMARK", REMARK);
params.put("REPORTORGNAME", REPORTORGNAME);
params.put("REMARK", REMARK);
params.put("REPORTORGNAME", "安徽省农村信用联合社");
params.put("OPERATORNAME", OPERATORNAME);
params.put("OPERATORPHONENUMBER", OPERATORPHONENUMBER);
params.put("STATUS", "");
String requestXML= "";
//String requestXML = sgBusiness.tx100404(tx100404,fromTGOrganizationId);
try {
ClientEnvironment.initTxClientEnvironment("../cfca");
SGBusiness sgBusiness = new SGBusiness();
requestXML = sgBusiness.tx100404(tx100404, tx100404.getMessageFrom());
String responseXML = sgBusiness.sendPackagedRequestXML(requestXML);
Result result = ResultUtil.chageXMLToResult(responseXML);
if (Constants.SUCCESS_CODE_VALUE.equals(result.getCode())) {//成功
//params.put("NEWTRANSSERIALNUMBER", newTransSerialNumber);
//params.put("CODE", "100000");//返回码
params.put("ERRORINFO", "");//返回消息
}else{//失败
//params.put("NEWTRANSSERIALNUMBER", newTransSerialNumber);
//params.put("CODE", "111111");//返回码失败
params.put("ERRORINFO", result.getDescription());//返回消息
}
} catch (Exception e) {
e.printStackTrace();
}
zfdjService.insertSazh(params);
request.setAttribute("msg", "发送成功!");
return mapping.findForward(SUCCESS);
}
/**
* 异常事件可疑名单上报页面
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
@SuppressWarnings("unchecked")
public ActionForward toSendEvent(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
return mapping.findForward("toSendEvent");
}
/**
* 异常事件可疑名单上报方法
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
@SuppressWarnings("unchecked")
public ActionForward sendEvent(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
Tx100405 tx100405 = new Tx100405();
String ACCOUNTNAME = request.getParameter("ACCOUNTNAME");//主账户名称
String CARDNUMBER = request.getParameter("CARDNUMBER");//主账户
String ACCOUNTNUMBER = request.getParameter("ACCOUNTNUMBER");//定位账户账号
String ACCOUNTSERIAL = request.getParameter("ACCOUNTSERIAL");//一般(子)账户序号
String ACCOUNTTYPE = request.getParameter("ACCOUNTTYPE");//一般(子)账户类别
String ACCOUNTSTATUS = request.getParameter("ACCOUNTSTATUS");//账户状态
String CURRENCY = request.getParameter("CURRENCY");//币种
String CASHREMIT = request.getParameter("CASHREMIT");//钞汇标志
String FEATURECODE = request.getParameter("FEATURECODE");//事件特征码
String TRANSACTIONTYPE = request.getParameter("TRANSACTIONTYPE");//交易类型
String BORROWINGSIGNS = request.getParameter("BORROWINGSIGNS");//借贷标志
String TRANSACTIONAMOUNT = request.getParameter("TRANSACTIONAMOUNT");//交易金额
String ACCOUNTBALANCE = request.getParameter("ACCOUNTBALANCE");//交易余额
String TRANSACTIONTIME = request.getParameter("TRANSACTIONTIME");//交易时间
String TRANSACTIONSERIAL = request.getParameter("TRANSACTIONSERIAL");//交易流水号
String OPPONENTNAME = request.getParameter("OPPONENTNAME");//交易对方名称
String OPPONENTACCOUNTNUMBER = request.getParameter("OPPONENTACCOUNTNUMBER");//交易对方账卡号
String OPPONENTCREDENTIALNUMBER = request.getParameter("OPPONENTCREDENTIALNUMBER");//交易对方证件号码
String OPPONENTDEPOSITBANKID = request.getParameter("OPPONENTDEPOSITBANKID");//交易对方账号开户行
String TRANSACTIONREMARK = request.getParameter("TRANSACTIONREMARK");//交易摘要
String TRANSACTIONBRANCHNAME = request.getParameter("TRANSACTIONBRANCHNAME");//交易网点名称
String TRANSACTIONBRANCHCODE = request.getParameter("TRANSACTIONBRANCHCODE");//交易网点代码
String LOGNUMBER = request.getParameter("LOGNUMBER");//日志号
String SUMMONSNUMBER = request.getParameter("SUMMONSNUMBER");//传票号
String VOUCHERTYPE = request.getParameter("VOUCHERTYPE");//凭证种类
String VOUCHERCODE = request.getParameter("VOUCHERCODE");//凭证号
String CASHMARK = request.getParameter("CASHMARK");//现金标志
String TERMINALNUMBER = request.getParameter("TERMINALNUMBER");//终端号
String TRANSACTIONSTATUS = request.getParameter("TRANSACTIONSTATUS");//交易是否成功
String TRANSACTIONADDRESS = request.getParameter("TRANSACTIONADDRESS");//交易发生地
String MERCHANTNAME = request.getParameter("MERCHANTNAME");//商户名称
String MERCHANTCODE = request.getParameter("MERCHANTCODE");//商户号
String IPADDRESS = request.getParameter("IPADDRESS");//IP地址
String MAC = request.getParameter("MAC");//MAC地址
String TELLERCODE = request.getParameter("TELLERCODE");//交易柜员号
String REMARK = request.getParameter("REMARK");//备注
String OPERATORNAME = request.getParameter("OPERATORNAME");//经办人姓名
String OPERATORPHONENUMBER = request.getParameter("OPERATORPHONENUMBER");//经办人电话
String transSerialNumber = StringUtil.getTransSerialNumber();//传输报文流水号
//String newTransSerialNumber = StringUtil.getTransSerialNumber();//传输报文流水号
String applicationId = StringUtil.getApplicationID();//业务申请编号
tx100405.setTransSerialNumber(transSerialNumber);
tx100405.setApplicationID(applicationId);
tx100405.setBankID("402361018886");
tx100405.setOperatorName(OPERATORNAME);
tx100405.setOperatorPhoneNumber(OPERATORPHONENUMBER);
List<TxExceptionalEvent_Accounts> accountsList = new ArrayList<TxExceptionalEvent_Accounts>();
TxExceptionalEvent_Accounts txExceptionalEvent_Accounts = new TxExceptionalEvent_Accounts();
txExceptionalEvent_Accounts.setAccountName(ACCOUNTNAME);
txExceptionalEvent_Accounts.setCardNumber(CARDNUMBER);
txExceptionalEvent_Accounts.setRemark(REMARK);
TxExceptionalEvent_Account txExceptionalEvent_Account = new TxExceptionalEvent_Account();
txExceptionalEvent_Account.setAccountNumber(ACCOUNTNUMBER);
txExceptionalEvent_Account.setAccountType(ACCOUNTTYPE);
txExceptionalEvent_Account.setAccountStatus(ACCOUNTSTATUS);
txExceptionalEvent_Account.setCurrency(CURRENCY);
txExceptionalEvent_Account.setCashRemit(CASHREMIT);
List<TxExceptionalEvent_Transaction> transactionList = new ArrayList<TxExceptionalEvent_Transaction>();
TxExceptionalEvent_Transaction transaction = new TxExceptionalEvent_Transaction();
transaction.setFeatureCode(FEATURECODE); //事件特征码
transaction.setTransactionType(TRANSACTIONTYPE);
transaction.setBorrowingSigns(BORROWINGSIGNS);
transaction.setCurrency(CURRENCY);
transaction.setTransactionAmount(TRANSACTIONAMOUNT);
transaction.setAccountBalance(ACCOUNTBALANCE);
transaction.setTransactionTime(TRANSACTIONTIME);
transaction.setTransactionSerial(TRANSACTIONSERIAL);
transaction.setOpponentName(OPPONENTNAME);
transaction.setOpponentAccountNumber(OPPONENTACCOUNTNUMBER);
transaction.setOpponentCredentialNumber(OPPONENTCREDENTIALNUMBER);
transaction.setOpponentDepositBankID(OPPONENTDEPOSITBANKID);
transaction.setTransactionRemark(TRANSACTIONREMARK);
transaction.setTransactionBranchName(TRANSACTIONBRANCHNAME);
transaction.setTransactionBranchCode(TRANSACTIONBRANCHCODE);
transaction.setLogNumber(LOGNUMBER);
transaction.setSummonsNumber(SUMMONSNUMBER);
transaction.setVoucherType(VOUCHERTYPE);
transaction.setVoucherCode(VOUCHERCODE);
transaction.setCashMark(CASHMARK);
transaction.setTerminalNumber(TERMINALNUMBER);
transaction.setTransactionStatus(TRANSACTIONSTATUS);
transaction.setTransactionAddress(TRANSACTIONADDRESS);
transaction.setMerchantName(MERCHANTNAME);
transaction.setMerchantCode(MERCHANTCODE);
transaction.setIpAddress(IPADDRESS);
transaction.setMac(MAC);
transaction.setTellerCode(TELLERCODE);
transaction.setRemark(REMARK);
transactionList.add(transaction);
txExceptionalEvent_Account.setTransactionList(transactionList);
List<TxExceptionalEvent_Account> txInvolvedAccount_AccountList = new ArrayList<TxExceptionalEvent_Account>();
txInvolvedAccount_AccountList.add(txExceptionalEvent_Account);
txExceptionalEvent_Accounts.setAccountList(txInvolvedAccount_AccountList);
accountsList.add(txExceptionalEvent_Accounts);
tx100405.setAccountsList(accountsList);
Map params = new HashMap();
params.put("TRANSSERIALNUMBER", transSerialNumber);
params.put("JSJG", "111111000000");
params.put("FROMTGORGANIZATIONID", "");
params.put("TXCODE", "100405");
params.put("APPLICATIONID", applicationId);
params.put("BANKID", "402361018886");
params.put("OPERATORNAME", OPERATORNAME);
params.put("OPERATORPHONENUMBER", OPERATORPHONENUMBER);
params.put("ACCOUNTNAME", ACCOUNTNAME);
params.put("CARDNUMBER", CARDNUMBER);
params.put("REMARK", REMARK);
params.put("ACCOUNTNUMBER", ACCOUNTNUMBER);
params.put("ACCOUNTSERIAL", ACCOUNTSERIAL);
params.put("ACCOUNTTYPE", ACCOUNTTYPE);
params.put("ACCOUNTSTATUS", ACCOUNTSTATUS);
params.put("CURRENCY", CURRENCY);
params.put("CASHREMIT", CASHREMIT);
params.put("FEATURECODE", FEATURECODE);
params.put("TRANSACTIONTYPE", TRANSACTIONTYPE);
params.put("BORROWINGSIGNS", BORROWINGSIGNS);
params.put("TRANSACTIONAMOUNT", TRANSACTIONAMOUNT);
params.put("ACCOUNTBALANCE", ACCOUNTBALANCE);
params.put("TRANSACTIONTIME", TRANSACTIONTIME);
params.put("TRANSACTIONSERIAL", TRANSACTIONSERIAL);
params.put("OPPONENTNAME", OPPONENTNAME);
params.put("OPPONENTACCOUNTNUMBER", OPPONENTACCOUNTNUMBER);
params.put("OPPONENTCREDENTIALNUMBER", OPPONENTCREDENTIALNUMBER);
params.put("OPPONENTDEPOSITBANKID", OPPONENTDEPOSITBANKID);
params.put("TRANSACTIONREMARK", TRANSACTIONREMARK);
params.put("TRANSACTIONBRANCHNAME", TRANSACTIONBRANCHNAME);
params.put("TRANSACTIONBRANCHCODE", TRANSACTIONBRANCHCODE);
params.put("LOGNUMBER", LOGNUMBER);
params.put("SUMMONSNUMBER", SUMMONSNUMBER);
params.put("VOUCHERTYPE", VOUCHERTYPE);
params.put("VOUCHERCODE", VOUCHERCODE);
params.put("CASHMARK", CASHMARK);
params.put("TERMINALNUMBER", TERMINALNUMBER);
params.put("TRANSACTIONSTATUS", TRANSACTIONSTATUS);
params.put("TRANSACTIONADDRESS", TRANSACTIONADDRESS);
params.put("MERCHANTNAME", MERCHANTNAME);
params.put("MERCHANTCODE", MERCHANTCODE);
params.put("IPADDRESS", IPADDRESS);
params.put("MAC", MAC);
params.put("TELLERCODE", TELLERCODE);
params.put("STATUS", "0");
String requestXML= "";
//String requestXML = sgBusiness.tx100405(tx100405, fromTGOrganizationId);
try {
ClientEnvironment.initTxClientEnvironment("../cfca");
SGBusiness sgBusiness = new SGBusiness();
requestXML = sgBusiness.tx100405(tx100405, tx100405.getMessageFrom());
String responseXML = sgBusiness.sendPackagedRequestXML(requestXML);
Result result = ResultUtil.chageXMLToResult(responseXML);
if (Constants.SUCCESS_CODE_VALUE.equals(result.getCode())) {//成功
//params.put("NEWTRANSSERIALNUMBER", newTransSerialNumber);
//params.put("CODE", "100000");//返回码
params.put("ERRORINFO", "");;//返回消息
}else{//失败
//params.put("NEWTRANSSERIALNUMBER", newTransSerialNumber);
//params.put("CODE", "111111");//返回码失败
params.put("ERRORINFO", result.getDescription());
}
} catch (Exception e) {
e.printStackTrace();
}
zfdjService.insertYcsj(params);
request.setAttribute("msg", "发送成功!");
return mapping.findForward(SUCCESS);
}
/**
* 案件举报页面
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
@SuppressWarnings("unchecked")
public ActionForward toAjjb(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
return mapping.findForward("toAjjb");
}
/**
* 案件举报上报方法
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
@SuppressWarnings("unchecked")
public ActionForward ajjb(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
Tx100401 tx100401 = new Tx100401();
String APPLICATIONTYPE = request.getParameter("APPLICATIONTYPE");//案件举报类型
String ISINITIALNODE = request.getParameter("ISINITIALNODE");//是否主动发送初始节点
String REPORTENDTIME = request.getParameter("REPORTENDTIME");//上报时间
String VICTIMNAME = request.getParameter("VICTIMNAME");//受害人姓名
String VICTIMPHONENUMBER = request.getParameter("VICTIMPHONENUMBER");//受害人联系电话
String VICTIMIDTYPE = request.getParameter("VICTIMIDTYPE");//证件类型
String VICTIMIDNUMBER = request.getParameter("VICTIMIDNUMBER");//证件号
String ACCIDENTDESCRIPTION = request.getParameter("ACCIDENTDESCRIPTION");//事件描述
String REPORTORGNAME = request.getParameter("REPORTORGNAME");//上报机构名称
String OPERATORNAME = request.getParameter("OPERATORNAME");//经办人姓名
String OPERATORPHONENUMBER = request.getParameter("OPERATORPHONENUMBER");//经办人电话
String ID = request.getParameter("ID");//交易流水号
String TYPE = request.getParameter("TYPE");//交易类型
String TIME = request.getParameter("TIME");//交易时间
String CURRENCY = request.getParameter("CURRENCY");//币种
String TRANSFERAMOUNT = request.getParameter("TRANSFERAMOUNT");//交易金额
String TRANSFEROUTBANKID = request.getParameter("TRANSFEROUTBANKID");//转出账户所属银行机构编码
String TRANSFEROUTBANKNAME = request.getParameter("TRANSFEROUTBANKNAME");//转出账户所属银行名称
String TRANSFEROUTACCOUNTNAME = request.getParameter("TRANSFEROUTACCOUNTNAME");//转出账户名
String TRANSFEROUTACCOUNTNUMBER = request.getParameter("TRANSFEROUTACCOUNTNUMBER");//转出卡/折号
String TRANSFERINBANKID = request.getParameter("TRANSFERINBANKID");//转入账户所属银行机构编码
String TRANSFERINBANKNAME = request.getParameter("TRANSFERINBANKNAME");//转入账户账户所属银行名称
String TRANSFERINACCOUNTNAME = request.getParameter("TRANSFERINACCOUNTNAME");//转入账户账户名
String TRANSFERINACCOUNTNUMBER = request.getParameter("TRANSFERINACCOUNTNUMBER");//转入账户卡/折号
String IP = request.getParameter("IP");//IP地址
String MAC = request.getParameter("MAC");//MAC地址
String DEVICEID = request.getParameter("DEVICEID");//设备ID
String PLACE = request.getParameter("PLACE");//交易地点
String REMARK = request.getParameter("REMARK");//备注
String ISCEASED = request.getParameter("ISCEASED");//是否已止付
String transSerialNumber = StringUtil.getTransSerialNumber();//传输报文流水号
//String newTransSerialNumber = StringUtil.getTransSerialNumber();//传输报文流水号
String applicationId = StringUtil.getApplicationID();//业务申请编号
tx100401.setTransSerialNumber(transSerialNumber);
tx100401.setApplicationID(applicationId);
tx100401.setApplicationType(APPLICATIONTYPE);
tx100401.setReportEndTime(REPORTENDTIME);
tx100401.setVictimName(VICTIMNAME);
tx100401.setVictimPhoneNumber(VICTIMPHONENUMBER);
tx100401.setVictimIDType(VICTIMIDTYPE);
tx100401.setVictimIDNumber(VICTIMIDNUMBER);
tx100401.setAccidentDescription(ACCIDENTDESCRIPTION);
tx100401.setReportOrgName(REPORTORGNAME);
tx100401.setOperatorName(OPERATORNAME);
tx100401.setOperatorPhoneNumber(OPERATORPHONENUMBER);
List<TxCaseReport_Transaction> list = new ArrayList<TxCaseReport_Transaction>();
TxCaseReport_Transaction txCaseReport_Transaction = new TxCaseReport_Transaction();
txCaseReport_Transaction.setId(ID);
txCaseReport_Transaction.setTime(TIME);
txCaseReport_Transaction.setType(TYPE);
txCaseReport_Transaction.setCurrency(CURRENCY);
txCaseReport_Transaction.setTransferAmount(TRANSFERAMOUNT);
txCaseReport_Transaction.setTransferOutBankID(TRANSFEROUTBANKID);
txCaseReport_Transaction.setTransferOutBankName(TRANSFEROUTBANKNAME);
txCaseReport_Transaction.setTransferOutAccountName(TRANSFEROUTACCOUNTNAME);
txCaseReport_Transaction.setTransferOutAccountNumber(TRANSFEROUTACCOUNTNUMBER);
txCaseReport_Transaction.setTransferInBankID(TRANSFERINBANKID);
txCaseReport_Transaction.setTransferInBankName(TRANSFERINBANKNAME);
//txCaseReport_Transaction.setTransferInAccountName(TRANSFERINACCOUNTNAME + System.currentTimeMillis());
txCaseReport_Transaction.setTransferInAccountName(TRANSFERINACCOUNTNAME);
txCaseReport_Transaction.setTransferInAccountNumber(TRANSFERINACCOUNTNUMBER);
txCaseReport_Transaction.setIp(IP);
txCaseReport_Transaction.setMac(MAC);
txCaseReport_Transaction.setDeviceID(DEVICEID);
txCaseReport_Transaction.setPlace(PLACE);
txCaseReport_Transaction.setRemark(REMARK);
txCaseReport_Transaction.setIsCeased(ISCEASED);
list.add(txCaseReport_Transaction);
tx100401.setTransactionList(list);
List<Attachment> attachmentList = new ArrayList<Attachment>();
// Attachment attachment = new Attachment();
// attachment.setContent("");
// attachment.setFilename("heh.jpg");
// attachmentList.add(attachment);
// tx100401.setAttachmentList(attachmentList);
Map params = new HashMap();
params.put("TRANSSERIALNUMBER", transSerialNumber);
params.put("JSJG", "111111000000");//402361018886
params.put("TXCODE", "100401");
params.put("ISINITIALNODE", ISINITIALNODE);
params.put("FROMTGORGANIZATIONID", "");
params.put("APPLICATIONID", applicationId);
params.put("APPLICATIONTYPE", APPLICATIONTYPE);
params.put("REPORTENDTIME", REPORTENDTIME);
params.put("VICTIMNAME", VICTIMNAME);
params.put("VICTIMPHONENUMBER", VICTIMPHONENUMBER);
params.put("VICTIMIDTYPE", VICTIMIDTYPE);
params.put("VICTIMIDNUMBER", VICTIMIDNUMBER);
params.put("ACCIDENTDESCRIPTION", ACCIDENTDESCRIPTION);
params.put("REPORTORGNAME", REPORTORGNAME);
params.put("OPERATORNAME", OPERATORNAME);
params.put("OPERATORPHONENUMBER", OPERATORPHONENUMBER);
params.put("ID", ID);
params.put("TIME", TIME);
params.put("TYPE", TYPE);
params.put("CURRENCY", CURRENCY);
params.put("TRANSFERAMOUNT", TRANSFERAMOUNT);
params.put("TRANSFEROUTBANKID", TRANSFEROUTBANKID);
params.put("TRANSFEROUTBANKNAME", TRANSFEROUTBANKNAME);
params.put("TRANSFEROUTACCOUNTNAME", TRANSFEROUTACCOUNTNAME);
params.put("TRANSFEROUTACCOUNTNUMBER", TRANSFEROUTACCOUNTNUMBER);
params.put("TRANSFERINBANKID", TRANSFERINBANKID);
params.put("TRANSFERINBANKNAME", TRANSFERINBANKNAME);
params.put("TRANSFERINACCOUNTNAME", TRANSFERINACCOUNTNAME);
params.put("TRANSFERINACCOUNTNUMBER", TRANSFERINACCOUNTNUMBER);
params.put("IP", IP);
params.put("MAC", MAC);
params.put("DEVICEID", DEVICEID);
params.put("PLACE", PLACE);
params.put("REMARK", REMARK);
params.put("ISCEASED", ISCEASED);
params.put("STATUS", "0");
String requestXML= "";
//String requestXML = sgBusiness.tx100401(tx100401, fromTGOrganizationId, mode, to);
try {
ClientEnvironment.initTxClientEnvironment("../cfca");
SGBusiness sgBusiness = new SGBusiness();
requestXML = sgBusiness.tx100401(tx100401, tx100401.getMessageFrom(), "01", tx100401.getMessageFrom());
String responseXML = sgBusiness.sendPackagedRequestXML(requestXML);
Result result = ResultUtil.chageXMLToResult(responseXML);
if (Constants.SUCCESS_CODE_VALUE.equals(result.getCode())) {//成功
//params.put("CODE", "100000");//返回码
params.put("ERRORINFO", "");;//返回消息
}else{//失败
//params.put("CODE", "111111");//返回码失败
params.put("ERRORINFO", result.getDescription());
}
} catch (Exception e) {
e.printStackTrace();
}
zfdjService.insertAjjb(params);
request.setAttribute("msg", "发送成功!");
return mapping.findForward(SUCCESS);
}
}
| [
"18539713@qq.com"
] | 18539713@qq.com |
e4fbb0a2c78335e72fd5100cdbff659f61ef167f | 49897f43e5341a563d0a0952e6f9c3dbab7b0490 | /app/src/main/java/com/example/secondlabandroid/organization/University.java | 35e14562b7d1e068af4a7b5be58486f0114fd953 | [] | no_license | Nastya-Lis/secondLabAndroid | 3216f72bee3b560bd5fefc992765f7effa8d6abc | 60109fb781e52ca048684a312189b1bf67b0f61c | refs/heads/master | 2022-12-26T17:46:20.931619 | 2020-10-04T14:19:30 | 2020-10-04T14:19:30 | 299,843,028 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 387 | java | package com.example.secondlabandroid.organization;
public enum University {
BSTU("Here you can die"),
BNTU("Chill"),
BGU("There are successful people"),
OTHER("Noname");
University(String shortDescribe){
describing = shortDescribe;
}
String describing;
int count;
public int getCount(){return count;}
public void setCount(){count++;}
}
| [
"bankay.kotopes@mail.ru"
] | bankay.kotopes@mail.ru |
5af11f4ad51cdc533e361b71e943e7e240fd027a | 68868ecc95c722534e2a72d369ba6ed991dcfc89 | /src/geeks/search_array/ExponentialSearch.java | d19831a99635af8044f9b918c64f6d908d9c4e7f | [] | no_license | singhalrbl/practice_data_structure | af7598d01e564711ea9fcf7d13baef2db096ac26 | e161d8cf4bc8adfad3827b3650902c4e22987c1a | refs/heads/master | 2023-01-01T18:06:48.395645 | 2020-10-12T02:27:06 | 2020-10-12T02:27:06 | 291,530,277 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 186 | java | package geeks.search_array;
/* https://www.geeksforgeeks.org/exponential-search/ */
/*https://en.wikipedia.org/wiki/Exponential_search */
public class ExponentialSearch {
} | [
"root@singhalrbl.localdomain"
] | root@singhalrbl.localdomain |
9aa93972992a599fcfe49d76018bcd90a3464ad6 | 167b30938b732781dbc418bbdc0b138b5d3f3b1d | /app/src/main/java/com/musicplayer/ccl/music_player/adapter/AudioListAdapter.java | 57102084336fdf34dda7f9358a17e7cbf03b7757 | [] | no_license | CCLCM/music_player | 10b46a3d0670d62352ce553078d6e458af718869 | 50666c6ed96edd7c9b1931b0afc181c505af8b26 | refs/heads/master | 2021-05-05T00:25:23.625044 | 2018-02-05T10:29:13 | 2018-02-05T10:29:13 | 119,480,155 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,819 | java | package com.musicplayer.ccl.music_player.adapter;
import android.content.Context;
import android.database.Cursor;
import android.support.v4.widget.CursorAdapter;
import android.text.format.Formatter;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.musicplayer.ccl.music_player.R;
import com.musicplayer.ccl.music_player.bean.AudioItem;
import com.musicplayer.ccl.music_player.bean.VideoItem;
import utils.StringUtils;
/**
* Created by ccl on 18-1-31.
*/
public class AudioListAdapter extends CursorAdapter {
public AudioListAdapter(Context context, Cursor c) {
super(context, c);
}
public AudioListAdapter(Context context, Cursor c, boolean autoRequery) {
super(context, c, autoRequery);
}
public AudioListAdapter(Context context, Cursor c, int flags) {
super(context, c, flags);
}
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
//创建新的view
View view = View.inflate(context, R.layout.main_audio_list_item,null);
view.setTag(new ViewHolder(view));
return view;
}
@Override
public void bindView(View view, Context context, Cursor cursor) {
//填充view
ViewHolder holder = (ViewHolder) view.getTag();
AudioItem audioItem = AudioItem.instanceFromCursor(cursor);
holder.tv_title.setText(StringUtils.formatDisplyName(audioItem.getTitle()));
holder.tv_arties.setText(audioItem.getArties());
}
private class ViewHolder{
TextView tv_title,tv_arties;
ViewHolder(View view) {
tv_title = (TextView) view.findViewById(R.id.main_audio_item_tv_title);
tv_arties = (TextView) view.findViewById(R.id.main_audio_item_tv_arties);
}
}
}
| [
"958860308@qq.com"
] | 958860308@qq.com |
a7efc665e33d1f32b322ab827bf5306f7f8f1243 | f487dd8332d397465071a392178d81876d9a668a | /Day01-15-语言基础/Day10集合代码/Lesson4Collections/src/com/cxk/demo06/Demo34HashTable.java | e00403cfac2a252f757f31fd2beb6e69640eb93f | [] | no_license | winderst/HarmonyOS-100-Days | 44d73496020d212a9df19be6fe9513e0ae190702 | d356b1790b27303ef2ece984784dd2ac43e0f1d0 | refs/heads/main | 2023-06-14T17:13:23.094544 | 2021-07-09T01:10:35 | 2021-07-09T01:10:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 803 | java | package com.cxk.demo06;
import java.util.HashMap;
import java.util.Hashtable;
public class Demo34HashTable {
public static void main(String[] args) {
/*
* HashMap,支持null
*
* HashTable,不支持null,抛出异常:NullPointerException
*/
HashMap<String, String> map = new HashMap<>();
map.put("A", "程序咖");
map.put("B", "Ruby");
map.put("C", null);//null对象
map.put("D", null);
System.out.println(map);
map.put(null, "haha");
System.out.println(map);
map.put(null, "hehe");
System.out.println(map);
Hashtable<String, String> table = new Hashtable<>();
table.put("AA", "程序咖");
table.put("BB", "Ruby");
// table.put("CC", null);
// table.put(null, "ddd");
System.out.println(table);
}
}
| [
"hanru723@163.com"
] | hanru723@163.com |
aec123015ecb6337b1c362b4aaa06f1431c6e0be | 04b1becdb49491e925010e7c70c26c9037ea9bc3 | /kodilla-patterns3/src/main/java/com/kodilla/kodillapatterns3/observer/forum/ForumTopic.java | 0c0b04106230ab62720a035b0a1a4bb5c138db7a | [] | no_license | michal-adamczyk8/kodilla-exception | db940cb26b135e251d121c359bb57e608fe0a6b6 | 7ad75c42471e3eb3adeb19d69bd409b5148aacb6 | refs/heads/master | 2021-05-09T05:09:39.134332 | 2018-06-18T17:16:00 | 2018-06-18T17:16:00 | 119,301,915 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,015 | java | package com.kodilla.kodillapatterns3.observer.forum;
import java.util.ArrayList;
import java.util.List;
public class ForumTopic implements Observable {
private final List<Observer> observers;
private final List<String> messeges;
private final String name;
public ForumTopic(String name) {
observers = new ArrayList<>();
messeges = new ArrayList<>();
this.name = name;
}
public void addPost(String post) {
messeges.add(post);
notifyObservers();
}
@Override
public void registerObserver(Observer observer) {
observers.add(observer);
}
@Override
public void notifyObservers() {
for (Observer observer : observers) {
observer.update(this);
}
}
@Override
public void removeObserver(Observer observer) {
observers.remove(observer);
}
public List<String> getMessages() {
return messeges;
}
public String getName() {
return name;
}
}
| [
"adamczyk888@gmail.com"
] | adamczyk888@gmail.com |
b207b5faf45e686a6e2e5e9a30687fbe284815ff | d20ef86674f54730187d53cf39a99a6fe316c8b3 | /src/main/java/sample/model/User.java | c1b503d5b6c859bd453924dc034364071a3ae029 | [] | no_license | LachowskiTomekPL/JavaFX_Database | 3641534ce1f894e0611faf40ea2bbe59ddd63d12 | b7927347779d62ef9f8626403ab04b8a6461f9ba | refs/heads/master | 2023-01-02T05:20:42.840543 | 2020-10-24T22:51:21 | 2020-10-24T22:51:21 | 301,829,300 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 682 | java | package sample.model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@AllArgsConstructor
@NoArgsConstructor
@Data
public class User {
private Integer id;
private String firstName;
private String lastName;
public Integer getId() {
return id;
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
@Override
public String toString() {
return "User{" +
"id=" + id +
", firstName='" + firstName + '\'' +
", lastName='" + lastName + '\'' +
'}';
}
}
| [
"lachowskitomasz.pl@gmail.com"
] | lachowskitomasz.pl@gmail.com |
6f841e0626b47162a664b84b145782dc75b10bea | 9e1af24290392bafa4e3b9c9bc12afbff897ced2 | /myhadoop2/src/main/java/fulljoin/reduce/JoinMapper2.java | 8411c903b5a0b081c7d49142b8906f1579b0f700 | [] | no_license | piwang1994/big12 | 239d6b82d0d2f0744499ea1de91854b9e903f92f | 08ff6daf75777d6cb784aa7d36aca85ce088415f | refs/heads/master | 2020-03-29T18:15:08.059879 | 2018-09-25T03:20:49 | 2018-09-25T03:20:49 | 150,201,729 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 999 | java | package fulljoin.reduce;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.lib.input.FileSplit;
import java.io.IOException;
/**
* Created by Administrator on 2018/9/21.
*/
public class JoinMapper2 extends Mapper<LongWritable,Text ,ComboKey , Text> {
protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
String line = value.toString();
String[] arr = line.split(",") ;
FileSplit split = (FileSplit) context.getInputSplit();
int type = 0 ;
int cid = 0 ;
int oid = 0 ;
if(split.getPath().getName().contains("cust")){
type = 0 ;
cid = Integer.parseInt(arr[0]) ;
}
else{
type = 1 ;
cid = Integer.parseInt(arr[arr.length - 1]);
oid = Integer.parseInt(arr[0]);
}
ComboKey keyOut = new ComboKey();
keyOut.setType(type);
keyOut.setCid(cid);
keyOut.setOid(oid);
context.write(keyOut, value);
}
}
| [
"1445207429@qq.com"
] | 1445207429@qq.com |
8e49ba7effa71edb15b9135d0728a57298b9d6b8 | 0de4853c59899f9f4a4fa4a323ece2a456d6071b | /src/main/java/com/prevsec/couchburp/controller/BurpController.java | 65215b1935a10cdd6b11b0e913232518ceb216f5 | [] | no_license | BenKettlewell/couchburp | 88ed87ea5ba1f2ddc2e36dcbedc51eebdae16cff | 7810c113d41567bce7e30b3c9bbc7fd87b5181ac | refs/heads/master | 2021-01-18T01:40:35.930601 | 2016-06-30T21:58:07 | 2016-06-30T21:58:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 23,155 | java | /*******************************************************************************
* Author: William Patrick Herrin
* Date: 2016
* Email: wherrin@prevsec.com, willherrin1@gmail.com
*******************************************************************************/
/* Component of CouchDB collaboration plugin for Burp Suite Professional Edition
* Author: William Patrick Herrin
* Date: Jun 20, 2016
* Email: wherrin@prevsec.com, willherrin1@gmail.com
*/
package com.prevsec.couchburp.controller;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import javax.persistence.EntityExistsException;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTree;
import javax.swing.table.TableModel;
import javax.swing.text.BadLocationException;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.MutableTreeNode;
import javax.swing.tree.TreeModel;
import javax.swing.tree.TreePath;
import javax.swing.tree.TreeSelectionModel;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONException;
import org.json.JSONObject;
import org.lightcouch.Changes;
import org.lightcouch.ChangesResult.Row;
import org.lightcouch.CouchDbClient;
import org.lightcouch.Response;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.mashape.unirest.http.HttpMethod;
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.http.exceptions.UnirestException;
import com.prevsec.couchburp.CouchClient;
import com.prevsec.couchburp.UUIDManager;
import com.prevsec.couchburp.models.BurpTableModel;
import com.prevsec.couchburp.models.HttpRequestResponse;
import com.prevsec.couchburp.models.Note;
import com.prevsec.couchburp.models.OWASPCategory;
import com.prevsec.couchburp.ui.BurpFrame;
import com.prevsec.couchburp.ui.HttpPane;
import com.prevsec.couchburp.ui.NotePane;
import com.prevsec.test.TestFactory;
import burp.IBurpExtenderCallbacks;
import burp.IContextMenuFactory;
import burp.IContextMenuInvocation;
import burp.IHttpRequestResponse;
import burp.IScanIssue;
public class BurpController implements IContextMenuFactory {
private BurpFrame frame;
private CouchClient client;
// This is invisible, so the name is whatever
private DefaultMutableTreeNode root = new DefaultMutableTreeNode("CouchDB");
private DefaultTreeModel treeModel = new DefaultTreeModel(root);
private JTree tree = new JTree(treeModel);
private IBurpExtenderCallbacks callbacks;
private boolean isBurp;
private Logger log = Logger.getLogger(this.getClass().getName());
private URL url;
private String rootmessage;
private String connectmessage;
private UUIDManager uuidManager;
private CouchDbClient cdbclient;
private BurpTableModel tableModel = new BurpTableModel();
private Executor exec = Executors.newCachedThreadPool();
private List<HttpRequestResponse> tryLater = new ArrayList<HttpRequestResponse>();
private JPanel infoPanel;
public BurpController(IBurpExtenderCallbacks callbacks, boolean isBurp) {
this.isBurp = isBurp;
if (isBurp) {
this.callbacks = callbacks;
}
callbacks.registerContextMenuFactory(BurpController.this);
System.setOut(new PrintStream(callbacks.getStdout()));
System.setErr(new PrintStream(callbacks.getStderr()));
}
public void init() {
rootmessage = "Json error. Are you sure this is the root directory of a CouchDB instance at: " + url.toString()
+ "?";
connectmessage = "Unable to establish HTTP connection with: " + url.toString();
}
public boolean testConnection() throws UnirestException, JSONException {
try {
return Unirest.get(url.toString()).asJson().getBody().getObject().getString("couchdb").equals("Welcome");
} catch (UnirestException e) {
log.log(Level.SEVERE, connectmessage);
throw new UnirestException(connectmessage);
} catch (JSONException e) {
log.log(Level.SEVERE, rootmessage);
throw new JSONException(rootmessage);
}
}
public void createDB(String name) throws EntityExistsException, UnirestException {
actionDB(HttpMethod.PUT, name);
}
private String parseError(JSONObject response) {
return "error: " + response.getString("error") + "\nreason:" + response.getString("reason");
}
public void deleteDB(String name) throws EntityExistsException, UnirestException {
actionDB(HttpMethod.DELETE, name);
}
private void actionDB(HttpMethod method, String name) throws EntityExistsException, UnirestException {
try {
JSONObject response = new JSONObject();
switch (method) {
case PUT:
response = Unirest.put(url + name).asJson().getBody().getObject();
break;
case DELETE:
response = Unirest.delete(url + name).asJson().getBody().getObject();
break;
}
if (!response.optBoolean("ok")) {
String error = parseError(response);
log.warning(error);
throw new EntityExistsException(error);
}
} catch (UnirestException e) {
log.severe(connectmessage);
throw new UnirestException(connectmessage);
}
}
public void configClient(String string) {
try {
this.url = new URL(string);
init();
if (!testConnection()) {
String error = "Unable to create CouchClient";
log.severe(error);
throw new Exception(error);
}
cdbclient = new CouchDbClient("testinng", true, "http", "127.0.0.1", 5984, null, null);
JOptionPane.showMessageDialog(null, "Connection to CouchDB established");
listen();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e.getMessage());
}
}
// Leaving this here because why not. Not using do to possible loop with
// listening on both the jtree and databases for changes.
// private void listenup() {
// treeModel.addTreeModelListener(new TreeModelListener() {
//
// @Override
// public void treeStructureChanged(TreeModelEvent e) {
// // TODO Auto-generated method stub
//
// }
//
// @Override
// public void treeNodesRemoved(TreeModelEvent e) {
// // TODO Auto-generated method stub
//
// }
//
// @Override
// public void treeNodesInserted(TreeModelEvent e) {
// int index = e.getChildIndices()[0];
// DefaultMutableTreeNode node = (DefaultMutableTreeNode)
// root.getChildAt(index);
// DefaultMutableTreeNode parent = (DefaultMutableTreeNode)
// node.getParent();
// Object userObject = node.getUserObject();
// Object parentUserObject = parent.getUserObject();
// if (userObject instanceof HttpRequestResponse) {
// HttpRequestResponse requestResponse = (HttpRequestResponse) userObject;
// if (parentUserObject instanceof HttpRequestResponse) {
// HttpRequestResponse parentRequestResponse = (HttpRequestResponse)
// parentUserObject;
// requestResponse.setParentUuid(parentRequestResponse.getUUID());
// requestResponse.setCategory(parentRequestResponse.getCategory());
// } else if (parentUserObject instanceof OWASPCategory) {
// OWASPCategory category = (OWASPCategory) parentUserObject;
// requestResponse.setCategory(category);
// }
// client.put(requestResponse);
// }
// }
//
// @Override
// public void treeNodesChanged(TreeModelEvent e) {
// // TODO Auto-generated method stub
//
// }
// });
//
// }
private void listen() {
Runnable runnable = new Runnable() {
// TODO - WTF it do this for????
@Override
public void run() {
Changes changes = cdbclient.changes().continuousChanges();
while (changes.hasNext()) {
try {
System.out.println("found changes");
Row row = changes.next();
List<HttpRequestResponse> httpRequestResponse = getAllHttps();
List<Note> note = getAllNotes();
rebuildTree(httpRequestResponse, note);
} catch (Exception e) {
}
}
}
};
exec.execute(runnable);
}
private List<Note> getAllNotes() {
return getAllDocs().stream().filter(e -> e.get("type").getAsString().equals("note")).map(e -> new Note(e))
.collect(Collectors.toList());
}
protected synchronized void rebuildTree(List<HttpRequestResponse> httpRequestResponse, List<Note> notes) {
root.removeAllChildren();
List<HttpRequestResponse> topLevel = httpRequestResponse.stream().filter(e -> e.getParentUuid() == null)
.collect(Collectors.toList());
log.info("Toplevel size is: " + topLevel.size());
List<HttpRequestResponse> children = httpRequestResponse.stream().filter(e -> e.getParentUuid() != null)
.collect(Collectors.toList());
for (HttpRequestResponse http : topLevel) {
try {
addAuto(http);
} catch (Exception e) {
}
}
for (HttpRequestResponse http : children) {
try {
addAuto(http);
} catch (Exception e) {
}
}
for (Note note : notes) {
try {
addAuto(note);
} catch (Exception e) {
}
}
tree.updateUI();
expandAll();
}
private void addAuto(Note note) {
searchByUUID(note.getParentUUID()).add(new DefaultMutableTreeNode(note));
}
private void expandAll() {
for (int i = 0; i < tree.getRowCount(); i++) {
tree.expandRow(i);
}
}
private List<HttpRequestResponse> getAllHttps() {
return getAllDocs().stream().filter(e -> e.get("type").getAsString().equals("http"))
.map(e -> new HttpRequestResponse(e)).collect(Collectors.toList());
// List<HttpRequestResponse> httpList = new
// ArrayList<HttpRequestResponse>();
// for (JsonObject json : getAllDocs()) {
// System.out.println(json.toString());
// try {
// HttpRequestResponse requestResponse = new HttpRequestResponse(json);
// httpList.add(requestResponse);
// } catch (Exception e) {
// System.out.println(e.getMessage());
// }
// }
// return httpList;
}
private List<JsonObject> getAllDocs() {
return cdbclient.view("_all_docs").includeDocs(true).query(JsonObject.class);
}
private void addAutoIn(HttpRequestResponse requestResponse) {
// Check to see if we have any id's already in the model
DefaultMutableTreeNode search = searchByUUID(requestResponse.getUUID());
HttpRequestResponse searchHttp = (HttpRequestResponse) search.getUserObject();
// Enter this if we find an id
if (search != null) {
// Checks if the incoming http has a parent if the current http has
// a parent
if (requestResponse.getParentUuid() != null && searchHttp.getParentUuid() != null) {
String parentUUID = requestResponse.getParentUuid();
String searchUUID = searchHttp.getParentUuid();
// Lets compare if the parent has changed
if (!parentUUID.equals(searchUUID)) {
// Search for the new parent value
DefaultMutableTreeNode newparent = searchByUUID(parentUUID);
// If we don't have the parent. We will have to come back to
// this one.
if (newparent == null) {
tryLater.add(requestResponse);
// Otherwise, we'll add the new parent
} else {
search.setParent(newparent);
}
}
}
}
if (search == null) {
return;
}
// if (requestResponse)
String currentRevision = ((HttpRequestResponse) search.getUserObject()).getRevision();
// searchedHttp.getRevision();
}
private JsonObject getJsonObject(String id) {
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(cdbclient.find(id)));
String line;
StringBuilder sb = new StringBuilder();
while ((line = reader.readLine()) != null) {
sb.append(line);
}
System.out.println(sb.toString());
return new JsonParser().parse(new InputStreamReader(cdbclient.find(id))).getAsJsonObject();
} catch (Exception e) {
return null;
}
}
private JSONObject getById(String id) throws UnirestException {
return Unirest.get(url.toString()).asJson().getBody().getObject();
}
private void update(DefaultMutableTreeNode search, Object object) {
if (object instanceof HttpRequestResponse) {
HttpRequestResponse newHttp = (HttpRequestResponse) object;
HttpRequestResponse oldhttp = (HttpRequestResponse) search.getUserObject();
int newRev = Integer.parseInt(StringUtils.substringBefore(newHttp.getRevision(), "-"));
int oldRev = Integer.parseInt(StringUtils.substringBefore(oldhttp.getRevision(), "-"));
if (newRev > oldRev) {
search.setUserObject(object);
}
}
}
public void addAuto(HttpRequestResponse httpRequestResponse) {
if (httpRequestResponse.getParentUuid() == null) {
DefaultMutableTreeNode categoryParent = searchByCategoryOrCreate(httpRequestResponse);
categoryParent.add(new DefaultMutableTreeNode(httpRequestResponse));
} else {
searchByUUID(httpRequestResponse.getParentUuid()).add(new DefaultMutableTreeNode(httpRequestResponse));
}
}
public void addAutoOut(Object object) {
// We store our list of changed nodes here to delete if something
// happens to go wrong.
List<DefaultMutableTreeNode> changes = new ArrayList<DefaultMutableTreeNode>();
try {
if (object == null) {
log.warning("Can't add nothing to the tree???");
}
DefaultMutableTreeNode parentNode;
if (object instanceof HttpRequestResponse) {
log.fine("Object detected as: " + HttpRequestResponse.class.getName());
HttpRequestResponse requestResponse = (HttpRequestResponse) object;
if (requestResponse.getParentUuid() != null) {
log.info(
"Object has a parent uuid defined. Searching for uuid: " + requestResponse.getParentUuid());
DefaultMutableTreeNode uuidParentNode = searchByUUID(requestResponse.getParentUuid());
if (uuidParentNode == null) {
log.severe("Parent uuid specified but the parent object does not exist.");
return;
}
parentNode = uuidParentNode;
} else {
DefaultMutableTreeNode categoryParent = searchByCategory((HttpRequestResponse) object);
if (categoryParent == null) {
log.info("Category does not currently exist. Creating category: "
+ requestResponse.getCategoryAsString());
categoryParent = addChild(root, requestResponse.getCategory());
log.fine("Category created");
changes.add(categoryParent);
}
log.info("Category found as: " + ((OWASPCategory) categoryParent.getUserObject()).toString()
+ ". Adding...");
parentNode = categoryParent;
}
DefaultMutableTreeNode childNode = addChild(parentNode, requestResponse);
changes.add(childNode);
// Add Stuff to couch db
Response response = cdbclient.post(requestResponse.toJson());
if (response.getError() == null) {
requestResponse.setUUID(response.getId());
requestResponse.setRevision(response.getRev());
} else {
log.severe("Couch DB error: " + response.getError() + ". Reason: " + response.getReason());
log.severe("Deleting element from tree");
childNode.removeFromParent();
}
log.fine("Added child node to parent.");
}
} catch (Exception e) {
log.severe("Exception caught. Rolling back changes.");
for (DefaultMutableTreeNode node : changes) {
log.severe("Removing: " + node.toString());
node.removeFromParent();
tree.updateUI();
}
}
}
/** Remove all nodes except the root node. */
public void clear() {
root.removeAllChildren();
treeModel.reload();
}
public DefaultMutableTreeNode searchByUUID(String uuid) {
if (uuid == null) {
log.warning("Unable to search by a null uuid");
return null;
}
Enumeration<DefaultMutableTreeNode> searchEnum = root.depthFirstEnumeration();
log.fine("Searching tree by depth first for uuid: " + uuid);
while (searchEnum.hasMoreElements()) {
DefaultMutableTreeNode currentNode = searchEnum.nextElement();
if (currentNode.getUserObject() instanceof HttpRequestResponse) {
log.fine("Found a node that is an instance of HttpRequestResponse");
HttpRequestResponse parentRequestResponse = (HttpRequestResponse) currentNode.getUserObject();
String parentuuid = parentRequestResponse.getUUID();
log.fine("Comparing uuid: " + uuid + " to uuid: " + parentuuid != null ? parentuuid : "null");
if (parentuuid.equals(uuid)) {
log.info("Match found for uuid: " + uuid);
return currentNode;
}
}
}
return null;
}
/** Remove the currently selected node. */
public void removeCurrentNode() {
TreePath currentSelection = tree.getSelectionPath();
if (currentSelection != null) {
DefaultMutableTreeNode currentNode = (DefaultMutableTreeNode) (currentSelection.getLastPathComponent());
MutableTreeNode parent = (MutableTreeNode) (currentNode.getParent());
if (parent != null) {
treeModel.removeNodeFromParent(currentNode);
return;
}
}
}
/** Add child to the currently selected node. */
public DefaultMutableTreeNode addToSelected(Object child) {
DefaultMutableTreeNode parentNode = null;
TreePath parentPath = tree.getSelectionPath();
if (parentPath == null) {
parentNode = root;
} else {
parentNode = (DefaultMutableTreeNode) (parentPath.getLastPathComponent());
}
return addChild(parentNode, child);
}
public DefaultMutableTreeNode addChild(DefaultMutableTreeNode parent, Object child) {
DefaultMutableTreeNode childNode = new DefaultMutableTreeNode(child);
if (parent == null) {
log.warning("No parent specified. Setting parent to root.");
parent = root;
}
// It is key to invoke this on the TreeModel, and NOT
// DefaultMutableTreeNode
treeModel.insertNodeInto(childNode, parent, parent.getChildCount());
// Make sure the user can see the lovely new node.
tree.scrollPathToVisible(new TreePath(childNode.getPath()));
return childNode;
}
private DefaultMutableTreeNode searchByCategoryOrCreate(HttpRequestResponse object) {
DefaultMutableTreeNode search;
if ((search = searchByCategory(object)) == null) {
root.add(search = new DefaultMutableTreeNode(object.getCategory()));
}
return search;
}
private DefaultMutableTreeNode searchByCategory(HttpRequestResponse object) {
log.fine("Searching for suitable parents for " + object.toString());
Enumeration<DefaultMutableTreeNode> searchenum = root.breadthFirstEnumeration();
while (searchenum.hasMoreElements()) {
DefaultMutableTreeNode node = searchenum.nextElement();
log.fine("Testing node with value: " + node.toString());
Object userObject = node.getUserObject();
if (userObject instanceof OWASPCategory) {
if (object.getCategory().compareTo((OWASPCategory) userObject) == 0) {
log.fine("OWASP category is: " + object.getCategoryAsString() + " with path: " + node.toString());
return node;
}
}
}
return null;
}
public void setFrame(BurpFrame frame) {
this.frame = frame;
}
public TreeModel getTreeModel() {
return treeModel;
}
public void addDomain() {
String hostname = JOptionPane.showInputDialog("Enter hostname:");
String description = JOptionPane.showInputDialog("Description:");
try {
client.createDB(hostname);
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e.getMessage());
}
// DBDescriptor descriptor = new DBDescriptor(hostname, description,
// null);
tree.updateUI();
}
public JTree getTree() {
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
return tree;
}
public void removeSelectedNode() {
TreePath path = tree.getSelectionPath();
}
public TableModel getTableModel() {
return tableModel;
}
public void addToStash(HttpRequestResponse http) {
tableModel.addHttp(http);
}
public void stashToTree(int rowIndex) {
if (rowIndex != -1) {
cdbclient.post(tableModel.getHttp(rowIndex).toJson());
}
}
public void updatePreview(DefaultMutableTreeNode node) {
Object userobject = node.getUserObject();
if (userobject instanceof HttpRequestResponse) {
infoPanel.removeAll();
infoPanel.add(new HttpPane(true, (HttpRequestResponse) userobject, this, callbacks));
} else if (userobject instanceof Note) {
infoPanel.removeAll();
try {
infoPanel.add(new NotePane(true, (Note) userobject, this));
} catch (BadLocationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public void multiTest() {
HttpRequestResponse requestResponse = TestFactory.createHttpRequestResponse("123");
cdbclient.post(requestResponse.toJson());
cdbclient.post(requestResponse.toJson());
requestResponse = TestFactory.createHttpRequestResponse("1234", "1-12345");
cdbclient.post(requestResponse.toJson());
cdbclient.post(requestResponse.toJson());
}
public void setInfo(JPanel infoPanel) {
this.infoPanel = infoPanel;
}
@Override
public List<JMenuItem> createMenuItems(IContextMenuInvocation invocation) {
List<JMenuItem> menu = new ArrayList<JMenuItem>();
JMenuItem send = new JMenuItem("Send to Stash");
send.addActionListener(e -> menuAction(invocation));
menu.add(send);
return menu;
}
public void menuAction(IContextMenuInvocation invocation) {
if (invocation.getInvocationContext() == invocation.CONTEXT_SCANNER_RESULTS) {
IScanIssue[] scanIssues = invocation.getSelectedIssues();
for (IScanIssue issue : scanIssues) {
for (IHttpRequestResponse http : issue.getHttpMessages()) {
HttpRequestResponse requestResponse = new HttpRequestResponse(null, null,
new String(http.getRequest()), new String(http.getResponse()), http.getComment(), null,
http.getHighlight(), http.getHttpService());
tableModel.addHttp(requestResponse);
tableModel.fireTableDataChanged();
}
}
} else {
IHttpRequestResponse[] messages = invocation.getSelectedMessages();
for (IHttpRequestResponse http : messages) {
HttpRequestResponse requestResponse = new HttpRequestResponse(null, null, new String(http.getRequest()),
new String(http.getResponse()), http.getComment(), null, http.getHighlight(),
http.getHttpService());
tableModel.addHttp(requestResponse);
tableModel.fireTableDataChanged();
}
}
}
public void updatePreview(int selectedRow) {
HttpRequestResponse http = tableModel.getHttp(selectedRow);
infoPanel.removeAll();
infoPanel.add(new HttpPane(true, http, this, callbacks));
}
public void updateNote(Note note) {
if (note.getUuid() == null) {
cdbclient.post(note.toJson());
} else {
cdbclient.update(note.toJson());
}
infoPanel.removeAll();
}
public void updateHttp(HttpRequestResponse http) {
if (http.getUUID() == null) {
cdbclient.post(http.toJson());
} else {
cdbclient.update(http.toJson());
}
infoPanel.removeAll();
}
public void addByCategory(int selectedRow) {
HttpRequestResponse http = tableModel.getHttp(selectedRow);
if (http.getUUID() == null) {
cdbclient.post(http.toJson());
} else {
cdbclient.update(http.toJson());
}
}
public void addToSelected(int selectedRow, Object lastSelectedPathComponent) {
HttpRequestResponse parent = (HttpRequestResponse) lastSelectedPathComponent;
HttpRequestResponse http = tableModel.getHttp(selectedRow);
http.setParentUuid(parent.getUUID());
if (http.getUUID() == null) {
cdbclient.post(http.toJson());
} else {
cdbclient.update(http.toJson());
}
}
} | [
"willherrin1@gmail.com"
] | willherrin1@gmail.com |
e1721b0b60e177f7c6abb56ae96d7ef2bbaa8db2 | 48eaf8db5c8a52ee746202b8e166bf3356554ff1 | /Operations/nifi-ops/core/src/test/java/com/sequenceiq/cloudbreak/core/bootstrap/service/ClusterBootstrapperTest.java | dc4040589a1f15839df49627c26a9ff5e3f5e531 | [
"Apache-2.0"
] | permissive | tspannhw/nifi-addons | 4f87e41a5ee45d152c5c9d880695464032b07dd2 | fd06d761e68baf207950730652d4a035e56278f4 | refs/heads/master | 2021-01-18T09:41:41.263741 | 2016-07-06T20:11:39 | 2016-07-06T20:11:39 | 62,816,041 | 1 | 0 | null | 2016-07-07T15:04:55 | 2016-07-07T15:04:54 | null | UTF-8 | Java | false | false | 25,608 | java | package com.sequenceiq.cloudbreak.core.bootstrap.service;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.anyLong;
import static org.mockito.Matchers.anySet;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.util.HashSet;
import java.util.Set;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.test.util.ReflectionTestUtils;
import com.sequenceiq.cloudbreak.TestUtil;
import com.sequenceiq.cloudbreak.cloud.model.Platform;
import com.sequenceiq.cloudbreak.cloud.scheduler.CancellationException;
import com.sequenceiq.cloudbreak.common.type.CloudConstants;
import com.sequenceiq.cloudbreak.common.type.ScalingType;
import com.sequenceiq.cloudbreak.core.CloudbreakException;
import com.sequenceiq.cloudbreak.core.bootstrap.service.container.ContainerBootstrapApiCheckerTask;
import com.sequenceiq.cloudbreak.core.bootstrap.service.container.ContainerClusterAvailabilityCheckerTask;
import com.sequenceiq.cloudbreak.core.bootstrap.service.container.ContainerOrchestratorResolver;
import com.sequenceiq.cloudbreak.core.bootstrap.service.host.HostBootstrapApiCheckerTask;
import com.sequenceiq.cloudbreak.core.bootstrap.service.host.HostClusterAvailabilityCheckerTask;
import com.sequenceiq.cloudbreak.core.bootstrap.service.host.HostOrchestratorResolver;
import com.sequenceiq.cloudbreak.core.flow.context.ContainerBootstrapApiContext;
import com.sequenceiq.cloudbreak.core.flow.context.ContainerOrchestratorClusterContext;
import com.sequenceiq.cloudbreak.core.flow.context.HostBootstrapApiContext;
import com.sequenceiq.cloudbreak.core.flow.context.HostOrchestratorClusterContext;
import com.sequenceiq.cloudbreak.core.flow.context.StackScalingContext;
import com.sequenceiq.cloudbreak.domain.InstanceMetaData;
import com.sequenceiq.cloudbreak.domain.Orchestrator;
import com.sequenceiq.cloudbreak.domain.Resource;
import com.sequenceiq.cloudbreak.domain.Stack;
import com.sequenceiq.cloudbreak.orchestrator.container.ContainerOrchestrator;
import com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorCancelledException;
import com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException;
import com.sequenceiq.cloudbreak.orchestrator.host.HostOrchestrator;
import com.sequenceiq.cloudbreak.orchestrator.model.ContainerConfig;
import com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig;
import com.sequenceiq.cloudbreak.orchestrator.model.Node;
import com.sequenceiq.cloudbreak.orchestrator.state.ExitCriteriaModel;
import com.sequenceiq.cloudbreak.repository.OrchestratorRepository;
import com.sequenceiq.cloudbreak.repository.StackRepository;
import com.sequenceiq.cloudbreak.service.PollingResult;
import com.sequenceiq.cloudbreak.service.PollingService;
import com.sequenceiq.cloudbreak.service.StatusCheckerTask;
import com.sequenceiq.cloudbreak.service.TlsSecurityService;
@RunWith(MockitoJUnitRunner.class)
public class ClusterBootstrapperTest {
private static final com.sequenceiq.cloudbreak.cloud.model.Platform GCP_PLATFORM = Platform.platform(CloudConstants.GCP);
@Mock
private StackRepository stackRepository;
@Mock
private OrchestratorRepository orchestratorRepository;
@Mock
private PollingService<ContainerBootstrapApiContext> containerBootstrapApiPollingService;
@Mock
private PollingService<HostBootstrapApiContext> hostBootstrapApiPollingService;
@Mock
private ContainerBootstrapApiCheckerTask containerBootstrapApiCheckerTask;
@Mock
private HostBootstrapApiCheckerTask hostBootstrapApiCheckerTask;
@Mock
private PollingService<ContainerOrchestratorClusterContext> containerClusterAvailabilityPollingService;
@Mock
private PollingService<HostOrchestratorClusterContext> hostClusterAvailabilityPollingService;
@Mock
private ContainerClusterAvailabilityCheckerTask containerClusterAvailabilityCheckerTask;
@Mock
private HostClusterAvailabilityCheckerTask hostClusterAvailabilityCheckerTask;
@Mock
private ClusterBootstrapperErrorHandler clusterBootstrapperErrorHandler;
@Mock
private ContainerOrchestratorResolver containerOrchestratorResolver;
@Mock
private HostOrchestratorResolver hostOrchestratorResolver;
@Mock
private TlsSecurityService tlsSecurityService;
@Mock
private ContainerConfigService containerConfigService;
@Mock
private HostServiceConfigService hostServiceConfigService;
@Mock
private OrchestratorTypeResolver orchestratorTypeResolver;
@InjectMocks
private ClusterBootstrapper underTest;
@Before
public void setUp() throws CloudbreakException {
when(orchestratorTypeResolver.resolveType(anyString())).thenReturn(OrchestratorType.CONTAINER);
ReflectionTestUtils.setField(containerConfigService, "munchausenImageName", "sequence/testcont:0.1.1");
}
@Test
public void bootstrapClusterWhenEverythingWorksNormally() throws CloudbreakException, CloudbreakOrchestratorFailedException {
Stack stack = TestUtil.stack();
when(tlsSecurityService.buildGatewayConfig(anyLong(), anyString(), anyInt(), anyString()))
.thenReturn(new GatewayConfig("10.0.0.1", "10.0.0.1", 8443, "/cert/1"));
when(containerOrchestratorResolver.get("SWARM")).thenReturn(new MockContainerOrchestrator());
when(containerBootstrapApiPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerBootstrapApiContext.class), anyInt(),
anyInt()))
.thenReturn(PollingResult.SUCCESS);
when(containerClusterAvailabilityPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class),
any(ContainerOrchestratorClusterContext.class), anyInt(), anyInt()))
.thenReturn(PollingResult.SUCCESS);
doNothing().when(clusterBootstrapperErrorHandler)
.terminateFailedNodes(any(HostOrchestrator.class), any(ContainerOrchestrator.class), any(Stack.class),
any(GatewayConfig.class), any(Set.class));
when(orchestratorRepository.save(any(Orchestrator.class))).thenReturn(new Orchestrator());
underTest.bootstrapContainers(stack);
verify(tlsSecurityService, times(1)).buildGatewayConfig(anyLong(), anyString(), anyInt(), anyString());
verify(clusterBootstrapperErrorHandler, times(0))
.terminateFailedNodes(any(HostOrchestrator.class), any(ContainerOrchestrator.class), any(Stack.class), any(GatewayConfig.class), anySet());
verify(containerBootstrapApiPollingService, times(1)).pollWithTimeoutSingleFailure(any(StatusCheckerTask.class),
any(ContainerBootstrapApiContext.class), anyInt(),
anyInt());
verify(containerClusterAvailabilityPollingService, times(1)).pollWithTimeoutSingleFailure(any(StatusCheckerTask.class),
any(ContainerOrchestratorClusterContext.class), anyInt(), anyInt());
}
@Test
public void bootstrapClusterWhenTimeOutComesInClusterAvailabilityPoller() throws CloudbreakException, CloudbreakOrchestratorFailedException {
Stack stack = TestUtil.stack();
when(tlsSecurityService.buildGatewayConfig(anyLong(), anyString(), anyInt(), anyString()))
.thenReturn(new GatewayConfig("10.0.0.1", "10.0.0.1", 8443, "/cert/1"));
when(containerOrchestratorResolver.get("SWARM")).thenReturn(new MockContainerOrchestrator());
when(containerBootstrapApiPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerBootstrapApiContext.class), anyInt(),
anyInt()))
.thenReturn(PollingResult.SUCCESS);
when(containerClusterAvailabilityPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class),
any(ContainerOrchestratorClusterContext.class), anyInt(), anyInt()))
.thenReturn(PollingResult.TIMEOUT);
doNothing().when(clusterBootstrapperErrorHandler)
.terminateFailedNodes(any(HostOrchestrator.class), any(ContainerOrchestrator.class), any(Stack.class),
any(GatewayConfig.class), any(Set.class));
underTest.bootstrapContainers(stack);
verify(tlsSecurityService, times(1)).buildGatewayConfig(anyLong(), anyString(), anyInt(), anyString());
verify(clusterBootstrapperErrorHandler, times(1))
.terminateFailedNodes(any(HostOrchestrator.class), any(ContainerOrchestrator.class), any(Stack.class), any(GatewayConfig.class), anySet());
verify(containerBootstrapApiPollingService, times(1)).pollWithTimeoutSingleFailure(any(StatusCheckerTask.class),
any(ContainerBootstrapApiContext.class), anyInt(),
anyInt());
verify(containerClusterAvailabilityPollingService, times(1)).pollWithTimeoutSingleFailure(any(StatusCheckerTask.class),
any(ContainerOrchestratorClusterContext.class), anyInt(), anyInt());
}
@Test(expected = CancellationException.class)
public void bootstrapClusterWhenOrchestratorDropCancelledException() throws CloudbreakException, CloudbreakOrchestratorFailedException {
Stack stack = TestUtil.stack();
when(tlsSecurityService.buildGatewayConfig(anyLong(), anyString(), anyInt(), anyString()))
.thenReturn(new GatewayConfig("10.0.0.1", "10.0.0.1", 8443, "/cert/1"));
when(containerOrchestratorResolver.get("SWARM")).thenReturn(new CancelledMockContainerOrchestrator());
when(containerBootstrapApiPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerBootstrapApiContext.class), anyInt(),
anyInt()))
.thenReturn(PollingResult.SUCCESS);
when(containerClusterAvailabilityPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class),
any(ContainerOrchestratorClusterContext.class), anyInt(), anyInt()))
.thenReturn(PollingResult.SUCCESS);
doNothing().when(clusterBootstrapperErrorHandler)
.terminateFailedNodes(any(HostOrchestrator.class), any(ContainerOrchestrator.class), any(Stack.class),
any(GatewayConfig.class), any(Set.class));
underTest.bootstrapContainers(stack);
}
@Test(expected = CloudbreakException.class)
public void bootstrapClusterWhenOrchestratorDropFailedException() throws CloudbreakException, CloudbreakOrchestratorFailedException {
Stack stack = TestUtil.stack();
when(tlsSecurityService.buildGatewayConfig(anyLong(), anyString(), anyInt(), anyString()))
.thenReturn(new GatewayConfig("10.0.0.1", "10.0.0.1", 8443, "/cert/1"));
when(containerOrchestratorResolver.get("SWARM")).thenReturn(new FailedMockContainerOrchestrator());
when(containerBootstrapApiPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerBootstrapApiContext.class), anyInt(),
anyInt()))
.thenReturn(PollingResult.SUCCESS);
when(containerClusterAvailabilityPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class),
any(ContainerOrchestratorClusterContext.class), anyInt(), anyInt()))
.thenReturn(PollingResult.SUCCESS);
doNothing().when(clusterBootstrapperErrorHandler)
.terminateFailedNodes(any(HostOrchestrator.class), any(ContainerOrchestrator.class), any(Stack.class),
any(GatewayConfig.class), any(Set.class));
underTest.bootstrapContainers(stack);
}
@Test
public void bootstrapClusterWhenEverythingWorksNormallyWithMoreBootstrapSegment() throws CloudbreakException, CloudbreakOrchestratorFailedException {
Stack stack = TestUtil.stack();
when(tlsSecurityService.buildGatewayConfig(anyLong(), anyString(), anyInt(), anyString()))
.thenReturn(new GatewayConfig("10.0.0.1", "10.0.0.1", 8443, "/cert/1"));
when(containerOrchestratorResolver.get("SWARM")).thenReturn(new TwoLengthMockContainerOrchestrator());
when(containerBootstrapApiPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerBootstrapApiContext.class), anyInt(),
anyInt()))
.thenReturn(PollingResult.SUCCESS);
when(containerClusterAvailabilityPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class),
any(ContainerOrchestratorClusterContext.class), anyInt(), anyInt())).thenReturn(PollingResult.SUCCESS);
doNothing().when(clusterBootstrapperErrorHandler)
.terminateFailedNodes(any(HostOrchestrator.class), any(ContainerOrchestrator.class), any(Stack.class),
any(GatewayConfig.class), any(Set.class));
underTest.bootstrapContainers(stack);
verify(clusterBootstrapperErrorHandler, times(0))
.terminateFailedNodes(any(HostOrchestrator.class), any(ContainerOrchestrator.class), any(Stack.class), any(GatewayConfig.class), anySet());
verify(tlsSecurityService, times(1)).buildGatewayConfig(anyLong(), anyString(), anyInt(), anyString());
verify(containerBootstrapApiPollingService, times(1)).pollWithTimeoutSingleFailure(any(StatusCheckerTask.class),
any(ContainerBootstrapApiContext.class), anyInt(), anyInt());
verify(containerClusterAvailabilityPollingService, times(3)).pollWithTimeoutSingleFailure(any(StatusCheckerTask.class),
any(ContainerOrchestratorClusterContext.class), anyInt(), anyInt());
}
@Test
public void bootstrapNewNodesInClusterWhenEverythingWorksNormally() throws CloudbreakException, CloudbreakOrchestratorFailedException {
Stack stack = TestUtil.stack();
StackScalingContext context = new StackScalingContext(1L, GCP_PLATFORM, 2, "master1", new HashSet<Resource>(),
ScalingType.UPSCALE_ONLY_STACK, getPrivateIps(stack));
when(stackRepository.findOneWithLists(anyLong())).thenReturn(stack);
when(tlsSecurityService.buildGatewayConfig(anyLong(), anyString(), anyInt(), anyString()))
.thenReturn(new GatewayConfig("10.0.0.1", "10.0.0.1", 8443, "/cert/1"));
when(containerOrchestratorResolver.get("SWARM")).thenReturn(new MockContainerOrchestrator());
when(containerBootstrapApiPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerBootstrapApiContext.class), anyInt(),
anyInt()))
.thenReturn(PollingResult.SUCCESS);
when(containerClusterAvailabilityPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class),
any(ContainerOrchestratorClusterContext.class), anyInt(), anyInt()))
.thenReturn(PollingResult.SUCCESS);
doNothing().when(clusterBootstrapperErrorHandler)
.terminateFailedNodes(any(HostOrchestrator.class), any(ContainerOrchestrator.class), any(Stack.class),
any(GatewayConfig.class), any(Set.class));
underTest.bootstrapNewNodes(context);
verify(clusterBootstrapperErrorHandler, times(0))
.terminateFailedNodes(any(HostOrchestrator.class), any(ContainerOrchestrator.class), any(Stack.class), any(GatewayConfig.class), anySet());
verify(tlsSecurityService, times(1)).buildGatewayConfig(anyLong(), anyString(), anyInt(), anyString());
verify(containerClusterAvailabilityPollingService, times(2)).pollWithTimeoutSingleFailure(any(StatusCheckerTask.class),
any(ContainerOrchestratorClusterContext.class), anyInt(), anyInt());
}
@Test
public void bootstrapNewNodesInClusterWhenBootstrapHappeningInTwoSegments() throws CloudbreakException, CloudbreakOrchestratorFailedException {
Stack stack = TestUtil.stack();
StackScalingContext context = new StackScalingContext(1L, GCP_PLATFORM, 2, "master1", new HashSet<Resource>(),
ScalingType.UPSCALE_ONLY_STACK, getPrivateIps(stack));
when(stackRepository.findOneWithLists(anyLong())).thenReturn(stack);
when(tlsSecurityService.buildGatewayConfig(anyLong(), anyString(), anyInt(), anyString()))
.thenReturn(new GatewayConfig("10.0.0.1", "10.0.0.1", 8443, "/cert/1"));
when(containerOrchestratorResolver.get("SWARM")).thenReturn(new TwoLengthMockContainerOrchestrator());
when(containerBootstrapApiPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerBootstrapApiContext.class), anyInt(),
anyInt()))
.thenReturn(PollingResult.SUCCESS);
when(containerClusterAvailabilityPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class),
any(ContainerOrchestratorClusterContext.class), anyInt(), anyInt()))
.thenReturn(PollingResult.SUCCESS);
doNothing().when(clusterBootstrapperErrorHandler)
.terminateFailedNodes(any(HostOrchestrator.class), any(ContainerOrchestrator.class), any(Stack.class),
any(GatewayConfig.class), any(Set.class));
underTest.bootstrapNewNodes(context);
verify(clusterBootstrapperErrorHandler, times(0))
.terminateFailedNodes(any(HostOrchestrator.class), any(ContainerOrchestrator.class), any(Stack.class), any(GatewayConfig.class), anySet());
verify(tlsSecurityService, times(1)).buildGatewayConfig(anyLong(), anyString(), anyInt(), anyString());
verify(containerClusterAvailabilityPollingService, times(3)).pollWithTimeoutSingleFailure(any(StatusCheckerTask.class),
any(ContainerOrchestratorClusterContext.class), anyInt(), anyInt());
}
@Test
public void bootstrapNewNodesInClusterWhenClusterAvailabilityDropTimeout() throws CloudbreakException, CloudbreakOrchestratorFailedException {
Stack stack = TestUtil.stack();
StackScalingContext context = new StackScalingContext(1L, GCP_PLATFORM, 2, "master1", new HashSet<Resource>(),
ScalingType.UPSCALE_ONLY_STACK, getPrivateIps(stack));
when(stackRepository.findOneWithLists(anyLong())).thenReturn(stack);
when(tlsSecurityService.buildGatewayConfig(anyLong(), anyString(), anyInt(), anyString()))
.thenReturn(new GatewayConfig("10.0.0.1", "10.0.0.1", 8443, "/cert/1"));
when(containerOrchestratorResolver.get("SWARM")).thenReturn(new MockContainerOrchestrator());
when(containerBootstrapApiPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerBootstrapApiContext.class), anyInt(),
anyInt()))
.thenReturn(PollingResult.SUCCESS);
when(containerClusterAvailabilityPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class),
any(ContainerOrchestratorClusterContext.class), anyInt(), anyInt()))
.thenReturn(PollingResult.TIMEOUT);
doNothing().when(clusterBootstrapperErrorHandler)
.terminateFailedNodes(any(HostOrchestrator.class), any(ContainerOrchestrator.class), any(Stack.class),
any(GatewayConfig.class), any(Set.class));
underTest.bootstrapNewNodes(context);
verify(clusterBootstrapperErrorHandler, times(1))
.terminateFailedNodes(any(HostOrchestrator.class), any(ContainerOrchestrator.class), any(Stack.class), any(GatewayConfig.class), anySet());
verify(tlsSecurityService, times(1)).buildGatewayConfig(anyLong(), anyString(), anyInt(), anyString());
verify(containerClusterAvailabilityPollingService, times(2)).pollWithTimeoutSingleFailure(any(StatusCheckerTask.class),
any(ContainerOrchestratorClusterContext.class), anyInt(), anyInt());
}
@Test(expected = CancellationException.class)
public void bootstrapNewNodesInClusterWhenOrchestratorDropCancelledException() throws CloudbreakException, CloudbreakOrchestratorFailedException {
Stack stack = TestUtil.stack();
StackScalingContext context = new StackScalingContext(1L, GCP_PLATFORM, 2, "master1", new HashSet<Resource>(),
ScalingType.UPSCALE_ONLY_STACK, getPrivateIps(stack));
when(stackRepository.findOneWithLists(anyLong())).thenReturn(stack);
when(tlsSecurityService.buildGatewayConfig(anyLong(), anyString(), anyInt(), anyString()))
.thenReturn(new GatewayConfig("10.0.0.1", "10.0.0.1", 8443, "/cert/1"));
when(containerOrchestratorResolver.get("SWARM")).thenReturn(new CancelledNewNodesMockContainerOrchestrator());
when(containerBootstrapApiPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerBootstrapApiContext.class), anyInt(),
anyInt()))
.thenReturn(PollingResult.SUCCESS);
when(containerClusterAvailabilityPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class),
any(ContainerOrchestratorClusterContext.class), anyInt(), anyInt()))
.thenReturn(PollingResult.TIMEOUT);
doNothing().when(clusterBootstrapperErrorHandler)
.terminateFailedNodes(any(HostOrchestrator.class), any(ContainerOrchestrator.class), any(Stack.class),
any(GatewayConfig.class), any(Set.class));
underTest.bootstrapNewNodes(context);
}
@Test(expected = CloudbreakException.class)
public void bootstrapNewNodesInClusterWhenOrchestratorDropFailedException() throws CloudbreakException, CloudbreakOrchestratorFailedException {
Stack stack = TestUtil.stack();
StackScalingContext context = new StackScalingContext(1L, GCP_PLATFORM, 2, "master1", new HashSet<Resource>(),
ScalingType.UPSCALE_ONLY_STACK, getPrivateIps(stack));
when(stackRepository.findOneWithLists(anyLong())).thenReturn(stack);
when(tlsSecurityService.buildGatewayConfig(anyLong(), anyString(), anyInt(), anyString()))
.thenReturn(new GatewayConfig("10.0.0.1", "10.0.0.1", 8443, "/cert/1"));
when(containerOrchestratorResolver.get("SWARM")).thenReturn(new FailedNewNodesMockContainerOrchestrator());
when(containerBootstrapApiPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerBootstrapApiContext.class), anyInt(),
anyInt()))
.thenReturn(PollingResult.SUCCESS);
when(containerClusterAvailabilityPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class),
any(ContainerOrchestratorClusterContext.class), anyInt(), anyInt()))
.thenReturn(PollingResult.TIMEOUT);
doNothing().when(clusterBootstrapperErrorHandler)
.terminateFailedNodes(any(HostOrchestrator.class), any(ContainerOrchestrator.class), any(Stack.class),
any(GatewayConfig.class), any(Set.class));
underTest.bootstrapNewNodes(context);
}
private Set<String> getPrivateIps(Stack stack) {
Set<String> ips = new HashSet<>();
for (InstanceMetaData instanceMetaData : stack.getRunningInstanceMetaData()) {
ips.add(instanceMetaData.getPrivateIp());
}
return ips;
}
class FailedNewNodesMockContainerOrchestrator extends MockContainerOrchestrator {
@Override
public void bootstrapNewNodes(GatewayConfig gatewayConfig, ContainerConfig containerConfig, Set<Node> nodes, ExitCriteriaModel
exitCriteriaModel)
throws CloudbreakOrchestratorFailedException {
throw new CloudbreakOrchestratorFailedException("failed");
}
}
class CancelledMockContainerOrchestrator extends MockContainerOrchestrator {
@Override
public void bootstrap(GatewayConfig gatewayConfig, ContainerConfig config, Set<Node> nodes, int consulServerCount, ExitCriteriaModel exitCriteriaModel)
throws CloudbreakOrchestratorCancelledException {
throw new CloudbreakOrchestratorCancelledException("cancelled");
}
}
class CancelledNewNodesMockContainerOrchestrator extends MockContainerOrchestrator {
@Override
public void bootstrapNewNodes(GatewayConfig gatewayConfig, ContainerConfig containerConfig, Set<Node> nodes, ExitCriteriaModel exitCriteriaModel)
throws CloudbreakOrchestratorCancelledException {
throw new CloudbreakOrchestratorCancelledException("cancelled");
}
}
class TwoLengthMockContainerOrchestrator extends MockContainerOrchestrator {
@Override
public int getMaxBootstrapNodes() {
return 2;
}
}
class FailedMockContainerOrchestrator extends MockContainerOrchestrator {
@Override
public void bootstrap(GatewayConfig gatewayConfig, ContainerConfig config, Set<Node> nodes, int consulServerCount, ExitCriteriaModel exitCriteriaModel)
throws CloudbreakOrchestratorFailedException {
throw new CloudbreakOrchestratorFailedException("failed");
}
}
}
| [
"jdye64@gmail.com"
] | jdye64@gmail.com |
c7191bf07cfc6a9db417be4c0db73464016cb492 | fbeaff12239b0c7decd7553bbb0142dc0846e9eb | /src/main/java/com/projecttau/defaults/commands/GamemodeCommand.java | 1eef8c79bf4ade701863b1606b7449a525b02743 | [
"MIT"
] | permissive | ZombieStriker/ProjectTau | 59c5bdb9b9cc5b77932f28a0f5205d95d9e0a678 | 9be1c8d3b485c1ca6f7625065c202516d4e13afe | refs/heads/main | 2023-05-20T03:43:32.143902 | 2021-06-13T09:35:20 | 2021-06-13T09:35:20 | 375,923,931 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,095 | java | package com.projecttau.defaults.commands;
import com.projecttau.bootstrap.Bootstrap;
import net.minestom.server.command.builder.Command;
import net.minestom.server.entity.GameMode;
import net.minestom.server.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class GamemodeCommand extends Command {
public GamemodeCommand() {
super("gamemode","g");
// Executed if no other executor can be used
setDefaultExecutor((sender, context) -> {
if(sender.isPlayer()){
Player player = sender.asPlayer();
if(player.getPermissionLevel() >= 2){
if(player.isCreative()){
player.setGameMode(GameMode.SURVIVAL);
player.sendMessage("Setting you back to survival mode");
}else{
player.setGameMode(GameMode.CREATIVE);
player.sendMessage("Setting you to creative mode.");
}
}
}
});
}
}
| [
"dannyboyhn@yahoo.com"
] | dannyboyhn@yahoo.com |
d77fd99d2f7b3391f901b682ccdd1cd701a52495 | 8920cf1e82cfec6213f4b14cfecf19202f1001a0 | /app/src/main/java/es/source/code/adapter/FoodDetailPagerAdapter.java | 2434c305d13bb471d6dbaf919cf428d4535590c2 | [] | no_license | togepro/SCOS | 9951b471d4a56d66305b63a8117749d1a6badd4e | e8b4b39bc9e2c1ef0fbb05f21374be9e0268aec2 | refs/heads/master | 2020-04-01T01:03:59.775943 | 2018-11-18T13:28:24 | 2018-11-18T13:28:24 | 152,724,828 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,359 | java | package es.source.code.adapter;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.view.PagerAdapter;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.List;
import es.source.code.activity.R;
import es.source.code.model.Data;
import es.source.code.model.Food;
public class FoodDetailPagerAdapter extends PagerAdapter {
private Context mContext;
private List<Food> foodList;
private int resId;
private List<View> viewList;
public FoodDetailPagerAdapter(Context context,List<Food> foodlist,int resId){
this.mContext=context;
this.foodList=foodlist;
this.resId=resId;
initViewList();
}
private void initViewList() {
viewList = new ArrayList<>();
LayoutInflater inflater = ((Activity) mContext).getLayoutInflater();
for (Food food : foodList) {
viewList.add(inflater.inflate(resId, null));
}
}
@Override
public int getCount() {
return viewList.size();
}
@Override
public boolean isViewFromObject(@NonNull View view, @NonNull Object o) {
return view==o;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView(viewList.get(position));
}
@NonNull
@Override
public Object instantiateItem(@NonNull ViewGroup container, int position) {
final View pageView = viewList.get(position);
final Food food = foodList.get(position);
final Data orderFoods= (Data)pageView.getContext().getApplicationContext();
TextView tvFoodName = pageView.findViewById(R.id.food_name_detail);
TextView tvFoodPrice = pageView.findViewById(R.id.food_price_detail);
ImageView ivFood = pageView.findViewById(R.id.food_image_detail);
final Button mButton = pageView.findViewById(R.id.take_order_detail);
if(orderFoods.isOrdered(food)) {
mButton.setText("退点");
}
tvFoodName.setText(food.getFoodName());
String price = String.valueOf(food.getPrice()) + "元";
tvFoodPrice.setText(price);
ivFood.setImageResource(food.getImageId());
mButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(mButton.getText().equals("点菜")){
food.setOrderState(1);
orderFoods.addFood(food);
Toast.makeText(pageView.getContext(),"点菜成功", Toast.LENGTH_SHORT).show();
mButton.setText("退点");
}
else if(mButton.getText().equals("退点")){
food.setOrderState(0);
orderFoods.removeFood(food);
Toast.makeText(pageView.getContext(),"退点成功", Toast.LENGTH_SHORT).show();
mButton.setText("点菜");
}
}
});
container.addView(pageView);
return pageView;
}
}
| [
"572298529@qq.com"
] | 572298529@qq.com |
14e9f956a9f8ab5a4474a4b04681f3ff88900639 | fa61fd6573be8fb5bdb7413a9333555863016cec | /NoRecordsDatabase/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/work/Catalina/localhost/mydatabase/org/apache/jsp/select/selectMusician_jsp.java | c9bf2cf0d0067b1979b88362a60c2bd0e2c06934 | [] | no_license | sagardhakal-photon/myDatabase | 9a5b7c41cb4f14eb84aec106903ab37d7f19cb5c | 9bfaa43d8fa5eba8c3f2b3f679a4a29e3589772f | refs/heads/master | 2023-04-01T18:23:58.704317 | 2018-03-31T03:07:19 | 2018-03-31T03:07:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,990 | java | /*
* Generated by the Jasper component of Apache Tomcat
* Version: Apache Tomcat/9.0.1
* Generated at: 2017-11-29 00:28:49 UTC
* Note: The last modified time of this file was set to
* the last modified time of the source file after
* generation to assist with modification tracking.
*/
package org.apache.jsp.select;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class selectMusician_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent,
org.apache.jasper.runtime.JspSourceImports {
private static final javax.servlet.jsp.JspFactory _jspxFactory =
javax.servlet.jsp.JspFactory.getDefaultFactory();
private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;
static {
_jspx_dependants = new java.util.HashMap<java.lang.String,java.lang.Long>(2);
_jspx_dependants.put("file:/C:/Program%20Files/apache-tomcat-9.0.1/lib/standard.jar", Long.valueOf(1511913603503L));
_jspx_dependants.put("jar:file:/C:/Program%20Files/apache-tomcat-9.0.1/lib/standard.jar!/META-INF/c.tld", Long.valueOf(1098736290000L));
}
private static final java.util.Set<java.lang.String> _jspx_imports_packages;
private static final java.util.Set<java.lang.String> _jspx_imports_classes;
static {
_jspx_imports_packages = new java.util.HashSet<>();
_jspx_imports_packages.add("javax.servlet");
_jspx_imports_packages.add("javax.servlet.http");
_jspx_imports_packages.add("javax.servlet.jsp");
_jspx_imports_classes = null;
}
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems;
private volatile javax.el.ExpressionFactory _el_expressionfactory;
private volatile org.apache.tomcat.InstanceManager _jsp_instancemanager;
public java.util.Map<java.lang.String,java.lang.Long> getDependants() {
return _jspx_dependants;
}
public java.util.Set<java.lang.String> getPackageImports() {
return _jspx_imports_packages;
}
public java.util.Set<java.lang.String> getClassImports() {
return _jspx_imports_classes;
}
public javax.el.ExpressionFactory _jsp_getExpressionFactory() {
if (_el_expressionfactory == null) {
synchronized (this) {
if (_el_expressionfactory == null) {
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
}
}
}
return _el_expressionfactory;
}
public org.apache.tomcat.InstanceManager _jsp_getInstanceManager() {
if (_jsp_instancemanager == null) {
synchronized (this) {
if (_jsp_instancemanager == null) {
_jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
}
}
}
return _jsp_instancemanager;
}
public void _jspInit() {
_005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
}
public void _jspDestroy() {
_005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems.release();
}
public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
throws java.io.IOException, javax.servlet.ServletException {
final java.lang.String _jspx_method = request.getMethod();
if (!"GET".equals(_jspx_method) && !"POST".equals(_jspx_method) && !"HEAD".equals(_jspx_method) && !javax.servlet.DispatcherType.ERROR.equals(request.getDispatcherType())) {
response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "JSPs only permit GET POST or HEAD");
return;
}
final javax.servlet.jsp.PageContext pageContext;
javax.servlet.http.HttpSession session = null;
final javax.servlet.ServletContext application;
final javax.servlet.ServletConfig config;
javax.servlet.jsp.JspWriter out = null;
final java.lang.Object page = this;
javax.servlet.jsp.JspWriter _jspx_out = null;
javax.servlet.jsp.PageContext _jspx_page_context = null;
try {
response.setContentType("text/html; charset=ISO-8859-1");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n");
out.write("\r\n");
out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n");
out.write("<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n");
out.write("<head>\r\n");
out.write("\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">\r\n");
out.write(" <link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css\">\r\n");
out.write(" <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js\"></script>\r\n");
out.write(" <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js\"></script>\r\n");
out.write(" \t<title>Musician</title>\r\n");
out.write("</head>\r\n");
out.write("<body>\r\n");
out.write("<div class=\"container\">\r\n");
out.write(" <div class=\"jumbotron\">\r\n");
out.write(" <h1>Musicians</h1>\r\n");
out.write(" </div>\r\n");
out.write("\t<form action=\"select/SelectMusician\" method=\"post\">\r\n");
out.write("\t\t<table class=\"table\">\r\n");
out.write("\t\t\t<thead class=\"thead-light\">\r\n");
out.write("\t\t\t\t<tr>\r\n");
out.write("\t\t\t\t\t<th scope=\"col\">ID#</th>\r\n");
out.write("\t\t\t\t\t<th scope=\"col\">Musician SSN</th>\r\n");
out.write("\t\t\t\t\t<th scope=\"col\">Name</th>\r\n");
out.write("\t\t\t\t\t<th scope=\"col\">Phone Number</th>\r\n");
out.write("\t\t\t\t\t<th scope=\"col\"></th>\r\n");
out.write("\t\t\t\t</tr>\r\n");
out.write("\t\t\t</thead>\r\n");
out.write("\t\t\t<tbody>\r\n");
out.write("\t\t\t\t");
if (_jspx_meth_c_005fforEach_005f0(_jspx_page_context))
return;
out.write("\r\n");
out.write("\t\t\t</tbody>\r\n");
out.write("\t\t</table>\r\n");
out.write("\t</form>\r\n");
out.write("</div>\r\n");
out.write("\t<a href=\"index.jsp\">back to home</a>\r\n");
out.write("</body>\r\n");
out.write("</html>\r\n");
} catch (java.lang.Throwable t) {
if (!(t instanceof javax.servlet.jsp.SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
try {
if (response.isCommitted()) {
out.flush();
} else {
out.clearBuffer();
}
} catch (java.io.IOException e) {}
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
private boolean _jspx_meth_c_005fforEach_005f0(javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// c:forEach
org.apache.taglibs.standard.tag.rt.core.ForEachTag _jspx_th_c_005fforEach_005f0 = (org.apache.taglibs.standard.tag.rt.core.ForEachTag) _005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems.get(org.apache.taglibs.standard.tag.rt.core.ForEachTag.class);
boolean _jspx_th_c_005fforEach_005f0_reused = false;
try {
_jspx_th_c_005fforEach_005f0.setPageContext(_jspx_page_context);
_jspx_th_c_005fforEach_005f0.setParent(null);
// /select/selectMusician.jsp(30,4) name = items type = java.lang.Object reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_c_005fforEach_005f0.setItems((java.lang.Object) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${mus}", java.lang.Object.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null));
// /select/selectMusician.jsp(30,4) name = var type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_c_005fforEach_005f0.setVar("it");
int[] _jspx_push_body_count_c_005fforEach_005f0 = new int[] { 0 };
try {
int _jspx_eval_c_005fforEach_005f0 = _jspx_th_c_005fforEach_005f0.doStartTag();
if (_jspx_eval_c_005fforEach_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
do {
out.write("\r\n");
out.write("\t\t\t\t\t<tr>\r\n");
out.write("\t\t\t\t\t\t<th scope=\"row\">");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${it.mid}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null));
out.write("</th>\r\n");
out.write("\t\t\t\t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${it.ssn}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null));
out.write("</td>\r\n");
out.write("\t\t\t\t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${it.name}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null));
out.write("</td>\r\n");
out.write("\t\t\t\t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${it.phone_no}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null));
out.write("</td>\r\n");
out.write("\t\t\t\t\t\t<td class=\"text-center\">\r\n");
out.write("\t\t\t\t\t\t\t<a href=\"DeleteMusician?id=");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${it.mid}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null));
out.write("\" class=\"btn btn-danger btn-xs\">\r\n");
out.write("\t\t\t\t\t\t\t\t<span class=\"glyphicon glyphicon-trash\"></span>\r\n");
out.write("\t\t\t\t\t\t\t</a>\r\n");
out.write("\t\t\t\t\t\t</td>\r\n");
out.write("\t\t\t\t\t</tr>\r\n");
out.write("\t\t\t\t");
int evalDoAfterBody = _jspx_th_c_005fforEach_005f0.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
}
if (_jspx_th_c_005fforEach_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
return true;
}
} catch (java.lang.Throwable _jspx_exception) {
while (_jspx_push_body_count_c_005fforEach_005f0[0]-- > 0)
out = _jspx_page_context.popBody();
_jspx_th_c_005fforEach_005f0.doCatch(_jspx_exception);
} finally {
_jspx_th_c_005fforEach_005f0.doFinally();
}
_005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems.reuse(_jspx_th_c_005fforEach_005f0);
_jspx_th_c_005fforEach_005f0_reused = true;
} finally {
org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_c_005fforEach_005f0, _jsp_getInstanceManager(), _jspx_th_c_005fforEach_005f0_reused);
}
return false;
}
}
| [
"mfperez13@gmail.com"
] | mfperez13@gmail.com |
37df24af34b27ddcb5b675f5ebf00c4ecb307d23 | 933dc607993a060f6297e4b0851ffb578558c0b4 | /Liczby Pierwsze/Main.java | 4bed989f95ba9a6d4691e055811fe4e6a07e298e | [] | no_license | MateuszWojnowski/SPOJ | 6667700e1ad647669d68dd87eb9a1a87a183735a | 99f7151343ecd4207f35de00652a26b96306295c | refs/heads/main | 2023-01-21T18:16:18.327130 | 2020-11-18T22:30:01 | 2020-11-18T22:30:01 | 314,024,354 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,123 | java | import java.util.*;
import java.lang.*;
class Main
{
public static boolean czyJestPierwsza(int sprawdzanaLiczba)
{
if (sprawdzanaLiczba == 0 || sprawdzanaLiczba == 1)
{
return false;
}
for (int i = 0; i < sprawdzanaLiczba-2; i++)
{
if (sprawdzanaLiczba % (i+2) == 0)
{
return false;
}
}
return true;
}
public static void main (String[] args) throws java.lang.Exception
{
Scanner scanner = new Scanner(System.in);
int liczbaTestow = scanner.nextInt();
int[] sprawdzanaLiczba = new int[liczbaTestow];
for (int i = 0; i < liczbaTestow; i++)
{
sprawdzanaLiczba[i] = scanner.nextInt();
}
for (int i = 0; i < liczbaTestow; i++)
{
if (Main.czyJestPierwsza(sprawdzanaLiczba[i]) == true )
{
System.out.println("TAK");
} else
{
System.out.println("NIE");
}
}
}
} | [
"noreply@github.com"
] | MateuszWojnowski.noreply@github.com |
db11680fe1200ddedebef449a3886881ffc7a747 | f97fe5ca8584ef3ee119abf5e76cd6ebf3ad87d5 | /src/main/java/org/manojit/messenger/resource/ProfileResource.java | a102c449f9dd8306594c3a2bf3a4ea2e58d20ae5 | [] | no_license | manojsoftware/restmessenger | cefae0a6770ec74b94560bd0c2495eebc7c475b4 | 4357aaacdab3b7c5fe6262305823be977e3875f3 | refs/heads/master | 2020-06-27T08:44:15.206570 | 2016-11-23T05:09:40 | 2016-11-23T05:09:40 | 74,529,702 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,313 | java | package org.manojit.messenger.resource;
import java.util.List;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.manojit.messenger.model.Profile;
import org.manojit.messenger.service.ProfileService;
@Path("/profiles")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public class ProfileResource {
ProfileService service =new ProfileService();
@GET
public List<Profile> getProfiles() {
return service.getAllProfiles();
}
@GET
@Path("/{profileName}")
public Profile getMessage(@PathParam("profileName")String ProfileName){
return service.getProfile(ProfileName);
}
@POST
public Profile addProfile(Profile profile){
return service.addProfile(profile);
}
@PUT
@Path("/{profileName}")
public Profile updateProfile(@PathParam("profileName")String ProfileName,Profile profile){
profile.setProfileName(ProfileName);
return service.updateProfile(profile);
}
@DELETE
@Path("/{profileName}")
public Profile deleteProfile(@PathParam("profileName")String ProfileName){
return service.removeProfile(ProfileName);
}
}
| [
"manojitsoftware@gmail.com"
] | manojitsoftware@gmail.com |
3e3ff97a65f2efa673efd95b87d852fe04e5bc53 | 407daf338c496df4978b8a459ee242177d622d6e | /mediumApp/domain/src/main/java/com/anlijiu/example/domain/interactor/GetCardDetails.java | 85b008a8d4cf96bcedb00e3f82645f5689e03b55 | [
"MIT"
] | permissive | anlijiu/android-boilerplates | afdce450ef3fd42ad9bcc27d1529df738705b2df | 2c1533f1057ee24c3c8f044ee1e89f5bd5764514 | refs/heads/master | 2020-03-20T22:56:34.533771 | 2018-10-08T01:59:23 | 2018-10-08T01:59:23 | 137,821,970 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,898 | java | /**
* Copyright (C) 2015 Fernando Cejas Open Source Project
*
* 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.anlijiu.example.domain.interactor;
import com.anlijiu.example.domain.objects.Card;
import com.anlijiu.example.domain.executor.PostExecutionThread;
import com.anlijiu.example.domain.executor.ThreadExecutor;
import com.anlijiu.example.domain.repository.CardRepository;
import io.reactivex.Observable;
import javax.inject.Inject;
/**
* This class is an implementation of {@link UseCase} that represents a use case for
* retrieving data related to an specific {@link Card}.
*/
public class GetCardDetails extends UseCase<Card, GetCardDetails.Params> {
private final CardRepository cardRepository;
@Inject
GetCardDetails(CardRepository cardRepository, ThreadExecutor threadExecutor,
PostExecutionThread postExecutionThread) {
super(threadExecutor, postExecutionThread);
this.cardRepository = cardRepository;
}
@Override Observable<Card> buildUseCaseObservable(Params params) {
if (params == null) {
throw new NullPointerException();
}
return this.cardRepository.card(params.cardId);
}
public static final class Params {
private final int cardId;
private Params(int cardId) {
this.cardId = cardId;
}
public static Params forCard(int cardId) {
return new Params(cardId);
}
}
}
| [
"evilly@126.com"
] | evilly@126.com |
5152e984b31a435a05de33855a541e45c89d2c41 | 9579c009c6ebbd446db23572b6feb71569ec3faf | /src/main/java/com/team09/dao/CommentDao.java | 10ffa3974817e7f29b9aa125c28c650aa54beae9 | [] | no_license | 997Yi/team09_simpleBBS | 7308ec0005a264184f455cbec9ef45c1c64f9162 | 8b31717d6dae57654766443c525cabf85a088daa | refs/heads/master | 2023-02-14T21:10:52.002210 | 2021-01-18T00:39:41 | 2021-01-18T00:39:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,133 | java | package com.team09.dao;
import com.team09.bean.Blog;
import com.team09.bean.Comment;
import java.sql.SQLException;
import java.util.List;
/**
* @author team09
*/
public interface CommentDao {
/**
* 添加评论
* @param comment
* @return
* @throws SQLException
*/
public boolean addComment(Comment comment) throws SQLException;
/**
* 通过评论id获取评论
* @param commentId
* @return
* @throws SQLException
*/
public Comment getCommentById(String commentId) throws SQLException;
/**
* 通过用户id查询评论
* @param userId
* @return
* @throws SQLException
*/
public List<Comment> getCommentsByUserId(String userId) throws SQLException;
/**
* 通过博客id查询评论
* @param blogId
* @return
* @throws SQLException
*/
public List<Comment> getCommentsByBlogId(String blogId) throws SQLException;
/**
* 删除评论
* @param commentId
* @return
* @throws SQLException
*/
public boolean deleteComment(String commentId) throws SQLException;
}
| [
"2012357983@qq.com"
] | 2012357983@qq.com |
93852a0208659517cd8cc38625f7606b418aad33 | 9796464e0f85d7fa56e4e7a0169c616792eda2c4 | /src/main/java/com/yuuko/modules/utility/commands/RolesCommand.java | adb3d67babca2faa49e2e2566d977e72fd0afeab | [
"Apache-2.0"
] | permissive | Yuwuko/Yuuko | 8164912478d373de36333d01553a26ffd3d99733 | c3e1f0fc47c7a593aa4c5599ab43ddf4b8c1eddb | refs/heads/master | 2023-06-10T12:26:21.467012 | 2021-07-01T18:09:28 | 2021-07-01T18:09:28 | 131,979,618 | 2 | 1 | Apache-2.0 | 2021-05-12T10:05:59 | 2018-05-03T10:28:50 | Java | UTF-8 | Java | false | false | 1,509 | java | package com.yuuko.modules.utility.commands;
import com.yuuko.MessageDispatcher;
import com.yuuko.Yuuko;
import com.yuuko.events.entity.MessageEvent;
import com.yuuko.modules.Command;
import com.yuuko.utilities.TextUtilities;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.entities.Role;
import java.util.Arrays;
public class RolesCommand extends Command {
public RolesCommand() {
super("roles", Arrays.asList("-roles"));
}
@Override
public void onCommand(MessageEvent context) {
StringBuilder roles = new StringBuilder();
if(!context.getGuild().getRoleCache().isEmpty()) {
int characterCount = 0;
for(Role role : context.getGuild().getRoleCache()) {
if(characterCount + role.getAsMention().length() + 2 < 2048) {
roles.append(role.getAsMention()).append("\n");
characterCount += role.getAsMention().length() + 1;
}
}
TextUtilities.removeLast(roles, "\n");
} else {
roles.append(context.i18n("none"));
}
EmbedBuilder embed = new EmbedBuilder()
.setTitle(context.i18n("title").formatted(context.getGuild().getName()))
.setDescription(roles.toString())
.setFooter(Yuuko.STANDARD_STRINGS.get(1) + context.getAuthor().getAsTag(), context.getAuthor().getEffectiveAvatarUrl());
MessageDispatcher.reply(context, embed.build());
}
}
| [
"errorsfound@hotmail.co.jp"
] | errorsfound@hotmail.co.jp |
6da65a8b5631528d536cfa658aaf157aa694c3ed | fef4db06d1b6d2b84d4a5453537c30f7aa5145bc | /src/co/tapdatapp/TapReady.java | 7f80ce34c05f3f47d24472f6c623a02e2aed5137 | [] | no_license | MikeConner/TapDatAndroid | 7f60701f281f2ce61fce98c7a004b079f9b9f105 | d3e90805788a0d6d202d49535389e90946a2caea | refs/heads/master | 2022-01-14T16:31:07.089533 | 2013-08-18T06:27:26 | 2013-08-18T06:27:26 | 12,041,552 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,231 | java | package co.tapdatapp;
import android.os.Bundle;
import android.app.Activity;
import android.app.PendingIntent;
import android.nfc.NdefMessage;
import android.nfc.NfcAdapter;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.IntentFilter.MalformedMimeTypeException;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
public class TapReady extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tap_ready);
Bundle extras = getIntent().getExtras();
if (extras != null) {
String tip_amount = extras.getString("tip_amount");
TextView edit_text1 = (TextView) findViewById(R.id.textView1);
edit_text1.setText(tip_amount);
}
NfcAdapter mNfcAdapter = NfcAdapter.getDefaultAdapter(this);
Object mNfcPendingIntent = PendingIntent.getActivity(this, 0,
new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
// Intent filters for exchanging over p2p.
IntentFilter ndefDetected = new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED);
try {
ndefDetected.addDataType("tapdat/performer");
} catch (MalformedMimeTypeException e) {
}
IntentFilter[] mNdefExchangeFilters = new IntentFilter[] { ndefDetected };
//Toast.makeText(this, mNdefExchangeFilters.toString(), Toast.LENGTH_LONG).show();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.tap_ready, menu);
return true;
}
@Override
protected void onNewIntent(Intent intent) {
// NDEF exchange mode
// check write mode: !mWriteMode &&
if ( NfcAdapter.ACTION_NDEF_DISCOVERED.equals(intent.getAction())) {
NdefMessage[] msgs = NfcUtils.getNdefMessages(intent);
//fireFriendRequest(msgs[0]);
Intent i = new Intent(this, TipSuccess.class);
startActivity(i);
Toast.makeText(this, "You tapped dat ass via nfc!", Toast.LENGTH_LONG).show();
}
}
public void readyForTap(View view){
}
}
| [
"arash.danaie@gmail.com"
] | arash.danaie@gmail.com |
d83f1f52a41e19e2b7859c0461ed1f3815ed3b6c | 6d62df72b9e974ed2a0e1c636018f5cc79719af0 | /app/src/main/java/com/zy/yaoproject/base/inter/IBaseView.java | 728885612416070ba24b673f989cdabbbda6eb0e | [] | no_license | doutuifei/YaoProject | 5b2fb257f716fd966b505af1ba5cd93ace869b57 | 61958bf278acc0822ac32c59ec572b8e628f959f | refs/heads/master | 2021-09-14T07:13:07.980485 | 2018-05-09T11:06:11 | 2018-05-09T11:06:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,086 | java | package com.zy.yaoproject.base.inter;
import android.content.Context;
import android.support.v4.widget.SwipeRefreshLayout;
/**
* Created by muzi on 2018/4/3.
* 727784430@qq.com
*/
public interface IBaseView {
/**
* 获取当前上下文对象
*
* @return
*/
Context getContext();
/**
* 显示进度条
*/
void showProgress();
/**
* 隐藏进度条
*/
void hideProgress();
/**
* 刷新
*
* @param refreshLayout
* @param onRefreshListener
*/
void initRefresh(SwipeRefreshLayout refreshLayout, SwipeRefreshLayout.OnRefreshListener onRefreshListener);
/**
* 刷新完成
*/
void refreshFinish();
/**
* 根据资源文件id弹出toast
*
* @param resId 资源文件id
*/
void showToast(int resId);
/**
* 根据字符串弹出toast
*
* @param msg 提示内容
*/
void showToast(String msg);
/**
* 结束当前页面
*/
void close();
/**
* 登录
*/
void startLogin();
}
| [
"727784430@qq.com"
] | 727784430@qq.com |
ac52596bafd9f4e955b2d03226d798bb9068400b | 72cc7541542905823a38d73b8ee4a0941e1b0b88 | /load-service-util/src/main/java/com/xu/util/Excel/ExportExcel.java | 06dff50b75c03fade2d7ba94bfc009665cabd9f7 | [] | no_license | xuhongda/load-service | 8dd6f08ebbaf0a980501b4bdf6c7173fba252ee8 | 21b710904b378d31dbb56a67aa78f6648ee20966 | refs/heads/master | 2022-12-22T13:26:20.663306 | 2019-07-29T12:47:57 | 2019-07-29T12:47:57 | 129,882,390 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,939 | java | package com.xu.util.Excel;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.streaming.SXSSFCell;
import org.apache.poi.xssf.streaming.SXSSFRow;
import org.apache.poi.xssf.streaming.SXSSFSheet;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import javax.servlet.http.HttpServletResponse;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 将HSSFWorkbook 对象改换成 HSSFWorkbook 突破EXCSEL 六万多条限制 SXSSFWorkbook 突破大量数据导致的OOM
* HSSFSheet==》》XSSFSheet ==》》SXSSFWorkbook
* HSSFRow ===》》XSSFRow
* HSSFCell ===》》XSSFCell
* @author xuhongda on 2018/4/24
* com.zhiyuan.riskcloud.portrait.service.Excel
* dataplatform
*/
public class ExportExcel {
/***
* 构造方法
*/
private ExportExcel() {
}
/***
* 工作簿
*/
private static /*HSSFWorkbook*//*XSSFWorkbook*/ SXSSFWorkbook workbook;
/***
* sheet
*/
private static /*HSSFSheet*//*XSSFSheet */SXSSFSheet sheet;
/***
* 标题行开始位置
*/
private static final int TITLE_START_POSITION = 0;
/***
* 时间行开始位置
*/
private static final int DATEHEAD_START_POSITION = 1;
/***
* 表头行开始位置
*/
private static final int HEAD_START_POSITION = 2;
/***
* 文本行开始位置
*/
private static final int CONTENT_START_POSITION = 3;
/**
*
* @param dataList
* 对象集合
* @param titleMap
* 表头信息(对象属性名称->要显示的标题值)[按顺序添加]
* @param sheetName
* sheet名称和表头值
* @param res
* response 对象
* @param fileNameAndPath
* 文件完整路径名
*/
public static void excelExport(List<?> dataList, Map<String, String> titleMap, String sheetName,String fileNameAndPath,HttpServletResponse res) {
// 初始化workbook
initHSSFWorkbook(sheetName);
// 标题行
createTitleRow(titleMap, sheetName);
// 时间行
createDateHeadRow(titleMap);
// 表头行
createHeadRow(titleMap);
// 文本行
createContentRow(dataList, titleMap);
//设置自动伸缩
autoSizeColumn(titleMap.size());
// 写入处理结果
try {
OutputStream out = new FileOutputStream( fileNameAndPath);
workbook.write(out);
out.close();
/*+++++++++++++++++++一以下载文件格式 ajax 异步请求不行 需要直接请求方式++++++++++++++++++++++++*/
// String fileName = "XXX表";
/*ByteArrayOutputStream os = new ByteArrayOutputStream();
workbook.write(os);
byte[] content = os.toByteArray();
InputStream is = new ByteArrayInputStream(content);
// 设置response参数,可以打开下载页面
res.reset();
res.setContentType("application/vnd.ms-excel;charset=utf-8");
res.setHeader("Content-Disposition", "attachment;filename="
+ new String((fileName + ".xlsx").getBytes(), "iso-8859-1"));
ServletOutputStream out = res.getOutputStream();
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
try {
bis = new BufferedInputStream(is);
bos = new BufferedOutputStream(out);
byte[] buff = new byte[2048];
int bytesRead;
// Simple read/write loop.
while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
bos.write(buff, 0, bytesRead);
}
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
} finally {
if (bis != null) {
bis.close();
}
if (bos != null) {
bos.close();
}
}*/
/*+++++++++++++++++++++++++++++++++++++++++++++*/
}
catch (Exception e) {
e.printStackTrace();
}
}
/***
*
* @param sheetName
* sheetName
*/
private static void initHSSFWorkbook(String sheetName) {
//workbook = new HSSFWorkbook();
//workbook=new XSSFWorkbook();
workbook = new SXSSFWorkbook();
sheet = workbook.createSheet(sheetName);
}
/**
* 生成标题(第零行创建)
* @param titleMap 对象属性名称->表头显示名称
* @param sheetName sheet名称
*/
private static void createTitleRow(Map<String, String> titleMap, String sheetName) {
CellRangeAddress titleRange = new CellRangeAddress(0, 0, 0, titleMap.size() - 1);
sheet.addMergedRegion(titleRange);
/*HSSFRow*/ /*XSSFRow*/SXSSFRow titleRow = sheet.createRow(TITLE_START_POSITION);
/* HSSFCell*//*XSSFCell*/SXSSFCell titleCell = titleRow.createCell(0);
titleCell.setCellValue(sheetName);
}
/**
* 创建时间行(第一行创建)
* @param titleMap 对象属性名称->表头显示名称
*/
private static void createDateHeadRow(Map<String, String> titleMap) {
CellRangeAddress dateRange = new CellRangeAddress(1, 1, 0, titleMap.size() - 1);
sheet.addMergedRegion(dateRange);
/*HSSFRow*//*XSSFRow*/SXSSFRow dateRow = sheet.createRow(DATEHEAD_START_POSITION);
/*HSSFCell*//*XSSFCell*/SXSSFCell dateCell = dateRow.createCell(0);
dateCell.setCellValue(new SimpleDateFormat("yyyy年MM月dd日").format(new Date()));
}
/**
* 创建表头行(第二行创建)
* @param titleMap 对象属性名称->表头显示名称
*/
private static void createHeadRow(Map<String, String> titleMap) {
// 第1行创建
/*HSSFRow*//*XSSFRow*/SXSSFRow headRow = sheet.createRow(HEAD_START_POSITION);
int i = 0;
for (String entry : titleMap.keySet()) {
/* HSSFCell*/ /*XSSFCell*/SXSSFCell headCell = headRow.createCell(i);
headCell.setCellValue(titleMap.get(entry));
i++;
}
}
/**
*
* @param dataList 对象数据集合
* @param titleMap 表头信息
*/
private static void createContentRow(List<?> dataList, Map<String, String> titleMap) {
try {
int i=0;
for (Object obj : dataList) {
/*HSSFRow*//*XSSFRow*/SXSSFRow textRow = sheet.createRow(CONTENT_START_POSITION + i);
int j = 0;
for (String entry : titleMap.keySet()) {
String method = "get" + entry.substring(0, 1).toUpperCase() + entry.substring(1);
Method m = obj.getClass().getMethod(method, null);
Object o =m.invoke(obj, null);
String value = null;
if (o != null){
value = o.toString();
}
// String value = m.invoke(obj, null).toString();
/* HSSFCell*//*XSSFCell*/SXSSFCell textcell = textRow.createCell(j);
textcell.setCellValue(value);
j++;
}
i++;
}
}
catch (Exception e) {
e.printStackTrace();
}
}
/**
* 自动伸缩列(如非必要,请勿打开此方法,耗内存)
* @param size 列数
*/
private static void autoSizeColumn(Integer size) {
//
sheet.trackAllColumnsForAutoSizing();
for (int j = 0; j < size; j++) {
sheet.autoSizeColumn(j);
}
}
}
| [
"xuhongda7@outlook.com"
] | xuhongda7@outlook.com |
1e99fd6a8d21ab51ddd72cd0afe40aa252c14832 | 821e348b780a7917f78fa0e8cd397230f3cf9f8d | /src/com/topsci/kwang/mobilecode/ArrayOfString.java | 3addefbc949f9dd6b56e04cd02ad2904a378878a | [] | no_license | mmlvkk/webserviceClientTest | 7bb4d34184e3f61c4ea6a2ac0603b20f10a87b02 | a9b1c654c104b7caec77ae7ecb32035679d455e3 | refs/heads/master | 2020-12-24T18:32:57.288155 | 2016-05-18T06:06:00 | 2016-05-18T06:06:00 | 56,495,139 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,899 | java |
package com.topsci.kwang.mobilecode;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for ArrayOfString complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="ArrayOfString">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="string" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ArrayOfString", propOrder = {
"string"
})
public class ArrayOfString {
@XmlElement(nillable = true)
protected List<String> string;
/**
* Gets the value of the string property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the string property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getString().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link String }
*
*
*/
public List<String> getString() {
if (string == null) {
string = new ArrayList<String>();
}
return this.string;
}
}
| [
"mmlvkk@gmail.com"
] | mmlvkk@gmail.com |
765d2e1a5cbb65b926878835d54f1087e3bdf778 | d593ad37a82a6396effceaf11679e70fddcabc06 | /unLock/ch12/android/src/com/msi/manning/UnlockingAndroid/ShowJob.java | 8bce35c18c5165e84f27856fd792a84232cc8b78 | [] | no_license | psh667/android | 8a18ea22c8c977852ba2cd9361a8489586e06f05 | 8f7394de8e26ce5106d9828cf95eb1617afca757 | refs/heads/master | 2018-12-27T23:30:46.988404 | 2013-09-09T13:16:46 | 2013-09-09T13:16:46 | 12,700,292 | 3 | 5 | null | null | null | null | UTF-8 | Java | false | false | 5,316 | java | /*
* showjob.java Unlocking Android http://manning.com/ableson Author: W. F. Ableson
* fableson@msiservices.com
*/
package com.msi.manning.UnlockingAndroid;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class ShowJob extends Activity {
Prefs myprefs = null;
JobEntry je = null;
final int CLOSEJOBTASK = 1;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.showjob);
this.myprefs = new Prefs(getApplicationContext());
StringBuilder sb = new StringBuilder();
String details = null;
Intent startingIntent = getIntent();
if (startingIntent != null) {
Log.i("CH12::ShowJob", "starting intent not null");
Bundle b = startingIntent.getExtras();
if (b == null) {
Log.i("CH12::ShowJob", "bad bundle");
details = "bad bundle?";
} else {
this.je = JobEntry.fromBundle(b);
sb.append("Job Id: " + this.je.get_jobid() + " (" + this.je.get_status() + ")\n\n");
sb.append(this.je.get_customer() + "\n\n");
sb.append(this.je.get_address() + "\n" + this.je.get_city() + "," + this.je.get_state() + "\n");
sb.append("Product : " + this.je.get_product() + "\n\n");
sb.append("Comments: " + this.je.get_comments() + "\n\n");
details = sb.toString();
}
} else {
details = "Job Information Not Found.";
TextView tv = (TextView) findViewById(R.id.details);
tv.setText(details);
return;
}
TextView tv = (TextView) findViewById(R.id.details);
tv.setText(details);
Button bmap = (Button) findViewById(R.id.mapjob);
bmap.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
// clean up data for use in GEO query
String address = ShowJob.this.je.get_address() + " " + ShowJob.this.je.get_city() + " "
+ ShowJob.this.je.get_zip();
String cleanAddress = address.replace(",", "");
cleanAddress = cleanAddress.replace(' ', '+');
try {
Intent geoIntent = new Intent("android.intent.action.VIEW", android.net.Uri.parse("geo:0,0?q="
+ cleanAddress));
startActivity(geoIntent);
} catch (Exception ee) {
Log.d("CH12", "error launching map? " + ee.getMessage());
}
}
});
Button bproductinfo = (Button) findViewById(R.id.productinfo);
bproductinfo.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
try {
Intent productInfoIntent = new Intent("android.intent.action.VIEW", android.net.Uri
.parse(ShowJob.this.je.get_producturl()));
startActivity(productInfoIntent);
} catch (Exception ee) {
Log.d("CH12", "error launching product info? " + ee.getMessage());
}
}
});
Button bclose = (Button) findViewById(R.id.closejob);
if (this.je.get_status().equals("CLOSED")) {
bclose.setText("Job is Closed. View Signature");
}
bclose.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
if (ShowJob.this.je.get_status().equals("CLOSED")) {
Intent signatureIntent = new Intent("android.intent.action.VIEW", android.net.Uri
.parse(ShowJob.this.myprefs.getServer() + "sigs/" + ShowJob.this.je.get_jobid() + ".jpg"));
startActivity(signatureIntent);
} else {
Intent closeJobIntent = new Intent(ShowJob.this, CloseJob.class);
Bundle b = ShowJob.this.je.toBundle();
closeJobIntent.putExtras(b);
// closeJobIntent.putExtra("android.intent.extra.INTENT", b);
startActivityForResult(closeJobIntent, ShowJob.this.CLOSEJOBTASK);
}
}
});
Log.d("CH12", "Job status is :" + this.je.get_status());
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case CLOSEJOBTASK:
if (resultCode == 1) {
Log.d("CH12", "Good Close!");
// propagate this up to the list activity
Intent resultIntent = new Intent();
resultIntent.putExtras(data.getExtras());
this.setResult(1, resultIntent);
// leave this activity
finish();
}
break;
}
}
}
| [
"paksan@daum.net"
] | paksan@daum.net |
f33454ece3d71204574ff32aef30064fdc514e0c | 15e6385746ccf4b8eb6c6e302aca236021bb8781 | /JavaPartI/le130_surroundedRegions.java | 0b9ef2180df3ed58f3ecb39015cd29b3f0803098 | [] | no_license | akb46mayu/Data-Structures-and-Algorithms | 11c4bbddc9b4d286e1aeaa9481eb6a620cd54746 | de98494e14fff3e2a468da681c48d60b4d1445a1 | refs/heads/master | 2021-01-12T09:51:32.618362 | 2018-05-16T16:37:18 | 2018-05-16T16:37:18 | 76,279,268 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,002 | java | /*
Given a 2D board containing 'X' and 'O' (the letter O), capture all regions surrounded by 'X'.
A region is captured by flipping all 'O's into 'X's in that surrounded region.
For example,
X X X X
X O O X
X X O X
X O X X
After running your function, the board should be:
X X X X
X X X X
X X X X
X O X X
*/
class Pair {
int x;
int y;
int val;
Pair(int x, int y) {
this.x = x;
this.y = y;
}
}
public class Solution {
public void solve(char[][] board) {
// corner case
if (board == null) {
return;
}
int m = board.length;
if (m == 0) {
return;
}
int n = board[0].length;
// bfs
for (int j = 0; j < n; j++) {
bfs(0, j, board);
bfs(m - 1, j, board);
}
for (int i = 0; i < m; i++) {
bfs(i, 0, board);
bfs(i, n - 1, board);
}
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
if (board[i][j] == 'W') {
board[i][j] = 'O';
} else {
board[i][j] = 'X';
}
}
}
}
private void bfs(int x0, int y0, char[][] board) {
if (board[x0][y0] != 'O') {
return;
}
int m = board.length, n = board[0].length;
int[] dx = {-1, 1, 0, 0};
int[] dy = {0, 0, -1, 1};
Queue<Pair> q = new LinkedList<>();
q.offer(new Pair(x0, y0));
board[x0][y0] = 'W';
while (!q.isEmpty()) {
Pair temp = q.poll();
int x = temp.x, y = temp.y;
for (int k = 0; k < 4; k++) {
int nx = x + dx[k];
int ny = y + dy[k];
if (nx >= 0 && nx < m && ny >= 0 && ny < n && board[nx][ny] == 'O') {
board[nx][ny] = 'W';
q.offer(new Pair(nx, ny));
}
}
}
}
}
| [
"noreply@github.com"
] | akb46mayu.noreply@github.com |
818f9b5dfe59174beaf722e0340b2cac862c2e58 | 8e2fa299246914d30ac47430d9799f4585aae270 | /CompleteWebsiteWithJsp/src/java/com/mohitpaudel/webapplication/dao/SecondContentDao.java | 09b13c88029f54072b7dde82f898be04941ab63c | [] | no_license | equinoxmohit/WebApplicationWithJsp | 496b6c4243a80f1b6760c00b2feaf07e65b3a2af | 4af20c23bb0aeb1bd56a3cbd94f08717d8124e04 | refs/heads/master | 2021-01-20T20:21:46.252041 | 2016-08-14T15:50:54 | 2016-08-14T15:50:54 | 65,612,619 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 580 | java | /*
* 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 com.mohitpaudel.webapplication.dao;
import com.mohitpaudel.webapplication.entity.SecondContent;
import java.sql.SQLException;
import java.util.List;
/**
*
* @author Mohit
*/
public interface SecondContentDao {
List<SecondContent> getAll() throws SQLException, ClassNotFoundException;
int update(SecondContent secondContent) throws SQLException, ClassNotFoundException;
}
| [
"mohit.paudel1996@gmail.com"
] | mohit.paudel1996@gmail.com |
4f0006e4e3fa792359a7869f6fe591a3cd974195 | 1f19aec2ecfd756934898cf0ad2758ee18d9eca2 | /u-1/u-11/u-11-111/u-11-111-1112/u-11-111-1112-11113/u-11-111-1112-11113-f5296.java | fedd489f32b2f62630c746e58ea26b971b725ed5 | [] | no_license | apertureatf/perftest | f6c6e69efad59265197f43af5072aa7af8393a34 | 584257a0c1ada22e5486052c11395858a87b20d5 | refs/heads/master | 2020-06-07T17:52:51.172890 | 2019-06-21T18:53:01 | 2019-06-21T18:53:01 | 193,039,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 106 | java | mastercard 5555555555554444 4012888888881881 4222222222222 378282246310005 6011111111111117
5654831763331 | [
"jenkins@khan.paloaltonetworks.local"
] | jenkins@khan.paloaltonetworks.local |
62e9e7e36cdf8e83fc6c9bddec4f59c3146eb958 | ed930f339e8dbdccf359a54a71f4aa7cf6839132 | /app/src/main/java/com/example/check24products/presentation/MainActivity.java | 27951e123828aa53e09325e05a4800558173b73c | [] | no_license | umairqidwai/Check24Products | 3e7d49e77e41a680e9dbb639b9aaba0547480cd8 | 6442eb28a6bf3fc4f5844f69c766eaacacf92040 | refs/heads/main | 2023-02-15T01:44:35.345193 | 2021-01-10T01:08:01 | 2021-01-10T01:08:01 | 326,806,698 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,392 | java | package com.example.check24products.presentation;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.example.check24products.R;
import com.example.check24products.presentation.adapter.ProductListAdapter;
import com.example.check24products.databinding.ActivityMainBinding;
import com.example.check24products.data.model.Header;
import com.example.check24products.data.model.Product;
import com.example.check24products.presentation.presenter.MainPresenter;
import com.example.check24products.presentation.presenter.contract.MainView;
import com.google.android.material.tabs.TabLayout;
import java.util.List;
public class MainActivity extends AppCompatActivity implements MainView {
private ActivityMainBinding binding;
private ProductListAdapter mAdapter;
private MainPresenter mPresenter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivityMainBinding.inflate(getLayoutInflater());
View view = binding.getRoot();
setContentView(view);
initView();
mPresenter = new MainPresenter(this);
mPresenter.getProducts(false);
}
private void initView() {
mAdapter = new ProductListAdapter(getApplicationContext(), new ProductListAdapter.ProductListAdapterListener() {
@Override
public void onLoadImage(String imageUrl, ImageView imageView) {
Glide.with(getApplicationContext()).load(imageUrl).placeholder(R.drawable.ic_launcher_background).into(imageView);
}
});
binding.refreshButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mPresenter.getProducts(true);
}
});
LinearLayoutManager llm = new LinearLayoutManager(getApplicationContext());
RecyclerView.ItemDecoration itemDecoration = new DividerItemDecoration(getApplicationContext(), DividerItemDecoration.VERTICAL);
binding.productListRv.setLayoutManager(llm);
binding.productListRv.setAdapter(mAdapter);
binding.productListRv.addItemDecoration(itemDecoration);
binding.tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
public void onTabSelected(TabLayout.Tab tab) {
String filterName = tab.getText().toString();
mPresenter.getFilteredProduct(filterName);
}
@Override
public void onTabUnselected(TabLayout.Tab tab) {
}
@Override
public void onTabReselected(TabLayout.Tab tab) {
}
});
}
@Override
public void loadHeader(Header header) {
binding.headerTitleTextview.setText(header.getHeaderTitle());
binding.headerDescriptionTextview.setText(header.getHeaderDescription());
}
@Override
public void loadFilters(List<String> filters) {
for (int i = 0; i < filters.size(); i++) {
binding.tabLayout.addTab(binding.tabLayout.newTab().setText(filters.get(i)));
}
}
@Override
public void loadProducts(List<Product> productList) {
mAdapter.setmProductList(productList);
mAdapter.notifyDataSetChanged();
}
@Override
public void showProgressBar() {
binding.progressBar.setVisibility(View.VISIBLE);
}
@Override
public void hideProgressBar() {
binding.progressBar.setVisibility(View.GONE);
}
@Override
public void refresh(List<Product> productList) {
mAdapter.setmProductList(productList);
mAdapter.notifyDataSetChanged();
TabLayout.Tab tab = binding.tabLayout.getTabAt(0);
if(tab!=null){
tab.select();
}
}
@Override
public void onError(String errMsg) {
Toast.makeText(this, errMsg, Toast.LENGTH_SHORT).show();
}
@Override
public void onFilterProdcutList(String filterName) {
mAdapter.setFilter(filterName);
}
} | [
"umair@Umairs-MacBook-Pro.local"
] | umair@Umairs-MacBook-Pro.local |
57305ba8d78bef87eacb1a72170a2930191a9b03 | ba39bfacdd72261fb15d6dc6b93c69e0ff0562f3 | /src/gwt/dojo/mobile/client/Pane.java | b99fc4b9bc14148b26e033f69c4d373a871a971a | [
"AFL-3.0",
"BSD-3-Clause",
"AFL-2.1",
"Apache-2.0"
] | permissive | andrescabrera/gwt-dojo-toolkit | 4cf0f7bf3061f1f1248dec731aca8d6fd91ac8dc | 4faf915c62871b2267a49ce0cd703dd98d986644 | refs/heads/master | 2020-05-30T03:49:29.199573 | 2013-06-17T10:57:52 | 2013-06-17T10:57:52 | 40,503,638 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 705 | java | package gwt.dojo.mobile.client;
import gwt.dojo.dijit.client.IContained;
import gwt.dojo.dijit.client._WidgetBase;
/**
* A simple pane widget.
* <p>
* Pane is a simple general-purpose pane widget. It is a widget, but can be
* regarded as a imple {@code <div>} element.
* <p>
* {@code baseClass='mblPane'}
*/
public class Pane extends _WidgetBase implements IContained {
public static final String MODULE = "dojox/mobile/Pane";
/**
* Not directly instantiable.
* <p>
* All subclasses must also define a protected, empty, no-arg constructor.
*/
protected Pane() {
}
/**
* Calls resize() of each child widget.
*/
public final native void resize() /*-{
this.resize();
}-*/;
}
| [
"georgopoulos.georgios@gmail.com"
] | georgopoulos.georgios@gmail.com |
69979b317d16fc808ef63327f8e04e6ce860749b | 330294d8c65859d014d5cee0b75840e543d42b81 | /src/Chess.java | a90c5b69cf7c3556835b3fdd6287523094f4c388 | [] | no_license | MLjungg/Chess-Game | 1c0e647cd5c262777a8d958d3460504ffd3e34a5 | 5875ad87357fc24cf86e7084123353bcd6c28ac9 | refs/heads/master | 2020-08-28T21:27:15.000627 | 2019-10-27T08:31:20 | 2019-10-27T08:31:20 | 217,825,519 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,813 | java | import java.util.Collections;
public class Chess implements Boardgame {
//Deklarerar instansvariabler
private String currentMessage;
private ChessPiece[][] board;
private Player currentPlayer;
private Player player1;
private Player player2;
private boolean squareReserved; //Håller koll på om en ruta markerats för att flyttas
Chess() {
//Ger värde till instansvariabler
this.initializeBoard();
this.player1 = new Player("white");
this.player2 = new Player( "black");
this.currentPlayer = this.player1;
this.currentMessage = this.currentPlayer.color + ": your turn";
this.squareReserved = false;
}
private void initializeBoard(){
// Setup gameboard
board = new ChessPiece[8][8];
//White Pawns
for (int i = 0; i < 8; i++) {
this.board[1][i] = new ChessPiece("white", "Pawn");
}
// Black Pawns
for (int i = 0; i < 8; i++) {
this.board[6][i] = new ChessPiece("black", "Pawn");
}
//Rooks
board[0][0] = new ChessPiece("white", "Rook");
board[0][7] = new ChessPiece("white", "Rook");
board[7][7] = new ChessPiece("black", "Rook");
board[7][0] = new ChessPiece("black", "Rook");
//Knights
board[0][1] = new ChessPiece("white", "Knight");
board[0][6] = new ChessPiece("white", "Knight");
board[7][6] = new ChessPiece("black", "Knight");
board[7][1] = new ChessPiece("black", "Knight");
//Bishops
board[0][2] = new ChessPiece("white", "Bishop");
board[0][5] = new ChessPiece("white", "Bishop");
board[7][2] = new ChessPiece("black", "Bishop");
board[7][5] = new ChessPiece("black", "Bishop");
//Queens
board[0][3] = new ChessPiece("white", "Queen");
board[7][3] = new ChessPiece("black", "Queen");
//Kings
board[0][4] = new ChessPiece("white", "King");
board[7][4] = new ChessPiece("black", "King");
//The rest
for (int i = 2; i < 6; i++) {
for (int j = 0; j < 8; j++)
this.board[i][j] = new ChessPiece();
}
}
public boolean move(int i, int j) {
if (getStatus(i, j).color == (this.currentPlayer.color)) {
this.squareReserved = true;
this.currentPlayer.reservCoordinates(i,j);
this.currentMessage = this.currentPlayer.color + " choose an empty box to move to";
return true;
}
//Om man markerat en ruta att flytta och sedan trycker på en tom ruta --> byter plats på pjäser
else if (getStatus(i, j).color == null && this.squareReserved) {
ChessPiece temporary = this.board[i][j];
this.board[i][j] = this.board[this.currentPlayer.reservedCoordinates[0]][this.currentPlayer.reservedCoordinates[1]];
this.board[this.currentPlayer.reservedCoordinates[0]][this.currentPlayer.reservedCoordinates[1]] = temporary;
this.squareReserved = false;
this.togglePlayer();
this.currentMessage = this.currentPlayer.color + ": your turn";
return true;
}
// Om man klickat på en pjäs med fel färg
else {
this.currentMessage = "Choose a " + this.currentPlayer.color + " piece to move";
return false;
}
}
public ChessPiece getStatus (int i, int j){
return board[i][j];
}
public String getMessage () {
return this.currentMessage;
}
private void togglePlayer() {
if (this.currentPlayer == this.player1) {
this.currentPlayer = this.player2;
} else {
this.currentPlayer = this.player1;
}
}
}
| [
"noreply@github.com"
] | MLjungg.noreply@github.com |
410436df7a0b07b07877e9bb49c6f5f7a87d8c6b | e7f8acff7948cf6618043ec7b998867b7c6ad831 | /java/blog1/src/main/java/com/pzh/blog/controls/admin/TagControl.java | bed80f37466114057171e9c153787fef46a8cdfb | [] | no_license | z778107203/pengzihao1999.github.io | 9b97ecefba6557f1f815a5f17da33118ddf78b37 | d683ba31772fb3a42085cb44ee0601637bcdd84e | refs/heads/master | 2022-11-13T10:44:00.988950 | 2019-10-08T15:29:04 | 2019-10-08T15:29:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,350 | java | package com.pzh.blog.controls.admin;
import com.pzh.blog.domain.Tag;
import com.pzh.blog.domain.Type;
import com.pzh.blog.service.ITagService;
import com.pzh.blog.service.ITypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PageableDefault;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
@Controller
@RequestMapping("/admin/tag")
public class TagControl {
@Autowired
private ITagService tagService ;
//分页
@GetMapping
public String tagPage(@PageableDefault(size = 5) Pageable pageable, Model model){
Page<Tag> tags = tagService.TagPage(pageable);
model.addAttribute("tagPages",tags);
return "admin/tag";
}
//编辑,跳转到编辑页面
@GetMapping("/edit/{id}")
public String editTag(@PathVariable Long id,Model model){
model.addAttribute("tagid",id);
return "admin/tag-edit";
}
//删除
@GetMapping("/delete/{id}")
public String deleteTag(@PathVariable Long id){
tagService.deleteTag(id);
return "redirect:/admin/tag";
}
//转发到新增type页面
@GetMapping("/add")
public String addTagpage(){
return "/admin/tag-add";
}
//新增Type并且重定向到查询全部页面
@PostMapping("/addtag")
public String addTag(@RequestParam(name = "tagname") String tagname,
@RequestParam(name = "tagid") Long id, RedirectAttributes redirectAttributes){
Tag tag = new Tag();
tag.setName(tagname);
if(tagname==null||tagname.trim().equals("")){
redirectAttributes.addFlashAttribute("msg","分类不能为空");
return "redirect:/admin/tag";
}
Tag findtag = tagService.findTagByName(tag);
if(findtag!=null){
redirectAttributes.addFlashAttribute("msg","不能重复添加分类");
return "redirect:/admin/tag";
}
if(id!=null){
tag.setId(id);
}
tagService.saveTag(tag);
return "redirect:/admin/tag";
}
}
| [
"916811138@qq.com"
] | 916811138@qq.com |
346538de5f31c50f5a2cf34237c836148919af9f | 8a5e3479744f9d96c684b31926f438748c3abf7f | /stream-reader/src/main/java/com/avenuecode/talk/stream/reader/model/Pixel.java | 2a0b66591aaff2881f405099ca95ddf399ed5781 | [] | no_license | smarotta/json-stream | 000b79c6241a46dbf3ce996d979f855b3bbb7674 | 4fe82dd903a7d360e5f835ef055b0f4c9c86692c | refs/heads/master | 2021-03-27T15:15:19.352613 | 2017-02-20T20:24:02 | 2017-02-20T20:24:02 | 77,847,037 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,090 | java | package com.avenuecode.talk.stream.reader.model;
public class Pixel {
private int x;
private int y;
private int a;
private int r;
private int g;
private int b;
public Pixel() {
}
public Pixel(int x, int y, int argb) {
this.x = x;
this.y = y;
setARGB(argb);
}
public int getARGB() {
int argb = 0;
argb += a << 24;
argb += r << 16;
argb += g << 8;
argb += b;
return argb;
}
public void setARGB(int argb) {
a = (argb & 0xFF000000) >> 24;
r = (argb & 0x00FF0000) >> 16;
g = (argb & 0x0000FF00) >> 8;
b = (argb & 0x000000FF) >> 0;
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
public int getA() {
return a;
}
public void setA(int a) {
this.a = a;
}
public int getR() {
return r;
}
public void setR(int r) {
this.r = r;
}
public int getG() {
return g;
}
public void setG(int g) {
this.g = g;
}
public int getB() {
return b;
}
public void setB(int b) {
this.b = b;
}
}
| [
"stefano.marotta@macys.com"
] | stefano.marotta@macys.com |
aa7d8b7203ef5bbd3ae18f459b6dd854039e0fbb | cd7624204dc1aa5b1b08f2d27c8b1a62b5280e23 | /src/main/java/com/example/blog/po/Tag.java | 6ef1d4f9df8296a762ddfb0b254623ffea0c0efd | [] | no_license | coder-yyz/spring-boot-blog | a176bd9393d4f745993d6f8ad3f16f80990ded38 | 3db5e7bfa0fda0ee778e7f961d2b8cda68088023 | refs/heads/master | 2022-04-09T21:17:47.397633 | 2020-03-26T13:33:46 | 2020-03-26T13:33:46 | 250,263,682 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 907 | java | package com.example.blog.po;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;
@Entity
@Table(name = "t_tag")
public class Tag {
@Id
@GeneratedValue
private Long id;
private String name;
@ManyToMany(mappedBy = "tags")
private List<Blog> blogs = new ArrayList<>();
public Tag() {
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<Blog> getBlogs() {
return blogs;
}
public void setBlogs(List<Blog> blogs) {
this.blogs = blogs;
}
@Override
public String toString() {
return "Tag{" +
"id=" + id +
", name='" + name + '\'' +
'}';
}
}
| [
"2562874272@qq.com"
] | 2562874272@qq.com |
a0b1950b125a14f36abe5109b497dd32a3fed83d | 8140c99028ec7145162ffe0ae0ed9b08ae13ce27 | /android/src/net/team11/pixeldungeon/playservices/adlisteners/RewardAdListener.java | f31c0dd8f187752bd5012d05b649bb5716a18586 | [] | no_license | beenham/PixelDungeon | 0df30430cdd2f9eedf1281a0b1f13526103ad604 | 8c4c9273cf5e783b01c2a345ea597b56b05cfa3d | refs/heads/master | 2020-03-10T06:05:11.447740 | 2020-03-03T21:55:35 | 2020-03-03T21:55:35 | 129,231,369 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,216 | java | package net.team11.pixeldungeon.playservices.adlisteners;
import android.util.Log;
import com.google.android.gms.ads.reward.RewardItem;
import com.google.android.gms.ads.reward.RewardedVideoAdListener;
import net.team11.pixeldungeon.playservices.AdmobClient;
import net.team11.pixeldungeon.screens.AbstractScreen;
import net.team11.pixeldungeon.screens.ScreenManager;
import net.team11.pixeldungeon.screens.components.dialog.RewardDialog;
import net.team11.pixeldungeon.utils.Util;
public class RewardAdListener implements RewardedVideoAdListener {
private static final String TAG = "RewardAdListener";
private AdmobClient admobClient;
private boolean loaded;
public RewardAdListener(AdmobClient admobClient) {
this.admobClient = admobClient;
loaded = false;
}
@Override
public void onRewardedVideoAdLoaded() {
loaded = true;
Log.i(TAG,"Video loaded..");
}
@Override
public void onRewardedVideoAdOpened() {
loaded = false;
Log.i(TAG,"Video opened..");
}
@Override
public void onRewardedVideoStarted() {
Log.i(TAG,"Video started..");
}
@Override
public void onRewardedVideoAdClosed() {
Log.i(TAG,"Video closed..");
admobClient.loadRewardAd();
}
@Override
public void onRewarded(RewardItem rewardItem) {
Log.i(TAG,"Video rewarded.. " + rewardItem.getType() + ": " + rewardItem.getAmount());
Util.getInstance().getStatsUtil().getGlobalStats().addCurrentCoins(rewardItem.getAmount());
Util.getInstance().saveGame();
new RewardDialog(rewardItem.getAmount()).show((AbstractScreen) ScreenManager
.getInstance().getScreen());
}
@Override
public void onRewardedVideoAdLeftApplication() {
Log.i(TAG,"Video rewarded but left..");
}
@Override
public void onRewardedVideoAdFailedToLoad(int i) {
}
@Override
public void onRewardedVideoCompleted() {
Log.i(TAG,"Video Completed..");
}
public boolean isLoaded() {
Log.i(TAG,"Is loaded? " + loaded);
if (!loaded) {
admobClient.loadRewardAd();
}
return loaded;
}
}
| [
"cjbeenham@gmail.com"
] | cjbeenham@gmail.com |
0907d72b7521c9a5f77f347e9afdb8b59d6a03e0 | cb1dd4b55242d37526f931b5e2cf6304bcf00286 | /src/lang/SBTest.java | f5ece300f18125aee652e35432065f083a4155b4 | [] | no_license | Jungyerin/chapter03 | f8f33ced9aecc558c2b736836c5fc49b72e5be74 | 232584002b66c469b0219fec4b12888e1062b57e | refs/heads/master | 2021-01-20T00:51:08.110263 | 2017-04-24T05:06:23 | 2017-04-24T05:06:23 | 89,199,803 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 918 | java | package lang;
public class SBTest {
public static void main(String[] args) {
// TODO Auto-generated method stub
//생성
StringBuffer sb = new StringBuffer("This");
System.out.println(sb);
//문자열 추가
sb.append(" is pencil");
System.out.println(sb);
//삽입
sb.insert(7, " My");
System.out.println(sb);
//치환
sb.replace(8, 10, "your");
System.out.println(sb);
//버퍼 크기 조정
sb.setLength(3);
System.out.println(sb);
//더 중요한 내용
//문자열 + 연산은 내부적으로 StringBuffer 객체로 변환된다.
String s1="Hello"+"World"+10+true;
String s2 = new StringBuffer("Hello").
append("World").
append(10).
append(true).toString();
System.out.println(s1); //s1을 실행하면 내부적으로 s2로 변환하여 실행한다.
System.out.println(s2);
}
}
| [
"JYL@DESKTOP-TORHHDE"
] | JYL@DESKTOP-TORHHDE |
ed0a2207360a9ad9bf1a736dab3427a23ad611e9 | 5fa37936066d19b9a287df4fa88a51a34effec27 | /Workshop/src/systemSplit/core/command/factory/CommandFactory.java | 5bcb0f2802e6cedc76367c970fdf8ce2639f11f6 | [] | no_license | Kaloyan86/JavaOOP | 4cb77b49ed41f5dd54f9d6ac6b4cb03dd59fa44c | f708b50c8dd1a732b7c4e1dba28e633dbf33f024 | refs/heads/master | 2020-09-04T14:53:38.177864 | 2019-11-05T14:07:33 | 2019-11-05T14:07:33 | 198,724,158 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 920 | java | package systemSplit.core.command.factory;
import systemSplit.core.command.Command;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
public final class CommandFactory {
private static final String BASE_COMMAND_PACKAGE = "systemSplit.core.command.";
private static final String COMMAND_SUFFIX = "Command";
@SuppressWarnings("unchecked")
public static Command buildCommand(String name, Object... args) {
try {
Class commandClass = Class.forName(BASE_COMMAND_PACKAGE + name + COMMAND_SUFFIX);
Constructor<Command> constructor = commandClass.getDeclaredConstructors()[0];
return constructor.newInstance(new Object[]{args});
} catch (ClassNotFoundException | IllegalAccessException | InstantiationException | InvocationTargetException e) {
e.printStackTrace();
}
return null;
}
}
| [
"me4ence3965"
] | me4ence3965 |
322e0d7fccd9637269849853ddf812a08bb57428 | 405ad62d14fb86a6df6a9826bd1763c8bd7c3179 | /src/test/Interesting.java | b20aa8bb8e72da302cf660065b18cb3cf4aabf81 | [] | no_license | xueshijun/Tesseract-OCR-Java-Demo | 5ae0695f695815287adbfafcb869edd95e0aa1aa | cc583ac169c0b09216a14980156110647f7ad235 | refs/heads/master | 2020-04-12T22:21:25.206499 | 2012-08-12T12:59:30 | 2012-08-12T12:59:30 | 5,174,386 | 1 | 0 | null | null | null | null | GB18030 | Java | false | false | 1,160 | java | package test;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import com.htmlparse.threesixzerobuy.JingDongItem.ItemImg;
import com.htmlparse.yihaodian.YiHaoDianItem.ItemType;
import com.sun.jndi.toolkit.url.Uri;
public class Interesting {
public void mymain(String[] args) throws IOException {
System.out.println("=======BEGIN======");
String getUrl = "http://www.yihaodian.com/product/16082_1"; //指定网页地址
Document doc = Jsoup.connect(getUrl).userAgent("") // 设置User-Agent
.timeout(3000) // 设置连接超时时间
.get();
// "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.2.15)"
//"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.77 Safari/535.7";
Element link=doc.select(".wrap>.produce.clearfix").first();
System.out.println(link.toString());
// }
}
}
| [
"324858038@qq.com"
] | 324858038@qq.com |
309c212360a13b140bfb9389e72d9245344cdb23 | fc8bc6d35fb82791ceb15e0d2729755ab5a384e5 | /app/src/main/java/com/css/aimstar/aimstar/adapter/NearbyCollegesAdapter.java | 064d8cbe1a3bbc4e3c7b5c0a2c23bfd2142c93c1 | [] | no_license | rizshivalli/AimStar | d7957fff1a98bc4877cdffbd8b215f0ce775e3b5 | 4cc6153de4a299999c964084ff81e340add17ca0 | refs/heads/master | 2020-03-25T01:42:40.949237 | 2018-08-02T06:35:08 | 2018-08-02T06:35:08 | 143,252,556 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,401 | java | package com.css.aimstar.aimstar.adapter;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.css.aimstar.aimstar.R;
import com.css.aimstar.aimstar.model.NearbyColleges;
import java.util.List;
public class NearbyCollegesAdapter extends RecyclerView.Adapter<NearbyCollegesAdapter.ViewHolder> {
private List<NearbyColleges> nearbyColleges;
private Context context;
private String titlevar,imagevar;
private String descriptionvar,path;
public NearbyCollegesAdapter(Context applicationContext, List<NearbyColleges> nearbyCollegesList) {
this.context = applicationContext;
this.nearbyColleges = nearbyCollegesList;
}
public class ViewHolder extends RecyclerView.ViewHolder{
//public TextView title,description;
public TextView title,description,path;
public ImageView image;
public ViewHolder(final View parent) {
super(parent);
title = (TextView) parent.findViewById(R.id.name);
description = (TextView) parent.findViewById(R.id.description);
image=(ImageView) parent.findViewById(R.id.image);
}
/* @Override
public void onClick(View view) {
Fragment2 descriptionFragment = new Fragment2();
Bundle args = new Bundle();
args.putString("title", titlevar);
args.putString("description", descriptionvar);
descriptionFragment.setArguments(args);
MainActivity.fragmentManager.beginTransaction().replace(R.id.mainf, descriptionFragment, "null").addToBackStack(null).commit();
}*/
public void setScheduleData(NearbyColleges schedule) {
this.title.setText(schedule.getTitle());
titlevar = schedule.getTitle();
this.description.setText(schedule.getDescription());
descriptionvar = schedule.getDescription();
//this.path.setText(schedule.getImage());
//imagevar=schedule.getImage();
// Glide.with(context).load(schedule.getImage()).into(image);
}
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.nearby_colleges_card, parent, false);
return new ViewHolder(itemView);
}
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
NearbyColleges row = nearbyColleges.get(position);
holder.title.setText(row.getTitle());
holder.description.setText(row.getDescription());
// holder.path.setText(row.getImage());
//String imageurl = row.getImage();
// Log.i(TAG, "onBindViewHolder:" + imageurl);
Glide.with(holder.image.getContext()).load(row.getImage()).into(holder.image);
ViewHolder inHolder = (ViewHolder) holder;
NearbyColleges schedule = (NearbyColleges) nearbyColleges.get(position);
// Picasso.with(context).load(row.getImage()).into(holder.image);
inHolder.setScheduleData(schedule);
}
@Override
public int getItemCount() {
return nearbyColleges.size();
}
}
| [
"rizwanshivalli@foremsoft.com"
] | rizwanshivalli@foremsoft.com |
53e6d4fc5dcb23ea5e16ab18216efe8dcc1f4b04 | bceba483c2d1831f0262931b7fc72d5c75954e18 | /src/qubed/corelogicextensions/PLATTEDLANDSEXTENSION.java | 1305546e50ce1f604afb84e4e47173d23b52f3db | [] | no_license | Nigel-Qubed/credit-services | 6e2acfdb936ab831a986fabeb6cefa74f03c672c | 21402c6d4328c93387fd8baf0efd8972442d2174 | refs/heads/master | 2022-12-01T02:36:57.495363 | 2020-08-10T17:26:07 | 2020-08-10T17:26:07 | 285,552,565 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,466 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2020.08.05 at 04:53:09 AM CAT
//
package qubed.corelogicextensions;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for PLATTED_LANDS_EXTENSION complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="PLATTED_LANDS_EXTENSION">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="MISMO" type="{http://www.mismo.org/residential/2009/schemas}MISMO_BASE" minOccurs="0"/>
* <element name="OTHER" type="{http://www.mismo.org/residential/2009/schemas}OTHER_BASE" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "PLATTED_LANDS_EXTENSION", propOrder = {
"mismo",
"other"
})
public class PLATTEDLANDSEXTENSION {
@XmlElement(name = "MISMO")
protected MISMOBASE mismo;
@XmlElement(name = "OTHER")
protected OTHERBASE other;
/**
* Gets the value of the mismo property.
*
* @return
* possible object is
* {@link MISMOBASE }
*
*/
public MISMOBASE getMISMO() {
return mismo;
}
/**
* Sets the value of the mismo property.
*
* @param value
* allowed object is
* {@link MISMOBASE }
*
*/
public void setMISMO(MISMOBASE value) {
this.mismo = value;
}
/**
* Gets the value of the other property.
*
* @return
* possible object is
* {@link OTHERBASE }
*
*/
public OTHERBASE getOTHER() {
return other;
}
/**
* Sets the value of the other property.
*
* @param value
* allowed object is
* {@link OTHERBASE }
*
*/
public void setOTHER(OTHERBASE value) {
this.other = value;
}
}
| [
"vectorcrael@yahoo.com"
] | vectorcrael@yahoo.com |
a6816b121e79174d3e729ffbd28f815c4cef242d | a250d196d137fb20ae2b44f10ab762d4b39da84e | /app/src/main/java/cs/util/JsBridge.java | 6c81fbedf2232465e3cc46f69007b7e961b5da0e | [] | no_license | ofts7th/sdumbachouti | 96df285c72f02f88e5da541894192fd2e49b8a6a | 1df6dd805412b741406f2047990acf0ce5caa669 | refs/heads/master | 2020-09-06T10:18:48.264931 | 2019-11-21T04:32:44 | 2019-11-21T04:32:44 | 220,397,610 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,377 | java | package cs.util;
import android.webkit.JavascriptInterface;
public class JsBridge {
private WebViewActivityUtil util;
public JsBridge(WebViewActivityUtil util) {
this.util = util;
}
@JavascriptInterface
public String readAssetFile(String path) {
return Util.readAssetFile(path);
}
@JavascriptInterface
public void exit() {
this.util.finishActivity();
}
@JavascriptInterface
public String getConfig(String k) {
return Util.getSafeConfig(k);
}
@JavascriptInterface
public void saveConfig(String k, String v) {
Util.saveConfig(k, v);
}
@JavascriptInterface
public void exitApp() {
System.exit(0);
}
@JavascriptInterface
public String getChild(String s) {
return this.util.getChild(s);
}
@JavascriptInterface
public String getTiMuIds() {
return this.util.getTiMuIds();
}
@JavascriptInterface
public String getTiMu(int id) {
return this.util.getTiMu(id);
}
@JavascriptInterface
public String getTodayCtRecord() {
return this.util.getTodayCtRecord();
}
@JavascriptInterface
public void addTodayCtRecord(int id) {
this.util.addTodayCtRecord(id);
}
@JavascriptInterface
public void clearCtRecord() {
this.util.clearCtRecord();
}
}
| [
"ofts7th@163.com"
] | ofts7th@163.com |
95ebb153f1a68c10d8ccb13258d9b31b4bde9fe1 | 9040a7d2ca932ad3be3fa70d7cbd52bf4270a5fa | /Chatroom/Group17_InClass06-1/Group17_InClass06/ChatRoom/app/src/main/java/com/example/sandhyayalla/chatroom/MainActivity.java | a50b49f3c6e40950a92898516185d22b3995586d | [] | no_license | pawanbole/MobileApplicationDevelopment | 06e3d9fec17689281c936ba7a41a7b766aed81fb | 811a54c5d8825e7fc6ed68577824d541e1ffe71d | refs/heads/master | 2020-03-30T03:18:19.979888 | 2018-10-28T21:51:54 | 2018-10-28T21:51:54 | 150,681,319 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 7,151 | java | /*FileName : Group17_InClass06.zip
Group R-17
Assignment 6
Naga Sandhyadevi yalla, Pawan Bole , Sumanth
*/
package com.example.sandhyayalla.chatroom;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import java.io.IOException;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.ResponseBody;
public class MainActivity extends AppCompatActivity {
TextView editTextUserName;
TextView editTextPassword;
Handler handler;
Button buttonLogin;
String loginUrl = "http://ec2-18-234-222-229.compute-1.amazonaws.com/api/login";
private final OkHttpClient client = new OkHttpClient();
public Login login = new Login();
UserAuthentication authenticationDetails;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//login
editTextUserName = findViewById(R.id.editTextUserName);
editTextPassword = findViewById(R.id.editTextPassword);
buttonLogin = findViewById(R.id.buttonLogin);
if (isConnected()) {
handler = new Handler(new Handler.Callback() {
@Override
public boolean handleMessage(Message message) {
if (message.what == 150) {
Toast.makeText(MainActivity.this, "Username or password is incorrect", Toast.LENGTH_SHORT).show();
}
return false;
}
});
buttonLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//validateSetCredentials();
if (editTextUserName.getText().toString().isEmpty() && editTextUserName.getText() != null) {
editTextUserName.setError("Enter Username");
} else if (editTextPassword.getText().toString().isEmpty() && editTextPassword.getText() != null) {
editTextPassword.setError("Enter Password");
} else {
RequestBody formBody = new FormBody.Builder()
.add("email", editTextUserName.getText().toString())
.add("password", editTextPassword.getText().toString())
.build();
Request request = new Request.Builder()
.url(loginUrl)
.post(formBody)
.build();
client.newCall(request).enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
e.printStackTrace();
}
@Override
public void onResponse(Call call, Response response) throws IOException {
if (!response.isSuccessful()) {
//throw new IOException("Unexpected code " + response);
Message message = new Message();
message.what = 150;
handler.sendMessage(message);
} else {
authenticationDetails = AuthenticationParser.parseAuthenticationDetails(response.body().string());
Log.d("demo", "details" + authenticationDetails.toString());
//Toast.makeText(MainActivity.this,authenticationDetails.toString(),Toast.LENGTH_LONG).show();
//call the thread api to get the threads
SharedPreferences preferences = getSharedPreferences("myPrefs", MODE_PRIVATE);
preferences.edit().remove("token").commit();//remove if any pref tokens are there
preferences.edit().putString("token", authenticationDetails.token.toString()).commit();
Intent messageintent = new Intent(MainActivity.this, MessageThreads.class);
messageintent.putExtra("authenticationdetails", authenticationDetails);
startActivity(messageintent);
}
// callMessageThread(authenticationDetails.toString().toString());
}
});
}//for else
}
});
//end login
//signup
Button btn_Signup = (Button) findViewById(R.id.buttonSignUp);
btn_Signup.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MainActivity.this, SignUpActivity.class);
startActivity(intent);
finish();
}
});
} else {
Toast.makeText(this, "No internet Connection", Toast.LENGTH_SHORT).show();
}
}
/* public void validateSetCredentials() {
if (editTextUserName.getText() != null && !editTextUserName.getText().toString().isEmpty()) {
editTextUserName.setText(editTextUserName.getText().toString());
login.setUsername(editTextUserName.getText().toString());
} else {
editTextUserName.requestFocus();
editTextUserName.setError("Enter Username");
}
if (editTextPassword.getText() != null && !editTextPassword.getText().toString().isEmpty()) {
editTextPassword.setText(editTextPassword.getText().toString());
login.setPassword(editTextPassword.getText().toString());
} else {
editTextPassword.requestFocus();
editTextPassword.setError("Enter Password");
}
}*/
private boolean isConnected() {
ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo();
if (networkInfo == null || !networkInfo.isConnected() || (networkInfo.getType() != ConnectivityManager.TYPE_WIFI && networkInfo.getType() != ConnectivityManager.TYPE_MOBILE)) {
return false;
} else
return true;
}
}
| [
"pawanbole1989@gmail.com"
] | pawanbole1989@gmail.com |
493ded3c2baf7ee6eabd890014648067295e6894 | c1f3b8bbd97585c32187a33e27115aa0c547d35f | /src/main/java/net/fabricmc/loader/transformer/PublicAccessTransformer.java | 9f6795229d5c4c28318d52856ebc30bfdd9db333 | [
"Apache-2.0"
] | permissive | asiekierka/fabric-loader | 8624f6933a6d8934ca8664ca4619a6f6398824f9 | 16d4470208e14c16202530efc46e429e75527cfa | refs/heads/master | 2020-04-11T15:40:22.473017 | 2018-12-14T20:04:25 | 2018-12-14T20:04:25 | 161,899,113 | 0 | 0 | null | 2018-12-15T11:40:14 | 2018-12-15T11:40:14 | null | UTF-8 | Java | false | false | 2,544 | java | /*
* Copyright 2016 FabricMC
*
* 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 net.fabricmc.loader.transformer;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.*;
public final class PublicAccessTransformer implements IClassTransformer {
private static final int modAccess(int access) {
if ((access & 0x7) != Opcodes.ACC_PRIVATE) {
return (access & (~0x7)) | Opcodes.ACC_PUBLIC;
} else {
return access;
}
}
static class AccessClassVisitor extends ClassVisitor {
public AccessClassVisitor(int api, ClassVisitor classVisitor) {
super(api, classVisitor);
}
@Override
public void visit(
final int version,
final int access,
final String name,
final String signature,
final String superName,
final String[] interfaces) {
super.visit(version, modAccess(access), name, signature, superName, interfaces);
}
@Override
public void visitInnerClass(
final String name, final String outerName, final String innerName, final int access) {
super.visitInnerClass(name, outerName, innerName, modAccess(access));
}
@Override
public FieldVisitor visitField(
final int access,
final String name,
final String descriptor,
final String signature,
final Object value) {
return super.visitField(modAccess(access), name, descriptor, signature, value);
}
@Override
public MethodVisitor visitMethod(
final int access,
final String name,
final String descriptor,
final String signature,
final String[] exceptions) {
return super.visitMethod(modAccess(access), name, descriptor, signature, exceptions);
}
}
@Override
public byte[] transform(String name, String transformedName, byte[] bytes) {
if (!name.startsWith("net.minecraft") && name.indexOf('.') >= 0) {
return bytes;
}
ClassReader classReader = new ClassReader(bytes);
ClassWriter classWriter = new ClassWriter(0);
classReader.accept(new AccessClassVisitor(Opcodes.ASM7, classWriter), 0);
return classWriter.toByteArray();
}
}
| [
"kontakt@asie.pl"
] | kontakt@asie.pl |
a4722094e63ee70dcb7477641c279776aa9e3504 | f20aa19601fa453a18bd6504c98ec14f4d609571 | /src/main/java/com/usa/ciclo3/reto3/web/ReservationControllerWeb.java | e740524b5cee00054f6396eabc31a21bd62b53f1 | [] | no_license | RedmiRei/Reto3_4 | 788111c73af8e237906ae7ae7349c1ed2baa0270 | 25d74c69ecea53c1b9bb4d038408b7d610658ac1 | refs/heads/master | 2023-08-25T17:19:03.155974 | 2021-11-10T02:19:26 | 2021-11-10T02:19:26 | 423,009,204 | 1 | 3 | null | null | null | null | UTF-8 | Java | false | false | 2,936 | java | package com.usa.ciclo3.reto3.web;
import java.util.List;
import java.util.Optional;
import com.usa.ciclo3.reto3.model.Reservation;
import com.usa.ciclo3.reto3.reports.CounterClients;
import com.usa.ciclo3.reto3.reports.StatusReservation;
import com.usa.ciclo3.reto3.services.ReservationServices;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
/**
*
* @author USUARIO
*/
@RestController
@RequestMapping("/api/Reservation")
@CrossOrigin(origins = "*", methods= {RequestMethod.GET,RequestMethod.POST,RequestMethod.PUT,RequestMethod.DELETE})
public class ReservationControllerWeb {
@Autowired
private ReservationServices reservationServices;
@GetMapping("/all")
public List<Reservation> getReservation(){
return reservationServices.getAll();
}
@GetMapping("/{id}")
public Optional<Reservation> getReservation(@PathVariable("id") int idReservation) {
return reservationServices.getReservation(idReservation);
}
@PostMapping("/save")
@ResponseStatus(HttpStatus.CREATED)
public Reservation save(@RequestBody Reservation reservation) {
return
reservationServices.save(reservation);
}
@PutMapping("/update")
@ResponseStatus(HttpStatus.CREATED)
public Reservation update(@RequestBody Reservation reservation) {
return
reservationServices.update(reservation);
}
@DeleteMapping("/{id}")
@ResponseStatus(HttpStatus.NO_CONTENT)
public boolean delete(@PathVariable("id") int idReservation) {
return
reservationServices.deleteReservation(idReservation);
}
@GetMapping("/report-status")
public StatusReservation getReservationsStatusReport(){
return reservationServices.getReservationStatusReport();
}
@GetMapping("/report-dates/{dateOne}/{dateTwo}")
public List<Reservation> getReservationsReportDates(@PathVariable("dateOne") String dateOne, @PathVariable("dateTwo") String dateTwo){
return reservationServices.getReservationPeriod(dateOne, dateTwo);
}
@GetMapping("/report-clients")
public List<CounterClients> getClients() {
return reservationServices.getTopClients();
}
}
| [
"yeisi.contreras.mt@correo.usa.edu.co"
] | yeisi.contreras.mt@correo.usa.edu.co |
e6834fb493c4f5f311c5a762185df9aa57bd903d | 57399432ae3f143f704edb17745f30e9bf70e63f | /src/main/java/fr/telecom_st_etienne/ontientlebonbout/repository/search/ReponseSearchRepository.java | 8f3fe2dcb7facb2d7a8a1b4936306f2ef8f0b627 | [] | no_license | clementFrade/OnTientLeBonBout | a92152c764f495d16926113a215381acaf8f171e | 952f7d7a6435fdf30d1377fc89408fa68016dcea | refs/heads/master | 2022-12-21T21:25:25.759037 | 2020-01-27T07:50:41 | 2020-01-27T07:50:41 | 232,601,694 | 0 | 0 | null | 2022-12-16T04:43:16 | 2020-01-08T16:03:32 | Java | UTF-8 | Java | false | false | 384 | java | package fr.telecom_st_etienne.ontientlebonbout.repository.search;
import fr.telecom_st_etienne.ontientlebonbout.domain.Reponse;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
/**
* Spring Data Elasticsearch repository for the {@link Reponse} entity.
*/
public interface ReponseSearchRepository extends ElasticsearchRepository<Reponse, Long> {
}
| [
"c.frade@laposte.net"
] | c.frade@laposte.net |
426fe9e1bd7cf3a34c2ebbaefc0629c39648f97d | 0e3b26b549b7c48e3b42cbab05eadb8f6aa28a0b | /Spring JMS Application/Spring-JMS-Application/src/main/java/com/NTT/config/ReceiverConfig.java | 1781af66d2d703bac2192535407f35ae8cd776ed | [] | no_license | MouliRepo/Spring-JMS-ActiveMq-Listener | 7e7c5c1609d2497c69d1bbdc45fd8a0133a01399 | 2dc54853c03f2a54d77306d7f10f5d99f910fb01 | refs/heads/master | 2020-07-31T22:27:06.001636 | 2019-09-25T07:05:41 | 2019-09-25T07:05:41 | 210,773,393 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,276 | java | package com.NTT.config;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jms.annotation.EnableJms;
import org.springframework.jms.config.DefaultJmsListenerContainerFactory;
import com.NTT.message.OrderReceiver;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.support.converter.MessageConverter;
import org.springframework.jms.support.converter.SimpleMessageConverter;
import javax.jms.ConnectionFactory;
import java.util.Arrays;
@Configuration
@EnableJms
public class ReceiverConfig {
@Value("${broker-url}")
private String brokerUrl;
@Value("${queue}")
private String MESSAGE_QUEUE;
@Bean
public ActiveMQConnectionFactory receiverActiveMQConnectionFactory() {
ActiveMQConnectionFactory activeMQConnectionFactory =
new ActiveMQConnectionFactory();
activeMQConnectionFactory.setBrokerURL(brokerUrl);
return activeMQConnectionFactory;
}
@Bean
public DefaultJmsListenerContainerFactory jmsListenerContainerFactory() {
DefaultJmsListenerContainerFactory factory =
new DefaultJmsListenerContainerFactory();
factory
.setConnectionFactory(receiverActiveMQConnectionFactory());
return factory;
}
@Bean
public OrderReceiver receiver() {
return new OrderReceiver();
}
@Bean
MessageConverter converter() {
return new SimpleMessageConverter();
}
@Bean
public ConnectionFactory connectionFactory() {
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory();
connectionFactory.setBrokerURL(brokerUrl);
connectionFactory.setTrustedPackages(Arrays.asList("com.NTT"));
return connectionFactory;
}
/*
* Used here for Sending Messages.
*/
@Bean
public JmsTemplate jmsTemplate() {
JmsTemplate template = new JmsTemplate();
template.setConnectionFactory(connectionFactory());
template.setDefaultDestinationName(MESSAGE_QUEUE);
return template;
}
}
| [
"noreply@github.com"
] | MouliRepo.noreply@github.com |
8ac8e00c5577d4f2a9f5da973dbb0375f948dbbc | 55d09fcf216ea053c422dd4c6b0977658cb82791 | /src/controlador/VistaController.java | 05bd371ab1249bf119eaebc726392c8037375053 | [] | no_license | ferguevara510/Licoreria | ca45320783a19245466babc6a05f35657275c565 | c046441aed7bbbbe388601b0fdfb6980e3f9f89c | refs/heads/main | 2023-06-10T01:15:08.568188 | 2021-06-18T02:10:25 | 2021-06-18T02:10:25 | 371,544,067 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 869 | java | package controlador;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.input.MouseEvent;
import javafx.stage.Stage;
import java.io.IOException;
import java.util.Objects;
public class VistaController {
public static void cargarVista(MouseEvent event, String titulo, String fxml) throws IOException {
Parent root;
root = FXMLLoader.load(Objects.requireNonNull(VistaController.class.getClassLoader().getResource(fxml)));
Stage stage = new Stage();
stage.setTitle(titulo);
stage.setScene(new Scene(root));
stage.show();
stage.setResizable(false);
stage.getIcons().add(new Image("/vista/imagenes/vintage.png"));
((Node)(event.getSource())).getScene().getWindow().hide();
}
}
| [
"kafera.g10@gmail.com"
] | kafera.g10@gmail.com |
5c51ca62b83fac53100dbc383c44f4c53f697eae | 12b733f7550ab6070a3c6dd6151145b31becc26a | /BiCycle.java | abb680795fcabd7670c679bb41ccb39b4060d14a | [] | no_license | Thashma007/Java.Xworkz | 4cb090841a3d7ea62f4559e11af27617efe0b0c3 | da2573686e8e98b31005ff1055414bf8046b5276 | refs/heads/master | 2023-08-25T06:08:06.944987 | 2021-10-22T11:20:01 | 2021-10-22T11:20:01 | 412,306,665 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 677 | java | class BiCycle{
String color;
float price;
String brand;
BicycleType name=BicycleType.ROADBIKE;
BiCycle(String color,float price,String brand)
{
System.out.println("invoked cons location String,float");
this.color=color;
this.price=price;
this.brand=brand;
}
void brake()
{
System.out.println("invoked brake");
}
void move()
{
System.out.println("invoked move");
}
void displayDetails()
{
System.out.println("invoked displayDetails");
System.out.println("Bicycle color :"+this.color);
System.out.println("Bicycle price :"+this.price);
System.out.println("Bicycle brand :"+this.brand);
System.out.println("Bicycle type :"+this.name);
}
} | [
"thashma.xworkz@gmail.com"
] | thashma.xworkz@gmail.com |
717ba7a9582b50f1de593017a82ef49efec81591 | 7152de38f0981f66c8d900af5c7bacbe9430519f | /src/classanimal/TestAnimal.java | 6293291d8b2d2f7fd2ea0434c6be6fae09feb6cb | [] | no_license | tranducluan1999/Java | 8e577707d4cc0bc57f6422d1d71e9824fba97ad0 | c8a88a8b97d4142f7dbbbd3dff45f4fce0319189 | refs/heads/master | 2022-11-24T04:56:22.334957 | 2020-07-20T17:04:40 | 2020-07-20T17:04:40 | 281,176,972 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 748 | java | package classanimal;
import java.util.Scanner;
// String name, String spiece, float age, String food
public class TestAnimal {
public static void main(String[] args)
{
Animal animal = new Animal();
Scanner sc = new Scanner(System.in);
System.out.println(" Name of animal: ");
String ten = sc.nextLine();
System.out.println(" Spiece of animal: ");
String loai = sc.nextLine();
System.out.println(" Age of animal: ");
float tuoi = sc.nextFloat();
sc.nextLine();
System.out.println(" Food of animal: ");
String doan = sc.nextLine();
animal = new Animal(ten, loai, tuoi, doan);
System.out.println(animal);
}
}
| [
"ducluantran1999@gmail.com"
] | ducluantran1999@gmail.com |
4817e9c1859a343a3ccceced93ebb4b46404e536 | bceb6add525f17713441b0cbb90cfb1b6f4f97e2 | /lbs-server/src/main/java/com/lbs/nettyserver/dao/PowerValueDAO.java | 4a090b8e60d4e0a22844c59cfc342dedd43a3dfd | [] | no_license | willint/lbs-netty-server | 8e7fcd823cc7beefe112c311a5987e0f2b1bf007 | fa168f8d6057181bc5370bed6452f761cb48f519 | refs/heads/master | 2021-04-12T02:58:34.741238 | 2018-03-18T07:12:41 | 2018-03-18T07:12:47 | 125,639,958 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,605 | java | package com.lbs.nettyserver.dao;
import java.util.List;
import javax.transaction.Transactional;
import org.hibernate.Query;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.lbs.nettyserver.dao.common.BaseDao;
import com.lbs.nettyserver.model.pojo.PowerValue;
@Transactional
@Repository("powerValueDAO")
public class PowerValueDAO {
@Autowired
private SessionFactory sessionFactory;
@Autowired
private BaseDao baseDao;
/**
* 保存用户能量体力实体到数据库
* @param powerValue
*/
public void savePowerValue(PowerValue powerValue){
this.sessionFactory.getCurrentSession().save(powerValue);
this.sessionFactory.getCurrentSession().flush();
}
/**
* 调用存储过程重置所有用户的体力和能量值
* @return
* @throws Exception
*/
public Object userPowerValueResetByProc() throws Exception{
return baseDao.selectNativeSqlUniqueResult("select user_power_value_reset() as \"isSuccess\";", null, "isSuccess");
}
/**
* 根据用户Id获取用户体力能量实体类
* @param userId
* @return
*/
public PowerValue getPowerValueByUserId(String userId){
String hql = "from PowerValue where user_id = :userId";
Query query = this.sessionFactory.getCurrentSession().createQuery(hql);
query.setParameter("userId", userId);
@SuppressWarnings("unchecked")
List<PowerValue> list = query.list();
this.sessionFactory.getCurrentSession().flush();
return (list!=null && list.size()>0)?list.get(0):null;
}
}
| [
"1254756248@qq.com"
] | 1254756248@qq.com |
ee2e10aebabb12543332765493e7e54cf1d73658 | 384687d756b2401dbe013c8b49fd83b0a162eb50 | /app/src/main/java/com/example/f/Bitmap_modifier.java | 1393bc48f8ced169ab6008553567b76d40ff3330 | [] | no_license | KoshkaMoroshka/GameEngineAndroid | 51b225f7690d9d7e510c228eda7810eec9bfda88 | 42ba49d6c7c1150dc1dea814819ea6f16ce4e840 | refs/heads/master | 2023-03-15T22:33:37.570700 | 2021-03-12T11:09:07 | 2021-03-12T11:09:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,315 | java | package com.example.f;
import android.graphics.Bitmap;
public class Bitmap_modifier {
public static int add(int c1, int c2){
int a, r, g, b;
b=c1&0xFF + c2&0xFF; b=b>0xFF?0xFF:b;
c1=c1>>8; c2=c2>>8;
g=c1&0xFF + c2&0xFF; g=g>0xFF?0xFF:g;
c1=c1>>8; c2=c2>>8;
r=c1&0xFF + c2&0xFF; r=r>0xFF?0xFF:r;
c1=c1>>8; c2=c2>>8;
a=c1&0xFF + c2&0xFF; a=a>0xFF?0xFF:a;
return a+r+g+b;
}
public static Bitmap[] split(Bitmap bmp, int w0, int h0){
int cx=(bmp.getWidth()-1)/(1+w0);
int cy=(bmp.getHeight()-1)/(1+h0);
Bitmap[] res=new Bitmap[cx*cy];
for(int i=0; i<res.length; i++)
res[i]=Bitmap.createBitmap(w0, h0, Bitmap.Config.ARGB_8888);
int x0, y0;
for(int i=0; i<res.length; i++){
x0=1+(1+w0)*(i%cx);
y0=1+(1+h0)*(i/cx);
for(int x=0; x<w0; x++)
for(int y=0; y<h0; y++)
res[i].setPixel(x, y, bmp.getPixel(x0+x, y0+y));
}
return res;
}
public static Bitmap cut_space(Bitmap bmp, boolean l, boolean u, boolean r, boolean d){
int x1=0, y1=0, x2=bmp.getWidth(), y2=bmp.getHeight();
boolean s;
if(l){
s=false;
for(x1=x1; x1<x2 && !s; x1++)
for(int y=y1; y<y2; y++)
if(s=(bmp.getPixel(x1, y)!=0xFF000000))
break;
x1--;
}
if(u){
s=false;
for(y1=y1; y1<y2 && !s; y1++)
for(int x=x1; x<x2; x++)
if(s=(bmp.getPixel(x, y1)!=0xFF000000))
break;
y1--;
}
if(r){
s=false;
for(x2=x2; x2>x1 && !s; x2--)
for(int y=y1; y<y2; y++)
if(s=(bmp.getPixel(x2-1, y)!=0xFF000000))
break;
x2++;
}
if(d){
s=false;
for(y2=y2; y2>y1 && !s; y2--)
for(int x=x1; x<x2; x++)
if(s=(bmp.getPixel(x, y2-1)!=0xFF000000))
break;
y2++;
}
Bitmap res=Bitmap.createBitmap(x2-x1, y2-y1, Bitmap.Config.ARGB_8888);
for(int x=0; x<x2-x1; x++)
for(int y=0; y<y2-y1; y++)
res.setPixel(x, y, bmp.getPixel(x1+x, y1+y));
return res;
}
public static void cut_space(Bitmap[] bmps, boolean l, boolean u, boolean r, boolean d){
for(int i=0; i<bmps.length; i++)
bmps[i]=cut_space(bmps[i], l, u, r, d);
}
public static Bitmap alphaGradient(Bitmap src){
int w=src.getWidth(), h=src.getHeight();
Bitmap res=Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888).copy(Bitmap.Config.ARGB_8888, true);
for(int x=0; x<w; x++)
for(int y=0; y<h; y++)
res.setPixel(x, y, src.getPixel(x, y)&0x00FFFFFF | (int)(255.0f*y/h)<<24);
return res;
}
public static Bitmap addLayer(Bitmap bmp, int color){
Bitmap res=Bitmap.createBitmap(bmp.getWidth(), bmp.getHeight(), Bitmap.Config.ARGB_8888).copy(Bitmap.Config.ARGB_8888, true);
for(int x=0; x<res.getWidth(); x++)
for(int y=0; y<res.getHeight(); y++)
res.setPixel(x, y, add(color, bmp.getPixel(x, y)));
return res;
}
public static Bitmap createFocusMask(int w, int h){
Bitmap res = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888).copy(Bitmap.Config.ARGB_8888, true);
int color = 0xFF000000;
for(int xx=0; xx<w; xx++)
for(int yy=0; yy<h; yy++)
res.setPixel(xx, yy, color);
int range=10;
int x0=w/2, y0=h/2, r=w-x0, dr=r/range;
for(int i=0; i<range; i++)
{
color=(255*(range-i)/range)<<24;
for(int xx=x0-r; xx<x0+r; xx++)
for(int yy=y0-r; yy<y0+r; yy++)
{
if(xx<0 || xx>=w || yy<0 || yy>=h)
continue;
if((xx-x0)*(xx-x0)+(yy-y0)*(yy-y0)>r*r)
continue;
res.setPixel(xx, yy, color);
}
r-=dr;
}
return res;
}
}
| [
"trillob0t@mail.ru"
] | trillob0t@mail.ru |
38079470c4862c78af65b4b9e0c8aab3c9c993c1 | 8c7ba26a417fa2fb165fd0b9399e05e0bba6562c | /WEB-INF/classes/Login.java | 42607833e25518c12f1ec1a658109acf15ebc917 | [] | no_license | HaochenSun/stucat002 | 85d67091667876929eecd618b02eefe13e28425f | a26ef8f49f5303f7e87d3deb447a95f361505dd5 | refs/heads/master | 2021-01-18T15:37:13.120611 | 2015-04-17T12:52:02 | 2015-04-17T12:52:02 | 34,124,520 | 0 | 0 | null | 2015-04-17T15:33:13 | 2015-04-17T15:33:13 | null | UTF-8 | Java | false | false | 2,796 | java | import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.velocity.app.Velocity;
import org.apache.velocity.context.Context;
import org.apache.velocity.Template;
import org.apache.velocity.tools.view.VelocityViewServlet;
import java.io.*;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.*;
import javax.servlet.http.*;
import com.mysql.jdbc.*;
public class Login extends VelocityViewServlet {
public Template handleRequest (HttpServletRequest request, HttpServletResponse response, Context ctx) {
Template page = null;
response.setContentType("text/html");
java.sql.Connection conn = null;
java.sql.PreparedStatement ps=null;
String email = request.getParameter("email");
String password = request.getParameter("pwd");
String checkname = "";
String checkemail = "";
Integer checkrole = 0;
HttpSession session = request.getSession(true);
try
{
// connect to the database
String sqluserName="team152";
String sqlpassword="b042ba74";
String url="jdbc:mysql://stusql.dcs.shef.ac.uk/team152";
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn=DriverManager.getConnection(url,sqluserName,sqlpassword);
// prepare statement
ps = conn.prepareStatement("SELECT * FROM User WHERE Email='" + email + "' AND Password='"+password+"';");
}
catch(Exception e)
{
System.out.println(e);
}
try
{
ResultSet results = ps.executeQuery();
while (results.next())
{
checkname = results.getString("Name");
checkrole = results.getInt("RoleId");
checkemail = results.getString("Email");
}
}
catch (SQLException e)
{
e.printStackTrace();
}
finally
{
try{conn.close();}catch(SQLException e){e.printStackTrace();}
}
if (checkemail.equals(email) && checkemail != "")
//Successful login
{
ctx.put("status","Logged in as: " + checkname);
//Store important user values in session
session.setAttribute("username", checkname);
session.setAttribute("roleID", checkrole);
session.setAttribute("email", checkemail);
}
else if (email == null && password == null)
//No login attempt
{
ctx.put("status","Email and Password not entered");
}
else
//Email not found
{
ctx.put("status","Account not found");
}
try
{
//Render homepage from servlet
request.getRequestDispatcher("/").forward(request,response);
}
catch (Exception e)
{
System.out.println("VelocityForm excpetion: " + e);
}
return page;
}
} | [
"acp14stt@DCS04497.windows.dcs.shef.ac.uk"
] | acp14stt@DCS04497.windows.dcs.shef.ac.uk |
dd7b9be8eaa571b0e70f4bae72b3ac5614cc64b6 | e859a28584da0078282b3afa435c43ed9bcbcb34 | /src/main/java/com/karen/fan/common/exception/InvalidParamsException.java | e0e3355491cdccd5dff26ba8dbb1844cfe0580d7 | [] | no_license | fweilian/karen | 1accedd6b04715226de3067cb20fd8491eccd14b | e3a5ad92b5f32fd1e3ec5e7e5dcec5ae051db298 | refs/heads/master | 2021-01-10T11:06:39.923454 | 2015-11-15T16:46:08 | 2015-11-15T16:46:08 | 46,225,515 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 962 | java | package com.karen.fan.common.exception;
/**
* @Date: 2015-07-12
* @author: fan
*/
public class InvalidParamsException extends GlobalException {
private static final int errorCode = 900002;
public InvalidParamsException() {
super();
}
public InvalidParamsException(String message) {
super(message);
}
public InvalidParamsException(String message, Object data) {
super(message, data);
}
public InvalidParamsException(String message, Throwable cause) {
super(message, cause);
}
public InvalidParamsException(String message, Throwable cause, Object data) {
super(message, cause, data);
}
public InvalidParamsException(Throwable cause) {
super(cause);
}
public InvalidParamsException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}
| [
"fweilian@163.com"
] | fweilian@163.com |
86de2305f88597b11c9ad49eb85adbd8e81952bd | d7f0d3fe7f5bddf1a0f59281f910991cd46960ed | /Unidad4/U4_AnimationEvents/U4_AnimationEvents-master/app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r/android/support/asynclayoutinflater/R.java | 468fd0c54e8300a8d032e2fcf05040f326d5ab4f | [] | no_license | JuanAntonioLopezSanchez/TAM2019 | 4899995a6a1be6961c74d682d753eb33eeed9033 | df0462767d3b99522d259aeb93f64c5be4978af8 | refs/heads/master | 2020-04-21T21:28:55.600825 | 2019-06-04T21:19:17 | 2019-06-04T21:19:17 | 169,880,296 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,466 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package android.support.asynclayoutinflater;
public final class R {
private R() {}
public static final class attr {
private attr() {}
public static final int alpha = 0x7f020027;
public static final int font = 0x7f02007a;
public static final int fontProviderAuthority = 0x7f02007c;
public static final int fontProviderCerts = 0x7f02007d;
public static final int fontProviderFetchStrategy = 0x7f02007e;
public static final int fontProviderFetchTimeout = 0x7f02007f;
public static final int fontProviderPackage = 0x7f020080;
public static final int fontProviderQuery = 0x7f020081;
public static final int fontStyle = 0x7f020082;
public static final int fontVariationSettings = 0x7f020083;
public static final int fontWeight = 0x7f020084;
public static final int ttcIndex = 0x7f02013c;
}
public static final class color {
private color() {}
public static final int notification_action_color_filter = 0x7f04003f;
public static final int notification_icon_bg_color = 0x7f040040;
public static final int ripple_material_light = 0x7f04004a;
public static final int secondary_text_default_material_light = 0x7f04004c;
}
public static final class dimen {
private dimen() {}
public static final int compat_button_inset_horizontal_material = 0x7f05004d;
public static final int compat_button_inset_vertical_material = 0x7f05004e;
public static final int compat_button_padding_horizontal_material = 0x7f05004f;
public static final int compat_button_padding_vertical_material = 0x7f050050;
public static final int compat_control_corner_material = 0x7f050051;
public static final int compat_notification_large_icon_max_height = 0x7f050052;
public static final int compat_notification_large_icon_max_width = 0x7f050053;
public static final int notification_action_icon_size = 0x7f05005f;
public static final int notification_action_text_size = 0x7f050060;
public static final int notification_big_circle_margin = 0x7f050061;
public static final int notification_content_margin_start = 0x7f050062;
public static final int notification_large_icon_height = 0x7f050063;
public static final int notification_large_icon_width = 0x7f050064;
public static final int notification_main_column_padding_top = 0x7f050065;
public static final int notification_media_narrow_margin = 0x7f050066;
public static final int notification_right_icon_size = 0x7f050067;
public static final int notification_right_side_padding_top = 0x7f050068;
public static final int notification_small_icon_background_padding = 0x7f050069;
public static final int notification_small_icon_size_as_large = 0x7f05006a;
public static final int notification_subtext_size = 0x7f05006b;
public static final int notification_top_pad = 0x7f05006c;
public static final int notification_top_pad_large_text = 0x7f05006d;
}
public static final class drawable {
private drawable() {}
public static final int notification_action_background = 0x7f060056;
public static final int notification_bg = 0x7f060057;
public static final int notification_bg_low = 0x7f060058;
public static final int notification_bg_low_normal = 0x7f060059;
public static final int notification_bg_low_pressed = 0x7f06005a;
public static final int notification_bg_normal = 0x7f06005b;
public static final int notification_bg_normal_pressed = 0x7f06005c;
public static final int notification_icon_background = 0x7f06005d;
public static final int notification_template_icon_bg = 0x7f06005e;
public static final int notification_template_icon_low_bg = 0x7f06005f;
public static final int notification_tile_bg = 0x7f060060;
public static final int notify_panel_notification_icon_bg = 0x7f060061;
}
public static final class id {
private id() {}
public static final int action_container = 0x7f07000d;
public static final int action_divider = 0x7f07000f;
public static final int action_image = 0x7f070010;
public static final int action_text = 0x7f070016;
public static final int actions = 0x7f070017;
public static final int async = 0x7f07001e;
public static final int blocking = 0x7f070021;
public static final int chronometer = 0x7f07002d;
public static final int forever = 0x7f070042;
public static final int icon = 0x7f070048;
public static final int icon_group = 0x7f070049;
public static final int info = 0x7f07004c;
public static final int italic = 0x7f07004e;
public static final int line1 = 0x7f070050;
public static final int line3 = 0x7f070051;
public static final int normal = 0x7f070059;
public static final int notification_background = 0x7f07005a;
public static final int notification_main_column = 0x7f07005b;
public static final int notification_main_column_container = 0x7f07005c;
public static final int right_icon = 0x7f070065;
public static final int right_side = 0x7f070066;
public static final int tag_transition_group = 0x7f070086;
public static final int tag_unhandled_key_event_manager = 0x7f070087;
public static final int tag_unhandled_key_listeners = 0x7f070088;
public static final int text = 0x7f070089;
public static final int text2 = 0x7f07008a;
public static final int time = 0x7f07008d;
public static final int title = 0x7f07008e;
}
public static final class integer {
private integer() {}
public static final int status_bar_notification_info_maxnum = 0x7f080004;
}
public static final class layout {
private layout() {}
public static final int notification_action = 0x7f09001d;
public static final int notification_action_tombstone = 0x7f09001e;
public static final int notification_template_custom_big = 0x7f09001f;
public static final int notification_template_icon_group = 0x7f090020;
public static final int notification_template_part_chronometer = 0x7f090021;
public static final int notification_template_part_time = 0x7f090022;
}
public static final class string {
private string() {}
public static final int status_bar_notification_info_overflow = 0x7f0b002a;
}
public static final class style {
private style() {}
public static final int TextAppearance_Compat_Notification = 0x7f0c00ec;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0c00ed;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0c00ee;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0c00ef;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0c00f0;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0c0158;
public static final int Widget_Compat_NotificationActionText = 0x7f0c0159;
}
public static final class styleable {
private styleable() {}
public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f020027 };
public static final int ColorStateListItem_android_color = 0;
public static final int ColorStateListItem_android_alpha = 1;
public static final int ColorStateListItem_alpha = 2;
public static final int[] FontFamily = { 0x7f02007c, 0x7f02007d, 0x7f02007e, 0x7f02007f, 0x7f020080, 0x7f020081 };
public static final int FontFamily_fontProviderAuthority = 0;
public static final int FontFamily_fontProviderCerts = 1;
public static final int FontFamily_fontProviderFetchStrategy = 2;
public static final int FontFamily_fontProviderFetchTimeout = 3;
public static final int FontFamily_fontProviderPackage = 4;
public static final int FontFamily_fontProviderQuery = 5;
public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f02007a, 0x7f020082, 0x7f020083, 0x7f020084, 0x7f02013c };
public static final int FontFamilyFont_android_font = 0;
public static final int FontFamilyFont_android_fontWeight = 1;
public static final int FontFamilyFont_android_fontStyle = 2;
public static final int FontFamilyFont_android_ttcIndex = 3;
public static final int FontFamilyFont_android_fontVariationSettings = 4;
public static final int FontFamilyFont_font = 5;
public static final int FontFamilyFont_fontStyle = 6;
public static final int FontFamilyFont_fontVariationSettings = 7;
public static final int FontFamilyFont_fontWeight = 8;
public static final int FontFamilyFont_ttcIndex = 9;
public static final int[] GradientColor = { 0x101019d, 0x101019e, 0x10101a1, 0x10101a2, 0x10101a3, 0x10101a4, 0x1010201, 0x101020b, 0x1010510, 0x1010511, 0x1010512, 0x1010513 };
public static final int GradientColor_android_startColor = 0;
public static final int GradientColor_android_endColor = 1;
public static final int GradientColor_android_type = 2;
public static final int GradientColor_android_centerX = 3;
public static final int GradientColor_android_centerY = 4;
public static final int GradientColor_android_gradientRadius = 5;
public static final int GradientColor_android_tileMode = 6;
public static final int GradientColor_android_centerColor = 7;
public static final int GradientColor_android_startX = 8;
public static final int GradientColor_android_startY = 9;
public static final int GradientColor_android_endX = 10;
public static final int GradientColor_android_endY = 11;
public static final int[] GradientColorItem = { 0x10101a5, 0x1010514 };
public static final int GradientColorItem_android_color = 0;
public static final int GradientColorItem_android_offset = 1;
}
}
| [
"43960380+JuanAntonioLopezSanchez@users.noreply.github.com"
] | 43960380+JuanAntonioLopezSanchez@users.noreply.github.com |
10929b1d2f46611c000cc6d654735c1e4aa8bb3c | 3ec3e917a882d5b9c02ebc9dfa1c9c5a1ff1f242 | /asciipic/src/main/java/com/asciipic/services/journalize/logout/JournalizeLogoutService.java | acef2b8473d22a66935b6cfe66a17b568b840429 | [] | no_license | AlexandruTudose/TW | 46eb553788896734410f9b0b4f123d47639adf52 | f8aeb6f37bf62fd1164950e2ebcd7d1822a72450 | refs/heads/master | 2021-01-20T14:34:10.444057 | 2017-05-14T21:42:25 | 2017-05-14T21:42:25 | 90,627,032 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 271 | java | package com.asciipic.services.journalize.logout;
import com.asciipic.models.JournalizeLogout;
import com.asciipic.services.UpdateService;
/**
* Created by Alexandru on 5/14/2017.
*/
public interface JournalizeLogoutService extends UpdateService<JournalizeLogout> {
}
| [
"alexandru.tudose@info.uaic.ro"
] | alexandru.tudose@info.uaic.ro |
123b7ec9e62f6166261a43e7d79c62ad85a6d334 | b2892a9090f06907261862f034a8bab151c3e91d | /src/lab5/Animalrescue/Dog.java | 7a14d49b415f6866e618167d04974f6767d1731c | [] | no_license | magdapentek/lab.6 | 270f6b2bf8e2e446831ec9069c9620032dea8931 | 6c703ea47121bcee771cc472f8f7d38bd40ce2a2 | refs/heads/master | 2020-09-05T00:46:30.829104 | 2019-11-13T06:25:01 | 2019-11-13T06:25:01 | 219,937,186 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 616 | java | package lab5.Animalrescue;
public class Dog extends Animal{
public class Main {
public void animals(){
Dog rex = new Dog();
}
public void healthLevel() {
System.out.println("7");
}
}
public void age(){
System.out.println("\nThe dogs ages are between 1 - 19");
}
public void favoritMeal(){
System.out.println("Pedigree");
}
public void relaxActivity(){
System.out.println("Playing with frisbee");
}
public void speak(){
System.out.println("Ham-ham");
}
}
| [
"pentekmagda@yahoo.com"
] | pentekmagda@yahoo.com |
a5b5b71d9fd577bfb03bb16f7064535695eaf9d8 | d3249d7a5badd76426f8a87888e6c27b136bf442 | /SeleniumTutorials/src/testNG/AssertionsExample.java | aa3b0e7fc3ddb0a8fabfa493f0a6f9ba161e32a7 | [] | no_license | SANJAY-46/SeleniumTutorials | 76f73af7cbb3857c0241f7c10f30c4475f104e15 | bbe8af177978a2e3c1712671ec4fea3f59f891a1 | refs/heads/master | 2022-11-30T12:47:54.873255 | 2020-08-14T11:54:43 | 2020-08-14T11:54:43 | 285,583,521 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 587 | java | package testNG;
import org.testng.Assert;
import org.testng.annotations.Test;
import org.testng.asserts.Assertion;
//Assertions main ah developers unit testing ku use panuvaganga nammo avalova use pana matom
public class AssertionsExample {
@Test
public void checkEqual() {
String name="Sanjay";
//NORMAL TYPE
//if (name.equals("Sanjay")) {
//System.out.println("Yes it is equal");
//}else {
// System.out.println("no , it is not equal");
//}
// ASSERTION TYPE
Assert.assertEquals(name, "Sanjay");
}
}
| [
"Sanjay46@Sanjay"
] | Sanjay46@Sanjay |
a984cbefe749b6440dac15ac6b5e53b0a2b730e4 | d49e3ff34467c71630681df5a791cb3e4bd72ab7 | /src/com/adobe/primetime/core/radio/CommandQueue$1.java | 5c7e2a984059b72afa1950620a3f8af9292b0ed4 | [] | no_license | reverseengineeringer/com.gogoair.ife | 124691cf49e832f5dd8009ceb590894a7a058dfa | e88a26eec5640274844e6cdafcd706be727e8ae3 | refs/heads/master | 2020-09-15T19:45:27.094286 | 2016-09-01T13:32:34 | 2016-09-01T13:32:34 | 67,133,682 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 506 | java | package com.adobe.primetime.core.radio;
import com.adobe.primetime.core.ICallback;
class CommandQueue$1
implements ICallback
{
CommandQueue$1(CommandQueue paramCommandQueue) {}
public Object call(Object paramObject)
{
if (CommandQueue.access$000(this$0)) {
return null;
}
CommandQueue.access$100(this$0);
return null;
}
}
/* Location:
* Qualified Name: com.adobe.primetime.core.radio.CommandQueue.1
* Java Class Version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"reverseengineeringer@hackeradmin.com"
] | reverseengineeringer@hackeradmin.com |
5db12a7bd4d8b8909a00135fbc467d2d9454a82d | 816c91bb4d424cb7b2190bdb9b1d1988101939a7 | /src/com/clillo/dmx/ui/jpanels/opcionesMenu/PanelMantienePuntosMovingHeads.java | 74fa2b8c265ecc8d6597a2973b0985b0a7b3ac3a | [] | no_license | clillo/iluminacion | 188743a0dc18a9fed07602bbc018e910be542e54 | d9b9fc7471461b8f6a1da310bbf00fe830ef6a4e | refs/heads/master | 2021-07-07T15:13:46.386311 | 2021-05-10T00:07:27 | 2021-05-10T00:07:27 | 236,244,798 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,455 | java | package com.clillo.dmx.ui.jpanels.opcionesMenu;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.AdjustmentEvent;
import java.awt.event.AdjustmentListener;
import java.util.ArrayList;
import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.border.TitledBorder;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import com.clillo.dmx.configuracion.escenas.PuntosRoboticasCfg;
import com.clillo.dmx.core.ListaFixtures;
import com.clillo.dmx.core.fixtures.FixtureMovingHead;
import com.clillo.dmx.ui.jpanels.fixtures.robotizados.ListenerCambioPosicion;
import com.clillo.dmx.ui.jpanels.fixtures.robotizados.ListenerMovimientos;
import com.clillo.dmx.ui.jpanels.fixtures.robotizados.PanelCanvas;
import com.clillo.dmx.ui.jpanels.fixtures.robotizados.PanelControlPosicion;
import com.clillo.dmx.ui.jpanels.fixtures.robotizados.Punto;
import com.clillo.dmx.ui.jpanels.opcionesMenu.escenas.PuntoRoboticas;
import javax.swing.JSpinner;
import javax.swing.JScrollBar;
public class PanelMantienePuntosMovingHeads extends PanelMenuGenerico implements ActionListener, ListenerCambioPosicion, ListSelectionListener, ListenerMovimientos, AdjustmentListener{
private static final long serialVersionUID = -5869553409971473557L;
private PanelCanvas pnlCanvas;
private JButton btnEditar;
private PanelControlPosicion pnlControlPosicion;
private PanelControlPosicion pnlControlPosicionFine;
private PanelControlPosicion pnlTraslada;
private PanelControlPosicion pnlEscala;
private JList<PuntoRoboticas> lstPuntos;
private DefaultListModel<PuntoRoboticas> modeloLista;
private JScrollBar scrlX;
private JScrollBar scrlY;
private FixtureMovingHead entidad;
private JTextField txtPosicion;
private JTextField txtFine;
private JPanel pnl1;
private String id;
public PanelMantienePuntosMovingHeads() {
this.configura(530, 490, "Mantiene Puntos Moving Heads");
this.setLayout(null);
pnl1 = new JPanel();
pnl1.setLayout(null);
pnl1.setBounds(4, 4, 536, 484);
add(pnl1);
txtPosicion = new JTextField();
txtPosicion.setBounds(436, 24, 39, 20);
pnl1.add(txtPosicion);
txtFine = new JTextField();
txtFine.setBounds(475, 24, 39, 20);
pnl1.add(txtFine);
pnlCanvas = new PanelCanvas();
pnlCanvas.setBackground(Color.BLACK);
pnlCanvas.setBounds(34, 22, 400, 400);
pnlCanvas.setTxtPosicion(txtPosicion);
pnlCanvas.setTxtFine(txtFine);
pnl1.add(pnlCanvas);
pnlControlPosicion = new PanelControlPosicion();
pnlControlPosicion.setBounds(451, 55, 60, 54);
pnl1.add(pnlControlPosicion);
pnlControlPosicionFine = new PanelControlPosicion();
pnlControlPosicionFine.setBounds(451, 120, 60, 54);
pnl1.add(pnlControlPosicionFine);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(448, 185, 63, 75);
pnl1.add(scrollPane);
modeloLista = new DefaultListModel<PuntoRoboticas>();
lstPuntos = new JList<PuntoRoboticas>(modeloLista);
lstPuntos.addListSelectionListener(this);
scrollPane.setViewportView(lstPuntos);
btnEditar = new JButton("Editar");
btnEditar.setBounds(446, 271, 68, 23);
btnEditar.addActionListener(this);
pnl1.add(btnEditar);
pnlTraslada = new PanelControlPosicion();
pnlTraslada.setBounds(454, 305, 60, 54);
pnl1.add(pnlTraslada);
pnlEscala = new PanelControlPosicion();
pnlEscala.setBounds(438, 370, 60, 54);
pnl1.add(pnlEscala);
scrlX = new JScrollBar();
scrlX.setMaximum(255);
scrlX.setOrientation(JScrollBar.HORIZONTAL);
scrlX.setBounds(10, 433, 490, 20);
scrlX.addAdjustmentListener(this);
pnl1.add(scrlX);
scrlY = new JScrollBar();
scrlY.setMaximum(255);
scrlY.setBounds(1, 25, 23, 397);
scrlY.addAdjustmentListener(this);
pnl1.add(scrlY);
}
private void actualizaPuntos(){
lstPuntos.removeListSelectionListener(this);
modeloLista.removeAllElements();
lstPuntos.addListSelectionListener(this);
ArrayList<Punto> listaPuntos = new ArrayList<Punto>();
for (PuntoRoboticas pr: PuntosRoboticasCfg.getListaPuntos()){
modeloLista.addElement(pr);
Punto p = new Punto();
p.setNombre(pr.getId());
if ("movingHead1".equals(this.id)){
p.setX(pr.getMovingHead1Pan());
p.setY(pr.getMovingHead1Tilt());
}else{
p.setX(pr.getMovingHead2Pan());
p.setY(pr.getMovingHead2Tilt());
}
//System.out.println(System.identityHashCode(pr)+"\t"+ pr.getId() +"\t"+pr.getMovingHead1Pan()+"\t"+pr.getMovingHead1Tilt());
listaPuntos.add(p);
}
pnlCanvas.setListaPuntos(listaPuntos);
}
public void setId(String id){
entidad = (FixtureMovingHead)ListaFixtures.getFixture(id);
pnlCanvas.setEntidad(entidad);
entidad.setListenerCambioPosicion(this);
pnlControlPosicion.setEntidad(entidad);
pnlControlPosicionFine.setEntidad(entidad);
pnlControlPosicionFine.setEsFine(true);
pnlTraslada.setListener(this);
pnlTraslada.setTipo(TipoMovimiento.TRASLADA);
pnlEscala.setListener(this);
pnlEscala.setTipo(TipoMovimiento.ESCALA);
if (id.contains("1"))
pnl1.setBorder(new TitledBorder(null, "Moving Head 1", TitledBorder.LEADING, TitledBorder.TOP, null, null));
else
pnl1.setBorder(new TitledBorder(null, "Moving Head 2", TitledBorder.LEADING, TitledBorder.TOP, null, null));
this.id = id;
actualizaPuntos();
}
@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource().equals(btnEditar)){
if (lstPuntos.getSelectedValue()!=null){
PuntoRoboticas pr = lstPuntos.getSelectedValue();
if ("movingHead1".equals(this.id)){
pr.setMovingHead1Pan(entidad.getPosX());
pr.setMovingHead1Tilt(entidad.getPosY());
pr.setMovingHead1PanFine(entidad.getPanFine());
pr.setMovingHead1TiltFine(entidad.getTiltFine());
}else{
pr.setMovingHead2Pan(entidad.getPosX());
pr.setMovingHead2Tilt(entidad.getPosY());
pr.setMovingHead2PanFine(entidad.getPanFine());
pr.setMovingHead2TiltFine(entidad.getTiltFine());
}
//System.out.println(System.identityHashCode(pr)+"\t"+ pr.getId() +"\t"+pr.getMovingHead1Pan()+"\t"+pr.getMovingHead1Tilt());
actualizaPuntos();
pnlCanvas.repaint();
PuntosRoboticasCfg.grabar();
}
}
}
@Override
public void moverHasta(int x, int y, boolean fine) {
if (fine){
scrlX.setValue(x);
scrlY.setValue(y);
}
pnlCanvas.repaint();
}
@Override
public void valueChanged(ListSelectionEvent arg0) {
if (arg0.getSource().equals(lstPuntos) && !arg0.getValueIsAdjusting()){
if (lstPuntos.getSelectedValue()!=null)
lstPuntos.getSelectedValue().mueveA();
pnlCanvas.repaint();
}
}
@Override
public void mueveArriba(TipoMovimiento tipo) {
for (PuntoRoboticas pr: PuntosRoboticasCfg.getListaPuntos()){
if ("movingHead1".equals(this.id)){
if (tipo == TipoMovimiento.TRASLADA)
pr.setMovingHead1Tilt(pr.getMovingHead1Tilt()-1);
else
pr.setMovingHead1Tilt((int)(pr.getMovingHead1Tilt()/1.025));
}else{
if (tipo == TipoMovimiento.TRASLADA)
pr.setMovingHead2Tilt(pr.getMovingHead2Tilt()-1);
else
pr.setMovingHead2Tilt((int)(pr.getMovingHead2Tilt()/1.025));
}
}
actualizaPuntos();
pnlCanvas.repaint();
PuntosRoboticasCfg.grabar();
}
@Override
public void mueveAbajo(TipoMovimiento tipo) {
for (PuntoRoboticas pr: PuntosRoboticasCfg.getListaPuntos()){
if ("movingHead1".equals(this.id)){
if (tipo == TipoMovimiento.TRASLADA)
pr.setMovingHead1Tilt(pr.getMovingHead1Tilt()+1);
else
pr.setMovingHead1Tilt((int)(pr.getMovingHead1Tilt()*1.025));
}else{
if (tipo == TipoMovimiento.TRASLADA)
pr.setMovingHead2Tilt(pr.getMovingHead2Tilt()+1);
else
pr.setMovingHead2Tilt((int)(pr.getMovingHead2Tilt()*1.025));
}
}
actualizaPuntos();
pnlCanvas.repaint();
PuntosRoboticasCfg.grabar();
}
@Override
public void mueveIzquerda(TipoMovimiento tipo) {
for (PuntoRoboticas pr: PuntosRoboticasCfg.getListaPuntos()){
if ("movingHead1".equals(this.id)){
if (tipo == TipoMovimiento.TRASLADA)
pr.setMovingHead1Pan(pr.getMovingHead1Pan()-1);
else
pr.setMovingHead1Pan((int)(pr.getMovingHead1Pan()/1.025));
}else{
if (tipo == TipoMovimiento.TRASLADA)
pr.setMovingHead2Pan(pr.getMovingHead2Pan()-1);
else
pr.setMovingHead2Pan((int)(pr.getMovingHead2Pan()/1.025));
}
}
actualizaPuntos();
pnlCanvas.repaint();
PuntosRoboticasCfg.grabar();
}
@Override
public void mueveDerecha(TipoMovimiento tipo) {
for (PuntoRoboticas pr: PuntosRoboticasCfg.getListaPuntos()){
if ("movingHead1".equals(this.id)){
if (tipo == TipoMovimiento.TRASLADA)
pr.setMovingHead1Pan(pr.getMovingHead1Pan()+1);
else
pr.setMovingHead1Pan((int)(pr.getMovingHead1Pan()*1.025));
}else{
if (tipo == TipoMovimiento.TRASLADA)
pr.setMovingHead2Pan(pr.getMovingHead2Pan()+1);
else
pr.setMovingHead2Pan((int)(pr.getMovingHead2Pan()*1.025));
}
}
actualizaPuntos();
pnlCanvas.repaint();
PuntosRoboticasCfg.grabar();
}
@Override
public void adjustmentValueChanged(AdjustmentEvent e) {
entidad.setPanFine(scrlX.getValue());
entidad.setTiltFine(scrlY.getValue());
entidad.saltarAFine(scrlX.getValue(), scrlY.getValue());
pnlCanvas.repaint();
}
}
| [
"carlos@DESKTOP-BUHFA21"
] | carlos@DESKTOP-BUHFA21 |
d4ba67f276229f76d9e2a763e4cf946cdd9274b1 | 6dbae30c806f661bcdcbc5f5f6a366ad702b1eea | /Corpus/eclipse.jdt.ui/3550.java | f38c3739da0fd733cfba7bdc8c6c47c735075246 | [
"MIT"
] | permissive | SurfGitHub/BLIZZARD-Replication-Package-ESEC-FSE2018 | d3fd21745dfddb2979e8ac262588cfdfe471899f | 0f8f4affd0ce1ecaa8ff8f487426f8edd6ad02c0 | refs/heads/master | 2020-03-31T15:52:01.005505 | 2018-10-01T23:38:50 | 2018-10-01T23:38:50 | 152,354,327 | 1 | 0 | MIT | 2018-10-10T02:57:02 | 2018-10-10T02:57:02 | null | UTF-8 | Java | false | false | 139 | java | package locals_in;
public class A_test504 {
public void foo() {
int x = 10;
/*[*/
/*]*/
--x;
}
}
| [
"masudcseku@gmail.com"
] | masudcseku@gmail.com |
4408e72049a1e9d48974d1e743d2e67896b44f2f | 5cbf5236f71c9d4d67f165d444924fb86457e4cf | /app/src/main/java/com/magic/picshow/di/component/RegisterComponent.java | 45c423a7ecd68101b4bbe369202602df37ca28df | [
"Apache-2.0"
] | permissive | snowwolf10285/PicShow-zhaipin | f54eb42bb6300a171a7728ab750e9d74d873659c | b8bec473db94b6214535e73355d2c2000927f70b | refs/heads/master | 2021-01-18T03:53:48.856924 | 2017-03-22T03:10:25 | 2017-03-22T03:10:25 | 85,778,898 | 12 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,243 | java | package com.magic.picshow.di.component;
import com.jess.arms.di.scope.ActivityScope;
import com.magic.picshow.di.module.RegisterModule;
import com.magic.picshow.mvp.ui.activity.RegisterActivity;
import common.AppComponent;
import dagger.Component;
/**
* 通过Template生成对应页面的MVP和Dagger代码,请注意输入框中输入的名字必须相同
* 由于每个项目包结构都不一定相同,所以每生成一个文件需要自己导入import包名,可以在设置中设置自动导入包名
* 请在对应包下按以下顺序生成对应代码,Contract->Model->Presenter->Activity->Module->Component
* 因为生成Activity时,Module和Component还没生成,但是Activity中有它们的引用,所以会报错,但是不用理会
* 继续将Module和Component生成完后,编译一下项目再回到Activity,按提示修改一个方法名即可
* 如果想生成Fragment的相关文件,则将上面构建顺序中的Activity换为Fragment,并将Component中inject方法的参数改为此Fragment
*/
/**
* Created by snowwolf on 17/1/29.
*/
@ActivityScope
@Component(modules = RegisterModule.class, dependencies = AppComponent.class)
public interface RegisterComponent {
void inject(RegisterActivity activity);
} | [
"snowwolf@snowwolfdeMBP.lan"
] | snowwolf@snowwolfdeMBP.lan |
4bf1093498516df58ff768568138884ce1f09c10 | 9eebccee9ec3211e98aa85f0b66ac8af3acf8309 | /Netty/code/parent/socket-server/src/main/java/wr1ttenyu/study/netty/timeserver/aio/demo/AIOTimeServer.java | 9ea5bc7741f08d1a3f5f69a243ce293637cd619d | [] | no_license | wr1ttenyu/study-record | db441d14a931acbe220910379d635f3bd0534fa0 | b709a5e445e8fd61c74e8120971763d3a223c25a | refs/heads/master | 2020-03-16T13:13:16.578607 | 2019-02-23T02:37:52 | 2019-02-23T02:37:52 | 132,684,034 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 559 | java | package wr1ttenyu.study.netty.timeserver.aio.demo;
public class AIOTimeServer {
public static void main(String[] args) {
int port = 8080;
if (args != null && args.length > 0) {
try {
port = Integer.valueOf(args[0]);
} catch (NumberFormatException e) {
// 采用默认值
}
}
AsyncTimeServerHandler asyncTimeServerHandler = new AsyncTimeServerHandler(port);
new Thread(asyncTimeServerHandler, "AIO-AsyncTimeServerHandler-001").start();
}
}
| [
"xingyu.zhao@bangdao-tech.com"
] | xingyu.zhao@bangdao-tech.com |
58c7e70dd1803ae1f1af9b280d337cca5b456a6d | a7e2488730e6d68f8aa306347a9f608d1f24e6e6 | /main/src/sib/util/json/.svn/text-base/ParserException.java.svn-base | 7ebfc9d8b49ebaf5abd8d63572ce5c5362fcf710 | [] | no_license | cqels/LSBench | 546be3f3462f01ae9f04766e78b6c8e46ded27ea | 7ae2cb251d90d0b73fbc061e8d2c0715db2cc38a | refs/heads/master | 2023-02-21T11:10:59.232016 | 2023-02-21T09:41:39 | 2023-02-21T09:41:39 | 208,025,232 | 9 | 3 | null | 2021-04-29T23:45:18 | 2019-09-12T10:29:44 | Java | UTF-8 | Java | false | false | 1,107 | /*
* Big Database Semantic Metric Tools
*
* Copyright (C) 2011 OpenLink Software <bdsmt@openlinksw.com>
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; only Version 2 of the License dated
* June 1991.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package sib.util.json;
@SuppressWarnings("serial")
public class ParserException extends RuntimeException {
public ParserException(String message) {
super(message);
}
public ParserException(String message, Throwable cause) {
super(message, cause);
}
}
| [
"danh@danhlephuoc.info"
] | danh@danhlephuoc.info |
|
16c6bcafefbdd1b193a117dd7145be04ff4bba7a | fc33c2ad683826100af04d86cddeba3820346370 | /app/src/main/java/frame/golden/com/goldenframe/adapter/recycledemo.java | fcddc014694c3408179de71d1008ea25e1df58e4 | [] | no_license | ylxjj/GoldenFrame | 4872b9df606dfc92d07814d55b72cfb1974c9d14 | 1f5141bbe1ef5806992aa549fd5b489fd9c8a7c7 | refs/heads/master | 2021-05-15T08:11:56.255624 | 2017-10-10T16:19:13 | 2017-10-10T16:19:13 | 106,441,561 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 180 | java | package frame.golden.com.goldenframe.adapter;
import android.support.v7.widget.RecyclerView;
/**
* Created by Jarnathin on 2017/10/4.
*/
public class recycledemo
{
}
| [
"a472179788@163.com"
] | a472179788@163.com |
18b23986d5819ccc16e6c94ab9a7310d9f976109 | 2b4c61eb9feb6bc73704b5a0bc659fd82048a195 | /src/main/java/pl/beda/UserAuthenticationSystem/repository/RoleRepository.java | 18df2f7e46c0132fd5bdd91babbca8890ce865c5 | [
"MIT"
] | permissive | marcinbeda/user-authentication-system | 5ae7878c34d2f58c58e5a40c37e2b1d4c94f0274 | f48cc8854f037b2ef15c882704c68752a00f8774 | refs/heads/master | 2023-08-22T03:25:49.650719 | 2021-10-30T09:10:49 | 2021-10-30T09:10:49 | 412,913,293 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 312 | java | package pl.beda.UserAuthenticationSystem.repository;
import java.util.Optional;
import org.springframework.data.repository.CrudRepository;
import pl.beda.UserAuthenticationSystem.entity.Role;
public interface RoleRepository extends CrudRepository<Role, Long> {
Optional<Role> findByName(String name);
}
| [
"marcin.beda@wp.pl"
] | marcin.beda@wp.pl |
adf5699e26b187cfe5235961272593e1b8f0e440 | f6899a2cf1c10a724632bbb2ccffb7283c77a5ff | /glassfish-4.1.1/appserver/web/admin/src/main/java/org/glassfish/web/admin/monitor/statistics/AltServletStatsImpl.java | e18fcad964f61e19c0994f219bdd31fca79572d9 | [] | no_license | Appdynamics/OSS | a8903058e29f4783e34119a4d87639f508a63692 | 1e112f8854a25b3ecf337cad6eccf7c85e732525 | refs/heads/master | 2023-07-22T03:34:54.770481 | 2021-10-28T07:01:57 | 2021-10-28T07:01:57 | 19,390,624 | 2 | 13 | null | 2023-07-08T02:26:33 | 2014-05-02T22:42:20 | null | UTF-8 | Java | false | false | 5,325 | java | /*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2013 Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
* or packager/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at packager/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* Oracle designates this particular file as subject to the "Classpath"
* exception as provided by Oracle in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package org.glassfish.web.admin.monitor.statistics;
import org.glassfish.web.admin.monitor.HttpServiceStatsProviderBootstrap;
import org.jvnet.hk2.annotations.Service;
import org.glassfish.hk2.api.PerLookup;
import javax.inject.Inject;
import org.glassfish.api.ActionReport;
import org.glassfish.api.ActionReport.ExitCode;
import org.glassfish.external.statistics.CountStatistic;
import org.glassfish.external.statistics.RangeStatistic;
import org.glassfish.admin.monitor.cli.MonitorContract;
import org.glassfish.flashlight.datatree.TreeNode;
import org.glassfish.flashlight.MonitoringRuntimeDataRegistry;
import java.util.List;
import java.util.ResourceBundle;
@Service
@PerLookup
public class AltServletStatsImpl implements MonitorContract {
private static final ResourceBundle rb = HttpServiceStatsProviderBootstrap.rb;
@Inject
private MonitoringRuntimeDataRegistry mrdr;
private final static String name = "servlet";
private final static String displayFormat = "%1$-10s %2$-10s %3$-10s";
public String getName() {
return name;
}
public ActionReport process(final ActionReport report, final String filter) {
if (mrdr == null) {
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
report.setMessage(rb.getString(HTTPListenerStatsImpl.MRDR_NULL));
return report;
}
TreeNode serverNode = mrdr.get("server");
if (serverNode == null) {
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
report.setMessage(rb.getString(HTTPListenerStatsImpl.MRDR_NULL));
return report;
}
String [] patternArr = new String [] {"server.web.servlet.*"};
long activeServletsLoadedCount = 0;
long maxServletsLoadedCount = 0;
long totalServletsLoadedCount = 0;
for (String pattern : patternArr) {
List<TreeNode> tnL = serverNode.getNodes(pattern);
for (TreeNode tn : tnL) {
if (tn.hasChildNodes()) {
continue;
}
if ("activeservletsloadedcount".equals(tn.getName())) {
activeServletsLoadedCount = getRangeStatisticValue(tn.getValue());
} else if ("maxservletsloadedcount".equals(tn.getName())) {
maxServletsLoadedCount = getCountStatisticValue(tn.getValue());
} else if ("totalservletsloadedcount".equals(tn.getName())) {
totalServletsLoadedCount = getCountStatisticValue(tn.getValue());
}
}
}
report.setMessage(String.format(displayFormat,
activeServletsLoadedCount, maxServletsLoadedCount,
totalServletsLoadedCount));
report.setActionExitCode(ExitCode.SUCCESS);
return report;
}
private long getCountStatisticValue(Object obj) {
long l = 0L;
if (obj == null) return l;
if (obj instanceof CountStatistic) {
return ((CountStatistic)obj).getCount();
}
return l;
}
private long getRangeStatisticValue(Object obj) {
long l = 0L;
if (obj == null) return l;
if (obj instanceof RangeStatistic) {
return ((RangeStatistic)obj).getCurrent();
}
return l;
}
}
| [
"fgonzales@appdynamics.com"
] | fgonzales@appdynamics.com |
f5ba8d305eeb2bd7a3d047f7d808630e1d65313e | c16b8990ec3c297ac36aecabb662a6ce124dd940 | /base/src/org/openXpertya/model/X_C_CashBook.java | 45f9f5d70275f9733f9df640339caa3acca810d3 | [] | no_license | Lucas128/libertya | 6decae77481ba0756a9a14998824f163001f4b7c | d2e8877a0342af5796c74809edabf726b9ff50dc | refs/heads/master | 2021-01-10T16:52:41.332435 | 2015-05-26T19:34:39 | 2015-05-26T19:34:39 | 36,461,214 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,553 | java | /** Modelo Generado - NO CAMBIAR MANUALMENTE - Disytel */
package org.openXpertya.model;
import java.util.*;
import java.sql.*;
import java.math.*;
import org.openXpertya.util.*;
/** Modelo Generado por C_CashBook
* @author Comunidad de Desarrollo Libertya* *Basado en Codigo Original Modificado, Revisado y Optimizado de:* * Jorg Janke
* @version - 2010-11-10 15:32:20.281 */
public class X_C_CashBook extends org.openXpertya.model.PO
{
/** Constructor estándar */
public X_C_CashBook (Properties ctx, int C_CashBook_ID, String trxName)
{
super (ctx, C_CashBook_ID, trxName);
/** if (C_CashBook_ID == 0)
{
setCashBookType (null); // 'G'
setC_CashBook_ID (0);
setC_Currency_ID (0); // SQL=SELECT cb.C_Currency_ID FROM C_CashBook cb INNER JOIN C_Cash c ON (cb.C_CashBook_ID=c.C_CashBook_ID) WHERE c.C_Cash_ID=@C_Cash_ID@
setIsDefault (false);
setName (null);
}
*/
}
/** Load Constructor */
public X_C_CashBook (Properties ctx, ResultSet rs, String trxName)
{
super (ctx, rs, trxName);
}
/** AD_Table_ID */
public static final int Table_ID = M_Table.getTableID("C_CashBook");
/** TableName=C_CashBook */
public static final String Table_Name="C_CashBook";
protected static KeyNamePair Model = new KeyNamePair(Table_ID,"C_CashBook");
protected static BigDecimal AccessLevel = new BigDecimal(3);
/** Load Meta Data */
protected POInfo initPO (Properties ctx)
{
POInfo poi = POInfo.getPOInfo (ctx, Table_ID);
return poi;
}
public String toString()
{
StringBuffer sb = new StringBuffer ("X_C_CashBook[").append(getID()).append("]");
return sb.toString();
}
public static final int CASHBOOKTYPE_AD_Reference_ID = MReference.getReferenceID("C_CashBook Type");
/** General Cash Book = G */
public static final String CASHBOOKTYPE_GeneralCashBook = "G";
/** Journal Cash Book = J */
public static final String CASHBOOKTYPE_JournalCashBook = "J";
/** Set Cash Book Type.
Cash Book Type */
public void setCashBookType (String CashBookType)
{
if (CashBookType.equals("G") || CashBookType.equals("J"));
else throw new IllegalArgumentException ("CashBookType Invalid value - Reference = CASHBOOKTYPE_AD_Reference_ID - G - J");
if (CashBookType == null) throw new IllegalArgumentException ("CashBookType is mandatory");
if (CashBookType.length() > 1)
{
log.warning("Length > 1 - truncated");
CashBookType = CashBookType.substring(0,1);
}
set_ValueNoCheck ("CashBookType", CashBookType);
}
/** Get Cash Book Type.
Cash Book Type */
public String getCashBookType()
{
return (String)get_Value("CashBookType");
}
/** Set Cash Book.
Cash Book for recording petty cash transactions */
public void setC_CashBook_ID (int C_CashBook_ID)
{
set_ValueNoCheck ("C_CashBook_ID", new Integer(C_CashBook_ID));
}
/** Get Cash Book.
Cash Book for recording petty cash transactions */
public int getC_CashBook_ID()
{
Integer ii = (Integer)get_Value("C_CashBook_ID");
if (ii == null) return 0;
return ii.intValue();
}
/** Set Currency.
The Currency for this record */
public void setC_Currency_ID (int C_Currency_ID)
{
set_Value ("C_Currency_ID", new Integer(C_Currency_ID));
}
/** Get Currency.
The Currency for this record */
public int getC_Currency_ID()
{
Integer ii = (Integer)get_Value("C_Currency_ID");
if (ii == null) return 0;
return ii.intValue();
}
/** Set Description.
Optional short description of the record */
public void setDescription (String Description)
{
if (Description != null && Description.length() > 255)
{
log.warning("Length > 255 - truncated");
Description = Description.substring(0,255);
}
set_Value ("Description", Description);
}
/** Get Description.
Optional short description of the record */
public String getDescription()
{
return (String)get_Value("Description");
}
/** Set Default.
Default value */
public void setIsDefault (boolean IsDefault)
{
set_Value ("IsDefault", new Boolean(IsDefault));
}
/** Get Default.
Default value */
public boolean isDefault()
{
Object oo = get_Value("IsDefault");
if (oo != null)
{
if (oo instanceof Boolean) return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Name.
Alphanumeric identifier of the entity */
public void setName (String Name)
{
if (Name == null) throw new IllegalArgumentException ("Name is mandatory");
if (Name.length() > 60)
{
log.warning("Length > 60 - truncated");
Name = Name.substring(0,60);
}
set_Value ("Name", Name);
}
/** Get Name.
Alphanumeric identifier of the entity */
public String getName()
{
return (String)get_Value("Name");
}
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(getID(), getName());
}
}
| [
"dev.disytel@gmail.com"
] | dev.disytel@gmail.com |
c6104ada7400c5ca134dc96e5c6ddaf692aa12bb | b6e0056e358aa4068b5d485030e2116400099ca5 | /practice_chap30(Generics)/src/sec02_exam_generic_type/copy/Box.java | 10e5261b20d878a8807667632d29b194d6ca9947 | [] | no_license | harrycjy1/java-bootcamp | f0c90dfaefa8639e26110caf514c8997ce0122c8 | 32c580e14c9184045a73c5b34199a53e76571c03 | refs/heads/master | 2020-04-02T21:04:39.948115 | 2018-10-26T06:31:02 | 2018-10-26T06:31:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 224 | java | package sec02_exam_generic_type.copy;
public class Box<T> {
private T t;
//setter
public void set(T t) {
this.t= t;
}
//getter
public T get() {
return this.t;
}
}
| [
"harrycjy123@gmail.com"
] | harrycjy123@gmail.com |
e63ed02b3e6c8678a597946a6eb1e765cef4d761 | 40d844c1c780cf3618979626282cf59be833907f | /src/testcases/CWE369_Divide_by_Zero/s02/CWE369_Divide_by_Zero__float_zero_divide_02.java | 82595ad466479f62b80fb1622b170e8498b1863b | [] | no_license | rubengomez97/juliet | f9566de7be198921113658f904b521b6bca4d262 | 13debb7a1cc801977b9371b8cc1a313cd1de3a0e | refs/heads/master | 2023-06-02T00:37:24.532638 | 2021-06-23T17:22:22 | 2021-06-23T17:22:22 | 379,676,259 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,214 | java | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE369_Divide_by_Zero__float_zero_divide_02.java
Label Definition File: CWE369_Divide_by_Zero__float.label.xml
Template File: sources-sinks-02.tmpl.java
*/
/*
* @description
* CWE: 369 Divide by zero
* BadSource: zero Set data to a hardcoded value of zero
* GoodSource: A hardcoded non-zero number (two)
* Sinks: divide
* GoodSink: Check for zero before dividing
* BadSink : Dividing by a value that may be zero
* Flow Variant: 02 Control flow: if(true) and if(false)
*
* */
package testcases.CWE369_Divide_by_Zero.s02;
import testcasesupport.*;
public class CWE369_Divide_by_Zero__float_zero_divide_02 extends AbstractTestCase
{
public void bad() throws Throwable
{
float data;
if (true)
{
data = 0.0f; /* POTENTIAL FLAW: data is set to zero */
}
else
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run
* but ensure data is inititialized before the Sink to avoid compiler errors */
data = 0.0f;
}
if (true)
{
/* POTENTIAL FLAW: Possibly divide by zero */
int result = (int)(100.0 / data);
IO.writeLine(result);
}
}
/* goodG2B1() - use goodsource and badsink by changing first true to false */
private void goodG2B1() throws Throwable
{
float data;
if (false)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run
* but ensure data is inititialized before the Sink to avoid compiler errors */
data = 0.0f;
}
else
{
/* FIX: Use a hardcoded number that won't a divide by zero */
data = 2.0f;
}
if (true)
{
/* POTENTIAL FLAW: Possibly divide by zero */
int result = (int)(100.0 / data);
IO.writeLine(result);
}
}
/* goodG2B2() - use goodsource and badsink by reversing statements in first if */
private void goodG2B2() throws Throwable
{
float data;
if (true)
{
/* FIX: Use a hardcoded number that won't a divide by zero */
data = 2.0f;
}
else
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run
* but ensure data is inititialized before the Sink to avoid compiler errors */
data = 0.0f;
}
if (true)
{
/* POTENTIAL FLAW: Possibly divide by zero */
int result = (int)(100.0 / data);
IO.writeLine(result);
}
}
/* goodB2G1() - use badsource and goodsink by changing second true to false */
private void goodB2G1() throws Throwable
{
float data;
if (true)
{
data = 0.0f; /* POTENTIAL FLAW: data is set to zero */
}
else
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run
* but ensure data is inititialized before the Sink to avoid compiler errors */
data = 0.0f;
}
if (false)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
IO.writeLine("Benign, fixed string");
}
else
{
/* FIX: Check for value of or near zero before dividing */
if (Math.abs(data) > 0.000001)
{
int result = (int)(100.0 / data);
IO.writeLine(result);
}
else
{
IO.writeLine("This would result in a divide by zero");
}
}
}
/* goodB2G2() - use badsource and goodsink by reversing statements in second if */
private void goodB2G2() throws Throwable
{
float data;
if (true)
{
data = 0.0f; /* POTENTIAL FLAW: data is set to zero */
}
else
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run
* but ensure data is inititialized before the Sink to avoid compiler errors */
data = 0.0f;
}
if (true)
{
/* FIX: Check for value of or near zero before dividing */
if (Math.abs(data) > 0.000001)
{
int result = (int)(100.0 / data);
IO.writeLine(result);
}
else
{
IO.writeLine("This would result in a divide by zero");
}
}
}
public void good() throws Throwable
{
goodG2B1();
goodG2B2();
goodB2G1();
goodB2G2();
}
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
public static void main(String[] args) throws ClassNotFoundException,
InstantiationException, IllegalAccessException
{
mainFromParent(args);
}
}
| [
"you@example.com"
] | you@example.com |
49102db0e62cb422abb7c39482d8c5e234e9ffaa | 68b7fff6f84f5d91e2bcc4c1b5473fa78f4a4402 | /practice/WEB-INF/src/practice/util/DiaryUtil.java | b745b7bc6c43a3959428cd4f133c41cb29e690f8 | [] | no_license | OmOm-muron/practice | c227bde2e57e7ef8d3fe8d5f039187ebae9a43c7 | 8fa6b77e6a03cae3ad90ced2840192dd0d9542dd | refs/heads/master | 2022-09-12T11:51:06.306046 | 2020-05-26T09:44:31 | 2020-05-26T09:44:31 | 265,513,288 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,120 | java | package practice.util;
import java.io.IOException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
import practice.diary.Diary;
import practice.io.CSVFileAccess;
public class DiaryUtil {
static private final int INDEX_ID = 0;
static private final int INDEX_TITLE = 1;
static private final int INDEX_DATE = 2;
static private final int INDEX_CONTENT = 3;
/**
* 一行日記を全て取得
* @return
* @throws IOException
* @throws NumberFormatException
* @throws ParseException
*/
public static List<Diary> getDiaryList() throws IOException, NumberFormatException {
List<Diary> listDiary = new ArrayList<Diary>();
CSVFileAccess csvFA = new CSVFileAccess();
try {
// CSVファイルの全行を読み込む
int lineCount = csvFA.getLineCount();
for(int i = 1; i <= lineCount; i++) {
// 1行のデータをカンマ区切りで配列化
String lineStr = csvFA.readLine(i);
if (lineStr.isEmpty()) {
continue;
}
String[] diaryElements = lineStr.split(",");
// 一行日記の要素を取り出し
int id = Integer.parseInt(diaryElements[INDEX_ID]);
String title = diaryElements[INDEX_TITLE];
String date = diaryElements[INDEX_DATE];
String content = diaryElements[INDEX_CONTENT];
if (date.isBlank()) {
// 日付が空なら削除済みなので非表示
continue;
}
// Diaryインスタンスを作成
Diary diary = new Diary();
diary.setId(id);
diary.setTitle(title);
diary.setDate(date);
diary.setContent(content);
// Listに追加
listDiary.add(diary);
}
return listDiary;
} catch (NumberFormatException e) {
e.printStackTrace();
throw e;
} catch (IOException e) {
e.printStackTrace();
throw e;
}
}
/**
* 一行日記を1件取得
* @param targetLine idと同義
* @return
* @throws IOException
* @throws NumberFormatException
* @throws ParseException
*/
public static Diary getDiary(int targetLine) throws IOException, NumberFormatException {
CSVFileAccess csvFA = new CSVFileAccess();
try {
// 1行のデータをカンマ区切りで配列化
String lineStr = csvFA.readLine(targetLine);
String[] diaryElements = lineStr.split(",");
// 一行日記の要素を取り出し
int id = Integer.parseInt(diaryElements[INDEX_ID]);
String title = diaryElements[INDEX_TITLE];
String date = diaryElements[INDEX_DATE];
String content = diaryElements[INDEX_CONTENT];
// Diaryインスタンスを作成
Diary diary = new Diary();
diary.setId(id);
diary.setTitle(title);
diary.setDate(date);
diary.setContent(content);
return diary;
} catch (NumberFormatException e) {
e.printStackTrace();
throw e;
} catch (IOException e) {
e.printStackTrace();
throw e;
}
}
/**
* 一行日記を書き込み
* @param diary
* @throws IOException
*/
public static void addDiary(Diary diary) throws IOException {
CSVFileAccess csvFA = new CSVFileAccess();
// 一行日記の要素を取り出し
int diaryid = diary.getId();
String title = diary.getTitle();
String date = diary.getDate();
String content = diary.getContent();
// IDをStringに変換
String id = String.valueOf(diaryid);
// CSVに書き込む文字列
String addStr = id + "," + title + "," + date + "," + content + "\n";
try {
csvFA.addLine(addStr);
} catch (IOException e) {
e.printStackTrace();
throw e;
}
}
/**
* 一行日記を更新
* @param diary
* @throws IOException
*/
public static void updateDiary(Diary diary) throws IOException {
CSVFileAccess csvFA = new CSVFileAccess();
// 一行日記の要素を取り出し
int diaryid = diary.getId();
String title = diary.getTitle();
String date = diary.getDate();
String content = diary.getContent();
// IDをStringに変換
String id = String.valueOf(diaryid);
// 更新後の文字列
String afterStr = id + "," + title + "," + date + "," + content;
try {
csvFA.editLine(diaryid, afterStr);
} catch (IOException e) {
e.printStackTrace();
throw e;
}
}
/**
* 一行日記を削除
* @param diary
* @throws IOException
*/
public static void deleteDiary(Diary diary) throws IOException {
CSVFileAccess csvFA = new CSVFileAccess();
// 一行日記のIDを取り出し
int diaryid = diary.getId();
// IDをStringに変換
String id = String.valueOf(diaryid);
// 削除後の文字列
String afterStr = id + "," + " " + "," + " " + "," + " ";
try {
csvFA.editLine(diaryid, afterStr);
} catch (IOException e) {
e.printStackTrace();
throw e;
}
}
}
| [
"43139003+OmOm-muron@users.noreply.github.com"
] | 43139003+OmOm-muron@users.noreply.github.com |
12cf241a908b73bfa355359ad45154e878e343ee | 13745970ffa57ffb477fb50f31670660dbd490b4 | /eureka/src/main/java/com/muf/eureka/EurekaApplication.java | cb3241dc2782dced9e382b67e40729ca3ee3d728 | [] | no_license | huharden/shopping-test | 6105373606137160d326e6c473b738508bfcfc39 | a139d29d71438068b07be507368435d9f201afe8 | refs/heads/master | 2020-04-25T15:38:38.303837 | 2019-02-27T09:32:27 | 2019-02-27T09:32:27 | 172,885,378 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 481 | java | package com.muf.eureka;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
/**
* Description:
*
* @author: hutao
* Date: 2019-02-27-15:06
*/
@SpringBootApplication
@EnableEurekaServer
public class EurekaApplication {
public static void main(String[] args){
SpringApplication.run(EurekaApplication.class,args);
}
}
| [
"15170073501@163.com"
] | 15170073501@163.com |
a9bf91ac0e0b47659cf6c3ed812238fbebce7bf5 | c65ee4d8342327adb4144255cfd41efac7f23feb | /src/main/java/net/hennabatch/hennadungeon/util/Reference.java | e4f06b39142d467974d67aa6c1802b0f6c71293f | [] | no_license | hennano/HennaDungeon | 152308463216502ec49266a2dd32aeb7da98aa4d | b41bf12da824df0f7d3fdd4e5b9b35e110cbc380 | refs/heads/master | 2023-02-06T20:15:40.448801 | 2020-12-25T09:11:50 | 2020-12-25T09:11:50 | 306,565,343 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,200 | java | package net.hennabatch.hennadungeon.util;
import net.hennabatch.hennadungeon.config.Config;
import net.hennabatch.hennadungeon.entity.EnemyEntity;
import net.hennabatch.hennadungeon.entity.character.*;
import net.hennabatch.hennadungeon.item.Item;
import net.hennabatch.hennadungeon.item.Items;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class Reference {
//config
public static final Path CONFIG_PATH = Paths.get("config.ini").toAbsolutePath();
public static final SystemLogger logger = new SystemLogger();
public static final Config config = Config.loadConfig(CONFIG_PATH);
//screen
public static final int SCREEN_WIDTH = 20;
public static final int SCREEN_HEIGHT = 20;
public static final String SCREEN_EMPTY = " ";
public static final String CURSOR_UP = "⯅ ";
public static final String CURSOR_DOWN = "⯆ ";
public static final String CURSOR_LEFT = "⯇ ";
public static final String CURSOR_RIGHT = " ⯈";
public static final String HORIZONTAL_LINE = "―";
public static final String VERTICAL_LINE = "|";
public static final String CROSS = "+";
//dungeon
public static final int DUNGEON_WIDTH = 75;
public static final int DUNGEON_HEIGHT = 75;
public static final int DUNGEON_MAXROOMS = 25;
public static final int DUNGEON_MIN_ROOMWIDTH = 5;
public static final int DUNGEON_MIN_ROOMHEIGTH = 5;
public static final double DUNGEON_CONNECT_CHANCE = 0.5;
public static final int PLAYER_SKILL_COOLTIME = 20;
public static final int SPAWN_ENEMIES_PER_ROOM = 2;
public static final int SPAWN_ITEMS_PER_ROOM = 1;
public static final List<Class<? extends EnemyEntity>> SPANNABLE_ENEMIES = new ArrayList<>(Arrays.asList(
BatEntity.class,
GoblinEntity.class,
SlimeEntity.class,
WitchEntity.class,
MimicEntity.class
));
public static final List<Item> SPANNABLE_ITEMS = new ArrayList<>(Arrays.asList(
Items.HEAL_POTION,
Items.ATK_BUFF_POTION,
Items.DEF_BUFF_POTION,
Items.MDEF_BUFF_POTION,
Items.REGENRATION_POTION
));
public static final List<Item> SPANNABLE_WEAPONS = new ArrayList<>(Arrays.asList(
Items.SWORD,
Items.LONGSWORD,
Items.MAGICALSWORD,
Items.GRIMOIRE,
Items.NECRONOMICON,
Items.POISON_DAGGER,
Items.BOW
));
public static final List<Item> SPANNABLE_ARMORS = new ArrayList<>(Arrays.asList(
Items.LEATHER_ARMOR,
Items.IRON_ARMOR,
Items.CROTHES,
Items.ROBE
));
public static final int SPAWN_TRAP_COUNT = 5;
public static final String DUNGEON_SPACE = SCREEN_EMPTY;
public static final String DUNGEON_WALL = "■";
public static final String DUNGEON_EXITPATH = "・";
public static final String DUNGEON_EXITROOM = "○";
public static final String WEAPON_RANGE = "※";
//state
public static final int MAX_MDEFEND = 80;
public static final int MAX_EVASION = 80;
}
| [
"pittyama37@gmail.com"
] | pittyama37@gmail.com |
9058ccd43d90d190402871e1f419e9b666c6e57a | f9381d9fdbfad63ea2c389a10dfaa24ec39ab36f | /product-service/src/main/java/com/nagarro/amcart/dao/ProductDAO.java | 08b5d0e331edddcc4d015f17b7e91060d50cfdde | [] | no_license | DishaDhingra/Ecom-5 | 1095623ed8f01d418f9e74fa3fa5a1da02385511 | c644a975092d3033a326e6fc50baadcb86e9bfcb | refs/heads/master | 2020-09-23T23:45:47.207283 | 2019-10-13T11:14:59 | 2019-10-13T11:14:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 530 | java | package com.nagarro.amcart.dao;
import java.util.List;
import com.nagarro.amcart.model.ProductModel;
public interface ProductDAO {
void save(ProductModel productModel);
ProductModel get(Long id);
ProductModel getByCode(String code);
void delete(ProductModel productModel);
List<ProductModel> findAll();
List<ProductModel> findAllNewProducts();
List<ProductModel> findAllFeaturedProducts();
List<ProductModel> findAllBestSellerProducts();
List<ProductModel> findAllSpecialProducts();
}
| [
"kartik.arora@nagarro.com"
] | kartik.arora@nagarro.com |
3a88d62dc7d9cb817687ed2faaf7e8d1d6830db5 | c406822ccec49ffa709447d25937b0f0fe93d879 | /Tcc/src/br/senai/sc/Telas/TelaEscolhaPato.java | dee84683f25d0a07e11da5dbce0d7508f50a2770 | [] | no_license | Brunohvc/TCCPatos | b3864128effd3f037ddc6ba701a98cc355423014 | df9587a918876f45672423083fea495495f2752c | refs/heads/master | 2020-03-19T08:54:56.873611 | 2018-11-06T23:15:15 | 2018-11-06T23:15:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,755 | java | /*
* 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 br.senai.sc.Telas;
import br.senai.sc.DAO.PatosDAO;
import br.senai.sc.DAO.UsuariopatosDAO;
import br.senai.sc.DAO.UsuariosDAO;
import br.senai.sc.Entidades.InfoUsuario;
import br.senai.sc.Entidades.Patos;
import br.senai.sc.Entidades.Usuariopatos;
import br.senai.sc.Entidades.Usuarios;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author bruni
*/
public class TelaEscolhaPato extends javax.swing.JFrame {
/**
* Creates new form TelaLojaPersonagem
*/
public TelaEscolhaPato() {
initComponents();
setLocationRelativeTo(null);
IniciarImg();
SetImagem();
}
Usuarios usu = new Usuarios();
UsuariosDAO usuDAO = new UsuariosDAO();
InfoUsuario IU = new InfoUsuario();
Patos pato = new Patos();
PatosDAO patoDAO = new PatosDAO();
Usuariopatos up = new Usuariopatos();
UsuariopatosDAO upDAO = new UsuariopatosDAO();
int id;
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
tabp = new javax.swing.JTable();
imgperso = new javax.swing.JLabel();
comprar = new javax.swing.JButton();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowActivated(java.awt.event.WindowEvent evt) {
formWindowActivated(evt);
}
public void windowOpened(java.awt.event.WindowEvent evt) {
formWindowOpened(evt);
}
});
jPanel1.setBackground(new java.awt.Color(255, 255, 255));
tabp.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{},
{},
{},
{}
},
new String [] {
}
));
tabp.setFocusable(false);
tabp.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
tabpMouseClicked(evt);
}
});
jScrollPane1.setViewportView(tabp);
imgperso.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
comprar.setText("Escolher");
comprar.setEnabled(false);
comprar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
comprarActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(250, 250, 250)
.addComponent(imgperso, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 138, Short.MAX_VALUE)
.addComponent(comprar, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap(22, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(imgperso, javax.swing.GroupLayout.PREFERRED_SIZE, 280, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(22, 22, 22))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addComponent(comprar, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))
);
jMenu1.setText("Voltar");
jMenu1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jMenu1MouseClicked(evt);
}
});
jMenuBar1.add(jMenu1);
setJMenuBar(jMenuBar1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
// TODO add your handling code here:
}//GEN-LAST:event_formWindowOpened
private void jMenu1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu1MouseClicked
// TODO add your handling code here:
TelaMenuPrincipal abrir = new TelaMenuPrincipal();
abrir.setVisible(true);
dispose();
}//GEN-LAST:event_jMenu1MouseClicked
private void tabpMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tabpMouseClicked
int linha = tabp.getSelectedRow();
if(linha>-1){
comprar.setEnabled(true);
id = (int) tabp.getValueAt(linha, 0);
SetImagem();
}
}//GEN-LAST:event_tabpMouseClicked
public void IniciarImg(){
usu.setIdusuario(IU.getIdusu());
up.setUsuarioID(usu);
try {
id = upDAO.AcharPato(up);
} catch (Exception ex) {
Logger.getLogger(TelaEscolhaPato.class.getName()).log(Level.SEVERE, null, ex);
}
}
public void SetImagem(){
if(id!=-1){
try {
pato = patoDAO.getPatoPorID(id);
} catch (Exception ex) {
Logger.getLogger(TelaEscolhaPato.class.getName()).log(Level.SEVERE, null, ex);
}
imgperso.setIcon(new javax.swing.ImageIcon(getClass().getResource(pato.getFoto())));
}
}
private void comprarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comprarActionPerformed
// TODO add your handling code here:
pato.Escolher(id);
Comprados();
}//GEN-LAST:event_comprarActionPerformed
private void formWindowActivated(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowActivated
// TODO add your handling code here:
Comprados();
}//GEN-LAST:event_formWindowActivated
public void Comprados(){
try {
tabp.setModel(upDAO.getTabelaComprados());
} catch (Exception ex) {
Logger.getLogger(TelaEscolhaPato.class.getName()).log(Level.SEVERE, null, ex);
}
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(TelaEscolhaPato.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(TelaEscolhaPato.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(TelaEscolhaPato.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(TelaEscolhaPato.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new TelaEscolhaPato().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton comprar;
private javax.swing.JLabel imgperso;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable tabp;
// End of variables declaration//GEN-END:variables
}
| [
"bruninho.carvalho159@gmail.com"
] | bruninho.carvalho159@gmail.com |
7ac376ff86eac05ff697591975a8da1f3841f4fe | 5bc9d8f92f38967cc9ecc03000c0606dbbb38f74 | /sca4j/spec/tags/sca-api-r1.0-0.4.5/src/main/java/org/osoa/sca/annotations/package-info.java | 90529a8415ef06a11d07332e372f03394b82dc30 | [] | no_license | codehaus/service-conduit | 795332fad474e12463db22c5e57ddd7cd6e2956e | 4687d4cfc16f7a863ced69ce9ca81c6db3adb6d2 | refs/heads/master | 2023-07-20T00:35:11.240347 | 2011-08-24T22:13:28 | 2011-08-24T22:13:28 | 36,342,601 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,988 | java | /**
* SCA4J
* Copyright (c) 2009 - 2099 Service Symphony Ltd
*
* Licensed to you under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. A copy of the license
* is included in this distrubtion or you may obtain a copy at
*
* http://www.opensource.org/licenses/apache2.0.php
*
* 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.
*
* This project contains code licensed from the Apache Software Foundation under
* the Apache License, Version 2.0 and original code from project contributors.
*
*
* Original Codehaus Header
*
* Copyright (c) 2007 - 2008 fabric3 project contributors
*
* Licensed to you under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. A copy of the license
* is included in this distrubtion or you may obtain a copy at
*
* http://www.opensource.org/licenses/apache2.0.php
*
* 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.
*
* This project contains code licensed from the Apache Software Foundation under
* the Apache License, Version 2.0 and original code from project contributors.
*
* Original Apache Header
*
* Copyright (c) 2005 - 2006 The Apache Software Foundation
*
* Apache Tuscany is an effort undergoing incubation at The Apache Software
* Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is
* required of all newly accepted projects until a further review indicates that
* the infrastructure, communications, and decision making process have stabilized
* in a manner consistent with other successful ASF projects. While incubation
* status is not necessarily a reflection of the completeness or stability of the
* code, it does indicate that the project has yet to be fully endorsed by the ASF.
*
* This product includes software developed by
* The Apache Software Foundation (http://www.apache.org/).
*/
/**
* SCA Common Annotations.
* <p/>
* Annotations that can be applied to Java code to provide additional meta-data about the SCA component type
* or configuration information for the implementation container. These are common annotations that
* are intended to provide consistent behaviour across different SCA implementation types but you should consult
* the documentation on each implementation type for a definition of how the annotation will be interpreted.
*/
package org.osoa.sca.annotations;
| [
"derekd@15bcc2b3-4398-4609-aa7c-97eea3cd106e"
] | derekd@15bcc2b3-4398-4609-aa7c-97eea3cd106e |
395f1ac8841561d3d889071627092990ccc0f75a | 2efc1d98607038013391eab032b99a10f62a2c4d | /src/main/java/com/ht/Main.java | 8e7eb5541590527199155362e11df826f0591602 | [] | no_license | bluesky2525/Social-Check | 88f4945e4624a06a8cecd90bec4140261873c310 | d51230418751dc5c1682a47256917ff21dba19c0 | refs/heads/master | 2021-09-15T16:43:38.485201 | 2018-06-07T03:01:21 | 2018-06-07T03:01:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,353 | java | package com.ht;
import java.io.File;
import java.io.IOException;
import java.util.List;
import javafx.application.Application;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
import com.ht.view.MainFrameController;
import javafx.scene.Scene;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.BorderPane;
public class Main extends Application {
private Stage primaryStage;
private BorderPane rootLayout;
@Override
public void start(Stage primaryStage) {
this.primaryStage = primaryStage;
this.primaryStage.setTitle("社保基数检查");
initRootLayout();
showMainview();
// try {
// BorderPane root = new BorderPane();
// Scene scene = new Scene(root,400,400);
// scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
// primaryStage.setScene(scene);
// primaryStage.show();
// } catch(Exception e) {
// e.printStackTrace();
// }
}
/**
* Initializes the root layout.
*/
public void initRootLayout() {
rootLayout = new BorderPane();
// Show the scene containing the root layout.
Scene scene = new Scene(rootLayout,600,400);
scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
primaryStage.setScene(scene);
primaryStage.show();
}
/**
* Shows the person overview inside the root layout.
*/
public void showMainview() {
try {
// Load person overview.
FXMLLoader loader = new FXMLLoader();
loader.setLocation(Main.class.getResource("view/MainFrame.fxml"));
AnchorPane personOverview = (AnchorPane) loader.load();
// Set person overview into the center of root layout.
rootLayout.setCenter(personOverview);
// Give the controller access to the main app.
MainFrameController controller = (MainFrameController)loader.getController();
controller.setMainApp(this);
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* Returns the main stage.
* @return
*/
public Stage getPrimaryStage() {
return primaryStage;
}
public static void main(String[] args) {
launch(args);
}
}
| [
"wangxz@aigongzuo.com"
] | wangxz@aigongzuo.com |
cafe39e314850cb788e9b1a9786544d697a0212e | dcaff2751db87bc47992f1df31b9e444ea9673ee | /3.JavaMultithreading/src/com/javarush/task/task27/task2712/Tablet.java | f7578dc009291fb60427ed201eb51227fbdca50b | [] | no_license | ygreksh/JavaRushTasks | 629ec9f0216b139d9134e2f0a160690b1af21dd4 | 3b8c0fd46d0b6740321d748580715a31b02fce22 | refs/heads/master | 2021-01-22T12:49:09.857400 | 2017-11-22T10:59:24 | 2017-11-22T10:59:24 | 102,356,387 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,903 | java | package com.javarush.task.task27.task2712;
import com.javarush.task.task27.task2712.ad.AdvertisementManager;
import com.javarush.task.task27.task2712.ad.NoVideoAvailableException;
import com.javarush.task.task27.task2712.kitchen.Order;
import com.javarush.task.task27.task2712.statistic.StatisticManager;
import com.javarush.task.task27.task2712.statistic.event.NoAvailableVideoEventDataRow;
import com.javarush.task.task27.task2712.statistic.event.VideoSelectedEventDataRow;
import java.io.IOException;
import java.util.Observable;
import java.util.logging.Level;
import java.util.logging.Logger;
public class Tablet extends Observable{
final int number;
public static Logger logger = Logger.getLogger(Tablet.class.getName());
public Order createOrder(){
Order order = null;
try {
order = new Order(this);
if (!order.isEmpty()) {
setChanged();
notifyObservers(order);
AdvertisementManager advertisementManager = new AdvertisementManager(order.getTotalCookingTime()*60);
try {
//StatisticManager.getInstance().register(new VideoSelectedEventDataRow(advertisementManager.));
advertisementManager.processVideos();
} catch (NoVideoAvailableException e) {
//StatisticManager.getInstance().register(new NoAvailableVideoEventDataRow(order.getTotalCookingTime()*60));
logger.log(Level.INFO, "No video is available for the order " + order);
}
}
return order;
} catch (IOException e) {
logger.log(Level.SEVERE,"Console is unavailable.");
return null;
}
}
public Tablet(int number) {
this.number = number;
}
@Override
public String toString() { return "Tablet{number=" + number + "}"; }
}
| [
"ygreksh"
] | ygreksh |
52df416f226c68e9577eafd42cd8eb0b5ad13128 | 8374135dce5bfa75a36c8b490460bd2fb2ffed6d | /src/main/java/com/sh/shdemo/Service/Receiver/TopicReceiver2.java | 8930ced54bc40fe9344e174d8310c027cf065c79 | [] | no_license | john-cpu/shdemo1 | 78ab6c716caf3da88a30cfbb885c12a2e6fc9c9c | 2227058b99173bbc43f8d2b0c68d2d6ff25bb31a | refs/heads/master | 2022-06-29T21:24:03.240879 | 2019-07-19T07:48:19 | 2019-07-19T07:48:19 | 193,200,009 | 0 | 0 | null | 2022-06-21T01:19:44 | 2019-06-22T06:30:43 | Java | UTF-8 | Java | false | false | 425 | java | package com.sh.shdemo.Service.Receiver;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
@Component
@RabbitListener(queues = "topic.message2")
public class TopicReceiver2 {
@RabbitHandler
public void process(String msg) {
System.out.println("TopicReceiver2 :" + msg);
}
}
| [
"1584911398@qq.com"
] | 1584911398@qq.com |
5da6fb5a15e31f9087b55abbb40b381d23db0a42 | f9b68e91fa085ed40b2eac6aa83db98e23c8a148 | /app/src/main/java/com/example/automaticotpretrieval/OTPActivity.java | dc819cf24dacaa93ca8dd28bee3bb2f94fd3e0ae | [] | no_license | Mushahid2521/Automatic_OTP_retrieval_in_Android | 9ebf7a3e73ae2dcbd3d27490383bb8b7d9f0a156 | ed4594c1a3790c94f72e40b4f052636d872e66f4 | refs/heads/master | 2022-12-04T23:22:41.119005 | 2020-08-21T05:08:48 | 2020-08-21T05:08:48 | 286,504,291 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,139 | java | package com.example.automaticotpretrieval;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
import java.util.regex.*;
import com.google.android.gms.auth.api.phone.SmsRetriever;
import com.google.android.gms.auth.api.phone.SmsRetrieverClient;
import com.google.android.gms.common.api.CommonStatusCodes;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task;
public class OTPActivity extends AppCompatActivity implements SMSReceiver.OTPReceiveListener{
private SMSReceiver smsReceiver;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_o_t_p);
startSMSListener();
}
private void startSMSListener() {
try {
smsReceiver = new SMSReceiver();
smsReceiver.setOTPListener(this);
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(SmsRetriever.SMS_RETRIEVED_ACTION);
this.registerReceiver(smsReceiver, intentFilter);
SmsRetrieverClient client = SmsRetriever.getClient(this);
Task<Void> task = client.startSmsRetriever();
task.addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
// API successfully started
Log.v("Hereeeeeee", "Successfully started api listner");
}
});
task.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
// Fail to start API
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onOTPReceived(String otp) {
showToast("OTP Received: " + otp);
if (smsReceiver != null) {
unregisterReceiver(smsReceiver);
smsReceiver = null;
}
// TODO: Send the OTP to the sever for Verification
if (otp.equals("1234567")) {
Intent intent = new Intent(OTPActivity.this, SuccessActivity.class);
startActivity(intent);
}
}
@Override
public void onOTPTimeOut() {
showToast("OTP Time out");
}
@Override
public void onOTPReceivedError(String error) {
showToast(error);
}
@Override
protected void onDestroy() {
super.onDestroy();
if (smsReceiver != null) {
unregisterReceiver(smsReceiver);
}
}
private void showToast(String msg) {
Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
}
} | [
"mushahidshamim@gmail.com"
] | mushahidshamim@gmail.com |
d2fbaefbfa3a863b84213b97491c65d48ca2c8fb | 4bfaee4e882214e2daf32a4c50affc0386e12707 | /JRPG/src/com/jsandusky/util/GNullable.java | 0bd78b88611ab9652986fc53583b2a64ecdb5f28 | [
"Apache-2.0"
] | permissive | mmmika/GdxJRPG | 2120ff0d407137d6a736a52d4d90d0a8e5c9e40c | d961925e29657d4baf93aff9b464829ae31c0919 | refs/heads/master | 2021-01-18T17:14:36.737945 | 2013-10-17T01:43:30 | 2013-10-17T01:43:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 335 | java | package com.jsandusky.util;
public class GNullable<T> {
T value_;
public GNullable() {
}
public GNullable(T val) {
set(val);
}
public boolean isNull() {
return value_ == null;
}
public T value() {
return value_;
}
public void set(T arg) {
value_ = arg;
}
public void reset() {
value_ = null;
}
}
| [
"jonathan@jsandusky.com"
] | jonathan@jsandusky.com |
a45a419639dd9aff179b809ba4cc651e15872b74 | 05331a56f11478bfcb7c8fec137343bfddb64ccc | /src/com/behavior/strategy/Test.java | ebe1a6c8338e0864c5389360fabfacecbad11c23 | [] | no_license | xujiuhua/design-pattern | 3803c26fd528e1e335773db5f03aec872a5a682a | dc1634a0d84bdf9e19af16a41def5c8e32612d99 | refs/heads/master | 2020-11-29T10:59:25.716727 | 2020-02-24T15:24:10 | 2020-02-24T15:24:10 | 230,097,859 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,016 | java | package com.behavior.strategy;
/**
* <p></p>
*
* @author jiuhua.xu
* @version 1.0
* @since JDK 1.8
*/
public class Test {
public static void main(String[] args) {
Player player1 = new Player("zs", new WinningStrategy(100));
Player player2 = new Player("ls", new WinningStrategy(200));
for (int i = 0; i < 100; i++) {
Hand hand1 = player1.netHand();
Hand hand2 = player2.netHand();
if (hand1.isStrongerThan(hand2)) {
System.out.println("Winner:" + player1);
player1.win();
player2.lose();
} else if (hand1.isWeakThan(hand2)) {
System.out.println("Winner:" + player2);
player2.win();
player1.lose();
} else {
System.out.println("Even...");
player1.even();
player2.even();
}
}
System.out.println(player1);
System.out.println(player2);
}
}
| [
"xujiuhuamoney@163.com"
] | xujiuhuamoney@163.com |
20c7b2a588d2899c67cb9ca37f7c209d41870045 | 5a61e3a36bc387ec308b34dc4ce8b3560629656c | /Leitura.java | 447c14ea73d3a5860a30a3feb09a2a2aa74ec2f4 | [] | no_license | Alexkondera134/java | a30b6253f1071e2ba3ffcc4ee79f919317cd2813 | a375cdcd5c64d007b50a1ec2df4c4c1843c1ecd7 | refs/heads/main | 2023-07-19T03:55:21.967072 | 2021-08-06T12:43:44 | 2021-08-06T12:43:44 | 393,040,393 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 597 | java | import java.util.Scanner;
public class Leitura{
public static void main(String args[]){
Scanner teclado;
teclado = new Scanner(System.in);
int valorInteiro;
double valorDouble;
float valorFloat;
System.out.println("Digite um valor inteiro:");
valorInteiro = teclado.nextInt();
System.out.println("Agora digite um valor decimal");
valorDouble = teclado.nextDouble();
System.out.println("Valor digitado = "+valorInteiro);
System.out.println("Valor digitado = "+valorDouble);
}
} | [
"noreply@github.com"
] | Alexkondera134.noreply@github.com |
9fa4c8bab4ef50e9b4748f861d12d3aa12c25a5d | f29969ffbf7008c0d625fc3c88b12a992f3b3b12 | /src/it/unitn/disi/giugno2018/torrehannoi.java | 9ada17cc3fc44a38719ea454e7f1a08a980ca6c8 | [] | no_license | lbottona/UNITN-lingProg-Torre_Hanoi | cc000f834ac9d892fd30796bbe2f23e8bd4d2620 | 675a178b0a9f6c15f9fed7ef82a10f0ef56a29de | refs/heads/master | 2023-03-15T21:04:55.054868 | 2019-07-05T11:45:30 | 2019-07-05T11:45:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,570 | java | /*
* 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 it.unitn.disi.giugno2018;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.Event;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.ColumnConstraints;
import javafx.scene.layout.CornerRadii;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
public class torrehannoi extends Application {
Stage mainWindow = null;
Palo p1 = null;
Palo p2 = null;
Palo p3 = null;
Disco disco1 = null;
Disco disco2 = null;
Disco disco3 = null;
Disco disco4 = null;
Disco discoAppoggio = null;
MyTextBox txtFrom = null;
MyTextBox txtTo = null;
Palo paloPartenza = null;
Palo paloArrivo = null;
Alert alert = new Alert(AlertType.WARNING);
BorderPane prepareSceneContent()
{
Palo paloPartenza = null;
Palo paloArrivo = null;
BorderPane root = new BorderPane();
MyButton btnClose = new MyButton("Close", true, new ListenerClose());
VBox vbVerticaleSx = new VBox();
vbVerticaleSx.setAlignment(Pos.CENTER_LEFT);
vbVerticaleSx.getChildren().add(btnClose);
HBox hbSuperiore = new HBox();
hbSuperiore.setAlignment(Pos.CENTER);
Label lblFrom = new Label("FROM");
Label lblTo = new Label("TO");
txtFrom = new MyTextBox("",true);
txtTo = new MyTextBox("",true);
MyButton btnClear = new MyButton("Clear", false, new ListenerClear());
hbSuperiore.getChildren().addAll(lblFrom,txtFrom,lblTo,txtTo,btnClear);
MyButton btnReset = new MyButton("Reset", false, new ListenerReset());
VBox vbVerticaleDx = new VBox();
vbVerticaleDx.setAlignment(Pos.CENTER_RIGHT);
vbVerticaleDx.getChildren().add(btnReset);
HBox hbInferiore = new HBox();
hbInferiore.setAlignment(Pos.CENTER);
MyButton btnMove = new MyButton("Move",false, new ListenerMove());
hbInferiore.getChildren().add(btnMove);
GridPane gpCentrale = new GridPane();
gpCentrale.setBackground(new Background(new BackgroundFill(Color.LIGHTGRAY, CornerRadii.EMPTY, Insets.EMPTY)));
p1= new Palo("p1");
p2= new Palo("p2");
p3= new Palo("p3");
gpCentrale.add(p1, 0, 0);
gpCentrale.add(p2, 1, 0);
gpCentrale.add(p3, 2, 0);
gpCentrale.setAlignment(Pos.CENTER);
disco1 = new Disco(1,Color.GREEN);
disco2 = new Disco(2,Color.BLUE);
disco3 = new Disco(3,Color.RED);
disco4 = new Disco(4,Color.YELLOW);
p1.aggiungi(disco1);
p1.aggiungi(disco2);
p1.aggiungi(disco3);
p1.aggiungi(disco4);
p1.addEventHandler(MouseEvent.MOUSE_CLICKED, new ListenerPali());
p2.addEventHandler(MouseEvent.MOUSE_CLICKED, new ListenerPali());
p3.addEventHandler(MouseEvent.MOUSE_CLICKED, new ListenerPali());
root.setTop(hbSuperiore);
root.setLeft(vbVerticaleSx);
root.setRight(vbVerticaleDx);
root.setCenter(gpCentrale);
root.setBottom(hbInferiore);
return root;
}
class ListenerClose implements EventHandler {
public void handle(Event t) {
}
}
class ListenerClear implements EventHandler {
public void handle(Event t) {
txtFrom.setText("");
txtTo.setText("");
paloPartenza = null;
paloArrivo = null;
}
}
class ListenerReset implements EventHandler {
public void handle(Event t) {
p1.reset();
p2.reset();
p3.reset();
p1.aggiungi(disco1);
p1.aggiungi(disco2);
p1.aggiungi(disco3);
p1.aggiungi(disco4);
txtFrom.setText("");
txtTo.setText("");
paloPartenza = null;
paloArrivo = null;
}
}
class ListenerMove implements EventHandler {
public void handle(Event t) {
if (txtFrom.getText().equals("") || txtTo.getText().equals(""))
{
erroreTextBoxVuote();
}
else
{
discoAppoggio = paloPartenza.rimuoviUltimo();
boolean risultato = paloArrivo.aggiungi(discoAppoggio);
if (risultato == false)
{
paloPartenza.aggiungi(discoAppoggio);
alert.setTitle("ATTENZIONE");
alert.setHeaderText("ATTENZIONE!!");
alert.setContentText("Impossibile appoggiare un disco su uno più piccolo");
alert.showAndWait();
}
txtFrom.setText("");
txtTo.setText("");
paloPartenza = null;
paloArrivo = null;
}
}
private void erroreTextBoxVuote()
{
alert.setTitle("ATTENZIONE");
alert.setHeaderText("ATTENZIONE!!");
alert.setContentText("pali di partenza e di arrivo non definiti");
alert.showAndWait();
}
}
class ListenerPali implements EventHandler {
public void handle(Event t) {
String sorgente = t.getSource().toString();
if (txtFrom.getText().equals("") && txtTo.getText().equals(""))
{
switch(sorgente)
{
case "p1":
if(!p1.isEmpty())
{
paloPartenza = p1;
txtFrom.setText(paloPartenza.getNome());
}
else
errorePaloPartenza();
break;
case "p2":
if(!p2.isEmpty())
{
paloPartenza = p2;
txtFrom.setText(paloPartenza.getNome());
}
else
errorePaloPartenza();
break;
case "p3":
if(!p3.isEmpty())
{
paloPartenza = p3;
txtFrom.setText(paloPartenza.getNome());
}
else
errorePaloPartenza();
break;
}
}
else if (!txtFrom.getText().equals("") && txtTo.getText().equals(""))
{
switch(sorgente)
{
case "p1":
if(!p1.equals(paloPartenza))
{
paloArrivo = p1;
txtTo.setText(paloArrivo.getNome());
}
else
errorePaloArrivo();
break;
case "p2":
if(!p2.equals(paloPartenza))
{
paloArrivo = p2;
txtTo.setText(paloArrivo.getNome());
}
else
errorePaloArrivo();
break;
case "p3":
if(!p3.equals(paloPartenza))
{
paloArrivo = p3;
txtTo.setText(paloArrivo.getNome());
}
else
errorePaloArrivo();
break;
}
}
else if(!txtFrom.getText().equals("") && !txtTo.getText().equals(""))
{
errorePaliGiaDefiniti();
}
}
private void errorePaloPartenza()
{
alert.setTitle("ATTENZIONE");
alert.setHeaderText("ATTENZIONE!!");
alert.setContentText("Il palo di partenza non può essere vuoto");
alert.showAndWait();
}
private void errorePaloArrivo()
{
alert.setTitle("ATTENZIONE");
alert.setHeaderText("ATTENZIONE!!");
alert.setContentText("il palo di partenza e quello di destinazione non possono coincidere");
alert.showAndWait();
}
private void errorePaliGiaDefiniti()
{
alert.setTitle("ATTENZIONE");
alert.setHeaderText("ATTENZIONE!!");
alert.setContentText("il palo di partenza e quello di destinazione sono già definiti");
alert.showAndWait();
}
}
/**
* BOTTONI
*/
class MyButton extends Button {
MyButton(String label, boolean isDisabled, EventHandler listener) {
super(label);
setMinSize(20, 20);
setDisable(isDisabled);
addEventHandler(ActionEvent.ACTION, listener);
}
}
/**
*
*/
class MyTextBox extends TextField
{
MyTextBox(String label, boolean isDisable)
{
super(label);
this.setDisable(isDisable);
}
}
public void start(Stage primaryStage) {
Scene scene = new Scene(this.prepareSceneContent(), 800, 500);
mainWindow = primaryStage;
primaryStage.setTitle("Torre Hanoi");
primaryStage.setScene(scene);
primaryStage.centerOnScreen();
primaryStage.show();
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}
| [
"39135429+Pater999@users.noreply.github.com"
] | 39135429+Pater999@users.noreply.github.com |
3e58804449e45b28175b2012093296f4e9ce934c | 8e507174ef6e0894fb3e4e6571db570575f53836 | /src/main/java/com/ua/passlocker/auth/controller/UserController.java | 738fa9338cc8aa14f45374f1a8a890fcbc3dc0db | [
"MIT"
] | permissive | itsaviu/passlocker-auth | b0ae00c2bb70358b03a9a41a7e11e770b4932541 | ee9ca3ed258287753499771f3dc363abadc7d2e5 | refs/heads/master | 2020-12-14T22:33:52.338213 | 2020-02-08T17:54:05 | 2020-02-08T17:54:05 | 234,894,021 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,321 | java | package com.ua.passlocker.auth.controller;
import com.fasterxml.jackson.annotation.JsonView;
import com.ua.passlocker.auth.models.dto.UserDetailReq;
import com.ua.passlocker.auth.service.UserService;
import com.ua.passlocker.auth.views.Views;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class UserController {
@Autowired
private UserService userService;
@PostMapping("/users")
@JsonView({Views.UserViews.class})
public ResponseEntity fetchUsers(@RequestBody UserDetailReq userDetailReq) {
return ResponseEntity.ok(userService.fetchUsers(userDetailReq));
}
@GetMapping("/user")
@JsonView({Views.UserViews.class})
public ResponseEntity fetchCurrentUser() {
return ResponseEntity.ok(userService.fetchCurrentUser(SecurityContextHolder.getContext().getAuthentication().getPrincipal().toString()));
}
}
| [
"avinash.umasankaramoorthy@coda.global"
] | avinash.umasankaramoorthy@coda.global |
8999a5f08aefe9933a7f483209f5d65476dfe5e1 | cbf0c8e0d7bea55f302f8b3c6f7d2faceb9e70d2 | /app/src/main/java/gaugler/backitude/listener/BatteryListener.java | 6c1df51618b4d0333346e71d873ab2b62eb528a3 | [] | no_license | backitude/Backitude | 7983eca97119982ebebe9e36dad7fd2af9b56c25 | d314c967049c8b7333dd5269005fdfb8584c2a56 | refs/heads/master | 2020-03-19T09:05:16.068226 | 2018-06-06T02:29:04 | 2018-06-06T02:29:04 | 136,259,155 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,274 | java | package gaugler.backitude.listener;
import gaugler.backitude.constants.PersistedData;
import gaugler.backitude.constants.Prefs;
import gaugler.backitude.service.ServiceManager;
import gaugler.backitude.util.ZLogger;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
public class BatteryListener extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent arg1) {
ZLogger.log("BatteryListener onReceive");
boolean isCharging = false;
boolean oldIsCharging = false;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext());
if (arg1.getAction().equals(Intent.ACTION_POWER_CONNECTED)){
ZLogger.log("BatteryListener: Device is docked");
isCharging = true;
// example, Intent.ACTION_BATTERY_CHANGED
// Battery Level: (String.valueOf(arg1.getIntExtra("level", 0)) + "%");
// Voltage: (String.valueOf((float)arg1.getIntExtra("voltage", 0)/1000) + "V");
// Temperature: (String.valueOf((float)arg1.getIntExtra("temperature", 0)/10) + "c");
// Technology: (arg1.getStringExtra("technology"));
// get BatteryManager.BATTERY_STATUS_UNKNOWN
// Options:
// BatteryManager.BATTERY_STATUS_CHARGING;
// BatteryManager.BATTERY_STATUS_DISCHARGING)
// BatteryManager.BATTERY_STATUS_NOT_CHARGING){
// BatteryManager.BATTERY_STATUS_FULL){
// Health = arg1.getIntExtra("health", BatteryManager.BATTERY_HEALTH_UNKNOWN);
// Options:
// BatteryManager.BATTERY_HEALTH_GOOD
// BatteryManager.BATTERY_HEALTH_OVERHEAT
// BatteryManager.BATTERY_HEALTH_DEAD
// BatteryManager.BATTERY_HEALTH_OVER_VOLTAGE
// BatteryManager.BATTERY_HEALTH_UNSPECIFIED_FAILURE
}
else {
isCharging = false;
ZLogger.log("BatteryListener: Device is UN-docked");
}
if(prefs!=null)
{
oldIsCharging = prefs.getBoolean(PersistedData.KEY_isCharging, false);
if(isCharging!=oldIsCharging)
{
ZLogger.log("BatteryListener: Device docked status is different then before");
SharedPreferences.Editor editor = prefs.edit();
editor.putBoolean(PersistedData.KEY_isCharging, isCharging);
editor.commit();
boolean realtimeEnabled = prefs.getBoolean(Prefs.KEY_realtime, false);
boolean isEnabled = prefs.getBoolean(Prefs.KEY_appEnabled, false);
boolean isWifiModeRunning = prefs.getBoolean(PersistedData.KEY_wifiModeRunning, false);
/*
* If RealTime updating is enabled and the application is enabled,
* and if we're in here, the charging status changed
* So we need to restart the alarm service to change the alarm as applicable
*/
if(isEnabled && realtimeEnabled && !isWifiModeRunning){
ZLogger.log("BatteryListener: docked status changed AND realtime updating is effected");
ServiceManager appStarter = new ServiceManager();
appStarter.startAlarmsWithDelay(context.getApplicationContext());
}
else
{
ZLogger.log("BatteryListener: Device status changed but dont matter- doesnt affect realtime");
}
}
else
{
ZLogger.log("BatteryListener: Device status is the same as previous, do nothing");
}
}
}
} | [
"backitude@gmail.com"
] | backitude@gmail.com |
188d392a57604843a20c2fb990a1440623c25fb8 | 5a8efd1d145f7de345d9a119605771b50624bdcc | /ch07-mocks/src/main/java/com/manning/junitbook/ch07/mocks/account/DefaultAccountManager2.java | fa4b203e7f6fd26bb141b4a1e2d04eb4bbd2f205 | [] | no_license | a0248327/JUnit | f25909305bf5beab28d75887df54716e8364c3d1 | ed283acb43c445c03b80c6ab394b3440622674d4 | refs/heads/master | 2020-05-18T12:42:10.176913 | 2015-02-25T13:35:50 | 2015-02-25T13:35:50 | 31,142,296 | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 2,659 | java | /*
* ========================================================================
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ========================================================================
*/
package com.manning.junitbook.ch07.mocks.account;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.manning.junitbook.ch07.mocks.configurations.Configuration;
import com.manning.junitbook.ch07.mocks.configurations.DefaultConfiguration;
/**
* Refactored architecture. We now pass the Configuration and Log objects to the
* constructor and use them for our own logic.
*
* @version $Id: DefaultAccountManager2.java 508 2009-08-16 18:05:18Z paranoid12
* $
*/
public class DefaultAccountManager2 implements AccountManager {
/**
* Logger instance.
*/
private Log logger;
/**
* Configuration to use.
*/
private Configuration configuration;
/**
* Constructor with no parameters.
*/
public DefaultAccountManager2() {
this(LogFactory.getLog(DefaultAccountManager2.class), new DefaultConfiguration("technical"));
}
/**
* Constructor with logger and configration parameters.
*
* @param logger
* @param configuration
*/
public DefaultAccountManager2(Log logger, Configuration configuration) {
this.logger = logger;
this.configuration = configuration;
}
/**
* Finds an account for user with the given userID.
*
* @param
*/
public Account findAccountForUser(String userId) {
this.logger.debug("Getting account for user [" + userId + "]");
this.configuration.getSQL("FIND_ACCOUNT_FOR_USER");
// Some code logic to load a user account using JDBC
// […]
return null;
}
/**
* Updates the given account.
*/
public void updateAccount(Account account) {
// Perform database access here
}
}
| [
"muxin_email@hotmail.com"
] | muxin_email@hotmail.com |
51bd1bafc7adae91ea3725e8e47f96a0f3135801 | c35e1ac31da97c0fe4fc7f738ac872a72a35cfa4 | /app/src/androidTest/java/cs407_mobile/prototype/ExampleInstrumentedTest.java | ef31d5a93f5466a76a3f94926540cb4def2622e0 | [] | no_license | blakeyp/prototype | 488a3216532c9fafda31ca4b8178baa59e5bbc0f | 63f7c3a3fa00eb0eaca850f747379be7662edde8 | refs/heads/master | 2021-07-22T17:18:27.982417 | 2017-11-01T12:17:04 | 2017-11-01T12:17:04 | 106,825,148 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 748 | java | package cs407_mobile.prototype;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("cs407_mobile.prototype", appContext.getPackageName());
}
}
| [
"blakeyp@hotmail.co.uk"
] | blakeyp@hotmail.co.uk |