blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
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
listlengths
1
1
author_id
stringlengths
0
313
61e89e003e00354fa99b7d590f57eb6a4ac413c3
6c951b44a0900ff7dd420ca42557b7f4d8ab6238
/OOD/src/Report/NeededReport.java
d97c8595a38d3e8a99e8466367e2bebd50d3c593
[]
no_license
elhaam/OOD
eb684ee220ae419ac2d5e998ed7e5643c7f198aa
522db2b0a999c7b88462742fb68718562845792d
refs/heads/master
2021-05-31T20:08:24.531758
2016-07-16T16:54:02
2016-07-16T16:54:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
489
java
package Report; import java.util.ArrayList; import DB.DataSource; import DB.Driver; public class NeededReport { private static NeededReport self = null; private Driver db; public static NeededReport getInstance() { if (self == null) { return new NeededReport(); } return self; } private NeededReport() { db = Driver.getInstance(); } public ArrayList<String[]> generateReport() { ArrayList<String[]> result = new ArrayList<>(); // TODO return result; } }
[ "yeganeghayour@gmail.com" ]
yeganeghayour@gmail.com
99b50216a3636781967131a4a73bc9893be7b1c6
ee393dcd8c46511a72ebc38a58371c7f10a72703
/src/java/modelo/LoginBean1.java
0d23b728c4184d106fc5ce015c465ae8f8efbacf
[]
no_license
silvinaG/Ejemplos
8b1194b1c95c18ebed3779b97f99a7b0470b6869
5e761402971df0f0f6c273285a346012ef50279e
refs/heads/master
2020-04-08T12:19:04.907836
2014-04-22T02:42:26
2014-04-22T02:42:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
822
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package modelo; import javax.inject.Named; import javax.enterprise.context.SessionScoped; import java.io.Serializable; /** * * @author Federico */ @Named(value = "loginBean1") @SessionScoped public class LoginBean1 implements Serializable { private String user; private String clave; /** * Creates a new instance of LoginBean1 */ public LoginBean1() { } public String getUser() { return user; } public void setUser(String user) { this.user = user; } public String getClave() { return clave; } public void setClave(String clave) { this.clave = clave; } }
[ "Alumno@GOMEZSILVINAe" ]
Alumno@GOMEZSILVINAe
aa2b2359cacf7da1a16cd6f9701b22a1bab4a362
cfe620210d8ef202ba18e82549ba4ba20f9d9764
/demo1111/src/test/java/com/wsf/demo/myThread/base/sync005/SyncDubbo2.java
132cce4e79d65cdacd7d3314a1a80687e7436e3b
[]
no_license
wsfgo/Demo
2f3c38fe786da58a86618c1a540abffa83dba6ed
b958ade3566ec9b6887dd34ab880828b9c0136de
refs/heads/master
2020-04-08T18:33:52.998460
2018-11-29T06:28:42
2018-11-29T06:28:42
159,613,816
0
0
null
null
null
null
UTF-8
Java
false
false
883
java
package com.wsf.demo.myThread.base.sync005; /** * synchronized的重入 * @author alienware * */ public class SyncDubbo2 { static class Main { public int i = 10; public synchronized void operationSup(){ try { i--; System.out.println("Main print i = " + i); Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } } } static class Sub extends Main { public synchronized void operationSub(){ try { while(i > 0) { i--; System.out.println("Sub print i = " + i); Thread.sleep(100); this.operationSup(); } } catch (InterruptedException e) { e.printStackTrace(); } } } public static void main(String[] args) { Thread t1 = new Thread(new Runnable() { @Override public void run() { Sub sub = new Sub(); sub.operationSub(); } }); t1.start(); } }
[ "shufa.wang@changhong.com" ]
shufa.wang@changhong.com
c7a8ca44fde4b201f855f66b1185cb88438e9335
1358f84a31c3bb4e7462da30d1f2591618456a04
/pinyougou-service/pinyougou-order-service/src/main/java/com/pinyougou/order/service/impl/OrderServiceImpl.java
ec4aaf3d4356278e55c753b2eb7e966c1fac89c0
[]
no_license
zhangjingxue1/myTest
7229b325808c0d251575887bbadb99f617081005
729b4e55f9a2f89a8367d8e05b8e12b3361a597c
refs/heads/master
2020-04-08T21:27:08.969264
2018-11-30T00:54:46
2018-11-30T00:54:46
159,744,861
0
0
null
null
null
null
UTF-8
Java
false
false
14,369
java
package com.pinyougou.order.service.impl; import java.util.Date; import com.alibaba.dubbo.config.annotation.Service; import com.github.pagehelper.ISelect; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.pinyougou.cart.Cart; import com.pinyougou.cart.CheckCart; import com.pinyougou.common.util.IdWorker; import com.pinyougou.mapper.OrderItemMapper; import com.pinyougou.mapper.OrderMapper; import com.pinyougou.mapper.PayLogMapper; import com.pinyougou.mapper.SellerMapper; import com.pinyougou.pojo.Order; import com.pinyougou.pojo.OrderItem; import com.pinyougou.pojo.PageResult; import com.pinyougou.pojo.PayLog; import com.pinyougou.service.OrderService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.transaction.annotation.Transactional; import java.io.Serializable; import java.math.BigDecimal; import java.util.*; @Service(interfaceName = "com.pinyougou.service.OrderService") @Transactional public class OrderServiceImpl implements OrderService { @Autowired private OrderMapper orderMapper; @Autowired private OrderItemMapper orderItemMapper; @Autowired private IdWorker idWorker; @Autowired private RedisTemplate<String, Object> redisTemplate; @Autowired private PayLogMapper payLogMapper; @Autowired private SellerMapper sellerMapper; /** * 保存订单 */ @Override public void save(Order order) { try { //定义订单ID集合(一次支付对应多个订单) List<String> orderIdList = new ArrayList<>(); //定义多个订单支付的总金额(元) double totalMoney = 0; //迭代购物车数据 // 根据用户名获取Redis中购物车数据 List<Cart> carts = (List<Cart>) redisTemplate .boundValueOps("cart_" + order.getUserId()).get(); //获取选中的购物车 List<CheckCart> checkCarts = (List<CheckCart>) redisTemplate.boundValueOps("checkCart" + order.getUserId()).get(); //如果是全选状态把所有全选的结算了 for (Cart cart : carts) { if ("1".equals(cart.getIsCheckedAll())) { totalMoney = getTotalMoney(order, orderIdList, totalMoney, cart); } /* 这个会报错的!会触发ConcurrentModificationException异常。 这就是你在操作这个对象的同时又去做另外一个操作,打个比方就是银行里你存了100块钱,你去取50块钱,这是在操作这个100块钱的对象, 然后你媳妇又在同时去存50块钱,那这样她也在操作这100块钱的对象,所以就出现了问题,肯定是要操作完了才能做其他的操作吧。 for (OrderItem orderItem : cart.getOrderItems()) { //不是全选状态把选中的购物车 for (CheckCart checkCart : checkCarts) { List<OrderItem> checkItems = checkCart.getCheckItems(); for (OrderItem checkItem : checkItems) { if (checkItem.getItemId().equals(orderItem.getItemId())) { oItems.add(orderItem); cart.getOrderItems().remove(orderItem); } } } }*/ //不是全选就获取选中购物车的商品去购物车商品中删除掉 Iterator<OrderItem> iterator = cart.getOrderItems().iterator(); while (iterator.hasNext()) { OrderItem next = iterator.next(); for (CheckCart checkCart : checkCarts) { Iterator<OrderItem> checkItems = checkCart.getCheckItems().iterator(); while (checkItems.hasNext()) { OrderItem checkItem = checkItems.next(); if (next.getItemId().equals(checkItem.getItemId())) { iterator.remove(); } } } } totalMoney = getTotalMoney(order, orderIdList, totalMoney, cart); //判断是否为微信支付 if ("1".equals(order.getPaymentType())) { //创建支付日志对象 PayLog payLog = new PayLog(); //生成订单交易号 String outTradeNo = String.valueOf(idWorker.nextId()); //设置订单交易号 payLog.setOutTradeNo(outTradeNo); //创建时间 payLog.setCreateTime(new Date()); //支付总金额(分) payLog.setTotalFee((long) (totalMoney * 100)); //用户id payLog.setUserId(order.getUserId()); //支付状态 payLog.setTradeState("0"); //订单号集合,逗号分隔 String ids = orderIdList.toString() .replace("[", "") .replace("]", "") .replace(" ", ""); //设置订单号 payLog.setOrderList(ids); //支付类型 payLog.setPayType("1"); //往支付日志表插入数据(这里设置的不合理吧, //只是方便自己获取订单的支付日志,不方便以后扩展啊, //感觉应该根据订单id存取但是会有多个订单) payLogMapper.insertSelective(payLog); //存入缓存 redisTemplate.boundValueOps("payLog_" + order.getUserId()).set(payLog); //全选就删除该用户购物车中所有的数据 if ("1".equals(cart.getIsCheckedAll())) { redisTemplate.delete("cart_" + order.getUserId()); } } } //不是全选就重写设置新的值 redisTemplate.boundValueOps("cart_" + order.getUserId()).set(carts); //最终都要删除选中购物车 redisTemplate.delete("checkCart" + order.getUserId()); } catch (Exception e) { throw new RuntimeException(e); } } /** * 获取支付总金额 */ private double getTotalMoney(Order order, List<String> orderIdList, double totalMoney, Cart cart) { /** 往订单表插入数据利用idWorder */ //生成订单主键id long orderId = idWorker.nextId(); Order order1 = new Order(); // 设置订单id order1.setOrderId(orderId); // 设置支付类型 order1.setPaymentType(order.getPaymentType()); // 设置支付状态码为“未支付” order1.setStatus("1"); // 设置订单创建时间 order1.setCreateTime(new Date()); // 设置订单修改时间 order1.setUpdateTime(order1.getCreateTime()); // 设置用户名 order1.setUserId(order.getUserId()); // 设置收件人地址 order1.setReceiverAreaName(order.getReceiverAreaName()); // 设置收件人手机号码 order1.setReceiverMobile(order.getReceiverMobile()); // 设置收件人 order1.setReceiver(order.getReceiver()); // 设置订单来源 order1.setSourceType(order.getSourceType()); // 设置商家id order1.setSellerId(cart.getSellerId()); //定义该订单的总金额 double money = 0; //往订单明细表插入数据 for (OrderItem orderItem : cart.getOrderItems()) { //设置主键id orderItem.setId(idWorker.nextId()); //设置关联的订单id orderItem.setOrderId(orderId); //累积总金额 money += orderItem.getTotalFee().doubleValue(); //保存到订单明细表数据库 orderItemMapper.insertSelective(orderItem); } //设置支付总金额 order1.setPayment(new BigDecimal(money)); //保存数据到订单表 orderMapper.insertSelective(order1); //记录订单id orderIdList.add(String.valueOf(orderId)); //记录总金额 totalMoney += money; return totalMoney; } /** * 根据用户id从redis中获取数据 */ @Override public PayLog findPayLogFromRedis(String userId) { try { return (PayLog) redisTemplate.boundValueOps("payLog_" + userId).get(); } catch (Exception e) { throw new RuntimeException(e); } } /** * 修改订单状态 * * @param outTradeNo 订单交易号 * @param transactionId 微信交易流水号 */ @Override public void updateOrderStatus(String outTradeNo, String transactionId) { /**修改支付日志状态*/ PayLog payLog = payLogMapper.selectByPrimaryKey(outTradeNo); payLog.setPayTime(new Date());//支付时间 payLog.setTradeState("1");//标记为已支付状态 payLog.setTransactionId(transactionId);//交易流水号 //修改支付日志表 payLogMapper.updateByPrimaryKeySelective(payLog); /**修改订单状态*/ String[] orderIds = payLog.getOrderList().split(",");//订单号列表 //循环订单号数组 for (String orderId : orderIds) { Order order = new Order(); order.setOrderId(Long.valueOf(orderId));//订单号 order.setPaymentTime(new Date());//支付时间 order.setStatus("2");//已支付 orderMapper.updateByPrimaryKeySelective(order); } /**支付完之后清空redis的存储数据*/ redisTemplate.delete("payLog_" + payLog.getUserId()); } /** * 分页查询订单列表根据用户名 */ @Override public Map<String, Object> findOrderByPage( Map<String, Object> params, String username) { //创建Map集合封装返回数据 HashMap<String, Object> data = new HashMap<>(); /**分页*/ //获取当前页码 Integer page = (Integer) params.get("page"); //第一次访问page是空 if (page == null || page < 1) { //默认是第一页 page = 1; } //获取每页显示的记录数据 Integer rows = (Integer) params.get("rows"); //第一次访问每页大小是空 if (rows == null) { //默认是5个 rows = 3; } //用分页插件查询订单列表 PageInfo<Order> pageInfo = PageHelper.startPage(page, rows) .doSelectPageInfo(new ISelect() { @Override public void doSelect() { orderMapper.findOrderByPage(username); } }); //根据查询出来订单列表用订单id查询订单详情 List<Order> orderList = pageInfo.getList(); for (Order order : orderList) { //根据订单id查询订单详情 List<OrderItem> orderItems = orderItemMapper. findOrderItemByOrderId(order.getOrderId()); //转换long为String order.setOrderSid(order.getOrderId().toString()); //封装订单详情数据 order.setOrderItems(orderItems); //根据商家id查询商家店铺名称 String nickName = sellerMapper.findNickNameBySid(order.getSellerId()); //封装店铺名称 order.setNickName(nickName); } //获取内容 data.put("model", orderList); //设置总页数 data.put("totalPages", pageInfo.getPages()); //设置总记录数 data.put("total", pageInfo.getTotal()); return data; } /** * 更新订单状态修改为已支付并且修改支付日志表(这里应该是查出来的, * 但是因为之前练习购买的时候很多订单保存的时候没有插入支付日志表, * 所以没有数据直接新建支付日志算了免得找不到空指针异常!) * * @param outTradeNo 订单交易号 * @param transactionId 微信交易流水号 */ @Override public void updateOrder(String outTradeNo, String transactionId) { try { //根据订单号修改订单为已支付状态 Order order = orderMapper.selectByOrderId(outTradeNo); order.setStatus("2"); order.setPaymentTime(new Date()); order.setUpdateTime(new Date()); //新增支付日志记录 PayLog payLog = new PayLog(); IdWorker idWorker = new IdWorker(); payLog.setOutTradeNo(String.valueOf(idWorker.nextId())); payLog.setCreateTime(new Date()); payLog.setPayTime(new Date()); payLog.setUserId(order.getUserId()); payLog.setTransactionId(transactionId); payLog.setTradeState("1"); payLog.setPayType("1"); //往支付日志表插入数据; payLogMapper.insertSelective(payLog); //修改订单表状态 orderMapper.updateByPrimaryKeySelective(order); } catch (Exception e) { throw new RuntimeException(e); } } @Override public void update(Order order) { } @Override public void delete(Serializable id) { } @Override public void deleteAll(Serializable[] ids) { } @Override public Order findOne(Serializable id) { return null; } @Override public List<Order> findAll() { return null; } @Override public PageResult findByPage(Order order, int page, int rows) { return null; } }
[ "775959249@qq.com" ]
775959249@qq.com
dad9c00a1f2d7a56350357c94cac41c6f9de97b5
a545a4d098aadf6735cbc4b0b7870bdf9af355f6
/src/com/neusoft/service/impl/AccountServiceImpl.java
5a4207bde283fb6d83e7e8c14ac954abb24bfc7a
[]
no_license
cabraG/Crmmanager
b3d5036f754ecada6f2a6613f37ddae160952753
19c150379d83f7e71d42bd158d87d59262c6483b
refs/heads/master
2021-01-01T17:34:49.881270
2018-07-12T09:53:59
2018-07-12T09:53:59
98,104,278
0
0
null
null
null
null
UTF-8
Java
false
false
598
java
package com.neusoft.service.impl; import com.neusoft.dao.AccountDao; import com.neusoft.dao.impl.AccountDapImpl; import com.neusoft.domain.Account; import com.neusoft.service.AccountService; public class AccountServiceImpl implements AccountService { AccountDao acd=new AccountDapImpl(); @Override public void officeAccount(Account source, Account target, double monney) { Account s= acd.getAccountByCardname(source); Account t= acd.getAccountByCardname(target); s.setMoney(s.getMoney()-monney); t.setMoney(t.getMoney()+monney); acd.updateAccount(s); acd.updateAccount(t); } }
[ "18071869608@163.com" ]
18071869608@163.com
26f889b28340430c77cda1671d55b69bc229c978
eb15398e45d1724b4cd26d3750a39da7e366c745
/辅助开发/【遥控手机端】TVRemoteControlClient-master/src/com/ktc/remote/client/utils/HttpClientUtil.java
35989afb42d78358802dd6f41e6f3e792141532c
[ "Apache-2.0" ]
permissive
advado/ForSmartTvDemos
5d9e1959525685fe8d26226480b63808168577f4
bfc4b6bd8697df3d62136674825f874fad7fb4aa
refs/heads/master
2023-08-11T12:05:51.548815
2018-12-11T05:00:57
2018-12-11T05:00:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,964
java
package com.ktc.remote.client.utils; import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.List; import java.util.Map; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.params.BasicHttpParams; import org.apache.http.params.HttpConnectionParams; import org.apache.http.params.HttpParams; import org.apache.http.util.EntityUtils; public class HttpClientUtil { private HttpClient client; private HttpPost post; private HttpResponse response; public HttpClientUtil() { client = new DefaultHttpClient(); } public String sendGet(String url) { HttpGet get = new HttpGet(url); HttpParams httpParams = new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(httpParams, 8000); HttpConnectionParams.setSoTimeout(httpParams, 8000); get.setParams(httpParams); try { response = client.execute(get); if (response.getStatusLine().getStatusCode() == 200) { return EntityUtils.toString(response.getEntity(), "UTF-8"); } } catch (Exception e) { e.printStackTrace(); } return null; } public InputStream loadImg(String url) { System.out.println(url); HttpGet get = new HttpGet(url); HttpParams httpParams = new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(httpParams, 8000); HttpConnectionParams.setSoTimeout(httpParams, 8000); get.setParams(httpParams); try { response = client.execute(get); if (response.getStatusLine().getStatusCode() == 200) { return response.getEntity().getContent(); } } catch (Exception e) { e.printStackTrace(); } return null; } }
[ "smartarvin199111@gmail.com" ]
smartarvin199111@gmail.com
0eadfc67e2318a9d4c74a81d5d03a7ae4bc907cb
d2cb1f4f186238ed3075c2748552e9325763a1cb
/methods_all/nonstatic_methods/javax_xml_transform_sax_SAXResult_wait.java
9401c4c47f0ef20b394a0230d17bceefa21d86dc
[]
no_license
Adabot1/data
9e5c64021261bf181b51b4141aab2e2877b9054a
352b77eaebd8efdb4d343b642c71cdbfec35054e
refs/heads/master
2020-05-16T14:22:19.491115
2019-05-25T04:35:00
2019-05-25T04:35:00
183,001,929
4
0
null
null
null
null
UTF-8
Java
false
false
170
java
class javax_xml_transform_sax_SAXResult_wait{ public static void function() {javax.xml.transform.sax.SAXResult obj = new javax.xml.transform.sax.SAXResult();obj.wait();}}
[ "peter2008.ok@163.com" ]
peter2008.ok@163.com
eebff5c070f095c54947f9bd465b2ff10fa849ac
4f0b67adaed641de90f91ed9e66f517d769209a6
/cuit-paimai-server/src/main/java/cn/edu/cuit/interceptor/TimeInterceptor.java
1bc38a4e4598f636d19a3f634b27f0d23e24bced
[]
no_license
sunshixiong789/cuit-paimai
bdb6078d4abe64428a45992abf9f59d685a2e01c
3feea08722094d8cfdddd1ed4999fe3455b08d77
refs/heads/master
2020-03-11T03:57:04.831494
2018-05-16T02:58:01
2018-05-16T02:58:01
129,763,426
0
0
null
null
null
null
UTF-8
Java
false
false
2,174
java
package cn.edu.cuit.interceptor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import org.springframework.web.method.HandlerMethod; import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * @author sunshixiong * @date 2018/2/4 15:58 */ @Slf4j @Component public class TimeInterceptor implements HandlerInterceptor { /** * 执行方法前调用 * @param request * @param response * @param handler * @return * @throws Exception */ @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { log.info("prehandle执行"); log.info(((HandlerMethod)handler).getBean().getClass().getName()); log.info(((HandlerMethod)handler).getMethod().getName()); request.setAttribute("startTime",System.currentTimeMillis()); return true; } /** * 执行controller方法后调用 * @param request * @param response * @param handler * @param modelAndView * @throws Exception * @deprecated 如果preHandle方法抛出异常这个不会被执行 */ @Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView){ log.info("postHandle执行"); long start = (long) request.getAttribute("startTime"); log.info("消耗时间:"+(System.currentTimeMillis()-start)); } /** * 不管怎么这个方法都会被执行 * @param request * @param response * @param handler * @param ex * @throws Exception */ @Override public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) { log.info("afterCompletion执行"); long start = (long) request.getAttribute("startTime"); log.info("消耗时间:"+(System.currentTimeMillis()-start)); log.info("异常:"+ex); } }
[ "1285913468@qq.com" ]
1285913468@qq.com
ee3e4a483a9268157d01d08d6d9486455ca4cbdb
ec3754ca5eaedbcfa193f67ea05b404590d85f53
/TokoKasurPandaanJaya/src/com/equinox/model/Supplier.java
ab577284c71a2afbc5d50609ecee34c12e878a54
[]
no_license
LinggaWahyu/TokoKasurPandaanJaya
98992dc930b841b4233afde19f7fab4bceca67e0
aaa31114a70d6c08a0b5fc95ec8480bd54559d91
refs/heads/master
2020-09-26T11:03:19.534274
2019-12-09T10:17:00
2019-12-09T10:17:00
226,241,662
1
0
null
null
null
null
UTF-8
Java
false
false
921
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.equinox.model; /** * * @author equinox */ public class Supplier { private String id_supplier, nama, alamat, no_telp; public String getId_supplier() { return id_supplier; } public void setId_supplier(String id_supplier) { this.id_supplier = id_supplier; } public String getNama() { return nama; } public void setNama(String nama) { this.nama = nama; } public String getAlamat() { return alamat; } public void setAlamat(String alamat) { this.alamat = alamat; } public String getNo_telp() { return no_telp; } public void setNo_telp(String no_telp) { this.no_telp = no_telp; } }
[ "linggawahyurochim@gmail.com" ]
linggawahyurochim@gmail.com
f61a9983ef656dea624bf1d692ee6a854aa4b3cf
07bd7613fe758060ace00d8d35a48731cb8a0040
/rest-validation-3.2/src/test/java/net/petrikainulainen/spring/trenches/UnitTestUtil.java
fd7c1b5bd4ce1628a2dfaf17735e371969069300
[ "Apache-2.0" ]
permissive
beginsmauel/spring-from-the-trenches
5ebf0f80d2dd4795587acb9dd61fef5d8631cb4d
da57ba1469bbce78125c7ffbe225acfa3453eea7
refs/heads/master
2021-01-11T16:03:35.957046
2017-10-13T04:12:58
2017-10-13T04:12:58
79,996,327
0
0
null
2017-01-25T08:31:59
2017-01-25T08:31:59
null
UTF-8
Java
false
false
1,143
java
package net.petrikainulainen.spring.trenches; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import org.springframework.http.MediaType; import java.io.IOException; import java.nio.charset.Charset; /** * @author Petri Kainulainen */ public class UnitTestUtil { private static final String CHARACTER = "C"; public static final MediaType APPLICATION_JSON_UTF8 = new MediaType(MediaType.APPLICATION_JSON.getType(), MediaType.APPLICATION_JSON.getSubtype(), Charset.forName("utf8")); public static byte[] convertObjectToJsonBytes(Object object) throws IOException { ObjectMapper mapper = new ObjectMapper(); mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); return mapper.writeValueAsBytes(object); } public static String createStringWithLength(int length) { StringBuilder builder = new StringBuilder(); for (int index = 0; index <= length; index++) { builder.append(CHARACTER); } return builder.toString(); } }
[ "petri.kainulainen@gmail.com" ]
petri.kainulainen@gmail.com
36f952f1665da7f25dcf6e40d9a187d6e14f1367
83d56024094d15f64e07650dd2b606a38d7ec5f1
/sicc_druida/fuentes/java/BelEstadMercaComboFormatter.java
41787abe9c6269a5df5a16e23bf1ca7b05650982
[]
no_license
cdiglesias/SICC
bdeba6af8f49e8d038ef30b61fcc6371c1083840
72fedb14a03cb4a77f62885bec3226dbbed6a5bb
refs/heads/master
2021-01-19T19:45:14.788800
2016-04-07T16:20:51
2016-04-07T16:20:51
null
0
0
null
null
null
null
ISO-8859-1
Java
false
false
2,607
java
/* INDRA/CAR/mmg $Id: BelEstadMercaComboFormatter.java,v 1.1 2009/12/03 18:34:28 pecbazalar Exp $ DESC */ /* INDRA/CAR/mmg $Id: BelEstadMercaComboFormatter.java,v 1.1 2009/12/03 18:34:28 pecbazalar Exp $ fdsfdsf DRUIDATARGET=/install/cvsiniciales */ import java.util.Enumeration; import java.util.Hashtable; import java.util.Iterator; import java.util.Map; import java.util.TreeMap; import java.util.Vector; import es.indra.belcorp.mso.*; import es.indra.druida.DruidaFormatoObjeto; import es.indra.druida.belcorp.MMGDruidaFormatoObjeto; import es.indra.druida.belcorp.MMGDruidaHelper; import es.indra.mare.common.dto.IMareDTO; import es.indra.utils.*; /** * Clase de formateo de objetos "BelEstadMerca" para Druida * * @author Indra */ public class BelEstadMercaComboFormatter extends MMGDruidaFormatoObjeto { public BelEstadMercaComboFormatter() { } public void formatea(String s, Object obj) throws Exception { IMareDTO dto = (IMareDTO) obj; Vector belEstadMercaCombo = (Vector) dto.getProperty("result"); Vector result = new Vector(); //Ordenamos los elementos //TreeMap orderBy = new TreeMap(); TreeMap orderBy = new TreeMap(new Comparador()); for(int i=0; i< belEstadMercaCombo.size(); i++){ BelEstadMercaData belEstadMercaData = (BelEstadMercaData)belEstadMercaCombo.get(i); String description = belEstadMercaData.getDescripcion() != null ? FormatUtils.formatObject(belEstadMercaData.getDescripcion(), MMGDruidaHelper.getUserDecimalFormatPattern(this), MMGDruidaHelper.getUserDecimalFormatSymbols(this)) : ""; orderBy.put(description.toUpperCase(), belEstadMercaData); } //Construimos cada fila con los valores de la clave y la descripción del elemento que se mostrará en el combo for (Iterator it = orderBy.entrySet().iterator() ; it.hasNext();) { BelEstadMercaData belEstadMercaData = (BelEstadMercaData)((Map.Entry)it.next()).getValue(); Vector row = new Vector(); // Añadir la clave Hashtable primaryKey = belEstadMercaData.mmgGetPrimaryKey(); Enumeration keys = primaryKey.keys(); while (keys.hasMoreElements()) { Object element = primaryKey.get(keys.nextElement()); row.add((element != null ? element.toString() : "")); } // Añadir el atributo choice row.add((belEstadMercaData.getDescripcion() != null ? FormatUtils.formatObject(belEstadMercaData.getDescripcion(), MMGDruidaHelper.getUserDecimalFormatPattern(this), MMGDruidaHelper.getUserDecimalFormatSymbols(this)) : "")); result.add(row); } setCampo(s, result); } }
[ "hp.vega@hotmail.com" ]
hp.vega@hotmail.com
88a604b7f304ea832fe5467b05613d12b5d92f10
2291b6d817d44c18918fe8a3cf35889c5349225a
/Task7/src/Entities/PassengerCar.java
ea57d32832b918c551ee1bd1444fad5df3bb9f27
[]
no_license
Vladonko/Epam
0379b1357c887b659f88b2980e8934c7039e60b8
917c25cbb6962b29d588ad29f8aa3f0e777d05f8
refs/heads/master
2020-03-18T12:42:20.100631
2018-06-16T14:14:24
2018-06-16T14:14:24
134,730,234
0
0
null
null
null
null
UTF-8
Java
false
false
1,699
java
package Entities; public class PassengerCar extends Vehicle { private int trunkSpace; public PassengerCar() { } public PassengerCar(byte numOfSeats, String color, String model, int yearOfIssue, int id, int price, int trunkSpace) { super(numOfSeats, color, model, yearOfIssue, id, price); this.trunkSpace = trunkSpace; } public PassengerCar(PassengerCar passengerCar) { super(passengerCar.numOfSeats, passengerCar.color, passengerCar.model, passengerCar.yearOfIssue, passengerCar.id, passengerCar.price); this.trunkSpace = passengerCar.trunkSpace; } public int getTrunkSpace() { return trunkSpace; } public void setTrunkSpace(int trunkSpace) { this.trunkSpace = trunkSpace; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; PassengerCar that = (PassengerCar) o; return getTrunkSpace() == that.getTrunkSpace(); } @Override public int hashCode() { int result = super.hashCode(); result = 31 * result + getTrunkSpace(); return result; } @Override public String toString() { return "Entities.PassengerCar{" + "trunkSpace=" + trunkSpace + ", numOfSeats=" + numOfSeats + ", color='" + color + '\'' + ", model='" + model + '\'' + ", yearOfIssue=" + yearOfIssue + ", id=" + id + ", price=" + price + '}'; } }
[ "39594347+Vladonko@users.noreply.github.com" ]
39594347+Vladonko@users.noreply.github.com
d26d530a6dbd25af03be979bc3d8941791cc9ddb
2e743d39b9928e352f1a8c7ecc33bf7c9f7481fb
/AE-Login/src/com/aionengine/loginserver/network/aion/clientpackets/CM_AUTH_GG.java
7fc62f3f697b64cfd10b0c389fb995167ee116bf
[]
no_license
webdes27/AionTypeZero
40461b3b99ae7ca229735889277e62eed4c5db7e
ff234a0a515c1155f18e61e5b5ba2afad7dfd8c9
refs/heads/master
2021-05-30T12:14:08.672390
2016-01-29T13:54:32
2016-01-29T13:54:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,332
java
/* * Copyright (c) 2015, TypeZero Engine (game.developpers.com) * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * Neither the name of TypeZero Engine nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ package com.aionengine.loginserver.network.aion.clientpackets; import com.aionengine.loginserver.network.aion.AionAuthResponse; import com.aionengine.loginserver.network.aion.AionClientPacket; import com.aionengine.loginserver.network.aion.LoginConnection; import com.aionengine.loginserver.network.aion.LoginConnection.State; import com.aionengine.loginserver.network.aion.serverpackets.SM_AUTH_GG; import com.aionengine.loginserver.network.aion.serverpackets.SM_LOGIN_FAIL; /** * @author -Nemesiss- */ public class CM_AUTH_GG extends AionClientPacket { /** * session id - its should match sessionId that was send in Init packet. */ private int sessionId; /* * private final int data1; private final int data2; private final int data3; private final int data4; */ /** * Constructs new instance of <tt>CM_AUTH_GG</tt> packet. * * @param buf * @param client */ public CM_AUTH_GG(java.nio.ByteBuffer buf, LoginConnection client) { super(buf, client, 0x07); } /** * {@inheritDoc} */ @Override protected void readImpl() { sessionId = readD(); readD(); readD(); readD(); readD(); readB(0x0B); } /** * {@inheritDoc} */ @Override protected void runImpl() { LoginConnection con = getConnection(); if (con.getSessionId() == sessionId) { con.setState(State.AUTHED_GG); con.sendPacket(new SM_AUTH_GG(sessionId)); } else { /** * Session id is not ok - inform client that smth went wrong - dc client */ con.close(new SM_LOGIN_FAIL(AionAuthResponse.SYSTEM_ERROR), false); } } }
[ "game.fanpage@gmail.com" ]
game.fanpage@gmail.com
a8f0d9dcdc748fbab87923b553149d492774afc8
4d2c0dfe2886e36414d25d7afaeecbc25705c631
/Project/Project/src/Main/Game.java
13a626bfe1b7084258454adb4d0f0323bb26818f
[]
no_license
iamchrisim/Java
15aba15781f1cddba711b7bd087e12a07073ad10
f604591bd0d9f7a5c631090594a8cfe000cc9dc0
refs/heads/master
2021-01-03T02:56:15.688414
2020-02-12T00:28:08
2020-02-12T00:28:08
239,891,627
0
0
null
null
null
null
UTF-8
Java
false
false
339
java
package Main; import javax.swing.JFrame; public class Game { public static void main(String[] args) { JFrame window = new JFrame("Project Dekhoda"); window.setContentPane(new GamePanel()); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.setResizable(false); window.pack(); window.setVisible(true);; } }
[ "chrisim0121@gmail.com" ]
chrisim0121@gmail.com
64cbeac25e16efeba2d834910eaf1395dfe3583e
7bc6dec03f6e9d41ca7e794433a95151dcb49ec2
/src/test/java/com/speedrent/demo/DemoApplicationTests.java
a4136dd28b05a2ab334c56344f951b0bd66b07e2
[]
no_license
1Mr-Styler/sr
a0d366b8f043af904d318b666428beab1a92311a
66527a1c02756bd85e7433d9b710d6d232ee0006
refs/heads/master
2020-05-24T05:49:32.071795
2019-05-17T01:28:06
2019-05-17T01:28:06
187,125,425
0
0
null
null
null
null
UTF-8
Java
false
false
342
java
package com.speedrent.demo; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class DemoApplicationTests { @Test public void contextLoads() { } }
[ "jerry@lyshnia.com" ]
jerry@lyshnia.com
5d0b6c0b03ebfd9873e4fe066555dfc3a7da7463
9e7719daaba59c95438dec8898b773ce563ff365
/thread/src/main/java/com/newtouch/thread/pipeline/strategy/PipeException.java
a62b3bf36ae561240499d708818a4f43cecf8222
[]
no_license
Git-yangrui/java-remote-repository
bbfa1a99466d6768109f6ec63d08cce538ed21fd
85e78ec7ad4f2515e50280120124cf96ac3e0bf6
refs/heads/master
2021-01-19T00:27:26.274418
2017-07-13T15:59:21
2017-07-13T15:59:21
87,173,114
3
0
null
null
null
null
GB18030
Java
false
false
775
java
package com.newtouch.thread.pipeline.strategy; /** * 处理的异常类extends Exception * @author Administrator * */ public class PipeException extends Exception{ private static final long serialVersionUID = 1L; /** * 抛出异常的pipe的实例 */ public final Pipe<?,?> sourcePipe; /** * 抛出异常的Pipe实例在抛出异常时处理的输入元素 */ public final Object input; //构造方法 public PipeException(Pipe<?,?> sourcePipe,Object input,String message){ super(message); this.sourcePipe=sourcePipe; this.input=input; } public PipeException(Pipe<?,?> sourcePipe,Object input,String message, Throwable cause){ super(message,cause); this.sourcePipe=sourcePipe; this.input=input; } }
[ "64537132@qq.com" ]
64537132@qq.com
4aabd7757ee95a5c6678d706fd735de09e48090a
ff68b7cfa35aa56d06c7e40e740d9246b6d0cb38
/Test5/src/test5/Test5.java
daf625e7e2e818085df26da1cf7395e0d3ec7b8b
[]
no_license
MariaVieira1234/TestNetbeans
8fcfbe4cd838055a22d2465db0545614a67ab4c6
15fdf07e6e14bddd12a71a74b0e48d3af81936ea
refs/heads/master
2021-06-30T22:03:06.765266
2017-09-18T02:27:04
2017-09-18T02:28:26
103,869,488
0
0
null
null
null
null
UTF-8
Java
false
false
483
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 test5; /** * * @author Maria Vieira */ public class Test5 { /** * @param args the command line arguments */ public static void main(String[] args) { System.out.println("hello\n"); // TODO code application logic here } }
[ "vieira.maria@gmail.com" ]
vieira.maria@gmail.com
f0f6bc7d1ee995244de98fa17b35e8bb96e6bdd4
10c96edfa12e1a7eef1caf3ad1d0e2cdc413ca6f
/src/main/resources/projs/Collection_4.1_parent/src/main/java/org/apache/commons/collections4/collection/SynchronizedCollection.java
08cf956c75baaadf00f9df5a45c5b4bd54ba6b62
[ "Apache-2.0" ]
permissive
Gu-Youngfeng/EfficiencyMiner
c17c574e41feac44cc0f483135d98291139cda5c
48fb567015088f6e48dfb964a4c63f2a316e45d4
refs/heads/master
2020-03-19T10:06:33.362993
2018-08-01T01:17:40
2018-08-01T01:17:40
136,343,802
0
0
Apache-2.0
2018-08-01T01:17:41
2018-06-06T14:51:55
Java
UTF-8
Java
false
false
6,471
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.collections4.collection; import java.io.Serializable; import java.util.Collection; import java.util.Iterator; /** * Decorates another {@link Collection} to synchronize its behaviour * for a multi-threaded environment. * <p> * Iterators must be manually synchronized: * <pre> * synchronized (coll) { * Iterator it = coll.iterator(); * // do stuff with iterator * } * </pre> * <p> * This class is Serializable from Commons Collections 3.1. * * @param <E> the type of the elements in the collection * @since 3.0 * @version $Id: SynchronizedCollection.java 1686855 2015-06-22 13:00:27Z tn $ */ public class SynchronizedCollection<E> implements Collection<E>, Serializable { /** Serialization version */ private static final long serialVersionUID = 2412805092710877986L; /** The collection to decorate */ private final Collection<E> collection; /** The object to lock on, needed for List/SortedSet views */ protected final Object lock; /** * Factory method to create a synchronized collection. * * @param <T> the type of the elements in the collection * @param coll the collection to decorate, must not be null * @return a new synchronized collection * @throws NullPointerException if collection is null * @since 4.0 */ public static <T> SynchronizedCollection<T> synchronizedCollection(final Collection<T> coll) { return new SynchronizedCollection<T>(coll); } //----------------------------------------------------------------------- /** * Constructor that wraps (not copies). * * @param collection the collection to decorate, must not be null * @throws NullPointerException if the collection is null */ protected SynchronizedCollection(final Collection<E> collection) { if (collection == null) { throw new NullPointerException("Collection must not be null."); } this.collection = collection; this.lock = this; } /** * Constructor that wraps (not copies). * * @param collection the collection to decorate, must not be null * @param lock the lock object to use, must not be null * @throws NullPointerException if the collection or lock is null */ protected SynchronizedCollection(final Collection<E> collection, final Object lock) { if (collection == null) { throw new NullPointerException("Collection must not be null."); } if (lock == null) { throw new NullPointerException("Lock must not be null."); } this.collection = collection; this.lock = lock; } /** * Gets the collection being decorated. * * @return the decorated collection */ protected Collection<E> decorated() { return collection; } //----------------------------------------------------------------------- @Override public boolean add(final E object) { synchronized (lock) { return decorated().add(object); } } @Override public boolean addAll(final Collection<? extends E> coll) { synchronized (lock) { return decorated().addAll(coll); } } @Override public void clear() { synchronized (lock) { decorated().clear(); } } @Override public boolean contains(final Object object) { synchronized (lock) { return decorated().contains(object); } } @Override public boolean containsAll(final Collection<?> coll) { synchronized (lock) { return decorated().containsAll(coll); } } @Override public boolean isEmpty() { synchronized (lock) { return decorated().isEmpty(); } } /** * Iterators must be manually synchronized. * <pre> * synchronized (coll) { * Iterator it = coll.iterator(); * // do stuff with iterator * } * </pre> * * @return an iterator that must be manually synchronized on the collection */ @Override public Iterator<E> iterator() { return decorated().iterator(); } @Override public Object[] toArray() { synchronized (lock) { return decorated().toArray(); } } @Override public <T> T[] toArray(final T[] object) { synchronized (lock) { return decorated().toArray(object); } } @Override public boolean remove(final Object object) { synchronized (lock) { return decorated().remove(object); } } @Override public boolean removeAll(final Collection<?> coll) { synchronized (lock) { return decorated().removeAll(coll); } } @Override public boolean retainAll(final Collection<?> coll) { synchronized (lock) { return decorated().retainAll(coll); } } @Override public int size() { synchronized (lock) { return decorated().size(); } } @Override public boolean equals(final Object object) { synchronized (lock) { if (object == this) { return true; } return object == this || decorated().equals(object); } } @Override public int hashCode() { synchronized (lock) { return decorated().hashCode(); } } @Override public String toString() { synchronized (lock) { return decorated().toString(); } } }
[ "yongfeng_gu@163.com" ]
yongfeng_gu@163.com
1f519619d7854463b6f9c583ecc148e6317619af
a05e6ed256ebdcca0bf031907a4d7ae932936605
/src/main/java/com/github/maikoncanuto/iubspringboot/config/interceptors/LoggerInterceptor.java
89ef712a2798b7edac6bfbf424ca00b196770a2a
[]
no_license
mikenew01/iub
ba30d999fa4ef76fd6971cb3340348a03b18a8fe
20615a8d3b467c63ff85dcde805be33b358bbe81
refs/heads/main
2023-04-16T10:18:22.747163
2021-05-02T21:23:37
2021-05-02T21:23:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
864
java
package com.github.maikoncanuto.iubspringboot.config.interceptors; import lombok.extern.slf4j.Slf4j; import org.springframework.web.servlet.HandlerInterceptor; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @Slf4j public class LoggerInterceptor implements HandlerInterceptor { @Override public boolean preHandle(final HttpServletRequest request, final HttpServletResponse response, final Object handler) throws Exception { log.info("[handler] - metodo: {}, uri: {}, ip: {}, remoteAddr: {}, host: {}, port: {}", request.getMethod(), request.getRequestURI(), request.getHeader("X-FORWARDED-FOR"), request.getRemoteAddr(), request.getRemoteHost(), request.getRemotePort()); return true; } }
[ "maikoncanuto@gmail.com" ]
maikoncanuto@gmail.com
153ec9a4fa99b4604b18ea5c527a6755cd4e801b
941bfe065f6c731ad0e6e00ef850bc634a6a4721
/app/src/main/java/com/example/gaid/BaseApplication.java
9910ee73d1cb7d1028e690543be626a732d981e5
[]
no_license
Ssook/gaid
afe8319bbb89ef7d9ed34aaa384b0a474c19316c
c4b651545e79ce2a79893cb1313ec54c758a4a35
refs/heads/master
2022-11-23T08:51:06.751502
2020-07-18T07:38:46
2020-07-18T07:38:46
275,738,896
0
2
null
null
null
null
UTF-8
Java
false
false
2,458
java
package com.example.gaid; import android.app.Activity; import android.app.Application; import android.app.Dialog; import android.graphics.drawable.AnimationDrawable; import android.graphics.drawable.ColorDrawable; import android.text.TextUtils; import android.widget.ImageView; import android.widget.TextView; import androidx.appcompat.app.AppCompatDialog; import com.airbnb.lottie.LottieAnimationView; public class BaseApplication extends Application { public static BaseApplication baseApplication; private LottieAnimationView animationView2; AppCompatDialog progressDialog; public static BaseApplication getInstance() { baseApplication = new BaseApplication(); return baseApplication; } @Override public void onCreate() { super.onCreate(); baseApplication = this; } public void progressON(Activity activity, String message) { if (activity == null || activity.isFinishing()) { return; } if (progressDialog != null && progressDialog.isShowing()) { progressSET(message); } else { progressDialog = new AppCompatDialog(activity); progressDialog.setCancelable(false); progressDialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); progressDialog.setContentView(R.layout.progress_loading); progressDialog.show(); } animationView2 = (LottieAnimationView)progressDialog.findViewById(R.id.animation_view); animationView2.setAnimation("elevator.json"); animationView2.loop(true); //Lottie Animation start animationView2.playAnimation(); // TextView tv_progress_message = (TextView) progressDialog.findViewById(R.id.tv_progress_message); // if (!TextUtils.isEmpty(message)) { // tv_progress_message.setText(message); // } } public void progressSET(String message) { if (progressDialog == null || !progressDialog.isShowing()) { return; } // TextView tv_progress_message = (TextView) progressDialog.findViewById(R.id.tv_progress_message); // if (!TextUtils.isEmpty(message)) { // tv_progress_message.setText(message); // } } public void progressOFF() { if (progressDialog != null && progressDialog.isShowing()) { progressDialog.dismiss(); } } }
[ "42290273+heoseungyeon@users.noreply.github.com" ]
42290273+heoseungyeon@users.noreply.github.com
9be41802cb62cbcf9a062bf73ac6ddb20d3f0a81
cda0e715c98cb63423661b2e9f227b53585400ec
/app/src/main/java/com/moon/samples/uncaughthandler/CrashHandler.java
f7534d5e027c482f0286b37a417ee982f46bbdbb
[]
no_license
moonljt521/Samples
c9d9e1b50f862346a667a9e0dca05eb14afe6398
064c2ac0748b9bf2c31b53a0a30ccb964fa32ff9
refs/heads/master
2021-01-22T13:36:25.183766
2017-12-09T15:22:33
2017-12-09T15:22:33
100,671,996
4
1
null
2017-12-09T15:22:34
2017-08-18T04:15:01
Java
UTF-8
Java
false
false
7,493
java
package com.moon.samples.uncaughthandler; import android.Manifest; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.os.Build; import android.os.Environment; import android.os.Looper; import android.support.v4.content.ContextCompat; import android.support.v4.util.ArrayMap; import android.util.Log; import android.widget.Toast; import com.moon.samples.utils.Logger; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; import java.io.Writer; import java.lang.Thread.UncaughtExceptionHandler; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Map; /** * 当app 崩溃时捕获异常 */ public class CrashHandler implements UncaughtExceptionHandler ,Runnable{ private static final String LOG_PATH = "doingnow/crm/logs/"; private static final String TAG = "CrashHandler"; //系统默认的UncaughtException处理类 private UncaughtExceptionHandler mDefaultHandler; //CrashHandler实例 private static CrashHandler INSTANCE = new CrashHandler(); //程序的Context对象 private Context mContext; //用来存储设备信息和异常信息 private Map<String, String> infos = new ArrayMap<>(); //用于格式化日期,作为日志文件名的一部分 private DateFormat formatter; private Throwable ex ; /** * 保证只有一个CrashHandler实例 */ public CrashHandler() { } /** * 获取CrashHandler实例 ,单例模式 */ public static CrashHandler getInstance() { return INSTANCE; } /** * 初始化 * * @param context c */ public void init(Context context) { mContext = context; //获取系统默认的UncaughtException处理器 mDefaultHandler = Thread.getDefaultUncaughtExceptionHandler(); //设置该CrashHandler为程序的默认处理器 Thread.setDefaultUncaughtExceptionHandler(this); } public void doWithAfterCrash() { } /** * 当UncaughtException发生时会转入该函数来处理 */ @Override public void uncaughtException(Thread thread, Throwable ex) { if (!handleException(ex) && mDefaultHandler != null) { //如果用户没有处理则让系统默认的异常处理器来处理 mDefaultHandler.uncaughtException(thread, ex); } else { try { Thread.sleep(3000); } catch (InterruptedException e) { Log.e(TAG, "error : ", e); } //退出程序 android.os.Process.killProcess(android.os.Process.myPid()); System.exit(1); } } /** * 自定义错误处理,收集错误信息 发送错误报告等操作均在此完成. * * @param ex e * @return true:如果处理了该异常信息;否则返回false. */ private boolean handleException(Throwable ex) { if (ex == null) { return false; } this.ex = ex; new Thread() { @Override public void run() { Looper.prepare(); doWithAfterCrash(); Toast.makeText(mContext, "很抱歉,程序出现异常,即将重启", Toast.LENGTH_LONG).show(); Looper.loop(); } }.start(); //保存日志文件 new Thread(this).start(); return true; } /** * 收集设备参数信息 * * @param ctx c */ private void collectDeviceInfo(Context ctx) { try { PackageManager pm = ctx.getPackageManager(); PackageInfo pi = pm.getPackageInfo(ctx.getPackageName(), PackageManager.GET_ACTIVITIES); if (pi != null) { String versionName = pi.versionName == null ? "null" : pi.versionName; String versionCode = pi.versionCode + ""; String device = Build.MODEL + ""; infos.put("versionName", versionName); infos.put("versionCode", versionCode); infos.put("device", device); } } catch (NameNotFoundException e) { Log.e(TAG, "an error occured when collect package info", e); } } /** * 保存错误信息到文件中 * * @param ex 异常内容 * @return 返回文件名称, 便于将文件传送到服务器 */ private void saveCrashInfo2File(Throwable ex) { final StringBuilder sb = new StringBuilder(); // 日志内容 formatter = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss"); for (Map.Entry<String, String> entry : infos.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); sb.append(key); sb.append("="); sb.append(value); sb.append("\n"); } Writer writer = new StringWriter(); PrintWriter printWriter = new PrintWriter(writer); if (ex != null) { ex.printStackTrace(printWriter); Throwable cause = ex.getCause(); while (cause != null) { cause.printStackTrace(printWriter); cause = cause.getCause(); } } printWriter.close(); String result = writer.toString(); sb.append(result); try { long timestamp = System.currentTimeMillis(); String time = formatter.format(new Date()); final String fileName = "crash-" + time + "-" + timestamp + ".log"; if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { Logger.i("没有挂载sd卡"); return ; } if (!requestSDPermission()) { Logger.i("没有写卡权限"); return ; } writeLog(fileName, sb); return ; } catch (Exception e) { Log.e(TAG, "an error occured while writing file...", e); } } private void writeLog(String fileName, StringBuilder sb) { String path = Environment.getExternalStorageDirectory().getPath() + File.separator + LOG_PATH; Logger.i("log文件路径 = " + path); File dir = new File(path); if (!dir.exists()) { if (!dir.mkdirs()) { return; } } FileOutputStream fos = null; try { fos = new FileOutputStream(path + fileName); fos.write(sb.toString().getBytes()); fos.close(); } catch (Exception e) { e.printStackTrace(); } finally { try { if (fos != null) { fos.close(); } } catch (IOException e) { e.printStackTrace(); } } } private boolean requestSDPermission() { return ContextCompat.checkSelfPermission(mContext, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED; } @Override public void run() { //收集设备参数信息 collectDeviceInfo(mContext); saveCrashInfo2File(ex); } }
[ "liangjiangtao@hongyuanshidai.cn" ]
liangjiangtao@hongyuanshidai.cn
59b769ca5b2919df6c0dc5f5bfe462e38256f424
625986344a26f6f9c80d7181ff9e33001c9e0a25
/JavaLibrary/src/test/org/bn/coders/test_asn/BugSequenceType.java
369eb3e3c1141a0bfe5b2c6a367f8e0f58050905
[]
no_license
gec/BinaryNotes
b3e7be684167b6e90340b3b44f829969705f9e48
350b4c2bc5e5aef29a01af4051f7169ee98bb820
refs/heads/master
2021-01-01T05:40:15.550328
2012-01-20T14:47:32
2012-01-20T14:47:32
3,226,917
4
4
null
2017-05-27T17:45:59
2012-01-20T14:34:54
Java
UTF-8
Java
false
false
1,844
java
package test.org.bn.coders.test_asn; // // This file was generated by the BinaryNotes compiler. // See http://bnotes.sourceforge.net // Any modifications to this file will be lost upon recompilation of the source ASN.1. // import org.bn.*; import org.bn.annotations.*; import org.bn.annotations.constraints.*; import org.bn.coders.*; import org.bn.types.*; @ASN1PreparedElement @ASN1Sequence ( name = "BugSequenceType", isSet = false ) public class BugSequenceType implements IASN1PreparedElement { @ASN1Boolean( name = "" ) @ASN1Element ( name = "booleanField", isOptional = false , hasTag = true, tag = 0 , hasDefaultValue = false ) private Boolean booleanField = null; @ASN1Integer( name = "" ) @ASN1Element ( name = "integerField", isOptional = false , hasTag = true, tag = 0 , hasDefaultValue = false ) private Long integerField = null; public Boolean getBooleanField () { return this.booleanField; } public void setBooleanField (Boolean value) { this.booleanField = value; } public Long getIntegerField () { return this.integerField; } public void setIntegerField (Long value) { this.integerField = value; } public void initWithDefaults() { } private static IASN1PreparedElementData preparedData = CoderFactory.getInstance().newPreparedElementData(BugSequenceType.class); public IASN1PreparedElementData getPreparedData() { return preparedData; } }
[ "akira_ag@6e58b0a2-a920-0410-943a-aae568831f16" ]
akira_ag@6e58b0a2-a920-0410-943a-aae568831f16
c23a68f668a926b8ac912fbe2f2133ef2f558142
f2be68465dd0095c6e2f4070dbef1a029bf26933
/src/main/java/org/primefaces/paradise/view/button/ButtonView.java
f8bd09b020e9b6980df52eb020bd619c47f13f9a
[]
no_license
rramirezech1/antCore-jsf
bde3178a73197c922ed20190db6435a09843c8dc
1d87b4922aa06cd14e830d08b1c7e51f82d3fd7e
refs/heads/master
2020-05-03T05:51:19.219424
2020-02-23T18:07:58
2020-02-23T18:07:58
166,338,506
0
0
null
null
null
null
UTF-8
Java
false
false
1,448
java
/* * Copyright 2009-2014 PrimeTek. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.primefaces.paradise.view.button; import javax.faces.application.FacesMessage; import javax.faces.bean.ManagedBean; import javax.faces.context.FacesContext; import javax.faces.event.ActionEvent; @ManagedBean public class ButtonView { public void save(ActionEvent actionEvent) { addMessage("Data saved"); } public void update(ActionEvent actionEvent) { addMessage("Data updated"); } public void delete(ActionEvent actionEvent) { addMessage("Data deleted"); } public void buttonAction(ActionEvent actionEvent) { addMessage("Welcome to Primefaces!!"); } public void addMessage(String summary) { FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, summary, null); FacesContext.getCurrentInstance().addMessage(null, message); } }
[ "rrami@DESKTOP-09BRSIP" ]
rrami@DESKTOP-09BRSIP
7517af46cc8cbb1a5fc7a9d4d195b75a98191c62
b111b77f2729c030ce78096ea2273691b9b63749
/db-example-large-multi-project/project64/src/test/java/org/gradle/test/performance/mediumjavamultiproject/project64/p322/Test6443.java
b0796fdfcca2ce8d839c1b48468dbd0497926a56
[]
no_license
WeilerWebServices/Gradle
a1a55bdb0dd39240787adf9241289e52f593ccc1
6ab6192439f891256a10d9b60f3073cab110b2be
refs/heads/master
2023-01-19T16:48:09.415529
2020-11-28T13:28:40
2020-11-28T13:28:40
256,249,773
1
0
null
null
null
null
UTF-8
Java
false
false
2,619
java
package org.gradle.test.performance.mediumjavamultiproject.project64.p322; import org.junit.Test; import static org.junit.Assert.*; public class Test6443 { Production6443 objectUnderTest = new Production6443(); @Test public void testProperty0() throws Exception { Production6440 value = new Production6440(); objectUnderTest.setProperty0(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty0()); } @Test public void testProperty1() throws Exception { Production6441 value = new Production6441(); objectUnderTest.setProperty1(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty1()); } @Test public void testProperty2() throws Exception { Production6442 value = new Production6442(); objectUnderTest.setProperty2(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty2()); } @Test public void testProperty3() throws Exception { String value = "value"; objectUnderTest.setProperty3(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty3()); } @Test public void testProperty4() throws Exception { String value = "value"; objectUnderTest.setProperty4(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty4()); } @Test public void testProperty5() throws Exception { String value = "value"; objectUnderTest.setProperty5(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty5()); } @Test public void testProperty6() throws Exception { String value = "value"; objectUnderTest.setProperty6(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty6()); } @Test public void testProperty7() throws Exception { String value = "value"; objectUnderTest.setProperty7(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty7()); } @Test public void testProperty8() throws Exception { String value = "value"; objectUnderTest.setProperty8(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty8()); } @Test public void testProperty9() throws Exception { String value = "value"; objectUnderTest.setProperty9(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty9()); } }
[ "nateweiler84@gmail.com" ]
nateweiler84@gmail.com
82da8cf4a3cfb10ff0fa4836e4211a2452a28171
ccc01b75b07d994bd7f58b287c8f42394805edec
/app/src/main/java/com/example/portatil20/db_dex/Init.java
8a37a591dda288749f5e36111890b76d08f80ae9
[]
no_license
gatogoku/DB-DEX
c9b1ec6dab656dd5a43e4035fd54655547e85b68
1e88f16850db95ee959987fea27d239d3fa229b2
refs/heads/master
2021-01-11T04:45:12.531209
2016-10-18T08:44:06
2016-10-18T08:44:06
71,128,429
0
0
null
null
null
null
UTF-8
Java
false
false
879
java
package com.example.portatil20.db_dex; import android.content.Intent; import android.content.res.Resources; import android.graphics.drawable.Drawable; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.ImageView; public class Init extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_init); ImageView iv = (ImageView) findViewById(R.id.imageView); //int photo = (int) getIntent().getExtras().get("I"); //Drawable drag = new Drawable(new Resources(photo)); //iv.setBackground(new Drawable()); } public void showChars(View view){ Intent intento = new Intent(this, MainActivity.class); startActivity(intento); } }
[ "aqv1793@gmail.com" ]
aqv1793@gmail.com
5527ee6e7f4f53ab46d040debfc3d8c73af71901
503320e8c38d0b79f7da75028c3770099aa96750
/codewars/src/test/java/HighestScoringWordTest.java
cba5889bb777e6a7315484565315fc37256a6fdf
[]
no_license
rikardeliasson/challenges
756e8c69aaabed6d13d649a68d38ae05a3e19c9d
ede5e783e6029ba32bdbf844ed74ff6935ddd780
refs/heads/master
2020-03-31T14:29:18.180528
2018-10-09T20:13:51
2018-10-09T20:13:51
152,297,198
0
0
null
null
null
null
UTF-8
Java
false
false
1,071
java
import org.junit.Test; import static org.junit.Assert.assertEquals; public class HighestScoringWordTest { HighestScoringWord highestScoringWord; @Test public void sampleTests() { assertEquals("taxi", highestScoringWord.high("man i need a taxi up to ubud")); assertEquals("volcano", highestScoringWord.high("what time are we climbing up to the volcano")); assertEquals("semynak", highestScoringWord.high("take me to semynak")); } @Test public void Test2() { assertEquals("qqotczpyaru", highestScoringWord.high("qqotczpyaru")); } @Test public void Test3() { assertEquals("ejptmfpxdmbqaap", highestScoringWord.high("ejptmfpxdmbqaap")); } @Test public void Test4() { assertEquals("yquyiqgvb", highestScoringWord.high("yquyiqgvb")); } @Test public void Test5() { assertEquals("zfzqlyfebie", highestScoringWord.high("zfzqlyfebie")); } @Test public void Test6() { assertEquals("aaaaaaaaa", highestScoringWord.high("aaaaaaaaa")); } }
[ "rikard.eliasson8@gmail.com" ]
rikard.eliasson8@gmail.com
8cf8cb12f382813eef9bf3a17a0d86b2a84f9115
4a2d430a7e16df25c9fb80d09197f0e048412b2e
/src/section5/whileDoWhileLoops/FlourPackChallenge.java
db825655953e6e938e832f7b877df918ffb5ef3c
[]
no_license
bogdanleustean/udemyJavaCourse
34ca7519aa3d20b6433d850f6a25fe300d2ac6aa
e9210e2c4104c15ceb68c6e5114956ebc026ff93
refs/heads/master
2023-08-13T07:42:58.098678
2021-06-30T21:25:20
2021-06-30T21:25:20
365,592,584
0
0
null
2021-08-23T20:22:58
2021-05-08T19:11:22
Java
UTF-8
Java
false
false
561
java
package section5.whileDoWhileLoops; public class FlourPackChallenge { public static void main(String[] args) { System.out.println(canPack(1,0,5)); System.out.println(canPack(1,0,4)); } public static boolean canPack( int bigCount, int smallCount, int goal){ if( bigCount < 0 || smallCount < 0 || goal < 0){ return false; } bigCount *=5; while( bigCount > goal){ bigCount -=5; } return bigCount + smallCount >= goal || smallCount >= goal; } }
[ "bogdan.leustean@yahoo.com" ]
bogdan.leustean@yahoo.com
d287b48bdd405896935a583510514720a44359b5
0e7bc3c4ec555fa106ef9686d2e11cfbff79ac9a
/src/com/sevanjoe/designpatterns/creational/abstractfactory/ConcreteProductA2.java
03743488c44a4c13a40ee5913bd95476a6e6d7ed
[]
no_license
SevanJoe/DesignPatterns_Java
2a1211769da4023d2f29b0f75d00a954ac26379f
7f7a481d17b0926f20921b63f506db81357b1a39
refs/heads/master
2021-01-19T08:49:32.914753
2017-04-09T04:53:45
2017-04-09T04:53:45
87,683,395
0
0
null
null
null
null
UTF-8
Java
false
false
356
java
package com.sevanjoe.designpatterns.creational.abstractfactory; /** * Created by Sevan on 2017/4/9. */ public class ConcreteProductA2 implements ProductA { public ConcreteProductA2() { this.initProductA(); } @Override public void initProductA() { System.out.println("Create product A2 by abstract factory..."); } }
[ "sevancr7@gmail.com" ]
sevancr7@gmail.com
4376b3836f7095f13039a400ebd40d4157e3604e
cd89f952d2a4b831189aec8310438f299a4d3cde
/NUapp/src/main/java/com/project/nuerp/StudentFragment/timeFrag.java
76e89a109d78a23b16363fa3c425255a65c4be64
[]
no_license
shan-github/NUERP
b216cc4993f2b656c3120a38fa04037fc2a521ea
d2be51c2a4fd5e4a25d57849fb1ddb6ea9827851
refs/heads/master
2020-03-09T10:33:42.382736
2018-05-05T05:27:36
2018-05-05T05:27:36
128,739,946
1
1
null
null
null
null
UTF-8
Java
false
false
2,997
java
package com.project.nuerp.StudentFragment; import android.app.DownloadManager; import android.content.Context; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.net.Uri; import android.view.ViewGroup; import android.widget.Button; import com.github.barteksc.pdfviewer.PDFView; import com.project.nuerp.R; public class timeFrag extends Fragment{ Button downloadBtn,wrdbtn,xlbtn; PDFView pdfView; DownloadManager downloadManager; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View v=inflater.inflate(R.layout.timefrag,container,false); pdfView=(PDFView)v.findViewById(R.id.pdf); pdfView.fromAsset("StudentWiseTTReport.pdf").load(); wrdbtn=(Button)v.findViewById(R.id.wrdBtn); downloadBtn=(Button)v.findViewById(R.id.pdfBtn); xlbtn=(Button)v.findViewById(R.id.xlBtn); downloadBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { downloadManager =(DownloadManager)getActivity().getSystemService(Context.DOWNLOAD_SERVICE); Uri uri= Uri.parse("https://raw.githubusercontent.com/shan-github/myrep/master/StudentWiseTTReport.pdf"); DownloadManager.Request request =new DownloadManager.Request(uri); request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); Long ref = downloadManager.enqueue(request); } });wrdbtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { downloadManager =(DownloadManager)getActivity().getSystemService(Context.DOWNLOAD_SERVICE); Uri uri= Uri.parse("https://raw.githubusercontent.com/shan-github/myrep/master/StudentWiseTTReport.doc"); DownloadManager.Request request =new DownloadManager.Request(uri); request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); Long ref = downloadManager.enqueue(request); } });xlbtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { downloadManager =(DownloadManager)getActivity().getSystemService(Context.DOWNLOAD_SERVICE); Uri uri= Uri.parse("https://raw.githubusercontent.com/shan-github/myrep/master/StudentWiseTTReport.xls"); DownloadManager.Request request =new DownloadManager.Request(uri); request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); Long ref = downloadManager.enqueue(request); } }); return v; } }
[ "bshantanu1@gmail.com" ]
bshantanu1@gmail.com
05283be628cbce0f0dad85d624fab1b0aa9b5320
82ada8f2b9753c7d97d720b396c6bda044fdf988
/base-framework/src/main/java/com/dingtai/android/library/news/api/impl/GetCompareDataAsynCall.java
f61a50e998cd2633a52960b611bc73b8b27c1e2d
[]
no_license
xyyou123/dingtai-base-framework
f0dc377647b92df15c0d3f66942c5582eaefe506
c983c4d9c4e8456c5dec9681ee347f0f2cfb484c
refs/heads/master
2022-04-23T16:03:40.978218
2020-04-19T19:43:42
2020-04-19T19:44:12
257,085,196
0
0
null
null
null
null
UTF-8
Java
false
false
1,143
java
package com.dingtai.android.library.news.api.impl; import com.alibaba.fastjson.JSONArray; import com.dingtai.android.library.news.api.NewsApi; import com.dingtai.android.library.resource.Resource; import com.lnr.android.base.framework.data.asyn.CallResultDecodeBase64; import com.lnr.android.base.framework.data.asyn.core.AbstractAsynCall; import com.lnr.android.base.framework.data.asyn.core.AsynParams; import javax.inject.Inject; import io.reactivex.Observable; import io.reactivex.schedulers.Schedulers; /** * author:lnr * date:2018-08-21 */ public class GetCompareDataAsynCall extends AbstractAsynCall<JSONArray> { private static final String URL = "base"; @Inject public GetCompareDataAsynCall(){} @Override public Observable<JSONArray> call(AsynParams params) { String Chid = params.get("Chid"); String sign = params.get("sign"); String chid = params.get("chid"); //业务逻辑 return http().call(NewsApi.class, URL).getCompareData(Chid, Resource.API.SIGN, chid, Resource.API.STID).subscribeOn(Schedulers.io()) .map(new CallResultDecodeBase64<JSONArray>()); } }
[ "zndx0502050105@163.com" ]
zndx0502050105@163.com
1e3e2d785f0b59c6b92ca2c933ddccff524f0132
60910cff5ea451903f333d1edb823860deb6c4ee
/dishes-application/src/main/java/org/dishes/application/impl/StatisticsApplicationImpl.java
0f7ae667257abc3075966e299e8513f40340200b
[]
no_license
edf91/dishes
e08a5a4b645d4135b6a0dd8761e7edb569bcb0b5
b2a658f8d749e51dca302a63bf0dd52f1d2a7910
refs/heads/master
2021-05-29T19:34:50.651714
2015-07-28T18:13:50
2015-07-28T18:13:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,321
java
package org.dishes.application.impl; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; import javax.inject.Named; import org.dishes.application.StatisticsApplication; import org.dishes.commons.DataUtil; import org.dishes.commons.MapValueComparator; import org.dishes.domain.Activity; import org.dishes.domain.Dish; import org.dishes.domain.Order; import org.dishes.domain.statistics.DishTop; import org.dishes.domain.statistics.NearDayStatis; @Named public class StatisticsApplicationImpl implements StatisticsApplication{ // 一天的毫秒数 private static final long ONE_DAY_TIMESTAP = 86400000; /** * 实现热销饼图 * topNum 为前几 */ public List<DishTop> getTopDish(int topNum) { // 存放统计结果 List<DishTop> results = new ArrayList<DishTop>(); // 获取所有的订单信息 List<Order> allOrder = Order.findAllEntities(); // 通过map集合的特性(key不可重复),存放菜id--买出数的映射 Map<String, Integer> dishIdNum = new HashMap<String, Integer>(); // 遍历所有订单,分析常规菜与活动,获取菜的销量 for (Order order : allOrder) { String[] dishIds = DataUtil.toArrayStr(order.getDishIds()); for (String dishId : dishIds) { if(null != dishId && !"".equals(dishId)) dishIdNum.put(dishId, dishIdNum.get(dishId) == null ? 1 : dishIdNum.get(dishId) + 1); } String[] activeIds = DataUtil.toArrayStr(order.getActiveIds()); for (String activeId : activeIds) { Activity activity = Activity.get(Activity.class, activeId); if(activity != null) for (Dish dish : activity.getDishs()) { dishIdNum.put(dish.getId(), dishIdNum.get(dish.getId()) == null ? 1 : dishIdNum.get(dish.getId()) + 1); } } } // 由于map为无序集合,因此通过自定义比较器实现map集合按照value值的顺序存放 List<Map.Entry<String, Integer>> sortList = new ArrayList<Map.Entry<String,Integer>>(dishIdNum.entrySet()); Collections.sort(sortList, new MapValueComparator()); Map<String, Integer> sortMap = new LinkedHashMap<String, Integer>(); for(Iterator<Map.Entry<String, Integer>> ite = sortList.iterator();ite.hasNext();){ Map.Entry<String, Integer> entry = ite.next(); sortMap.put(entry.getKey(), entry.getValue()); } // 存放进最后的结果集 int sum = 0; Set<Map.Entry<String,Integer>> sets = sortMap.entrySet(); int i = 0; // 用户判断是否已经达到topNum for(Iterator<Map.Entry<String, Integer>> iter = sets.iterator(); iter.hasNext();){ if(i++ == topNum) break; Map.Entry<String, Integer> entry = iter.next(); Dish d = Dish.get(Dish.class, entry.getKey()); DishTop dishTop = new DishTop(); dishTop.setDishName(d.getName()); dishTop.setDishType(d.getDishType().getName()); dishTop.setNum(entry.getValue()); sum += entry.getValue(); results.add(dishTop); } // 计算比例 for (DishTop d : results) { d.setSum(sum); if(sum != 0) d.setScale(Double.parseDouble(d.getNum() + "") / Double.parseDouble(sum + "")); } return results; } /** * 近nearDay的日销量 */ public NearDayStatis nearDayStatis(int nearDay) { // 结果集 NearDayStatis result = new NearDayStatis(); result.setNearDay(nearDay); result.setTimes(initTimeArrayList(nearDay)); for(int i = 0; i < nearDay ; i++){ // 获取这段时间的订单 List<Order> orders = Order.findByOrderTimeBetween(result.getTimes().get(i + 1),result.getTimes().get(i)); double realSumPay = 0.0; // 遍历订单 for (Order order : orders) { realSumPay += order.getRealPrice(); } result.getSalesCount().add(realSumPay); } return result; } /** * 通过nearDay获取各个日期的日期时间戳 * @param nearDay * @return */ private List<Long> initTimeArrayList(int nearDay){ // 根据nearDay 初始化 times List<Long> times = new ArrayList<Long>(); times.add(new Date().getTime()); // 获取当前年月日时间 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); String currentTimeStr = sdf.format(new Date()); // 获取当前时间的年月日时间戳 long currentDateStap = 0; try { currentDateStap = sdf.parse(currentTimeStr).getTime(); } catch (Exception e) { e.printStackTrace(); } for(int i = 0; i < nearDay; i++){ times.add(currentDateStap); currentDateStap -= ONE_DAY_TIMESTAP; } return times; } /*public static void main(String[] args) throws ParseException { // 获取当前年月日时间 int nearDay = 10; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); String currentTimeStr = sdf.format(new Date()); // 获取当前时间的年月日时间戳 long currentDateStap = 0; try { currentDateStap = sdf.parse(currentTimeStr).getTime(); } catch (Exception e) { e.printStackTrace(); } List<Long> times = new ArrayList<Long>(); for(int i = 0; i < nearDay; i++){ times.add(currentDateStap); currentDateStap -= ONE_DAY_TIMESTAP; } for (Long dateStap : times) { System.out.println(new Date(dateStap)); } }*/ }
[ "1114207539@qq.com" ]
1114207539@qq.com
8da1d6e45d5208871ee2734e73cd20b8e9b78fcd
028a80ae37d2cffd0585b98585c858197f5766b7
/src/main/java/com/sekoya/dao/StudentDaoImpl.java
6e2e6944a118316af6a8ebc63e5498c10c24b6dc
[]
no_license
eniacce/test
195fff8fbfb7b438d8273d8ec9d9ce52ed794bcb
f38dbfbcec7de283f51a340cbd5bedb2fcfb36e6
refs/heads/master
2021-01-23T07:35:20.016827
2015-08-28T18:25:33
2015-08-28T18:25:33
41,562,557
0
0
null
null
null
null
UTF-8
Java
false
false
2,167
java
package com.sekoya.dao; import com.sekoya.hibernateListener.DbListener; import com.sekoya.model.Student; import org.hibernate.Query; import org.hibernate.SQLQuery; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.criterion.Projections; import org.hibernate.event.spi.PreUpdateEvent; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.ApplicationEventPublisherAware; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.transaction.annotation.Transactional; import java.util.List; /** * Created by sekoya1 on 26.08.2015. */ public class StudentDaoImpl implements IStudentDAO{ @Autowired SessionFactory sessionFactory; @Autowired DbListener dbListener; private boolean durum=false; @Transactional @Scheduled(fixedDelay =30000) public List<Student> studentList() { Session session1 = sessionFactory.openSession(); List<Student> list = session1.createQuery("from Student").list(); session1.close(); return list; } @Transactional public void save(Student student) { Session session = sessionFactory.openSession(); session.save(student); session.close(); studentList(); } @Transactional public Student updateStudent(int id) { Session session = sessionFactory.openSession(); Student student1 = ((Student) session.get(Student.class, id)); durum=true; student1.setUpdateControl(durum); session.close(); return student1; } @Transactional public int count() { Session session = sessionFactory.openSession(); String hql = "select count(*) from Student student"; Query query = session.createQuery(hql); int i = ((Number) query.uniqueResult()).intValue(); if(i==0){ session.close(); return 0; } else { session.close(); System.out.println(i); return i; } } }
[ "mesutaygn@gmail.com" ]
mesutaygn@gmail.com
c16d2fbf9399c312ca2702f7f989515989e37137
6fd7b9ed4929feb64a95f4c7ead4fb1822a8d65e
/src/sample1_basics/test1.java
501292433ad8ecc3f6e14e23e4929a2f2bafdbe9
[]
no_license
uchihatmtkinu/Poke-Map-Java
b03527f0356d0a981701af2d3019e9e48798f8fa
70c5d30d9ceb920bb1618ac925e00d20cb1fc9e8
refs/heads/master
2020-04-09T07:01:32.798263
2016-09-14T07:35:18
2016-09-14T07:35:18
68,183,379
0
0
null
null
null
null
UTF-8
Java
false
false
3,213
java
package sample1_basics; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.URL; import java.util.List; import java.util.Scanner; import java.util.concurrent.TimeUnit; import javax.swing.JFrame; import com.google.maps.GeoApiContext; import com.google.maps.GeocodingApi; import com.google.maps.model.GeocodingResult; import com.google.protobuf.InvalidProtocolBufferException; import com.pokegoapi.api.PokemonGo; import com.pokegoapi.api.map.pokemon.CatchablePokemon; import com.pokegoapi.api.map.pokemon.NearbyPokemon; import com.pokegoapi.auth.GoogleUserCredentialProvider; import com.pokegoapi.auth.PtcCredentialProvider; import com.pokegoapi.exceptions.LoginFailedException; import com.pokegoapi.exceptions.NoSuchItemException; import com.pokegoapi.exceptions.RemoteServerException; import com.pokegoapi.main.ServerRequest; import com.pokegoapi.util.Log; import POGOProtos.Data.PokemonDataOuterClass.PokemonData; import POGOProtos.Networking.Requests.RequestTypeOuterClass.RequestType; import POGOProtos.Networking.Requests.Messages.LevelUpRewardsMessageOuterClass.LevelUpRewardsMessage; import POGOProtos.Networking.Responses.LevelUpRewardsResponseOuterClass.LevelUpRewardsResponse; import okhttp3.OkHttpClient; public class test1 { /** * PTC is much simpler, but less secure. * You will need the username and password for each user log in * This account does not currently support a refresh_token. * Example log in : * @throws RemoteServerException * @throws LoginFailedException */ public static void main(String[] args) throws LoginFailedException, RemoteServerException { OkHttpClient httpClient = new OkHttpClient(); PokemonGo go = new PokemonGo(httpClient); JFrame test = new JFrame("Google Maps"); try { go.login(new PtcCredentialProvider(httpClient,"uchiha_8" , "test1234")); // After this you can access the api from the PokemonGo instance : TimeUnit.MILLISECONDS.sleep(500); go.setLocation(22.3358582, 114.2633857, 1); // set your position to get stuff around (altitude is not needed, you can use 1 for example) //go.getMap().getCatchablePokemon(); // get all currently Catchable Pokemon around you TimeUnit.MILLISECONDS.sleep(500); //List<NearbyPokemon> nearbyPokemon = go.getMap().getNearbyPokemon(); //System.out.println("Pokemon in area:" + nearbyPokemon.size()); List<CatchablePokemon> catchablePokemon = go.getMap().getCatchablePokemon(); System.out.println("Pokemon in catch:" + catchablePokemon.size()); for (CatchablePokemon cp : catchablePokemon) { //tmpdata = cp.getPokemonData(); long timedis = cp.getExpirationTimestampMs() - System.currentTimeMillis(); System.out.println("Pokemon: " + cp.getPokemonId() + ' ' + timedis/1000); } } catch (LoginFailedException | RemoteServerException e) { // failed to login, invalid credentials, auth issue or server issue. Log.e("Main", "Failed to login or server issue: ", e); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
[ "noreply@github.com" ]
uchihatmtkinu.noreply@github.com
38cf2d7fe343b23efd3f6bb15f585220d71143a0
2c5b8aff137117e316f8557bf82e553e55454989
/CrackingCode/MasterAlgorithm/src/main/java/com/dp/leetcode/MeetingConflict.java
58287a76d5d33a88511199fabd3e10b204dddc20
[]
no_license
lamadipen/Algo
33de4fc1e7049c3d597b5e6090e408460fa2e90e
ef9e5f06214a3387dd4dbe7dd3e979a70617da1d
refs/heads/master
2022-10-07T16:52:26.537618
2022-10-05T21:06:05
2022-10-05T21:06:05
82,363,649
2
0
null
2023-09-12T13:55:45
2017-02-18T05:21:18
Java
UTF-8
Java
false
false
4,762
java
package com.dp.leetcode; import java.util.Arrays; import java.util.Comparator; public class MeetingConflict { public static void main(String[] args) { //EqualesImplQuiz(); Integer[][] array = {{0,30},{15,20},{5,10}}; //JAVA 8 IMPLEMENTATION //Arrays.sort(array, Comparator.comparing(pair -> pair[0])); Comparator<Integer[]> comparator = new Comparator<Integer[]>() { @Override public int compare(Integer[] o1, Integer[] o2) { return o1[0].compareTo(o2[0]); //return compare(o1[0],o2[0]); } }; //Using Comparator Arrays.sort(array, comparator); for(int i = 0; i < array.length; i++){ for(int j = 0; j < array[0].length;j++){ System.out.print(array[i][j] + " "); } System.out.println(); } } private static void EqualesImplQuiz() { //What is difference in the below implementation. String apple = null; System.out.println("Apple".equals(null)); System.out.println("Apple".equals(apple)); //This will throw null point exception System.out.println(apple.equals("apple")); } } /* // int a = 5, b = 10 // a = a + b; // b = a - b; // a = a - b; // 3->2->5->1-> // Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] (si < ei), determine if a person could attend all meetings. // Example 1: // Input: [[0,30],[5,10],[15,20]] // Output: false // 0-30 5 -10 15 -20 // // Example 2: // Input: [[7,10],[2,4]] // Output: true // // Example 3: // Input: [[7,10],[6,9]] // Output: false public boolean couldAttend(int[][] input){ Arrays.sort(input, (a,b) -> a[0] - b[0]); //Arrays.stream(input).sorted(Comparator.comparing(val -> )) //int largest = input[0][input.length -1]; // input[0][1]; input[input.length-1][1]; for(int i =0; i < input.length -1; i++){ // i < input.length-1 if(input[i][1] > input[i+1][0] ) //input[i][1] > input[i+1][0] => false { return false; } } return true; } Designing a URL Shortening service like TinyURL Functional Requirements: Given a URL, our service should generate a shorter(length is 6) and unique alias of it. This is called a short link. When users access a short link, our service should redirect them to the original link. For example, if we shorten this page through TinyURL: https://www.educative.io/collection/page/5668639101419520/5649050225344512/5668600916475904/ We would get: http://tinyurl.com/jlg8zpc 1. I need implementation 1. How to convert Long url to Shorter url 2. How to convert a shorter url to the original URl 2. I need the restful service implemention 1. GET, POST or PUT? 2. How to implment the rest service 3. I need the DB design 1. RMSDB? NO-SQL? Why? 2. How many tables? 3. Whats the column we may need 4. I need a high level Capacity Estimation(Optional) 1. How many VMs we may need? -> 1 vm The order that to anwser questions : 4 - 3 - 2 - 1 Daily Active User: 1M QPS : write -> 100, read -> 1000 id primary longur(unique) shortulr(unique) public TinyUrl{ private int id; private String tinryUrl; private String longUrl; } @RestContorller public class UrlController{ @Mapping(value ="/tinyUrl", Method= HttpMethod.Get) public List<TinyUrl> getAllTinyUrls(){ return mockService.getAllTinyList(); } @Mapping(value ="/tinyUrl/{shortUrl}", Method= HttpMethod.Get) public List<TinyUrl> getAllTinyUrls(@Params String id){ return mockService.getTinyById(id); } @Mapping(value ="/tinyUrl", Method= HttpMethod.Post) public List<TinyUrl> getAllTinyUrls(@RequestBody String tinyUrl){ return mockService.savetinyUrl(tinyUrl); } } public String longToShortUrl(String longUrl){ input:https://www.educative.io/collection/page/5668639101419520/5649050225344512/5668600916475904/,https://www.urbandictionary.com/author.php?author=asldkjf%3B output:jlg8zp List<Character> chars = Arrays.asList(new Character[]{A,B,,C}) DateTime currenttime = DateTime.now(); String date =currentTime.toString(); Character[] dateChar = date.toCharArray(); for(int i =0; i < date.length(); i++){ int randomIndex = Math.random(0,date.length); dateaChar[i] = chars.get(randmIndes); } String finalReul= dateChar.toString() } */
[ "lamadipen@yahoo.com" ]
lamadipen@yahoo.com
ca545c3c74be99aaa0f7cb4f50464890c625d9ff
52608e4ce9383dba9492f0749dab6a5057cdd5a9
/auto1.1/src/main/java/com/zc/gener/common/ServiceGenerator.java
346c97de760278f04efa34d1d23c3fb9041b0757
[]
no_license
ZC7025/GeneratorCode
ba854e983286f40e2d4ca746b4a3791af66ddb6f
ff0dafb0222be331a2e98cd0bbabaadd0c0a5f31
refs/heads/master
2020-03-20T13:20:41.979062
2018-06-21T08:21:44
2018-06-21T08:21:44
137,453,335
0
0
null
null
null
null
UTF-8
Java
false
false
2,944
java
package com.zc.gener.common; import com.zc.common.DateFormatUtils; import org.apache.commons.lang3.StringUtils; import com.zc.bean.TableColumns; import com.zc.constant.GeneratorConstants; import com.zc.constant.TemplateConstants; import com.zc.used.enums.DatePatternEnum; import java.util.Calendar; import java.util.List; /** * Service自动生成代码封装类<br/> * * 创建于2018-03-12<br/> * * @author 王振宇 * @version 1.0 */ public class ServiceGenerator { /** * 生成Service接口 * @param tableColumns 表数据 */ public static void generateService(TableColumns tableColumns) { String beanName = GeneratorUtils.tableNameToClassName(tableColumns.getTableName(), "t"); String packagePath = GeneratorUtils.createPackage(GeneratorConstants.SERVICE_PACKAGE); String fileContent = GeneratorUtils.readTemplate(GeneratorConstants.SERVICE_TEMPLATE); fileContent = fileContent.replace(TemplateConstants.CREATE_DATE, DateFormatUtils.format(Calendar.getInstance(), DatePatternEnum.DATE.getValue())) .replace(TemplateConstants.AUTHOR, GeneratorConstants.AUTHOR) .replace(TemplateConstants.BEAN_NAME, beanName); GeneratorUtils.writeFile(fileContent, packagePath, beanName + GeneratorConstants.SERVICE_JAVA_SUFFIX); } /** * 生成所有Service接口 * @param tableColumnsList 所有表数据 */ public static void generateServices(List<TableColumns> tableColumnsList) { for (TableColumns tableColumns : tableColumnsList) { generateService(tableColumns); } } /** * 生成Service接口实现类 * @param tableColumns 表数据 */ public static void generateServiceImpl(TableColumns tableColumns) { String beanName = GeneratorUtils.tableNameToClassName(tableColumns.getTableName(), "t"); String packagePath = GeneratorUtils.createPackage(GeneratorConstants.SERVICE_IMPL_PACKAGE); String fileContent = GeneratorUtils.readTemplate(GeneratorConstants.SERVICE_IMPL_TEMPLATE); fileContent = fileContent.replace(TemplateConstants.CREATE_DATE, DateFormatUtils.format(Calendar.getInstance(), DatePatternEnum.DATE.getValue())) .replace(TemplateConstants.AUTHOR, GeneratorConstants.AUTHOR) .replace(TemplateConstants.BEAN_NAME, beanName) .replace(TemplateConstants.BEAN_NAME_LOWER_CASE, StringUtils.uncapitalize(beanName)); GeneratorUtils.writeFile(fileContent, packagePath, beanName + GeneratorConstants.SERVICE_IMPL_JAVA_SUFFIX); } /** * 生成所有Service接口实现类 * @param tableColumnsList 所有实现类 */ public static void generateServiceImpls(List<TableColumns> tableColumnsList) { for (TableColumns tableColumns : tableColumnsList) { generateServiceImpl(tableColumns); } } }
[ "1531952273@qq.com" ]
1531952273@qq.com
be3638ded95808906c38ae978c0e60649a79f8c8
139960e2d7d55e71c15e6a63acb6609e142a2ace
/mobile_app1/module1227/src/main/java/module1227packageJava0/Foo53.java
59a06d1faaf21ada8f36aa76b73f6b6ee0301e18
[ "Apache-2.0" ]
permissive
uber-common/android-build-eval
448bfe141b6911ad8a99268378c75217d431766f
7723bfd0b9b1056892cef1fef02314b435b086f2
refs/heads/master
2023-02-18T22:25:15.121902
2023-02-06T19:35:34
2023-02-06T19:35:34
294,831,672
83
7
Apache-2.0
2021-09-24T08:55:30
2020-09-11T23:27:37
Java
UTF-8
Java
false
false
568
java
package module1227packageJava0; import java.lang.Integer; public class Foo53 { Integer int0; Integer int1; Integer int2; public void foo0() { new module1227packageJava0.Foo52().foo9(); } public void foo1() { foo0(); } public void foo2() { foo1(); } public void foo3() { foo2(); } public void foo4() { foo3(); } public void foo5() { foo4(); } public void foo6() { foo5(); } public void foo7() { foo6(); } public void foo8() { foo7(); } public void foo9() { foo8(); } }
[ "oliviern@uber.com" ]
oliviern@uber.com
60184939a6e7199f821632914ba50149c9391658
a6779806942cb65889afcc40e47e39f4095df3b1
/src/test/java/DoctorServiceTests.java
5aa853a90b4dc3c5c89f93edeb65ef2bafc582ca
[]
no_license
MorezaFatehyt/PharmacyProject
a823adf3855160328dc99f7c7f76da89cfeac950
13f63318d60d3fb4f6cb377cd26ce75d93fb3a6f
refs/heads/master
2020-05-22T17:02:27.485543
2019-05-09T13:30:20
2019-05-09T13:30:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,249
java
package test.java; import com.pharmacy.context.IContext; import com.pharmacy.context.InMemoryContext; import com.pharmacy.entities.Doctor; import com.pharmacy.entities.User; import com.pharmacy.services.IDoctorService; import com.pharmacy.services.IUserService; import org.junit.Assert; import org.junit.Before; import org.junit.Test; public class DoctorServiceTests { private IContext context; @Before public void InitContext(){ context = new InMemoryContext(); } @Test public void Create_ExistUser_MustNotCreate(){ IDoctorService doctorService = ServiceTestHelper.getDoctorService(context); String existUserId = ServiceTestHelper.getExistUser(context,"test").getId(); Doctor result = doctorService.Create(existUserId, "test", "test"); Assert.assertNull(result); } @Test public void Create_NotExitUser_MustCreate(){ IDoctorService doctorService = ServiceTestHelper.getDoctorService(context); IUserService userService = ServiceTestHelper.getUserService(context); User user = userService.CreateUser("test9123", "P@$$W0rd"); Doctor result = doctorService.Create(user.getId(), "test", "test"); Assert.assertNotNull(result); } }
[ "amirhosseinghorbani7@gmail.com" ]
amirhosseinghorbani7@gmail.com
37968163c2670ab4ccb4a9e7232618769747dc5c
55ddd148a7b2c7ad335ab87c123acc2c8d04d6a3
/app/src/main/java/org/agoenka/flicks/activities/MovieActivity.java
d854ab7a9262cd2c701dd0c84ba2b81ac53891d6
[ "Apache-2.0" ]
permissive
AmitGoenka/Flicks
0257af18abafdfd637d791fd26dd73a002b59aa2
b2a34f46cbcea7904937853c84fba11a97277024
refs/heads/master
2021-01-11T04:21:50.889841
2016-10-22T01:54:20
2016-10-22T01:54:20
71,200,361
0
0
null
null
null
null
UTF-8
Java
false
false
5,641
java
package org.agoenka.flicks.activities; import android.content.Intent; import android.os.Bundle; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.widget.ListView; import android.widget.Toast; import org.agoenka.flicks.R; import org.agoenka.flicks.adapters.MovieArrayAdapter; import org.agoenka.flicks.models.Movie; import org.agoenka.flicks.network.MovieDbClient; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.IOException; import java.util.ArrayList; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnItemClick; import okhttp3.Call; import okhttp3.Callback; import okhttp3.Response; import static org.agoenka.flicks.utils.OsUtils.isNetworkAvailable; public class MovieActivity extends AppCompatActivity { List<Movie> movies; MovieArrayAdapter movieAdapter; @BindView(R.id.lvMovies) ListView lvItems; @BindView(R.id.swipeContainer) SwipeRefreshLayout swipeContainer; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_movie); ButterKnife.bind(this); initSwipeContainer(); movies = new ArrayList<>(); movieAdapter = new MovieArrayAdapter(this, movies); lvItems.setAdapter(movieAdapter); fetchMovies(); } private void initSwipeContainer() { // Configure the refreshing colors swipeContainer.setColorSchemeResources(android.R.color.holo_blue_bright, android.R.color.holo_green_light, android.R.color.holo_orange_light, android.R.color.holo_red_light); // Setup refresh listener which triggers new data loading swipeContainer.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { // code to refresh the list. // once the network request has completed successfully swipeContainer.setRefreshing(false) must be called. fetchMovies(); swipeContainer.setRefreshing(false); } }); } @OnItemClick(R.id.lvMovies) public void OnItemClick(int position) { Intent intent = new Intent(MovieActivity.this, MovieDetailActivity.class); intent.putExtra("selectedMovie", movies.get(position)); startActivity(intent); } private void fetchMovies() { if (!isNetworkAvailable(MovieActivity.this)) { Toast.makeText(MovieActivity.this, "Internet connectivity is not available. Please check your internet connection.", Toast.LENGTH_SHORT).show(); } else { new MovieDbClient().getNowPlayingMovies(new Callback() { @Override public void onResponse(Call call, final Response response) throws IOException { try { if (!response.isSuccessful()) { MovieActivity.this.runOnUiThread(new Runnable() { @Override public void run() { try { Log.d("DEBUG", response.body().string()); Log.d("DEBUG", String.format("Response Status Code: %s", response.code())); Toast.makeText(MovieActivity.this, "The request to fetch movies was unsuccessful!", Toast.LENGTH_SHORT).show(); } catch (IOException e) { Log.d("DEBUG", e.getMessage()); } } }); } else { // Read data on the worker thread String responseData = response.body().string(); // extracting the movie results from the json response final JSONArray movieJsonResults = new JSONObject(responseData).getJSONArray("results"); MovieActivity.this.runOnUiThread(new Runnable() { @Override public void run() { movieAdapter.clear(); movies.clear(); movies.addAll(Movie.fromJsonArray(movieJsonResults)); movieAdapter.notifyDataSetChanged(); Log.d("DEBUG", movies.toString()); } }); } } catch (JSONException e) { Log.d("DEBUG", e.getMessage()); } } @Override public void onFailure(Call call, final IOException e) { // Run view-related code back on the main thread MovieActivity.this.runOnUiThread(new Runnable() { @Override public void run() { Log.d("DEBUG", e.getMessage()); Toast.makeText(MovieActivity.this, "Error occurred while retrieving the movies.", Toast.LENGTH_SHORT).show(); } }); } }); } } }
[ "master.goenka@gmail.com" ]
master.goenka@gmail.com
7f671ba0d19fbc42308a5b21974c6a63896386f2
8dd18d56de5ee19acc7e22c0ed7f686f4784fe47
/cobinhood/src/main/java/api/cobinhood/api/models/chart/Timeframe.java
ef5f27918547314f98b827908bbc626b1722b461
[ "Apache-2.0", "MIT" ]
permissive
dalalsunil1986/Cobinhood.Java
77e4e7a359d397bc8b658b62961d7001bac487a7
15888f117a2862bf84f0641700a51916b6019e0e
refs/heads/master
2021-09-10T20:36:36.412413
2018-04-01T23:55:44
2018-04-01T23:55:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,056
java
package api.cobinhood.api.models.chart; import java.util.Arrays; /** * Created by joel on 3/21/18. */ public enum Timeframe { TIMEFRAME_1_MINUTE("1m"), TIMEFRAME_5_MINUTES("5m"), TIMEFRAME_15_MINUTES("15m"), TIMEFRAME_30_MINUTES("30m"), TIMEFRAME_1_HOUR("1h"), TIMEFRAME_3_HOURS("3h"), TIMEFRAME_6_HOURS("6h"), TIMEFRAME_12_HOUR("12h"), TIMEFRAME_1_DAY("1D"), TIMEFRAME_7_DAYS("7D"), TIMEFRAME_14_DAYS("14D"), TIMEFRAME_1_MONTH("1M"); private final String name; private Timeframe(String s) { name = s; } public boolean equalsName(String otherName) { // (otherName == null) check is not needed because name.equals(null) returns false return name.equals(otherName); } public String toString() { return this.name; } public static Timeframe getByName(String name) { for(Timeframe value:Timeframe.values()) { if(value.name.equals(name)) return value; } return null; } }
[ "jdeanjj1000@gmail.com" ]
jdeanjj1000@gmail.com
714b1fb2a0d3de1ec525a9b2d061de86dbeab4bf
0e8af533eba091197dda0bf29b7040cf5f387897
/ffmpegLib/src/main/java/com/mabeijianxi/smallvideorecord2/UVCMediaRecorderNative.java
29e1c6f065bd3925467b89de95c134c0d0c857a4
[]
no_license
xiechongbin/AndroidFFmpeg
f60c6843f4568d1f24186566ce401575cc22e94f
4c693e8f3535e6f1040c9d6201b686bbc740a329
refs/heads/master
2022-02-25T16:43:58.321572
2018-11-01T06:03:35
2018-11-01T06:03:35
148,434,805
0
0
null
null
null
null
UTF-8
Java
false
false
9,425
java
package com.mabeijianxi.smallvideorecord2; import android.app.Activity; import android.hardware.Camera; import android.hardware.usb.UsbDevice; import android.media.MediaRecorder; import android.os.Handler; import android.os.Looper; import android.view.Surface; import com.mabeijianxi.smallvideorecord2.jniinterface.FFmpegBridge; import com.mabeijianxi.smallvideorecord2.model.MediaObject; import com.serenegiant.usb.IFrameCallback; import com.serenegiant.usb.USBMonitor; import com.serenegiant.usb.UVCCamera; import com.serenegiant.usb.usbcameracommon.UVCCameraHandlerMultiSurface; import com.serenegiant.usb.widget.CameraViewInterface; import com.serenegiant.usb.widget.UVCCameraTextureView; import java.nio.ByteBuffer; /** * 视频录制:边录制边底层处理视频(旋转和裁剪) */ public class UVCMediaRecorderNative extends MediaRecorderBase implements MediaRecorder.OnErrorListener, FFmpegBridge.FFmpegStateListener, IFrameCallback, USBMonitor.OnDeviceConnectListener { /** * 视频后缀 */ private static final String VIDEO_SUFFIX = ".ts"; /** * uvc摄像头相关 */ private final Object mSync = new Object(); private USBMonitor mUSBMonitor; private UVCCameraHandlerMultiSurface mCameraHandler; private UVCCameraTextureView mUVCCameraView; private Activity activity; private final CameraViewInterface.Callback mCallback = new CameraViewInterface.Callback() { @Override public void onSurfaceCreated(final CameraViewInterface view, final Surface surface) { if (mCameraHandler != null) { mCameraHandler.addSurface(surface.hashCode(), surface, false); } } @Override public void onSurfaceChanged(final CameraViewInterface view, final Surface surface, final int width, final int height) { } @Override public void onSurfaceDestroy(final CameraViewInterface view, final Surface surface) { synchronized (mSync) { if (mCameraHandler != null) { mCameraHandler.removeSurface(surface.hashCode()); } } } }; public UVCMediaRecorderNative(Activity activity, UVCCameraTextureView uvcCameraTextureView) { this.activity = activity; this.mUVCCameraView = uvcCameraTextureView; FFmpegBridge.registFFmpegStateListener(this); initUsbCamera(); } private void initUsbCamera() { if (mUSBMonitor == null) { mUSBMonitor = new USBMonitor(activity, this); } registerUsbMonitor(); mUVCCameraView.setCallback(mCallback); synchronized (mSync) { mCameraHandler = UVCCameraHandlerMultiSurface.createHandler(activity, mUVCCameraView, 2, UVCCamera.DEFAULT_PREVIEW_WIDTH, UVCCamera.DEFAULT_PREVIEW_HEIGHT, 1); } mCameraHandler.setFrameCallback(this); } /** * 开始录制 */ @Override public MediaObject.MediaPart startRecord() { int vCustomFormat; if (mCameraId == Camera.CameraInfo.CAMERA_FACING_BACK) { vCustomFormat = FFmpegBridge.ROTATE_90_CROP_LT; } else { vCustomFormat = FFmpegBridge.ROTATE_270_CROP_LT_MIRROR_LR; } FFmpegBridge.prepareJXFFmpegEncoder(mMediaObject.getOutputDirectory(), mMediaObject.getBaseName(), vCustomFormat, mSupportedPreviewWidth, SMALL_VIDEO_HEIGHT, SMALL_VIDEO_WIDTH, SMALL_VIDEO_HEIGHT, mFrameRate, mVideoBitrate); MediaObject.MediaPart result = null; if (mMediaObject != null) { result = mMediaObject.buildMediaPart(mCameraId, VIDEO_SUFFIX); String cmd = String.format("filename = \"%s\"; ", result.mediaPath); //如果需要定制非480x480的视频,可以启用以下代码,其他vf参数参考ffmpeg的文档: if (mAudioRecorder == null && result != null) { mAudioRecorder = new AudioRecorder(this); mAudioRecorder.start(); } mRecording = true; } return result; } /** * 停止录制 */ @Override public void stopRecord() { super.stopRecord(); if (mOnEncodeListener != null) { mOnEncodeListener.onEncodeStart(); } FFmpegBridge.recordEnd(); } /** * 数据回调(内置摄像头) */ @Override public void onPreviewFrame(byte[] data, Camera camera) { super.onPreviewFrame(data, camera); } /** * usb摄像头数据回调 */ @Override public void onFrame(ByteBuffer frame) { if (mRecording) { int length = frame.limit(); byte[] data = new byte[length]; frame.get(data, 0, length); frame.flip(); FFmpegBridge.encodeFrame2H264(data); mPreviewFrameCallCount++; } } /** * 预览成功,设置视频输入输出参数 */ @Override protected void onStartPreviewSuccess() { // if (mCameraId == Camera.CameraInfo.CAMERA_FACING_BACK) { // UtilityAdapter.RenderInputSettings(mSupportedPreviewWidth, SMALL_VIDEO_WIDTH, 0, UtilityAdapter.FLIPTYPE_NORMAL); // } else { // UtilityAdapter.RenderInputSettings(mSupportedPreviewWidth, SMALL_VIDEO_WIDTH, 180, UtilityAdapter.FLIPTYPE_HORIZONTAL); // } // UtilityAdapter.RenderOutputSettings(SMALL_VIDEO_WIDTH, SMALL_VIDEO_HEIGHT, mFrameRate, UtilityAdapter.OUTPUTFORMAT_YUV | UtilityAdapter.OUTPUTFORMAT_MASK_MP4/*| UtilityAdapter.OUTPUTFORMAT_MASK_HARDWARE_ACC*/); } @Override public void onError(MediaRecorder mr, int what, int extra) { try { if (mr != null) mr.reset(); } catch (IllegalStateException e) { Log.e("stopRecord", e); } catch (Exception e) { Log.e("stopRecord", e); } if (mOnErrorListener != null) mOnErrorListener.onVideoError(what, extra); } /** * 接收音频数据,传递到底层 */ @Override public void receiveAudioData(byte[] sampleBuffer, int len) { if (mRecording && len > 0) { FFmpegBridge.encodeFrame2AAC(sampleBuffer); } } @Override public void allRecordEnd() { final boolean captureFlag = FFMpegUtils.captureThumbnails(mMediaObject.getOutputTempTranscodingVideoPath(), mMediaObject.getOutputVideoThumbPath(), String.valueOf(CAPTURE_THUMBNAILS_TIME)); if (mOnEncodeListener != null) { new Handler(Looper.getMainLooper()).postDelayed(new Runnable() { @Override public void run() { if (captureFlag) { mOnEncodeListener.onEncodeComplete(); } else { mOnEncodeListener.onEncodeError(); } } }, 0); } } public void activityStop() { FFmpegBridge.unRegistFFmpegStateListener(this); } /** * usb设备关联上 */ @Override public void onAttach(UsbDevice device) { Log.d("usb camera attach"); if (mUSBMonitor != null) { boolean result = mUSBMonitor.requestPermission(device); Log.d("usb mUSBMonitor result =" + result); } } /** * usb设备失去关联 */ @Override public void onDetach(UsbDevice device) { Log.d("usb camera detach"); } /** * usb设备连接上 */ @Override public void onConnect(final UsbDevice device, final USBMonitor.UsbControlBlock ctrlBlock, final boolean createNew) { Log.d("usb camera onConnect"); synchronized (mSync) { if (mCameraHandler == null) { mCameraHandler = UVCCameraHandlerMultiSurface.createHandler(activity, mUVCCameraView, 2, UVCCamera.DEFAULT_PREVIEW_WIDTH, UVCCamera.DEFAULT_PREVIEW_HEIGHT, 1); mCameraHandler.open(ctrlBlock); mCameraHandler.startPreview(); } else { if (!mCameraHandler.isOpened()) { mCameraHandler.open(ctrlBlock); mCameraHandler.startPreview(); } } } } /** * usb设备断开连接 */ @Override public void onDisconnect(UsbDevice device, USBMonitor.UsbControlBlock ctrlBlock) { Log.d("usb camera disConnect"); synchronized (mSync) { if (mCameraHandler != null) { new Thread(new Runnable() { @Override public void run() { mCameraHandler.close(); } }).start(); } } } /** * usb设备取消连接 */ @Override public void onCancel(UsbDevice device) { Log.d("usb camera cancel"); } /** * 注册usbMonitor */ private void registerUsbMonitor() { if (mUSBMonitor != null && !mUSBMonitor.isRegistered()) { mUSBMonitor.register(); } } /** * 反注册usbMonitor */ private void unRegisterUsbMonitor() { if (mUSBMonitor != null && mUSBMonitor.isRegistered()) { mUSBMonitor.unregister(); mUSBMonitor = null; } } }
[ "xiecb@gzyitop.com" ]
xiecb@gzyitop.com
480d1a04bbb264b6e8f8938e7aba0461588c17f4
da01672123434e3669d01d0eb94b55728a463238
/src/main/java/trainor/sean/Job.java
a73e1344e775ef3dbfc407aa8d3d5d3f5eae436b
[]
no_license
Dogfoger/Assignment3ADP
1a3c62a5ec246e382ac020ef71344dff9dcbd213
8552da96da035d3472ee7323b84f20bf15cd4eaa
refs/heads/master
2021-02-12T23:44:12.316601
2020-03-03T13:45:41
2020-03-03T13:45:41
244,643,117
0
0
null
2020-10-13T20:01:46
2020-03-03T13:28:19
Java
UTF-8
Java
false
false
548
java
package trainor.sean; public class Job { private String duties; private int wage; private int employeeID; public void setDuties(String duties) { this.duties = duties; } public void setWage(int wage) { this.wage = wage; } public void setEmployeeID(int employeeID) { this.employeeID = employeeID; } public String getDuties() { return duties; } public int getWage() { return wage; } public int getEmployeeID() { return employeeID; } }
[ "seanr.trainor4@gmail.com" ]
seanr.trainor4@gmail.com
39f38d61eed5713f8ddd3635ee54e49f0cc391ea
53deaec83aa792d7fa678149d2d4b2ad5cab2e97
/eclipse-workspace/ShriResumeMavenProject/src/test/java/stepDefinations/Hooks.java
f3ae4343f6fb84920ea31fe32ed68ceae3db926a
[]
no_license
neharaj95/Demo2Neha
4761312cd2574d3db40e93fe11ac9478980372b4
5541a81c133e63be16d7879b729739fc3710d919
refs/heads/master
2023-02-08T17:03:15.175658
2020-12-25T06:41:05
2020-12-25T06:41:05
324,521,541
0
0
null
null
null
null
UTF-8
Java
false
false
651
java
package stepDefinations; import java.io.IOException; import org.openqa.selenium.WebDriver; import Basic.BaseShriResume; import cucumber.api.java.After; import cucumber.api.java.Before; public class Hooks extends BaseShriResume{ public static WebDriver driver; @Before("@SmokeTest") public static void afterValidation_method() throws IOException { System.out.println("Smoke test"); BaseShriResume.getDriver(); System.out.println("Smoke test 2"); //driver=BaseShriResume.getDriver(); //new BaseShriResume(); //BaseShriResume.getDriver(); } @After("@SmokeTest") public static void LogIN() { System.out.println("pass"); } }
[ "nehulraj95@gmail.com" ]
nehulraj95@gmail.com
e2fbb253dece9d4aff1c730befe7ff29e7f55f1a
49c53000572711cb4b3926f562d1b249bd5a1c87
/ExerciciUnify/src/test/java/com/unify/test/RunWith.java
4b7d11f8ef9c4fb70158cf0f4b0b529732fc1925
[]
no_license
marcx92/git_test
c5a2346e61b2c5081a666cea78054f6db708ca67
6c999a97aa660364019bb87afd4f4f14b09124ac
refs/heads/master
2020-04-04T23:24:17.525943
2019-03-05T08:46:48
2019-03-05T08:46:48
155,359,205
0
0
null
null
null
null
UTF-8
Java
false
false
61
java
package com.unify.test; public @interface RunWith { }
[ "noreply@github.com" ]
marcx92.noreply@github.com
d3649df49d4a68ebe53c45320f93f0132d899c33
21965f1edcd861a81625c9c5d75e1114fd613908
/src/main/java/com/tavisca/cache/annotation/impl/CacheMethodInvocationHandler.java
d25b2f2e3e8aff0da38d6059b90d1956b671f6cd
[]
no_license
naresh-coditas/in-memory-cache
febdc298b263e7f29fcebd3792230d49f24a4966
9c4130a3ccf3cac9e1b148952dafb9f7bc3db516
refs/heads/master
2021-07-09T16:23:26.181038
2019-09-04T05:55:50
2019-09-04T05:55:50
206,160,996
0
0
null
2020-10-13T15:46:59
2019-09-03T19:53:41
Java
UTF-8
Java
false
false
5,227
java
package com.tavisca.cache.annotation.impl; import java.beans.PropertyDescriptor; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.util.Optional; import com.tavisca.cache.annotation.CacheRemove; import com.tavisca.cache.annotation.CacheSet; import com.tavisca.cache.annotation.Cacheable; import com.tavisca.cache.impl.CacheManager; /** * This Class Represents the Enhance the Cache Features using Annotation * and by implementing CacheService * This Class Uses the Java Dynamic Proxy Features * @author Naresh Mahajan * */ public class CacheMethodInvocationHandler implements InvocationHandler { /** * Cache Enabled Service Object */ private final Object obj; /** * Initialize proxy Method Invocation Handler * @param obj */ public CacheMethodInvocationHandler(final Object objRef) { this.obj = objRef; } /** * This is Proxy Handler Method called when Proxied Object method get's called. * This Method Uses CacheManager methods for Cache Operation */ @Override public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable { Object result = null; Object annotation = null; Method annotaionMethod = null; try { Class<?>[] paramTypes = new Class<?>[method.getParameterCount()]; for (int i = 0; i < args.length; i++) { paramTypes[i] = args[i].getClass(); } annotation = this.checkCacheAnnotationPresent(method, paramTypes); if (annotation != null) { annotaionMethod = this.obj.getClass().getMethod(method.getName(), paramTypes); result = this.annotationProcess(annotation, annotaionMethod, args); } } catch (NoSuchMethodException e) { e.printStackTrace(); } return result; } /** * This Method Checks the Cache Annotation Presence on Requested method. * @param method * @param types * @return AnnotationObject */ private Object checkCacheAnnotationPresent(final Method method, final Class<?> ...types) { Object result = null; try { final Method objMethod = this.obj.getClass().getMethod(method.getName(), types); if (objMethod.isAnnotationPresent(Cacheable.class)) { result = objMethod.getAnnotation(Cacheable.class); } else if (objMethod.isAnnotationPresent(CacheSet.class)) { result = objMethod.getAnnotation(CacheSet.class); } else if (objMethod.isAnnotationPresent(CacheRemove.class)) { result = objMethod.getAnnotation(CacheRemove.class); } } catch (NoSuchMethodException e) { e.printStackTrace(); } return result; } /** * This Method Uses Cache Manager Functionalities as per Input Annotation Object * @param annotation * @param method * @param args * @return */ private Object annotationProcess(final Object annotation, final Method method, final Object ... args) { Optional<Object> result = Optional.empty(); try { if (annotation instanceof Cacheable) { final CacheManager cacheManager = CacheManager.getInstance(); final Cacheable cacheable = (Cacheable) annotation; Object idValue = args[0]; Optional<String> checkNull = Optional.ofNullable(cacheable.propertyKey()); if (checkNull.isPresent()) { String propKey = cacheable.propertyKey(); PropertyDescriptor pd = new PropertyDescriptor(propKey, args[0].getClass()); Method getter = pd.getReadMethod(); idValue = getter.invoke(args[0]); } String objectKey = obj.getClass().getTypeName().concat("_").concat(String.valueOf(idValue)); result = Optional.ofNullable(cacheManager.get(objectKey)); if (!result.isPresent()) { result = Optional.ofNullable(method.invoke(obj, args)); cacheManager.set(objectKey, result.orElse(null)); } } else if (annotation instanceof CacheSet) { CacheManager cacheManager = CacheManager.getInstance(); CacheSet cacheable = (CacheSet) annotation; Object idValue = args[0]; Optional<String> checkNull = Optional.ofNullable(cacheable.propertyKey()); if (checkNull.isPresent()) { String propKey = cacheable.propertyKey(); PropertyDescriptor pd = new PropertyDescriptor(propKey, args[0].getClass()); Method getter = pd.getReadMethod(); idValue = getter.invoke(args[0]); } String objectKey = obj.getClass().getTypeName().concat("_").concat(String.valueOf(idValue)); result = Optional.ofNullable(method.invoke(obj, args)); cacheManager.set(objectKey, result.orElse(null)); } else if (annotation instanceof CacheRemove) { CacheManager cacheManager = CacheManager.getInstance(); CacheRemove cacheable = (CacheRemove) annotation; Object idValue = args[0]; Optional<String> checkNull = Optional.ofNullable(cacheable.propertyKey()); if (checkNull.isPresent()) { String propKey = cacheable.propertyKey(); PropertyDescriptor pd = new PropertyDescriptor(propKey, args[0].getClass()); Method getter = pd.getReadMethod(); idValue = getter.invoke(args[0]); } result = Optional.ofNullable(method.invoke(obj, args)); String objectKey = obj.getClass().getTypeName().concat("_").concat(String.valueOf(idValue)); cacheManager.remove(objectKey); } } catch (Exception e) { e.printStackTrace(); } return result.orElse(null); } }
[ "nareshmahajan87@gmail.com" ]
nareshmahajan87@gmail.com
dae0216b9ac7025ed0476700670528b654db64d3
e324a41e6f55f7153e26fafff4ed9060c75fe2ee
/src/main/java/com/boot/pg/crud/bootpostgrescrud/model/User.java
845cad5579702b4fe9e74a0f1a55065f47ca43a1
[]
no_license
nprate/boot-postgres-crud
7f42422befe094ae9b52377651f5a799a84f3336
b20374237ba2c2a032fb5ef870db7742047343e3
refs/heads/main
2023-01-21T09:24:04.837961
2020-12-04T16:34:20
2020-12-04T16:34:20
318,520,454
0
0
null
null
null
null
UTF-8
Java
false
false
835
java
package com.boot.pg.crud.bootpostgrescrud.model; public class User { private long id; private String first_name; private String last_name; public User() { // TODO Auto-generated constructor stub } public User(String first_name, String last_name) { this.first_name = first_name; this.last_name = last_name; } public long getId() { return id; } public void setId(long id) { this.id = id; } public String getFirst_name() { return first_name; } public void setFirst_name(String first_name) { this.first_name = first_name; } public String getLast_name() { return last_name; } public void setLast_name(String last_name) { this.last_name = last_name; } @Override public String toString() { return "User [id=" + id + ", first_name=" + first_name + ", last_name=" + last_name + "]"; } }
[ "natthanon.prat@gmail.com" ]
natthanon.prat@gmail.com
f1f9e388403ab296d4eb11d5c8c345d4891f0af0
2eafa648cf8be6afbaa150c9941bf67f0ced4a28
/Madodis/src/br/edu/facol/gestaoacademicaweb/pojo/AlunoProva.java
936ee09344eae5ab6da1c25880904892f3d0fd53
[]
no_license
djairvieira/Madodis_Kalangus
a81fd5207257afee7b913a5af72aaa2c464242a2
f29028f17e1bacdebe572891ca00d0e303dc65c6
refs/heads/master
2020-12-03T00:41:08.310866
2017-07-10T01:37:51
2017-07-10T01:37:51
96,061,957
1
0
null
null
null
null
WINDOWS-1252
Java
false
false
937
java
package br.edu.facol.gestaoacademicaweb.pojo; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.OneToOne; import javax.persistence.Table; import javax.validation.constraints.Max; import javax.validation.constraints.Min; @Entity @Table(name="TB_ALUNO_PROVA") public class AlunoProva extends BaseObject { @OneToOne(fetch=FetchType.EAGER) private Aluno aluno; @Min(value=0, message="O valor minimo para a nota é 0.") @Max(value=10, message="O valor maximo para a nota é 10") @Column(name="NOTA") private float nota; public Aluno getAluno() { return aluno; } public void setAluno(Aluno aluno) { this.aluno = aluno; } public float getNota() { return nota; } public void setNota(float nota) { this.nota = nota; } @Override public String toString() { return "AlunoProva[id = "+ getId() +", aluno = "+ aluno.getNome() +"]"; } }
[ "djairv53@gmail.com" ]
djairv53@gmail.com
2210da072d70308490874586a07ac5e2ccf413da
2d2235d1b0a3c50b0d23bca6d48b47ab64b1a04a
/drools-core/src/main/java/org/drools/core/metadata/ToManyPropertyLiteral.java
d0a9d9a2266956741b9cc00cb725865347e895a5
[ "Apache-2.0" ]
permissive
NeoLoo/drools
25f98316c74911068d34e1692c90f1342fa435fb
3a31d023ea590114683a82d68c5e6ac8c5d49ae9
refs/heads/master
2020-12-30T23:08:45.309370
2015-04-28T11:53:06
2015-04-28T11:53:15
34,831,771
1
0
null
2015-04-30T03:18:18
2015-04-30T03:18:18
null
UTF-8
Java
false
false
2,260
java
package org.drools.core.metadata; import java.net.URI; import java.util.ArrayList; import java.util.Collections; import java.util.List; public abstract class ToManyPropertyLiteral<T,R> extends PropertyLiteral<T,R,List<R>> implements ManyValuedMetaProperty<T,R,List<R>> { public ToManyPropertyLiteral( int index, Class<T> klass, String name ) { super( index, klass, name ); } public ToManyPropertyLiteral( int index, String name, URI key ) { super( index, name, key ); } public abstract void set( T o, List<R> values ); @Override public void set( T o, List<R> values, Lit mode ) { switch ( mode ) { case SET: set( o, new ArrayList( values ) ); break; case ADD: List<R> list = get( o ); if ( list == null ) { list = new ArrayList(); set( o, list ); } list.addAll( values ); break; case REMOVE: List<R> curr = get( o ); if ( curr != null ) { curr.removeAll( values ); } break; } } @Override public void set( T o, R value, Lit mode ) { switch ( mode ) { case SET: set( o, Collections.singletonList( value ) ); break; case ADD: List<R> list = get( o ); if ( list == null ) { list = new ArrayList(); } list.add( value ); set( o, list ); break; case REMOVE: List<R> curr = get( o ); if ( curr != null ) { curr.remove( value ); } set( o, curr ); break; } } @Override public boolean isManyValued() { return true; } @Override public OneValuedMetaProperty<T,List<R>> asFunctionalProperty() { return (OneValuedMetaProperty<T,List<R>>) this; } @Override public ManyValuedMetaProperty<T,R,List<R>> asManyValuedProperty() { return this; } }
[ "dsotty@gmail.com" ]
dsotty@gmail.com
f5cf7c0b1a574d6f20778e664cfcc3d66169902e
baebcc04c74b66331171e321a1a45a7f6497582b
/src/rpc/RpcHelper.java
1c957eed130ce5cb41fe8563a17d1b09e9ca74b6
[]
no_license
anl135/Irvine
cc5f15a1a38db29d8aef8f9484de9fd36f3f3bc1
ae6dded16243089bd5a093b967552fec51fde326
refs/heads/master
2020-04-28T14:36:47.083040
2019-03-13T04:05:53
2019-03-13T04:05:53
175,343,646
0
0
null
null
null
null
UTF-8
Java
false
false
1,433
java
package rpc; import java.io.BufferedReader; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.json.JSONArray; import org.json.JSONObject; public class RpcHelper { // Writes a JSONArray to http response. public static void writeJsonArray(HttpServletResponse response, JSONArray array) throws IOException{ response.setContentType("application/json"); response.setHeader("Access-Control-Allow-Origin", "*"); PrintWriter out = response.getWriter(); out.print(array); out.close(); } // Writes a JSONObject to http response. public static void writeJsonObject(HttpServletResponse response, JSONObject obj) throws IOException { response.setContentType("application/json"); response.setHeader("Access-Control-Allow-Origin", "*"); PrintWriter out = response.getWriter(); out.print(obj); out.close(); } // Parses a JSONObject from http request. public static JSONObject readJSONObject(HttpServletRequest request) { StringBuilder sBuilder = new StringBuilder(); try (BufferedReader reader = request.getReader()) { String line = null; while((line = reader.readLine()) != null) { sBuilder.append(line); } return new JSONObject(sBuilder.toString()); } catch (Exception e) { e.printStackTrace(); } return new JSONObject(); } }
[ "anzhe5657@gmail.com" ]
anzhe5657@gmail.com
669c45389a1ffc5714c0b34367bd89a2752dfa3e
75ab502990dcae6ae88f36f9261f4d5de2c12d52
/src/lezioni/lezione9/music/Note.java
e7ee6052402f8f2fd64ccc71de5962b9838a5fa7
[]
no_license
aguero90/JAVA_TLP
cb0d9dc4b39484bebe2411b633e481a055ab29b4
9802de8db38e8d26e797040bcd69f1ed2f1b876b
refs/heads/master
2021-01-18T14:02:13.241978
2015-03-15T19:21:18
2015-03-15T19:21:18
32,279,186
2
0
null
null
null
null
UTF-8
Java
false
false
529
java
//: c07:music:Note.java // Notes to play on musical instruments. // From 'Thinking in Java, 3rd ed.' (c) Bruce Eckel 2002 // www.BruceEckel.com. See copyright notice in CopyRight.txt. package lezione9.music; public class Note { private String noteName; private Note(String noteName) { this.noteName = noteName; } public String toString() { return noteName; } public static final Note MIDDLE_C = new Note("Middle C"), C_SHARP = new Note("C Sharp"), B_FLAT = new Note("B Flat"); // Etc. } ///:~
[ "a.univaq@hotmail.it" ]
a.univaq@hotmail.it
e16437ff0401c908dedb14d63305009b8fab9bf9
21d70bfeb8139da4c458351463d3059ddeabcdf3
/java SE阶段/day06_多线程之同步/代码/day06/src/cn/itcast/demo03_sync/Ticket.java
8dd7054d151de277b6f16140fdacffa07aba6a1e
[]
no_license
Zhangxb1111/techSource
92322e1fba28da1fa067b629c7926bbde34c3014
9e3e690ea380323ff857249a699f62414eb8bfd2
refs/heads/master
2023-01-20T00:18:50.703877
2020-11-17T12:57:47
2020-11-17T12:57:47
299,050,652
1
0
null
null
null
null
UTF-8
Java
false
false
992
java
package cn.itcast.demo03_sync; /* 定义票 并且这个类是线程任务类,线程要执行的任务是卖票 所以还要再run方法中进行卖票的操作。 如果多个线程操作共享数据,那么有可能引发线程安全问题。 */ public class Ticket implements Runnable{ //定义票 int num = 100; //在run方法中进行买票的操作 @Override public void run() { //定义死循环一直去卖票 while(true) { //如果还有票,那么就卖票 if(num > 0) { //掏身份证,磨磨唧唧,用了10ms try { Thread.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } //进行卖票操作 System.out.println(Thread.currentThread().getName() + "正在卖第" + num + "张票"); num--; } } } }
[ "2955356960@qq.com" ]
2955356960@qq.com
6be6d2638aa378e329c5661faae050b9e991b0b5
0e7f6fe515fa7df5485162731d6bb0de44c4ce53
/Spike_Game_Engine/src/GameEngine/Graphics/Font.java
8393e06330a699f805ee23b38c7d1e8574ece15f
[]
no_license
juliuszlosinski/Java_Game_Engine
8a83e5cbc6967f8525020c902b76fbdcd8debe61
a690d4137e0cab9700c249485a6d97129be4d805
refs/heads/main
2023-04-09T19:51:45.598558
2021-04-21T12:33:30
2021-04-21T12:33:30
359,945,093
3
0
null
null
null
null
UTF-8
Java
false
false
942
java
package GameEngine.Graphics; public class Font extends ImageBase { //REGION: CLASSES AREA //REGION: FIELDS public static final Font DEFAULT=new Font("/DefaultFont.png",16,16); // Default font. //END REGION //END REGION //REGION: INSTANCES AREA //REGION: FIELDS private int widthOfOneLetter; // Width of one letter in the image. private int heightOfOneLetter; // Height of one letter in the image. //END REGION //REGION: CONSTRUCTORS public Font(String path, int widthOfOneLetter, int heightOfOneLetter) { //TODO: Get an image of the font and information about one letter. super(path); this.widthOfOneLetter=widthOfOneLetter; this.heightOfOneLetter=heightOfOneLetter; } //END REGION //REGION: PROPORTIES public int getHeightOfOneLetter() { return heightOfOneLetter; } public int getWidthOfOneLetter() { return widthOfOneLetter; } //END REGION //END REGION }
[ "noreply@github.com" ]
juliuszlosinski.noreply@github.com
ef531f829a83a3f88260031d77de4405c16a002b
7e2eb4cafa490339ef0edb67c1ef8eb966b30261
/app/src/androidTest/java/com/minhhieu/mufi/ExampleInstrumentedTest.java
cfc70dd9debcaad81a1d3241dc941b53987cbde4
[]
no_license
papermanz/Mufi
8d6cb4b2757b28f4c8c3755f4da56f7ee4572542
a3d719852d23a4170ec0e711ffb4cc4a20ba85e0
refs/heads/master
2022-12-22T21:18:32.423168
2020-10-06T03:13:40
2020-10-06T03:13:40
287,498,740
0
0
null
null
null
null
UTF-8
Java
false
false
748
java
package com.minhhieu.mufi; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented 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() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.minhhieu.mufi", appContext.getPackageName()); } }
[ "kaitakenzo@gmail.com" ]
kaitakenzo@gmail.com
922f1790e11d8d7a3e46deb8e1be2f425cd4c01a
b6ab7f8d36e3ae84505abd69a53707c70dad9c1c
/src/net/xmf/nutz/module/CommonModule.java
f9d67590fb5a8dc98523a899a699363be49ac5d6
[]
no_license
coralandbill/MyNutz
e8a319d499c5f6c8588d8d122d1196ae98142239
d7334fb55833745d85c0ff02bbea20f60fbd26ad
refs/heads/master
2020-05-26T20:03:25.168461
2015-01-04T05:45:06
2015-01-04T05:45:06
28,328,513
0
0
null
null
null
null
UTF-8
Java
false
false
227
java
package net.xmf.nutz.module; import org.nutz.dao.Dao; import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; @IocBean public class CommonModule { @Inject public Dao dao; }
[ "347135219@qq.com" ]
347135219@qq.com
625e30fa6fa1059868e67825697cc2b9c78a1518
8bc5a746efd9025d232c8a25495dd3ea807a90ec
/lab2/driverDFA.java
ee311c3e13c677b3541e37fbc66a755b09c81288
[]
no_license
RichardLiao321/Cmpt440L-Formal-Languages
5640c5835d43a0fd09c6fa3563a4e0be4a304f67
665b39bbb9fc53e956e141676d7174c7025bfaca
refs/heads/master
2021-01-10T15:27:25.841783
2016-05-12T15:19:30
2016-05-12T15:19:30
51,482,695
0
0
null
null
null
null
UTF-8
Java
false
false
663
java
package lab2; import java.io.IOException; import java.util.Scanner; public class driverDFA { public static void main(String[]args)throws IOException{ /*BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String s = in.readLine(); while(s!=null){ s=in.readLine(); System.out.println(s); }*/ //Read in user input FIXME:buffered reader??? What is wanted for reading input Scanner userInput = new Scanner(System.in); System.out.print("Enter a solution: \n"); String solutionString = userInput.nextLine(); //Call manwolf main to run ManWolf manWolf = new ManWolf(solutionString); manWolf.main(args); } }
[ "rliao321@gmail.com" ]
rliao321@gmail.com
84860a9c8cc53e3fd30a52bbd42305e9be076780
3f3d082d369aba513107a98676734d1234b0e070
/assignments/part-1/percolation/Percolation.java
9651048cc00d5d2d7b89ad3556d6b233d0c98924
[]
no_license
MoeAl-Ani/algorithms-princeton-univerisity
eb265e848ec331911301e104ae8b3b3f740c6549
7412df9f2a952df623cbe7ae5a1e7c1bedf571c0
refs/heads/master
2022-12-12T00:56:20.591206
2020-09-11T09:26:45
2020-09-11T09:26:45
294,647,863
0
0
null
null
null
null
UTF-8
Java
false
false
5,025
java
import edu.princeton.cs.algs4.WeightedQuickUnionUF; public class Percolation { private final int gridSize; private final boolean[][] grid; private final int[][] gridIndexValue; private int openSiteCount = 0; private final WeightedQuickUnionUF uf; private final int virtualTop; private final int virtualBottom; public Percolation(int gridSize) { validateGridSize(gridSize); this.gridSize = gridSize; this.grid = new boolean[gridSize][gridSize]; this.gridIndexValue = new int[gridSize][gridSize]; for (int i = 0; i < grid.length; i++) { for (int j = 0; j < grid.length; j++) { grid[i][j] = false; gridIndexValue[i][j] = (i * grid.length) + j; } } this.virtualTop = gridSize * gridSize + 1; this.virtualBottom = gridSize * gridSize + 2; uf = new WeightedQuickUnionUF(gridSize * gridSize + 3); } public boolean isOpen(int row, int col) { validateRowCol(row, col); return grid[row - 1][col - 1]; } public void open(int row, int col) { validateRowCol(row, col); if (!isOpen(row, col)) { grid[row - 1][col - 1] = true; openSiteCount++; if (isSiteInTop(row)) { uf.union(virtualTop, gridIndexValue[row - 1][col - 1]); } if (isSiteInBottom(row)) { uf.union(virtualBottom, gridIndexValue[row - 1][col - 1]); } if (isSiteRightEdge(col)) { if (isLeftSiteOpen(row, col)) { uf.union(gridIndexValue[row - 1][col - 1], gridIndexValue[row - 1][col - 2]); } if (isBottomSiteOpen(row, col)) { uf.union(gridIndexValue[row - 1][col - 1], gridIndexValue[row][col - 1]); } } if (isSiteLeftEdge(col)) { if (isRightSiteOpen(row, col)) { uf.union(gridIndexValue[row - 1][col - 1], gridIndexValue[row - 1][col]); } if (isBottomSiteOpen(row, col)) { uf.union(gridIndexValue[row - 1][col - 1], gridIndexValue[row][col - 1]); } } if (isRightSiteOpen(row, col)) { uf.union(gridIndexValue[row - 1][col - 1], gridIndexValue[row - 1][col]); } if (isLeftSiteOpen(row, col)) { uf.union(gridIndexValue[row - 1][col - 1], gridIndexValue[row - 1][col - 2]); } if (isBottomSiteOpen(row, col)) { uf.union(gridIndexValue[row - 1][col - 1], gridIndexValue[row][col - 1]); } if (isTopSiteOpen(row, col)) { uf.union(gridIndexValue[row - 1][col - 1], gridIndexValue[row - 2][col - 1]); } } } public boolean isFull(int row, int col) { validateRowCol(row, col); int site = gridIndexValue[row - 1][col - 1]; int p = uf.find(site); int vTop = uf.find(virtualTop); return isOpen(row, col) && p == vTop; } public boolean percolates() { // check from top to bottom if there is a connection int top = uf.find(virtualTop); int bottom = uf.find(virtualBottom); return top == bottom; } public int numberOfOpenSites() { return openSiteCount; } private boolean isSiteLeftEdge(int col) { return col - 1 == 0; } private boolean isSiteRightEdge(int col) { return col - 1 == gridSize - 1; } private boolean isSiteInTop(int row) { return row - 1 == 0; } private boolean isSiteInBottom(int row) { return row - 1 == gridSize - 1; } private boolean isLeftSiteOpen(int row, int col) { if (!isInbound(row - 1, col - 2)) return false; return grid[row - 1][col - 2]; } private boolean isRightSiteOpen(int row, int col) { if (!isInbound(row - 1, col)) return false; return grid[row - 1][col]; } private boolean isTopSiteOpen(int row, int col) { if (!isInbound(row - 2, col - 1)) return false; return grid[row - 2][col - 1]; } private boolean isBottomSiteOpen(int row, int col) { if (!isInbound(row, col - 1)) return false; return grid[row][col - 1]; } private boolean isInbound(int row, int col) { if (row < 0 || row >= gridSize) return false; if (col < 0 || col >= gridSize) return false; return true; } private void validateRowCol(int row, int col) { if (row < 1 || row > gridSize) { throw new IllegalArgumentException("row out of range"); } if (col < 1 || col > gridSize) { throw new IllegalArgumentException("col out of range"); } } private void validateGridSize(int n) { if (n <= 0) throw new IllegalArgumentException("n must be greator than 0"); } }
[ "mohammedalanny@gmail.com" ]
mohammedalanny@gmail.com
f8d788cdb40cc8429763b0d910aef683f1338b25
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/8/8_7db520beb17545ef1244f36bf3deed01b9c40faa/RestController/8_7db520beb17545ef1244f36bf3deed01b9c40faa_RestController_t.java
d7317a2571e6c373447eb3d782a795ac2318ee78
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
22,997
java
/** * Copyright (C) 2011, 2012 Alejandro Ayuso * * This file is part of Jongo. * Jongo is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * Jongo 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 Jongo. If not, see <http://www.gnu.org/licenses/>. */ package jongo; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import java.util.Map; import javax.ws.rs.core.Response; import jongo.config.JongoConfiguration; import jongo.exceptions.JongoBadRequestException; import jongo.jdbc.JDBCExecutor; import jongo.jdbc.LimitParam; import jongo.jdbc.OrderParam; import jongo.jdbc.StoredProcedureParam; import jongo.rest.xstream.JongoError; import jongo.rest.xstream.JongoHead; import jongo.rest.xstream.JongoResponse; import jongo.rest.xstream.JongoSuccess; import jongo.rest.xstream.Row; import jongo.sql.Delete; import jongo.sql.DynamicFinder; import jongo.sql.Insert; import jongo.sql.Select; import jongo.sql.SelectParam; import jongo.sql.Table; import jongo.sql.Update; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Controller for the RESTful operations. Serves as a backend for the {@link jongo.JongoWS} implementations. * @author Alejandro Ayuso */ public class RestController { private static final Logger l = LoggerFactory.getLogger(RestController.class); private static final JongoConfiguration conf = JongoConfiguration.instanceOf(); private final String alias; private final String database; /** * Instantiates a new controller for the given database/schema if this exists * @param alias the name of the database/schema to work with * @throws IllegalArgumentException if the database/schema name is blank, empty or null */ public RestController(String alias){ if(StringUtils.isBlank(alias)) throw new IllegalArgumentException("Alias name can't be blank, empty or null"); this.alias = alias; this.database = conf.getDatabaseConfigurationForAlias(alias).getDatabase(); } /** * Obtains a list of tables for the given database/schema and returns a {@link jongo.rest.xstream.JongoSuccess} * response. * @return a {@link jongo.rest.xstream.JongoSuccess} or a {@link jongo.rest.xstream.JongoError} */ public JongoResponse getDatabaseMetadata(){ l.debug("Obtaining metadata for " + database); JongoResponse response = null; List<Row> results = null; try { results = JDBCExecutor.getListOfTables(database); } catch (Throwable ex){ response = handleException(ex, database); } if(response == null){ response = new JongoSuccess(database, results); } return response; } /** * Obtains a list of columns for the given resource and returns a {@link jongo.rest.xstream.JongoSuccess} * response. * @param table name of the resource to obtain the metadata from * @return a {@link jongo.rest.xstream.JongoSuccess} or a {@link jongo.rest.xstream.JongoError} */ public JongoResponse getResourceMetadata(final String table){ l.debug("Obtaining metadata for " + table); Table t; try{ t = new Table(database, table); }catch (IllegalArgumentException e){ l.debug("Failed to generate select " + e.getMessage()); return new JongoError(table, Response.Status.BAD_REQUEST, e.getMessage()); } Select select = new Select(t).setLimitParam(new LimitParam(1)); JongoResponse response = null; List<Row> results = null; try { results = JDBCExecutor.getTableMetaData(select); } catch (Throwable ex){ response = handleException(ex, table); } if(results == null && response == null){ response = new JongoError(table, Response.Status.NO_CONTENT); } if(response == null){ response = new JongoHead(table, results); } return response; } /** * Retrieves all resources from a given table ordered and limited. * @param table the table or view to query * @param limit a LimitParam object with the limit values * @param order order an OrderParam object with the ordering values. * @return Returns a JongoResponse with the values of the resource. If the resource is not available an error * if the table is empty, we return a SuccessResponse with no values. */ public JongoResponse getAllResources(final String table, final LimitParam limit, final OrderParam order){ l.debug("Geting all resources from {}.{}", alias, table); Table t; try{ t = new Table(database, table); }catch (IllegalArgumentException e){ l.debug("Failed to generate select: {}", e.getMessage()); return new JongoError(table, Response.Status.BAD_REQUEST, e.getMessage()); } final Select s = new Select(t).setLimitParam(limit).setOrderParam(order); JongoResponse response = null; List<Row> results = null; try{ results = JDBCExecutor.get(s, true); } catch (Throwable ex){ response = handleException(ex, table); } if(results == null && response == null){ response = new JongoError(table, Response.Status.NOT_FOUND); } if(response == null){ response = new JongoSuccess(table, results); } return response; } /** * Retrieves one resource for the given id. * @param table the table or view to query * @param col the column defined to be used in the query. Defaults to "id" * @param arg the value of the col. * @param limit a LimitParam object with the limit values * @param order an OrderParam object with the ordering values. * @return Returns a JongoResponse with the values of the resource. If the resource is not available an error is returned. */ public JongoResponse getResource(final String table, final String col, final String arg, final LimitParam limit, final OrderParam order){ l.debug("Geting resource from " + alias + "." + table + " with id " + arg); Table t; try{ t = new Table(database, table); }catch (IllegalArgumentException e){ l.debug("Failed to generate select " + e.getMessage()); return new JongoError(table, Response.Status.BAD_REQUEST, e.getMessage()); } Select select = new Select(t).setParameter(new SelectParam(col, arg)).setLimitParam(limit).setOrderParam(order); JongoResponse response = null; List<Row> results = null; try{ results = JDBCExecutor.get(select, false); } catch (Throwable ex){ response = handleException(ex, table); } if((results == null || results.isEmpty()) && response == null){ response = new JongoError(table, Response.Status.NOT_FOUND); } if(response == null){ response = new JongoSuccess(table, results); } return response; } /** * Retrieves all resources for the given column and value. * @param table the table or view to query * @param col the column defined to be used in the query. Defaults to "id" * @param arg the value of the col. * @param limit a LimitParam object with the limit values * @param order an OrderParam object with the ordering values. * @return Returns a JongoResponse with the values of the resources. If the resources are not available an error is returned. */ public JongoResponse findResources(final String table, final String col, final String arg, final LimitParam limit, final OrderParam order){ l.debug("Geting resource from " + alias + "." + table + " with id " + arg); if(StringUtils.isEmpty(arg) || StringUtils.isEmpty(col)) return new JongoError(table, Response.Status.BAD_REQUEST, "Invalid argument"); Table t; try{ t = new Table(database, table); }catch (IllegalArgumentException e){ l.debug("Failed to generate select " + e.getMessage()); return new JongoError(table, Response.Status.BAD_REQUEST, e.getMessage()); } Select select = new Select(t).setParameter(new SelectParam(col, arg)).setLimitParam(limit).setOrderParam(order); JongoResponse response = null; List<Row> results = null; try{ results = JDBCExecutor.get(select, true); } catch (Throwable ex){ response = handleException(ex, table); } if((results == null || results.isEmpty()) && response == null){ response = new JongoError(table, Response.Status.NOT_FOUND); } if(response == null){ response = new JongoSuccess(table, results); } return response; } /** * Generates an instance of {@link jongo.sql.Insert} for the given JSON arguments and calls the * insertResource(Insert) method. * @param resource the resource or view where to insert the record. * @param pk optional field which indicates the primary key column name. Defaults to "id" * @param jsonRequest JSON representation of the values we want to insert. For example: * {"name":"foo", "age":40} * @return a {@link jongo.rest.xstream.JongoSuccess} or a {@link jongo.rest.xstream.JongoError} */ public JongoResponse insertResource(final String resource, final String pk, final String jsonRequest){ l.debug("Insert new " + alias + "." + resource + " with JSON values: " + jsonRequest); JongoResponse response; try { Map<String, String> params = JongoUtils.getParamsFromJSON(jsonRequest); response = insertResource(resource, pk, params); } catch (JongoBadRequestException ex){ l.info("Failed to parse JSON arguments " + ex.getMessage()); response = new JongoError(resource, Response.Status.BAD_REQUEST, ex.getMessage()); } return response; } /** * Generates an instance of {@link jongo.sql.Insert} for the given x-www-form-urlencoded arguments and calls the * insertResource(Insert) method. * @param resource the resource or view where to insert the record. * @param pk optional field which indicates the primary key column name. Defaults to "id" * @param formParams a x-www-form-urlencoded representation of the values we want to insert. * @return a {@link jongo.rest.xstream.JongoSuccess} or a {@link jongo.rest.xstream.JongoError} */ public JongoResponse insertResource(final String resource, final String pk, final Map<String, String> formParams){ l.debug("Insert new " + alias + "." + resource + " with values: " + formParams); JongoResponse response; Table t; try{ t = new Table(database, resource); }catch (IllegalArgumentException e){ l.debug("Failed to generate Insert " + e.getMessage()); return new JongoError(resource, Response.Status.BAD_REQUEST, e.getMessage()); } Insert insert = new Insert(t).setColumns(formParams); response = insertResource(insert); return response; } /** * Calls the {@link jongo.jdbc.JDBCExecutor} insert method with the * given {@link jongo.sql.Insert} instance and handles errors. * @param insert a {@link jongo.sql.Insert} instance * @return a {@link jongo.rest.xstream.JongoSuccess} or a {@link jongo.rest.xstream.JongoError} */ private JongoResponse insertResource(Insert insert){ JongoResponse response = null; int result = 0; try { result = JDBCExecutor.insert(insert); } catch (Throwable ex){ response = handleException(ex, insert.getTable().getName()); } if(result == 0 && response == null){ response = new JongoError(null, Response.Status.NO_CONTENT); } if(response == null){ List<Row> results = new ArrayList<Row>(); results.add(new Row(0)); response = new JongoSuccess(null, results, Response.Status.CREATED); } return response; } /** * Creates an instance of {@link jongo.sql.Update}, calls * the {@link jongo.jdbc.JDBCExecutor} update method and handles errors * @param resource the resource or view where to insert the record. * @param pk optional field which indicates the primary key column name. Defaults to "id" * @param jsonRequest JSON representation of the values we want to update. For example: * {"name":"foo", "age":40} * @return a {@link jongo.rest.xstream.JongoSuccess} or a {@link jongo.rest.xstream.JongoError} */ public JongoResponse updateResource(final String resource, final String pk, final String id, final String jsonRequest){ l.debug("Update record " + id + " in table " + alias + "." + resource + " with values: " + jsonRequest); JongoResponse response = null; List<Row> results = null; Table t; try{ t = new Table(database, resource, pk); }catch (IllegalArgumentException e){ l.debug("Failed to generate update " + e.getMessage()); return new JongoError(resource, Response.Status.BAD_REQUEST, e.getMessage()); } Update update = new Update(t).setId(id); try { update.setColumns(JongoUtils.getParamsFromJSON(jsonRequest)); results = JDBCExecutor.update(update); } catch (Throwable ex){ response = handleException(ex, resource); } if((results == null || results.isEmpty()) && response == null){ response = new JongoError(resource, Response.Status.NO_CONTENT); } if(response == null){ response = new JongoSuccess(resource, results, Response.Status.OK); } return response; } /** * Creates an instance of {@link jongo.sql.Delete}, calls * the {@link jongo.jdbc.JDBCExecutor} delete method and handles errors * @param resource the resource or view where to insert the record. * @param pk optional field which indicates the primary key column name. Defaults to "id" * @param id unique pk identifier of the record to delete. * @return a {@link jongo.rest.xstream.JongoSuccess} or a {@link jongo.rest.xstream.JongoError} */ public JongoResponse deleteResource(final String resource, final String pk, final String id){ l.debug("Delete record " + id + " from table " + alias + "." + resource); Table t; try{ t = new Table(database, resource, pk); }catch (IllegalArgumentException e){ l.debug("Failed to generate delete " + e.getMessage()); return new JongoError(resource, Response.Status.BAD_REQUEST, e.getMessage()); } Delete delete = new Delete(t).setId(id); JongoResponse response = null; int result = 0; try { result = JDBCExecutor.delete(delete); } catch (Throwable ex){ response = handleException(ex, resource); } if(result == 0 && response == null){ response = new JongoError(resource, Response.Status.NO_CONTENT); } if(response == null){ List<Row> results = new ArrayList<Row>(); results.add(new Row(0)); response = new JongoSuccess(resource, results, Response.Status.OK); } return response; } /** * Generates a {@link org.jongo.jdbc.DynamicFinder} from the given parameters and calls * the {@link jongo.jdbc.JDBCExecutor} find method and handles errors * @param resource the resource or view where to insert the record. * @param query a {@link org.jongo.jdbc.DynamicFinder} query * @param values a list of arguments to be given to the {@link org.jongo.jdbc.DynamicFinder} * @param limit a {@link jongo.jdbc.LimitParam} instance. * @param order a {@link jongo.jdbc.OrderParam} instance. * @return a {@link jongo.rest.xstream.JongoSuccess} or a {@link jongo.rest.xstream.JongoError} */ public JongoResponse findByDynamicFinder(final String resource, final String query, final List<String> values, final LimitParam limit, final OrderParam order){ l.debug("Find resource from " + alias + "." + resource + " with " + query); if(values == null) throw new IllegalArgumentException("Invalid null argument"); if(query == null) return new JongoError(resource, Response.Status.BAD_REQUEST, "Invalid query"); JongoResponse response = null; List<Row> results = null; if(values.isEmpty()){ try{ DynamicFinder df = DynamicFinder.valueOf(resource, query); results = JDBCExecutor.find(database, df, limit, order); } catch (Throwable ex){ response = handleException(ex, resource); } }else{ try{ DynamicFinder df = DynamicFinder.valueOf(resource, query, values.toArray(new String []{})); results = JDBCExecutor.find(database, df, limit, order, JongoUtils.parseValues(values)); } catch (Throwable ex){ response = handleException(ex, resource); } } if((results == null || results.isEmpty()) && response == null){ response = new JongoError(resource, Response.Status.NOT_FOUND, "No results for " + query); } if(response == null){ response = new JongoSuccess(resource, results); } return response; } /** * Generates a List of {@link jongo.jdbc.StoredProcedureParam} and executes * the {@link jongo.jdbc.JDBCExecutor} executeQuery method with the given JSON parameters. * @param query name of the function or stored procedure * @param json IN and OUT parameters in JSON format. For example: * [ * {"value":2010, "name":"year", "outParameter":false, "type":"INTEGER", "index":1}, * {"name":"out_total", "outParameter":true, "type":"INTEGER", "index":2} * ] * @return a {@link jongo.rest.xstream.JongoSuccess} or a {@link jongo.rest.xstream.JongoError} */ public JongoResponse executeStoredProcedure(final String query, final String json){ l.debug("Executing Stored Procedure " + query); List<StoredProcedureParam> params; try { params = JongoUtils.getStoredProcedureParamsFromJSON(json); } catch (JongoBadRequestException ex) { return handleException(ex, query); } JongoResponse response = null; List<Row> results = null; try { results = JDBCExecutor.executeQuery(database, query, params); } catch (Throwable ex){ response = handleException(ex, query); } if(response == null){ response = new JongoSuccess(query, results); } return response; } /** * Method in charge of handling the possible exceptions thrown by the JDBCExecutor or any other * operation. The current implementation handles SQLException, JongoBadRequestException & * IllegalArgumentException to return different errors. For any other exception * a {@link jongo.rest.xstream.JongoError} with a 500 status code is returned. * @param t the exception to handle. * @param resource the name of the resource which is throwing the exception. * @return a {@link jongo.rest.xstream.JongoError} with different error codes depending * on the exception being handled. If we can't handle the exception, a 500 error code is used. */ private JongoResponse handleException(final Throwable t, final String resource){ JongoResponse response; StringBuilder b; if(t instanceof SQLException){ SQLException ex = (SQLException)t; b = new StringBuilder("Received a SQLException "); b.append(ex.getMessage()); b.append(" state ["); b.append(ex.getSQLState()); b.append("] & code ["); b.append(ex.getErrorCode()); b.append("]"); l.debug(b.toString()); response = new JongoError(resource, ex); }else if(t instanceof JongoBadRequestException){ b = new StringBuilder("Received a JongoBadRequestException "); b.append(t.getMessage()); l.debug(b.toString()); response = new JongoError(resource, Response.Status.BAD_REQUEST, t.getMessage()); }else if(t instanceof IllegalArgumentException){ b = new StringBuilder("Received an IllegalArgumentException "); b.append(t.getMessage()); l.debug(b.toString()); response = new JongoError(resource, Response.Status.BAD_REQUEST, t.getMessage()); }else{ b = new StringBuilder("Received an Unhandled Exception "); b.append(t.getMessage()); l.error(b.toString()); response = new JongoError(resource, Response.Status.INTERNAL_SERVER_ERROR); } return response; } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
1b2d4146c0befec5067c7db6d8640c47c4bb0ed1
b1e630049fdc8b8820f6802bda7965987ff85268
/src/integration-test/java/com/ebi/genome/restapi/ITUpdateProjectTest.java
abb420960bdf0e72c5788c0807920e688a3ca3b0
[]
no_license
glmanhtu/genome
3a1080ea4c53119be4cdafaee243f631cd6064a6
ff74ffb38061f6a06f1b3b179aa45c3d4a1bc53d
refs/heads/master
2021-03-22T03:00:09.783032
2017-11-07T14:43:48
2017-11-07T14:43:48
109,150,281
1
0
null
null
null
null
UTF-8
Java
false
false
7,424
java
package com.ebi.genome.restapi; import com.ebi.genome.TestConstants; import com.ebi.genome.WebTestUtil; import com.ebi.genome.persistence.dto.ProjectDTO; import com.github.springtestdbunit.DbUnitTestExecutionListener; import com.github.springtestdbunit.annotation.DatabaseSetup; import com.github.springtestdbunit.annotation.ExpectedDatabase; import com.github.springtestdbunit.assertion.DatabaseAssertionMode; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.TestExecutionListeners; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.support.DependencyInjectionTestExecutionListener; import org.springframework.test.context.transaction.TransactionalTestExecutionListener; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @RunWith(SpringJUnit4ClassRunner.class) @ActiveProfiles("integration-test") @SpringBootTest @TestExecutionListeners({DependencyInjectionTestExecutionListener.class, TransactionalTestExecutionListener.class, DbUnitTestExecutionListener.class}) @WebAppConfiguration public class ITUpdateProjectTest { @Autowired private WebApplicationContext wac; private MockMvc mockMvc; @Before public void setup() { this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build(); } @Test @DatabaseSetup("no-project-entries.xml") public void update_WhenProjectEntryIsNotFound_ShouldReturnResponseStatusNotFound() throws Exception { ProjectDTO projectDTO = new ProjectDTO(); projectDTO.setProjectId("not-found"); projectDTO.setTitle("Intra-tumor Genetic Heterogeneity in Rectal Cancer"); projectDTO.setStudyType("Case Set"); projectDTO.setSourceType("Germline"); projectDTO.setEvaCenterName(null); projectDTO.setDescription("Targetted confirmatory sequencing of heterogenous variants " + "detected by exome sequencing of spatially disparate areas from six rectal tumors"); projectDTO.setCenterName("University of Michigan Medical School"); projectDTO.setTaxonomyId(6096); mockMvc.perform( put("/studies") .contentType(TestConstants.APPLICATION_JSON_UTF8) .content(WebTestUtil.convertObjectToJsonBytes(projectDTO)) ) .andExpect(status().isNotFound()); } @Test @DatabaseSetup("no-project-entries.xml") @ExpectedDatabase(value = "no-project-entries.xml", assertionMode = DatabaseAssertionMode.NON_STRICT_UNORDERED) public void update_WhenProjectEntryIsNotFound_ShouldNotMakeAnyChangesToDatabase() throws Exception { ProjectDTO projectDTO = new ProjectDTO(); projectDTO.setProjectId("not-found"); projectDTO.setTitle("Intra-tumor Genetic Heterogeneity in Rectal Cancer"); projectDTO.setStudyType("Case Set"); projectDTO.setSourceType("Germline"); projectDTO.setEvaCenterName(null); projectDTO.setDescription("Targetted confirmatory sequencing of heterogenous variants " + "detected by exome sequencing of spatially disparate areas from six rectal tumors"); projectDTO.setCenterName("University of Michigan Medical School"); projectDTO.setTaxonomyId(6096); mockMvc.perform( put("/studies") .contentType(TestConstants.APPLICATION_JSON_UTF8) .content(WebTestUtil.convertObjectToJsonBytes(projectDTO)) ); } @Test @DatabaseSetup("one-project-entry.xml") public void update_WhenProjectEntryHasNoTitle_ShouldReturnResponseStatusBadRequest() throws Exception { ProjectDTO projectDTO = new ProjectDTO(); projectDTO.setProjectId("not-found"); projectDTO.setStudyType("Case Set"); projectDTO.setSourceType("Germline"); projectDTO.setEvaCenterName(null); projectDTO.setDescription("Targetted confirmatory sequencing of heterogenous variants " + "detected by exome sequencing of spatially disparate areas from six rectal tumors"); projectDTO.setCenterName("University of Michigan Medical School"); projectDTO.setTaxonomyId(6096); mockMvc.perform( put("/studies") .contentType(TestConstants.APPLICATION_JSON_UTF8) .content(WebTestUtil.convertObjectToJsonBytes(projectDTO)) ) .andExpect(status().isBadRequest()); } @Test @DatabaseSetup("one-project-entry.xml") public void update_WhenProjectEntryIsValid_ShouldReturnResponseStatusOk() throws Exception { ProjectDTO projectDTO = new ProjectDTO(); projectDTO.setProjectId("PRJEB10956"); projectDTO.setTitle("Intra-tumor Genetic Heterogeneity in Rectal Cancer"); projectDTO.setStudyType("Case Set"); projectDTO.setSourceType("Germline"); projectDTO.setEvaCenterName(null); projectDTO.setDescription("Targetted confirmatory sequencing of heterogenous variants " + "detected by exome sequencing of spatially disparate areas from six rectal tumors"); projectDTO.setCenterName("University of Michigan Medical School"); projectDTO.setTaxonomyId(9606); mockMvc.perform( put("/studies") .contentType(TestConstants.APPLICATION_JSON_UTF8) .content(WebTestUtil.convertObjectToJsonBytes(projectDTO)) ) .andExpect(status().isOk()); } @Test @DatabaseSetup("one-project-entry.xml") @ExpectedDatabase(value = "update-one-project-entry.xml", assertionMode = DatabaseAssertionMode.NON_STRICT_UNORDERED) public void update_WhenProjectEntryIsValid_ShouldUpdateProjectEntry() throws Exception { ProjectDTO projectDTO = new ProjectDTO(); projectDTO.setProjectId("PRJEB10956"); projectDTO.setTitle("genetic variantion data for LYC"); projectDTO.setStudyType("Case Set"); projectDTO.setSourceType("Germline"); projectDTO.setEvaCenterName("Center for Genomic Regulation - CRG (Barcelona); " + "Institute of Human Genetics - Helmholtz Zentrum (Munich)"); projectDTO.setDescription("Targetted confirmatory sequencing of heterogenous variants detected by exome " + "sequencing of spatially disparate areas from six rectal tumors"); projectDTO.setCenterName("University of Michigan Medical School"); projectDTO.setTaxonomyId(9606); mockMvc.perform( put("/studies") .contentType(TestConstants.APPLICATION_JSON_UTF8) .content(WebTestUtil.convertObjectToJsonBytes(projectDTO)) ); } }
[ "glmanhtu@gmail.com" ]
glmanhtu@gmail.com
23bd4785a86ad868aa07f81ef378dcdd9e29bd01
74dd63d7d113e2ff3a41d7bb4fc597f70776a9d9
/timss-itsm/src/main/java/com/timss/itsm/service/core/ItsmWoPriorityServiceImpl.java
f053401ea7b6ab57dcb7b114f6ad5be9276cbeb1
[]
no_license
gspandy/timssBusiSrc
989c7510311d59ec7c9a2bab3b04f5303150d005
a5d37a397460a7860cc221421c5f6e31b48cac0f
refs/heads/master
2023-08-14T02:14:21.232317
2017-02-16T07:18:21
2017-02-16T07:18:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,602
java
package com.timss.itsm.service.core; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import net.sf.json.JSONArray; import net.sf.json.JSONObject; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import com.timss.itsm.bean.ItsmWoPriConfig; import com.timss.itsm.bean.ItsmWoPriority; import com.timss.itsm.dao.ItsmWoPriConfigDao; import com.timss.itsm.dao.ItsmWoPriorityDao; import com.timss.itsm.service.ItsmWoPriorityService; import com.yudean.itc.dto.Page; import com.yudean.itc.util.json.JsonHelper; import com.yudean.mvc.bean.userinfo.UserInfoScope; import com.yudean.mvc.service.ItcMvcService; @Service public class ItsmWoPriorityServiceImpl implements ItsmWoPriorityService { @Autowired private ItcMvcService ItcMvcService; @Autowired private ItsmWoPriorityDao woPriorityDao; @Autowired private ItsmWoPriConfigDao woPriConfigDao; private static Logger logger = Logger.getLogger(ItsmWoPriorityServiceImpl.class); @Override @Transactional(propagation = Propagation.REQUIRED, rollbackFor ={Exception.class}) public void insertWoPriority(Map<String, String> addWoLabelDataMap) { UserInfoScope userInfoScope = ItcMvcService.getUserInfoScopeDatas(); String siteId = userInfoScope.getSiteId(); String deptId = userInfoScope.getOrgId(); String userId = userInfoScope.getUserId(); String woPriorityForm = addWoLabelDataMap.get("woPriorityForm"); String woPriConfData = addWoLabelDataMap.get("woPriConfData"); JSONObject woPriConfJsonObj = JSONObject.fromObject(woPriConfData); int woPriConfDatagridNum =Integer.valueOf(woPriConfJsonObj.get("total").toString()); //记录数 JSONArray woPriConfJsonArray = woPriConfJsonObj.getJSONArray("rows"); //记录数组 int id = woPriorityDao.getNextParamsConfId(); ItsmWoPriority woPriority = JsonHelper.fromJsonStringToBean(woPriorityForm, ItsmWoPriority.class); woPriority.setSiteid(siteId); woPriority.setDeptid(deptId); woPriority.setCreatedate(new Date()); woPriority.setCreateuser(userId); woPriority.setId(id); woPriority.setYxbz(1); //插入服务级别基本信息 woPriorityDao.insertWoPriority(woPriority); //插入服务级别对应的“紧急度”和“影响范围” for(int i=0; i<woPriConfDatagridNum; i++){ String itemsRecord = woPriConfJsonArray.get(i).toString(); //某条记录的字符串表示 ItsmWoPriConfig woPriConfig = JsonHelper.fromJsonStringToBean(itemsRecord, ItsmWoPriConfig.class); woPriConfig.setPriId(id); woPriConfig.setSiteid(siteId); woPriConfigDao.insertWoPriConfig(woPriConfig); } } @Override @Transactional(propagation = Propagation.REQUIRED, rollbackFor ={Exception.class}) public void updateWoPriority(Map<String, String> addWoLabelDataMap) { UserInfoScope userInfoScope = ItcMvcService.getUserInfoScopeDatas(); String userId = userInfoScope.getUserId(); String siteid = userInfoScope.getSiteId(); String woPriorityForm = addWoLabelDataMap.get("woPriorityForm"); String woPriConfData = addWoLabelDataMap.get("woPriConfData"); JSONObject woPriConfJsonObj = JSONObject.fromObject(woPriConfData); int woPriConfDatagridNum =Integer.valueOf(woPriConfJsonObj.get("total").toString()); //记录数 JSONArray woPriConfJsonArray = woPriConfJsonObj.getJSONArray("rows"); //记录数组 ItsmWoPriority woPriority; try { woPriority = JsonHelper.toObject(woPriorityForm, ItsmWoPriority.class); } catch (Exception e) { logger.error(e.getMessage()); throw new RuntimeException(e); } woPriority.setModifydate(new Date()); woPriority.setModifyuser(userId); woPriorityDao.updateWoPriority(woPriority); woPriConfigDao.deleteWoPriConfig(woPriority.getId(), siteid); //插入服务级别对应的“紧急度”和“影响范围” for(int i=0; i<woPriConfDatagridNum; i++){ String itemsRecord = woPriConfJsonArray.get(i).toString(); //某条记录的字符串表示 ItsmWoPriConfig woPriConfig = JsonHelper.fromJsonStringToBean(itemsRecord, ItsmWoPriConfig.class); woPriConfig.setPriId(woPriority.getId()); woPriConfig.setSiteid(siteid); woPriConfigDao.insertWoPriConfig(woPriConfig); } } @Override @Transactional(propagation = Propagation.REQUIRED, rollbackFor ={Exception.class}) public HashMap<String, Object> queryWoPriorityById(int id,String siteid) { HashMap<String, Object> result = new HashMap<String, Object>(); ItsmWoPriority woPriority = woPriorityDao.queryWoPriorityById(id); List<ItsmWoPriConfig> woPriConfigList = woPriConfigDao.queryWoPriConfigListById(id, siteid); result.put("baseData", woPriority); result.put("datagridData", woPriConfigList); return result; } @Override @Transactional(propagation = Propagation.REQUIRED, rollbackFor ={Exception.class}) public Page<ItsmWoPriority> queryWoPriorityList(Page<ItsmWoPriority> page) { List<ItsmWoPriority> ret = woPriorityDao.queryWoPriorityList(page); page.setResults(ret); logger.info("查询优先级列表信息"); return page; } @Override @Transactional(propagation = Propagation.REQUIRED, rollbackFor ={Exception.class}) public HashMap<String, String> getPriIdValByUrgentInfluence(String urgentVal, String influenceVal) { HashMap<String, String> result = new HashMap<String, String>(); UserInfoScope userInfoScope = ItcMvcService.getUserInfoScopeDatas(); String siteid = userInfoScope.getSiteId(); int priId = 0 ; String priName =""; ItsmWoPriConfig woPriConfig = woPriConfigDao.queryWoPriConfigByOtherCode(urgentVal, influenceVal,siteid); if(woPriConfig != null){ priId = woPriConfig.getPriId(); priName = woPriorityDao.queryWoPriorityById(priId).getName(); } result.put("priId", String.valueOf(priId)); result.put("priName", priName); return result; } @Override @Transactional(propagation = Propagation.REQUIRED,rollbackFor ={Exception.class}) public HashMap<String, Object> deleteWoPriority(int woPriorityId, String siteid) { woPriConfigDao.deleteWoPriConfig(woPriorityId, siteid); woPriorityDao.deleteWoPriority(woPriorityId,siteid); return null; } @Override public List<ItsmWoPriority> queryWoPriorityListBySiteId(String siteid) { return woPriorityDao.queryWoPriorityListBySiteId(siteid); } @Override public ItsmWoPriority queryWoPriorityById(int priorityId) { return woPriorityDao.queryWoPriorityById(priorityId); } }
[ "londalonda@qq.com" ]
londalonda@qq.com
0b603eaf06a19ca4bfe7df8d046436ec07c96256
175a7326785bfdfd3578e4a57181ee514b2da7a5
/app/src/main/java/lk/mobilevisions/kiki/audio/adapter/RecentlyPlayedVerticalAdapter.java
6a74c195a917cf30a0f48bf6d29861d75829cb95
[]
no_license
insafzakariya/-kiki_android_app-
6d3a254bd75368bc04d9a978a73d46667fc1d09f
c73b4e1cfdc00c2fb13c9c7cd17efa4531a9f04f
refs/heads/master
2023-04-03T17:47:27.411876
2020-05-23T13:47:57
2020-05-23T13:47:57
353,258,945
0
0
null
null
null
null
UTF-8
Java
false
false
4,432
java
package lk.mobilevisions.kiki.audio.adapter; import android.content.Context; import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; import com.squareup.picasso.Picasso; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; import lk.mobilevisions.kiki.R; import lk.mobilevisions.kiki.audio.model.dto.Song; public class RecentlyPlayedVerticalAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { private static Context context; private static RecentlyPlayedVerticalAdapter mInstance; private RecentlyPlayedItemActionListener recentlyPlayedItemActionListener; private Context mContext; private List<Song> recentlyPlayedList; public RecentlyPlayedVerticalAdapter(Context mContext, List<Song> recentlyPlayedList) { this.mContext = mContext; this.recentlyPlayedList = recentlyPlayedList; } public RecentlyPlayedVerticalAdapter(Context mContext) { this.mContext = mContext; } public static RecentlyPlayedVerticalAdapter getInstance(Context context) { if (mInstance == null) { mInstance = new RecentlyPlayedVerticalAdapter(context); } return mInstance; } @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_horizontal_recently_played, parent, false); return new RecentlyPlayedRecyclerViewHolder(view); } @Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { initLayoutTwo((RecentlyPlayedRecyclerViewHolder) holder, position); } private void initLayoutTwo(final RecentlyPlayedRecyclerViewHolder holder, int pos) { final Song current = recentlyPlayedList.get(pos); System.out.println("ehjhegdfyfh 111 " + current.getName()); System.out.println("ehjhegdfyfh 222 " + current.getDescription()); System.out.println("ehjhegdfyfh 333 " + current.getImage()); holder.titleTextView.setText(current.getName()); holder.descriptionTextView.setText(current.getDescription()); if(current.getImage()!=null){ try { Picasso.with(mContext).load(URLDecoder.decode(current.getImage(), "UTF-8")) .placeholder(R.drawable.program) .into(holder.imageView); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } holder.rvHorizontal.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { RecentlyPlayedVerticalAdapter adapter = RecentlyPlayedVerticalAdapter.getInstance(context); adapter.requestStream(recentlyPlayedList.get(holder.getAdapterPosition()),holder.getAdapterPosition(),recentlyPlayedList); } }); } @Override public int getItemCount() { return recentlyPlayedList.size(); } class RecentlyPlayedRecyclerViewHolder extends RecyclerView.ViewHolder { @BindView(R.id.relativeLayoutRoot) RelativeLayout rvHorizontal; @BindView(R.id.textView6) TextView titleTextView; @BindView(R.id.textView7) TextView descriptionTextView; @BindView(R.id.image) ImageView imageView; public RecentlyPlayedRecyclerViewHolder(View itemView) { super(itemView); ButterKnife.bind(this,itemView); } } private void requestStream(Song song,int position,List<Song> songs) { if(recentlyPlayedItemActionListener!=null){ recentlyPlayedItemActionListener.onRecentlyPlayedPlayAction(song,position,songs); } } public void setActionListener(RecentlyPlayedItemActionListener actionListener){ this.recentlyPlayedItemActionListener = actionListener; } public interface RecentlyPlayedItemActionListener{ void onRecentlyPlayedPlayAction(Song song,int position,List<Song> songs); } }
[ "indthujan.groupit@maharaja.lk" ]
indthujan.groupit@maharaja.lk
6208e6338b09a3853b7850d07897a08daf46b1ae
3d28124f3c614d73c39c552efcf3fdd013a30b15
/wwe/gtbS.java
1bdb230a2386d8bde8274aceb1ff7dbb761628dc
[]
no_license
WarriorCrystal/WWE-Deobf-Source-Leak
ac5caff81e96cf1d15e53c7f62f4af20053682df
660a29c3a32a7753299cc8edadf83c109369da1c
refs/heads/master
2022-03-25T08:29:40.333788
2019-11-29T01:09:59
2019-11-29T01:09:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
422
java
package wwe; import java.util.*; import net.minecraft.util.math.*; import net.minecraft.util.*; import wwe.modules.world.*; class gtbS extends HashMap<BlockPos, EnumFacing> { final BlockPos WJBJ; final Scaffold cdLk; gtbS(final Scaffold cdLk, final BlockPos wjbj) { this.cdLk = cdLk; this.WJBJ = wjbj; super(); this.put(this.WJBJ.add(0, 0, 1), EnumFacing.NORTH); } }
[ "57571957+RIPBackdoored@users.noreply.github.com" ]
57571957+RIPBackdoored@users.noreply.github.com
8d742690d54dd8c452a710ed70deb6fd0b352946
5751f920a13ea8e3cf8ef00e880e439cfd6b29b9
/ConvenienceServices/src/com/future/link/delivery/service/CouponService.java
664b5d66664d91205cb4e74a6b23b008a7bb5a64
[]
no_license
zbb-jzh/ConvenienceServices
b22cd2d9abeec7e3bc3e9eecae5d426ca85e9952
25e2969f2e5cdc08d000d887e29dac853bccec7f
refs/heads/master
2020-04-13T18:38:59.032611
2019-01-04T08:53:34
2019-01-04T08:53:34
163,380,916
0
0
null
null
null
null
UTF-8
Java
false
false
1,133
java
package com.future.link.delivery.service; import java.util.List; import com.future.link.common.Result; import com.future.link.delivery.model.Coupon; import com.future.link.utils.ToolDateTime; import com.jfinal.aop.Enhancer; public class CouponService { public static final CouponService service = Enhancer.enhance(CouponService.class); /** * 新增 * @param coupon * @return */ public Result addCoupon(Coupon coupon) { coupon.setStatus(0); coupon.setCreateTime(ToolDateTime.getDate()); coupon.save(); return new Result(Result.SUCCESS_STATUS, "添加成功"); } /** * 统计用户未使用的优惠券数量 * @return */ public int countUnusedCoupon(long userId) { List<Coupon> list = Coupon.dao.find("select * from delivery_coupon where wxUserId = ? and status = 0", userId); if(null == list) { return 0; }else { return list.size(); } } /** * 获取用户最早得到的优惠券 * @return */ public Coupon getCoupon(long userId) { return Coupon.dao.findFirst("select * from delivery_coupon where wxUserId = ? and status = 0 order by createTime", userId); } }
[ "603845887@qq.com" ]
603845887@qq.com
d7e7e21174b5a7b8fda22c27dfd5aab67363a62c
2f3e332db7f00d751809030e70ddbfdb4ce63255
/ivms_wxOrder_20190527/src/com/htinf/tool/Md5AndSha.java
727cd6ca53b50c2ec4f0c121ac8b0f0cba96b9e4
[]
no_license
yjie096213/localproject
9c469b309284545655ea6c031794e3b85c348da0
6d665c37b46d393861e49381174d8394496c684b
refs/heads/master
2023-07-10T23:23:15.065108
2021-08-13T09:57:20
2021-08-13T09:57:20
362,379,404
0
0
null
null
null
null
UTF-8
Java
false
false
1,696
java
package com.htinf.tool; import java.security.MessageDigest; public class Md5AndSha{ public String convertMD5(String s){ char hexChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; try { byte[] bytes = s.getBytes(); MessageDigest md = MessageDigest.getInstance("md5"); md.update(bytes); bytes = md.digest(); int j = bytes.length; char[] chars = new char[j * 2]; int k = 0; for (int i = 0; i < bytes.length; i++) { byte b = bytes[i]; chars[k++] = hexChars[b >>> 4 & 0xf]; chars[k++] = hexChars[b & 0xf]; } return new String(chars); } catch (Exception e){ return null; } } public String convertSHA(String s){ char hexChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; try { byte[] bytes = s.getBytes(); MessageDigest md = MessageDigest.getInstance("sha"); md.update(bytes); bytes = md.digest(); int j = bytes.length; char[] chars = new char[j * 2]; int k = 0; for (int i = 0; i < bytes.length; i++) { byte b = bytes[i]; chars[k++] = hexChars[b >>> 4 & 0xf]; chars[k++] = hexChars[b & 0xf]; } return new String(chars); } catch (Exception e){ return null; } } public static void main(String[] args){ } }
[ "yjie096213@163.com" ]
yjie096213@163.com
3b9d76feb8d7f2e478fb4e2323adc760175bf016
91b979b9447f15c7eb96134af96481245738d5dd
/app/src/main/java/com/example/instagramclone/src/Main/MainFeed/Comments/interfaces/CommentActivityView.java
4f209f141c67f38140e15d92c5d68d261317e48d
[]
no_license
k-nh/android-InstagramClone
70ebaf035286be39aaa8319253b03fc6da7d6845
657de1da781f4b9ec1e09a3e4f585f372777cd65
refs/heads/master
2023-06-01T11:51:26.299612
2021-06-15T18:15:11
2021-06-15T18:15:11
319,889,189
0
0
null
null
null
null
UTF-8
Java
false
false
314
java
package com.example.instagramclone.src.Main.MainFeed.Comments.interfaces; import com.example.instagramclone.src.Main.MainFeed.Comments.models.CommentResponse; public interface CommentActivityView { void WriteCommentSuccess(CommentResponse commentResponse); void WriteCommentFailure(String message); }
[ "skgml977@gmail.com" ]
skgml977@gmail.com
188d9f00d841005fac63ddad34fb5243663fa36f
0f25135558b0477aa627d57b5ee5a69c9f39a622
/Ian/vuforiaTest.java
17fd6895548dd2c51106c9133da5579dc3377545
[]
no_license
trial-and-error-10191/2019-FTC-Season
82a601c67fef228410f709c4eacf470ef2d5f632
b57ec63c5015ea3eb589fe1e1049548cc300936b
refs/heads/master
2020-08-01T23:11:35.337057
2020-02-22T18:40:59
2020-02-22T18:40:59
211,150,686
0
1
null
2020-01-18T23:21:26
2019-09-26T17:58:51
Java
UTF-8
Java
false
false
16,456
java
/* Copyright (c) 2019 FIRST. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted (subject to the limitations in the disclaimer below) provided that * the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this list * of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, this * list of conditions and the following disclaimer in the documentation and/or * other materials provided with the distribution. * * Neither the name of FIRST nor the names of its contributors may be used to endorse or * promote products derived from this software without specific prior written permission. * * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS * LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.firstinspires.ftc.teamcode; import android.service.autofill.Dataset; import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.vuforia.DataSet; import com.vuforia.ModelTarget; import com.vuforia.ObjectTracker; import com.vuforia.TrackerManager; import org.firstinspires.ftc.robotcore.external.ClassFactory; import org.firstinspires.ftc.robotcore.external.matrices.OpenGLMatrix; import org.firstinspires.ftc.robotcore.external.matrices.VectorF; import org.firstinspires.ftc.robotcore.external.navigation.Orientation; import org.firstinspires.ftc.robotcore.external.navigation.VuforiaLocalizer; import org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackable; import org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackableDefaultListener; import org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackables; import java.util.ArrayList; import java.util.List; import static org.firstinspires.ftc.robotcore.external.navigation.AngleUnit.DEGREES; import static org.firstinspires.ftc.robotcore.external.navigation.AxesOrder.XYZ; import static org.firstinspires.ftc.robotcore.external.navigation.AxesOrder.YZX; import static org.firstinspires.ftc.robotcore.external.navigation.AxesReference.EXTRINSIC; import static org.firstinspires.ftc.robotcore.external.navigation.VuforiaLocalizer.CameraDirection.BACK; /** * This 2019-2020 OpMode illustrates the basics of using the Vuforia localizer to determine * d positioning anorientation of robot on the SKYSTONE FTC field. * The code is structured as a LinearOpMode * * When images are located, Vuforia is able to determine the position and orientation of the * image relative to the camera. This sample code then combines that information with a * knowledge of where the target images are on the field, to determine the location of the camera. * * From the Audience perspective, the Red Alliance station is on the right and the * Blue Alliance Station is on the left. * Eight perimeter targets are distributed evenly around the four perimeter walls * Four Bridge targets are located on the bridge uprights. * Refer to the Field Setup manual for more specific location details * * A final calculation then uses the location of the camera on the robot to determine the * robot's location and orientation on the field. * * @see VuforiaLocalizer * @see VuforiaTrackableDefaultListener * see skystone/doc/tutorial/FTC_FieldCoordinateSystemDefinition.pdf * * Use Android Studio to Copy this Class, and Paste it into your team's code folder with a new name. * Remove or comment out the @Disabled line to add this opmode to the Driver Station OpMode list. * * IMPORTANT: In order to use this OpMode, you need to obtain your own Vuforia license key as * is explained below. */ @TeleOp(name="SKYSTONE Vuforia Nav", group ="Concept") public class vuforiaTest extends LinearOpMode { // IMPORTANT: For Phone Camera, set 1) the camera source and 2) the orientation, based on how your phone is mounted: // 1) Camera Source. Valid choices are: BACK (behind screen) or FRONT (selfie side) // 2) Phone Orientation. Choices are: PHONE_IS_PORTRAIT = true (portrait) or PHONE_IS_PORTRAIT = false (landscape) // // NOTE: If you are running on a CONTROL HUB, with only one USB WebCam, you must select CAMERA_CHOICE = BACK; and PHONE_IS_PORTRAIT = false; // private static final VuforiaLocalizer.CameraDirection CAMERA_CHOICE = BACK; private static final boolean PHONE_IS_PORTRAIT = false ; /* * IMPORTANT: You need to obtain your own license key to use Vuforia. The string below with which * 'parameters.vuforiaLicenseKey' is initialized is for illustration only, and will not function. * A Vuforia 'Development' license key, can be obtained free of charge from the Vuforia developer * web site at https://developer.vuforia.com/license-manager. * * Vuforia license keys are always 380 characters long, and look as if they contain mostly * random data. As an example, here is a example of a fragment of a valid key: * ... yIgIzTqZ4mWjk9wd3cZO9T1axEqzuhxoGlfOOI2dRzKS4T0hQ8kT ... * Once you've obtained a license key, copy the string from the Vuforia web site * and paste it in to your code on the next line, between the double quotes. */ private static final String VUFORIA_KEY = "Acd3Mhv/////AAABmQHTPP6MLkaAuT4ajCpWMLFIAsffT0PglAjW5YBhoEBRGmKeJcOmf37joiF+BKOuseAqCQ+Dq6THvITLD+L/v5UI/RaEka+Egq7V+JYnS26F1HnEGFG0pYR6TxQksLltAKf7HvyKRgfZLwtRSGPvA8/Pvu936WpjlRDOizksUUMQ8+iaM/aPUKGrlswF8QrzncCcmCGOSq+HwwHCJH6pJSQK7HTgGmg5TMLkXK5Q5D3OILskNBUI8LVrAEzWY7mDZVGpYekIBeb4IoNu7tShpgOmj4Sx0VLoT5eidMHOzN+BAoTkoZkawqGqWIHHwykX0cLcxeh8hWhHhN2n56mbv/57u/h9eUUdXzNZikOhPRff"; // Since ImageTarget trackables use mm to specifiy their dimensions, we must use mm for all the physical dimension. // We will define some constants and conversions here private static final float mmPerInch = 25.4f; private static final float mmTargetHeight = (6) * mmPerInch; // the height of the center of the target image above the floor // Constant for Stone Target private static final float stoneZ = 2.00f * mmPerInch; // Constants for the center support targets private static final float bridgeZ = 6.42f * mmPerInch; private static final float bridgeY = 23 * mmPerInch; private static final float bridgeX = 5.18f * mmPerInch; private static final float bridgeRotY = 59; // Units are degrees private static final float bridgeRotZ = 180; // Constants for perimeter targets private static final float halfField = 72 * mmPerInch; private static final float quadField = 36 * mmPerInch; // Class Members private OpenGLMatrix lastLocation = null; private VuforiaLocalizer vuforia = null; private boolean targetVisible = false; private float phoneXRotate = 0; private float phoneYRotate = 0; private float phoneZRotate = 0; @Override public void runOpMode() { /* * Configure Vuforia by creating a Parameter object, and passing it to the Vuforia engine. * We can pass Vuforia the handle to a camera preview resource (on the RC phone); * If no camera monitor is desired, use the parameter-less constructor instead (commented out below). */ int cameraMonitorViewId = hardwareMap.appContext.getResources().getIdentifier("cameraMonitorViewId", "id", hardwareMap.appContext.getPackageName()); VuforiaLocalizer.Parameters parameters = new VuforiaLocalizer.Parameters(cameraMonitorViewId); // VuforiaLocalizer.Parameters parameters = new VuforiaLocalizer.Parameters(); parameters.vuforiaLicenseKey = VUFORIA_KEY; parameters.cameraDirection = CAMERA_CHOICE; // Instantiate the Vuforia engine vuforia = ClassFactory.getInstance().createVuforia(parameters); // Load the data sets for the trackable objects. These particular data // sets are stored in the 'assets' part of our application. //VuforiaTrackables targetsBlueSite = this.vuforia.loadTrackablesFromAsset("blue_site_1"); //VuforiaTrackables targetsRedSite = this.vuforia.loadTrackablesFromAsset("red_site_1"); VuforiaTrackables buildSiteTraget = this.vuforia.loadTrackablesFromAsset("Build_Site"); // For convenience, gather together all the trackable objects in one easily-iterable collection */ List<VuforiaTrackable> allTrackables = new ArrayList<VuforiaTrackable>(); allTrackables.addAll(buildSiteTraget); /** * In order for localization to work, we need to tell the system where each target is on the field, and * where the phone resides on the robot. These specifications are in the form of <em>transformation matrices.</em> * Transformation matrices are a central, important concept in the math here involved in localization. * See <a href="https://en.wikipedia.org/wiki/Transformation_matrix">Transformation Matrix</a> * for detailed information. Commonly, you'll encounter transformation matrices as instances * of the {@link OpenGLMatrix} class. * * If you are standing in the Red Alliance Station looking towards the center of the field, * - The X axis runs from your left to the right. (positive from the center to the right) * - The Y axis runs from the Red Alliance Station towards the other side of the field * where the Blue Alliance Station is. (Positive is from the center, towards the BlueAlliance station) * - The Z axis runs from the floor, upwards towards the ceiling. (Positive is above the floor) * * Before being transformed, each target image is conceptually located at the origin of the field's * coordinate system (the center of the field), facing up. */ // Set the position of the Stone Target. Since it's not fixed in position, assume it's at the field origin. // Rotated it to to face forward, and raised it to sit on the ground correctly. // This can be used for generic target-centric approach algorithms // Create a transformation matrix describing where the phone is on the robot. // // NOTE !!!! It's very important that you turn OFF ame as the field. // // The robot's "forward" direction is facing out along X your phone's Auto-Screen-Rotation option. // Lock it into Portrait for these numbers to work. // // Info: The coordinate frame for the robot looks the saxis, with the LEFT side facing out along the Y axis. // Z is UP on the robot. This equates to a bearing angle of Zero degrees. // // The phone starts out lying flat, with the screen facing Up and with the physical top of the phone // pointing to the LEFT side of the Robot. // The two examples below assume that the camera is facing forward out the front of the robot. // We need to rotate the camera around it's long axis to bring the correct camera forward if (CAMERA_CHOICE == BACK) { phoneYRotate = -90; } else { phoneYRotate = 90; } // Rotate the phone vertical about the X axis if it's in portrait mode if (PHONE_IS_PORTRAIT) { phoneXRotate = 90 ; } // Next, translate the camera lens to where it is on the robot. // In this example, it is centered (left to right), but forward of the middle of the robot, and above ground level. final float CAMERA_FORWARD_DISPLACEMENT = 4.0f * mmPerInch; // eg: Camera is 4 Inches in front of robot center final float CAMERA_VERTICAL_DISPLACEMENT = 8.0f * mmPerInch; // eg: Camera is 8 Inches above ground final float CAMERA_LEFT_DISPLACEMENT = 0; // eg: Camera is ON the robot's center line OpenGLMatrix robotFromCamera = OpenGLMatrix .translation(CAMERA_FORWARD_DISPLACEMENT, CAMERA_LEFT_DISPLACEMENT, CAMERA_VERTICAL_DISPLACEMENT) .multiplied(Orientation.getRotationMatrix(EXTRINSIC, YZX, DEGREES, phoneYRotate, phoneZRotate, phoneXRotate)); /** Let all the trackable listeners know where the phone is. */ for (VuforiaTrackable trackable : allTrackables) { ((VuforiaTrackableDefaultListener) trackable.getListener()).setPhoneInformation(robotFromCamera, parameters.cameraDirection); } //!! // WARNING: // In this sample, we do not wait for PLAY to be pressed. Target Tracking is started immediately when INIT is pressed. // This sequence is used to enable the new remote DS Camera Preview feature to be used with this sample. // CONSEQUENTLY do not put any driving commands in this loop. // To restore the normal opmode structure, just un-comment the following line: //waitForStart(); // Note: To use the remote camera preview: // AFTER you hit Init on the Driver Station, use the "options menu" to select "Camera Stream" // Tap the preview window to receive a fresh image. //targetsBlueSite.activate(); //targetsRedSite.activate(); buildSiteTraget.activate(); while (!isStopRequested()) { // telemetry.addData("Blue Site Size",targetsBlueSite.size()); // telemetry.addData("Red Site Size",targetsRedSite.size()); // check all the trackable targets to see which one (if any) is visible. targetVisible = false; for (VuforiaTrackable trackable : allTrackables) { if (((VuforiaTrackableDefaultListener)trackable.getListener()).isVisible()) { telemetry.addData("Visible Target", trackable.getName()); targetVisible = true; // getUpdatedRobotLocation() will return null if no new information is available since // the last time that call was made, or if the trackable is not currently visible. OpenGLMatrix robotLocationTransform = ((VuforiaTrackableDefaultListener)trackable.getListener()).getUpdatedRobotLocation(); if (robotLocationTransform != null) { lastLocation = robotLocationTransform; } break; } } // Provide feedback as to where the robot is located (if we know). if (targetVisible) { // express position (translation) of robot in inches. VectorF translation = lastLocation.getTranslation(); telemetry.addData("Pos (in)", "{X, Y, Z} = %.1f, %.1f, %.1f", translation.get(0) / mmPerInch, translation.get(1) / mmPerInch, translation.get(2) / mmPerInch); // express the rotation of the robot in degrees. Orientation rotation = Orientation.getOrientation(lastLocation, EXTRINSIC, XYZ, DEGREES); telemetry.addData("Rot (deg)", "{Roll, Pitch, Heading} = %.0f, %.0f, %.0f", rotation.firstAngle, rotation.secondAngle, rotation.thirdAngle); } else { telemetry.addData("Visible Target", "none"); } telemetry.update(); } // Disable Tracking when we are done; //targetsBlueSite.deactivate(); //targetsRedSite.deactivate(); buildSiteTraget.deactivate(); } }
[ "noreply@github.com" ]
trial-and-error-10191.noreply@github.com
adc7813019fc3b2a2e5c430aa5a9a98a7fad5695
d964c4f6ee329eaae67a6d8feff234d79e498241
/app/src/main/java/com/kuan/retrofitrxjavacamrea/mvp/details/DetailTasksContract.java
a97629d5478417d5661fa9c58638d0ea317850c0
[]
no_license
zhuangwu116/RetrofitRxjavaCamrea
0e12f44e2a2f98186e7b9046df2748a811746dd1
616dd8a53deb43de830c1d92b6ad5425a37d189b
refs/heads/master
2021-01-20T06:43:35.590129
2017-05-13T10:15:04
2017-05-13T10:15:04
89,918,546
0
0
null
null
null
null
UTF-8
Java
false
false
553
java
package com.kuan.retrofitrxjavacamrea.mvp.details; import com.kuan.retrofitrxjavacamrea.bean.DetailsInfoBean; import com.kuan.retrofitrxjavacamrea.mvp.BasePresenter; import com.kuan.retrofitrxjavacamrea.mvp.BaseView; /** * Created by zhuangwu on 17-5-13. */ public interface DetailTasksContract { interface View extends BaseView<Presenter> { public void Success(DetailsInfoBean data); public void Error(); } interface Presenter extends BasePresenter { public void getDetailInfos(String url,String id); } }
[ "562669088@qq.com" ]
562669088@qq.com
c0c77fd4bdebf57b91e309481edf8bc0458b2eed
5b5f90c99f66587cea981a640063a54b6ea75185
/src/main/java/com/coxandkings/travel/operations/repository/manageproductupdates/ManageProductUpdatesToDoTaskRepository.java
334c48dc07ce1c4c2df7f7692067022e00db7850
[]
no_license
suyash-capiot/operations
02558d5f4c72a895d4a7e7e743495a118b953e97
b6ad01cbdd60190e3be1f2a12d94258091fec934
refs/heads/master
2020-04-02T06:22:30.589898
2018-10-26T12:11:11
2018-10-26T12:11:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
480
java
package com.coxandkings.travel.operations.repository.manageproductupdates; import com.coxandkings.travel.operations.exceptions.OperationException; import com.coxandkings.travel.operations.model.todo.ToDoSubType; import com.coxandkings.travel.operations.resource.todo.ToDoStatus; import java.util.List; public interface ManageProductUpdatesToDoTaskRepository { public List<String> getToDoTasksBySubType(ToDoSubType subType, ToDoStatus status) throws OperationException; }
[ "sahil@capiot.com" ]
sahil@capiot.com
3719e4847dc12b7f23c42c973429f4892ed95e29
7f322700621838e4a69d276fe130aca01edffc83
/creator/src/main/java/kr/co/creator/join/JoinDAO.java
374d68a603350b9ef60e6253db86a154609d91a6
[]
no_license
Pigchick/Codetiator
4d94bb29fd93ef59c2e2059e0d5590a03e856795
d106cf533a0f6eb6001517fd7f57e58e0b57071d
refs/heads/master
2022-12-22T00:45:37.132515
2019-10-07T07:47:46
2019-10-07T07:47:46
193,810,849
0
0
null
2022-12-16T00:37:11
2019-06-26T01:54:08
JavaScript
UTF-8
Java
false
false
596
java
package kr.co.creator.join; import org.apache.ibatis.session.SqlSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import kr.co.creator.vo.UserVO; @Repository public class JoinDAO { @Autowired SqlSession sqlSession; public int joinEmailChk(UserVO vo) { int cnt = 0; cnt = sqlSession.selectOne("JoinMapper.joinEmailChk", vo); return cnt; }//joinEmailChk public int joinUser(UserVO vo) { int successCnt = 0; successCnt = sqlSession.insert("JoinMapper.joinUser", vo); return successCnt; }//joinUser }
[ "USER@USER-PC" ]
USER@USER-PC
d7a0c9ef5dd367aa7bf77e2c9df41d1d4c9c62e7
8f4b6a75114ecdf33c41e46a436e7228f7502ff5
/inspector/src/main/java/org/xtuml/masl/inspector/BreakpointListener.java
67cc2099b892c70c325d22e195e0308a32f85f97
[ "Apache-2.0" ]
permissive
aneki1/masl
a2c5592ea451b65e40addc888b4fa85d1790e38c
ec71c34848e01bd9ff28401ea8ed7b86c57a453f
refs/heads/master
2020-05-02T20:03:53.057549
2018-12-26T19:45:54
2018-12-27T18:03:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
267
java
// // Filename : BreakpointListener.java // // UK Crown Copyright (c) 2005. All Rights Reserved // package org.xtuml.masl.inspector; public interface BreakpointListener extends java.util.EventListener { public void breakpointChanged ( BreakpointEvent e ); }
[ "cort@roxsoftware.com" ]
cort@roxsoftware.com
820f0653e2f350ef2f5c3458154b6faecc1fe0fb
e43dfb7ed07f4497855c6d54fae46fd8369f254c
/app/src/main/java/ru/dentro/geekbrains/levelthreelessontwo/MainActivity.java
6ed164a9476eb3641907a52a821d38abc1d63f3f
[]
no_license
DentroApps/level3lesson2
c1933169218659b2d118faab63835b0ea07595c1
d7e61e98ddbaaa3c246d12c11f613931f893d8bf
refs/heads/master
2020-03-28T10:40:34.364475
2018-09-10T09:40:22
2018-09-10T09:40:22
148,133,132
0
0
null
2018-09-10T09:48:27
2018-09-10T09:42:36
Java
UTF-8
Java
false
false
2,138
java
package ru.dentro.geekbrains.levelthreelessontwo; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.Editable; import android.text.TextWatcher; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import io.reactivex.Observable; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.schedulers.Schedulers; public class MainActivity extends AppCompatActivity implements TextReceiver, View.OnClickListener { private EditText etTextInput; private TextView twTextOutput; private TextStreamHandler handler; private Observable<String> obsText; private Button btnEventBus; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); etTextInput = findViewById(R.id.etTextInput); twTextOutput = findViewById(R.id.twTextOutput); etTextInput.addTextChangedListener(inputListener); btnEventBus = findViewById(R.id.btnEventBus); btnEventBus.setOnClickListener(this); handler = new TextStreamHandler(this); } private TextWatcher inputListener = new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { obsText = Observable.just(s.toString()) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()); handler.emitText(obsText); // Можно обойтись и без Rx, но не зря же мы его проходим } }; @Override public void onTextReceived(String s) { twTextOutput.setText(s); } @Override public void onClick(View v) { startActivity(new Intent(this, EventBusActivity.class)); } }
[ "33389655+DentroApps@users.noreply.github.com" ]
33389655+DentroApps@users.noreply.github.com
cdfedf47bfa9457a90fa597f0365c0954855135e
b2bd27bc9460b7af12d8a3685d3070150953c872
/src/main/java/com/searshc/hs/agreement/agreementservice/service/AgreementService.java
5a8d2b4516bf85a4b962bb9a4259e71d9547f715
[]
no_license
hnairb/shs-cuid
c09897c2221e2eab44e337c736bf5efee5afb49d
524520e64eb0303d2a1a139271cb8f1bee689c54
refs/heads/master
2021-01-15T17:55:12.299185
2017-08-08T12:00:37
2017-08-08T12:00:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,286
java
package com.searshc.hs.agreement.agreementservice.service; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; import com.searshc.hs.agreement.agreementservice.domain.request.AddRequest; import com.searshc.hs.agreement.agreementservice.domain.request.AgreementDetailsRequest; import com.searshc.hs.agreement.agreementservice.domain.request.AgreementListRequest; import com.searshc.hs.agreement.agreementservice.domain.request.CancelRequest; import com.searshc.hs.agreement.agreementservice.domain.request.DetailsRequest; import com.searshc.hs.agreement.agreementservice.domain.request.LeadDetailsRequest; import com.searshc.hs.agreement.agreementservice.domain.request.ManualLeadRequestVO; import com.searshc.hs.agreement.agreementservice.domain.request.QueueCancelListRequest; import com.searshc.hs.agreement.agreementservice.domain.request.QueueCancelRequest; import com.searshc.hs.agreement.agreementservice.domain.request.ReprintRequest; import com.searshc.hs.agreement.agreementservice.domain.request.SettlementRequest; import com.searshc.hs.agreement.agreementservice.domain.request.TechPASalesRequest; import com.searshc.hs.agreement.agreementservice.domain.response.AddResponse; import com.searshc.hs.agreement.agreementservice.domain.response.AgreementDetailResponse; import com.searshc.hs.agreement.agreementservice.domain.response.AgreementResponse; import com.searshc.hs.agreement.agreementservice.domain.response.CancelResponse; import com.searshc.hs.agreement.agreementservice.domain.response.ItemDetailsResponse; import com.searshc.hs.agreement.agreementservice.domain.response.LeadDetailsResponse; import com.searshc.hs.agreement.agreementservice.domain.response.ManualLeadResponseVO; import com.searshc.hs.agreement.agreementservice.domain.response.QueueCancelListResponse; import com.searshc.hs.agreement.agreementservice.domain.response.QueueCancelResponse; import com.searshc.hs.agreement.agreementservice.domain.response.ReprintResponse; import com.searshc.hs.agreement.agreementservice.domain.response.SettlementResponse; import com.searshc.hs.agreement.agreementservice.domain.response.TechPASalesResponse; import com.searshc.hs.agreement.contract.service.domain.request.HwpDetailsRequest; import com.searshc.hs.agreement.contract.service.domain.response.HwpDetailsResponse; @Path("/agreementservice") @Produces({"application/xml"}) @Consumes({"application/xml"}) public interface AgreementService { @POST @Path("/agreement/hwpdetails") public HwpDetailsResponse getContractDetail( HwpDetailsRequest hwpDetailsRequest); @POST @Path("/agreement/list") public AgreementResponse getAgreementList(AgreementListRequest agreementListRequest); @POST @Path("/agreement/details") public AgreementDetailResponse getAgreementDetails(AgreementDetailsRequest agreementDetailsRequest); @POST @Path("/agreement/item/details") public ItemDetailsResponse getItemDetails(DetailsRequest request); @POST @Path("/agreement/addagreement") public AddResponse addAgreement(AddRequest addRequest); @POST @Path("/agreement/leaddetails") public LeadDetailsResponse getLeadDetails(LeadDetailsRequest leadDetailsRequest); @POST @Path("/agreement/queuecancel") public QueueCancelResponse queueCancel(QueueCancelRequest queueCancelRequest); @POST @Path("/agreement/queuecancellist") public QueueCancelListResponse queueCancelList(QueueCancelListRequest queueCancelListRequest); @GET @Path("/agreement/ping") public String ping(); @POST @Path("/agreement/cancelagreement") public CancelResponse cancelAgreement(CancelRequest cancelRequest); @POST @Path("/agreement/createtechpa") public TechPASalesResponse createTechPA(TechPASalesRequest techPASalesRequest); @POST @Path("/agreement/reprint") public ReprintResponse reprint(ReprintRequest reprintRequest); @POST @Path("/agreement/settlement") public SettlementResponse settlement(SettlementRequest settlementRequest); @POST @Path("/agreement/addmanualleadpending") public ManualLeadResponseVO addManualLeadPending(ManualLeadRequestVO manualLeadRequestVO); @POST @Path("/agreement/addmanuallead") public ManualLeadResponseVO addManualLead(ManualLeadRequestVO manualLeadRequestVO); }
[ "rgaurav@SHI58495EU1278F.kih.kmart.com" ]
rgaurav@SHI58495EU1278F.kih.kmart.com
ce20caf163d93d26faeacd14c4bd2c7ce88ed4bc
bb7be5b4175efccf3edad6e89aad95a589a9dc6c
/DesignPattern/src/main/java/com/belong/factory/simplefactory/Test.java
239be9365c1ea45dc811a6fc56574574cb3946d7
[]
no_license
BarryPro/JavaEE_Eclipse
5fde49bfcedf88d660319ab7c9da187f0eaddcea
df5bacbc094e49c693eb8b18f8b734835665b068
refs/heads/master
2021-06-25T04:21:16.572515
2017-09-13T04:10:01
2017-09-13T04:10:01
99,305,991
0
1
null
null
null
null
UTF-8
Java
false
false
224
java
package com.belong.factory.simplefactory; public class Test { public static void main(String[] args) { Factory factory = new Factory(); IProduct product = factory.factory(1); product.saleProduct(); } }
[ "belong.belong@outlook.com" ]
belong.belong@outlook.com
f936079c4c8a650faa9927cd0282a3bad8490177
89b1c3a8b8851aa0ff8a1a8881ef9a440808445a
/src/main/java/com/lsriders/backend/web/rest/PuntsClauResource.java
d7eafbb6428f70e05b88c0b9b3d135cf175213a5
[]
no_license
ferransalvat3/BackendLSRiders
827d76a73a531980ae7c32d5f016823c0995f56a
87bf5f13ebc8975c637c37eed6adcec778ce3f17
refs/heads/master
2021-07-04T20:40:46.575892
2019-06-08T16:52:06
2019-06-08T16:52:06
179,109,284
0
1
null
2020-09-18T08:04:10
2019-04-02T15:39:49
Java
UTF-8
Java
false
false
4,557
java
package com.lsriders.backend.web.rest; import com.lsriders.backend.domain.PuntsClau; import com.lsriders.backend.repository.PuntsClauRepository; import com.lsriders.backend.web.rest.errors.BadRequestAlertException; import com.lsriders.backend.web.rest.util.HeaderUtil; import io.github.jhipster.web.util.ResponseUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import java.net.URI; import java.net.URISyntaxException; import java.util.List; import java.util.Optional; /** * REST controller for managing PuntsClau. */ @RestController @RequestMapping("/api") public class PuntsClauResource { private final Logger log = LoggerFactory.getLogger(PuntsClauResource.class); private static final String ENTITY_NAME = "puntsClau"; private final PuntsClauRepository puntsClauRepository; public PuntsClauResource(PuntsClauRepository puntsClauRepository) { this.puntsClauRepository = puntsClauRepository; } /** * POST /punts-claus : Create a new puntsClau. * * @param puntsClau the puntsClau to create * @return the ResponseEntity with status 201 (Created) and with body the new puntsClau, or with status 400 (Bad Request) if the puntsClau has already an ID * @throws URISyntaxException if the Location URI syntax is incorrect */ @PostMapping("/punts-claus") public ResponseEntity<PuntsClau> createPuntsClau(@RequestBody PuntsClau puntsClau) throws URISyntaxException { log.debug("REST request to save PuntsClau : {}", puntsClau); if (puntsClau.getId() != null) { throw new BadRequestAlertException("A new puntsClau cannot already have an ID", ENTITY_NAME, "idexists"); } PuntsClau result = puntsClauRepository.save(puntsClau); return ResponseEntity.created(new URI("/api/punts-claus/" + result.getId())) .headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString())) .body(result); } /** * PUT /punts-claus : Updates an existing puntsClau. * * @param puntsClau the puntsClau to update * @return the ResponseEntity with status 200 (OK) and with body the updated puntsClau, * or with status 400 (Bad Request) if the puntsClau is not valid, * or with status 500 (Internal Server Error) if the puntsClau couldn't be updated * @throws URISyntaxException if the Location URI syntax is incorrect */ @PutMapping("/punts-claus") public ResponseEntity<PuntsClau> updatePuntsClau(@RequestBody PuntsClau puntsClau) throws URISyntaxException { log.debug("REST request to update PuntsClau : {}", puntsClau); if (puntsClau.getId() == null) { throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); } PuntsClau result = puntsClauRepository.save(puntsClau); return ResponseEntity.ok() .headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, puntsClau.getId().toString())) .body(result); } /** * GET /punts-claus : get all the puntsClaus. * * @return the ResponseEntity with status 200 (OK) and the list of puntsClaus in body */ @GetMapping("/punts-claus") public List<PuntsClau> getAllPuntsClaus() { log.debug("REST request to get all PuntsClaus"); return puntsClauRepository.findAll(); } /** * GET /punts-claus/:id : get the "id" puntsClau. * * @param id the id of the puntsClau to retrieve * @return the ResponseEntity with status 200 (OK) and with body the puntsClau, or with status 404 (Not Found) */ @GetMapping("/punts-claus/{id}") public ResponseEntity<PuntsClau> getPuntsClau(@PathVariable Long id) { log.debug("REST request to get PuntsClau : {}", id); Optional<PuntsClau> puntsClau = puntsClauRepository.findById(id); return ResponseUtil.wrapOrNotFound(puntsClau); } /** * DELETE /punts-claus/:id : delete the "id" puntsClau. * * @param id the id of the puntsClau to delete * @return the ResponseEntity with status 200 (OK) */ @DeleteMapping("/punts-claus/{id}") public ResponseEntity<Void> deletePuntsClau(@PathVariable Long id) { log.debug("REST request to delete PuntsClau : {}", id); puntsClauRepository.deleteById(id); return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build(); } }
[ "jhipster-bot@jhipster.tech" ]
jhipster-bot@jhipster.tech
85db33238265bdc17c8b02df09c567946314629b
329b2cb3c91a0c953458efd253c4fcdce6f539c4
/graphsdk/src/main/java/com/microsoft/graph/extensions/IWorkbookNamedItemRangeRequest.java
a6c643c636a5449529fbaf2578134d4818c12d44
[ "MIT" ]
permissive
sbolotovms/msgraph-sdk-android
255eeddf19c1b15f04ee3b1549f0cae70d561fdd
1320795ba1c0b5eb36ef8252b73799d15fc46ba1
refs/heads/master
2021-01-20T05:09:00.148739
2017-04-28T23:20:23
2017-04-28T23:20:23
89,751,501
1
0
null
2017-04-28T23:20:37
2017-04-28T23:20:37
null
UTF-8
Java
false
false
928
java
// ------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. // ------------------------------------------------------------------------------ package com.microsoft.graph.extensions; import com.microsoft.graph.concurrency.*; import com.microsoft.graph.core.*; import com.microsoft.graph.extensions.*; import com.microsoft.graph.http.*; import com.microsoft.graph.generated.*; import com.microsoft.graph.options.*; import com.microsoft.graph.serializer.*; import java.util.Arrays; import java.util.List; // This file is available for extending, afterwards please submit a pull request. /** * The interface for the Workbook Named Item Range Request. */ public interface IWorkbookNamedItemRangeRequest extends IBaseWorkbookNamedItemRangeRequest { }
[ "brianmel@microsoft.com" ]
brianmel@microsoft.com
6dc374593bfd3a8af4ee7b84672df1b6cb301cd6
3f542f5a4845635ebb473fab1c01a426f9c0ea85
/src/de/sag/mazehunter/server/networkData/lobby/OccupySlotRequest.java
09d32cf3bdfce309651f2ffb448c612ce8dbe93a
[]
no_license
SAG-INFO/MazeHunterServer
f878e4619b9835dcffd39e8b406ab4929ccf9006
8eb6890ecfc3e38f2a93dff5c717e471dc36de01
refs/heads/master
2020-03-11T05:15:59.298592
2018-07-23T10:36:11
2018-07-23T10:36:11
129,797,626
3
2
null
2018-07-23T10:36:12
2018-04-16T19:53:02
Java
UTF-8
Java
false
false
337
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 de.sag.mazehunter.server.networkData.lobby; /** * * @author arein */ public class OccupySlotRequest { public int index; }
[ "arein@DESKTOP-NIC662K.fritz.box" ]
arein@DESKTOP-NIC662K.fritz.box
43924f1450d9799e369f8af32b93302273a17009
b14d21b709d7d4737fb69fbcb1153e58eb4e671f
/src/com/unifi/ing/engine/renderer/EntityRenderer.java
aa077ab7c749d01711098d3918702dd028cb63d6
[ "Apache-2.0" ]
permissive
maurizioterreni/OpenGL
3a4fa5264d4f475b1c87379ccb8535afdde08d24
a953d5d68cef6dc5b25d7b2d6c558a3da69819df
refs/heads/master
2020-04-05T23:29:45.602102
2017-07-06T20:54:20
2017-07-06T20:54:20
86,566,094
4
0
null
null
null
null
UTF-8
Java
false
false
3,203
java
package com.unifi.ing.engine.renderer; import java.util.List; import java.util.Map; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL13; import org.lwjgl.opengl.GL20; import org.lwjgl.opengl.GL30; import org.lwjgl.util.vector.Matrix4f; import org.lwjgl.util.vector.Quaternion; import com.unifi.ing.engine.entity.Entity; import com.unifi.ing.engine.model.RawModel; import com.unifi.ing.engine.model.TexturedModel; import com.unifi.ing.engine.shader.model.ModelShader; import com.unifi.ing.engine.texture.ModelTexture; import com.unifi.ing.engine.utils.Maths; public class EntityRenderer { private ModelShader shader; public EntityRenderer(ModelShader shader,Matrix4f projectionMatrix) { this.shader = shader; shader.start(); shader.loadProjectionMatrix(projectionMatrix); shader.stop(); } public void render(Map<TexturedModel, List<Entity>> entities) { for (TexturedModel model : entities.keySet()) { prepareTexturedModel(model); List<Entity> batch = entities.get(model); for (Entity entity : batch) { prepareInstance(entity); GL11.glDrawElements(GL11.GL_TRIANGLES, model.getRawModel().getVertexCount(), GL11.GL_UNSIGNED_INT, 0); } unbindTexturedModel(); } } private void prepareTexturedModel(TexturedModel model) { RawModel rawModel = model.getRawModel(); GL30.glBindVertexArray(rawModel.getVaoID()); GL20.glEnableVertexAttribArray(0); GL20.glEnableVertexAttribArray(1); GL20.glEnableVertexAttribArray(2); ModelTexture texture = model.getTexture(); if(texture.isHasTransparency()){ MasterRenderer.disableCulling(); } shader.loadFakeLightingVariable(texture.isUseFakeLighting()); shader.loadShineVariables(texture.getShineDamper(), texture.getReflectivity()); GL13.glActiveTexture(GL13.GL_TEXTURE0); GL11.glBindTexture(GL11.GL_TEXTURE_2D, model.getTexture().getTextureID()); } private void unbindTexturedModel() { MasterRenderer.enableCulling(); GL20.glDisableVertexAttribArray(0); GL20.glDisableVertexAttribArray(1); GL20.glDisableVertexAttribArray(2); GL30.glBindVertexArray(0); } private void prepareInstance(Entity entity) { // Matrix4f transformationMatrix = Maths.createTransformationMatrix(entity.getPosition(), // entity.getRotX(), entity.getRotY(), entity.getRotZ(), entity.getScale()); Matrix4f transformationMatrix = Maths.createTransformationMatrix(entity.getPosition(), Entity.getRotationQuat(entity.getRotX(), entity.getRotY(), entity.getRotZ()), entity.getScale()); shader.loadTransformationMatrix(transformationMatrix); } public Quaternion addRotation(float rx, float ry, float rz) { Quaternion rotation = new Quaternion(); // Rotate Y axis Quaternion.mul(new Quaternion(1f, 0f, 0f, ry * Maths.PI_OVER_180), rotation, rotation); rotation.normalise(); // Rotate X axis Quaternion.mul(rotation, new Quaternion(0f, 1f, 0f, rx * Maths.PI_OVER_180),rotation); rotation.normalise(); // Rotate Z axis Quaternion.mul(new Quaternion(0f, 0f, 1f, rz * Maths.PI_OVER_180), rotation, rotation); rotation.normalise(); return rotation; } }
[ "maurizio.terreni@live.it" ]
maurizio.terreni@live.it
4510a36aa249e4e7a80335a608217efc01ef380b
8ce3b07c0cf61e41bf5fdb640c973f77e0493eb6
/com/dreamcodex/todr/object/Floorplan.java
4a2913cb67683632adcdc66da08d12f75dcb3f96
[ "MIT" ]
permissive
michaelsbradleyjr/ToDR
84aa567ac1497bce9d6150e65d2ffafef13cc427
847129f53b47b21a4f116cb788a78ec5b5974ef3
refs/heads/master
2016-09-06T12:48:07.643234
2015-03-20T20:14:04
2015-03-20T20:14:04
32,601,655
0
0
null
null
null
null
UTF-8
Java
false
false
2,085
java
package com.dreamcodex.todr.object; import com.dreamcodex.util.Coord; public class Floorplan { private char[][] plan; private Coord cpAreaStart; // this is the beginning of the active "inside" area (where monsters and item are confined) private Coord cpAreaEnd; // this is the end of the active "inside" area private int[][] layout; // holds volatile room layout, changes based on processing of plan template against current room settings public Floorplan(char[][] plan, Coord cpStart, Coord cpEnd) { this.plan = plan; cpAreaStart = new Coord(cpStart); cpAreaEnd = new Coord(cpEnd); layout = new int[plan.length][plan[0].length]; } public char[][] getPlan() { return plan; } public int getHeight() { return plan.length; } public int getWidth() { return plan[0].length; } public Coord getAreaStart() { return cpAreaStart; } public int getAreaStartX() { return cpAreaStart.getX(); } public int getAreaStartY() { return cpAreaStart.getY(); } public Coord getAreaEnd() { return cpAreaEnd; } public int getAreaEndX() { return cpAreaEnd.getX(); } public int getAreaEndY() { return cpAreaEnd.getY(); } public int getAreaXPos() { return ((cpAreaEnd.getX() - cpAreaStart.getX()) / 2) + 1; } // number of valid X positions inside room for objects (objects are 2 units wide) public int getAreaYPos() { return ((cpAreaEnd.getY() - cpAreaStart.getY()) / 2) + 1; } // number of valid Y positions inside room for objects (objects are 2 units tall) public int[][] getLayout() { return layout; } public char getPlanChar(int x, int y) { return plan[y][x]; } public int getLayoutType(int x, int y) { if((y < 0) || (x < 0) || (y >= layout.length) || (x >= layout[0].length)) { return Globals.ROOM_OFFMAP; } else { return layout[y][x]; } } public void setLayoutType(int x, int y, int i) { if((y < 0) || (x < 0) || (y >= layout.length) || (x >= layout[0].length)) { // off map, ignore } else { layout[y][x] = i; } } }
[ "hkistler@tabularetina.com" ]
hkistler@tabularetina.com
240c918eb45968e94ea9a8a741fb5855c5c06dcc
05e5bee54209901d233f4bfa425eb6702970d6ab
/net/minecraft/util/io/netty/handler/codec/marshalling/DefaultUnmarshallerProvider.java
318c34f8730315965818e1c0ad4c26b36691a682
[]
no_license
TheShermanTanker/PaperSpigot-1.7.10
23f51ff301e7eb05ef6a3d6999dd2c62175c270f
ea9d33bcd075e00db27b7f26450f9dc8e6d18262
refs/heads/master
2022-12-24T10:32:09.048106
2020-09-25T15:43:22
2020-09-25T15:43:22
298,614,646
0
1
null
null
null
null
UTF-8
Java
false
false
1,471
java
/* */ package net.minecraft.util.io.netty.handler.codec.marshalling; /* */ /* */ import net.minecraft.util.io.netty.channel.ChannelHandlerContext; /* */ import org.jboss.marshalling.MarshallerFactory; /* */ import org.jboss.marshalling.MarshallingConfiguration; /* */ import org.jboss.marshalling.Unmarshaller; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class DefaultUnmarshallerProvider /* */ implements UnmarshallerProvider /* */ { /* */ private final MarshallerFactory factory; /* */ private final MarshallingConfiguration config; /* */ /* */ public DefaultUnmarshallerProvider(MarshallerFactory factory, MarshallingConfiguration config) { /* 41 */ this.factory = factory; /* 42 */ this.config = config; /* */ } /* */ /* */ /* */ public Unmarshaller getUnmarshaller(ChannelHandlerContext ctx) throws Exception { /* 47 */ return this.factory.createUnmarshaller(this.config); /* */ } /* */ } /* Location: D:\Paper-1.7.10\PaperSpigot-1.7.10-R0.1-SNAPSHOT-latest.jar!\net\minecraf\\util\io\netty\handler\codec\marshalling\DefaultUnmarshallerProvider.class * Java compiler version: 6 (50.0) * JD-Core Version: 1.1.3 */
[ "tanksherman27@gmail.com" ]
tanksherman27@gmail.com
8a9ee1882b0e20ca9bf4b52bbd192022996c6af2
b07acbae379982280cf953da07cf8994d1602a07
/javatest-basis/src/main/java/com/thd/thread/api/t14executeorder/semaphore/Test.java
b222c4ae2c79454355c9c26df0d14f4d9629fb20
[]
no_license
devil13th/javatest-root
28d35199b5b2475aac75cb8ee50d8e9f92d8c980
e2a1f6595ba8eebbaa404c6ba422065df7baf802
refs/heads/master
2022-12-23T02:43:46.050912
2021-05-28T02:03:03
2021-05-28T02:03:03
137,824,328
0
0
null
2022-12-16T03:03:30
2018-06-19T01:20:49
Java
UTF-8
Java
false
false
1,226
java
package com.thd.thread.api.t14executeorder.semaphore; import java.util.concurrent.Semaphore; //Semaphore 的作用是控制线程只能有指定数量的线程同时运行 public class Test { public static void main(String[] args) { int N = 8; //工人数 Semaphore semaphore = new Semaphore(2); //机器数目 for(int i=0;i<N;i++) new Worker(i,semaphore,i%2).start(); } static class Worker extends Thread{ private int num; private Semaphore semaphore; private int sleepTime; public Worker(int num,Semaphore semaphore,int sleepTime){ this.num = num; this.semaphore = semaphore; this.sleepTime = sleepTime * 1000; } @Override public void run() { try { semaphore.acquire(); System.out.println("工人"+this.num+"占用一个机器在生产..."); Thread.sleep(this.sleepTime); System.out.println("工人"+this.num+"释放出机器"); semaphore.release(); } catch (InterruptedException e) { e.printStackTrace(); } } } }
[ "181907667@qq.com" ]
181907667@qq.com
13d8611207f8f4c28c8ea47943b04e88dad59db2
44dbae7ac797b62f42ec82b4cd5a0242b440fa92
/src/lk/ijse/dep/MostWantedCabs/DAO/custom/impl/VehicleCategoryDAOImpl.java
156b40e20236a21ddc6d311058c66fc50239bb92
[ "MIT" ]
permissive
KesharaWaidyarathna/Car-Rental-Management-System-JPA-Hibernate
f9ae90dcc47a085576611b7b6d9c7c24ec77972c
77209f7080e1731d10559d41d41d974375ba6563
refs/heads/master
2020-09-20T12:39:34.586115
2019-11-28T18:32:17
2019-11-28T18:32:17
224,480,811
0
0
null
null
null
null
UTF-8
Java
false
false
750
java
package lk.ijse.dep.MostWantedCabs.DAO.custom.impl; import lk.ijse.dep.MostWantedCabs.DAO.CrudDAOImpl; import lk.ijse.dep.MostWantedCabs.DAO.custom.VehicleCategoryDAO; import lk.ijse.dep.MostWantedCabs.Entity.VehicleCategory; import javax.persistence.Query; import java.sql.ResultSet; import java.util.ArrayList; import java.util.List; public class VehicleCategoryDAOImpl extends CrudDAOImpl<VehicleCategory,String> implements VehicleCategoryDAO { @Override public String getLastCategoryID() throws Exception { Query nativeQuery = entityManager.createNativeQuery("SELECT id FROM vehiclecategory ORDER BY id DESC LIMIT 1"); return nativeQuery.getResultList().size()>0? (String) nativeQuery.getSingleResult() :null; } }
[ "waidyrathna@gmail.com" ]
waidyrathna@gmail.com
c3833961c1d67f809e69f9405547394d8632b8d5
c343c123296d2687bbb20f8feafb062edfa0f19f
/Test.java
c5c936371d28ba14b8d94945cd039dceaa594479
[]
no_license
Nanzhengji/Thread_03
abc45f1919a9df4afccf4bdeff7dd6ca061b34a2
3ed764d7d0c1f6a353c2b623fc77d84399310e56
refs/heads/master
2020-04-09T01:57:22.667896
2018-12-01T08:19:25
2018-12-01T08:19:25
159,923,749
0
0
null
null
null
null
UTF-8
Java
false
false
273
java
package threadDemo3; public class Test { public static void main(String[] args) { Computer c = new Computer(); Producter p = new Producter(c); Takener t = new Takener(c); Thread p1 = new Thread(p); Thread t1 = new Thread(t); p1.start(); t1.start(); } }
[ "noreply@github.com" ]
Nanzhengji.noreply@github.com
05a8aab427c34e12775e36ab2776a2a71abdee75
9944682cee0dc6fc782ddb39623312f5a804e85b
/base/org/curso/model/X_H_QueyLine.java
81853c567232a13cc001ff720f62ef3d9eba9778
[]
no_license
GermanLaguna/Custom-Adempiere-Hospital
22ae605bd94cffbd8930664cc0702bee0c896235
f3504e6d4c5b5efaf1e416117ac781495d93a18c
refs/heads/master
2021-08-26T09:13:36.906346
2017-11-22T20:29:31
2017-11-22T20:29:31
110,012,694
0
0
null
null
null
null
UTF-8
Java
false
false
4,817
java
/****************************************************************************** * Product: Adempiere ERP & CRM Smart Business Solution * * Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. * * This program is free software, you can redistribute it and/or modify it * * under the terms version 2 of the GNU General Public License as published * * by the Free Software Foundation. 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., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * * For the text or an alternative of this public license, you may reach us * * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * * or via info@compiere.org or http://www.compiere.org/license.html * *****************************************************************************/ /** Generated Model - DO NOT CHANGE */ package org.curso.model; import java.sql.ResultSet; import java.util.Properties; import org.compiere.model.*; /** Generated Model for H_QueyLine * @author Adempiere (generated) * @version Release 3.8.0 - $Id$ */ public class X_H_QueyLine extends PO implements I_H_QueyLine, I_Persistent { /** * */ private static final long serialVersionUID = 20171103L; /** Standard Constructor */ public X_H_QueyLine (Properties ctx, int H_QueyLine_ID, String trxName) { super (ctx, H_QueyLine_ID, trxName); /** if (H_QueyLine_ID == 0) { setH_QueyLine_ID (0); } */ } /** Load Constructor */ public X_H_QueyLine (Properties ctx, ResultSet rs, String trxName) { super (ctx, rs, trxName); } /** AccessLevel * @return 3 - Client - Org */ protected int get_AccessLevel() { return accessLevel.intValue(); } /** Load Meta Data */ protected POInfo initPO (Properties ctx) { POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName()); return poi; } public String toString() { StringBuffer sb = new StringBuffer ("X_H_QueyLine[") .append(get_ID()).append("]"); return sb.toString(); } /** Set Description. @param Description Optional short description of the record */ public void setDescription (String Description) { set_Value (COLUMNNAME_Description, Description); } /** Get Description. @return Optional short description of the record */ public String getDescription () { return (String)get_Value(COLUMNNAME_Description); } public org.curso.model.I_H_Affliction getH_Affliction() throws RuntimeException { return (org.curso.model.I_H_Affliction)MTable.get(getCtx(), org.curso.model.I_H_Affliction.Table_Name) .getPO(getH_Affliction_ID(), get_TrxName()); } /** Set Affliction. @param H_Affliction_ID Affliction */ public void setH_Affliction_ID (int H_Affliction_ID) { if (H_Affliction_ID < 1) set_Value (COLUMNNAME_H_Affliction_ID, null); else set_Value (COLUMNNAME_H_Affliction_ID, Integer.valueOf(H_Affliction_ID)); } /** Get Affliction. @return Affliction */ public int getH_Affliction_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_H_Affliction_ID); if (ii == null) return 0; return ii.intValue(); } public org.curso.model.I_H_Query getH_Query() throws RuntimeException { return (org.curso.model.I_H_Query)MTable.get(getCtx(), org.curso.model.I_H_Query.Table_Name) .getPO(getH_Query_ID(), get_TrxName()); } /** Set Query. @param H_Query_ID Query */ public void setH_Query_ID (int H_Query_ID) { if (H_Query_ID < 1) set_Value (COLUMNNAME_H_Query_ID, null); else set_Value (COLUMNNAME_H_Query_ID, Integer.valueOf(H_Query_ID)); } /** Get Query. @return Query */ public int getH_Query_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_H_Query_ID); if (ii == null) return 0; return ii.intValue(); } /** Set QueryLine ID. @param H_QueyLine_ID QueryLine ID */ public void setH_QueyLine_ID (int H_QueyLine_ID) { if (H_QueyLine_ID < 1) set_ValueNoCheck (COLUMNNAME_H_QueyLine_ID, null); else set_ValueNoCheck (COLUMNNAME_H_QueyLine_ID, Integer.valueOf(H_QueyLine_ID)); } /** Get QueryLine ID. @return QueryLine ID */ public int getH_QueyLine_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_H_QueyLine_ID); if (ii == null) return 0; return ii.intValue(); } }
[ "informatica@DESKTOP-JIEAIJ1" ]
informatica@DESKTOP-JIEAIJ1
d0b948549e9954fbb586bbd422ccd73c00ec5da1
6d6e32054b3d966a091f6651523267cc6a37aca1
/src/main/java/com/qiang/modules/sys/pojo/BlogMessage.java
433d4170b7b0ea3f45e3458460289674ae05522c
[]
no_license
yexi520/people-blog
e87fc48cf973a6cda3fee4018d7094efb4e4c762
d70241fe1cc397b32aa0d5e5f225fdf8fe713ca1
refs/heads/master
2020-09-09T07:18:15.219035
2019-09-15T08:12:01
2019-09-15T08:12:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,970
java
package com.qiang.modules.sys.pojo; import java.io.Serializable; /** * @Author: qiang * @ProjectName: adminsystem * @Package: com.qiang.modules.sys.pojo * @Description: 博客信息表 * @Date: 2019/7/4 0004 11:13 **/ public class BlogMessage implements Serializable { private static final long serialVersionUID = 6202944650911776915L; /** * 标识符 */ private long id; /** * 标题 */ private String title; /** * 正文 */ private String text; /** * 标签id */ private String labelValues; /** * 文章类型 */ private String selectType; /** * 博客分类 */ private String selectCategories; /** * 文章等级 */ private int selectGrade; /** * 原文章作者 */ private String originalAuthor; /** * 文章(0-公开 1-私密) */ private String message; /** * 创建时间 */ private String createTime; /** * 点赞 */ private Integer likes; /** * 作者名字 */ private String name; /** * 文章摘要 * @return */ private String articleTabloid; /** * 含HTML文章 */ private String articleHtmlContent; /** * 标签数组 */ private String[] tagValue; /** * 浏览次数 */ private int look; public int getLook() { return look; } public void setLook(int look) { this.look = look; } public String[] getTagValue() { return tagValue; } public void setTagValue(String[] tagValue) { this.tagValue = tagValue; } public String getArticleHtmlContent() { return articleHtmlContent; } public void setArticleHtmlContent(String articleHtmlContent) { this.articleHtmlContent = articleHtmlContent; } public String getCreateTime() { return createTime; } public void setCreateTime(String createTime) { this.createTime = createTime; } public String getArticleTabloid() { return articleTabloid; } public void setArticleTabloid(String articleTabloid) { this.articleTabloid = articleTabloid; } public long getId() { return id; } public void setId(long id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getText() { return text; } public void setText(String text) { this.text = text; } public String getLabelValues() { return labelValues; } public void setLabelValues(String labelValues) { this.labelValues = labelValues; } public String getSelectType() { return selectType; } public void setSelectType(String selectType) { this.selectType = selectType; } public String getSelectCategories() { return selectCategories; } public void setSelectCategories(String selectCategories) { this.selectCategories = selectCategories; } public int getSelectGrade() { return selectGrade; } public void setSelectGrade(int selectGrade) { this.selectGrade = selectGrade; } public String getOriginalAuthor() { return originalAuthor; } public void setOriginalAuthor(String originalAuthor) { this.originalAuthor = originalAuthor; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public Integer getLike() { return likes; } public void setLike(Integer likes) { this.likes = likes; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
[ "1158821459@qq.com" ]
1158821459@qq.com
5c9c86d104777891dc32fb14d1fc707777eeb5ae
2213311ac8a417661c45b3e97e250a7f68d62b64
/Hbase/src/main/java/com/sql/hbase/nosleep/mapReduce/hdfsorhbase/HdfsToHBase.java
068faf0d7372571c005e40622bed7aab59fc3ac6
[]
no_license
sqlchan/llfTool
41a2e62740340c7e0d3df198b7c530ce0ef55ae2
9541b4f01c69cbf5798f62e6f85d3c7fb0db995a
refs/heads/master
2022-07-04T06:28:59.854793
2020-04-03T06:05:09
2020-04-03T06:05:09
244,408,719
0
0
null
2022-07-01T21:28:24
2020-03-02T15:42:22
Java
UTF-8
Java
false
false
3,907
java
package com.sql.hbase.nosleep.mapReduce.hdfsorhbase; import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.client.HBaseAdmin; import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.mapreduce.TableOutputFormat; import org.apache.hadoop.hbase.mapreduce.TableReducer; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.io.NullWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.Mapper; import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; import org.apache.hadoop.mapreduce.lib.input.TextInputFormat; // 读取Hdfs文件将统计结果存入到Hbase表中 public class HdfsToHBase { public static class Map extends Mapper<LongWritable, Text, Text, IntWritable> { private IntWritable i = new IntWritable(1); @Override public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { String s[] = value.toString().trim().split("/n"); for (String m : s) { context.write(new Text(m), i); } } } public static class Reduce extends TableReducer<Text, IntWritable, NullWritable> { @Override public void reduce(Text key, Iterable<IntWritable> values, Context context) throws IOException, InterruptedException { int sum = 0; for (IntWritable i : values) { sum += i.get(); } Put put = new Put(Bytes.toBytes(key.toString())); // 列族为cf,列为count,列值为数目 put.add(Bytes.toBytes("cf"), Bytes.toBytes("count"), Bytes.toBytes(String.valueOf(sum))); context.write(NullWritable.get(), put); } } public static void createHBaseTable(String tableName) throws IOException { HTableDescriptor htd = new HTableDescriptor(tableName); HColumnDescriptor col = new HColumnDescriptor("cf"); htd.addFamily(col); Configuration conf = HBaseConfiguration.create(); conf.set("hbase.zookeeper.quorum", "h71"); HBaseAdmin admin = new HBaseAdmin(conf); if (admin.tableExists(tableName)) { System.out.println("table exists, trying to recreate table......"); admin.disableTable(tableName); admin.deleteTable(tableName); } System.out.println("create new table:" + tableName); admin.createTable(htd); } public static void main(String[] args) throws IOException, InterruptedException, ClassNotFoundException { //将结果存入hbase的表名 String tableName = "mytb2"; Configuration conf = new Configuration(); conf.set(TableOutputFormat.OUTPUT_TABLE, tableName); createHBaseTable(tableName); String input = args[0]; Job job = new Job(conf, "WordCount table with " + input); job.setJarByClass(HdfsToHBase.class); job.setNumReduceTasks(3); job.setMapperClass(Map.class); job.setReducerClass(Reduce.class); job.setMapOutputKeyClass(Text.class); job.setMapOutputValueClass(IntWritable.class); job.setInputFormatClass(TextInputFormat.class); job.setOutputFormatClass(TableOutputFormat.class); FileInputFormat.addInputPath(job, new Path(input)); // FileInputFormat.setInputPaths(job, new Path(input)); //这种方法也可以 System.exit(job.waitForCompletion(true) ? 0 : 1); } }
[ "lilongfei5@hikvision.com" ]
lilongfei5@hikvision.com
ed6a0a292411818ce27962c18ad8a4c580068744
0007526bdb937902f06d51ca91767f7586140236
/src/com/dao/GoodsDao.java
219036dcfe9a9e14c9e175742e30e09708a221b7
[]
no_license
liaochengliang/SwapPub
4f4fed1a560f627d51917e7a21b60e22312d999d
90633457c6208bf18f012f08424f79be7c437d77
refs/heads/master
2022-02-27T05:16:39.834738
2019-07-20T11:02:44
2019-07-20T11:02:44
197,916,659
0
0
null
null
null
null
GB18030
Java
false
false
6,399
java
package com.dao; import java.sql.Connection; import java.sql.Date; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import com.entity.Goods; public class GoodsDao { //添加货品操作 : true 表示添加成功 false 表示添加失败 public boolean addGoods(Goods goods){ int belong_user = goods.getBelong_user(); String goodName = goods.getGoodName(); int hs_consumption = goods.getHs_consumption(); String g_img = goods.getG_img(); String description = goods.getDescription(); int s_category = goods.getS_category(); int g_category = goods.getG_category(); Statement stmt=null; Connection con=null; try{ Class.forName("com.mysql.jdbc.Driver"); }catch(ClassNotFoundException e){ e.printStackTrace(); } String url="jdbc:mysql://localhost:3306/swap_pub?user=root&password=root&characterEncoding=utf8"; try { con=DriverManager.getConnection(url); stmt = con.createStatement(); String sql="insert into goods set belong_user='"+belong_user+"',goodName='"+goodName+"',hs_consumption='"+hs_consumption+"',g_img='"+g_img+"',g_category='"+g_category+"',s_category='"+s_category+"',description='"+description+"',created_date=CURRENT_TIMESTAMP"; int result=stmt.executeUpdate(sql); if(result>0){ stmt.close(); con.close(); return true; } else{ stmt.close(); con.close(); return false; } }catch (SQLException e){ e.printStackTrace(); return false; } } //删除货品操作(根据id) : true 表示删除成功 false 表示删除失败 public boolean deleteGoods(int id) { Statement stmt=null; Connection con=null; try{ Class.forName("com.mysql.jdbc.Driver"); }catch(ClassNotFoundException e){ e.printStackTrace(); } String url="jdbc:mysql://localhost:3306/swap_pub?user=root&password=root&characterEncoding=utf8"; try { con=DriverManager.getConnection(url); stmt = con.createStatement(); String sql="delete from goods where id='"+id+"'"; int result=stmt.executeUpdate(sql); if(result>0) { stmt.close(); con.close(); return true; } else{ stmt.close(); con.close(); return false; } }catch (SQLException e){ e.printStackTrace(); return false; } } //修改货品操作(根据id及修改后的信息) : true 表示修改成功 false 表示修改失败 public boolean updateUser(Goods goods) { int id = goods.getId(); int belong_user = goods.getBelong_user(); String goodName = goods.getGoodName(); int hs_consumption = goods.getHs_consumption(); String g_img = goods.getG_img(); String description = goods.getDescription(); int s_category = goods.getS_category(); int g_category = goods.getG_category(); Statement stmt=null; Connection con=null; try{ Class.forName("com.mysql.jdbc.Driver"); }catch(ClassNotFoundException e){ e.printStackTrace(); } String url="jdbc:mysql://localhost:3306/swap_pub?user=root&password=root&characterEncoding=utf8"; try { con=DriverManager.getConnection(url); stmt = con.createStatement(); String sql="update from goods set id='"+id+"', belong_user='"+belong_user+"',goodName='"+goodName+"',hs_consumption='"+hs_consumption+"',g_img='"+g_img+"',g_category='"+g_category+"',s_category='"+s_category+"',description='"+g_category+"'"; int result=stmt.executeUpdate(sql); if(result>0) { stmt.close(); con.close(); return true; } else{ stmt.close(); con.close(); return false; } }catch (SQLException e){ e.printStackTrace(); return false; } } //查询货品(根据id): public Goods selectGoods(int id) { Statement stmt=null; Connection con=null; try{ Class.forName("com.mysql.jdbc.Driver"); }catch(ClassNotFoundException e){ e.printStackTrace(); } String url="jdbc:mysql://localhost:3306/swap_pub?user=root&password=root&characterEncoding=utf8"; try { con=DriverManager.getConnection(url); stmt = con.createStatement(); String sql="select belong_user,goodName,hs_consumption,g_img,description,s_category,g_category,created_date from goods where id='"+id+"'"; ResultSet rs=stmt.executeQuery(sql); if(rs.next()) { int belong_user = rs.getInt("belong_user"); String goodName = rs.getString("goodName"); int hs_consumption = rs.getInt("hs_consumption"); String g_img = rs.getString("g_img"); String description = rs.getString("description"); int s_category = rs.getInt("s_category"); int g_category = rs.getInt("g_category"); Date date = rs.getDate("created_date"); Goods goods=new Goods(id,belong_user,goodName,hs_consumption,g_img,description,s_category,g_category,date); stmt.close(); con.close(); return goods; } else{ stmt.close(); con.close(); return null; } }catch (SQLException e){ e.printStackTrace(); return null; } } //获取所有货品 public ArrayList selectAllGoods() { ArrayList goodsList=new ArrayList(); Statement stmt=null; Connection con=null; try{ Class.forName("com.mysql.jdbc.Driver"); }catch(ClassNotFoundException e){ e.printStackTrace(); } String url="jdbc:mysql://localhost:3306/swap_pub?user=root&password=root&characterEncoding=utf8"; try { con=DriverManager.getConnection(url); stmt = con.createStatement(); String sql="select id,belong_user,goodName,hs_consumption,g_img,description,s_category,g_category from goods"; ResultSet rs=stmt.executeQuery(sql); while(rs.next()){ int id = rs.getInt("id"); int belong_user = rs.getInt("belong_user"); String goodName = rs.getString("goodName"); int hs_consumption = rs.getInt("hs_consumption"); String g_img = rs.getString("g_img"); String description = rs.getString("description"); int s_category = rs.getInt("s_category"); int g_category = rs.getInt("g_category"); goodsList.add(new Goods(id,belong_user,goodName,hs_consumption,g_img,description,s_category,g_category)); } stmt.close(); con.close(); return goodsList; }catch (SQLException e){ e.printStackTrace(); return null; } } }
[ "2789094390@qq.com" ]
2789094390@qq.com
44ed8c08d20324b7489980f9e70037ba16fc3b54
595d95824926e357427f8b110cca6770a6577c65
/ejemplo92_asynctask/src/com/tid/Ejemplo92_asynctask/Ejemplo92_asynctask.java
68fb321e6666c5259486a4bd18aecc652023a905
[]
no_license
jgorozco/curso-avanzado-android
99cf64e2cf926ad2d7aa55c5bc06fe8a8c2d3e13
5f0837f3c279c88841717f2f87ec66f5242b3d43
refs/heads/master
2016-09-05T22:11:40.805035
2012-09-18T15:06:44
2012-09-18T15:06:44
3,864,264
2
0
null
null
null
null
UTF-8
Java
false
false
2,278
java
package com.tid.Ejemplo92_asynctask; import android.app.Activity; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.widget.TextView; public class Ejemplo92_asynctask extends Activity { /** Called when the activity is first created. */ TextView texto; TareaAsync tarea; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); texto=(TextView) findViewById(R.id.text_data); texto.setText("iniciado todo"); initAsyncTask(); } private void initAsyncTask() { tarea=new TareaAsync(); tarea.execute("13"); } private void updateUi(String str) { texto.setText(str); } @Override protected void onStop() { Log.d("TID_EXAMPLE","pasamos por onStop"); tarea.cancel(true); // this.finish(); try { finalize(); } catch (Throwable e) { // TODO Auto-generated catch block e.printStackTrace(); } super.onPause(); } public class TareaAsync extends AsyncTask<String, Integer, Integer> { public int proceso=0; public int total; @Override protected Integer doInBackground(String... arg0) { Log.d("TID_EXAMPLE","doInBackground with"+arg0[arg0.length-1]); String entrada=arg0[arg0.length-1]; total=Integer.parseInt(entrada); while (total>proceso) { try { Thread.sleep(1000); Log.d("TID_EXAMPLE","click"); proceso=proceso+1; publishProgress(proceso); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return total; } @Override protected void onCancelled() { Log.d("TID_EXAMPLE","onCancelled"); super.onCancelled(); } @Override protected void onPostExecute(Integer result) { Log.d("TID_EXAMPLE","onPostExecute["+String.valueOf(result)+"]"); super.onPostExecute(result); } @Override protected void onPreExecute() { Log.d("TID_EXAMPLE","onPreExecute"); super.onPreExecute(); } @Override protected void onProgressUpdate(Integer... values) { Log.d("TID_EXAMPLE","onProgressUpdate["+String.valueOf(values[0])+"]"); updateUi(String.valueOf(values[0])); super.onProgressUpdate(values); } } }
[ "josegoupm@gmail.com" ]
josegoupm@gmail.com
e4e3e9b965fd235b19ac7a2a77ddd198c9d27fc3
037cdf4305251af6561c1f718f581d4d73db177c
/src/Assignment3/A3Q3.java
8c9fc1a43e8cba2b18dea7cf6fe868413ba0a100
[]
no_license
ICS3UI-02-2017/3u-assignments-Jaredriepert
b69141a79920349013794b1f682a191fca53a7b9
3ecef6d729bbb4bd5613ec37dac7f439ef291a7b
refs/heads/master
2021-04-30T11:56:46.934509
2018-06-19T15:11:57
2018-06-19T15:11:57
121,263,936
0
0
null
null
null
null
UTF-8
Java
false
false
1,457
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package Assignment3; import becker.robots.City; import becker.robots.Direction; import becker.robots.RobotSE; /** * * @author riepj9547 */ public class A3Q3 { /** * @param args the command line arguments */ public static void main(String[] args) { // create city City town = new City(); //create buddy... WITH ITEAMS RobotSE buddy = new RobotSE(town, 1, 1, Direction.EAST, 20); //create a counter for his row int row = 5; //while buddy has iteams do the following while (buddy.countThingsInBackpack() > 0) { //move buddy along his 4 by 5 grid planting his seeds buddy.putThing(); buddy.move(); row -= 1; //once buddy has completed a row, move onto the next one if (buddy.isFacingWest() && row == 0) { buddy.turnLeft(); buddy.move(); buddy.turnLeft(); buddy.move(); row = 5; } if (buddy.isFacingEast() && row == 0) { buddy.turnRight(); buddy.move(); buddy.turnRight(); buddy.move(); row = 5; } } } }
[ "riepj9547@HRH-IC0027345.wrdsb.ca" ]
riepj9547@HRH-IC0027345.wrdsb.ca
50193d416da980911d317054f1896880569cbd71
0b75d1a7c8e0109d9e61d967cea69c5a6eeb5231
/Competition/BattleOfVars/HashASec.java
bade57800e8c6aca1fdf07c18f8ef6bc342b2024
[]
no_license
kajalgupta/Data-Structures
9775585957907c631ad60fbfe09680c53a883d62
03745815502daffffc3855e49af07cb49956b276
refs/heads/master
2023-01-24T00:15:33.876178
2020-11-26T10:13:43
2020-11-26T10:13:43
316,193,230
0
0
null
null
null
null
UTF-8
Java
false
false
1,037
java
package Competition.BattleOfVars; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class HashASec { public static void main(String[] args) throws IOException, NoSuchAlgorithmException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str = br.readLine(); System.out.println(toHexString(getSHA(str))); } private static byte[] getSHA(String str) throws NoSuchAlgorithmException { MessageDigest md = MessageDigest.getInstance("SHA-256"); return md.digest(str.getBytes(StandardCharsets.UTF_8)); } private static String toHexString(byte[] hash) { BigInteger num = new BigInteger(1, hash); StringBuilder hexString = new StringBuilder(num.toString(16)); while (hexString.length() < 32) { hexString.insert(0, '0'); } return hexString.toString(); } }
[ "kajal1406gupta@gmail.com" ]
kajal1406gupta@gmail.com
ed24e1f01213dabcf608eb8e582aebf065918b00
4691acca4e62da71a857385cffce2b6b4aef3bb3
/testing-modules/junit-5/src/test/java/com/baeldung/FailAssertionUnitTest.java
8dfa99ab3ccf92fd41dc2a000ffc4ec003c02be5
[ "MIT" ]
permissive
lor6/tutorials
800f2e48d7968c047407bbd8a61b47be7ec352f2
e993db2c23d559d503b8bf8bc27aab0847224593
refs/heads/master
2023-05-29T06:17:47.980938
2023-05-19T08:37:45
2023-05-19T08:37:45
145,218,314
7
11
MIT
2018-08-18T12:29:20
2018-08-18T12:29:19
null
UTF-8
Java
false
false
1,099
java
package com.baeldung; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.function.Supplier; import java.util.stream.Stream; import static org.junit.jupiter.api.Assertions.fail; public class FailAssertionUnitTest { @Test void failThrowable() { try { safeMethod(); // more testing code } catch (Exception e) { fail(e); } } @Test void failMessageThrowable() { try { safeMethod(); // more testing code } catch (Exception e) { fail("Unexpected exception was thrown", e); } } @Test @Disabled void failMessageSupplier() { Supplier<String> timedMessage = () -> DateTimeFormatter.ofPattern("yyyy-MM-dd").format(LocalDate.now()); fail(timedMessage); } @Test void genericType() { Stream.of().map(entry -> fail("should not be called")); } private void safeMethod() { return; } }
[ "noreply@github.com" ]
lor6.noreply@github.com
5ef5c68ab62c9ded2340c8f02783cb99db427adf
1abdf3f3eee21e5ac059b3e5face867092bb4479
/mudfish-job/mudfish-test/src/main/test/com/mudfish/test/NIOServer.java
6cd315a8873c3a824d0cbf03b74d9f9444f244a1
[]
no_license
LaneSonnet/hodgepodge
b435f06403d73c9e922652eb0fb4a0ddf1fb1c8a
c0f638713f6b76116c05b71753c9ea368eb28248
refs/heads/master
2020-07-09T13:00:02.036813
2019-06-01T12:38:15
2019-06-01T12:38:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,887
java
package com.mudfish.test; import java.io.IOException; import java.net.InetSocketAddress; import java.nio.ByteBuffer; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; import java.nio.channels.ServerSocketChannel; import java.nio.channels.SocketChannel; import java.util.Iterator; /** * NIO服务端 */ public class NIOServer { // 通道管理器 private Selector selector; /** * 获得一个ServerSocket通道,并对该通道做一些初始化的工作 * * @param port * 绑定的端口号 * @throws IOException */ public void initServer(int port) throws IOException { // 获得一个ServerSocket通道 ServerSocketChannel serverChannel = ServerSocketChannel.open(); // 设置通道为非阻塞 serverChannel.configureBlocking(false); // 将该通道对应的ServerSocket绑定到port端口 serverChannel.socket().bind(new InetSocketAddress(port)); // 获得一个通道管理器 this.selector = Selector.open(); // 将通道管理器和该通道绑定,并为该通道注册SelectionKey.OP_ACCEPT事件,注册该事件后, // 当该事件到达时,selector.select()会返回,如果该事件没到达selector.select()会一直阻塞。 serverChannel.register(selector, SelectionKey.OP_ACCEPT); } /** * 采用轮询的方式监听selector上是否有需要处理的事件,如果有,则进行处理 * * @throws IOException */ public void listen() throws IOException { System.out.println("服务端启动成功!"); // 轮询访问selector while (true) { // 当注册的事件到达时,方法返回;否则,该方法会一直阻塞 selector.select(); // 获得selector中选中的项的迭代器,选中的项为注册的事件 Iterator<?> ite = this.selector.selectedKeys().iterator(); while (ite.hasNext()) { SelectionKey key = (SelectionKey) ite.next(); // 删除已选的key,以防重复处理 ite.remove(); handler(key); } } } /** * 处理请求 * * @param key * @throws IOException */ public void handler(SelectionKey key) throws IOException { // 客户端请求连接事件 if (key.isAcceptable()) { handlerAccept(key); // 获得了可读的事件 } else if (key.isReadable()) { handelerRead(key); } } /** * 处理连接请求 * * @param key * @throws IOException */ public void handlerAccept(SelectionKey key) throws IOException { ServerSocketChannel server = (ServerSocketChannel) key.channel(); // 获得和客户端连接的通道 SocketChannel channel = server.accept(); // 设置成非阻塞 channel.configureBlocking(false); // 在这里可以给客户端发送信息哦 System.out.println("新的客户端连接"); // 在和客户端连接成功之后,为了可以接收到客户端的信息,需要给通道设置读的权限。 channel.register(this.selector, SelectionKey.OP_READ); } /** * 处理读的事件 * * @param key * @throws IOException */ public void handelerRead(SelectionKey key) throws IOException { // 服务器可读取消息:得到事件发生的Socket通道 SocketChannel channel = (SocketChannel) key.channel(); // 创建读取的缓冲区 ByteBuffer buffer = ByteBuffer.allocate(1024); int read = channel.read(buffer); if(read > 0){ byte[] data = buffer.array(); String msg = new String(data).trim(); System.out.println("服务端收到信息:" + msg); //回写数据 ByteBuffer outBuffer = ByteBuffer.wrap("好的".getBytes()); channel.write(outBuffer);// 将消息回送给客户端 }else{ System.out.println("客户端关闭"); key.cancel(); } } /** * 启动服务端测试 * * @throws IOException */ public static void main(String[] args) throws IOException { NIOServer server = new NIOServer(); server.initServer(8000); server.listen(); } }
[ "1548346934@qq.com" ]
1548346934@qq.com
b2d21cf6d18617054ab3e9cd25eae25c6a39c28f
a65d371aa2ce42ac2cbc29b86c5feef99a617775
/O Point do Acai Android/app/src/main/java/com/devup/opointdoacai/opointdoacai/JuicesList.java
0290ff49b6f04793cccbb7a42541c69505ea0f6f
[]
no_license
luisclsantos/O-Point-do-Acai-Android
b72992f65d92f63f5dd8269d88d6794babe8cd51
619509530d2fdc4c9b15160050ebb15fc5b07a6c
refs/heads/master
2022-11-05T16:25:50.995261
2020-06-16T20:52:32
2020-06-16T20:52:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,015
java
package com.devup.opointdoacai.opointdoacai; import android.animation.Animator; import android.animation.ObjectAnimator; import android.content.pm.ActivityInfo; import android.graphics.Color; import android.os.Build; import android.os.Bundle; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.view.animation.DecelerateInterpolator; import android.widget.ProgressBar; import android.widget.TextView; import com.devup.opointdoacai.opointdoacai.Adapter.PagerViewAdapter; public class JuicesList extends AppCompatActivity { private android.support.v7.widget.Toolbar toolbar; private TextView mMilkLabel; private TextView mWaterLabel; private TextView mDoubleLabel; private ViewPager mViewPager; private PagerViewAdapter mPagerViewAdapter; private ProgressBar mProgressBar; @Override protected void onRestart() { super.onRestart(); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_juices_list); mProgressBar = findViewById(R.id.progress_bar_juices); mProgressBar.setVisibility(View.VISIBLE); ObjectAnimator animation = ObjectAnimator.ofInt(mProgressBar, "progress", 0, 100); animation.setDuration(3000); animation.setInterpolator(new DecelerateInterpolator()); animation.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animator) { } @Override public void onAnimationEnd(Animator animator) { mProgressBar.setVisibility(View.INVISIBLE); } @Override public void onAnimationCancel(Animator animator) { } @Override public void onAnimationRepeat(Animator animator) { } }); animation.start(); //Setando Orientação de Retrato setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); mMilkLabel = findViewById(R.id.milk_pager_id); mWaterLabel = findViewById(R.id.water_pager_id); mDoubleLabel = findViewById(R.id.double_pager_id); mViewPager = findViewById(R.id.view_pager_id); mViewPager.setOffscreenPageLimit(2); mPagerViewAdapter = new PagerViewAdapter(getSupportFragmentManager()); mViewPager.setAdapter(mPagerViewAdapter); mMilkLabel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mViewPager.setCurrentItem(0); } }); mWaterLabel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mViewPager.setCurrentItem(1); } }); mDoubleLabel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mViewPager.setCurrentItem(2); } }); mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float v, int i1) { } @Override public void onPageSelected(int position) { changeTabs(position); } @Override public void onPageScrollStateChanged(int i) { } }); //Toolbar - Instanciando toolbar = findViewById(R.id.toolbar_id_juices); toolbar.setTitle("Sucos"); toolbar.setTitleTextColor(Color.parseColor("#FFFFFF")); setSupportActionBar(toolbar); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); } private void changeTabs(int position) { if (position == 0){ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { mMilkLabel.setTextColor(getColor(R.color.colorPrimary)); } mMilkLabel.setTextSize(18); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { mWaterLabel.setTextColor(getColor(R.color.colorPrimaryDark)); } mWaterLabel.setTextSize(14); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { mDoubleLabel.setTextColor(getColor(R.color.colorPrimaryDark)); } mDoubleLabel.setTextSize(14); } if (position == 1){ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { mMilkLabel.setTextColor(getColor(R.color.colorPrimaryDark)); } mMilkLabel.setTextSize(14); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { mWaterLabel.setTextColor(getColor(R.color.colorPrimary)); } mWaterLabel.setTextSize(18); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { mDoubleLabel.setTextColor(getColor(R.color.colorPrimaryDark)); } mDoubleLabel.setTextSize(14); } if (position == 2){ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { mMilkLabel.setTextColor(getColor(R.color.colorPrimaryDark)); } mMilkLabel.setTextSize(14); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { mWaterLabel.setTextColor(getColor(R.color.colorPrimaryDark)); } mWaterLabel.setTextSize(14); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { mDoubleLabel.setTextColor(getColor(R.color.colorPrimary)); } mDoubleLabel.setTextSize(18); } } @Override public void onBackPressed() { finish(); } }
[ "luiscarlos_lima@outlook.com.br" ]
luiscarlos_lima@outlook.com.br
8ac98c80991f63624961b9dddeebf39bacfb0348
f369f0801285872602bcb508efc5a6db0a5d7e9d
/core/src/test/java/co/cask/wrangler/utils/Json2SchemaTest.java
70dfdbf24d8cd50360b50f18e53c4c363deb7105
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
vhajdari/wrangler
3e72da65cb56d8575088439cdf2eaf6fa9a5c1af
0da385da22d7f9b14a58803ccd54303c4470b72d
refs/heads/develop
2021-01-21T23:23:34.011888
2017-06-23T15:38:58
2017-06-23T15:38:58
95,237,441
0
1
null
2017-06-23T16:30:39
2017-06-23T16:30:38
null
UTF-8
Java
false
false
3,084
java
/* * Copyright © 2017 Cask Data, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package co.cask.wrangler.utils; import co.cask.cdap.api.data.format.StructuredRecord; import co.cask.cdap.api.data.schema.Schema; import co.cask.cdap.format.StructuredRecordStringConverter; import co.cask.wrangler.api.Record; import co.cask.wrangler.executor.PipelineExecutor; import co.cask.wrangler.parser.TextDirectives; import com.google.common.collect.Lists; import com.google.gson.JsonElement; import com.google.gson.JsonParser; import org.junit.Assert; import org.junit.Test; import java.util.List; /** * Tests {@link Json2Schema} */ public class Json2SchemaTest { private static final String[] TESTS = new String[] { JsonTestData.BASIC, JsonTestData.SIMPLE_JSON_OBJECT, JsonTestData.ARRAY_OF_OBJECTS, JsonTestData.JSON_ARRAY_WITH_OBJECT, JsonTestData.COMPLEX_1, JsonTestData.ARRAY_OF_NUMBERS, JsonTestData.ARRAY_OF_STRING, JsonTestData.COMPLEX_2, JsonTestData.EMPTY_OBJECT, JsonTestData.FB_JSON }; private static final String[] directives = new String[] { "set-column body json:parse(body, false)" }; @Test public void conversionTest() throws Exception { Json2Schema converter = new Json2Schema(); RecordConvertor recordConvertor = new RecordConvertor(); PipelineExecutor executor = new PipelineExecutor(); JsonParser parser = new JsonParser(); executor.configure(new TextDirectives(directives), null); for (String test : TESTS) { Record record = new Record("body", test); List<Record> records = executor.execute(Lists.newArrayList(record)); Schema schema = converter.toSchema("myrecord", records.get(0)); if (schema.getType() != Schema.Type.RECORD) { schema = Schema.recordOf("array", Schema.Field.of("array", schema)); } Assert.assertNotNull(schema); List<StructuredRecord> structuredRecords = recordConvertor.toStructureRecord(records, schema); String decode = StructuredRecordStringConverter.toJsonString(structuredRecords.get(0)); JsonElement originalObject = parser.parse(test); JsonElement roundTripObject = parser.parse(decode).getAsJsonObject().get("body"); Assert.assertEquals(originalObject, roundTripObject); Assert.assertTrue(structuredRecords.size() > 0); } } @Test public void testJsonPathGeneration() throws Exception { JsonPathGenerator paths = new JsonPathGenerator(); List<String> path = paths.get(JsonTestData.COMPLEX_1); Assert.assertEquals(path.size(), 23); } }
[ "noreply@github.com" ]
vhajdari.noreply@github.com
50026fc21f8ac94ae0929b67cdb48420433d5073
f0ec508f4b480d8d5399a2880e4cbb0533fc2fc1
/com.gzedu.xlims.service/src/main/java/com/gzedu/xlims/service/graduation/GjtGraduationApplyDegreeService.java
cfcf58c84e0ef2217e8fc9d9fe357b9c7b75c464
[]
no_license
lizm335/MyLizm
a327bd4d08a33c79e9b6ef97144d63dae7114a52
1bcca82395b54d431fb26817e61a294f9d7dd867
refs/heads/master
2020-03-11T17:25:25.687426
2018-04-19T03:10:28
2018-04-19T03:10:28
130,146,458
3
0
null
null
null
null
UTF-8
Java
false
false
2,486
java
package com.gzedu.xlims.service.graduation; import java.util.List; import java.util.Map; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import com.gzedu.xlims.pojo.graduation.GjtGraApplyFlowRecord; import com.gzedu.xlims.pojo.graduation.GjtGraduationApplyDegree; import com.gzedu.xlims.service.base.BaseService; /** * * 功能说明:学位申请 * * @author ouguohao@eenet.com * @Date 2017年9月18日 * @version 3.0 * */ public interface GjtGraduationApplyDegreeService extends BaseService<GjtGraduationApplyDegree> { /** * @author ouguohao@eenet.com * @Date 2017年9月19日 下午7:42:26 * @param searchParams * @param pageRequest * @return */ Page<GjtGraduationApplyDegree> queryGraduationApplyCardByPage(Map<String, Object> searchParams, PageRequest pageRequest); /** * @author ouguohao@eenet.com * @Date 2017年9月19日 下午7:45:27 * @param searchParams * @param pageRequest * @return */ long countGraduationApplyCardByPage(Map<String, Object> searchParams); /** * 查询审核记录 * * @author ouguohao@eenet.com * @Date 2017年9月22日 上午10:04:55 * @param recordId * @return */ GjtGraApplyFlowRecord queryFlowRecordById(String recordId); /** * @author ouguohao@eenet.com * @Date 2017年9月22日 上午10:16:09 * @param record * @return */ GjtGraApplyFlowRecord saveFlowRecord(GjtGraApplyFlowRecord record); /** * 查询学生成绩 * * @author ouguohao@eenet.com * @Date 2017年9月22日 下午5:32:03 * @param studentId * @return */ List<Map<String, Object>> queryAchievementByStudentId(String studentId); /** * @author ouguohao@eenet.com * @Date 2017年9月25日 上午12:57:42 * @param applyId * @param roleId * @return */ GjtGraApplyFlowRecord queryFlowRecordByApplyId(String applyId, int roleId); /** * @author ouguohao@eenet.com * @Date 2017年9月25日 上午1:06:46 * @param studentId * @return */ GjtGraduationApplyDegree queryDegreeApplyByStudentId(String studentId); /** * @author ouguohao@eenet.com * @Date 2017年9月26日 上午1:47:29 * @param searchParams * @param realPath * @return * @throws Exception */ String downloadReqFile(Map<String, Object> searchParams, String realPath) throws Exception; /** * 学员学位情况 * @param searchParams * @return */ Map<String,Object> countStudentApplyDegreeSituation(Map<String, Object> searchParams); }
[ "lizengming@eenet.com" ]
lizengming@eenet.com
aa7c275ba1d69fc98f420d8264c612e597328caa
546f42937307487bb65292597c19d8a3e1bd4e0e
/src/com/ask/java/strings/RemoveDuplicates.java
29426545b108b53fbdfc7bdfe9432c5af6896c28
[]
no_license
ashokgangola/Java
e3f9f797eccf36c2ba1a9b264b010bb987312de0
739f24434b874e2d560ebe04eb1de85ff754aa66
refs/heads/master
2020-08-16T04:57:22.327698
2019-10-16T04:37:17
2019-10-16T04:37:17
215,457,660
0
0
null
null
null
null
UTF-8
Java
false
false
595
java
package com.ask.java.strings; public class RemoveDuplicates { public static void main(String[] args) { String data = "HelloWorld_helloworld"; char[] array = data.toUpperCase().toCharArray(); String _array = removeRedundant(array); System.out.println("String after duplicate removed = "+_array); } private static String removeRedundant(char[] array) { String _array = ""; for(int i=0;i<array.length;i++) { System.out.println(array[i]+"::"+_array.lastIndexOf(array[i])); if(_array.lastIndexOf(array[i]) == -1) { _array += array[i]; } } return _array; } }
[ "ashokk@aabmatica.com" ]
ashokk@aabmatica.com
0f5c885dabf6a7d07d12b02fd89ec7f6a9fad72d
951641e1f731bbb52bf4ee4a6531412b43fabc8b
/IExtraStuffAPI.java
0b996a64ab4a4fc1c314da67a37d7a0297d8a2ff
[ "MIT" ]
permissive
DrummerMC/Extra-Stuff-API
eaecb3c0de7298111b889c2aba3e19a1692562c4
41b2e878ba3839f1350456e9dfdd7f5dccd87495
refs/heads/master
2020-05-19T13:27:03.585396
2014-07-09T22:04:01
2014-07-09T22:04:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
130
java
package DrummerMC.Extra_Stuff.Api; import DrummerMC.Extra_Stuff.Api.Grid.IEnergyStorageGrid; public interface IExtraStuffAPI { }
[ "drummermods@icloud.com" ]
drummermods@icloud.com
f9d48f8c380d9c22f3bb45e622db9f8628fc1c58
1935abc4b91ec248de55b8c0d53937019618e0f9
/study/src/main/java/com/example/controller/IndexController.java
e1613bfa2b20a3b64a1e26d90355772dbe8957a0
[]
no_license
MasahiroTamaki/study
e0f98afb6bfc0606e7e56db409661d0c9a70f306
3c031f75a5c5bcca74cbb3306b7b26e76daf0e96
refs/heads/master
2020-04-17T07:23:50.571653
2019-02-25T13:14:06
2019-02-25T13:14:06
166,367,320
0
0
null
null
null
null
UTF-8
Java
false
false
603
java
package com.example.controller; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import com.example.domain.Date; import com.example.mapper.DateMapper; @Controller public class IndexController { @Autowired DateMapper datemapper; @RequestMapping("/study") public String index (Model model) { List<Date> list = datemapper.selectAll(); model.addAttribute("datemaster",list); return "date/index"; } }
[ "akutarou53@gmail.com" ]
akutarou53@gmail.com
ba9ade8fcf9299d07c9efe88b714cb8024efadcd
bf289c8b396627e15764bb2da250baa334b80b16
/src/main/java/com/ondot/automation/TestDemo/testscript/createsession/Test_Create_Session_WrongAppToken.java
db37847d98dfc8defbd85dcfadd1997e116c3184
[]
no_license
bhushankaka/RepoDemo
8a853234c01d7c70162d189086bb88f65ee93226
b846d103ad9b93b56bd167e6c55169031d4923ba
refs/heads/master
2021-07-06T16:00:41.471744
2017-09-28T15:13:48
2017-09-28T15:13:48
105,162,947
0
0
null
null
null
null
UTF-8
Java
false
false
3,378
java
package com.ondot.automation.TestDemo.testscript.createsession; import java.io.File; import java.util.HashMap; import java.util.Map; import org.codehaus.jettison.json.JSONObject; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import com.atmecs.falcon.automation.dataprovider.TestDataProvider; import com.atmecs.falcon.automation.rest.endpoint.RequestBuilder; import com.atmecs.falcon.automation.rest.endpoint.ResponseService; import com.atmecs.falcon.automation.util.reporter.ReportLogService; import com.atmecs.falcon.automation.util.reporter.ReportLogServiceImpl; import com.atmecs.falcon.automation.verifyresult.VerificationManager; import com.ondot.automation.TestDemo.testfunction.OnDotConstants; import com.ondot.automation.TestDemo.testfunction.OnDotUtilities; import com.ondot.automation.TestDemo.testsuite.SampleTestSuiteBase; public class Test_Create_Session_WrongAppToken extends SampleTestSuiteBase{ JSONObject createSessionTestData; JSONObject requestBody; JSONObject expectedresponseBody; TestDataProvider dataprovider=TestDataProvider.getInstance(); RequestBuilder requestBuilder = new RequestBuilder(); ReportLogService report = new ReportLogServiceImpl(Test_Create_Session.class); Map<String, String> requestHeaders = new HashMap<String, String>(); OnDotUtilities utils=new OnDotUtilities(); @BeforeTest public void dataSetup() throws Exception { TestDataProvider.folderPath =OnDotConstants.TESTDATA_FOLDER_CRAEATE_SESSION; } @Test(dataProvider = "DataProvider", dataProviderClass = TestDataProvider.class) public void createsessionTest(File testDataFile) throws Exception { createSessionTestData=dataprovider.getJSONObject(testDataFile); requestBody=createSessionTestData.getJSONObject("requestBody"); expectedresponseBody=createSessionTestData.getJSONObject("responseBody"); report.info("Step #1: Do Post Call for Create_Session and Store Response"); ResponseService responseService = requestBuilder.contentType("application/json").queryParam("apiVersion", "v2.0") .queryParam("opId", "CREATE_SESSION").body(requestBody.toString()).build() .post(CONFIG.getProperty("baseURI")+CONFIG.getProperty("registerEndPoint")); //report.info("Step #2: Prepare Request Body for create_session API"); /*requestBuilder.headers(requestHeaders).queryParam("apiVersion", "v2.0").queryParam("opId", "CREATE_SESSION") .body(expectedresponseBody.toString()).build();*/ JSONObject actualResponseJSONObject = new JSONObject(responseService.getResponseBody()); report.info("Step #2: Get Actual Data " ); String actualresponseCode=utils.getValueFromJsonData(actualResponseJSONObject, "responseStatus", "responseCode"); String actualmessageCode=utils.getValueFromJsonData(actualResponseJSONObject, "responseStatus", "messageCode"); report.info("Step #3:Get expected data"); String expectedResposeCode=utils.getValueFromJsonData(expectedresponseBody, "responseStatus", "responseCode"); String expectedmessageCode=utils.getValueFromJsonData(expectedresponseBody, "responseStatus", "messageCode"); report.info("Step #4: Verify Actual vs Expected"); VerificationManager.verifyString(actualresponseCode, expectedResposeCode, "Verifing the response code"); VerificationManager.verifyString(actualmessageCode, expectedmessageCode, "verifying messagecode"); } }
[ "kakadbhushan@gmail.com" ]
kakadbhushan@gmail.com
4d1d52fc088c14b36a03c8458f159464c5ae6569
a815668a759d588238932d369d6b812460ecd96a
/app/src/main/java/com/sweetlab/sweetspot/loader/CollectionItem.java
d40a97f89c2157cc93a903a9cde29d1e3c86659e
[]
no_license
InsideGH/SweetSpot
40815aae399a84bfc2bf61da844c2888ec1a507e
22d2ad19eba5561c23eefb41d334df2f06b77b7e
refs/heads/master
2021-01-10T17:50:37.944197
2015-05-23T21:29:59
2015-05-23T21:29:59
36,141,663
0
0
null
null
null
null
UTF-8
Java
false
false
1,228
java
package com.sweetlab.sweetspot.loader; /** * This class holds the type and the object associated with the type. */ public class CollectionItem { /** * Held object is a photo (PhotoMeta) type. */ public static final int TYPE_PHOTO = 0; /** * Held object is a date (DateMeta) type. */ public static final int TYPE_DATE = 1; /** * The type. */ private final int mType; /** * The held object. */ private Object mObject; /** * Constructor. * * @param type Type if object to hold. */ public CollectionItem(int type) { mType = type; } /** * Set the object. * * @param object Object to insert. */ public void setObject(Object object) { mObject = object; } /** * Get the type of the object. * * @return The type. */ public int getType() { return mType; } /** * Get the object stored within this item. * * @param classType The class type. * @param <T> Class generic. * @return The casted object. */ public <T> T getObject(Class<T> classType) { return classType.cast(mObject); } }
[ "peterlarssonsmail@gmail.com" ]
peterlarssonsmail@gmail.com
05878803f87ec3e28dce8dc206f47929301b83dd
ed522f6b8ceacb4059ff06191d696ae73cb273bc
/src/main/java/cloudwall/graph/io/edge/TrivialGraphModel.java
fd30bd418837e36a21908c8c4e3bf5b6d47d77a3
[ "Apache-2.0" ]
permissive
seanahmad/cloudwall-graph
b246e9836b52a5fb4ca8bcd2def983b2a09b9704
a0d7595dfc6423d04de78b42199bcbcc49355efb
refs/heads/master
2021-09-21T01:48:55.816939
2018-08-18T21:13:26
2018-08-18T21:13:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,139
java
/* * (C) Copyright 2017 Kyle F. Downey. * * 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 cloudwall.graph.io.edge; import cloudwall.graph.GraphModel; import cloudwall.graph.GraphVisitor; import org.jooq.lambda.tuple.Tuple2; import javax.activation.DataSource; import java.io.IOException; import java.io.Writer; import java.util.ArrayList; import java.util.List; /** * Simple data model for storing node and edge information in Trivial Graph Format (TGF). * * @author <a href="mailto:kyle.downey@gmail.com">Kyle F. Downey</a> * @see TrivialGraphFormat */ @SuppressWarnings("WeakerAccess") public class TrivialGraphModel implements GraphModel { private final List<Tuple2<Long, String>> nodes = new ArrayList<>(); private final EdgeListModel edgeListModel; public TrivialGraphModel() { edgeListModel = new EdgeListModel() { @Override protected void writeEdges(Writer w) throws IOException { for (Tuple2<Long,String> node : nodes) { w.write(String.valueOf(node.v1())); if (node.v2() != null){ w.write(" "); w.write(node.v2()); } w.write("\n"); } w.write("#\n"); super.writeEdges(w); } }; } @Override public void visit(GraphVisitor visitor) { edgeListModel.visit(visitor); } @Override public long getVertexCount() { return edgeListModel.getVertexCount(); } @Override public long getEdgeCount() { return edgeListModel.getEdgeCount(); } void parseAndAddEdge(String line, int lineNumber) throws IOException { edgeListModel.parseAndAddEdge(line, lineNumber); } void parseAndAddVertex(String line, int lineNumber) throws IOException { int ndxFirstSpace = line.indexOf(" "); String vidTxt; String label = null; if (ndxFirstSpace == -1) { vidTxt = line; } else { vidTxt = line.substring(0, ndxFirstSpace); label = line.substring(ndxFirstSpace + 1); } try { addNode(Long.parseLong(vidTxt), label); } catch (NumberFormatException e) { throw new IOException("invalid node ID in node list at line # " + lineNumber + ": " + line); } } void addNode(long vid, String label) { nodes.add(new Tuple2<>(vid, label)); } void write(DataSource dataOut) throws IOException { edgeListModel.write(dataOut); } }
[ "protean.p0@gmail.com" ]
protean.p0@gmail.com
873a6cd24c1a2a8a42804a379c4921c47ba49448
790852e8c1a47c1286ab859bb4b130003a468f9a
/src/empmgmt/gui/SearchEmployeeFrame.java
86f22655283e39d839ddf0d7813fa4c644005b79
[]
no_license
geek-aryan/employee-management-mini
9a71e5dab775301fc8ce32c9c4e43152d3275f42
ebf8113d9bda1d30e049f28d43c32c12b92a5034
refs/heads/main
2023-06-25T22:16:01.102603
2021-07-18T11:41:51
2021-07-18T11:41:51
387,081,023
0
0
null
null
null
null
UTF-8
Java
false
false
11,754
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 empmgmt.gui; import empmgmt.dao.EmpDAO; import empmgmt.pojo.Employee; import java.sql.SQLException; import javax.swing.JOptionPane; /** * * @author aryan */ public class SearchEmployeeFrame extends javax.swing.JFrame { /** * Creates new form SearchEmployeeFrame */ public SearchEmployeeFrame() { initComponents(); setLocationRelativeTo(null); } /** * 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(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); txtEmpNo = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); txtEmpName = new javax.swing.JTextField(); jLabel4 = new javax.swing.JLabel(); txtSal = new javax.swing.JTextField(); btnSearch = new javax.swing.JButton(); btnBack = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); JPanel1.setBackground(new java.awt.Color(0, 0, 0)); jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N jLabel1.setForeground(new java.awt.Color(255, 255, 255)); jLabel1.setText("Search Employee Details"); jLabel2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel2.setForeground(new java.awt.Color(255, 255, 255)); jLabel2.setText("EmpNo"); txtEmpNo.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel3.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel3.setForeground(new java.awt.Color(255, 255, 255)); jLabel3.setText("EmpName"); txtEmpName.setEditable(false); txtEmpName.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel4.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel4.setForeground(new java.awt.Color(255, 255, 255)); jLabel4.setText("Salary"); txtSal.setEditable(false); txtSal.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N btnSearch.setBackground(new java.awt.Color(0, 0, 0)); btnSearch.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N btnSearch.setForeground(new java.awt.Color(255, 255, 255)); btnSearch.setText("Search"); btnSearch.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnSearchActionPerformed(evt); } }); btnBack.setBackground(new java.awt.Color(0, 0, 0)); btnBack.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N btnBack.setForeground(new java.awt.Color(255, 255, 255)); btnBack.setText("Back"); btnBack.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnBackActionPerformed(evt); } }); javax.swing.GroupLayout JPanel1Layout = new javax.swing.GroupLayout(JPanel1); JPanel1.setLayout(JPanel1Layout); JPanel1Layout.setHorizontalGroup( JPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(JPanel1Layout.createSequentialGroup() .addGap(128, 128, 128) .addGroup(JPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(btnSearch, javax.swing.GroupLayout.DEFAULT_SIZE, 89, Short.MAX_VALUE) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(44, 44, 44) .addGroup(JPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txtEmpName, javax.swing.GroupLayout.PREFERRED_SIZE, 164, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtEmpNo, javax.swing.GroupLayout.PREFERRED_SIZE, 164, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtSal, javax.swing.GroupLayout.PREFERRED_SIZE, 164, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(JPanel1Layout.createSequentialGroup() .addGap(12, 12, 12) .addComponent(btnBack, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(45, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, JPanel1Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel1) .addGap(107, 107, 107)) ); JPanel1Layout.setVerticalGroup( JPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(JPanel1Layout.createSequentialGroup() .addGap(21, 21, 21) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(33, 33, 33) .addGroup(JPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtEmpNo, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(28, 28, 28) .addGroup(JPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(txtEmpName, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(31, 31, 31) .addGroup(JPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4) .addComponent(txtSal, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(45, 45, 45) .addGroup(JPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btnSearch) .addComponent(btnBack)) .addContainerGap(57, Short.MAX_VALUE)) ); 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.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) ); pack(); }// </editor-fold>//GEN-END:initComponents private void btnBackActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBackActionPerformed this.dispose(); OptionsFrame optsFrame=new OptionsFrame(); optsFrame.setVisible(true); }//GEN-LAST:event_btnBackActionPerformed private void btnSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSearchActionPerformed txtEmpName.setText(""); txtSal.setText(""); String empno=txtEmpNo.getText().trim(); if(empno.isEmpty()){ JOptionPane.showMessageDialog(null, "Please Filled employee no!","Error",JOptionPane.INFORMATION_MESSAGE); return; } try{ int eno = Integer.parseInt(empno); Employee e=EmpDAO.findEmployeeById(eno); if(e==null){ JOptionPane.showMessageDialog(null, "No record of empid "+eno+"prasent","Not Found",JOptionPane.INFORMATION_MESSAGE); return; } txtEmpName.setText(e.getEmpName()); txtSal.setText(String.valueOf(e.getEmpSal())); } catch(NumberFormatException ex){ JOptionPane.showMessageDialog(null, "Please Filled numaric data!","Error",JOptionPane.ERROR_MESSAGE); ex.printStackTrace(); } catch(SQLException ex){ JOptionPane.showMessageDialog(null, "DB error","Error",JOptionPane.ERROR_MESSAGE); ex.printStackTrace(); } }//GEN-LAST:event_btnSearchActionPerformed /** * @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(SearchEmployeeFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(SearchEmployeeFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(SearchEmployeeFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(SearchEmployeeFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new SearchEmployeeFrame().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JPanel JPanel1; private javax.swing.JButton btnBack; private javax.swing.JButton btnSearch; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JTextField txtEmpName; private javax.swing.JTextField txtEmpNo; private javax.swing.JTextField txtSal; // End of variables declaration//GEN-END:variables }
[ "noreply@github.com" ]
geek-aryan.noreply@github.com
c14e33f9062607926e6f92c18e2f9730bea4f1e9
7dd73504d783c7ebb0c2e51fa98dea2b25c37a11
/eaglercraft-main/eaglercraft-main/sp-server/src/main/java/net/minecraft/src/TileEntityMobSpawnerLogic.java
7a32d1ffc7fc99649600436771b798640a4ee04d
[ "CC-BY-NC-4.0" ]
permissive
bagel-man/bagel-man.github.io
32813dd7ef0b95045f53718a74ae1319dae8c31e
eaccb6c00aa89c449c56a842052b4e24f15a8869
refs/heads/master
2023-04-05T10:27:26.743162
2023-03-16T04:24:32
2023-03-16T04:24:32
220,102,442
3
21
MIT
2022-12-14T18:44:43
2019-11-06T22:29:24
C++
UTF-8
Java
false
false
1,147
java
package net.minecraft.src; class TileEntityMobSpawnerLogic extends MobSpawnerBaseLogic { /** The mob spawner we deal with */ final TileEntityMobSpawner mobSpawnerEntity; TileEntityMobSpawnerLogic(TileEntityMobSpawner par1TileEntityMobSpawner) { this.mobSpawnerEntity = par1TileEntityMobSpawner; } public void func_98267_a(int par1) { this.mobSpawnerEntity.worldObj.addBlockEvent(this.mobSpawnerEntity.xCoord, this.mobSpawnerEntity.yCoord, this.mobSpawnerEntity.zCoord, Block.mobSpawner.blockID, par1, 0); } public World getSpawnerWorld() { return this.mobSpawnerEntity.worldObj; } public int getSpawnerX() { return this.mobSpawnerEntity.xCoord; } public int getSpawnerY() { return this.mobSpawnerEntity.yCoord; } public int getSpawnerZ() { return this.mobSpawnerEntity.zCoord; } public void setRandomMinecart(WeightedRandomMinecart par1WeightedRandomMinecart) { super.setRandomMinecart(par1WeightedRandomMinecart); if (this.getSpawnerWorld() != null) { this.getSpawnerWorld().markBlockForUpdate(this.mobSpawnerEntity.xCoord, this.mobSpawnerEntity.yCoord, this.mobSpawnerEntity.zCoord); } } }
[ "tom@blowmage.com" ]
tom@blowmage.com