blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 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 684M ⌀ | 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 132 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 28 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c9ded0b46d14b79c5b789fec8bb0df5c77805689 | 93a75cc413a1a00580fa0848d92af0d0244dc595 | /src/engine/java/de/objectcode/canyon/bpe/engine/evaluator/JXPathCondition.java | db2084503e17fac0ae493f696204dcfbb0c9f84d | [] | no_license | OC-Git/canyon | 8d6af137433ec1538474fbfbc05982b721dd3f8a | a22e3177b2176678e969bd14e9a651455fef1a63 | refs/heads/master | 2016-09-06T05:44:37.039041 | 2013-10-11T07:08:17 | 2013-10-11T07:08:17 | 13,492,138 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,171 | java | package de.objectcode.canyon.bpe.engine.evaluator;
import java.io.Serializable;
import org.dom4j.Element;
import de.objectcode.canyon.bpe.engine.EngineException;
import de.objectcode.canyon.bpe.engine.activities.Activity;
/**
* @author junglas
*/
public class JXPathCondition implements Serializable,ICondition
{
static final long serialVersionUID = 6554127138593692750L;
private String m_expression;
public JXPathCondition ( String expression )
{
m_expression = expression;
}
/**
* @see de.objectcode.canyon.bpe.engine.evaluator.ICondition#eval(de.objectcode.canyon.bpe.engine.activities.Activity)
*/
public boolean eval (Activity activity) throws EngineException
{
// TODO Auto-generated method stub
return false;
}
/**
* @see de.objectcode.canyon.bpe.util.IDomSerializable#getElementName()
*/
public String getElementName ( )
{
return "jxpath-expression";
}
/**
* @see de.objectcode.canyon.bpe.util.IDomSerializable#toDom(org.dom4j.Element)
*/
public void toDom (Element element)
{
element.addAttribute("expression", m_expression);
}
}
| [
"joerg@joergviola.de"
] | joerg@joergviola.de |
e93a36f5b7c1abec5aea1447b44d9ec96f80d781 | d394a14cc9e0d984dfe42691726ab99b29c21a1b | /src/VISTAS/libros/GestionarEstado.java | 74b1c3c3dd691910ca4859a6ec0dcb61c4f7a8e5 | [] | no_license | Dahucar/biblioteca-fastdevelopment | 35f414b30d62b4b4693dcf9b4c47255a4eb84160 | b008ac440184ca5f62ac20557c1e01dcf18f86e5 | refs/heads/master | 2022-11-25T01:19:48.721324 | 2020-08-01T04:10:39 | 2020-08-01T04:10:39 | 284,183,383 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,402 | 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 VISTAS.libros;
/**
*
* @author Daniel Huenul
*/
public class GestionarEstado extends javax.swing.JFrame {
/**
* Creates new form GestionarEstado
*/
public GestionarEstado() {
initComponents();
}
/**
* 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() {
jLabel2 = new javax.swing.JLabel();
campo_cateogira = new javax.swing.JTextField();
jScrollPane1 = new javax.swing.JScrollPane();
Tabla_estados = new javax.swing.JTable();
jLabel1 = new javax.swing.JLabel();
btn_add = new javax.swing.JButton();
btn_remove = new javax.swing.JButton();
jSeparator1 = new javax.swing.JSeparator();
btn_update = new javax.swing.JButton();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
Submenu_volver = new javax.swing.JMenuItem();
jSeparator2 = new javax.swing.JPopupMenu.Separator();
Submenu_salir = new javax.swing.JMenuItem();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setResizable(false);
jLabel2.setText("Categoria");
Tabla_estados.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane1.setViewportView(Tabla_estados);
jLabel1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel1.setText("Estados registrados");
btn_add.setIcon(new javax.swing.ImageIcon(getClass().getResource("/iconos/guardar.png"))); // NOI18N
btn_remove.setIcon(new javax.swing.ImageIcon(getClass().getResource("/iconos/basura.png"))); // NOI18N
btn_update.setIcon(new javax.swing.ImageIcon(getClass().getResource("/iconos/lazo.png"))); // NOI18N
jMenu1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/iconos/ajustes.png"))); // NOI18N
jMenu1.setText("Opciones");
Submenu_volver.setIcon(new javax.swing.ImageIcon(getClass().getResource("/iconos/espalda.png"))); // NOI18N
Submenu_volver.setText("Volver");
jMenu1.add(Submenu_volver);
jMenu1.add(jSeparator2);
Submenu_salir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/iconos/salida.png"))); // NOI18N
Submenu_salir.setText("Salir");
jMenu1.add(Submenu_salir);
jMenuBar1.add(jMenu1);
setJMenuBar(jMenuBar1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jScrollPane1)
.addComponent(jSeparator1)
.addComponent(jLabel2))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(campo_cateogira, javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(btn_add)
.addGap(27, 27, 27)
.addComponent(btn_remove)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btn_update, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(217, 217, 217))))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(21, 21, 21)
.addComponent(jLabel1)
.addGap(26, 26, 26)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(campo_cateogira, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btn_remove)
.addComponent(btn_add))
.addGap(29, 29, 29)
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 44, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 277, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(btn_update)
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
/**
* @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(GestionarEstado.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(GestionarEstado.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(GestionarEstado.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(GestionarEstado.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 GestionarEstado().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
public javax.swing.JMenuItem Submenu_salir;
public javax.swing.JMenuItem Submenu_volver;
public javax.swing.JTable Tabla_estados;
public javax.swing.JButton btn_add;
public javax.swing.JButton btn_remove;
public javax.swing.JButton btn_update;
public javax.swing.JTextField campo_cateogira;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JPopupMenu.Separator jSeparator2;
// End of variables declaration//GEN-END:variables
}
| [
"danielhuenul90.gmail.com"
] | danielhuenul90.gmail.com |
b65ea645549975ad27677322ea3fbf9ada0bf00c | ce85ebe5eb7b4ea44a9aa94c1aabd393f8b85b71 | /src/main/java/com/xapp/controller/AppController.java | 1647b6aed672c2a3855bbfbc433ba4677ee0ebff | [] | no_license | shlice/pushservice | 05e4de7e2f44ff9a5444b7c1539844cbb454dd21 | 0ce3e22155acc990a8c6c1ec81796b860930b8fc | refs/heads/master | 2016-09-10T18:51:58.735865 | 2015-08-14T05:25:09 | 2015-08-14T05:25:09 | 40,037,793 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,661 | java | package com.xapp.controller;
import com.alibaba.fastjson.JSON;
import com.xapp.service.AppService;
import com.xapp.service.RequestHandler;
import com.xapp.service.Result;
import com.xapp.util.ContextUtility;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.List;
@Controller
@RequestMapping("")
public class AppController {
private static final Logger logger = LoggerFactory
.getLogger(AppController.class);
@ResponseBody
@RequestMapping(value = "/api", method = RequestMethod.POST)
public String api(HttpServletRequest request) {
int totalLength = request.getContentLength();
byte[] data = new byte[totalLength];
BufferedInputStream in;
try {
in = new BufferedInputStream(request.getInputStream());
byte[] inputByte = new byte[1024];
int length = 0;
int pos = 0;
while ((length = in.read(inputByte, 0, inputByte.length)) > 0) {
System.arraycopy(inputByte, 0, data, pos, length);
pos += length;
}
} catch (IOException e) {
logger.error(e.getLocalizedMessage());
}
String input = null;
try {
input = new String(data, "UTF-8");
} catch (UnsupportedEncodingException e) {
logger.error(e.getLocalizedMessage());
}
RequestHandler rh = new RequestHandler(request);
Result result = rh.handleApi(input);
return JSON.toJSONString(result);
}
@RequestMapping(value = "/testapi", method = RequestMethod.GET)
public ModelAndView testapi(HttpServletRequest request) {
ModelAndView mv = new ModelAndView();
mv.setViewName("testapi");
// mv.addObject("content", content);
return mv;
}
@RequestMapping(value = "/allusers", method = RequestMethod.GET)
public ModelAndView allusers(HttpServletRequest request) {
ModelAndView mv = new ModelAndView();
mv.setViewName("allusers");
AppService as = (AppService) ContextUtility.getBean("appService");
List result = as.queryUsers();
mv.addObject("users", result);
return mv;
}
}
| [
"licesh@gmail.com"
] | licesh@gmail.com |
ee6c6088e2abe17e29f70614e52e8d41d69d872b | bd78794b8112bd9e5c375caab17282d806f5306c | /src/sockets/Socket2.java | bff2dbea27b965267c4e396f8648ad7a228c1f90 | [] | no_license | Brad0914/IS---2018-Proyecto-2- | 8fab12de3df481857f58347744defc74df6be848 | 6fd6172b20bc15e191c968f2efc1c42bebe26c05 | refs/heads/master | 2020-03-18T16:05:25.665322 | 2018-05-26T09:19:29 | 2018-05-26T09:19:29 | 134,945,804 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 810 | java | package sockets;
import java.net.*;
import java.io.*;
public class Socket2 {
Socket client;
int port = 9000;
String ip = "localhost";
BufferedReader entry, keyboard;
PrintStream exit;
public void start() {
try {
client = new Socket(ip, port);
entry = new BufferedReader(new InputStreamReader(client.getInputStream()));
keyboard = new BufferedReader(new InputStreamReader(System.in));
String keys = keyboard.readLine();
exit = new PrintStream(client.getOutputStream());
exit.println(keys);
String message = entry.readLine();
System.out.println(message);
entry.close();
exit.close();
keyboard.close();
client.close();
} catch (Exception e) {
// TODO: handle exception
}
}
}
| [
"bradmvf09081999@gmail.com"
] | bradmvf09081999@gmail.com |
cfa6f51778dec7cd6594041684103c5d1c22945d | 61751a562e11d35fed2b762ba014e89b0bd817ed | /医院药品管理系统/total - 副本/src/main/java/com/java1234/entity/PurchaseListDrugs.java | 7253d803b012e7adb9407e34e99abd89aa4a957f | [] | no_license | LYTWork/Practical-Training | 4110d78e7132f8928a84c53ea5146eb842fffc3a | d47551865738c17c8092811b6a19c9483d9a6008 | refs/heads/master | 2022-10-24T11:31:37.648148 | 2019-09-26T04:36:26 | 2019-09-26T04:36:26 | 162,795,495 | 0 | 0 | null | 2022-10-12T20:32:10 | 2018-12-22T08:40:39 | JavaScript | UTF-8 | Java | false | false | 2,975 | java | package com.java1234.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
/*
* 进货单药品实体
* @author java1234 AT
*
*/
@Entity
@Table(name="t_purchase_list_drugs")
public class PurchaseListDrugs {
@Id
@GeneratedValue
private Integer id; // 编号
@ManyToOne
@JoinColumn(name="purchaseListId")
private PurchaseList purchaseList; // 进货单
@Column(length=50)
private String code; // 药品编码
@Column(length=50)
private String name; // 药品名称
@Column(length=50)
private String model; // 药品型号
@ManyToOne
@JoinColumn(name="typeId")
private DrugsType type; // 药品类别
@Transient
private Integer typeId; // 类别id
private Integer drugsId; // 药品id
@Column(length=10)
private String unit; // 药品单位
private float price; // 单价
private int num; // 数量
private float total; // 总价
@Transient
private String codeOrName; // 查询用到 根据药品编码或者药品名称查询
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public DrugsType getType() {
return type;
}
public void setType(DrugsType type) {
this.type = type;
}
public Integer getTypeId() {
return typeId;
}
public void setTypeId(Integer typeId) {
this.typeId = typeId;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public float getPrice() {
return price;
}
public void setPrice(float price) {
this.price = price;
}
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
public float getTotal() {
return total;
}
public void setTotal(float total) {
this.total = total;
}
public PurchaseList getPurchaseList() {
return purchaseList;
}
public void setPurchaseList(PurchaseList purchaseList) {
this.purchaseList = purchaseList;
}
public Integer getDrugsId() {
return drugsId;
}
public void setDrugsId(Integer drugsId) {
this.drugsId = drugsId;
}
public String getCodeOrName() {
return codeOrName;
}
public void setCodeOrName(String codeOrName) {
this.codeOrName = codeOrName;
}
@Override
public String toString() {
return "[id=" + id + ", code=" + code + ", name=" + name + ", model=" + model + ", type="
+ type + ", unit=" + unit + ", price=" + price + ", num=" + num + ", total=" + total + "]";
}
}
| [
"1446236992@qq.com"
] | 1446236992@qq.com |
52bdad1d9122c51ef3410d2b60ebd33ac53a2726 | 63da595a4e74145e86269e74e46c98ad1c1bcad3 | /java/com/genscript/gsscm/serv/entity/ServiceClassification.java | f29d76597cbde7e7d6891c15141467c75e594265 | [] | no_license | qcamei/scm | 4f2cec86fedc3b8dc0f1cc1649e9ef3be687f726 | 0199673fbc21396e3077fbc79eeec1d2f9bd65f5 | refs/heads/master | 2020-04-27T19:38:19.460288 | 2012-09-18T07:06:04 | 2012-09-18T07:06:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,101 | java | package com.genscript.gsscm.serv.entity;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.apache.commons.lang.builder.ToStringBuilder;
import com.genscript.core.orm.hibernate.BaseEntity;
/**
* SERVICE ProductClass.
*
*
* @author Wangsf
*/
@Entity
@Table(name = "service_classification", catalog="product")
public class ServiceClassification extends BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer clsId;
private String name;
private String description;
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this);
}
public Integer getClsId() {
return clsId;
}
public void setClsId(Integer clsId) {
this.clsId = clsId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
| [
"253479240@qq.com"
] | 253479240@qq.com |
72c5570954df5f63c5e23a04c7dcabae3839b1a0 | 717102a4c89d6a221ec681c19f774312624218f7 | /src/com/xgf/winecome/ui/adapter/MainGoodsGvAdapter.java | 60522edbb5bccbe14b141934e1558a3074c438c3 | [] | no_license | xiguofeng/WineCome | df2c6acd7253350a012599954026623be3a2608c | 2cf6e566aba8c9596850ce8e1c32db6478e1415f | refs/heads/master | 2020-07-03T08:21:10.183507 | 2015-12-11T09:08:55 | 2015-12-11T09:08:55 | 37,714,387 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,775 | java | package com.xgf.winecome.ui.adapter;
import java.util.ArrayList;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.xgf.winecome.R;
import com.xgf.winecome.entity.Goods;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
public class MainGoodsGvAdapter extends BaseAdapter {
private Context context;
private ArrayList<Goods> mDatas;
public MainGoodsGvAdapter(Context context, ArrayList<Goods> data) {
this.context = context;
this.mDatas = data;
}
@Override
public int getCount() {
return mDatas.size();
}
@Override
public Object getItem(int arg0) {
return null;
}
@Override
public long getItemId(int arg0) {
return 0;
}
@Override
public View getView(int position, View currentView, ViewGroup arg2) {
HolderView holderView = null;
if (currentView == null) {
holderView = new HolderView();
currentView = LayoutInflater.from(context).inflate(
R.layout.gv_main_goods_item, null);
holderView.iconIv = (ImageView) currentView
.findViewById(R.id.gv_main_goods_common_iv);
holderView.nameTv = (TextView) currentView
.findViewById(R.id.gv_main_goods_common_name_tv);
currentView.setTag(holderView);
} else {
holderView = (HolderView) currentView.getTag();
}
// holderView.iconIv.setImageResource(data.get(position).getLocalImage());
holderView.nameTv.setText(mDatas.get(position).getName());
ImageLoader.getInstance().displayImage(mDatas.get(position).getIconUrl(),
holderView.iconIv);
return currentView;
}
public class HolderView {
private ImageView iconIv;
private TextView nameTv;
}
}
| [
"xiguofeng@163.com"
] | xiguofeng@163.com |
13d37ae8175d7fb2d92d9e60d604b77124bd0e3c | 9f36296c474c672f6430ee225db4111e6a7a1c01 | /src/niuke/GetLeastNumbers_Solution.java | 6ba3c0ad31c2c816a7b1d3f37cc39ec8bbeab8fb | [] | no_license | longhaidadi/leetcode | 035222fb7841192e19daa0b80f5cd1760a403135 | 324175638e3a3f5ac18890bd5e646c1577155819 | refs/heads/master | 2020-12-25T21:43:42.467114 | 2016-09-21T10:55:04 | 2016-09-21T10:55:04 | 68,807,991 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,608 | java | package niuke;
import java.util.ArrayList;
/**
* Created by lon on 16-5-30.
*/
public class GetLeastNumbers_Solution {
public static void main(String[] args) {
int [] array = {4,5,1,6,2,7,3,8};
new GetLeastNumbers_Solution().GetLeastNumbers_Solution(array,2);
}
public ArrayList<Integer> GetLeastNumbers_Solution(int [] input, int k) {
ArrayList<Integer> list = new ArrayList<>();
if(input==null || input.length==0 || input.length<k)return list;
partition(input, 0, input.length - 1, k,list);
System.out.println(list);
return list;
}
public void partition(int [] input , int low , int high ,int k,ArrayList<Integer> list){
int start = low;
int end = high;
if(start<=end){
int temp = input[start];
while (start<end){
while (end>start && input[end]>=temp)
end--;
input[start]=input[end];
while (start<end && input[start]<=temp)
start++;
input[end]=input[start];
}
input[start]= temp;
int len = start-low;
if(len==k){
for(int i =0;i<len;i++)
list.add(input[low+i]);
return;
}
if(len<k) {
for (int i = 0; i <=len ; i++) {
list.add(input[low+i]);
}
partition(input, start+1 , high, k - len-1 , list);
}
else partition(input,low,start-1,k,list);
}
}
}
| [
"yanglongfei@software.ict.ac.cn"
] | yanglongfei@software.ict.ac.cn |
3012f2fd078d4f83f40b76785ed3eb0afde44367 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/17/17_dd8206d669e4795f9ba2fa3c6df2319b40946b16/ClassDeclarationPattern/17_dd8206d669e4795f9ba2fa3c6df2319b40946b16_ClassDeclarationPattern_t.java | ab84bb9d1869925ac0a9419627c52915ac7c03f1 | [] | 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 | 8,286 | java | /*******************************************************************************
* Copyright (c) 2000, 2003 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
/*
* Created on Jun 13, 2003
*/
package org.eclipse.cdt.internal.core.search.matching;
import java.io.IOException;
import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
import org.eclipse.cdt.core.parser.ast.ASTClassKind;
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement;
import org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement;
import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration;
import org.eclipse.cdt.core.search.ICSearchScope;
import org.eclipse.cdt.internal.core.CharOperation;
import org.eclipse.cdt.internal.core.index.IEntryResult;
import org.eclipse.cdt.internal.core.index.impl.IndexInput;
import org.eclipse.cdt.internal.core.index.impl.IndexedFile;
import org.eclipse.cdt.internal.core.search.IIndexSearchRequestor;
import org.eclipse.cdt.internal.core.search.indexing.AbstractIndexer;
/**
* @author aniefer
*/
public class ClassDeclarationPattern extends CSearchPattern {
// public ClassDeclarationPattern( int matchMode, boolean caseSensitive ){
// super( matchMode, caseSensitive, DECLARATIONS );
// }
public ClassDeclarationPattern( char[] name, char[][] containers, SearchFor searchFor, LimitTo limit, int mode, boolean caseSensitive ){
super( mode, caseSensitive, limit );
simpleName = caseSensitive ? name : CharOperation.toLowerCase( name );
if( caseSensitive || containers == null ){
qualifications = containers;
} else {
int len = containers.length;
this.qualifications = new char[ len ][];
for( int i = 0; i < len; i++ ){
this.qualifications[i] = CharOperation.toLowerCase( containers[i] );
}
}
this.searchFor = searchFor;
if( searchFor == CLASS ){
classKind = ASTClassKind.CLASS;
} else if( searchFor == STRUCT ) {
classKind = ASTClassKind.STRUCT;
} else if ( searchFor == ENUM ) {
classKind = ASTClassKind.ENUM;
} else if ( searchFor == UNION ) {
classKind = ASTClassKind.UNION;
} else {
classKind = null;
}
}
public int matchLevel( ISourceElementCallbackDelegate node, LimitTo limit ){
if ( !( node instanceof IASTClassSpecifier ) &&
!( node instanceof IASTElaboratedTypeSpecifier ) &&
!( node instanceof IASTTypedefDeclaration ) &&
!( node instanceof IASTEnumerationSpecifier) )
{
return IMPOSSIBLE_MATCH;
} else if( searchFor != TYPE && ((searchFor == TYPEDEF) ^ (node instanceof IASTTypedefDeclaration)) ) {
return IMPOSSIBLE_MATCH;
}
if( ! canAccept( limit ) )
return IMPOSSIBLE_MATCH;
String nodeName = null;
if (node instanceof IASTElaboratedTypeSpecifier)
{
nodeName = ((IASTElaboratedTypeSpecifier)node).getName();
}
else if( node instanceof IASTOffsetableNamedElement )
{
nodeName = ((IASTOffsetableNamedElement)node).getName();
} else {
return IMPOSSIBLE_MATCH;
}
//check name, if simpleName == null, its treated the same as "*"
if( simpleName != null && !matchesName( simpleName, nodeName.toCharArray() ) ){
return IMPOSSIBLE_MATCH;
}
if( node instanceof IASTQualifiedNameElement ){
//create char[][] out of full name,
String [] fullName = ((IASTQualifiedNameElement) node).getFullyQualifiedName();
char [][] qualName = new char [ fullName.length - 1 ][];
for( int i = 0; i < fullName.length - 1; i++ ){
qualName[i] = fullName[i].toCharArray();
}
//check containing scopes
if( !matchQualifications( qualifications, qualName ) ){
return IMPOSSIBLE_MATCH;
}
}
//check type
if( classKind != null ){
if( node instanceof IASTClassSpecifier ){
IASTClassSpecifier clsSpec = (IASTClassSpecifier) node;
return ( classKind == clsSpec.getClassKind() ) ? ACCURATE_MATCH : IMPOSSIBLE_MATCH;
} else if (node instanceof IASTEnumerationSpecifier){
return ( classKind == ASTClassKind.ENUM ) ? ACCURATE_MATCH : IMPOSSIBLE_MATCH;
} else if (node instanceof IASTElaboratedTypeSpecifier ){
IASTElaboratedTypeSpecifier elabTypeSpec = (IASTElaboratedTypeSpecifier) node;
return ( classKind == elabTypeSpec.getClassKind() ) ? ACCURATE_MATCH : IMPOSSIBLE_MATCH;
}
}
return ACCURATE_MATCH;
}
public char [] getName() {
return simpleName;
}
public char[] [] getContainingTypes () {
return qualifications;
}
public ASTClassKind getKind(){
return classKind;
}
protected char[] simpleName;
protected char[][] qualifications;
protected ASTClassKind classKind;
protected SearchFor searchFor;
protected char[] decodedSimpleName;
private char[][] decodedContainingTypes;
protected char decodedType;
public void feedIndexRequestor(IIndexSearchRequestor requestor, int detailLevel, int[] references, IndexInput input, ICSearchScope scope) throws IOException {
boolean isClass = decodedType == CLASS_SUFFIX;
for (int i = 0, max = references.length; i < max; i++) {
IndexedFile file = input.getIndexedFile(references[i]);
String path;
if (file != null && scope.encloses(path =file.getPath())) {
//TODO: BOG Fix this up - even if it's not a class we still care
if (isClass) {
requestor.acceptClassDeclaration(path, decodedSimpleName, decodedContainingTypes);
} else {
requestor.acceptClassDeclaration(path, decodedSimpleName, decodedContainingTypes);
}
}
}
}
protected void resetIndexInfo(){
decodedType = 0;
decodedSimpleName = null;
decodedContainingTypes = null;
}
protected void decodeIndexEntry(IEntryResult entryResult) {
char[] word = entryResult.getWord();
int size = word.length;
int firstSlash = CharOperation.indexOf( SEPARATOR, word, 0 );
this.decodedType = word[ firstSlash + 1 ];
firstSlash += 2;
int slash = CharOperation.indexOf( SEPARATOR, word, firstSlash + 1 );
this.decodedSimpleName = CharOperation.subarray( word, firstSlash + 1, slash );
if( slash != -1 && slash+1 < size ){
char [][] temp = CharOperation.splitOn('/', CharOperation.subarray( word, slash + 1, size ));
this.decodedContainingTypes = new char [ temp.length ][];
for( int i = 0; i < temp.length; i++ ){
this.decodedContainingTypes[ i ] = temp[ temp.length - i - 1 ];
}
}
}
public char[] indexEntryPrefix() {
return AbstractIndexer.bestTypePrefix(
searchFor,
getLimitTo(),
simpleName,
qualifications,
_matchMode,
_caseSensitive
);
}
protected boolean matchIndexEntry() {
//check type matches
if( classKind == null ){
if( searchFor == TYPEDEF && decodedType != TYPEDEF_SUFFIX ){
return false;
}
//don't match variable entries
if( decodedType == VAR_SUFFIX ){
return false;
}
} else if( classKind == ASTClassKind.CLASS ) {
if( decodedType != CLASS_SUFFIX ){
return false;
}
} else if ( classKind == ASTClassKind.STRUCT ) {
if( decodedType != STRUCT_SUFFIX ){
return false;
}
} else if ( classKind == ASTClassKind.UNION ) {
if( decodedType != UNION_SUFFIX ){
return false;
}
} else if ( classKind == ASTClassKind.ENUM ) {
if( decodedType != ENUM_SUFFIX ) {
return false;
}
}
/* check simple name matches */
if (simpleName != null){
if( ! matchesName( simpleName, decodedSimpleName ) ){
return false;
}
}
if( !matchQualifications( qualifications, decodedContainingTypes ) ){
return false;
}
return true;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
a4c44ce09fedc6d360cc22db9089881bff09a399 | fc59aeeb55577739535facc80a2b2c62a4fc9d2c | /src/main/java/jdk/com/sun/corba/se/PortableActivationIDL/ServerNotActiveHolder.java | 94de9a39d2bd4f026c3be13057038a59a7a88cde | [] | no_license | goubo/javaDemo | 8dc1037b824ce71fab4b246fc437fa8aaa66b859 | 35234d9a2b410e17f1672c0b05d2f370b85f806a | refs/heads/main | 2023-03-12T08:27:41.194350 | 2021-02-24T02:08:14 | 2021-02-24T02:08:14 | 340,292,219 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,164 | java | package com.sun.corba.se.PortableActivationIDL;
/**
* com/sun/corba/se/PortableActivationIDL/ServerNotActiveHolder.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from /jenkins/workspace/8-2-build-macosx-x86_64/jdk8u271/605/corba/src/share/classes/com/sun/corba/se/PortableActivationIDL/activation.idl
* Wednesday, September 16, 2020 4:54:59 PM GMT
*/
public final class ServerNotActiveHolder implements org.omg.CORBA.portable.Streamable
{
public com.sun.corba.se.PortableActivationIDL.ServerNotActive value = null;
public ServerNotActiveHolder ()
{
}
public ServerNotActiveHolder (com.sun.corba.se.PortableActivationIDL.ServerNotActive initialValue)
{
value = initialValue;
}
public void _read (org.omg.CORBA.portable.InputStream i)
{
value = com.sun.corba.se.PortableActivationIDL.ServerNotActiveHelper.read (i);
}
public void _write (org.omg.CORBA.portable.OutputStream o)
{
com.sun.corba.se.PortableActivationIDL.ServerNotActiveHelper.write (o, value);
}
public org.omg.CORBA.TypeCode _type ()
{
return com.sun.corba.se.PortableActivationIDL.ServerNotActiveHelper.type ();
}
}
| [
"goujinbo@outlook.com"
] | goujinbo@outlook.com |
e4d16665eff3e656de50c618795baeed1cc8b622 | 926b7007b03d1261717aeaf9fef1ba8fceb5ad12 | /src/main/java/com/msun/thirdpartyPay/wepay/exception/WepayException.java | 2cde89db3c8ff246b026f09e528d5e78f5f95daf | [
"Apache-2.0"
] | permissive | MSUNorg/thirdpartyPay | f5dee9d6ec25b975efef7c0b1ddfa4837bcd0140 | 35fa62c2aa23042f54314cebb1b918c707e3e82a | refs/heads/master | 2021-01-19T14:22:25.835211 | 2017-08-04T09:12:45 | 2017-08-04T09:13:39 | 88,155,176 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 872 | java | package com.msun.thirdpartyPay.wepay.exception;
/**
* 微信支付异常
*
* @author zxc Apr 13, 2017 6:42:34 PM
*/
public class WepayException extends RuntimeException {
private static final long serialVersionUID = 8445615780195056892L;
/**
* 当微信发生错误时,对应的错误码
*/
private String errorCode;
/**
* 当微信发生错误时,对应的错误消息
*/
private String errorMsg;
public WepayException(Throwable cause) {
super(cause);
}
public WepayException(String errorCode, String errorMsg) {
super("[" + errorCode + "]" + errorMsg);
this.errorCode = errorCode;
this.errorMsg = errorMsg;
}
public String getErrorCode() {
return errorCode;
}
public String getErrorMsg() {
return errorMsg;
}
}
| [
"zhangxiongcai337@163.com"
] | zhangxiongcai337@163.com |
2976db490e7f3b6f014c83bea9b1cb16f9ee6a71 | a724a88f7113bcd9f812d50900d40917c2783db2 | /PR08Geometry/src/ee/taltech/iti0202/geometry/shape/Triangle.java | 5f11e1aae928c4840f1ec04b36ebbefc6d7eda0f | [] | no_license | JelenaKiblik/School-java | 02e3f8507cb0379ae6609532441e1a945bff24c7 | b4fcada35daeda20f6cab4bbbd3f7f07a1ce2cc2 | refs/heads/master | 2020-06-05T20:32:11.100628 | 2019-06-05T14:02:41 | 2019-06-05T14:02:41 | 192,536,788 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 202 | java | package ee.taltech.iti0202.geometry.shape;
public class Triangle extends Shape {
public Triangle(String name, int angles, Color color, int size) {
super(name, angles, color, size);
}
}
| [
"jekibl@ttu.ee"
] | jekibl@ttu.ee |
66c45f161c5ccc98ec0964faa467179e742f9e97 | fcff93e8c7f87ad88bdc9abca4453fbe86bb4328 | /code/section_iii/3_2_passing_multiple_parameters.java | 72bcad3d6e4d45b067ffc376657d757609df9417 | [] | no_license | kumarraunak/oreilly_programming_with_sql | 4b16e5cf1a1ebf13dd94d900ce7b78430a40ca12 | 32aece26780f1c3f4f8014476ebce99686b81b91 | refs/heads/master | 2022-04-05T15:39:39.103664 | 2020-02-27T14:51:52 | 2020-02-27T14:51:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 933 | java | import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
public class JavaLauncher {
public static void main(String[] args) {
try {
Connection conn = DriverManager.getConnection("jdbc:sqlite:/c:/git/oreilly_advanced_sql_for_data/thunderbird_manufacturing.db");
PreparedStatement stmt = conn.prepareStatement("SELECT * FROM CUSTOMER WHERE STATE = ? AND CATEGORY = ?");
stmt.setString(1, "TX");
stmt.setString(2, "COMMERCIAL");
ResultSet rs = stmt.executeQuery();
while (rs.next()) {
System.out.println(rs.getInt("CUSTOMER_ID") + "," + rs.getString("CUSTOMER_NAME") + "," + rs.getString("STATE") + "," + rs.getString("CATEGORY"));
}
conn.close();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
} | [
"thomasnield@live.com"
] | thomasnield@live.com |
a679cff6c117bfce38e25b30df848ee6015e2de7 | 39d3eca8d1a53c3cffd07a53922ea483ac410db6 | /Mqtt piolt/app/src/main/java/com/example/viji/my/MainActivity.java | 6826e2f5c8f8aa6babfb74af6e853969298f1862 | [] | no_license | justin1093/MQTT-Project | 8a669c180989e1eb038a47d4e231af5a1a9c5fac | 8ecc164b443e73505990e51ef97fbf3c4cf1b37a | refs/heads/master | 2021-01-21T18:34:47.984890 | 2017-05-22T14:41:31 | 2017-05-22T14:41:31 | 92,063,324 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 332 | java | package com.example.viji.my;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
| [
"justinmnl@hotmail.com"
] | justinmnl@hotmail.com |
2be67344aaa3f3481f65c14ca9a01bd60f73c5d2 | 11928d2fc74f845065198722c3ffc5e415d81bee | /src/main/java/employee/manager/service/EmployeeService.java | e417148d161518b81a2cc1d0af5089e0e18c0da8 | [] | no_license | grandiene/manager | d0e108d1579184fffe406c6aed2eabfa024f473d | 590f513ea94fdb27ba6837dbdd0ebf0518e2783e | refs/heads/master | 2023-06-17T00:07:18.477819 | 2021-07-12T02:07:21 | 2021-07-12T02:07:21 | 385,098,785 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 232 | java | package employee.manager.service;
import employee.manager.model.entity.Employee;
public interface EmployeeService {
Employee save(Employee employee);
void setIsDelete(Integer id);
Employee update(Employee employee);
}
| [
"jr.yayan@gmail.com"
] | jr.yayan@gmail.com |
dc06b5d8030eb8a502df6208d7b7ca67e15b9877 | 69e8d40a685b0affa61f940c49feadf585397267 | /spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/AbstractNamedValueMethodArgumentResolver.java | efa4d7da1e1937cc84e2292cb505574d8796bfa8 | [
"Apache-2.0"
] | permissive | rocky-peng/spring-framework-v5.2.1.RELEASE-sourcecode-read | 5be7e3e1ef408f0b2bee5b65b76d1d7b68b21011 | 4991a34860407ddcd644732a5ea8f84bc058efb1 | refs/heads/master | 2020-09-30T15:16:32.014509 | 2020-03-05T15:11:10 | 2020-03-05T15:11:10 | 227,312,986 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,896 | java | /*
* Copyright 2002-2019 the original author or authors.
*
* 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
*
* https://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.springframework.messaging.handler.annotation.support;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.config.BeanExpressionContext;
import org.springframework.beans.factory.config.BeanExpressionResolver;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.core.MethodParameter;
import org.springframework.core.convert.ConversionService;
import org.springframework.core.convert.TypeDescriptor;
import org.springframework.core.convert.support.DefaultConversionService;
import org.springframework.lang.Nullable;
import org.springframework.messaging.Message;
import org.springframework.messaging.handler.annotation.ValueConstants;
import org.springframework.messaging.handler.invocation.HandlerMethodArgumentResolver;
import org.springframework.util.ClassUtils;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* Abstract base class to resolve method arguments from a named value, e.g.
* message headers or destination variables. Named values could have one or more
* of a name, a required flag, and a default value.
*
* <p>Subclasses only need to define specific steps such as how to obtain named
* value details from a method parameter, how to resolve to argument values, or
* how to handle missing values.
*
* <p>A default value string can contain ${...} placeholders and Spring
* Expression Language {@code #{...}} expressions which will be resolved if a
* {@link ConfigurableBeanFactory} is supplied to the class constructor.
*
* <p>A {@link ConversionService} is used to convert a resolved String argument
* value to the expected target method parameter type.
*
* @author Rossen Stoyanchev
* @author Juergen Hoeller
* @since 4.0
*/
public abstract class AbstractNamedValueMethodArgumentResolver implements HandlerMethodArgumentResolver {
private final ConversionService conversionService;
@Nullable
private final ConfigurableBeanFactory configurableBeanFactory;
@Nullable
private final BeanExpressionContext expressionContext;
private final Map<MethodParameter, NamedValueInfo> namedValueInfoCache = new ConcurrentHashMap<>(256);
/**
* Constructor with a {@link ConversionService} and a {@link BeanFactory}.
*
* @param conversionService conversion service for converting String values
* to the target method parameter type
* @param beanFactory a bean factory for resolving {@code ${...}}
* placeholders and {@code #{...}} SpEL expressions in default values
*/
protected AbstractNamedValueMethodArgumentResolver(ConversionService conversionService,
@Nullable ConfigurableBeanFactory beanFactory) {
// Fallback on shared ConversionService for now for historic reasons.
// Possibly remove after discussion in gh-23882.
//noinspection ConstantConditions
this.conversionService = conversionService != null ?
conversionService : DefaultConversionService.getSharedInstance();
this.configurableBeanFactory = beanFactory;
this.expressionContext = (beanFactory != null ? new BeanExpressionContext(beanFactory, null) : null);
}
@Override
public Object resolveArgument(MethodParameter parameter, Message<?> message) throws Exception {
NamedValueInfo namedValueInfo = getNamedValueInfo(parameter);
MethodParameter nestedParameter = parameter.nestedIfOptional();
Object resolvedName = resolveEmbeddedValuesAndExpressions(namedValueInfo.name);
if (resolvedName == null) {
throw new IllegalArgumentException(
"Specified name must not resolve to null: [" + namedValueInfo.name + "]");
}
Object arg = resolveArgumentInternal(nestedParameter, message, resolvedName.toString());
if (arg == null) {
if (namedValueInfo.defaultValue != null) {
arg = resolveEmbeddedValuesAndExpressions(namedValueInfo.defaultValue);
} else if (namedValueInfo.required && !nestedParameter.isOptional()) {
handleMissingValue(namedValueInfo.name, nestedParameter, message);
}
arg = handleNullValue(namedValueInfo.name, arg, nestedParameter.getNestedParameterType());
} else if ("".equals(arg) && namedValueInfo.defaultValue != null) {
arg = resolveEmbeddedValuesAndExpressions(namedValueInfo.defaultValue);
}
if (parameter != nestedParameter || !ClassUtils.isAssignableValue(parameter.getParameterType(), arg)) {
arg = this.conversionService.convert(arg, TypeDescriptor.forObject(arg), new TypeDescriptor(parameter));
}
handleResolvedValue(arg, namedValueInfo.name, parameter, message);
return arg;
}
/**
* Obtain the named value for the given method parameter.
*/
private NamedValueInfo getNamedValueInfo(MethodParameter parameter) {
NamedValueInfo namedValueInfo = this.namedValueInfoCache.get(parameter);
if (namedValueInfo == null) {
namedValueInfo = createNamedValueInfo(parameter);
namedValueInfo = updateNamedValueInfo(parameter, namedValueInfo);
this.namedValueInfoCache.put(parameter, namedValueInfo);
}
return namedValueInfo;
}
/**
* Create the {@link NamedValueInfo} object for the given method parameter.
* Implementations typically retrieve the method annotation by means of
* {@link MethodParameter#getParameterAnnotation(Class)}.
*
* @param parameter the method parameter
* @return the named value information
*/
protected abstract NamedValueInfo createNamedValueInfo(MethodParameter parameter);
/**
* Fall back on the parameter name from the class file if necessary and
* replace {@link ValueConstants#DEFAULT_NONE} with null.
*/
private NamedValueInfo updateNamedValueInfo(MethodParameter parameter, NamedValueInfo info) {
String name = info.name;
if (info.name.isEmpty()) {
name = parameter.getParameterName();
if (name == null) {
Class<?> type = parameter.getParameterType();
throw new IllegalArgumentException(
"Name for argument of type [" + type.getName() + "] not specified, " +
"and parameter name information not found in class file either.");
}
}
return new NamedValueInfo(name, info.required,
ValueConstants.DEFAULT_NONE.equals(info.defaultValue) ? null : info.defaultValue);
}
/**
* Resolve the given annotation-specified value,
* potentially containing placeholders and expressions.
*/
@Nullable
private Object resolveEmbeddedValuesAndExpressions(String value) {
if (this.configurableBeanFactory == null || this.expressionContext == null) {
return value;
}
String placeholdersResolved = this.configurableBeanFactory.resolveEmbeddedValue(value);
BeanExpressionResolver exprResolver = this.configurableBeanFactory.getBeanExpressionResolver();
if (exprResolver == null) {
return value;
}
return exprResolver.evaluate(placeholdersResolved, this.expressionContext);
}
/**
* Resolves the given parameter type and value name into an argument value.
*
* @param parameter the method parameter to resolve to an argument value
* @param message the current request
* @param name the name of the value being resolved
* @return the resolved argument. May be {@code null}
* @throws Exception in case of errors
*/
@Nullable
protected abstract Object resolveArgumentInternal(MethodParameter parameter, Message<?> message, String name)
throws Exception;
/**
* Invoked when a value is required, but {@link #resolveArgumentInternal}
* returned {@code null} and there is no default value. Sub-classes can
* throw an appropriate exception for this case.
*
* @param name the name for the value
* @param parameter the target method parameter
* @param message the message being processed
*/
protected abstract void handleMissingValue(String name, MethodParameter parameter, Message<?> message);
/**
* One last chance to handle a possible null value.
* Specifically for booleans method parameters, use {@link Boolean#FALSE}.
* Also raise an ISE for primitive types.
*/
@Nullable
private Object handleNullValue(String name, @Nullable Object value, Class<?> paramType) {
if (value == null) {
if (Boolean.TYPE.equals(paramType)) {
return Boolean.FALSE;
} else if (paramType.isPrimitive()) {
throw new IllegalStateException("Optional " + paramType + " parameter '" + name +
"' is present but cannot be translated into a null value due to being " +
"declared as a primitive type. Consider declaring it as object wrapper " +
"for the corresponding primitive type.");
}
}
return value;
}
/**
* Invoked after a value is resolved.
*
* @param arg the resolved argument value
* @param name the argument name
* @param parameter the argument parameter type
* @param message the message
*/
protected void handleResolvedValue(
@Nullable Object arg, String name, MethodParameter parameter, Message<?> message) {
}
/**
* Represents a named value declaration.
*/
protected static class NamedValueInfo {
private final String name;
private final boolean required;
@Nullable
private final String defaultValue;
protected NamedValueInfo(String name, boolean required, @Nullable String defaultValue) {
this.name = name;
this.required = required;
this.defaultValue = defaultValue;
}
}
}
| [
"rocky.peng@qq.com"
] | rocky.peng@qq.com |
866c5c26b549f26d5dbde7aff0c92b9b131e2ef9 | 9120caf11387377b220faf223a1b91c5803edfa3 | /ListViewWithCustomAdapter/gen/com/example/listviewwithcustomadapter/BuildConfig.java | 91ec2e6303be5c02acdbaaf72b93cb2ad06c3be5 | [] | no_license | cyuunankai/android_lessions | 3166fa28e3837759d50bf54020e4b951727ebf65 | 60cd2d6b08ebc917407656b744391d29a9bcd94d | refs/heads/master | 2020-05-19T07:17:43.144273 | 2015-01-20T02:52:40 | 2015-01-20T02:52:40 | 26,475,946 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 179 | java | /** Automatically generated file. DO NOT MODIFY */
package com.example.listviewwithcustomadapter;
public final class BuildConfig {
public final static boolean DEBUG = true;
} | [
"li_yang@microad-tech.com"
] | li_yang@microad-tech.com |
4febfbe4beab50958f8e1a942f053216a9412e11 | e240359d70fda0974502cc6da46a576e0b493052 | /homework6 - Graphs/test/GraphTaskTest.java | 0c6a169cf2af60c75b958ed172f3b73fbdfcd8b6 | [] | no_license | MartinSirg/Algorithms-and-Data-Structures | a3f7329ae3b4a873e70ac8ad65c2a8260e52bc7e | 13f9c551fdb034357903f1f544d0284e8a6fd8ab | refs/heads/master | 2021-10-11T15:06:02.764028 | 2019-01-27T17:59:27 | 2019-01-27T17:59:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,212 | java | import static org.junit.Assert.*;
import org.junit.Test;
import java.util.*;
public class GraphTaskTest {
@Test (timeout=20000)
public void testGraphNotSameObjectAsClone() {
Graph graph = new Graph("G");
graph.createRandomSimpleGraph(6,10);
Graph clone = graph.deepGraphClone();
assertNotSame(clone, graph);
}
@Test (timeout=20000)
public void testGraphElementsIdNameIndependence() {
Graph graph = new Graph("G");
graph.createRandomSimpleGraph(6,10);
Graph clone = graph.deepGraphClone();
assertEquals(clone.id, graph.id);
assertEquals(clone.first.id, graph.first.id);
assertEquals(clone.first.first.id, graph.first.first.id);
graph.id = "new name";
graph.first.id = "new vertex name";
graph.first.first.id = "new arc name";
assertNotEquals(clone.id, graph.id);
assertNotEquals(clone.first.id, graph.first.id);
assertNotEquals(clone.first.first.id, graph.first.first.id);
}
@Test (timeout=20000)
public void testGraphVertexNextIndependence() {
Graph graph = new Graph("G");
graph.createRandomSimpleGraph(6,10);
Graph clone = graph.deepGraphClone();
graph.first.next = null;
assertNotNull(clone.first.next);
}
@Test (timeout=20000)
public void testGraphVertexFirstIndependence() {
Graph graph = new Graph("G");
graph.createRandomSimpleGraph(6,10);
Graph clone = graph.deepGraphClone();
graph.first.first = null;
assertNotNull(clone.first.first);
}
@Test (timeout=20000)
public void testGraphArcTargetIndependence() {
Graph graph = new Graph("G");
graph.createRandomSimpleGraph(6,10);
Graph clone = graph.deepGraphClone();
clone.first.first.target = clone.first.next.next;
graph.first.first.target = graph.first.next;
assertNotSame(clone.first.first.target, clone.first.next);
}
@Test (timeout=20000)
public void testGraphArcNextIndependence() {
Graph graph = new Graph("G");
graph.createRandomSimpleGraph(6,15);
Graph clone = graph.deepGraphClone();
graph.first.first.next = null;
assertNotNull(clone.first.first.next);
}
}
| [
"sirgmartin@gmail.com"
] | sirgmartin@gmail.com |
7a4f80819d28dce6686672b348f9c2e7f29397ad | f64fcd2d9d37e4a2c29bf0504f45e95dcaef48ce | /04.spring-mq/mq-sender/src/test/java/com/sinosoft/mq/WanYiMingSenderTest.java | 9ecfab48904f2bb1a6b323ec1a188b3ae1e01740 | [] | no_license | chenzecq/StudyProject | 19953bfca1df15300edadf060b307547c4d21a03 | a77a26be49b0caaa3c804426a841040379013dbd | refs/heads/master | 2021-01-17T18:33:28.534269 | 2017-03-05T12:48:06 | 2017-03-05T12:48:06 | 84,135,018 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 758 | java | package com.sinosoft.mq;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
/**
* Created by WanYiMing on 2017/2/28.
*/
@ContextConfiguration(
locations = {
"classpath:/spring/spring-mq-sender.xml",
"classpath:/spring/spring-mq-sender.xml",
"classpath:/spring/spring-mq.xml"
}
)
public class WanYiMingSenderTest extends AbstractJUnit4SpringContextTests{
@Autowired
private WanYiMingSender wanYiMingSender;
@Test
public void sender(){
wanYiMingSender.sendMessage("SKTOne!");
}
}
| [
"wanyiming@sinosoft.com.cn"
] | wanyiming@sinosoft.com.cn |
31fa1cc30299dcde0f8e4b82e429a6aef50cb216 | 8eaaf20f0f20240fb0e31cb62ff838b8bbca7770 | /DreamPvP [mc-1.3.1]/se/proxus/DreamPvP/Mods/m_Chams.java | fc6759a9caa09dbf42de3798792e24e463d22b99 | [
"LicenseRef-scancode-public-domain",
"Unlicense"
] | permissive | Olivki/minecraft-clients | aa7e5d94596c3c67fa748816566ccce17160d000 | 19e00b00d3556e6b3cee5f968005638593d12c01 | refs/heads/master | 2020-04-13T05:30:22.073886 | 2019-03-04T20:52:54 | 2019-03-04T20:52:54 | 162,994,258 | 4 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 340 | java | package se.proxus.DreamPvP.Mods;
import static org.lwjgl.input.Keyboard.*;
public class m_Chams extends Base_Mod {
public m_Chams() {
super('7', "Chams", "Makes it so you can see players through walls.", KEY_NONE, "Player", "[§eP§r] ");
}
@Override
public void onEnabled() {
}
@Override
public void onDisabled() {
}
} | [
"0liverb3rg@gmail.com"
] | 0liverb3rg@gmail.com |
63c392de03b5be02bf7976d43175c4009621cb16 | 51d1ce4c6007dafc3eb68f4f421ede0e99b97c67 | /spring-boot/ses-spring-boot/src/main/java/app/ses/SESProcessor.java | 9af430f11c639c8c18098b397e2a7890ba23946c | [
"MIT"
] | permissive | rommy2015/code-examples | ac0d0c3b59b1dd59eb9b99a4a40a44e886c2c55e | 65b90553ccd9adeb89b82e8764334b0b3f916a5d | refs/heads/master | 2022-12-08T11:40:51.727522 | 2020-08-24T06:33:49 | 2020-08-24T06:33:49 | 289,846,908 | 0 | 0 | MIT | 2020-08-24T06:31:15 | 2020-08-24T06:31:14 | null | UTF-8 | Java | false | false | 3,571 | java | package app.ses;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.LinkedList;
import java.util.Queue;
import java.util.logging.Level;
import java.util.logging.Logger;
public class SESProcessor extends Thread {
private static final Logger LOG = Logger.getLogger(SESProcessor.class.getName());
private boolean iCanContinue = true;
private static SESProcessor sInstance = null;
private SESWorker[] workers;
private final Queue<AmazonEmail> queue = new LinkedList<>();
private final int MAX_SLEEP_TIME = 3 * 60 * 60 * 1000; //3 hours
private final int MAX_WORKERS = 1;
private int current = 0;
public SESProcessor() {
super("SESProcessor");
setDaemon(true);
}
@Override
public void run() {
LOG.log(Level.INFO, "Amazon SES processor is up and running.");
//initialize workers
initializeWorkers();
//start processing
while (iCanContinue) {
synchronized (queue) {
// Check for a new item from the queue
if (queue.isEmpty()) {
// Sleep for it, if there is nothing to do
LOG.log(Level.INFO, "Waiting for Amazon SES email to send...{0}", getTime());
try {
queue.wait(MAX_SLEEP_TIME);
} catch (InterruptedException e) {
LOG.log(Level.INFO, "Interrupted...{0}", getTime());
}
}
//distribute tasks among workers
while (!queue.isEmpty()) {
workers[current++].add(queue.poll());
current = current % MAX_WORKERS;
}
}
}
}
public static synchronized SESProcessor getInstance() {
if (sInstance == null) {
sInstance = new SESProcessor();
sInstance.start();
}
return sInstance;
}
private void initializeWorkers() {
LOG.info("Amazon SES workers are initializing ....");
workers = new SESWorker[MAX_WORKERS];
for (int i = 0; i < MAX_WORKERS; i++) {
workers[i] = new SESWorker(i + 1);
workers[i].start();
}
}
private void stopWorkers() {
LOG.info("Amazon SES workers are stopping...");
for (int i = 0; i < MAX_WORKERS; i++) {
workers[i].stopWorker();
}
}
public void add(AmazonEmail item) {
synchronized (queue) {
queue.add(item);
queue.notify();
LOG.info("New Amazon SES email added into queue...");
}
}
public static void stopProcessor() {
if (sInstance == null) {
return;
}
LOG.info("Stopping Amazon SES file processor...");
try {
//stop workers first
sInstance.stopWorkers();
sInstance.iCanContinue = false;
sInstance.interrupt();
sInstance.join();
} catch (InterruptedException | NullPointerException e) {
LOG.log(Level.SEVERE, "Exception while stop Amazon SES processor...{0}",
e.getMessage());
}
}
/*
* Get current server date & time
*/
public String getTime() {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SS");
return format.format(new Date());
}
}
| [
"hi@attacomsian.com"
] | hi@attacomsian.com |
65add415b6cfc8a38cbd5bf06446bead47ea9064 | 494a18dee6e7e8b5cc0b49aa794ac9cd1ba10a2c | /src/ContactTracingProgram.java | 60bfd719db6dd212b8853a672dfd3e22ce8aac38 | [] | no_license | Apr2020JavaBootcamp/Week3Challenge1 | 6f22072556dd79a104a95cab805e6cfc66674358 | 9a30c00b66024e8e8b2f22b0814e2982d0733649 | refs/heads/master | 2022-07-02T01:40:13.126943 | 2020-05-08T18:44:12 | 2020-05-08T18:44:12 | 262,401,707 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,508 | java | import java.util.ArrayList;
import java.util.Scanner;
public class ContactTracingProgram {
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
String userInput;
Person person1 = new Person();
ArrayList<Contact> contactList = new ArrayList<>();
ArrayList<String> symptomList = new ArrayList<>();
System.out.println("\n\t\t\t\t\tCONTACT TRACING APP\n____________________________________________________________");
System.out.println("To help contain the spread of the virus, it's important that \n" +
"you fill out this form to provide some information regarding \nany symptoms you may " +
"be experiencing or have experienced in \nthe last few days.");
System.out.println("____________________________________________________________");
System.out.println("\n\t\t\t\t\tPATIENT INFO");
System.out.println("NAME: ");
userInput = scn.nextLine();
person1.setName(userInput);
System.out.println("EMAIL address: ");
userInput = scn.nextLine();
person1.setEmail(userInput);
System.out.println("HOME address: (St/House Number, City, State, ZipCode)");
userInput = scn.nextLine();
person1.setAddress(userInput);
System.out.println("PHONE NUMBER: ");
userInput = scn.nextLine();
person1.setPhone(userInput);
System.out.println("____________________________________________________________");
System.out.println("\n\t\t\t\t\tSYMPTOMS INFO");
//Go through list of symptoms in Symptom class. If they have it, ask how many
//days and add that info to another list
for(String element: person1.getSymptom().SymptomList()){
System.out.println("Have you experienced "+element+"? y/n");
userInput = scn.nextLine();
if(userInput.equalsIgnoreCase("y")){
System.out.println("How many days did you experience it?");
userInput = scn.nextLine();
symptomList.add(element+" for "+userInput+" days");
}
}
System.out.println("____________________________________________________________");
System.out.println("\n\t\t\t\t\tRECENT ENCOUNTERS INFO");
System.out.println("Have you met or run into anybody from 2 weeks \nprior to the first symptom up until today? y/n");
userInput = scn.nextLine();
while(userInput.equalsIgnoreCase("y")){
Contact contact1 = new Contact();
contactList.add(contact1);
System.out.println("Their NAME:");
userInput = scn.nextLine();
contact1.setName(userInput);
System.out.println("Their EMAIL: ");
userInput = scn.nextLine();
contact1.setEmail(userInput);
System.out.println("Their PHONE NUMBER");
userInput = scn.nextLine();
contact1.setPhone(userInput);
System.out.println("Where did you meet or run into this person? ");
userInput = scn.nextLine();
contact1.setContactLocation(userInput);
System.out.println("In which city and state? ");
userInput = scn.nextLine();
contact1.setAddress(userInput);
System.out.println("Have you met or run into anybody else from 2 weeks \nprior to the first symptom up until today? y/n");
userInput = scn.nextLine();
}
System.out.println("____________________________________________________________");
System.out.println("\n\t\t\t\t\tPATIENT INFO");
System.out.println("\nPatient Name: "+person1.getName()+"\nPatient Email: "+person1.getEmail()+"\nPatient Address: "+person1.getAddress()+"\nPatient Phone: "+person1.getPhone());
System.out.println("\nList of symptoms: ");
for (String i: symptomList){
System.out.println(i);
}
System.out.println("\n*** ***");
System.out.println("\n\t\t\t\t\tCONTACTS LIST");
for (Contact i: contactList){
System.out.println("\nContact Name: "+ i.getName()+"\nContact Email: "+i.getEmail()+"\nContact Phone: "+i.getPhone()+
"\nMeeting Location: "+i.getContactLocation()+"\nCity and State: "+i.getAddress());
}
System.out.println("____________________________________________________________");
}
}
| [
"rap9210@gmail.com"
] | rap9210@gmail.com |
320166bb7354fa5ae909eca1fd42fba0ba248c36 | 779b09784a0012ae3c463ca1350fcaf92721074e | /app/src/main/java/com/dflores/misgastosapp/repositories/OperationsRepository.java | 459694252b3163970d89be361ef4a02293c5f896 | [] | no_license | rafael1diego/MisGastosApp | 6514209518a3db900986d9cbb6bafdd795dad66e | 449a808b3034da7c64ef1483c658d89127dc25e2 | refs/heads/master | 2020-08-05T17:22:11.287236 | 2019-10-03T16:55:05 | 2019-10-03T16:55:05 | 212,455,432 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,722 | java | package com.dflores.misgastosapp.repositories;
import com.dflores.misgastosapp.models.OperationsModel;
import com.dflores.misgastosapp.models.OperationsModel;
import java.util.ArrayList;
import java.util.List;
public class OperationsRepository {
private static List<OperationsModel> operation;
static{
operation = new ArrayList<>();
operation.add(new OperationsModel("12/05/2000","Egresos", "1200.50", "Tarjeta de Crédito"));
operation.add(new OperationsModel("18/04/2000","Ingresos", "1300.50", "Ahorro"));
operation.add(new OperationsModel("23/04/2000","Ingresos", "1400.50", "Efectivo"));
operation.add(new OperationsModel("21/07/2000","Ingresos", "5200.50", "Tarjeta de Crédito"));
}
public static List<OperationsModel> getOperation(String saldo) {
List<OperationsModel> temp = new ArrayList<>();
for(int m = 0; m < operation.size(); m++){
if(operation.get(m).getSaldo().equals(saldo)){
temp.add(operation.get(m));
}
}
return temp;
}
public static void agregar(String fecha, String tipo, String monto, String saldo){
operation.add(new OperationsModel(fecha, tipo, monto, saldo));
};
public static double total(String saldo){
double total = 0;
double total_ingresos = 0;
double total_egresos = 0;
for(int m = 0; m < operation.size(); m++){
if(operation.get(m).getSaldo().equals(saldo)){
if (operation.get(m).getTipo().equals("Ingresos")){
double numero1 = Double.parseDouble(operation.get(m).getMonto());
total_ingresos = total_ingresos + numero1;
}else{
double numero2 = Double.parseDouble(operation.get(m).getMonto());
total_egresos = total_egresos + numero2;
}
}
}
total = total_ingresos - total_egresos;
return total;
}
public static double total_global(){
double sumatoria_egresos = 0;
double sumatoria_ingresos = 0;
double sumatoria = 0;
for(int m = 0; m < operation.size(); m++){
if(operation.get(m).getTipo().equals("Ingresos")){
double numero1 = Double.parseDouble(operation.get(m).getMonto());
sumatoria_ingresos = sumatoria_ingresos + numero1;
}else{
double numero2 = Double.parseDouble(operation.get(m).getMonto());
sumatoria_egresos = sumatoria_egresos + numero2;
}
}
sumatoria = (sumatoria_ingresos/(sumatoria_egresos+sumatoria_ingresos))*100;
return sumatoria;
}
}
| [
"diego.flores.ma@tecsup.edu.pe"
] | diego.flores.ma@tecsup.edu.pe |
084b83af438423732ab915b08815c3784cf41ca7 | 1e318522468c76d4f11ced10d11cb7064750420b | /src/main/java/com/sihle/simple/controller/exception/RestControllerException.java | 82e1a4fc6e03fa6124d96a80648448c54f67ce61 | [] | no_license | zenzilesihle/simple | b77aef635721a7abdf3af4dfbca588778972dc29 | 044c9146fd4b41de3cc1bf9765a904279300ed49 | refs/heads/master | 2020-08-05T15:45:54.759069 | 2019-10-03T14:33:43 | 2019-10-03T14:33:43 | 212,601,762 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 181 | java | package com.sihle.simple.controller.exception;
import org.springframework.web.bind.annotation.RestControllerAdvice;
@RestControllerAdvice
public class RestControllerException {
}
| [
"Sihle.Zenzile@vcontractor.co.za"
] | Sihle.Zenzile@vcontractor.co.za |
933b91bf951ac240f1c0e259d4b6f1a7ff355333 | f16c1556d1f84f4d638759ddf0b9cd62c2454cc5 | /productService/src/main/java/com/product/mapper/ProductMapper.java | e9bd57e0e7e0a90eae308f18a2ce5c63ac284190 | [] | no_license | HelloHang/ecommerce | 2a1b8a75a1a4a89a7eb1801cea51c07e28bf0525 | 99132ebfecbf163c9ee00cc667f39c1e3b37be4f | refs/heads/master | 2022-06-22T09:17:34.715074 | 2019-09-11T09:55:54 | 2019-09-11T09:55:54 | 202,358,922 | 1 | 0 | null | 2022-06-21T01:48:22 | 2019-08-14T13:42:56 | Java | UTF-8 | Java | false | false | 1,213 | java | package com.product.mapper;
import com.product.entity.ProductEntity;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
/**
* @author: Daniels Gao
* @date: 2019/8/13 15:06
*/
@Mapper
public interface ProductMapper {
@Select("Select * from products")
@Results({@Result(property = "productType", column = "product_type")})
List<ProductEntity> getAll();
@Select("Select * from products where id=#{id}")
@Results({@Result(property = "productType", column = "product_type")})
ProductEntity getOne(Long id);
@Insert("Insert into products(id,name,description,product_type) values(#{id},#{name},#{description},#{productType})")
void insert(ProductEntity productEntity);
@Update("Update products set name=#{name}, description=#{description}, product_type=#{productType} where id=#{id}")
void update(ProductEntity productEntity);
@Delete("Delete from products where id=#{id}")
void delete(Long id);
}
| [
"544533631@qq.com"
] | 544533631@qq.com |
4b7383941a482973683db04baf1cbe22f552062f | e153fd48766258106886509240c29775ef3feb4a | /examples/showcase/src/main/java/org/springside/examples/showcase/webservice/soap/response/GetUserResponse.java | d6ad1d735721825f113c5379caad9f41b96a1951 | [
"Apache-2.0"
] | permissive | liuweizaixian/springside4 | d0e23a7c435ada38e508d6a06888ff7ee1e090a4 | e1f35a597899abc3d4f0ef3f49747bee40fcc384 | refs/heads/master | 2021-01-23T22:19:28.235574 | 2012-09-03T17:09:48 | 2012-09-03T17:09:48 | 5,666,122 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 587 | java | package org.springside.examples.showcase.webservice.soap.response;
import javax.xml.bind.annotation.XmlType;
import org.springside.examples.showcase.webservice.soap.WsConstants;
import org.springside.examples.showcase.webservice.soap.response.base.WSResponse;
import org.springside.examples.showcase.webservice.soap.response.dto.UserDTO;
@XmlType(name = "GetUserResponse", namespace = WsConstants.NS)
public class GetUserResponse extends WSResponse {
private UserDTO user;
public UserDTO getUser() {
return user;
}
public void setUser(UserDTO user) {
this.user = user;
}
}
| [
"calvinxiu@gmail.com"
] | calvinxiu@gmail.com |
b508496aa401d77a17772b9df0452aee893384b3 | b74b4f31817b401b60ba3dfb1b50658d79977c7e | /src/com/Substation/TIDNaming.java | 067e93bc8f97115118e34e80d5f33ef41d4e1163 | [] | no_license | AnastasiaPrix/BananaProject | d34b3ffa93b0da44d5e9d14656c9111294c5dbbe | a6b70fc7f1696c72bede207ed16b62e256452d28 | refs/heads/master | 2022-05-30T18:07:13.381535 | 2019-06-28T16:49:05 | 2019-06-28T16:49:05 | 186,911,746 | 0 | 0 | null | 2022-05-20T20:57:48 | 2019-05-15T22:34:52 | SuperCollider | UTF-8 | Java | false | false | 2,657 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2018.05.14 at 02:34:33 PM MSK
//
package com.Substation;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.NormalizedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
/**
* <p>Java class for tIDNaming complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="tIDNaming">
* <complexContent>
* <extension base="{http://www.iec.ch/61850/2006/SCL}tBaseElement">
* <attGroup ref="{http://www.iec.ch/61850/2006/SCL}agDesc"/>
* <attribute name="id" use="required" type="{http://www.iec.ch/61850/2006/SCL}tName" />
* <anyAttribute processContents='lax' namespace='##other'/>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "tIDNaming")
public abstract class TIDNaming
extends TBaseElement
{
@XmlAttribute(name = "id", required = true)
@XmlJavaTypeAdapter(NormalizedStringAdapter.class)
protected String id;
@XmlAttribute(name = "desc")
@XmlJavaTypeAdapter(NormalizedStringAdapter.class)
@XmlSchemaType(name = "normalizedString")
protected String desc;
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setId(String value) {
this.id = value;
}
/**
* Gets the value of the desc property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDesc() {
return desc;
}
/**
* Sets the value of the desc property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDesc(String value) {
this.desc = value;
}
}
| [
"diana-96.9696@mail.ru"
] | diana-96.9696@mail.ru |
7a2774f806d17edee7df252b88f5ee1e75ab8a97 | 883b7801d828a0994cae7367a7097000f2d2e06a | /python/experiments/projects/inovexcorp-mobi/real_error_dataset/1/83/BalanaPolicyManager.java | 5a250e3c8653eb02c6b4ddbbe2698edb4bea04a4 | [] | no_license | pombredanne/styler | 9c423917619912789289fe2f8982d9c0b331654b | f3d752d2785c2ab76bacbe5793bd8306ac7961a1 | refs/heads/master | 2023-07-08T05:55:18.284539 | 2020-11-06T05:09:47 | 2020-11-06T05:09:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 20,873 | java | package com.mobi.security.policy.impl.xacml;
/*-
* #%L
* com.mobi.security.policy.impl.xacml
* $Id:$
* $HeadURL:$
* %%
* Copyright (C) 2016 - 2018 iNovex Information Systems, Inc.
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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 Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
import aQute.bnd.annotation.component.Activate;
import aQute.bnd.annotation.component.Component;
import aQute.bnd.annotation.component.ConfigurationPolicy;
import aQute.bnd.annotation.component.Modified;
import aQute.bnd.annotation.component.Reference;
import aQute.bnd.annotation.metatype.Configurable;
import com.mobi.exception.MobiException;
import com.mobi.persistence.utils.RepositoryResults;
import com.mobi.rdf.api.IRI;
import com.mobi.rdf.api.Model;
import com.mobi.rdf.api.ModelFactory;
import com.mobi.rdf.api.Resource;
import com.mobi.rdf.api.ValueFactory;
import com.mobi.repository.api.Repository;
import com.mobi.repository.api.RepositoryConnection;
import com.mobi.security.policy.api.Policy;
import com.mobi.security.policy.api.cache.PolicyCache;
import com.mobi.security.policy.api.ontologies.policy.PolicyFile;
import com.mobi.security.policy.api.ontologies.policy.PolicyFileFactory;
import com.mobi.security.policy.api.xacml.PolicyQueryParams;
import com.mobi.security.policy.api.xacml.XACML;
import com.mobi.security.policy.api.xacml.XACMLPolicy;
import com.mobi.security.policy.api.xacml.XACMLPolicyManager;
import com.mobi.security.policy.api.xacml.config.PolicyManagerConfig;
import com.mobi.security.policy.api.xacml.jaxb.AttributeDesignatorType;
import com.mobi.security.policy.api.xacml.jaxb.PolicyType;
import com.mobi.security.policy.api.xacml.jaxb.TargetType;
import com.mobi.vfs.api.VirtualFile;
import com.mobi.vfs.api.VirtualFilesystem;
import com.mobi.vfs.api.VirtualFilesystemException;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.net.URLDecoder;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import javax.cache.Cache;
@Component(
configurationPolicy = ConfigurationPolicy.require,
designateFactory = PolicyManagerConfig.class,
name = BalanaPolicyManager.COMPONENT_NAME
)
public class BalanaPolicyManager implements XACMLPolicyManager {
static final String COMPONENT_NAME = "com.mobi.security.policy.api.xacml.XACMLPolicyManager";
private static final Logger LOG = LoggerFactory.getLogger(BalanaPolicyManager.class);
private ValueFactory vf;
private ModelFactory mf;
private PolicyCache policyCache;
private VirtualFilesystem vfs;
private Repository repository;
private PolicyFileFactory policyFileFactory;
private String fileLocation;
private IRI typeIRI;
private IRI policyFileTypeIRI;
@Reference
void setVf(ValueFactory vf) {
this.vf = vf;
}
@Reference
void setMf(ModelFactory mf) {
this.mf = mf;
}
@Reference
void setPolicyCache(PolicyCache policyCache) {
this.policyCache = policyCache;
}
@Reference
void setVfs(VirtualFilesystem vfs) {
this.vfs = vfs;
}
@Reference(name = "repository")
void setRepository(Repository repository) {
this.repository = repository;
}
@Reference
void setPolicyFileFactory(PolicyFileFactory policyFileFactory) {
this.policyFileFactory = policyFileFactory;
}
@Activate
protected void start(BundleContext context, Map<String, Object> props) {
typeIRI = vf.createIRI(com.mobi.ontologies.rdfs.Resource.type_IRI);
policyFileTypeIRI = vf.createIRI(PolicyFile.TYPE);
PolicyManagerConfig config = Configurable.createConfigurable(PolicyManagerConfig.class, props);
try {
LOG.debug("Setting up policy file directory");
VirtualFile file = this.vfs.resolveVirtualFile(config.policyFileLocation());
if (!file.exists()) {
if (config.createLocationIfNotExists()) {
LOG.debug("Directory does not exist. Creating it now.");
file.createFolder();
} else {
throw new MobiException("Policy File Location " + config.policyFileLocation() + " does not exist");
}
} else if (!file.isFolder()) {
throw new MobiException("Policy File Location " + config.policyFileLocation() + " is not a directory");
}
fileLocation = config.policyFileLocation();
} catch (VirtualFilesystemException e) {
throw new MobiException(e);
}
loadPolicies(context);
}
@Modified
protected void modified(BundleContext context, Map<String, Object> props) {
start(context, props);
}
@Override
public XACMLPolicy createPolicy(PolicyType policyType) {
return new BalanaPolicy(policyType, vf);
}
@Override
public Resource addPolicy(XACMLPolicy policy) {
validateUniqueId(policy);
BalanaPolicy balanaPolicy = getBalanaPolicy(policy);
LOG.debug("Creating new policy file");
try {
byte[] fileBytes = balanaPolicy.toString().getBytes();
VirtualFile file = vfs.resolveVirtualFile(fileBytes, fileLocation);
PolicyFile policyFile = addPolicyFile(file, file.getIdentifier() + ".xml", balanaPolicy);
return policyFile.getResource();
} catch (IOException e) {
throw new IllegalStateException("Could not save XACML Policy to disk due to: ", e);
}
}
@Override
public List<XACMLPolicy> getPolicies(PolicyQueryParams params) {
List<Resource> policyIds = PolicyUtils.findPolicies(params, repository);
Optional<Cache<String, Policy>> cache = policyCache.getPolicyCache();
// If there is a policy cache
if (cache.isPresent()) {
try (RepositoryConnection conn = repository.getConnection()) {
Cache<String, Policy> cacheMap = cache.get();
return policyIds.stream()
.map(id -> {
if (cacheMap.containsKey(id.stringValue())) {
return cacheMap.get(id.stringValue());
} else {
return getPolicyFromFile(id, conn);
}
})
.filter(policy -> policy instanceof XACMLPolicy)
.map(policy -> getBalanaPolicy((XACMLPolicy) policy))
.collect(Collectors.toList());
}
}
try (RepositoryConnection conn = repository.getConnection()) {
return policyIds.stream()
.map(id -> getPolicyFromFile(id, conn))
.collect(Collectors.toList());
}
}
@Override
public Optional<XACMLPolicy> getPolicy(Resource policyId) {
Optional<Cache<String, Policy>> cache = policyCache.getPolicyCache();
if (cache.isPresent()) {
if (cache.get().containsKey(policyId.stringValue())) {
Policy policy = cache.get().get(policyId.stringValue());
if (policy instanceof XACMLPolicy) {
return Optional.of(getBalanaPolicy((XACMLPolicy) policy));
}
}
}
Optional<BalanaPolicy> opt = optPolicyFromFile(policyId);
opt.ifPresent(policy -> cache.ifPresent(c -> c.put(policyId.stringValue(), policy)));
return opt.map(policy -> policy);
}
@Override
public void updatePolicy(XACMLPolicy newPolicy) {
PolicyFile policyFile = validatePolicy(newPolicy.getId());
try {
BalanaPolicy balanaPolicy = getBalanaPolicy(newPolicy);
IRI filePath = getRetrievalURL(policyFile);
VirtualFile virtualFileOld = vfs.resolveVirtualFile(filePath.stringValue());
if (!virtualFileOld.exists()) {
throw new IllegalStateException("Policy file does not exist");
}
VirtualFile virtualFileNew = vfs.resolveVirtualFile(balanaPolicy.toString().getBytes(), fileLocation);
LOG.debug("Updating policy file at " + filePath + " to file at " + virtualFileNew.getIdentifier());
setRelatedProperties(policyFile, balanaPolicy);
policyFile.setChecksum(getChecksum(balanaPolicy));
policyFile.setRetrievalURL(vf.createIRI(virtualFileNew.getIdentifier()));
policyFile.setFileName(virtualFileNew.getIdentifier() + ".xml");
if (!virtualFileNew.getIdentifier().equals(virtualFileOld.getIdentifier())) {
virtualFileOld.delete();
}
try (RepositoryConnection conn = repository.getConnection()) {
conn.clear(newPolicy.getId());
conn.add(policyFile.getModel(), newPolicy.getId());
}
policyCache.getPolicyCache()
.ifPresent(cache -> cache.replace(newPolicy.getId().stringValue(), balanaPolicy));
} catch (IOException e) {
throw new IllegalStateException("Could not save XACML Policy to disk due to: ", e);
}
}
@Override
public void deletePolicy(Resource policyId) {
PolicyFile policyFile = validatePolicy(policyId);
try {
IRI filePath = getRetrievalURL(policyFile);
LOG.debug("Removing policy file at " + filePath);
VirtualFile file = vfs.resolveVirtualFile(filePath.stringValue());
if (file.exists()) {
file.delete();
}
try (RepositoryConnection conn = repository.getConnection()) {
conn.clear(policyFile.getResource());
}
policyCache.getPolicyCache().ifPresent(cache -> cache.remove(policyId.stringValue()));
} catch (VirtualFilesystemException e) {
throw new IllegalStateException("Could not remove XACML Policy on disk due to: ", e);
}
}
@Override
public Repository getRepository() {
return this.repository;
}
private BalanaPolicy getBalanaPolicy(XACMLPolicy policy) {
if (policy instanceof BalanaPolicy) {
return (BalanaPolicy) policy;
} else {
return new BalanaPolicy(policy.toString(), vf);
}
}
private void validateUniqueId(XACMLPolicy policy) {
try (RepositoryConnection conn = repository.getConnection()) {
if (conn.contains(policy.getId(), null, null)) {
throw new IllegalArgumentException(policy.getId() + " already exists in the repository");
}
}
}
private PolicyFile validatePolicy(Resource policyId) {
try (RepositoryConnection conn = repository.getConnection()) {
return validatePolicy(policyId, conn);
}
}
private PolicyFile validatePolicy(Resource policyId, RepositoryConnection conn) {
if (!conn.contains(policyId, typeIRI, policyFileTypeIRI)) {
throw new IllegalArgumentException("Policy " + policyId + " does not exist");
}
Model policyModel = RepositoryResults.asModel(conn.getStatements(null, null, null, policyId), mf);
return policyFileFactory.getExisting(policyId, policyModel).orElseThrow(() ->
new IllegalStateException("PolicyFile not present in named graph"));
}
private Optional<PolicyFile> optPolicy(Resource policyId, RepositoryConnection conn) {
Model policyModel = RepositoryResults.asModel(conn.getStatements(null, null, null, policyId), mf);
return policyFileFactory.getExisting(policyId, policyModel);
}
private IRI getRetrievalURL(PolicyFile policyFile) {
return policyFile.getRetrievalURL().orElseThrow(() ->
new IllegalStateException("PolicyFile must have retrievalURL set"));
}
private String getFileName(PolicyFile policyFile) {
Optional<String> fileName = policyFile.getFileName();
return fileName.orElseGet(() -> FilenameUtils.getName(getRetrievalURL(policyFile).stringValue()));
}
private Optional<BalanaPolicy> optPolicyFromFile(Resource policyId) {
try (RepositoryConnection conn = repository.getConnection()) {
return optPolicyFromFile(policyId, conn);
}
}
private Optional<BalanaPolicy> optPolicyFromFile(Resource policyId, RepositoryConnection conn) {
return optPolicy(policyId, conn).map(file -> getPolicyFromFile(getRetrievalURL(file).stringValue()));
}
private BalanaPolicy getPolicyFromFile(Resource policyId, RepositoryConnection conn) {
return getPolicyFromFile(validatePolicy(policyId, conn));
}
private BalanaPolicy getPolicyFromFile(PolicyFile policyFile) {
return getPolicyFromFile(getRetrievalURL(policyFile).stringValue());
}
private BalanaPolicy getPolicyFromFile(String filePath) {
try {
return getPolicyFromFile(vfs.resolveVirtualFile(filePath));
} catch (IOException e) {
throw new IllegalStateException("Could not retrieve XACML Policy on disk due to: ", e);
}
}
private BalanaPolicy getPolicyFromFile(VirtualFile file) {
try {
if (file.isFile()) {
try (InputStream inputStream = file.readContent()) {
String policyStr = IOUtils.toString(inputStream);
return new BalanaPolicy(policyStr, vf);
}
}
throw new IllegalStateException("Policy could not be found on disk");
} catch (IOException e) {
throw new IllegalStateException("Could not retrieve XACML Policy on disk due to: ", e);
}
}
private void loadPolicies(BundleContext context) {
LOG.debug("Loading policies");
Optional<Cache<String, Policy>> cache = policyCache.getPolicyCache();
cache.ifPresent(Cache::clear);
try (RepositoryConnection conn = repository.getConnection()) {
VirtualFile directory = vfs.resolveVirtualFile(fileLocation);
// Initialize policies from within the bundle if they don't already exist
Bundle bundle = context.getBundle();
Enumeration<URL> urls = bundle.findEntries("/policies", "*.xml", true);
while (urls.hasMoreElements()) {
URL url = urls.nextElement();
String fileName = URLDecoder.decode(FilenameUtils.getName(url.getPath()), "UTF-8");
String fileId = FilenameUtils.removeExtension(URLDecoder.decode(fileName, "UTF-8"));
Resource fileIRI = vf.createIRI(fileId);
if (!conn.contains(fileIRI, null, null)) {
VirtualFile file = vfs.resolveVirtualFile(url.openStream(), fileLocation);
addPolicyFile(file, file.getIdentifier() + ".xml", getPolicyFromFile(file));
} else {
PolicyFile policy = validatePolicy(fileIRI);
VirtualFile file = vfs.resolveVirtualFile(policy.getRetrievalURL().toString());
if (!file.exists()) {
file = vfs.resolveVirtualFile(url.openStream(), fileLocation);
addPolicyFile(file, file.getIdentifier() + ".xml", getPolicyFromFile(file));
}
}
}
// Grab fileNames that are already in the repository
Set<String> fileNames = new HashSet<>();
conn.getStatements(null, typeIRI, policyFileTypeIRI).forEach(statement -> {
Resource policyIRI = statement.getSubject();
PolicyFile policyFile = validatePolicy(policyIRI);
fileNames.add(FilenameUtils.removeExtension(getFileName(policyFile)));
});
addMissingFilesToRepo(fileNames, directory);
conn.getStatements(null, typeIRI, policyFileTypeIRI).forEach(statement -> {
Resource policyIRI = statement.getSubject();
PolicyFile policyFile = validatePolicy(policyIRI);
BalanaPolicy policy = getPolicyFromFile(policyFile);
cache.ifPresent(c -> c.put(policyIRI.stringValue(), policy));
});
} catch (IOException e) {
throw new MobiException("Error initializing policy files due to: ", e);
}
}
private void addMissingFilesToRepo(Set<String> filePaths, VirtualFile baseFolder) throws VirtualFilesystemException {
for (VirtualFile file : baseFolder.getChildren()) {
if (file.isFolder()) {
addMissingFilesToRepo(filePaths, file);
} else if (!filePaths.contains(file.getIdentifier())) {
BalanaPolicy balanaPolicy = getPolicyFromFile(file);
addPolicyFile(file, file.getIdentifier() + ".xml", balanaPolicy);
}
}
}
private void setRelatedProperties(PolicyFile policyFile, BalanaPolicy policy) {
Set<IRI> relatedResources = new HashSet<>();
Set<IRI> relatedSubjects = new HashSet<>();
Set<IRI> relatedActions = new HashSet<>();
PolicyType policyType = policy.getJaxbPolicy();
TargetType targetType = policyType.getTarget();
if (targetType != null) {
targetType.getAnyOf().forEach(anyOfType ->
anyOfType.getAllOf().forEach(allOfType -> allOfType.getMatch().forEach(matchType -> {
AttributeDesignatorType attributeDesignator = matchType.getAttributeDesignator();
String value = matchType.getAttributeValue().getContent().get(0).toString();
switch (attributeDesignator.getAttributeId()) {
case XACML.RESOURCE_ID:
relatedResources.add(vf.createIRI(value));
break;
case XACML.SUBJECT_ID:
relatedSubjects.add(vf.createIRI(value));
break;
case XACML.ACTION_ID:
relatedActions.add(vf.createIRI(value));
break;
default:
}
})));
}
policyFile.setRelatedResource(relatedResources);
policyFile.setRelatedSubject(relatedSubjects);
policyFile.setRelatedAction(relatedActions);
}
private PolicyFile addPolicyFile(VirtualFile file, String fileName, BalanaPolicy balanaPolicy)
throws VirtualFilesystemException {
PolicyFile policyFile = policyFileFactory.createNew(balanaPolicy.getId());
policyFile.setRetrievalURL(vf.createIRI(file.getIdentifier()));
policyFile.setSize((double) file.getSize());
policyFile.setFileName(fileName);
policyFile.setChecksum(getChecksum(balanaPolicy));
setRelatedProperties(policyFile, balanaPolicy);
try (RepositoryConnection conn = repository.getConnection()) {
conn.remove(policyFile.getResource(), null, null);
conn.add(policyFile.getModel(), policyFile.getResource());
}
policyCache.getPolicyCache().ifPresent(cache ->
cache.put(policyFile.getResource().stringValue(), balanaPolicy));
return policyFile;
}
private String getChecksum(BalanaPolicy policy) {
try {
MessageDigest digest = MessageDigest.getInstance("SHA-256");
byte[] hash = digest.digest(policy.toString().getBytes());
return new String(hash, "UTF-8");
} catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
throw new MobiException(e);
}
}
}
| [
"fer.madeiral@gmail.com"
] | fer.madeiral@gmail.com |
a797931fc8a15d09cc36b12b7065b25898e0890d | 844474886b85d4183c4afcb90ef6a2075835b5fc | /9.4PersonalJavaWeb/src/club/banyuan/servlet/SearchDeptServlet.java | fca0adb6d6dbb168c6679b760ab835c0a294baae | [] | no_license | cloudy-cyber/JavaEE | 3352410a52de72bc392dda619469b471e31865f8 | e9e6edca1aa15950534ab65b814f3409c895edf4 | refs/heads/master | 2022-12-21T14:29:13.409785 | 2020-09-18T08:31:45 | 2020-09-18T08:31:45 | 284,983,206 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,714 | java | package club.banyuan.servlet;
import club.banyuan.pojo.Department;
import club.banyuan.service.DepartmentService;
import club.banyuan.service.impl.DepartmentServiceImpl;
import com.alibaba.fastjson.JSONObject;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@WebServlet(name = "SearchDeptServlet", urlPatterns = "/dept/list")
public class SearchDeptServlet extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
DepartmentService departmentService = new DepartmentServiceImpl();
response.setContentType("text/html; charset=UTF-8");
try {
List<Department> departmentList = departmentService.getDepartment();
System.out.println(departmentList);
Map<String, Object> map = new HashMap<>();
map.put("total", departmentList.size());
map.put("code", 0);
map.put("rows", departmentList);
String string = JSONObject.toJSONString(map);
PrintWriter writer = response.getWriter();
writer.print(string);
writer.flush();
writer.close();
} catch (Exception e) {
e.printStackTrace();
}
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response);
}
}
| [
"1191130744@qq.com"
] | 1191130744@qq.com |
654f6db1df21e22c0267586c152d903c15ee9961 | cf64ff59a0292500d65d69fcfb0b42d7e4dba9d8 | /samples/powerPoint/build/src/ppt/OCXExtenderEvents.java | 6f0fbbbb989546bd604293322e0dd9289acd782e | [
"BSD-2-Clause"
] | permissive | nosdod/CDWriterJava | 0bb3db2e68278c445b78afc665731e058dc42ea4 | 7146689889d8d50d7162b21ea0b98fc5c2364306 | refs/heads/main | 2023-09-06T01:32:33.614647 | 2021-11-23T15:14:42 | 2021-11-23T15:14:42 | 431,142,538 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 261 | java | package ppt ;
import com4j.*;
@IID("{914934C1-5A91-11CF-8700-00AA0060263B}")
public interface OCXExtenderEvents extends Com4jObject {
// Methods:
/**
*/
@VTID(7)
void gotFocus();
/**
*/
@VTID(8)
void lostFocus();
// Properties:
}
| [
"mark.dodson@dodtech.co.uk"
] | mark.dodson@dodtech.co.uk |
e835c3d421c7ccf19d07086623345cd07da769a2 | 57f484bc51709d7debd56c949e4037a5966b6c5b | /grid/connect/ConnectService.java | 33cc4f12bd973392e04b945481ccf09eb8fd1d23 | [] | no_license | xiangmujbl/adf2 | a8c8eb5524b63e3a01fffdf25a45d3bd5e5de53d | cb6a2914633f93ed82cfbe778925e5b904d589c0 | refs/heads/master | 2020-03-22T17:02:14.618445 | 2018-10-19T02:05:19 | 2018-10-19T02:05:19 | 140,368,043 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 464 | java | package com.jnj.adf.dataservice.adfcoreignite.grid.connect;
public abstract interface ConnectService
{
public abstract boolean connect(String paramString1, String paramString2);
public abstract boolean isConnect(String paramString);
}
/* Location: C:\Users\jliu315\repository\com\jnj\adf\adf-core\0.3.04\adf-core-0.3.04.jar!\com\jnj\adf\grid\connect\ConnectService.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 0.7.1
*/ | [
"15151326922@163.com"
] | 15151326922@163.com |
1e16a183010f160f7c1a26f0c3ed67474ec5b1ed | 7a59674f00b9b6a9b6ca3baa0eca5679f16b566a | /demo-data-jpa/src/main/java/demo/service/ReviewRepository.java | 206dd591951cc632ee03f63feaf0037b476f405d | [
"Apache-2.0"
] | permissive | crsmejia93/spring-boot-samples | d8ae2ebb5dd449a25eb19b6fb53d88fae3902e8b | d4d43f131fa576c3dc7a036568ada5fdbddcec7d | refs/heads/master | 2020-06-01T13:01:55.821348 | 2019-06-07T20:08:39 | 2019-06-07T20:08:39 | 190,788,185 | 0 | 0 | Apache-2.0 | 2019-06-07T18:06:17 | 2019-06-07T18:06:17 | null | UTF-8 | Java | false | false | 1,057 | java | /*
* Copyright 2012-2013 the original author or authors.
*
* 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 demo.service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.Repository;
import demo.domain.Hotel;
import demo.domain.Review;
interface ReviewRepository extends Repository<Review, Long> {
Page<Review> findByHotel(Hotel hotel, Pageable pageable);
Review findByHotelAndIndex(Hotel hotel, int index);
Review save(Review review);
}
| [
"jose.diaz@joedayz.pe"
] | jose.diaz@joedayz.pe |
328da6076864db92f706d8bbee4ada7948a8e0be | f3e6c412ad97e108eb5978e60dbac2dddb442084 | /src/main/java/za/co/tman/billing/enums/enumwrappers/IncidentPriorityDeserializer.java | 2b24ab4700d4c61d4ec71fc0ee20db4c15406bc5 | [] | no_license | kappaj2/IMN-BillingModule | 6a333e92cd91413a108f2270eb3071996b65e128 | ab8a73954c28557fce3195cb85c71b27be9b841d | refs/heads/master | 2020-03-20T22:38:08.545184 | 2018-07-24T07:44:28 | 2018-07-24T07:44:28 | 137,807,756 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,004 | java | package za.co.tman.billing.enums.enumwrappers;
import java.io.IOException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.ObjectCodec;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonNode;
import za.co.tman.billing.enums.IncidentPriority;
public class IncidentPriorityDeserializer extends JsonDeserializer<IncidentPriority> {
@Override
public IncidentPriority deserialize(JsonParser jsonParser, DeserializationContext ctxt) throws IOException {
ObjectCodec oc = jsonParser.getCodec();
JsonNode node = oc.readTree(jsonParser);
if (node == null) {
return null;
}
String text = node.get("priority_code").textValue();
if (text == null) {
return null;
}
return IncidentPriority.findIncidentPriority(text);
}
}
| [
"kappaj@gmail.com"
] | kappaj@gmail.com |
bf87e2decc86dc9f5f6cdbc4b390a12b87a0f5a8 | df8ffbf9e80b7635ca5c0089cd348fdccb2d09fd | /day1013/MethodOverloadingTest06.java | ef719792c3233e1e663c835c5eede60207f02ba2 | [] | no_license | MegiLove/javaStudy | 39c1eb6b5b8ac507893468e213c87001ff29b259 | 9c0e8c61838bc745c63f510cf4b3f4c98b9fd8c2 | refs/heads/main | 2023-08-29T07:45:03.249131 | 2021-10-15T08:50:42 | 2021-10-15T08:50:42 | 411,869,936 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 550 | java | class SistUtil
{
public static int sum(int data[])
{
int sum=0;
int arr[]= data;
for(int i=0; i<arr.length; i++)
{
sum+=arr[i];
}
return sum;
}
public static double sum(double data[])
{ double sum=0;
double arr[]=data;
for(int i=0; i<arr.length; i++)
{
sum+=arr[i];
}
return sum;
}
}
class MethodOverloadingTest06
{
public static void main(String[] args)
{
int a[]= {1,2,3,4,5};
double b[]= {1.2,3.3,4.2};
System.out.println(SistUtil.sum(a));
System.out.println(SistUtil.sum(b));
}
}
| [
"ibisevic@naver.com"
] | ibisevic@naver.com |
00ec988225e98c31ee489dad5c18525861b3330b | 47252198ca0dca179b60cf761057341994ba6d20 | /umeng_libs/src/com/umeng/comm/ui/adapters/FeedImageAdapter.java | 43a2e2844c16cbcfe135d56c970e68756427a2d7 | [] | no_license | lnczx/meijia-yxz-android | 31156daf065245b0ed9899786f1f3acff63f170c | 1757d5800b5b8de281d9b94f69279e56fa0eaff8 | refs/heads/master | 2021-04-22T11:51:05.778283 | 2016-08-19T10:44:10 | 2016-08-19T10:44:10 | 57,012,678 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,617 | java | /*
* The MIT License (MIT)
*
* Copyright (c) 2014-2015 Umeng, Inc
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.umeng.comm.ui.adapters;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView.LayoutParams;
import android.widget.ImageView.ScaleType;
import com.umeng.comm.core.beans.ImageItem;
import com.umeng.comm.core.imageloader.ImgDisplayOption;
import com.umeng.comm.core.utils.ResFinder;
import com.umeng.comm.core.utils.ResFinder.ResType;
import com.umeng.comm.ui.adapters.viewholders.NullViewParser;
import com.umeng.comm.ui.imagepicker.adapters.CommonAdapter;
import com.umeng.comm.ui.imagepicker.widgets.SquareImageView;
/**
* 消息流九宫格图片的Adapter
*/
public class FeedImageAdapter extends CommonAdapter<ImageItem, NullViewParser> {
private ImgDisplayOption mDisplayOption = new ImgDisplayOption();
/**
* 构造函数
*
* @param context
*/
public FeedImageAdapter(Context context) {
super(context);
initDisplayOption();
}
@Override
protected NullViewParser createViewHolder() {
return new NullViewParser();
}
/**
* 初始化显示的图片跟配置</br>
*/
private void initDisplayOption() {
mDisplayOption.mLoadingResId = ResFinder.getResourceId(ResType.DRAWABLE,
"umeng_comm_not_found");
mDisplayOption.mLoadFailedResId = ResFinder.getResourceId(ResType.DRAWABLE,
"umeng_comm_not_found");
}
@Override
public int getCount() {
int count = super.getCount();
return count > 9 ? 9 : count;
}
// 此处不用ViewParser的方式,主要是只有ImageView且都需要设置Tag(ViewHolder跟图片的url地址,导致冲突)
@Override
public View getView(int position, View view, ViewGroup parent) {
SquareImageView imageView;
if (view == null) {
LayoutParams mImageViewLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT
, ViewGroup.LayoutParams.MATCH_PARENT);
imageView = new SquareImageView(mContext);
imageView.setScaleType(ScaleType.CENTER_CROP);
imageView.setLayoutParams(mImageViewLayoutParams);
} else {
imageView = (SquareImageView) view;
}
imageView.setImageUrl(getItem(position).thumbnail, mDisplayOption);
return imageView;
}
@Override
protected void setItemData(int position, NullViewParser holder, View rootView) {
}
}
| [
"kerryg@yeah.net"
] | kerryg@yeah.net |
213fb4ccebe7682dac688655657aa8a46cc04077 | c9479b2e04a986670318f0c8bc2c03f67cd2f7eb | /leetcode/0-250/035-constructRectangle.java | 4aa0125285f887ec812cb5e296f897e2a311afc8 | [
"MIT"
] | permissive | nurnisi/algorithms-and-data-structures | 419b7025d2d245f7fecd1b8daf7b5e1dcb41cdbf | 577c0225b1d4aff091d60489920f3a95afb660bd | refs/heads/master | 2023-08-23T10:14:24.065487 | 2019-10-31T20:22:45 | 2019-10-31T20:22:45 | 65,622,984 | 26 | 7 | MIT | 2019-10-07T10:30:16 | 2016-08-13T15:11:05 | Java | UTF-8 | Java | false | false | 151 | java | public static int[] constructRectangle(int area) {
int n = (int) Math.sqrt(area);
while(area % n != 0) n--;
return new int[]{area/n, n};
}
| [
"esenov7@gmail.com"
] | esenov7@gmail.com |
5d8f9e333aad422e049d725b990e05f6c03a3125 | 2eed37d6f29fe10c8e6ed1ebc9c0de0c0a2fd02c | /src/test/java/models/AnimalTest.java | f1ad06464bbed49a9fb094a33d2f83b1b173ad4f | [
"MIT"
] | permissive | Abel-b/Atse-Wild | 2724a50c34e2f2eee2881d752f9a10807447d03a | dc7fa92ba1719439d7ff5d36ed08252654b01a40 | refs/heads/master | 2020-09-15T03:09:20.343192 | 2019-11-26T13:26:09 | 2019-11-26T13:26:09 | 223,333,731 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 295 | java | package models;
import org.junit.After;
import org.junit.Before;
import static org.junit.Assert.*;
public class AnimalTest {
@Before
public void setUp() throws Exception {
// Animal animal = new Animal();
}
@After
public void tearDown() throws Exception {
}
} | [
"abelberhane011@gmail.com"
] | abelberhane011@gmail.com |
8dceb53a5014a5b385bc149274124372aec57f55 | ac890db04a6748f60a18f7317941a70dab3909be | /CS325/src/utils/DSUtils.java | c4ef5423cd1ff84cfef84aea444e992b9a2c0502 | [] | no_license | knt102000/cs325Projects | 2ede3733c0c9913df244ca0ba2012c4f7822c996 | c461f879240667e0464d919555e2a5f00e879f64 | refs/heads/master | 2020-04-06T03:53:01.322778 | 2015-03-02T05:38:48 | 2015-03-02T05:40:09 | 29,660,538 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 850 | java | package utils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import cs325.classifier.StringFeature;
public class DSUtils {
@SuppressWarnings("unchecked")
static public <T>List<T> createList(T... keys) {
List<T> list=new ArrayList<>(keys.length);
for (T key:keys) list.add(key);
return list;
}
static public <T extends Comparable<T>>List<T> getBestList(List<T> list) {
List<T> best=new ArrayList<>();
T max=Collections.max(list);
for (T key:list) if (key.compareTo(max)==0) best.add(key);
return best;
}
static public List<StringFeature> createFeatureVector(String... typeValue) {
List<StringFeature> features=new ArrayList<>();
int len=typeValue.length;
for (int i=0;i<len;i+=2) features.add(new StringFeature(typeValue[i],typeValue[i+1]));
return features;
}
}
| [
"ctsui3@emory.edu"
] | ctsui3@emory.edu |
2a0f04667c743b97129ada7ddfc24a2458192ed4 | 19711b18c28763c1ca9c68a6c017806e78eca334 | /src/main/java/com/demo/encode/result/EncodeResult.java | 6aa3ab599cc385de7775eb7acba30276c54977ce | [] | no_license | universalMachine/encoder | 125747ed3cbdc25cfb05f5df99a0dea125ffd34d | bb931053e534fb8fb16563a8b402882adc2cd23c | refs/heads/master | 2020-03-16T17:42:35.715502 | 2018-05-10T03:34:29 | 2018-05-10T03:34:29 | 132,843,712 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 713 | java | package com.demo.encode.result;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
public class EncodeResult {
/**
* 表示编码成功或失败
*/
private Integer statusCode;
/**
* 编码的结果,如果编码失败则是空字符串
*/
private String encodeResult;
public EncodeResult() {
}
public Integer getStatusCode() {
return statusCode;
}
public void setStatusCode(Integer statusCode) {
this.statusCode = statusCode;
}
public String getEncodeResult() {
return encodeResult;
}
public void setEncodeResult(String encodeResult) {
this.encodeResult = encodeResult;
}
}
| [
"xiaokeaiabao@126.com"
] | xiaokeaiabao@126.com |
03dd9d5ca12767bc5b054c208197c15b3babf98b | e04318bab858eb83c6257287d58d794deae5a25d | /app/build/tmp/kapt3/stubs/debug/com/raywenderlich/android/droidwiki/dagger/NetworkModule.java | eabfe88850efdb4c0074b47d142606d3821de5c3 | [] | no_license | Honey14/wiki-pedia-dagger | 0fd2754a1d8692e8a965d4c49f61e59933020c24 | b1b9ef15d5f84d1bec841bebce08d583d954d657 | refs/heads/master | 2022-12-23T04:00:44.189979 | 2020-07-20T15:19:00 | 2020-07-20T15:19:00 | 280,614,575 | 2 | 0 | null | 2020-07-18T08:54:29 | 2020-07-18T08:26:30 | null | UTF-8 | Java | false | false | 3,030 | java | package com.raywenderlich.android.droidwiki.dagger;
import java.lang.System;
@kotlin.Metadata(mv = {1, 1, 16}, bv = {1, 0, 3}, k = 1, d1 = {"\u0000(\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\b\u0007\u0018\u0000 \u000e2\u00020\u0001:\u0001\u000eB\u0005\u00a2\u0006\u0002\u0010\u0002J\b\u0010\u0003\u001a\u00020\u0004H\u0007J\b\u0010\u0005\u001a\u00020\u0006H\u0007J\u0014\u0010\u0007\u001a\u0004\u0018\u00010\b2\b\b\u0001\u0010\t\u001a\u00020\u0004H\u0007J\u001a\u0010\n\u001a\u00020\u000b2\u0006\u0010\f\u001a\u00020\u00062\b\u0010\r\u001a\u0004\u0018\u00010\bH\u0007\u00a8\u0006\u000f"}, d2 = {"Lcom/raywenderlich/android/droidwiki/dagger/NetworkModule;", "", "()V", "provideBaseUrlString", "", "provideHttpClient", "Lokhttp3/OkHttpClient;", "provideRequestBuilder", "Lokhttp3/HttpUrl$Builder;", "baseUrl", "provideWikiApi", "Lcom/raywenderlich/android/droidwiki/network/WikiApi;", "okHttpClient", "requestBuilder", "Companion", "app_debug"})
@dagger.Module()
public final class NetworkModule {
private static final java.lang.String BASE_URL = "NAME_BASE_URL";
public static final com.raywenderlich.android.droidwiki.dagger.NetworkModule.Companion Companion = null;
@org.jetbrains.annotations.NotNull()
@javax.inject.Named(value = "NAME_BASE_URL")
@dagger.Provides()
public final java.lang.String provideBaseUrlString() {
return null;
}
@org.jetbrains.annotations.NotNull()
@javax.inject.Singleton()
@dagger.Provides()
public final okhttp3.OkHttpClient provideHttpClient() {
return null;
}
@org.jetbrains.annotations.Nullable()
@javax.inject.Singleton()
@dagger.Provides()
public final okhttp3.HttpUrl.Builder provideRequestBuilder(@org.jetbrains.annotations.NotNull()
@javax.inject.Named(value = "NAME_BASE_URL")
java.lang.String baseUrl) {
return null;
}
@org.jetbrains.annotations.NotNull()
@javax.inject.Singleton()
@dagger.Provides()
public final com.raywenderlich.android.droidwiki.network.WikiApi provideWikiApi(@org.jetbrains.annotations.NotNull()
okhttp3.OkHttpClient okHttpClient, @org.jetbrains.annotations.Nullable()
okhttp3.HttpUrl.Builder requestBuilder) {
return null;
}
public NetworkModule() {
super();
}
@kotlin.Metadata(mv = {1, 1, 16}, bv = {1, 0, 3}, k = 1, d1 = {"\u0000\u0012\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002\u00a2\u0006\u0002\u0010\u0002R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082T\u00a2\u0006\u0002\n\u0000\u00a8\u0006\u0005"}, d2 = {"Lcom/raywenderlich/android/droidwiki/dagger/NetworkModule$Companion;", "", "()V", "BASE_URL", "", "app_debug"})
public static final class Companion {
private Companion() {
super();
}
}
} | [
"honeysonwani88@gmail.com"
] | honeysonwani88@gmail.com |
3615e167593cf6b858b30e88c47098276cdfbf4b | d43a41079529348ffb737c5f0b2dcd9a14573ec7 | /Java-Web-Basics/Exams/Torshia/jsp/src/main/java/torshia/service/ReportServiceImpl.java | a055d3cc7e15e25accf8e45133e6fea4f38e6113 | [
"MIT"
] | permissive | IvayloIV/Java | 4688071e052c1a11179306f6464492286fbf0a88 | 00952f83f43ea8d8b300fcc762c2dae458dc5860 | refs/heads/master | 2022-12-04T01:13:20.175961 | 2022-09-28T21:11:38 | 2022-09-28T21:11:38 | 192,743,500 | 0 | 1 | MIT | 2022-11-24T09:54:29 | 2019-06-19T14:00:10 | Java | UTF-8 | Java | false | false | 2,507 | java | package torshia.service;
import org.modelmapper.ModelMapper;
import torshia.domain.entities.Report;
import torshia.domain.enums.ReportStatus;
import torshia.domain.models.services.ReportServiceModel;
import torshia.domain.models.services.TaskServiceModel;
import torshia.domain.models.services.UserServiceModel;
import torshia.repository.ReportRepository;
import torshia.repository.TaskRepository;
import torshia.repository.UserRepository;
import javax.inject.Inject;
import java.util.Date;
import java.util.List;
import java.util.Random;
import java.util.stream.Collectors;
public class ReportServiceImpl implements ReportService {
private ModelMapper modelMapper;
private ReportRepository reportRepository;
private UserRepository userRepository;
private TaskRepository taskRepository;
private Random random;
@Inject
public ReportServiceImpl(ModelMapper modelMapper,
ReportRepository reportRepository,
UserRepository userRepository,
TaskRepository taskRepository,
Random random) {
this.modelMapper = modelMapper;
this.reportRepository = reportRepository;
this.userRepository = userRepository;
this.taskRepository = taskRepository;
this.random = random;
}
@Override
public Boolean createReport(String userId, String taskId) {
TaskServiceModel taskModel = this.modelMapper
.map(this.taskRepository.getById(taskId), TaskServiceModel.class);
UserServiceModel userModel = this.modelMapper
.map(this.userRepository.getById(userId), UserServiceModel.class);
ReportServiceModel report = new ReportServiceModel();
report.setReportedOn(new Date());
report.setReporter(userModel);
report.setTask(taskModel);
report.setStatus(this.generateStatus());
return this.reportRepository.save(this.modelMapper.map(report, Report.class));
}
@Override
public List<ReportServiceModel> getAll() {
return this.reportRepository.getAll()
.stream()
.map(r -> this.modelMapper.map(r, ReportServiceModel.class))
.collect(Collectors.toList());
}
private ReportStatus generateStatus() {
int num = this.random.nextInt(100) + 1;
if (num <= 75) {
return ReportStatus.Completed;
}
return ReportStatus.Archived;
}
}
| [
"ivvo98@abv.bg"
] | ivvo98@abv.bg |
e5c071d2a0b9e922647dd772b83b690312150c72 | 36de8dd09c8281624faf450fd8986353b8f6b793 | /src/osmedile/intellij/stringmanip/sort/tokens/TokenLine.java | 2c72f36780bb31e6361e7ed3d4117b4c39cd39dd | [
"Apache-2.0"
] | permissive | tan9/StringManipulation | 49bf6856741158992494b6265ae8315804beb498 | 0129602dc688b0cc44932346a5c3567edb0bed5b | refs/heads/master | 2023-03-20T23:26:45.189745 | 2021-03-06T02:38:24 | 2021-03-06T08:17:30 | 263,498,735 | 0 | 0 | Apache-2.0 | 2020-05-13T01:53:52 | 2020-05-13T01:53:51 | null | UTF-8 | Java | false | false | 3,806 | java | package osmedile.intellij.stringmanip.sort.tokens;
import org.jetbrains.annotations.NotNull;
import osmedile.intellij.stringmanip.align.FixedStringTokenScanner;
import osmedile.intellij.stringmanip.sort.support.SimpleSortable;
import osmedile.intellij.stringmanip.sort.support.SortSettings;
import osmedile.intellij.stringmanip.utils.StringUtil;
import java.util.*;
public class TokenLine {
private final String originalText;
private final SortSettings sortSettings;
private final String[] split;
private Set<String> separators;
private SortTokensModel model;
public TokenLine(String originalText, SortTokensModel model) {
this.originalText = originalText;
this.sortSettings = model.getSortSettings();
separators = new HashSet<>(model.getSeparators());
this.model = model;
String[] separators = model.getSeparators().toArray(new String[0]);
if (separators.length == 1 && separators[0].equals(" ")) {
split = StringUtil.splitToTokensBySpace(originalText).toArray(new String[0]);
} else {
split = FixedStringTokenScanner.splitToFixedStringTokensAndOtherTokens(originalText, -1, separators).toArray(new String[0]);
}
//should start with token, and end with token
// if (split.length>1 && split.length % 2 == 0) {
// throw new IllegalStateException("bug, report this, split.length="+split.length+"; "+split);
// }
}
public String getSortedText() {
List<String> strings = sortTokens();
StringBuilder sb = new StringBuilder();
for (String s : strings) {
sb.append(s);
}
return sb.toString();
}
private List<String> sortTokens() {
List<SimpleSortable> lines = new ArrayList<>();
for (int i = 0, splitLength = split.length; i < splitLength; i++) {
if (isSeparator(split[i])) {
continue;
}
String token = split[i];
String textForComparison = token;
if (sortSettings.isIgnoreLeadingSpaces()) {
textForComparison = token.substring(StringUtil.indexOfAnyButWhitespace(token));
}
if (model.isIgnoreEmptyTokens() && token.trim().length() == 0) {
continue;
}
lines.add(new SimpleSortable(token, textForComparison));
}
List<SimpleSortable> sorted = sortSettings.getSortType().sortLines(lines, sortSettings.getBaseComparator(), sortSettings.getCollatorLanguageTag());
Iterator<SimpleSortable> sortedIterator = sorted.iterator();
List<String> strings = replaceTokens2(sortedIterator);
if (sortedIterator.hasNext()) {
strings.add(sortedIterator.next().getText());
}
return strings;
}
private boolean isSeparator(String s) {
return separators.contains(s);
}
@NotNull
private List<String> replaceTokens2(Iterator<SimpleSortable> sortedIterator) {
List<String> strings = new ArrayList<>();
for (int i = 0; i < split.length; i++) {
if (!isSeparator(split[i])) {
if (model.isIgnoreEmptyTokens() && split[i].trim().length() == 0) {
strings.add(split[i]);
continue;
}
String resultToken = sortedIterator.next().getText();
// if (sortSettings.isPreserveLeadingSpaces()) {
int oldContentStartIndex = StringUtil.indexOfAnyButWhitespace(split[i]);
int newContentStartIndex = StringUtil.indexOfAnyButWhitespace(resultToken);
String oldContentLeadingSpaces = split[i].substring(0, oldContentStartIndex);
String newActualContent = resultToken.substring(newContentStartIndex, resultToken.length());
resultToken = oldContentLeadingSpaces + newActualContent;
// }
strings.add(resultToken);
} else {
strings.add(split[i]);
}
}
return strings;
}
public String[] getSplit() {
return split;
}
public String replaceTokens(Iterator<SimpleSortable> iterator) {
List<String> strings = replaceTokens2(iterator);
StringBuilder sb = new StringBuilder();
for (String s : strings) {
sb.append(s);
}
return sb.toString();
}
}
| [
"vojta.krasa@gmail.com"
] | vojta.krasa@gmail.com |
848263b4702aa6b0f64be62f1ec6afeaaf540970 | cad4f947dbb6f1ef7f6d531aaf725ec4b8c7986e | /arcusApp/app/src/main/java/arcus/app/device/pairing/post/controller/AddToFavoritesFragmentController.java | 7fa28ecdead780d7355cee33f98d3b5ff4fda4e8 | [
"Apache-2.0"
] | permissive | pupper68k/arcusandroid | 324e3abbd2f3e789431c7dcac1d495c262702179 | 50e0a6d71609bf404353da80d8e620584cc818d3 | refs/heads/master | 2020-07-28T17:23:04.035283 | 2019-02-28T17:52:25 | 2019-02-28T17:52:25 | 209,477,977 | 0 | 0 | Apache-2.0 | 2019-09-19T06:24:01 | 2019-09-19T06:24:00 | null | UTF-8 | Java | false | false | 4,257 | java | /*
* Copyright 2019 Arcus Project.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package arcus.app.device.pairing.post.controller;
import android.app.Activity;
import com.google.common.collect.ImmutableSet;
import arcus.cornea.provider.DeviceModelProvider;
import com.iris.client.capability.Capability;
import com.iris.client.event.Listener;
import com.iris.client.model.DeviceModel;
import arcus.app.common.controller.FragmentController;
import arcus.app.common.utils.GlobalSetting;
public class AddToFavoritesFragmentController extends FragmentController<AddToFavoritesFragmentController.Callbacks> {
public interface Callbacks {
void onSuccess();
void onFailure(Throwable cause);
}
private Activity activity;
private static final AddToFavoritesFragmentController instance = new AddToFavoritesFragmentController();
private AddToFavoritesFragmentController () {}
public static AddToFavoritesFragmentController getInstance () { return instance; }
public void setIsFavorite (Activity activity, String deviceAddress, final boolean isFavorite) {
this.activity = activity;
// Load the device model
DeviceModelProvider.instance().getModel(deviceAddress).load().onSuccess(new Listener<DeviceModel>() {
@Override
public void onEvent(DeviceModel deviceModel) {
// ... and add or remove the favorite tag
if (isFavorite) {
addFavoriteTag(deviceModel);
} else {
removeFavoriteTag(deviceModel);
}
}
}).onFailure(new Listener<Throwable>() {
@Override
public void onEvent(Throwable throwable) {
fireOnFailure(throwable);
}
});
}
private void addFavoriteTag (DeviceModel deviceModel) {
deviceModel.addTags(ImmutableSet.of(GlobalSetting.FAVORITE_TAG)).onSuccess(new Listener<Capability.AddTagsResponse>() {
@Override
public void onEvent(Capability.AddTagsResponse addTagsResponse) {
fireOnSuccess();
}
}).onFailure(new Listener<Throwable>() {
@Override
public void onEvent(Throwable throwable) {
fireOnFailure(throwable);
}
});
}
private void removeFavoriteTag (DeviceModel deviceModel) {
deviceModel.removeTags(ImmutableSet.of(GlobalSetting.FAVORITE_TAG)).onSuccess(new Listener<Capability.RemoveTagsResponse>() {
@Override
public void onEvent(Capability.RemoveTagsResponse removeTagsResponse) {
fireOnSuccess();
}
}).onFailure(new Listener<Throwable>() {
@Override
public void onEvent(Throwable throwable) {
fireOnFailure(throwable);
}
});
}
private void fireOnSuccess() {
if (activity != null) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
Callbacks listener = getListener();
if (listener != null) {
listener.onSuccess();
}
}
});
}
}
private void fireOnFailure(final Throwable throwable) {
if (activity != null) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
Callbacks listener = getListener();
if (listener != null) {
listener.onFailure(throwable);
}
}
});
}
}
}
| [
"b@yoyo.com"
] | b@yoyo.com |
a142cb9f213e72cadb5a0690c07ae5ac361b62ce | e1a90b9eadbb2ee78c545033ef354ea9ca902b75 | /src/ru/nsu/ccfit/pm/econ/controller/player/LocalState.java | ea31f4685c040e3bc856cd9ba0b81fe6c48d53a5 | [] | no_license | orfest/happypiggy | 85fdf893efbcd6cb1ce743cda29785b8d4bc1656 | 0b9e1e82f84132123a9a68eefef444ad2bfd4e08 | refs/heads/master | 2020-12-24T13:28:55.496725 | 2010-09-24T03:41:56 | 2010-09-24T03:41:56 | 32,205,173 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,246 | java | package ru.nsu.ccfit.pm.econ.controller.player;
import java.util.Date;
import java.util.TimeZone;
import com.google.gag.annotation.remark.Magic;
import com.google.gag.enumeration.MagicType;
import com.google.inject.Inject;
import com.google.inject.name.Named;
import ru.nsu.ccfit.pm.econ.common.controller.player.IULocalState;
import ru.nsu.ccfit.pm.econ.common.controller.scenario.IUScenarioProperties;
import ru.nsu.ccfit.pm.econ.common.engine.data.IUGameTime;
import ru.nsu.ccfit.pm.econ.common.engine.roles.IUPersonDescription;
import ru.nsu.ccfit.pm.econ.common.engine.roles.IUPlayer;
import ru.nsu.ccfit.pm.econ.common.engine.roles.IUStudent;
import ru.nsu.ccfit.pm.econ.common.engine.roles.IUTeacher;
import ru.nsu.ccfit.pm.econ.controller.player.data.GameTime;
import ru.nsu.ccfit.pm.econ.controller.player.data.ScenarioProperties;
import ru.nsu.ccfit.pm.econ.controller.player.roles.PersonDescription;
import ru.nsu.ccfit.pm.econ.controller.player.roles.Player;
import ru.nsu.ccfit.pm.econ.controller.player.roles.Student;
import ru.nsu.ccfit.pm.econ.controller.player.roles.Teacher;
/**
* Holds local to PlayerController state.
* @see IULocalState
* @see IModifiableLocalState
*
* @author dragonfly
*/
public class LocalState implements IULocalState, IModifiableLocalState {
private boolean insideServer = false;
private Player player = new Player();
private int turnNumber = 0;
private boolean turnFinished = true;
private Date turnStartTime = new Date();
private ScenarioProperties scenarioProperties;
@Inject
@Override
public void setInsideServer(@Named("isInsideServer") boolean isServer) {
insideServer = isServer;
}
@Override
public boolean isInsideServer() {
return insideServer;
}
@Override
public PersonDescription getModifiableMineDescription() {
return player.getPersonDescription();
}
@Override
public void setMineDescription(PersonDescription pd) {
player.setPersonDescription(pd);
}
@Override
public IUPersonDescription getMineDescription() {
return player.getUnmodifiablePersonDescription();
}
@Override
public void setMineId(long newId) {
player.setId(newId);
}
@Override
public long getMineId() {
return player.getId();
}
@Override
public IUPlayer getPlayer() {
return (IUPlayer)player;
}
@Override
public IUStudent getPlayerAsStudent() {
return (IUStudent)player;
}
@Override
public IUTeacher getPlayerAsTeacher() {
return (IUTeacher)player;
}
@Override
public Player getModifiablePlayer() {
return player;
}
@Override
public Student getModifiablePlayerAsStudent() {
return (Student)player;
}
@Override
public Teacher getModifiablePlayerAsTeacher() {
return (Teacher)player;
}
@Override
public void setPlayer(Player player) {
this.player = player;
}
@Override
@Magic(type=MagicType.VOODOO)
// OK, using Date objects for time offsets turned out
// to be quite a wrong idea...
public Date getTimeSinceTurnStart() {
// Beware: weird things may happen if game is played
// at night during DST transitions.
Date now = new Date();
long nt = now.getTime();
long st = turnStartTime.getTime();
long diff = nt - st;
int offset = TimeZone.getDefault().getOffset(st);
return new Date(diff - offset);
}
@Override
public int getTurnNumber() {
return turnNumber;
}
@Override
public boolean isTurnFinished() {
return turnFinished;
}
@Override
public void setTurnFinished(boolean isFinished) {
this.turnFinished = isFinished;
}
@Override
public void setTurnNumber(int newTurnNumber) {
if (this.turnNumber != newTurnNumber) {
turnStartTime = new Date();
}
this.turnNumber = newTurnNumber;
}
@Override
public IUGameTime getCurrentGameTime() {
return new GameTime(getTimeSinceTurnStart(), getTurnNumber(), isTurnFinished());
}
@Override
public IUScenarioProperties getScenarioProperties() {
return scenarioProperties;
}
@Override
public void setScenarioProperties(IUScenarioProperties scenarioProperties) {
this.scenarioProperties = new ScenarioProperties(scenarioProperties);
}
}
| [
"nkurtov@98a6e77e-0b7b-74f5-35af-b87a7c0ac467"
] | nkurtov@98a6e77e-0b7b-74f5-35af-b87a7c0ac467 |
9bccab766695e15e24f47404e8371ebe05063df4 | 61a5afc31de290a527dfbf0552c852577a706b7b | /plugin/src/main/java/me/scana/okgradle/internal/dsl/api/java/JavaModel.java | ec88c0c9bc16dd902a3dc53ec028f89805082117 | [
"Apache-2.0"
] | permissive | scana/ok-gradle | 892ca48e019a774d1c72cad556f8d14b2c3bebd9 | 7ecbade228ea8f055eead30e18f4c3b4d244d2de | refs/heads/master | 2023-09-04T10:39:08.921797 | 2021-01-10T19:11:04 | 2021-01-10T19:11:04 | 107,177,226 | 727 | 34 | Apache-2.0 | 2021-01-09T15:07:27 | 2017-10-16T20:05:45 | Java | UTF-8 | Java | false | false | 811 | java | /*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.scana.okgradle.internal.dsl.api.java;
import me.scana.okgradle.internal.dsl.api.android.BaseCompileOptionsModel;
public interface JavaModel extends BaseCompileOptionsModel {
}
| [
"scanarch@gmail.com"
] | scanarch@gmail.com |
a04a044eee4038ffb598b4c4feefbb04c587ffe4 | 4a9b12103c506d93de7956e2d97e0e09663981d1 | /TSP/src/SA/City.java | c65d2f45263d3d849770308901ba992ed9030dc1 | [] | no_license | abdullah-ming/algorithm | f3dfa94e5e961a4235edda7381774dac1cac5da0 | e6d0db17e4a1a1eb217738a945c86989af242c21 | refs/heads/master | 2021-07-18T12:47:36.414840 | 2020-05-22T14:37:52 | 2020-05-22T14:37:52 | 154,482,566 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 650 | java | package SA;
public class City {
public City(){
}
public City(float x,float y){
this.x = x;
this.y = y;
}
// private int num;
private float x;
private float y;
public float getX() {
return x;
}
public void setX(float x) {
this.x = x;
}
public float getY() {
return y;
}
public void setY(float y) {
this.y = y;
}
public double distanceTo(City city){
float xDistance = Math.abs(getX() - city.getX());
float yDistance = Math.abs(getY() - city.getY());
double distance = Math.sqrt( (xDistance*xDistance) + (yDistance*yDistance) );
return distance;
}
}
| [
"826479138@qq.com"
] | 826479138@qq.com |
6a68eacea5632e6f70054e8c046a2cd2c8ad8065 | 4bfe39028fffcad8d87192514ac717f98fc375c5 | /RocketStatsCore/src/gamerscreed/rocketstats/model/test/MatchResultPlayerDAOTest.java | 6eed5433aba27416756be14f187994c8972975af | [] | no_license | ChustaSoft/GamersCreed | 855b6063efe23e9ad31c401c29e46c6ef43274cd | 99c99f29560ba4d35db16a37dc9dd005575c5b1d | refs/heads/master | 2021-10-11T00:22:46.619161 | 2019-01-19T17:43:46 | 2019-01-19T17:43:46 | 55,869,687 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,314 | java | package gamerscreed.rocketstats.model.test;
import static org.junit.Assert.assertEquals;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import gamerscreed.rocketstats.model.entities.MatchResultPlayer;
import gamerscreed.rocketstats.model.test.interfaces.CoreDaoTestInterface;
import gamerscreed.rocketstats.model.test.utilities.MatchTestHelper;
public class MatchResultPlayerDAOTest implements CoreDaoTestInterface<MatchResultPlayer>{
private MatchTestHelper matchTestHelper;
@Before
public void initTestClass(){
matchTestHelper = new MatchTestHelper();
}
@After
public void endTestClass(){
}
@Test
public void savingRightMatchResultPlayer() {
MatchResultPlayer testMatchResultPlayer = matchTestHelper.getMatchResultPlayer_OK();
boolean tmpResponse = matchTestHelper.saveTestMatchResultPlayer(testMatchResultPlayer);
assertEquals("Saving right MatchResultPlayer", true, tmpResponse);
}
@Test
public void savingWrongMatchResultPlayer() {
MatchResultPlayer testMatchResultPlayer = matchTestHelper.getMatchResultPlayer_KO();
boolean tmpResponse = matchTestHelper.saveTestMatchResultPlayer(testMatchResultPlayer);
assertEquals("Saving wrong MatchResultPlayer", false, tmpResponse);
}
}
| [
"javiru87@gmail.com"
] | javiru87@gmail.com |
eb5c3234e0be4636a61e65601043e679207ea343 | 868d17c3d3f97ea43259966f01b8926ce5a546e4 | /service-rest/src/test/java/com/epam/gpipko/service/rest/ProjectServiceRestTest.java | c5e0b701b2d70d20bc246962136689b5d02e6a9e | [] | no_license | Brest-Java-Course-2021/gpipko | 3f847d6b1f09d4a807c2a44552eaa07f34bbbfc1 | 337ac85dcb51ba91d3ab069211a6b5969513c562 | refs/heads/main | 2023-04-09T03:15:46.088210 | 2021-04-18T16:17:21 | 2021-04-18T16:17:21 | 333,511,710 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,998 | java | package com.epam.gpipko.service.rest;
import com.epam.gpipko.Project;
import com.epam.gpipko.ProjectService;
import com.epam.gpipko.service.rest.config.TestConfig;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.lang3.RandomStringUtils;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.web.client.ExpectedCount;
import org.springframework.test.web.client.MockRestServiceServer;
import org.springframework.web.client.RestTemplate;
import java.net.URI;
import java.time.LocalDate;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import static com.epam.gpipko.service.rest.config.TestConfig.PROJECTS_URL;
import static org.junit.jupiter.api.Assertions.*;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.method;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
import static org.springframework.test.web.client.response.MockRestResponseCreators.withStatus;
@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = TestConfig.class)
class ProjectServiceRestTest {
private static final Logger LOGGER = LoggerFactory.getLogger(ProjectServiceRestTest.class);
@Autowired
RestTemplate restTemplate;
@Autowired
ProjectService projectService;
private MockRestServiceServer mockServer;
private ObjectMapper mapper = new ObjectMapper();
@BeforeEach
public void before() {
mockServer = MockRestServiceServer.createServer(restTemplate);
}
@Test
public void shouldFindAllProjects() throws Exception {
LOGGER.debug("shouldFindAllProjects()");
// given
mockServer.expect(ExpectedCount.once(), requestTo(new URI(PROJECTS_URL)))
.andExpect(method(HttpMethod.GET))
.andRespond(withStatus(HttpStatus.OK)
.contentType(MediaType.APPLICATION_JSON)
.body(mapper.writeValueAsString(Arrays.asList(
createProject(0, LocalDate.of(2021,01,01)),
createProject(1, LocalDate.of(2021,02,02)))))
);
// when
List<Project> projects = projectService.findAll();
// then
mockServer.verify();
assertNotNull(projects);
assertTrue(projects.size() > 0);
}
@Test
public void shouldCreateProject() throws Exception {
LOGGER.debug("shouldCreateProject()");
// given
Project project = new Project(RandomStringUtils.randomAlphabetic(255),
LocalDate.of(2021,03,03));
mockServer.expect(ExpectedCount.once(), requestTo(new URI(PROJECTS_URL)))
.andExpect(method(HttpMethod.POST))
.andRespond(withStatus(HttpStatus.OK)
.contentType(MediaType.APPLICATION_JSON)
.body(mapper.writeValueAsString("1"))
);
// when
Integer id = projectService.create(project);
// then
mockServer.verify();
assertNotNull(id);
}
@Test
public void shouldFindProjectById() throws Exception {
// given
Integer id = 1;
Project project = new Project(RandomStringUtils.randomAlphabetic(255),
LocalDate.of(2021,04,04));
project.setProjectId(id);
mockServer.expect(ExpectedCount.once(), requestTo(new URI(PROJECTS_URL + "/" + id)))
.andExpect(method(HttpMethod.GET))
.andRespond(withStatus(HttpStatus.OK)
.contentType(MediaType.APPLICATION_JSON)
.body(mapper.writeValueAsString(project))
);
// when
Optional<Project> optionalProject = projectService.findById(id);
// then
mockServer.verify();
assertTrue(optionalProject.isPresent());
assertEquals(optionalProject.get().getProjectId(), id);
assertEquals(optionalProject.get().getProjectName(), project.getProjectName());
assertEquals(optionalProject.get().getCreationDate(), project.getCreationDate());
}
@Test
public void shouldUpdateProject() throws Exception {
// given
Integer id = 1;
Project project = new Project(RandomStringUtils.randomAlphabetic(255),
LocalDate.of(2021,05,05));
project.setProjectId(id);
mockServer.expect(ExpectedCount.once(), requestTo(new URI(PROJECTS_URL)))
.andExpect(method(HttpMethod.PUT))
.andRespond(withStatus(HttpStatus.OK)
.contentType(MediaType.APPLICATION_JSON)
.body(mapper.writeValueAsString("1"))
);
mockServer.expect(ExpectedCount.once(), requestTo(new URI(PROJECTS_URL + "/" + id)))
.andExpect(method(HttpMethod.GET))
.andRespond(withStatus(HttpStatus.OK)
.contentType(MediaType.APPLICATION_JSON)
.body(mapper.writeValueAsString(project))
);
// when
int result = projectService.update(project);
Optional<Project> updatedProjectOptional = projectService.findById(id);
// then
mockServer.verify();
assertTrue(1 == result);
assertTrue(updatedProjectOptional.isPresent());
assertEquals(updatedProjectOptional.get().getProjectId(), id);
assertEquals(updatedProjectOptional.get().getProjectName(), project.getProjectName());
assertEquals(updatedProjectOptional.get().getCreationDate(), project.getCreationDate());
}
@Test
public void shouldDeleteProject() throws Exception {
// given
Integer id = 1;
mockServer.expect(ExpectedCount.once(), requestTo(new URI(PROJECTS_URL + "/" + id)))
.andExpect(method(HttpMethod.DELETE))
.andRespond(withStatus(HttpStatus.OK)
.contentType(MediaType.APPLICATION_JSON)
.body(mapper.writeValueAsString("1"))
);
// when
int result = projectService.delete(id);
// then
mockServer.verify();
assertTrue(1 == result);
}
private Project createProject(int id, LocalDate date) {
Project project = new Project();
project.setProjectId(id);
project.setProjectName("p" + id);
project.setCreationDate(date);
return project;
}
} | [
"frotyk1@gmail.com"
] | frotyk1@gmail.com |
fa5f3cfa65a74f1a75ea89cf42255f7984ebe831 | 5636586629217a2a75be87b44df926b144633ce0 | /service-feign/src/main/java/com/lptree/servicefeign/ServiceFeignApplication.java | b33bbf77aacddd01bc3cd7b414241f2297b16137 | [] | no_license | lptree/spring-cloud-test | 5fc8d909757126bba7da9800c07db01a8a4744e4 | e39f0d4c1510738009b2d5b748a0403b0b9cbf4c | refs/heads/master | 2020-03-11T09:26:29.924571 | 2018-05-06T16:10:31 | 2018-05-06T16:10:31 | 129,911,020 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 507 | java | package com.lptree.servicefeign;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
public class ServiceFeignApplication {
public static void main(String[] args) {
SpringApplication.run(ServiceFeignApplication.class, args);
}
}
| [
"lphnl1@163.com"
] | lphnl1@163.com |
5390d3b57ad2d54d50ca8268f000f8359dcf08e4 | 850c81f763359af0a21961c2a2363df0651e2df1 | /tutorial/src/main/java/com/ss/service/impl/UserServiceImpl.java | 5175cbbc207ada844a3b1fad89688de261317656 | [] | no_license | surbhissaxena/tutorial | daad6c9c3eaaac5b1465bc4499468a5a49c092c5 | 6477dfe62a19d90f33a8bd46330d28baf1922bb8 | refs/heads/master | 2020-03-29T12:27:45.896280 | 2018-09-22T18:25:46 | 2018-09-22T18:25:46 | 149,898,282 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,467 | java | package com.ss.service.impl;
import com.ss.dao.UserDAO;
import com.ss.dao.impl.UserDAOImpl;
import com.ss.dto.UserDTO;
import com.ss.service.UserService;
import com.ss.util.DBResponse;
import com.ss.util.PasswordGenerator;
public class UserServiceImpl implements UserService {
UserDAO userDAO = new UserDAOImpl();
public DBResponse getAllUserData() throws Exception {
return userDAO.getAllUserData();
}
public DBResponse registerUser(UserDTO dto) throws Exception {
try {
dto.setUserPassword(PasswordGenerator.generateRandomPassword());
} catch (Exception e) {
e.printStackTrace();
}
return userDAO.addUser(dto);
}
public DBResponse getUserById(UserDTO dto) throws Exception {
// TODO Auto-generated method stub
return userDAO.getUserById(dto);
}
public DBResponse getUserByName(UserDTO dto) throws Exception {
return userDAO.getUserByName(dto);
}
public DBResponse deleteUserById(UserDTO dto) throws Exception {
// TODO Auto-generated method stub
return userDAO.deleteUserById(dto);
}
public DBResponse updateUser(UserDTO dto) throws Exception {
// TODO Auto-generated method stub
return userDAO.updateUser(dto);
}
public DBResponse authenticateUser(UserDTO dto) throws Exception {
DBResponse dbResponse = new DBResponse();
try {
dbResponse = userDAO.getUserByEmailAndPassword(dto);
} catch (Exception e) {
e.printStackTrace();
}
return dbResponse;
}
public DBResponse getUserByUserName(UserDTO dto) throws Exception {
// TODO Auto-generated method stub
return userDAO.getUserByUserName(dto);
}
public DBResponse searchUser(UserDTO dto) throws Exception {
return userDAO.searchUser(dto);
}
public DBResponse searchUserByUsingPrePaidStatement(UserDTO dto) throws Exception {
// TODO Auto-generated method stub
return userDAO.searchUserByUsingPrePaidStatement(dto);
}
@Override
public DBResponse updateUserPasswordToken(UserDTO dto) throws Exception {
// TODO Auto-generated method stub
return userDAO.updateUserPasswordToken(dto);
}
@Override
public DBResponse updateUserResetPassword(UserDTO dto) throws Exception {
// TODO Auto-generated method stub
return userDAO.updateUserResetPassword(dto);
}
@Override
public DBResponse getUserRecordByPagination(int start, int total) throws Exception {
// TODO Auto-generated method stub
return userDAO.getUserRecordByPagination(start, total);
}
@Override
public DBResponse userResetPassword(UserDTO dto) throws Exception {
// TODO Auto-generated method stub
return userDAO.userResetPassword(dto);
}
@Override
public DBResponse getAllOperator() throws Exception {
// TODO Auto-generated method stub
return userDAO.getAllOperator();
}
@Override
public DBResponse getAllStudent() throws Exception {
// TODO Auto-generated method stub
return userDAO.getAllStudent();
}
@Override
public DBResponse aboutMe(UserDTO dto) throws Exception {
// TODO Auto-generated method stub
return userDAO.aboutMe(dto);
}
@Override
public DBResponse getUserByEmail(UserDTO dto) throws Exception {
// TODO Auto-generated method stub
return userDAO.getUserByEmail(dto);
}
@Override
public DBResponse verifyUserForPasswordReset(UserDTO dto) throws Exception {
// TODO Auto-generated method stub
return userDAO.getUserByEmailAndToken(dto);
}
}
| [
"sur.saxena16@gmail.com"
] | sur.saxena16@gmail.com |
f549491e0305d4ebdba3649f0262ac5ce51d3ec8 | c60086e4147310ccc43ed1b127ca3e645fa62e57 | /code/src/fromaman/TreeTest.java | a8c067b1c0c03ae5acb4e8a009cdfd21d355cadc | [] | no_license | sachinmaheshwari/code-practice | a6a48bd527857ce067f2ba4b14b01ed900de02e9 | c059699811069a272c958ada47cf6066b45ab154 | refs/heads/master | 2021-12-09T06:22:16.992256 | 2021-11-08T11:26:39 | 2021-11-08T11:26:39 | 40,038,820 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 920 | java | package fromaman;
import java.io.IOException;
public class TreeTest {
/**
* @param args
*/
public static void main(String[] args) {
//Created a tree
Tree tree = new Tree("a");
//Added Child
tree.addChild("b");
tree.addChild("c");
//Added child of child
Tree child = new Tree("d");
tree.getChildAt(1).addChild(child);
//Tree Traversal
tree.traverse();
//Tree serialization
//format is
//parent:[child1,child2,] and next line
//child1(as parent):[child1's child1:child1's child2,] and so on
String fileName = "gur.txt";
try {
tree.serialize(fileName);
} catch (IOException e) {
e.printStackTrace();
}
//Tree de-serialization
Tree deserializedTree = null;
try {
deserializedTree = tree.deserialize(fileName);
} catch (IOException e) {
e.printStackTrace();
}
//Traversing de-serialized tree
deserializedTree.traverse();
}
}
| [
"sachin.maheshwari8@gmail.com"
] | sachin.maheshwari8@gmail.com |
e58f6c0bed7b4a54991d9f3ed1d491cbe9f72510 | 3bf8c61a201ff4a982ee42f580e0092ca8cc4e2d | /src/main/java/Test/DuoTai.java | 10cdd1bdab39385509bb1db876a02d3e94076073 | [] | no_license | codeauthorization/ConcurrentNote | 95c341db499dba762eec1a51fc31daf94aeb1124 | c289e73b26a77ff1c2f12fbbfe75db9da1b239a2 | refs/heads/master | 2022-06-22T03:47:47.211397 | 2019-10-14T12:27:11 | 2019-10-14T12:27:11 | 205,340,269 | 0 | 0 | null | 2022-06-21T01:46:42 | 2019-08-30T08:33:56 | Java | UTF-8 | Java | false | false | 767 | java | package Test;
public class DuoTai extends Girl{
@Override
public Integer getPublicInt() {
return super.getPublicInt();
}
public static Integer getStaticInt() {
return 2;
}
public static void main(String[] args) {
Girl duoTai = new DuoTai();
Integer publicInt = duoTai.getPublicInt();
System.out.println(publicInt);
System.out.println(DuoTai.num);
System.out.println(getStaticInt());
System.out.println(duoTai.getStaticInt());
}
}
class Girl {
public static Integer num = 2;
private Integer getInt() {
return num;
}
public static Integer getStaticInt() {
return 1;
}
public Integer getPublicInt() {
return num;
}
}
| [
"ayang818@qq.com"
] | ayang818@qq.com |
d5a0f53a77ce885daa2846cde335a614c8eaca32 | 0ca28fa577f5f7a2c0ee1eb9edd613fe5917d34b | /WEB_MOTEL/src/com/slook/converter/BaseConverter.java | 40573dd53fcf03d7a6337cdb038b49e87933eb4b | [] | no_license | vietnv5/motel-project | 88fbe567a53f172ef93c7f53092e06e094b89de9 | 7b228bc1b13359ecfac8c78e49f9c8bb2e3f5d85 | refs/heads/master | 2023-03-12T19:05:22.379540 | 2019-05-01T15:25:57 | 2019-05-01T15:25:57 | 174,317,540 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,035 | 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.slook.converter;
import com.slook.util.DataUtil;
import java.io.Serializable;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.util.List;
import java.util.logging.Level;
import javax.faces.component.UIComponent;
import javax.faces.component.UISelectItem;
import javax.faces.component.UISelectItems;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* @author vietnv14
* @see dung de lua chon gia trị ngay tại list cua combox; chi su dung cho combobox , KHONG THE su dung cho autocompleted
*/
public abstract class BaseConverter<T extends Serializable> implements Converter {
protected static final Logger logger = LoggerFactory.getLogger(BaseConverter.class);
public abstract String getFieldId();
private Class<T> domainClass;
private Method getMethodId() {
try {
java.lang.reflect.Type genericSuperclass = getClass().getGenericSuperclass();
this.domainClass = (Class<T>) ((ParameterizedType) genericSuperclass).getActualTypeArguments()[0];
Method methods = domainClass.getMethod(DataUtil.getGetterOfColumn(getFieldId()));
return methods;
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return null;
}
@Override
public Object getAsObject(FacesContext arg0, UIComponent arg1, String arg2) {
T ret = null;
UIComponent src = arg1;
Method methods = getMethodId();
if (src != null) {
List<UIComponent> childs = src.getChildren();
UISelectItems itens = null;
if (childs != null) {
for (UIComponent ui : childs) {
if (ui instanceof UISelectItems) {
itens = (UISelectItems) ui;
break;
} else if (ui instanceof UISelectItem) {
UISelectItem item = (UISelectItem) ui;
try {
T val = (T) item.getItemValue();
Object value = methods.invoke(val);
if (value != null && arg2.equals("" + value)) {
ret = val;
break;
}
} catch (Exception e) {
logger.debug(e.getMessage(), e);
}
}
}
}
if (itens != null) {
List<T> values = (List<T>) itens.getValue();
if (values != null) {
for (T val : values) {
try {
Object value = methods.invoke(val);
if (value != null && arg2.equals("" + value)) {
ret = val;
break;
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
}
}
}
return ret;
}
@Override
public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2) {
String ret = "";
Method methods = getMethodId();
if (arg2 != null) {
try {
T m = (T) arg2;
ret += methods.invoke(m);
} catch (Exception e) {
java.util.logging.Logger.getLogger(BaseConverter.class.getName()).log(Level.INFO, null, e);
}
}
return ret;
}
}
| [
"vietnv@1d7999a0-bdfd-47d3-b774-009da9be2ac5"
] | vietnv@1d7999a0-bdfd-47d3-b774-009da9be2ac5 |
763db752bac7f0e8afbc4a3e3324e3471563a4ee | 40e2ce65c8c929a8237b9b83392bf1c0a86c995b | /src/day39/CarMaker.java | 4e3d9d4c20c5b3e857f54481ddf059e242623ef6 | [] | no_license | abrahamhope/CybertekJavaClasses | f65816bceb2e4f35a9ce12e399f136e375e1c4d7 | acdf6aa59d79ab900f59e8bd8982addea192dff7 | refs/heads/master | 2020-11-27T22:26:01.044451 | 2020-02-23T21:47:40 | 2020-02-23T21:47:40 | 229,625,040 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 509 | java | package day39;
public class CarMaker {
public static void main(String[] args) {
Car c1=new Car();
c1.model="corolla";
c1.year=2018;
c1.make="toyota";
c1.color="green";
System.out.println(c1.year+" "+c1.color+" "+c1.make+" "+c1.model+" ");
Car c2=new Car();
c2.model="avalon";
c2.year=2018;
c2.make="toyota";
c2.color="black";
System.out.println(c2.year+" "+c2.color+" "+c2.make+" "+c2.model+" ");
}
}
| [
"abrahamisaachope@gmai.com"
] | abrahamisaachope@gmai.com |
6fec38b8def56c203c1ce1e0c626b2f40ba4c0f2 | 956a88098bd8180239ba00fae9f1c1e61a8b985e | /src/main/java/com/example/security/role/UserRole.java | c41c6e50c2f00757e18171a4d1dbdebaac9c80ab | [] | no_license | valchanov/Spring-Security-with-JWT | 29a35a031554548e442e8c87b3a31a52c02478fe | 3919a00f8e6bbb2938685bdcbfe407320059c4e1 | refs/heads/main | 2023-03-08T14:00:30.018610 | 2021-02-23T15:34:31 | 2021-02-23T15:34:31 | 307,378,453 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 222 | java | package com.example.security.role;
public enum UserRole {
ROLE_USER,
ROLE_ADMIN,
ROLE_ANONYMOUS;
public String forSecurity() {
return this.name()
.replace("ROLE_", "");
}
}
| [
"georgi.buyukliev@accedia.com"
] | georgi.buyukliev@accedia.com |
dd152626da8fd2a8a98d282c69a87e7aeb8a8164 | a20f447b6368ad342f40fc47f47aa2dc29b9f65e | /app/src/main/java/xyz/tfti/app/SyncAdapter.java | 3ee62a364d8fdd2c2c2790ff52bc9a0e8da2efa2 | [] | no_license | yjimmyy/tfti-android | 1790e3b50e53b5c3f5c17c01d3cc84d7296b8e9f | 834756b8b8b370a596428e6718c32e9b274160ba | refs/heads/master | 2021-01-19T08:16:06.444007 | 2016-02-21T07:19:25 | 2016-02-21T07:19:25 | 42,151,340 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,301 | java | package xyz.tfti.app;
import android.accounts.Account;
import android.content.AbstractThreadedSyncAdapter;
import android.content.ContentProviderClient;
import android.content.ContentResolver;
import android.content.Context;
import android.content.SyncResult;
import android.os.Bundle;
import android.util.Log;
/**
* Created by jimmy on 9/11/2015.
*/
public class SyncAdapter extends AbstractThreadedSyncAdapter {
public final static String KEY_REFRESH = "refresh";
public final static String KEY_SPOTS_UPDATED = "spotsUpdated";
ContentResolver contentResolver;
private Context context;
public SyncAdapter(Context context, boolean autoInitialize) {
super(context, autoInitialize);
this.context = context;
contentResolver = context.getContentResolver();
}
public SyncAdapter(Context context, boolean autoInitialize, boolean allowParallelSyncs) {
super(context, autoInitialize, allowParallelSyncs);
this.context = context;
contentResolver = context.getContentResolver();
}
public void onPerformSync(Account account, Bundle extras, String authority,
ContentProviderClient provider, SyncResult syncResult) {
Log.d("main", "SyncAdapter sync");
new SyncHelper(context).startSync(extras);
}
}
| [
"yjimmyy@gmail.com"
] | yjimmyy@gmail.com |
2317c75a6ed43801005643c0bbecfbb7ebc6b1ff | ff5107cf2f495b2a07329cdf7190ff6469a1a834 | /apps/microservices/ad/src/test/java/com/adloveyou/ms/ad/web/rest/MediaTargetResourceIntTest.java | b5f8334291cce4c5c4532fc90bb967c0d9ef33aa | [] | no_license | icudroid/addonf-microservice | 596e341cf282e1190c3752f6adf5a2c210976032 | db9e80617b206ff3c1122e56f3c6de14e555692e | refs/heads/master | 2021-05-09T02:15:47.863941 | 2018-01-27T20:29:48 | 2018-01-27T20:29:48 | 119,200,152 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,709 | java | package com.adloveyou.ms.ad.web.rest;
import com.adloveyou.ms.ad.AdApp;
import com.adloveyou.ms.ad.config.SecurityBeanOverrideConfiguration;
import com.adloveyou.ms.ad.domain.MediaTarget;
import com.adloveyou.ms.ad.repository.MediaTargetRepository;
import com.adloveyou.ms.ad.service.MediaTargetService;
import com.adloveyou.ms.ad.repository.search.MediaTargetSearchRepository;
import com.adloveyou.ms.ad.service.dto.MediaTargetDTO;
import com.adloveyou.ms.ad.service.mapper.MediaTargetMapper;
import com.adloveyou.ms.web.rest.TestUtil;
import com.adloveyou.ms.web.rest.errors.ExceptionTranslator;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.MockitoAnnotations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.EntityManager;
import java.util.List;
import static com.adloveyou.ms.web.rest.TestUtil.createFormattingConversionService;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.hasItem;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
import com.adloveyou.ms.ad.domain.enumeration.AdMediaType;
/**
* Test class for the MediaTargetResource REST controller.
*
* @see MediaTargetResource
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = {AdApp.class, SecurityBeanOverrideConfiguration.class})
public class MediaTargetResourceIntTest {
private static final AdMediaType DEFAULT_MEDIA_TYPE = AdMediaType.WEB;
private static final AdMediaType UPDATED_MEDIA_TYPE = AdMediaType.MOBILE;
@Autowired
private MediaTargetRepository mediaTargetRepository;
@Autowired
private MediaTargetMapper mediaTargetMapper;
@Autowired
private MediaTargetService mediaTargetService;
@Autowired
private MediaTargetSearchRepository mediaTargetSearchRepository;
@Autowired
private MappingJackson2HttpMessageConverter jacksonMessageConverter;
@Autowired
private PageableHandlerMethodArgumentResolver pageableArgumentResolver;
@Autowired
private ExceptionTranslator exceptionTranslator;
@Autowired
private EntityManager em;
private MockMvc restMediaTargetMockMvc;
private MediaTarget mediaTarget;
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
final MediaTargetResource mediaTargetResource = new MediaTargetResource(mediaTargetService);
this.restMediaTargetMockMvc = MockMvcBuilders.standaloneSetup(mediaTargetResource)
.setCustomArgumentResolvers(pageableArgumentResolver)
.setControllerAdvice(exceptionTranslator)
.setConversionService(createFormattingConversionService())
.setMessageConverters(jacksonMessageConverter).build();
}
/**
* Create an entity for this test.
*
* This is a static method, as tests for other entities might also need it,
* if they test an entity which requires the current entity.
*/
public static MediaTarget createEntity(EntityManager em) {
MediaTarget mediaTarget = new MediaTarget()
.mediaType(DEFAULT_MEDIA_TYPE);
return mediaTarget;
}
@Before
public void initTest() {
mediaTargetSearchRepository.deleteAll();
mediaTarget = createEntity(em);
}
@Test
@Transactional
public void createMediaTarget() throws Exception {
int databaseSizeBeforeCreate = mediaTargetRepository.findAll().size();
// Create the MediaTarget
MediaTargetDTO mediaTargetDTO = mediaTargetMapper.toDto(mediaTarget);
restMediaTargetMockMvc.perform(post("/api/media-targets")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(mediaTargetDTO)))
.andExpect(status().isCreated());
// Validate the MediaTarget in the database
List<MediaTarget> mediaTargetList = mediaTargetRepository.findAll();
assertThat(mediaTargetList).hasSize(databaseSizeBeforeCreate + 1);
MediaTarget testMediaTarget = mediaTargetList.get(mediaTargetList.size() - 1);
assertThat(testMediaTarget.getMediaType()).isEqualTo(DEFAULT_MEDIA_TYPE);
// Validate the MediaTarget in Elasticsearch
MediaTarget mediaTargetEs = mediaTargetSearchRepository.findOne(testMediaTarget.getId());
assertThat(mediaTargetEs).isEqualToIgnoringGivenFields(testMediaTarget);
}
@Test
@Transactional
public void createMediaTargetWithExistingId() throws Exception {
int databaseSizeBeforeCreate = mediaTargetRepository.findAll().size();
// Create the MediaTarget with an existing ID
mediaTarget.setId(1L);
MediaTargetDTO mediaTargetDTO = mediaTargetMapper.toDto(mediaTarget);
// An entity with an existing ID cannot be created, so this API call must fail
restMediaTargetMockMvc.perform(post("/api/media-targets")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(mediaTargetDTO)))
.andExpect(status().isBadRequest());
// Validate the MediaTarget in the database
List<MediaTarget> mediaTargetList = mediaTargetRepository.findAll();
assertThat(mediaTargetList).hasSize(databaseSizeBeforeCreate);
}
@Test
@Transactional
public void checkMediaTypeIsRequired() throws Exception {
int databaseSizeBeforeTest = mediaTargetRepository.findAll().size();
// set the field null
mediaTarget.setMediaType(null);
// Create the MediaTarget, which fails.
MediaTargetDTO mediaTargetDTO = mediaTargetMapper.toDto(mediaTarget);
restMediaTargetMockMvc.perform(post("/api/media-targets")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(mediaTargetDTO)))
.andExpect(status().isBadRequest());
List<MediaTarget> mediaTargetList = mediaTargetRepository.findAll();
assertThat(mediaTargetList).hasSize(databaseSizeBeforeTest);
}
@Test
@Transactional
public void getAllMediaTargets() throws Exception {
// Initialize the database
mediaTargetRepository.saveAndFlush(mediaTarget);
// Get all the mediaTargetList
restMediaTargetMockMvc.perform(get("/api/media-targets?sort=id,desc"))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.[*].id").value(hasItem(mediaTarget.getId().intValue())))
.andExpect(jsonPath("$.[*].mediaType").value(hasItem(DEFAULT_MEDIA_TYPE.toString())));
}
@Test
@Transactional
public void getMediaTarget() throws Exception {
// Initialize the database
mediaTargetRepository.saveAndFlush(mediaTarget);
// Get the mediaTarget
restMediaTargetMockMvc.perform(get("/api/media-targets/{id}", mediaTarget.getId()))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.id").value(mediaTarget.getId().intValue()))
.andExpect(jsonPath("$.mediaType").value(DEFAULT_MEDIA_TYPE.toString()));
}
@Test
@Transactional
public void getNonExistingMediaTarget() throws Exception {
// Get the mediaTarget
restMediaTargetMockMvc.perform(get("/api/media-targets/{id}", Long.MAX_VALUE))
.andExpect(status().isNotFound());
}
@Test
@Transactional
public void updateMediaTarget() throws Exception {
// Initialize the database
mediaTargetRepository.saveAndFlush(mediaTarget);
mediaTargetSearchRepository.save(mediaTarget);
int databaseSizeBeforeUpdate = mediaTargetRepository.findAll().size();
// Update the mediaTarget
MediaTarget updatedMediaTarget = mediaTargetRepository.findOne(mediaTarget.getId());
// Disconnect from session so that the updates on updatedMediaTarget are not directly saved in db
em.detach(updatedMediaTarget);
updatedMediaTarget
.mediaType(UPDATED_MEDIA_TYPE);
MediaTargetDTO mediaTargetDTO = mediaTargetMapper.toDto(updatedMediaTarget);
restMediaTargetMockMvc.perform(put("/api/media-targets")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(mediaTargetDTO)))
.andExpect(status().isOk());
// Validate the MediaTarget in the database
List<MediaTarget> mediaTargetList = mediaTargetRepository.findAll();
assertThat(mediaTargetList).hasSize(databaseSizeBeforeUpdate);
MediaTarget testMediaTarget = mediaTargetList.get(mediaTargetList.size() - 1);
assertThat(testMediaTarget.getMediaType()).isEqualTo(UPDATED_MEDIA_TYPE);
// Validate the MediaTarget in Elasticsearch
MediaTarget mediaTargetEs = mediaTargetSearchRepository.findOne(testMediaTarget.getId());
assertThat(mediaTargetEs).isEqualToIgnoringGivenFields(testMediaTarget);
}
@Test
@Transactional
public void updateNonExistingMediaTarget() throws Exception {
int databaseSizeBeforeUpdate = mediaTargetRepository.findAll().size();
// Create the MediaTarget
MediaTargetDTO mediaTargetDTO = mediaTargetMapper.toDto(mediaTarget);
// If the entity doesn't have an ID, it will be created instead of just being updated
restMediaTargetMockMvc.perform(put("/api/media-targets")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(mediaTargetDTO)))
.andExpect(status().isCreated());
// Validate the MediaTarget in the database
List<MediaTarget> mediaTargetList = mediaTargetRepository.findAll();
assertThat(mediaTargetList).hasSize(databaseSizeBeforeUpdate + 1);
}
@Test
@Transactional
public void deleteMediaTarget() throws Exception {
// Initialize the database
mediaTargetRepository.saveAndFlush(mediaTarget);
mediaTargetSearchRepository.save(mediaTarget);
int databaseSizeBeforeDelete = mediaTargetRepository.findAll().size();
// Get the mediaTarget
restMediaTargetMockMvc.perform(delete("/api/media-targets/{id}", mediaTarget.getId())
.accept(TestUtil.APPLICATION_JSON_UTF8))
.andExpect(status().isOk());
// Validate Elasticsearch is empty
boolean mediaTargetExistsInEs = mediaTargetSearchRepository.exists(mediaTarget.getId());
assertThat(mediaTargetExistsInEs).isFalse();
// Validate the database is empty
List<MediaTarget> mediaTargetList = mediaTargetRepository.findAll();
assertThat(mediaTargetList).hasSize(databaseSizeBeforeDelete - 1);
}
@Test
@Transactional
public void searchMediaTarget() throws Exception {
// Initialize the database
mediaTargetRepository.saveAndFlush(mediaTarget);
mediaTargetSearchRepository.save(mediaTarget);
// Search the mediaTarget
restMediaTargetMockMvc.perform(get("/api/_search/media-targets?query=id:" + mediaTarget.getId()))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.[*].id").value(hasItem(mediaTarget.getId().intValue())))
.andExpect(jsonPath("$.[*].mediaType").value(hasItem(DEFAULT_MEDIA_TYPE.toString())));
}
@Test
@Transactional
public void equalsVerifier() throws Exception {
TestUtil.equalsVerifier(MediaTarget.class);
MediaTarget mediaTarget1 = new MediaTarget();
mediaTarget1.setId(1L);
MediaTarget mediaTarget2 = new MediaTarget();
mediaTarget2.setId(mediaTarget1.getId());
assertThat(mediaTarget1).isEqualTo(mediaTarget2);
mediaTarget2.setId(2L);
assertThat(mediaTarget1).isNotEqualTo(mediaTarget2);
mediaTarget1.setId(null);
assertThat(mediaTarget1).isNotEqualTo(mediaTarget2);
}
@Test
@Transactional
public void dtoEqualsVerifier() throws Exception {
TestUtil.equalsVerifier(MediaTargetDTO.class);
MediaTargetDTO mediaTargetDTO1 = new MediaTargetDTO();
mediaTargetDTO1.setId(1L);
MediaTargetDTO mediaTargetDTO2 = new MediaTargetDTO();
assertThat(mediaTargetDTO1).isNotEqualTo(mediaTargetDTO2);
mediaTargetDTO2.setId(mediaTargetDTO1.getId());
assertThat(mediaTargetDTO1).isEqualTo(mediaTargetDTO2);
mediaTargetDTO2.setId(2L);
assertThat(mediaTargetDTO1).isNotEqualTo(mediaTargetDTO2);
mediaTargetDTO1.setId(null);
assertThat(mediaTargetDTO1).isNotEqualTo(mediaTargetDTO2);
}
@Test
@Transactional
public void testEntityFromId() {
assertThat(mediaTargetMapper.fromId(42L).getId()).isEqualTo(42);
assertThat(mediaTargetMapper.fromId(null)).isNull();
}
}
| [
"dimitri@d-kahn.net"
] | dimitri@d-kahn.net |
c76462efa7c333a73aa1d0276b6a84b519c0398c | f321db1ace514d08219cc9ba5089ebcfff13c87a | /generated-tests/dynamosa/tests/s1020/24_webmagic/evosuite-tests/us/codecraft/webmagic/Site_ESTest.java | 62993b10cecf083646dbac90052e5546762c6b3e | [] | no_license | sealuzh/dynamic-performance-replication | 01bd512bde9d591ea9afa326968b35123aec6d78 | f89b4dd1143de282cd590311f0315f59c9c7143a | refs/heads/master | 2021-07-12T06:09:46.990436 | 2020-06-05T09:44:56 | 2020-06-05T09:44:56 | 146,285,168 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 72,556 | java | /*
* This file was automatically generated by EvoSuite
* Thu Jul 04 06:25:10 GMT 2019
*/
package us.codecraft.webmagic;
import org.junit.Test;
import static org.junit.Assert.*;
import java.util.LinkedHashSet;
import java.util.Set;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.junit.runner.RunWith;
import us.codecraft.webmagic.Site;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true, useJEE = true)
public class Site_ESTest extends Site_ESTest_scaffolding {
@Test(timeout = 4000)
public void test000() throws Throwable {
Site site0 = new Site();
site0.setCycleRetryTimes(92);
site0.hashCode();
assertEquals(92, site0.getCycleRetryTimes());
}
@Test(timeout = 4000)
public void test001() throws Throwable {
Site site0 = new Site();
site0.setRetryTimes((-2017));
site0.hashCode();
assertEquals((-2017), site0.getRetryTimes());
}
@Test(timeout = 4000)
public void test002() throws Throwable {
Site site0 = Site.me();
site0.setCharset("2|");
site0.hashCode();
assertEquals(5000, site0.getSleepTime());
assertEquals(0, site0.getCycleRetryTimes());
assertFalse(site0.isDisableCookieManagement());
assertEquals(5000, site0.getTimeOut());
assertEquals(1000, site0.getRetrySleepTime());
assertEquals(0, site0.getRetryTimes());
}
@Test(timeout = 4000)
public void test003() throws Throwable {
Site site0 = new Site();
site0.setDomain(")&q>8?#)P}nD=tQ");
site0.hashCode();
assertEquals(5000, site0.getSleepTime());
assertEquals(5000, site0.getTimeOut());
assertEquals(1000, site0.getRetrySleepTime());
assertEquals(0, site0.getCycleRetryTimes());
assertEquals(0, site0.getRetryTimes());
}
@Test(timeout = 4000)
public void test004() throws Throwable {
Site site0 = new Site();
Site site1 = Site.me();
Site site2 = site1.setUserAgent("");
site0.setTimeOut((-2017));
boolean boolean0 = site2.equals(site0);
assertEquals((-2017), site0.getTimeOut());
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test005() throws Throwable {
Site site0 = new Site();
Site site1 = Site.me();
assertEquals(5000, site1.getSleepTime());
Site site2 = site1.setSleepTime(0);
boolean boolean0 = site2.equals(site0);
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test006() throws Throwable {
Site site0 = Site.me();
Site site1 = Site.me();
site1.setRetryTimes(301);
boolean boolean0 = site0.equals(site1);
assertEquals(301, site1.getRetryTimes());
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test007() throws Throwable {
Site site0 = new Site();
Site site1 = Site.me();
site1.setCycleRetryTimes((-2034458190));
boolean boolean0 = site1.equals(site0);
assertEquals((-2034458190), site1.getCycleRetryTimes());
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test008() throws Throwable {
Site site0 = Site.me();
assertTrue(site0.isUseGzip());
Site site1 = site0.setUseGzip(false);
site1.setUserAgent((String) null);
assertFalse(site0.isUseGzip());
assertEquals(5000, site0.getSleepTime());
}
@Test(timeout = 4000)
public void test009() throws Throwable {
Site site0 = new Site();
assertFalse(site0.isDisableCookieManagement());
Site site1 = site0.setDisableCookieManagement(true);
site1.setUserAgent("rjJP9");
assertTrue(site0.isDisableCookieManagement());
assertEquals(5000, site0.getSleepTime());
}
@Test(timeout = 4000)
public void test010() throws Throwable {
Site site0 = new Site();
assertEquals(5000, site0.getTimeOut());
Site site1 = site0.setTimeOut(0);
site1.setUserAgent("");
assertEquals(5000, site0.getSleepTime());
}
@Test(timeout = 4000)
public void test011() throws Throwable {
Site site0 = Site.me();
site0.setTimeOut((-218));
site0.setUserAgent("");
assertEquals((-218), site0.getTimeOut());
}
@Test(timeout = 4000)
public void test012() throws Throwable {
Site site0 = Site.me();
assertEquals(5000, site0.getSleepTime());
Site site1 = site0.setSleepTime(0);
site1.setUserAgent("");
assertEquals(5000, site0.getTimeOut());
}
@Test(timeout = 4000)
public void test013() throws Throwable {
Site site0 = Site.me();
site0.setSleepTime((-2308));
site0.setUserAgent((String) null);
assertEquals((-2308), site0.getSleepTime());
}
@Test(timeout = 4000)
public void test014() throws Throwable {
Site site0 = new Site();
site0.setRetryTimes(3998);
site0.setUserAgent("rjJP9");
assertEquals(3998, site0.getRetryTimes());
}
@Test(timeout = 4000)
public void test015() throws Throwable {
Site site0 = new Site();
site0.setRetryTimes((-4374));
site0.setUserAgent(", cycleRetryTimes=");
assertEquals((-4374), site0.getRetryTimes());
}
@Test(timeout = 4000)
public void test016() throws Throwable {
Site site0 = Site.me();
assertEquals(1000, site0.getRetrySleepTime());
Site site1 = site0.setRetrySleepTime(0);
site1.setUserAgent("KC-`b");
assertEquals(5000, site0.getTimeOut());
}
@Test(timeout = 4000)
public void test017() throws Throwable {
Site site0 = new Site();
Site site1 = site0.setRetrySleepTime((-3480));
site1.setUserAgent("rjJP9");
assertEquals((-3480), site0.getRetrySleepTime());
assertTrue(site0.isUseGzip());
}
@Test(timeout = 4000)
public void test018() throws Throwable {
Site site0 = Site.me();
Site site1 = site0.setCycleRetryTimes(1000);
site1.setUserAgent("KC-`b");
assertEquals(1000, site0.getCycleRetryTimes());
assertEquals(5000, site0.getSleepTime());
}
@Test(timeout = 4000)
public void test019() throws Throwable {
Site site0 = Site.me();
site0.setCycleRetryTimes((-2308));
site0.setUserAgent((String) null);
assertEquals((-2308), site0.getCycleRetryTimes());
}
@Test(timeout = 4000)
public void test020() throws Throwable {
Site site0 = new Site();
assertFalse(site0.isDisableCookieManagement());
site0.setDisableCookieManagement(true);
site0.setUseGzip(true);
assertTrue(site0.isDisableCookieManagement());
}
@Test(timeout = 4000)
public void test021() throws Throwable {
Site site0 = new Site();
assertEquals(5000, site0.getTimeOut());
Site site1 = site0.setTimeOut(0);
site1.setUseGzip(false);
assertEquals(1000, site0.getRetrySleepTime());
}
@Test(timeout = 4000)
public void test022() throws Throwable {
Site site0 = new Site();
site0.setTimeOut((-26));
site0.setUseGzip(false);
assertEquals((-26), site0.getTimeOut());
}
@Test(timeout = 4000)
public void test023() throws Throwable {
Site site0 = Site.me();
assertEquals(5000, site0.getSleepTime());
site0.setSleepTime(0);
site0.setUseGzip(true);
assertEquals(0, site0.getRetryTimes());
}
@Test(timeout = 4000)
public void test024() throws Throwable {
Site site0 = Site.me();
site0.setSleepTime((-1146));
site0.setUseGzip(true);
assertEquals((-1146), site0.getSleepTime());
}
@Test(timeout = 4000)
public void test025() throws Throwable {
Site site0 = new Site();
site0.setRetryTimes(3998);
site0.setUseGzip(true);
assertEquals(3998, site0.getRetryTimes());
}
@Test(timeout = 4000)
public void test026() throws Throwable {
Site site0 = Site.me();
site0.setRetryTimes((-1879048190));
site0.setUseGzip(false);
assertEquals((-1879048190), site0.getRetryTimes());
}
@Test(timeout = 4000)
public void test027() throws Throwable {
Site site0 = Site.me();
assertEquals(1000, site0.getRetrySleepTime());
site0.setRetrySleepTime(0);
site0.setUseGzip(true);
assertEquals(0, site0.getRetrySleepTime());
}
@Test(timeout = 4000)
public void test028() throws Throwable {
Site site0 = new Site();
Site site1 = site0.setRetrySleepTime((-3480));
site1.setUseGzip(true);
assertEquals((-3480), site0.getRetrySleepTime());
assertEquals(0, site0.getRetryTimes());
}
@Test(timeout = 4000)
public void test029() throws Throwable {
Site site0 = Site.me();
Site site1 = site0.setCycleRetryTimes(31);
site1.setUseGzip(false);
assertEquals(31, site0.getCycleRetryTimes());
assertEquals(1000, site0.getRetrySleepTime());
}
@Test(timeout = 4000)
public void test030() throws Throwable {
Site site0 = Site.me();
site0.setCycleRetryTimes((-2107));
site0.setUseGzip(false);
assertEquals((-2107), site0.getCycleRetryTimes());
}
@Test(timeout = 4000)
public void test031() throws Throwable {
Site site0 = Site.me();
site0.setUseGzip(false);
site0.setTimeOut((-2107));
assertEquals((-2107), site0.getTimeOut());
}
@Test(timeout = 4000)
public void test032() throws Throwable {
Site site0 = Site.me();
site0.setDisableCookieManagement(true);
site0.setTimeOut(1366);
assertEquals(1366, site0.getTimeOut());
}
@Test(timeout = 4000)
public void test033() throws Throwable {
Site site0 = Site.me();
site0.setSleepTime(0);
site0.setTimeOut((-2821));
assertEquals((-2821), site0.getTimeOut());
}
@Test(timeout = 4000)
public void test034() throws Throwable {
Site site0 = Site.me();
site0.setSleepTime((-2633));
site0.setTimeOut((-2678));
assertEquals((-2633), site0.getSleepTime());
}
@Test(timeout = 4000)
public void test035() throws Throwable {
Site site0 = Site.me();
Site site1 = site0.setRetryTimes(1366);
site1.setTimeOut(1366);
assertEquals(1366, site0.getRetryTimes());
assertEquals(1366, site0.getTimeOut());
}
@Test(timeout = 4000)
public void test036() throws Throwable {
Site site0 = Site.me();
site0.setRetryTimes((-1879048190));
site0.setTimeOut((-2107));
assertEquals((-1879048190), site0.getRetryTimes());
}
@Test(timeout = 4000)
public void test037() throws Throwable {
Site site0 = Site.me();
site0.setRetrySleepTime(0);
assertEquals(5000, site0.getTimeOut());
site0.setTimeOut(0);
assertEquals(0, site0.getRetrySleepTime());
}
@Test(timeout = 4000)
public void test038() throws Throwable {
Site site0 = Site.me();
site0.setRetrySleepTime((-199));
site0.setTimeOut(586);
assertEquals((-199), site0.getRetrySleepTime());
}
@Test(timeout = 4000)
public void test039() throws Throwable {
Site site0 = new Site();
site0.setCycleRetryTimes(668);
site0.setTimeOut((-26));
assertEquals((-26), site0.getTimeOut());
}
@Test(timeout = 4000)
public void test040() throws Throwable {
Site site0 = Site.me();
site0.setCycleRetryTimes((-2107));
site0.setTimeOut((-2107));
assertEquals((-2107), site0.getTimeOut());
}
@Test(timeout = 4000)
public void test041() throws Throwable {
Site site0 = Site.me();
Site site1 = site0.setUseGzip(false);
site1.setSleepTime((-2308));
assertEquals((-2308), site1.getSleepTime());
}
@Test(timeout = 4000)
public void test042() throws Throwable {
Site site0 = new Site();
site0.setDisableCookieManagement(true);
site0.setSleepTime((-3480));
assertEquals((-3480), site0.getSleepTime());
}
@Test(timeout = 4000)
public void test043() throws Throwable {
Site site0 = Site.me();
Site site1 = site0.setTimeOut(0);
assertEquals(5000, site1.getSleepTime());
site1.setSleepTime(0);
assertEquals(1000, site0.getRetrySleepTime());
}
@Test(timeout = 4000)
public void test044() throws Throwable {
Site site0 = Site.me();
site0.setTimeOut((-1));
site0.setSleepTime((-221));
assertEquals((-221), site0.getSleepTime());
}
@Test(timeout = 4000)
public void test045() throws Throwable {
Site site0 = Site.me();
Site site1 = site0.setRetryTimes(554);
site1.setSleepTime(554);
assertEquals(554, site0.getRetryTimes());
assertTrue(site0.isUseGzip());
}
@Test(timeout = 4000)
public void test046() throws Throwable {
Site site0 = new Site();
Site site1 = site0.setRetryTimes((-2441));
site1.setSleepTime((-2343));
assertEquals((-2343), site1.getSleepTime());
}
@Test(timeout = 4000)
public void test047() throws Throwable {
Site site0 = new Site();
site0.setRetrySleepTime(0);
site0.setSleepTime((-1516));
assertEquals((-1516), site0.getSleepTime());
}
@Test(timeout = 4000)
public void test048() throws Throwable {
Site site0 = new Site();
site0.setRetrySleepTime((-3480));
site0.setSleepTime((-3480));
assertEquals((-3480), site0.getRetrySleepTime());
}
@Test(timeout = 4000)
public void test049() throws Throwable {
Site site0 = new Site();
Site site1 = site0.setCycleRetryTimes(5819);
site1.setSleepTime((-2343));
assertEquals(5819, site0.getCycleRetryTimes());
assertEquals(5000, site0.getTimeOut());
}
@Test(timeout = 4000)
public void test050() throws Throwable {
Site site0 = Site.me();
site0.setCycleRetryTimes((-2107));
site0.setSleepTime(1);
assertEquals((-2107), site0.getCycleRetryTimes());
}
@Test(timeout = 4000)
public void test051() throws Throwable {
Site site0 = new Site();
Site site1 = site0.setUseGzip(false);
site1.setRetryTimes(668);
assertEquals(668, site1.getRetryTimes());
}
@Test(timeout = 4000)
public void test052() throws Throwable {
Site site0 = Site.me();
site0.setDisableCookieManagement(true);
site0.setRetryTimes(1366);
assertEquals(1366, site0.getRetryTimes());
}
@Test(timeout = 4000)
public void test053() throws Throwable {
Site site0 = Site.me();
assertEquals(5000, site0.getTimeOut());
Site site1 = site0.setTimeOut(0);
site1.setRetryTimes(0);
assertEquals(5000, site0.getSleepTime());
}
@Test(timeout = 4000)
public void test054() throws Throwable {
Site site0 = Site.me();
Site site1 = site0.setTimeOut((-755));
site1.setRetryTimes(301);
assertEquals(301, site1.getRetryTimes());
}
@Test(timeout = 4000)
public void test055() throws Throwable {
Site site0 = new Site();
assertEquals(5000, site0.getSleepTime());
site0.setSleepTime(0);
site0.setRetryTimes(0);
assertEquals(0, site0.getRetryTimes());
}
@Test(timeout = 4000)
public void test056() throws Throwable {
Site site0 = new Site();
site0.setSleepTime((-1));
site0.setRetryTimes((-1));
assertEquals((-1), site0.getRetryTimes());
}
@Test(timeout = 4000)
public void test057() throws Throwable {
Site site0 = Site.me();
assertEquals(1000, site0.getRetrySleepTime());
site0.setRetrySleepTime(0);
site0.setRetryTimes(0);
assertEquals(0, site0.getRetryTimes());
}
@Test(timeout = 4000)
public void test058() throws Throwable {
Site site0 = new Site();
Site site1 = site0.setRetrySleepTime((-2017));
site1.setRetryTimes((-2017));
assertEquals((-2017), site1.getRetryTimes());
}
@Test(timeout = 4000)
public void test059() throws Throwable {
Site site0 = new Site();
Site site1 = site0.setCycleRetryTimes(668);
site1.setRetryTimes(668);
assertEquals(668, site1.getRetryTimes());
}
@Test(timeout = 4000)
public void test060() throws Throwable {
Site site0 = new Site();
site0.setCycleRetryTimes((-2034458190));
site0.setRetryTimes((-3835));
assertEquals((-2034458190), site0.getCycleRetryTimes());
}
@Test(timeout = 4000)
public void test061() throws Throwable {
Site site0 = new Site();
site0.setUseGzip(false);
site0.setRetrySleepTime(5000);
assertEquals(5000, site0.getRetrySleepTime());
}
@Test(timeout = 4000)
public void test062() throws Throwable {
Site site0 = Site.me();
site0.setDisableCookieManagement(true);
site0.setRetrySleepTime(3862);
assertEquals(3862, site0.getRetrySleepTime());
}
@Test(timeout = 4000)
public void test063() throws Throwable {
Site site0 = Site.me();
site0.setTimeOut(0);
assertEquals(1000, site0.getRetrySleepTime());
site0.setRetrySleepTime(0);
assertEquals(0, site0.getCycleRetryTimes());
}
@Test(timeout = 4000)
public void test064() throws Throwable {
Site site0 = new Site();
Site site1 = site0.setTimeOut((-26));
site1.setRetrySleepTime(5000);
assertEquals(5000, site1.getRetrySleepTime());
}
@Test(timeout = 4000)
public void test065() throws Throwable {
Site site0 = new Site();
site0.setSleepTime(0);
site0.setRetrySleepTime((-2017));
assertEquals((-2017), site0.getRetrySleepTime());
}
@Test(timeout = 4000)
public void test066() throws Throwable {
Site site0 = new Site();
site0.setSleepTime((-7));
site0.setRetrySleepTime((-2017));
assertEquals((-7), site0.getSleepTime());
}
@Test(timeout = 4000)
public void test067() throws Throwable {
Site site0 = new Site();
Site site1 = site0.setRetryTimes(3998);
site1.setRetrySleepTime((-3480));
assertEquals((-3480), site1.getRetrySleepTime());
}
@Test(timeout = 4000)
public void test068() throws Throwable {
Site site0 = new Site();
Site site1 = site0.setRetryTimes((-4374));
site1.setRetrySleepTime((-4374));
assertEquals((-4374), site1.getRetrySleepTime());
}
@Test(timeout = 4000)
public void test069() throws Throwable {
Site site0 = new Site();
Site site1 = site0.setCycleRetryTimes(668);
site1.setRetrySleepTime(5000);
assertEquals(5000, site1.getRetrySleepTime());
}
@Test(timeout = 4000)
public void test070() throws Throwable {
Site site0 = new Site();
site0.setCycleRetryTimes((-2034458190));
site0.setRetrySleepTime((-2017));
assertEquals((-2034458190), site0.getCycleRetryTimes());
}
@Test(timeout = 4000)
public void test071() throws Throwable {
Site site0 = new Site();
assertTrue(site0.isUseGzip());
Site site1 = site0.setUseGzip(false);
site1.setDomain(", sleepTime=");
assertFalse(site0.isUseGzip());
assertEquals(1000, site0.getRetrySleepTime());
}
@Test(timeout = 4000)
public void test072() throws Throwable {
Site site0 = new Site();
assertFalse(site0.isDisableCookieManagement());
site0.setDisableCookieManagement(true);
site0.setDomain("");
assertTrue(site0.isDisableCookieManagement());
}
@Test(timeout = 4000)
public void test073() throws Throwable {
Site site0 = Site.me();
assertEquals(5000, site0.getTimeOut());
site0.setTimeOut(0);
site0.setDomain(", timeOut=");
assertEquals(1000, site0.getRetrySleepTime());
}
@Test(timeout = 4000)
public void test074() throws Throwable {
Site site0 = Site.me();
site0.setTimeOut((-755));
site0.setDomain("");
assertEquals((-755), site0.getTimeOut());
}
@Test(timeout = 4000)
public void test075() throws Throwable {
Site site0 = new Site();
assertEquals(5000, site0.getSleepTime());
Site site1 = site0.setSleepTime(0);
site1.setDomain(", retryTimes=");
assertEquals(0, site0.getSleepTime());
}
@Test(timeout = 4000)
public void test076() throws Throwable {
Site site0 = new Site();
Site site1 = site0.setSleepTime((-7));
site1.setDomain("");
assertEquals((-7), site0.getSleepTime());
assertFalse(site0.isDisableCookieManagement());
}
@Test(timeout = 4000)
public void test077() throws Throwable {
Site site0 = Site.me();
Site site1 = site0.setRetryTimes(554);
site1.setDomain(";?");
assertEquals(554, site0.getRetryTimes());
assertEquals(0, site0.getCycleRetryTimes());
}
@Test(timeout = 4000)
public void test078() throws Throwable {
Site site0 = new Site();
Site site1 = site0.setRetryTimes((-2441));
site1.setDomain((String) null);
assertEquals((-2441), site0.getRetryTimes());
assertEquals(5000, site0.getTimeOut());
}
@Test(timeout = 4000)
public void test079() throws Throwable {
Site site0 = Site.me();
assertEquals(1000, site0.getRetrySleepTime());
site0.setRetrySleepTime(0);
site0.setDomain("");
assertEquals(5000, site0.getSleepTime());
}
@Test(timeout = 4000)
public void test080() throws Throwable {
Site site0 = Site.me();
site0.setRetrySleepTime((-199));
site0.setDomain("vN__T~$O");
assertEquals((-199), site0.getRetrySleepTime());
}
@Test(timeout = 4000)
public void test081() throws Throwable {
Site site0 = new Site();
site0.setCycleRetryTimes(668);
site0.setDomain(", sleepTime=");
assertEquals(668, site0.getCycleRetryTimes());
}
@Test(timeout = 4000)
public void test082() throws Throwable {
Site site0 = new Site();
site0.setCycleRetryTimes((-2017));
site0.setDomain("nchf]2");
assertEquals((-2017), site0.getCycleRetryTimes());
}
@Test(timeout = 4000)
public void test083() throws Throwable {
Site site0 = Site.me();
assertTrue(site0.isUseGzip());
site0.setUseGzip(false);
site0.setDisableCookieManagement(false);
assertFalse(site0.isUseGzip());
}
@Test(timeout = 4000)
public void test084() throws Throwable {
Site site0 = Site.me();
assertEquals(5000, site0.getTimeOut());
site0.setTimeOut(0);
site0.setDisableCookieManagement(false);
assertFalse(site0.isDisableCookieManagement());
}
@Test(timeout = 4000)
public void test085() throws Throwable {
Site site0 = Site.me();
site0.setTimeOut((-218));
site0.setDisableCookieManagement(true);
assertEquals((-218), site0.getTimeOut());
}
@Test(timeout = 4000)
public void test086() throws Throwable {
Site site0 = Site.me();
assertEquals(5000, site0.getSleepTime());
Site site1 = site0.setSleepTime(0);
site1.setDisableCookieManagement(false);
assertEquals(5000, site0.getTimeOut());
}
@Test(timeout = 4000)
public void test087() throws Throwable {
Site site0 = Site.me();
site0.setSleepTime((-2308));
site0.setDisableCookieManagement(false);
assertEquals((-2308), site0.getSleepTime());
}
@Test(timeout = 4000)
public void test088() throws Throwable {
Site site0 = new Site();
site0.setRetryTimes(3998);
site0.setDisableCookieManagement(true);
assertEquals(3998, site0.getRetryTimes());
}
@Test(timeout = 4000)
public void test089() throws Throwable {
Site site0 = new Site();
site0.setRetryTimes((-2017));
site0.setDisableCookieManagement(false);
assertEquals((-2017), site0.getRetryTimes());
}
@Test(timeout = 4000)
public void test090() throws Throwable {
Site site0 = Site.me();
assertEquals(1000, site0.getRetrySleepTime());
Site site1 = site0.setRetrySleepTime(0);
site1.setDisableCookieManagement(true);
assertEquals(0, site0.getRetrySleepTime());
}
@Test(timeout = 4000)
public void test091() throws Throwable {
Site site0 = Site.me();
site0.setRetrySleepTime((-199));
site0.setDisableCookieManagement(true);
assertEquals((-199), site0.getRetrySleepTime());
}
@Test(timeout = 4000)
public void test092() throws Throwable {
Site site0 = new Site();
site0.setCycleRetryTimes(668);
site0.setDisableCookieManagement(false);
assertEquals(668, site0.getCycleRetryTimes());
}
@Test(timeout = 4000)
public void test093() throws Throwable {
Site site0 = Site.me();
site0.setCycleRetryTimes((-2308));
site0.setDisableCookieManagement(false);
assertEquals((-2308), site0.getCycleRetryTimes());
}
@Test(timeout = 4000)
public void test094() throws Throwable {
Site site0 = Site.me();
Site site1 = site0.setUseGzip(false);
site1.setCycleRetryTimes((-2308));
assertEquals((-2308), site1.getCycleRetryTimes());
}
@Test(timeout = 4000)
public void test095() throws Throwable {
Site site0 = Site.me();
site0.setDisableCookieManagement(true);
site0.setCycleRetryTimes(200);
assertEquals(200, site0.getCycleRetryTimes());
}
@Test(timeout = 4000)
public void test096() throws Throwable {
Site site0 = Site.me();
site0.setTimeOut(0);
site0.setCycleRetryTimes((-467));
assertEquals((-467), site0.getCycleRetryTimes());
}
@Test(timeout = 4000)
public void test097() throws Throwable {
Site site0 = Site.me();
site0.setTimeOut((-2017));
site0.setCycleRetryTimes(0);
assertEquals((-2017), site0.getTimeOut());
}
@Test(timeout = 4000)
public void test098() throws Throwable {
Site site0 = Site.me();
assertEquals(5000, site0.getSleepTime());
site0.setSleepTime(0);
site0.setCycleRetryTimes(0);
assertEquals(5000, site0.getTimeOut());
}
@Test(timeout = 4000)
public void test099() throws Throwable {
Site site0 = Site.me();
Site site1 = site0.setSleepTime((-2308));
site1.setCycleRetryTimes((-2308));
assertEquals((-2308), site0.getSleepTime());
assertTrue(site0.isUseGzip());
}
@Test(timeout = 4000)
public void test100() throws Throwable {
Site site0 = Site.me();
site0.setRetryTimes(554);
site0.setCycleRetryTimes(554);
assertEquals(554, site0.getRetryTimes());
}
@Test(timeout = 4000)
public void test101() throws Throwable {
Site site0 = new Site();
Site site1 = site0.setRetryTimes((-2441));
site1.setCycleRetryTimes(5819);
assertEquals(5819, site1.getCycleRetryTimes());
}
@Test(timeout = 4000)
public void test102() throws Throwable {
Site site0 = new Site();
assertEquals(1000, site0.getRetrySleepTime());
site0.setRetrySleepTime(0);
site0.setCycleRetryTimes(1);
assertEquals(0, site0.getRetrySleepTime());
}
@Test(timeout = 4000)
public void test103() throws Throwable {
Site site0 = new Site();
site0.setRetrySleepTime((-2017));
site0.setCycleRetryTimes(92);
assertEquals((-2017), site0.getRetrySleepTime());
}
@Test(timeout = 4000)
public void test104() throws Throwable {
Site site0 = Site.me();
assertTrue(site0.isUseGzip());
Site site1 = site0.setUseGzip(false);
site1.setCharset("Kn=c");
assertFalse(site0.isUseGzip());
}
@Test(timeout = 4000)
public void test105() throws Throwable {
Site site0 = new Site();
assertFalse(site0.isDisableCookieManagement());
Site site1 = site0.setDisableCookieManagement(true);
site1.setCharset("v8n");
assertTrue(site0.isDisableCookieManagement());
assertEquals(5000, site0.getSleepTime());
}
@Test(timeout = 4000)
public void test106() throws Throwable {
Site site0 = Site.me();
assertEquals(5000, site0.getTimeOut());
Site site1 = site0.setTimeOut(0);
site1.setCharset("");
assertEquals(1000, site0.getRetrySleepTime());
}
@Test(timeout = 4000)
public void test107() throws Throwable {
Site site0 = Site.me();
Site site1 = site0.setTimeOut((-2034458190));
site1.setCharset("");
assertEquals((-2034458190), site0.getTimeOut());
assertEquals(1000, site0.getRetrySleepTime());
}
@Test(timeout = 4000)
public void test108() throws Throwable {
Site site0 = Site.me();
assertEquals(5000, site0.getSleepTime());
Site site1 = site0.setSleepTime(0);
site1.setCharset("");
assertEquals(1000, site0.getRetrySleepTime());
}
@Test(timeout = 4000)
public void test109() throws Throwable {
Site site0 = Site.me();
Site site1 = site0.setSleepTime((-2308));
site1.setCharset("");
assertEquals((-2308), site0.getSleepTime());
}
@Test(timeout = 4000)
public void test110() throws Throwable {
Site site0 = Site.me();
site0.setRetryTimes(5000);
site0.setCharset("yn%o6-r");
assertEquals(5000, site0.getRetryTimes());
}
@Test(timeout = 4000)
public void test111() throws Throwable {
Site site0 = Site.me();
Site site1 = site0.setRetryTimes((-1879048190));
site1.setCharset("");
assertEquals((-1879048190), site0.getRetryTimes());
assertEquals(1000, site0.getRetrySleepTime());
}
@Test(timeout = 4000)
public void test112() throws Throwable {
Site site0 = Site.me();
assertEquals(1000, site0.getRetrySleepTime());
Site site1 = site0.setRetrySleepTime(0);
site1.setCharset(", headers=");
assertEquals(5000, site0.getTimeOut());
}
@Test(timeout = 4000)
public void test113() throws Throwable {
Site site0 = Site.me();
site0.setRetrySleepTime((-199));
site0.setCharset("u46KcYVc=mT");
assertEquals((-199), site0.getRetrySleepTime());
}
@Test(timeout = 4000)
public void test114() throws Throwable {
Site site0 = Site.me();
site0.setCycleRetryTimes(2779);
site0.setCharset("");
assertEquals(2779, site0.getCycleRetryTimes());
}
@Test(timeout = 4000)
public void test115() throws Throwable {
Site site0 = Site.me();
site0.setCycleRetryTimes((-2107));
site0.setCharset("");
assertEquals((-2107), site0.getCycleRetryTimes());
}
@Test(timeout = 4000)
public void test116() throws Throwable {
Site site0 = new Site();
assertTrue(site0.isUseGzip());
site0.setUseGzip(false);
LinkedHashSet<Integer> linkedHashSet0 = new LinkedHashSet<Integer>();
site0.setAcceptStatCode(linkedHashSet0);
assertFalse(site0.isUseGzip());
}
@Test(timeout = 4000)
public void test117() throws Throwable {
Site site0 = Site.me();
assertFalse(site0.isDisableCookieManagement());
Site site1 = site0.setDisableCookieManagement(true);
LinkedHashSet<Integer> linkedHashSet0 = new LinkedHashSet<Integer>();
site1.setAcceptStatCode(linkedHashSet0);
assertTrue(site0.isDisableCookieManagement());
assertEquals(1000, site0.getRetrySleepTime());
}
@Test(timeout = 4000)
public void test118() throws Throwable {
Site site0 = new Site();
Set<Integer> set0 = site0.getAcceptStatCode();
assertEquals(5000, site0.getTimeOut());
site0.setTimeOut(0);
site0.setAcceptStatCode(set0);
assertEquals(1000, site0.getRetrySleepTime());
}
@Test(timeout = 4000)
public void test119() throws Throwable {
Site site0 = Site.me();
site0.setTimeOut((-218));
Set<Integer> set0 = site0.getAcceptStatCode();
site0.setAcceptStatCode(set0);
assertEquals((-218), site0.getTimeOut());
}
@Test(timeout = 4000)
public void test120() throws Throwable {
Site site0 = Site.me();
assertEquals(5000, site0.getSleepTime());
Site site1 = site0.setSleepTime(0);
LinkedHashSet<Integer> linkedHashSet0 = new LinkedHashSet<Integer>();
site1.setAcceptStatCode(linkedHashSet0);
assertEquals(5000, site0.getTimeOut());
}
@Test(timeout = 4000)
public void test121() throws Throwable {
Site site0 = new Site();
Site site1 = site0.setSleepTime((-763));
Set<Integer> set0 = site1.getAcceptStatCode();
site0.setAcceptStatCode(set0);
assertEquals((-763), site0.getSleepTime());
}
@Test(timeout = 4000)
public void test122() throws Throwable {
Site site0 = Site.me();
site0.setRetryTimes(554);
LinkedHashSet<Integer> linkedHashSet0 = new LinkedHashSet<Integer>();
site0.setAcceptStatCode(linkedHashSet0);
assertEquals(554, site0.getRetryTimes());
}
@Test(timeout = 4000)
public void test123() throws Throwable {
Site site0 = new Site();
Set<Integer> set0 = site0.getAcceptStatCode();
site0.setRetryTimes((-1));
site0.setAcceptStatCode(set0);
assertEquals((-1), site0.getRetryTimes());
}
@Test(timeout = 4000)
public void test124() throws Throwable {
Site site0 = Site.me();
assertEquals(1000, site0.getRetrySleepTime());
site0.setRetrySleepTime(0);
site0.setAcceptStatCode((Set<Integer>) null);
assertEquals(0, site0.getRetrySleepTime());
}
@Test(timeout = 4000)
public void test125() throws Throwable {
Site site0 = new Site();
Site site1 = site0.setRetrySleepTime((-2017));
LinkedHashSet<Integer> linkedHashSet0 = new LinkedHashSet<Integer>();
site1.setAcceptStatCode(linkedHashSet0);
assertEquals((-2017), site0.getRetrySleepTime());
}
@Test(timeout = 4000)
public void test126() throws Throwable {
Site site0 = Site.me();
site0.setCycleRetryTimes(554);
LinkedHashSet<Integer> linkedHashSet0 = new LinkedHashSet<Integer>();
site0.setAcceptStatCode(linkedHashSet0);
assertEquals(554, site0.getCycleRetryTimes());
}
@Test(timeout = 4000)
public void test127() throws Throwable {
Site site0 = Site.me();
Site site1 = site0.setCycleRetryTimes((-218));
Set<Integer> set0 = site0.getAcceptStatCode();
site1.setAcceptStatCode(set0);
assertEquals((-218), site0.getCycleRetryTimes());
assertEquals(5000, site0.getTimeOut());
}
@Test(timeout = 4000)
public void test128() throws Throwable {
Site site0 = Site.me();
assertTrue(site0.isUseGzip());
Site site1 = site0.setUseGzip(false);
boolean boolean0 = site1.isUseGzip();
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test129() throws Throwable {
Site site0 = Site.me();
assertFalse(site0.isDisableCookieManagement());
site0.setDisableCookieManagement(true);
boolean boolean0 = site0.isDisableCookieManagement();
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test130() throws Throwable {
Site site0 = Site.me();
Site site1 = site0.setUserAgent("KC-`b");
site1.getUserAgent();
assertFalse(site1.isDisableCookieManagement());
assertEquals(0, site1.getCycleRetryTimes());
assertEquals(5000, site1.getSleepTime());
assertEquals(1000, site1.getRetrySleepTime());
assertEquals(0, site1.getRetryTimes());
assertEquals(5000, site1.getTimeOut());
assertTrue(site1.isUseGzip());
}
@Test(timeout = 4000)
public void test131() throws Throwable {
Site site0 = new Site();
site0.setUserAgent("");
site0.getUserAgent();
assertTrue(site0.isUseGzip());
assertEquals(0, site0.getRetryTimes());
assertFalse(site0.isDisableCookieManagement());
assertEquals(0, site0.getCycleRetryTimes());
assertEquals(5000, site0.getSleepTime());
assertEquals(5000, site0.getTimeOut());
assertEquals(1000, site0.getRetrySleepTime());
}
@Test(timeout = 4000)
public void test132() throws Throwable {
Site site0 = new Site();
assertEquals(5000, site0.getTimeOut());
site0.setTimeOut(0);
int int0 = site0.getTimeOut();
assertEquals(0, int0);
}
@Test(timeout = 4000)
public void test133() throws Throwable {
Site site0 = Site.me();
Site site1 = site0.setTimeOut((-2821));
int int0 = site1.getTimeOut();
assertEquals((-2821), int0);
}
@Test(timeout = 4000)
public void test134() throws Throwable {
Site site0 = new Site();
assertEquals(5000, site0.getSleepTime());
site0.setSleepTime(0);
int int0 = site0.getSleepTime();
assertEquals(0, int0);
}
@Test(timeout = 4000)
public void test135() throws Throwable {
Site site0 = new Site();
site0.setSleepTime((-1516));
int int0 = site0.getSleepTime();
assertEquals((-1516), int0);
}
@Test(timeout = 4000)
public void test136() throws Throwable {
Site site0 = new Site();
site0.setRetryTimes(668);
int int0 = site0.getRetryTimes();
assertEquals(668, int0);
}
@Test(timeout = 4000)
public void test137() throws Throwable {
Site site0 = Site.me();
site0.setRetryTimes((-1774));
int int0 = site0.getRetryTimes();
assertEquals((-1774), int0);
}
@Test(timeout = 4000)
public void test138() throws Throwable {
Site site0 = Site.me();
assertEquals(1000, site0.getRetrySleepTime());
site0.setRetrySleepTime(0);
int int0 = site0.getRetrySleepTime();
assertEquals(0, int0);
}
@Test(timeout = 4000)
public void test139() throws Throwable {
Site site0 = new Site();
Site site1 = site0.setRetrySleepTime((-3480));
int int0 = site1.getRetrySleepTime();
assertEquals((-3480), int0);
}
@Test(timeout = 4000)
public void test140() throws Throwable {
Site site0 = Site.me();
site0.addHeader(", cycleRetryTimes=", ", cycleRetryTimes=");
site0.getHeaders();
assertFalse(site0.isDisableCookieManagement());
assertEquals(0, site0.getCycleRetryTimes());
assertEquals(0, site0.getRetryTimes());
assertEquals(5000, site0.getSleepTime());
assertEquals(1000, site0.getRetrySleepTime());
assertEquals(5000, site0.getTimeOut());
assertTrue(site0.isUseGzip());
}
@Test(timeout = 4000)
public void test141() throws Throwable {
Site site0 = new Site();
site0.setDomain(", cycleRetryTimes=");
site0.getDomain();
assertEquals(1000, site0.getRetrySleepTime());
assertEquals(0, site0.getCycleRetryTimes());
assertEquals(5000, site0.getTimeOut());
assertEquals(0, site0.getRetryTimes());
assertFalse(site0.isDisableCookieManagement());
assertEquals(5000, site0.getSleepTime());
assertTrue(site0.isUseGzip());
}
@Test(timeout = 4000)
public void test142() throws Throwable {
Site site0 = new Site();
site0.setCycleRetryTimes(668);
int int0 = site0.getCycleRetryTimes();
assertEquals(668, int0);
}
@Test(timeout = 4000)
public void test143() throws Throwable {
Site site0 = Site.me();
Site site1 = site0.setCycleRetryTimes((-2107));
int int0 = site1.getCycleRetryTimes();
assertEquals((-2107), int0);
}
@Test(timeout = 4000)
public void test144() throws Throwable {
Site site0 = new Site();
Site site1 = site0.addCookie("", "");
site1.getCookies();
assertEquals(0, site1.getRetryTimes());
assertEquals(1000, site1.getRetrySleepTime());
assertEquals(5000, site1.getSleepTime());
assertTrue(site1.isUseGzip());
assertEquals(5000, site1.getTimeOut());
assertEquals(0, site1.getCycleRetryTimes());
assertFalse(site1.isDisableCookieManagement());
}
@Test(timeout = 4000)
public void test145() throws Throwable {
Site site0 = Site.me();
site0.setCharset(", cycleRetryTimes=");
site0.getCharset();
assertTrue(site0.isUseGzip());
assertEquals(0, site0.getCycleRetryTimes());
assertEquals(0, site0.getRetryTimes());
assertFalse(site0.isDisableCookieManagement());
assertEquals(1000, site0.getRetrySleepTime());
assertEquals(5000, site0.getTimeOut());
assertEquals(5000, site0.getSleepTime());
}
@Test(timeout = 4000)
public void test146() throws Throwable {
Site site0 = Site.me();
Site site1 = site0.setCharset("");
site1.getCharset();
assertEquals(0, site1.getRetryTimes());
assertEquals(5000, site1.getSleepTime());
assertEquals(0, site1.getCycleRetryTimes());
assertFalse(site1.isDisableCookieManagement());
assertEquals(1000, site1.getRetrySleepTime());
assertEquals(5000, site1.getTimeOut());
assertTrue(site1.isUseGzip());
}
@Test(timeout = 4000)
public void test147() throws Throwable {
Site site0 = new Site();
site0.addCookie("", "", "");
site0.getAllCookies();
assertEquals(0, site0.getCycleRetryTimes());
assertFalse(site0.isDisableCookieManagement());
assertTrue(site0.isUseGzip());
assertEquals(5000, site0.getSleepTime());
assertEquals(5000, site0.getTimeOut());
assertEquals(1000, site0.getRetrySleepTime());
assertEquals(0, site0.getRetryTimes());
}
@Test(timeout = 4000)
public void test148() throws Throwable {
Site site0 = Site.me();
site0.setAcceptStatCode((Set<Integer>) null);
site0.getAcceptStatCode();
assertEquals(1000, site0.getRetrySleepTime());
assertEquals(5000, site0.getTimeOut());
assertTrue(site0.isUseGzip());
assertEquals(5000, site0.getSleepTime());
assertEquals(0, site0.getRetryTimes());
assertEquals(0, site0.getCycleRetryTimes());
assertFalse(site0.isDisableCookieManagement());
}
@Test(timeout = 4000)
public void test149() throws Throwable {
Site site0 = Site.me();
LinkedHashSet<Integer> linkedHashSet0 = new LinkedHashSet<Integer>();
Site site1 = site0.setAcceptStatCode(linkedHashSet0);
site1.getAcceptStatCode();
assertEquals(5000, site1.getSleepTime());
assertEquals(0, site1.getRetryTimes());
assertFalse(site1.isDisableCookieManagement());
assertEquals(0, site1.getCycleRetryTimes());
assertEquals(1000, site1.getRetrySleepTime());
assertEquals(5000, site1.getTimeOut());
assertTrue(site1.isUseGzip());
}
@Test(timeout = 4000)
public void test150() throws Throwable {
Site site0 = new Site();
assertTrue(site0.isUseGzip());
Site site1 = site0.setUseGzip(false);
site1.addHeader(", sleepTime=", ", sleepTime=");
assertFalse(site0.isUseGzip());
assertEquals(5000, site0.getTimeOut());
}
@Test(timeout = 4000)
public void test151() throws Throwable {
Site site0 = Site.me();
assertEquals(5000, site0.getTimeOut());
site0.setTimeOut(0);
site0.addHeader(", userAgent='", "");
assertTrue(site0.isUseGzip());
}
@Test(timeout = 4000)
public void test152() throws Throwable {
Site site0 = Site.me();
Site site1 = site0.setTimeOut((-2821));
site1.addHeader("", "");
assertEquals((-2821), site0.getTimeOut());
assertEquals(5000, site0.getSleepTime());
}
@Test(timeout = 4000)
public void test153() throws Throwable {
Site site0 = Site.me();
assertEquals(5000, site0.getSleepTime());
Site site1 = site0.setSleepTime(0);
site1.addHeader("", "");
assertEquals(5000, site0.getTimeOut());
}
@Test(timeout = 4000)
public void test154() throws Throwable {
Site site0 = Site.me();
site0.setSleepTime((-1146));
site0.addHeader("bk')N2S]x ^", ", userAgent='");
assertEquals((-1146), site0.getSleepTime());
}
@Test(timeout = 4000)
public void test155() throws Throwable {
Site site0 = new Site();
site0.setRetryTimes(2680);
site0.addHeader("", "");
assertEquals(2680, site0.getRetryTimes());
}
@Test(timeout = 4000)
public void test156() throws Throwable {
Site site0 = new Site();
site0.setRetryTimes((-4374));
site0.addHeader(", cycleRetryTimes=", ", cycleRetryTimes=");
assertEquals((-4374), site0.getRetryTimes());
}
@Test(timeout = 4000)
public void test157() throws Throwable {
Site site0 = Site.me();
assertEquals(1000, site0.getRetrySleepTime());
site0.setRetrySleepTime(0);
site0.addHeader("v6?tOR=cD'zL", "v6?tOR=cD'zL");
assertEquals(5000, site0.getSleepTime());
}
@Test(timeout = 4000)
public void test158() throws Throwable {
Site site0 = new Site();
Site site1 = site0.setRetrySleepTime((-137));
site1.addHeader((String) null, "");
assertEquals((-137), site0.getRetrySleepTime());
assertFalse(site0.isDisableCookieManagement());
}
@Test(timeout = 4000)
public void test159() throws Throwable {
Site site0 = new Site();
Site site1 = site0.setCycleRetryTimes(668);
site1.addHeader(", sleepTime=", ", sleepTime=");
assertEquals(668, site0.getCycleRetryTimes());
assertEquals(5000, site0.getSleepTime());
}
@Test(timeout = 4000)
public void test160() throws Throwable {
Site site0 = Site.me();
Site site1 = site0.setCycleRetryTimes((-218));
site1.addHeader("", ", timeOut=");
assertEquals((-218), site0.getCycleRetryTimes());
assertEquals(5000, site0.getSleepTime());
}
@Test(timeout = 4000)
public void test161() throws Throwable {
Site site0 = new Site();
assertTrue(site0.isUseGzip());
site0.setUseGzip(false);
site0.addCookie("", "", "'PL7 I,a|F");
assertFalse(site0.isUseGzip());
}
@Test(timeout = 4000)
public void test162() throws Throwable {
Site site0 = Site.me();
assertFalse(site0.isDisableCookieManagement());
Site site1 = site0.setDisableCookieManagement(true);
site1.addCookie("", "", "");
assertTrue(site0.isDisableCookieManagement());
}
@Test(timeout = 4000)
public void test163() throws Throwable {
Site site0 = new Site();
assertEquals(5000, site0.getTimeOut());
Site site1 = site0.setTimeOut(0);
site1.addCookie("N;[f2(", "", ", retryTimes=");
assertEquals(5000, site0.getSleepTime());
}
@Test(timeout = 4000)
public void test164() throws Throwable {
Site site0 = Site.me();
Site site1 = site0.setTimeOut((-755));
site1.addCookie("", "", "");
assertEquals((-755), site0.getTimeOut());
assertEquals(5000, site0.getSleepTime());
}
@Test(timeout = 4000)
public void test165() throws Throwable {
Site site0 = new Site();
assertEquals(5000, site0.getSleepTime());
Site site1 = site0.setSleepTime(0);
site1.addCookie("kg:U6", "KC-`b", "");
assertEquals(5000, site0.getTimeOut());
}
@Test(timeout = 4000)
public void test166() throws Throwable {
Site site0 = new Site();
Site site1 = site0.setSleepTime((-763));
site1.addCookie("6\"Rq.Shz[s-Jy8[);HC", "BU^5p$eJ-U/!SJ", "n@^Pb}8K");
assertEquals((-763), site0.getSleepTime());
assertEquals(5000, site0.getTimeOut());
}
@Test(timeout = 4000)
public void test167() throws Throwable {
Site site0 = new Site();
Site site1 = site0.setRetryTimes(2680);
site1.addCookie("", ", sleepTime=", "");
assertEquals(2680, site0.getRetryTimes());
assertEquals(5000, site0.getTimeOut());
}
@Test(timeout = 4000)
public void test168() throws Throwable {
Site site0 = Site.me();
Site site1 = site0.setRetryTimes((-2034458190));
site1.addCookie("`{ru`[=;", "", "");
assertEquals((-2034458190), site0.getRetryTimes());
assertEquals(5000, site0.getSleepTime());
}
@Test(timeout = 4000)
public void test169() throws Throwable {
Site site0 = Site.me();
assertEquals(1000, site0.getRetrySleepTime());
site0.setRetrySleepTime(0);
site0.addCookie("", "", "");
assertEquals(5000, site0.getTimeOut());
}
@Test(timeout = 4000)
public void test170() throws Throwable {
Site site0 = Site.me();
Site site1 = site0.setRetrySleepTime((-199));
site1.addCookie(", userAgent='", ", userAgent='", "u46KcYVc=mT");
assertEquals((-199), site0.getRetrySleepTime());
assertEquals(5000, site0.getTimeOut());
}
@Test(timeout = 4000)
public void test171() throws Throwable {
Site site0 = Site.me();
site0.setCycleRetryTimes(1000);
site0.addCookie("we~0/tAbTtcMb1<%de", (String) null, "KC-`b");
assertEquals(1000, site0.getCycleRetryTimes());
}
@Test(timeout = 4000)
public void test172() throws Throwable {
Site site0 = Site.me();
site0.setCycleRetryTimes((-218));
site0.addCookie("", "Rxm(2*VF<,FcgB.m!", "us.codecraft.webmagic.Site$1");
assertEquals((-218), site0.getCycleRetryTimes());
}
@Test(timeout = 4000)
public void test173() throws Throwable {
Site site0 = Site.me();
assertFalse(site0.isDisableCookieManagement());
Site site1 = site0.setDisableCookieManagement(true);
site1.addCookie((String) null, (String) null);
assertTrue(site0.isDisableCookieManagement());
assertEquals(1000, site0.getRetrySleepTime());
}
@Test(timeout = 4000)
public void test174() throws Throwable {
Site site0 = Site.me();
site0.setTimeOut((-2017));
site0.addCookie("", "G;TAsJhj6");
assertEquals((-2017), site0.getTimeOut());
}
@Test(timeout = 4000)
public void test175() throws Throwable {
Site site0 = new Site();
Site site1 = site0.setSleepTime((-2343));
site1.addCookie((String) null, (String) null);
assertEquals((-2343), site0.getSleepTime());
assertEquals(5000, site0.getTimeOut());
}
@Test(timeout = 4000)
public void test176() throws Throwable {
Site site0 = Site.me();
site0.setRetryTimes(1366);
site0.addCookie((String) null, (String) null);
assertEquals(1366, site0.getRetryTimes());
}
@Test(timeout = 4000)
public void test177() throws Throwable {
Site site0 = new Site();
Site site1 = site0.setCycleRetryTimes(5819);
site1.addCookie((String) null, (String) null);
assertEquals(5819, site0.getCycleRetryTimes());
}
@Test(timeout = 4000)
public void test178() throws Throwable {
Site site0 = new Site();
site0.setCycleRetryTimes((-2017));
site0.addCookie("", ", cycleRetryTimes=");
assertEquals((-2017), site0.getCycleRetryTimes());
}
@Test(timeout = 4000)
public void test179() throws Throwable {
Site site0 = new Site();
assertEquals(5000, site0.getTimeOut());
Site site1 = site0.setTimeOut(0);
site1.addCookie((String) null, "");
assertFalse(site0.isDisableCookieManagement());
}
@Test(timeout = 4000)
public void test180() throws Throwable {
Site site0 = Site.me();
assertEquals(5000, site0.getSleepTime());
site0.setSleepTime(0);
site0.addCookie((String) null, (String) null);
assertEquals(1000, site0.getRetrySleepTime());
}
@Test(timeout = 4000)
public void test181() throws Throwable {
Site site0 = new Site();
Site site1 = site0.setRetryTimes((-2441));
site1.addCookie((String) null, (String) null);
assertEquals((-2441), site0.getRetryTimes());
assertEquals(1000, site0.getRetrySleepTime());
}
@Test(timeout = 4000)
public void test182() throws Throwable {
Site site0 = Site.me();
assertEquals(1000, site0.getRetrySleepTime());
site0.setRetrySleepTime(0);
site0.addCookie(", headers=", "");
assertEquals(5000, site0.getTimeOut());
}
@Test(timeout = 4000)
public void test183() throws Throwable {
Site site0 = new Site();
Site site1 = site0.setCharset((String) null);
assertTrue(site1.isUseGzip());
assertEquals(5000, site1.getSleepTime());
assertEquals(0, site1.getCycleRetryTimes());
assertEquals(0, site1.getRetryTimes());
assertFalse(site1.isDisableCookieManagement());
assertEquals(1000, site1.getRetrySleepTime());
assertEquals(5000, site1.getTimeOut());
}
@Test(timeout = 4000)
public void test184() throws Throwable {
Site site0 = Site.me();
Object object0 = new Object();
boolean boolean0 = site0.equals(object0);
assertTrue(site0.isUseGzip());
assertEquals(5000, site0.getTimeOut());
assertEquals(5000, site0.getSleepTime());
assertEquals(1000, site0.getRetrySleepTime());
assertFalse(site0.isDisableCookieManagement());
assertEquals(0, site0.getCycleRetryTimes());
assertEquals(0, site0.getRetryTimes());
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test185() throws Throwable {
Site site0 = new Site();
Site site1 = site0.addHeader((String) null, (String) null);
assertTrue(site1.isUseGzip());
assertFalse(site1.isDisableCookieManagement());
assertEquals(0, site1.getCycleRetryTimes());
assertEquals(1000, site1.getRetrySleepTime());
assertEquals(5000, site1.getSleepTime());
assertEquals(0, site1.getRetryTimes());
assertEquals(5000, site1.getTimeOut());
}
@Test(timeout = 4000)
public void test186() throws Throwable {
Site site0 = Site.me();
Site site1 = site0.addCookie((String) null, (String) null, (String) null);
assertEquals(5000, site1.getSleepTime());
assertTrue(site1.isUseGzip());
assertEquals(1000, site1.getRetrySleepTime());
assertEquals(5000, site1.getTimeOut());
assertEquals(0, site1.getRetryTimes());
assertEquals(0, site1.getCycleRetryTimes());
assertFalse(site1.isDisableCookieManagement());
}
@Test(timeout = 4000)
public void test187() throws Throwable {
Site site0 = Site.me();
site0.addCookie(", headers=", "");
site0.hashCode();
assertEquals(1000, site0.getRetrySleepTime());
assertEquals(0, site0.getCycleRetryTimes());
assertEquals(5000, site0.getSleepTime());
assertEquals(0, site0.getRetryTimes());
assertEquals(5000, site0.getTimeOut());
}
@Test(timeout = 4000)
public void test188() throws Throwable {
Site site0 = Site.me();
Site site1 = site0.setAcceptStatCode((Set<Integer>) null);
site1.hashCode();
assertEquals(5000, site1.getSleepTime());
assertEquals(0, site1.getRetryTimes());
assertEquals(1000, site1.getRetrySleepTime());
assertEquals(5000, site1.getTimeOut());
assertTrue(site1.isUseGzip());
}
@Test(timeout = 4000)
public void test189() throws Throwable {
Site site0 = new Site();
site0.setUserAgent("#:DNiC1>H|]CaGkb6");
Site site1 = new Site();
boolean boolean0 = site1.equals(site0);
assertEquals(5000, site1.getTimeOut());
assertFalse(boolean0);
assertEquals(1000, site1.getRetrySleepTime());
assertTrue(site1.isUseGzip());
assertEquals(5000, site1.getSleepTime());
assertEquals(0, site1.getRetryTimes());
assertEquals(0, site1.getCycleRetryTimes());
assertFalse(site1.isDisableCookieManagement());
}
@Test(timeout = 4000)
public void test190() throws Throwable {
Site site0 = Site.me();
Site site1 = new Site();
Site site2 = site1.setUserAgent("DHHnBX3>oa=,{6");
assertFalse(site2.equals((Object)site0));
Site site3 = site0.setUserAgent("DHHnBX3>oa=,{6");
boolean boolean0 = site3.equals(site2);
assertTrue(site2.equals((Object)site0));
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test191() throws Throwable {
Site site0 = Site.me();
Site site1 = new Site();
assertTrue(site1.equals((Object)site0));
Site site2 = site0.setUserAgent("DHHnBX3>oa=,{6");
boolean boolean0 = site2.equals(site1);
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test192() throws Throwable {
Site site0 = Site.me();
Site site1 = Site.me();
assertTrue(site1.equals((Object)site0));
Site site2 = site0.addHeader("=uS>E+v9", "=uS>E+v9");
boolean boolean0 = site2.equals(site1);
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test193() throws Throwable {
Site site0 = Site.me();
Site site1 = new Site();
assertTrue(site1.equals((Object)site0));
site1.setDomain(", acceptStatCode=");
boolean boolean0 = site0.equals(site1);
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test194() throws Throwable {
Site site0 = new Site();
Site site1 = Site.me();
Site site2 = site0.setDomain("N9V4BA\"");
assertFalse(site2.equals((Object)site1));
Site site3 = site1.setDomain("N9V4BA\"");
boolean boolean0 = site3.equals(site2);
assertTrue(site2.equals((Object)site1));
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test195() throws Throwable {
Site site0 = Site.me();
site0.setDomain(", headers=");
Site site1 = Site.me();
boolean boolean0 = site0.equals(site1);
assertFalse(boolean0);
assertEquals(0, site1.getCycleRetryTimes());
assertFalse(site1.isDisableCookieManagement());
assertTrue(site1.isUseGzip());
assertEquals(5000, site1.getTimeOut());
assertEquals(5000, site1.getSleepTime());
assertEquals(0, site1.getRetryTimes());
assertEquals(1000, site1.getRetrySleepTime());
}
@Test(timeout = 4000)
public void test196() throws Throwable {
Site site0 = Site.me();
Site site1 = new Site();
assertTrue(site1.equals((Object)site0));
site1.addCookie("Q[vI3MVukC", "Q[vI3MVukC");
boolean boolean0 = site0.equals(site1);
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test197() throws Throwable {
Site site0 = Site.me();
site0.setCharset("U}");
Site site1 = new Site();
boolean boolean0 = site1.equals(site0);
assertEquals(5000, site1.getTimeOut());
assertEquals(1000, site1.getRetrySleepTime());
assertTrue(site1.isUseGzip());
assertEquals(5000, site1.getSleepTime());
assertEquals(0, site1.getRetryTimes());
assertEquals(0, site1.getCycleRetryTimes());
assertFalse(boolean0);
assertFalse(site1.isDisableCookieManagement());
}
@Test(timeout = 4000)
public void test198() throws Throwable {
Site site0 = new Site();
Site site1 = Site.me();
Site site2 = site1.setCharset("");
assertFalse(site2.equals((Object)site0));
Site site3 = site0.setCharset("");
boolean boolean0 = site3.equals(site1);
assertTrue(site0.equals((Object)site1));
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test199() throws Throwable {
Site site0 = new Site();
Site site1 = site0.setAcceptStatCode((Set<Integer>) null);
Site site2 = Site.me();
assertFalse(site2.equals((Object)site1));
site2.setAcceptStatCode((Set<Integer>) null);
boolean boolean0 = site1.equals(site2);
assertTrue(site2.equals((Object)site0));
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test200() throws Throwable {
Site site0 = new Site();
Site site1 = Site.me();
assertTrue(site1.equals((Object)site0));
LinkedHashSet<Integer> linkedHashSet0 = new LinkedHashSet<Integer>();
site1.setAcceptStatCode(linkedHashSet0);
boolean boolean0 = site0.equals(site1);
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test201() throws Throwable {
Site site0 = Site.me();
Site site1 = Site.me();
site1.setTimeOut((-1749545338));
boolean boolean0 = site1.equals(site0);
assertEquals((-1749545338), site1.getTimeOut());
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test202() throws Throwable {
Site site0 = Site.me();
Site site1 = new Site();
Site site2 = site1.setSleepTime(479);
boolean boolean0 = site0.equals(site2);
assertEquals(479, site1.getSleepTime());
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test203() throws Throwable {
Site site0 = new Site();
Site site1 = Site.me();
Site site2 = site1.setRetryTimes(6567);
boolean boolean0 = site2.equals(site0);
assertEquals(6567, site1.getRetryTimes());
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test204() throws Throwable {
Site site0 = new Site();
boolean boolean0 = site0.equals((Object) null);
assertEquals(5000, site0.getSleepTime());
assertEquals(0, site0.getRetryTimes());
assertFalse(site0.isDisableCookieManagement());
assertEquals(0, site0.getCycleRetryTimes());
assertEquals(5000, site0.getTimeOut());
assertEquals(1000, site0.getRetrySleepTime());
assertFalse(boolean0);
assertTrue(site0.isUseGzip());
}
@Test(timeout = 4000)
public void test205() throws Throwable {
Site site0 = new Site();
boolean boolean0 = site0.equals(site0);
assertTrue(boolean0);
assertTrue(site0.isUseGzip());
assertEquals(5000, site0.getTimeOut());
assertEquals(1000, site0.getRetrySleepTime());
assertEquals(0, site0.getRetryTimes());
assertEquals(5000, site0.getSleepTime());
assertFalse(site0.isDisableCookieManagement());
assertEquals(0, site0.getCycleRetryTimes());
}
@Test(timeout = 4000)
public void test206() throws Throwable {
Site site0 = Site.me();
Site site1 = Site.me();
assertTrue(site1.equals((Object)site0));
site1.setCharset("#:DNiC1>H|]CaGkb6");
boolean boolean0 = site1.equals(site0);
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test207() throws Throwable {
Site site0 = new Site();
site0.addCookie("", "", "");
Site site1 = site0.addCookie("", "", "");
assertEquals(0, site1.getRetryTimes());
assertFalse(site1.isDisableCookieManagement());
assertEquals(0, site1.getCycleRetryTimes());
assertEquals(1000, site1.getRetrySleepTime());
assertEquals(5000, site1.getSleepTime());
assertEquals(5000, site1.getTimeOut());
assertTrue(site1.isUseGzip());
}
@Test(timeout = 4000)
public void test208() throws Throwable {
Site site0 = new Site();
Site site1 = site0.setDomain("");
site1.getDomain();
assertEquals(0, site1.getCycleRetryTimes());
assertFalse(site1.isDisableCookieManagement());
assertEquals(0, site1.getRetryTimes());
assertEquals(1000, site1.getRetrySleepTime());
assertEquals(5000, site1.getSleepTime());
assertEquals(5000, site1.getTimeOut());
assertTrue(site1.isUseGzip());
}
@Test(timeout = 4000)
public void test209() throws Throwable {
Site site0 = Site.me();
int int0 = site0.getSleepTime();
assertEquals(5000, int0);
assertTrue(site0.isUseGzip());
assertEquals(0, site0.getRetryTimes());
assertEquals(5000, site0.getTimeOut());
assertEquals(1000, site0.getRetrySleepTime());
assertFalse(site0.isDisableCookieManagement());
assertEquals(0, site0.getCycleRetryTimes());
}
@Test(timeout = 4000)
public void test210() throws Throwable {
Site site0 = new Site();
int int0 = site0.getRetrySleepTime();
assertEquals(5000, site0.getSleepTime());
assertEquals(0, site0.getCycleRetryTimes());
assertFalse(site0.isDisableCookieManagement());
assertEquals(5000, site0.getTimeOut());
assertEquals(1000, int0);
assertTrue(site0.isUseGzip());
assertEquals(0, site0.getRetryTimes());
}
@Test(timeout = 4000)
public void test211() throws Throwable {
Site site0 = new Site();
String string0 = site0.toString();
assertEquals("Site{domain='null', userAgent='null', cookies={}, charset='null', sleepTime=5000, retryTimes=0, cycleRetryTimes=0, timeOut=5000, acceptStatCode=[200], headers={}}", string0);
assertFalse(site0.isDisableCookieManagement());
assertEquals(1000, site0.getRetrySleepTime());
assertTrue(site0.isUseGzip());
}
@Test(timeout = 4000)
public void test212() throws Throwable {
Site site0 = Site.me();
site0.getCookies();
assertEquals(5000, site0.getSleepTime());
assertTrue(site0.isUseGzip());
assertEquals(5000, site0.getTimeOut());
assertEquals(1000, site0.getRetrySleepTime());
assertFalse(site0.isDisableCookieManagement());
assertEquals(0, site0.getCycleRetryTimes());
assertEquals(0, site0.getRetryTimes());
}
@Test(timeout = 4000)
public void test213() throws Throwable {
Site site0 = new Site();
site0.getAllCookies();
assertFalse(site0.isDisableCookieManagement());
assertEquals(0, site0.getCycleRetryTimes());
assertTrue(site0.isUseGzip());
assertEquals(5000, site0.getTimeOut());
assertEquals(1000, site0.getRetrySleepTime());
assertEquals(5000, site0.getSleepTime());
assertEquals(0, site0.getRetryTimes());
}
@Test(timeout = 4000)
public void test214() throws Throwable {
Site site0 = new Site();
int int0 = site0.getRetryTimes();
assertEquals(1000, site0.getRetrySleepTime());
assertEquals(0, int0);
assertEquals(5000, site0.getTimeOut());
assertTrue(site0.isUseGzip());
assertEquals(5000, site0.getSleepTime());
assertEquals(0, site0.getCycleRetryTimes());
assertFalse(site0.isDisableCookieManagement());
}
@Test(timeout = 4000)
public void test215() throws Throwable {
Site site0 = Site.me();
site0.getDomain();
assertTrue(site0.isUseGzip());
assertEquals(5000, site0.getTimeOut());
assertEquals(5000, site0.getSleepTime());
assertEquals(1000, site0.getRetrySleepTime());
assertEquals(0, site0.getRetryTimes());
assertFalse(site0.isDisableCookieManagement());
assertEquals(0, site0.getCycleRetryTimes());
}
@Test(timeout = 4000)
public void test216() throws Throwable {
Site site0 = Site.me();
Site site1 = site0.setUserAgent("DHHnBX3>oa=,{6");
site1.hashCode();
assertEquals(1000, site1.getRetrySleepTime());
assertEquals(5000, site1.getSleepTime());
assertEquals(5000, site1.getTimeOut());
}
@Test(timeout = 4000)
public void test217() throws Throwable {
Site site0 = Site.me();
site0.getHeaders();
assertEquals(1000, site0.getRetrySleepTime());
assertEquals(5000, site0.getTimeOut());
assertEquals(0, site0.getRetryTimes());
assertTrue(site0.isUseGzip());
assertEquals(5000, site0.getSleepTime());
assertFalse(site0.isDisableCookieManagement());
assertEquals(0, site0.getCycleRetryTimes());
}
@Test(timeout = 4000)
public void test218() throws Throwable {
Site site0 = Site.me();
site0.getUserAgent();
assertEquals(1000, site0.getRetrySleepTime());
assertEquals(5000, site0.getTimeOut());
assertTrue(site0.isUseGzip());
assertEquals(5000, site0.getSleepTime());
assertEquals(0, site0.getRetryTimes());
assertEquals(0, site0.getCycleRetryTimes());
assertFalse(site0.isDisableCookieManagement());
}
@Test(timeout = 4000)
public void test219() throws Throwable {
Site site0 = Site.me();
int int0 = site0.getCycleRetryTimes();
assertTrue(site0.isUseGzip());
assertFalse(site0.isDisableCookieManagement());
assertEquals(0, site0.getRetryTimes());
assertEquals(1000, site0.getRetrySleepTime());
assertEquals(5000, site0.getTimeOut());
assertEquals(5000, site0.getSleepTime());
assertEquals(0, int0);
}
@Test(timeout = 4000)
public void test220() throws Throwable {
Site site0 = new Site();
assertFalse(site0.isDisableCookieManagement());
site0.setDisableCookieManagement(true);
site0.addHeader("", "");
assertTrue(site0.isDisableCookieManagement());
}
@Test(timeout = 4000)
public void test221() throws Throwable {
Site site0 = Site.me();
assertTrue(site0.isUseGzip());
site0.setUseGzip(false);
site0.addCookie("", "EM}u");
assertFalse(site0.isUseGzip());
}
@Test(timeout = 4000)
public void test222() throws Throwable {
Site site0 = new Site();
site0.setRetrySleepTime((-2017));
site0.addCookie("O>'PMP>r:]o%4E5\u0006f&", ", cycleRetryTimes=");
assertEquals((-2017), site0.getRetrySleepTime());
}
@Test(timeout = 4000)
public void test223() throws Throwable {
Site site0 = new Site();
boolean boolean0 = site0.isUseGzip();
assertEquals(1000, site0.getRetrySleepTime());
assertEquals(5000, site0.getTimeOut());
assertEquals(0, site0.getCycleRetryTimes());
assertFalse(site0.isDisableCookieManagement());
assertEquals(5000, site0.getSleepTime());
assertEquals(0, site0.getRetryTimes());
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test224() throws Throwable {
Site site0 = new Site();
site0.toTask();
assertEquals(5000, site0.getSleepTime());
assertFalse(site0.isDisableCookieManagement());
assertEquals(0, site0.getCycleRetryTimes());
assertEquals(5000, site0.getTimeOut());
assertEquals(0, site0.getRetryTimes());
assertEquals(1000, site0.getRetrySleepTime());
assertTrue(site0.isUseGzip());
}
@Test(timeout = 4000)
public void test225() throws Throwable {
Site site0 = Site.me();
site0.setCycleRetryTimes(5000);
Site site1 = new Site();
boolean boolean0 = site0.equals(site1);
assertEquals(5000, site0.getCycleRetryTimes());
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test226() throws Throwable {
Site site0 = Site.me();
boolean boolean0 = site0.isDisableCookieManagement();
assertEquals(1000, site0.getRetrySleepTime());
assertFalse(boolean0);
assertEquals(5000, site0.getTimeOut());
assertEquals(0, site0.getRetryTimes());
assertEquals(0, site0.getCycleRetryTimes());
assertEquals(5000, site0.getSleepTime());
assertTrue(site0.isUseGzip());
}
@Test(timeout = 4000)
public void test227() throws Throwable {
Site site0 = new Site();
int int0 = site0.getTimeOut();
assertFalse(site0.isDisableCookieManagement());
assertEquals(0, site0.getCycleRetryTimes());
assertEquals(1000, site0.getRetrySleepTime());
assertEquals(0, site0.getRetryTimes());
assertTrue(site0.isUseGzip());
assertEquals(5000, int0);
assertEquals(5000, site0.getSleepTime());
}
@Test(timeout = 4000)
public void test228() throws Throwable {
Site site0 = new Site();
site0.getCharset();
assertEquals(5000, site0.getSleepTime());
assertEquals(0, site0.getRetryTimes());
assertEquals(0, site0.getCycleRetryTimes());
assertFalse(site0.isDisableCookieManagement());
assertEquals(1000, site0.getRetrySleepTime());
assertEquals(5000, site0.getTimeOut());
assertTrue(site0.isUseGzip());
}
@Test(timeout = 4000)
public void test229() throws Throwable {
Site site0 = new Site();
Site site1 = site0.setAcceptStatCode((Set<Integer>) null);
Site site2 = Site.me();
boolean boolean0 = site1.equals(site2);
assertEquals(5000, site2.getTimeOut());
assertEquals(1000, site2.getRetrySleepTime());
assertTrue(site2.isUseGzip());
assertEquals(0, site2.getRetryTimes());
assertFalse(site2.equals((Object)site0));
assertEquals(5000, site2.getSleepTime());
assertFalse(boolean0);
assertEquals(0, site2.getCycleRetryTimes());
assertFalse(site2.isDisableCookieManagement());
}
}
| [
"granogiovanni90@gmail.com"
] | granogiovanni90@gmail.com |
0f852debdec7960b70f127a3b1b388e58394c75e | 158c4b2aded0df654e9441c67a820ea74f04477f | /src/test/java/com/bind/eventbus/eventbus/EventbusApplicationTests.java | d4f61b9fab40bc007e9e4a4312f13dd44aa15c8f | [] | no_license | careybind/eventbus | 5cd49c8eda3abffdf9166e275f2b808603ec1f63 | e0e0170a5dfb3a2474569d5b16380b3765948db2 | refs/heads/master | 2020-06-25T08:32:35.526216 | 2019-09-11T02:43:39 | 2019-09-11T02:43:39 | 199,259,954 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 354 | java | package com.bind.eventbus.eventbus;
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 EventbusApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"821874441@qq.com"
] | 821874441@qq.com |
d8c767dea6f969bc455fb511de0394462cda6720 | 6f27727f4a3d9542b0fa3fc565fae379b0ff0aad | /src/leetcode/editor/cn/ReverseLinkedListIi.java | bd0562f0dde62db418fc1f7c936a9aafa961bb98 | [] | no_license | nuaayuhy/JavaCode | 4c1556d8869f9fb8a33b16520440daf20a2832bd | 7b08f61a37d9ec2b089dc6ddbdd768366f57cde8 | refs/heads/master | 2023-03-28T13:02:51.617270 | 2021-03-24T15:33:05 | 2021-03-24T15:33:05 | 351,119,505 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,240 | java | //给你单链表的头指针 head 和两个整数 left 和 right ,其中 left <= right 。请你反转从位置 left 到位置 right 的链
//表节点,返回 反转后的链表 。
//
//
// 示例 1:
//
//
//输入:head = [1,2,3,4,5], left = 2, right = 4
//输出:[1,4,3,2,5]
//
//
// 示例 2:
//
//
//输入:head = [5], left = 1, right = 1
//输出:[5]
//
//
//
//
// 提示:
//
//
// 链表中节点数目为 n
// 1 <= n <= 500
// -500 <= Node.val <= 500
// 1 <= left <= right <= n
//
//
//
//
// 进阶: 你可以使用一趟扫描完成反转吗?
// Related Topics 链表
// 👍 833 👎 0
package leetcode.editor.cn;
import java.util.List;
//Java:反转链表 II
public class ReverseLinkedListIi{
public static void main(String[] args) {
Solution solution = new ReverseLinkedListIi().new Solution();
// TO TEST
}
//leetcode submit region begin(Prohibit modification and deletion)
/**
* Definition for singly-linked list.
* */
public class ListNode {
int val;
ListNode next;
ListNode() {}
ListNode(int val) { this.val = val; }
ListNode(int val, ListNode next) { this.val = val; this.next = next; }
}
class Solution {
public ListNode reverseBetween(ListNode head, int left, int right) {
ListNode dummyNode = new ListNode(-1);
dummyNode.next = head;
ListNode pre = dummyNode;
for (int i = 0; i < left - 1; i++) {
pre = pre.next;
}
ListNode rightNode = pre;
for (int i = 0; i < right - left + 1; i++) {
rightNode = rightNode.next;
}
ListNode leftNode = pre.next;
ListNode succ = rightNode.next;
pre.next = null;
rightNode.next = null;
reverseLinkedList(leftNode);
pre.next = rightNode;
leftNode.next = succ;
return dummyNode.next;
}
private void reverseLinkedList(ListNode head){
ListNode pre = null;
ListNode cur = head;
while(cur != null){
ListNode next = cur.next;
cur.next = pre;
pre = cur;
cur = next;
}
}
}
//leetcode submit region end(Prohibit modification and deletion)
} | [
"1106658062@qq.com"
] | 1106658062@qq.com |
cda452ed85f2050540214fd113f6f82fa9306aa8 | b93cf9293b4b0d14c3e3af74bfe65b141496f859 | /JPAWellness/src/test/java/com/skilldistillery/wellnesstracker/entities/WellnessTest.java | 89a9aba150cafe01ce866cf3c485c57e94ad50d5 | [] | no_license | kbow009/EventTrackerProject | 73c25041e0230518a4c98f06c5db79ba3a35064a | 07c22b7745dd0a28dfeef933ddfa571813d65c5a | refs/heads/main | 2023-08-27T21:30:11.783196 | 2021-10-18T14:15:03 | 2021-10-18T14:15:03 | 415,108,874 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,084 | java | package com.skilldistillery.wellnesstracker.entities;
import static org.junit.jupiter.api.Assertions.*;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
class WellnessTest {
private static EntityManagerFactory emf;
private EntityManager em;
private Wellness wellness;
@BeforeAll
static void setUpBeforeClass() throws Exception {
emf = Persistence.createEntityManagerFactory("JPAWellness");
}
@AfterAll
static void tearDownAfterClass() throws Exception {
emf.close();
}
@BeforeEach
void setUp() throws Exception {
em = emf.createEntityManager();
wellness = em.find(Wellness.class, 1);
}
@AfterEach
void tearDown() throws Exception {
em.close();
wellness = null;
}
@Test
void test() {
assertNotNull(wellness);
assertEquals("Meditation", wellness.getActivity());
}
}
| [
"bowman.kristin@gmail.com"
] | bowman.kristin@gmail.com |
bdb8853256bbbcfd12f0d9a9a8405d711a9e7f06 | a6cc10e4ce6c7bab94b529d28aa6685035be8082 | /src/main/java/com/athena/common/utils/poi/ExcelUtil.java | f1411d53a241d08a2023ead213814fbe8dd006e4 | [] | no_license | jo4fark/owl-sv | 826c3de76bca51d861398b9db1f3386b785f1408 | ac4bfee463d30f7a4efedb6a5a7b9d38fc37558f | refs/heads/master | 2022-12-04T17:23:22.551473 | 2020-08-18T08:44:17 | 2020-08-18T08:44:17 | 288,401,824 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 27,670 | java | package com.athena.common.utils.poi;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.DataValidation;
import org.apache.poi.ss.usermodel.DataValidationConstraint;
import org.apache.poi.ss.usermodel.DataValidationHelper;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.apache.poi.ss.util.CellRangeAddressList;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFDataValidation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.athena.framework.aspectj.lang.annotation.Excel;
import com.athena.framework.aspectj.lang.annotation.Excel.ColumnType;
import com.athena.framework.aspectj.lang.annotation.Excel.Type;
import com.athena.framework.aspectj.lang.annotation.Excels;
import com.athena.framework.config.RuoYiConfig;
import com.athena.framework.web.domain.ResResult;
import com.athena.common.core.text.Convert;
import com.athena.common.exception.CustomException;
import com.athena.common.utils.DateUtils;
import com.athena.common.utils.reflect.ReflectUtils;
/**
* Excel相关处理
*
* @author athena
*/
public class ExcelUtil<T>
{
private static final Logger log = LoggerFactory.getLogger(ExcelUtil.class);
/**
* Excel sheet最大行数,默认65536
*/
public static final int sheetSize = 65536;
/**
* 工作表名称
*/
private String sheetName;
/**
* 导出类型(EXPORT:导出数据;IMPORT:导入模板)
*/
private Type type;
/**
* 工作薄对象
*/
private Workbook wb;
/**
* 工作表对象
*/
private Sheet sheet;
/**
* 样式列表
*/
private Map<String, CellStyle> styles;
/**
* 导入导出数据列表
*/
private List<T> list;
/**
* 注解列表
*/
private List<Object[]> fields;
/**
* 实体对象
*/
public Class<T> clazz;
public ExcelUtil(Class<T> clazz)
{
this.clazz = clazz;
}
public void init(List<T> list, String sheetName, Type type)
{
if (list == null)
{
list = new ArrayList<T>();
}
this.list = list;
this.sheetName = sheetName;
this.type = type;
createExcelField();
createWorkbook();
}
/**
* 对excel表单默认第一个索引名转换成list
*
* @param is 输入流
* @return 转换后集合
*/
public List<T> importExcel(InputStream is) throws Exception
{
return importExcel(StrUtil.EMPTY, is);
}
/**
* 对excel表单指定表格索引名转换成list
*
* @param sheetName 表格索引名
* @param is 输入流
* @return 转换后集合
*/
public List<T> importExcel(String sheetName, InputStream is) throws Exception
{
this.type = Type.IMPORT;
this.wb = WorkbookFactory.create(is);
List<T> list = new ArrayList<T>();
Sheet sheet = null;
if (StrUtil.isNotEmpty(sheetName))
{
// 如果指定sheet名,则取指定sheet中的内容.
sheet = wb.getSheet(sheetName);
}
else
{
// 如果传入的sheet名不存在则默认指向第1个sheet.
sheet = wb.getSheetAt(0);
}
if (sheet == null)
{
throw new IOException("文件sheet不存在");
}
int rows = sheet.getPhysicalNumberOfRows();
if (rows > 0)
{
// 定义一个map用于存放excel列的序号和field.
Map<String, Integer> cellMap = new HashMap<String, Integer>();
// 获取表头
Row heard = sheet.getRow(0);
for (int i = 0; i < heard.getPhysicalNumberOfCells(); i++)
{
Cell cell = heard.getCell(i);
if (ObjectUtil.isNotNull(cell != null))
{
String value = this.getCellValue(heard, i).toString();
cellMap.put(value, i);
}
else
{
cellMap.put(null, i);
}
}
// 有数据时才处理 得到类的所有field.
Field[] allFields = clazz.getDeclaredFields();
// 定义一个map用于存放列的序号和field.
Map<Integer, Field> fieldsMap = new HashMap<Integer, Field>();
for (int col = 0; col < allFields.length; col++)
{
Field field = allFields[col];
Excel attr = field.getAnnotation(Excel.class);
if (attr != null && (attr.type() == Type.ALL || attr.type() == type))
{
// 设置类的私有字段属性可访问.
field.setAccessible(true);
Integer column = cellMap.get(attr.name());
fieldsMap.put(column, field);
}
}
for (int i = 1; i < rows; i++)
{
// 从第2行开始取数据,默认第一行是表头.
Row row = sheet.getRow(i);
T entity = null;
for (Map.Entry<Integer, Field> entry : fieldsMap.entrySet())
{
Object val = this.getCellValue(row, entry.getKey());
// 如果不存在实例则新建.
entity = (entity == null ? clazz.newInstance() : entity);
// 从map中得到对应列的field.
Field field = fieldsMap.get(entry.getKey());
// 取得类型,并根据对象类型设置值.
Class<?> fieldType = field.getType();
if (String.class == fieldType)
{
String s = Convert.toStr(val);
if (StrUtil.endWith(s, ".0"))
{
val = StrUtil.subBefore(s, ".0",false);
}
else
{
val = Convert.toStr(val);
}
}
else if ((Integer.TYPE == fieldType) || (Integer.class == fieldType))
{
val = Convert.toInt(val);
}
else if ((Long.TYPE == fieldType) || (Long.class == fieldType))
{
val = Convert.toLong(val);
}
else if ((Double.TYPE == fieldType) || (Double.class == fieldType))
{
val = Convert.toDouble(val);
}
else if ((Float.TYPE == fieldType) || (Float.class == fieldType))
{
val = Convert.toFloat(val);
}
else if (BigDecimal.class == fieldType)
{
val = Convert.toBigDecimal(val);
}
else if (Date.class == fieldType)
{
if (val instanceof String)
{
val = DateUtils.parseDate(val);
}
else if (val instanceof Double)
{
val = DateUtil.getJavaDate((Double) val);
}
}
if (ObjectUtil.isNotNull(fieldType))
{
Excel attr = field.getAnnotation(Excel.class);
String propertyName = field.getName();
if (StrUtil.isNotEmpty(attr.targetAttr()))
{
propertyName = field.getName() + "." + attr.targetAttr();
}
else if (StrUtil.isNotEmpty(attr.readConverterExp()))
{
val = reverseByExp(String.valueOf(val), attr.readConverterExp());
}
ReflectUtils.invokeSetter(entity, propertyName, val);
}
}
list.add(entity);
}
}
return list;
}
/**
* 对list数据源将其里面的数据导入到excel表单
*
* @param list 导出数据集合
* @param sheetName 工作表的名称
* @return 结果
*/
public ResResult exportExcel(List<T> list, String sheetName)
{
this.init(list, sheetName, Type.EXPORT);
return exportExcel();
}
/**
* 对list数据源将其里面的数据导入到excel表单
*
* @param sheetName 工作表的名称
* @return 结果
*/
public ResResult importTemplateExcel(String sheetName)
{
this.init(null, sheetName, Type.IMPORT);
return exportExcel();
}
/**
* 对list数据源将其里面的数据导入到excel表单
*
* @return 结果
*/
public ResResult exportExcel()
{
OutputStream out = null;
try
{
// 取出一共有多少个sheet.
double sheetNo = Math.ceil(list.size() / sheetSize);
for (int index = 0; index <= sheetNo; index++)
{
createSheet(sheetNo, index);
// 产生一行
Row row = sheet.createRow(0);
int column = 0;
// 写入各个字段的列头名称
for (Object[] os : fields)
{
Excel excel = (Excel) os[1];
this.createCell(excel, row, column++);
}
if (Type.EXPORT.equals(type))
{
fillExcelData(index, row);
}
}
String filename = encodingFilename(sheetName);
out = new FileOutputStream(getAbsoluteFile(filename));
wb.write(out);
return ResResult.success(filename);
}
catch (Exception e)
{
log.error("导出Excel异常{}", e.getMessage());
throw new CustomException("导出Excel失败,请联系网站管理员!");
}
finally
{
if (wb != null)
{
try
{
wb.close();
}
catch (IOException e1)
{
e1.printStackTrace();
}
}
if (out != null)
{
try
{
out.close();
}
catch (IOException e1)
{
e1.printStackTrace();
}
}
}
}
/**
* 填充excel数据
*
* @param index 序号
* @param row 单元格行
*/
public void fillExcelData(int index, Row row)
{
int startNo = index * sheetSize;
int endNo = Math.min(startNo + sheetSize, list.size());
for (int i = startNo; i < endNo; i++)
{
row = sheet.createRow(i + 1 - startNo);
// 得到导出对象.
T vo = (T) list.get(i);
int column = 0;
for (Object[] os : fields)
{
Field field = (Field) os[0];
Excel excel = (Excel) os[1];
// 设置实体类私有属性可访问
field.setAccessible(true);
this.addCell(excel, row, vo, field, column++);
}
}
}
/**
* 创建表格样式
*
* @param wb 工作薄对象
* @return 样式列表
*/
private Map<String, CellStyle> createStyles(Workbook wb)
{
// 写入各条记录,每条记录对应excel表中的一行
Map<String, CellStyle> styles = new HashMap<String, CellStyle>();
CellStyle style = wb.createCellStyle();
style.setAlignment(HorizontalAlignment.CENTER);
style.setVerticalAlignment(VerticalAlignment.CENTER);
style.setBorderRight(BorderStyle.THIN);
style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
style.setBorderLeft(BorderStyle.THIN);
style.setLeftBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
style.setBorderTop(BorderStyle.THIN);
style.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
style.setBorderBottom(BorderStyle.THIN);
style.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
Font dataFont = wb.createFont();
dataFont.setFontName("Arial");
dataFont.setFontHeightInPoints((short) 10);
style.setFont(dataFont);
styles.put("data", style);
style = wb.createCellStyle();
style.cloneStyleFrom(styles.get("data"));
style.setAlignment(HorizontalAlignment.CENTER);
style.setVerticalAlignment(VerticalAlignment.CENTER);
style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
Font headerFont = wb.createFont();
headerFont.setFontName("Arial");
headerFont.setFontHeightInPoints((short) 10);
headerFont.setBold(true);
headerFont.setColor(IndexedColors.WHITE.getIndex());
style.setFont(headerFont);
styles.put("header", style);
return styles;
}
/**
* 创建单元格
*/
public Cell createCell(Excel attr, Row row, int column)
{
// 创建列
Cell cell = row.createCell(column);
// 写入列信息
cell.setCellValue(attr.name());
setDataValidation(attr, row, column);
cell.setCellStyle(styles.get("header"));
return cell;
}
/**
* 设置单元格信息
*
* @param value 单元格值
* @param attr 注解相关
* @param cell 单元格信息
*/
public void setCellVo(Object value, Excel attr, Cell cell)
{
if (ColumnType.STRING == attr.cellType())
{
cell.setCellType(CellType.NUMERIC);
cell.setCellValue(ObjectUtil.isNull(value) ? attr.defaultValue() : value + attr.suffix());
}
else if (ColumnType.NUMERIC == attr.cellType())
{
cell.setCellType(CellType.NUMERIC);
cell.setCellValue(Integer.parseInt(value + ""));
}
}
/**
* 创建表格样式
*/
public void setDataValidation(Excel attr, Row row, int column)
{
if (attr.name().indexOf("注:") >= 0)
{
sheet.setColumnWidth(column, 6000);
}
else
{
// 设置列宽
sheet.setColumnWidth(column, (int) ((attr.width() + 0.72) * 256));
row.setHeight((short) (attr.height() * 20));
}
// 如果设置了提示信息则鼠标放上去提示.
if (StrUtil.isNotEmpty(attr.prompt()))
{
// 这里默认设了2-101列提示.
setXSSFPrompt(sheet, "", attr.prompt(), 1, 100, column, column);
}
// 如果设置了combo属性则本列只能选择不能输入
if (attr.combo().length > 0)
{
// 这里默认设了2-101列只能选择不能输入.
setXSSFValidation(sheet, attr.combo(), 1, 100, column, column);
}
}
/**
* 添加单元格
*/
public Cell addCell(Excel attr, Row row, T vo, Field field, int column)
{
Cell cell = null;
try
{
// 设置行高
row.setHeight((short) (attr.height() * 20));
// 根据Excel中设置情况决定是否导出,有些情况需要保持为空,希望用户填写这一列.
if (attr.isExport())
{
// 创建cell
cell = row.createCell(column);
cell.setCellStyle(styles.get("data"));
// 用于读取对象中的属性
Object value = getTargetValue(vo, field, attr);
String dateFormat = attr.dateFormat();
String readConverterExp = attr.readConverterExp();
if (StrUtil.isNotEmpty(dateFormat) && ObjectUtil.isNotNull(value))
{
cell.setCellValue(DateUtils.parseDateToStr(dateFormat, (Date) value));
}
else if (StrUtil.isNotEmpty(readConverterExp) && ObjectUtil.isNotNull(value))
{
cell.setCellValue(convertByExp(String.valueOf(value), readConverterExp));
}
else
{
// 设置列类型
setCellVo(value, attr, cell);
}
}
}
catch (Exception e)
{
log.error("导出Excel失败{}", e);
}
return cell;
}
/**
* 设置 POI XSSFSheet 单元格提示
*
* @param sheet 表单
* @param promptTitle 提示标题
* @param promptContent 提示内容
* @param firstRow 开始行
* @param endRow 结束行
* @param firstCol 开始列
* @param endCol 结束列
*/
public void setXSSFPrompt(Sheet sheet, String promptTitle, String promptContent, int firstRow, int endRow,
int firstCol, int endCol)
{
DataValidationHelper helper = sheet.getDataValidationHelper();
DataValidationConstraint constraint = helper.createCustomConstraint("DD1");
CellRangeAddressList regions = new CellRangeAddressList(firstRow, endRow, firstCol, endCol);
DataValidation dataValidation = helper.createValidation(constraint, regions);
dataValidation.createPromptBox(promptTitle, promptContent);
dataValidation.setShowPromptBox(true);
sheet.addValidationData(dataValidation);
}
/**
* 设置某些列的值只能输入预制的数据,显示下拉框.
*
* @param sheet 要设置的sheet.
* @param textlist 下拉框显示的内容
* @param firstRow 开始行
* @param endRow 结束行
* @param firstCol 开始列
* @param endCol 结束列
* @return 设置好的sheet.
*/
public void setXSSFValidation(Sheet sheet, String[] textlist, int firstRow, int endRow, int firstCol, int endCol)
{
DataValidationHelper helper = sheet.getDataValidationHelper();
// 加载下拉列表内容
DataValidationConstraint constraint = helper.createExplicitListConstraint(textlist);
// 设置数据有效性加载在哪个单元格上,四个参数分别是:起始行、终止行、起始列、终止列
CellRangeAddressList regions = new CellRangeAddressList(firstRow, endRow, firstCol, endCol);
// 数据有效性对象
DataValidation dataValidation = helper.createValidation(constraint, regions);
// 处理Excel兼容性问题
if (dataValidation instanceof XSSFDataValidation)
{
dataValidation.setSuppressDropDownArrow(true);
dataValidation.setShowErrorBox(true);
}
else
{
dataValidation.setSuppressDropDownArrow(false);
}
sheet.addValidationData(dataValidation);
}
/**
* 解析导出值 0=男,1=女,2=未知
*
* @param propertyValue 参数值
* @param converterExp 翻译注解
* @return 解析后值
* @throws Exception
*/
public static String convertByExp(String propertyValue, String converterExp) throws Exception
{
try
{
String[] convertSource = converterExp.split(",");
for (String item : convertSource)
{
String[] itemArray = item.split("=");
if (itemArray[0].equals(propertyValue))
{
return itemArray[1];
}
}
}
catch (Exception e)
{
throw e;
}
return propertyValue;
}
/**
* 反向解析值 男=0,女=1,未知=2
*
* @param propertyValue 参数值
* @param converterExp 翻译注解
* @return 解析后值
* @throws Exception
*/
public static String reverseByExp(String propertyValue, String converterExp) throws Exception
{
try
{
String[] convertSource = converterExp.split(",");
for (String item : convertSource)
{
String[] itemArray = item.split("=");
if (itemArray[1].equals(propertyValue))
{
return itemArray[0];
}
}
}
catch (Exception e)
{
throw e;
}
return propertyValue;
}
/**
* 编码文件名
*/
public String encodingFilename(String filename)
{
filename = UUID.randomUUID().toString() + "_" + filename + ".xlsx";
return filename;
}
/**
* 获取下载路径
*
* @param filename 文件名称
*/
public String getAbsoluteFile(String filename)
{
String downloadPath = RuoYiConfig.getDownloadPath() + filename;
File desc = new File(downloadPath);
if (!desc.getParentFile().exists())
{
desc.getParentFile().mkdirs();
}
return downloadPath;
}
/**
* 获取bean中的属性值
*
* @param vo 实体对象
* @param field 字段
* @param excel 注解
* @return 最终的属性值
* @throws Exception
*/
private Object getTargetValue(T vo, Field field, Excel excel) throws Exception
{
Object o = field.get(vo);
if (StrUtil.isNotEmpty(excel.targetAttr()))
{
String target = excel.targetAttr();
if (target.indexOf(".") > -1)
{
String[] targets = target.split("[.]");
for (String name : targets)
{
o = getValue(o, name);
}
}
else
{
o = getValue(o, target);
}
}
return o;
}
/**
* 以类的属性的get方法方法形式获取值
*
* @param o
* @param name
* @return value
* @throws Exception
*/
private Object getValue(Object o, String name) throws Exception
{
if (StrUtil.isNotEmpty(name))
{
Class<?> clazz = o.getClass();
String methodName = "get" + name.substring(0, 1).toUpperCase() + name.substring(1);
Method method = clazz.getMethod(methodName);
o = method.invoke(o);
}
return o;
}
/**
* 得到所有定义字段
*/
private void createExcelField()
{
this.fields = new ArrayList<Object[]>();
List<Field> tempFields = new ArrayList<>();
tempFields.addAll(Arrays.asList(clazz.getSuperclass().getDeclaredFields()));
tempFields.addAll(Arrays.asList(clazz.getDeclaredFields()));
for (Field field : tempFields)
{
// 单注解
if (field.isAnnotationPresent(Excel.class))
{
putToField(field, field.getAnnotation(Excel.class));
}
// 多注解
if (field.isAnnotationPresent(Excels.class))
{
Excels attrs = field.getAnnotation(Excels.class);
Excel[] excels = attrs.value();
for (Excel excel : excels)
{
putToField(field, excel);
}
}
}
}
/**
* 放到字段集合中
*/
private void putToField(Field field, Excel attr)
{
if (attr != null && (attr.type() == Type.ALL || attr.type() == type))
{
this.fields.add(new Object[] { field, attr });
}
}
/**
* 创建一个工作簿
*/
public void createWorkbook()
{
this.wb = new SXSSFWorkbook(500);
}
/**
* 创建工作表
*
* @param sheetNo sheet数量
* @param index 序号
*/
public void createSheet(double sheetNo, int index)
{
this.sheet = wb.createSheet();
this.styles = createStyles(wb);
// 设置工作表的名称.
if (sheetNo == 0)
{
wb.setSheetName(index, sheetName);
}
else
{
wb.setSheetName(index, sheetName + index);
}
}
/**
* 获取单元格值
*
* @param row 获取的行
* @param column 获取单元格列号
* @return 单元格值
*/
public Object getCellValue(Row row, int column)
{
if (row == null)
{
return row;
}
Object val = "";
try
{
Cell cell = row.getCell(column);
if (cell != null)
{
if (cell.getCellTypeEnum() == CellType.NUMERIC || cell.getCellTypeEnum() == CellType.FORMULA)
{
val = cell.getNumericCellValue();
if (HSSFDateUtil.isCellDateFormatted(cell))
{
val = DateUtil.getJavaDate((Double) val); // POI Excel 日期格式转换
}
else
{
if ((Double) val % 1 > 0)
{
val = new DecimalFormat("0.00").format(val);
}
else
{
val = new DecimalFormat("0").format(val);
}
}
}
else if (cell.getCellTypeEnum() == CellType.STRING)
{
val = cell.getStringCellValue();
}
else if (cell.getCellTypeEnum() == CellType.BOOLEAN)
{
val = cell.getBooleanCellValue();
}
else if (cell.getCellTypeEnum() == CellType.ERROR)
{
val = cell.getErrorCellValue();
}
}
}
catch (Exception e)
{
return val;
}
return val;
}
} | [
"yangyang@siro-info.com"
] | yangyang@siro-info.com |
d318324b99addaf7c1a6e4bac61d273840e51f4d | 25fe7d83f615ae581339b67c034cd31fa1426030 | /ComicReader/src/com/blogspot/applications4android/comicreader/comics/SafeHavens.java | 2d17d8b0c18a6778671f6a6d2c70b1898f47ff4e | [
"Apache-2.0"
] | permissive | applications4android/ComicReader | 87e2426925aa1cbab3d61e4b51ac193c1a3eeed7 | d553d25345851a9230811afc43fbba0f4fa64864 | refs/heads/master | 2021-07-05T09:49:11.702638 | 2020-08-23T03:23:52 | 2020-08-23T03:23:52 | 5,045,151 | 18 | 13 | NOASSERTION | 2020-04-10T06:18:44 | 2012-07-14T06:15:29 | HTML | UTF-8 | Java | false | false | 3,041 | java | package com.blogspot.applications4android.comicreader.comics;
import java.io.BufferedReader;
import java.io.IOException;
import java.util.Calendar;
//import android.util.Log;
import com.blogspot.applications4android.comicreader.comictypes.DailyComic;
import com.blogspot.applications4android.comicreader.core.Strip;
public class SafeHavens extends DailyComic {
/** list of month names */
private static final String[] MONTH_NAMES = {
"january", "february", "march",
"april", "may", "june", "july",
"august", "september", "october",
"november", "december" };
@Override
protected Calendar getFirstCalendar() {
Calendar first = Calendar.getInstance();
first.set(2012, 6, 9); // 2012-Jul-09
return first;
}
@Override
public String getComicWebPageUrl() {
return "http://www.safehavenscomic.com";
}
@Override
protected Calendar getLatestCalendar() {
return Calendar.getInstance(m_zone);
}
@Override
protected Calendar getTimeFromUrl(String url) {
url = url.replaceAll(".*comics/", "");
url = url.replaceAll("/", "");
String[] time = url.split("-");
int month = _getMonthIdFromName(time[0]);
int day = Integer.parseInt(time[1]);
int year = Integer.parseInt(time[2]);
//Log.d("SafeHavens", String.format("date=%d %d %d",year,month,day));
Calendar date = Calendar.getInstance();
date.set(year, month, day);
return date;
}
@Override
protected String parse(String url, BufferedReader reader, Strip strip) throws IOException {
// The date format is (using Linux date command formats)
// +%Y-%m-%d up thru 2012-Jun-30
// +%Y-%m-%d-2 for 2012-Jul-1 and 2012-Jul-8
// +fast%Y%m%d from 2012-Jul-2 to 2012-Jul-7
String str;
String final_str = null;
String final_title = null;
String final_date = null;
while((str = reader.readLine()) != null) {
int index1 = str.indexOf("og:image");
if (index1 != -1) {
final_str = str;
}
index1 = str.indexOf("og:title");
if (index1 != -1) {
final_date = str;
}
}
final_str = final_str.replaceAll(".*content=\"","");
final_str = final_str.replaceAll("\".*","");
final_date = final_date.replaceAll(".*content=\"","");
final_date = final_date.replaceAll("\".*","");
final_title = "Safe Havens" + ": " + final_date;
strip.setTitle(final_title);
strip.setText("-NA-");
return final_str;
}
@Override
public String getUrlFromTime(Calendar cal) {
String url = "http://www.safehavenscomic.com/comics/";
url += _getMonthNameFromId(cal.get(Calendar.MONTH)) + "-" + cal.get(Calendar.DAY_OF_MONTH) + "-" + cal.get(Calendar.YEAR);
return url;
}
private int _getMonthIdFromName(String name) {
int idx = 0;
for(String mon: MONTH_NAMES) {
if(mon.equals(name)) {
return idx;
}
idx++;
}
return -1;
}
private String _getMonthNameFromId(int idx) {
return MONTH_NAMES[idx];
}
@Override
protected boolean htmlNeeded() {
return true;
}
}
| [
"ali.corbin@gmail.com"
] | ali.corbin@gmail.com |
69967af71a185a26809abdde7b4a49a610fdfc22 | d9541d9c794526f57c27baa0f43b1f53b7ab013a | /yodlee-api-model-beta/src/main/java/com/yodlee/api/model/enums/EligibilityStatus.java | 1549ed2bc0f63f0777a3c2e8a8d04a345cb4af70 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | Yodlee/java-sdk | 1dfb42eee056d71cd3be0f3e2a50c909f17548e6 | 7bbb12aecb8ec137b758ecd98479ca80e6a59613 | refs/heads/master | 2023-03-17T01:54:00.366648 | 2023-03-06T11:25:48 | 2023-03-06T11:25:48 | 214,408,027 | 7 | 8 | MIT | 2023-03-22T02:11:44 | 2019-10-11T10:26:27 | Java | UTF-8 | Java | false | false | 651 | java | /**
* Copyright (c) 2019 Yodlee, Inc. All Rights Reserved.
*
* Licensed under the MIT License. See LICENSE file in the project root for license information.
*/
package com.yodlee.api.model.enums;
public enum EligibilityStatus {
/**
* This status indicates that the account is eligible for next update
*/
ALLOW_UPDATE, //
/**
* The status indicates to update or refresh the account by directing the user to edit the provided credentials
*/
ALLOW_UPDATE_WITH_CREDENTIALS, //
/**
* The status indicates the account is not eligible for the update or refresh process due to a site issue or a
* technical error
*/
DISALLOW_UPDATE
}
| [
"ktandon@yodlee.com"
] | ktandon@yodlee.com |
d367745b550a6d271d04c8a7d634432b73750fa5 | 96a580b4b791887b546b81367ffcffc8a3022bb2 | /src/main/java/com/krishanwyse/prepaidcard/resources/CardResource.java | e89c0647894597fdd261f4dc6a17ddeee29328cd | [] | no_license | kwyse/prepaid-card | 8977ce94ca74784bb0c2beea53acd13e638530e2 | a0f4397f1c4b9fdd4f977ae70248154e6a9fa3a3 | refs/heads/master | 2020-05-22T23:34:26.736552 | 2017-03-20T22:07:56 | 2017-03-20T22:07:56 | 84,734,118 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,521 | java | package com.krishanwyse.prepaidcard.resources;
import com.krishanwyse.prepaidcard.core.*;
import com.krishanwyse.prepaidcard.db.CardDao;
import javax.validation.Valid;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import java.util.List;
@Path("/cards")
@Produces(MediaType.APPLICATION_JSON)
public class CardResource {
private final CardDao dao;
public CardResource(CardDao dao) {
this.dao = dao;
}
@GET
public List<Card> getAll() {
return dao.selectAll();
}
@GET
@Path("/{id}")
public Card get(@PathParam("id") long id) {
return getCardIfExists(id);
}
@POST
@Consumes(MediaType.APPLICATION_JSON)
public Card add(@Valid Card card) {
long id = dao.insert(card);
card.setId(id);
return card;
}
@PUT
@Path("/{id}")
@Consumes(MediaType.APPLICATION_JSON)
public Card load(@PathParam("id") long id, Amount amount) {
if (amount.get() < 0)
throw new BadRequestException("Only a positive amount can be loaded onto this card");
Card card = getCardIfExists(id);
double newBalance = card.getBalance() + amount.get();
dao.updateBalance(id, newBalance);
card.setBalance(newBalance);
return card;
}
private Card getCardIfExists(long id) {
Card card = dao.selectById(id);
if (card == null)
throw new BadRequestException(String.format("Card with ID %d not found", id));
return card;
}
}
| [
"kwysek@gmail.com"
] | kwysek@gmail.com |
fb29fb790bf27123a7c48a4cf2fc75fa75c52272 | c619ac11b618bae472b8c2ff481904751cdaf577 | /app/src/main/java/com/slogan/wristband/wristband/activity/VerifyCodeActivity.java | e3f018e98d9b2f63b85a16d8430ccf1997ee21a3 | [] | no_license | jygzdx/wristband | 7d93caa6b2c6c288069a4a0548628f916e19a0e5 | d5fa01f84da615c9631a87b30d07e43a65ef9016 | refs/heads/master | 2020-04-02T10:35:59.601611 | 2018-12-04T09:56:08 | 2018-12-04T09:56:08 | 154,346,384 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,260 | java | package com.slogan.wristband.wristband.activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import com.slogan.wristband.wristband.R;
import com.slogan.wristband.wristband.activity.base.BaseActivity;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class VerifyCodeActivity extends BaseActivity {
@BindView(R.id.iv_left)
ImageView ivLeft;
@BindView(R.id.tv_phone)
TextView tvPhone;
@BindView(R.id.et_verify_code)
EditText etVerifyCode;
@BindView(R.id.tv_verify_time)
TextView tvVerifyTime;
@BindView(R.id.et_password)
EditText etPassword;
@BindView(R.id.tv_show_password)
ImageView tvShowPassword;
@BindView(R.id.tv_register)
TextView tvRegister;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_verify_code);
ButterKnife.bind(this);
initHandler();
initWidget();
}
@Override
public void initWidget() {
super.initWidget();
etVerifyCode.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
}
});
}
@OnClick({R.id.tv_verify_time, R.id.tv_show_password, R.id.tv_register})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.tv_verify_time:
break;
case R.id.tv_show_password:
break;
case R.id.tv_register:
gotoMainActivity();
break;
}
}
private void gotoMainActivity() {
Intent intent = new Intent(VerifyCodeActivity.this,MainActivity.class);
startActivity(intent);
}
}
| [
"chenhaihai@mishuoapp.com"
] | chenhaihai@mishuoapp.com |
9010d85544d5ecc63e65b0e5cd6acb420c89340c | c6abe8b953fcf79fc003cca0900ee2c86f54fcf6 | /sshd-core/src/main/java/org/apache/sshd/common/session/SessionDisconnectHandler.java | 6cf45588ffff7cebd109fb3c2286da9673ed9c57 | [
"Apache-2.0"
] | permissive | lgoldstein/mina-sshd | 1582fe9ae0045bfb615531e0204728ac54cbfcab | 962835303e015b09be51ffcce9392aae5103aef8 | refs/heads/master | 2023-06-14T16:10:25.598452 | 2020-02-27T08:43:54 | 2020-02-28T15:17:09 | 35,859,018 | 0 | 1 | NOASSERTION | 2021-03-05T09:18:25 | 2015-05-19T04:22:04 | Java | UTF-8 | Java | false | false | 7,417 | 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.sshd.common.session;
import java.io.IOException;
import java.util.Map;
import org.apache.sshd.common.Service;
import org.apache.sshd.common.kex.KexProposalOption;
import org.apache.sshd.common.session.helpers.TimeoutIndicator;
import org.apache.sshd.common.util.buffer.Buffer;
import org.apache.sshd.server.ServerFactoryManager;
/**
* Invoked when the internal session code decides it should disconnect
* a session due to some consideration. Usually allows intervening in
* the decision and even canceling it.
*
* @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
*/
public interface SessionDisconnectHandler {
/**
* Invoked when an internal timeout has expired (e.g., authentication, idle).
*
* @param session The session whose timeout has expired
* @param timeoutStatus The expired timeout
* @return {@code true} if expired timeout should be reset (i.e., no disconnect).
* If {@code false} then session will disconnect due to the expired timeout
* @throws IOException If failed to handle the event
*/
default boolean handleTimeoutDisconnectReason(
Session session, TimeoutIndicator timeoutStatus)
throws IOException {
return false;
}
/**
* Called to inform that the maximum allowed concurrent sessions threshold
* has been exceeded. <B>Note:</B> when handler is invoked the session is
* not yet marked as having been authenticated, nor has the authentication
* success been acknowledged to the peer.
*
* @param session The session that caused the excess
* @param service The {@link Service} instance through which the request was received
* @param username The authenticated username that is associated with the session.
* @param currentSessionCount The current sessions count
* @param maxSessionCount The maximum allowed sessions count
* @return {@code true} if accept the exceeding session regardless of the
* threshold. If {@code false} then exceeding session will be disconnected
* @throws IOException If failed to handle the event, <B>Note:</B> choosing
* to ignore this disconnect reason does not reset the current concurrent sessions
* counter in any way - i.e., the handler will be re-invoked every time the
* threshold is exceeded.
* @see ServerFactoryManager#MAX_CONCURRENT_SESSIONS
*/
default boolean handleSessionsCountDisconnectReason(
Session session, Service service, String username, int currentSessionCount, int maxSessionCount)
throws IOException {
return false;
}
/**
* Invoked when a request has been made related to an unknown SSH
* service as described in <A HREF="https://tools.ietf.org/html/rfc4253#section-10">RFC 4253 - section 10</A>.
*
* @param session The session through which the command was received
* @param cmd The service related command
* @param serviceName The service name
* @param buffer Any extra data received in the packet containing the request
* @return {@code true} if disregard the request (e.g., the handler handled it)
* @throws IOException If failed to handle the request
*/
default boolean handleUnsupportedServiceDisconnectReason(
Session session, int cmd, String serviceName, Buffer buffer)
throws IOException {
return false;
}
/**
* Invoked if the number of authentication attempts exceeded the maximum allowed
*
* @param session The session being authenticated
* @param service The {@link Service} instance through which the request was received
* @param serviceName The authentication service name
* @param method The authentication method name
* @param user The authentication username
* @param currentAuthCount The authentication attempt count
* @param maxAuthCount The maximum allowed attempts
* @return {@code true} if OK to ignore the exceeded attempt count and
* allow more attempts. <B>Note:</B> choosing to ignore this disconnect reason does
* not reset the current count - i.e., it will be re-invoked on the next attempt.
* @throws IOException If failed to handle the event
*/
default boolean handleAuthCountDisconnectReason(
Session session, Service service, String serviceName, String method, String user, int currentAuthCount, int maxAuthCount)
throws IOException {
return false;
}
/**
* Invoked if the authentication parameters changed in mid-authentication process.
*
* @param session The session being authenticated
* @param service The {@link Service} instance through which the request was received
* @param authUser The original username being authenticated
* @param username The requested username
* @param authService The original authentication service name
* @param serviceName The requested service name
* @return {@code true} if OK to ignore the change
* @throws IOException If failed to handle the event
*/
default boolean handleAuthParamsDisconnectReason(
Session session, Service service, String authUser, String username, String authService, String serviceName)
throws IOException {
return false;
}
/**
* Invoked if after KEX negotiation parameters resolved one of the options
* violates some internal constraint (e.g., cannot negotiate a value, or
* <A HREF="https://tools.ietf.org/html/rfc8308#section-2.2">RFC 8308 - section 2.2</A>).
*
* @param session The session where the violation occurred
* @param c2sOptions The client options
* @param s2cOptions The server options
* @param negotiatedGuess The negotiated KEX options
* @param option The violating {@link KexProposalOption}
* @return {@code true} if disregard the violation - if {@code false} then
* session will disconnect
* @throws IOException if attempted to exchange some packets to fix the situation
*/
default boolean handleKexDisconnectReason(
Session session, Map<KexProposalOption, String> c2sOptions, Map<KexProposalOption, String> s2cOptions,
Map<KexProposalOption, String> negotiatedGuess, KexProposalOption option)
throws IOException {
if (KexProposalOption.S2CLANG.equals(option) || KexProposalOption.C2SLANG.equals(option)) {
return true; // OK if cannot agree on a language
}
return false;
}
}
| [
"lgoldstein@apache.org"
] | lgoldstein@apache.org |
c038c87c532b3ec66e0b0101df7f2b0268e3c25c | cd63684aed7c31493c5c14bc7cef0d0508048dac | /config/config-api/src/test/java/com/thoughtworks/go/config/AllowTest.java | 8e8799927d4c1ceeaa57ec53b3da2d2fd8a89307 | [
"Apache-2.0"
] | permissive | zzz222zzz/gocd | cb1765d16840d96c991b8a9308c01cb37eb3ea7c | 280175df42d13e6cd94386a7af6fdac966b2e875 | refs/heads/master | 2020-05-09T20:25:48.079858 | 2019-04-15T02:53:33 | 2019-04-15T02:53:33 | 181,407,372 | 1 | 0 | Apache-2.0 | 2019-04-15T03:41:28 | 2019-04-15T03:41:26 | null | UTF-8 | Java | false | false | 885 | java | /*
* Copyright 2019 ThoughtWorks, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.thoughtworks.go.config;
class AllowTest extends AbstractDirectiveTest {
//runs the test from AbstractDirectiveTest for this Directive
Directive getDirective(String action, String type, String resource) {
return new Allow(action, type, resource);
}
} | [
"bdpiparva@gmail.com"
] | bdpiparva@gmail.com |
c1c3a9281f7473712e47eb9a9c6fe40ad3b5adcd | 7aa1f38d2dc0024d85a596019d704b76ea21aa4a | /uhc-custom-craft/src/main/java/gg/eris/uhc/customcraft/craft/vocation/specialist/SpecialistVocationRegistry.java | 21976c08fb67ae845e172583179b4c5b306cc601 | [
"MIT"
] | permissive | erisgg/uhc | 1b5b968b62d5871bc9c0ec3d3fad104ed972780d | 149fe0ba601dfc2eed1b7371208e2637d08c04cd | refs/heads/master | 2023-07-14T17:33:35.916193 | 2021-08-30T09:29:19 | 2021-08-30T09:29:19 | 356,544,971 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,727 | java | package gg.eris.uhc.customcraft.craft.vocation.specialist;
import gg.eris.uhc.core.UhcPlugin;
import gg.eris.uhc.customcraft.craft.vocation.Vocation;
import gg.eris.uhc.customcraft.craft.vocation.VocationRegistry;
import gg.eris.uhc.customcraft.craft.vocation.specialist.craft.HardenedHelmetCraft;
import gg.eris.uhc.customcraft.craft.vocation.specialist.craft.LightAnvilCraft;
import gg.eris.uhc.customcraft.craft.vocation.specialist.craft.LightObsidianCraft;
import gg.eris.uhc.customcraft.craft.vocation.specialist.craft.SeekersCompassCraft;
import gg.eris.uhc.customcraft.craft.vocation.specialist.perk.SpecialistPerk;
import gg.eris.uhc.customcraft.craft.vocation.specialist.trinket.EirenesAllureTrinket;
import gg.eris.uhc.customcraft.craft.vocation.specialist.trinket.PrometheusProtectionTrinket;
public final class SpecialistVocationRegistry extends VocationRegistry {
private static final SpecialistVocationRegistry REGISTRY = new SpecialistVocationRegistry();
private final SpecialistPerk perk;
private final EirenesAllureTrinket firstTrinket;
private final PrometheusProtectionTrinket secondTrinket;
private final LightObsidianCraft firstCraft;
private final LightAnvilCraft secondCraft;
private final HardenedHelmetCraft thirdCraft;
private final SeekersCompassCraft fourthCraft;
private SpecialistVocationRegistry() {
this.perk = register(
new SpecialistPerk(UhcPlugin.getPlugin().getCommons().getErisPlayerManager()));
this.firstTrinket = register(new EirenesAllureTrinket());
this.secondTrinket = register(new PrometheusProtectionTrinket());
this.firstCraft = register(new LightObsidianCraft());
this.secondCraft = register(new LightAnvilCraft());
this.thirdCraft = register(new HardenedHelmetCraft());
this.fourthCraft = register(new SeekersCompassCraft());
}
@Override
public String getIdentifierValue() {
return "specialist";
}
@Override
public SpecialistPerk getPerk() {
return this.perk;
}
@Override
public EirenesAllureTrinket getFirstTrinket() {
return this.firstTrinket;
}
@Override
public PrometheusProtectionTrinket getSecondTrinket() {
return this.secondTrinket;
}
@Override
public LightObsidianCraft getFirstCraft() {
return this.firstCraft;
}
@Override
public LightAnvilCraft getSecondCraft() {
return this.secondCraft;
}
@Override
public HardenedHelmetCraft getThirdCraft() {
return this.thirdCraft;
}
@Override
public SeekersCompassCraft getFourthCraft() {
return this.fourthCraft;
}
@Override
public Vocation getVocation() {
return Vocation.SPECIALIST;
}
public static SpecialistVocationRegistry get() {
return REGISTRY;
}
} | [
"alfie@alfiesmith.net"
] | alfie@alfiesmith.net |
0bfdbfebb9e0cc42d8769beace1161082501c959 | 670180fe6700cc3f8d86c1059748f606ff568013 | /litemall-apollo/src/main/java/com/doopai/litemall/apollo/service/HomeCacheManager.java | 2e58f81de1b9f21d22d8766d172e9ec7d4297d1e | [
"MIT"
] | permissive | litemall/litemall | fef8eb659b2eba563283eaa7b3a682d0e90e30ae | 201f033b6f842de27512879553e019779dd8a268 | refs/heads/master | 2022-07-23T23:37:35.612454 | 2019-12-17T15:19:43 | 2019-12-17T15:19:43 | 228,733,930 | 0 | 0 | MIT | 2022-06-21T02:27:58 | 2019-12-18T01:39:54 | Java | UTF-8 | Java | false | false | 2,261 | java | package com.doopai.litemall.apollo.service;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* 简单缓存的数据
*/
public class HomeCacheManager {
public static final boolean ENABLE = false;
public static final String INDEX = "index";
public static final String CATALOG = "catalog";
public static final String GOODS = "goods";
private static ConcurrentHashMap<String, Map<String, Object>> cacheDataList = new ConcurrentHashMap<>();
/**
* 缓存首页数据
*
* @param data
*/
public static void loadData(String cacheKey, Map<String, Object> data) {
Map<String, Object> cacheData = cacheDataList.get(cacheKey);
//有记录,则先丢弃
if (cacheData != null) {
cacheData.remove(cacheKey);
}
cacheData = new HashMap<>();
//深拷贝
cacheData.putAll(data);
cacheData.put("isCache", "true");
//设置缓存有效期为10分钟
cacheData.put("expireTime", LocalDateTime.now().plusMinutes(10));
cacheDataList.put(cacheKey, cacheData);
}
public static Map<String, Object> getCacheData(String cacheKey) {
return cacheDataList.get(cacheKey);
}
/**
* 判断缓存中是否有数据
*
* @return
*/
public static boolean hasData(String cacheKey) {
if (!ENABLE)
return false;
Map<String, Object> cacheData = cacheDataList.get(cacheKey);
if (cacheData == null) {
return false;
} else {
LocalDateTime expire = (LocalDateTime) cacheData.get("expireTime");
if (expire.isBefore(LocalDateTime.now())) {
return false;
} else {
return true;
}
}
}
/**
* 清除所有缓存
*/
public static void clearAll() {
cacheDataList = new ConcurrentHashMap<>();
}
/**
* 清除缓存数据
*/
public static void clear(String cacheKey) {
Map<String, Object> cacheData = cacheDataList.get(cacheKey);
if (cacheData != null) {
cacheDataList.remove(cacheKey);
}
}
}
| [
"duanhongyi@doopai.com"
] | duanhongyi@doopai.com |
12af3da4d4cde82a210ced8e93744b9ab8f7bf02 | da1d71c726da5a8184e78ccb6ea3387689b639a2 | /src/com/edjab/model/EditableUserProfile.java | eb7c1c513d200b96bab01606d8b3117fa632f087 | [] | no_license | nitishkohade/Edjab-PojoModel | eb210ae32733efdaf6bca622cfc292b95eb6d729 | e42ab48f7b5e449b9889bb06b8794fc8a824c243 | refs/heads/master | 2021-03-29T02:47:24.940903 | 2017-02-21T18:03:32 | 2017-02-21T18:03:32 | 60,392,765 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,701 | java | //@Copyright Edjab 2016
package com.edjab.model;
import java.util.List;
/**
* This is class that contains attributes editable by User. This class is not part of any table
* @author varun
*
*/
public class EditableUserProfile {
private String userId=" ";
private String firstName=" ";
private String middleName=" ";
private String lastName=" ";
private String emailId=" ";
private String gender=" ";
private String street=" ";
private String city=" ";
private String indianState=" ";
private String country=" ";
private String zip=" ";
private String contactNumber=" ";
private List<String> titles = null;
private String subscriptionFrequency=" ";
private String dateOfBirth=" ";
public EditableUserProfile(){
}
public EditableUserProfile(String userId, String firstName,
String middleName, String lastName, String emailId, String gender,
String street, String city, String indianState, String country,
String zip, String contactNumber, List<String> titles,
String subscriptionFrequency, String dateOfBirth) {
super();
this.userId = userId;
this.firstName = firstName;
this.middleName = middleName;
this.lastName = lastName;
this.emailId = emailId;
this.gender = gender;
this.street = street;
this.city = city;
this.indianState = indianState;
this.country = country;
this.zip = zip;
this.contactNumber = contactNumber;
this.titles = titles;
this.subscriptionFrequency = subscriptionFrequency;
this.dateOfBirth = dateOfBirth;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getMiddleName() {
return middleName;
}
public void setMiddleName(String middleName) {
this.middleName = middleName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getEmailId() {
return emailId;
}
public void setEmailId(String emailId) {
this.emailId = emailId;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getStreet() {
return street;
}
public void setStreet(String street) {
this.street = street;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getIndianState() {
return indianState;
}
public void setIndianState(String indianState) {
this.indianState = indianState;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getZip() {
return zip;
}
public void setZip(String zip) {
this.zip = zip;
}
public String getContactNumber() {
return contactNumber;
}
public void setContactNumber(String contactNumber) {
this.contactNumber = contactNumber;
}
public List<String> getTitles() {
return titles;
}
public void setTitles(List<String> titles) {
this.titles = titles;
}
public String getSubscriptionFrequency() {
return subscriptionFrequency;
}
public void setSubscriptionFrequency(String subscriptionFrequency) {
this.subscriptionFrequency = subscriptionFrequency;
}
public String getDateOfBirth() {
return dateOfBirth;
}
public void setDateOfBirth(String dateOfBirth) {
this.dateOfBirth = dateOfBirth;
}
@Override
public String toString() {
return "EditableUserProfile [userId=" + userId + ", firstName="
+ firstName + ", middleName=" + middleName + ", lastName="
+ lastName + ", emailId=" + emailId + ", gender=" + gender
+ ", street=" + street + ", city=" + city + ", indianState="
+ indianState + ", country=" + country + ", zip=" + zip
+ ", contactNumber=" + contactNumber + ", titles=" + titles
+ ", subscriptionFrequency=" + subscriptionFrequency
+ ", dateOfBirth=" + dateOfBirth + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((city == null) ? 0 : city.hashCode());
result = prime * result
+ ((contactNumber == null) ? 0 : contactNumber.hashCode());
result = prime * result + ((country == null) ? 0 : country.hashCode());
result = prime * result
+ ((dateOfBirth == null) ? 0 : dateOfBirth.hashCode());
result = prime * result + ((emailId == null) ? 0 : emailId.hashCode());
result = prime * result
+ ((firstName == null) ? 0 : firstName.hashCode());
result = prime * result + ((gender == null) ? 0 : gender.hashCode());
result = prime * result
+ ((indianState == null) ? 0 : indianState.hashCode());
result = prime * result
+ ((lastName == null) ? 0 : lastName.hashCode());
result = prime * result
+ ((middleName == null) ? 0 : middleName.hashCode());
result = prime * result + ((street == null) ? 0 : street.hashCode());
result = prime
* result
+ ((subscriptionFrequency == null) ? 0 : subscriptionFrequency
.hashCode());
result = prime * result + ((titles == null) ? 0 : titles.hashCode());
result = prime * result + ((userId == null) ? 0 : userId.hashCode());
result = prime * result + ((zip == null) ? 0 : zip.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
EditableUserProfile other = (EditableUserProfile) obj;
if (city == null) {
if (other.city != null)
return false;
} else if (!city.equals(other.city))
return false;
if (contactNumber == null) {
if (other.contactNumber != null)
return false;
} else if (!contactNumber.equals(other.contactNumber))
return false;
if (country == null) {
if (other.country != null)
return false;
} else if (!country.equals(other.country))
return false;
if (dateOfBirth == null) {
if (other.dateOfBirth != null)
return false;
} else if (!dateOfBirth.equals(other.dateOfBirth))
return false;
if (emailId == null) {
if (other.emailId != null)
return false;
} else if (!emailId.equals(other.emailId))
return false;
if (firstName == null) {
if (other.firstName != null)
return false;
} else if (!firstName.equals(other.firstName))
return false;
if (gender == null) {
if (other.gender != null)
return false;
} else if (!gender.equals(other.gender))
return false;
if (indianState == null) {
if (other.indianState != null)
return false;
} else if (!indianState.equals(other.indianState))
return false;
if (lastName == null) {
if (other.lastName != null)
return false;
} else if (!lastName.equals(other.lastName))
return false;
if (middleName == null) {
if (other.middleName != null)
return false;
} else if (!middleName.equals(other.middleName))
return false;
if (street == null) {
if (other.street != null)
return false;
} else if (!street.equals(other.street))
return false;
if (subscriptionFrequency == null) {
if (other.subscriptionFrequency != null)
return false;
} else if (!subscriptionFrequency.equals(other.subscriptionFrequency))
return false;
if (titles == null) {
if (other.titles != null)
return false;
} else if (!titles.equals(other.titles))
return false;
if (userId == null) {
if (other.userId != null)
return false;
} else if (!userId.equals(other.userId))
return false;
if (zip == null) {
if (other.zip != null)
return false;
} else if (!zip.equals(other.zip))
return false;
return true;
}
} | [
"nitish.kohade@gmail.com"
] | nitish.kohade@gmail.com |
124a28d529a9b7c855687fb82692d78df4c9f78c | d3135cbb2577cf6a8942abf525c14393f0c60e69 | /trunk/zsoa/soa-server/src/main/java/com/zodiac/db/Executeable.java | 8caff3f2750690fd947860cb25b9f358f77fb831 | [] | no_license | BGCX262/zsoa-svn-to-git | a3ce79f14498d4386221166aa60db238c924bc56 | 8a7429f89ed1756adc5260d2faa38bce0a4c8e7a | refs/heads/master | 2020-04-17T16:23:16.633069 | 2015-08-23T06:49:13 | 2015-08-23T06:49:13 | 41,256,951 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,150 | java | /*
* Copyright (C) 2012 Zodiac Innovation
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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, see <http://www.gnu.org/licenses/>.
*/
package com.zodiac.db;
import java.sql.SQLException;
/**
* This are SQL Object that can be executed. For example
* a query or transaction.
*
* @author Brian Estrada <brianseg014@gmail.com>
*/
public interface Executeable {
/**
* Attemp to execute the task of a SQL Object.
*
* @throws SQLException if database error occurs
*/
public void execute() throws DataAccessException;
}
| [
"you@example.com"
] | you@example.com |
6b8f138905b5af15a9a5dbc4ae350a808402a378 | 57d7801f31d911cde6570e3e513e43fb33f2baa3 | /src/main/java/nl/strohalm/cyclos/services/transactions/GrantSinglePaymentLoanDTO.java | a026f53b56d4701cd2404706cce3dfe31f2318fa | [] | no_license | kryzoo/cyclos | 61f7f772db45b697fe010f11c5e6b2b2e34a8042 | ead4176b832707d4568840e38d9795d7588943c8 | refs/heads/master | 2020-04-29T14:50:20.470400 | 2011-12-09T11:51:05 | 2011-12-09T11:51:05 | 54,712,705 | 0 | 1 | null | 2016-03-25T10:41:41 | 2016-03-25T10:41:41 | null | UTF-8 | Java | false | false | 1,385 | java | /*
This file is part of Cyclos.
Cyclos is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Cyclos 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 Cyclos; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package nl.strohalm.cyclos.services.transactions;
import java.util.Calendar;
import nl.strohalm.cyclos.entities.accounts.loans.Loan.Type;
/**
* Parameters for granting a single-payment loan
* @author luis
*/
public class GrantSinglePaymentLoanDTO extends GrantLoanDTO {
private static final long serialVersionUID = -6637355488102983527L;
private Calendar repaymentDate;
@Override
public Type getLoanType() {
return Type.SINGLE_PAYMENT;
}
public Calendar getRepaymentDate() {
return repaymentDate;
}
public void setRepaymentDate(final Calendar repaymentDate) {
this.repaymentDate = repaymentDate;
}
}
| [
"mpr@touk.pl"
] | mpr@touk.pl |
4f8c1b9630de56e2117c0b28691a9c7dc09bf45c | b08221a226cb41dbd72e5e613cee25e4d5027801 | /MarketMini/src/DAO/ChitiethoadonDAO.java | 2029329c0eb0d5df87a770aee597f0969140afc0 | [] | no_license | thienv29/MarketMini | 9b4c2a080907a924b6613fee219c2dc053ff4f3c | 9b811e802654a824acdd68090f647c544cc237c2 | refs/heads/main | 2023-08-06T02:40:59.380875 | 2021-09-06T09:39:28 | 2021-09-06T09:39:28 | 403,562,656 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,081 | 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 DAO;
import DTO.ChitietHoadonDTO;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
*
* @author Tan Thuan
*/
public class ChitiethoadonDAO {
DB_ConnectionDAO conn = new DB_ConnectionDAO();
public boolean ThemCthd(ChitietHoadonDTO cthd) {
String sql = "INSERT INTO `tbl_chitiethoadon`"
+ "(`id_hoadon`, `id_sanpham`, `soluong`, `gia`, `tongtien_loaisanpham`) VALUES "
+ "(" + cthd.getIdHoadonDTO() + "," + cthd.getIdSanphamDTO() + "," + cthd.getSoluongDTO() + "," + cthd.getDongiaDTO() + "," + cthd.getTongGia() + ")";
boolean result = conn.sqlUpdate(sql);
return result;
}
public boolean XoaCthd(int idhd) {
String sql = "DELETE FROM `tbl_chitiethoadon` WHERE id_hoadon=" + idhd;
boolean result = conn.sqlUpdate(sql);
return result;
}
public ArrayList<ChitietHoadonDTO> getListCthd() {
ArrayList<ChitietHoadonDTO> list = new ArrayList<>();
try {
String sql = "SELECT * FROM `tbl_chitiethoadon` WHERE 1";
ResultSet rs = conn.sqlQuery(sql);
if (rs != null) {
while (rs.next()) {
ChitietHoadonDTO cthd = new ChitietHoadonDTO();
cthd.setIdHoadonDTO(rs.getInt("id_hoadon"));
cthd.setSoluongDTO(rs.getInt("soluong"));
cthd.setDongiaDTO(rs.getInt("gia"));
cthd.setTongGia(rs.getInt("tongtien_loaisanpham"));
cthd.setIdSanphamDTO(rs.getInt("id_sanpham"));
list.add(cthd);
}
}
conn.closeConnection();
} catch (Exception e) {
e.printStackTrace();
}
return list;
}
}
| [
"thienv29@gmail.com"
] | thienv29@gmail.com |
640f9cbe5375c67a074c7794c52f9eec6bff6935 | 5754346c1b860af692646f8d6ed4e6bd42af67df | /src/Mulitdimensional.java | 83d16fd584b39b107fc9e7942b2784a89fcbc99c | [] | no_license | MiguelVera08/Java-Practice- | 64ca88d3430a4a2a7e85f067a853c38b54688e5c | fdd652958639e7e1aa0eecac8aa0a0d1055cd8a5 | refs/heads/master | 2023-01-10T07:44:38.840131 | 2020-11-10T23:08:53 | 2020-11-10T23:08:53 | 298,728,815 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 909 | java | public class Mulitdimensional {
public static void main(String[] args){
int[] values = {3, 5, 2343};
//Displays the contents of second index
System.out.println(values[2]);
//two-dimensional array
int[][] grid = {
{3, 5, 2343},
{2, 4},
{1, 2, 3, 4}
};
System.out.println(grid[1][1]);
System.out.println(grid[0][2]);
String[][] texts = new String[2][3];
//Sets the grid location to string
texts[0][1] = "Hello world";
//Displays the string
System.out.println(texts[0][1]);
//Nested for loop to display grid
for(int row=0; row<grid.length; row++){
for(int col=0; col<grid[row].length; col++){
System.out.print(grid[row][col] + "\t");
}
System.out.println();
}
}
}
| [
"miguel.vera7908@gmail.com"
] | miguel.vera7908@gmail.com |
bbeedc24efa07055c94520cf1badb30c3d65aba7 | 7253a0360e2d6496fcd8f13f6feb8b404e7aa7f4 | /src/com/biz/arrays/ext/Array01.java | f2689daaf6e584278ac05e6635249e297ff7a8bb | [] | no_license | dwt4597/Array_Variable | e84412b14acdb628379dba67db29385892123556 | 15eeb4f33128ec8982c50fa84f64a389bab62695 | refs/heads/master | 2020-04-08T12:06:37.317204 | 2018-11-27T12:41:13 | 2018-11-27T12:41:13 | 159,333,396 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,215 | java | package com.biz.arrays.ext;
public class Array01 {
public static void main(String[] args) {
// TODO Auto-generated method stub
// 숫자형 배열은 배열을 선언하면
// 모든 요소의 값들이 0으로 자동 초기화된다.
int[] arrNum = new int[10];
for (int i = 0; i < arrNum.length; i++) {
System.out.println(arrNum[1]);
}
// 문자열형 배열은 배열을 선언하면
// 모든요소의 값들이 ""으로 초기화된다.
// 단, sysout..을 사용해서 console에 보이면
// null 값으로 표현되는데
// 실제 null값하고는 다소 차이가 있다.
// 문자열 배열요소를 이용해서
// 문자열 변수의 확장기능들(.length())을 사용하려고하면
// 사용할 수 없다.
//따라서 문자열 배열에서 추출한 요소는
// 어떤 값(문자열)을 저장하기 전에는
// 읽기 명령을 실행하면
// NullPointException이 발생한다
String s1 = "Republic of korea";
String[] arrString = new String[10];
arrString[0] = "대한민국";
arrString[0].length();
System.out.println(s1);
for (int i = 0; i < arrString.length; i++) {
System.out.println(arrString[i].length());
}
}
}
| [
"ijs9200@naver.com"
] | ijs9200@naver.com |
0b04b2587004f9aa28853153c05ac3389ef70d8d | a100ee3dcef292ac811eb8634615b86fd2e8e072 | /app/src/main/java/com/jsqix/dongqing/gank/behavior/ScrollAwareFABBehaviorDefault.java | 7db583c6973f1f5813dafe3fdc701db1a7cf7202 | [] | no_license | a741762308/GankDemo | adfdf256bb8720e92e06432459132300b5121800 | 0f87ed545c756c956e2e03fa475a8673bf8b8fde | refs/heads/master | 2021-01-12T08:50:59.137937 | 2017-02-08T08:40:54 | 2017-02-08T08:40:54 | 76,635,496 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,770 | java | package com.jsqix.dongqing.gank.behavior;
import android.content.Context;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.view.ViewCompat;
import android.util.AttributeSet;
import android.view.View;
public class ScrollAwareFABBehaviorDefault extends FloatingActionButton.Behavior {
public ScrollAwareFABBehaviorDefault(Context context, AttributeSet attrs) {
super();
}
@Override
public boolean onStartNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child,
final View directTargetChild, final View target, final int nestedScrollAxes) {
// Ensure we react to vertical scrolling
return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL
|| super.onStartNestedScroll(coordinatorLayout, child, directTargetChild, target, nestedScrollAxes);
}
@Override
public void onNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child,
final View target, final int dxConsumed, final int dyConsumed,
final int dxUnconsumed, final int dyUnconsumed) {
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) {
// User scrolled down and the FAB is currently visible -> hide the FAB
child.hide();
} else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) {
// User scrolled up and the FAB is currently not visible -> show the FAB
child.show();
}
}
}
| [
"dongqing123@126.com"
] | dongqing123@126.com |
80933d4497c7e41e2eb776103ab5ddc574a4c35c | 1e2aea9830cb1f35bb5325726edbb48a02adafa8 | /Day_3/Java/CheckChar.java | e6381623f6769c7b489995d73caf8e16c8d9d9bd | [] | no_license | kathu1991/Itfy-C | cb10269ff6d91dc06d868797fea6607eeab7cba9 | 16c5eb8b1539adf958c95253e0932d06222d77d1 | refs/heads/master | 2023-04-03T15:17:57.512196 | 2021-04-14T15:21:23 | 2021-04-14T15:21:23 | 357,925,452 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 997 | java | //23 Write a program to check whether a character is an alphabet, digit or special character.
import java.util.Scanner;
public class CheckChar {
public final static Scanner STDIN_SCANNER = new Scanner(System.in);
public static void main(String[] args) {
byte ch;
/* Input character from user */
System.out.print("Enter any character: ");
ch = (byte)nextChar(STDIN_SCANNER);
/* Alphabet check */
if(ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z') {
System.out.print("'" + ((char)Byte.toUnsignedInt(ch)) + "' is alphabet.");
} else if(ch >= '0' && ch <= '9') {
System.out.print("'" + ((char)Byte.toUnsignedInt(ch)) + "' is digit.");
} else {
System.out.print("'" + ((char)Byte.toUnsignedInt(ch)) + "' is special character.");
}
}
/**
* This method is missing from the Scanner interface.
*/
public final static int nextChar(Scanner scanner) {
scanner.useDelimiter("");
int ret = scanner.next().charAt(0);
scanner.reset();
return ret;
}
}
| [
"karthik@kaholabs.com"
] | karthik@kaholabs.com |
cdf1e8f9074d15cdbdd3cf752531aa536bc59623 | 3bdf11b2be40b07f14e49556b55cb88a6ef5f9dd | /src/main/java/com/gonuclei/models/bo/UserBo.java | 216b4ccd8afe217c1d48bc8915fd5d3318ff0569 | [] | no_license | sagarmaktha/Assignment5 | fa9e40911e9d161e87bd7b2ffe5b588fc2f83ce1 | 09a132d3719c045b6268e82600a4e3bbb4f80601 | refs/heads/master | 2020-12-22T21:40:24.585783 | 2020-02-04T17:05:32 | 2020-02-04T17:05:32 | 236,938,856 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 835 | java | package com.gonuclei.models.bo;
public class UserBo {
private Long id;
private String emailId;
private String name;
private String password;
public UserBo(Long id, String emailId, String name, String password) {
this.id = id;
this.emailId = emailId;
this.name = name;
this.password = password;
}
public UserBo() {
}
public void setId(Long id) {
this.id = id;
}
public void setEmailId(String emailId) {
this.emailId = emailId;
}
public void setName(String name) {
this.name = name;
}
public void setPassword(String password) {
this.password = password;
}
public Long getId() {
return id;
}
public String getEmailId() {
return emailId;
}
public String getName() {
return name;
}
public String getPassword() {
return password;
}
}
| [
"sagarmakhta@Sagars-MacBook-Pro.local"
] | sagarmakhta@Sagars-MacBook-Pro.local |
9238742ce2602de9a1176e0995939e34e08f83f3 | 253106692a7d7b41ced8ae8e1e7ce27e6c2e4437 | /src/main/java/ct/enumtest/TestSeason.java | 3f3e3e7690691fc50ed2acae3594553ae786242e | [] | no_license | chentao92/CTProject | d7365c7a010eac541a71d2d49062c563d76dfc71 | 831a7555efa68e1466c0038b8882fac4b58ceff6 | refs/heads/master | 2023-01-09T07:03:36.551565 | 2020-11-13T07:12:49 | 2020-11-13T07:12:49 | 286,958,211 | 4 | 0 | null | 2020-08-20T01:34:03 | 2020-08-12T08:22:36 | null | UTF-8 | Java | false | false | 733 | java | package ct.enumtest;
public class TestSeason {
public static void main(String[] args) {
Season spring = Season.SPRING;
System.out.println(spring);
spring.show();
System.out.println(spring.getSeasonName());
// 1. values() 方法:返回所有值
Season[] seasons = Season.values();
for (int i=0; i<seasons.length;i++) {
System.out.println(seasons[i]);
}
// 2. valueOf() 方法:返回指定对象的值(要求传入的形参name是枚举类对象的名字)
// 否则,报 java.lang.IllegalArgumentException 异常
String str = "SPRING";
Season sea = Season.valueOf(str);
System.out.println(sea);
}
} | [
"1315450620@qq.com"
] | 1315450620@qq.com |
a003d318c4af467367215e8619c3a0796cdb9d85 | e26bacd2a3722148d2efe144224fc36dce4e1092 | /scheduletask/src/main/java/com/liujun/schedule/domain/task/service/DcTaskTypeDomainService.java | 1de87f5ecc16ed877cf5c51b86320fff9c31a76a | [] | no_license | kkzfl22/schedule | 2efaed73e527ff36af50dbd3776b140d2542a958 | 0567f940714c05d910c55a51d05a28140abdd1bb | refs/heads/main | 2023-07-04T05:12:33.000010 | 2021-08-03T12:36:32 | 2021-08-03T12:36:32 | 390,570,127 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,035 | java | package com.liujun.schedule.domain.task.service;
import com.ddd.common.infrastructure.entity.DomainPage;
import com.liujun.schedule.domain.task.entity.DcTaskTypeDO;
import com.liujun.schedule.domain.task.facade.DcTaskTypeRepositoryInterface;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 调度任务信息-的领域服务
*
* @author liujun
* @version 0.0.1
*/
@Service
@Slf4j
public class DcTaskTypeDomainService {
/**
* 调度任务信息-的领域存储接口
*/
@Autowired
private DcTaskTypeRepositoryInterface repository;
/**
* 单个添加
*
* @param param 调度任务信息-的领域实体信息
* @return true 操作成功,false 操作失败
*/
public boolean insert(DcTaskTypeDO param) {
boolean updateRsp = repository.insert(param);
return updateRsp;
}
/**
* 批量添加
*
* @param param 调度任务信息-的领域实体信息
* @return true 操作成功,false 操作失败
*/
public boolean insertList(List<DcTaskTypeDO> param) {
boolean updateRsp = repository.insertList(param);
return updateRsp;
}
/**
* 修改方法
*
* @param param 调度任务信息-的领域实体信息
* @return true 操作成功,false 操作失败
*/
public boolean update(DcTaskTypeDO param) {
boolean updateRsp = repository.update(param);
return updateRsp;
}
/**
* 批量删除
*
* @param param 调度任务信息-的领域实体信息
* @return true 操作成功,false 操作失败
*/
public boolean deleteByIds(DcTaskTypeDO param) {
boolean updateRsp = repository.deleteByIds(param);
return updateRsp;
}
/**
* 分页查询
*
* @param pageReq 分页查询请求参数
* @return 分页查询响应
*/
public DomainPage<List<DcTaskTypeDO>> queryPage(DomainPage<DcTaskTypeDO> pageReq) {
DomainPage<List<DcTaskTypeDO>> pageResult = repository.queryPage(pageReq);
return pageResult;
}
/**
* 获取类型的配制信息
*
* @return
*/
public Map<String, DcTaskTypeDO> queryAllToMap() {
List<DcTaskTypeDO> list = repository.queryAll();
if (null == list) {
return Collections.emptyMap();
}
Map<String, DcTaskTypeDO> result = new HashMap<>(list.size());
for (DcTaskTypeDO item : list) {
result.put(item.getType(), item);
}
return result;
}
/**
* 按id查询详细
*
* @param param 调度任务信息-的领域实体信息
* @return 数据集
*/
public DcTaskTypeDO detail(DcTaskTypeDO param) {
DcTaskTypeDO queryReturn = repository.detail(param);
return queryReturn;
}
} | [
"liujun@paraview.cn"
] | liujun@paraview.cn |
01ad8f295e0e7f6c8dd8b18906dd54abed179cad | 09d0ddd512472a10bab82c912b66cbb13113fcbf | /TestApplications/TF-BETA-THERMATK-v5.7.1/DecompiledCode/JADX/src/main/java/org/telegram/messenger/C0355-$$Lambda$DataQuery$EvRKZ0icyHpXu5syph8WWuRUigE.java | 06f317dae5440a8cbe8bf36b797d472e453c7010 | [] | no_license | sgros/activity_flow_plugin | bde2de3745d95e8097c053795c9e990c829a88f4 | 9e59f8b3adacf078946990db9c58f4965a5ccb48 | refs/heads/master | 2020-06-19T02:39:13.865609 | 2019-07-08T20:17:28 | 2019-07-08T20:17:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 972 | java | package org.telegram.messenger;
import java.util.ArrayList;
/* compiled from: lambda */
/* renamed from: org.telegram.messenger.-$$Lambda$DataQuery$EvRKZ0icyHpXu5syph8WWuRUigE */
public final /* synthetic */ class C0355-$$Lambda$DataQuery$EvRKZ0icyHpXu5syph8WWuRUigE implements Runnable {
private final /* synthetic */ DataQuery f$0;
private final /* synthetic */ ArrayList f$1;
private final /* synthetic */ ArrayList f$2;
private final /* synthetic */ int f$3;
private final /* synthetic */ int f$4;
public /* synthetic */ C0355-$$Lambda$DataQuery$EvRKZ0icyHpXu5syph8WWuRUigE(DataQuery dataQuery, ArrayList arrayList, ArrayList arrayList2, int i, int i2) {
this.f$0 = dataQuery;
this.f$1 = arrayList;
this.f$2 = arrayList2;
this.f$3 = i;
this.f$4 = i2;
}
public final void run() {
this.f$0.lambda$putFeaturedStickersToCache$25$DataQuery(this.f$1, this.f$2, this.f$3, this.f$4);
}
}
| [
"crash@home.home.hr"
] | crash@home.home.hr |
185b93bec3060fbeee9aa37f3ad3fc077d65fcbb | 8b89088e3b5376be831d1759e382c10f291b34f1 | /src/com/TestNG/rakesh/utilities/ApplVariables.java | 57830f00e1dd90ed94297800d503052e4ed65e38 | [] | no_license | rakeshgdm95/TestNG | dece91307735e0c008288b8dffc6b93a7b0e4b64 | 1e71c535f5d44748ab1b76cc6a517a729b9c2e77 | refs/heads/master | 2020-03-22T23:46:41.297491 | 2018-07-13T10:26:01 | 2018-07-13T10:26:01 | 140,828,412 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,444 | java | package com.TestNG.rakesh.utilities;
import java.io.IOException;
import org.apache.poi.EncryptedDocumentException;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import com.TestNG.rakesh.base.BaseEngine;
import com.TestNG.rakesh.supporters.ExcelReader;
import com.TestNG.rakesh.supporters.PropertiesReusables;
public class ApplVariables {
private static String orfilePtah="C:\\Users\\MandU\\eclipse-workspace\\TestNG\\src\\com\\TestNG\\rakesh\\objectrepository\\or.properties";
private static String conffilePtah="C:\\Users\\MandU\\eclipse-workspace\\TestNG\\config.properties";
private static String excelfilePtah="C:\\Users\\MandU\\eclipse-workspace\\TestNG\\src\\com\\TestNG\\rakesh\\testData\\TestData.xls";
public static PropertiesReusables getOrObj(String file) throws EncryptedDocumentException, InvalidFormatException, IOException,InterruptedException
{
PropertiesReusables propertiesReusables = new PropertiesReusables(file);
return propertiesReusables;
}
public static String getOrfilePath()
{
return orfilePtah;
}
public static String getConffilePath()
{
return conffilePtah;
}
public static String getExcelfilePath()
{
return excelfilePtah;
}
public static ExcelReader getExcelObj() throws EncryptedDocumentException, InvalidFormatException, IOException,InterruptedException
{
ExcelReader excelReader = new ExcelReader(excelfilePtah);
return excelReader;
}
}
| [
"rakeshgaddam123@gmail.com"
] | rakeshgaddam123@gmail.com |
fd156781a287607cbc8c8a71075afddb874544ca | 57fb1ef8c905aca1eeac82292f782c0a53fd9e45 | /ClassExcersise/src/class7/Department.java | e6c788cd3ac6f68d1c10d3e39bd08ad51ae11613 | [] | no_license | vp4nb/workspace | ecca1d04c3a9e0899c6f2060ad42340013fb93d7 | 950b9807bebdc54cc8e267c2e9159a979c7d17cf | refs/heads/master | 2021-01-10T01:32:07.456383 | 2016-03-01T20:18:42 | 2016-03-01T20:18:42 | 52,906,871 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,049 | java | package class7;
public class Department {
private int deptId;
private String deptName;
private String deptLocation;
public void setDeptId(int deptId)
{
this.deptId=deptId;
}
public void setDeptName(String deptName)
{
this.deptName=deptName;
}
public void SetDeptLocation(String deptLocation)
{
this.deptLocation=deptLocation;
}
public int getDeptId(){
return this.deptId;
}
public String getDeptName()
{
return this.deptName;
}
public String getDeptLocation()
{
return this.deptLocation;
}
public String toString()
{
return getClass().getName()+" values are: id:"+deptId+" name:"+deptName+" Location:"+deptLocation;
}
public boolean equals(Object obj)
{
if(obj==null)
{
return false;
}
else if(obj instanceof Department)
{
Department s=(Department)obj;
if(this.getDeptId()==s.getDeptId()&&this.getDeptName().equals(s.getDeptName())&&this.getDeptLocation().equals(s.getDeptLocation()))
{
return true;
}
else
{
return false;
}
}
else
{
return false;
}
}
}
| [
"venkatakrishna prathipati"
] | venkatakrishna prathipati |
23b4ad9b94c8f2e6006670812dbdcceed1d42626 | a30bbdfcf5c617f04c8ee11641e735c518c92d48 | /src/main/java/quek/undergarden/entity/rotspawn/RotbeastEntity.java | f87ce6003848bd67be66c9d7199ffcff1630c880 | [
"MIT"
] | permissive | KiberkotletaSaidWhy/The-Undergarden | 31bd6fb1b93252b62d9caa41c2697429a2f91ac7 | 476f389b506ae46003af46253ce2f29132852b38 | refs/heads/1.16 | 2023-06-13T00:41:44.788856 | 2021-06-23T00:44:11 | 2021-06-23T00:44:11 | 379,580,613 | 0 | 0 | MIT | 2021-06-23T11:35:45 | 2021-06-23T11:31:54 | null | UTF-8 | Java | false | false | 2,943 | java | package quek.undergarden.entity.rotspawn;
import net.minecraft.block.BlockState;
import net.minecraft.entity.*;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.entity.ai.attributes.Attributes;
import net.minecraft.entity.monster.MonsterEntity;
import net.minecraft.util.DamageSource;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import quek.undergarden.registry.UGSoundEvents;
public class RotbeastEntity extends AbstractRotspawnEntity {
private int attackTimer;
public RotbeastEntity(EntityType<? extends MonsterEntity> type, World world) {
super(type, world);
}
public static AttributeModifierMap.MutableAttribute registerAttributes() {
return MonsterEntity.createMobAttributes()
.add(Attributes.MAX_HEALTH, 80.0D)
.add(Attributes.ARMOR, 3.0D)
.add(Attributes.ATTACK_DAMAGE, 10.0D)
.add(Attributes.MOVEMENT_SPEED, 0.22D)
.add(Attributes.KNOCKBACK_RESISTANCE, 0.5D);
}
@Override
protected SoundEvent getAmbientSound() {
return UGSoundEvents.ROTBEAST_LIVING.get();
}
@Override
protected SoundEvent getHurtSound(DamageSource damageSource) {
return UGSoundEvents.ROTBEAST_HURT.get();
}
@Override
protected SoundEvent getDeathSound() {
return UGSoundEvents.ROTBEAST_DEATH.get();
}
@Override
protected void playStepSound(BlockPos pos, BlockState blockIn) {
this.playSound(SoundEvents.ZOMBIE_STEP, 0.15F, 0.5F);
}
@Override
public void aiStep() {
super.aiStep();
if (this.attackTimer > 0) {
--this.attackTimer;
}
}
@Override
public boolean doHurtTarget(Entity entityIn) {
this.attackTimer = 10;
this.level.broadcastEntityEvent(this, (byte)4);
float f = (float)this.getAttributeValue(Attributes.ATTACK_DAMAGE);
float f1 = (int)f > 0 ? f / 2.0F + (float)this.random.nextInt((int)f) : f;
boolean flag = entityIn.hurt(DamageSource.mobAttack(this), f1);
if (flag) {
entityIn.setDeltaMovement(entityIn.getDeltaMovement().add(0.0D, 0.4F, 0.0D));
this.doEnchantDamageEffects(this, entityIn);
}
this.playSound(SoundEvents.IRON_GOLEM_ATTACK, 1.0F, 1.0F);
return flag;
}
@OnlyIn(Dist.CLIENT)
public void handleEntityEvent(byte id) {
if (id == 4) {
this.attackTimer = 10;
this.playSound(SoundEvents.IRON_GOLEM_ATTACK, 1.0F, 1.0F);
}
else {
super.handleEntityEvent(id);
}
}
@OnlyIn(Dist.CLIENT)
public int getAttackTimer() {
return this.attackTimer;
}
}
| [
"55364841+quek04@users.noreply.github.com"
] | 55364841+quek04@users.noreply.github.com |
c7b55776e0ed1af8df547dbd183225b5713111f4 | bc47f3ee8cd6d8546e1bf6f70eab50d0ce73ce14 | /recycleview/src/main/java/com/hejunlin/tvsample/service/LocalService.java | e1737a9363c38d6233c9dba9ddc40d171676a08e | [
"Apache-2.0"
] | permissive | DXH100/TVFogComputingBox | cdbc5d46cc0c264dc31c0fc76d3a944bc4147b09 | b5ccf27c84d76dc81d66d2d4b0ee2e3bbd185a73 | refs/heads/master | 2021-05-10T07:41:28.018677 | 2018-01-26T03:52:34 | 2018-01-26T03:52:34 | 118,851,725 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,199 | java | package com.hejunlin.tvsample.service;
import android.app.PendingIntent;
import android.app.Service;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.SystemClock;
import android.support.v4.app.NotificationCompat;
import android.widget.Toast;
import com.hejunlin.tvsample.LogUtils;
public class LocalService extends Service {
private MyBinder binder;
private MyServiceConnection conn;
@Override
public IBinder onBind(Intent intent) {
// TODO Auto-generated method stub
return binder;
}
@Override
public void onCreate() {
// TODO Auto-generated method stub
super.onCreate();
if(binder ==null){
binder = new MyBinder();
}
conn = new MyServiceConnection();
// new Handler().postDelayed(new Runnable() {
// @Override
// public void run() {
// LogUtils.e(11111);
// }
// },500);
new Thread(new Runnable() {
@Override
public void run() {
while (true){
SystemClock.sleep(500);
LogUtils.e(11111);
}
}
}).start();
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
LocalService.this.bindService(new Intent(LocalService.this, RemoteService.class), conn, Context.BIND_IMPORTANT);
PendingIntent contentIntent = PendingIntent.getService(this, 0, intent, 0);
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
builder.setTicker("XXX")
.setContentIntent(contentIntent)
.setContentTitle("我是XXX,我怕谁!")
.setAutoCancel(true)
.setContentText("哈哈")
.setWhen( System.currentTimeMillis());
//把service设置为前台运行,避免手机系统自动杀掉改服务。
startForeground(startId, builder.build());
return START_STICKY;
}
class MyBinder extends IMyAidlInterface.Stub{
@Override
public String getProcessName() throws RemoteException {
// TODO Auto-generated method stub
return "LocalService";
}
}
class MyServiceConnection implements ServiceConnection {
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
LogUtils.e( "建立连接成功!");
}
@Override
public void onServiceDisconnected(ComponentName name) {
LogUtils.e( "RemoteService服务被干掉了~~~~断开连接!");
Toast.makeText(LocalService.this, "断开连接", Toast.LENGTH_SHORT).show();
//启动被干掉的
LocalService.this.startService(new Intent(LocalService.this, RemoteService.class));
LocalService.this.bindService(new Intent(LocalService.this, RemoteService.class), conn, Context.BIND_IMPORTANT);
}
}
}
| [
"denghanxiao@outlook.com"
] | denghanxiao@outlook.com |
a80858918ec1639bea63f2295a5732b0ff3d3ebc | 612d1ad785ab770b162d339bc7c1d92b16ac543e | /JavaDetails/javaL/src/com/basic/Demo_System.java | f05f21f5aac4856632de64368197558a2d7e6a3f | [] | no_license | sygriffin/JavaLearning | 5f671e4881aea11515c2704ee539bf1ebc83678f | 07fcad3a5e74354b742d854b39d7f853e7e878c1 | refs/heads/master | 2020-04-07T07:56:57.369894 | 2019-04-15T11:45:41 | 2019-04-15T11:45:41 | 158,195,164 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,026 | java | package com.basic;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.text.DateFormat;
import java.text.FieldPosition;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Created by songyang on 2019/3/23.
*
*
*
*/
public class Demo_System {
public static void main (String[] args) {
//System -- gc 辣鸡回收器
System.gc();
//exit 终止当前jvm
//返回毫秒
System.currentTimeMillis();
int[] arr = {1,3,5,6};
int[] arr2 = new int[8];
//原数组,原数组中的起始位置,目标数组,目标数组中的起始位置,要复制的数组元素数量(所有参数解释)
System.arraycopy(arr,0,arr2,0,4);
//集合底层是由数组实现的
//BigInteger
BigInteger bi1 = new BigInteger("1000");
BigInteger bi2 = new BigInteger("20");
System.out.println(bi1);
BigInteger[] arrB = bi1.divideAndRemainder(bi2); //取除数和余数
//BigDecimal -- 精确存储小数
// BigDecimal bd1 = new BigDecimal(2.0);
// BigDecimal bd2 = new BigDecimal(1.1);
BigDecimal bd1 = new BigDecimal("2.0");
BigDecimal bd2 = new BigDecimal("1.1");
BigDecimal bd3 = BigDecimal.valueOf(0.23);
System.out.println(bd1.subtract(bd2));
//入参为double的构造方法计算出来的值具有一定的不确定性 - 0.1无法准确的表示double,所以通常建议优先使用String构造方法
//一定是double的话,先toString,或者BigDecimal的valueOf
//以上方法 -- 推荐
//日期类
Date date = new Date();
System.out.println(date);
System.out.println(date.getTime());
System.out.println(System.currentTimeMillis());//均为毫秒级的
Date date1 = new Date(0);
System.out.println(date1);
//构造方法 -- 0 ,类似dateSince1970
//1970-01-01
//毫秒级 -- 1s
Date date2 = new Date();
date2.setTime(1000);
System.out.println(date2);
//转字符串了SimpleDateFormat
// DateFormat df = new DateFormat(); -- 抽象类不允许实例化
DateFormat df1 = DateFormat.getDateInstance();
DateFormat df2 = new SimpleDateFormat();
//以上两句相同
//输出默认格式日期
Date currentDate = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
System.out.println(sdf.format(currentDate));
//直接在simpleDateFormat里给定日期格式
//将时间字符串转换成日期对象
String dateStr = "2000年08月08日08:00:00";
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy年MM月dd日HH:mm:ss");
try {
Date cd = sdf1.parse(dateStr);
System.out.println(cd);
} catch (Exception e ){
System.out.println(e);
}
}
} | [
"786281584@qq.com"
] | 786281584@qq.com |
af04886f90a3dc02f7ef9edd7cc03073358c7939 | 8b7ffbf634eb5558a3e189e23ae02bbc4e304548 | /QuickIndexBar/app/src/androidTest/java/com/koumanwei/quickindexbar/ExampleInstrumentationTest.java | 4f09eff0afbee19145cc6e7651f6dcc77fc24283 | [] | no_license | koumanwei/QuickIndexBar | ecc2e12d005949cfd16bc8e67bcbede81196105c | 08048dcfb78a3671f77e8ac34f14202e26118ed1 | refs/heads/master | 2021-01-18T20:27:27.157602 | 2016-06-16T05:51:16 | 2016-06-16T05:51:16 | 61,265,240 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 821 | java | package com.koumanwei.quickindexbar;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.filters.MediumTest;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@MediumTest
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentationTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.koumanwei.quickindexbar", appContext.getPackageName());
}
} | [
"874899973@qq.com"
] | 874899973@qq.com |
f2168c112dfa9cb4b63946e6d0415b0ec647a09a | 3f010f48ba2fc5108fc3931794f4e96261d2c805 | /src/main/java/sportsbetting/service/IUserService.java | 0fcb3bf7293f0b4130b9e26cdc0dfa88214f4b2e | [] | no_license | YanchevskayaAnna/SportsBettingApplication | 6d6231e0b7993f801d9000e739505517417ef8c1 | 462e18d91eacec580ec90055282471751f2e102b | refs/heads/master | 2022-06-04T17:56:38.655391 | 2020-03-31T07:13:09 | 2020-03-31T07:13:09 | 251,414,054 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 253 | java | package sportsbetting.service;
import sportsbetting.model.user.User;
public interface IUserService {
User findUserByEmail(String email);
User findUserByUserName(String userName);
User saveUser(User user);
User updateUser(User user);
}
| [
"hanna_yanchevska@epam.com"
] | hanna_yanchevska@epam.com |
f07fe5d92e9846a527cdee0ebc77b739ad76725e | 663de7679f837acbb5dc57a243c939684585615e | /arLocation/src/main/java/com/david/arlocation/aritem/boundary/ArManager.java | 79f5d0ac19381483bad6cd799ae2037f2c9133ac | [] | no_license | santukis/ArLocation | d4f8fbc0df4de6fc24bb5195448e6bfa98a0bf53 | 606158dc0a2e61dbd7127444ff5b28b83e795396 | refs/heads/master | 2021-03-12T19:27:41.046915 | 2017-09-11T14:56:23 | 2017-09-11T14:56:23 | 102,878,184 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 286 | java | package com.david.arlocation.aritem.boundary;
import com.david.arlocation.aritem.model.ArItem;
import java.util.Collection;
public interface ArManager<T extends ArItem> extends ConfigManager<T> {
void init();
void release();
void addArItems(Collection<T> arItems);
}
| [
"santamadavid@gmail.com"
] | santamadavid@gmail.com |
99d871ca680deec3e8660a357ea885697a2ffed0 | 7569f9a68ea0ad651b39086ee549119de6d8af36 | /cocoon-2.1.9/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/FieldDefinitionBuilder.java | 4d1e44be62df2f316da168ebf3fecee9765a5ca9 | [
"Apache-2.0"
] | permissive | tpso-src/cocoon | 844357890f8565c4e7852d2459668ab875c3be39 | f590cca695fd9930fbb98d86ae5f40afe399c6c2 | refs/heads/master | 2021-01-10T02:45:37.533684 | 2015-07-29T18:47:11 | 2015-07-29T18:47:11 | 44,549,791 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,837 | java | /*
* Copyright 1999-2004 The Apache Software Foundation.
*
* 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.apache.cocoon.forms.formmodel;
import org.apache.cocoon.forms.datatype.SelectionList;
import org.apache.cocoon.forms.util.DomHelper;
import org.w3c.dom.Element;
/**
* Builds {FieldDefinition}s.
*
* @version $Id: FieldDefinitionBuilder.java 327125 2005-10-21 08:52:51Z sylvain $
*/
public class FieldDefinitionBuilder extends AbstractDatatypeWidgetDefinitionBuilder {
public WidgetDefinition buildWidgetDefinition(Element widgetElement) throws Exception {
FieldDefinition definition = new FieldDefinition();
setupDefinition(widgetElement, definition);
definition.makeImmutable();
return definition;
}
protected void setupDefinition(Element widgetElement, FieldDefinition definition) throws Exception {
super.setupDefinition(widgetElement, definition);
// parse "@required"
if(widgetElement.hasAttribute("required"))
definition.setRequired(DomHelper.getAttributeAsBoolean(widgetElement, "required", false));
SelectionList list = buildSelectionList(widgetElement, definition, "suggestion-list");
if (list != null) {
definition.setSuggestionList(list);
}
}
}
| [
"ms@tpso.com"
] | ms@tpso.com |
5487325029bf8bd59b67e7ad27adcfc9d7e966a4 | dd4041b790bec01c8a00122404b1ed83da24faf8 | /Uremont/src/test/java/com/main/appmanager/ApplicationManager.java | d353f9f44bc8029b6a9fd7b3f319fe0bf5ddac24 | [] | no_license | Kolywan/TestProject | 8491df66e14f9cf1a76af13febb3851e3484aede | cab7994bdcb0107427ac4090615423e3fcacaff9 | refs/heads/master | 2020-05-30T20:14:51.461907 | 2019-06-03T06:08:07 | 2019-06-03T06:08:07 | 189,941,915 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,478 | java | package com.main.appmanager;
import static com.codeborne.selenide.Selenide.close;
import static com.codeborne.selenide.Selenide.open;
import java.io.File;
import java.io.IOException;
import java.util.logging.ConsoleHandler;
import java.util.logging.FileHandler;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;
//import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.RemoteWebDriver;
import com.base.common.Logs;
import com.codeborne.selenide.Configuration;
import com.data.Data;
import com.data.DelEmails;
import com.data.GetCodeSMS;
import com.data.GetEmail;
import com.pages.RequestUseer_4_1;
import com.pages.MessageSTO_5_2_1;
import com.pages.MessageUser_5_1_1;
import com.pages.LoginSTO_2_2;
import com.pages.CostRepair_6_1;
import com.pages.GoSTO_9_2;
import com.pages.RequestGuest_4_2;
import com.pages.RegistrationUser_1;
import com.pages.RecordRepair_7_1_1;
import com.pages.RegistrationSTO_2;
import com.pages.RequestGuestLink_4_2_1;
import com.pages.RequestUserLink_4_1_1;
public class ApplicationManager {
public int timeOut = 5000;
public int tt= 6969;
public int pp= 6968;
protected static Logs logs;
// ##########################
protected Data data;
// ##########################
// Pages
protected RequestUseer_4_1 login;
protected RegistrationSTO_2 regSTO;
protected LoginSTO_2_2 loginSTO;
protected RequestGuest_4_2 mainPage;
protected RequestUserLink_4_1_1 reqUser;
protected RequestGuestLink_4_2_1 reqGuest;
protected RegistrationUser_1 PageReg;
protected DelEmails deleteMails;
protected GetEmail getEmail;
protected MessageUser_5_1_1 messageUser;
protected MessageSTO_5_2_1 messageSTO;
protected CostRepair_6_1 costRepair;
protected GetCodeSMS sms;
protected RecordRepair_7_1_1 recordRepair;
protected GoSTO_9_2 goSTO;
// ##########################
public static ApplicationManager app;
public static ApplicationManager getInstance(String url, String platform) throws Exception {
app = new ApplicationManager();
File DriverPath = new File("");
System.setProperty("webdriver.chrome.driver", DriverPath.getAbsolutePath() + "\\drivers\\chromedriver.exe");
System.setProperty("java.util.logging.SimpleFormatter.format", "%1$tT %4$s %5$s%6$s%n");
// LoggingPreferences logs = new LoggingPreferences();
// logs.enable(LogType.BROWSER, Level.ALL);
// logs.enable(LogType.CLIENT, Level.ALL);
// logs.enable(LogType.DRIVER, Level.ALL);
// logs.enable(LogType.PERFORMANCE, Level.ALL);
// logs.enable(LogType.PROFILER, Level.ALL);
// logs.enable(LogType.SERVER, Level.ALL);
// ChromeOptions options = new ChromeOptions();
// DesiredCapabilities capabilities = DesiredCapabilities.chrome();
// capabilities.setCapability(CapabilityType.LOGGING_PREFS, logs);
// options.addArguments("start-maximized");
// capabilities.setCapability(ChromeOptions.CAPABILITY, options);
Configuration.startMaximized = true;
open(url);
return app;
}
public void tearDown() throws Exception {
close();
}
// ##############################
public Logs logs() {
return logs = new Logs();
}
// ##############################
public Data data() {
return data = new Data();
}
// ##############################
public DelEmails deleteMails() {
return deleteMails = new DelEmails();
}
// ##############################
public GetEmail getEmail() {
return getEmail = new GetEmail();
}
// ##############################
// ##############################
public GetCodeSMS sms() {
return sms = new GetCodeSMS();
}
// ##############################
public RequestUseer_4_1 login() {
return login = new RequestUseer_4_1();
}
public RegistrationSTO_2 regSTO() {
return regSTO = new RegistrationSTO_2();
}
public LoginSTO_2_2 loginSTO() {
return loginSTO = new LoginSTO_2_2();
}
public RegistrationUser_1 PageReg() {
return PageReg = new RegistrationUser_1();
}
public RequestGuest_4_2 mainPage() {
return mainPage = new RequestGuest_4_2();
}
public RequestUserLink_4_1_1 reqUser() {
return reqUser = new RequestUserLink_4_1_1();
}
public RequestGuestLink_4_2_1 reqGuest() {
return reqGuest = new RequestGuestLink_4_2_1();
}
public MessageUser_5_1_1 messageUser() {
return messageUser = new MessageUser_5_1_1();
}
public MessageSTO_5_2_1 messageSTO() {
return messageSTO = new MessageSTO_5_2_1();
}
public CostRepair_6_1 costRepair() {
return costRepair = new CostRepair_6_1();
}
public RecordRepair_7_1_1 recordRepair() {
return recordRepair = new RecordRepair_7_1_1();
}
public GoSTO_9_2 goSTO() {
return goSTO = new GoSTO_9_2();
}
// ##############################
public void switchLoging() throws SecurityException, IOException {
// set logger Level for RemoteWebDriver
Logger logger = Logger.getLogger(RemoteWebDriver.class.getName());
logger.setLevel(Level.ALL);
// delete all Handlers
for (Handler handler : logger.getHandlers()) {
logger.removeHandler(handler);
}
// create Console Handler and define level ALL
ConsoleHandler console = new ConsoleHandler();
console.setLevel(Level.INFO);
logger.addHandler(console);
// create File Handler and define level ALL
File log = new File("log.txt");
FileHandler file = new FileHandler(log.getAbsolutePath());
file.setLevel(Level.ALL);
file.setFormatter(new SimpleFormatter());
logger.addHandler(file);
}
}
| [
"Admin@DESKTOP-OBQRPCJ"
] | Admin@DESKTOP-OBQRPCJ |
d0f140f0c22d9d43403cd5ab0e554edbcd4e9b32 | 3748c1f8d20a0a411049ed0a8bd420e9481179b4 | /Hotel/src/frontend/PantallaVisualizarUsuarios.java | 60160449e2b890fae9ebabe1b0ba8b3a62907256 | [] | no_license | Bayke96/Hotel | c1aae7f100e3284e83c7d9975852ac5c0205be04 | 5b0a6b374fde211ee38fd6ceda4a54068ec7f288 | refs/heads/master | 2020-04-01T19:28:18.572901 | 2018-10-19T16:30:13 | 2018-10-19T16:30:13 | 153,555,351 | 0 | 0 | null | null | null | null | ISO-8859-2 | Java | false | false | 27,018 | java | package frontend;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.geom.RoundRectangle2D;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
import javax.swing.JFrame;
import java.awt.Color;
import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.BorderLayout;
import javax.swing.JPanel;
import java.awt.GridLayout;
import java.awt.Image;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import java.awt.Shape;
import java.awt.TextField;
import com.jgoodies.forms.layout.FormLayout;
import com.jgoodies.forms.layout.ColumnSpec;
import com.jgoodies.forms.layout.RowSpec;
import backend.BD;
import com.jgoodies.forms.layout.FormSpecs;
import net.miginfocom.swing.MigLayout;
import javax.swing.UIManager;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.SwingConstants;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.JTextField;
import javax.swing.JPasswordField;
import javax.swing.ImageIcon;
import javax.swing.border.AbstractBorder;
import javax.swing.border.EmptyBorder;
import javax.swing.border.MatteBorder;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.text.WordUtils;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JButton;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JComboBox;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JTable;
import javax.swing.JScrollPane;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.DefaultTableModel;
import javax.swing.border.LineBorder;
public class PantallaVisualizarUsuarios {
private static JTable tablacargos;
public static void main(String[] args) {
try {
UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
} catch (Throwable e) {
e.printStackTrace();
}
JFrame PantallaVisualizarUsuarios = new JFrame("Hotel Mi Reina - Autorización de Acceso");
PantallaVisualizarUsuarios.setTitle("Hotel Mi Reina C.A - Visualizar Usuarios");
PantallaVisualizarUsuarios.getContentPane().setBackground(Color.WHITE);
PantallaVisualizarUsuarios.getContentPane().setLayout(null);
UIManager.put("TextField.border", BorderFactory.createCompoundBorder(
new CustomeBorder(),
new EmptyBorder(new Insets(4,4,4,4))));
ImagePanel panel = new ImagePanel(new ImageIcon(Toolkit.getDefaultToolkit().getImage(PantallaVisualizarUsuarios.class.getResource("/imagenes/BG.jpg"))).getImage());
panel.setDoubleBuffered(false);
panel.setFocusable(false);
panel.setFocusTraversalKeysEnabled(false);
panel.setOpaque(false);
panel.setBackground(new Color(255, 255, 255));
panel.setBounds(0, 0, 1012, 640);
PantallaVisualizarUsuarios.getContentPane().add(panel);
panel.setLayout(null);
JLabel lblNombre = new JLabel("Nombre");
lblNombre.setFont(new Font("SansSerif", Font.BOLD, 12));
lblNombre.setForeground(Color.WHITE);
lblNombre.setHorizontalAlignment(SwingConstants.CENTER);
lblNombre.setBounds(19, 78, 198, 16);
panel.add(lblNombre);
JLabel lblCargo = new JLabel("Cargo");
lblCargo.setFont(new Font("SansSerif", Font.BOLD, 12));
lblCargo.setForeground(Color.WHITE);
lblCargo.setHorizontalAlignment(SwingConstants.CENTER);
lblCargo.setBounds(447, 78, 198, 16);
panel.add(lblCargo);
JLabel lblHora = new JLabel(new Date().toString());
lblHora.setFont(new Font("SansSerif", Font.BOLD, 12));
lblHora.setForeground(Color.WHITE);
lblHora.setHorizontalAlignment(SwingConstants.CENTER);
lblHora.setBounds(19, 707, 139, 16);
panel.add(lblHora);
LocalDateTime ldt = LocalDateTime.now();
lblHora.setText("Fecha: " + DateTimeFormatter.ofPattern("dd-MM-yyyy", Locale.ENGLISH).format(ldt));
JLabel lblNewLabel = new JLabel("Hotel Mi Reina C.A");
lblNewLabel.setBorder(new MatteBorder(0, 0, 2, 0, (Color) Color.WHITE));
lblNewLabel.setForeground(Color.WHITE);
lblNewLabel.setFont(new Font("Script MT Bold", Font.BOLD, 29));
lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
lblNewLabel.setBounds(19, 19, 855, 47);
panel.add(lblNewLabel);
JLabel lblTurno_1 = new JLabel("Turno");
lblTurno_1.setHorizontalAlignment(SwingConstants.CENTER);
lblTurno_1.setForeground(Color.WHITE);
lblTurno_1.setFont(new Font("SansSerif", Font.BOLD, 12));
lblTurno_1.setBounds(669, 78, 198, 16);
panel.add(lblTurno_1);
JButton btnSalir = new JButton(" Salir");
btnSalir.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
PantallaVisualizarUsuarios.dispose();
}
});
btnSalir.setIcon(new ImageIcon(PantallaVisualizarUsuarios.class.getResource("/imagenes/LogoutIcon(1).png")));
btnSalir.setForeground(Color.WHITE);
btnSalir.setFont(new Font("Segoe UI", Font.BOLD, 12));
btnSalir.setFocusPainted(false);
btnSalir.setBackground(new Color(0, 51, 51));
btnSalir.setBounds(565, 137, 113, 37);
panel.add(btnSalir);
JComboBox comboBoxOrden = new JComboBox();
comboBoxOrden.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
BD op = new BD();
if(comboBoxOrden.getSelectedItem().toString().equalsIgnoreCase("Usuario")){
DefaultTableModel dm = (DefaultTableModel) tablacargos.getModel();
int rowCount = dm.getRowCount();
//Remove rows one by one from the end of the table
for (int i = rowCount - 1; i >= 0; i--) {
dm.removeRow(i);
}
try{
op.Conectar("Hotel");
Statement stmt = op.conn.createStatement();
String sql = "SELECT Nombre_Usuario, Nombres, Apellidos, Cedula, Direccion, Telefono, "
+ "Correo, Departamento, Cargo, RIF, Turno FROM Usuarios ORDER BY Nombre_Usuario Asc";
ResultSet rs = stmt.executeQuery(sql);
//STEP 5: Extract data from result set
while(rs.next()){
//Retrieve by column name
String username = rs.getString("Nombre_Usuario");
String turno = rs.getString("Turno");
int departamento = rs.getInt("Departamento");
int cargo = rs.getInt("Cargo");
String names = rs.getString("Nombres");
String lastnames = rs.getString("Apellidos");
int cedula = rs.getInt("Cedula");
String direccion = rs.getString("Direccion");
String telefono = rs.getString("Telefono");
String correo = rs.getString("Correo");
String RIF = rs.getString("RIF");
DefaultTableModel model = (DefaultTableModel) tablacargos.getModel();
if(cedula != 0) model.addRow(new Object[]{tablacargos.getRowCount() + 1, WordUtils.capitalizeFully(username),WordUtils.capitalizeFully(turno),
op.DestransformarCargo(departamento, cargo), WordUtils.capitalizeFully(names), WordUtils.capitalizeFully(lastnames), "V-" + cedula,
WordUtils.capitalizeFully(direccion), telefono, correo, RIF.toUpperCase()});
if(cedula == 0) model.addRow(new Object[]{tablacargos.getRowCount() + 1, WordUtils.capitalizeFully(username),WordUtils.capitalizeFully(turno),
op.DestransformarCargo(departamento, cargo) , WordUtils.capitalizeFully(names), WordUtils.capitalizeFully(lastnames), "",
WordUtils.capitalizeFully(direccion), telefono, correo, RIF.toUpperCase()});
}
rs.close();
op.Desconectar();
}
catch(Exception ae){
System.err.println(ae);
}
return;
}
if(comboBoxOrden.getSelectedItem().toString().equalsIgnoreCase("Nombres")){
DefaultTableModel dm = (DefaultTableModel) tablacargos.getModel();
int rowCount = dm.getRowCount();
//Remove rows one by one from the end of the table
for (int i = rowCount - 1; i >= 0; i--) {
dm.removeRow(i);
}
try{
op.Conectar("Hotel");
Statement stmt = op.conn.createStatement();
String sql = "SELECT Nombre_Usuario, Nombres, Apellidos, Cedula, Direccion, Telefono, "
+ "Correo, Departamento, Cargo, RIF, Turno FROM Usuarios ORDER BY Nombres Asc";
ResultSet rs = stmt.executeQuery(sql);
//STEP 5: Extract data from result set
while(rs.next()){
//Retrieve by column name
String username = rs.getString("Nombre_Usuario");
String turno = rs.getString("Turno");
int departamento = rs.getInt("Departamento");
int cargo = rs.getInt("Cargo");
String names = rs.getString("Nombres");
String lastnames = rs.getString("Apellidos");
int cedula = rs.getInt("Cedula");
String direccion = rs.getString("Direccion");
String telefono = rs.getString("Telefono");
String correo = rs.getString("Correo");
String RIF = rs.getString("RIF");
DefaultTableModel model = (DefaultTableModel) tablacargos.getModel();
if(cedula != 0) model.addRow(new Object[]{tablacargos.getRowCount() + 1, WordUtils.capitalizeFully(username),WordUtils.capitalizeFully(turno),
op.DestransformarCargo(departamento, cargo), WordUtils.capitalizeFully(names), WordUtils.capitalizeFully(lastnames), "V-" + cedula,
WordUtils.capitalizeFully(direccion), telefono, correo, RIF.toUpperCase()});
if(cedula == 0) model.addRow(new Object[]{tablacargos.getRowCount() + 1, WordUtils.capitalizeFully(username),WordUtils.capitalizeFully(turno),
op.DestransformarCargo(departamento, cargo) , WordUtils.capitalizeFully(names), WordUtils.capitalizeFully(lastnames), "",
WordUtils.capitalizeFully(direccion), telefono, correo, RIF.toUpperCase()});
}
rs.close();
op.Desconectar();
}
catch(Exception ae){
System.err.println(ae);
}
return;
}
if(comboBoxOrden.getSelectedItem().toString().equalsIgnoreCase("Apellidos")){
DefaultTableModel dm = (DefaultTableModel) tablacargos.getModel();
int rowCount = dm.getRowCount();
//Remove rows one by one from the end of the table
for (int i = rowCount - 1; i >= 0; i--) {
dm.removeRow(i);
}
try{
op.Conectar("Hotel");
Statement stmt = op.conn.createStatement();
String sql = "SELECT Nombre_Usuario, Nombres, Apellidos, Cedula, Direccion, Telefono, "
+ "Correo, Departamento, Cargo, RIF, Turno FROM Usuarios ORDER BY Apellidos Asc";
ResultSet rs = stmt.executeQuery(sql);
//STEP 5: Extract data from result set
while(rs.next()){
//Retrieve by column name
String username = rs.getString("Nombre_Usuario");
String turno = rs.getString("Turno");
int departamento = rs.getInt("Departamento");
int cargo = rs.getInt("Cargo");
String names = rs.getString("Nombres");
String lastnames = rs.getString("Apellidos");
int cedula = rs.getInt("Cedula");
String direccion = rs.getString("Direccion");
String telefono = rs.getString("Telefono");
String correo = rs.getString("Correo");
String RIF = rs.getString("RIF");
DefaultTableModel model = (DefaultTableModel) tablacargos.getModel();
if(cedula != 0) model.addRow(new Object[]{tablacargos.getRowCount() + 1, WordUtils.capitalizeFully(username),WordUtils.capitalizeFully(turno),
op.DestransformarCargo(departamento, cargo), WordUtils.capitalizeFully(names), WordUtils.capitalizeFully(lastnames), "V-" + cedula,
WordUtils.capitalizeFully(direccion), telefono, correo, RIF.toUpperCase()});
if(cedula == 0) model.addRow(new Object[]{tablacargos.getRowCount() + 1, WordUtils.capitalizeFully(username),WordUtils.capitalizeFully(turno),
op.DestransformarCargo(departamento, cargo) , WordUtils.capitalizeFully(names), WordUtils.capitalizeFully(lastnames), "",
WordUtils.capitalizeFully(direccion), telefono, correo, RIF.toUpperCase()});
}
rs.close();
op.Desconectar();
}
catch(Exception ae){
System.err.println(ae);
}
return;
}
if(comboBoxOrden.getSelectedItem().toString().equalsIgnoreCase("Cédula")){
DefaultTableModel dm = (DefaultTableModel) tablacargos.getModel();
int rowCount = dm.getRowCount();
//Remove rows one by one from the end of the table
for (int i = rowCount - 1; i >= 0; i--) {
dm.removeRow(i);
}
try{
op.Conectar("Hotel");
Statement stmt = op.conn.createStatement();
String sql = "SELECT Nombre_Usuario, Nombres, Apellidos, Cedula, Direccion, Telefono, "
+ "Correo, Departamento, Cargo, RIF, Turno FROM Usuarios ORDER BY Cedula Asc";
ResultSet rs = stmt.executeQuery(sql);
//STEP 5: Extract data from result set
while(rs.next()){
//Retrieve by column name
String username = rs.getString("Nombre_Usuario");
String turno = rs.getString("Turno");
int departamento = rs.getInt("Departamento");
int cargo = rs.getInt("Cargo");
String names = rs.getString("Nombres");
String lastnames = rs.getString("Apellidos");
int cedula = rs.getInt("Cedula");
String direccion = rs.getString("Direccion");
String telefono = rs.getString("Telefono");
String correo = rs.getString("Correo");
String RIF = rs.getString("RIF");
DefaultTableModel model = (DefaultTableModel) tablacargos.getModel();
if(cedula != 0) model.addRow(new Object[]{tablacargos.getRowCount() + 1, WordUtils.capitalizeFully(username),WordUtils.capitalizeFully(turno),
op.DestransformarCargo(departamento, cargo), WordUtils.capitalizeFully(names), WordUtils.capitalizeFully(lastnames), "V-" + cedula,
WordUtils.capitalizeFully(direccion), telefono, correo, RIF.toUpperCase()});
if(cedula == 0) model.addRow(new Object[]{tablacargos.getRowCount() + 1, WordUtils.capitalizeFully(username),WordUtils.capitalizeFully(turno),
op.DestransformarCargo(departamento, cargo) , WordUtils.capitalizeFully(names), WordUtils.capitalizeFully(lastnames), "",
WordUtils.capitalizeFully(direccion), telefono, correo, RIF.toUpperCase()});
}
rs.close();
op.Desconectar();
}
catch(Exception ae){
System.err.println(ae);
}
return;
}
if(comboBoxOrden.getSelectedItem().toString().equalsIgnoreCase("Correo")){
DefaultTableModel dm = (DefaultTableModel) tablacargos.getModel();
int rowCount = dm.getRowCount();
//Remove rows one by one from the end of the table
for (int i = rowCount - 1; i >= 0; i--) {
dm.removeRow(i);
}
try{
op.Conectar("Hotel");
Statement stmt = op.conn.createStatement();
String sql = "SELECT Nombre_Usuario, Nombres, Apellidos, Cedula, Direccion, Telefono, "
+ "Correo, Departamento, Cargo, RIF, Turno FROM Usuarios ORDER BY Correo Asc";
ResultSet rs = stmt.executeQuery(sql);
//STEP 5: Extract data from result set
while(rs.next()){
//Retrieve by column name
String username = rs.getString("Nombre_Usuario");
String turno = rs.getString("Turno");
int departamento = rs.getInt("Departamento");
int cargo = rs.getInt("Cargo");
String names = rs.getString("Nombres");
String lastnames = rs.getString("Apellidos");
int cedula = rs.getInt("Cedula");
String direccion = rs.getString("Direccion");
String telefono = rs.getString("Telefono");
String correo = rs.getString("Correo");
String RIF = rs.getString("RIF");
DefaultTableModel model = (DefaultTableModel) tablacargos.getModel();
if(cedula != 0) model.addRow(new Object[]{tablacargos.getRowCount() + 1, WordUtils.capitalizeFully(username),WordUtils.capitalizeFully(turno),
op.DestransformarCargo(departamento, cargo), WordUtils.capitalizeFully(names), WordUtils.capitalizeFully(lastnames), "V-" + cedula,
WordUtils.capitalizeFully(direccion), telefono, correo, RIF.toUpperCase()});
if(cedula == 0) model.addRow(new Object[]{tablacargos.getRowCount() + 1, WordUtils.capitalizeFully(username),WordUtils.capitalizeFully(turno),
op.DestransformarCargo(departamento, cargo) , WordUtils.capitalizeFully(names), WordUtils.capitalizeFully(lastnames), "",
WordUtils.capitalizeFully(direccion), telefono, correo, RIF.toUpperCase()});
}
rs.close();
op.Desconectar();
}
catch(Exception ae){
System.err.println(ae);
}
return;
}
if(comboBoxOrden.getSelectedItem().toString().equalsIgnoreCase("Turno")){
DefaultTableModel dm = (DefaultTableModel) tablacargos.getModel();
int rowCount = dm.getRowCount();
//Remove rows one by one from the end of the table
for (int i = rowCount - 1; i >= 0; i--) {
dm.removeRow(i);
}
try{
op.Conectar("Hotel");
Statement stmt = op.conn.createStatement();
String sql = "SELECT Nombre_Usuario, Nombres, Apellidos, Cedula, Direccion, Telefono, "
+ "Correo, Departamento, Cargo, RIF, Turno FROM Usuarios ORDER BY Turno Asc";
ResultSet rs = stmt.executeQuery(sql);
//STEP 5: Extract data from result set
while(rs.next()){
//Retrieve by column name
String username = rs.getString("Nombre_Usuario");
String turno = rs.getString("Turno");
int departamento = rs.getInt("Departamento");
int cargo = rs.getInt("Cargo");
String names = rs.getString("Nombres");
String lastnames = rs.getString("Apellidos");
int cedula = rs.getInt("Cedula");
String direccion = rs.getString("Direccion");
String telefono = rs.getString("Telefono");
String correo = rs.getString("Correo");
String RIF = rs.getString("RIF");
DefaultTableModel model = (DefaultTableModel) tablacargos.getModel();
if(cedula != 0) model.addRow(new Object[]{tablacargos.getRowCount() + 1, WordUtils.capitalizeFully(username),WordUtils.capitalizeFully(turno),
op.DestransformarCargo(departamento, cargo), WordUtils.capitalizeFully(names), WordUtils.capitalizeFully(lastnames), "V-" + cedula,
WordUtils.capitalizeFully(direccion), telefono, correo, RIF.toUpperCase()});
if(cedula == 0) model.addRow(new Object[]{tablacargos.getRowCount() + 1, WordUtils.capitalizeFully(username),WordUtils.capitalizeFully(turno),
op.DestransformarCargo(departamento, cargo) , WordUtils.capitalizeFully(names), WordUtils.capitalizeFully(lastnames), "",
WordUtils.capitalizeFully(direccion), telefono, correo, RIF.toUpperCase()});
}
rs.close();
op.Desconectar();
}
catch(Exception ae){
System.err.println(ae);
}
return;
}
if(comboBoxOrden.getSelectedItem().toString().equalsIgnoreCase("Cargo")){
DefaultTableModel dm = (DefaultTableModel) tablacargos.getModel();
int rowCount = dm.getRowCount();
//Remove rows one by one from the end of the table
for (int i = rowCount - 1; i >= 0; i--) {
dm.removeRow(i);
}
try{
op.Conectar("Hotel");
Statement stmt = op.conn.createStatement();
String sql = "SELECT Nombre_Usuario, Nombres, Apellidos, Cedula, Direccion, Telefono, "
+ "Correo, Departamento, Cargo, RIF, Turno FROM Usuarios ORDER BY Nombre_Usuario Asc";
ResultSet rs = stmt.executeQuery(sql);
//STEP 5: Extract data from result set
while(rs.next()){
//Retrieve by column name
String username = rs.getString("Nombre_Usuario");
String turno = rs.getString("Turno");
int departamento = rs.getInt("Departamento");
int cargo = rs.getInt("Cargo");
String names = rs.getString("Nombres");
String lastnames = rs.getString("Apellidos");
int cedula = rs.getInt("Cedula");
String direccion = rs.getString("Direccion");
String telefono = rs.getString("Telefono");
String correo = rs.getString("Correo");
String RIF = rs.getString("RIF");
DefaultTableModel model = (DefaultTableModel) tablacargos.getModel();
if(cedula != 0) model.addRow(new Object[]{tablacargos.getRowCount() + 1, WordUtils.capitalizeFully(username),WordUtils.capitalizeFully(turno),
op.DestransformarCargo(departamento, cargo), WordUtils.capitalizeFully(names), WordUtils.capitalizeFully(lastnames), "V-" + cedula,
WordUtils.capitalizeFully(direccion), telefono, correo, RIF.toUpperCase()});
if(cedula == 0) model.addRow(new Object[]{tablacargos.getRowCount() + 1, WordUtils.capitalizeFully(username),WordUtils.capitalizeFully(turno),
op.DestransformarCargo(departamento, cargo) , WordUtils.capitalizeFully(names), WordUtils.capitalizeFully(lastnames), "",
WordUtils.capitalizeFully(direccion), telefono, correo, RIF.toUpperCase()});
}
rs.close();
op.Desconectar();
}
catch(Exception ae){
System.err.println(ae);
}
return;
}
}
});
comboBoxOrden.setFont(new Font("SansSerif", Font.BOLD, 12));
comboBoxOrden.setModel(new DefaultComboBoxModel(new String[] {"Seleccionar", "Usuario", "Nombres", "Apellidos", "C\u00E9dula", "Correo", "Cargo", "Turno"}));
comboBoxOrden.setBounds(355, 141, 198, 28);
panel.add(comboBoxOrden);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBorder(null);
scrollPane.setBackground(new Color(0, 0, 0, 0));
scrollPane.setBounds(19, 186, 975, 376);
panel.add(scrollPane);
tablacargos = new JTable();
tablacargos.setRowSelectionAllowed(false);
tablacargos.setFont(new Font("Segoe UI", Font.BOLD, 10));
tablacargos.setGridColor(new Color(255, 255, 255));
tablacargos.setForeground(new Color(255, 255, 255));
tablacargos.setBorder(new LineBorder(new Color(0, 51, 51), 1, true));
tablacargos.setFillsViewportHeight(true);
tablacargos.setBackground(new Color(0, 51, 51));
tablacargos.setShowGrid(false);
tablacargos.setModel(new DefaultTableModel(
new Object[][] {
},
new String[] {
"<html><b>N\u00B0</b></html>", "<html><b>Usuario</b></html>", "<html><b>Turno</b></html>", "<html><b>Cargo</b></html>", "<html><b>Nombres</b></html>", "<html><b>Apellidos</b></html>", "<html><b>C.I</b></html>", "<html><b>Direcci\u00F3n</b></html>", "<html><b>T\u00E9lefono</b></html>", "<html><b>Correo</b></html>", "<html><b>RIF</b></html>"
}
) {
boolean[] columnEditables = new boolean[] {
false, false, false, false, false, false, false, false, false, false, false
};
public boolean isCellEditable(int row, int column) {
return columnEditables[column];
}
});
tablacargos.getColumnModel().getColumn(0).setResizable(false);
tablacargos.getColumnModel().getColumn(0).setMaxWidth(32);
tablacargos.getColumnModel().getColumn(1).setResizable(false);
tablacargos.setShowHorizontalLines(true);
scrollPane.setViewportView(tablacargos);
DefaultTableCellRenderer headerRenderer = new DefaultTableCellRenderer();
headerRenderer.setBackground(new Color(0, 51, 51));
headerRenderer.setForeground(Color.WHITE);
headerRenderer.setHorizontalAlignment(JLabel.CENTER);
headerRenderer.setFont(new Font("Segoe UI", Font.BOLD, 12));
tablacargos.getTableHeader().setReorderingAllowed(false);
for (int i = 0; i < tablacargos.getModel().getColumnCount(); i++) {
tablacargos.getColumnModel().getColumn(i).setHeaderRenderer(headerRenderer);
tablacargos.getColumnModel().getColumn(i).setCellRenderer( headerRenderer );
}
PantallaVisualizarUsuarios.setIconImage(Toolkit.getDefaultToolkit().getImage(PantallaVisualizarUsuarios.class.getResource("/imagenes/HotelIcon.png")));
PantallaVisualizarUsuarios.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
PantallaVisualizarUsuarios.setResizable(false);
PantallaVisualizarUsuarios.setSize(1024, 668);
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
PantallaVisualizarUsuarios.setLocation(dim.width/2-PantallaVisualizarUsuarios.getSize().width/2, dim.height/2-PantallaVisualizarUsuarios.getSize().height/2);
BD abc = new BD();
try {
abc.CargarUsuarios(tablacargos);
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
lblNombre.setText(WordUtils.capitalizeFully(PantallaAcceso.Usuario));
lblCargo.setText(WordUtils.capitalizeFully(PantallaAcceso.cargo));
lblTurno_1.setText(WordUtils.capitalizeFully(PantallaAcceso.Turno));
JLabel lblCargo_1 = new JLabel("Ordenar por");
lblCargo_1.setHorizontalAlignment(SwingConstants.CENTER);
lblCargo_1.setForeground(Color.WHITE);
lblCargo_1.setFont(new Font("Segoe UI", Font.BOLD, 12));
lblCargo_1.setBounds(239, 139, 104, 33);
panel.add(lblCargo_1);
JLabel lbldepartamento = new JLabel(PantallaAcceso.departamento);
lbldepartamento.setHorizontalAlignment(SwingConstants.CENTER);
lbldepartamento.setForeground(Color.WHITE);
lbldepartamento.setFont(new Font("SansSerif", Font.BOLD, 12));
lbldepartamento.setBounds(237, 78, 198, 16);
panel.add(lbldepartamento);
PantallaVisualizarUsuarios.setVisible(true);
}
}
| [
"cdgl1996@gmail.com"
] | cdgl1996@gmail.com |
3255cde4714c6ca515e3057497c3b1d95f817843 | ef3117a35719a8d4bb4d0437c9ee1e177466325b | /ch08_prj3_AreaCalculator/src/Rectangle.java | d9909256e2300bcbf21a5d8e1fd1ac0a8539abed | [] | no_license | sean-blessing/bootcamp-2018-02-instruction | 699188ffaacb9680d5aec63564a9db712988fd7a | 77d393016156f19860d5d7fcf9573fdf8fd4b9da | refs/heads/master | 2020-03-28T02:31:40.247843 | 2018-10-24T13:02:11 | 2018-10-24T13:02:11 | 147,577,237 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 370 | java |
public class Rectangle extends Square {
private double height;
public Rectangle(double width, double height) {
super(width);
this.height = height;
}
public double getHeight() {
return height;
}
public void setHeight(double height) {
this.height = height;
}
@Override
public double getArea() {
return width*height;
}
}
| [
"snblessing@gmail.com"
] | snblessing@gmail.com |
2139c42a1ec9dae195961cecfb8768de5954bf7b | 498035e4aca74601d6ee3ed35a4d13459a2f4f15 | /2.JavaCore/src/com/javarush/task/task14/task1418/Solution.java | e73705fd9a847187837d6a3a3da2c4b9944a52c7 | [] | no_license | PPrydorozhnyi/JavaRush | 8de342457b7399cd1a46ba2f57462e70d59ad236 | fe9b6c04ce6a80ebcf4df742135a32aaa39f479d | refs/heads/master | 2021-06-22T10:18:06.352082 | 2017-09-06T18:36:56 | 2017-09-06T18:36:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,126 | java | package com.javarush.task.task14.task1418;
import java.util.DoubleSummaryStatistics;
import java.util.LinkedList;
import java.util.List;
/*
Исправь 4 ошибки
*/
public class Solution {
public static void main(String[] args) {
List<Number> list = new LinkedList<Number>();
//3
initList(list);
printListValues(list);
processCastedObjects(list);
/*list.add(new Double(1000f));
list.add(new Double("123e-445632"));
list.add(new Float(-90 / -3));
list.remove(new Double("123e-445632"));*/
//4 - Исправь 2 ошибки
/*for (int i = 0; i <= list.size(); i--) {
System.out.println(list.get(i));
}*/
//5
/*for (Number object : list) {
//Исправь 2 ошибки
if (object instanceof Float) {
Double a = (Double) object;
System.out.println("Is float value defined? " + !(a.isNaN()));
} else if (object instanceof Double) {
Float a = (Float) object;
System.out.println("Is double value infinite? " + a.isInfinite());
}
}*/
}
public static void initList(List<Number> list){
list.add(new Double(1000f));
list.add(new Double("123e-445632"));
list.add(new Float(-90 / -3));
list.remove(new Double("123e-445632"));
}
public static void printListValues(List<Number> list){
for (int i = 0; i < list.size(); i++) {
System.out.println(list.get(i));
}
}
public static void processCastedObjects(List<Number> list){
for (Number object : list) {
//Исправь 2 ошибки
if (object instanceof Float) {
Float a = (Float) object;
System.out.println("Is float value defined? " + !(a.isNaN()));
} else if (object instanceof Double) {
Double a = (Double) object;
System.out.println("Is double value infinite? " + a.isInfinite());
}
}
}
}
| [
"Peter35128@gmail.com"
] | Peter35128@gmail.com |
5e5ba95019fa3825fd1db2652699611c337902aa | c832c1f846b0f85369b2e3521322c54bdf6e941f | /app/src/test/java/com/example/lucasgoldman/bluetoothtestapp2/ExampleUnitTest.java | fdd574a3ed0d9b2eddeec7c37aa7186db452c866 | [] | no_license | LucasGoldman/Bluetoothtestapp2 | 7f629c235947d980c907ae91a664860cc674df45 | 69660f0f5dc585c312a2a21313a5372e773d364a | refs/heads/master | 2021-01-01T04:14:14.492776 | 2017-07-13T16:50:13 | 2017-07-13T16:50:13 | 97,145,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 420 | java | package com.example.lucasgoldman.bluetoothtestapp2;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"jeffgoldman@jeffs-MacBook-Pro.local"
] | jeffgoldman@jeffs-MacBook-Pro.local |
62fd27499b55abecdc33be6bfeb1e16c6dd68fc2 | 84e4452d49b0ac0f1f2332ddd48c0efe0e9559f2 | /src/by/it/loktev/jd01_13/VariantC/Computer.java | db5ed4a75600f4e391f2f0f25fe26a60569d3ca8 | [] | no_license | loktevalexey/JD2017-02-20 | ea2c25203cefc2c139f1277f17d9999e5c8af522 | f69c964dc9d651c2acef01e6f177aead182f83b6 | refs/heads/master | 2020-04-15T00:13:55.277294 | 2017-06-20T07:53:24 | 2017-06-20T07:53:24 | 86,786,465 | 0 | 1 | null | 2017-03-31T06:37:19 | 2017-03-31T06:37:19 | null | UTF-8 | Java | false | false | 1,258 | java | package by.it.loktev.jd01_13.VariantC;
abstract public class Computer extends ElectronicDevice implements IRunProgram {
public Computer(String name, double weight){
super(name,weight);
}
// можно было не реализовывать run в этом классе, а только в дочерних;
// но нужно же и показать вызов super.метод()
public void run(String path) throws RunException {
System.out.println("Готовимся к запуску программы "+path+"...");
if ( Math.random()<((this instanceof Notebook)?0.5:0.1) )
{
System.out.println("УПС! НЕ ХВАТИЛО ПАМЯТИ!");
throw new RunException("Не хватило памяти для запуска программы "+path);
}
}
abstract public void repairBroken();
abstract public void repairBroken(double price);
public void runScreenSaver(String path){
System.out.println("включаем скринсейвер...");
run(path); // позднее связывание
}
@Override
public void switchOff(){
System.out.println("выключаем компьютер "+name);
}
}
| [
"loktev.alex.74@gmail.com"
] | loktev.alex.74@gmail.com |
036b43d515aae3cf2da4a0b32ba54f08f52574e3 | 13f12f6b2356ebbf046bd3a5443aaa2ab645224f | /seckill/src/main/java/com/monitoring/seckill/Util/EnumCode.java | 29ea4f6052bdf5a9d64bcb39a505c9152a4bab57 | [] | no_license | MyBaron/TK | fa063241ff19b9000c3d6ecd8b21e8a7edafdacb | 5fe931e845a34378c661de3616983619f2cbe8c8 | refs/heads/master | 2023-01-07T18:58:01.370402 | 2019-06-15T13:57:35 | 2019-06-15T13:57:35 | 162,979,060 | 1 | 0 | null | 2023-01-03T23:19:58 | 2018-12-24T10:27:15 | CSS | UTF-8 | Java | false | false | 95 | java | package com.monitoring.seckill.Util;
public enum EnumCode {
;
EnumCode() {
}
}
| [
"249790774@qq.com"
] | 249790774@qq.com |
37e5b5d5ae5e2032a7d249b378dd5ba7bcffa1d1 | e30479b1089cccb84357752f2477cf8760ef32b6 | /src/main/java/com/example/demo/repository/AyUserRepository.java | 5cf4c9852a62384ca91fd504a013144ea0b6d384 | [] | no_license | codezhe/My-Spring-Boot | 7f4ba6e0d6255382d6a7d1c6093cd6e71b28014f | f29cd80cb28f0dd548cf330ed104f1d99e31f0d4 | refs/heads/master | 2020-07-14T16:35:22.734787 | 2019-09-06T07:15:40 | 2019-09-06T07:15:40 | 205,354,320 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 794 | java | package com.example.demo.repository;
import com.example.demo.model.AyUser;
import org.atmosphere.config.service.Delete;
import org.springframework.data.domain.Page;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import java.awt.print.Pageable;
import java.util.Collection;
import java.util.List;
/**
* @author Somebody
*/
public interface AyUserRepository extends JpaRepository<AyUser, String> {
/*
通过名字相等查询,参数为name
==selec u from ay_user u where u.name = ?1
*/
List<AyUser> findByName(String name);
/*
name like查询
*/
List<AyUser> findByNameLike(String name);
/*
查询id集合
*/
List<AyUser> findByIdIn(Collection<String> ids);
}
| [
"1487691423@qq.com"
] | 1487691423@qq.com |
66011bcbfb2645c42b4e03e477df40486165700b | 71f681a257f5fa81d29e17d844f1cafe7d348b54 | /app/src/main/java/com/thienthien97/thstore/Model/ObjectClass/KhuyenMai.java | 3cadc57ee69caf4cca04871bd7872fff58a49ad1 | [] | no_license | hoangthien97/DA_CN | ae8af8fd4f3be9b3e81d46a69f0b361aad959fcd | cf314df7e0d0db5470815bbdb8add2eceab8ba72 | refs/heads/master | 2020-04-09T17:56:46.509332 | 2018-12-05T10:14:55 | 2018-12-05T10:14:55 | 160,496,685 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,563 | java | package com.thienthien97.thstore.Model.ObjectClass;
import java.util.List;
public class KhuyenMai {
int MAKM, MALOAISP;
String TENKM;
String NGAYBATDAU;
String NGAYKETTHUC;
String HINHKHUYENMAI;
String TENLOAISP;
List<SanPham> DSSPKhuyenMai;
public String getTENLOAISP() {
return TENLOAISP;
}
public void setTENLOAISP(String TENLOAISP) {
this.TENLOAISP = TENLOAISP;
}
public int getMAKM() {
return MAKM;
}
public void setMAKM(int MAKM) {
this.MAKM = MAKM;
}
public int getMALOAISP() {
return MALOAISP;
}
public void setMALOAISP(int MALOAISP) {
this.MALOAISP = MALOAISP;
}
public String getTENKM() {
return TENKM;
}
public void setTENKM(String TENKM) {
this.TENKM = TENKM;
}
public String getNGAYBATDAU() {
return NGAYBATDAU;
}
public void setNGAYBATDAU(String NGAYBATDAU) {
this.NGAYBATDAU = NGAYBATDAU;
}
public String getNGAYKETTHUC() {
return NGAYKETTHUC;
}
public void setNGAYKETTHUC(String NGAYKETTHUC) {
this.NGAYKETTHUC = NGAYKETTHUC;
}
public String getHINHKHUYENMAI() {
return HINHKHUYENMAI;
}
public void setHINHKHUYENMAI(String HINHKHUYENMAI) {
this.HINHKHUYENMAI = HINHKHUYENMAI;
}
public List<SanPham> getDSSPKhuyenMai() {
return DSSPKhuyenMai;
}
public void setDSSPKhuyenMai(List<SanPham> DSSPKhuyenMai) {
this.DSSPKhuyenMai = DSSPKhuyenMai;
}
}
| [
"thien.vuhoang97@gmail.com"
] | thien.vuhoang97@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.