blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 132 | path stringlengths 2 382 | src_encoding stringclasses 34
values | length_bytes int64 9 3.8M | score float64 1.5 4.94 | int_score int64 2 5 | detected_licenses listlengths 0 142 | license_type stringclasses 2
values | text stringlengths 9 3.8M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
3a591abfa39906836e7afb3729d61b022555e14a | Java | creative-active-technology/inkubator-hrm | /inkubator-hrm/src/main/java/com/inkubator/hrm/web/model/UnregPayrollViewModel.java | UTF-8 | 1,655 | 1.992188 | 2 | [] | no_license | package com.inkubator.hrm.web.model;
import java.io.Serializable;
import java.math.BigDecimal;
/**
*
* @author rizkykojek
*/
public class UnregPayrollViewModel implements Serializable {
private Long id;
private Long unregSalaryId;
private Long empDataId;
private String empNik;
private String empName;
private BigDecimal income;
private BigDecimal deduction;
private BigDecimal tax;
private BigDecimal takeHomePay;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getUnregSalaryId() {
return unregSalaryId;
}
public void setUnregSalaryId(Long unregSalaryId) {
this.unregSalaryId = unregSalaryId;
}
public Long getEmpDataId() {
return empDataId;
}
public void setEmpDataId(Long empDataId) {
this.empDataId = empDataId;
}
public String getEmpNik() {
return empNik;
}
public void setEmpNik(String empNik) {
this.empNik = empNik;
}
public String getEmpName() {
return empName;
}
public void setEmpName(String empName) {
this.empName = empName;
}
public BigDecimal getIncome() {
return income;
}
public void setIncome(BigDecimal income) {
this.income = income;
}
public BigDecimal getDeduction() {
return deduction;
}
public void setDeduction(BigDecimal deduction) {
this.deduction = deduction;
}
public BigDecimal getTax() {
return tax;
}
public void setTax(BigDecimal tax) {
this.tax = tax;
}
public BigDecimal getTakeHomePay() {
return takeHomePay;
}
public void setTakeHomePay(BigDecimal takeHomePay) {
this.takeHomePay = takeHomePay;
}
}
| true |
f354f06f4ca797085b9dc51ee70a259025e03473 | Java | hexstia/ScreenShareRTC-master | /app/src/main/java/org/webrtc/VideoEncoder.java | UTF-8 | 3,088 | 2.171875 | 2 | [
"Apache-2.0"
] | permissive | //
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package org.webrtc;
import org.webrtc.EncodedImage.FrameType;
public interface VideoEncoder {
VideoCodecStatus initEncode(VideoEncoder.Settings var1, VideoEncoder.Callback var2);
VideoCodecStatus release();
VideoCodecStatus encode(VideoFrame var1, VideoEncoder.EncodeInfo var2);
VideoCodecStatus setChannelParameters(short var1, long var2);
VideoCodecStatus setRateAllocation(VideoEncoder.BitrateAllocation var1, int var2);
VideoEncoder.ScalingSettings getScalingSettings();
String getImplementationName();
public interface Callback {
void onEncodedFrame(EncodedImage var1, VideoEncoder.CodecSpecificInfo var2);
}
public static class ScalingSettings {
public final boolean on;
public final int low;
public final int high;
public ScalingSettings(boolean on, int low, int high) {
this.on = on;
this.low = low;
this.high = high;
}
}
public static class BitrateAllocation {
public final int[][] bitratesBbs;
public BitrateAllocation(int[][] bitratesBbs) {
this.bitratesBbs = bitratesBbs;
}
public int getSum() {
int sum = 0;
int[][] var2 = this.bitratesBbs;
int var3 = var2.length;
for(int var4 = 0; var4 < var3; ++var4) {
int[] spatialLayer = var2[var4];
int[] var6 = spatialLayer;
int var7 = spatialLayer.length;
for(int var8 = 0; var8 < var7; ++var8) {
int bitrate = var6[var8];
sum += bitrate;
}
}
return sum;
}
}
public static class CodecSpecificInfoH264 extends VideoEncoder.CodecSpecificInfo {
public CodecSpecificInfoH264() {
}
}
public static class CodecSpecificInfoVP9 extends VideoEncoder.CodecSpecificInfo {
public CodecSpecificInfoVP9() {
}
}
public static class CodecSpecificInfoVP8 extends VideoEncoder.CodecSpecificInfo {
public CodecSpecificInfoVP8() {
}
}
public static class CodecSpecificInfo {
public CodecSpecificInfo() {
}
}
public static class EncodeInfo {
public final FrameType[] frameTypes;
public EncodeInfo(FrameType[] frameTypes) {
this.frameTypes = frameTypes;
}
}
public static class Settings {
public final int numberOfCores;
public final int width;
public final int height;
public final int startBitrate;
public final int maxFramerate;
public Settings(int numberOfCores, int width, int height, int startBitrate, int maxFramerate) {
this.numberOfCores = numberOfCores;
this.width = width;
this.height = height;
this.startBitrate = startBitrate;
this.maxFramerate = maxFramerate;
}
}
}
| true |
89d25e424cec435e852b8f2a9444deb9d38ac02f | Java | MarcosPerezA/CRUDinterfazProgra2 | /Comisiones/src/main/java/Ingreso.java | UTF-8 | 12,849 | 2.484375 | 2 | [] | no_license |
import Datos.ClsempleadoJDBC;
import Dominio.Clsempleado;
import java.awt.Color;
import javax.swing.JOptionPane;
/*
* 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.
*/
/**
*
* @author W10
*/
public class Ingreso extends javax.swing.JFrame {
/**
* Creates new form Ingreso
*/
public Ingreso() {
initComponents();
this.setTitle("Ingreso De Registros");
this.getContentPane().setBackground(Color.yellow);
setLocationRelativeTo(null);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jButton1 = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
txteb = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
txten = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
txtnom = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
txtmar = new javax.swing.JTextField();
btninsert = new javax.swing.JButton();
jLabel5 = new javax.swing.JLabel();
jButton2 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jButton1.setText("Regresar a CRUD");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jLabel1.setText("Ingresa el nombre");
txteb.setBackground(new java.awt.Color(0, 0, 0));
txteb.setForeground(new java.awt.Color(255, 255, 255));
jLabel2.setText("ingresa el total de enero");
txten.setBackground(new java.awt.Color(0, 0, 0));
txten.setForeground(new java.awt.Color(255, 255, 255));
jLabel3.setText("Ingresa el total de febrero");
txtnom.setBackground(new java.awt.Color(0, 0, 0));
txtnom.setForeground(new java.awt.Color(255, 255, 255));
jLabel4.setText("Ingresa el total de marzo");
txtmar.setBackground(new java.awt.Color(0, 0, 0));
txtmar.setForeground(new java.awt.Color(255, 255, 255));
btninsert.setText("Insertar");
btninsert.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btninsertActionPerformed(evt);
}
});
jLabel5.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jLabel5.setText("Ingresa Un registro nuevo");
jLabel5.setBorder(javax.swing.BorderFactory.createEtchedBorder());
jButton2.setText("Mostrar Registros");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 139, Short.MAX_VALUE))
.addComponent(jLabel4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(txtmar, javax.swing.GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE)
.addComponent(txteb))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(txtnom, javax.swing.GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE)
.addComponent(txten))
.addGap(0, 0, Short.MAX_VALUE))))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(btninsert, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 127, Short.MAX_VALUE)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
.addGroup(layout.createSequentialGroup()
.addGap(135, 135, 135)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 163, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGap(114, 114, 114)
.addComponent(jLabel5)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel5)
.addGap(17, 17, 17)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtnom, 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.BASELINE)
.addComponent(txten, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(txteb, 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.BASELINE)
.addComponent(jLabel4)
.addComponent(txtmar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 54, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btninsert)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(29, 29, 29)
.addComponent(jButton1))
);
pack();
}// </editor-fold>//GEN-END:initComponents
public void insertar(){
ClsempleadoJDBC em= new ClsempleadoJDBC();
Clsempleado emp= new Clsempleado();
String nombre= txtnom.getText();
emp.setnombre(" "+nombre);
double Enero = Double.valueOf(txten.getText());
emp.setEnero(Enero);
double Febrero = Double.valueOf(txteb.getText());
emp.setFebrero(Febrero);
double Marzo = Double.valueOf(txtmar.getText());
emp.setMarzo(Marzo);
em.insert(emp);
JOptionPane.showMessageDialog(null, "Registro Exitoso");
}
public void mostrar(){
Mostrar mostrar = new Mostrar();
mostrar.setVisible(true);
this.dispose();
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
regresar();
this.dispose();
}//GEN-LAST:event_jButton1ActionPerformed
private void btninsertActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btninsertActionPerformed
// TODO add your handling code here:
insertar();
}//GEN-LAST:event_btninsertActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
// TODO add your handling code here:
mostrar();
}//GEN-LAST:event_jButton2ActionPerformed
public void regresar(){
CRUD CRUD = new CRUD();
CRUD.setVisible(true);
}
/**
* @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(Ingreso.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Ingreso.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Ingreso.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Ingreso.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 Ingreso().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btninsert;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JTextField txteb;
private javax.swing.JTextField txten;
private javax.swing.JTextField txtmar;
private javax.swing.JTextField txtnom;
// End of variables declaration//GEN-END:variables
}
| true |
eda857027209812424b2607ac21e48fbcc2bd09a | Java | pditommaso/Black-Coffee | /commons/src/org/blackcoffee/commons/utils/Duration.java | UTF-8 | 2,571 | 3.25 | 3 | [] | no_license | package org.blackcoffee.commons.utils;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/*
* Duration class
*/
public class Duration {
static Pattern days = Pattern.compile("^([0-9]+)d$");
static Pattern hours = Pattern.compile("^([0-9]+)h$");
static Pattern minutes = Pattern.compile("^([0-9]+)mi?n$");
static Pattern seconds = Pattern.compile("^([0-9]+)s$");
static Pattern millis = Pattern.compile("^([0-9]+)(ms)?$");
long value;
private Duration() {
}
public long millis() {
return value;
}
public int secs() {
return (int) (value / 1000);
}
public int mins() {
return secs() / 60;
}
public int hours() {
return mins() / 60;
}
public int days() {
return hours() / 24;
}
/**
* Parse a duration
* @param duration 3h, 2mn, 7s
* @return The number of seconds
*/
public static Duration parse(String duration) {
Duration result = new Duration();
result.value = -1;
if (days.matcher(duration).matches()) {
Matcher matcher = days.matcher(duration);
matcher.matches();
result.value = Integer.parseInt(matcher.group(1)) * (60 * 60) * 24 * 1000;
}
else if (hours.matcher(duration).matches()) {
Matcher matcher = hours.matcher(duration);
matcher.matches();
result.value = Integer.parseInt(matcher.group(1)) * (60 * 60) * 1000;
}
else if (minutes.matcher(duration).matches()) {
Matcher matcher = minutes.matcher(duration);
matcher.matches();
result.value = Integer.parseInt(matcher.group(1)) * (60) * 1000;
}
else if (seconds.matcher(duration).matches()) {
Matcher matcher = seconds.matcher(duration);
matcher.matches();
result.value = Integer.parseInt(matcher.group(1)) * 1000;
}
else if (millis.matcher(duration).matches()) {
Matcher matcher = millis.matcher(duration);
matcher.matches();
result.value = Integer.parseInt(matcher.group(1)) ;
}
if (result.value == -1) {
throw new IllegalArgumentException("Invalid duration pattern : " + duration);
}
return result;
}
public String toString() {
return String.format("Duration[%s ms]", value);
}
}
| true |
fe178966764555f2495fe26f57cea6bfea80529a | Java | lixiawss/fd-j | /feidao-service-migratory/src/main/java/com/feidao/platform/service/migratory/serviceimpl/UserRegisterServiceImpl.java | UTF-8 | 25,401 | 2.109375 | 2 | [] | no_license | package com.feidao.platform.service.migratory.serviceimpl;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.feidao.platform.common.constants.SystemIdCTS;
import com.feidao.platform.common.dbtemplate.db.template.IDBTemplate;
import com.feidao.platform.common.dbtemplate.db.template.util.CreateDBTemplateUtil;
import com.feidao.platform.common.util.MD5Util;
import com.feidao.platform.service.data.constants.MessageContentCTS;
import com.feidao.platform.service.data.utils.PublicUtils;
import com.feidao.platform.service.migratory.serviceInterface.IUserRegisterService;
import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
/**
* 注册自定义服务实现类
*
*/
public class UserRegisterServiceImpl implements IUserRegisterService {
private static final Logger LOGGER = LoggerFactory.getLogger(UserRegisterServiceImpl.class);
private static final String PUB_USER_T_NAME = "pub_user";
private static final String PUB_CAPTCHA_T_NAME = "pub_captcha";
private BasicDBObject msgNode;
public UserRegisterServiceImpl(BasicDBObject msgNode) throws Exception {
super();
this.msgNode = msgNode;
}
// ------------------------ methods --------------------------
@Override
public String execute() throws Exception {
String result = "";
if(LOGGER.isDebugEnabled()){
LOGGER.debug(this.getClass().getName()+".UserRegisterServiceImpl-msgNode:" + msgNode);
}
String spaceId = PublicUtils.getSpaceId(msgNode);
String systemid = SystemIdCTS.CLIENT_META;
String regType = msgNode.getString(MessageContentCTS.REG_TYPE);
String usercode = msgNode.getString(MessageContentCTS.REGISTER_USERCODE);
String userName = msgNode.getString(MessageContentCTS.USER_REGISTER_USER_NAME);
boolean usernameUnique = msgNode.getBoolean(MessageContentCTS.USERNAME_UNIQUE);
String email = msgNode.getString(MessageContentCTS.EMAIL);
String phone = msgNode.getString(MessageContentCTS.PHONE);
String password = msgNode.getString(MessageContentCTS.PASSWORD);
String captcha = msgNode.getString(MessageContentCTS.CAPTCHA);
String imgCaptcha = msgNode.getString(MessageContentCTS.IMG_CAPTCHA);
String imgCaptchaKey = msgNode.getString(MessageContentCTS.IMG_CAPTCHA_KEY);
String productid = msgNode.getString(MessageContentCTS.PRODUCT_ID);
IDBTemplate publicTemplate = CreateDBTemplateUtil.createDBTemplate(spaceId,systemid);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String formatdate = format.format(new Date());
try {
if (isEmpty(productid)) {
result = "{\"result\":false,\"msg\":\"产品ID不能为空\"}";
return result;
}
if ("usercode".equals(regType)) {
if (isEmpty(usercode)) {
result = "{\"result\":false,\"msg\":\"用户名不能为空\"}";
return result;
}
if (isEmpty(password)) {
result = "{\"result\":false,\"msg\":\"密码不能为空\"}";
return result;
}
BasicDBObject puUserDb = new BasicDBObject();
puUserDb.put("usercode", usercode);
puUserDb.put("productid", productid);
publicTemplate.installTable(PUB_USER_T_NAME);
long countPubUser = publicTemplate.count(puUserDb);
if (countPubUser > 0) {
result = "{\"result\":false,\"msg\":\"用户名" + usercode
+ "已存在\"}";
return result;
}
// imgCaptchaKey不为空需要验证图片验证码
if (!isEmpty(imgCaptchaKey)) {
BasicDBObject consCaptcha = new BasicDBObject();
consCaptcha.put("keyword", imgCaptchaKey);
consCaptcha.put("productid", productid);
publicTemplate.installTable(PUB_CAPTCHA_T_NAME);
DBObject captchaObj = publicTemplate.findOne(consCaptcha);
if (captchaObj == null) {
result = "{\"result\":false,\"msg\":\"图片验证码不存在\"}";
return result;
} else {
BasicDBObject basicCaptcha = (BasicDBObject) captchaObj;
if (basicCaptcha.isEmpty()) {
result = "{\"result\":false,\"msg\":\"图片验证码不存在\"}";
return result;
} else {
String preCaptcha = basicCaptcha
.getString("captcha");
if (!preCaptcha.equals(imgCaptcha)) {
result = "{\"result\":false,\"msg\":\"图片验证码不正确\"}";
return result;
}
}
}
}
// userName不为空,同时usernameUnique为true时需要判断userName是否已存在
publicTemplate.installTable(PUB_USER_T_NAME);
if (!isEmpty(userName) && usernameUnique) {
BasicDBObject conPubUser = new BasicDBObject();
conPubUser.put("user_name", userName);
conPubUser.put("productid", productid);
long countUser = publicTemplate.count(conPubUser);
if (countUser > 0) {
result = "{\"result\":false,\"msg\":\"用户昵称" + userName
+ "已存在\"}";
return result;
}
}
if (!isEmpty(email)) {
if (!validateEmail(email)) {
result = "{\"result\":false,\"msg\":\"email格式不正确\"}";
return result;
}
BasicDBObject conPubUser = new BasicDBObject();
conPubUser.put("email", email);
conPubUser.put("productid", productid);
long countUser = publicTemplate.count(conPubUser);
if (countUser > 0) {
result = "{\"result\":false,\"msg\":\"email:" + email
+ "已注册\"}";
return result;
}
}
if (!isEmpty(phone)) {
BasicDBObject conPubUser = new BasicDBObject();
conPubUser.put("phone", phone);
conPubUser.put("productid", productid);
long countUser = publicTemplate.count(conPubUser);
if (countUser > 0) {
result = "{\"result\":false,\"msg\":\"手机号码:" + phone
+ "已注册\"}";
return result;
}
}
// 注册
BasicDBObject newdbo = new BasicDBObject();
newdbo.put("_id", UUID.randomUUID().toString());
newdbo.put("usercode", usercode);
newdbo.put("user_name", userName);
newdbo.put("name_spell", null);
newdbo.put("is_disabled", false);
newdbo.put("create_time", format.parse(formatdate).getTime());
newdbo.put("productid", productid);
newdbo.put("email", email);
newdbo.put("phone", phone);
newdbo.put("password", MD5Util.encode(usercode + password)
.toLowerCase());
newdbo.put("phone_verified", false);
newdbo.put("email_verified", false);
publicTemplate.insert(newdbo);
String state = "1";
String auditstatus ="0";
if (msgNode.getString("state" )== null || msgNode.getString("state" ).equals("") || msgNode.getString("state" ).equals("0")) {
state = "0";
auditstatus="1";
}
BasicDBObject pubUserCheckObj = new BasicDBObject();
pubUserCheckObj.put("_id", UUID.randomUUID().toString());
pubUserCheckObj.put("productid", productid);
pubUserCheckObj.put("usercode",usercode);
pubUserCheckObj.put("state", state);
pubUserCheckObj.put("auditstatus", auditstatus);
publicTemplate.installTable("pub_user_check");
publicTemplate.insert(pubUserCheckObj);
publicTemplate.commit();
newdbo.remove("password");
result = "{\"result\":true,\"msg\":\"注册成功\",\"reginfo\":"+newdbo+"}";
} else if ("email".equals(regType)) {
boolean isUserCode = true;
if (isEmpty(email)) {
result = "{\"result\":false,\"msg\":\"email不能为空\"}";
return result;
}
if (isEmpty(password)) {
result = "{\"result\":false,\"msg\":\"密码不能为空\"}";
return result;
}
if (!isEmpty(usercode)) {
isUserCode = false;
BasicDBObject puUserDb = new BasicDBObject();
puUserDb.put("usercode", usercode);
puUserDb.put("productid", productid);
publicTemplate.installTable(PUB_USER_T_NAME);
long countPubUser = publicTemplate.count(puUserDb);
if (countPubUser > 0) {
result = "{\"result\":false,\"msg\":\"用户名" + usercode
+ "已存在\"}";
return result;
}
}
if (!isEmpty(imgCaptchaKey)) {
BasicDBObject consCaptcha = new BasicDBObject();
consCaptcha.put("keyword", imgCaptchaKey);
consCaptcha.put("productid", productid);
publicTemplate.installTable(PUB_CAPTCHA_T_NAME);
DBObject captchaObj = publicTemplate.findOne(consCaptcha);
if (captchaObj == null) {
result = "{\"result\":false,\"msg\":\"图片验证码不存在\"}";
return result;
} else {
BasicDBObject basicCaptcha = (BasicDBObject) captchaObj;
if (basicCaptcha.isEmpty()) {
result = "{\"result\":false,\"msg\":\"图片验证码不存在\"}";
return result;
} else {
String preCaptcha = basicCaptcha
.getString("captcha");
if (!preCaptcha.equals(imgCaptcha)) {
result = "{\"result\":false,\"msg\":\"图片验证码不正确\"}";
return result;
}
}
}
}
publicTemplate.installTable(PUB_USER_T_NAME);
if (!isEmpty(userName) && usernameUnique) {
BasicDBObject conPubUser = new BasicDBObject();
conPubUser.put("user_name", userName);
conPubUser.put("productid", productid);
long countUser = publicTemplate.count(conPubUser);
if (countUser > 0) {
result = "{\"result\":false,\"msg\":\"用户昵称" + userName
+ "已存在\"}";
return result;
}
}
if (!isEmpty(email)) {
if (!validateEmail(email)) {
result = "{\"result\":false,\"msg\":\"email格式不正确\"}";
return result;
}
BasicDBObject conPubUser = new BasicDBObject();
conPubUser.put("email", email);
conPubUser.put("productid", productid);
long countUser = publicTemplate.count(conPubUser);
if (countUser > 0) {
result = "{\"result\":false,\"msg\":\"email:" + email
+ "已注册\"}";
return result;
}
}
if (!isEmpty(phone)) {
BasicDBObject conPubUser = new BasicDBObject();
conPubUser.put("phone", phone);
conPubUser.put("productid", productid);
long countUser = publicTemplate.count(conPubUser);
if (countUser > 0) {
result = "{\"result\":false,\"msg\":\"手机号码:" + phone
+ "已注册\"}";
return result;
}
}
boolean verifiedEmail = false;
if (!isEmpty(captcha)) {
BasicDBObject consCaptcha = new BasicDBObject();
consCaptcha.put("keyword", email);
consCaptcha.put("productid", productid);
publicTemplate.installTable(PUB_CAPTCHA_T_NAME);
DBObject captchaObj = publicTemplate.findOne(consCaptcha);
if (captchaObj == null) {
result = "{\"result\":false,\"msg\":\"邮箱验证码不存在\"}";
return result;
} else {
BasicDBObject basicCaptcha = (BasicDBObject) captchaObj;
if (basicCaptcha.isEmpty()) {
result = "{\"result\":false,\"msg\":\"邮箱验证码不存在\"}";
return result;
} else {
String preCaptcha = basicCaptcha
.getString("captcha");
if (!preCaptcha.equals(captcha)) {
result = "{\"result\":false,\"msg\":\"邮箱验证码不正确\"}";
return result;
} else {
verifiedEmail = true;
}
}
}
}
if (isUserCode) {
usercode = UUID.randomUUID().toString();
}
// 注册
BasicDBObject newdbo = new BasicDBObject();
newdbo.put("_id", UUID.randomUUID().toString());
newdbo.put("usercode", usercode);
newdbo.put("user_name", userName);
newdbo.put("name_spell", null);
newdbo.put("is_disabled", false);
newdbo.put("create_time", format.parse(formatdate).getTime());
newdbo.put("productid", productid);
newdbo.put("email", email);
newdbo.put("phone", phone);
newdbo.put("password", MD5Util.encode(usercode + password)
.toLowerCase());
newdbo.put("email_verified", verifiedEmail);
newdbo.put("phone_verified", false);
publicTemplate.installTable(PUB_USER_T_NAME);
publicTemplate.insert(newdbo);
String state = "1";
String auditstatus ="0";
if (msgNode.getString("state" )== null || msgNode.getString("state" ).equals("") || msgNode.getString("state" ).equals("0")) {
state = "0";
auditstatus="1";
}
BasicDBObject pubUserCheckObj = new BasicDBObject();
pubUserCheckObj.put("_id", UUID.randomUUID().toString());
pubUserCheckObj.put("productid", productid);
pubUserCheckObj.put("usercode",usercode);
pubUserCheckObj.put("state", state);
pubUserCheckObj.put("auditstatus", auditstatus);
publicTemplate.installTable("pub_user_check");
publicTemplate.insert(pubUserCheckObj);
publicTemplate.commit();
newdbo.remove("password");
result = "{\"result\":true,\"msg\":\"注册成功\",\"reginfo\":"+newdbo+"}";
} else if ("phone".equals(regType)) {
boolean isUserCode = true;
if (isEmpty(phone)) {
result = "{\"result\":false,\"msg\":\"手机号码不能为空\"}";
return result;
}
if (isEmpty(password)) {
result = "{\"result\":false,\"msg\":\"密码不能为空\"}";
return result;
}
if (!isEmpty(usercode)) {
isUserCode = false;
BasicDBObject puUserDb = new BasicDBObject();
puUserDb.put("usercode", usercode);
puUserDb.put("productid", productid);
publicTemplate.installTable(PUB_USER_T_NAME);
long countPubUser = publicTemplate.count(puUserDb);
if (countPubUser > 0) {
result = "{\"result\":false,\"msg\":\"用户名" + usercode
+ "已存在\"}";
return result;
}
}
if (!isEmpty(imgCaptchaKey)) {
BasicDBObject consCaptcha = new BasicDBObject();
consCaptcha.put("keyword", imgCaptchaKey);
consCaptcha.put("productid", productid);
publicTemplate.installTable(PUB_CAPTCHA_T_NAME);
DBObject captchaObj = publicTemplate.findOne(consCaptcha);
if (captchaObj == null) {
result = "{\"result\":false,\"msg\":\"图片验证码不存在\"}";
return result;
} else {
BasicDBObject basicCaptcha = (BasicDBObject) captchaObj;
if (basicCaptcha.isEmpty()) {
result = "{\"result\":false,\"msg\":\"图片验证码不存在\"}";
return result;
} else {
String preCaptcha = basicCaptcha
.getString("captcha");
if (!preCaptcha.equals(imgCaptcha)) {
result = "{\"result\":false,\"msg\":\"图片验证码不正确\"}";
return result;
}
}
}
}
publicTemplate.installTable(PUB_USER_T_NAME);
if (!isEmpty(userName) && usernameUnique) {
BasicDBObject conPubUser = new BasicDBObject();
conPubUser.put("user_name", userName);
conPubUser.put("productid", productid);
long countUser = publicTemplate.count(conPubUser);
if (countUser > 0) {
result = "{\"result\":false,\"msg\":\"用户昵称" + userName
+ "已存在\"}";
return result;
}
}
if (!isEmpty(email)) {
if (!validateEmail(email)) {
result = "{\"result\":false,\"msg\":\"email格式不正确\"}";
return result;
}
BasicDBObject conPubUser = new BasicDBObject();
conPubUser.put("email", email);
conPubUser.put("productid", productid);
long countUser = publicTemplate.count(conPubUser);
if (countUser > 0) {
result = "{\"result\":false,\"msg\":\"email:" + email
+ "已注册\"}";
return result;
}
}
if (!isEmpty(phone)) {
BasicDBObject conPubUser = new BasicDBObject();
conPubUser.put("phone", phone);
conPubUser.put("productid", productid);
long countUser = publicTemplate.count(conPubUser);
if (countUser > 0) {
result = "{\"result\":false,\"msg\":\"手机号码:" + phone
+ "已注册\"}";
return result;
}
}
boolean verifiedPhone = false;
if (!isEmpty(captcha)) {
BasicDBObject consCaptcha = new BasicDBObject();
consCaptcha.put("keyword", phone);
consCaptcha.put("productid", productid);
publicTemplate.installTable(PUB_CAPTCHA_T_NAME);
DBObject captchaObj = publicTemplate.findOne(consCaptcha);
if (captchaObj == null) {
result = "{\"result\":false,\"msg\":\"手机验证码不存在\"}";
return result;
} else {
BasicDBObject basicCaptcha = (BasicDBObject) captchaObj;
if (basicCaptcha.isEmpty()) {
result = "{\"result\":false,\"msg\":\"手机验证码不存在\"}";
return result;
} else {
String preCaptcha = basicCaptcha
.getString("captcha");
if (!preCaptcha.equals(captcha)) {
result = "{\"result\":false,\"msg\":\"手机验证码不正确\"}";
return result;
} else {
verifiedPhone = true;
}
}
}
}
if (isUserCode) {
usercode = UUID.randomUUID().toString();
}
// 注册
BasicDBObject newdbo = new BasicDBObject();
newdbo.put("_id", UUID.randomUUID().toString());
newdbo.put("usercode", usercode);
newdbo.put("user_name", userName);
newdbo.put("name_spell", null);
newdbo.put("is_disabled", false);
newdbo.put("create_time", format.parse(formatdate).getTime());
newdbo.put("productid", productid);
newdbo.put("email", email);
newdbo.put("phone", phone);
newdbo.put("password", MD5Util.encode(usercode + password)
.toLowerCase());
newdbo.put("phone_verified", verifiedPhone);
newdbo.put("email_verified", false);
publicTemplate.installTable(PUB_USER_T_NAME);
publicTemplate.insert(newdbo);
String state = "1";
String auditstatus ="0";
if (msgNode.getString("state" )== null || msgNode.getString("state" ).equals("") || msgNode.getString("state" ).equals("0")) {
state = "0";
auditstatus="1";
}
BasicDBObject pubUserCheckObj = new BasicDBObject();
pubUserCheckObj.put("_id", UUID.randomUUID().toString());
pubUserCheckObj.put("productid", productid);
pubUserCheckObj.put("usercode",usercode);
pubUserCheckObj.put("state", state);
pubUserCheckObj.put("auditstatus", auditstatus);
publicTemplate.installTable("pub_user_check");
publicTemplate.insert(pubUserCheckObj);
publicTemplate.commit();
newdbo.remove("password");
result = "{\"result\":true,\"msg\":\"注册成功\",\"reginfo\":"+newdbo+"}";
} else if ("verifyemail".equals(regType)) {
if (isEmpty(email)) {
result = "{\"result\":false,\"msg\":\"邮箱不能为空\"}";
return result;
}
if (isEmpty(captcha)) {
result = "{\"result\":false,\"msg\":\"邮箱验证码不能为空\"}";
return result;
}
if (!isEmpty(imgCaptchaKey)) {
BasicDBObject consCaptcha = new BasicDBObject();
consCaptcha.put("keyword", imgCaptchaKey);
consCaptcha.put("productid", productid);
publicTemplate.installTable(PUB_CAPTCHA_T_NAME);
DBObject captchaObj = publicTemplate.findOne(consCaptcha);
if (captchaObj == null) {
result = "{\"result\":false,\"msg\":\"图片验证码不存在\"}";
return result;
} else {
BasicDBObject basicCaptcha = (BasicDBObject) captchaObj;
if (basicCaptcha.isEmpty()) {
result = "{\"result\":false,\"msg\":\"图片验证码不存在\"}";
return result;
} else {
String preCaptcha = basicCaptcha
.getString("captcha");
if (!preCaptcha.equals(imgCaptcha)) {
result = "{\"result\":false,\"msg\":\"图片验证码不正确\"}";
return result;
}
}
}
}
boolean verifiedEmail = false;
if (!isEmpty(captcha)) {
BasicDBObject consCaptcha = new BasicDBObject();
consCaptcha.put("keyword", email);
consCaptcha.put("productid", productid);
publicTemplate.installTable(PUB_CAPTCHA_T_NAME);
DBObject captchaObj = publicTemplate.findOne(consCaptcha);
if (captchaObj == null) {
result = "{\"result\":false,\"msg\":\"邮箱验证码不存在\"}";
return result;
} else {
BasicDBObject basicCaptcha = (BasicDBObject) captchaObj;
if (basicCaptcha.isEmpty()) {
result = "{\"result\":false,\"msg\":\"邮箱验证码不存在\"}";
return result;
} else {
String preCaptcha = basicCaptcha
.getString("captcha");
if (!preCaptcha.equals(captcha)) {
result = "{\"result\":false,\"msg\":\"邮箱验证码不正确\"}";
return result;
} else {
verifiedEmail = true;
}
}
}
}
BasicDBObject puUserDb = new BasicDBObject();
puUserDb.put("email", email);
puUserDb.put("productid", productid);
publicTemplate.installTable(PUB_USER_T_NAME);
DBObject dbpubuser = publicTemplate.findOne(puUserDb);
if (dbpubuser == null) {
result = "{\"result\":false,\"msg\":\"邮箱不存在\"}";
return result;
} else {
BasicDBObject basicPubUser = (BasicDBObject) dbpubuser;
String _id = basicPubUser.getString("_id");
boolean preEmailVerifed = basicPubUser
.getBoolean("email_verified");
if (basicPubUser.isEmpty()) {
result = "{\"result\":false,\"msg\":\"邮箱不存在\"}";
return result;
} else {
if (preEmailVerifed) {
result = "{\"result\":false,\"msg\":\"邮箱已验证过\"}";
return result;
}
basicPubUser.put("email_verified", verifiedEmail);
publicTemplate.update(new BasicDBObject("_id", _id),
basicPubUser);
publicTemplate.commit();
result = "{\"result\":true,\"msg\":\"邮箱已验证\"}";
}
}
} else if ("verifyphone".equals(regType)) {
if (isEmpty(phone)) {
result = "{\"result\":false,\"msg\":\"手机不能为空\"}";
return result;
}
if (isEmpty(captcha)) {
result = "{\"result\":false,\"msg\":\"手机验证码不能为空\"}";
return result;
}
if (!isEmpty(imgCaptchaKey)) {
BasicDBObject consCaptcha = new BasicDBObject();
consCaptcha.put("keyword", imgCaptchaKey);
consCaptcha.put("productid", productid);
publicTemplate.installTable(PUB_CAPTCHA_T_NAME);
DBObject captchaObj = publicTemplate.findOne(consCaptcha);
if (captchaObj == null) {
result = "{\"result\":false,\"msg\":\"图片验证码不存在\"}";
return result;
} else {
BasicDBObject basicCaptcha = (BasicDBObject) captchaObj;
if (basicCaptcha.isEmpty()) {
result = "{\"result\":false,\"msg\":\"图片验证码不存在\"}";
return result;
} else {
String preCaptcha = basicCaptcha
.getString("captcha");
if (!preCaptcha.equals(imgCaptcha)) {
result = "{\"result\":false,\"msg\":\"图片验证码不正确\"}";
return result;
}
}
}
}
boolean verifiedPhone = false;
if (!isEmpty(captcha)) {
BasicDBObject consCaptcha = new BasicDBObject();
consCaptcha.put("keyword", phone);
consCaptcha.put("productid", productid);
publicTemplate.installTable(PUB_CAPTCHA_T_NAME);
DBObject captchaObj = publicTemplate.findOne(consCaptcha);
if (captchaObj == null) {
result = "{\"result\":false,\"msg\":\"手机验证码不存在\"}";
return result;
} else {
BasicDBObject basicCaptcha = (BasicDBObject) captchaObj;
if (basicCaptcha.isEmpty()) {
result = "{\"result\":false,\"msg\":\"手机验证码不存在\"}";
return result;
} else {
String preCaptcha = basicCaptcha
.getString("captcha");
if (!preCaptcha.equals(captcha)) {
result = "{\"result\":false,\"msg\":\"手机验证码不正确\"}";
return result;
} else {
verifiedPhone = true;
}
}
}
}
BasicDBObject puUserDb = new BasicDBObject();
puUserDb.put("phone", phone);
puUserDb.put("productid", productid);
publicTemplate.installTable(PUB_USER_T_NAME);
DBObject dbpubuser = publicTemplate.findOne(puUserDb);
if (dbpubuser == null) {
result = "{\"result\":false,\"msg\":\"手机号码不存在\"}";
return result;
} else {
BasicDBObject basicPubUser = (BasicDBObject) dbpubuser;
String _id = basicPubUser.getString("_id");
boolean prePhoneVerifed = basicPubUser
.getBoolean("phone_verified");
if (basicPubUser.isEmpty()) {
result = "{\"result\":false,\"msg\":\"手机号码不存在\"}";
return result;
} else {
if (prePhoneVerifed) {
result = "{\"result\":false,\"msg\":\"手机号码已验证过\"}";
return result;
}
basicPubUser.put("phone_verified", verifiedPhone);
publicTemplate.update(new BasicDBObject("_id", _id),
basicPubUser);
publicTemplate.commit();
result = "{\"result\":true,\"msg\":\"手机已验证\"}";
}
}
}
} catch (Exception e) {
publicTemplate.rollback();
LOGGER.error(this.getClass().getName()+".execute()注册失败", e);
throw e;
} finally {
publicTemplate.close();
}
if(LOGGER.isDebugEnabled()){
LOGGER.debug("UserRegisterServiceImpl-result: " + result);
}
return result;
}
// 验证email
private static boolean validateEmail(String email) {
Pattern p = Pattern.compile("\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*");
Matcher m = p.matcher(email);
return m.find();
}
public static boolean isEmpty(String raw) {
return StringUtils.isEmpty(raw);
}
}
| true |
6a90003afc925e2f7e6fc5bdfbbffaa2892525f2 | Java | nnikunj/heap-flow | /heap_flow_reports/heap_flow_reports/src/main/java/com/paranika/erp/heap_flow_reports/common/models/dos/InventoryTypeDO.java | UTF-8 | 1,947 | 2.09375 | 2 | [] | no_license | package com.paranika.erp.heap_flow_reports.common.models.dos;
import java.util.ArrayList;
import java.util.Collection;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import com.fasterxml.jackson.annotation.JsonIgnore;
@Entity
@Table(name = "inventory_types")
public class InventoryTypeDO extends BaseDO {
/**
*
*/
private static final long serialVersionUID = 1L;
@Column(name = "type_name", nullable = false, length = 32)
private String typeName;
@Column(name = "description", nullable = false, length = 256)
private String description;
@Column(name = "is_considered_for_valuation", nullable = false)
private boolean isConsideredForValuation;
@JsonIgnore
@OneToMany(mappedBy = "type")
Collection<InventoryDO> inventories = new ArrayList<InventoryDO>();
@JsonIgnore
@OneToMany(mappedBy = "inventoryType")
Collection<IngressLedgerDO> referringIngressLedger = new ArrayList<IngressLedgerDO>();
public String getTypeName() {
return typeName;
}
public void setTypeName(String typeName) {
this.typeName = typeName;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public boolean isConsideredForValuation() {
return isConsideredForValuation;
}
public void setConsideredForValuation(boolean isConsideredForValuation) {
this.isConsideredForValuation = isConsideredForValuation;
}
public Collection<InventoryDO> getInventories() {
return inventories;
}
public void setInventories(Collection<InventoryDO> inventories) {
this.inventories = inventories;
}
public Collection<IngressLedgerDO> getReferringIngressLedger() {
return referringIngressLedger;
}
public void setReferringIngressLedger(Collection<IngressLedgerDO> referringIngressLedger) {
this.referringIngressLedger = referringIngressLedger;
}
}
| true |
71a338219dc9c690e867644ebaa6aa9318506bc8 | Java | mahendrathapa/Java | /HackerRank/FindDigits.java | UTF-8 | 723 | 3.15625 | 3 | [] | no_license | import java.util.*;
public class FindDigits
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
int t = in.nextInt();
for(int i = 0; i<t; ++i)
{
int result = 0;
int n = in.nextInt();
int z = n;
ArrayList<Integer> al = new ArrayList<Integer>();
while(n>0)
{
al.add(n%10);
n /=10;
}
for(int k: al)
{
if(k == 0)
continue;
if(z%k == 0)
++result;
}
System.out.println(result);
}
}
}
| true |
ffb9441dce3af6c8745444fad41c60ed76d57f1e | Java | afifaniks/eShoppers | /src/main/java/me/afifaniks/shoppingcart/web/CheckoutServlet.java | UTF-8 | 1,739 | 2.328125 | 2 | [] | no_license | /**
* Created by IntelliJ IDEA.
* Author : Afif Al Mamun
* Web : https://afifaniks.me
* Date : 3/28/2021
* Time : 1:05 PM
**/
package me.afifaniks.shoppingcart.web;
import me.afifaniks.shoppingcart.domain.Cart;
import me.afifaniks.shoppingcart.domain.User;
import me.afifaniks.shoppingcart.repository.CartItemRepositoryImpl;
import me.afifaniks.shoppingcart.repository.CartRepositoryImpl;
import me.afifaniks.shoppingcart.repository.ProductRepositoryImpl;
import me.afifaniks.shoppingcart.service.CartService;
import me.afifaniks.shoppingcart.service.CartServiceImpl;
import me.afifaniks.shoppingcart.util.SecurityContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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;
@WebServlet("/checkout")
public class CheckoutServlet extends HttpServlet {
private static final Logger LOGGER = LoggerFactory.getLogger(CheckoutServlet.class);
private CartService cartService = new CartServiceImpl(
new CartRepositoryImpl(),
new ProductRepositoryImpl(),
new CartItemRepositoryImpl()
);
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
LOGGER.info("Serving checkout page");
User currentUser = SecurityContext.getCurrentUser(req);
Cart cart = cartService.getCartByUser(currentUser);
req.setAttribute("cart", cart);
req.getRequestDispatcher("/WEB-INF/checkout.jsp").forward(req, resp);
}
}
| true |
f737975c2c5e976b7c40b924aec83358c68ff5a0 | Java | vkrishnayadlapalli/SafeLiteDemo | /src/main/java/com/safelite/accelerators/EnableReports.java | UTF-8 | 415 | 1.71875 | 2 | [] | no_license | package com.safelite.accelerators;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface EnableReports {
String getTestCaseName() default "";
String getBrowserType() default "";
String getIpAddress() default "";
}
| true |
d25f6189038523783281d0bf45cb1afe6c1edaa1 | Java | jals/JCVSBomb | /src/bomberman/test/ClientThread.java | UTF-8 | 1,365 | 2.9375 | 3 | [] | no_license | package bomberman.test;
import bomberman.client.Client;
/**
* Runs an instance of the client in a separate thread
* Used for testing purposes
*
* @author spbyron
*
*/
public class ClientThread extends Thread {
// Underlying client object, that the thread runs
protected Client client;
private boolean isTesting;
private String player;
/**
* Create a new ClientThread, giving the Client the given name
* @param player
*/
public ClientThread(String player) {
this(player, 9876, true);
}
public ClientThread(String player, int port, boolean gui) {
this(player, "127.0.0.1", port, gui, true);
}
public ClientThread(String player, String host, int port, boolean gui, boolean isTesting) {
this.isTesting = isTesting;
this.player = player;
try {
client = new Client(player, host, port, gui);
} catch (Exception e) {
e.printStackTrace();
}
}
public void run() {
client.startClient(isTesting);
while (client.isRunning()) {
}
}
/**
* Returns the Client object that is being run by the thread
* @return
*/
public Client getClient() {
return client;
}
public void shutdown() {
client.shutDown();
}
public String getLogFile() {
return client.getLogFile();
}
public String toString() {
return player;
}
}
| true |
af7b50b609cb898aef52364bac778535eb1bbc53 | Java | asche910/SuperSpider | /src/com/bean/User.java | UTF-8 | 1,903 | 2.53125 | 3 | [] | no_license | package com.bean;
public class User {
private String user; // *
private String password = "abc123456"; // abc123456
private String name; // *
private String imgAvatar;
private String signature;
private String email;
private int userGroup = 0; // 0
private int money = 100; //100
public User(String user, String password, String name, String imgAvatar, String signature, String email, int userGroup, int money) {
this.user = user;
this.password = password;
this.name = name;
this.imgAvatar = imgAvatar;
this.signature = signature;
this.email = email;
this.userGroup = userGroup;
this.money = money;
}
public User(){}
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getImgAvatar() {
return imgAvatar;
}
public void setImgAvatar(String imgAvatar) {
this.imgAvatar = imgAvatar;
}
public String getSignature() {
return signature;
}
public void setSignature(String signature) {
this.signature = signature;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public int getUserGroup() {
return userGroup;
}
public void setUserGroup(int userGroup) {
this.userGroup = userGroup;
}
public int getMoney() {
return money;
}
public void setMoney(int money) {
this.money = money;
}
}
| true |
e1b702106cfc9ef1fab10b043fcc6df90e500aca | Java | Arslandinho/MagiShine | /Perpenanto 2.0(SpringBoot)/src/main/java/io/vscale/perpenanto/forms/admin/ProfileForm.java | UTF-8 | 564 | 1.570313 | 2 | [] | no_license | package io.vscale.perpenanto.forms.admin;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.Builder;
import lombok.ToString;
import lombok.NoArgsConstructor;
/**
* 29.01.2018
*
* @author Andrey Romanov (steampart@gmail.com)
* @version 1.0
*/
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Builder
@EqualsAndHashCode
@ToString
public class ProfileForm {
private Long id;
private String personName;
private String personSurname;
private String email;
private Long userId;
}
| true |
d91d32df5b0abb22a1ac07d7f88c82f5b4da214b | Java | shimosuk/GoFDesignPatterns | /src/theIteratorPattern/training/Aggregate.java | UTF-8 | 111 | 2.25 | 2 | [] | no_license | package theIteratorPattern.training;
public interface Aggregate {
public abstract Iterator iterator();
}
| true |
79fb1fb8115f380e6ae00ede1cad9a27327040ec | Java | dmedelacruz/sideway-sales-inventory-management | /src/main/java/com/sideway/management/model/Item.java | UTF-8 | 1,278 | 2.203125 | 2 | [] | no_license | package com.sideway.management.model;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
@Table(name = "item")
@Entity
@Data
public class Item extends BaseEntity {
@Column(name = "description")
private String description;
@Column(name = "details")
private String details;
@Column(name = "current_stock", nullable = false)
private Integer currentStock;
@Column(name = "low_stock_threshold", nullable = false)
private Integer lowStockThreshold;
@Transient
private Boolean lowInStock;
@Column(name = "capital", nullable = false)
private Float capital;
@Column(name = "recommended_selling_price", nullable = false)
private Float recommendedSellingPrice;
@ManyToOne
@JoinColumn(name = "category_id")
private Category category;
@ManyToOne
@JoinColumn(name = "type_id")
private Type type;
@ManyToOne
@JoinColumn(name = "brand_id")
private Brand brand;
@ManyToOne
@JoinColumn(name = "model_id")
private Model model;
@ManyToOne
@JoinColumn(name = "supplier_id")
private Supplier supplier;
@Transient
public Boolean isLowInStock() {
return this.currentStock < this.lowStockThreshold;
}
}
| true |
f440ffd0d4090d1b71a33c71d5c7f96d4157b2e7 | Java | buckeyebrown/phase5db | /src/main/java/com/phasefive/backend/SQLConnect.java | UTF-8 | 39,106 | 2.484375 | 2 | [] | no_license | package com.phasefive.backend;
import java.sql.*;
import com.microsoft.sqlserver.jdbc.*;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.FileNotFoundException;
import java.util.Properties;
public class SQLConnect {
public SQLConnect() {
super();
}
public static ResultSet setUpConnection() {
Connection conn = null;
CallableStatement cstmt = null;
ResultSet rs = null;
// Create a variable for the connection string.
String connectionUrl = "jdbc:sqlserver://localhost:1433;" +
"databaseName=insurance;integratedSecurity=true;";
String query = getQuery(ObtainQueryCode.getQueryCode());
//Change this
try {
//Establish the connection
//Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
conn = DriverManager.getConnection(connectionUrl);
//DriverManager.registerDriver(new com.microsoft.sqlserver.jdbc.SQLServerDriver());
//String dbURL = "jdbc:sqlserver://localhost;databaseName=insurance;integratedSecurity=true;";
//Connection conn = DriverManager.getConnection(dbURL);
if (conn != null) {
Statement stat = conn.createStatement();
System.out.println("Connected to SQL server.");
if(!(ObtainQueryCode.getQueryCode() == 7)){
rs = stat.executeQuery(query);
}
else{
stat.executeUpdate(query);
}
System.out.println("Got the result set.");
}
}
catch (SQLException ex) {
ex.printStackTrace();
}
catch (NullPointerException n) {
}
finally
{
return rs;
}
}
private static String getQuery(int queryCode){
String returnString = "";
switch (queryCode){
case 0:
if(!(ObtainQueryCode.getQueryText() == "")){
returnString = ObtainQueryCode.getQueryText();
}
break;
case 1:
returnString = "SELECT fname, lname FROM CLIENT WHERE ssn IN (SELECT client_ssn FROM DEPENDENTS)\n" +
"UNION\n" +
"SELECT fname, lname FROM CLIENT WHERE employee_ssn IN (SELECT emp_ssn FROM EMPLOYEES WHERE lname = 'higgins')";
break;
case 2:
returnString = "SELECT fname, lname FROM CLIENT WHERE ssn IN (SELECT client_ssn FROM DEPENDENTS)\n" +
"INTERSECT\n" +
"SELECT fname, lname FROM CLIENT WHERE employee_ssn IN (SELECT emp_ssn FROM EMPLOYEES WHERE lname = 'higgins')";
break;
case 3:
returnString = "SELECT Account_ID FROM ACCOUNTS\n" +
"EXCEPT\n" +
"(SELECT ssn FROM CLIENT WHERE ssn IN (SELECT client_ssn FROM DEPENDENTS)\n" +
"INTERSECT\n" +
"SELECT employee_ssn FROM CLIENT WHERE employee_ssn IN (SELECT emp_ssn FROM EMPLOYEES WHERE lname = 'higgins'))";
break;
case 4:
returnString = "SELECT vehicle_model FROM VEHICLES WHERE NOT EXISTS (SELECT Report_Number FROM ACCIDENT_HISTORY)";
break;
case 5:
returnString = "SELECT SUM(salary) FROM EMPLOYEES WHERE salary > 40000";
break;
case 6:
returnString = "SELECT * FROM (ACCOUNTS as a INNER JOIN CAR_INSURANCE_POLICY as c ON a.Account_ID = c.accountNumber) INNER JOIN BOAT_INSURANCE_POLICY as b ON b.accountNumber = a.Account_ID\n";
break;
case 7:
returnString = "CREATE TABLE INSURANCE_COMPANY\n" +
"(\n" +
"\tIns_Company_Name varchar(50) not null,\n" +
"\tIns_Company_Address varchar(70) not null,\n" +
"\tWebsite_URL varchar(30),\n" +
"\tPRIMARY KEY(Ins_Company_Name)\n" +
")\n" +
"\n" +
"CREATE TABLE BROKERS\n" +
"(\n" +
"\tCompany_Name varchar(50) not null,\n" +
"\tCompany_Address varchar(70) not null,\n" +
"\tWebsite_URL varchar(30),\n" +
"\tPRIMARY KEY(Company_Name)\n" +
")\n" +
"\n" +
"CREATE TABLE EMPLOYEES\n" +
"(\n" +
"\temp_ssn char(9) UNIQUE not null,\n" +
"\twork_phone varchar(10),\n" +
"\tsalary int,\n" +
"\tfname varchar(30) not null,\n" +
"\tlname varchar(30) not null,\n" +
"\tbroker_company varchar(50),\n" +
"\tPRIMARY KEY(emp_ssn)\n" +
")\n" +
"\n" +
"CREATE TABLE CLIENT\n" +
"(\n" +
"\tfname varchar(30) not null,\n" +
"\tlname varchar(30) not null,\n" +
"\tssn char(9) UNIQUE not null,\n" +
"\tprimary_phone_number varchar(30),\n" +
"\tprimary_email varchar(30),\n" +
"\taddress varchar(70),\n" +
"\tdob datetime,\n" +
"\taccount_number int not null,\n" +
"\temployee_ssn char(9) not null,\n" +
"\tPRIMARY KEY(ssn),\n" +
"\tFOREIGN KEY(employee_ssn)\n" +
"\tREFERENCES EMPLOYEES(emp_ssn)\n" +
")\n" +
"\n" +
"CREATE TABLE DEPENDENTS\n" +
"(\n" +
"\tfname varchar(30) not null,\n" +
"\tlname varchar(30) not null,\n" +
"\tdependent_ssn char(9) UNIQUE not null,\n" +
"\tclient_ssn char(9) not null,\n" +
"\tdob datetime,\n" +
"\tPRIMARY KEY(dependent_ssn),\n" +
"\tFOREIGN KEY(client_ssn)\n" +
"\tREFERENCES CLIENT(ssn)\n" +
")\n" +
"\n" +
"CREATE TABLE LAWYERS\n" +
"(\n" +
"\tfname varchar(30) not null,\n" +
"\tlname varchar(30) not null,\n" +
"\tprimary_email varchar(30),\n" +
"\tprimary_phone varchar(10),\n" +
"\tlawyer_id int not null unique,\n" +
"\tinsurance_Company_Name varchar(50) not null,\n" +
"\tPRIMARY KEY(lawyer_id),\n" +
"\tFOREIGN KEY(insurance_Company_Name)\n" +
"\tREFERENCES INSURANCE_COMPANY(Ins_Company_Name)\n" +
")\n" +
"\n" +
"CREATE TABLE ACCOUNTS\n" +
"(\n" +
"\tAccount_ID int not null unique,\n" +
"\tDate_Created datetime,\n" +
"\tAccount_Age int,\n" +
"\tclient_ssn char(9) not null,\n" +
"\tPRIMARY KEY(Account_ID),\n" +
"\tFOREIGN KEY(client_ssn)\n" +
"\tREFERENCES CLIENT(ssn)\n" +
")\n" +
"\n" +
"CREATE TABLE PAYMENT\n" +
"(\n" +
"\ttransaction_id int not null unique,\n" +
"\tpayment_method varchar(15),\n" +
"\tpayment_date datetime,\n" +
"\tpayment_amount int,\n" +
"\tpaid_off varchar(3),\n" +
"\tbalance int,\n" +
"\taccount_no int not null,\n" +
"\tPRIMARY KEY(transaction_id),\n" +
"\tFOREIGN KEY(account_no)\n" +
"\tREFERENCES Accounts(Account_ID)\n" +
")\n" +
"\n" +
"CREATE TABLE HOME_INSURANCE_POLICY\n" +
"(\n" +
"\tPolicy_Num int not null unique,\n" +
"\tterm_price int,\n" +
"\tterm_length int,\n" +
"\tactive varchar(3),\n" +
"\tstartDate datetime,\n" +
"\tpolicyAge int,\n" +
"\taccountNumber int not null,\n" +
"\tPRIMARY KEY(Policy_Num),\n" +
"\tFOREIGN KEY(accountNumber)\n" +
"\tREFERENCES Accounts(Account_ID)\n" +
")\n" +
"\n" +
"CREATE TABLE CAR_INSURANCE_POLICY\n" +
"(\n" +
"\tPolicy_Num int not null unique,\n" +
"\tterm_price int,\n" +
"\tterm_length int,\n" +
"\tactive varchar(3),\n" +
"\tstartDate datetime,\n" +
"\tpolicyAge int,\n" +
"\taccountNumber int not null,\n" +
"\tPRIMARY KEY(Policy_Num),\n" +
"\tFOREIGN KEY(accountNumber)\n" +
"\tREFERENCES Accounts(Account_ID)\n" +
")\n" +
"\n" +
"CREATE TABLE BOAT_INSURANCE_POLICY\n" +
"(\n" +
"\tPolicy_Num int not null unique,\n" +
"\tterm_price int,\n" +
"\tterm_length int,\n" +
"\tactive varchar(3),\n" +
"\tstartDate datetime,\n" +
"\tpolicyAge int,\n" +
"\taccountNumber int not null,\n" +
"\tPRIMARY KEY(Policy_Num),\n" +
"\tFOREIGN KEY(accountNumber)\n" +
"\tREFERENCES Accounts(Account_ID)\n" +
")\n" +
"\n" +
"CREATE TABLE HOMES\n" +
"(\n" +
"\tHouse_ID int not null unique,\n" +
"\tfloors int,\n" +
"\toccupants int,\n" +
"\tyear_built int,\n" +
"\thouse_age int,\n" +
"\ttotal_cost int,\n" +
"\tliability_deductible int,\n" +
"\tliability_coverage int,\n" +
"\tfire_deductible int,\n" +
"\tfire_coverage int,\n" +
"\tflood_deductible int,\n" +
"\tflood_coverage int,\n" +
"\thome_insurance_policy_num int not null,\n" +
"\tPRIMARY KEY(House_ID),\n" +
"\tFOREIGN KEY(home_insurance_policy_num)\n" +
"\tREFERENCES Home_Insurance_Policy(Policy_Num)\n" +
")\n" +
"\n" +
"CREATE TABLE ACCIDENT_HISTORY\n" +
"(\n" +
"\tReport_Number int not null unique,\n" +
"\tAccident_Data varchar(100),\n" +
"\tAccident_Date datetime,\n" +
"\tPRIMARY KEY(Report_Number)\n" +
")\n" +
"\n" +
"CREATE TABLE VEHICLES\n" +
"(\n" +
"\tVin char(17) not null unique,\n" +
"\tTotal_cost int,\n" +
"\tvehicle_year int,\n" +
"\tvehicle_color varchar(30),\n" +
"\tvehicle_make varchar(30),\n" +
"\tvehicle_model varchar(30),\n" +
"\tvehicle_doors int,\n" +
"\tbodily_injury_deductible int,\n" +
"\tbodily_injury_coverage int,\n" +
"\tcomprehensive_injury_deductible int,\n" +
"\tcomprehensive_injury_coverage int,\n" +
"\tuninsured_motorist_deductible int,\n" +
"\tuninsured_motorist_coverage int,\n" +
"\tcollison_injury_deductible int,\n" +
"\tcollison_injury_coverage int,\n" +
"\taccident_report_number int not null,\n" +
"\tat_fault varchar(3),\n" +
"\tis_totaled varchar(3),\n" +
"\tdamage_cost int,\n" +
"\tvehicles_policy_number int not null,\n" +
"\tPRIMARY KEY(Vin),\n" +
"\tFOREIGN KEY(accident_report_number)\n" +
"\tREFERENCES ACCIDENT_HISTORY(Report_Number),\n" +
"\tFOREIGN KEY(vehicles_policy_number)\n" +
"\tREFERENCES CAR_INSURANCE_POLICY(Policy_Num)\n" +
")\n" +
"\n" +
"CREATE TABLE BOATS\n" +
"(\n" +
"\tHin char(12) not null unique,\n" +
"\tTotal_cost int,\n" +
"\tbodily_injury_deductible int,\n" +
"\tbodily_injury_coverage int,\n" +
"\tcomprehensive_injury_deductible int,\n" +
"\tcomprehensive_injury_coverage int,\n" +
"\tcollison_injury_deductible int,\n" +
"\tcollison_injury_coverage int,\n" +
"\taccident_report_number int not null,\n" +
"\tat_fault varchar(3),\n" +
"\tis_totaled varchar(3),\n" +
"\tdamage_cost int,\n" +
"\tboat_insurance_policy_number int not null,\n" +
"\tPRIMARY KEY(Hin),\n" +
"\tFOREIGN KEY(accident_report_number)\n" +
"\tREFERENCES ACCIDENT_HISTORY(Report_Number),\n" +
"\tFOREIGN KEY(boat_insurance_policy_number)\n" +
"\tREFERENCES BOAT_INSURANCE_POLICY(Policy_Num)\n" +
")\n" +
"\n" +
"CREATE TABLE ACCOUNTS_SOLD\n" +
"(\n" +
"\temp_ssn char(9) not null unique,\n" +
"\taccount_id int not null\n" +
"\tPRIMARY KEY(emp_ssn),\n" +
"\tFOREIGN KEY(account_id)\n" +
"\tREFERENCES ACCOUNTS(Account_ID)\n" +
")\n" +
"\n" +
"CREATE TABLE Policies_Written\n" +
"(\n" +
"\tLawyer_ID int not null unique,\n" +
"\tHome_Ins_Policy_Num int,\n" +
"\tCar_Ins_Policy_Num int,\n" +
"\tBoat_Ins_Policy_Num int,\n" +
"\tPRIMARY KEY(Lawyer_ID),\n" +
"\tFOREIGN KEY(Home_Ins_Policy_Num)\n" +
"\tREFERENCES HOME_INSURANCE_POLICY(Policy_Num),\n" +
"\tFOREIGN KEY(Car_Ins_Policy_Num)\n" +
"\tREFERENCES CAR_INSURANCE_POLICY(Policy_Num),\n" +
"\tFOREIGN KEY(Boat_Ins_Policy_Num)\n" +
"\tREFERENCES BOAT_INSURANCE_POLICY(Policy_Num)\n" +
")\n" +
"\n" +
"CREATE TABLE Companies_Brokers\n" +
"(\n" +
"\tIns_Company_Name varchar(50) not null,\n" +
"\tBroker_Company_Name varchar(50) not null,\n" +
"\tFOREIGN KEY(Ins_Company_Name)\n" +
"\tREFERENCES INSURANCE_COMPANY(Ins_Company_Name),\n" +
"\tFOREIGN KEY(Broker_Company_Name)\n" +
"\tREFERENCES BROKERS(Company_Name)\n" +
")\n" +
"\n" +
"CREATE TABLE Client_Audit\n" +
"(\n" +
"\tclientFName varchar(30) not null,\n" +
"\tclientLName varchar(30) not null,\n" +
"\temp_ssn char(9) not null,\n" +
"\taudit_action varchar(100),\n" +
"\taudit_time datetime\n" +
")\n" +
"\n" +
"CREATE TABLE Past_Clients\n" +
"(\n" +
"\tclientFname varchar(30) not null,\n" +
"\tclientLname varchar(30) not null,\n" +
"\tssn char(9) UNIQUE not null,\n" +
"\tprimary_phone_number int,\n" +
"\tprimary_email varchar(30),\n" +
"\tdate_deleted datetime\n" +
")" + "CREATE INDEX EmpIndex\n" +
"ON EMPLOYEES (lname, fname)\n" +
"\n" +
"CREATE INDEX CliIndex\n" +
"ON CLIENT (lname, fname)\n" +
"\n" +
"CREATE INDEX DepIndex\n" +
"ON DEPENDENTS (fname, lname)\n" +
"\n" +
"CREATE INDEX LawIndex\n" +
"ON LAWYERS (lname, fname)\n" +
"\n" +
"CREATE INDEX PayIndex\n" +
"ON PAYMENT (Payment_date)\n";
break;
case 8:
returnString = "/*\n" +
"* INSURANCE COMPANY INSERTS\n" +
"*/\n" +
"\n" +
"INSERT INTO INSURANCE_COMPANY (Ins_Company_Name, Ins_Company_Address,Website_URL) \n" +
"values ('Humana', '123 Sunshine Street Columbus 43210', 'www.humana.com');\n" +
"\n" +
"INSERT INTO INSURANCE_COMPANY (Ins_Company_Name, Ins_Company_Address,Website_URL) \n" +
"values ('BestInsurance', '321 Happy Street Columbus 43210', 'www.bestinsurance.com');\n" +
"\n" +
"INSERT INTO INSURANCE_COMPANY (Ins_Company_Name, Ins_Company_Address,Website_URL) \n" +
"values ('RightInsurance', '321 Wonderful Avenue Columbus 43210', 'www.rightinsurance.com');\n" +
"\n" +
"/*\n" +
"* INSURANCE BROKER INSERTS\n" +
"*/\n" +
"\n" +
"INSERT INTO BROKERS (Company_Name, Company_Address,Website_URL) \n" +
"values ('Tims brokerage', '123 Doughnut Street Columbus 43210', 'www.timsbrokerage');\n" +
"\n" +
"INSERT INTO BROKERS (Company_Name, Company_Address,Website_URL) \n" +
"values ('best brokers', '123 Cake Street Columbus 43210', 'www.bestbrokers');\n" +
"\n" +
"INSERT INTO BROKERS (Company_Name, Company_Address,Website_URL) \n" +
"values ('Sallys brokerage', '123 Petunia Avenue Columbus 43210', 'www.sallysbrokerage');\n" +
"\n" +
"/*\n" +
"* EMPLOYEE INSERTS\n" +
"*/\n" +
"\n" +
"INSERT INTO EMPLOYEES (emp_ssn, work_phone, salary, fname, lname, broker_company) \n" +
"values ('234332243', '1234567891', '40000', 'hannah', 'higgins', 'Tims brokerage');\n" +
"\n" +
"INSERT INTO EMPLOYEES (emp_ssn, work_phone, salary, fname, lname, broker_company) \n" +
"values ('123343232', '3214567891', '50000', 'samantha', 'jones', 'best brokers');\n" +
"\n" +
"INSERT INTO EMPLOYEES (emp_ssn, work_phone, salary, fname, lname, broker_company) \n" +
"values ('313343232', '3217027891', '90000', 'alexa', 'newman', 'Sallys brokerage');\n" +
"\n" +
"\n" +
"\n" +
"/*\n" +
"* CLIENT INSERTS\n" +
"*/\n" +
"\n" +
"INSERT INTO CLIENT (Fname, Lname, SSN, Primary_Phone_Number, primary_email, Address, DOB, employee_ssn, account_number) \n" +
"values ('Mike', 'Smith', '123111232', 233, 'mike.smith@gmail.com', '101 Mike Smith Way Columbus, OH 43201', '12/17/1970', '234332243', 55);\n" +
"\n" +
"INSERT INTO CLIENT (Fname, Lname, SSN, Primary_Phone_Number, Primary_Email, Address, DOB, employee_ssn, account_number) \n" +
"values ('Jeffrey', 'Brown', '123343232', 33, 'mrperson@gmail.com', '101 hello Way Columbus, OH 43201', '05/07/1971', '234332243', 56);\n" +
"\n" +
"INSERT INTO CLIENT (Fname, Lname, SSN, Primary_Phone_Number, Primary_Email, Address, DOB, employee_ssn, account_number) \n" +
"values ('Adam', 'Morakis', '313343232', 32, 'morakis@gmail.com', '123 Edison Street Columbus, OH 43201', '06/07/1971', '313343232', 57);\n" +
"\n" +
"\n" +
"\n" +
"\n" +
"/*\n" +
"* DEPENDENT INSERTS\n" +
"*/\n" +
"\n" +
"INSERT INTO DEPENDENTS (Fname, Lname, Dependent_SSN, Client_SSN, DOB) \n" +
"values ('Sandy', 'Smith', '123118462', '123111232', '11/18/1970');\n" +
"\n" +
"INSERT INTO DEPENDENTS (Fname, Lname, Dependent_SSN, Client_SSN, DOB) \n" +
"values ('Mark', 'Edison', '953118462', '123111232', '11/18/1980');\n" +
"\n" +
"INSERT INTO DEPENDENTS (Fname, Lname, Dependent_SSN, Client_SSN, DOB) \n" +
"values ('Halle', 'Berry', '531118462', '123343232', '11/14/1990');\n" +
"\n" +
"INSERT INTO DEPENDENTS (Fname, Lname, Dependent_SSN, Client_SSN, DOB) \n" +
"values ('Brad', 'Pitt', '531118952', '123343232', '11/11/1990');\n" +
"\n" +
"\n" +
"\n" +
"/*\n" +
"* LAWYER INSERTS\n" +
"*/\n" +
"\n" +
"INSERT INTO LAWYERS (Fname, Lname, Primary_Email, Primary_Phone, Lawyer_ID, Insurance_Company_Name) \n" +
"values ('Dwane', 'Carter', 'carter@gmail.com', '9195349624', '863563', 'Humana');\n" +
"\n" +
"INSERT INTO LAWYERS (Fname, Lname, Primary_Email, Primary_Phone, Lawyer_ID, Insurance_Company_Name) \n" +
"values ('Aubrey', 'Graham', 'graham@gmail.com', '9193549624', '103563', 'Humana');\n" +
"\n" +
"INSERT INTO LAWYERS (Fname, Lname, Primary_Email, Primary_Phone, Lawyer_ID, Insurance_Company_Name) \n" +
"values ('Michael', 'Jordan', 'jordan@gmail.com', '8621249624', '962563', 'Humana');\n" +
"\n" +
"INSERT INTO LAWYERS (Fname, Lname, Primary_Email, Primary_Phone, Lawyer_ID, Insurance_Company_Name) \n" +
"values ('Nicki', 'Minaj', 'minaj@gmail.com', '4259219224', '123663', 'Humana');\n" +
"\n" +
"\n" +
"/*\n" +
"* ACCOUNTS INSERTS\n" +
"*/\n" +
"\n" +
"INSERT INTO ACCOUNTS (Account_ID, Date_Created, Account_Age, client_ssn) \n" +
"values ('326781', '01/10/1994', '22', '123111232');\n" +
"\n" +
"INSERT INTO ACCOUNTS (Account_ID, Date_Created, Account_Age, client_ssn) \n" +
"values ('221781', '01/10/1995', '21', '123343232');\n" +
"\n" +
"INSERT INTO ACCOUNTS (Account_ID, Date_Created, Account_Age, client_ssn) \n" +
"values ('117815', '02/10/1995', '21', '313343232');\n" +
"\n" +
"/*\n" +
"* PAYMENT INSERTS\n" +
"*/\n" +
"\n" +
"INSERT INTO PAYMENT (Transaction_ID,Payment_Method, Payment_Date, Payment_Amount, Paid_Off, Balance, Account_no) \n" +
"values ('64224', 'Credit', '03/11/2000', '100', 'y', '600', '326781');\n" +
"\n" +
"INSERT INTO PAYMENT (Transaction_ID,Payment_Method, Payment_Date, Payment_Amount, Paid_Off, Balance, Account_no) \n" +
"values ('64225', 'Credit', '03/11/2001', '200', 'y', '800', '326781');\n" +
"\n" +
"INSERT INTO PAYMENT (Transaction_ID,Payment_Method, Payment_Date, Payment_Amount, Paid_Off, Balance, Account_no) \n" +
"values ('64226', 'Credit', '03/11/2002', '300', 'y', '900', '221781');\n" +
"\n" +
"INSERT INTO PAYMENT (Transaction_ID,Payment_Method, Payment_Date, Payment_Amount, Paid_Off, Balance, Account_no) \n" +
"values ('64227', 'Credit', '03/11/2003', '400', 'y', '100', '117815');\n" +
"\n" +
"\n" +
"/*\n" +
"* HOME INSURANCE POLICY INSERTS\n" +
"*/\n" +
"\n" +
"INSERT INTO Home_Insurance_Policy (Policy_Num,Term_Price, Term_Length, Active, startDate, policyAge, accountNumber) \n" +
"values ('1', '1000', '5', 'y', '03/08/2014', '3', '326781');\n" +
"\n" +
"INSERT INTO Home_Insurance_Policy (Policy_Num,Term_Price, Term_Length, Active, startDate, policyAge, accountNumber) \n" +
"values ('2', '5000', '10', 'y', '03/01/2010', '7', '326781');\n" +
"\n" +
"INSERT INTO Home_Insurance_Policy (Policy_Num,Term_Price, Term_Length, Active, startDate, policyAge, accountNumber) \n" +
"values ('3', '6000', '10', 'y', '03/10/2015', '2', '221781')\n" +
"\n" +
"INSERT INTO Home_Insurance_Policy (Policy_Num,Term_Price, Term_Length, Active, startDate, policyAge, accountNumber) \n" +
"values ('4', '3000', '5', 'y', '03/10/2013', '4', '117815')\n" +
"\n" +
"/*\n" +
"* CAR INSURANCE POLICY INSERTS\n" +
"*/\n" +
"\n" +
"INSERT INTO Car_Insurance_Policy (Policy_Num,Term_Price, Term_Length, Active, startDate, policyAge, accountNumber) \n" +
"values ('1', '2000', '5', 'y', '03/08/2014', '3', '117815');\n" +
"\n" +
"INSERT INTO Car_Insurance_Policy (Policy_Num,Term_Price, Term_Length, Active, startDate, policyAge, accountNumber) \n" +
"values ('2', '3000', '10', 'y', '03/01/2010', '7', '117815');\n" +
"\n" +
"INSERT INTO Car_Insurance_Policy (Policy_Num,Term_Price, Term_Length, Active, startDate, policyAge, accountNumber) \n" +
"values ('3', '4000', '10', 'y', '03/10/2015', '2', '221781')\n" +
"\n" +
"INSERT INTO Car_Insurance_Policy (Policy_Num,Term_Price, Term_Length, Active, startDate, policyAge, accountNumber) \n" +
"values ('4', '5000', '5', 'y', '03/10/2013', '4', '326781')\n" +
"\n" +
"\n" +
"/*\n" +
"* Boat INSURANCE POLICY INSERTS\n" +
"*/\n" +
"\n" +
"INSERT INTO Boat_Insurance_Policy (Policy_Num,Term_Price, Term_Length, Active, startDate, policyAge, accountNumber) \n" +
"values ('1', '8000', '5', 'y', '03/08/2014', '3', '221781');\n" +
"\n" +
"INSERT INTO Boat_Insurance_Policy (Policy_Num,Term_Price, Term_Length, Active, startDate, policyAge, accountNumber) \n" +
"values ('2', '7000', '10', 'y', '03/01/2010', '7', '326781');\n" +
"\n" +
"INSERT INTO Boat_Insurance_Policy (Policy_Num,Term_Price, Term_Length, Active, startDate, policyAge, accountNumber) \n" +
"values ('3', '6000', '10', 'y', '03/10/2015', '2', '326781')\n" +
"\n" +
"INSERT INTO Boat_Insurance_Policy (Policy_Num,Term_Price, Term_Length, Active, startDate, policyAge, accountNumber) \n" +
"values ('4', '2000', '5', 'y', '03/10/2013', '4', '117815')\n" +
"\n" +
"\n" +
"/*\n" +
"* HOME INSERTS\n" +
"*/\n" +
"\n" +
"INSERT INTO HOMES(House_ID, floors, occupants, year_built, house_age, total_cost, liability_deductible, liability_coverage, fire_deductible, fire_coverage, flood_deductible, flood_coverage, home_insurance_policy_num)\n" +
"values ('55', '2', '2', '1920', '97', '800000', '10000', '500000', '10000', '500000', '10000', '500000', '1')\n" +
"\n" +
"INSERT INTO HOMES(House_ID, floors, occupants, year_built, house_age, total_cost, liability_deductible, liability_coverage, fire_deductible, fire_coverage, flood_deductible, flood_coverage, home_insurance_policy_num)\n" +
"values ('53', '5', '4', '1960', '57', '300000', '4000', '60000', '3000', '70000', '2000', '20000', '2')\n" +
"\n" +
"INSERT INTO HOMES(House_ID, floors, occupants, year_built, house_age, total_cost, liability_deductible, liability_coverage, fire_deductible, fire_coverage, flood_deductible, flood_coverage, home_insurance_policy_num)\n" +
"values ('50', '5', '3', '1970', '47', '500000', '4000', '60000', '3000', '70000', '2000', '20000', '3')\n" +
"\n" +
"/*\n" +
"* ACCIDENT HISTORY INSERTS\n" +
"*/\n" +
"\n" +
"INSERT INTO ACCIDENT_HISTORY(Report_Number, Accident_Data, Accident_Date)\n" +
"values ('400', 'Owner injured another passenger with her truck.', '12/17/2016')\n" +
"\n" +
"INSERT INTO ACCIDENT_HISTORY(Report_Number, Accident_Data, Accident_Date)\n" +
"values ('402', 'Non injury, owner ran into a flag pole.', '12/18/2016')\n" +
"\n" +
"INSERT INTO ACCIDENT_HISTORY(Report_Number, Accident_Data, Accident_Date)\n" +
"values ('401', 'Non injury, owner got into a fender bender.', '12/31/2016')\n" +
"\n" +
"INSERT INTO ACCIDENT_HISTORY(Report_Number, Accident_Data, Accident_Date)\n" +
"values ('500', 'Crashed into a harbor.', '06/17/2016')\n" +
"\n" +
"INSERT INTO ACCIDENT_HISTORY(Report_Number, Accident_Data, Accident_Date)\n" +
"values ('502', 'DUI boat collision', '07/18/2016')\n" +
"\n" +
"INSERT INTO ACCIDENT_HISTORY(Report_Number, Accident_Data, Accident_Date)\n" +
"values ('501', 'Non injury, owner got into a fender bender with another boat', '08/31/2016')\n" +
"\n" +
"\n" +
"/*\n" +
"* Vehicles\n" +
"*/\n" +
"INSERT INTO VEHICLES(Vin, Total_cost, vehicle_year, vehicle_make, vehicle_model, vehicle_doors, bodily_injury_deductible, bodily_injury_coverage, comprehensive_injury_deductible, comprehensive_injury_coverage, uninsured_motorist_deductible, uninsured_motorist_coverage, collison_injury_deductible, collison_injury_coverage, accident_report_number, at_fault, is_totaled, damage_cost, vehicles_policy_number)\n" +
"values('11111222223333344', '13000', '1994', 'Mazda', 'Mazda6', '4', '10000', '5000000', '600', '30000', '500', '50000', '300', '30000', '400', 'yes', 'yes', '500000', '2')\n" +
"\n" +
"INSERT INTO VEHICLES(Vin, Total_cost, vehicle_year, vehicle_make, vehicle_model, vehicle_doors, bodily_injury_deductible, bodily_injury_coverage, comprehensive_injury_deductible, comprehensive_injury_coverage, uninsured_motorist_deductible, uninsured_motorist_coverage, collison_injury_deductible, collison_injury_coverage, accident_report_number, at_fault, is_totaled, damage_cost, vehicles_policy_number)\n" +
"values('77711222223333344', '13000', '1996', 'Honda', 'Accord', '4', '14000', '1000000', '500', '30000', '501', '50000', '300', '30000', NULL, 'yes', 'yes', '500000', '1')\n" +
"\n" +
"INSERT INTO VEHICLES(Vin, Total_cost, vehicle_year, vehicle_make, vehicle_model, vehicle_doors, bodily_injury_deductible, bodily_injury_coverage, comprehensive_injury_deductible, comprehensive_injury_coverage, uninsured_motorist_deductible, uninsured_motorist_coverage, collison_injury_deductible, collison_injury_coverage, accident_report_number, at_fault, is_totaled, damage_cost, vehicles_policy_number)\n" +
"values('7771122222333DD44', '13000', '1998', 'Honda', 'Civic', '4', '13000', '2000000', '500', '30000', '502', '50000', '300', '30000', '400', 'yes', 'yes', '500000', '3')\n" +
"\n" +
"\n" +
"/*\n" +
"* Boats\n" +
"*/\n" +
"\n" +
"INSERT INTO BOATS(Hin, Total_cost, bodily_injury_deductible, bodily_injury_coverage, collison_injury_deductible, collison_injury_coverage, accident_report_number, at_fault, is_totaled, damage_cost, boat_insurance_policy_number)\n" +
"values('98734453HH22', '500000', '2000', '70000', '100', '300000', '500', 'no', 'no', '0', '2')\n" +
"\n" +
"INSERT INTO BOATS(Hin, Total_cost, bodily_injury_deductible, bodily_injury_coverage, collison_injury_deductible, collison_injury_coverage, accident_report_number, at_fault, is_totaled, damage_cost, boat_insurance_policy_number)\n" +
"values('987FFFF3HH22', '50000', '200', '7000', '100', '300000', '501', 'no', 'no', '0', '4')\n" +
"\n" +
"INSERT INTO BOATS(Hin, Total_cost, bodily_injury_deductible, bodily_injury_coverage, collison_injury_deductible, collison_injury_coverage, accident_report_number, at_fault, is_totaled, damage_cost, boat_insurance_policy_number)\n" +
"values('987QQ453HH22', '230000', '1000', '80000', '500', '300000', '502', 'no', 'no', '0', '3')\n" +
"\n" +
"/*\n" +
"* Accounts Sold\n" +
"*/ \n" +
"\n" +
"INSERT INTO ACCOUNTS_SOLD(emp_ssn, account_id)\n" +
"values('234332243', '326781')\n" +
"\n" +
"INSERT INTO ACCOUNTS_SOLD(emp_ssn, account_id)\n" +
"values('313343232', '221781')\n" +
"\n" +
"INSERT INTO ACCOUNTS_SOLD(emp_ssn, account_id)\n" +
"values('123343232', '326781')\n" +
"\n" +
"/*\n" +
"* Policies Written\n" +
"*/\n" +
"\n" +
"INSERT INTO Policies_Written(Lawyer_ID, Home_Ins_Policy_Num, Car_Ins_Policy_Num, Boat_Ins_Policy_Num)\n" +
"values('863563', NULL, NULL, '2')\n" +
"\n" +
"INSERT INTO Policies_Written(Lawyer_ID, Home_Ins_Policy_Num, Car_Ins_Policy_Num, Boat_Ins_Policy_Num)\n" +
"values('962563', NULL, '3', NULL)\n" +
"\n" +
"INSERT INTO Policies_Written(Lawyer_ID, Home_Ins_Policy_Num, Car_Ins_Policy_Num, Boat_Ins_Policy_Num)\n" +
"values('103563', '1', '1', NULL)\n" +
"\n" +
"/*\n" +
"* Companies_Brokers\n" +
"*/\n" +
"INSERT INTO Companies_Brokers(Ins_Company_Name, Broker_Company_Name)\n" +
"values('Humana', 'best brokers')\n" +
"\n" +
"INSERT INTO Companies_Brokers(Ins_Company_Name, Broker_Company_Name)\n" +
"values('BestInsurance', 'Sallys brokerage')\n" +
"\n" +
"INSERT INTO Companies_Brokers(Ins_Company_Name, Broker_Company_Name)\n" +
"values('RightInsurance', 'Tims brokerage')";
break;
}
return returnString;
}
}
| true |
64a6c1541ae75fb66e775436bf8bc76ff175ce1e | Java | zlk-newman/Travel | /src/com/qst/model/Hotel.java | GB18030 | 1,496 | 2.234375 | 2 | [] | no_license | package com.qst.model;
public class Hotel {
private int Hid;
private String Hname;
private int Hpri; //۸
private String Hdes; //
private String Hguide; //
private String Hreviews; //
private String Hpic; //ͼƬ·
public Hotel() {
}
@Override
public String toString() {
return "Hotel [Hid=" + Hid + ", Hname=" + Hname + ", Hpri=" + Hpri + ", Hdes="
+ Hdes + ", Hguide=" + Hguide + ", Hreviews=" + Hreviews
+ ", Hpic=" + Hpic + "]";
}
public Hotel(int hid, String hname, int hpri, String hdes, String hguide,
String hreviews, String hpic) {
super();
Hid = hid;
Hname = hname;
Hpri = hpri;
Hdes = hdes;
Hguide = hguide;
Hreviews = hreviews;
Hpic = hpic;
}
public int getHid() {
return Hid;
}
public void setHid(int hid) {
Hid = hid;
}
public String getHname() {
return Hname;
}
public void setHname(String hname) {
Hname = hname;
}
public int getHpri() {
return Hpri;
}
public void setHpri(int hpri) {
Hpri = hpri;
}
public String getHdes() {
return Hdes;
}
public void setHdes(String hdes) {
Hdes = hdes;
}
public String getHguide() {
return Hguide;
}
public void setHguide(String hguide) {
Hguide = hguide;
}
public String getHreviews() {
return Hreviews;
}
public void setHreviews(String hreviews) {
Hreviews = hreviews;
}
public String getHpic() {
return Hpic;
}
public void setHpic(String hpic) {
Hpic = hpic;
}
}
| true |
8716102f307cd3e23faef8767434826474cb9b6f | Java | mukesh249/AnokBookAnroid | /app/src/main/java/com/anokbook/Activites/MyWallet.java | UTF-8 | 10,876 | 1.84375 | 2 | [
"Apache-2.0"
] | permissive | package com.anokbook.Activites;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
import com.anokbook.Adapters.WalletHistoryAdapter;
import com.anokbook.Api.RequestCode;
import com.anokbook.Api.WebCompleteTask;
import com.anokbook.Api.WebTask;
import com.anokbook.Api.WebUrls;
import com.anokbook.Common.Constrants;
import com.anokbook.Common.SharedPrefManager;
import com.anokbook.Models.WalletHistoryModel;
import com.anokbook.R;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
import butterknife.BindView;
import butterknife.ButterKnife;
public class MyWallet extends AppCompatActivity implements WebCompleteTask {
@BindView(R.id.recycerview_histroy_wallet)
RecyclerView recyclerview_history_wallet;
ArrayList<WalletHistoryModel> walletHistoryAddArrayList = new ArrayList<>();
ArrayList<WalletHistoryModel> walletHistoryPaidArrayList = new ArrayList<>();
WalletHistoryAdapter walletHistoryAdapter;
@BindView(R.id.wallet_amout_tv)
TextView wallet_amout_tv;
@BindView(R.id.add_money_wallet_tv)
TextView add_money_wallet_tv;
@BindView(R.id.send_money_on_bank_tv)
TextView send_money_on_bank_tv;
@BindView(R.id.profile_edit_toobar)
Toolbar toolbar;
@Override
protected void onCreate(Bundle savedInstanceState) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(getResources().getColor(R.color.gray_50));
}
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my_wallet);
ButterKnife.bind(this, this);
add_money_wallet_tv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(MyWallet.this, AddMoney.class).putExtra("wallet_amount", wallet_amout_tv.getText().toString().trim()));
}
});
send_money_on_bank_tv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(MyWallet.this, SendMonyeOnBank.class));
}
});
recyclerview_history_wallet.setLayoutManager(new LinearLayoutManager(this));
setSupportActionBar(toolbar);
setTitle("My Wallet");
GetWallet();
// AddMoneyHistory();
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
onBackPressed();
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
protected void onStart() {
super.onStart();
GetWallet();
AddMoneyHistory();
}
public void GetWallet() {
try {
JSONObject dataObj = new JSONObject();
dataObj.put("user_id", SharedPrefManager.getUserID(Constrants.UserId));
JSONObject requiredObj = new JSONObject();
requiredObj.put("method", "get_wallet");
requiredObj.put("data", dataObj);
HashMap objectNew = new HashMap();
objectNew.put("request", requiredObj.toString());
Log.d("get_wallet_data", objectNew.toString());
new WebTask(MyWallet.this, WebUrls.BASE_URL, objectNew, MyWallet.this, RequestCode.CODE_Get_Wallet, 5);
} catch (JSONException e) {
e.printStackTrace();
}
}
public void AddMoneyHistory() {
try {
JSONObject dataObj = new JSONObject();
dataObj.put("user_id", SharedPrefManager.getUserID(Constrants.UserId));
JSONObject requiredObj = new JSONObject();
requiredObj.put("method", "get_transaction");
requiredObj.put("data", dataObj);
HashMap objectNew = new HashMap();
objectNew.put("request", requiredObj.toString());
Log.d("get_transaction_data", objectNew.toString());
new WebTask(MyWallet.this, WebUrls.BASE_URL, objectNew, MyWallet.this, RequestCode.CODE_Get_Transaction, 5);
} catch (JSONException e) {
e.printStackTrace();
}
}
private void PaidHistory() {
try {
JSONObject dataObj = new JSONObject();
dataObj.put("user_id", SharedPrefManager.getUserID(Constrants.UserId));
JSONObject requiredObj = new JSONObject();
requiredObj.put("method", "paidbooklist");
requiredObj.put("data", dataObj);
HashMap objectNew = new HashMap();
objectNew.put("request", requiredObj.toString());
Log.d("paidlist_data", objectNew.toString());
new WebTask(MyWallet.this, WebUrls.BASE_URL, objectNew, MyWallet.this, RequestCode.CODE_PaidList, 5);
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void onComplete(String response, int taskcode) {
if (RequestCode.CODE_Get_Wallet == taskcode) {
try {
JSONObject object = new JSONObject(response);
Log.d("get_wallet_success", response);
if (object.optString("status").compareTo("success") == 0) {
JSONArray dataArray = object.optJSONArray("data");
wallet_amout_tv.setText(dataArray.optJSONObject(0).optString("wallet_amount"));
}
} catch (JSONException e) {
e.printStackTrace();
}
}
if (RequestCode.CODE_Get_Transaction == taskcode) {
try {
JSONObject object = new JSONObject(response);
Log.d("get_transaction_success", response);
if (object.optString("status").compareTo("success") == 0) {
JSONArray dataArray = object.optJSONArray("data");
walletHistoryAddArrayList.clear();
walletHistoryPaidArrayList.clear();
for (int i = 0; i < dataArray.length(); i++) {
JSONObject obj = dataArray.optJSONObject(i);
WalletHistoryModel walletHistoryModel = new WalletHistoryModel();
walletHistoryModel.setHistory_id(obj.optString("user_id"));
walletHistoryModel.setHistory_amount(obj.optString("amount"));
walletHistoryModel.setPayment_id(obj.optString("payment_id"));
String dates = obj.optString("created_at");
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss", Locale.ENGLISH);
Date date = dateFormat.parse(dates);
SimpleDateFormat newFormat = new SimpleDateFormat("dd MMM yyyy", Locale.ENGLISH);
SimpleDateFormat newtime = new SimpleDateFormat("hh:mm a", Locale.ENGLISH);
walletHistoryModel.setHistory_date(newFormat.format(date) + "");
walletHistoryModel.setHistroy_time(newtime.format(date) + "");
walletHistoryAddArrayList.add(walletHistoryModel);
}
if (walletHistoryAddArrayList != null && walletHistoryAddArrayList.size() > 0)
PaidHistory();
// walletHistoryAdapter = new WalletHistoryAdapter(walletHistoryModelArrayList,MyWallet.this);
// recyclerview_history_wallet.setAdapter(walletHistoryAdapter);
}
} catch (JSONException e) {
e.printStackTrace();
} catch (ParseException e) {
e.printStackTrace();
}
}
if (RequestCode.CODE_PaidList == taskcode) {
try {
JSONObject object = new JSONObject(response);
Log.d("paidlist_success", response);
if (object.optString("status").compareTo("success") == 0) {
JSONArray dataArray = object.optJSONArray("data");
walletHistoryPaidArrayList.clear();
for (int i = 0; i < dataArray.length(); i++) {
JSONObject obj = dataArray.optJSONObject(i);
WalletHistoryModel walletHistoryModel = new WalletHistoryModel();
walletHistoryModel.setHistory_id(obj.optString("id"));
walletHistoryModel.setHistory_amount(Double.parseDouble(obj.optString("rent")) + Double.parseDouble(obj.optString("service_charge")) + Double.parseDouble(obj.optString("security_charge")) + "");
walletHistoryModel.setPayment_id(obj.optString("payment_id"));
walletHistoryModel.setHistory_title(obj.optString("book_name"));
String dates = obj.optString("created_at");
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss", Locale.ENGLISH);
Date date = dateFormat.parse(dates);
SimpleDateFormat newFormat = new SimpleDateFormat("dd MMM yyyy", Locale.ENGLISH);
SimpleDateFormat newtime = new SimpleDateFormat("hh:mm a", Locale.ENGLISH);
walletHistoryModel.setHistory_date(newFormat.format(date) + "");
walletHistoryModel.setHistroy_time(newtime.format(date) + "");
walletHistoryPaidArrayList.add(walletHistoryModel);
}
walletHistoryAddArrayList.addAll(walletHistoryPaidArrayList);
walletHistoryAdapter = new WalletHistoryAdapter(walletHistoryAddArrayList, MyWallet.this);
recyclerview_history_wallet.setAdapter(walletHistoryAdapter);
}
} catch (JSONException e) {
e.printStackTrace();
} catch (ParseException e) {
e.printStackTrace();
}
}
}
} | true |
e343fa88d2438d8b9cb0471aa839605f103e4cb2 | Java | suryakishore/ecom_store | /app/src/main/java/com/app/ecomstore/boarding/login/model/LoginRequestData.java | UTF-8 | 5,517 | 1.828125 | 2 | [] | no_license | package com.app.ecomstore.boarding.login.model;
import android.os.Parcel;
import android.os.Parcelable;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class LoginRequestData implements Parcelable {
@SerializedName("id")
@Expose
private String id;
@SerializedName("email")
@Expose
private String email;
@SerializedName("countryCode")
@Expose
private String countryCode;
@SerializedName("verifyType")
@Expose
private int verifyType;
@SerializedName("mobile")
@Expose
private String mobile;
@SerializedName("password")
@Expose
private String password;
@SerializedName("ipAddress")
@Expose
private String ipAddress;
@SerializedName("type")
@Expose
private double type;
@SerializedName("latitude")
@Expose
private double latitude;
@SerializedName("longitude")
@Expose
private double longitude;
@SerializedName("city")
@Expose
private String city;
@SerializedName("country")
@Expose
private String country;
@SerializedName("deviceMake")
@Expose
private String deviceMake;
@SerializedName("deviceOsVersion")
@Expose
private String deviceOsVersion;
@SerializedName("deviceId")
@Expose
private String deviceId;
@SerializedName("appVersion")
@Expose
private String appVersion;
@SerializedName("deviceModel")
@Expose
private String deviceModel;
public LoginRequestData() {
}
protected LoginRequestData(Parcel in) {
id = in.readString();
email = in.readString();
countryCode = in.readString();
verifyType = in.readInt();
mobile = in.readString();
password = in.readString();
ipAddress = in.readString();
type = in.readDouble();
latitude = in.readDouble();
longitude = in.readDouble();
city = in.readString();
country = in.readString();
deviceMake = in.readString();
deviceOsVersion = in.readString();
deviceId = in.readString();
appVersion = in.readString();
deviceModel = in.readString();
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(id);
dest.writeString(email);
dest.writeString(countryCode);
dest.writeInt(verifyType);
dest.writeString(mobile);
dest.writeString(password);
dest.writeString(ipAddress);
dest.writeDouble(type);
dest.writeDouble(latitude);
dest.writeDouble(longitude);
dest.writeString(city);
dest.writeString(country);
dest.writeString(deviceMake);
dest.writeString(deviceOsVersion);
dest.writeString(deviceId);
dest.writeString(appVersion);
dest.writeString(deviceModel);
}
@Override
public int describeContents() {
return 0;
}
public static final Creator<LoginRequestData> CREATOR = new Creator<LoginRequestData>() {
@Override
public LoginRequestData createFromParcel(Parcel in) {
return new LoginRequestData(in);
}
@Override
public LoginRequestData[] newArray(int size) {
return new LoginRequestData[size];
}
};
public int getVerifyType() {
return verifyType;
}
public void setVerifyType(int verifyType) {
this.verifyType = verifyType;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getIpAddress() {
return ipAddress;
}
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
}
public double getType() {
return type;
}
public void setType(double type) {
this.type = type;
}
public double getLatitude() {
return latitude;
}
public void setLatitude(double latitude) {
this.latitude = latitude;
}
public double getLongitude() {
return longitude;
}
public void setLongitude(double longitude) {
this.longitude = longitude;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getDeviceMake() {
return deviceMake;
}
public void setDeviceMake(String deviceMake) {
this.deviceMake = deviceMake;
}
public String getDeviceOsVersion() {
return deviceOsVersion;
}
public void setDeviceOsVersion(String deviceOsVersion) {
this.deviceOsVersion = deviceOsVersion;
}
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getVersion() {
return appVersion;
}
public void setVersion(String appVersion) {
this.appVersion = appVersion;
}
public String getDeviceModel() {
return deviceModel;
}
public void setDeviceModel(String deviceModel) {
this.deviceModel = deviceModel;
}
public String getAppVersion() {
return appVersion;
}
public void setAppVersion(String appVersion) {
this.appVersion = appVersion;
}
public String getCountryCode() {
return countryCode;
}
public void setCountryCode(String countryCode) {
this.countryCode = countryCode;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
}
| true |
a39a009112b365d1ace9b9435cc80560d11f909f | Java | AymenChla/spring-boot-spring-security-config | /src/main/java/entities/Reservation.java | UTF-8 | 2,210 | 2.21875 | 2 | [] | no_license |
package entities;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
@Entity
@Table(name="RESERVATIONS")
public class Reservation{
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Long idReservation;
private Date dateDebutSejour;
private Date dateFinSejour;
private Boolean payer;
@ManyToOne
@JoinColumn(name="ID_CLIENT")
private Client client;
@ManyToOne
@JoinColumn(name="ID_RESIDENT")
private Resident resident;
@ManyToOne
@JoinColumn(name="ID_CHAMBRE")
private Chambre chambre;
public Reservation() {
}
public Reservation(Date date_debut_sejour, Date date_fin_sejour, Boolean payer) {
this.dateDebutSejour = date_debut_sejour;
this.dateFinSejour = date_fin_sejour;
this.payer = payer;
}
public Long getIdReservation() {
return idReservation;
}
public void setIdReservation(Long code_reservation) {
this.idReservation = code_reservation;
}
public Date getDateDebutSejour() {
return dateDebutSejour;
}
public void setDateDebutSejour(Date date_debut_sejour) {
this.dateDebutSejour = date_debut_sejour;
}
public Date getDateFinSejour() {
return dateFinSejour;
}
public void setDateFinSejour(Date date_fin_sejour) {
this.dateFinSejour = date_fin_sejour;
}
public Boolean getPayer() {
return payer;
}
public void setPayer(Boolean payer) {
this.payer = payer;
}
public Client getClient() {
return client;
}
public void setClient(Client client) {
this.client = client;
}
public Resident getResident() {
return resident;
}
public void setResident(Resident resident) {
this.resident = resident;
}
public Chambre getChambre() {
return chambre;
}
public void setChambre(Chambre chambre) {
this.chambre = chambre;
}
}
| true |
b70632b157ecb32be4afce2d41e71771b10537f2 | Java | ghostardy/DDHomeKits | /AuthCenter/src/main/java/family/dd/DDHomeKits/AuthCenter/infrastructure/util/CommonUtil.java | UTF-8 | 284 | 2.109375 | 2 | [] | no_license | package family.dd.DDHomeKits.AuthCenter.infrastructure.util;
public class CommonUtil {
public static boolean isNull(Object o){
return null == o;
}
public static boolean isEmptyString(String str) {
return null==str||str.isEmpty()||str.equals("");
}
}
| true |
52b14b1e9a3df09eef303849b5905b7d0f937a58 | Java | NickImpact/GTS-Pixelmon-Extension | /generations/src/main/java/net/impactdev/gts/generations/entry/GenerationsEntry.java | UTF-8 | 14,281 | 1.507813 | 2 | [] | no_license | package net.impactdev.gts.generations.entry;
import com.google.common.collect.Lists;
import com.pixelmongenerations.api.pokemon.specs.UntradeableSpec;
import com.pixelmongenerations.common.battle.BattleRegistry;
import com.pixelmongenerations.common.entity.pixelmon.EntityPixelmon;
import com.pixelmongenerations.common.item.ItemPixelmonSprite;
import com.pixelmongenerations.core.config.PixelmonEntityList;
import com.pixelmongenerations.core.config.PixelmonItems;
import com.pixelmongenerations.core.enums.EnumSpecies;
import com.pixelmongenerations.core.storage.NbtKeys;
import com.pixelmongenerations.core.storage.PixelmonStorage;
import com.pixelmongenerations.core.storage.PlayerStorage;
import net.impactdev.gts.api.blacklist.Blacklist;
import net.impactdev.gts.api.data.registry.GTSKeyMarker;
import net.impactdev.gts.api.listings.Listing;
import net.impactdev.gts.api.listings.makeup.Display;
import net.impactdev.gts.api.listings.prices.PriceControlled;
import net.impactdev.gts.api.util.TriFunction;
import net.impactdev.gts.common.config.ConfigKeys;
import net.impactdev.gts.common.config.MsgConfigKeys;
import net.impactdev.gts.common.plugin.GTSPlugin;
import net.impactdev.gts.generations.GTSSpongeGenerationsPlugin;
import net.impactdev.gts.generations.config.GenerationsConfigKeys;
import net.impactdev.gts.generations.config.GenerationsLangConfigKeys;
import net.impactdev.gts.generations.config.mappings.GenerationsPriceControls;
import net.impactdev.gts.generations.converter.JObjectConverter;
import net.impactdev.gts.generations.entry.description.ContextualDetails;
import net.impactdev.gts.generations.flags.GenerationsSpecFlags;
import net.impactdev.gts.sponge.listings.makeup.SpongeDisplay;
import net.impactdev.gts.sponge.listings.makeup.SpongeEntry;
import net.impactdev.impactor.api.Impactor;
import net.impactdev.impactor.api.configuration.Config;
import net.impactdev.impactor.api.configuration.ConfigKey;
import net.impactdev.impactor.api.json.factory.JObject;
import net.impactdev.impactor.api.services.text.MessageService;
import net.impactdev.pixelmonbridge.details.SpecKeys;
import net.impactdev.pixelmonbridge.generations.GenerationsPokemon;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.data.key.Keys;
import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.item.inventory.ItemStack;
import org.spongepowered.api.text.Text;
import java.util.Calendar;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
import java.util.stream.Collectors;
/**
* Represents a pokemon compatible with Generations.
*
* NOTE: The "reforged-pokemon" tag is intentional here. This is a legacy flag for helping data conversion
* on data that was tagged in a manner that caused cross-conversion to be much more complicated. New versions
* don't have this issue, but the tag remains as a fallback for any possible old datasets.
*/
@GTSKeyMarker({"pokemon", "reforged-pokemon"})
public class GenerationsEntry extends SpongeEntry<GenerationsPokemon> implements PriceControlled {
private GenerationsPokemon pokemon;
private transient Display<ItemStack> display;
public GenerationsEntry(GenerationsPokemon pokemon) {
this.pokemon = pokemon;
}
@Override
public GenerationsPokemon getOrCreateElement() {
return this.pokemon;
}
@Override
public TextComponent getName() {
return Component.text(this.pokemon.getOrCreate().getSpecies().getPokemonName());
}
@Override
public TextComponent getDescription() {
return this.getName();
}
@Override
public Display<ItemStack> getDisplay(UUID viewer) {
if(this.display == null) {
final MessageService<Text> service = Impactor.getInstance().getRegistry().get(MessageService.class);
List<Text> lore = Lists.newArrayList();
lore.addAll(service.parse(GTSSpongeGenerationsPlugin.getInstance().getMsgConfig().get(GenerationsLangConfigKeys.POKEMON_DETAILS), Lists.newArrayList(() -> this.pokemon)));
lore.addAll(ContextualDetails.receive(this.getOrCreateElement().getOrCreate()));
ItemStack rep = ItemStack.builder()
.from(getPicture(this.pokemon.getOrCreate()))
.add(Keys.DISPLAY_NAME, service.parse(GTSSpongeGenerationsPlugin.getInstance().getMsgConfig()
.get(GenerationsLangConfigKeys.POKEMON_TITLE), Lists.newArrayList(() -> this.pokemon))
)
.add(Keys.ITEM_LORE, lore)
.build();
this.display = new SpongeDisplay(rep);
}
return this.display;
}
@Override
public boolean give(UUID receiver) {
if(Sponge.getServer().getPlayer(receiver).isPresent()) {
PixelmonStorage.pokeBallManager.getPlayerStorageFromUUID(receiver).get().addToParty(this.pokemon.getOrCreate());
return true;
}
return false;
}
@Override
public boolean take(UUID depositor) {
Optional<Player> user = Sponge.getServer().getPlayer(depositor);
Config mainLang = GTSPlugin.getInstance().getMsgConfig();
Config gensLang = GTSSpongeGenerationsPlugin.getInstance().getMsgConfig();
MessageService<Text> parser = Impactor.getInstance().getRegistry().get(MessageService.class);
PlayerStorage party = PixelmonStorage.pokeBallManager.getPlayerStorageFromUUID(depositor).get();
if(BattleRegistry.getBattle(party.getPlayer()) != null) {
user.ifPresent(player -> player.sendMessages(parser.parse(gensLang.get(GenerationsLangConfigKeys.ERROR_IN_BATTLE))));
return false;
}
boolean blacklisted = Impactor.getInstance().getRegistry()
.get(Blacklist.class)
.isBlacklisted(EnumSpecies.class, this.pokemon.getOrCreate().getSpecies().name);
if(blacklisted) {
user.ifPresent(player -> player.sendMessages(parser.parse(mainLang.get(MsgConfigKeys.GENERAL_FEEDBACK_BLACKLISTED))));
return false;
}
if(GenerationsSpecFlags.UNTRADABLE.matches(this.getOrCreateElement().getOrCreate())) {
user.ifPresent(player -> player.sendMessages(parser.parse(gensLang.get(GenerationsLangConfigKeys.ERROR_UNTRADEABLE))));
return false;
}
// Check party size. Ensure we aren't less than 1 because who knows whether Reforged or another plugin
// will break something
if(party.getTeam().size() <= 1 && !this.pokemon.getOrCreate().isEgg) {
user.ifPresent(player -> player.sendMessages(parser.parse(gensLang.get(GenerationsLangConfigKeys.ERROR_LAST_ABLE_MEMBER))));
return false;
}
party.recallAllPokemon();
party.removeFromPartyPlayer(party.getPosition(this.pokemon.getOrCreate().getPokemonId()));
return true;
}
@Override
public Optional<String> getThumbnailURL() {
StringBuilder url = new StringBuilder("https://projectpokemon.org/images/");
if(this.pokemon.get(SpecKeys.SHINY).orElse(false)) {
url.append("shiny");
} else {
url.append("normal");
}
url.append("-sprite/");
url.append(this.pokemon.getOrCreate().getSpecies().name.toLowerCase());
url.append(".gif");
return Optional.of(url.toString());
}
@Override
public List<String> getDetails() {
MessageService<Text> parser = Impactor.getInstance().getRegistry().get(MessageService.class);
Config reforgedLang = GTSSpongeGenerationsPlugin.getInstance().getMsgConfig();
return parser.parse(reforgedLang.get(GenerationsLangConfigKeys.DISCORD_DETAILS), Lists.newArrayList(this::getOrCreateElement))
.stream()
.map(Text::toPlain)
.collect(Collectors.toList());
}
@Override
public int getVersion() {
return 1;
}
@Override
public JObject serialize() {
// Since the custom serializer for the Cross Pixelmon Library uses it's own version of
// JObject, as to not rely on Impactor, we need to convert between the two objects
return new JObject()
.add("pokemon", JObjectConverter.convert(GTSSpongeGenerationsPlugin.getInstance()
.getManager()
.getInternalManager()
.serialize(this.pokemon)
))
.add("version", this.getVersion());
}
@Override
public double getMin() {
Optional<GenerationsPriceControls.Control> control = GTSSpongeGenerationsPlugin.getInstance().getConfiguration()
.get(GenerationsConfigKeys.PRICE_CONTROLS)
.get(this.getOrCreateElement().getOrCreate().getSpecies());
double calculated = control.map(GenerationsPriceControls.Control::getMin)
.orElseGet(() -> {
if(GTSSpongeGenerationsPlugin.getInstance().getConfiguration().get(GenerationsConfigKeys.MIN_PRICING_USE_CUSTOM_BASE)) {
return GTSSpongeGenerationsPlugin.getInstance().getConfiguration().get(GenerationsConfigKeys.MIN_PRICING_CUSTOM_BASE);
}
return 0.0;
});
for(MinimumPriceCalculator calculator : MinimumPriceCalculator.values()) {
calculated = calculator.calculate(this.getOrCreateElement().getOrCreate(), calculated);
}
return Math.max(1, Math.max(
GTSPlugin.getInstance().getConfiguration().get(ConfigKeys.LISTINGS_MIN_PRICE),
calculated
));
}
@Override
public double getMax() {
Optional<GenerationsPriceControls.Control> control = GTSSpongeGenerationsPlugin.getInstance().getConfiguration()
.get(GenerationsConfigKeys.PRICE_CONTROLS)
.get(this.getOrCreateElement().getOrCreate().getSpecies());
return Math.max(1, Math.min(
GTSPlugin.getInstance().getConfiguration().get(ConfigKeys.LISTINGS_MAX_PRICE),
control.map(GenerationsPriceControls.Control::getMax).orElse(Double.MAX_VALUE)
));
}
public static ItemStack getPicture(EntityPixelmon pokemon) {
Calendar calendar = Calendar.getInstance();
boolean aprilFools = (calendar.get(Calendar.MONTH) == Calendar.APRIL || calendar.get(Calendar.MONTH) == Calendar.JULY)
&& calendar.get(Calendar.DAY_OF_MONTH) == 1;
if(pokemon.isEgg) {
net.minecraft.item.ItemStack item = new net.minecraft.item.ItemStack(PixelmonItems.itemPixelmonSprite);
NBTTagCompound nbt = new NBTTagCompound();
switch (pokemon.getSpecies()) {
case Manaphy:
case Togepi:
nbt.setString(NbtKeys.SPRITE_NAME,
String.format("pixelmon:sprites/eggs/%s1", pokemon.getSpecies().name.toLowerCase()));
break;
default:
nbt.setString(NbtKeys.SPRITE_NAME, "pixelmon:sprites/eggs/egg1");
break;
}
item.setTagCompound(nbt);
return (ItemStack) (Object) item;
} else {
World world = (World) (Object) Sponge.getServer().getWorlds().iterator().next();
return (ItemStack) (Object) (aprilFools ? ItemPixelmonSprite.getPhoto((EntityPixelmon) PixelmonEntityList.createEntityByName(EnumSpecies.Bidoof.name, world)) : ItemPixelmonSprite.getPhoto(pokemon));
}
}
private enum MinimumPriceCalculator {
LEGENDARY(GenerationsConfigKeys.MIN_PRICING_LEGEND_ENABLED, GenerationsConfigKeys.MIN_PRICING_LEGEND_PRICE, (pokemon, key, current) -> {
if(EnumSpecies.legendaries.contains(pokemon.getSpecies().getPokemonName())) {
return GTSSpongeGenerationsPlugin.getInstance().getConfiguration().get(key) + current;
}
return current;
}),
SHINY(GenerationsConfigKeys.MIN_PRICING_SHINY_ENABLED, GenerationsConfigKeys.MIN_PRICING_SHINY_PRICE, (pokemon, key, current) -> {
if(pokemon.isShiny()) {
return GTSSpongeGenerationsPlugin.getInstance().getConfiguration().get(key) + current;
}
return current;
}),
HIDDEN_ABILITY(GenerationsConfigKeys.MIN_PRICING_HA_ENABLED, GenerationsConfigKeys.MIN_PRICING_HA_PRICE, (pokemon, key, current) -> {
if(pokemon.getAbilitySlot() == 2) {
return GTSSpongeGenerationsPlugin.getInstance().getConfiguration().get(key) + current;
}
return current;
}),
IV(GenerationsConfigKeys.MIN_PRICING_IVS_ENABLED, GenerationsConfigKeys.MIN_PRICING_IVS_PRICE, (pokemon, key, current) -> {
int required = GTSSpongeGenerationsPlugin.getInstance().getConfiguration().get(GenerationsConfigKeys.MIN_PRICING_IVS_REQUIRE);
for(int iv : pokemon.stats.IVs.getArray()) {
if(iv >= required) {
current += GTSSpongeGenerationsPlugin.getInstance().getConfiguration().get(key);
}
}
return current;
}),;
private final ConfigKey<Boolean> enableKey;
private final ConfigKey<Double> priceKey;
private final TriFunction<EntityPixelmon, ConfigKey<Double>, Double, Double> priceApplier;
MinimumPriceCalculator(ConfigKey<Boolean> enableKey, ConfigKey<Double> priceKey, TriFunction<EntityPixelmon, ConfigKey<Double>, Double, Double> priceApplier) {
this.enableKey = enableKey;
this.priceKey = priceKey;
this.priceApplier = priceApplier;
}
public double calculate(EntityPixelmon source, double current) {
if(GTSSpongeGenerationsPlugin.getInstance().getConfiguration().get(this.enableKey)) {
return this.priceApplier.apply(source, this.priceKey, current);
}
return current;
}
}
}
| true |
b9f9d30c37fab5d541d7100e602ab773f21d4549 | Java | aikolesnikov/jv-artcode-self | /arch/acb23_1/week_2/Task_2_09.java | UTF-8 | 1,522 | 3.8125 | 4 | [] | no_license | package week_2;
import utilities.Output;
import static utilities.Input.generateIntAr;
import static utilities.Input.inputInt;
/**
* 9) Задать два массива случайными числами от 25 до 75.
* Определить у какого из массивов больше парных елементов.
*/
public class Task_2_09 {
public static void main(String[] args) {
int size = inputInt("Array size?: ");
if (size == 0) {
System.out.println("Size must be > 0 !");
return;
}
int[] ar1 = generateIntAr(size, 25, 75);
int[] ar2 = generateIntAr(size, 25, 75);
Output.printArray("Array1:", ar1);
Output.printArray("Array2:", ar2);
int par1 = 0;
int par2 = 0;
for (int i = 0; i < ar1.length - 1; i++) {
for (int j = i + 1; j < ar1.length; j++) {
if (ar1[j] == ar1[i]) {
par1++;
break;
}
}
}
for (int i = 0; i < ar2.length - 1; i++) {
for (int j = i + 1; j < ar2.length; j++) {
if (ar2[j] == ar2[i]) {
par2++;
break;
}
}
}
System.out.println(par1 > par2 ?
"Array1 has more or equal pairs (" + par1 + ") than Array2 (" + par2 + ")":
"Array2 has more or equal pairs (" + par2 + ") than Array1 (" + par1 + ")");
}
}
| true |
22149617bc4a16eef6562dfb82cd28cb022481e2 | Java | ayukTayui/discovery-assessment | /src/main/java/za/co/discovery_bank/DiscoveryBankApplication.java | UTF-8 | 327 | 1.507813 | 2 | [] | no_license | package za.co.discovery_bank;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DiscoveryBankApplication {
public static void main(String[] args) {
SpringApplication.run(DiscoveryBankApplication.class, args);
}
}
| true |
0b38b6c2c7b1782a77d262a55bc011ec40d40dfa | Java | SinigagliaSteeve/generic-graph-framework | /src/main/java/core/algo/Dijkstra.java | UTF-8 | 1,690 | 3.0625 | 3 | [] | no_license | package core.algo;
import core.IDirectedGraph;
import tool.ArrayTools;
import java.util.Arrays;
/**
* Created by Alexis on 09/02/2017.
*/
public class Dijkstra {
public static void compute(IDirectedGraph G, int firstNode) {
System.out.println("Processing Dijkstra algorithm on " + G.getClass().getSimpleName() + "...");
int[] dist = new int[G.getNbNodes()];
int[] pred = new int[G.getNbNodes()];
boolean[] mark = new boolean[G.getNbNodes()];
Arrays.fill(dist, Integer.MAX_VALUE);
Arrays.fill(mark, false);
Arrays.fill(pred, -1);
dist[firstNode] = 0;
for (int i = 0; i < G.getNbNodes() - 1; i++) {
int node = minDistance(dist, mark);
mark[node] = true;
for (int j = 0; j < G.getNbNodes(); j++) {
if (!mark[j] && G.isArc(node, j) && dist[node] != Integer.MAX_VALUE && dist[node] + G.getWeight(node, j) < dist[j]) {
dist[j] = dist[node] + G.getWeight(node, j);
pred[j] = node;
}
}
}
System.out.print("marked: "); ArrayTools.showArrayInLine(mark);
System.out.print("dist: "); ArrayTools.showArrayInLine(dist);
System.out.print("pred: "); ArrayTools.showArrayInLine(pred);
}
public static int minDistance(int distance[], boolean nodeVisited[]) {
int min = Integer.MAX_VALUE;
int min_index = -1;
for (int n = 0; n < distance.length; n++) {
if (!nodeVisited[n] && distance[n] <= min) {
min = distance[n];
min_index = n;
}
}
return min_index;
}
}
| true |
d3451bdad333b41ebe678df55ce1e68e65e8b089 | Java | RuseHackV2/PlayNPlay | /app/com/ruse/hack/utils/di/DaoModule.java | UTF-8 | 470 | 1.992188 | 2 | [
"Apache-2.0"
] | permissive | package com.ruse.hack.utils.di;
import com.google.inject.AbstractModule;
import com.ruse.hack.dao.BaseDao;
import com.ruse.hack.dao.BaseDaoImpl;
import com.ruse.hack.dao.MovieDao;
import com.ruse.hack.dao.MovieDaoImpl;
/**
* Created by nslavov on 11/6/15.
*/
public class DaoModule extends AbstractModule {
@Override
protected void configure() {
bind(BaseDao.class).to(BaseDaoImpl.class);
bind(MovieDao.class).to(MovieDaoImpl.class);
}
}
| true |
6b1064f78cc90c754e088ce45d0f3fcf0e83c479 | Java | Homeboyzandroid/Marathon | /app/src/main/java/com/beyondzero/loise/marathon/FAQsActivity.java | UTF-8 | 1,989 | 2.203125 | 2 | [] | no_license | package com.beyondzero.loise.marathon;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class FAQsActivity extends AppCompatActivity {
@Override
protected void onCreate (Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_faqs);
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setIcon(R.drawable.fl);
String[] myDataset = {"How to Donate", "How to Register", "Marathon Date", "Marathon venue",};
ArrayAdapter<String> myAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, myDataset);
ListView myList = (ListView) findViewById(R.id.listView);
myList.setAdapter(myAdapter);
myList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
switch (position) {
case 0:
startActivity(new Intent(getApplicationContext(), DonationInfo.class));
break;
case 1:
startActivity(new Intent(getApplicationContext(), RegistrationInfo.class));
break;
case 2:
startActivity(new Intent(getApplicationContext(), MainActivity.class));
break;
/*case 3:
startActivity(new Intent(getApplicationContext(), RoutesActivity.class));
break;*/
}
}
});
}
}
| true |
ba42f355dd9bdbf1eb8bdc355e6af070f069dd00 | Java | PVPN4799/portfolo | /Java/Mult Thread/src/Total.java | UTF-8 | 240 | 2.484375 | 2 | [] | no_license |
public class Total {
private static int total = 0; // count starts at zero
public synchronized void setTotal(int amount)
{
total = total+ amount;
}
public synchronized int getTotal()
{
return total;
}
}
| true |
be240cd10e7130e2fab14707481ed5079d55a59d | Java | AISS-2021-L6-G02/AISS-2021-L6-G02 | /secondProject/ProyectoIntegracion-L6-2/src/main/java/aiss/model/Store.java | UTF-8 | 3,521 | 2.6875 | 3 | [] | no_license | package aiss.model;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.*;
import org.jboss.resteasy.spi.BadRequestException;
public class Store {
private String id;
private String name;
private String location;
private List<StoreGame> games;
private String phone;
//Constructors
public Store() {
super();
}
public Store(String id, String name, String location, List<StoreGame> games, String phone) {
super();
this.id = id;
this.name = name;
this.location = location;
this.games = games;
setPhone(phone);
}
public Store(String name, String location, List<StoreGame> games,
String phone) {
super();
this.name = name;
this.location = location;
this.games = games;
setPhone(phone);
}
//Getters
public String getId() {
return id;
}
public String getName() {
return name;
}
public String getLocation() {
return location;
}
public List<StoreGame> getGames() {
return games;
}
public String getPhone() {
return phone;
}
//Setters
public void setId(String id) {
this.id=id;
}
public void setName(String name) {
this.name = name;
}
public void setLocation(String location) {
this.location = location;
}
public void setGames(List<StoreGame> games) {
if(games != null)
{
games.forEach(g -> { if(g != null) g.setStoreId(this.id); });
}
this.games = games;
}
public void setPhone(String phone) {
//Aplicar regex
String patterns = "^(\\+34|0034|34)?[6789]\\d{8}$";
Pattern regex = Pattern.compile(patterns);
Matcher match = regex.matcher(phone);
if(match.matches()) this.phone = phone;
else throw new BadRequestException("Phone number not suported");
}
//Other methods
public void addGame(StoreGame game) {
if(game != null)
{
game.setStoreId(this.id);
}
if(games==null) games = new ArrayList<StoreGame>();
games.add(game);
}
public void deleteGame(StoreGame game) {
games.remove(game);
}
public Integer getGamesSize() {
return this.games!=null? this.games.size():0;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((games == null) ? 0 : games.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((location == null) ? 0 : location.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((phone == null) ? 0 : phone.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;
Store other = (Store) obj;
if (games == null) {
if (other.games != null)
return false;
} else if (!games.equals(other.games))
return false;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (location == null) {
if (other.location != null)
return false;
} else if (!location.equals(other.location))
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (phone == null) {
if (other.phone != null)
return false;
} else if (!phone.equals(other.phone))
return false;
return true;
}
@Override
public String toString() {
return "Store [id=" + id + ", name=" + name + ", location=" + location +
", games=" + games + ", phone=" + phone + "]";
}
}
| true |
ebdedfd0e61838a087d6ed6e62cac590a18e89aa | Java | SanatSharma/ThinkingInJava | /TrickyJavaQuestions/HappyNumbers.java | UTF-8 | 2,649 | 4.1875 | 4 | [] | no_license | package TrickyJavaQuestions;
/*Take any positive number, such as 28. The sum of the squares of its digits is
* 2^2 + 8^2 = 68. If we continue this process, we get the following sequence:
28, 68, 100, 1.
Since the sequence ends in 1, 28 is a happy number.
However, not all numbers are happy. For example, 45 is not a happy number,
or is an unhappy number, since it produces the following sequence:
45, 41, 17, 50, 25, 29, 85, 89, 145, 42, 20, 4, 16, 37, 58, 89, ...
at which point the sequence has started to repeat. The process never results in a 1.
For this problem, we will determine if a number is happy or unhappy, and the degree to which it is happy or unhappy.
Input description/format
The input to your solution will be a list of ten positive integers, one on each line.
The smallest possible integer is 1; the largest possible integer is 500,000.
Output description/format
The output from your solution should be one line per number. Each line should have
one word and one number, in that order, separated by one whitespace character.
If the input integer for the line is happy (as defined above), the word happy should
be followed by the number of integers in the sequence before a 1 is seen.
If the number is unhappy, the word unhappy should be followed by the number of integers
in the sequence before the sequence starts to repeat.
The output should end with an empty line.
Example input
28
45
1
314159
100
25
4
500000
888
27182
Example output
happy 3
unhappy 15
happy 0
happy 6
happy 1
unhappy 11
unhappy 8
unhappy 12
happy 4
unhappy 14
*/
import java.util.*;
public class HappyNumbers
{
static Scanner scan = new Scanner(System.in);
//make array with digits
//square the and place the output in an HashSet
//if out==1, return true, else check if it matches with any other number in the HashSet
//if yes return false, if not, continue loop
public static void main(String[] args)
{
for(int i=0;i<10;i++)
{
System.out.print("Enter number: ");
int num = scan.nextInt();
int b = happyNum(num);
System.out.println(b);
}
}
public static int happyNum(int num)
{
HashSet<Integer> checker = new HashSet<Integer>();
Boolean unique;
int recursions = 0;
if(num==1)
{
System.out.print("Happy ");
return recursions;
}
do
{
int sq=0;
while(num>0)
{
int a = num%10;
sq = sq + a*a;
num = num/10;
}
if(sq ==1)
{
recursions++;
System.out.print("Happy ");
return recursions;
}
unique = checker.add(sq);
recursions++;
num = sq;
}
while(unique==true);
System.out.print("Unhappy ");
return recursions;
}
}
| true |
c7e9a5eff088740550161c9d76dab58777314a16 | Java | rrosero1963/ejercicios-java | /Ecommerce/CatalogBundle/com/arkaitzgarro/ecommerce/catalog/model/Product.java | UTF-8 | 1,782 | 3.203125 | 3 | [] | no_license | package com.arkaitzgarro.ecommerce.catalog.model;
import com.arkaitzgarro.ecommerce.catalog.model.abstracts.AbstractPurchasable;
import com.arkaitzgarro.ecommerce.catalog.model.interfaces.IBrand;
import com.arkaitzgarro.ecommerce.catalog.model.interfaces.IPurchasable;
public class Product extends AbstractPurchasable implements IPurchasable,
Cloneable {
/**
* Stock
*/
private int stock;
/**
* Create a new product with a given name and brand
*
* @param nombre
* Nombre del producto
* @param marca
* Nombre de la marca
*/
public Product(String name, IBrand brand) {
this.name = name;
this.setBrand(brand);
this.price = new Money(0, new Currency("Euro", "€"));
this.setStock(0);
}
/**
* {@inheritDoc}
*
* @see com.arkaitzgarro.ecommerce.catalog.model.IPurchasable#getStock()
*/
public int getStock() {
return stock;
}
/**
* {@inheritDoc}
*
* @see com.arkaitzgarro.ecommerce.catalog.model.IPurchasable#setStock(int)
*/
public void setStock(int stock) {
this.stock = (stock < 0) ? 0 : stock;
}
/**
* Prints product data
*/
@Override
public String toString() {
return this.getName() + " " + this.getBrandName() + " "
+ this.getPrice();
}
/**
* Compare this product with a given one
*/
@Override
public boolean equals(Object tmp) {
Product p = (Product) tmp;
return p.getName().equals(this.getName())
&& p.getBrandName().equals(this.getBrandName());
}
/**
* Create a copy of this object
*/
public Product clone() {
Product obj = null;
try {
obj = (Product) super.clone();
} catch (CloneNotSupportedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
obj.price = ((Money) obj.price).clone();
return obj;
}
}
| true |
389b9f43ab9c2b911e58a18eb1c7defb0ce88d87 | Java | Housum/javaporject | /Grpc/core/src/test/java/io/grpc/internal/SerializeReentrantCallsDirectExecutorTest.java | UTF-8 | 4,766 | 2.234375 | 2 | [
"BSD-3-Clause",
"Apache-2.0"
] | permissive | /*
* Copyright 2015, Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package io.grpc.internal;
import static java.util.Arrays.asList;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
@RunWith(JUnit4.class)
public class SerializeReentrantCallsDirectExecutorTest {
SerializeReentrantCallsDirectExecutor executor;
@Before
public void setup() {
executor = new SerializeReentrantCallsDirectExecutor();
}
@Test public void reentrantCallsShouldBeSerialized() {
final List<Integer> callOrder = new ArrayList<Integer>(4);
executor.execute(new Runnable() {
@Override
public void run() {
executor.execute(new Runnable() {
@Override
public void run() {
executor.execute(new Runnable() {
@Override public void run() {
callOrder.add(3);
}
});
callOrder.add(2);
executor.execute(new Runnable() {
@Override public void run() {
callOrder.add(4);
}
});
}
});
callOrder.add(1);
}
});
assertEquals(asList(1, 2, 3, 4), callOrder);
}
@Test
public void exceptionShouldNotCancelQueuedTasks() {
final AtomicBoolean executed1 = new AtomicBoolean();
final AtomicBoolean executed2 = new AtomicBoolean();
executor.execute(new Runnable() {
@Override
public void run() {
executor.execute(new Runnable() {
@Override
public void run() {
executed1.set(true);
throw new RuntimeException("Two");
}
});
executor.execute(new Runnable() {
@Override
public void run() {
executed2.set(true);
}
});
throw new RuntimeException("One");
}
});
assertTrue(executed1.get());
assertTrue(executed2.get());
}
@Test(expected = NullPointerException.class)
public void executingNullShouldFail() {
executor.execute(null);
}
@Test
public void executeCanBeRepeated() {
final List<Integer> executes = new ArrayList<Integer>();
executor.execute(new Runnable() {
@Override
public void run() {
executes.add(1);
}
});
executor.execute(new Runnable() {
@Override
public void run() {
executes.add(2);
}
});
assertEquals(asList(1,2), executes);
}
@Test
public void interruptDoesNotAffectExecution() {
final AtomicInteger callsExecuted = new AtomicInteger();
Thread.currentThread().interrupt();
executor.execute(new Runnable() {
@Override
public void run() {
Thread.currentThread().interrupt();
callsExecuted.incrementAndGet();
}
});
executor.execute(new Runnable() {
@Override
public void run() {
callsExecuted.incrementAndGet();
}
});
// clear interrupted flag
Thread.interrupted();
}
}
| true |
7f193b7b24e05749128a7bf6e0665fe6f31a41b2 | Java | sda-course/java-course | /1-java-podstawy/src/main/java/java_course/_1_basics/chapter11/_11_3_BigInteger.java | UTF-8 | 1,232 | 3.828125 | 4 | [] | no_license | package java_course._1_basics.chapter11;
import java.math.BigInteger;
/**
* Klasa służy do przechowywania liczb całkowitych o dowolnej liczbie cyfr i wykonywania
* na nich operacji arytmetycznych.
*/
public class _11_3_BigInteger {
public static void main(String[] args) {
BigInteger e12 = new BigInteger("1000000000000");
BigInteger e10 = new BigInteger("10000000000");
System.out.println("e12 = " + e12);
System.out.println("e10 = " + e10);
System.out.println("Większa z pary e12 i e10: " + e12.max(e10));
System.out.println("Mniejsza z pary e12 i e10: " + e12.min(e10));
//Można też tworzyć obiekty BigInteger na podstawie typu long
BigInteger thousand = BigInteger.valueOf(1000L);
System.out.println("e12 + 1000 = " + e12.add(thousand));
System.out.println("e12 / 1000 = " + e12.divide(thousand));
System.out.println("e12 modulo 3000 (reszta z dzielenia) = " + e12.mod(BigInteger.valueOf(3000)));
System.out.println("e12 do potęgi 10 " + e12.pow(10));
System.out.println("Liczba bitów potrzebna do zapisania e12: " + e12.bitLength());
System.out.println("Liczba zero: " + BigInteger.ZERO);
}
}
| true |
c081fb546b8041293ba026c36dbaade371a40728 | Java | mateusferrer/openinsula-arena | /arena-echo2/tags/0.4.4/src/main/java/org/openinsula/arena/echo2/component/model/container/impl/PageableContainerTableModel.java | UTF-8 | 2,105 | 2.671875 | 3 | [] | no_license | package org.openinsula.arena.echo2.component.model.container.impl;
import org.openinsula.arena.echo2.component.model.PageableTableModel;
/**
* This TableModel supports pagination and it is also an optional to use the
* PagerRow Component to update it's pages.
* @author Joao Galli
*
* @param <T>
*/
public class PageableContainerTableModel<T> extends BeanReflectionContainerTableModel<T> implements PageableTableModel {
private static final long serialVersionUID = 1L;
private int currentPage;
private int pageSize = 20;
public PageableContainerTableModel() {
}
public PageableContainerTableModel(boolean permitDuplicates, boolean substituteDuplicate) {
super(permitDuplicates, substituteDuplicate);
}
@Override
public Object getValueAt(int columnIndex, int rowIndex) {
return super.getValueAt(columnIndex, getCurrentPageItemIndex(rowIndex));
}
@Override
public int getRowCount() {
return getCurrentPageSize();
}
/**
* @param index
* @return The right item index for this page.
*/
public int getCurrentPageItemIndex(int index) {
return index + (getPageSize() * getCurrentPage());
}
/**
* @return The number of items in the current page
*/
protected int getCurrentPageSize() {
int currentPageSize = getPageSize();
int lastPage = (getPageCount() > 0) ? (getPageCount() - 1) : 0;
if (lastPage == getCurrentPage()) {
if (getCurrentPage() == 0) {
currentPageSize = size();
}
else if ((size() % getPageSize()) == 0) {
return getPageSize();
}
else {
currentPageSize = (size() % getPageSize());
}
}
if (size() == 0) {
currentPageSize = 0;
}
return currentPageSize;
}
public int getCurrentPage() {
return currentPage;
}
public int getPageCount() {
int size = size();
int pageCount = size / pageSize;
if ((size % pageSize) > 0) {
pageCount++;
}
return pageCount;
}
public void setCurrentPage(int index) {
this.currentPage = index;
this.fireTableDataChanged();
}
public void setPageSize(int index) {
this.pageSize = index;
}
public int getPageSize() {
return pageSize;
}
}
| true |
a3dc9f6814d2a135925a50b6d9abed3318ca63bf | Java | Psyh2409/hw9_Collection | /hw8/src/com/gmail/psyh2409/studentsGroup/Student.java | UTF-8 | 1,455 | 3.078125 | 3 | [] | no_license | package com.gmail.psyh2409.studentsGroup;
import java.io.Serializable;
import java.util.Objects;
public class Student extends Human implements Serializable {
private static final long serialVersionUID = 1L;
private long recordBookId;
public Student() {
super();
}
public Student(String surname, long recordBookId) {
super(surname);
this.recordBookId = recordBookId;
}
public Student(Sex sex, String name, String surname, int age, long recordBookId) {
super(sex, name, surname, age);
this.recordBookId = recordBookId;
}
public long getRecordBookId() {
return recordBookId;
}
public void setRecordBookId(long recordBookId) {
this.recordBookId = recordBookId;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
Student student = (Student) o;
return recordBookId == student.recordBookId;
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), recordBookId);
}
@Override
public String toString() {
return "Student{" +
super.toString() +
" and recordBookId=" + recordBookId +
'}';
}
@Override
public void printInfo() {
System.out.println(this);
}
}
| true |
7ea1d55cc7954715a7d5d2708fe79789eb132afe | Java | nguyenhoangnam110392/workspace | /Android/Radio_service/app/src/main/java/com/simple/one/radio/MyService.java | UTF-8 | 6,802 | 2.1875 | 2 | [] | no_license | package com.simple.one.radio;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.location.Address;
import android.location.Geocoder;
import android.location.Location;
import android.location.LocationManager;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.util.Log;
import android.widget.Toast;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
/**
* Created by one on 10/10/2017.
*/
public class MyService extends Service {
private static final String TAG = "BOOMBOOMTESTGPS";
private LocationManager mLocationManager = null;
private Handler mHandler = new Handler();
private Timer mTimer = null;
Location mLastLocation;
Geocoder geocoder = new Geocoder(MyService.this, Locale.getDefault());
List<Address> geo;
private boolean update_ticket = true;
Setting setting;
API api;
@Override
public void onCreate() {
/* new */
LocationManager locationManager = null;
/* new class */
setting = new Setting(locationManager);
api = new API(setting, this);
if(mTimer != null) {
mTimer.cancel();
} else {
mTimer = new Timer();
}
// schedule task
mTimer.scheduleAtFixedRate(new TimeDisplayTimerTask(), 0, setting.NOTIFY_INTERVAL);
}
@Override
public void onStart(Intent intent, int startId) {
Toast.makeText(this, "Radio Started", Toast.LENGTH_LONG).show();
}
@Override
public void onDestroy() {
//Toast.makeText(this, "MyService Stopped", Toast.LENGTH_LONG).show();
}
private class LocationListener implements android.location.LocationListener
{
public LocationListener(String provider)
{
mLastLocation = new Location(provider);
}
@Override
public void onLocationChanged(Location location)
{
mLastLocation.set(location);
setting.Longtitude = location.getLongitude();
setting.Latitude = location.getLatitude();
}
@Override
public void onProviderDisabled(String provider) {}
@Override
public void onProviderEnabled(String provider) {}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {}
}
LocationListener[] mLocationListeners = new LocationListener[] {
new LocationListener(LocationManager.GPS_PROVIDER),
new LocationListener(LocationManager.NETWORK_PROVIDER)
};
@Override
public IBinder onBind(Intent arg0) {
return null;
}
private void initializeLocationManager() {
if (mLocationManager == null) {
mLocationManager = (LocationManager) getApplicationContext().getSystemService(Context.LOCATION_SERVICE);
}
}
class TimeDisplayTimerTask extends TimerTask {
@Override
public void run() {
// run on another thread
mHandler.post(new Runnable() {
@Override
public void run() {
if(update_ticket) {
update_ticket = false;
initializeLocationManager();
LocationUpdate();
//Toast.makeText(getApplicationContext(), "Location: " + setting.Longtitude + "," + setting.Latitude,
// Toast.LENGTH_SHORT).show();
try {
geo = geocoder.getFromLocation(setting.Latitude, setting.Longtitude, 1);
setting.Address = geo.get(0).getAddressLine(0);
setting.DateTime = getDateTime();
} catch (Exception e) {
e.printStackTrace();
}
//if(setting.Longtitude != 0 && setting.Latitude != 0) {
MyPost mypost = new MyPost(setting);
try {
mypost.execute().get(30000, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
} catch (TimeoutException e) {
e.printStackTrace();
}
//}
update_ticket = true; //need to put this variable into post method
}
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
mLocationManager.removeUpdates(mLocationListeners[0]);
mLocationManager.removeUpdates(mLocationListeners[1]);
//api.takeSnapShots();
//Toast.makeText(getApplicationContext(), "Image snapshot Done",Toast.LENGTH_LONG).show();
}
}, setting.GPS_NOTIFY_OFF_INTERVAL);
}
});
}
private String getDateTime() {
// get date time in custom format
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd - HH:mm:ss");
return sdf.format(new Date());
}
private void LocationUpdate(){
try {
mLocationManager.requestLocationUpdates(
LocationManager.NETWORK_PROVIDER, 0, 0,
mLocationListeners[1]);
} catch (java.lang.SecurityException ex) {
Log.i(TAG, "fail to request location update, ignore", ex);
} catch (IllegalArgumentException ex) {
Log.d(TAG, "network provider does not exist, " + ex.getMessage());
}
/*
try {
mLocationManager.requestLocationUpdates(
LocationManager.GPS_PROVIDER, 0, 0,
mLocationListeners[0]);
} catch (java.lang.SecurityException ex) {
Log.i(TAG, "fail to request location update, ignore", ex);
} catch (IllegalArgumentException ex) {
Log.d(TAG, "gps provider does not exist " + ex.getMessage());
}
*/
}
}
}
| true |
54ec822ed84b4b4268a07eba5279eb6e9ad1b5d8 | Java | howeeyz/ECE419 | /lab3/mazewar/partial/ClientSenderThread.java | UTF-8 | 3,137 | 2.84375 | 3 | [] | no_license | import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.BlockingQueue;
public class ClientSenderThread implements Runnable {
private final int TIMEOUT = 500;
private RingSocket ringSocket = null;
private BlockingQueue<Token> mTQueue = null;
private Player myPlayer = null;
private NSPacket received = null;
private boolean acked = false;
private Timer ackTimer = null;
public ClientSenderThread(RingSocket rSocket,
BlockingQueue tQueue,
Player player){
this.ringSocket = rSocket;
this.mTQueue = tQueue;
this.myPlayer = player;
}
private void scheduleTimer(final Token tk){
TimerTask taskPerformer = new TimerTask() {
public void run() {
retransmitToken(tk);
}
};
if(ackTimer == null){
ackTimer = new Timer("AckTimer", true);
}
ackTimer.scheduleAtFixedRate(taskPerformer, TIMEOUT, TIMEOUT);
}
private void retransmitToken(final Token tk){
ringSocket.writeObject(tk);
}
public void run() {
if(Debug.debug) System.out.println("Starting ClientSenderThread");
while(true){
if(!mTQueue.isEmpty()){
try{
//This tells us that the listener is done doing what it needs to do
//Ready to pass off token
Token tk = mTQueue.peek();
scheduleTimer(tk);
ringSocket.writeObject(tk);
mTQueue.take();
received = (NSPacket)ringSocket.readObject();
while(received == null){
if(!mTQueue.isEmpty() && mTQueue.peek().getCount() > tk.getCount()){
break;
}
received = (NSPacket)ringSocket.readObject();
}
// If we receive a newer token from the previous node
// Or if we receive an ack from the next node
// Stop retransmitting packets
if((!mTQueue.isEmpty() && mTQueue.peek().getCount() > tk.getCount())
|| tk.getCount() == received.getmAckNo()){
assert(ackTimer != null);
ackTimer.cancel();
ackTimer.purge();
ackTimer = null;
}
}catch (InterruptedException e){
System.out.println(e);
}catch (IOException e){
System.out.println(e);
}catch (ClassNotFoundException e){
System.out.println(e);
}
}
}
}
}
| true |
945471781463cd975ed0266ab40f9e9d3ebdaaf6 | Java | sumand99/ST_Parent_App | /app/src/main/java/com/vedanshtechnologies/swipetouch/ModelClass/MonthlyAttendance.java | UTF-8 | 644 | 2.4375 | 2 | [] | no_license | package com.swipetouch.ModelClass;
import java.util.ArrayList;
public class MonthlyAttendance {
public String status;
public String message;
public ArrayList<Month> months;
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public ArrayList<Month> getMonths() {
return months;
}
public void setMonths(ArrayList<Month> months) {
this.months = months;
}
}
| true |
299d755d9b247fb51bf19128edbb947f37c5e5d0 | Java | mittalabhi/Data-Structures-and-Algorithms | /Trees/FindLargestValueinEachTreeRow.java | UTF-8 | 1,093 | 3.421875 | 3 | [] | no_license | /**
* Definition for a binary tree node.
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode() {}
* TreeNode(int val) { this.val = val; }
* TreeNode(int val, TreeNode left, TreeNode right) {
* this.val = val;
* this.left = left;
* this.right = right;
* }
* }
*/
class Solution {
public List<Integer> largestValues(TreeNode root) {
if(root == null) return new ArrayList<>();
LinkedList<TreeNode> que = new LinkedList<>();
ArrayList<Integer> ans = new ArrayList<>();
que.add(root);
int max = Integer.MIN_VALUE;
while(que.size() != 0){
int size = que.size();
while(size -- > 0){
TreeNode vtx = que.removeFirst();
max = Math.max(vtx.val,max);
if(vtx.left != null) que.addLast(vtx.left);
if(vtx.right != null) que.addLast(vtx.right);
}
ans.add(max);
max = Integer.MIN_VALUE;
}
return ans;
}
} | true |
490aefa910309b93dbbc5fbd2fdf8a92194158a9 | Java | rizqyfitrianto1/ControllingPenulisanIlmiah | /app/src/main/java/com/example/rizqy/Model/Request.java | UTF-8 | 924 | 2.109375 | 2 | [] | no_license | package com.example.rizqy.Model;
public class Request {
private String Tanggal;
private String Judul;
private String Subjudul;
private String Npm;
public Request() {
}
public Request(String tanggal, String judul, String subjudul, String npm) {
Tanggal = tanggal;
Judul = judul;
Subjudul = subjudul;
Npm = npm;
}
public String getNpm() {
return Npm;
}
public void setNpm(String npm) {
Npm = npm;
}
public String getTanggal() {
return Tanggal;
}
public void setTanggal(String tanggal) {
Tanggal = tanggal;
}
public String getJudul() {
return Judul;
}
public void setJudul(String judul) {
Judul = judul;
}
public String getSubjudul() {
return Subjudul;
}
public void setSubjudul(String subjudul) {
Subjudul = subjudul;
}
}
| true |
ace4e8b1d2079718826181ab8f6b399b06923f0f | Java | TieuCao/Web-Proxy-Server | /src/main/java/com/thaitien/proxy/gui/model/BlackUrlModel.java | UTF-8 | 2,368 | 2.671875 | 3 | [] | no_license | package com.thaitien.proxy.gui.model;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.thaitien.proxy.core.model.HttpMethod;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.beans.value.ChangeListener;
public class BlackUrlModel {
private StringProperty url;
private HttpMethod[] methods;
private BooleanProperty[] votes;
public BlackUrlModel(String url, boolean initValue) {
this.url = new SimpleStringProperty(url);
this.votes = new BooleanProperty[HttpMethod.values().length];
this.methods = new HttpMethod[HttpMethod.values().length];
for (int i = 0; i < HttpMethod.values().length; i++) {
methods[i] = HttpMethod.values()[i];
votes[i] = new SimpleBooleanProperty(initValue);
}
}
public BlackUrlModel(String url) {
this(url, true);
}
public HttpMethod[] getMethods() {
return methods;
}
public void setMethods(HttpMethod[] methods) {
this.methods = methods;
}
public String getUrl() {
return url.getValue();
}
public StringProperty getUrlProperty() {
return url;
}
public void setUrl(String url) {
this.url.setValue(url);
}
public BooleanProperty[] getVotes() {
return votes;
}
public void setVotes(BooleanProperty[] votes) {
this.votes = votes;
}
public void setVote(int index, boolean value) {
this.votes[index].set(value);
}
public void setVote(HttpMethod method, boolean value) {
for (int i = 0; i < votes.length; i++) {
if (methods[i] == method) {
votes[i].set(value);
return;
}
}
}
public List<HttpMethod> getBlackMethodList() {
ArrayList<HttpMethod> lstBlackMethods = new ArrayList<>();
for (int i = 0; i < votes.length; i++) {
if (votes[i].getValue().booleanValue())
lstBlackMethods.add(methods[i]);
}
return lstBlackMethods;
}
public void setChangeListener(ChangeListener<Boolean> listener) {
for (int i = 0; i < HttpMethod.values().length; i++) {
votes[i].addListener(listener);
}
}
@Override
public String toString() {
return "BlackUrlModel [url=" + url + ", lstMethod=" + methods + ", votes=" + Arrays.toString(votes) + "]";
}
}
| true |
b1710e75df4906ee366b9e4ade1975d1c9b7afee | Java | ValmirBP/JavaStudies | /src/com/valmir/cursojava/exercicios16E17/Exercise21.java | UTF-8 | 1,265 | 3.796875 | 4 | [] | no_license | package com.valmir.cursojava.exercicios16E17;
import java.util.Scanner;
public class Exercise21 {
/*
Faça um programa que calcule o número médio de alunos por turma.
Para isto, peça a quantidade de turmas e a quantidade de alunos para
cada turma. As turmas não podem ter mais de 40 alunos.
*/
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
double average = 0;
double sum = 0;
int qtyclass, qtydStud;
boolean valid;
System.out.println(" entre com a quantidade de tumas");
qtyclass = s.nextInt();
for (int i = 1; i <= qtyclass; i++) {
valid = true;
do {
System.out.println(" entre com o nomero de alunos da turma " + i);
qtydStud = s.nextInt();
if (qtydStud <= 40) {
valid = false;
} else {
System.out.println(" Atencao: Quantidade superior, a quantidade de alunos nao pode ser maior que 40 Digite novamente ");
}
} while (valid);
sum += qtydStud;
average = sum / qtyclass;
}
System.out.println(" a media de alunos eh " + average);
}
}
| true |
23393cf77b3dc3ba4a69eba03c28b59019a6bbc9 | Java | kovacseni/training-solutions | /src/main/java/week13d02/Quiz.java | UTF-8 | 2,658 | 3.453125 | 3 | [] | no_license | package week13d02;
import java.io.BufferedReader;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.*;
public class Quiz {
private Map<String, List<Character>> answers = new HashMap<>();
private char[] goodAnswers;
public void loadFromFile(BufferedReader br) {
try {
String line = br.readLine();
goodAnswers = line.toCharArray();
while ((line = br.readLine()) != null) {
putToMap(line);
}
br.close();
} catch (IOException ioe) {
throw new IllegalStateException("Can not handle file.", ioe);
}
}
private void putToMap(String line) {
String[] temp = line.split(" ");
String id = temp[0];
char answer = temp[1].charAt(0);
if (!answers.containsKey(id)) {
answers.put(id, new ArrayList<>());
}
answers.get(id).add(answer);
}
public boolean wasItAGoodAnswer(String id, int i) {
if (i < 1 || i > 5) {
throw new IllegalArgumentException("There was five questions in the quiz. Add a number between 1 and 5!");
}
if (!answers.containsKey(id)) {
throw new IllegalArgumentException("This competitioner didn't took part in the quiz.");
}
char answer = answers.get(id).get(i - 1);
return answer == goodAnswers[i - 1];
}
public String whichCompetitionerHasMostXes() {
String id = null;
int max = 0;
for (String s : answers.keySet()) {
int counter = countXes(answers.get(s));
if (counter > max) {
max = counter;
id = s;
}
}
return id;
}
private int countXes(List<Character> listOfAnswersById) {
int counter = 0;
for (char c : listOfAnswersById) {
if (c == 'X') {
counter++;
}
}
return counter;
}
public String whichCompetitionerHasMostPoints() {
String id = null;
int max = 0;
for (String s : answers.keySet()) {
int counter = countPoints(answers.get(s));
if (counter > max) {
max = counter;
id = s;
}
}
return id;
}
private int countPoints(List<Character> listOfAnswersById) {
int counter = 0;
for (int i = 1; i <= listOfAnswersById.size(); i++) {
if (listOfAnswersById.get(i - 1) == goodAnswers[i - 1]) {
counter += i;
}
}
return counter;
}
}
| true |
85af8442fa4c89e0620e1afb1387ed3fa0fbbd9a | Java | dharper998/CS140CourseWork | /lab04/Student.java | UTF-8 | 254 | 2.96875 | 3 | [] | no_license | package lab04;
public class Student {
private int id;
private String name;
public Student(int idNum, String studentName) {
id = idNum;
name = studentName;
}
public int getID() {
return id;
}
public String getName() {
return name;
}
}
| true |
7dd4197d38e1da777039945f18014622a7d7f3fa | Java | ApolloDev/apollo | /apollo-translator/src/main/java/edu/pitt/apollo/apollotranslator/setters/TreatmentSetter.java | UTF-8 | 7,041 | 2.15625 | 2 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | package edu.pitt.apollo.apollotranslator.setters;
import edu.pitt.apollo.apollotranslator.ApolloTranslationEngine;
import edu.pitt.apollo.apollotranslator.exception.ApolloSetterException;
import edu.pitt.apollo.apollotranslator.types.translator.SetterReturnObject;
import edu.pitt.apollo.types.v4_0_2.ApolloPathogenCode;
import edu.pitt.apollo.types.v4_0_2.Duration;
import edu.pitt.apollo.types.v4_0_2.Treatment;
import edu.pitt.apollo.types.v4_0_2.TreatmentContraindication;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
/**
*
* Author: Nick Millett
* Email: nick.millett@gmail.com
* Date: Sep 18, 2013
* Time: 12:59:48 PM
* Class: TreatmentSetter
* IDE: NetBeans 6.9.1
*/
public abstract class TreatmentSetter<T extends Treatment> extends AbstractTypedSetter<T> {
private static final String TREATMENT_DESCRIPTION = "description";
private static final String SPECIES_OF_TREATED_ORGANISMS = "speciesOfTreatedOrganism";
private static final String NUM_DOSES_IN_TREATMENT_COURSE = "numDosesInTreatmentCourse";
private static final String TREATMENT_CONTRAINDICATIONS = "treatmentContraindications";
// private static final String TREATMENT_EFFICACIES = "treatmentEfficacies";
private static final String PATHOGEN = "pathogen";
// private static final String VACCINE_ID = "vaccineId";
// private static final String DRUG_ID = "drugId";
private static final String DURATION_OF_TREATMENT_COURSE = "durationOfTreatmentCourse";
// String type, section;
public TreatmentSetter(String type, String section, ApolloTranslationEngine apolloTranslatorEngine) {
super(type, section, apolloTranslatorEngine);
// this.type = type;
// this.section = section;
}
// @Override
// protected List<SetterReturnObject> setValue(String fieldName, String fieldValue, String section) throws ApolloSetterException {
// String newType;
// if (fieldName.isEmpty()) {
// newType = type;
// } else {
// newType = type + "." + fieldName;
// }
// return super.setValue(newType, fieldValue, section);
// }
private List<SetterReturnObject> setTreatmentDescription(String description) throws ApolloSetterException {
return setValue(TREATMENT_DESCRIPTION, description, section);
}
private List<SetterReturnObject> setTreatmentSpeciesOfTreatedOrganisms(String id) throws ApolloSetterException {
return setValue(SPECIES_OF_TREATED_ORGANISMS, id, section);
}
private List<SetterReturnObject> setTreatmentNumDosesInTreatmentCourse(BigInteger numDoses) throws ApolloSetterException {
return setValue(NUM_DOSES_IN_TREATMENT_COURSE, numDoses.toString(), section);
}
private List<SetterReturnObject> setPathogen(ApolloPathogenCode code) throws ApolloSetterException {
ApolloPathogenCodeSetter setter = new ApolloPathogenCodeSetter(apolloTranslationEngine, type + "." + PATHOGEN, section);
return setter.set(code);
}
// private List<SetterReturnObject> setVaccineId(String id) throws ApolloSetterException {
// return setValue(VACCINE_ID, id, section);
// }
//
// private List<SetterReturnObject> setDrugId(String id) throws ApolloSetterException {
// return setValue(DRUG_ID, id, section);
// }
private List<SetterReturnObject> setDurationOfTreatmentCourse(Duration duration) throws ApolloSetterException {
DurationSetter setter = new DurationSetter(apolloTranslationEngine, type + "." + DURATION_OF_TREATMENT_COURSE, section);
return setter.set(duration);
}
private List<SetterReturnObject> setTreatmentContraindications(List<TreatmentContraindication> contraindications) throws ApolloSetterException {
List<SetterReturnObject> sroList;
if (contraindications != null && contraindications.size() > 0) {
sroList = setValue(TREATMENT_CONTRAINDICATIONS, "(list values described below)", section);
ListSetter setter = new ListSetter(TreatmentContraindicationSetter.class, TreatmentContraindication.class,
contraindications, apolloTranslationEngine, section, type + "." + TREATMENT_CONTRAINDICATIONS);
// VaccinationEfficacyForSimulatorConfigurationSetter vaccinationEfficacySetter = new VaccinationEfficacyForSimulatorConfigurationSetter(apolloTranslationEngine, type
// + "." + VACCINATION_EFFICACIES, section);
List<SetterReturnObject> result = setter.set();
sroList.get(0).setSubApolloParameters(result);
} else {
sroList = setValue(TREATMENT_CONTRAINDICATIONS, PARAM_IS_NOT_SET_LABEL, section);
}
return sroList;
}
// private List<SetterReturnObject> setVaccinationEfficacies(List<TreatmentEfficacy> efficacies) throws ApolloSetterException {
// ListSetter setter = new ListSetter(VaccinationEfficacyForSimulatorConfigurationSetter.class,
// VaccinationEfficacyForSimulatorConfiguration.class,
// efficacies, apolloTranslationEngine, section, type + "." + TREATMENT_EFFICACIES);
//
// return setter.set();
// }
//
// private List<SetterReturnObject> setAntiviralTreatmentEfficacies(List<TreatmentEfficacy> efficacies) throws ApolloSetterException {
// ListSetter setter = new ListSetter(AntiviralTreatmentEfficacySetter.class,
// AntiviralTreatmentEfficacy.class,
// efficacies, apolloTranslationEngine, section, type + "." + TREATMENT_EFFICACIES);
//
// return setter.set();
// }
//
// private List<SetterReturnObject> setTreatmentEfficacies(List<TreatmentEfficacy> efficacies) throws ApolloSetterException {
//
// List<SetterReturnObject> sroList = new ArrayList<SetterReturnObject>();
// sroList.addAll(setVaccinationEfficacies(efficacies));
// sroList.addAll(setAntiviralTreatmentEfficacies(efficacies));
//
// return sroList;
// }
public List<SetterReturnObject> setTreatment(T treatment) throws ApolloSetterException {
List<SetterReturnObject> list = new ArrayList<SetterReturnObject>();
list.addAll(setTreatmentDescription(treatment.getDescription()));
list.addAll(setTreatmentNumDosesInTreatmentCourse(treatment.getNumDosesInTreatmentCourse()));
list.addAll(setTreatmentSpeciesOfTreatedOrganisms(treatment.getSpeciesOfTreatedOrganism()));
list.addAll(setTreatmentContraindications(treatment.getTreatmentContraindications()));
list.addAll(setPathogen(treatment.getPathogen()));
// if (treatment.getVaccineId() != null) {
// list.addAll(setVaccineId(treatment.getVaccineId()));
// }
//
// if (treatment.getDrugId() != null) {
// list.addAll(setDrugId(treatment.getDrugId()));
// }
list.addAll(setDurationOfTreatmentCourse(treatment.getDurationOfTreatmentCourse()));
// list.addAll(setTreatmentEfficacies(treatment.getTreatmentEfficacies()));
return list;
}
}
| true |
f7f5bd750beb215adc25f37a6183f18314b5ce66 | Java | gabrielvicenteYT/MineplexHub | /mineplex/minecraft/game/classcombat/Class/repository/token/SlotToken.java | UTF-8 | 595 | 2.796875 | 3 | [] | no_license | package mineplex.minecraft.game.classcombat.Class.repository.token;
import java.io.PrintStream;
public class SlotToken
{
public String Name = "";
public String Material = "";
public int Amount = 0;
public SlotToken() {}
public SlotToken(String name, org.bukkit.Material material, int amount)
{
this.Name = name;
this.Material = material.name();
this.Amount = amount;
}
public void printInfo()
{
System.out.println("Name : " + this.Name);
System.out.println("Material : " + this.Material);
System.out.println("Amount : " + this.Amount);
}
}
| true |
dea7fab9e4b2cd739a869b645d2b1921a87d8a4a | Java | spinkstowork/wordchain1 | /src/main/java/com/sdp/wordchain1/WCDictionary.java | UTF-8 | 3,546 | 3.28125 | 3 | [] | no_license | package com.sdp.wordchain1;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.*;
import java.util.stream.Stream;
/**
* Written By: S. D. Pinkston Feb, 2018
* Implementation of our "dictionary".
*/
public class WCDictionary {
private String filename;
// todo: overcome issue with this being declared static
private static final SortedMap<String,String> dictionary = new TreeMap<>( String.CASE_INSENSITIVE_ORDER );
private String charSet;
protected WCDictionary() {
}
public WCDictionary( String filename ) {
this.filename = filename;
}
public String getFilename() {
return filename;
}
/**
* Assumes a "plain" text file as input.
* @throws IOException
*/
public void loadFromFile() throws IOException {
if( dictionary.size() == 0 ) {
Stream<String> stream = Files.lines( Paths.get( filename ) );
stream.forEach( WCDictionary::addKeyToDict );
// immediately calculate the charset. Yes, we might assume a-z, but there
// are times with smaller dictionaries when there are less than a-z chars
// in the set, so this step can sometimes limit the permutations used
this.charSet = Utils.findAllPotentialCharsSorted( dictionary.values() );
}
else {
throw new RuntimeException( "Refusing to load dictionary a second time." );
}
}
public SortedMap<String,String> findFirstKey( String key ) {
return dictionary.subMap( key, key + "Z" );
}
public boolean containsKey( String key ) {
return dictionary.containsKey( key );
}
public String getCharSet() {
return charSet;
}
/**
* Given an input string and set of characters, construct all derivative strings
* that do not match by one character that exist in this dictionary.
* @param input
* @return
*/
public List<String> calcDerivatives( String input ) {
List<String> output = new ArrayList<>();
char[] inputChars = input.toCharArray(); // calculate this once, hoping to save cycles
char[] buf; // hoping to save cycles verses a string builder
for( int x=0; x < input.length(); x++ ) {
buf = input.toCharArray(); // reset
for( char tmp : charSet.toCharArray() ) {
buf[x] = tmp;
// only allow derivatives that exist in the dictionary
// do not allow input string. Screen out input word
if( !Arrays.equals( inputChars, buf ) && dictionary.containsKey( String.copyValueOf( buf ) ) ) {
output.add( new String( buf ) );
}
}
}
return output;
}
private static void addKeyToDict( String key ) {
// fail silently instead of output to System.err
if( key.indexOf( " " ) >= 0 ) {
// System.err.println( "Key: [" + key + "] contains a space. Ignoring." );
} else if( key.indexOf( "'" ) >= 0 ) {
// System.err.println( "Key: [" + key + "] contains an apostraphe. Ignoring." );
} else if( key.indexOf( "-" ) >= 0 ) {
// System.err.println( "Key: [" + key + "] contains a hyphen. Ignoring." );
} else if( !dictionary.containsKey( key ) ) {
dictionary.put( key.toLowerCase(), key );
}
}
}
| true |
1ec84f5144f5d0801e7eec25f47d268c4ca09ada | Java | hanyayn/javaBasic | /src/com/neuedu/c/Person.java | UTF-8 | 608 | 2.875 | 3 | [] | no_license | package com.neuedu.c;
public class Person {
public String name;
public int height;
public int weigth;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getHeight() {
return height;
}
public void setHeight(int height) {
this.height = height;
}
public int getWeigth() {
return weigth;
}
public void setWeigth(int weigth) {
this.weigth = weigth;
}
public void sayHello(){
System.out.println("hello,my name is xxx");
}
}
| true |
5cfbc2cb90c2ca0d5a2d67a0c6945a264e46dc11 | Java | tamtamu-spring/swadhyay | /src/main/java/com/example/sawdhyay/daos/TrackDaoImpl.java | UTF-8 | 1,990 | 2.609375 | 3 | [] | no_license | package com.example.sawdhyay.daos;
import com.example.sawdhyay.models.Track;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository("trackDao")
public class TrackDaoImpl implements TrackDao {
private static final Logger logger = LoggerFactory.getLogger(TrackDaoImpl.class);
@Autowired
private SessionFactory sessionFactory;
@Override
public void saveTrack(Track track) {
Session session = this.sessionFactory.getCurrentSession();
session.persist(track);
logger.info("Track saved successfully, Track Details=" + track);
}
@Override
public Track getTrack(int id) {
Session session = this.sessionFactory.getCurrentSession();
Track track = (Track) session.load(Track.class, new Integer(id));
logger.info("Track loaded successfully, Track details=" + track);
return track;
}
@Override
public List<Track> listTracks() {
Session session = sessionFactory.getCurrentSession();
List<Track> trackList = session.createQuery("from Track").list();
for(Track track : trackList){
logger.info("Track List::" + track);
}
return trackList;
}
@Override
public void updateTrack(Track track) {
Session session = this.sessionFactory.getCurrentSession();
session.update(track);
logger.info("Track updated successfully, Track Details="+track);
}
@Override
public void deleteTrack(int id) {
Session session = this.sessionFactory.getCurrentSession();
Track track = (Track) session.load(Track.class, new Integer(id));
if(null != track){
session.delete(track);
}
logger.info("Track deleted successfully, track details=" + track);
}
}
| true |
f4ebff88932e30df569023f3a517245b8e400c55 | Java | mortuzacreative/java-sorting-algorithm | /Sorting_Java/src/SelectionSort.java | UTF-8 | 996 | 3.609375 | 4 | [] | no_license | import java.util.Random;
public class SelectionSort {
static double startTime = System.currentTimeMillis();
public static int[] randomNumGenerate() {
Random random = new Random();
int index = 1000;
int[] rndm = new int[index];
for (int i = 0; i < rndm.length; i++) {
int num = random.nextInt(index);
rndm[i] = (num == 0) ? num + 1 : num;
}
return rndm;
}
public static int[] doSelectionSort(int[] arr) {
for (int i = 0; i < arr.length - 1; i++) {
int index = i;
for (int j = i + 1; j < arr.length; j++)
if (arr[j] < arr[index])
index = j;
int smallerNumber = arr[index];
arr[index] = arr[i];
arr[i] = smallerNumber;
}
return arr;
}
public static void main(String a[]) {
int[] arr1 = randomNumGenerate();
int[] arr2 = doSelectionSort(arr1);
for (int i : arr2) {
System.out.println(i);
}
double endTime = System.currentTimeMillis();
double time = endTime - startTime;
System.out.println("Sorting time: " + time);
}
}
| true |
2a913d2fb7611b73fcd61a633ec959f0c983ed70 | Java | nemanja97/bsep2020_projekat | /SIEMAgent/src/main/java/tim6/bsep/SIEMAgent/model/enums/SeverityLevel.java | UTF-8 | 149 | 1.867188 | 2 | [] | no_license | package tim6.bsep.SIEMAgent.model.enums;
public enum SeverityLevel {
EMERGENCY, ALERT, CRITICAL, ERROR, WARNING, NOTICE, INFORMATIONAL, DEBUG
}
| true |
20f62152e1d625a23aa173e70b677641cb680215 | Java | dupreemovil/AzzortiBolivia | /app/src/main/java/com/dupreeincabolnuevo/dupree/mh_required_api/RequiredIdMessaage.java | UTF-8 | 329 | 1.859375 | 2 | [
"Apache-2.0"
] | permissive | package com.dupreeincabolnuevo.dupree.mh_required_api;
/**
* Created by cloudemotion on 28/8/17.
*/
public class RequiredIdMessaage {
String id_mensaje;
public RequiredIdMessaage(String id_mensaje) {
this.id_mensaje = id_mensaje;
}
public String getId_mensaje() {
return id_mensaje;
}
}
| true |
4d4667e1ef1b2c773233c24517c0490afd1cc897 | Java | vitalif/openesb-components | /ojc-core/component-common/crl/src/com/sun/jbi/crl/mep/impl/AbstractCallback.java | UTF-8 | 2,776 | 1.734375 | 2 | [] | no_license | /*
* BEGIN_HEADER - DO NOT EDIT
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the "License"). You may not use this file except
* in compliance with the License.
*
* You can obtain a copy of the license at
* https://open-jbi-components.dev.java.net/public/CDDLv1.0.html.
* See the License for the specific language governing
* permissions and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* HEADER in each file and include the License file at
* https://open-jbi-components.dev.java.net/public/CDDLv1.0.html.
* If applicable add the following below this CDDL HEADER,
* with the fields enclosed by brackets "[]" replaced with
* your own identifying information: Portions Copyright
* [year] [name of copyright owner]
*/
/*
* @(#)AbstractCallback.java
*
* Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
*
* END_HEADER - DO NOT EDIT
*/
package com.sun.jbi.crl.mep.impl;
import javax.jbi.JBIException;
import com.sun.jbi.crl.mep.Callback;
import com.sun.jbi.crl.mep.exchange.CRLMessageExchange;
import com.sun.jbi.crl.mep.exchange.CRLMessageExchangeFactory;
/**
* Abstract base class for {@link Callback} implementations.
*
* @author Kevan Simpson
*/
public abstract class AbstractCallback implements Callback {
private Object mData = null;
private CRLMessageExchange mMessage = null;
private CRLMessageExchangeFactory mFactory = null;
/** @see com.sun.jbi.crl.mep.Callback#getData() */
public Object getData() {
return mData;
}
/** @see com.sun.jbi.crl.mep.Callback#getExchangeFactory() */
public CRLMessageExchangeFactory getExchangeFactory() {
return mFactory;
}
/** @see com.sun.jbi.crl.mep.Callback#getMessageExchange() */
public CRLMessageExchange getMessageExchange() {
return mMessage;
}
/** @see com.sun.jbi.crl.mep.Callback#onCallback(java.lang.Object) */
public abstract CRLMessageExchange onCallback(Object data) throws JBIException;
/** @see com.sun.jbi.crl.mep.Callback#onTimeout() */
public abstract CRLMessageExchange onTimeout() throws JBIException;
/** @see com.sun.jbi.crl.mep.Callback#setData(java.lang.Object) */
public void setData(Object data) {
mData = data;
}
/** @see com.sun.jbi.crl.mep.Callback#setExchangeFactory(com.sun.jbi.crl.mep.exchange.CRLMessageExchangeFactory) */
public void setExchangeFactory(CRLMessageExchangeFactory fac) {
mFactory = fac;
}
/** @see com.sun.jbi.crl.mep.Callback#setMessageExchange(com.sun.jbi.crl.mep.exchange.CRLMessageExchange) */
public void setMessageExchange(CRLMessageExchange msg) {
mMessage = msg;
}
}
| true |
cf0abd0468c306f28891428759c67991744a73f7 | Java | oscar0812/pokeapi-v2-java | /src/main/java/com/github/oscar0812/pokeapi/models/pokemon/NatureStatChange.java | UTF-8 | 853 | 3.0625 | 3 | [
"MIT"
] | permissive | /* Natures influence how a Pokémon's stats grow. See Bulbapedia for greater detail. */
package com.github.oscar0812.pokeapi.models.pokemon;
public class NatureStatChange {
// The amount of change.
private int max_change;
// The stat being affected.
private PokeathlonStat pokeathlon_stat;
public int getMaxChange() {
return max_change;
}
public NatureStatChange setMaxChange(int max_change) {
this.max_change = max_change;
return this;
}
public PokeathlonStat getPokeathlonStat() {
if(!pokeathlon_stat.getIsFetched()) {
pokeathlon_stat = pokeathlon_stat.get();
}
return pokeathlon_stat;
}
public NatureStatChange setPokeathlonStat(PokeathlonStat pokeathlon_stat) {
this.pokeathlon_stat = pokeathlon_stat;
return this;
}
@Override
public String toString() {
return new com.google.gson.Gson().toJson(this);
}
} | true |
e11312e6f9cc4c28cc757b73193a1130493f8816 | Java | manases-juarez/Plotter-Serial | /ParalelComunicattion/src/Generadores/GSintactico.java | UTF-8 | 1,605 | 2.9375 | 3 | [] | no_license | package Generadores;
public class GSintactico
{
public static void main(String[] args)
{
int n = 0;
String opciones[] = new String[7];
String destino = "-destdir",
carpetaTexto = "src/AnalizadoresTexto/",
carpetaCodigo = "src/Analizadores/",
simbols = "-symbols",
simbolsCSS = "Symc",
par = "-parser",
sintactico = "Sintactico";
//Seleccionamos la opción de dirección de destino
opciones[n] = destino;
//Le damos la dirección, carpeta donde se va a generar el parser.java & el simbolosxxx.java
n++;
opciones[n] = carpetaCodigo;
//Seleccionamos la opción de nombre de archivo simbolos
n++;
opciones[n] = simbols;
//Le damos el nombre que queremos que tenga
n++;
opciones[n] = simbolsCSS;
//Seleccionamos la opcion de clase parser
n++;
opciones[n] = par;
//Le damos nombre a esa clase del paso anterior
n++;
opciones[n] = sintactico;
//Le decimos donde se encuentra el archivo .cup
n++;
opciones[n] = carpetaTexto + sintactico +".cup";
try
{
System.out.println("\n--------------------------------------------------------------------------");
java_cup.Main.main(opciones);
}
catch (Exception ex)
{
System.out.print(ex);
}
}
}
| true |
98851203b5f5e1f8d9f6f5a46987864ee4c3a461 | Java | ArukalaMadhu/CucumberSeleniumFW | /CucumberDemo/src/commonutils/RESTUtils.java | UTF-8 | 1,990 | 2.53125 | 3 | [] | no_license | package commonutils;
import static io.restassured.RestAssured.given;
import java.util.List;
import java.util.Map;
import io.restassured.RestAssured;
import io.restassured.http.ContentType;
import io.restassured.parsing.Parser;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
public class RESTUtils {
public JsonPath getRESTPOSTResponse(String endPoint, String request){
Response response = given().contentType(ContentType.JSON).body(request).
when().post(endPoint).then().contentType(ContentType.JSON).extract().response();
return response.jsonPath();
}
public JsonPath getRESTGETResponse(String endPoint, String request){
Response response = given().contentType(ContentType.JSON).
when().get(endPoint).then().contentType(ContentType.JSON).extract().response();
return response.jsonPath();
}
public static boolean checkElementPathFromJSONPATH(JsonPath jsonPathObj, String elePath){
List<Map> res = jsonPathObj.get(elePath);
System.out.println(res);
return res.size()>0;
}
public static boolean isValueExistInJSONPATH(JsonPath jsonPathObj, String path, String expectedValue){
String res = jsonPathObj.getString(path);
return res.equalsIgnoreCase(expectedValue);
}
public static void main(String args[]){
Response response = given().contentType(ContentType.JSON).body("{\"name\":\"madhu\",\"job\":\"IT\"}").
when().post("https://reqres.in/api/users").
then().contentType(ContentType.JSON).extract().response();
//System.out.println(response.getStatusCode());
// List<String> jsonResponse = response.jsonPath().getList("$");
// System.out.println(jsonResponse);
System.out.println(response.body().asString());
Map<String, String> company = response.jsonPath().getMap("");
System.out.println(company.get("name"));
System.out.println(response.jsonPath().getString("name"));
}
}
| true |
b4ed576175d29607066af52e78bae9321b612bb1 | Java | OuYang-Single/populay_options | /app/src/main/java/com/pine/populay_options/mvp/model/entity/Message.java | UTF-8 | 1,886 | 2.25 | 2 | [] | no_license | package com.pine.populay_options.mvp.model.entity;
import android.os.Parcel;
import android.os.Parcelable;
import com.pine.populay_options.mvp.model.wigth.chatkit.commons.models.IMessage;
import com.pine.populay_options.mvp.model.wigth.chatkit.commons.models.IUser;
import com.pine.populay_options.mvp.model.wigth.chatkit.commons.models.MessageContentType;
import java.util.Date;
public class Message implements MessageContentType, Parcelable {
private String Id;
private String Text;
private Users User;
private Date CreatedAt;
public Message(){}
protected Message(Parcel in) {
Id = in.readString();
Text = in.readString();
User = in.readParcelable(Users.class.getClassLoader());
}
public static final Creator<Message> CREATOR = new Creator<Message>() {
@Override
public Message createFromParcel(Parcel in) {
return new Message(in);
}
@Override
public Message[] newArray(int size) {
return new Message[size];
}
};
public void setText(String text) {
Text = text;
}
public void setUser(Users user) {
User = user;
}
public void setCreatedAt(Date createdAt) {
CreatedAt = createdAt;
}
@Override
public String getId() {
return Id;
}
@Override
public String getText() {
return Text;
}
@Override
public IUser getUser() {
return User;
}
@Override
public Date getCreatedAt() {
return CreatedAt;
}
public void setId(String Id){
this.Id=Id;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(Id);
dest.writeString(Text);
dest.writeParcelable(User, flags);
}
}
| true |
3224266a15a40ad536012a23de609bdcb4e33dfe | Java | OmarJiRa/pw-icons | /icons/src/main/java/pe/edu/upc/icons/services/impl/PostServiceImpl.java | UTF-8 | 1,132 | 2.203125 | 2 | [] | no_license | package pe.edu.upc.icons.services.impl;
import java.io.Serializable;
import java.util.List;
import java.util.Optional;
import javax.inject.Inject;
import pe.edu.upc.icons.models.entities.Post;
import pe.edu.upc.icons.models.repositories.PostRepository;
import pe.edu.upc.icons.services.PostService;
public class PostServiceImpl implements PostService, Serializable {
private static final long serialVersionUID = 1L;
@Inject
private PostRepository postRepository;
@Override
public Post save(Post entity) throws Exception {
return postRepository.save(entity);
}
@Override
public Post update(Post entity) throws Exception {
return postRepository.update(entity);
}
@Override
public void deleteById(Integer id) throws Exception {
postRepository.deleteById(id);
}
@Override
public Optional<Post> findById(Integer id) throws Exception {
return postRepository.findById(id);
}
@Override
public List<Post> findAll() throws Exception {
return postRepository.findAll();
}
@Override
public List<Post> findByNombre(String nombre) throws Exception {
return postRepository.findByNombre(nombre);
}
}
| true |
c485666da67c137f8b59a4674cbb3bf3ca4e9048 | Java | xMlex/l2phoenix-epilogue | /java/l2p/gameserver/clientpackets/RequestExitPartyMatchingWaitingRoom.java | UTF-8 | 475 | 2.1875 | 2 | [] | no_license | package l2p.gameserver.clientpackets;
import l2p.gameserver.instancemanager.PartyRoomManager;
import l2p.gameserver.model.L2Player;
/**
* Format: (ch)
*/
public class RequestExitPartyMatchingWaitingRoom extends L2GameClientPacket
{
@Override
public void readImpl()
{}
@Override
public void runImpl()
{
L2Player activeChar = getClient().getActiveChar();
if(activeChar == null)
return;
PartyRoomManager.getInstance().removeFromWaitingList(activeChar);
}
} | true |
8bae25f94a7bda9c3a912f0891b69bfbeab41585 | Java | IsaacSamuel/CIS2168 | /lab3/Node.java | UTF-8 | 316 | 2.90625 | 3 | [] | no_license |
public class Node<E> {
E element;
Node<E> next;
public Node() {
this.element = null;
this.next = null;
}
public Node(E e) {
this.element = e;
this.next = null;
}
public E getElement() {
return this.element;
}
public void setElement(E element) {
this.element= element;
}
} | true |
684efeea102ba7c8f63914c1e67cff66c7f4df65 | Java | akshaypatil1411/training_project | /08_Project_LMS/src/com/montran/pojo/Member.java | UTF-8 | 1,515 | 2.5 | 2 | [] | no_license | package com.montran.pojo;
import javax.persistence.Entity;
import javax.persistence.Id;
@Entity(name = "member_master")
public class Member {
@Id
private String member_code;
private String member_type;
private String member_name;
private int no_of_books_issued;
public Member() {
// TODO Auto-generated constructor stub
}
public Member(String member_code, String member_type, String member_name, int no_of_books_issued) {
super();
this.member_code = member_code;
this.member_type = member_type;
this.member_name = member_name;
this.no_of_books_issued = no_of_books_issued;
}
public String getMember_code() {
return member_code;
}
public void setMember_code(String member_code) {
this.member_code = member_code;
}
public String getMember_type() {
return member_type;
}
public void setMember_type(String member_type) {
this.member_type = member_type;
}
public String getMember_name() {
return member_name;
}
public void setMember_name(String member_name) {
this.member_name = member_name;
}
public int getNo_of_books_issued() {
return no_of_books_issued;
}
public void setNo_of_books_issued(int no_of_books_issued) {
this.no_of_books_issued = no_of_books_issued;
}
@Override
public String toString() {
return "Member [member_code=" + member_code + ", member_type=" + member_type + ", member_name=" + member_name
+ ", no_of_books_issued=" + no_of_books_issued + "]";
}
}
| true |
e7958d25b54e7277674ed75ca38dfcb23c814f79 | Java | pntalari/Maven.Quiz3 | /src/main/java/rocks/zipcode/io/quiz3/fundamentals/PigLatinGenerator.java | UTF-8 | 1,573 | 3.421875 | 3 | [] | no_license | package rocks.zipcode.io.quiz3.fundamentals;
/**
* @author leon on 09/12/2018.
*/
public class PigLatinGenerator {
public String translate(String str) {
String[] arr = str.split(" ");
StringBuilder builder = new StringBuilder();
// String strRet = "";
for (int i = 0; i < arr.length - 1; i++) {
String word = arr[i];
if (VowelUtils.startsWithVowel(word)) {
builder.append(word + "way" + " ");
} else {
Integer index = VowelUtils.getIndexOfFirstVowel(arr[i]);
if (index == null) {
builder.append(word + "ay" + " ");
} else {
String beginning = word.substring(0, index);
String ending = word.substring(index);
String finalWord = ending + beginning + "ay";
builder.append(finalWord + " ");
}
}
}
builder.deleteCharAt(builder.length());
return builder.toString();
}
// Integer index = VowelUtils.getIndexOfFirstVowel(arr[i]);
// if (index != null) {
// if (VowelUtils.startsWithVowel(arr[i])) {
// strRet += arr[i] + "way";
//
// } else {
// strRet += arr[i].substring(index) + arr[i].substring(0, index) + "ay";
//
// }
// } else {
// strRet += arr[i] + "ay";
//
// }
// }
// return strRet;
}
| true |
2ed85ba4b4c170c7211cf0fa43f562fdc951185a | Java | hugoaguirre11/Tare3HugoAguirre | /src/test/java/pages/MainPage.java | UTF-8 | 287 | 1.742188 | 2 | [] | no_license | package pages;
import control.Button;
import org.openqa.selenium.By;
public class MainPage {
public Button singUpFreeButton= new Button(By.xpath("//*[@id=\"__next\"]/div/main/div[1]/header/nav/div/ul[2]/li[2]/a"),"[singUp Free] Button on Main Page");
public MainPage(){}
}
| true |
aea8e096511e44ab12940c3f864eecb174af8998 | Java | AgnieszkaCicha/Magazyn-meble | /src/main/java/pl/agnieszkacicha/magazyn/model/AGD.java | UTF-8 | 634 | 2.875 | 3 | [] | no_license | package pl.agnieszkacicha.magazyn.model;
public class AGD extends Product {
private Double power;
public AGD(int code, String name, int pieces, double price, Double power) {
super(code, name, pieces, price);
this.power = power;
}
public AGD(Double power) {
this.power = power;
}
public Double getPower() {
return power;
}
public void setPower(Double power) {
this.power = power;
}
@Override
public String toString() {
return "AGD{" +
super.toString() +
", power=" + power +
'}';
}
}
| true |
4f486b2c57c7d3518a16dbb43670ff39d4b0da5b | Java | numbnet/icepdf_FULL-versii | /icepdf-5.1.1_P02/icepdf/examples/applet/ViewerApplet.java | UTF-8 | 5,861 | 2.34375 | 2 | [
"Apache-2.0"
] | permissive | /*
* Copyright 2006-2014 ICEsoft Technologies 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.
*/
import org.icepdf.ri.common.MyAnnotationCallback;
import org.icepdf.ri.common.SwingController;
import org.icepdf.ri.common.SwingViewBuilder;
import javax.swing.*;
import java.awt.*;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* <p>Use this applet on your site to launch the PDF Viewer in a browser.</p>
* <p/>
* <p>A sample HTML applet tag for starting this class:</p>
* <p/>
* <pre>
* <applet
* width="800"
* height="600"
* archive="icepdf-core.jar, icepdf-viewer.jar, icepdf-applet.jar"
* title="ICEpdf Applet Example" >
* <param name="type" value="application/x-java-applet;jpi-version=1.5.0" />
* <param name="java_arguments" value="-Xmx128m" />
* <param name="classloader_cache" value="false" />
* <param name="url" value="http://www.icepdf.org/pdf/ICEpdf-Datasheet.pdf" />
* <param name="code" value="ViewerApplet.class" />
* </applet>
* </pre>
* <p/>
* <p><b>Note:</b><br/>
* If you would like to load none local URLs, this class will have to
* be added to a signed jar.</p>
*
* @since 1.0
*/
public class ViewerApplet extends JApplet {
private static final Logger logger =
Logger.getLogger(ViewerApplet.class.toString());
SwingController controller;
public ViewerApplet() throws HeadlessException {
super();
}
/**
* Creates an Applet which contains the default viewer.
*/
public void init() {
logger.fine("Initializing ICEpdf Viewer Applet");
try {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
// create a controller and a swing factory
controller = new SwingController();
SwingViewBuilder factory = new SwingViewBuilder(controller);
// add interactive mouse link annotation support via callback
controller.getDocumentViewController().setAnnotationCallback(
new org.icepdf.ri.common.MyAnnotationCallback(
controller.getDocumentViewController()));
// build viewer component and add it to the applet content pane.
MyAnnotationCallback myAnnotationCallback = new MyAnnotationCallback(
controller.getDocumentViewController());
controller.getDocumentViewController().setAnnotationCallback(myAnnotationCallback);
// build the viewer with a menubar
getContentPane().setLayout(new BorderLayout());
getContentPane().add(factory.buildViewerPanel(), BorderLayout.CENTER);
getContentPane().add(factory.buildCompleteMenuBar(), BorderLayout.NORTH);
}
});
} catch (Exception e) {
logger.log(Level.SEVERE, "Error creating GUI", e);
}
}
public void start() {
logger.fine("Starting ICEpdf Viewer Applet");
// Open a url if available
final String url = getParameter("url");
// resolve the url
try {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
URL documentURL = null;
try {
documentURL = new URL(url);
} catch (MalformedURLException e) {
e.printStackTrace();
}
// Now that the GUI is all in place, we can try opening a PDF
if (documentURL != null) {
controller.openDocument(documentURL);
}
}
});
} catch (Exception e) {
logger.log(Level.SEVERE, "Loading file didn't successfully complete", e);
}
}
public void stop() {
logger.fine("Stopping ICEpdf Viewer Applet");
// closing document.
try {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
if (controller != null) {
controller.closeDocument();
}
}
});
} catch (Exception e) {
logger.log(Level.SEVERE, "Closing file didn't successfully complete", e);
}
}
/**
* Dispose of the document.
*/
public void destroy() {
logger.fine("Distroying ICEpdf Viewer Applet");
try {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
// dispose the viewer component
if (controller != null) {
controller.dispose();
controller = null;
}
getContentPane().removeAll();
}
});
} catch (Exception e) {
logger.log(Level.SEVERE,
"Destroying ICEpdf controller didn't successfully complete", e);
}
}
}
| true |
7a58200d95a763950c3c917955436965911e0a00 | Java | ToniCors/Yaspl3 | /Yaspl3/src/parser/Visitor.java | UTF-8 | 89 | 2.109375 | 2 | [] | no_license | package parser;
public interface Visitor {
public void visit(Visitable v);
}
| true |
f01233383caebbb1502a3c7e27e2b75392f946dc | Java | nfOlguin/test-crud-spring_boot-react | /spring-boot-mysql-crud/src/main/java/com/coopeuch/springbootmysqlcrud/service/impl/TaskServiceImpl.java | UTF-8 | 857 | 2.203125 | 2 | [] | no_license | package com.coopeuch.springbootmysqlcrud.service.impl;
import com.coopeuch.springbootmysqlcrud.model.Task;
import com.coopeuch.springbootmysqlcrud.repo.TaskRepo;
import com.coopeuch.springbootmysqlcrud.service.TaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Optional;
@Service
public class TaskServiceImpl implements TaskService {
@Autowired
private TaskRepo taskRepo;
@Override
public Task save(Task task) {
return taskRepo.save(task);
}
@Override
public Iterable<Task> findAll() {
return taskRepo.findAll();
}
@Override
public Optional<Task> findById(Long id) {
return taskRepo.findById(id);
}
@Override
public void deleteById(Long id) {
taskRepo.deleteById(id);
}
}
| true |
9e1dd72018ef14e173d5b5cce2e63bc7dad50038 | Java | heddyzhang/tt1 | /WEB-INF/src/kit/edi/ReinyuAnnai/EdiReinyuAnnai_EditFunction.java | UTF-8 | 4,964 | 1.96875 | 2 | [] | no_license | package kit.edi.ReinyuAnnai;
import static kit.edi.ReinyuAnnai.IEdiReinyuAnnai.*;
import static fb.com.IKitComConst.EDI_SYUKKA_PARTNER_KB_SDN;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import fb.com.ComBatchUtil;
import fb.com.exception.KitComException;
import fb.inf.KitFunction;
import fb.inf.exception.KitException;
/**
* 99902_1_1 戻入案内送信
*
* @author Tuneduka
*
*/
public class EdiReinyuAnnai_EditFunction extends KitFunction {
/** シリアルID */
private static final long serialVersionUID = -505663954367544840L;
/** 編集フォーム */
private EdiReinyuAnnai_EditForm editForm = null;
/** クラス名. */
private static String className__ = EdiReinyuAnnai_EditFunction.class.getName();
/**
* トランザクション制御を行うかどうかを示すフラグ. trueの場合トランザクション制御を行う. falseの場合トランザクション制御を行なわない.
*
* @see #isTransactionalFunction ()
*/
private static final boolean isTransactionalFunction = true;
/**
* Transaction制御フラグを返す.
*
* @return true(制御を行う) or false(制御を行わない)
*/
@Override
protected boolean isTransactionalFunction() {
return isTransactionalFunction;
}
/**
* クラス名を取得.
*
* @return クラス名
*/
@Override
protected String getFunctionName() {
return className__;
}
/**
* コンストラクタです.
*
* @param mapping
* paramName
* @param form
* paramName
* @param request
* paramName
* @param response
* paramName
*/
public EdiReinyuAnnai_EditFunction(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
super(mapping, form, request, response);
reset();
}
/**
* フィールドを初期化する
*/
private void reset(){
this.editForm = null;
}
// -----------------------------------------
// search & set page data
// -----------------------------------------
@Override
public String execute_() throws KitException {
String sForwardPage = FORWARD_SUCCESS;
// 編集フォームを取得する
this.editForm = (EdiReinyuAnnai_EditForm) form_;
// 呪文:リクエストタイプが無い場合にExceptionを発行させる
this.editForm.checkHasReqType();
// バッチ起動共通クラス
ComBatchUtil comBatchUtil = new ComBatchUtil(getComUserSession(), getDatabase(), isTransactionalFunction(), getActionErrors());
// --------------------------------------------------------
// 入力チェック
// -------------------------------------------------------
// チェックサービスを初期化
EdiReinyuAnnai_CheckService checkServ = new EdiReinyuAnnai_CheckService(
getComUserSession(), getDatabase(), isTransaction(), getActionErrors());
// 呼出時チェックを実行
if (!checkServ.validateSearch(editForm)) {
return sForwardPage;
}
// --------------------------------------------------------
// ボタン押下(リクエストタイプ)に応じた処理を
// 実装し、結果に応じてeditFormを設定する
// -------------------------------------------------------
// ----------------------------------------------------
// 戻入案内送信
// ----------------------------------------------------
if (REQ_TYPE_IKKATU.equals(this.editForm.getReqType())) {
try {
//ジョブネット起動 一括
comBatchUtil.startJobnet(JOB_TYPE_IKKATU_JOBNET,
JOB_TYPE_IKKATU_MSG,
"from_date="+this.editForm.getFromDt(),
"to_date="+this.editForm.getToDt(),
"edi_group_cd="+this.editForm.getSakuseitaisyouKbn());
} catch (Exception e) {
return FORWARD_FAIL;
}
} else if (REQ_TYPE_REINYUANNAIEDI.equals(this.editForm.getReqType())) {
if(editForm.getSousinsakiKbn().equals(EDI_SYUKKA_PARTNER_KB_SDN)){
try {
//ジョブネット起動 戻入案内 送信
comBatchUtil.startJobnet(JOB_TYPE_REINYUANNAIEDI_JOBNET,
JOB_TYPE_REINYUANNAIEDI_MSG);
} catch (Exception e) {
return FORWARD_FAIL;
}
} else {
throw new KitComException("$$$ This form has no reqType . $$$");
}
// ----------------------------------------------------
// その他エラー
// ----------------------------------------------------
} else {
throw new KitComException("$$$ This form has no reqType . $$$");
}
setRequest(ONLOAD_POPUP_URL,JOB_STATUS_POPUP_URL);
return sForwardPage;
}
}
| true |
ec5ca60d9640c7ca4673252242e3b3864017b51a | Java | ayubjuda/sdp-sp3-2021-repo-code | /Help-Sessions/0210/src/demo/MyProduct.java | UTF-8 | 1,124 | 3.40625 | 3 | [] | no_license | package demo;
import java.util.Objects;
public class MyProduct implements Product {
private String description;
private float price;
public MyProduct(String description, float price) {
this.description = description;
this.price = price;
}
@Override
public String getDescription() {
return description;
}
@Override
public void setDescription(String description) {
this.description = description;
}
@Override
public float getPrice() {
return price;
}
@Override
public void setPrice(float price) {
this.price = price;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Product)) return false;
Product myProduct = (Product) o;
return Float.compare(myProduct.getPrice(), getPrice()) == 0 && getDescription().equals(myProduct.getDescription());
}
@Override
public int hashCode() {
return Objects.hash(getDescription(), getPrice());
}
@Override
public String toString() {
return "MyProduct{" +
"description='" + description + '\'' +
", price=" + price +
'}';
}
}
| true |
f8f0df9abd61d1bed5bc46f83289160a1edeb893 | Java | gaoyw/metaData | /src/main/java/com/meta/ffmpeg/model/VideoMetadata.java | UTF-8 | 991 | 2.328125 | 2 | [] | no_license | package com.meta.ffmpeg.model;
/**
* 视频元数据
*
* @ClassName: VideoMetadata
* @author gaoy
* @date 2018年12月28日 下午4:06:14
*/
public class VideoMetadata {
private String videoCodedFormat; // 编码格式
private String videoFormat; // 视频格式
private String videoResolution; // 分辨率
private String Duration; // 播放时长;
public String getVideoCodedFormat() {
return videoCodedFormat;
}
public void setVideoCodedFormat(String videoCodedFormat) {
this.videoCodedFormat = videoCodedFormat;
}
public String getVideoFormat() {
return videoFormat;
}
public void setVideoFormat(String videoFormat) {
this.videoFormat = videoFormat;
}
public String getVideoResolution() {
return videoResolution;
}
public void setVideoResolution(String videoResolution) {
this.videoResolution = videoResolution;
}
public String getDuration() {
return Duration;
}
public void setDuration(String duration) {
Duration = duration;
}
}
| true |
6875eb841361c2db0ab01bd965386f5c0a2cc839 | Java | coutomariel/orange-talents-05-template-casa-do-codigo | /src/main/java/br/com/zupacademy/mariel/casadocodigo/cliente/ClientesController.java | UTF-8 | 1,317 | 2.046875 | 2 | [
"Apache-2.0"
] | permissive | package br.com.zupacademy.mariel.casadocodigo.cliente;
import javax.transaction.Transactional;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import br.com.zupacademy.mariel.casadocodigo.estado.Estado;
import br.com.zupacademy.mariel.casadocodigo.estado.EstadosRepository;
import br.com.zupacademy.mariel.casadocodigo.pais.Pais;
import br.com.zupacademy.mariel.casadocodigo.pais.PaisesRepository;
@RestController
@RequestMapping("/clientes")
public class ClientesController {
@Autowired
private ClientesRepository clientesRepository;
@Autowired
private EstadosRepository estadosRepository;
@Autowired
private PaisesRepository paisesRepository;
@PostMapping
@Transactional
public Long criarCliente(@RequestBody @Valid ClienteRequestDto request) {
Pais pais = paisesRepository.findById(request.getPaisId()).get();
Estado estado = estadosRepository.findById(request.getEstadoId()).get();
Cliente clienteSalvo = clientesRepository.save(request.toEntity(pais, estado));
return clienteSalvo.getId();
}
}
| true |
0732349e851cbe456e90e1123c3cb0a79645fa16 | Java | amitkmrghosh/spring | /batch/spring-batch-experiments-master/chapter08/src/main/java/kr/spring/batch/chapter08/retry/DiscountsTasklet.java | UTF-8 | 826 | 2.21875 | 2 | [
"Unlicense"
] | permissive | package kr.spring.batch.chapter08.retry;
import org.springframework.batch.core.StepContribution;
import org.springframework.batch.core.scope.context.ChunkContext;
import org.springframework.batch.core.step.tasklet.Tasklet;
import org.springframework.batch.repeat.RepeatStatus;
import java.util.List;
/**
* kr.spring.batch.chapter08.retry.DiscountsTasklet
*
* @author 배성혁 sunghyouk.bae@gmail.com
* @since 13. 8. 10. 오후 5:16
*/
public class DiscountsTasklet implements Tasklet {
private DiscountService discountService;
private DiscountsHolder discountsHolder;
@Override
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
List<Discount> discounts = discountService.getDiscounts();
discountsHolder.setDiscounts(discounts);
return RepeatStatus.FINISHED;
}
}
| true |
945a24af60f24909c7d58f24222d553fd98e509a | Java | nitinguptaetz/schedfoxnitin | /schedfox/Schedfox/src/main/java/rmischedule/corporate_comm/CreateNewCorporateCommunicator.java | UTF-8 | 9,523 | 1.78125 | 2 | [] | no_license | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* CreateNewCorporateCommunicator.java
*
* Created on Oct 26, 2010, 10:33:35 AM
*/
package rmischedule.corporate_comm;
import java.util.Date;
import javax.swing.JOptionPane;
import rmischedule.data_connection.Connection;
import rmischedule.main.Main_Window;
import rmischedule.messaging.email.SchedfoxEmail;
import rmischedule.schedule.Schedule_View_Panel;
import schedfoxlib.model.util.Record_Set;
import schedfoxlib.model.Client;
import schedfoxlib.model.Problemsolver;
import rmischeduleserver.mysqlconnectivity.queries.client.get_corporate_communicator_contact_query;
import rmischeduleserver.mysqlconnectivity.queries.problem_solver.save_problem_for_client_query;
/**
*
* @author user
*/
public class CreateNewCorporateCommunicator extends javax.swing.JDialog {
private Schedule_View_Panel svp;
private Client client;
private CorporateCommunicator corporateCommunicator;
/** Creates new form CreateNewCorporateCommunicator */
public CreateNewCorporateCommunicator(java.awt.Frame parent, CorporateCommunicator corpCommunicator,
Schedule_View_Panel svp, boolean modal, Client clientobj) {
super(parent, modal);
this.svp = svp;
this.client = clientobj;
this.corporateCommunicator = corpCommunicator;
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() {
jPanel3 = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
jPanel5 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jPanel2 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
problemTxt = new javax.swing.JTextArea();
jPanel1 = new javax.swing.JPanel();
cancelBtn = new javax.swing.JButton();
jPanel4 = new javax.swing.JPanel();
okBtn = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("");
getContentPane().setLayout(new javax.swing.BoxLayout(getContentPane(), javax.swing.BoxLayout.Y_AXIS));
jPanel3.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 8, 1, 8));
jPanel3.setMaximumSize(new java.awt.Dimension(7000005, 75));
jPanel3.setMinimumSize(new java.awt.Dimension(100, 75));
jPanel3.setPreferredSize(new java.awt.Dimension(396, 75));
jPanel3.setLayout(new java.awt.BorderLayout());
jLabel2.setFont(new java.awt.Font("sansserif", 1, 32)); // NOI18N
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel2.setText("Corporate Communicator");
jLabel2.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jPanel3.add(jLabel2, java.awt.BorderLayout.NORTH);
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 414, Short.MAX_VALUE)
);
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 12, Short.MAX_VALUE)
);
jPanel3.add(jPanel5, java.awt.BorderLayout.CENTER);
jLabel1.setFont(new java.awt.Font("sansserif", 1, 14)); // NOI18N
jLabel1.setForeground(new java.awt.Color(32, 25, 101));
jLabel1.setText("Communication makes us both better. Tell us how we can help.");
jPanel3.add(jLabel1, java.awt.BorderLayout.SOUTH);
getContentPane().add(jPanel3);
jPanel2.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 8, 8, 8));
jPanel2.setLayout(new java.awt.GridLayout(1, 0));
problemTxt.setColumns(20);
problemTxt.setLineWrap(true);
problemTxt.setRows(5);
problemTxt.setWrapStyleWord(true);
jScrollPane1.setViewportView(problemTxt);
jPanel2.add(jScrollPane1);
getContentPane().add(jPanel2);
jPanel1.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 8, 1, 8));
jPanel1.setMaximumSize(new java.awt.Dimension(32767, 35));
jPanel1.setMinimumSize(new java.awt.Dimension(0, 35));
jPanel1.setPreferredSize(new java.awt.Dimension(413, 35));
jPanel1.setLayout(new javax.swing.BoxLayout(jPanel1, javax.swing.BoxLayout.LINE_AXIS));
cancelBtn.setText("Cancel");
cancelBtn.setMaximumSize(new java.awt.Dimension(90, 30));
cancelBtn.setMinimumSize(new java.awt.Dimension(90, 23));
cancelBtn.setPreferredSize(new java.awt.Dimension(90, 23));
cancelBtn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cancelBtnActionPerformed(evt);
}
});
jPanel1.add(cancelBtn);
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 234, Short.MAX_VALUE)
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 33, Short.MAX_VALUE)
);
jPanel1.add(jPanel4);
okBtn.setText("Save");
okBtn.setMaximumSize(new java.awt.Dimension(90, 30));
okBtn.setMinimumSize(new java.awt.Dimension(90, 23));
okBtn.setPreferredSize(new java.awt.Dimension(90, 23));
okBtn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
okBtnActionPerformed(evt);
}
});
jPanel1.add(okBtn);
getContentPane().add(jPanel1);
java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
setBounds((screenSize.width-438)/2, (screenSize.height-291)/2, 438, 291);
}// </editor-fold>//GEN-END:initComponents
private void cancelBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelBtnActionPerformed
this.dispose();
}//GEN-LAST:event_cancelBtnActionPerformed
private void okBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okBtnActionPerformed
Connection myConn = svp.getConnection();
long millis = myConn.getServerTimeMillis();
int client_id = Integer.parseInt(Main_Window.parentOfApplication.myUser.getUserId());
Problemsolver problem = new Problemsolver();
problem.setProblem(this.problemTxt.getText());
problem.setPsDate(new Date(millis));
problem.setClientId(client_id);
save_problem_for_client_query saveQuery = new save_problem_for_client_query();
saveQuery.update(problem);
myConn.prepQuery(saveQuery);
myConn.executeQuery(saveQuery);
try {
Main_Window.parentOfApplication.myUser.setEmail("notify@schedfox.com");
new SchedfoxEmail("New Corporate Communicator for " + client.getClientName(), this.problemTxt.getText(), getDMToNotify(client_id), false);
} catch (Exception e) {
JOptionPane.showMessageDialog(Main_Window.parentOfApplication, "Error",
"Could not notify DM's via email. " + e.getMessage(), JOptionPane.ERROR_MESSAGE);
} finally {
corporateCommunicator.refreshProblems(svp);
this.dispose();
}
}//GEN-LAST:event_okBtnActionPerformed
private String[] getDMToNotify(int client_id) {
get_corporate_communicator_contact_query contactQuery = new get_corporate_communicator_contact_query();
contactQuery.setPreparedStatement(new Object[]{client_id});
Record_Set rst = svp.getConnection().executeQuery(contactQuery);
String[] myVal = new String[rst.length()];
if (rst.length() == 0) {
myVal = new String[5];
myVal[0] = "bmccoy@champ.net";
myVal[1] = "msullivan@champ.net";
myVal[2] = "bsatchell@champ.net";
myVal[3] = "aalonzo@champ.net";
myVal[4] = "dmorong@champ.net";
} else {
for (int u = 0; u < rst.length(); u++) {
myVal[u] = rst.getString("user_email");
rst.moveNext();
}
}
return myVal;
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton cancelBtn;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JButton okBtn;
private javax.swing.JTextArea problemTxt;
// End of variables declaration//GEN-END:variables
}
| true |
06a3cbb0fbc915cd162b07837f534c4a0ffbc55c | Java | ronyjdiaz/bottle-flip | /app/src/main/java/com/slashmobility/bottleflip_android/fragments/RankingFragment.java | UTF-8 | 1,324 | 2.078125 | 2 | [] | no_license | package com.slashmobility.bottleflip_android.fragments;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.slashmobility.bottleflip_android.R;
import com.slashmobility.bottleflip_android.adapters.RankingAdapter;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* Created by Edgar-W10 on 8/4/2017.
*/
public class RankingFragment extends BaseFragment {
@BindView(R.id.rv_ranking) RecyclerView rv_ranking;
private RankingAdapter mAdapter;
private View mView;
private LinearLayoutManager mLinearLayoutManager;
public RankingFragment() {}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
mView = inflater.inflate(R.layout.fragment_ranking, container, false);
ButterKnife.bind(this, mView);
getViews();
return mView;
}
private void getViews(){
mLinearLayoutManager = new LinearLayoutManager(getContext());
rv_ranking.setLayoutManager(mLinearLayoutManager);
mAdapter = new RankingAdapter();
rv_ranking.setAdapter(mAdapter);
}
}
| true |
9d65af3e4b33cc76c7fe3ff6ff2060b232c9a59e | Java | Dudoserg/compiler | /src/main/java/main/Lab4/TreeNext/_NextNodeBase.java | UTF-8 | 357 | 2.453125 | 2 | [] | no_license | package main.Lab4.TreeNext;
import main.SavePoint;
public class _NextNodeBase {
public Integer triad_number = -9999;
public String triad_lexem;
public SavePoint savePoint;
public _NextNodeBase(SavePoint savePoint) {
this.savePoint = savePoint;
}
public boolean isTriad(){
return this.triad_number >= 0;
}
}
| true |
2a05bd16cd5709d8a8d96ce74a5667a9b37b4a56 | Java | dykdykdyk/decompileTools | /android/nut-dex2jar.src/com/baidu/android/pushservice/message/PublicMsg$2.java | UTF-8 | 561 | 1.71875 | 2 | [] | no_license | package com.baidu.android.pushservice.message;
import android.os.Parcel;
import android.os.Parcelable.Creator;
final class PublicMsg$2
implements Parcelable.Creator<PublicMsg>
{
public final PublicMsg a(Parcel paramParcel)
{
return new PublicMsg(paramParcel);
}
public final PublicMsg[] a(int paramInt)
{
return new PublicMsg[paramInt];
}
}
/* Location: C:\crazyd\work\ustone\odm2016031702\baidu\android\nut-dex2jar.jar
* Qualified Name: com.baidu.android.pushservice.message.PublicMsg.2
* JD-Core Version: 0.6.2
*/ | true |
9b029014fb1a210c3a39bbc1715d505521b2b89b | Java | xl8or/- | /projs./apk/com.facebook.katana-1.7.2/src/com/facebook/katana/activity/media/PhotoUploader.java | UTF-8 | 4,894 | 1.851563 | 2 | [] | no_license | // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)
// Source File Name: PhotoUploader.java
package com.facebook.katana.activity.media;
import android.app.Activity;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Environment;
import com.facebook.katana.util.Log;
import com.facebook.katana.util.Toaster;
import java.io.File;
// Referenced classes of package com.facebook.katana.activity.media:
// UploadPhotoActivity
public class PhotoUploader
{
public PhotoUploader(Activity activity, long l, int i, int j)
{
mActivity = activity;
mAlbumId = null;
mProfileId = l;
mTakeCameraPhotoRequestCode = i;
mPickExistingPhotoRequestCode = j;
}
public PhotoUploader(Activity activity, String s, int i, int j)
{
mActivity = activity;
mAlbumId = s;
mProfileId = -1L;
mTakeCameraPhotoRequestCode = i;
mPickExistingPhotoRequestCode = j;
}
public Dialog createDialog()
{
CharSequence acharsequence[] = new CharSequence[2];
acharsequence[0] = mActivity.getText(0x7f0a0210);
acharsequence[1] = mActivity.getText(0x7f0a020f);
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(mActivity);
builder.setTitle(0x7f0a0212);
builder.setItems(acharsequence, new android.content.DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialoginterface, int i)
{
i;
JVM INSTR tableswitch 0 1: default 24
// 0 31
// 1 75;
goto _L1 _L2 _L3
_L1:
dialoginterface.dismiss();
return;
_L2:
Intent intent1 = new Intent("android.intent.action.PICK", android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
intent1.setType("image/*");
mActivity.startActivityForResult(intent1, mPickExistingPhotoRequestCode);
continue; /* Loop/switch isn't completed */
_L3:
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
intent.putExtra("output", PhotoUploader.TEMP_PHOTO_URI);
mActivity.startActivityForResult(intent, mTakeCameraPhotoRequestCode);
if(true) goto _L1; else goto _L4
_L4:
}
final PhotoUploader this$0;
{
this$0 = PhotoUploader.this;
super();
}
}
);
return builder.create();
}
public void onActivityResult(int i, int j, Intent intent)
{
if(i != mTakeCameraPhotoRequestCode) goto _L2; else goto _L1
_L1:
if(TEMP_PHOTO_FILE.exists()) goto _L4; else goto _L3
_L3:
Toaster.toast(mActivity, 0x7f0a0205);
_L8:
return;
_L4:
Intent intent1;
intent1 = new Intent(mActivity, com/facebook/katana/activity/media/UploadPhotoActivity);
intent1.setAction("com.facebook.katana.upload.bitmap");
intent1.putExtra("android.intent.extra.STREAM", TEMP_PHOTO_URI);
_L6:
intent1.putExtra("extra_album_id", mAlbumId);
intent1.putExtra("extra_profile_id", mProfileId);
if(intent != null)
{
intent1.putExtra("extra_checkin_id", intent.getLongExtra("checkin_id", -1L));
intent1.putExtra("extra_photo_publish", intent.getBooleanExtra("extra_photo_publish", true));
}
mActivity.startActivity(intent1);
continue; /* Loop/switch isn't completed */
_L2:
if(i != mPickExistingPhotoRequestCode)
break; /* Loop/switch isn't completed */
intent1 = new Intent(mActivity, com/facebook/katana/activity/media/UploadPhotoActivity);
intent1.setAction("com.facebook.katana.upload.uri");
intent1.putExtra("android.intent.extra.STREAM", intent.getData());
if(true) goto _L6; else goto _L5
_L5:
Log.e("PhotoUploader", "illegal requestcode");
if(true) goto _L8; else goto _L7
_L7:
}
private static final String PHOTO_FILENAME = "Facebook-photo.jpg";
private static final String TAG = "PhotoUploader";
public static final File TEMP_PHOTO_FILE;
public static final Uri TEMP_PHOTO_URI;
private final Activity mActivity;
private final String mAlbumId;
private final int mPickExistingPhotoRequestCode;
private final long mProfileId;
private final int mTakeCameraPhotoRequestCode;
static
{
TEMP_PHOTO_FILE = new File(Environment.getExternalStorageDirectory(), "Facebook-photo.jpg");
TEMP_PHOTO_URI = Uri.fromFile(TEMP_PHOTO_FILE);
}
}
| true |
7580c818f97bfe1728d21f19c4f18413767b283b | Java | vk2211/RgbConfig | /app/src/main/java/com/color/function/fragment/MainFragment.java | UTF-8 | 4,703 | 2.21875 | 2 | [
"Apache-2.0"
] | permissive | package com.color.function.fragment;
import android.app.Activity;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import com.color.function.colorbean.IdentyColor;
import com.jstelcom.colorshape.R;
import com.jude.easyrecyclerview.EasyRecyclerView;
import java.util.ArrayList;
import java.util.List;
public class MainFragment extends Fragment {
private TouchImageView mConfigImageView;
private TextView mRgbText;
private ColorSettingAdapter mColorSettingAdapter;
private EasyRecyclerView mColorSettingList;
private Bitmap mShotBitmap;
private Button bt_save;
private List<IdentyColor> mList;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_main, container, false);
mConfigImageView = (TouchImageView) view.findViewById(R.id.configImage);
mColorSettingList = (EasyRecyclerView) view.findViewById(R.id.colorSettingList);
mRgbText = (TextView) view.findViewById(R.id.rgbText);
bt_save=(Button)view.findViewById(R.id.save);
bt_save.setOnClickListener(saveRGBOnclickListener);
mConfigImageView.setOnTouchListener(onTouchListener);
LinearLayoutManager m = new LinearLayoutManager(getActivity());
m.setOrientation(LinearLayoutManager.VERTICAL);
mColorSettingList.setLayoutManager(m);
mColorSettingAdapter = new ColorSettingAdapter(getActivity());
mColorSettingAdapter.setOnSettingColorListener(new ColorSettingAdapter.OnSettingColorListener() {
@Override
public void onSettingColor(boolean isSetting) {
mConfigImageView.enableDrag(!isSetting);
}
});
mList=initListdata();
mColorSettingAdapter.addAll(mList);
mColorSettingList.setAdapter(mColorSettingAdapter);
return view;
}
/**
* 保存RGB的值
*/
private View.OnClickListener saveRGBOnclickListener=new View.OnClickListener() {
@Override
public void onClick(View v) {
saveAllRGB(mList);
}
};
/**
* 触屏获取RGB的值
*/
private View.OnTouchListener onTouchListener = new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent event) {
// TODO Auto-generated method stub
int x = (int) event.getX();
int y = (int) event.getY();
int pixel;
if (mShotBitmap != null) {
mShotBitmap.recycle();
mShotBitmap = null;
}
mShotBitmap = shot(mConfigImageView);
if (x <= mShotBitmap.getWidth() && y <= mShotBitmap.getHeight()) {
pixel = mShotBitmap.getPixel(x, y);
int r = (pixel & 0xff0000) >> 16;
int g = (pixel & 0xff00) >> 8;
int b = (pixel & 0xff);
mRgbText.setText("R:" + r + ",G:" + g + ",B:" + b);
int pos = mColorSettingAdapter.getCurrentPos();
if (pos > -1) {
IdentyColor color = mColorSettingAdapter.getItem(pos);
color.update(r, g, b);
mColorSettingAdapter.update(color, pos);
mColorSettingAdapter.notifyItemChanged(pos);
}
}
return false;
}
};
/**
* 初始化ListView 的数据
*
* @return
*/
public List<IdentyColor> initListdata() {
List<IdentyColor> list = new ArrayList<IdentyColor>();
String[] data = {"红色", "绿色", "蓝色", "黄色", "品色", "青色", "黑色", "白色", "底色"};
for (int i = 0; i < data.length; i++) {
IdentyColor baseColor = new IdentyColor(getContext(), data[i]);
baseColor.setRgb(i);
list.add(baseColor);
}
return list;
}
/**
* 保存所有的RGB值
*/
public void saveAllRGB(List<IdentyColor> list){
for (int i=0;i<list.size();i++){
list.get(i).saveRGB(i);
}
}
/**
* 截屏
* @param activity
* @return
*/
private Bitmap shot(Activity activity) {
View view = activity.getWindow().getDecorView();
view.buildDrawingCache();
view.setDrawingCacheEnabled(true);
int x = (int) view.getX();
int y = (int) view.getY();
int w = view.getWidth();
int h = view.getHeight();
Bitmap bmp = Bitmap.createBitmap(view.getDrawingCache(), x, y, w, h);
view.destroyDrawingCache();
return bmp;
}
/**
* 截屏
* @param
* @return
*/
private Bitmap shot(View view) {
view.buildDrawingCache();
view.setDrawingCacheEnabled(true);
int x = (int) view.getX();
int y = (int) view.getY();
int w = view.getWidth();
int h = view.getHeight();
Bitmap bmp = Bitmap.createBitmap(view.getDrawingCache(), x, y, w, h);
view.destroyDrawingCache();
return bmp;
}
}
| true |
cf43762c4f9deaa4520f78306f33082f6d3d92a9 | Java | cha63506/CompSecurity | /weather-widget-source/src/com/vladium/emma/data/IMetadataConstants.java | UTF-8 | 563 | 1.539063 | 2 | [] | no_license | // Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: braces fieldsfirst space lnc
package com.vladium.emma.data;
public interface IMetadataConstants
{
public static final int METHOD_ABSTRACT_OR_NATIVE = 2;
public static final int METHOD_ADDED = 8;
public static final int METHOD_EXCLUDED = 4;
public static final int METHOD_NO_BLOCK_DATA = 14;
public static final int METHOD_NO_LINE_DATA = 15;
public static final int METHOD_NO_LINE_NUMBER_TABLE = 1;
}
| true |
2de8523fc9c56ca382ba98ca31d55d572127ddc8 | Java | ArronHZG/DesignPartternsForJava | /create/Builder/Client.java | UTF-8 | 466 | 2.8125 | 3 | [] | no_license | /** @version: 1.0
* @Description: package Builder;
* @author: Arron
* @date: 2018年10月16日-下午2:45:56
*/
package Builder;
public class Client
{
public static void main(String[] args)
{
Builder builder = new ConcreteBuilder();
Director director = new Director(builder);
director.construct();
Product product = builder.retrieveResult();
System.out.println(product.getPart1());
System.out.println(product.getPart2());
}
}
| true |
d39015037fbef3c5a58be3286507e8c896c549f0 | Java | spring-projects/spring-framework | /spring-test/src/main/java/org/springframework/test/context/support/ApplicationContextInitializerUtils.java | UTF-8 | 3,576 | 2.03125 | 2 | [
"Apache-2.0"
] | permissive | /*
* Copyright 2002-2022 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.test.context.support;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.ContextConfigurationAttributes;
import org.springframework.util.Assert;
/**
* Utility methods for working with
* {@link ApplicationContextInitializer ApplicationContextInitializers}.
*
* <p>Although {@code ApplicationContextInitializerUtils} was first introduced
* in Spring Framework 4.1, the initial implementations of methods in this class
* were based on the existing code base in {@code ContextLoaderUtils}.
*
* @author Sam Brannen
* @since 4.1
* @see ContextConfiguration#initializers
*/
abstract class ApplicationContextInitializerUtils {
private static final Log logger = LogFactory.getLog(ApplicationContextInitializerUtils.class);
/**
* Resolve the set of merged {@code ApplicationContextInitializer} classes for the
* supplied list of {@code ContextConfigurationAttributes}.
* <p>Note that the {@link ContextConfiguration#inheritInitializers inheritInitializers}
* flag of {@link ContextConfiguration @ContextConfiguration} will be taken into
* consideration. Specifically, if the {@code inheritInitializers} flag is set to
* {@code true} for a given level in the class hierarchy and enclosing class
* hierarchy represented by the provided configuration attributes, context
* initializer classes defined at the given level will be merged with those
* defined in higher levels of the class hierarchy or enclosing class hierarchy.
* @param configAttributesList the list of configuration attributes to process; must
* not be {@code null} or <em>empty</em>; must be ordered <em>bottom-up</em>
* (i.e., as if we were traversing up the class hierarchy or enclosing class hierarchy)
* @return the set of merged context initializer classes, including those from
* superclasses if appropriate (never {@code null})
* @since 3.2
*/
static Set<Class<? extends ApplicationContextInitializer<?>>> resolveInitializerClasses(
List<ContextConfigurationAttributes> configAttributesList) {
Assert.notEmpty(configAttributesList, "ContextConfigurationAttributes List must not be empty");
Set<Class<? extends ApplicationContextInitializer<?>>> initializerClasses = new LinkedHashSet<>();
for (ContextConfigurationAttributes configAttributes : configAttributesList) {
if (logger.isTraceEnabled()) {
logger.trace("Processing context initializers for configuration attributes " + configAttributes);
}
Collections.addAll(initializerClasses, configAttributes.getInitializers());
if (!configAttributes.isInheritInitializers()) {
break;
}
}
return initializerClasses;
}
}
| true |
e3244fd69b9e987cef32d9a7f8db8337c3c82982 | Java | ImanRostam/OOP-Test-2019-Starter | /src/ie/tudublin/UI.java | UTF-8 | 1,715 | 2.9375 | 3 | [] | no_license | package ie.tudublin;
import java.awt.Color;
import java.util.ArrayList;
import processing.core.PApplet;
import processing.data.Table;
import processing.data.TableRow;
public class UI extends PApplet
{
ArrayList<Colour> colour = new ArrayList<Colour>();
ArrayList<Resistor> resistor = new ArrayList<Resistor>();
public void separate(int value)
{
int hundreds = (value / 100);
int tens = (value - (hundreds * 100)) / 10;
int ones = value - ((hundreds * 100) + (tens * 10));
print(hundreds + ",");
print(tens + ",");
println(ones);
}
public void settings()
{
size(500, 800);
separate(381);
separate(1);
separate(92);
}
public void loadColours()
{
Table table = loadTable("colours.csv", "header");
for(TableRow row: table.rows())
{
Colour colour = new Colour(row);
colour.add(colour);
}
}
public void loadResistors()
{
Table table = loadTable("resistors.csv", "header");
for(TableRow row: table.rows())
{
Resistor resistor = new Resistor(12);
System.out.println("Resistor " + resistor + row);
}
}
public void printColour()
{
for(Colour colour: colour)
{
System.out.println(colour);
}
}
public Color findColor(int value)
{
}
public void setup()
{
resistor.add(new Resistor(12));
loadColours();
loadResistors();
toString();
printColour();
}
// int space = 100;
// int length = 0;
public void draw()
{
for(Resistor re: resistor)
{
re.render();
}
// Boxes
// noFill();
// for(int i = 0; i < 4; i++)
// {
// rect(200, 0 + space, 100, 100);
// space = space + 110;
// }
}
}
| true |
17979449be3b5c02f81063c9e1db2754bd442cf9 | Java | IamZbl/kmeans-1 | /src/cn/itcast/dao/BuildPoints.java | GB18030 | 683 | 2.84375 | 3 | [] | no_license | package cn.itcast.dao;
import java.util.ArrayList;
import cn.itcast.bean.DataBean;
import cn.itcast.util.XmlUtil;
/*xmlнϢװһArrayList*/
public class BuildPoints {
private ArrayList<DataBean> points=new ArrayList<DataBean>();
public ArrayList<DataBean> preparePoint(){
for(int i=0;i<12;i++){
DataBean datatemp=new DataBean();
datatemp=XmlUtil.find(i+"");
points.add(datatemp);
}
System.out.println("xmlĵԴǣ");
for(DataBean temp:points){
System.out.println(" "+temp.getPointid()+" "+temp.getXaxis()+" "+temp.getYaxis());
}
System.out.println("\n");
return points;
}
}
| true |
07307143f68f201a256262fc48c909294c6f47b9 | Java | YourTradingSystems/Binary_options_android | /src/com/mobilez365/binary_option/core/service/WebRequestService.java | UTF-8 | 1,282 | 2.171875 | 2 | [] | no_license | package com.mobilez365.binary_option.core.service;
import android.app.Service;
import android.content.Intent;
import android.os.*;
import android.util.Log;
import static com.mobilez365.binary_option.global.Constants.*;
/**
* User: ZOG
* Date: 13.05.14
* Time: 17:25
*/
public final class WebRequestService extends Service {
private WRSBinder myBinder;
public WebRequestService() {
myBinder = new WRSBinder();
Log.d(TAG_SERVICE, "WebRequestService: constructor");
}
@Override
public final IBinder onBind(final Intent _intent) {
Log.d(TAG_SERVICE, "WebRequestService: onBind()");
return myBinder;
}
@Override
public final void onRebind (final Intent _intent) {
Log.d(TAG_SERVICE, "WebRequestService: onRebind()");
}
@Override
public final boolean onUnbind (final Intent _intent) {
Log.d(TAG_SERVICE, "WebRequestService: onUnbind()");
return super.onUnbind(_intent);
}
// @Override
// public final int onStartCommand(final Intent _intent, final int _flags, final int _startId) {
// Log.d(TAG_SERVICE, "WebRequestService: onStartCommand()");
//// sendMessage(0);
//// stopSelf();
//
// return START_NOT_STICKY;
// }
@Override
public final void onDestroy() {
Log.d(TAG_SERVICE, "WebRequestService: onDestroy()");
super.onDestroy();
}
} | true |
df795dcc6c920046a3d836a12b19cc95d7474946 | Java | cptspock/gexms | /Samples/src/tests/Elvis.java | UTF-8 | 841 | 3.65625 | 4 | [] | no_license | package tests;
/**
* purest form of a singleton, no reflection issues nor thread safety issues.
* @author E15662
*
*/
public enum Elvis {
INSTANCE;
private int age;
public int getAge(){
return age;
}
public void setAge(int val){
age = val;
}
// this needs to be added for normal singleton to prevent instances from deserialization from having a different instance of the singleton.
// not required for enum singleton. just added to show it is done.
/*private Object readResolve(){
return INSTANCE;
}*/
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Elvis.INSTANCE.setAge(10);
System.out.println(Elvis.INSTANCE.getAge());
Elvis.INSTANCE.setAge(20);
System.out.println(Elvis.INSTANCE.getAge());
}
}
| true |
f6ff1f38884b9f65dddf22675a07f448ca29c1e1 | Java | AppliedRecognition/AAMVA-Barcode-Parser-Android | /aamvabarcodeparser/src/main/java/com/appliedrec/aamvabarcodeparser/MagStripeDocumentData.java | UTF-8 | 946 | 2.34375 | 2 | [] | no_license | package com.appliedrec.aamvabarcodeparser;
/**
* Represents information encoded in a magnetic stripe
*/
public class MagStripeDocumentData extends DocumentData {
@Override
public String getFirstName() {
return getValueForKey("First name");
}
@Override
public String getLastName() {
return getValueForKey("Last name");
}
@Override
public String getAddress() {
return getValueForKey("Address");
}
@Override
public String getDateOfBirth() {
return getValueForKey("Date of birth");
}
@Override
public String getDateOfExpiry() {
return getValueForKey("Date of expiry");
}
@Override
public String getDateOfIssue() {
return null;
}
@Override
public String getDocumentNumber() {
return getValueForKey("DL/ID#");
}
@Override
public String getSex() {
return getValueForKey("Sex");
}
}
| true |
6ead82ed2052d613f2fba76219bba4c5bcbd4629 | Java | xtaticzero/COB | /ControlObligaciones/ControlObligaciones/src/main/java/mx/gob/sat/siat/cob/seguimiento/util/exportador/pdf/ObligacionPdf.java | UTF-8 | 793 | 2.375 | 2 | [] | no_license | package mx.gob.sat.siat.cob.seguimiento.util.exportador.pdf;
import java.util.List;
import mx.gob.sat.siat.cob.seguimiento.dto.catalogos.Obligacion;
/**
*
* @author root
*/
public class ObligacionPdf extends GeneraPdf {
/**
*
*/
public ObligacionPdf() {
super();
}
/**
*
* @param datos
*/
@Override
public void colocarDatos(List<Object> datos) {
for (Object obj : datos) {
Obligacion obligacion = (Obligacion) obj;
super.getTb().addCell(obligacion.getDescrObliCompleta());
super.getTb().addCell(obligacion.getConcepto());
super.getTb().addCell(obligacion.getDescripcion());
super.getTb().addCell(obligacion.getValorBooleano().getNombre());
}
}
}
| true |
6acd078c5582454c6e65bacd76a153e6e3dfd2af | Java | Linklmm/ssmweb | /src/main/java/com/test/event/TestListener.java | UTF-8 | 660 | 2.3125 | 2 | [] | no_license | package com.test.event;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
/**
* 版权声明:Copyright(c) 2019
*
* @program: ssmweb
* @Author minmin.liu
* @Date 2019-03-13 11:25
* @Version 1.0
* @Description 定义监听器
*/
public class TestListener implements ApplicationListener {
@Override
public void onApplicationEvent(ApplicationEvent applicationEvent) {
if (applicationEvent instanceof TestEvent) {
TestEvent testEvent = (TestEvent) applicationEvent;
testEvent.print();
System.out.println("我监听到了");
}
}
}
| true |
c7e4f5060bdf8a119a8917ec8393b0bcea9ca3e1 | Java | johnhovanec/DesignPatterns | /Assignment5_DecoratorPatter/ReceiptFactory.java | UTF-8 | 1,664 | 3.28125 | 3 | [] | no_license | package assignment5;
import java.util.Date;
public class ReceiptFactory {
StoreHeader store_header; // contains street_addr, zip_code, state_code, phone num, store num private
// TaxComputationMethod[] taxComputationsObjs; // tax computation objs (for each
// state) private AddOn[] addOns; // secondary heading, rebate and coupon
// add-ons (hardcoded here)
public ReceiptFactory() { // constructor
// 1. Populates array of TaxComputationMethod objects and array of AddOn objects (as if downloaded from the BestBuy web site).
// 2. Reads config file to create and save StoreHeader object (store_num, street_addr, etc.) to be used on all receipts.
// 3. Based on the state code (e.g., “MD”) creates and stores appropriate StateComputation object to be used on all receipts.
}
public Receipt getReceipt(PurchasedItems items, Date date) {
// 1. Sets the current date of the BasicReceipt.
// 2. Sets StoreHeader object of the BasicReceipt (by call to SetStoreHeader of BasicReceipt)
// 3. Sets the TaxComputationMethod object of the BasicReceipt (by call to the setTaxComputationMethod of BasicReceipt).
// 4. Traverses over all AddOn objects, calling the applies method of each. If an AddOn object applies, then determines if the AddOn is of type SecondaryHeader, Rebate, or Coupon.
// If of type SecondaryHeader, then creates a PreDecorator for othe AddOn. If of type Rebate or Coupon, then creates a PostDecorator.
// 5. Links in the decorator object based on the Decorator design pattern.
// 6. Returns decorated BasicReceipt object as type Receipt.
BasicReceipt r = new BasicReceipt(items, date);
return (Receipt) r;
}
}
| true |
8f3c2a9d42a4e7f1d8d28b322cec2ef010f5938d | Java | TopQuadrant/shacl | /src/main/java/org/topbraid/shacl/targets/NodeTarget.java | UTF-8 | 600 | 2.484375 | 2 | [
"Apache-2.0"
] | permissive | package org.topbraid.shacl.targets;
import java.util.Set;
import org.apache.jena.query.Dataset;
import org.apache.jena.rdf.model.RDFNode;
/**
* A Target based on a sh:targetNode statement.
*
* @author Holger Knublauch
*/
public class NodeTarget implements Target {
private RDFNode node;
public NodeTarget(RDFNode node) {
this.node = node;
}
@Override
public void addTargetNodes(Dataset dataset, Set<RDFNode> results) {
results.add(node.inModel(dataset.getDefaultModel()));
}
@Override
public boolean contains(Dataset dataset, RDFNode node) {
return this.node.equals(node);
}
}
| true |
437f818fe768349c4d06fc671d84ce9a668713ce | Java | KenYinkz/myMobKit | /mymobkit/mymobkit/myMobKit/src/main/java/com/mymobkit/data/phone/Phone.java | UTF-8 | 2,304 | 2.6875 | 3 | [] | no_license | package com.mymobkit.data.phone;
import android.provider.ContactsContract.CommonDataKinds;
public class Phone {
private final static String cellPhonePattern = "\\+*\\d+";
private String contactName;
private final String number;
private final String cleanNumber;
private String label;
private final int type;
private boolean isCellPhoneNumber;
private boolean isDefaultNumber;
/**
*
* @param contactName
* @param number
*/
public Phone(String contactName, String number) {
this.contactName = contactName;
this.number = number;
this.cleanNumber = cleanPhoneNumber(number);
this.isCellPhoneNumber = true;
this.type = CommonDataKinds.Phone.TYPE_MOBILE;
}
/**
*
* @param number
* @param label
* @param type
* @param super_primary
*/
public Phone(String number, String label, int type, int super_primary) {
this.number = number;
this.cleanNumber = cleanPhoneNumber(number);
this.label = label;
this.type = type;
isDefaultNumber = super_primary > 0;
}
public Boolean phoneMatch(String phone) {
phone = cleanPhoneNumber(phone);
if (cleanNumber.equals(phone)) {
return true;
}
else if (cleanNumber.length() != phone.length()) {
if (cleanNumber.length() > phone.length() && cleanNumber.startsWith("+")) {
return cleanNumber.replaceFirst("\\+\\d\\d", "0").equals(phone);
}
else if (phone.length() > cleanNumber.length() && phone.startsWith("+")) {
return phone.replaceFirst("\\+\\d\\d", "0").equals(cleanNumber);
}
}
return false;
}
public static boolean isCellPhoneNumber(String number) {
return Phone.cleanPhoneNumber(number).matches(cellPhonePattern);
}
public static String cleanPhoneNumber(String number) {
return number.replace("(", "")
.replace(")", "")
.replace("-", "")
.replace(".", "")
.replace(" ", "");
}
public String getContactName() {
return contactName;
}
public String getNumber() {
return number;
}
public String getCleanNumber() {
return cleanNumber;
}
public String getLabel() {
return label;
}
public int getType() {
return type;
}
public boolean isCellPhoneNumber() {
return isCellPhoneNumber;
}
public boolean isDefaultNumber() {
return isDefaultNumber;
}
public void setContactName(String name) {
this.contactName = name;
}
} | true |
add826e7778c0a1fef02c10633f4a4d97672208e | Java | cbangyu-zju/audio-analysis | /src/main/java/com/audio/reader/MP3Reader.java | UTF-8 | 1,871 | 2.578125 | 3 | [] | no_license | package com.audio.reader;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javazoom.spi.mpeg.sampled.file.MpegAudioFileReader;
import java.io.File;
public class MP3Reader{
private static MP3Reader mp3Reader = null;
private MP3Reader(){}
//双判断,解决单利问题
public static MP3Reader getInstance(){
if(mp3Reader == null){
synchronized (MP3Reader.class) {
if(mp3Reader == null){
mp3Reader = new MP3Reader();
}
}
}
return mp3Reader;
}
public AudioInputStream getPcmAudioInputStream(String mp3filepath) {
Integer sampleSizeInByte = 2;
return getPcmAudioInputStream(mp3filepath, sampleSizeInByte);
}
public AudioInputStream getPcmAudioInputStream(String mp3filepath, Integer sampleSizeInByte) {
File mp3 = new File(mp3filepath);
AudioInputStream audioInputStream = null;
AudioFormat targetFormat = null;
try {
AudioInputStream in = null;
//读取音频文件的类
MpegAudioFileReader mp = new MpegAudioFileReader();
in = mp.getAudioInputStream(mp3);
AudioFormat baseFormat = in.getFormat();
//设定输出格式为pcm格式的音频文件
targetFormat = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, baseFormat.getSampleRate(), sampleSizeInByte * 8,
baseFormat.getChannels(), baseFormat.getChannels() * sampleSizeInByte, baseFormat.getSampleRate(), false);
//输出到音频
audioInputStream = AudioSystem.getAudioInputStream(targetFormat, in);
} catch (Exception e) {
e.printStackTrace();
}
return audioInputStream;
}
} | true |
ceed19c6a8041d3ec0cbb140dc8e1f21ab36f398 | Java | Hsmallm/MyText1 | /app/src/main/java/com/example/administrator/text1/ui/testAsyncTask/TestAsyncTask.java | UTF-8 | 4,348 | 2.8125 | 3 | [] | no_license | package com.example.administrator.text1.ui.testAsyncTask;
import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.widget.ListView;
import com.example.administrator.text1.R;
import com.example.administrator.text1.model.NewSBean;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
/**
* 功能描述:实现异步加载功能的两种方式、数据解析
* 第一种(1):使用AsyncTask实现异步加载
* 第二种(2):开启新线程实现异步加载
* 三 (3):网络数据的解析(InputStream--String)、Json数据的解析(String--JsonObject--JsonArray--NewsBean)
* (使用异步加载的条件:一般涉及到网络及其他耗时操作时用到)
* Created by hzhm on 2016/7/8.
*/
public class TestAsyncTask extends Activity {
private static final String URL = "http://www.imooc.com/api/teacher?type=4&num=30";
private List<NewSBean> newSBeanList = new ArrayList<NewSBean>();
private ListView mListView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test_asynctask);
mListView = (ListView) findViewById(R.id.listview);
//1.1、执行异步操作
new NewsAsyncTask().execute(URL);
}
/**
* 实现网络获取数据的异步访问类(注:<String, Void, List<NewSBean>这三个参数:String:传入的数据源网址;Void:中间过程;List<NewSBean>:执行成功后返回的对象)
*/
class NewsAsyncTask extends AsyncTask<String, Void, List<NewSBean>> {
//1.2、执行异步操作doInBackground:执行相关的耗操作
@Override
protected List<NewSBean> doInBackground(String... params) {
return getJsonData(params[0]);
}
//1.3、onPostExecute:执行成功后回调的方法,一般进行UI线程的更新操作
@Override
protected void onPostExecute(List<NewSBean> list) {
super.onPostExecute(list);
NewsAdapter mAdapter = new NewsAdapter(TestAsyncTask.this,newSBeanList,mListView);
mListView.setAdapter(mAdapter);
}
}
/**
* 3.2、将Json格式数据转化为我们所封装的NewSBean对象(String--JsonObject--JsonArray--NewsBean)
* @param url
* @return
*/
private List<NewSBean> getJsonData(String url){
List<NewSBean> newsBeanList = new ArrayList<NewSBean>();
try {
//new URL(url).openStream():连接网络获取InputStream网络数据
String jsonString = readStream(new URL(url).openStream());
JSONObject jsonObject;
NewSBean newSBean;
Log.e("json",jsonString);
jsonObject = new JSONObject(jsonString);
JSONArray jsonArray = jsonObject.getJSONArray("data");
for(int i = 0; i < jsonArray.length(); i++){
jsonObject = jsonArray.getJSONObject(i);
newSBean = new NewSBean();
newSBean.newsIconUrl = jsonObject.getString("picSmall");
newSBean.newsTitle = jsonObject.getString("name");
newSBean.newsContent = jsonObject.getString("description");
newSBeanList.add(newSBean);
}
} catch (IOException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
}
return newsBeanList;
}
/**
* 3.1、通过InputStream解析网页返回的数据(InputStream--String)
* @param is
* @return
*/
private String readStream(InputStream is){
InputStreamReader isr;
String result = "";
try {
String line = "";
isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
while ((line = br.readLine()) != null){
result += line;
}
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
}
| true |
cc90a70d3f1642deae34ee8908a7e308cde4e93f | Java | shaileshitech/workspace | /HackerEarth/src/TwoArrayMerge2.java | UTF-8 | 2,519 | 3.203125 | 3 | [] | no_license | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class TwoArrayMerge2 {
/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
/*
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int a = Integer.parseInt(br.readLine());
int b = Integer.parseInt(br.readLine());
int m[]=new int[a];
for(int i=0;i<a;i++)
{
m[i] = Integer.parseInt(br.readLine());
}
int n[]=new int[b];
for(int i=0;i<b;i++)
{
n[i] = Integer.parseInt(br.readLine());
}
int[] answer = new int[m.length + n.length];
int i = 0, j = 0, k = 0;
try {
while (i < m.length && j < n.length)
{
if (m[i] < n[j])
answer[k++] = m[i++];
else
answer[k++] = n[j++];
}
while (i < m.length)
answer[k++] = m[i++];
while (j < n.length)
answer[k++] = n[j++];
for(int f=0;i<m.length + n.length;f++){
System.out.println(answer[f]);
}
} catch (Exception e) {
}
*/
int a[]=new int[]{3,5,6,9,12,14,18,20,25,28};
int b[]=new int[2*a.length];
int t=30;
for(int i=0;i<a.length;i++)
{
b[i]=t;
t+=2;
}
//System.out.println(b.length);
mergeArrays(a, b, a.length);
}
static void mergeArrays(int []a, int[]b, int M)
{
System.arraycopy(b, 0, b, M, M);
int i = 0, j = M, k = 0;
while (i < M && j < 2*M)
{
if (a[i] < b[j])
b[k++] = a[i++];
else
b[k++] = b[j++];
}
while (i < M)
b[k++] = a[i++];
while (j < M)
b[k++] = b[j++];
for(int f=0;f<M + M;f++){
System.out.print(b[f]+" ");
}
}
} | true |
fb743ebe8f6c405a24d873e2e59dc16285b8a62b | Java | automsen/psiot | /tw-paas-service-saas/src/main/java/cn/com/tw/saas/serv/mapper/cust/SubAccountMapper.java | UTF-8 | 720 | 1.875 | 2 | [] | no_license | /**
* TODO: complete the comment
*/
package cn.com.tw.saas.serv.mapper.cust;
import java.util.List;
import cn.com.tw.common.web.entity.page.Page;
import cn.com.tw.saas.serv.entity.db.cust.SubAccount;
import cn.com.tw.saas.serv.entity.room.Room;
public interface SubAccountMapper {
int deleteByPrimaryKey(String subAccountId);
int insert(SubAccount record);
SubAccount selectByPrimaryKey(String subAccountId);
int updateForBalance(SubAccount record);
int updateByPrimaryKeySelective(SubAccount record);
List<SubAccount> selectByPage(Page page);
List<SubAccount> selectByEntity(SubAccount record);
List<Room> selectCustomerByPage(Page page);
} | true |
00f43e57ed15d47403a32cc04757786aa6efff52 | Java | bschalich/Clue | /src/com/outtatech/common/SuperSleuth.java | UTF-8 | 1,328 | 3.140625 | 3 | [] | no_license | package com.outtatech.common;
/**
* Version-latenightpizzaparty
* The SuperSleuth class represents a type of ActionCard that represents an
* SuperSleuth action. A SuperSleuth action does on of the following: A player
* of your choice: "Shows you one female Suspect Card." (1) "Show you one male
* Suspect Card." (1) "Shows you one flying Vehicle Card." (1) "Shows you one
* blue Vehicle Card." (1) "Shows you one southern Destination Card." (1) "Shows
* you one western Destination Card." (1)
*
* @author bennettschalich
*/
public class SuperSleuth extends ActionCard
{
private SuperSleuthType type;
/**
* Version-latenightpizzaparty
* Constructs a new SuperSleuth ActionCard.
* @param type method parameter
*/
public SuperSleuth(SuperSleuthType type)
{
super(ActionCardType.SUPER_SLEUTH);
this.type = type;
}
/**
* Version-latenightpizzaparty
*
* @return return value
*/
public SuperSleuthType getType()
{
return type;
}
public String toString()
{
return "SUPERSLEUTH";
}
public boolean equals(Object obj)
{
if (!(obj instanceof SuperSleuth)) {
return false;
}
SuperSleuth other = (SuperSleuth)obj;
return this.type == other.type;
}
}
| true |
a9bd63edbbae17483f03f70ac770d785950e04f6 | Java | litliang/ms | /code/app/src/main/java/com/yzb/card/king/ui/gift/presenter/GiftcardNoRecvPresenter.java | UTF-8 | 1,500 | 2.125 | 2 | [] | no_license | package com.yzb.card.king.ui.gift.presenter;
import com.yzb.card.king.ui.gift.bean.NoRecvCardBean;
import com.yzb.card.king.sys.AppConstant;
import com.yzb.card.king.ui.base.BaseMultiLoadListener;
import com.yzb.card.king.ui.gift.modle.GiftcardNoRecvModel;
import com.yzb.card.king.ui.gift.view.GiftcardNoRecvView;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 功能:礼品卡首页;
*
* @author:gengqiyun
* @date: 2016/12/22
*/
public class GiftcardNoRecvPresenter implements BaseMultiLoadListener
{
private GiftcardNoRecvModel model;
private GiftcardNoRecvView view;
public GiftcardNoRecvPresenter(GiftcardNoRecvView view)
{
this.view = view;
model = new GiftcardNoRecvModel(this);
}
public void loadData(boolean event_tag, Map<String, Object> paramMap)
{
model.loadData(event_tag, paramMap);
}
public void setInterfaceParameters(boolean event_tag,String pageStart){
Map<String, Object> args = new HashMap<>();
args.put("pageStart", pageStart);
args.put("pageSize", AppConstant.MAX_PAGE_NUM);
args.put("sessionId", AppConstant.sessionId);
model.loadData(event_tag, args);
}
@Override
public void onListenSuccess(boolean event_tag, Object data)
{
view.onGetECardListSuc(event_tag, (List<NoRecvCardBean>) data);
}
@Override
public void onListenError(String msg)
{
view.onGetECardListFail(msg);
}
}
| true |
4a28227f1bf892be25a0f3ab1f3783c67a7c9a10 | Java | jianghan200/wxsrc6.6.7 | /app/src/main/java/com/tencent/mm/protocal/c/bez.java | UTF-8 | 10,845 | 1.679688 | 2 | [] | no_license | package com.tencent.mm.protocal.c;
import f.a.a.b;
import java.util.LinkedList;
public final class bez
extends com.tencent.mm.bk.a
{
public int id;
public bhz sgA;
public bhz sgB;
public bhz sgC;
public bhz sgD;
public bhz sgE;
public bhz sgF;
public bhz sgx;
public bhz sgy;
public bhz sgz;
protected final int a(int paramInt, Object... paramVarArgs)
{
if (paramInt == 0)
{
paramVarArgs = (f.a.a.c.a)paramVarArgs[0];
if (this.sgy == null) {
throw new b("Not all required fields were included: province");
}
if (this.sgz == null) {
throw new b("Not all required fields were included: city");
}
if (this.sgA == null) {
throw new b("Not all required fields were included: district");
}
if (this.sgB == null) {
throw new b("Not all required fields were included: zipcode");
}
if (this.sgC == null) {
throw new b("Not all required fields were included: detail");
}
if (this.sgD == null) {
throw new b("Not all required fields were included: name");
}
if (this.sgE == null) {
throw new b("Not all required fields were included: phone");
}
paramVarArgs.fT(1, this.id);
if (this.sgx != null)
{
paramVarArgs.fV(2, this.sgx.boi());
this.sgx.a(paramVarArgs);
}
if (this.sgy != null)
{
paramVarArgs.fV(3, this.sgy.boi());
this.sgy.a(paramVarArgs);
}
if (this.sgz != null)
{
paramVarArgs.fV(4, this.sgz.boi());
this.sgz.a(paramVarArgs);
}
if (this.sgA != null)
{
paramVarArgs.fV(5, this.sgA.boi());
this.sgA.a(paramVarArgs);
}
if (this.sgB != null)
{
paramVarArgs.fV(6, this.sgB.boi());
this.sgB.a(paramVarArgs);
}
if (this.sgC != null)
{
paramVarArgs.fV(7, this.sgC.boi());
this.sgC.a(paramVarArgs);
}
if (this.sgD != null)
{
paramVarArgs.fV(8, this.sgD.boi());
this.sgD.a(paramVarArgs);
}
if (this.sgE != null)
{
paramVarArgs.fV(9, this.sgE.boi());
this.sgE.a(paramVarArgs);
}
if (this.sgF != null)
{
paramVarArgs.fV(10, this.sgF.boi());
this.sgF.a(paramVarArgs);
}
paramInt = 0;
}
int i;
do
{
return paramInt;
if (paramInt != 1) {
break;
}
i = f.a.a.a.fQ(1, this.id) + 0;
paramInt = i;
if (this.sgx != null) {
paramInt = i + f.a.a.a.fS(2, this.sgx.boi());
}
i = paramInt;
if (this.sgy != null) {
i = paramInt + f.a.a.a.fS(3, this.sgy.boi());
}
paramInt = i;
if (this.sgz != null) {
paramInt = i + f.a.a.a.fS(4, this.sgz.boi());
}
i = paramInt;
if (this.sgA != null) {
i = paramInt + f.a.a.a.fS(5, this.sgA.boi());
}
paramInt = i;
if (this.sgB != null) {
paramInt = i + f.a.a.a.fS(6, this.sgB.boi());
}
i = paramInt;
if (this.sgC != null) {
i = paramInt + f.a.a.a.fS(7, this.sgC.boi());
}
paramInt = i;
if (this.sgD != null) {
paramInt = i + f.a.a.a.fS(8, this.sgD.boi());
}
i = paramInt;
if (this.sgE != null) {
i = paramInt + f.a.a.a.fS(9, this.sgE.boi());
}
paramInt = i;
} while (this.sgF == null);
return i + f.a.a.a.fS(10, this.sgF.boi());
if (paramInt == 2)
{
paramVarArgs = new f.a.a.a.a((byte[])paramVarArgs[0], unknownTagHandler);
for (paramInt = com.tencent.mm.bk.a.a(paramVarArgs); paramInt > 0; paramInt = com.tencent.mm.bk.a.a(paramVarArgs)) {
if (!super.a(paramVarArgs, this, paramInt)) {
paramVarArgs.cJS();
}
}
if (this.sgy == null) {
throw new b("Not all required fields were included: province");
}
if (this.sgz == null) {
throw new b("Not all required fields were included: city");
}
if (this.sgA == null) {
throw new b("Not all required fields were included: district");
}
if (this.sgB == null) {
throw new b("Not all required fields were included: zipcode");
}
if (this.sgC == null) {
throw new b("Not all required fields were included: detail");
}
if (this.sgD == null) {
throw new b("Not all required fields were included: name");
}
if (this.sgE == null) {
throw new b("Not all required fields were included: phone");
}
return 0;
}
if (paramInt == 3)
{
Object localObject1 = (f.a.a.a.a)paramVarArgs[0];
bez localbez = (bez)paramVarArgs[1];
paramInt = ((Integer)paramVarArgs[2]).intValue();
Object localObject2;
boolean bool;
switch (paramInt)
{
default:
return -1;
case 1:
localbez.id = ((f.a.a.a.a)localObject1).vHC.rY();
return 0;
case 2:
paramVarArgs = ((f.a.a.a.a)localObject1).IC(paramInt);
i = paramVarArgs.size();
paramInt = 0;
while (paramInt < i)
{
localObject2 = (byte[])paramVarArgs.get(paramInt);
localObject1 = new bhz();
localObject2 = new f.a.a.a.a((byte[])localObject2, unknownTagHandler);
for (bool = true; bool; bool = ((bhz)localObject1).a((f.a.a.a.a)localObject2, (com.tencent.mm.bk.a)localObject1, com.tencent.mm.bk.a.a((f.a.a.a.a)localObject2))) {}
localbez.sgx = ((bhz)localObject1);
paramInt += 1;
}
return 0;
case 3:
paramVarArgs = ((f.a.a.a.a)localObject1).IC(paramInt);
i = paramVarArgs.size();
paramInt = 0;
while (paramInt < i)
{
localObject2 = (byte[])paramVarArgs.get(paramInt);
localObject1 = new bhz();
localObject2 = new f.a.a.a.a((byte[])localObject2, unknownTagHandler);
for (bool = true; bool; bool = ((bhz)localObject1).a((f.a.a.a.a)localObject2, (com.tencent.mm.bk.a)localObject1, com.tencent.mm.bk.a.a((f.a.a.a.a)localObject2))) {}
localbez.sgy = ((bhz)localObject1);
paramInt += 1;
}
return 0;
case 4:
paramVarArgs = ((f.a.a.a.a)localObject1).IC(paramInt);
i = paramVarArgs.size();
paramInt = 0;
while (paramInt < i)
{
localObject2 = (byte[])paramVarArgs.get(paramInt);
localObject1 = new bhz();
localObject2 = new f.a.a.a.a((byte[])localObject2, unknownTagHandler);
for (bool = true; bool; bool = ((bhz)localObject1).a((f.a.a.a.a)localObject2, (com.tencent.mm.bk.a)localObject1, com.tencent.mm.bk.a.a((f.a.a.a.a)localObject2))) {}
localbez.sgz = ((bhz)localObject1);
paramInt += 1;
}
return 0;
case 5:
paramVarArgs = ((f.a.a.a.a)localObject1).IC(paramInt);
i = paramVarArgs.size();
paramInt = 0;
while (paramInt < i)
{
localObject2 = (byte[])paramVarArgs.get(paramInt);
localObject1 = new bhz();
localObject2 = new f.a.a.a.a((byte[])localObject2, unknownTagHandler);
for (bool = true; bool; bool = ((bhz)localObject1).a((f.a.a.a.a)localObject2, (com.tencent.mm.bk.a)localObject1, com.tencent.mm.bk.a.a((f.a.a.a.a)localObject2))) {}
localbez.sgA = ((bhz)localObject1);
paramInt += 1;
}
return 0;
case 6:
paramVarArgs = ((f.a.a.a.a)localObject1).IC(paramInt);
i = paramVarArgs.size();
paramInt = 0;
while (paramInt < i)
{
localObject2 = (byte[])paramVarArgs.get(paramInt);
localObject1 = new bhz();
localObject2 = new f.a.a.a.a((byte[])localObject2, unknownTagHandler);
for (bool = true; bool; bool = ((bhz)localObject1).a((f.a.a.a.a)localObject2, (com.tencent.mm.bk.a)localObject1, com.tencent.mm.bk.a.a((f.a.a.a.a)localObject2))) {}
localbez.sgB = ((bhz)localObject1);
paramInt += 1;
}
return 0;
case 7:
paramVarArgs = ((f.a.a.a.a)localObject1).IC(paramInt);
i = paramVarArgs.size();
paramInt = 0;
while (paramInt < i)
{
localObject2 = (byte[])paramVarArgs.get(paramInt);
localObject1 = new bhz();
localObject2 = new f.a.a.a.a((byte[])localObject2, unknownTagHandler);
for (bool = true; bool; bool = ((bhz)localObject1).a((f.a.a.a.a)localObject2, (com.tencent.mm.bk.a)localObject1, com.tencent.mm.bk.a.a((f.a.a.a.a)localObject2))) {}
localbez.sgC = ((bhz)localObject1);
paramInt += 1;
}
return 0;
case 8:
paramVarArgs = ((f.a.a.a.a)localObject1).IC(paramInt);
i = paramVarArgs.size();
paramInt = 0;
while (paramInt < i)
{
localObject2 = (byte[])paramVarArgs.get(paramInt);
localObject1 = new bhz();
localObject2 = new f.a.a.a.a((byte[])localObject2, unknownTagHandler);
for (bool = true; bool; bool = ((bhz)localObject1).a((f.a.a.a.a)localObject2, (com.tencent.mm.bk.a)localObject1, com.tencent.mm.bk.a.a((f.a.a.a.a)localObject2))) {}
localbez.sgD = ((bhz)localObject1);
paramInt += 1;
}
return 0;
case 9:
paramVarArgs = ((f.a.a.a.a)localObject1).IC(paramInt);
i = paramVarArgs.size();
paramInt = 0;
while (paramInt < i)
{
localObject2 = (byte[])paramVarArgs.get(paramInt);
localObject1 = new bhz();
localObject2 = new f.a.a.a.a((byte[])localObject2, unknownTagHandler);
for (bool = true; bool; bool = ((bhz)localObject1).a((f.a.a.a.a)localObject2, (com.tencent.mm.bk.a)localObject1, com.tencent.mm.bk.a.a((f.a.a.a.a)localObject2))) {}
localbez.sgE = ((bhz)localObject1);
paramInt += 1;
}
return 0;
}
paramVarArgs = ((f.a.a.a.a)localObject1).IC(paramInt);
i = paramVarArgs.size();
paramInt = 0;
while (paramInt < i)
{
localObject2 = (byte[])paramVarArgs.get(paramInt);
localObject1 = new bhz();
localObject2 = new f.a.a.a.a((byte[])localObject2, unknownTagHandler);
for (bool = true; bool; bool = ((bhz)localObject1).a((f.a.a.a.a)localObject2, (com.tencent.mm.bk.a)localObject1, com.tencent.mm.bk.a.a((f.a.a.a.a)localObject2))) {}
localbez.sgF = ((bhz)localObject1);
paramInt += 1;
}
return 0;
}
return -1;
}
}
/* Location: /Users/Han/Desktop/wxall/微信反编译/反编译 6.6.7/dex2jar-2.0/classes4-dex2jar.jar!/com/tencent/mm/protocal/c/bez.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | true |
4b1e4ee65f6a0b5ae036bd2fdf6b95d75ee21640 | Java | huojun17603/ICH-VIEW | /src/main/java/com/ich/view/dao/AdvMapper.java | UTF-8 | 356 | 1.625 | 2 | [] | no_license | package com.ich.view.dao;
import com.ich.view.pojo.Adv;
import java.util.List;
public interface AdvMapper {
public int insert(Adv adv);
public int update(Adv adv);
public int deleteAdv(Long id);
public Adv selectByPrimaryKey(Long id);
public List<Adv> selectAdvByPostion(String postion);
public List<Adv> selectAllAdv();
}
| true |
f00c6131fb1de2a4525c8b6bf641f1bba5333548 | Java | ChuangShen-Prince/common | /src/main/java/com/sc/common/util/FileUtil.java | UTF-8 | 5,892 | 2.765625 | 3 | [] | no_license | package com.sc.common.util;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
public class FileUtil {
public static List<String> FileToList(String filename) {
List<String> list = new ArrayList<String>();
String line = null;
try {
BufferedReader br = new BufferedReader(new InputStreamReader(
new FileInputStream(new File(filename).getAbsoluteFile()),
"UTF-8"));
while ((line = br.readLine()) != null) {
list.add(line.toLowerCase());
}
br.close();
} catch (Exception e) {
e.printStackTrace();
}
return list;
}
public static String LocalFileToString(String filename) {
StringBuffer sb = new StringBuffer();
String line = null;
BufferedReader br = null;
try {
InputStream resourceAsStream = FileUtil.class.getClassLoader().getResourceAsStream(filename);
br = new BufferedReader(new InputStreamReader(resourceAsStream,"UTF-8"));
while ((line = br.readLine()) != null) {
sb.append(line);
}
br.close();
} catch (Exception e) {
e.printStackTrace();
}
return sb.toString();
}
public static List<String> LocalFileToList(String name) {
List<String> list =new ArrayList<String>();
BufferedReader br = null;
try {
InputStream resourceAsStream = FileUtil.class.getClassLoader().getResourceAsStream(name);
br = new BufferedReader(new InputStreamReader(resourceAsStream,"UTF-8"));
String line = null;
while ((line = br.readLine()) != null) {
list.add(line);
}
} catch (IOException e) {
e.printStackTrace();
}
return list;
}
/***
* hpo文件:hpoid,英文名称,中文名称
*
* @return hpoid,英文名称,中文名称的组合
*
*/
public static Map<String, Object> LocalFileToMap(String name) {
Map<String, Object> subclassMap = new LinkedHashMap<String, Object>();
BufferedReader br = null;
try {
InputStream resourceAsStream = FileUtil.class.getClassLoader().getResourceAsStream(name);
br = new BufferedReader(new InputStreamReader(resourceAsStream,"UTF-8"));
String line = null;
while ((line = br.readLine()) != null) {
String[] split = line.split("\t",2);
subclassMap.put(split[0], split[1]);
}
} catch (IOException e) {
e.printStackTrace();
}
return subclassMap;
}
public static void writeFile(String filePath, String content){
BufferedWriter bw = null ;
try {
bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filePath, true)));
bw.write(content);
bw.flush();
} catch (IOException e) {
e.printStackTrace();
}
}
/***
*
* <p>Title: 遍历文件</p>
* <p>Description: 遍历指定目录的下的所有文件,包括文件夹下的文件</p>
* <p>Company: CapitalBio Corporation. </p>
* @author: guohuiyang
* @date: 2017年1月6日 上午10:43:09
*
* @param dirPath 目录名称
* @return
*
*/
public static List<File> getAllFiles(String dirPath) {
File dir = new File(dirPath);
ArrayList<File> files = new ArrayList<File>();
if (dir.isDirectory()) {
File[] fileArr = dir.listFiles();
for (int i = 0; i < fileArr.length; i++) {
File f = fileArr[i];
if (f.isFile()) {
files.add(f);
} else {
files.addAll(getAllFiles(f.getPath()));
}
}
}
return files;
}
/** *//**文件重命名
* @param path 文件目录
* @param oldname 原来的文件名
* @param newname 新文件名
*/
public static void renameFile(String path,String oldname,String newname){
if(!oldname.equals(newname)){//新的文件名和以前文件名不同时,才有必要进行重命名
File oldfile=new File(path+"/"+oldname);
File newfile=new File(path+"/"+newname);
if(!oldfile.exists()){
return;//重命名文件不存在
}
if(newfile.exists())//若在该目录下已经有一个文件和新文件名相同,则不允许重命名
System.out.println(newname+"已经存在!");
else{
oldfile.renameTo(newfile);
}
}else{
System.out.println("新文件名和旧文件名相同...");
}
}
public static List<File> getAllDirectory(String dirPath) {
File dir = new File(dirPath);
ArrayList<File> files = new ArrayList<File>();
if (dir.isDirectory()) {
File[] fileArr = dir.listFiles();
for (int i = 0; i < fileArr.length; i++) {
File f = fileArr[i];
if (f.isFile()) {
// files.add(f);
} else {
files.add(f);
}
}
}
return files;
}
/***
* 复制单个文件
*
* @param oldPath
* String 原文件路径 如:c:/fqf.txt
* @param newPath
* String 复制后路径 如:f:/fqf.txt
* @return boolean
*/
public static void copyFile(String oldPath, String newPath) {
try {
int bytesum = 0;
int byteread = 0;
File oldfile = new File(oldPath);
if (oldfile.exists()) { // 文件存在时
InputStream inStream = new FileInputStream(oldPath); // 读入原文件
FileOutputStream fs = new FileOutputStream(newPath);
byte[] buffer = new byte[1444];
int length;
while ((byteread = inStream.read(buffer)) != -1) {
bytesum += byteread; // 字节数 文件大小
fs.write(buffer, 0, byteread);
}
inStream.close();
}
} catch (Exception e) {
System.out.println("复制单个文件操作出错");
e.printStackTrace();
}
}
public static void main(String[] args) {}
}
| true |
9acbda42a721ce27b0f6b5f9d5eb7b19cd375925 | Java | black-one-admin/tree | /src/main/java/com/black/one/sql/controller/SqlController.java | UTF-8 | 480 | 1.632813 | 2 | [] | no_license | package com.black.one.sql.controller;
import com.black.one.sql.service.SqlService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
/**
* sql语句查询
*
* @author swh
* @create: 2020-05-31 17:27
*/
@Controller
@Api(description = "sql语句查询")
@Slf4j
public class SqlController {
@Autowired
private SqlService sqlService;
}
| true |