blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2
values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 9.45M | extension stringclasses 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7b34eb3388ec1fd6c9ffd97c40267041978e411f | 59a9c81ca7b831f60fd2e4234c3d925e2035fe47 | /src/main/java/com/awesomeravi/SimpleJdbcApp/Controllers/StudentController.java | 21424de9bbe1d2b7dc426a66068b1b894b5791e2 | [] | no_license | ravindudiaz/Student-Platform-Backend | 7a14e828f2884906779e43184fe20cf45ef3b150 | 6409bf7e3578b5fe4b1ca555b0903a060994782b | refs/heads/master | 2023-03-04T12:31:46.271866 | 2021-02-10T21:52:12 | 2021-02-10T21:52:12 | 337,536,694 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,289 | java | package com.awesomeravi.SimpleJdbcApp.Controllers;
import com.awesomeravi.SimpleJdbcApp.Domain.Student;
import com.awesomeravi.SimpleJdbcApp.Repositories.StudentRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/students")
public class StudentController {
@Autowired
StudentRepository studentRepository;
@GetMapping("/getallstudents")
public List<Student> getAllStudents(){
return studentRepository.getAllStudents();
}
@GetMapping("/getstudentbyid/{uid}")
public Student student(@PathVariable("uid") Integer uid){
List<Student> students = studentRepository.getStudentById(uid);
return students.get(0);
}
@PostMapping("/addstudent")
public String addStudent(@RequestBody Student student){
return studentRepository.addStudent(student);
}
@PutMapping("/updatestudent")
public Student updateStudent(@RequestBody Student student){
return studentRepository.updateStudent(student);
}
@DeleteMapping("/deletestudent/{uid}")
public String deleteStudentById(@PathVariable("uid") Integer id){
return studentRepository.deleteStudentById(id);
}
}
| [
"ravindudiaz75@gmail.com"
] | ravindudiaz75@gmail.com |
04eb6d9cb77ebd1ff07ad03a6cfac252bf35afd5 | a8f05a18342cc363d9848bbda15f84fdf7daa12b | /src/com/carl/controller/WebSocketController.java | 019ea6dbd7f4afe66eb18536155b98402e47f128 | [] | no_license | liuCarls/models | 629e4b1480b3f7b822474c8100af52bdef035ff3 | 7f3cb8a2791c5b21c9feb9bf8ed6840466af78a5 | refs/heads/master | 2020-03-28T20:37:02.810660 | 2019-03-15T07:25:53 | 2019-03-15T07:25:53 | 149,087,543 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,650 | java | package com.carl.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Created by user on 2018/11/24.
*/
//@Controller
//@EnableScheduling
public class WebSocketController {
@Autowired
private SimpMessagingTemplate messagingTemplate;
@GetMapping("/")
public String index() {
return "index";
}
@MessageMapping("/send")
@SendTo("/topic/send")
public SocketMessage send(SocketMessage message) throws Exception {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
message.date = df.format(new Date());
return message;
}
/*
@EnableScheduling注解为:启用spring boot的定时任务,
这与“callback”方法相呼应,用于每隔1秒推送服务器端的时间。
*/
@Scheduled(fixedRate = 1000)
@SendTo("/topic/callback")
public Object callback() throws Exception {
// 发现消息
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
messagingTemplate.convertAndSend("/topic/callback", df.format(new Date()));
return "callback";
}
}
| [
"liugx618@163.com"
] | liugx618@163.com |
73a2f50659585ec05af086465af29f64526111c5 | d052a647b14b04d7cfc11ac24cdcd725fc8c366e | /src/nutrigo/Ingresar_dieta_2.java | f6d8b74be33f7b53f62990d09d8559f08d176d0c | [] | no_license | ReneCastilloM/NutriGo | 8dcde9663cbb10fbe0bf7145d8abcf15840563b4 | d87b16cf2e4fd63e8e5648a48f9b5cb7e751e53a | refs/heads/master | 2021-01-11T00:01:29.724977 | 2016-11-26T03:21:03 | 2016-11-26T03:21:03 | 70,744,511 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 199,435 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package nutrigo;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.logging.Level;
import java.util.logging.Logger;
import static javafx.beans.binding.Bindings.and;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import static nutrigo.Panel_Dietas.Tabla;
/**
*
* @author Rene
*/
public class Ingresar_dieta_2 extends javax.swing.JFrame {
Conectar con = new Conectar();
Connection co = con.conexion();
public static int calorias;
public static String titulo, notas;
/**
* Creates new form Ingresar_dieta
*/
public Ingresar_dieta_2() {
initComponents();
this.getContentPane().setBackground(new java.awt.Color(175, 228, 202));
this.setLocationRelativeTo(null);
setIconImage(new ImageIcon(getClass().getResource("../img//recursos/Icono.png")).getImage());
}
/**
* 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() {
jTabbedPane1 = new javax.swing.JTabbedPane();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
t_desayuno_1 = new javax.swing.JTextArea();
jScrollPane2 = new javax.swing.JScrollPane();
t_colacion1_1 = new javax.swing.JTextArea();
jScrollPane3 = new javax.swing.JScrollPane();
t_comida_1 = new javax.swing.JTextArea();
jScrollPane4 = new javax.swing.JScrollPane();
t_colacion2_1 = new javax.swing.JTextArea();
jScrollPane5 = new javax.swing.JScrollPane();
t_cena_1 = new javax.swing.JTextArea();
jScrollPane6 = new javax.swing.JScrollPane();
desayuno_1 = new javax.swing.JTextArea();
jScrollPane7 = new javax.swing.JScrollPane();
colacion1_1 = new javax.swing.JTextArea();
jScrollPane8 = new javax.swing.JScrollPane();
comida_1 = new javax.swing.JTextArea();
jScrollPane9 = new javax.swing.JScrollPane();
colacion2_1 = new javax.swing.JTextArea();
jScrollPane10 = new javax.swing.JScrollPane();
cena_1 = new javax.swing.JTextArea();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jButton5 = new javax.swing.JButton();
jButton6 = new javax.swing.JButton();
jButton7 = new javax.swing.JButton();
jPanel2 = new javax.swing.JPanel();
jScrollPane11 = new javax.swing.JScrollPane();
cena_2 = new javax.swing.JTextArea();
jScrollPane12 = new javax.swing.JScrollPane();
t_cena_2 = new javax.swing.JTextArea();
jLabel8 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
jLabel11 = new javax.swing.JLabel();
jLabel12 = new javax.swing.JLabel();
jLabel13 = new javax.swing.JLabel();
jLabel14 = new javax.swing.JLabel();
jScrollPane13 = new javax.swing.JScrollPane();
t_desayuno_2 = new javax.swing.JTextArea();
jScrollPane14 = new javax.swing.JScrollPane();
desayuno_2 = new javax.swing.JTextArea();
jScrollPane15 = new javax.swing.JScrollPane();
t_colacion1_2 = new javax.swing.JTextArea();
jScrollPane16 = new javax.swing.JScrollPane();
t_comida_2 = new javax.swing.JTextArea();
jScrollPane17 = new javax.swing.JScrollPane();
t_colacion2_2 = new javax.swing.JTextArea();
jScrollPane18 = new javax.swing.JScrollPane();
colacion2_2 = new javax.swing.JTextArea();
jScrollPane19 = new javax.swing.JScrollPane();
comida_2 = new javax.swing.JTextArea();
jScrollPane20 = new javax.swing.JScrollPane();
colacion1_2 = new javax.swing.JTextArea();
jButton8 = new javax.swing.JButton();
jButton9 = new javax.swing.JButton();
jButton10 = new javax.swing.JButton();
jButton11 = new javax.swing.JButton();
jButton12 = new javax.swing.JButton();
jPanel3 = new javax.swing.JPanel();
jScrollPane21 = new javax.swing.JScrollPane();
cena_3 = new javax.swing.JTextArea();
jScrollPane22 = new javax.swing.JScrollPane();
t_cena_3 = new javax.swing.JTextArea();
jLabel15 = new javax.swing.JLabel();
jLabel16 = new javax.swing.JLabel();
jLabel17 = new javax.swing.JLabel();
jLabel18 = new javax.swing.JLabel();
jLabel19 = new javax.swing.JLabel();
jLabel20 = new javax.swing.JLabel();
jLabel21 = new javax.swing.JLabel();
jScrollPane23 = new javax.swing.JScrollPane();
t_desayuno_3 = new javax.swing.JTextArea();
jScrollPane24 = new javax.swing.JScrollPane();
desayuno_3 = new javax.swing.JTextArea();
jScrollPane25 = new javax.swing.JScrollPane();
t_colacion1_3 = new javax.swing.JTextArea();
jScrollPane26 = new javax.swing.JScrollPane();
t_comida_3 = new javax.swing.JTextArea();
jScrollPane27 = new javax.swing.JScrollPane();
t_colacion2_3 = new javax.swing.JTextArea();
jScrollPane28 = new javax.swing.JScrollPane();
colacion2_3 = new javax.swing.JTextArea();
jScrollPane29 = new javax.swing.JScrollPane();
comida_3 = new javax.swing.JTextArea();
jScrollPane30 = new javax.swing.JScrollPane();
colacion1_3 = new javax.swing.JTextArea();
jButton13 = new javax.swing.JButton();
jButton14 = new javax.swing.JButton();
jButton15 = new javax.swing.JButton();
jButton16 = new javax.swing.JButton();
jButton17 = new javax.swing.JButton();
jPanel4 = new javax.swing.JPanel();
jScrollPane31 = new javax.swing.JScrollPane();
cena_4 = new javax.swing.JTextArea();
jScrollPane32 = new javax.swing.JScrollPane();
t_cena_4 = new javax.swing.JTextArea();
jLabel22 = new javax.swing.JLabel();
jLabel23 = new javax.swing.JLabel();
jLabel24 = new javax.swing.JLabel();
jLabel25 = new javax.swing.JLabel();
jLabel26 = new javax.swing.JLabel();
jLabel27 = new javax.swing.JLabel();
jLabel28 = new javax.swing.JLabel();
jScrollPane33 = new javax.swing.JScrollPane();
t_desayuno_4 = new javax.swing.JTextArea();
jScrollPane34 = new javax.swing.JScrollPane();
desayuno_4 = new javax.swing.JTextArea();
jScrollPane35 = new javax.swing.JScrollPane();
t_colacion1_4 = new javax.swing.JTextArea();
jScrollPane36 = new javax.swing.JScrollPane();
t_comida_4 = new javax.swing.JTextArea();
jScrollPane37 = new javax.swing.JScrollPane();
t_colacion2_4 = new javax.swing.JTextArea();
jScrollPane38 = new javax.swing.JScrollPane();
colacion2_4 = new javax.swing.JTextArea();
jScrollPane39 = new javax.swing.JScrollPane();
comida_4 = new javax.swing.JTextArea();
jScrollPane40 = new javax.swing.JScrollPane();
colacion1_4 = new javax.swing.JTextArea();
jButton18 = new javax.swing.JButton();
jButton19 = new javax.swing.JButton();
jButton20 = new javax.swing.JButton();
jButton21 = new javax.swing.JButton();
jButton22 = new javax.swing.JButton();
jPanel5 = new javax.swing.JPanel();
jScrollPane41 = new javax.swing.JScrollPane();
cena_5 = new javax.swing.JTextArea();
jScrollPane42 = new javax.swing.JScrollPane();
t_cena_5 = new javax.swing.JTextArea();
jLabel29 = new javax.swing.JLabel();
jLabel30 = new javax.swing.JLabel();
jLabel31 = new javax.swing.JLabel();
jLabel32 = new javax.swing.JLabel();
jLabel33 = new javax.swing.JLabel();
jLabel34 = new javax.swing.JLabel();
jLabel35 = new javax.swing.JLabel();
jScrollPane43 = new javax.swing.JScrollPane();
t_desayuno_5 = new javax.swing.JTextArea();
jScrollPane44 = new javax.swing.JScrollPane();
desayuno_5 = new javax.swing.JTextArea();
jScrollPane45 = new javax.swing.JScrollPane();
t_colacion1_5 = new javax.swing.JTextArea();
jScrollPane46 = new javax.swing.JScrollPane();
t_comida_5 = new javax.swing.JTextArea();
jScrollPane47 = new javax.swing.JScrollPane();
t_colacion2_5 = new javax.swing.JTextArea();
jScrollPane48 = new javax.swing.JScrollPane();
colacion2_5 = new javax.swing.JTextArea();
jScrollPane49 = new javax.swing.JScrollPane();
comida_5 = new javax.swing.JTextArea();
jScrollPane50 = new javax.swing.JScrollPane();
colacion1_5 = new javax.swing.JTextArea();
jButton23 = new javax.swing.JButton();
jButton24 = new javax.swing.JButton();
jButton25 = new javax.swing.JButton();
jButton26 = new javax.swing.JButton();
jButton27 = new javax.swing.JButton();
jPanel6 = new javax.swing.JPanel();
jScrollPane51 = new javax.swing.JScrollPane();
cena_6 = new javax.swing.JTextArea();
jScrollPane52 = new javax.swing.JScrollPane();
t_cena_6 = new javax.swing.JTextArea();
jLabel36 = new javax.swing.JLabel();
jLabel37 = new javax.swing.JLabel();
jLabel38 = new javax.swing.JLabel();
jLabel39 = new javax.swing.JLabel();
jLabel40 = new javax.swing.JLabel();
jLabel41 = new javax.swing.JLabel();
jLabel42 = new javax.swing.JLabel();
jScrollPane53 = new javax.swing.JScrollPane();
t_desayuno_6 = new javax.swing.JTextArea();
jScrollPane54 = new javax.swing.JScrollPane();
desayuno_6 = new javax.swing.JTextArea();
jScrollPane55 = new javax.swing.JScrollPane();
t_colacion1_6 = new javax.swing.JTextArea();
jScrollPane56 = new javax.swing.JScrollPane();
t_comida_6 = new javax.swing.JTextArea();
jScrollPane57 = new javax.swing.JScrollPane();
t_colacion2_6 = new javax.swing.JTextArea();
jScrollPane58 = new javax.swing.JScrollPane();
colacion2_6 = new javax.swing.JTextArea();
jScrollPane59 = new javax.swing.JScrollPane();
comida_6 = new javax.swing.JTextArea();
jScrollPane60 = new javax.swing.JScrollPane();
colacion1_6 = new javax.swing.JTextArea();
jButton28 = new javax.swing.JButton();
jButton29 = new javax.swing.JButton();
jButton30 = new javax.swing.JButton();
jButton31 = new javax.swing.JButton();
jButton32 = new javax.swing.JButton();
jPanel7 = new javax.swing.JPanel();
jScrollPane61 = new javax.swing.JScrollPane();
cena_7 = new javax.swing.JTextArea();
jScrollPane62 = new javax.swing.JScrollPane();
t_cena_7 = new javax.swing.JTextArea();
jLabel43 = new javax.swing.JLabel();
jLabel44 = new javax.swing.JLabel();
jLabel45 = new javax.swing.JLabel();
jLabel46 = new javax.swing.JLabel();
jLabel47 = new javax.swing.JLabel();
jLabel48 = new javax.swing.JLabel();
jLabel49 = new javax.swing.JLabel();
jScrollPane63 = new javax.swing.JScrollPane();
t_desayuno_7 = new javax.swing.JTextArea();
jScrollPane64 = new javax.swing.JScrollPane();
desayuno_7 = new javax.swing.JTextArea();
jScrollPane65 = new javax.swing.JScrollPane();
t_colacion1_7 = new javax.swing.JTextArea();
jScrollPane66 = new javax.swing.JScrollPane();
t_comida_7 = new javax.swing.JTextArea();
jScrollPane67 = new javax.swing.JScrollPane();
t_colacion2_7 = new javax.swing.JTextArea();
jScrollPane68 = new javax.swing.JScrollPane();
colacion2_7 = new javax.swing.JTextArea();
jScrollPane69 = new javax.swing.JScrollPane();
comida_7 = new javax.swing.JTextArea();
jScrollPane70 = new javax.swing.JScrollPane();
colacion1_7 = new javax.swing.JTextArea();
jButton33 = new javax.swing.JButton();
jButton34 = new javax.swing.JButton();
jButton35 = new javax.swing.JButton();
jButton36 = new javax.swing.JButton();
jButton37 = new javax.swing.JButton();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Ingresar dieta");
jPanel1.setBackground(new java.awt.Color(175, 228, 202));
jLabel1.setText("Desayuno");
jLabel2.setText("Titulo");
jLabel3.setText("Ingredientes");
jLabel4.setText("Colacion 1");
jLabel5.setText("Comida");
jLabel6.setText("Colacion 2");
jLabel7.setText("Cena");
t_desayuno_1.setColumns(20);
t_desayuno_1.setLineWrap(true);
t_desayuno_1.setRows(3);
jScrollPane1.setViewportView(t_desayuno_1);
t_colacion1_1.setColumns(20);
t_colacion1_1.setLineWrap(true);
t_colacion1_1.setRows(3);
jScrollPane2.setViewportView(t_colacion1_1);
t_comida_1.setColumns(20);
t_comida_1.setLineWrap(true);
t_comida_1.setRows(3);
jScrollPane3.setViewportView(t_comida_1);
t_colacion2_1.setColumns(20);
t_colacion2_1.setLineWrap(true);
t_colacion2_1.setRows(3);
jScrollPane4.setViewportView(t_colacion2_1);
t_cena_1.setColumns(20);
t_cena_1.setLineWrap(true);
t_cena_1.setRows(3);
jScrollPane5.setViewportView(t_cena_1);
desayuno_1.setColumns(20);
desayuno_1.setLineWrap(true);
desayuno_1.setRows(3);
jScrollPane6.setViewportView(desayuno_1);
colacion1_1.setColumns(20);
colacion1_1.setLineWrap(true);
colacion1_1.setRows(3);
jScrollPane7.setViewportView(colacion1_1);
comida_1.setColumns(20);
comida_1.setLineWrap(true);
comida_1.setRows(3);
jScrollPane8.setViewportView(comida_1);
colacion2_1.setColumns(20);
colacion2_1.setLineWrap(true);
colacion2_1.setRows(3);
jScrollPane9.setViewportView(colacion2_1);
cena_1.setColumns(20);
cena_1.setLineWrap(true);
cena_1.setRows(3);
jScrollPane10.setViewportView(cena_1);
jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/botones/llenar.png"))); // NOI18N
jButton3.setText("Llenar");
jButton3.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jButton4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/botones/llenar.png"))); // NOI18N
jButton4.setText("Llenar");
jButton4.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
jButton5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/botones/llenar.png"))); // NOI18N
jButton5.setText("Llenar");
jButton5.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});
jButton6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/botones/llenar.png"))); // NOI18N
jButton6.setText("Llenar");
jButton6.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton6ActionPerformed(evt);
}
});
jButton7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/botones/llenar.png"))); // NOI18N
jButton7.setText("Llenar");
jButton7.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton7ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(160, 160, 160)
.addComponent(jLabel2)
.addGap(223, 223, 223)
.addComponent(jLabel3))
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel7)
.addComponent(jLabel1)
.addComponent(jLabel6)
.addComponent(jLabel4)
.addComponent(jLabel5))
.addGap(29, 29, 29)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane10))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane9))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 350, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, 350, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton5)
.addComponent(jButton6)
.addComponent(jButton7)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 350, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton4)
.addComponent(jButton3))))))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jLabel3))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(36, 36, 36)
.addComponent(jLabel1))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(17, 17, 17))
.addComponent(jScrollPane6, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(37, 37, 37)
.addComponent(jLabel4))
.addGroup(jPanel1Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(28, 28, 28)
.addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(7, 7, 7)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(19, 19, 19)
.addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane9, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(19, 19, 19)))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jScrollPane10, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(21, 21, 21))))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel5)
.addGap(61, 61, 61)
.addComponent(jLabel6)
.addGap(66, 66, 66)
.addComponent(jLabel7)
.addGap(23, 23, 23)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jTabbedPane1.addTab("Lunes", jPanel1);
jPanel2.setBackground(new java.awt.Color(175, 228, 202));
cena_2.setColumns(20);
cena_2.setLineWrap(true);
cena_2.setRows(3);
jScrollPane11.setViewportView(cena_2);
t_cena_2.setColumns(20);
t_cena_2.setLineWrap(true);
t_cena_2.setRows(3);
jScrollPane12.setViewportView(t_cena_2);
jLabel8.setText("Cena");
jLabel9.setText("Colacion 2");
jLabel10.setText("Comida");
jLabel11.setText("Colacion 1");
jLabel12.setText("Desayuno");
jLabel13.setText("Titulo");
jLabel14.setText("Ingredientes");
t_desayuno_2.setColumns(20);
t_desayuno_2.setLineWrap(true);
t_desayuno_2.setRows(3);
jScrollPane13.setViewportView(t_desayuno_2);
desayuno_2.setColumns(20);
desayuno_2.setLineWrap(true);
desayuno_2.setRows(3);
jScrollPane14.setViewportView(desayuno_2);
t_colacion1_2.setColumns(20);
t_colacion1_2.setLineWrap(true);
t_colacion1_2.setRows(3);
jScrollPane15.setViewportView(t_colacion1_2);
t_comida_2.setColumns(20);
t_comida_2.setLineWrap(true);
t_comida_2.setRows(3);
jScrollPane16.setViewportView(t_comida_2);
t_colacion2_2.setColumns(20);
t_colacion2_2.setLineWrap(true);
t_colacion2_2.setRows(3);
jScrollPane17.setViewportView(t_colacion2_2);
colacion2_2.setColumns(20);
colacion2_2.setLineWrap(true);
colacion2_2.setRows(3);
jScrollPane18.setViewportView(colacion2_2);
comida_2.setColumns(20);
comida_2.setLineWrap(true);
comida_2.setRows(3);
jScrollPane19.setViewportView(comida_2);
colacion1_2.setColumns(20);
colacion1_2.setLineWrap(true);
colacion1_2.setRows(3);
jScrollPane20.setViewportView(colacion1_2);
jButton8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/botones/llenar.png"))); // NOI18N
jButton8.setText("Llenar");
jButton8.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton8ActionPerformed(evt);
}
});
jButton9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/botones/llenar.png"))); // NOI18N
jButton9.setText("Llenar");
jButton9.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton9.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton9ActionPerformed(evt);
}
});
jButton10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/botones/llenar.png"))); // NOI18N
jButton10.setText("Llenar");
jButton10.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton10.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton10ActionPerformed(evt);
}
});
jButton11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/botones/llenar.png"))); // NOI18N
jButton11.setText("Llenar");
jButton11.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton11.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton11ActionPerformed(evt);
}
});
jButton12.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/botones/llenar.png"))); // NOI18N
jButton12.setText("Llenar");
jButton12.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton12.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton12ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(160, 160, 160)
.addComponent(jLabel13)
.addGap(220, 220, 220)
.addComponent(jLabel14)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel8)
.addComponent(jLabel12)
.addComponent(jLabel9)
.addComponent(jLabel11)
.addComponent(jLabel10))
.addGap(29, 29, 29)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jScrollPane12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane11, javax.swing.GroupLayout.DEFAULT_SIZE, 350, Short.MAX_VALUE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jScrollPane17, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane18))
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jScrollPane16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane19))
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jScrollPane15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane20))
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jScrollPane13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane14)))
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(18, 18, 18)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton9)
.addComponent(jButton12))
.addComponent(jButton8)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton10)
.addComponent(jButton11))))
.addContainerGap())
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel13)
.addComponent(jLabel14))
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(36, 36, 36)
.addComponent(jLabel12))
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(6, 6, 6)
.addComponent(jScrollPane14, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addComponent(jScrollPane13, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(37, 37, 37)
.addComponent(jLabel11))
.addGroup(jPanel2Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane20, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jScrollPane15, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel10)
.addGap(61, 61, 61)
.addComponent(jLabel9)
.addGap(66, 66, 66)
.addComponent(jLabel8)
.addGap(42, 42, 42))
.addGroup(jPanel2Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane16, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jScrollPane19, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane17, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jScrollPane18, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jScrollPane12, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jScrollPane11, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(15, Short.MAX_VALUE))))
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(44, 44, 44)
.addComponent(jButton9, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(46, 46, 46)
.addComponent(jButton10, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(43, 43, 43)
.addComponent(jButton11, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(49, 49, 49)
.addComponent(jButton12, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(37, 37, 37))))
);
jTabbedPane1.addTab("Martes", jPanel2);
jPanel3.setBackground(new java.awt.Color(175, 228, 202));
cena_3.setColumns(20);
cena_3.setLineWrap(true);
cena_3.setRows(3);
jScrollPane21.setViewportView(cena_3);
t_cena_3.setColumns(20);
t_cena_3.setLineWrap(true);
t_cena_3.setRows(3);
jScrollPane22.setViewportView(t_cena_3);
jLabel15.setText("Cena");
jLabel16.setText("Colacion 2");
jLabel17.setText("Comida");
jLabel18.setText("Colacion 1");
jLabel19.setText("Desayuno");
jLabel20.setText("Titulo");
jLabel21.setText("Ingredientes");
t_desayuno_3.setColumns(20);
t_desayuno_3.setLineWrap(true);
t_desayuno_3.setRows(3);
jScrollPane23.setViewportView(t_desayuno_3);
desayuno_3.setColumns(20);
desayuno_3.setLineWrap(true);
desayuno_3.setRows(3);
jScrollPane24.setViewportView(desayuno_3);
t_colacion1_3.setColumns(20);
t_colacion1_3.setLineWrap(true);
t_colacion1_3.setRows(3);
jScrollPane25.setViewportView(t_colacion1_3);
t_comida_3.setColumns(20);
t_comida_3.setLineWrap(true);
t_comida_3.setRows(3);
jScrollPane26.setViewportView(t_comida_3);
t_colacion2_3.setColumns(20);
t_colacion2_3.setLineWrap(true);
t_colacion2_3.setRows(3);
jScrollPane27.setViewportView(t_colacion2_3);
colacion2_3.setColumns(20);
colacion2_3.setLineWrap(true);
colacion2_3.setRows(3);
jScrollPane28.setViewportView(colacion2_3);
comida_3.setColumns(20);
comida_3.setLineWrap(true);
comida_3.setRows(3);
jScrollPane29.setViewportView(comida_3);
colacion1_3.setColumns(20);
colacion1_3.setLineWrap(true);
colacion1_3.setRows(3);
jScrollPane30.setViewportView(colacion1_3);
jButton13.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/botones/llenar.png"))); // NOI18N
jButton13.setText("Llenar");
jButton13.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton13.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton13ActionPerformed(evt);
}
});
jButton14.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/botones/llenar.png"))); // NOI18N
jButton14.setText("Llenar");
jButton14.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton14.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton14ActionPerformed(evt);
}
});
jButton15.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/botones/llenar.png"))); // NOI18N
jButton15.setText("Llenar");
jButton15.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton15.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton15ActionPerformed(evt);
}
});
jButton16.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/botones/llenar.png"))); // NOI18N
jButton16.setText("Llenar");
jButton16.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton16.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton16ActionPerformed(evt);
}
});
jButton17.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/botones/llenar.png"))); // NOI18N
jButton17.setText("Llenar");
jButton17.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton17.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton17ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(160, 160, 160)
.addComponent(jLabel20)
.addGap(225, 225, 225)
.addComponent(jLabel21)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel15)
.addComponent(jLabel19)
.addComponent(jLabel16)
.addComponent(jLabel18)
.addComponent(jLabel17))
.addGap(29, 29, 29)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(jScrollPane22, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane21, javax.swing.GroupLayout.DEFAULT_SIZE, 350, Short.MAX_VALUE))
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(jScrollPane27, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane28))
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(jScrollPane26, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane29))
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(jScrollPane25, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane30))
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(jScrollPane23, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane24)))
.addGap(18, 18, 18)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton14)
.addComponent(jButton16)
.addComponent(jButton17))
.addComponent(jButton15, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jButton13, javax.swing.GroupLayout.Alignment.TRAILING))
.addContainerGap())
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel20)
.addComponent(jLabel21))
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(36, 36, 36)
.addComponent(jLabel19))
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(6, 6, 6)
.addComponent(jScrollPane24, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addComponent(jScrollPane23, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(37, 37, 37)
.addComponent(jLabel18))
.addGroup(jPanel3Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane30, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jScrollPane25, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel17)
.addGap(61, 61, 61)
.addComponent(jLabel16)
.addGap(66, 66, 66)
.addComponent(jLabel15)
.addGap(42, 42, 42))
.addGroup(jPanel3Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane26, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jScrollPane29, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane27, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jScrollPane28, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jScrollPane22, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jScrollPane21, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(14, Short.MAX_VALUE))))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton13, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(43, 43, 43)
.addComponent(jButton14, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(45, 45, 45)
.addComponent(jButton15, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(45, 45, 45)
.addComponent(jButton16, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(51, 51, 51)
.addComponent(jButton17, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(34, 34, 34))
);
jTabbedPane1.addTab("Miercoles", jPanel3);
jPanel4.setBackground(new java.awt.Color(175, 228, 202));
cena_4.setColumns(20);
cena_4.setRows(3);
jScrollPane31.setViewportView(cena_4);
t_cena_4.setColumns(20);
t_cena_4.setRows(3);
jScrollPane32.setViewportView(t_cena_4);
jLabel22.setText("Cena");
jLabel23.setText("Colacion 2");
jLabel24.setText("Comida");
jLabel25.setText("Colacion 1");
jLabel26.setText("Desayuno");
jLabel27.setText("Titulo");
jLabel28.setText("Ingredientes");
t_desayuno_4.setColumns(20);
t_desayuno_4.setRows(3);
jScrollPane33.setViewportView(t_desayuno_4);
desayuno_4.setColumns(20);
desayuno_4.setRows(3);
jScrollPane34.setViewportView(desayuno_4);
t_colacion1_4.setColumns(20);
t_colacion1_4.setRows(3);
jScrollPane35.setViewportView(t_colacion1_4);
t_comida_4.setColumns(20);
t_comida_4.setRows(3);
jScrollPane36.setViewportView(t_comida_4);
t_colacion2_4.setColumns(20);
t_colacion2_4.setRows(3);
jScrollPane37.setViewportView(t_colacion2_4);
colacion2_4.setColumns(20);
colacion2_4.setRows(3);
jScrollPane38.setViewportView(colacion2_4);
comida_4.setColumns(20);
comida_4.setRows(3);
jScrollPane39.setViewportView(comida_4);
colacion1_4.setColumns(20);
colacion1_4.setRows(3);
jScrollPane40.setViewportView(colacion1_4);
jButton18.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/botones/llenar.png"))); // NOI18N
jButton18.setText("Llenar");
jButton18.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton18.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton18ActionPerformed(evt);
}
});
jButton19.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/botones/llenar.png"))); // NOI18N
jButton19.setText("Llenar");
jButton19.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton19.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton19ActionPerformed(evt);
}
});
jButton20.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/botones/llenar.png"))); // NOI18N
jButton20.setText("Llenar");
jButton20.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton20.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton20ActionPerformed(evt);
}
});
jButton21.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/botones/llenar.png"))); // NOI18N
jButton21.setText("Llenar");
jButton21.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton21.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton21ActionPerformed(evt);
}
});
jButton22.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/botones/llenar.png"))); // NOI18N
jButton22.setText("Llenar");
jButton22.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton22.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton22ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(160, 160, 160)
.addComponent(jLabel27)
.addGap(222, 222, 222)
.addComponent(jLabel28)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel22)
.addComponent(jLabel26)
.addComponent(jLabel23)
.addComponent(jLabel25)
.addComponent(jLabel24))
.addGap(29, 29, 29)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addComponent(jScrollPane32, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane31, javax.swing.GroupLayout.DEFAULT_SIZE, 350, Short.MAX_VALUE))
.addGroup(jPanel4Layout.createSequentialGroup()
.addComponent(jScrollPane37, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane38))
.addGroup(jPanel4Layout.createSequentialGroup()
.addComponent(jScrollPane36, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane39))
.addGroup(jPanel4Layout.createSequentialGroup()
.addComponent(jScrollPane35, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane40))
.addGroup(jPanel4Layout.createSequentialGroup()
.addComponent(jScrollPane33, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane34)))
.addGap(18, 18, 18)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton19)
.addComponent(jButton21)
.addComponent(jButton22))
.addComponent(jButton20, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jButton18, javax.swing.GroupLayout.Alignment.TRAILING))))
.addContainerGap())
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel27)
.addComponent(jLabel28))
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(36, 36, 36)
.addComponent(jLabel26))
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(6, 6, 6)
.addComponent(jScrollPane34, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addComponent(jScrollPane33, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(37, 37, 37)
.addComponent(jLabel25))
.addGroup(jPanel4Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane40, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jScrollPane35, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel24)
.addGap(61, 61, 61)
.addComponent(jLabel23)
.addGap(66, 66, 66)
.addComponent(jLabel22)
.addGap(42, 42, 42))
.addGroup(jPanel4Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane36, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jScrollPane39, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane37, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jScrollPane38, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jScrollPane32, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jScrollPane31, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(13, Short.MAX_VALUE))))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton18, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(43, 43, 43)
.addComponent(jButton19, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(45, 45, 45)
.addComponent(jButton20, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(45, 45, 45)
.addComponent(jButton21, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(51, 51, 51)
.addComponent(jButton22, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(33, 33, 33))
);
jTabbedPane1.addTab("Jueves", jPanel4);
jPanel5.setBackground(new java.awt.Color(175, 228, 202));
cena_5.setColumns(20);
cena_5.setLineWrap(true);
cena_5.setRows(3);
jScrollPane41.setViewportView(cena_5);
t_cena_5.setColumns(20);
t_cena_5.setLineWrap(true);
t_cena_5.setRows(3);
jScrollPane42.setViewportView(t_cena_5);
jLabel29.setText("Cena");
jLabel30.setText("Colacion 2");
jLabel31.setText("Comida");
jLabel32.setText("Colacion 1");
jLabel33.setText("Desayuno");
jLabel34.setText("Titulo");
jLabel35.setText("Ingredientes");
t_desayuno_5.setColumns(20);
t_desayuno_5.setLineWrap(true);
t_desayuno_5.setRows(3);
jScrollPane43.setViewportView(t_desayuno_5);
desayuno_5.setColumns(20);
desayuno_5.setLineWrap(true);
desayuno_5.setRows(3);
jScrollPane44.setViewportView(desayuno_5);
t_colacion1_5.setColumns(20);
t_colacion1_5.setLineWrap(true);
t_colacion1_5.setRows(3);
jScrollPane45.setViewportView(t_colacion1_5);
t_comida_5.setColumns(20);
t_comida_5.setLineWrap(true);
t_comida_5.setRows(3);
jScrollPane46.setViewportView(t_comida_5);
t_colacion2_5.setColumns(20);
t_colacion2_5.setLineWrap(true);
t_colacion2_5.setRows(3);
jScrollPane47.setViewportView(t_colacion2_5);
colacion2_5.setColumns(20);
colacion2_5.setLineWrap(true);
colacion2_5.setRows(3);
jScrollPane48.setViewportView(colacion2_5);
comida_5.setColumns(20);
comida_5.setLineWrap(true);
comida_5.setRows(3);
jScrollPane49.setViewportView(comida_5);
colacion1_5.setColumns(20);
colacion1_5.setLineWrap(true);
colacion1_5.setRows(3);
jScrollPane50.setViewportView(colacion1_5);
jButton23.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/botones/llenar.png"))); // NOI18N
jButton23.setText("Llenar");
jButton23.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton23.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton23ActionPerformed(evt);
}
});
jButton24.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/botones/llenar.png"))); // NOI18N
jButton24.setText("Llenar");
jButton24.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton24.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton24ActionPerformed(evt);
}
});
jButton25.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/botones/llenar.png"))); // NOI18N
jButton25.setText("Llenar");
jButton25.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton25.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton25ActionPerformed(evt);
}
});
jButton26.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/botones/llenar.png"))); // NOI18N
jButton26.setText("Llenar");
jButton26.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton26.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton26ActionPerformed(evt);
}
});
jButton27.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/botones/llenar.png"))); // NOI18N
jButton27.setText("Llenar");
jButton27.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton27.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton27ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(160, 160, 160)
.addComponent(jLabel34)
.addGap(225, 225, 225)
.addComponent(jLabel35)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanel5Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel29)
.addComponent(jLabel33)
.addComponent(jLabel30)
.addComponent(jLabel32)
.addComponent(jLabel31))
.addGap(29, 29, 29)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addComponent(jScrollPane42, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane41, javax.swing.GroupLayout.DEFAULT_SIZE, 350, Short.MAX_VALUE))
.addGroup(jPanel5Layout.createSequentialGroup()
.addComponent(jScrollPane47, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane48))
.addGroup(jPanel5Layout.createSequentialGroup()
.addComponent(jScrollPane46, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane49))
.addGroup(jPanel5Layout.createSequentialGroup()
.addComponent(jScrollPane45, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane50))
.addGroup(jPanel5Layout.createSequentialGroup()
.addComponent(jScrollPane43, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane44)))
.addGap(18, 18, 18)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton24)
.addComponent(jButton26)
.addComponent(jButton27))
.addComponent(jButton25, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jButton23, javax.swing.GroupLayout.Alignment.TRAILING))
.addContainerGap())
);
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel34)
.addComponent(jLabel35))
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(36, 36, 36)
.addComponent(jLabel33))
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(6, 6, 6)
.addComponent(jScrollPane44, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addComponent(jScrollPane43, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(37, 37, 37)
.addComponent(jLabel32))
.addGroup(jPanel5Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane50, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jScrollPane45, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel31)
.addGap(61, 61, 61)
.addComponent(jLabel30)
.addGap(66, 66, 66)
.addComponent(jLabel29)
.addGap(42, 42, 42))
.addGroup(jPanel5Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane46, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jScrollPane49, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane47, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jScrollPane48, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jScrollPane42, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jScrollPane41, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(15, Short.MAX_VALUE))))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton23, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(43, 43, 43)
.addComponent(jButton24, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(45, 45, 45)
.addComponent(jButton25, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(45, 45, 45)
.addComponent(jButton26, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(51, 51, 51)
.addComponent(jButton27, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(35, 35, 35))
);
jTabbedPane1.addTab("Viernes", jPanel5);
jPanel6.setBackground(new java.awt.Color(175, 228, 202));
cena_6.setColumns(20);
cena_6.setLineWrap(true);
cena_6.setRows(3);
jScrollPane51.setViewportView(cena_6);
t_cena_6.setColumns(20);
t_cena_6.setLineWrap(true);
t_cena_6.setRows(3);
jScrollPane52.setViewportView(t_cena_6);
jLabel36.setText("Cena");
jLabel37.setText("Colacion 2");
jLabel38.setText("Comida");
jLabel39.setText("Colacion 1");
jLabel40.setText("Desayuno");
jLabel41.setText("Titulo");
jLabel42.setText("Ingredientes");
t_desayuno_6.setColumns(20);
t_desayuno_6.setLineWrap(true);
t_desayuno_6.setRows(3);
jScrollPane53.setViewportView(t_desayuno_6);
desayuno_6.setColumns(20);
desayuno_6.setLineWrap(true);
desayuno_6.setRows(3);
jScrollPane54.setViewportView(desayuno_6);
t_colacion1_6.setColumns(20);
t_colacion1_6.setLineWrap(true);
t_colacion1_6.setRows(3);
jScrollPane55.setViewportView(t_colacion1_6);
t_comida_6.setColumns(20);
t_comida_6.setLineWrap(true);
t_comida_6.setRows(3);
jScrollPane56.setViewportView(t_comida_6);
t_colacion2_6.setColumns(20);
t_colacion2_6.setLineWrap(true);
t_colacion2_6.setRows(3);
jScrollPane57.setViewportView(t_colacion2_6);
colacion2_6.setColumns(20);
colacion2_6.setLineWrap(true);
colacion2_6.setRows(3);
jScrollPane58.setViewportView(colacion2_6);
comida_6.setColumns(20);
comida_6.setLineWrap(true);
comida_6.setRows(3);
jScrollPane59.setViewportView(comida_6);
colacion1_6.setColumns(20);
colacion1_6.setLineWrap(true);
colacion1_6.setRows(3);
jScrollPane60.setViewportView(colacion1_6);
jButton28.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/botones/llenar.png"))); // NOI18N
jButton28.setText("Llenar");
jButton28.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton28.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton28ActionPerformed(evt);
}
});
jButton29.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/botones/llenar.png"))); // NOI18N
jButton29.setText("Llenar");
jButton29.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton29.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton29ActionPerformed(evt);
}
});
jButton30.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/botones/llenar.png"))); // NOI18N
jButton30.setText("Llenar");
jButton30.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton30.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton30ActionPerformed(evt);
}
});
jButton31.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/botones/llenar.png"))); // NOI18N
jButton31.setText("Llenar");
jButton31.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton31.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton31ActionPerformed(evt);
}
});
jButton32.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/botones/llenar.png"))); // NOI18N
jButton32.setText("Llenar");
jButton32.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton32.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton32ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
jPanel6.setLayout(jPanel6Layout);
jPanel6Layout.setHorizontalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addGap(160, 160, 160)
.addComponent(jLabel41)
.addGap(223, 223, 223)
.addComponent(jLabel42)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanel6Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel36)
.addComponent(jLabel40)
.addComponent(jLabel37)
.addComponent(jLabel39)
.addComponent(jLabel38))
.addGap(29, 29, 29)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addComponent(jScrollPane52, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane51, javax.swing.GroupLayout.DEFAULT_SIZE, 350, Short.MAX_VALUE))
.addGroup(jPanel6Layout.createSequentialGroup()
.addComponent(jScrollPane57, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane58))
.addGroup(jPanel6Layout.createSequentialGroup()
.addComponent(jScrollPane56, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane59))
.addGroup(jPanel6Layout.createSequentialGroup()
.addComponent(jScrollPane55, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane60))
.addGroup(jPanel6Layout.createSequentialGroup()
.addComponent(jScrollPane53, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane54)))
.addGap(18, 18, 18)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton29)
.addComponent(jButton31)
.addComponent(jButton32))
.addComponent(jButton30, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jButton28, javax.swing.GroupLayout.Alignment.TRAILING))
.addContainerGap())
);
jPanel6Layout.setVerticalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel41, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel42, javax.swing.GroupLayout.Alignment.TRAILING))
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addGap(36, 36, 36)
.addComponent(jLabel40))
.addGroup(jPanel6Layout.createSequentialGroup()
.addGap(6, 6, 6)
.addComponent(jScrollPane54, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addComponent(jScrollPane53, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addGap(37, 37, 37)
.addComponent(jLabel39))
.addGroup(jPanel6Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane60, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jScrollPane55, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel38)
.addGap(61, 61, 61)
.addComponent(jLabel37)
.addGap(66, 66, 66)
.addComponent(jLabel36)
.addGap(42, 42, 42))
.addGroup(jPanel6Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane56, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jScrollPane59, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane57, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jScrollPane58, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jScrollPane52, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jScrollPane51, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(12, Short.MAX_VALUE))))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton28, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(43, 43, 43)
.addComponent(jButton29, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(45, 45, 45)
.addComponent(jButton30, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(45, 45, 45)
.addComponent(jButton31, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(51, 51, 51)
.addComponent(jButton32, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(32, 32, 32))
);
jTabbedPane1.addTab("Sabado", jPanel6);
jPanel7.setBackground(new java.awt.Color(175, 228, 202));
cena_7.setColumns(20);
cena_7.setLineWrap(true);
cena_7.setRows(3);
jScrollPane61.setViewportView(cena_7);
t_cena_7.setColumns(20);
t_cena_7.setLineWrap(true);
t_cena_7.setRows(3);
jScrollPane62.setViewportView(t_cena_7);
jLabel43.setText("Cena");
jLabel44.setText("Colacion 2");
jLabel45.setText("Comida");
jLabel46.setText("Colacion 1");
jLabel47.setText("Desayuno");
jLabel48.setText("Titulo");
jLabel49.setText("Ingredientes");
t_desayuno_7.setColumns(20);
t_desayuno_7.setLineWrap(true);
t_desayuno_7.setRows(3);
jScrollPane63.setViewportView(t_desayuno_7);
desayuno_7.setColumns(20);
desayuno_7.setLineWrap(true);
desayuno_7.setRows(3);
jScrollPane64.setViewportView(desayuno_7);
t_colacion1_7.setColumns(20);
t_colacion1_7.setLineWrap(true);
t_colacion1_7.setRows(3);
jScrollPane65.setViewportView(t_colacion1_7);
t_comida_7.setColumns(20);
t_comida_7.setLineWrap(true);
t_comida_7.setRows(3);
jScrollPane66.setViewportView(t_comida_7);
t_colacion2_7.setColumns(20);
t_colacion2_7.setLineWrap(true);
t_colacion2_7.setRows(3);
jScrollPane67.setViewportView(t_colacion2_7);
colacion2_7.setColumns(20);
colacion2_7.setLineWrap(true);
colacion2_7.setRows(3);
jScrollPane68.setViewportView(colacion2_7);
comida_7.setColumns(20);
comida_7.setLineWrap(true);
comida_7.setRows(3);
jScrollPane69.setViewportView(comida_7);
colacion1_7.setColumns(20);
colacion1_7.setLineWrap(true);
colacion1_7.setRows(3);
jScrollPane70.setViewportView(colacion1_7);
jButton33.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/botones/llenar.png"))); // NOI18N
jButton33.setText("Llenar");
jButton33.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton33.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton33ActionPerformed(evt);
}
});
jButton34.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/botones/llenar.png"))); // NOI18N
jButton34.setText("Llenar");
jButton34.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton34.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton34ActionPerformed(evt);
}
});
jButton35.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/botones/llenar.png"))); // NOI18N
jButton35.setText("Llenar");
jButton35.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton35.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton35ActionPerformed(evt);
}
});
jButton36.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/botones/llenar.png"))); // NOI18N
jButton36.setText("Llenar");
jButton36.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton36.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton36ActionPerformed(evt);
}
});
jButton37.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/botones/llenar.png"))); // NOI18N
jButton37.setText("Llenar");
jButton37.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton37.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton37ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
jPanel7.setLayout(jPanel7Layout);
jPanel7Layout.setHorizontalGroup(
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel7Layout.createSequentialGroup()
.addGap(160, 160, 160)
.addComponent(jLabel48)
.addGap(225, 225, 225)
.addComponent(jLabel49)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanel7Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel43)
.addComponent(jLabel47)
.addComponent(jLabel44)
.addComponent(jLabel46)
.addComponent(jLabel45))
.addGap(29, 29, 29)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel7Layout.createSequentialGroup()
.addComponent(jScrollPane62, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane61, javax.swing.GroupLayout.DEFAULT_SIZE, 350, Short.MAX_VALUE))
.addGroup(jPanel7Layout.createSequentialGroup()
.addComponent(jScrollPane67, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane68))
.addGroup(jPanel7Layout.createSequentialGroup()
.addComponent(jScrollPane66, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane69))
.addGroup(jPanel7Layout.createSequentialGroup()
.addComponent(jScrollPane65, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane70))
.addGroup(jPanel7Layout.createSequentialGroup()
.addComponent(jScrollPane63, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane64)))
.addGap(18, 18, 18)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton34)
.addComponent(jButton36)
.addComponent(jButton37))
.addComponent(jButton35, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jButton33, javax.swing.GroupLayout.Alignment.TRAILING))
.addContainerGap())
);
jPanel7Layout.setVerticalGroup(
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel7Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel7Layout.createSequentialGroup()
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel48)
.addComponent(jLabel49))
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel7Layout.createSequentialGroup()
.addGap(36, 36, 36)
.addComponent(jLabel47))
.addGroup(jPanel7Layout.createSequentialGroup()
.addGap(6, 6, 6)
.addComponent(jScrollPane64, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addComponent(jScrollPane63, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel7Layout.createSequentialGroup()
.addGap(37, 37, 37)
.addComponent(jLabel46))
.addGroup(jPanel7Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane70, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jScrollPane65, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel7Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel45)
.addGap(61, 61, 61)
.addComponent(jLabel44)
.addGap(66, 66, 66)
.addComponent(jLabel43)
.addGap(42, 42, 42))
.addGroup(jPanel7Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel7Layout.createSequentialGroup()
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane66, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jScrollPane69, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane67, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jScrollPane68, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jScrollPane62, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jScrollPane61, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(14, Short.MAX_VALUE))))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton33, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(43, 43, 43)
.addComponent(jButton34, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(45, 45, 45)
.addComponent(jButton35, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(45, 45, 45)
.addComponent(jButton36, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(51, 51, 51)
.addComponent(jButton37, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(34, 34, 34))
);
jTabbedPane1.addTab("Domingo", jPanel7);
jButton1.setText("Ingresar");
jButton1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton2.setText("Cancelar");
jButton2.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
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(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
.addComponent(jTabbedPane1)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 441, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
this.setVisible(false);
}//GEN-LAST:event_jButton2ActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
String desayuno_1_txt = desayuno_1.getText();
String colacion1_1_txt = colacion1_1.getText();
String comida_1_txt = comida_1.getText();
String colacion2_1_txt = colacion2_1.getText();
String cena_1_txt = cena_1.getText();
String desayuno_2_txt = desayuno_2.getText();
String colacion1_2_txt = colacion1_2.getText();
String comida_2_txt = comida_2.getText();
String colacion2_2_txt = colacion2_2.getText();
String cena_2_txt = cena_2.getText();
String desayuno_3_txt = desayuno_3.getText();
String colacion1_3_txt = colacion1_3.getText();
String comida_3_txt = comida_3.getText();
String colacion2_3_txt = colacion2_3.getText();
String cena_3_txt = cena_3.getText();
String desayuno_4_txt = desayuno_4.getText();
String colacion1_4_txt = colacion1_4.getText();
String comida_4_txt = comida_4.getText();
String colacion2_4_txt = colacion2_4.getText();
String cena_4_txt = cena_4.getText();
String desayuno_5_txt = desayuno_5.getText();
String colacion1_5_txt = colacion1_5.getText();
String comida_5_txt = comida_5.getText();
String colacion2_5_txt = colacion2_5.getText();
String cena_5_txt = cena_5.getText();
String desayuno_6_txt = desayuno_6.getText();
String colacion1_6_txt = colacion1_6.getText();
String comida_6_txt = comida_6.getText();
String colacion2_6_txt = colacion2_6.getText();
String cena_6_txt = cena_6.getText();
String desayuno_7_txt = desayuno_7.getText();
String colacion1_7_txt = colacion1_7.getText();
String comida_7_txt = comida_7.getText();
String colacion2_7_txt = colacion2_7.getText();
String cena_7_txt = cena_7.getText();
String t_desayuno_1_txt = t_desayuno_1.getText();
String t_colacion1_1_txt = t_colacion1_1.getText();
String t_comida_1_txt = t_comida_1.getText();
String t_colacion2_1_txt = t_colacion2_1.getText();
String t_cena_1_txt = t_cena_1.getText();
String t_desayuno_2_txt = t_desayuno_2.getText();
String t_colacion1_2_txt = t_colacion1_2.getText();
String t_comida_2_txt = t_comida_2.getText();
String t_colacion2_2_txt = t_colacion2_2.getText();
String t_cena_2_txt = t_cena_2.getText();
String t_desayuno_3_txt = t_desayuno_3.getText();
String t_colacion1_3_txt = t_colacion1_3.getText();
String t_comida_3_txt = t_comida_3.getText();
String t_colacion2_3_txt = t_colacion2_3.getText();
String t_cena_3_txt = t_cena_3.getText();
String t_desayuno_4_txt = t_desayuno_4.getText();
String t_colacion1_4_txt = t_colacion1_4.getText();
String t_comida_4_txt = t_comida_4.getText();
String t_colacion2_4_txt = t_colacion2_4.getText();
String t_cena_4_txt = t_cena_4.getText();
String t_desayuno_5_txt = t_desayuno_5.getText();
String t_colacion1_5_txt = t_colacion1_5.getText();
String t_comida_5_txt = t_comida_5.getText();
String t_colacion2_5_txt = t_colacion2_5.getText();
String t_cena_5_txt = t_cena_5.getText();
String t_desayuno_6_txt = t_desayuno_6.getText();
String t_colacion1_6_txt = t_colacion1_6.getText();
String t_comida_6_txt = t_comida_6.getText();
String t_colacion2_6_txt = t_colacion2_6.getText();
String t_cena_6_txt = t_cena_6.getText();
String t_desayuno_7_txt = t_desayuno_7.getText();
String t_colacion1_7_txt = t_colacion1_7.getText();
String t_comida_7_txt = t_comida_7.getText();
String t_colacion2_7_txt = t_colacion2_7.getText();
String t_cena_7_txt = t_cena_7.getText();
Calendar fecha = Calendar.getInstance();
int ano = fecha.get(Calendar.YEAR);
int mes = fecha.get(Calendar.MONTH) + 1;
int dia = fecha.get(Calendar.DAY_OF_MONTH);
String fecha_de_hoy = String.valueOf(ano) + "-" + String.valueOf(mes) + "-" + String.valueOf(dia);
Statement stm;
String sql="";
if (calorias == 1000){
sql = "INSERT INTO dietas_1000 VALUES(NULL,'" + titulo + "','" + fecha_de_hoy + "','" +
t_desayuno_1_txt + "','" + t_desayuno_2_txt + "','" + t_desayuno_3_txt + "','" + t_desayuno_4_txt + "','" + t_desayuno_5_txt + "','" + t_desayuno_6_txt + "','" + t_desayuno_7_txt + "','" +
t_colacion1_1_txt + "','" + t_colacion1_2_txt + "','" + t_colacion1_3_txt + "','" + t_colacion1_4_txt + "','" + t_colacion1_5_txt + "','" + t_colacion1_6_txt + "','" + t_colacion1_7_txt + "','" +
t_comida_1_txt + "','" + t_comida_2_txt + "','" + t_comida_3_txt + "','" + t_comida_4_txt + "','" + t_comida_5_txt + "','" + t_comida_6_txt + "','" + t_comida_7_txt + "','" +
t_colacion2_1_txt + "','" + t_colacion2_2_txt + "','" + t_colacion2_3_txt + "','" + t_colacion2_4_txt + "','" + t_colacion2_5_txt + "','" + t_colacion2_6_txt + "','" + t_colacion2_7_txt + "','" +
t_cena_1_txt + "','" + t_cena_2_txt + "','" + t_cena_3_txt + "','" + t_cena_4_txt + "','" + t_cena_5_txt + "','" + t_cena_6_txt + "','" + t_cena_7_txt + "','" +
desayuno_1_txt + "','" + desayuno_2_txt + "','" + desayuno_3_txt + "','" + desayuno_4_txt + "','" + desayuno_5_txt + "','" + desayuno_6_txt + "','" + desayuno_7_txt + "','" +
colacion1_1_txt + "','" + colacion1_2_txt + "','" + colacion1_3_txt + "','" + colacion1_4_txt + "','" + colacion1_5_txt + "','" + colacion1_6_txt + "','" + colacion1_7_txt + "','" +
comida_1_txt + "','" + comida_2_txt + "','" + comida_3_txt + "','" + comida_4_txt + "','" + comida_5_txt + "','" + comida_6_txt + "','" + comida_7_txt + "','" +
colacion2_1_txt + "','" + colacion2_2_txt + "','" + colacion2_3_txt + "','" + colacion2_4_txt + "','" + colacion2_5_txt + "','" + colacion2_6_txt + "','" + colacion2_7_txt + "','" +
cena_1_txt + "','" + cena_2_txt + "','" + cena_3_txt + "','" + cena_4_txt + "','" + cena_5_txt + "','" + cena_6_txt + "','" + cena_7_txt + "','" + notas + "')";
}
else if(calorias == 1200){
sql = "INSERT INTO dietas_1200 VALUES(NULL,'" + titulo + "','" + fecha_de_hoy + "','" +
t_desayuno_1_txt + "','" + t_desayuno_2_txt + "','" + t_desayuno_3_txt + "','" + t_desayuno_4_txt + "','" + t_desayuno_5_txt + "','" + t_desayuno_6_txt + "','" + t_desayuno_7_txt + "','" +
t_colacion1_1_txt + "','" + t_colacion1_2_txt + "','" + t_colacion1_3_txt + "','" + t_colacion1_4_txt + "','" + t_colacion1_5_txt + "','" + t_colacion1_6_txt + "','" + t_colacion1_7_txt + "','" +
t_comida_1_txt + "','" + t_comida_2_txt + "','" + t_comida_3_txt + "','" + t_comida_4_txt + "','" + t_comida_5_txt + "','" + t_comida_6_txt + "','" + t_comida_7_txt + "','" +
t_colacion2_1_txt + "','" + t_colacion2_2_txt + "','" + t_colacion2_3_txt + "','" + t_colacion2_4_txt + "','" + t_colacion2_5_txt + "','" + t_colacion2_6_txt + "','" + t_colacion2_7_txt + "','" +
t_cena_1_txt + "','" + t_cena_2_txt + "','" + t_cena_3_txt + "','" + t_cena_4_txt + "','" + t_cena_5_txt + "','" + t_cena_6_txt + "','" + t_cena_7_txt + "','" +
desayuno_1_txt + "','" + desayuno_2_txt + "','" + desayuno_3_txt + "','" + desayuno_4_txt + "','" + desayuno_5_txt + "','" + desayuno_6_txt + "','" + desayuno_7_txt + "','" +
colacion1_1_txt + "','" + colacion1_2_txt + "','" + colacion1_3_txt + "','" + colacion1_4_txt + "','" + colacion1_5_txt + "','" + colacion1_6_txt + "','" + colacion1_7_txt + "','" +
comida_1_txt + "','" + comida_2_txt + "','" + comida_3_txt + "','" + comida_4_txt + "','" + comida_5_txt + "','" + comida_6_txt + "','" + comida_7_txt + "','" +
colacion2_1_txt + "','" + colacion2_2_txt + "','" + colacion2_3_txt + "','" + colacion2_4_txt + "','" + colacion2_5_txt + "','" + colacion2_6_txt + "','" + colacion2_7_txt + "','" +
cena_1_txt + "','" + cena_2_txt + "','" + cena_3_txt + "','" + cena_4_txt + "','" + cena_5_txt + "','" + cena_6_txt + "','" + cena_7_txt + "','" + notas + "')";
}
else if(calorias == 1400){
sql = "INSERT INTO dietas_1400 VALUES(NULL,'" + titulo + "','" + fecha_de_hoy + "','" +
t_desayuno_1_txt + "','" + t_desayuno_2_txt + "','" + t_desayuno_3_txt + "','" + t_desayuno_4_txt + "','" + t_desayuno_5_txt + "','" + t_desayuno_6_txt + "','" + t_desayuno_7_txt + "','" +
t_colacion1_1_txt + "','" + t_colacion1_2_txt + "','" + t_colacion1_3_txt + "','" + t_colacion1_4_txt + "','" + t_colacion1_5_txt + "','" + t_colacion1_6_txt + "','" + t_colacion1_7_txt + "','" +
t_comida_1_txt + "','" + t_comida_2_txt + "','" + t_comida_3_txt + "','" + t_comida_4_txt + "','" + t_comida_5_txt + "','" + t_comida_6_txt + "','" + t_comida_7_txt + "','" +
t_colacion2_1_txt + "','" + t_colacion2_2_txt + "','" + t_colacion2_3_txt + "','" + t_colacion2_4_txt + "','" + t_colacion2_5_txt + "','" + t_colacion2_6_txt + "','" + t_colacion2_7_txt + "','" +
t_cena_1_txt + "','" + t_cena_2_txt + "','" + t_cena_3_txt + "','" + t_cena_4_txt + "','" + t_cena_5_txt + "','" + t_cena_6_txt + "','" + t_cena_7_txt + "','" +
desayuno_1_txt + "','" + desayuno_2_txt + "','" + desayuno_3_txt + "','" + desayuno_4_txt + "','" + desayuno_5_txt + "','" + desayuno_6_txt + "','" + desayuno_7_txt + "','" +
colacion1_1_txt + "','" + colacion1_2_txt + "','" + colacion1_3_txt + "','" + colacion1_4_txt + "','" + colacion1_5_txt + "','" + colacion1_6_txt + "','" + colacion1_7_txt + "','" +
comida_1_txt + "','" + comida_2_txt + "','" + comida_3_txt + "','" + comida_4_txt + "','" + comida_5_txt + "','" + comida_6_txt + "','" + comida_7_txt + "','" +
colacion2_1_txt + "','" + colacion2_2_txt + "','" + colacion2_3_txt + "','" + colacion2_4_txt + "','" + colacion2_5_txt + "','" + colacion2_6_txt + "','" + colacion2_7_txt + "','" +
cena_1_txt + "','" + cena_2_txt + "','" + cena_3_txt + "','" + cena_4_txt + "','" + cena_5_txt + "','" + cena_6_txt + "','" + cena_7_txt + "','" + notas + "')";
}
else if(calorias==1600){
sql = "INSERT INTO dietas_1600 VALUES(NULL,'" + titulo + "','" + fecha_de_hoy + "','" +
t_desayuno_1_txt + "','" + t_desayuno_2_txt + "','" + t_desayuno_3_txt + "','" + t_desayuno_4_txt + "','" + t_desayuno_5_txt + "','" + t_desayuno_6_txt + "','" + t_desayuno_7_txt + "','" +
t_colacion1_1_txt + "','" + t_colacion1_2_txt + "','" + t_colacion1_3_txt + "','" + t_colacion1_4_txt + "','" + t_colacion1_5_txt + "','" + t_colacion1_6_txt + "','" + t_colacion1_7_txt + "','" +
t_comida_1_txt + "','" + t_comida_2_txt + "','" + t_comida_3_txt + "','" + t_comida_4_txt + "','" + t_comida_5_txt + "','" + t_comida_6_txt + "','" + t_comida_7_txt + "','" +
t_colacion2_1_txt + "','" + t_colacion2_2_txt + "','" + t_colacion2_3_txt + "','" + t_colacion2_4_txt + "','" + t_colacion2_5_txt + "','" + t_colacion2_6_txt + "','" + t_colacion2_7_txt + "','" +
t_cena_1_txt + "','" + t_cena_2_txt + "','" + t_cena_3_txt + "','" + t_cena_4_txt + "','" + t_cena_5_txt + "','" + t_cena_6_txt + "','" + t_cena_7_txt + "','" +
desayuno_1_txt + "','" + desayuno_2_txt + "','" + desayuno_3_txt + "','" + desayuno_4_txt + "','" + desayuno_5_txt + "','" + desayuno_6_txt + "','" + desayuno_7_txt + "','" +
colacion1_1_txt + "','" + colacion1_2_txt + "','" + colacion1_3_txt + "','" + colacion1_4_txt + "','" + colacion1_5_txt + "','" + colacion1_6_txt + "','" + colacion1_7_txt + "','" +
comida_1_txt + "','" + comida_2_txt + "','" + comida_3_txt + "','" + comida_4_txt + "','" + comida_5_txt + "','" + comida_6_txt + "','" + comida_7_txt + "','" +
colacion2_1_txt + "','" + colacion2_2_txt + "','" + colacion2_3_txt + "','" + colacion2_4_txt + "','" + colacion2_5_txt + "','" + colacion2_6_txt + "','" + colacion2_7_txt + "','" +
cena_1_txt + "','" + cena_2_txt + "','" + cena_3_txt + "','" + cena_4_txt + "','" + cena_5_txt + "','" + cena_6_txt + "','" + cena_7_txt + "','" + notas + "')";
}
else{
sql = "INSERT INTO dietas_1800 VALUES(NULL,'" + titulo + "','" + fecha_de_hoy + "','" +
t_desayuno_1_txt + "','" + t_desayuno_2_txt + "','" + t_desayuno_3_txt + "','" + t_desayuno_4_txt + "','" + t_desayuno_5_txt + "','" + t_desayuno_6_txt + "','" + t_desayuno_7_txt + "','" +
t_colacion1_1_txt + "','" + t_colacion1_2_txt + "','" + t_colacion1_3_txt + "','" + t_colacion1_4_txt + "','" + t_colacion1_5_txt + "','" + t_colacion1_6_txt + "','" + t_colacion1_7_txt + "','" +
t_comida_1_txt + "','" + t_comida_2_txt + "','" + t_comida_3_txt + "','" + t_comida_4_txt + "','" + t_comida_5_txt + "','" + t_comida_6_txt + "','" + t_comida_7_txt + "','" +
t_colacion2_1_txt + "','" + t_colacion2_2_txt + "','" + t_colacion2_3_txt + "','" + t_colacion2_4_txt + "','" + t_colacion2_5_txt + "','" + t_colacion2_6_txt + "','" + t_colacion2_7_txt + "','" +
t_cena_1_txt + "','" + t_cena_2_txt + "','" + t_cena_3_txt + "','" + t_cena_4_txt + "','" + t_cena_5_txt + "','" + t_cena_6_txt + "','" + t_cena_7_txt + "','" +
desayuno_1_txt + "','" + desayuno_2_txt + "','" + desayuno_3_txt + "','" + desayuno_4_txt + "','" + desayuno_5_txt + "','" + desayuno_6_txt + "','" + desayuno_7_txt + "','" +
colacion1_1_txt + "','" + colacion1_2_txt + "','" + colacion1_3_txt + "','" + colacion1_4_txt + "','" + colacion1_5_txt + "','" + colacion1_6_txt + "','" + colacion1_7_txt + "','" +
comida_1_txt + "','" + comida_2_txt + "','" + comida_3_txt + "','" + comida_4_txt + "','" + comida_5_txt + "','" + comida_6_txt + "','" + comida_7_txt + "','" +
colacion2_1_txt + "','" + colacion2_2_txt + "','" + colacion2_3_txt + "','" + colacion2_4_txt + "','" + colacion2_5_txt + "','" + colacion2_6_txt + "','" + colacion2_7_txt + "','" +
cena_1_txt + "','" + cena_2_txt + "','" + cena_3_txt + "','" + cena_4_txt + "','" + cena_5_txt + "','" + cena_6_txt + "','" + cena_7_txt + "','" + notas + "')";
}
try {
stm = co.createStatement();
stm.executeUpdate(sql);
JOptionPane.showMessageDialog(null, "Dieta dada de alta con exito");
DefaultTableModel modelo=(DefaultTableModel) Tabla.getModel();
int filas = Tabla.getRowCount();
for (int i = 0;filas>i; i++)
{
modelo.removeRow(0);
}
String sql_1000 = "SELECT id,titulo,fecha,notas FROM dietas_1000";
String sql_1200 = "SELECT id,titulo,fecha,notas FROM dietas_1200";
String sql_1400 = "SELECT id,titulo,fecha,notas FROM dietas_1400";
String sql_1600 = "SELECT id,titulo,fecha,notas FROM dietas_1600";
String sql_1800 = "SELECT id,titulo,fecha,notas FROM dietas_1800";
String []datos_1000 = new String [5];
stm = co.createStatement();
ResultSet rs = stm.executeQuery(sql_1000);
while(rs.next()){
datos_1000[0]= "1000";
datos_1000[1] =rs.getString("id");
datos_1000[2]=rs.getString("titulo");
datos_1000[3]=rs.getString("fecha");
datos_1000[4]=rs.getString("notas");
modelo.addRow(datos_1000);
}
String []datos_1200 = new String [5];
stm = co.createStatement();
rs = stm.executeQuery(sql_1200);
while(rs.next()){
datos_1200[0]= "1200";
datos_1200[1] =rs.getString("id");
datos_1200[2]=rs.getString("titulo");
datos_1200[3]=rs.getString("fecha");
datos_1200[4]=rs.getString("notas");
modelo.addRow(datos_1200);
}
String []datos_1400 = new String [5];
stm = co.createStatement();
rs = stm.executeQuery(sql_1400);
while(rs.next()){
datos_1400[0]= "1400";
datos_1400[1] =rs.getString("id");
datos_1400[2]=rs.getString("titulo");
datos_1400[3]=rs.getString("fecha");
datos_1400[4]=rs.getString("notas");
modelo.addRow(datos_1400);
}
String []datos_1600 = new String [5];
stm = co.createStatement();
rs = stm.executeQuery(sql_1600);
while(rs.next()){
datos_1600[0]= "1600";
datos_1600[1] =rs.getString("id");
datos_1600[2]=rs.getString("titulo");
datos_1600[3]=rs.getString("fecha");
datos_1600[4]=rs.getString("notas");
modelo.addRow(datos_1600);
}
String []datos_1800 = new String [5];
stm = co.createStatement();
rs = stm.executeQuery(sql_1800);
while(rs.next()){
datos_1800[0]= "1800";
datos_1800[1] =rs.getString("id");
datos_1800[2]=rs.getString("titulo");
datos_1800[3]=rs.getString("fecha");
datos_1800[4]=rs.getString("notas");
modelo.addRow(datos_1800);
}
this.setVisible(false);
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error al ingresar la dieta, intentelo mas tarde");
}
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
int contador = 0;
String sql = "SELECT titulo,ingredientes FROM comidas_predeterminadas WHERE calorias=" + calorias + " AND comida='Desayuno'";
Statement st;
try {
st = co.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
contador++;
}
if (contador == 0){
JOptionPane.showMessageDialog(null, "Actualmente no tienes elementos predeterminados en esta categoria");
return;
}
String[] alimentos = new String[contador];
String[] ingredientes = new String[contador];
int i = 0;
rs = st.executeQuery(sql);
while(rs.next()){
alimentos[i] = rs.getString(1);
ingredientes[i] = rs.getString(2);
i++;
}
String valor = (String) JOptionPane.showInputDialog(this, "Seleccione un alimento", "Seleccionar alimento predeterminado", JOptionPane.INFORMATION_MESSAGE, null, alimentos, alimentos[0]);
t_desayuno_1.setText(valor);
for(int x=0; x<contador; x++){
if(alimentos[x].equals(valor)){
desayuno_1.setText(ingredientes[x]);
}
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error al taratar de mostrar los alimentos predeterminados");
}
}//GEN-LAST:event_jButton3ActionPerformed
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
int contador = 0;
String sql = "SELECT titulo,ingredientes FROM comidas_predeterminadas WHERE calorias=" + calorias + " AND comida='Colacion'";
Statement st;
try {
st = co.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
contador++;
}
if (contador == 0){
JOptionPane.showMessageDialog(null, "Actualmente no tienes elementos predeterminados en esta categoria");
return;
}
String[] alimentos = new String[contador];
String[] ingredientes = new String[contador];
int i = 0;
rs = st.executeQuery(sql);
while(rs.next()){
alimentos[i] = rs.getString(1);
ingredientes[i] = rs.getString(2);
i++;
}
String valor = (String) JOptionPane.showInputDialog(this, "Seleccione un alimento", "Seleccionar alimento predeterminado", JOptionPane.INFORMATION_MESSAGE, null, alimentos, alimentos[0]);
t_colacion1_1.setText(valor);
for(int x=0; x<contador; x++){
if(alimentos[x].equals(valor)){
colacion1_1.setText(ingredientes[x]);
}
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error al taratar de mostrar los alimentos predeterminados");
}
}//GEN-LAST:event_jButton4ActionPerformed
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
int contador = 0;
String sql = "SELECT titulo,ingredientes FROM comidas_predeterminadas WHERE calorias=" + calorias + " AND comida='Comida'";
Statement st;
try {
st = co.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
contador++;
}
if (contador == 0){
JOptionPane.showMessageDialog(null, "Actualmente no tienes elementos predeterminados en esta categoria");
return;
}
String[] alimentos = new String[contador];
String[] ingredientes = new String[contador];
int i = 0;
rs = st.executeQuery(sql);
while(rs.next()){
alimentos[i] = rs.getString(1);
ingredientes[i] = rs.getString(2);
i++;
}
String valor = (String) JOptionPane.showInputDialog(this, "Seleccione un alimento", "Seleccionar alimento predeterminado", JOptionPane.INFORMATION_MESSAGE, null, alimentos, alimentos[0]);
t_comida_1.setText(valor);
for(int x=0; x<contador; x++){
if(alimentos[x].equals(valor)){
comida_1.setText(ingredientes[x]);
}
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error al taratar de mostrar los alimentos predeterminados");
}
}//GEN-LAST:event_jButton5ActionPerformed
private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
int contador = 0;
String sql = "SELECT titulo,ingredientes FROM comidas_predeterminadas WHERE calorias=" + calorias + " AND comida='Colacion'";
Statement st;
try {
st = co.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
contador++;
}
if (contador == 0){
JOptionPane.showMessageDialog(null, "Actualmente no tienes elementos predeterminados en esta categoria");
return;
}
String[] alimentos = new String[contador];
String[] ingredientes = new String[contador];
int i = 0;
rs = st.executeQuery(sql);
while(rs.next()){
alimentos[i] = rs.getString(1);
ingredientes[i] = rs.getString(2);
i++;
}
String valor = (String) JOptionPane.showInputDialog(this, "Seleccione un alimento", "Seleccionar alimento predeterminado", JOptionPane.INFORMATION_MESSAGE, null, alimentos, alimentos[0]);
t_colacion2_1.setText(valor);
for(int x=0; x<contador; x++){
if(alimentos[x].equals(valor)){
colacion2_1.setText(ingredientes[x]);
}
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error al taratar de mostrar los alimentos predeterminados");
}
}//GEN-LAST:event_jButton6ActionPerformed
private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
int contador = 0;
String sql = "SELECT titulo,ingredientes FROM comidas_predeterminadas WHERE calorias=" + calorias + " AND comida='Cena'";
Statement st;
try {
st = co.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
contador++;
}
if (contador == 0){
JOptionPane.showMessageDialog(null, "Actualmente no tienes elementos predeterminados en esta categoria");
return;
}
String[] alimentos = new String[contador];
String[] ingredientes = new String[contador];
int i = 0;
rs = st.executeQuery(sql);
while(rs.next()){
alimentos[i] = rs.getString(1);
ingredientes[i] = rs.getString(2);
i++;
}
String valor = (String) JOptionPane.showInputDialog(this, "Seleccione un alimento", "Seleccionar alimento predeterminado", JOptionPane.INFORMATION_MESSAGE, null, alimentos, alimentos[0]);
t_cena_1.setText(valor);
for(int x=0; x<contador; x++){
if(alimentos[x].equals(valor)){
cena_1.setText(ingredientes[x]);
}
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error al taratar de mostrar los alimentos predeterminados");
}
}//GEN-LAST:event_jButton7ActionPerformed
private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed
int contador = 0;
String sql = "SELECT titulo,ingredientes FROM comidas_predeterminadas WHERE calorias=" + calorias + " AND comida='Desayuno'";
Statement st;
try {
st = co.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
contador++;
}
if (contador == 0){
JOptionPane.showMessageDialog(null, "Actualmente no tienes elementos predeterminados en esta categoria");
return;
}
String[] alimentos = new String[contador];
String[] ingredientes = new String[contador];
int i = 0;
rs = st.executeQuery(sql);
while(rs.next()){
alimentos[i] = rs.getString(1);
ingredientes[i] = rs.getString(2);
i++;
}
String valor = (String) JOptionPane.showInputDialog(this, "Seleccione un alimento", "Seleccionar alimento predeterminado", JOptionPane.INFORMATION_MESSAGE, null, alimentos, alimentos[0]);
t_desayuno_2.setText(valor);
for(int x=0; x<contador; x++){
if(alimentos[x].equals(valor)){
desayuno_2.setText(ingredientes[x]);
}
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error al taratar de mostrar los alimentos predeterminados");
}
}//GEN-LAST:event_jButton8ActionPerformed
private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed
int contador = 0;
String sql = "SELECT titulo,ingredientes FROM comidas_predeterminadas WHERE calorias=" + calorias + " AND comida='Colacion'";
Statement st;
try {
st = co.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
contador++;
}
if (contador == 0){
JOptionPane.showMessageDialog(null, "Actualmente no tienes elementos predeterminados en esta categoria");
return;
}
String[] alimentos = new String[contador];
String[] ingredientes = new String[contador];
int i = 0;
rs = st.executeQuery(sql);
while(rs.next()){
alimentos[i] = rs.getString(1);
ingredientes[i] = rs.getString(2);
i++;
}
String valor = (String) JOptionPane.showInputDialog(this, "Seleccione un alimento", "Seleccionar alimento predeterminado", JOptionPane.INFORMATION_MESSAGE, null, alimentos, alimentos[0]);
t_colacion1_2.setText(valor);
for(int x=0; x<contador; x++){
if(alimentos[x].equals(valor)){
colacion1_2.setText(ingredientes[x]);
}
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error al taratar de mostrar los alimentos predeterminados");
}
}//GEN-LAST:event_jButton9ActionPerformed
private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton10ActionPerformed
int contador = 0;
String sql = "SELECT titulo,ingredientes FROM comidas_predeterminadas WHERE calorias=" + calorias + " AND comida='Comida'";
Statement st;
try {
st = co.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
contador++;
}
if (contador == 0){
JOptionPane.showMessageDialog(null, "Actualmente no tienes elementos predeterminados en esta categoria");
return;
}
String[] alimentos = new String[contador];
String[] ingredientes = new String[contador];
int i = 0;
rs = st.executeQuery(sql);
while(rs.next()){
alimentos[i] = rs.getString(1);
ingredientes[i] = rs.getString(2);
i++;
}
String valor = (String) JOptionPane.showInputDialog(this, "Seleccione un alimento", "Seleccionar alimento predeterminado", JOptionPane.INFORMATION_MESSAGE, null, alimentos, alimentos[0]);
t_comida_2.setText(valor);
for(int x=0; x<contador; x++){
if(alimentos[x].equals(valor)){
comida_2.setText(ingredientes[x]);
}
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error al taratar de mostrar los alimentos predeterminados");
}
}//GEN-LAST:event_jButton10ActionPerformed
private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton11ActionPerformed
int contador = 0;
String sql = "SELECT titulo,ingredientes FROM comidas_predeterminadas WHERE calorias=" + calorias + " AND comida='Colacion'";
Statement st;
try {
st = co.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
contador++;
}
if (contador == 0){
JOptionPane.showMessageDialog(null, "Actualmente no tienes elementos predeterminados en esta categoria");
return;
}
String[] alimentos = new String[contador];
String[] ingredientes = new String[contador];
int i = 0;
rs = st.executeQuery(sql);
while(rs.next()){
alimentos[i] = rs.getString(1);
ingredientes[i] = rs.getString(2);
i++;
}
String valor = (String) JOptionPane.showInputDialog(this, "Seleccione un alimento", "Seleccionar alimento predeterminado", JOptionPane.INFORMATION_MESSAGE, null, alimentos, alimentos[0]);
t_colacion2_2.setText(valor);
for(int x=0; x<contador; x++){
if(alimentos[x].equals(valor)){
colacion2_2.setText(ingredientes[x]);
}
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error al taratar de mostrar los alimentos predeterminados");
}
}//GEN-LAST:event_jButton11ActionPerformed
private void jButton12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton12ActionPerformed
int contador = 0;
String sql = "SELECT titulo,ingredientes FROM comidas_predeterminadas WHERE calorias=" + calorias + " AND comida='Cena'";
Statement st;
try {
st = co.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
contador++;
}
if (contador == 0){
JOptionPane.showMessageDialog(null, "Actualmente no tienes elementos predeterminados en esta categoria");
return;
}
String[] alimentos = new String[contador];
String[] ingredientes = new String[contador];
int i = 0;
rs = st.executeQuery(sql);
while(rs.next()){
alimentos[i] = rs.getString(1);
ingredientes[i] = rs.getString(2);
i++;
}
String valor = (String) JOptionPane.showInputDialog(this, "Seleccione un alimento", "Seleccionar alimento predeterminado", JOptionPane.INFORMATION_MESSAGE, null, alimentos, alimentos[0]);
t_cena_2.setText(valor);
for(int x=0; x<contador; x++){
if(alimentos[x].equals(valor)){
cena_2.setText(ingredientes[x]);
}
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error al taratar de mostrar los alimentos predeterminados");
}
}//GEN-LAST:event_jButton12ActionPerformed
private void jButton13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton13ActionPerformed
int contador = 0;
String sql = "SELECT titulo,ingredientes FROM comidas_predeterminadas WHERE calorias=" + calorias + " AND comida='Desayuno'";
Statement st;
try {
st = co.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
contador++;
}
if (contador == 0){
JOptionPane.showMessageDialog(null, "Actualmente no tienes elementos predeterminados en esta categoria");
return;
}
String[] alimentos = new String[contador];
String[] ingredientes = new String[contador];
int i = 0;
rs = st.executeQuery(sql);
while(rs.next()){
alimentos[i] = rs.getString(1);
ingredientes[i] = rs.getString(2);
i++;
}
String valor = (String) JOptionPane.showInputDialog(this, "Seleccione un alimento", "Seleccionar alimento predeterminado", JOptionPane.INFORMATION_MESSAGE, null, alimentos, alimentos[0]);
t_desayuno_3.setText(valor);
for(int x=0; x<contador; x++){
if(alimentos[x].equals(valor)){
desayuno_3.setText(ingredientes[x]);
}
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error al taratar de mostrar los alimentos predeterminados");
}
}//GEN-LAST:event_jButton13ActionPerformed
private void jButton14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton14ActionPerformed
int contador = 0;
String sql = "SELECT titulo,ingredientes FROM comidas_predeterminadas WHERE calorias=" + calorias + " AND comida='Colacion'";
Statement st;
try {
st = co.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
contador++;
}
if (contador == 0){
JOptionPane.showMessageDialog(null, "Actualmente no tienes elementos predeterminados en esta categoria");
return;
}
String[] alimentos = new String[contador];
String[] ingredientes = new String[contador];
int i = 0;
rs = st.executeQuery(sql);
while(rs.next()){
alimentos[i] = rs.getString(1);
ingredientes[i] = rs.getString(2);
i++;
}
String valor = (String) JOptionPane.showInputDialog(this, "Seleccione un alimento", "Seleccionar alimento predeterminado", JOptionPane.INFORMATION_MESSAGE, null, alimentos, alimentos[0]);
t_colacion1_3.setText(valor);
for(int x=0; x<contador; x++){
if(alimentos[x].equals(valor)){
colacion1_3.setText(ingredientes[x]);
}
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error al taratar de mostrar los alimentos predeterminados");
}
}//GEN-LAST:event_jButton14ActionPerformed
private void jButton15ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton15ActionPerformed
int contador = 0;
String sql = "SELECT titulo,ingredientes FROM comidas_predeterminadas WHERE calorias=" + calorias + " AND comida='Comida'";
Statement st;
try {
st = co.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
contador++;
}
if (contador == 0){
JOptionPane.showMessageDialog(null, "Actualmente no tienes elementos predeterminados en esta categoria");
return;
}
String[] alimentos = new String[contador];
String[] ingredientes = new String[contador];
int i = 0;
rs = st.executeQuery(sql);
while(rs.next()){
alimentos[i] = rs.getString(1);
ingredientes[i] = rs.getString(2);
i++;
}
String valor = (String) JOptionPane.showInputDialog(this, "Seleccione un alimento", "Seleccionar alimento predeterminado", JOptionPane.INFORMATION_MESSAGE, null, alimentos, alimentos[0]);
t_comida_3.setText(valor);
for(int x=0; x<contador; x++){
if(alimentos[x].equals(valor)){
comida_3.setText(ingredientes[x]);
}
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error al taratar de mostrar los alimentos predeterminados");
}
}//GEN-LAST:event_jButton15ActionPerformed
private void jButton16ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton16ActionPerformed
int contador = 0;
String sql = "SELECT titulo,ingredientes FROM comidas_predeterminadas WHERE calorias=" + calorias + " AND comida='Colacion'";
Statement st;
try {
st = co.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
contador++;
}
if (contador == 0){
JOptionPane.showMessageDialog(null, "Actualmente no tienes elementos predeterminados en esta categoria");
return;
}
String[] alimentos = new String[contador];
String[] ingredientes = new String[contador];
int i = 0;
rs = st.executeQuery(sql);
while(rs.next()){
alimentos[i] = rs.getString(1);
ingredientes[i] = rs.getString(2);
i++;
}
String valor = (String) JOptionPane.showInputDialog(this, "Seleccione un alimento", "Seleccionar alimento predeterminado", JOptionPane.INFORMATION_MESSAGE, null, alimentos, alimentos[0]);
t_colacion2_3.setText(valor);
for(int x=0; x<contador; x++){
if(alimentos[x].equals(valor)){
colacion2_3.setText(ingredientes[x]);
}
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error al taratar de mostrar los alimentos predeterminados");
}
}//GEN-LAST:event_jButton16ActionPerformed
private void jButton17ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton17ActionPerformed
int contador = 0;
String sql = "SELECT titulo,ingredientes FROM comidas_predeterminadas WHERE calorias=" + calorias + " AND comida='Cena'";
Statement st;
try {
st = co.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
contador++;
}
if (contador == 0){
JOptionPane.showMessageDialog(null, "Actualmente no tienes elementos predeterminados en esta categoria");
return;
}
String[] alimentos = new String[contador];
String[] ingredientes = new String[contador];
int i = 0;
rs = st.executeQuery(sql);
while(rs.next()){
alimentos[i] = rs.getString(1);
ingredientes[i] = rs.getString(2);
i++;
}
String valor = (String) JOptionPane.showInputDialog(this, "Seleccione un alimento", "Seleccionar alimento predeterminado", JOptionPane.INFORMATION_MESSAGE, null, alimentos, alimentos[0]);
t_cena_3.setText(valor);
for(int x=0; x<contador; x++){
if(alimentos[x].equals(valor)){
cena_3.setText(ingredientes[x]);
}
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error al taratar de mostrar los alimentos predeterminados");
}
}//GEN-LAST:event_jButton17ActionPerformed
private void jButton18ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton18ActionPerformed
int contador = 0;
String sql = "SELECT titulo,ingredientes FROM comidas_predeterminadas WHERE calorias=" + calorias + " AND comida='Desayuno'";
Statement st;
try {
st = co.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
contador++;
}
if (contador == 0){
JOptionPane.showMessageDialog(null, "Actualmente no tienes elementos predeterminados en esta categoria");
return;
}
String[] alimentos = new String[contador];
String[] ingredientes = new String[contador];
int i = 0;
rs = st.executeQuery(sql);
while(rs.next()){
alimentos[i] = rs.getString(1);
ingredientes[i] = rs.getString(2);
i++;
}
String valor = (String) JOptionPane.showInputDialog(this, "Seleccione un alimento", "Seleccionar alimento predeterminado", JOptionPane.INFORMATION_MESSAGE, null, alimentos, alimentos[0]);
t_desayuno_4.setText(valor);
for(int x=0; x<contador; x++){
if(alimentos[x].equals(valor)){
desayuno_4.setText(ingredientes[x]);
}
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error al taratar de mostrar los alimentos predeterminados");
}
}//GEN-LAST:event_jButton18ActionPerformed
private void jButton19ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton19ActionPerformed
int contador = 0;
String sql = "SELECT titulo,ingredientes FROM comidas_predeterminadas WHERE calorias=" + calorias + " AND comida='Colacion'";
Statement st;
try {
st = co.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
contador++;
}
if (contador == 0){
JOptionPane.showMessageDialog(null, "Actualmente no tienes elementos predeterminados en esta categoria");
return;
}
String[] alimentos = new String[contador];
String[] ingredientes = new String[contador];
int i = 0;
rs = st.executeQuery(sql);
while(rs.next()){
alimentos[i] = rs.getString(1);
ingredientes[i] = rs.getString(2);
i++;
}
String valor = (String) JOptionPane.showInputDialog(this, "Seleccione un alimento", "Seleccionar alimento predeterminado", JOptionPane.INFORMATION_MESSAGE, null, alimentos, alimentos[0]);
t_colacion1_4.setText(valor);
for(int x=0; x<contador; x++){
if(alimentos[x].equals(valor)){
colacion1_4.setText(ingredientes[x]);
}
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error al taratar de mostrar los alimentos predeterminados");
}
}//GEN-LAST:event_jButton19ActionPerformed
private void jButton20ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton20ActionPerformed
int contador = 0;
String sql = "SELECT titulo,ingredientes FROM comidas_predeterminadas WHERE calorias=" + calorias + " AND comida='Comida'";
Statement st;
try {
st = co.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
contador++;
}
if (contador == 0){
JOptionPane.showMessageDialog(null, "Actualmente no tienes elementos predeterminados en esta categoria");
return;
}
String[] alimentos = new String[contador];
String[] ingredientes = new String[contador];
int i = 0;
rs = st.executeQuery(sql);
while(rs.next()){
alimentos[i] = rs.getString(1);
ingredientes[i] = rs.getString(2);
i++;
}
String valor = (String) JOptionPane.showInputDialog(this, "Seleccione un alimento", "Seleccionar alimento predeterminado", JOptionPane.INFORMATION_MESSAGE, null, alimentos, alimentos[0]);
t_comida_4.setText(valor);
for(int x=0; x<contador; x++){
if(alimentos[x].equals(valor)){
comida_4.setText(ingredientes[x]);
}
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error al taratar de mostrar los alimentos predeterminados");
}
}//GEN-LAST:event_jButton20ActionPerformed
private void jButton21ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton21ActionPerformed
int contador = 0;
String sql = "SELECT titulo,ingredientes FROM comidas_predeterminadas WHERE calorias=" + calorias + " AND comida='Colacion'";
Statement st;
try {
st = co.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
contador++;
}
if (contador == 0){
JOptionPane.showMessageDialog(null, "Actualmente no tienes elementos predeterminados en esta categoria");
return;
}
String[] alimentos = new String[contador];
String[] ingredientes = new String[contador];
int i = 0;
rs = st.executeQuery(sql);
while(rs.next()){
alimentos[i] = rs.getString(1);
ingredientes[i] = rs.getString(2);
i++;
}
String valor = (String) JOptionPane.showInputDialog(this, "Seleccione un alimento", "Seleccionar alimento predeterminado", JOptionPane.INFORMATION_MESSAGE, null, alimentos, alimentos[0]);
t_colacion2_4.setText(valor);
for(int x=0; x<contador; x++){
if(alimentos[x].equals(valor)){
colacion2_4.setText(ingredientes[x]);
}
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error al taratar de mostrar los alimentos predeterminados");
}
}//GEN-LAST:event_jButton21ActionPerformed
private void jButton22ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton22ActionPerformed
int contador = 0;
String sql = "SELECT titulo,ingredientes FROM comidas_predeterminadas WHERE calorias=" + calorias + " AND comida='Cena'";
Statement st;
try {
st = co.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
contador++;
}
if (contador == 0){
JOptionPane.showMessageDialog(null, "Actualmente no tienes elementos predeterminados en esta categoria");
return;
}
String[] alimentos = new String[contador];
String[] ingredientes = new String[contador];
int i = 0;
rs = st.executeQuery(sql);
while(rs.next()){
alimentos[i] = rs.getString(1);
ingredientes[i] = rs.getString(2);
i++;
}
String valor = (String) JOptionPane.showInputDialog(this, "Seleccione un alimento", "Seleccionar alimento predeterminado", JOptionPane.INFORMATION_MESSAGE, null, alimentos, alimentos[0]);
t_cena_4.setText(valor);
for(int x=0; x<contador; x++){
if(alimentos[x].equals(valor)){
cena_4.setText(ingredientes[x]);
}
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error al taratar de mostrar los alimentos predeterminados");
}
}//GEN-LAST:event_jButton22ActionPerformed
private void jButton23ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton23ActionPerformed
int contador = 0;
String sql = "SELECT titulo,ingredientes FROM comidas_predeterminadas WHERE calorias=" + calorias + " AND comida='Desayuno'";
Statement st;
try {
st = co.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
contador++;
}
if (contador == 0){
JOptionPane.showMessageDialog(null, "Actualmente no tienes elementos predeterminados en esta categoria");
return;
}
String[] alimentos = new String[contador];
String[] ingredientes = new String[contador];
int i = 0;
rs = st.executeQuery(sql);
while(rs.next()){
alimentos[i] = rs.getString(1);
ingredientes[i] = rs.getString(2);
i++;
}
String valor = (String) JOptionPane.showInputDialog(this, "Seleccione un alimento", "Seleccionar alimento predeterminado", JOptionPane.INFORMATION_MESSAGE, null, alimentos, alimentos[0]);
t_desayuno_5.setText(valor);
for(int x=0; x<contador; x++){
if(alimentos[x].equals(valor)){
desayuno_5.setText(ingredientes[x]);
}
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error al taratar de mostrar los alimentos predeterminados");
}
}//GEN-LAST:event_jButton23ActionPerformed
private void jButton24ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton24ActionPerformed
int contador = 0;
String sql = "SELECT titulo,ingredientes FROM comidas_predeterminadas WHERE calorias=" + calorias + " AND comida='Colacion'";
Statement st;
try {
st = co.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
contador++;
}
if (contador == 0){
JOptionPane.showMessageDialog(null, "Actualmente no tienes elementos predeterminados en esta categoria");
return;
}
String[] alimentos = new String[contador];
String[] ingredientes = new String[contador];
int i = 0;
rs = st.executeQuery(sql);
while(rs.next()){
alimentos[i] = rs.getString(1);
ingredientes[i] = rs.getString(2);
i++;
}
String valor = (String) JOptionPane.showInputDialog(this, "Seleccione un alimento", "Seleccionar alimento predeterminado", JOptionPane.INFORMATION_MESSAGE, null, alimentos, alimentos[0]);
t_colacion1_5.setText(valor);
for(int x=0; x<contador; x++){
if(alimentos[x].equals(valor)){
colacion1_5.setText(ingredientes[x]);
}
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error al taratar de mostrar los alimentos predeterminados");
}
}//GEN-LAST:event_jButton24ActionPerformed
private void jButton25ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton25ActionPerformed
int contador = 0;
String sql = "SELECT titulo,ingredientes FROM comidas_predeterminadas WHERE calorias=" + calorias + " AND comida='Comida'";
Statement st;
try {
st = co.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
contador++;
}
if (contador == 0){
JOptionPane.showMessageDialog(null, "Actualmente no tienes elementos predeterminados en esta categoria");
return;
}
String[] alimentos = new String[contador];
String[] ingredientes = new String[contador];
int i = 0;
rs = st.executeQuery(sql);
while(rs.next()){
alimentos[i] = rs.getString(1);
ingredientes[i] = rs.getString(2);
i++;
}
String valor = (String) JOptionPane.showInputDialog(this, "Seleccione un alimento", "Seleccionar alimento predeterminado", JOptionPane.INFORMATION_MESSAGE, null, alimentos, alimentos[0]);
t_comida_5.setText(valor);
for(int x=0; x<contador; x++){
if(alimentos[x].equals(valor)){
comida_5.setText(ingredientes[x]);
}
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error al taratar de mostrar los alimentos predeterminados");
}
}//GEN-LAST:event_jButton25ActionPerformed
private void jButton26ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton26ActionPerformed
int contador = 0;
String sql = "SELECT titulo,ingredientes FROM comidas_predeterminadas WHERE calorias=" + calorias + " AND comida='Colacion'";
Statement st;
try {
st = co.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
contador++;
}
if (contador == 0){
JOptionPane.showMessageDialog(null, "Actualmente no tienes elementos predeterminados en esta categoria");
return;
}
String[] alimentos = new String[contador];
String[] ingredientes = new String[contador];
int i = 0;
rs = st.executeQuery(sql);
while(rs.next()){
alimentos[i] = rs.getString(1);
ingredientes[i] = rs.getString(2);
i++;
}
String valor = (String) JOptionPane.showInputDialog(this, "Seleccione un alimento", "Seleccionar alimento predeterminado", JOptionPane.INFORMATION_MESSAGE, null, alimentos, alimentos[0]);
t_colacion2_5.setText(valor);
for(int x=0; x<contador; x++){
if(alimentos[x].equals(valor)){
colacion2_5.setText(ingredientes[x]);
}
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error al taratar de mostrar los alimentos predeterminados");
}
}//GEN-LAST:event_jButton26ActionPerformed
private void jButton27ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton27ActionPerformed
int contador = 0;
String sql = "SELECT titulo,ingredientes FROM comidas_predeterminadas WHERE calorias=" + calorias + " AND comida='Cena'";
Statement st;
try {
st = co.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
contador++;
}
if (contador == 0){
JOptionPane.showMessageDialog(null, "Actualmente no tienes elementos predeterminados en esta categoria");
return;
}
String[] alimentos = new String[contador];
String[] ingredientes = new String[contador];
int i = 0;
rs = st.executeQuery(sql);
while(rs.next()){
alimentos[i] = rs.getString(1);
ingredientes[i] = rs.getString(2);
i++;
}
String valor = (String) JOptionPane.showInputDialog(this, "Seleccione un alimento", "Seleccionar alimento predeterminado", JOptionPane.INFORMATION_MESSAGE, null, alimentos, alimentos[0]);
t_cena_5.setText(valor);
for(int x=0; x<contador; x++){
if(alimentos[x].equals(valor)){
cena_5.setText(ingredientes[x]);
}
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error al taratar de mostrar los alimentos predeterminados");
}
}//GEN-LAST:event_jButton27ActionPerformed
private void jButton28ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton28ActionPerformed
int contador = 0;
String sql = "SELECT titulo,ingredientes FROM comidas_predeterminadas WHERE calorias=" + calorias + " AND comida='Desayuno'";
Statement st;
try {
st = co.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
contador++;
}
if (contador == 0){
JOptionPane.showMessageDialog(null, "Actualmente no tienes elementos predeterminados en esta categoria");
return;
}
String[] alimentos = new String[contador];
String[] ingredientes = new String[contador];
int i = 0;
rs = st.executeQuery(sql);
while(rs.next()){
alimentos[i] = rs.getString(1);
ingredientes[i] = rs.getString(2);
i++;
}
String valor = (String) JOptionPane.showInputDialog(this, "Seleccione un alimento", "Seleccionar alimento predeterminado", JOptionPane.INFORMATION_MESSAGE, null, alimentos, alimentos[0]);
t_desayuno_6.setText(valor);
for(int x=0; x<contador; x++){
if(alimentos[x].equals(valor)){
desayuno_6.setText(ingredientes[x]);
}
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error al taratar de mostrar los alimentos predeterminados");
}
}//GEN-LAST:event_jButton28ActionPerformed
private void jButton29ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton29ActionPerformed
int contador = 0;
String sql = "SELECT titulo,ingredientes FROM comidas_predeterminadas WHERE calorias=" + calorias + " AND comida='Colacion'";
Statement st;
try {
st = co.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
contador++;
}
if (contador == 0){
JOptionPane.showMessageDialog(null, "Actualmente no tienes elementos predeterminados en esta categoria");
return;
}
String[] alimentos = new String[contador];
String[] ingredientes = new String[contador];
int i = 0;
rs = st.executeQuery(sql);
while(rs.next()){
alimentos[i] = rs.getString(1);
ingredientes[i] = rs.getString(2);
i++;
}
String valor = (String) JOptionPane.showInputDialog(this, "Seleccione un alimento", "Seleccionar alimento predeterminado", JOptionPane.INFORMATION_MESSAGE, null, alimentos, alimentos[0]);
t_colacion1_6.setText(valor);
for(int x=0; x<contador; x++){
if(alimentos[x].equals(valor)){
colacion1_6.setText(ingredientes[x]);
}
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error al taratar de mostrar los alimentos predeterminados");
}
}//GEN-LAST:event_jButton29ActionPerformed
private void jButton30ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton30ActionPerformed
int contador = 0;
String sql = "SELECT titulo,ingredientes FROM comidas_predeterminadas WHERE calorias=" + calorias + " AND comida='Comida'";
Statement st;
try {
st = co.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
contador++;
}
if (contador == 0){
JOptionPane.showMessageDialog(null, "Actualmente no tienes elementos predeterminados en esta categoria");
return;
}
String[] alimentos = new String[contador];
String[] ingredientes = new String[contador];
int i = 0;
rs = st.executeQuery(sql);
while(rs.next()){
alimentos[i] = rs.getString(1);
ingredientes[i] = rs.getString(2);
i++;
}
String valor = (String) JOptionPane.showInputDialog(this, "Seleccione un alimento", "Seleccionar alimento predeterminado", JOptionPane.INFORMATION_MESSAGE, null, alimentos, alimentos[0]);
t_comida_6.setText(valor);
for(int x=0; x<contador; x++){
if(alimentos[x].equals(valor)){
comida_6.setText(ingredientes[x]);
}
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error al taratar de mostrar los alimentos predeterminados");
}
}//GEN-LAST:event_jButton30ActionPerformed
private void jButton31ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton31ActionPerformed
int contador = 0;
String sql = "SELECT titulo,ingredientes FROM comidas_predeterminadas WHERE calorias=" + calorias + " AND comida='Colacion'";
Statement st;
try {
st = co.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
contador++;
}
if (contador == 0){
JOptionPane.showMessageDialog(null, "Actualmente no tienes elementos predeterminados en esta categoria");
return;
}
String[] alimentos = new String[contador];
String[] ingredientes = new String[contador];
int i = 0;
rs = st.executeQuery(sql);
while(rs.next()){
alimentos[i] = rs.getString(1);
ingredientes[i] = rs.getString(2);
i++;
}
String valor = (String) JOptionPane.showInputDialog(this, "Seleccione un alimento", "Seleccionar alimento predeterminado", JOptionPane.INFORMATION_MESSAGE, null, alimentos, alimentos[0]);
t_colacion2_6.setText(valor);
for(int x=0; x<contador; x++){
if(alimentos[x].equals(valor)){
colacion2_6.setText(ingredientes[x]);
}
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error al taratar de mostrar los alimentos predeterminados");
}
}//GEN-LAST:event_jButton31ActionPerformed
private void jButton32ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton32ActionPerformed
int contador = 0;
String sql = "SELECT titulo,ingredientes FROM comidas_predeterminadas WHERE calorias=" + calorias + " AND comida='Cena'";
Statement st;
try {
st = co.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
contador++;
}
if (contador == 0){
JOptionPane.showMessageDialog(null, "Actualmente no tienes elementos predeterminados en esta categoria");
return;
}
String[] alimentos = new String[contador];
String[] ingredientes = new String[contador];
int i = 0;
rs = st.executeQuery(sql);
while(rs.next()){
alimentos[i] = rs.getString(1);
ingredientes[i] = rs.getString(2);
i++;
}
String valor = (String) JOptionPane.showInputDialog(this, "Seleccione un alimento", "Seleccionar alimento predeterminado", JOptionPane.INFORMATION_MESSAGE, null, alimentos, alimentos[0]);
t_cena_6.setText(valor);
for(int x=0; x<contador; x++){
if(alimentos[x].equals(valor)){
cena_6.setText(ingredientes[x]);
}
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error al taratar de mostrar los alimentos predeterminados");
}
}//GEN-LAST:event_jButton32ActionPerformed
private void jButton33ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton33ActionPerformed
int contador = 0;
String sql = "SELECT titulo,ingredientes FROM comidas_predeterminadas WHERE calorias=" + calorias + " AND comida='Desayuno'";
Statement st;
try {
st = co.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
contador++;
}
if (contador == 0){
JOptionPane.showMessageDialog(null, "Actualmente no tienes elementos predeterminados en esta categoria");
return;
}
String[] alimentos = new String[contador];
String[] ingredientes = new String[contador];
int i = 0;
rs = st.executeQuery(sql);
while(rs.next()){
alimentos[i] = rs.getString(1);
ingredientes[i] = rs.getString(2);
i++;
}
String valor = (String) JOptionPane.showInputDialog(this, "Seleccione un alimento", "Seleccionar alimento predeterminado", JOptionPane.INFORMATION_MESSAGE, null, alimentos, alimentos[0]);
t_desayuno_7.setText(valor);
for(int x=0; x<contador; x++){
if(alimentos[x].equals(valor)){
desayuno_7.setText(ingredientes[x]);
}
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error al taratar de mostrar los alimentos predeterminados");
}
}//GEN-LAST:event_jButton33ActionPerformed
private void jButton34ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton34ActionPerformed
int contador = 0;
String sql = "SELECT titulo,ingredientes FROM comidas_predeterminadas WHERE calorias=" + calorias + " AND comida='Colacion'";
Statement st;
try {
st = co.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
contador++;
}
if (contador == 0){
JOptionPane.showMessageDialog(null, "Actualmente no tienes elementos predeterminados en esta categoria");
return;
}
String[] alimentos = new String[contador];
String[] ingredientes = new String[contador];
int i = 0;
rs = st.executeQuery(sql);
while(rs.next()){
alimentos[i] = rs.getString(1);
ingredientes[i] = rs.getString(2);
i++;
}
String valor = (String) JOptionPane.showInputDialog(this, "Seleccione un alimento", "Seleccionar alimento predeterminado", JOptionPane.INFORMATION_MESSAGE, null, alimentos, alimentos[0]);
t_colacion1_7.setText(valor);
for(int x=0; x<contador; x++){
if(alimentos[x].equals(valor)){
colacion1_7.setText(ingredientes[x]);
}
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error al taratar de mostrar los alimentos predeterminados");
}
}//GEN-LAST:event_jButton34ActionPerformed
private void jButton35ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton35ActionPerformed
int contador = 0;
String sql = "SELECT titulo,ingredientes FROM comidas_predeterminadas WHERE calorias=" + calorias + " AND comida='Comida'";
Statement st;
try {
st = co.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
contador++;
}
if (contador == 0){
JOptionPane.showMessageDialog(null, "Actualmente no tienes elementos predeterminados en esta categoria");
return;
}
String[] alimentos = new String[contador];
String[] ingredientes = new String[contador];
int i = 0;
rs = st.executeQuery(sql);
while(rs.next()){
alimentos[i] = rs.getString(1);
ingredientes[i] = rs.getString(2);
i++;
}
String valor = (String) JOptionPane.showInputDialog(this, "Seleccione un alimento", "Seleccionar alimento predeterminado", JOptionPane.INFORMATION_MESSAGE, null, alimentos, alimentos[0]);
t_comida_7.setText(valor);
for(int x=0; x<contador; x++){
if(alimentos[x].equals(valor)){
comida_7.setText(ingredientes[x]);
}
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error al taratar de mostrar los alimentos predeterminados");
}
}//GEN-LAST:event_jButton35ActionPerformed
private void jButton36ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton36ActionPerformed
int contador = 0;
String sql = "SELECT titulo,ingredientes FROM comidas_predeterminadas WHERE calorias=" + calorias + " AND comida='Colacion'";
Statement st;
try {
st = co.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
contador++;
}
if (contador == 0){
JOptionPane.showMessageDialog(null, "Actualmente no tienes elementos predeterminados en esta categoria");
return;
}
String[] alimentos = new String[contador];
String[] ingredientes = new String[contador];
int i = 0;
rs = st.executeQuery(sql);
while(rs.next()){
alimentos[i] = rs.getString(1);
ingredientes[i] = rs.getString(2);
i++;
}
String valor = (String) JOptionPane.showInputDialog(this, "Seleccione un alimento", "Seleccionar alimento predeterminado", JOptionPane.INFORMATION_MESSAGE, null, alimentos, alimentos[0]);
t_colacion2_7.setText(valor);
for(int x=0; x<contador; x++){
if(alimentos[x].equals(valor)){
colacion2_7.setText(ingredientes[x]);
}
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error al taratar de mostrar los alimentos predeterminados");
}
}//GEN-LAST:event_jButton36ActionPerformed
private void jButton37ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton37ActionPerformed
int contador = 0;
String sql = "SELECT titulo,ingredientes FROM comidas_predeterminadas WHERE calorias=" + calorias + " AND comida='Cena'";
Statement st;
try {
st = co.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
contador++;
}
if (contador == 0){
JOptionPane.showMessageDialog(null, "Actualmente no tienes elementos predeterminados en esta categoria");
return;
}
String[] alimentos = new String[contador];
String[] ingredientes = new String[contador];
int i = 0;
rs = st.executeQuery(sql);
while(rs.next()){
alimentos[i] = rs.getString(1);
ingredientes[i] = rs.getString(2);
i++;
}
String valor = (String) JOptionPane.showInputDialog(this, "Seleccione un alimento", "Seleccionar alimento predeterminado", JOptionPane.INFORMATION_MESSAGE, null, alimentos, alimentos[0]);
t_cena_7.setText(valor);
for(int x=0; x<contador; x++){
if(alimentos[x].equals(valor)){
cena_7.setText(ingredientes[x]);
}
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error al taratar de mostrar los alimentos predeterminados");
}
}//GEN-LAST:event_jButton37ActionPerformed
/**
* @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(Ingresar_dieta_2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Ingresar_dieta_2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Ingresar_dieta_2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Ingresar_dieta_2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Ingresar_dieta_2().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTextArea cena_1;
private javax.swing.JTextArea cena_2;
private javax.swing.JTextArea cena_3;
private javax.swing.JTextArea cena_4;
private javax.swing.JTextArea cena_5;
private javax.swing.JTextArea cena_6;
private javax.swing.JTextArea cena_7;
private javax.swing.JTextArea colacion1_1;
private javax.swing.JTextArea colacion1_2;
private javax.swing.JTextArea colacion1_3;
private javax.swing.JTextArea colacion1_4;
private javax.swing.JTextArea colacion1_5;
private javax.swing.JTextArea colacion1_6;
private javax.swing.JTextArea colacion1_7;
private javax.swing.JTextArea colacion2_1;
private javax.swing.JTextArea colacion2_2;
private javax.swing.JTextArea colacion2_3;
private javax.swing.JTextArea colacion2_4;
private javax.swing.JTextArea colacion2_5;
private javax.swing.JTextArea colacion2_6;
private javax.swing.JTextArea colacion2_7;
private javax.swing.JTextArea comida_1;
private javax.swing.JTextArea comida_2;
private javax.swing.JTextArea comida_3;
private javax.swing.JTextArea comida_4;
private javax.swing.JTextArea comida_5;
private javax.swing.JTextArea comida_6;
private javax.swing.JTextArea comida_7;
private javax.swing.JTextArea desayuno_1;
private javax.swing.JTextArea desayuno_2;
private javax.swing.JTextArea desayuno_3;
private javax.swing.JTextArea desayuno_4;
private javax.swing.JTextArea desayuno_5;
private javax.swing.JTextArea desayuno_6;
private javax.swing.JTextArea desayuno_7;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton10;
private javax.swing.JButton jButton11;
private javax.swing.JButton jButton12;
private javax.swing.JButton jButton13;
private javax.swing.JButton jButton14;
private javax.swing.JButton jButton15;
private javax.swing.JButton jButton16;
private javax.swing.JButton jButton17;
private javax.swing.JButton jButton18;
private javax.swing.JButton jButton19;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton20;
private javax.swing.JButton jButton21;
private javax.swing.JButton jButton22;
private javax.swing.JButton jButton23;
private javax.swing.JButton jButton24;
private javax.swing.JButton jButton25;
private javax.swing.JButton jButton26;
private javax.swing.JButton jButton27;
private javax.swing.JButton jButton28;
private javax.swing.JButton jButton29;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton30;
private javax.swing.JButton jButton31;
private javax.swing.JButton jButton32;
private javax.swing.JButton jButton33;
private javax.swing.JButton jButton34;
private javax.swing.JButton jButton35;
private javax.swing.JButton jButton36;
private javax.swing.JButton jButton37;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;
private javax.swing.JButton jButton6;
private javax.swing.JButton jButton7;
private javax.swing.JButton jButton8;
private javax.swing.JButton jButton9;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel17;
private javax.swing.JLabel jLabel18;
private javax.swing.JLabel jLabel19;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel20;
private javax.swing.JLabel jLabel21;
private javax.swing.JLabel jLabel22;
private javax.swing.JLabel jLabel23;
private javax.swing.JLabel jLabel24;
private javax.swing.JLabel jLabel25;
private javax.swing.JLabel jLabel26;
private javax.swing.JLabel jLabel27;
private javax.swing.JLabel jLabel28;
private javax.swing.JLabel jLabel29;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel30;
private javax.swing.JLabel jLabel31;
private javax.swing.JLabel jLabel32;
private javax.swing.JLabel jLabel33;
private javax.swing.JLabel jLabel34;
private javax.swing.JLabel jLabel35;
private javax.swing.JLabel jLabel36;
private javax.swing.JLabel jLabel37;
private javax.swing.JLabel jLabel38;
private javax.swing.JLabel jLabel39;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel40;
private javax.swing.JLabel jLabel41;
private javax.swing.JLabel jLabel42;
private javax.swing.JLabel jLabel43;
private javax.swing.JLabel jLabel44;
private javax.swing.JLabel jLabel45;
private javax.swing.JLabel jLabel46;
private javax.swing.JLabel jLabel47;
private javax.swing.JLabel jLabel48;
private javax.swing.JLabel jLabel49;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
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.JPanel jPanel6;
private javax.swing.JPanel jPanel7;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane10;
private javax.swing.JScrollPane jScrollPane11;
private javax.swing.JScrollPane jScrollPane12;
private javax.swing.JScrollPane jScrollPane13;
private javax.swing.JScrollPane jScrollPane14;
private javax.swing.JScrollPane jScrollPane15;
private javax.swing.JScrollPane jScrollPane16;
private javax.swing.JScrollPane jScrollPane17;
private javax.swing.JScrollPane jScrollPane18;
private javax.swing.JScrollPane jScrollPane19;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane20;
private javax.swing.JScrollPane jScrollPane21;
private javax.swing.JScrollPane jScrollPane22;
private javax.swing.JScrollPane jScrollPane23;
private javax.swing.JScrollPane jScrollPane24;
private javax.swing.JScrollPane jScrollPane25;
private javax.swing.JScrollPane jScrollPane26;
private javax.swing.JScrollPane jScrollPane27;
private javax.swing.JScrollPane jScrollPane28;
private javax.swing.JScrollPane jScrollPane29;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JScrollPane jScrollPane30;
private javax.swing.JScrollPane jScrollPane31;
private javax.swing.JScrollPane jScrollPane32;
private javax.swing.JScrollPane jScrollPane33;
private javax.swing.JScrollPane jScrollPane34;
private javax.swing.JScrollPane jScrollPane35;
private javax.swing.JScrollPane jScrollPane36;
private javax.swing.JScrollPane jScrollPane37;
private javax.swing.JScrollPane jScrollPane38;
private javax.swing.JScrollPane jScrollPane39;
private javax.swing.JScrollPane jScrollPane4;
private javax.swing.JScrollPane jScrollPane40;
private javax.swing.JScrollPane jScrollPane41;
private javax.swing.JScrollPane jScrollPane42;
private javax.swing.JScrollPane jScrollPane43;
private javax.swing.JScrollPane jScrollPane44;
private javax.swing.JScrollPane jScrollPane45;
private javax.swing.JScrollPane jScrollPane46;
private javax.swing.JScrollPane jScrollPane47;
private javax.swing.JScrollPane jScrollPane48;
private javax.swing.JScrollPane jScrollPane49;
private javax.swing.JScrollPane jScrollPane5;
private javax.swing.JScrollPane jScrollPane50;
private javax.swing.JScrollPane jScrollPane51;
private javax.swing.JScrollPane jScrollPane52;
private javax.swing.JScrollPane jScrollPane53;
private javax.swing.JScrollPane jScrollPane54;
private javax.swing.JScrollPane jScrollPane55;
private javax.swing.JScrollPane jScrollPane56;
private javax.swing.JScrollPane jScrollPane57;
private javax.swing.JScrollPane jScrollPane58;
private javax.swing.JScrollPane jScrollPane59;
private javax.swing.JScrollPane jScrollPane6;
private javax.swing.JScrollPane jScrollPane60;
private javax.swing.JScrollPane jScrollPane61;
private javax.swing.JScrollPane jScrollPane62;
private javax.swing.JScrollPane jScrollPane63;
private javax.swing.JScrollPane jScrollPane64;
private javax.swing.JScrollPane jScrollPane65;
private javax.swing.JScrollPane jScrollPane66;
private javax.swing.JScrollPane jScrollPane67;
private javax.swing.JScrollPane jScrollPane68;
private javax.swing.JScrollPane jScrollPane69;
private javax.swing.JScrollPane jScrollPane7;
private javax.swing.JScrollPane jScrollPane70;
private javax.swing.JScrollPane jScrollPane8;
private javax.swing.JScrollPane jScrollPane9;
private javax.swing.JTabbedPane jTabbedPane1;
private javax.swing.JTextArea t_cena_1;
private javax.swing.JTextArea t_cena_2;
private javax.swing.JTextArea t_cena_3;
private javax.swing.JTextArea t_cena_4;
private javax.swing.JTextArea t_cena_5;
private javax.swing.JTextArea t_cena_6;
private javax.swing.JTextArea t_cena_7;
private javax.swing.JTextArea t_colacion1_1;
private javax.swing.JTextArea t_colacion1_2;
private javax.swing.JTextArea t_colacion1_3;
private javax.swing.JTextArea t_colacion1_4;
private javax.swing.JTextArea t_colacion1_5;
private javax.swing.JTextArea t_colacion1_6;
private javax.swing.JTextArea t_colacion1_7;
private javax.swing.JTextArea t_colacion2_1;
private javax.swing.JTextArea t_colacion2_2;
private javax.swing.JTextArea t_colacion2_3;
private javax.swing.JTextArea t_colacion2_4;
private javax.swing.JTextArea t_colacion2_5;
private javax.swing.JTextArea t_colacion2_6;
private javax.swing.JTextArea t_colacion2_7;
private javax.swing.JTextArea t_comida_1;
private javax.swing.JTextArea t_comida_2;
private javax.swing.JTextArea t_comida_3;
private javax.swing.JTextArea t_comida_4;
private javax.swing.JTextArea t_comida_5;
private javax.swing.JTextArea t_comida_6;
private javax.swing.JTextArea t_comida_7;
private javax.swing.JTextArea t_desayuno_1;
private javax.swing.JTextArea t_desayuno_2;
private javax.swing.JTextArea t_desayuno_3;
private javax.swing.JTextArea t_desayuno_4;
private javax.swing.JTextArea t_desayuno_5;
private javax.swing.JTextArea t_desayuno_6;
private javax.swing.JTextArea t_desayuno_7;
// End of variables declaration//GEN-END:variables
}
| [
"renecmireles@hotmail.com"
] | renecmireles@hotmail.com |
0bc4742f054198a85279ab0fc8ca3d621678ad7d | e0415154565fbc5f10ccee2e130a9c599b894343 | /app/src/main/java/util/ObjectSerializer.java | 860fee82076511cccde0d6bda73cda1c8a69d6ed | [] | no_license | dev-sravanthi/EducationApp | 90ebbe26a2d98f4df47c22fbcff8d67aa6d0b031 | 3e0634707a25eb05ec7fca61d27485b58411c613 | refs/heads/master | 2023-07-08T18:57:23.809036 | 2021-08-18T11:52:17 | 2021-08-18T11:52:17 | 386,272,716 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,681 | java | package util;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
public class ObjectSerializer {
public static String serialize(Serializable obj) throws IOException {
if (obj == null) return "";
ByteArrayOutputStream serialObj = new ByteArrayOutputStream();
ObjectOutputStream objStream = new ObjectOutputStream(serialObj);
objStream.writeObject(obj);
objStream.close();
return encodeBytes(serialObj.toByteArray());
}
public static Object deserialize(String str) throws IOException, ClassNotFoundException {
if (str == null || str.length() == 0) return null;
ByteArrayInputStream serialObj = new ByteArrayInputStream(decodeBytes(str));
ObjectInputStream objStream = new ObjectInputStream(serialObj);
return objStream.readObject();
}
public static String encodeBytes(byte[] bytes) {
StringBuffer strBuf = new StringBuffer();
for (int i = 0; i < bytes.length; i++) {
strBuf.append((char) (((bytes[i] >> 4) & 0xF) + ((int) 'a')));
strBuf.append((char) (((bytes[i]) & 0xF) + ((int) 'a')));
}
return strBuf.toString();
}
public static byte[] decodeBytes(String str) {
byte[] bytes = new byte[str.length() / 2];
for (int i = 0; i < str.length(); i+=2) {
char c = str.charAt(i);
bytes[i/2] = (byte) ((c - 'a') << 4);
c = str.charAt(i+1);
bytes[i/2] += (c - 'a');
}
return bytes;
}
} | [
"dev.sravanthi309@gmail.com"
] | dev.sravanthi309@gmail.com |
a6d162c24a86f8f70dccc54089cc613ccf78348a | 796637477f3daf6e1dfbb7fd0ab9d8a44e11552f | /phase2/Game/app/src/main/java/com/example/game/TilesGame/BoardInvert.java | 4c22ff767892a707f6cf32f71779a6003f0493ac | [] | no_license | leechristine/mobile-minis | c8c94650400be0902ff7c26542097938cf53e9fa | ee87422b1e6ef9386d7ac3430801ac236dd92a77 | refs/heads/master | 2020-12-11T20:07:46.103945 | 2019-12-02T04:55:01 | 2019-12-02T04:55:01 | 233,946,118 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,258 | java | package com.example.game.TilesGame;
import android.content.Context;
import java.util.ArrayList;
import java.util.Random;
class BoardInvert extends BoardManager {
/** Construct an invert board manager. */
BoardInvert(Context context) {
super(context);
}
/** Update the items in a board. */
@Override
public void update() {
if (gameStart) { // No changes to items on board will occur if game has not started.
// Check if the game will end this turn.
if (doesGameEnd()) {
gameEnd = true;
return; // No changes to items on board will occur if game has ended.
}
// Move all the tiles on this board, incrementing the speed by 50 every 15 points.
int increment = Math.floorDiv(scoreManager.getScore(), 15);
for (ArrayList<Tile> tileRow : tileBoard) {
for (Tile tile : tileRow) {
tile.move(100 + (increment * 50));
}
}
// Invert the first 4 rows in board (random chance of occurrence).
Random rand = new Random(); // Create a random variable.
if (rand.nextInt(15) < 1) { // Invert the board (1/15 probability of occurrence).
invertBoard();
}
// Populate top of board with new tiles and remove tiles that have passed bottom of board.
populate();
}
}
/** Invert the tiles on this board. */
private void invertBoard() {
for (int i = 0; i < 4; i++) { // For first three rows in board:
ArrayList<Tile> tileRow = tileBoard.get(i); // Get row.
for (int j = 0; j < 4; j++) {
Tile thisTile = tileRow.get(j);
if (!thisTile.isTouch()) { // If tile has not been touched:
// Invert tile.
Tile newTile = invertTile(thisTile);
tileRow.set(j, newTile);
}
}
}
}
/** Return an inverted tile of thisTile. */
private Tile invertTile(Tile thisTile) {
if (thisTile instanceof KeyTile) { // If thisTile is KeyTile:
// Return a new DangerTile at the location of thisTile
return tileFactory.getDangerTile(thisTile.getX(), thisTile.getY());
} else { // If thisTile is DangerTile:
// Return a new KeyTile at the location of thisTile
return tileFactory.getKeyTile(thisTile.getX(), thisTile.getY());
}
}
}
| [
"chrstn.lee@mail.utoronto.ca"
] | chrstn.lee@mail.utoronto.ca |
c23898b726902079a5f2236287d4119d8f6b7cc1 | 19f8aefc88e856b07bdeeb809cb03b7c39726484 | /spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/neo4j/DataNeo4jTestWithIncludeFilterIntegrationTests.java | 77cd76220141dd250c32ddf6d679d6df83b5855a | [
"Apache-2.0"
] | permissive | moving-bricks/spring-boot-2.1.x | 8dd7c6ba6e43ca2ec16cc262548245ced41806ab | 78ed6ff678b51672abdbc761019edb64de36afde | refs/heads/master | 2023-01-07T09:21:31.434984 | 2019-08-14T11:41:04 | 2019-08-14T11:41:04 | 202,248,924 | 0 | 1 | Apache-2.0 | 2022-12-27T14:44:14 | 2019-08-14T01:22:07 | Java | UTF-8 | Java | false | false | 2,543 | java | /*
* Copyright 2012-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.test.autoconfigure.data.neo4j;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.testcontainers.containers.Neo4jContainer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.util.TestPropertyValues;
import org.springframework.boot.testsupport.testcontainers.SkippableContainer;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan.Filter;
import org.springframework.stereotype.Service;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Integration test with custom include filter for {@link DataNeo4jTest}.
*
* @author Eddú Meléndez
* @author Michael Simons
*/
@RunWith(SpringRunner.class)
@ContextConfiguration(initializers = DataNeo4jTestWithIncludeFilterIntegrationTests.Initializer.class)
@DataNeo4jTest(includeFilters = @Filter(Service.class))
public class DataNeo4jTestWithIncludeFilterIntegrationTests {
@ClassRule
public static SkippableContainer<Neo4jContainer<?>> neo4j = new SkippableContainer<Neo4jContainer<?>>(
() -> new Neo4jContainer<>().withAdminPassword(null));
@Autowired
private ExampleService service;
@Test
public void testService() {
assertThat(this.service.hasNode(ExampleGraph.class)).isFalse();
}
static class Initializer implements ApplicationContextInitializer<ConfigurableApplicationContext> {
@Override
public void initialize(ConfigurableApplicationContext configurableApplicationContext) {
TestPropertyValues.of("spring.data.neo4j.uri=" + neo4j.getContainer().getBoltUrl())
.applyTo(configurableApplicationContext.getEnvironment());
}
}
}
| [
"810095178@qq.com"
] | 810095178@qq.com |
b4b7e8d070a6211c3742a1bf21d79fe867754805 | 7b82d70ba5fef677d83879dfeab859d17f4809aa | /f/cjlgb-cloud-platform/cjlgb-design-common/cjlgb-design-common-upms/src/main/java/com/cjlgb/design/common/upms/entity/SysRole.java | 109fe8acab3223ba1d0ba7c0c2eab5b030f1c4a1 | [
"Apache-2.0"
] | permissive | apollowesley/jun_test | fb962a28b6384c4097c7a8087a53878188db2ebc | c7a4600c3f0e1b045280eaf3464b64e908d2f0a2 | refs/heads/main | 2022-12-30T20:47:36.637165 | 2020-10-13T18:10:46 | 2020-10-13T18:10:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,402 | java | package com.cjlgb.design.common.upms.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.cjlgb.design.common.core.bean.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
import java.time.LocalDateTime;
import java.util.Collection;
/**
* @author WFT
* @date 2020/7/13
* description:系统角色
*/
@Setter
@Getter
@NoArgsConstructor
public class SysRole extends BaseEntity {
/**
* 角色名称
*/
@NotBlank(message = "角色名称不能为空")
private String roleName;
/**
* 描述
*/
private String roleDescribe;
/**
* 创建时间
*/
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
/**
* 最后修改时间
*/
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@TableField(fill = FieldFill.INSERT_UPDATE)
private LocalDateTime lastModifyTime;
/**
* 权限标识列表
*/
@TableField(exist = false)
private Collection<String> authorities;
}
| [
"wujun728@hotmail.com"
] | wujun728@hotmail.com |
154f0270b8193dc5a543f9cf76c53aa38a718da4 | 9f116b4d36cf30a2cea722890f50394f02bcbed8 | /IO/priv/rsl/IO_3/EncodeStream.java | 8d0965077070c64ee3d0c63ab9d35d381769b61e | [] | no_license | RenSLei/JavaFoundation | df7f73c3da5bdea2a02400d315fe1e130cc998a8 | 5510762dbf9a68dd1c6e1c5713ed3071991a5bd8 | refs/heads/master | 2020-03-24T21:35:02.884291 | 2018-07-31T16:35:22 | 2018-07-31T16:35:22 | 143,040,458 | 1 | 0 | null | null | null | null | GB18030 | Java | false | false | 1,197 | java | package priv.rsl.IO_3;
/*
转换流的字符编码:
*/
import java.io.*;
class EncodeStream
{
public static void main(String[] args) throws IOException
{
//writeText();
readText();
}
public static void writeText() throws IOException
{
//用gbk编码形式写的文件是2个字节一个字符,用UTF-8写的文件是3个字节
OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream("utf.txt"),"UTF-8");
osw.write("你好");
osw.close();
}
public static void readText() throws IOException
{
//用gbk(utf-8)编码写的文件去查utf-8(gbk)的编码表会乱码:
//1,InputStreamReader isr = new InputStreamReader(new FileInputStream("gbk.txt"),"UTF-8");
//2,InputStreamReader isr = new InputStreamReader(new FileInputStream("utf.txt"),"gbk");
//不乱码:
InputStreamReader isr = new InputStreamReader(new FileInputStream("gbk.txt"),"gbk");
char[] buf = new char[10];
int len=isr.read(buf);
String str = new String(buf,0,len);
System.out.println(str);
/*
1,用gbk编码写的文件去查utf-8的编码表会乱码:
浣犲ソ
2,用utf-8编码写的文件去查gbk的编码表会乱码:
??
*/
}
}
| [
"786584576@qq.com"
] | 786584576@qq.com |
e10591b3d628d4eb890d915a18215a4d9877782a | 5aaa8c6d0ddc15975f9ec3e8b14f88484dde5e52 | /src/main/java/com/wingsglory/foru/server/common/SmsNumSendResError.java | 01c761cedee108e75bf0d3a801238d90430cb583 | [] | no_license | hezhujun/FORU-SERVER | f4c761b27b2d674c1f75e86810a6fc292552d39a | df9ff41b1cd20426df233c6123b4c7f4219da428 | refs/heads/master | 2021-01-01T17:35:19.264585 | 2017-09-04T11:40:02 | 2017-09-04T11:40:02 | 94,957,129 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 229 | java | package com.wingsglory.foru.server.common;
/**
* Created by hezhujun on 2017/6/24.
*/
public class SmsNumSendResError {
private int code;
private String msg;
private String subCode;
private String requestId;
}
| [
"1214507717@qq.com"
] | 1214507717@qq.com |
00571eee31bd741a069a3a8f549ab51a4d62c14c | ec4780894cff3531d0c9eb9e78861f060d2bd9cd | /advertising-system/ad-service/ad-sponsor/src/main/java/cn/edu/nju/vo/AdPlanGetRequest.java | 8eef975cfa381843fedb0ea3235f3d9a28832917 | [] | no_license | Thpffcj/SpringBoot-Project | e2c16b66a781b279ebecbf855bd00a0bac89f64e | 1968895a2faff646cdeea5eb9849603220488869 | refs/heads/master | 2022-12-23T22:54:41.992818 | 2019-11-04T13:00:52 | 2019-11-04T13:00:52 | 107,384,236 | 2 | 1 | null | 2022-12-16T10:32:06 | 2017-10-18T09:06:15 | JavaScript | UTF-8 | Java | false | false | 465 | java | package cn.edu.nju.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.util.CollectionUtils;
import java.util.List;
/**
* Created by thpffcj on 2019/8/26.
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class AdPlanGetRequest {
private Long userId;
private List<Long> ids;
public boolean validate() {
return userId != null && !CollectionUtils.isEmpty(ids);
}
}
| [
"1441732331@qq.com"
] | 1441732331@qq.com |
bfe276fe3325347d2bc73c48bd63a41b5d612a82 | 524b8af36e64be688fdf56a6a849e171b63892a0 | /app/src/main/java/com/wsh/photofilter/filter/IFWaldenFilter.java | abc8b2b1ed77ce12584d23783f38a34622c91077 | [] | no_license | wangshanhai/PhotoRCropAndFilter | 3abb8a6cf402f26c953162f415553bdb4490d9f4 | 182037bf065808c088ce526186aeb9d70499ddc8 | refs/heads/master | 2021-01-18T16:47:34.922585 | 2018-05-05T13:46:56 | 2018-05-05T13:46:56 | 86,768,006 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,908 | java | package com.wsh.photofilter.filter;
import android.content.Context;
import com.wsh.photofilter.R;
/**
* Created by sam on 14-8-9.
*/
public class IFWaldenFilter extends IFImageFilter {
private static final String SHADER = "precision lowp float;\n" +
" \n" +
" varying highp vec2 textureCoordinate;\n" +
" \n" +
" uniform sampler2D inputImageTexture;\n" +
" uniform sampler2D inputImageTexture2; //map\n" +
" uniform sampler2D inputImageTexture3; //vigMap\n" +
" \n" +
" void main()\n" +
" {\n" +
" \n" +
" vec3 texel = texture2D(inputImageTexture, textureCoordinate).rgb;\n" +
" \n" +
" texel = vec3(\n" +
" texture2D(inputImageTexture2, vec2(texel.r, .16666)).r,\n" +
" texture2D(inputImageTexture2, vec2(texel.g, .5)).g,\n" +
" texture2D(inputImageTexture2, vec2(texel.b, .83333)).b);\n" +
" \n" +
" vec2 tc = (2.0 * textureCoordinate) - 1.0;\n" +
" float d = dot(tc, tc);\n" +
" vec2 lookup = vec2(d, texel.r);\n" +
" texel.r = texture2D(inputImageTexture3, lookup).r;\n" +
" lookup.y = texel.g;\n" +
" texel.g = texture2D(inputImageTexture3, lookup).g;\n" +
" lookup.y = texel.b;\n" +
" texel.b\t= texture2D(inputImageTexture3, lookup).b;\n" +
" \n" +
" gl_FragColor = vec4(texel, 1.0);\n" +
" }\n";
public IFWaldenFilter(Context paramContext) {
super(paramContext, SHADER);
setRes();
}
private void setRes() {
addInputTexture(R.drawable.walden_map);
addInputTexture(R.drawable.vignette_map);
}
}
| [
"260005426@qq.com"
] | 260005426@qq.com |
7e08474bfe0e11701e142f5cdc95ecbe05cf8c6a | 2033a1ab5781ae0762782f5e5b7e4cf05bffb2b7 | /Group/DevNightmare/jsdf-dataflowtesting/src/main/java/net/bqc/jsdf/core/model/EntryVertex.java | 2dfae05784820a9c9ea0ffaccb1055ffd81fff9d | [] | no_license | truonganhhoang/int3117-2017 | 17df99d31fcad95b468a96f3882a76ba2a4c83e8 | 972f6635d2b512a276d2c6f26cd316d62232efa3 | refs/heads/master | 2021-01-20T09:29:04.977067 | 2018-01-04T13:41:28 | 2018-01-04T13:41:28 | 101,594,242 | 10 | 97 | null | 2018-01-04T13:41:29 | 2017-08-28T01:59:51 | JavaScript | UTF-8 | Java | false | false | 144 | java | package net.bqc.jsdf.core.model;
public class EntryVertex extends Vertex {
public EntryVertex() {
this.type = Type.ENTRY;
}
}
| [
"bqcuong2212@gmail.com"
] | bqcuong2212@gmail.com |
2757dcf7940740e04c97d064131873a528926bf9 | eb1f67cb5641e9e0062acdf7de7cc59b2af5d88a | /AdressBook/src/main/java/snork/application/NameSection.java | 01df31b5cdd0c1ce47290be7e396e34cc2c89c37 | [] | no_license | S-nork/Mt_AT | 6042e49f274b00b6b37fdb75c007eb361c5aad01 | cc50621905e5d118b7965de5f4940e6be81250b5 | refs/heads/master | 2021-01-10T15:35:06.631205 | 2016-03-28T13:49:04 | 2016-03-28T13:49:04 | 54,895,052 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 764 | java | /*
*
* =======================================================================
*
* Copyright (c) 2009-2016 Sony Network Entertainment, Inc. All rights reserved.
*
* This software is the confidential and proprietary information of
* Sony Network Entertainment, Inc.
* You shall not disclose such Confidential Information and shall use it only in
* accordance with the terms of the license agreement you entered into with
* Sony Network Entertainment, Inc.
*
* =======================================================================
*
* For more information, please see http://www.sony.com/SCA/outline/corporation.shtml
*
*/
package snork.application;
public interface NameSection {
String collectNameInfo();
void showName(String name);
}
| [
"olya.trifonova@gmail.com"
] | olya.trifonova@gmail.com |
b1eb19d4e2a79e7e0e0e928db26426e579324c7b | 30db3bfc31a6c10cfa70eaaa025c3935324f7fc4 | /item/src/main/java/org/exnihilo/Item/model/MiembroEquipo.java | 1f4e6fe93e079cd288ea2f697ba76c60592965d7 | [] | no_license | marcola1910/item | 5364269e060ed56a96400555b5a6d5ec18e9ae27 | 17e5e69337ac845a375b5a882cc77297a9374dcb | refs/heads/master | 2020-05-22T00:04:15.317138 | 2017-01-18T15:34:06 | 2017-01-18T15:34:06 | 62,510,598 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,011 | java | package org.exnihilo.Item.model;
import java.util.List;
public class MiembroEquipo extends Usuario {
private Puesto puesto;
private List<Equipo> Equipos;
private int dbId;
public MiembroEquipo(){
super();
}
public String getOid() {
return super.getOid();
}
public void setOid(String oid) {
super.setOid(oid);
}
public String getNombre() {
return super.getNombre();
}
public void setNombre(String nombre) {
super.setNombre(nombre);
}
public Puesto getPuesto() {
return puesto;
}
public void setPuesto(Puesto puesto) {
this.puesto = puesto;
}
public List<Equipo> getEquipos() {
return Equipos;
}
public void setEquipos(List<Equipo> equipos) {
Equipos = equipos;
}
public void setIniPass(){
super.setPassword("ini1234");
}
/**
* @return the dbId
*/
public int getDbId() {
return dbId;
}
/**
* @param dbId the dbId to set
*/
public void setDbId(int dbId) {
this.dbId = dbId;
}
}
| [
"marc.alcantara@gmail.com"
] | marc.alcantara@gmail.com |
37a56a598404b40727ba0de9341fa73d1f3a2f58 | 151dcddd4fa069d4434efd6ea29b3e095511be9b | /src/com/company/step1/DataManager.java | df64c2571e5ffa8963b79b9d76feb63ae93fb760 | [] | no_license | piyumisudusinghe/InversionOfControl | 697508ff4619f16f533d82126cfe1847e512453e | 130f71ad897e20f2993030de9540481f76680e70 | refs/heads/master | 2020-08-08T11:27:11.415119 | 2019-10-09T08:44:29 | 2019-10-09T08:44:29 | 213,821,794 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 662 | java | package com.company.step1;
import java.util.HashMap;
public class DataManager {
public HashMap<String,String> getClientDetails(int id){
//connect with the database and retrieve the data relevant to the given client id
System.out.println("Getting details of the client" + id);
HashMap<String,String>clientDetails = new HashMap<String,String>();
clientDetails.put("id", String.valueOf(id));
clientDetails.put("firstname","Piyumi");
clientDetails.put("lastname","Sudusinghe");
clientDetails.put("country","Sri Lanka");
clientDetails.put("city","Matara");
return clientDetails;
}
}
| [
"piyumisudusinghe@gmail.com"
] | piyumisudusinghe@gmail.com |
79385b948a6379313ef52318423ec20d0448a517 | edfffbee3f6307e5814252d92a30f809a4f18bb5 | /spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAdvisorAutoProxyCreator.java | fd8a658bf8362c72748d609b51b493ece8408966 | [] | no_license | CST11021/SpringMVC_Source_3.2.9_Fourm | 249009070e247a8f95d1b80b654903e11e72001d | 8a87c479607b86338417228e6a8b622b7b361cc4 | refs/heads/master | 2022-09-16T02:57:57.311437 | 2018-02-09T10:18:34 | 2018-02-09T10:18:34 | 94,592,635 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 6,711 | java | /*
* Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.aop.framework.autoproxy;
import java.util.List;
import org.springframework.aop.Advisor;
import org.springframework.aop.TargetSource;
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.core.OrderComparator;
/**
* Generic auto proxy creator that builds AOP proxies for specific beans
* based on detected Advisors for each bean.
*
* <p>Subclasses must implement the abstract {@link #findCandidateAdvisors()}
* method to return a list of Advisors applying to any object. Subclasses can
* also override the inherited {@link #shouldSkip} method to exclude certain
* objects from auto-proxying.
*
* <p>Advisors or advices requiring ordering should implement the
* {@link org.springframework.core.Ordered} interface. This class sorts
* Advisors by Ordered order value. Advisors that don't implement the
* Ordered interface will be considered as unordered; they will appear
* at the end of the advisor chain in undefined order.
*
* @author Rod Johnson
* @author Juergen Hoeller
* @see #findCandidateAdvisors
*/
@SuppressWarnings("serial")
public abstract class AbstractAdvisorAutoProxyCreator extends AbstractAutoProxyCreator {
private BeanFactoryAdvisorRetrievalHelper advisorRetrievalHelper;
@Override
public void setBeanFactory(BeanFactory beanFactory) {
super.setBeanFactory(beanFactory);
if (!(beanFactory instanceof ConfigurableListableBeanFactory)) {
throw new IllegalStateException("Cannot use AdvisorAutoProxyCreator without a ConfigurableListableBeanFactory");
}
initBeanFactory((ConfigurableListableBeanFactory) beanFactory);
}
protected void initBeanFactory(ConfigurableListableBeanFactory beanFactory) {
this.advisorRetrievalHelper = new BeanFactoryAdvisorRetrievalHelperAdapter(beanFactory);
}
@Override
protected Object[] getAdvicesAndAdvisorsForBean(Class beanClass, String beanName, TargetSource targetSource) {
List advisors = findEligibleAdvisors(beanClass, beanName);
if (advisors.isEmpty()) {
return DO_NOT_PROXY;
}
return advisors.toArray();
}
/**
* Find all eligible Advisors for auto-proxying this class.
* @param beanClass the clazz to find advisors for
* @param beanName the name of the currently proxied bean
* @return the empty List, not {@code null},
* if there are no pointcuts or interceptors
* @see #findCandidateAdvisors
* @see #sortAdvisors
* @see #extendAdvisors
*/
// 对于指定bean的增强方法的获取一定是包含两个步骤,获取所有的增强以及寻找所有增强中适用于bean的增强并应用,那么findCandidateAdvisors与findAdvisorsThatCanApply
// 便是做了这两件事情。当然,如果无法找到对应的增强器便返回DO_NOT_PROXY,其中DO_NOT_PROXY=null。
protected List<Advisor> findEligibleAdvisors(Class beanClass, String beanName) {
List<Advisor> candidateAdvisors = findCandidateAdvisors();
List<Advisor> eligibleAdvisors = findAdvisorsThatCanApply(candidateAdvisors, beanClass, beanName);
extendAdvisors(eligibleAdvisors);
if (!eligibleAdvisors.isEmpty()) {
eligibleAdvisors = sortAdvisors(eligibleAdvisors);
}
return eligibleAdvisors;
}
/**
* Find all candidate Advisors to use in auto-proxying.
* @return the List of candidate Advisors
*/
protected List<Advisor> findCandidateAdvisors() {
return this.advisorRetrievalHelper.findAdvisorBeans();
}
/**
* Search the given candidate Advisors to find all Advisors that
* can apply to the specified bean.
* @param candidateAdvisors the candidate Advisors
* @param beanClass the target's bean class
* @param beanName the target's bean name
* @return the List of applicable Advisors
* @see ProxyCreationContext#getCurrentProxiedBeanName()
*/
protected List<Advisor> findAdvisorsThatCanApply(List<Advisor> candidateAdvisors, Class beanClass, String beanName) {
ProxyCreationContext.setCurrentProxiedBeanName(beanName);
try {
return AopUtils.findAdvisorsThatCanApply(candidateAdvisors, beanClass);
}
finally {
ProxyCreationContext.setCurrentProxiedBeanName(null);
}
}
/**
* Return whether the Advisor bean with the given name is eligible
* for proxying in the first place.
* @param beanName the name of the Advisor bean
* @return whether the bean is eligible
*/
protected boolean isEligibleAdvisorBean(String beanName) {
return true;
}
/**
* Sort advisors based on ordering. Subclasses may choose to override this
* method to customize the sorting strategy.
* @param advisors the source List of Advisors
* @return the sorted List of Advisors
* @see org.springframework.core.Ordered
* @see org.springframework.core.OrderComparator
*/
protected List<Advisor> sortAdvisors(List<Advisor> advisors) {
OrderComparator.sort(advisors);
return advisors;
}
/**
* Extension hook that subclasses can override to register additional Advisors,
* given the sorted Advisors obtained to date.
* <p>The default implementation is empty.
* <p>Typically used to add Advisors that expose contextual information
* required by some of the later advisors.
* @param candidateAdvisors Advisors that have already been identified as
* applying to a given bean
*/
protected void extendAdvisors(List<Advisor> candidateAdvisors) {
}
/**
* This auto-proxy creator always returns pre-filtered Advisors.
*/
@Override
protected boolean advisorsPreFiltered() {
return true;
}
/**
* Subclass of BeanFactoryAdvisorRetrievalHelper that delegates to
* surrounding AbstractAdvisorAutoProxyCreator facilities.
*/
private class BeanFactoryAdvisorRetrievalHelperAdapter extends BeanFactoryAdvisorRetrievalHelper {
public BeanFactoryAdvisorRetrievalHelperAdapter(ConfigurableListableBeanFactory beanFactory) {
super(beanFactory);
}
@Override
protected boolean isEligibleBean(String beanName) {
return AbstractAdvisorAutoProxyCreator.this.isEligibleAdvisorBean(beanName);
}
}
}
| [
"wb-whz291815@alibaba-inc.com"
] | wb-whz291815@alibaba-inc.com |
e7d4eeef0955dc148e0aa10bb344c3a93a9d5089 | 9b0d92ae7342f6601de2b091586c0e95b84359ac | /app/src/main/java/com/example/bakingapp/ui/RecipeStepListFragment.java | c6dbb159a562f094e9ebf9e882e332912aa93050 | [] | no_license | jiajiewu96/BakingApp | d751f1a50d96e7f0b80f0055192c544f29a44a6f | 7c5174487d453fbb5bbcec807881435f7e7b8fcc | refs/heads/master | 2020-07-13T10:12:46.301760 | 2019-09-17T12:53:24 | 2019-09-17T12:53:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,320 | java | package com.example.bakingapp.ui;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.lifecycle.ViewModelProviders;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.example.bakingapp.AppExecutors;
import com.example.bakingapp.R;
import com.example.bakingapp.data.FavoritesViewModel;
import com.example.bakingapp.model.Recipe;
import com.example.bakingapp.model.Step;
import com.example.bakingapp.ui.adapters.IngredientsListAdapter;
import com.example.bakingapp.ui.adapters.StepAdapter;
import com.example.bakingapp.ui.fragmentInterfaces.CommonFragmentInterfaces;
import com.example.bakingapp.utils.Consts;
import java.util.ArrayList;
public class RecipeStepListFragment extends Fragment implements StepAdapter.StepSelectedListener {
private CommonFragmentInterfaces mTitleInterface;
private IngredientsListAdapter mIngredientsListAdapter;
private StepAdapter mStepAdapter;
private ImageView mFavoriteImageView;
private FavoritesViewModel mFavoritesViewModel;
private FragmentActivity mFragmentActivity;
private OnStepClickedListener onStepClickedListener;
private Recipe mRecipe;
private Context mContext;
private ImageView mPinImageView;
public interface OnStepClickedListener {
void onStepClicked(ArrayList<Step> steps, int position);
}
public RecipeStepListFragment(){
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
try{
onStepClickedListener = (OnStepClickedListener) context;
mTitleInterface = (CommonFragmentInterfaces) context;
} catch (ClassCastException e){
throw new ClassCastException(context.toString() +
" Must implement onStepClickedListener");
}
mContext = getContext();
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mFragmentActivity = getActivity();
FavoritesViewModel.Factory factory = new FavoritesViewModel.Factory(mFragmentActivity.getApplication());
mFavoritesViewModel = ViewModelProviders.of(mFragmentActivity,factory).get(FavoritesViewModel.class);
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_recipe_steps, container, false);
ActionBar actionBar = ((AppCompatActivity) mFragmentActivity).getSupportActionBar();
mFavoriteImageView = rootView.findViewById(R.id.iv_favorite_button);
setButtonOnClicks();
setupRecyclerViews(rootView);
Bundle bundle = getArguments();
if(bundle!=null){
mRecipe = (Recipe) bundle.getParcelable(Consts.RECIPE_KEY);
actionBar.show();
mTitleInterface.onFragmentChangedListener(mRecipe.getName());
mIngredientsListAdapter.setIngredients(mRecipe.getIngredients());
mStepAdapter.setSteps(mRecipe.getSteps());
}
checkForRecipeInDB();
return rootView;
}
private void setButtonOnClicks() {
mFavoriteImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(mRecipe.getFavorite() != Consts.FLAG_IS_FAVORITED){
mRecipe.setFavorite(Consts.FLAG_IS_FAVORITED);
setFavoriteSelectedImage();
AppExecutors.getInstance().diskIO().execute(
new Runnable() {
@Override
public void run() {
mFavoritesViewModel.addFavorite(mRecipe);
}
}
);
}else{
mRecipe.setFavorite(Consts.FLAG_IS_NOT_FAVORITED);
setFavoriteUnselectedImage();
AppExecutors.getInstance().diskIO().execute(new Runnable() {
@Override
public void run() {
mFavoritesViewModel.removeFavorite(mRecipe);
}
});
}
}
});
}
private void checkForRecipeInDB() {
AppExecutors.getInstance().diskIO().execute(new Runnable() {
@Override
public void run() {
if(mRecipe.getWidget() == Consts.FLAG_IS_WIDGET){
if(!mFavoritesViewModel.checkIfRecipeInDb(mRecipe)){
mRecipe.setFavorite(Consts.FLAG_IS_FAVORITED);
setFavoriteSelectedImage();
}else{
mRecipe.setFavorite(Consts.FLAG_IS_NOT_FAVORITED);
setFavoriteUnselectedImage();
}
}else{
if(mFavoritesViewModel.checkIfRecipeInDb(mRecipe)){
mRecipe.setFavorite(Consts.FLAG_IS_FAVORITED);
setFavoriteSelectedImage();
}else{
mRecipe.setFavorite(Consts.FLAG_IS_NOT_FAVORITED);
setFavoriteUnselectedImage();
}
}
}
});
}
private void setupRecyclerViews(View rootView) {
RecyclerView ingredientsRecycler = (RecyclerView) rootView.findViewById(R.id.recycler_ingredients);
RecyclerView stepsRecycler = (RecyclerView) rootView.findViewById(R.id.recycler_steps);
mIngredientsListAdapter = new IngredientsListAdapter();
ingredientsRecycler.setAdapter(mIngredientsListAdapter);
mStepAdapter = new StepAdapter(this);
stepsRecycler.setAdapter(mStepAdapter);
LinearLayoutManager ingredientsLayoutManager = new LinearLayoutManager(getActivity()){
@Override
public boolean canScrollVertically() {
return false;
}
};
LinearLayoutManager stepsLayoutManager = new LinearLayoutManager(getActivity());
ingredientsRecycler.setLayoutManager(ingredientsLayoutManager);
stepsRecycler.setLayoutManager(stepsLayoutManager);
ingredientsRecycler.setNestedScrollingEnabled(true);
stepsRecycler.setNestedScrollingEnabled(true);
}
private void setFavoriteUnselectedImage() {
mFavoriteImageView.setImageResource(R.drawable.ic_unfavorite);
}
private void setFavoriteSelectedImage() {
mFavoriteImageView.setImageResource(R.drawable.ic_favorite);
}
@Override
public void onStepSelected(ArrayList<Step> steps, int position) {
onStepClickedListener.onStepClicked(steps, position);
}
}
| [
"jiajie.wu96@gmail.com"
] | jiajie.wu96@gmail.com |
1f51d076f21481f0e90f295dc43639cddff7b587 | 33cae071de05a68ce026bbbdeaa34780f965fd42 | /src/剑指offer/_53表示数值的字符串.java | f157d8ba1f37b192ac2eaefce9afe3f331c330ea | [] | no_license | xiaok1024/AlgorithmWithDesign | 85c04ab08f43409b5314fdc21220f0446aa3f2be | 80f5fce4d4864a7451534d13cbc9bc83e4b042ef | refs/heads/master | 2020-05-01T09:47:53.202394 | 2019-03-24T12:02:05 | 2019-03-24T12:02:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,241 | java | package 剑指offer;
public class _53表示数值的字符串 {
/*
* 请实现一个函数用来判断字符串是否表示数值(包括整数和小数)。
* 例如,字符串"+100","5e2","-123","3.1416"和"-1E-16"都表示数值。
* 但是"12e","1a3.14","1.2.3","+-5"和"12e+4.3"都不是。
*
*/
// 思路:逐个字符进行判断,e或E和小数点最多出现一次(无法共存),而e或E的前一个必须是数字,且不能是第一个或最后一个字符,
// 符号的前一个字符不能是e或E。也可用正则表达式判断!
/*
* 思路:定义ecount 和 pcount 先判断第一个数是否为'-' 或者'+',遍历str
* 后面的数字判断'-'或者'+'的前面是否为'e或者'E',
* 判断e/E出现的次数,出现一次eCount 和pCount 都要+1,判断eCount >1 -> false,判断e的位置是否合法(不能为首尾,前面必须是数字) ,不满足false,都满足continue
* 判断'.'出现的次数,eCount>1,false否则continue继续遍历
* 判断是否合法(为数字<48~57,e,E>)
*
*/
/*public boolean isNumeric(char[] str) {
if (str == null)
return false;
int index = 0;
int ecount = 0;
int pcount = 0;
//如果第一个字符是符号就跳过
if (str[0] == '-' || str[0] == '+')
index++;
for (int i = index; i < str.length; i++) {
if (str[i] == '-' || str[i] == '+') {
if (str[i - 1] != 'e' && str[i - 1] != 'E')
return false;
continue;
}
if (str[i] == 'e' || str[i] == 'E') {
ecount++;
if (ecount > 1)
return false;
if (i == 0 || str[i - 1] < 48 || str[i - 1] > 57 || i == str.length - 1)
return false;
pcount++;
continue;
}
if (str[i] == '.') {
pcount++;
if (pcount > 1)
return false;
continue;
}
// 出现非数字且不是e/E则返回false(小数点和符号用continue跳过了)
if ((str[i] < 48 || str[i] > 57) && (str[i] != 'e') && (str[i] != 'E'))
return false;
}
return true;
}
*/
public boolean isNumeric(char[] str) {
if(str ==null)
return false;
int ecount=0; //e的个数
int pcount=0; //p的个数
int index =0; //首字母是否为正负
//判断第一个位置是否为-|+
if(str[0] =='-' || str[0] =='+')
index =1;
for (int i = index; i < str.length; i++) {
//数组中后面的位置出现了正负前面必须为e,E
if(str[i] == '-' || str[i] == '+') {
if (str[i-1] != 'e' && str[i-1] != 'E') {
return false;
}
continue;
}
//判断存在几个e|E
if( str[i] =='e' || str[i] =='E' ) {
ecount++;
if(ecount>1)
return false;
//判断e的前后条件
if(i==0 || i==str.length-1 ||str[i-1] <48 ||str[i-1] >57)
return false;
//存在e或者E就不能有小数
pcount++;
continue;
}
//判断是否存在小数
if(str[i] =='.') {
pcount++;
if(pcount >1)
return false;
continue;
}
// 出现非数字且不是e/E(因为前面是根据e/E来判断的,可能前面出现了E,后面有e)则返回false(小数点和符号用continue跳过了)
if ((str[i] < 48 || str[i] > 57) && (str[i] != 'e') && (str[i] != 'E'))
return false;
}
return true;
}
}
| [
"xiaokang136106@163.com"
] | xiaokang136106@163.com |
c28af66a3550226c75e788dc12e152de67880712 | c7ad128bb722227c7995e58fb3b41e767562357b | /app/src/main/java/com/article/oa_article/view/mobanmanager/ItemTouchHelperAdapter.java | 710bf573a0087ee76e252b307128c7da17298253 | [] | no_license | sengeiou/oa_article | 45bbc650274ab4976c4fcf27f17b91d82be3086a | 233a4a4acda90d69a7b961c894714bbfbd950f34 | refs/heads/master | 2022-03-30T11:20:34.007968 | 2020-01-14T08:27:02 | 2020-01-14T08:27:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 247 | java | package com.article.oa_article.view.mobanmanager;
//先写一个接口
public interface ItemTouchHelperAdapter {
void onItemMove(int fromPosition, int toPosition);//移动时方法
void onItemDissmiss(int position);//消失时方法
}
| [
"wy19941007"
] | wy19941007 |
5e67f029aea7892bab476f6daa727b40a90a4b43 | f080e03b5aa88dce25a7a7afaea18f11f1167a02 | /ZNTVodBoxNew/src/com/znt/vodbox/activity/LoginActivity.java | 8619024d35b51289c8b9ddb2d565572235777e5c | [] | no_license | fireworkburn/DianYinGuanJia | 03c562f0c4170ded202a30016bcb36aefe73cba5 | 7895c35824ad62171ab948e36760a002d11c31b4 | refs/heads/master | 2021-01-19T19:40:52.260600 | 2017-09-07T14:35:57 | 2017-09-07T14:35:57 | 100,284,502 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 11,617 | java | package com.znt.vodbox.activity;
import java.util.HashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.znt.diange.mina.entity.UserInfor;
import com.znt.vodbox.R;
import com.znt.vodbox.entity.Constant;
import com.znt.vodbox.entity.LocalDataEntity;
import com.znt.vodbox.mvp.p.HttpLoginPresenter;
import com.znt.vodbox.mvp.v.IHttpLoginView;
import com.znt.vodbox.utils.ViewUtils;
import com.znt.vodbox.view.SplashView;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.design.widget.Snackbar;
import android.text.TextUtils;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import cn.smssdk.EventHandler;
import cn.smssdk.SMSSDK;
import cn.smssdk.gui.RegisterPage;
public class LoginActivity extends BaseActivity implements IHttpLoginView
{
public static final String VIDEO_NAME = "welcome_video.mp4";
private static final int REQUEST_SIGNUP = 0;
private EditText _emailText;
private EditText _passwordText;
private Button _loginButton;
private TextView _signupLink;
private TextView tvFindPwd;
private LinearLayout linearLayout = null;
private SplashView mSplashView = null;
private View viewSpBg = null;
private RegisterPage registerPage = null;
// 填写从短信SDK应用后台注册得到的APPKEY
private final String APPKEY = "1042787b0334e";
// 填写从短信SDK应用后台注册得到的APPSECRET
private final String APPSECRET = "084334a5af0fca9cdd5ebd886516e95a";
private boolean ready;
private HttpLoginPresenter httpLoginPresenter = null;
private Handler handler = new Handler();
private String loginType = "0";//1, 不显示splash
private boolean isClickLogin = false;
private long startTime = 0;
private final long finishTime = 1000 * 3;
@Override
protected void onCreate(Bundle savedInstanceState) {
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
showTopView(false);
_signupLink = (TextView)findViewById(R.id.link_signup);
tvFindPwd = (TextView)findViewById(R.id.link_signup_findpwd);
_passwordText = (EditText)findViewById(R.id.input_password);
_emailText = (EditText)findViewById(R.id.input_email);
_loginButton = (Button)findViewById(R.id.btn_login);
linearLayout = (LinearLayout) findViewById(R.id.view_login_splash);
viewSpBg = findViewById(R.id.view_login_splash_bg);
loginType = getIntent().getStringExtra("LoginType");
if(TextUtils.isEmpty(loginType))
loginType = "0";
_loginButton.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
if (validate())
{
isClickLogin = true;
httpLoginPresenter.userLogin();
}
}
});
_signupLink.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Start the Signup activity
/*Intent intent = new Intent(getApplicationContext(), RegisterActivity.class);
startActivityForResult(intent, REQUEST_SIGNUP);
overridePendingTransition(R.anim.push_left_in, R.anim.push_left_out);*/
startSMSCheck();
}
});
tvFindPwd.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startSMSCheck();
}
});
if(loginType.equals("0"))
{
mSplashView = new SplashView(this);
handler.postDelayed(new Runnable()
{
@Override
public void run()
{
mSplashView.stopRotate();
handler.postDelayed(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
if(MyApplication.isLogin)
goHomePage();
else
{
showTopView(true);
setCenterString(getResources().getString(R.string.user_login));
hideSplash();
}
}
}, 500);
}
}, finishTime);
linearLayout.addView(mSplashView);
}
else
{
showTopView(true);
viewSpBg.setVisibility(View.GONE);
setCenterString(getResources().getString(R.string.user_login));
}
httpLoginPresenter = new HttpLoginPresenter(getApplicationContext(), this);
//initSMSSDK();
initLogin();
}
private void hideSplash()
{
linearLayout.setVisibility(View.GONE);
viewSpBg.setVisibility(View.GONE);
}
private void initLogin()
{
UserInfor info = LocalDataEntity.newInstance(getApplicationContext()).getUserInfor();
String account = info.getAccount();
String pwd = info.getPwd();
if(!TextUtils.isEmpty(account) && !TextUtils.isEmpty(pwd))
{
startTime = System.currentTimeMillis();
_emailText.setText(account);
_passwordText.setText(pwd);
httpLoginPresenter.userLogin();
}
}
public boolean validate() {
String email = _emailText.getText().toString();
String password = _passwordText.getText().toString();
if(email.isEmpty())
{
_emailText.setError(getResources().getString(R.string.account_number_error_hint));
return false;
}
if (android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches()
|| isMobileNO(email))
{
_emailText.setError(null);
}
else
{
_emailText.setError(getResources().getString(R.string.account_number_error_hint));
return false;
}
if (password.isEmpty() || password.length() < 6 || password.length() > 12)
{
_passwordText.setError(getResources().getString(R.string.account_pwd_error_hint));
return false;
}
else
{
_passwordText.setError(null);
}
return true;
}
private void initSMSSDK()
{
if(ready)
return;
// 初始化短信SDK
SMSSDK.initSDK(this, APPKEY, APPSECRET);
EventHandler eventHandler = new EventHandler()
{
public void afterEvent(int event, int result, Object data)
{
Message msg = new Message();
msg.arg1 = event;
msg.arg2 = result;
msg.obj = data;
handler.sendMessage(msg);
}
};
// 注册回调监听接口
SMSSDK.registerEventHandler(eventHandler);
ready = true;
// 获取新好友个数
//showDialog();
//SMSSDK.getNewFriendsCount();
}
private void registerSms()
{
// 打开注册页面
if(registerPage == null)
{
registerPage = new RegisterPage();
registerPage.setRegisterCallback(new EventHandler()
{
public void afterEvent(int event, int result, Object data)
{
// 解析注册结果
if (result == SMSSDK.RESULT_COMPLETE)
{
if (event == SMSSDK.EVENT_GET_VERIFICATION_CODE)
{
if(result == SMSSDK.RESULT_COMPLETE)
{
boolean smart = (Boolean)data;
if(smart)
{
//通过智能验证
showToast("智能验证");
}
else
{
//依然走短信验证
showToast("短信验证");
}
}
}
@SuppressWarnings("unchecked")
HashMap<String,Object> phoneMap = (HashMap<String, Object>) data;
String country = (String) phoneMap.get("country");
String phone = (String) phoneMap.get("phone");
Bundle bundle = new Bundle();
bundle.putString("phone", phone);
ViewUtils.startActivity(getActivity(), RegisterActivity.class, bundle, 5);
//String pwd = (String) phoneMap.get("pwd");
//int type = (Integer)phoneMap.get("checktype");
/*userInfor.setAccount(phone);
userInfor.setPwd(pwd);
etAccount.setText(phone);
etPwd.setText(pwd);*/
}
}
});
}
registerPage.show(this);
}
private void startSMSCheck()
{
registerSms();
}
/**
*callbacks
*/
@Override
protected void onResume()
{
//showUserInfor();
if (ready)
{
// 获取新好友个数
//showDialog();
//SMSSDK.getNewFriendsCount();
}
// TODO Auto-generated method stub
super.onResume();
}
public static boolean isMobileNO(String mobiles)
{
Pattern p = Pattern.compile("^(13[0-9]|14[57]|15[0-35-9]|17[6-8]|18[0-9])[0-9]{8}$");
Matcher m = p.matcher(mobiles);
return m.matches();
}
@Override
protected void onDestroy()
{
if (ready)
{
// 销毁回调监听接口
SMSSDK.unregisterAllEventHandler();
}
super.onDestroy();
}
private void userLoginResult(UserInfor info)
{
UserInfor userInfor = info;
userInfor.setAccount(this.getLoginAccount());
userInfor.setPwd(this.getLoginPwd());
if(userInfor != null)
{
LocalDataEntity.newInstance(getApplicationContext()).setUserInfor(userInfor);
LocalDataEntity.newInstance(getApplicationContext()).setUserRecord(userInfor);
MyApplication.isLogin = true;
Constant.isShopUpdated = true;
Constant.isAlbumUpdated = true;
}
}
private void goHomePage()
{
Intent intent = new Intent();
intent.setClass(getApplicationContext(), MainActivity.class);
startActivity(intent);
finish();
}
@Override
public String getLoginAccount()
{
// TODO Auto-generated method stub
return _emailText.getText().toString().trim();
}
@Override
public String getLoginPwd()
{
// TODO Auto-generated method stub
return _passwordText.getText().toString().trim();
}
@Override
public void loginRunning()
{
// TODO Auto-generated method stub
if(isClickLogin)
{
//showProgressDialog(getActivity(), "正在登录...");;
_loginButton.setText(getResources().getString(R.string.login_doing));
_loginButton.setClickable(false);
}
}
@Override
public void loginFailed(String error)
{
// TODO Auto-generated method stub
Snackbar.make(_loginButton, error, 0).show();
_loginButton.setText(getResources().getString(R.string.login));
_loginButton.setClickable(true);
//dismissDialog();
}
@Override
public void loginSuccess(UserInfor info)
{
// TODO Auto-generated method stub
userLoginResult(info);
dismissDialog();
if(isClickLogin)
goHomePage();
/*long endTime = System.currentTimeMillis() - startTime;
if(endTime < finishTime)
{
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
goHomePage();
}
}, endTime);
}*/
}
private long touchTime = 0;
@Override
public void onBackPressed()
{
if((System.currentTimeMillis() - touchTime) < 2000)
{
closeApp();
super.onBackPressed();
// TODO Auto-generated method stub
}
else
{
showToast(getResources().getString(R.string.exit_hint));
touchTime = System.currentTimeMillis();
}
}
private void closeApp()
{
closeAllActivity();
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(0);
}
} | [
"yuyan19850204@sina.com"
] | yuyan19850204@sina.com |
45e11eed018ea6fd3c73de442bc6f6a356e955fb | 155d3eff19c828e03d6925e710f187478edd0791 | /openldbws-lib/src/main/java/com/thalesgroup/rtti/_2016_02_16/ldb/types/StationBoard.java | 772be00633f3ab2ebd705078c00f3da690ca2017 | [] | no_license | asimpson2004/openldbws-app | 2b19d2ef8c1c0c34163c480a725b8847a9773e61 | fd9596319fec7c9ae1724e2d62c9a208f13e6af2 | refs/heads/master | 2021-01-03T14:03:17.531012 | 2020-07-02T11:40:46 | 2020-07-02T11:40:46 | 240,096,181 | 0 | 0 | null | 2020-07-02T11:40:47 | 2020-02-12T19:23:31 | Java | UTF-8 | Java | false | false | 3,240 | java |
package com.thalesgroup.rtti._2016_02_16.ldb.types;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
import com.thalesgroup.rtti._2015_11_27.ldb.types.BaseStationBoard;
/**
* A structure containing details of a basic departure board for a specific location.
*
* <p>Java class for StationBoard complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="StationBoard">
* <complexContent>
* <extension base="{http://thalesgroup.com/RTTI/2015-11-27/ldb/types}BaseStationBoard">
* <sequence>
* <element name="trainServices" type="{http://thalesgroup.com/RTTI/2016-02-16/ldb/types}ArrayOfServiceItems" minOccurs="0"/>
* <element name="busServices" type="{http://thalesgroup.com/RTTI/2016-02-16/ldb/types}ArrayOfServiceItems" minOccurs="0"/>
* <element name="ferryServices" type="{http://thalesgroup.com/RTTI/2016-02-16/ldb/types}ArrayOfServiceItems" minOccurs="0"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "StationBoard", propOrder = {
"trainServices",
"busServices",
"ferryServices"
})
public class StationBoard
extends BaseStationBoard
{
protected ArrayOfServiceItems trainServices;
protected ArrayOfServiceItems busServices;
protected ArrayOfServiceItems ferryServices;
/**
* Gets the value of the trainServices property.
*
* @return
* possible object is
* {@link ArrayOfServiceItems }
*
*/
public ArrayOfServiceItems getTrainServices() {
return trainServices;
}
/**
* Sets the value of the trainServices property.
*
* @param value
* allowed object is
* {@link ArrayOfServiceItems }
*
*/
public void setTrainServices(ArrayOfServiceItems value) {
this.trainServices = value;
}
/**
* Gets the value of the busServices property.
*
* @return
* possible object is
* {@link ArrayOfServiceItems }
*
*/
public ArrayOfServiceItems getBusServices() {
return busServices;
}
/**
* Sets the value of the busServices property.
*
* @param value
* allowed object is
* {@link ArrayOfServiceItems }
*
*/
public void setBusServices(ArrayOfServiceItems value) {
this.busServices = value;
}
/**
* Gets the value of the ferryServices property.
*
* @return
* possible object is
* {@link ArrayOfServiceItems }
*
*/
public ArrayOfServiceItems getFerryServices() {
return ferryServices;
}
/**
* Sets the value of the ferryServices property.
*
* @param value
* allowed object is
* {@link ArrayOfServiceItems }
*
*/
public void setFerryServices(ArrayOfServiceItems value) {
this.ferryServices = value;
}
}
| [
"a.simpson.2004@hotmail.com"
] | a.simpson.2004@hotmail.com |
29dfe4a0ea1024345a6fdfa30f3d464f1164e33f | 3456fe5453946d9cd2d91d4a3904beb3111b3ab8 | /HibernateMapping/src/main/java/com/techiegoals/onetoone/entity/UserDetails.java | 2c877e8ebfbfef1a3d2cea31a35b269abd2e1c98 | [] | no_license | anandkushwaha/hibernate-mapping | c2028b5c4d19759d3d44802618a5bdc1ca34a263 | c2f599786f076e6a41cce4c512dccd047353c0e4 | refs/heads/master | 2020-12-25T14:38:08.589301 | 2016-08-15T17:42:18 | 2016-08-15T17:42:18 | 65,725,127 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 921 | java | package com.techiegoals.onetoone.entity;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;
@Entity
@Table(name = "User_Details")
public class UserDetails {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int userId;
private String userName;
@OneToOne
private Vehicle vehicle;
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public Vehicle getVehicle() {
return vehicle;
}
public void setVehicle(Vehicle vehicle) {
this.vehicle = vehicle;
}
}
| [
"anandkushwahakiet@gmail.com"
] | anandkushwahakiet@gmail.com |
8f750c7aaa941e4debb09bcee694b7de5e2526f7 | a7b8be31e2abbe0af021b921f00720de47181edb | /src/test/java/Helpers/HelperStep.java | 0ba1d16a806fa4979f727ea384e4a10753b1936c | [] | no_license | costinha4/automationwebfnactest | d5054fae56f8f7ffe75a63b0016d114daa0e129f | 726e4e60af503c8c45010c4b47791631845e31f5 | refs/heads/master | 2023-08-11T18:07:30.299409 | 2021-09-28T09:14:21 | 2021-09-28T09:14:21 | 411,213,082 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 22,523 | java | package Helpers;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;
public class HelperStep {
public static WebDriver driver;
private static final Logger logger = LogManager.getLogger(HelperStep.class);
private By imgLogoFnac = By.xpath(".//a[@href='https://www.fnac.pt/']/span");
private By inputSearch = By.xpath(".//input[@id='Fnac_Search']");
private By btnSearch = By.xpath(".//div[contains(@class, 'Header__search')]/button[contains(@class, 'Header__search-submit')]");
private By btnActionNext = By.xpath(".//a[contains(@class, 'actionNext')]");
private By btnAcceptCookies = By.xpath(".//button[@id='onetrust-accept-btn-handler']");
private By seeBookCharact = By.xpath(".//div[@class='f-productVariousData-actions']/a");
private By authorNameCharact = By.xpath(".//div[@class='productStrates__column']//dt[text()='Autor']/..//a");
private By isbnCharact = By.xpath(".//div[@class='productStrates__column']//dt[text()='ISBN']/..//p");
private By pagesNumberCharact = By.xpath(".//div[@class='productStrates__column']//dt[text()='Nº Páginas']/..//p");
private By bookDimentionsCharact = By.xpath(".//div[@class='productStrates__column']//dt[text()='Dimensões']/..//p");
public HelperStep() {
driver = openBrowser("Firefox");
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
}
public static WebDriver openBrowser(String browser) {
WebDriver driver = null;
try {
switch (browser) {
case ("Chrome"):
System.setProperty("webdriver.chrome.driver", ".\\drivers\\chromedriver.exe");
driver = new ChromeDriver();
break;
case ("Firefox"):
System.setProperty("webdriver.gecko.driver", ".\\drivers\\geckodriver.exe");
driver = new FirefoxDriver();
break;
default:
System.out.println("Expected value: Firefox or Chrome");
}
return driver;
} catch (Exception E) {
E.printStackTrace();
}
return driver;
}
public void closeBrowser() {
driver.close();
}
public void NavigateToPage() {
driver.get("https://www.fnac.pt/");
driver.findElement(imgLogoFnac).isDisplayed();
}
public void AcceptCookies() {
driver.findElement(btnAcceptCookies).click();
}
public void ScrollToElement(WebElement xpath, WebElement xpathToFind) {
JavascriptExecutor js = (JavascriptExecutor) driver;
WebElement Element = xpath;
js.executeScript("arguments[0].scrollIntoView();", Element);
while (!(xpathToFind).isDisplayed()) {
js.executeScript("arguments[0].scrollIntoView();", Element);
}
}
public void CloseNotifyContent() {
try {
Thread.sleep(5000);
if (driver.findElement(By.xpath(".//div[@class='inside_notify_content']")).isDisplayed()) {
try {
driver.findElement(By.xpath(".//div[@class='inside_closeButton fonticon icon-hclose']")).click();
Thread.sleep(1000);
System.out.println("Notify content closed!");
} catch (Exception e) {
System.out.println(e);
}
}
} catch (Exception e) {
System.out.println(e);
}
}
public void Search(String stringSearch) {
driver.findElement(inputSearch).sendKeys(stringSearch);
driver.findElement(btnSearch).click();
}
public void FindBookTitle(String bookTitle) {
int i = 1;
int tam = driver.findElements(By.xpath(".//div[@class= 'clearfix Article-item js-Search-hashLinkId']")).size();
System.out.println("TAMANHO: " + tam);
while (i < tam + 1) {
String title = driver.findElement(By.xpath("(.//div[contains(@data-automation-id, 'product-block')])[" + i + "]//a[contains(@class, 'Article-title')]")).getText();
if (bookTitle.equals(title)) {
System.out.println("Book found with title:" + title + " . In url: " + driver.getCurrentUrl());
break;
} else {
if (i == tam) {
ScrollToElement(driver.findElement(By.xpath("(.//div[contains(@data-automation-id, 'product-block')])[" + i + "]//a[contains(@class, 'Article-title')]")), driver.findElement(btnActionNext));
try {
Thread.sleep(5000);
driver.findElement(btnActionNext).click();
} catch (Exception e) {
System.out.println(e);
}
try {
Thread.sleep(5000);
tam = driver.findElements(By.xpath(".//div[@class= 'clearfix Article-item js-Search-hashLinkId']")).size();
i = 1;
} catch (Exception e) {
System.out.println(e);
}
} else {
i++;
}
}
}
}
public void FindWordDescription(String word) {
String description = driver.findElement(By.xpath(".//div[contains(@data-automation-id, 'product-block')]//a[contains(text(), 'Fascism and Democracy') and contains(@class, 'Article-title')]/../..//p[@class='summary']/span")).getText();
if (description.contains(word)) {
System.out.println("I found the keyword");
} else {
throw new java.lang.Error("A word '" + word + "' not found in a description!");
}
}
public void ClickGoTheBookPage() {
driver.findElement(By.xpath("(.//div[contains(@data-automation-id, 'product-block')]//a[text()='1984' and contains(@class, 'Article-title')])[1]")).click();
}
public void ClickSeeBookCharacteristics() {
driver.findElement(seeBookCharact).click();
}
public void ValidateAuthor(String name) {
if (driver.findElement(authorNameCharact).getText().equals(name)) {
System.out.println("Valid author name.");
} else {
throw new java.lang.Error("The author '" + name + "' not matches.");
}
}
public void ValidateISBN(String number) {
if (driver.findElement(isbnCharact).getText().equals(number)) {
System.out.println("Valid author ISBN.");
} else {
throw new java.lang.Error("The ISBN '" + number + "' not matches.");
}
}
public void ValidateNumberPages(String number) {
if (driver.findElement(pagesNumberCharact).getText().equals(number)) {
System.out.println("Valid number of pages.");
} else {
throw new java.lang.Error("The number of pages '" + number + "' not matches.");
}
}
public void ValidateDimensions(String dimensions) {
if (driver.findElement(bookDimentionsCharact).getText().equals(dimensions)) {
System.out.println("Valid book dimensions.");
} else {
throw new java.lang.Error("The book dimensions '" + dimensions + "' not matches.");
}
}
public void GoOpinionPage() {
ScrollToElement(driver.findElement(By.xpath(".//section[@id='CustomersAlsoBought']")), driver.findElement(By.xpath(".//span[text()='Ver todas as opiniões']")));
driver.findElement(By.xpath(".//span[text()='Ver todas as opiniões']")).click();
}
public void OldestComment(String date) {
WebElement buttonEndComment = driver.findElement(By.xpath("(.//button[@class='paginate-item-number js-paginate-item'])[3]"));
driver.findElement(By.xpath(".//a[text()='As mais recentes']")).click();
try {
buttonEndComment.click();
Thread.sleep(3000);
} catch (Exception e) {
System.out.println(e);
}
int tam = driver.findElements(By.xpath(".//div[@class='f-review-customerReview']")).size();
String commentDate = driver.findElement(By.xpath("(.//div[@class='f-review-customerReview'])[" + tam + "]//div[@class='f-reviews-date']/p")).getText();
String replacedDate = commentDate.replace("Publicada a ", "");
String[] splitDate = replacedDate.split("\\s+"); //split by space
System.out.println(Arrays.toString(splitDate));
String dateFormated = "";
if (splitDate[1].equals("ago")) {
dateFormated = String.join("/", splitDate[0], splitDate[1].replace(splitDate[1], "08"), splitDate[2]);
System.out.println(dateFormated);
}
if (date.equals(dateFormated)) {
System.out.println("Valid date");
} else {
throw new java.lang.Error("The last date was '" + dateFormated + "'.");
}
}
public void ValidateTheRatings(int validator, int starRating) {
ScrollToElement(driver.findElement(By.xpath(".//span[text()='Opiniões']/span[text()='clientes']")), driver.findElement(By.xpath(".//div[contains(@class,'customerReviewsRating')]/div[contains(@class,'customerReviewChart')]")));
if (driver.findElement(By.xpath(".//div[@class='customerReviewChart__star']/span[text()='" + starRating + "']")).isDisplayed()) {
String ratingExpected = String.valueOf(validator);
String ratingValue = driver.findElement(By.xpath(".//div[@class='customerReviewChart__star']/span[text()='" + starRating + "']/../..//span")).getText();
if (ratingExpected.equals(ratingValue)) {
logger.info("Valid rating");
System.out.println("Valid rating");
} else {
throw new java.lang.Error("The rating for '" + starRating + "star' is not '" + ratingExpected + "'. It is '" + ratingValue + "'.");
}
} else {
throw new java.lang.Error("The rating for '" + starRating + "star' is not present on page.");
}
}
public void GoToAuthorPage() {
ScrollToElement(driver.findElement(By.xpath(".//section[@id='CustomerReviews']")), driver.findElement(By.xpath(".//div[@class= 'productStrates__column authorStrate__column']")));
driver.findElement(By.xpath(".//div[@class= 'productStrates__column authorStrate__column']//a[text() = 'Tudo sobre o autor']")).click();
}
public void ConsultAuthorsBiography() {
driver.findElement(By.xpath(".//a[contains(text(), 'Ler Biografia')]")).click();
if (!(driver.findElement(By.xpath(".//section[contains(@class, 'Biography')]")).isDisplayed())) {
throw new java.lang.Error("The author's biography is not present.");
} else {
String authorName = driver.findElement(By.xpath(".//div[contains(@class, 'intervenantBiography-backgroundWord')]")).getText();
String authorBiography = driver.findElement(By.xpath(".//div[contains(@class, 'intervenantBiography-text')]")).getText();
System.out.println("The author's biography for author " + authorName + " is: " + authorBiography);
}
}
public void ValidateBookExistsInAuthorsBiography(String bookName) {
int i = 1;
int flag = 0;
int tam = driver.findElements(By.xpath(".//div[contains(@class,'Carousel-item')]")).size();
System.out.println("TAMANHO: " + tam);
ScrollToElement(driver.findElement(By.xpath(".//span[text()='Bibliografia']")), driver.findElement(By.xpath(".//div[contains(@class, 'js-Carousel-container')]")));
while (i < tam + 1) {
String bookTitle = driver.findElement(By.xpath("(.//span[@class='thumbnail-title']/a)[" + i + "]")).getText();
if (bookName.equals(bookTitle)) {
flag = 1;
System.out.println("Book found with title:" + bookTitle + ".");
break;
} else {
if (driver.findElement(By.xpath("(.//span[@class='thumbnail-title']/a)[" + i + "]")).isDisplayed()) {
i++;
} else {
Actions a = new Actions(driver);
a.click(driver.findElement(By.xpath(".//button[contains(@class,'Carousel-arrow--rightFull')]"))).build().perform();
i++;
}
}
}
if (flag == 0) {
throw new Error("The book '" + bookName + "is not present on the author's biography page.");
}
}
public void AddBookToShoppingCart(String bookName) {
int i = 1;
int tam = driver.findElements(By.xpath(".//div[@class= 'clearfix Article-item js-Search-hashLinkId']")).size();
while (i < tam + 1) {
String title = driver.findElement(By.xpath("(.//div[contains(@data-automation-id, 'product-block')])[" + i + "]//a[contains(@class, 'Article-title')]")).getText();
if (bookName.equals(title)) {
System.out.println("Book found with title:" + title);
driver.findElement(By.xpath("(.//button/span[text()='Adicionar ao Cesto'])[" + i + "]")).click();
break;
} else {
if (i == tam) {
ScrollToElement(driver.findElement(By.xpath("(.//div[contains(@data-automation-id, 'product-block')])[" + i + "]//a[contains(@class, 'Article-title')]")), driver.findElement(btnActionNext));
try {
Thread.sleep(5000);
driver.findElement(btnActionNext).click();
} catch (Exception e) {
System.out.println(e);
}
try {
Thread.sleep(5000);
tam = driver.findElements(By.xpath(".//div[@class= 'clearfix Article-item js-Search-hashLinkId']")).size();
i = 1;
} catch (Exception e) {
System.out.println(e);
}
} else {
i++;
}
}
}
}
public void CloseBasketContent() {
try {
Thread.sleep(3000);
driver.findElement(By.xpath(".//button[@title='Close (Esc)']")).click();
} catch (Exception e) {
System.out.println(e);
}
}
public void ValidateNumberItensShoppingCart(String numberItens) {
String numberItemBasket = driver.findElement(By.xpath(".//div[@data-automation-id='header-icon-basket']//span")).getText();
if (numberItens.equals(numberItemBasket)) {
System.out.println("The number of itens in basket is valid:" + numberItemBasket);
} else {
throw new java.lang.Error("Expected '" + numberItens + "' in basket but found '" + numberItemBasket + "'");
}
}
public void ClickToGoShoppingCart() {
CloseNotifyContent();
driver.findElement(By.xpath(".//div[@data-automation-id='header-tab-basket']//a")).click();
try {
Thread.sleep(2000);
CloseNotifyContent();
driver.findElement(By.xpath(".//div[@class='LayerBasket__total-action']//a[text()='Ver o meu cesto']")).click();
Thread.sleep(2000);
} catch (Exception e) {
System.out.println(e);
}
}
public void ValidateTheTotalCosts() {
String ExpectedBookPrice = driver.findElement(By.xpath(".//span[text()='Cesto']/../span[@class='basket-informations__price']/span")).getText();
String bookPrice = ExpectedBookPrice.replace("€", ".");
String ExpectedDeliveryPrice = driver.findElement(By.xpath(".//span[text()='Custos de entrega estimados']/../span[@class='basket-informations__price']/span")).getText();
String deliveryPrice = ExpectedDeliveryPrice.replace("€", ".");
String ExpectedTotalPrice = driver.findElement(By.xpath(".//div[text()='TOTAL']/span[text()='(com IVA)']/../span[@class='basket-informations__price basket-informations__price--total']/span")).getText();
String totalPrice = ExpectedTotalPrice.replace("€", ".");
System.out.println("BOOK: " + ExpectedBookPrice + " " + bookPrice);
System.out.println("DELIVERY: " + ExpectedDeliveryPrice + " " + deliveryPrice);
System.out.println("TOTAL: " + ExpectedTotalPrice + " " + totalPrice);
float book = Float.parseFloat(bookPrice);
float delivery = Float.parseFloat(deliveryPrice);
float total = Float.parseFloat(totalPrice);
float billCountTotal = book + delivery;
System.out.println("Total calculated is: " + billCountTotal);
if (total == billCountTotal) {
System.out.println("The expected amount to pay for the book is:" + total);
} else {
throw new java.lang.Error("Expected amount to pay for the book is'" + billCountTotal + "' and in basket found '" + total + "'");
}
}
public void SearchForStoreAndGoStoresPage(String storeName) {
driver.findElement(By.xpath(".//a[contains(@class,'store')]")).click();
driver.findElement(By.xpath(".//input[@name='city']")).sendKeys(storeName);
driver.findElement(By.xpath("(.//div/button[contains(@class,'store')])[2]")).click();
}
public void SelectTheStoreInZone(String storeZone) throws InterruptedException {
int i = 1;
int tam = driver.findElements(By.xpath(".//li[contains(@class,'store')]")).size();
while (i < tam + 1) {
String zone = driver.findElement(By.xpath("(.//li[contains(@class,'store')])[" + i + "]//a")).getText();
if (storeZone.toUpperCase().equals(zone)) {
System.out.println("Found store " + zone);
if (driver.findElement(By.xpath("(.//li[contains(@class,'store')])[" + i + "]//div[@class='StoreFinder-storeContent']")).isDisplayed()) {
Thread.sleep(1000);
CloseNotifyContent();
driver.findElement(By.xpath("(.//li[contains(@class,'store')])[" + i + "]//div[@class='StoreFinder-storeContent']")).click();
Thread.sleep(500);
CloseNotifyContent();
break;
} else {
if (driver.findElement(By.xpath(".//div[@class='inside_notify_content']")).isDisplayed()) {
driver.findElement(By.xpath(".//div[@class='inside_closeButton fonticon icon-hclose']")).click();
}
try {
WebElement scrollIntoStoresList = driver.findElement(By.xpath(".//div[contains(@class,'shopList')]"));
((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", scrollIntoStoresList);
driver.findElement(By.xpath("(.//li[contains(@class,'store')])[" + i + "]//a")).click();
Thread.sleep(800);
} catch (Exception e) {
System.out.println(e);
}
break;
}
} else {
if (i == tam) {
throw new java.lang.Error("A store in '" + storeZone + "' not found in a list of stores!");
} else {
i++;
}
}
}
}
public void ValidateStoreZipCode(String ExpectedZipCode) {
CloseNotifyContent();
String zipAddress = driver.findElement(By.xpath(".//div[@class='store_address']/div[2]")).getText();
String[] zipAddressArray = zipAddress.split("\\s+");
if (ExpectedZipCode.equals(zipAddressArray[0])) {
System.out.println("Valid zip code (" + zipAddressArray[0] + ") for that store.");
} else {
throw new java.lang.Error("Invalid zip code (" + zipAddressArray[0] + ")' for that store. Expected '" + ExpectedZipCode + "'");
}
}
public void ValidateStoreSchedule(String startHour, String endHour) {
String[] week = {"segunda", "terça", "quarta", "quinta", "sexta", "sábado", "domingo"};
int daysOfWeekTam = driver.findElements(By.xpath(".//span[@class='store_dayofweek']")).size();
int i = 1;
if (daysOfWeekTam == week.length) {
while (i < daysOfWeekTam + 1) {
String weekDay = driver.findElement(By.xpath("(.//div/span[@class='store_dayofweek'])[" + i + "]")).getText();
if (weekDay.equals(week[i - 1])) {
String schedule = (driver.findElement(By.xpath("(.//div/span[@class='store_openingtime'])[" + i + "]")).getText()).replace(" - ", " ");
String[] scheduleArray = schedule.split("\\s+");
if (scheduleArray[0].equals(startHour) && scheduleArray[1].equals(endHour)) {
System.out.println("In " + weekDay + " the store open at " + scheduleArray[0] + "h and close at " + scheduleArray[1] + "h");
} else {
throw new java.lang.Error("The explected schedule for day" + weekDay + " it's open at " + startHour + "h and close at " + endHour + "h");
}
} else {
throw new java.lang.Error("Expected the store is open every day of week. The " + week[i - 1] + "is not found in schedule.");
}
i++;
}
} else {
throw new java.lang.Error("The store is not open every day");
}
}
} | [
"diogo.costa@readinessit.com"
] | diogo.costa@readinessit.com |
0c975a3b06d14f3836b04e43e493e902b8366578 | c3482f8bd5d43cf03a19ef0ece4cf262186d5fb7 | /android/src/main/java/com/jeep/plugin/capacitor/cdssUtils/SQLiteDatabaseHelper.java | 9219c7553212b89392790d441c2749c2993fb70c | [] | no_license | xTancho/capacitor-sqlite | 367edc8d2dd610823e17a2236ffe81139b0fd32f | e081a55130c9e00bd3dae69fa00cebbe433b10a8 | refs/heads/master | 2021-05-27T01:25:09.897809 | 2020-04-06T13:53:03 | 2020-04-06T13:53:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,896 | java | //
// SQLiteDatabaseHelper.java
// Plugin
//
// Created by Quéau Jean Pierre on 01/21/2020.
//
package com.jeep.plugin.capacitor.cdssUtils;
import android.content.Context;
import android.database.Cursor;
import net.sqlcipher.database.SQLiteDatabase;
import net.sqlcipher.database.SQLiteOpenHelper;
import android.util.Log;
import com.getcapacitor.JSArray;
import com.getcapacitor.JSObject;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.io.File;
import static android.database.Cursor.FIELD_TYPE_BLOB;
import static android.database.Cursor.FIELD_TYPE_FLOAT;
import static android.database.Cursor.FIELD_TYPE_INTEGER;
import static android.database.Cursor.FIELD_TYPE_NULL;
import static android.database.Cursor.FIELD_TYPE_STRING;
public class SQLiteDatabaseHelper extends SQLiteOpenHelper {
public Boolean isOpen = false;
private static final String TAG = "SQLiteDatabaseHelper";
private static Context context;
private String dbName;
private Boolean encrypted;
private String mode;
private String secret;
private final String newsecret;
private final int dbVersion;
public SQLiteDatabaseHelper(Context _context, String _dbName,
Boolean _encrypted, String _mode, String _secret,
String _newsecret, int _vNumber) {
super(_context, _dbName, null, _vNumber);
dbName = _dbName;
dbVersion = _vNumber;
encrypted = _encrypted;
secret = _secret;
newsecret = _newsecret;
mode = _mode;
context = _context;
InitializeSQLCipher();
}
private void InitializeSQLCipher() {
SQLiteDatabase.loadLibs(context);
SQLiteDatabase database = null;
File databaseFile;
File tempFile;
if(!encrypted && mode.equals("no-encryption")) {
databaseFile = context.getDatabasePath(dbName);
try {
database = SQLiteDatabase.openOrCreateDatabase(databaseFile, "", null);
isOpen = true;
} catch (Exception e) {
database = null;
}
} else if (encrypted && mode.equals("secret") && secret.length() > 0) {
databaseFile = context.getDatabasePath(dbName);
try {
database = SQLiteDatabase.openOrCreateDatabase(databaseFile, secret, null);
isOpen = true;
} catch (Exception e) {
Log.d(TAG, "InitializeSQLCipher: Wrong Secret " );
database = null;
}
} else if(encrypted && mode.equals("newsecret") && secret.length() > 0
&& newsecret.length() > 0) {
databaseFile = context.getDatabasePath(dbName);
try {
database = SQLiteDatabase.openOrCreateDatabase(databaseFile, secret, null);
// Change database secret to newsecret
database.changePassword(newsecret);
secret = newsecret;
isOpen = true;
} catch (Exception e) {
Log.d(TAG, "InitializeSQLCipher: " + e );
database = null;
}
} else if (encrypted && mode.equals("encryption") && secret.length() > 0) {
try {
encryptDataBase(secret);
} catch (Exception e) {
Log.d(TAG, "InitializeSQLCipher: Error while encrypting the database");
database = null;
} finally {
databaseFile = context.getDatabasePath(dbName);
database = SQLiteDatabase.openOrCreateDatabase(databaseFile, secret, null);
encrypted = true;
isOpen = true;
}
Log.d(TAG, "InitializeSQLCipher isOpen: " + isOpen );
}
if(database != null) database.close();
}
private void encryptDataBase(String passphrase) throws IOException {
File originalFile = context.getDatabasePath(dbName);
File newFile = File.createTempFile("sqlcipherutils", "tmp", context.getCacheDir());
SQLiteDatabase existing_db = SQLiteDatabase.openOrCreateDatabase(originalFile,
null, null);
existing_db.rawExecSQL("ATTACH DATABASE '" + newFile.getPath() + "' AS encrypted KEY '" + passphrase + "';");
existing_db.rawExecSQL("SELECT sqlcipher_export('encrypted');");
existing_db.rawExecSQL("DETACH DATABASE encrypted;");
// close the database
existing_db.close();
// delete the original database
originalFile.delete();
// rename the encrypted database
newFile.renameTo(originalFile);
}
@Override
public void onCreate(SQLiteDatabase db) {
Log.d(TAG, "onCreate: name: database created");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
if (oldVersion != newVersion) {
dropAllTables(db);
onCreate(db);
}
}
// execute sql raw statements
public int execSQL(String[] statements) {
// Open the database for writing
SQLiteDatabase db = getWritableDatabase(secret);
try {
for (String cmd : statements ) {
db.execSQL(cmd+";");
}
} catch (Exception e) {
Log.d(TAG, "Error: execSQL failed: ",e);
return Integer.valueOf(-1);
} finally {
db.close();
return dbChanges();
}
}
// run one statement with or without values
public int runSQL(String statement, ArrayList values) {
// Open the database for writing
SQLiteDatabase db = getWritableDatabase(secret);
try {
if(values != null && !values.isEmpty()) {
// with value
Object[] bindings = new Object[values.size()];
for (int i = 0 ; i < values.size() ; i++) {
bindings[i] = values.get(i);
}
db.execSQL(statement,bindings);
} else {
// without values
db.execSQL(statement);
}
} catch (Exception e) {
Log.d(TAG, "Error: runSQL failed: ",e);
return Integer.valueOf(-1);
} finally {
db.close();
return dbChanges();
}
}
public JSArray querySQL(String statement, ArrayList<String> values) {
JSArray retArray = new JSArray();
// Open the database for reading
SQLiteDatabase db = getReadableDatabase(secret);
Cursor c = null;
try {
if(values != null && !values.isEmpty()) {
// with values
String[] bindings = new String[values.size()];
for (int i = 0; i < values.size(); i++) {
bindings[i] = values.get(i);
}
c = db.rawQuery(statement, bindings);
} else {
// without values
c = db.rawQuery(statement, null);
}
if(c.getCount() > 0) {
try {
if (c.moveToFirst()) {
do {
JSObject row = new JSObject();
for (int i = 0; i< c.getColumnCount(); i++) {
int type = c.getType(i);
switch (type ) {
case FIELD_TYPE_STRING :
row.put(c.getColumnName(i),c.getString(c.getColumnIndex(c.getColumnName(i))));
break;
case FIELD_TYPE_INTEGER :
row.put(c.getColumnName(i),c.getLong(c.getColumnIndex(c.getColumnName(i))));
break;
case FIELD_TYPE_FLOAT :
row.put(c.getColumnName(i),c.getFloat(c.getColumnIndex(c.getColumnName(i))));
break;
case FIELD_TYPE_BLOB :
row.put(c.getColumnName(i),c.getBlob(c.getColumnIndex(c.getColumnName(i))));
break;
case FIELD_TYPE_NULL :
break;
default :
break;
}
}
retArray.put(row);
} while (c.moveToNext());
}
} catch (Exception e) {
Log.d(TAG, "Error: Error while creating the resulting cursor");
if (c != null && !c.isClosed()) {
c.close();
}
db.close();
return new JSArray();
} finally {
if (c != null && !c.isClosed()) {
c.close();
}
}
} else {
if (c != null && !c.isClosed()) {
c.close();
}
}
} catch (Exception e) {
Log.d(TAG, "Error: querySQL failed: ",e);
db.close();
return new JSArray();
} finally {
db.close();
return retArray;
}
}
public boolean closeDB(String databaseName) {
boolean ret = false;
Log.d(TAG, "closeDB: databaseName " + databaseName);
File databaseFile = context.getDatabasePath(databaseName);
try {
SQLiteDatabase database = SQLiteDatabase.openOrCreateDatabase(databaseFile, secret,
null);
database.close();
} catch (Exception e) {
Log.d(TAG, "Error: closeDB failed: ",e);
return false;
} finally {
isOpen = false;
ret = true;
Log.d(TAG, "closeDB: successful isOpen " + String.valueOf(isOpen));
return ret;
}
}
public boolean deleteDB(String databaseName) {
Log.d(TAG, "deleteDB: databaseName " + databaseName);
context.deleteDatabase(databaseName);
context.deleteFile(databaseName);
File databaseFile = context.getDatabasePath(databaseName);
if (databaseFile.exists()) {
return false;
} else {
isOpen = false;
return true;
}
}
private boolean dropAllTables(SQLiteDatabase db) {
boolean ret = false;
List<String> tables = new ArrayList<String>();
Cursor cursor = null;
cursor = db.rawQuery("SELECT * FROM sqlite_master WHERE type='table';", null);
cursor.moveToFirst();
while (!cursor.isAfterLast()) {
String tableName = cursor.getString(1);
if (!tableName.equals("android_metadata") &&
!tableName.equals("sqlite_sequence"))
tables.add(tableName);
cursor.moveToNext();
}
cursor.close();
try {
for(String tableName:tables) {
db.execSQL("DROP TABLE IF EXISTS " + tableName);
}
} catch (Exception e) {
Log.d(TAG, "Error: dropAllTables failed: ",e);
return false;
} finally {
ret = true;
}
return ret;
}
private int dbChanges() {
String SELECT_CHANGE = "SELECT changes()";
SQLiteDatabase db = getReadableDatabase(secret);
Cursor cursor = db.rawQuery(SELECT_CHANGE, null);
int ret = cursor.getCount();
cursor.close();
db.close();
return ret;
}
}
| [
"jepi.queau@free.fr"
] | jepi.queau@free.fr |
6b6198863bbc590d37aaf64eb70263ed8d250f91 | 11c5a49f694091c1158418d4d144395ce03e773f | /src/test/java/com/mycompany/myapp/web/rest/LogoutResourceIT.java | 8dbc9f74ad125382ad60e9dc1d204a74e19cfcc4 | [] | no_license | huangfeng212/jhipsterlab-oauth | 94de340a09d3c8b15dac93cf8b24ebb0eb3907bf | 457078271562cc1d3085b7d4412b6886e8ae01d0 | refs/heads/master | 2022-12-25T19:53:06.466357 | 2019-11-19T05:51:48 | 2019-11-19T06:18:01 | 222,622,764 | 0 | 0 | null | 2022-12-16T04:41:53 | 2019-11-19T06:17:42 | Java | UTF-8 | Java | false | false | 3,926 | java | package com.mycompany.myapp.web.rest;
import com.mycompany.myapp.MyprojApp;
import com.mycompany.myapp.config.TestSecurityConfiguration;
import com.mycompany.myapp.security.AuthoritiesConstants;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.oauth2.client.authentication.OAuth2AuthenticationToken;
import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository;
import org.springframework.security.oauth2.core.oidc.OidcIdToken;
import org.springframework.security.oauth2.core.oidc.user.DefaultOidcUser;
import org.springframework.security.oauth2.core.oidc.user.OidcUser;
import org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
/**
* Integration tests for the {@link LogoutResource} REST controller.
*/
@SpringBootTest(classes = {MyprojApp.class, TestSecurityConfiguration.class})
public class LogoutResourceIT {
@Autowired
private ClientRegistrationRepository registrations;
@Autowired
private WebApplicationContext context;
private final static String ID_TOKEN = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9" +
".eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsIm" +
"p0aSI6ImQzNWRmMTRkLTA5ZjYtNDhmZi04YTkzLTdjNmYwMzM5MzE1OSIsImlhdCI6MTU0M" +
"Tk3MTU4MywiZXhwIjoxNTQxOTc1MTgzfQ.QaQOarmV8xEUYV7yvWzX3cUE_4W1luMcWCwpr" +
"oqqUrg";
private MockMvc restLogoutMockMvc;
@BeforeEach
public void before() throws Exception {
Map<String, Object> claims = new HashMap<>();
claims.put("groups", "ROLE_USER");
claims.put("sub", 123);
OidcIdToken idToken = new OidcIdToken(ID_TOKEN, Instant.now(),
Instant.now().plusSeconds(60), claims);
SecurityContextHolder.getContext().setAuthentication(authenticationToken(idToken));
SecurityContextHolderAwareRequestFilter authInjector = new SecurityContextHolderAwareRequestFilter();
authInjector.afterPropertiesSet();
this.restLogoutMockMvc = MockMvcBuilders.webAppContextSetup(this.context).build();
}
@Test
public void getLogoutInformation() throws Exception {
String logoutUrl = this.registrations.findByRegistrationId("oidc").getProviderDetails()
.getConfigurationMetadata().get("end_session_endpoint").toString();
restLogoutMockMvc.perform(post("/api/logout"))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.logoutUrl").value(logoutUrl))
.andExpect(jsonPath("$.idToken").value(ID_TOKEN));
}
private OAuth2AuthenticationToken authenticationToken(OidcIdToken idToken) {
Collection<GrantedAuthority> authorities = new ArrayList<>();
authorities.add(new SimpleGrantedAuthority(AuthoritiesConstants.USER));
OidcUser user = new DefaultOidcUser(authorities, idToken);
return new OAuth2AuthenticationToken(user, authorities, "oidc");
}
}
| [
"huangfeng212@gmail.com"
] | huangfeng212@gmail.com |
25c31e78cc5050ec8c2946fb23a3d21a01b8fc2d | dafe9afc42372b00aeb1d29ed5d16511815e3add | /app/src/main/java/android/connectify/com/connectify/sidebar.java | 232ebd17f4e8c27e444ae84a7947ffc26f5453b3 | [] | no_license | yakovd33/Connectify-Android-App | febf03a4dfe3943f863e163b536d47ef1dac8187 | 1b522cd63c95d619e1ce55fb3a5bfbabba099241 | refs/heads/master | 2023-07-19T01:41:24.421574 | 2018-08-25T22:29:12 | 2018-08-25T22:29:12 | 405,372,096 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 495 | java | package android.connectify.com.connectify;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public class sidebar extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_sidebar, container, false);
}
} | [
"yakovd33@gmail.com"
] | yakovd33@gmail.com |
dae6fc4b4f283c50204fa0d6412966b8d3624046 | 7f9aec801ce59ca7f57f9b62331be7210b4b82bc | /Tuan_8/Bai_20/MathClient.java | 04ec9892a16f6c8a48f941f5c32e05b4ddb39c2a | [] | no_license | ThuanK42/LapTrinhMangNLU | 99bbcf4b1ce1baddcc3cf9b696d581e8a7637db8 | 3b58d30814b137d4ef217e3114c2cefa1dbe4201 | refs/heads/master | 2020-12-01T07:50:00.455108 | 2020-01-17T03:23:01 | 2020-01-17T03:23:01 | 230,585,496 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 53 | java | package Tuan_8.Bai_20;
public class MathClient {
}
| [
"lytutrong02@gmail.com"
] | lytutrong02@gmail.com |
bed50c6ebcc085450b0293b53268c0e952a74b0b | 8b97b74117b1f68d09d041728c6232763ea94c76 | /src/main/java/com/zipcodewilmington/ericb/metamealserver/service/Yelp/YelpThreader.java | 51510d50d7453bc9fb13c93093935ef233ac1d04 | [] | no_license | EricBarnaba/MetaMeal-Server | b25f6d07e88e83e05214157a9b59514cb6a7b6a8 | 0cce6d0b19ac13aaefe8fddf1ccd8a1c793764b3 | refs/heads/master | 2020-03-12T17:23:29.631068 | 2018-04-29T18:08:20 | 2018-04-29T18:08:20 | 130,734,386 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 737 | java | package com.zipcodewilmington.ericb.metamealserver.service.Yelp;
import com.zipcodewilmington.ericb.metamealserver.domain.YelpRestaurant;
import java.util.List;
import java.util.concurrent.Callable;
public class YelpThreader implements Callable<List<YelpRestaurant>> {
private String city;
private String state;
private String cuisine;
private YelpService service;
public YelpThreader(String city, String state, String cuisine, YelpService service){
this.city = city;
this.state = state;
this.cuisine = cuisine;
this.service = service;
}
@Override
public List<YelpRestaurant> call() throws Exception {
return service.getRestaurants(city,state,cuisine);
}
}
| [
"ericbarnaba@zipcoders-MacBook-Pro-25.local"
] | ericbarnaba@zipcoders-MacBook-Pro-25.local |
c786087f7c846d7afeb042b18dcd8bcec0d93918 | 63ea0aebb962d37cb5029653cf0be250e948fff6 | /src/main/java/com/mrbysco/barsfordays/storage/bar/ServerBarInfo.java | 3a407073dc32d7f33c317eead030985d4be12c54 | [
"MIT"
] | permissive | Mrbysco/BarsForDays | ea0ca259d616510661906d859a7d03cd66af2c4b | 747f03f357e8ab3612f28b762b3f2bd23bbfa949 | refs/heads/main | 2023-09-06T01:17:10.721473 | 2021-11-12T02:47:56 | 2021-11-12T02:47:56 | 383,305,687 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,825 | java | package com.mrbysco.barsfordays.storage.bar;
import com.google.common.base.Objects;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.mrbysco.barsfordays.network.NetworkForDays;
import com.mrbysco.barsfordays.network.message.UpdateCustomBarPacket;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.network.PacketDistributor;
import java.util.Collection;
import java.util.Collections;
import java.util.Set;
public class ServerBarInfo extends BarInfo {
private final Set<ServerPlayerEntity> players = Sets.newHashSet();
private final Set<ServerPlayerEntity> unmodifiablePlayers = Collections.unmodifiableSet(this.players);
private boolean visible = true;
public ServerBarInfo(ITextComponent textComponent, BarInfo.Color color, BarInfo.Overlay overlay) {
super(MathHelper.createInsecureUUID(), textComponent, color, overlay);
}
public void setPercent(float percent) {
if (percent != this.percent) {
super.setPercent(percent);
this.broadcast(UpdateCustomBarPacket.Operation.UPDATE_PCT);
}
}
public void setScale(double newScale) {
if (newScale != this.scale) {
super.setScale(newScale);
this.broadcast(UpdateCustomBarPacket.Operation.UPDATE_POSITION);
}
}
public void setXPos(int xPos) {
if (xPos != this.xPos) {
super.setXPos(xPos);
this.broadcast(UpdateCustomBarPacket.Operation.UPDATE_POSITION);
}
}
public void setYPos(int yPos) {
if (yPos != this.yPos) {
super.setYPos(yPos);
this.broadcast(UpdateCustomBarPacket.Operation.UPDATE_POSITION);
}
}
public void setCenterX(boolean centerX) {
if (centerX != this.centerX) {
super.setCenterX(centerX);
this.broadcast(UpdateCustomBarPacket.Operation.UPDATE_POSITION);
}
}
public void setCenterY(boolean centerY) {
if (centerY != this.centerY) {
super.setCenterY(centerY);
this.broadcast(UpdateCustomBarPacket.Operation.UPDATE_POSITION);
}
}
public void setXInverted(boolean invertX) {
if (invertX != this.invertX) {
super.setXInverted(invertX);
this.broadcast(UpdateCustomBarPacket.Operation.UPDATE_POSITION);
}
}
public void setYInverted(boolean invertY) {
if (invertY != this.invertY) {
super.setYInverted(invertY);
this.broadcast(UpdateCustomBarPacket.Operation.UPDATE_POSITION);
}
}
public void setColor(BarInfo.Color color) {
if (color != this.color) {
super.setColor(color);
this.broadcast(UpdateCustomBarPacket.Operation.UPDATE_STYLE);
}
}
public void setOverlay(BarInfo.Overlay overlay) {
if (overlay != this.overlay) {
super.setOverlay(overlay);
this.broadcast(UpdateCustomBarPacket.Operation.UPDATE_STYLE);
}
}
public void setName(ITextComponent textComponent) {
if (!Objects.equal(textComponent, this.name)) {
super.setName(textComponent);
this.broadcast(UpdateCustomBarPacket.Operation.UPDATE_NAME);
}
}
private void broadcast(UpdateCustomBarPacket.Operation operation) {
if (this.visible) {
UpdateCustomBarPacket supdatebossinfopacket = new UpdateCustomBarPacket(operation, this);
for(ServerPlayerEntity serverplayerentity : this.players) {
NetworkForDays.CHANNEL.send(PacketDistributor.PLAYER.with(() -> serverplayerentity), supdatebossinfopacket);
}
}
}
public void addPlayer(ServerPlayerEntity playerEntity) {
if (this.players.add(playerEntity) && this.visible) {
NetworkForDays.CHANNEL.send(PacketDistributor.PLAYER.with(() -> playerEntity), new UpdateCustomBarPacket(UpdateCustomBarPacket.Operation.ADD, this));
NetworkForDays.CHANNEL.send(PacketDistributor.PLAYER.with(() -> playerEntity), new UpdateCustomBarPacket(UpdateCustomBarPacket.Operation.UPDATE_POSITION, this));
}
}
public void removePlayer(ServerPlayerEntity playerEntity) {
if (this.players.remove(playerEntity) && this.visible) {
NetworkForDays.CHANNEL.send(PacketDistributor.PLAYER.with(() -> playerEntity), new UpdateCustomBarPacket(UpdateCustomBarPacket.Operation.REMOVE, this));
}
}
public void removeAllPlayers() {
if (!this.players.isEmpty()) {
for(ServerPlayerEntity serverplayerentity : Lists.newArrayList(this.players)) {
this.removePlayer(serverplayerentity);
}
}
}
public boolean isVisible() {
return this.visible;
}
public void setVisible(boolean visible) {
if (visible != this.visible) {
this.visible = visible;
for(ServerPlayerEntity serverplayerentity : this.players) {
NetworkForDays.CHANNEL.send(PacketDistributor.PLAYER.with(() -> serverplayerentity), new UpdateCustomBarPacket(visible ? UpdateCustomBarPacket.Operation.ADD : UpdateCustomBarPacket.Operation.REMOVE, this));
}
}
}
public Collection<ServerPlayerEntity> getPlayers() {
return this.unmodifiablePlayers;
}
}
| [
"Mrbysco@users.noreply.github.com"
] | Mrbysco@users.noreply.github.com |
62dd255b5ed28b43880c31fa563058702d14f393 | c42210acb2619ded0ab22c27e806fddc2a1c96a5 | /src/main/java/com/mason/blog/service/SortService.java | 3ee16aa15014dd62e095a996da98ccf927fbdfd3 | [] | no_license | miketwais/myBlog | 6f143ded85d70f7024d41c5838e730e46aba03e8 | 658c2f9dddd4383852863364f7a167d60d7a3729 | refs/heads/master | 2020-03-23T21:38:16.161392 | 2018-07-24T10:29:14 | 2018-07-24T10:29:14 | 142,121,366 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,529 | java | package com.mason.blog.service;
import com.mason.blog.entity.SortInfo;
import java.util.List;
/**
* Created with IntelliJ IDEA.
* Author: Mason
* Date: 2018/6/26
* Time: 15:14
*/
public interface SortService {
/**
* 得到菜单List
*
* @param pageSize
* @param start
* @return
*/
List<SortInfo> sortList(String catName,int pageSize, int start);
List<SortInfo> allLists();
/**
* 获取sorts列表
*
* @param pageSize
* @param start
* @return
*/
List<SortInfo> sortsList(int pageSize, int start);
/**
* 获取sorts列表的总量
*
* @param pageSize
* @param pageSize
* @param start
* @return
*/
Integer sortsSize(String catName,int pageSize, int start);
/**
* 新建菜单信息
*
* @param sortInfo
*/
void insertsort(SortInfo sortInfo);
/**
* 修改菜单信息
*
* @param sortInfo
*/
void updatesort(SortInfo sortInfo);
/**
* 删除菜单信息
*
* @param groupId
*/
void deletesorts(List<String> groupId);
/**
* 通过parentId得到sorts列表
*
* @param parentId
* @return
*/
List<SortInfo> sortsByParentId(int parentId);
/**
* 获取二级菜单
* @return
*/
List<SortInfo> getSubsorts();
/**
* 删除
*/
void deleteSorts(List<String> groupId);
/**
* 根据ID查询名称
*/
String getNameById(Integer id);
}
| [
"miketwais@126.com"
] | miketwais@126.com |
1fe2934d154e9cdc383d44995f1b13f89bef1cd3 | 4c8c41b45aee6253c4b4a20850577bf05d03d66c | /MstJavaPrep/src/main/java/StringCharOccurances1.java | ebbf48f79b8b09729fe7229f4d336bc312ca7012 | [] | no_license | mandeepsidhu13/Mst01112 | 6c5be66cd70b2760fd6a8af7e528c6498a320a24 | 2acbc111b63183ae69c77307c81d03fad32e26e6 | refs/heads/main | 2023-02-22T14:54:20.359315 | 2021-01-25T14:48:41 | 2021-01-25T14:48:41 | 331,011,358 | 0 | 0 | null | 2021-01-25T14:48:42 | 2021-01-19T14:42:58 | Java | UTF-8 | Java | false | false | 374 | java |
public class StringCharOccurances1 {
public static void main(String args[])
{
String s="Toronto";
int tc=s.length();
System.out.println("length is : "+tc);
int tcn=s.replace("o", "").length();
System.out.println("new length is : "+tcn);
int c=tc-tcn;
System.out.println("total count for 0 :"+c);
}
}
| [
"mandeepkaur.mtrx@gmail.com"
] | mandeepkaur.mtrx@gmail.com |
0bec9afaa9689d34dc946f3445651ae4c93d2784 | b76534090915970e7964bd6e244236ef89e09e93 | /app/src/androidTest/java/com/tech/manisaiprasad/myprofile/ExampleInstrumentedTest.java | a3d422b6997e6460abb736d9c926f6d1d10888ec | [] | no_license | manisaiprasad/Profile-Screen-Android | dcdc439d236329cf56f0b5b1ac1ae8924c403d47 | 6badf7015fb4bcd88a9d73e0827a7149c7734399 | refs/heads/master | 2020-03-19T18:55:38.626313 | 2018-06-10T17:51:17 | 2018-06-10T17:51:17 | 136,831,510 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 765 | java | package com.tech.manisaiprasad.myprofile;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.tech.manisaiprasad.myprofile", appContext.getPackageName());
}
}
| [
"manisaiprasadam@gmail.com"
] | manisaiprasadam@gmail.com |
70e2dff2484c5c16da69d48eb6a1b0a1e3024406 | 26636427014228cf9b06d26509d69d283c7afee2 | /Computer Networks Lab/MultiUser TCP/src/client.java | 9ae3eba9cf8673f05c6f6eb6e07c7ad58cd67597 | [] | no_license | VivekAlhat/SPPU-Codes | d04235354ff2091d3470aee4eea04a5f43b3bda8 | 9e79d4748498a58f395fdc839972aece917156da | refs/heads/master | 2020-06-19T12:56:12.875625 | 2019-12-23T17:52:03 | 2019-12-23T17:52:03 | 196,715,715 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 756 | java | import java.io.*;
import java.net.*;
import java.util.*;
public class client {
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
Scanner sc = new Scanner(System.in);
Socket s = new Socket("localhost",1030);
DataInputStream din = new DataInputStream(s.getInputStream());
DataOutputStream dout = new DataOutputStream(s.getOutputStream());
System.out.println("Enter your name: ");
String name = sc.next();
dout.writeUTF(name);
String str1="", str2="";
while(!str1.equals("Bye")) {
str1=sc.next();
dout.writeUTF(str1);
str2=din.readUTF();
System.out.println("Server Says: "+str2);
}
sc.close();
s.close();
}
catch(Exception e) {
e.printStackTrace();
}
}
}
| [
"vivekalhat14@outlook.com"
] | vivekalhat14@outlook.com |
2e854d04162a17b9b551d4d05f96b61d9acd0618 | f3a9108db02fa0b01f58e0c1f799be37a8603089 | /src/test/java/MyTest.java | 1bf5f42b7e632abac8d91c3a876556b52d19eaf2 | [] | no_license | lisz1012/mybatis-sql-mapping | 7ef214fd3d38e2df64606d50b9c61a5f5b20f205 | fd0f43e4b68a84c896f8d2e964d0fb88136b11be | refs/heads/master | 2023-02-12T17:26:47.654518 | 2020-12-31T06:21:50 | 2020-12-31T06:21:50 | 325,229,589 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,644 | java | import com.lisz.bean.User;
import com.lisz.dao.UserDao;
import com.lisz.dao.UserDaoAnnotation;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Before;
import org.junit.Test;
import java.io.IOException;
import java.io.InputStream;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class MyTest {
private static final String RESOURCE = "mybatis-config.xml";
private InputStream inputStream;
private SqlSessionFactory sqlSessionFactory;
@Before
public void setup() {
try {
inputStream = Resources.getResourceAsStream(RESOURCE);
} catch (IOException e) {
e.printStackTrace();
}
sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
}
@Test
public void testSelect() throws Exception{
try (SqlSession session = sqlSessionFactory.openSession()) {
//UserDaoAnnotation dao = session.getMapper(UserDaoAnnotation.class);
UserDao dao = session.getMapper(UserDao.class);
User user = dao.findById(1);
System.out.println(user);
// 动态代理类:org.apache.ibatis.binding.MapperProxy@5178056b
//System.out.println(dao);
}
}
@Test
public void testSelect2() throws Exception{
try (SqlSession session = sqlSessionFactory.openSession()) {
//UserDaoAnnotation dao = session.getMapper(UserDaoAnnotation.class);
UserDao dao = session.getMapper(UserDao.class);
Map<Object, Object> map = dao.findById2(1);
System.out.println(map);
// 动态代理类:org.apache.ibatis.binding.MapperProxy@5178056b
System.out.println(dao);
}
}
@Test
public void testSelectAll() throws Exception{
try (SqlSession session = sqlSessionFactory.openSession()) {
UserDao dao = session.getMapper(UserDao.class);
List<User> users = dao.selectAll();
System.out.println(users);
}
}
@Test
public void testSelectAll2() throws Exception{
try (SqlSession session = sqlSessionFactory.openSession()) {
UserDao dao = session.getMapper(UserDao.class);
Map<String, User> map = dao.selectAll2();
System.out.println(map);
}
}
@Test
public void testSelectUsersByScore() throws Exception{
try (SqlSession session = sqlSessionFactory.openSession()) {
UserDao dao = session.getMapper(UserDao.class);
User user = new User();
user.setScore(110.00);
List<User> users = dao.selectUsersByScore(user);
System.out.println(users);
}
}
@Test
public void testSelectUsersByScoreAndId1() throws Exception{
try (SqlSession session = sqlSessionFactory.openSession()) {
UserDao dao = session.getMapper(UserDao.class);
List<User> users = dao.selectUsersByScoreAndId1(1, 110.00);
System.out.println(users);
}
}
@Test
public void testSelectUsersByScoreAndId2() throws Exception{
try (SqlSession session = sqlSessionFactory.openSession()) {
UserDao dao = session.getMapper(UserDao.class);
List<User> users = dao.selectUsersByScoreAndId2(1, 110.00);
System.out.println(users);
}
}
@Test
public void testSelectUsersByScoreAndId3() throws Exception{
try (SqlSession session = sqlSessionFactory.openSession()) {
UserDao dao = session.getMapper(UserDao.class);
Map<String, Object> map = new HashMap<>();
map.put("id", 1);
map.put("score", 110.00);
List<User> users = dao.selectUsersByScoreAndId3(map);
System.out.println(users);
}
}
@Test
public void testSave() throws Exception{
try (SqlSession session = sqlSessionFactory.openSession()) {// sqlSessionFactory.openSession(true) 自动提交
UserDao dao = session.getMapper(UserDao.class);
User user = new User();
user.setName("yijing");
user.setJob("SDE");
user.setBirthDate(new Date("1991/09/15"));
user.setEmail("yijing@gmail.com");
user.setScore(100.00);
user.setCreatedAt(new Date("2020/12/13"));
user.setModifiedAt(new Date("2020/12/13"));
Integer res = dao.save(user);
session.commit();
System.out.println("Result: " + res);
System.out.println(user);
}
}
@Test
public void testUpdate() throws Exception{
try (SqlSession session = sqlSessionFactory.openSession(true)) {
UserDao dao = session.getMapper(UserDao.class);
User user = new User();
user.setId(1);
user.setScore(120.00);
dao.update(user);
System.out.println(user);
}
}
@Test
public void testDelete() throws Exception{
try (SqlSession session = sqlSessionFactory.openSession(true)) {
UserDao dao = session.getMapper(UserDao.class);
Integer delete = dao.deleteById(9);
System.out.println(delete);
}
}
}
| [
"lisz1012@163.com"
] | lisz1012@163.com |
4ff8dd5bb90c5ae270c3e3bb485e82a8331fc536 | d2b214a3d05c57b4884a63952c048c8557893905 | /app/src/main/java/com/example/lenovo/work11_boss/adapter/Receiving_Address_Adapter.java | 2addb840f272ad5eb655493716716ac5f9fc4726 | [] | no_license | yidongpengbo/work11_Boss_one | fe65e4192b9903785154edd66688992d72f735ef | 7e76b7f1328faa3d962d9c3a95996b77439bb152 | refs/heads/master | 2020-04-15T04:16:04.777005 | 2019-06-19T17:21:17 | 2019-06-19T17:21:20 | 164,376,513 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,171 | java | package com.example.lenovo.work11_boss.adapter;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.example.lenovo.work11_boss.R;
import com.example.lenovo.work11_boss.bean.Find_Address_List_Bean;
import java.util.List;
public class Receiving_Address_Adapter extends RecyclerView.Adapter<Receiving_Address_Adapter.ViewHolder> {
private Context mContext;
private List<Find_Address_List_Bean.ResultBean> mjihe;
public Receiving_Address_Adapter(Context context, List<Find_Address_List_Bean.ResultBean> mjihe) {
mContext = context;
this.mjihe = mjihe;
}
public void setMjihe(List<Find_Address_List_Bean.ResultBean> mjihe) {
this.mjihe = mjihe;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
View view=LayoutInflater.from(mContext).inflate(R.layout.receiving_address_adapter,viewGroup,false);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) {
viewHolder.ReceivingAddressAdapterName.setText(mjihe.get(i).getRealName());
viewHolder.ReceivingAddressAdapterPhone.setText(mjihe.get(i).getPhone());
viewHolder.ReceivingAddressAdapterDetails.setText(mjihe.get(i).getAddress());
}
@Override
public int getItemCount() {
return mjihe.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
TextView ReceivingAddressAdapterName,ReceivingAddressAdapterPhone,ReceivingAddressAdapterDetails;
public ViewHolder(@NonNull View itemView) {
super(itemView);
ReceivingAddressAdapterName=itemView.findViewById(R.id.ReceivingAddressAdapterName);
ReceivingAddressAdapterPhone=itemView.findViewById(R.id.ReceivingAddressAdapterPhone);
ReceivingAddressAdapterDetails=itemView.findViewById(R.id.ReceivingAddressAdapterDetails);
}
}
}
| [
"1461078880@qq.com"
] | 1461078880@qq.com |
95776ad5f2776bca67ce6595b5a8c50a5531936c | f1f5a154a9bbc2f60ffa08a8a9d99c7e30ffc145 | /src/main/java/com/aliyun/openservices/aliyun/log/producer/internals/GroupKey.java | 240d8428038e0b10441e532961f954ef2651c3db | [
"Apache-2.0"
] | permissive | ilivein/aliyun-log-java-producer | 1f0de0048f295af32d32023611863e91eabdb46d | 9ce2044fa5238fd05f1d8035be857df8bf8bc102 | refs/heads/master | 2020-08-30T04:51:00.692590 | 2019-08-19T11:52:39 | 2019-08-19T11:52:39 | 218,268,851 | 1 | 0 | null | 2019-10-29T11:14:12 | 2019-10-29T11:14:11 | null | UTF-8 | Java | false | false | 1,384 | java | package com.aliyun.openservices.aliyun.log.producer.internals;
public final class GroupKey {
private static final String DELIMITER = "|";
private final String key;
private final String project;
private final String logStore;
private final String topic;
private final String source;
private final String shardHash;
public GroupKey(String project, String logStore, String topic, String source, String shardHash) {
this.project = project;
this.logStore = logStore;
this.topic = topic;
this.source = source;
this.shardHash = shardHash;
this.key = project + DELIMITER + logStore + DELIMITER + topic + DELIMITER + source;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
GroupKey groupKey = (GroupKey) o;
return key.equals(groupKey.key);
}
@Override
public int hashCode() {
return key.hashCode();
}
@Override
public String toString() {
return key;
}
public String getKey() {
return key;
}
public String getProject() {
return project;
}
public String getLogStore() {
return logStore;
}
public String getTopic() {
return topic;
}
public String getSource() {
return source;
}
public String getShardHash() {
return shardHash;
}
}
| [
"brucewu.fly.cn@gmail.com"
] | brucewu.fly.cn@gmail.com |
e846d23b549e3bef289de1a0d1eabd15594cd411 | 524968bba3e28288b9fa3d7c9bd2d99c30957858 | /src/main/java/com/king/frame/entity/SuperEntity.java | 18965c7c4b3a23c446d5a09c429d13d5897fb72e | [] | no_license | ls909074489/stockAdmin | af87e1d89e5fe032233dc4fb9767a1c4016d2718 | 54b5f88cd76d29aae304a38f0ab5c1de9958d9eb | refs/heads/master | 2022-12-21T05:59:07.211881 | 2019-10-11T05:36:02 | 2019-10-11T05:36:02 | 191,016,890 | 0 | 0 | null | 2022-12-16T04:50:21 | 2019-06-09T14:33:04 | JavaScript | UTF-8 | Java | false | false | 2,914 | java | package com.king.frame.entity;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.apache.poi.ss.formula.functions.T;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.king.common.annotation.MetaData;
/**
* 实体类基类-超级
*
*
* @author zhangcb
*
*/
@MappedSuperclass
public class SuperEntity extends BaseEntity implements ISuperEntity<T> {
private static final long serialVersionUID = 1L;
@MetaData(value = "审批状态", comments = "1:自由态,2:提交态,3:审批态,4:退回态,5:通过态")
@Column(nullable = false)
protected Integer billstatus = 1;
@MetaData(value = "单据号")
@Column(length = 100)
protected String billcode;
@MetaData(value = "单据类型")
@Column(length = 100)
protected String billtype;
@MetaData(value = "单据日期")
@Temporal(TemporalType.DATE)
protected Date billdate;
@MetaData(value = "提交时间")
@Temporal(TemporalType.DATE)
protected Date submittime;
@MetaData(value = "最后审批人id")
@Column(length = 36)
protected String approver;
@MetaData(value = "最后审批人")
@Column(length = 200)
protected String approvername;
@MetaData(value = "最后审批时间")
protected Date approvetime;
@MetaData(value = "审核意见")
@Column(length = 2000)
protected String approveremark;
public Integer getBillstatus() {
return billstatus;
}
public void setBillstatus(Integer billstatus) {
this.billstatus = billstatus;
}
public String getBillcode() {
return billcode;
}
public void setBillcode(String billcode) {
this.billcode = billcode;
}
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+08:00")
public Date getBilldate() {
return billdate;
}
public void setBilldate(Date billdate) {
this.billdate = billdate;
}
public String getApprover() {
return approver;
}
public void setApprover(String approver) {
this.approver = approver;
}
public String getApprovername() {
return approvername;
}
public void setApprovername(String approvername) {
this.approvername = approvername;
}
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
public Date getApprovetime() {
return approvetime;
}
public void setApprovetime(Date approvetime) {
this.approvetime = approvetime;
}
public String getBilltype() {
return billtype;
}
public void setBilltype(String billtype) {
this.billtype = billtype;
}
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
public Date getSubmittime() {
return submittime;
}
public void setSubmittime(Date submittime) {
this.submittime = submittime;
}
public String getApproveremark() {
return approveremark;
}
public void setApproveremark(String approveremark) {
this.approveremark = approveremark;
}
}
| [
"909074489@qq.com"
] | 909074489@qq.com |
9e913275ea5849d471955cf7a8eac88b5a655443 | 7996feb562a43d92fec085e74b4daeb0570454b2 | /mycove_app/WebApp/WEB-INF/src/com/mycove/dao/SurveyResultsDAO.java | 3b377f023c895c0c235eff900a8ca03d2a4e8d7f | [] | no_license | muraleekrish/myc | 20ccd0570c3c9e70a6de63bba1b42a1e281ab8ca | 09088733121f04124edd4e232cba5078d7979fd7 | refs/heads/master | 2021-01-22T17:57:39.086054 | 2011-11-16T13:26:27 | 2011-11-16T13:26:27 | 2,787,938 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,357 | java | package com.mycove.dao;
import java.util.List;
import javax.persistence.Query;
import org.apache.log4j.Logger;
import com.mycove.vo.SurveyResults;
/**
* A data access object (DAO) providing persistence and search support for
* SurveyResults entities. Transaction control of the save(), update() and
* delete() operations must be handled externally by senders of these methods or
* must be manually added to each of these methods for data to be persisted to
* the JPA datastore.
*
* @see com.mycove.vo.SurveyResults
* @author MyEclipse Persistence Tools
*/
public class SurveyResultsDAO extends BaseDAO<SurveyResults> {
private final static Logger log = Logger.getLogger(SurveyResultsDAO.class);
// property constants
public static final String OPTED_FLAG = "optedFlag";
public static final String CREATED_BY = "createdBy";
public static final String MODIFIED_BY = "modifiedBy";
/**
* Delete a persistent SurveyResults entity. This operation must be
* performed within the a database transaction context for the entity's data
* to be permanently deleted from the persistence store, i.e., database.
* This method uses the
* {@link javax.persistence.EntityManager#remove(Object)
* EntityManager#delete} operation.
*
* @param entity SurveyResults entity to delete
* @throws RuntimeException when the operation fails
*/
public void delete(SurveyResults entity) throws Exception {
log.info("deleting SurveyResults instance");
try {
entity = getEntityManager().getReference(SurveyResults.class, entity.getId());
super.delete(entity);
log.info("delete successful");
} catch (RuntimeException e) {
log.error("delete failed", e);
throw e;
}
}
public SurveyResults findById(Long id) {
log.info("finding SurveyResults instance with id: " + id);
try {
SurveyResults instance = getEntityManager().find(SurveyResults.class, id);
return instance;
} catch (RuntimeException e) {
log.error("find failed", e);
throw e;
}
}
/**
* Find all SurveyResults entities with a specific property value.
*
* @param propertyName the name of the SurveyResults property to query
* @param value the property value to match
* @return List<SurveyResults> found by query
*/
@SuppressWarnings("unchecked")
public List<SurveyResults> findByProperty(String propertyName,
final Object value) {
log.info(
"finding SurveyResults instance with property: " + propertyName
+ ", value: " + value);
try {
final String queryString = "select model from SurveyResults model where model."
+ propertyName + "= :propertyValue";
Query query = getEntityManager().createQuery(queryString);
query.setParameter("propertyValue", value);
return query.getResultList();
} catch (RuntimeException e) {
log.error("find by property name failed", e);
throw e;
}
}
/**
* Find all SurveyResults entities.
*
* @return List<SurveyResults> all SurveyResults entities
*/
@SuppressWarnings("unchecked")
public List<SurveyResults> findAll() {
log.info("finding all SurveyResults instances");
try {
final String queryString = "select model from SurveyResults model";
Query query = getEntityManager().createQuery(queryString);
return query.getResultList();
} catch (RuntimeException e) {
log.error("find all failed", e);
throw e;
}
}
} | [
"muralee@.savant.in"
] | muralee@.savant.in |
f53b5f4cc27c9279b05288e59e90cccd10703c5a | 6070ab0116bcf4eaca62d0a1ff6307c311544a64 | /src/main/java/io/novelis/filtragecv/service/StopWordService.java | 2db722c967ead7e95bb17fc1f5183dd7b499b578 | [] | no_license | ilyasslazaar/CVCount | 8890033e163a567b7e1ad65025ff1f61efd246a4 | b6a64881507ee8114161cdf5e064e624527bffa5 | refs/heads/master | 2022-12-25T23:55:29.512808 | 2019-09-07T22:47:31 | 2019-09-07T22:47:31 | 195,426,613 | 0 | 0 | null | 2022-12-16T05:03:11 | 2019-07-05T14:53:42 | Java | UTF-8 | Java | false | false | 3,383 | java | package io.novelis.filtragecv.service;
import io.novelis.filtragecv.domain.Skill;
import io.novelis.filtragecv.domain.StopWord;
import io.novelis.filtragecv.repository.SkillRepository;
import io.novelis.filtragecv.repository.StopWordRepository;
import io.novelis.filtragecv.service.dto.StopWordDTO;
import io.novelis.filtragecv.service.mapper.StopWordMapper;
import io.novelis.filtragecv.web.rest.errors.BadRequestException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* Service Implementation for managing {@link StopWord}.
*/
@Service
@Transactional
public class StopWordService {
private final Logger log = LoggerFactory.getLogger(StopWordService.class);
private final StopWordRepository stopWordRepository;
private final SkillRepository skillRepository;
private final StopWordMapper stopWordMapper;
public StopWordService(StopWordRepository stopWordRepository, StopWordMapper stopWordMapper, SkillRepository skillRepository) {
this.stopWordRepository = stopWordRepository;
this.stopWordMapper = stopWordMapper;
this.skillRepository = skillRepository;
}
/**
* Save a stopWord and deletes it if it exists in the skill table.
*
* @param stopWordDTO the entity to save.
* @throws BadRequestException if there is a skill with a known category with the same name as the stopWord
* @return the persisted entity.
*/
public StopWordDTO save(StopWordDTO stopWordDTO) {
log.debug("Request to save StopWord : {}", stopWordDTO);
StopWord stopWord = stopWordMapper.toEntity(stopWordDTO);
Optional<Skill> existingSkill = skillRepository.findByName(stopWord.getName());
if(existingSkill.isPresent()) {
if(!existingSkill.get().getCategory().getName().equals("other")) {
throw new BadRequestException("cant add stop word " + stopWord.getName() + " because there is already a skill with a known category with that same name");
}
}
stopWord = stopWordRepository.save(stopWord);
skillRepository.deleteByName(stopWord.getName());
return stopWordMapper.toDto(stopWord);
}
/**
* Get all the stopWords.
*
* @return the list of entities.
*/
@Transactional(readOnly = true)
public List<StopWordDTO> findAll() {
log.debug("Request to get all StopWords");
return stopWordRepository.findAll().stream()
.map(stopWordMapper::toDto)
.collect(Collectors.toCollection(LinkedList::new));
}
/**
* Get one stopWord by id.
*
* @param id the id of the entity.
* @return the entity.
*/
@Transactional(readOnly = true)
public Optional<StopWordDTO> findOne(Long id) {
log.debug("Request to get StopWord : {}", id);
return stopWordRepository.findById(id)
.map(stopWordMapper::toDto);
}
/**
* Delete the stopWord by id.
*
* @param id the id of the entity.
*/
public void delete(Long id) {
log.debug("Request to delete StopWord : {}", id);
stopWordRepository.deleteById(id);
}
}
| [
"ilyasamraoui1@gmail.com"
] | ilyasamraoui1@gmail.com |
66037cdaf26b9978dbf4b70f255aaa6e0cb354b4 | 6db2daefa358fe4e21719d2544d130e7621d6e20 | /estructura_de_datos_2/java/GrafoLetras/src/letras/Persistencia.java | f9ea5c1e82862fb84c0cc872042544d962fdb1a3 | [] | no_license | Guillermocala/notas-de-clase | 61da93eb051f059efa47ab87512438a4d856e53e | a0bce98ff6b0beac166b76a737d842232e99672c | refs/heads/master | 2022-11-30T17:31:21.504377 | 2022-11-20T04:01:53 | 2022-11-20T04:01:53 | 149,884,015 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,006 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package letras;
import Principal.Grafo;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
/**
*
* @author 57300
*/
public class Persistencia {
public void guardar(Grafo<String> x) throws FileNotFoundException, IOException {
try (ObjectOutputStream ob = new ObjectOutputStream(new FileOutputStream("archivo.ch"))) {
ob.writeObject(x);
}
}
public Grafo<String> recuperar(String nom) throws FileNotFoundException, IOException, ClassNotFoundException{
Grafo<String> ar;
try (ObjectInputStream ob = new ObjectInputStream(new FileInputStream(nom))) {
ar = (Grafo<String>) ob.readObject();
}
return ar;
}
}
| [
"guillermo.cala7@gmail.com"
] | guillermo.cala7@gmail.com |
88aa6891e35e708363338479212f09fc300a74bd | a7fdf7f482a9876b85dbc0dc82355eb7bfa60f42 | /VisualParadigm/generatedCode/es/uvlive/model/UVLiveModel.java | 6691f8d362ea1f028cb122373edc8f70f8a0e257 | [] | no_license | alextfos/uvlive-api | e01d60545734e8dfe77ca49eab11d7478ac21c30 | fa2de36bdbf913c74cdfc5435c9811ea6bf4dcff | refs/heads/master | 2021-01-18T21:09:38.166498 | 2017-06-01T20:59:07 | 2017-06-01T20:59:07 | 47,890,543 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,101 | java | package es.uvlive.model;
public class UVLiveModel {
private TutorialCatalog tutorialCatalog;
private SessionManager sessionManager;
public void updateCourse() {
// TODO - implement UVLiveModel.actualizarCurso
throw new UnsupportedOperationException();
}
/**
*
* @param userName
* @param password
* @param loginType
*/
public String login(String userName, String password, String loginType) {
// TODO - implement UVLiveModel.login
throw new UnsupportedOperationException();
}
/**
*
* @param key
*/
public boolean containsUser(String key) {
// TODO - implement UVLiveModel.containsUser
throw new UnsupportedOperationException();
}
/**
*
* @param key
* @param idAlumno
*/
public void blockStudent(String key, int idAlumno) {
// TODO - implement UVLiveModel.banearAlumno
throw new UnsupportedOperationException();
}
/**
*
* @param key
* @param traderName
*/
public void validateTraderName(String key, String traderName) {
// TODO - implement UVLiveModel.validarNombreComerciante
throw new UnsupportedOperationException();
}
} | [
"alextfos@gmail.com"
] | alextfos@gmail.com |
386864cbba7e2fe75b43cc529aeeabd8aaf9b302 | 7dd082c951972480f9c48fac39ef1a03c2c041e1 | /Inheritance/ClassObject.java | 12209324d7733b86a55c103c41663b1eb60dcca2 | [] | no_license | sunfanio1/JavaExecrises | 4957bbcc666687c62c35c1b56178033f9a7ab5aa | ac050019ed879de20673d3ef0baeeffa1f4f8ccc | refs/heads/master | 2023-02-13T18:40:26.009310 | 2020-05-13T02:19:41 | 2020-05-13T02:19:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 845 | java | /*
*
* In Java using special class Object. In default this is superclass for all other classes
*
*/
public class ClassObject extends Object {
public static void main(String[] args) {
Doggo doggo = new Doggo("GafGafich");
// Doggo dog = new Doggo ("GafGafich");
Doggo dog = doggo;
// methods that can be use from any objects
// Doggo shiba = doggo.clone(); //method clone must be overriding
System.out.println("Equals? - " + doggo.equals(dog)); //determine equals of objects
System.out.println("Class of object? - " + dog.getClass()); //return class of object in run-time
System.out.println("String description of object? - " + doggo.toString()); //return String that contains class description
System.out.println("hashCode? - " + doggo.hashCode());
}
}
| [
"igorizhenbin@gmail.com"
] | igorizhenbin@gmail.com |
409024cd56150466f3ead5b9e810a7d790a9476d | d0d94ec2f77e9c43e2738da0300163cdd87d576f | /MapEnlarge/gen/com/ss12/mapenlarge/R.java | 76dcf01d3de261a294499a5139666140194d8707 | [] | no_license | ProjPossibility/MapEnlarge | da9f85a409f78e1d183d0a597f3ba0727ad49d3b | 3879e2544508f9212a66ed2accce9ead2f5750f6 | refs/heads/master | 2021-01-13T02:37:16.528048 | 2012-01-15T23:04:37 | 2012-01-15T23:04:37 | 3,179,753 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,369 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.ss12.mapenlarge;
public final class R {
public static final class attr {
}
public static final class drawable {
public static final int icon=0x7f020000;
}
public static final class id {
public static final int btn_bad=0x7f050005;
public static final int btn_capture_image=0x7f050001;
public static final int btn_good=0x7f050004;
public static final int btn_submit=0x7f050002;
public static final int iv_preview=0x7f050003;
public static final int ll_button_bar=0x7f050000;
}
public static final class layout {
public static final int main=0x7f030000;
public static final int page_image_capture=0x7f030001;
public static final int page_result=0x7f030002;
}
public static final class string {
public static final int app_name=0x7f040001;
public static final int hello=0x7f040000;
public static final int web_service_check_url=0x7f040003;
public static final int web_service_image=0x7f040005;
public static final int web_service_submit_url=0x7f040002;
public static final int web_service_uuid=0x7f040004;
}
}
| [
"TheRageKage@.(none)"
] | TheRageKage@.(none) |
5220b39240ccc05dca611fa53f6e427dfc92b96a | e10a01f3b4bed1a1503bb38cd9a604c18948cd99 | /android/IMDEMO/asmack_src/com/xmpp/push/sns/util/collections/AbstractHashedMap.java | f0394e793f30d0d1333852c18332f7582bcb5803 | [] | no_license | flypigrmvb/huaitaoo2o | 8a0b8ea7efdd70263d333f4246c1d8be4cb8f03f | 36f56eea25318fdc261a4e22e05a52caccfd11d1 | refs/heads/master | 2021-01-23T21:33:32.822720 | 2015-07-13T13:07:30 | 2015-07-13T13:07:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 44,238 | java | // GenericsNote: Converted -- However, null keys will now be represented in the internal structures, a big change.
/*
* Copyright 2003-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.xmpp.push.sns.util.collections;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.*;
/**
* An abstract implementation of a hash-based map which provides numerous points for
* subclasses to override.
* <p/>
* This class implements all the features necessary for a subclass hash-based map.
* Key-value entries are stored in instances of the <code>HashEntry</code> class,
* which can be overridden and replaced. The iterators can similarly be replaced,
* without the need to replace the KeySet, EntrySet and Values view classes.
* <p/>
* Overridable methods are provided to change the default hashing behaviour, and
* to change how entries are added to and removed from the map. Hopefully, all you
* need for unusual subclasses is here.
* <p/>
* NOTE: From Commons Collections 3.1 this class extends AbstractMap.
* This is to provide backwards compatibility for ReferenceMap between v3.0 and v3.1.
* This extends clause will be removed in v4.0.
*
* @author java util HashMap
* @author Matt Hall, John Watkinson, Stephen Colebourne
* @version $Revision: 1.1 $ $Date: 2005/10/11 17:05:32 $
* @since Commons Collections 3.0
*/
public class AbstractHashedMap <K,V> extends AbstractMap<K, V> implements IterableMap<K, V> {
protected static final String NO_NEXT_ENTRY = "No next() entry in the iteration";
protected static final String NO_PREVIOUS_ENTRY = "No previous() entry in the iteration";
protected static final String REMOVE_INVALID = "remove() can only be called once after next()";
protected static final String GETKEY_INVALID = "getKey() can only be called after next() and before remove()";
protected static final String GETVALUE_INVALID = "getValue() can only be called after next() and before remove()";
protected static final String SETVALUE_INVALID = "setValue() can only be called after next() and before remove()";
/**
* The default capacity to use
*/
protected static final int DEFAULT_CAPACITY = 16;
/**
* The default threshold to use
*/
protected static final int DEFAULT_THRESHOLD = 12;
/**
* The default load factor to use
*/
protected static final float DEFAULT_LOAD_FACTOR = 0.75f;
/**
* The maximum capacity allowed
*/
protected static final int MAXIMUM_CAPACITY = 1 << 30;
/**
* An object for masking null
*/
protected static final Object NULL = new Object();
/**
* Load factor, normally 0.75
*/
protected transient float loadFactor;
/**
* The size of the map
*/
protected transient int size;
/**
* Map entries
*/
protected transient HashEntry<K, V>[] data;
/**
* Size at which to rehash
*/
protected transient int threshold;
/**
* Modification count for iterators
*/
protected transient int modCount;
/**
* Entry set
*/
protected transient EntrySet<K, V> entrySet;
/**
* Key set
*/
protected transient KeySet<K, V> keySet;
/**
* Values
*/
protected transient Values<K, V> values;
/**
* Constructor only used in deserialization, do not use otherwise.
*/
protected AbstractHashedMap() {
super();
}
/**
* Constructor which performs no validation on the passed in parameters.
*
* @param initialCapacity the initial capacity, must be a power of two
* @param loadFactor the load factor, must be > 0.0f and generally < 1.0f
* @param threshold the threshold, must be sensible
*/
protected AbstractHashedMap(int initialCapacity, float loadFactor, int threshold) {
super();
this.loadFactor = loadFactor;
this.data = new HashEntry[initialCapacity];
this.threshold = threshold;
init();
}
/**
* Constructs a new, empty map with the specified initial capacity and
* default load factor.
*
* @param initialCapacity the initial capacity
* @throws IllegalArgumentException if the initial capacity is less than one
*/
protected AbstractHashedMap(int initialCapacity) {
this(initialCapacity, DEFAULT_LOAD_FACTOR);
}
/**
* Constructs a new, empty map with the specified initial capacity and
* load factor.
*
* @param initialCapacity the initial capacity
* @param loadFactor the load factor
* @throws IllegalArgumentException if the initial capacity is less than one
* @throws IllegalArgumentException if the load factor is less than or equal to zero
*/
protected AbstractHashedMap(int initialCapacity, float loadFactor) {
super();
if (initialCapacity < 1) {
throw new IllegalArgumentException("Initial capacity must be greater than 0");
}
if (loadFactor <= 0.0f || Float.isNaN(loadFactor)) {
throw new IllegalArgumentException("Load factor must be greater than 0");
}
this.loadFactor = loadFactor;
this.threshold = calculateThreshold(initialCapacity, loadFactor);
initialCapacity = calculateNewCapacity(initialCapacity);
this.data = new HashEntry[initialCapacity];
init();
}
/**
* Constructor copying elements from another map.
*
* @param map the map to copy
* @throws NullPointerException if the map is null
*/
protected AbstractHashedMap(Map<? extends K, ? extends V> map) {
this(Math.max(2 * map.size(), DEFAULT_CAPACITY), DEFAULT_LOAD_FACTOR);
putAll(map);
}
/**
* Initialise subclasses during construction, cloning or deserialization.
*/
protected void init() {
}
//-----------------------------------------------------------------------
/**
* Gets the value mapped to the key specified.
*
* @param key the key
* @return the mapped value, null if no match
*/
@Override
public V get(Object key) {
int hashCode = hash((key == null) ? NULL : key);
HashEntry<K, V> entry = data[hashIndex(hashCode, data.length)]; // no local for hash index
while (entry != null) {
if (entry.hashCode == hashCode && isEqualKey(key, entry.key)) {
return entry.getValue();
}
entry = entry.next;
}
return null;
}
/**
* Gets the size of the map.
*
* @return the size
*/
@Override
public int size() {
return size;
}
/**
* Checks whether the map is currently empty.
*
* @return true if the map is currently size zero
*/
@Override
public boolean isEmpty() {
return (size == 0);
}
//-----------------------------------------------------------------------
/**
* Checks whether the map contains the specified key.
*
* @param key the key to search for
* @return true if the map contains the key
*/
@Override
public boolean containsKey(Object key) {
int hashCode = hash((key == null) ? NULL : key);
HashEntry entry = data[hashIndex(hashCode, data.length)]; // no local for hash index
while (entry != null) {
if (entry.hashCode == hashCode && isEqualKey(key, entry.getKey())) {
return true;
}
entry = entry.next;
}
return false;
}
/**
* Checks whether the map contains the specified value.
*
* @param value the value to search for
* @return true if the map contains the value
*/
@Override
public boolean containsValue(Object value) {
if (value == null) {
for (int i = 0, isize = data.length; i < isize; i++) {
HashEntry entry = data[i];
while (entry != null) {
if (entry.getValue() == null) {
return true;
}
entry = entry.next;
}
}
} else {
for (int i = 0, isize = data.length; i < isize; i++) {
HashEntry entry = data[i];
while (entry != null) {
if (isEqualValue(value, entry.getValue())) {
return true;
}
entry = entry.next;
}
}
}
return false;
}
//-----------------------------------------------------------------------
/**
* Puts a key-value mapping into this map.
*
* @param key the key to add
* @param value the value to add
* @return the value previously mapped to this key, null if none
*/
@Override
public V put(K key, V value) {
int hashCode = hash((key == null) ? NULL : key);
int index = hashIndex(hashCode, data.length);
HashEntry<K, V> entry = data[index];
while (entry != null) {
if (entry.hashCode == hashCode && isEqualKey(key, entry.getKey())) {
V oldValue = entry.getValue();
updateEntry(entry, value);
return oldValue;
}
entry = entry.next;
}
addMapping(index, hashCode, key, value);
return null;
}
/**
* Puts all the values from the specified map into this map.
* <p/>
* This implementation iterates around the specified map and
* uses {@link #put(Object, Object)}.
*
* @param map the map to add
* @throws NullPointerException if the map is null
*/
@Override
public void putAll(Map<? extends K, ? extends V> map) {
int mapSize = map.size();
if (mapSize == 0) {
return;
}
int newSize = (int) ((size + mapSize) / loadFactor + 1);
ensureCapacity(calculateNewCapacity(newSize));
// Have to cast here because of compiler inference problems.
for (Iterator it = map.entrySet().iterator(); it.hasNext();) {
Map.Entry<? extends K, ? extends V> entry = (Map.Entry<? extends K, ? extends V>) it.next();
put(entry.getKey(), entry.getValue());
}
}
/**
* Removes the specified mapping from this map.
*
* @param key the mapping to remove
* @return the value mapped to the removed key, null if key not in map
*/
@Override
public V remove(Object key) {
int hashCode = hash((key == null) ? NULL : key);
int index = hashIndex(hashCode, data.length);
HashEntry<K, V> entry = data[index];
HashEntry<K, V> previous = null;
while (entry != null) {
if (entry.hashCode == hashCode && isEqualKey(key, entry.getKey())) {
V oldValue = entry.getValue();
removeMapping(entry, index, previous);
return oldValue;
}
previous = entry;
entry = entry.next;
}
return null;
}
/**
* Clears the map, resetting the size to zero and nullifying references
* to avoid garbage collection issues.
*/
@Override
public void clear() {
modCount++;
HashEntry[] data = this.data;
for (int i = data.length - 1; i >= 0; i--) {
data[i] = null;
}
size = 0;
}
/**
* Gets the hash code for the key specified.
* This implementation uses the additional hashing routine from JDK1.4.
* Subclasses can override this to return alternate hash codes.
*
* @param key the key to get a hash code for
* @return the hash code
*/
protected int hash(Object key) {
// same as JDK 1.4
int h = key.hashCode();
h += ~(h << 9);
h ^= (h >>> 14);
h += (h << 4);
h ^= (h >>> 10);
return h;
}
/**
* Compares two keys, in internal converted form, to see if they are equal.
* This implementation uses the equals method.
* Subclasses can override this to match differently.
*
* @param key1 the first key to compare passed in from outside
* @param key2 the second key extracted from the entry via <code>entry.key</code>
* @return true if equal
*/
protected boolean isEqualKey(Object key1, Object key2) {
return (key1 == key2 || ((key1 != null) && key1.equals(key2)));
}
/**
* Compares two values, in external form, to see if they are equal.
* This implementation uses the equals method and assumes neither value is null.
* Subclasses can override this to match differently.
*
* @param value1 the first value to compare passed in from outside
* @param value2 the second value extracted from the entry via <code>getValue()</code>
* @return true if equal
*/
protected boolean isEqualValue(Object value1, Object value2) {
return (value1 == value2 || value1.equals(value2));
}
/**
* Gets the index into the data storage for the hashCode specified.
* This implementation uses the least significant bits of the hashCode.
* Subclasses can override this to return alternate bucketing.
*
* @param hashCode the hash code to use
* @param dataSize the size of the data to pick a bucket from
* @return the bucket index
*/
protected int hashIndex(int hashCode, int dataSize) {
return hashCode & (dataSize - 1);
}
//-----------------------------------------------------------------------
/**
* Gets the entry mapped to the key specified.
* <p/>
* This method exists for subclasses that may need to perform a multi-step
* process accessing the entry. The public methods in this class don't use this
* method to gain a small performance boost.
*
* @param key the key
* @return the entry, null if no match
*/
protected HashEntry<K, V> getEntry(Object key) {
int hashCode = hash((key == null) ? NULL : key);
HashEntry<K, V> entry = data[hashIndex(hashCode, data.length)]; // no local for hash index
while (entry != null) {
if (entry.hashCode == hashCode && isEqualKey(key, entry.getKey())) {
return entry;
}
entry = entry.next;
}
return null;
}
//-----------------------------------------------------------------------
/**
* Updates an existing key-value mapping to change the value.
* <p/>
* This implementation calls <code>setValue()</code> on the entry.
* Subclasses could override to handle changes to the map.
*
* @param entry the entry to update
* @param newValue the new value to store
*/
protected void updateEntry(HashEntry<K, V> entry, V newValue) {
entry.setValue(newValue);
}
/**
* Reuses an existing key-value mapping, storing completely new data.
* <p/>
* This implementation sets all the data fields on the entry.
* Subclasses could populate additional entry fields.
*
* @param entry the entry to update, not null
* @param hashIndex the index in the data array
* @param hashCode the hash code of the key to add
* @param key the key to add
* @param value the value to add
*/
protected void reuseEntry(HashEntry<K, V> entry, int hashIndex, int hashCode, K key, V value) {
entry.next = data[hashIndex];
entry.hashCode = hashCode;
entry.key = key;
entry.value = value;
}
//-----------------------------------------------------------------------
/**
* Adds a new key-value mapping into this map.
* <p/>
* This implementation calls <code>createEntry()</code>, <code>addEntry()</code>
* and <code>checkCapacity()</code>.
* It also handles changes to <code>modCount</code> and <code>size</code>.
* Subclasses could override to fully control adds to the map.
*
* @param hashIndex the index into the data array to store at
* @param hashCode the hash code of the key to add
* @param key the key to add
* @param value the value to add
*/
protected void addMapping(int hashIndex, int hashCode, K key, V value) {
modCount++;
HashEntry<K, V> entry = createEntry(data[hashIndex], hashCode, key, value);
addEntry(entry, hashIndex);
size++;
checkCapacity();
}
/**
* Creates an entry to store the key-value data.
* <p/>
* This implementation creates a new HashEntry instance.
* Subclasses can override this to return a different storage class,
* or implement caching.
*
* @param next the next entry in sequence
* @param hashCode the hash code to use
* @param key the key to store
* @param value the value to store
* @return the newly created entry
*/
protected HashEntry<K, V> createEntry(HashEntry<K, V> next, int hashCode, K key, V value) {
return new HashEntry<K, V>(next, hashCode, key, value);
}
/**
* Adds an entry into this map.
* <p/>
* This implementation adds the entry to the data storage table.
* Subclasses could override to handle changes to the map.
*
* @param entry the entry to add
* @param hashIndex the index into the data array to store at
*/
protected void addEntry(HashEntry<K, V> entry, int hashIndex) {
data[hashIndex] = entry;
}
//-----------------------------------------------------------------------
/**
* Removes a mapping from the map.
* <p/>
* This implementation calls <code>removeEntry()</code> and <code>destroyEntry()</code>.
* It also handles changes to <code>modCount</code> and <code>size</code>.
* Subclasses could override to fully control removals from the map.
*
* @param entry the entry to remove
* @param hashIndex the index into the data structure
* @param previous the previous entry in the chain
*/
protected void removeMapping(HashEntry<K, V> entry, int hashIndex, HashEntry<K, V> previous) {
modCount++;
removeEntry(entry, hashIndex, previous);
size--;
destroyEntry(entry);
}
/**
* Removes an entry from the chain stored in a particular index.
* <p/>
* This implementation removes the entry from the data storage table.
* The size is not updated.
* Subclasses could override to handle changes to the map.
*
* @param entry the entry to remove
* @param hashIndex the index into the data structure
* @param previous the previous entry in the chain
*/
protected void removeEntry(HashEntry<K, V> entry, int hashIndex, HashEntry<K, V> previous) {
if (previous == null) {
data[hashIndex] = entry.next;
} else {
previous.next = entry.next;
}
}
/**
* Kills an entry ready for the garbage collector.
* <p/>
* This implementation prepares the HashEntry for garbage collection.
* Subclasses can override this to implement caching (override clear as well).
*
* @param entry the entry to destroy
*/
protected void destroyEntry(HashEntry<K, V> entry) {
entry.next = null;
entry.key = null;
entry.value = null;
}
//-----------------------------------------------------------------------
/**
* Checks the capacity of the map and enlarges it if necessary.
* <p/>
* This implementation uses the threshold to check if the map needs enlarging
*/
protected void checkCapacity() {
if (size >= threshold) {
int newCapacity = data.length * 2;
if (newCapacity <= MAXIMUM_CAPACITY) {
ensureCapacity(newCapacity);
}
}
}
/**
* Changes the size of the data structure to the capacity proposed.
*
* @param newCapacity the new capacity of the array (a power of two, less or equal to max)
*/
protected void ensureCapacity(int newCapacity) {
int oldCapacity = data.length;
if (newCapacity <= oldCapacity) {
return;
}
if (size == 0) {
threshold = calculateThreshold(newCapacity, loadFactor);
data = new HashEntry[newCapacity];
} else {
HashEntry<K, V> oldEntries[] = data;
HashEntry<K, V> newEntries[] = new HashEntry[newCapacity];
modCount++;
for (int i = oldCapacity - 1; i >= 0; i--) {
HashEntry<K, V> entry = oldEntries[i];
if (entry != null) {
oldEntries[i] = null; // gc
do {
HashEntry<K, V> next = entry.next;
int index = hashIndex(entry.hashCode, newCapacity);
entry.next = newEntries[index];
newEntries[index] = entry;
entry = next;
} while (entry != null);
}
}
threshold = calculateThreshold(newCapacity, loadFactor);
data = newEntries;
}
}
/**
* Calculates the new capacity of the map.
* This implementation normalizes the capacity to a power of two.
*
* @param proposedCapacity the proposed capacity
* @return the normalized new capacity
*/
protected int calculateNewCapacity(int proposedCapacity) {
int newCapacity = 1;
if (proposedCapacity > MAXIMUM_CAPACITY) {
newCapacity = MAXIMUM_CAPACITY;
} else {
while (newCapacity < proposedCapacity) {
newCapacity <<= 1; // multiply by two
}
if (newCapacity > MAXIMUM_CAPACITY) {
newCapacity = MAXIMUM_CAPACITY;
}
}
return newCapacity;
}
/**
* Calculates the new threshold of the map, where it will be resized.
* This implementation uses the load factor.
*
* @param newCapacity the new capacity
* @param factor the load factor
* @return the new resize threshold
*/
protected int calculateThreshold(int newCapacity, float factor) {
return (int) (newCapacity * factor);
}
//-----------------------------------------------------------------------
/**
* Gets the <code>next</code> field from a <code>HashEntry</code>.
* Used in subclasses that have no visibility of the field.
*
* @param entry the entry to query, must not be null
* @return the <code>next</code> field of the entry
* @throws NullPointerException if the entry is null
* @since Commons Collections 3.1
*/
protected HashEntry<K, V> entryNext(HashEntry<K, V> entry) {
return entry.next;
}
/**
* Gets the <code>hashCode</code> field from a <code>HashEntry</code>.
* Used in subclasses that have no visibility of the field.
*
* @param entry the entry to query, must not be null
* @return the <code>hashCode</code> field of the entry
* @throws NullPointerException if the entry is null
* @since Commons Collections 3.1
*/
protected int entryHashCode(HashEntry<K, V> entry) {
return entry.hashCode;
}
/**
* Gets the <code>key</code> field from a <code>HashEntry</code>.
* Used in subclasses that have no visibility of the field.
*
* @param entry the entry to query, must not be null
* @return the <code>key</code> field of the entry
* @throws NullPointerException if the entry is null
* @since Commons Collections 3.1
*/
protected K entryKey(HashEntry<K, V> entry) {
return entry.key;
}
/**
* Gets the <code>value</code> field from a <code>HashEntry</code>.
* Used in subclasses that have no visibility of the field.
*
* @param entry the entry to query, must not be null
* @return the <code>value</code> field of the entry
* @throws NullPointerException if the entry is null
* @since Commons Collections 3.1
*/
protected V entryValue(HashEntry<K, V> entry) {
return entry.value;
}
//-----------------------------------------------------------------------
/**
* Gets an iterator over the map.
* Changes made to the iterator affect this map.
* <p/>
* A MapIterator returns the keys in the map. It also provides convenient
* methods to get the key and value, and set the value.
* It avoids the need to create an entrySet/keySet/values object.
* It also avoids creating the Map.Entry object.
*
* @return the map iterator
*/
@Override
public MapIterator<K, V> mapIterator() {
if (size == 0) {
return EmptyMapIterator.INSTANCE;
}
return new HashMapIterator<K, V>(this);
}
/**
* MapIterator implementation.
*/
protected static class HashMapIterator <K,V> extends HashIterator<K, V> implements MapIterator<K, V> {
protected HashMapIterator(AbstractHashedMap<K, V> parent) {
super(parent);
}
@Override
public K next() {
return super.nextEntry().getKey();
}
@Override
public K getKey() {
HashEntry<K, V> current = currentEntry();
if (current == null) {
throw new IllegalStateException(AbstractHashedMap.GETKEY_INVALID);
}
return current.getKey();
}
@Override
public V getValue() {
HashEntry<K, V> current = currentEntry();
if (current == null) {
throw new IllegalStateException(AbstractHashedMap.GETVALUE_INVALID);
}
return current.getValue();
}
@Override
public V setValue(V value) {
HashEntry<K, V> current = currentEntry();
if (current == null) {
throw new IllegalStateException(AbstractHashedMap.SETVALUE_INVALID);
}
return current.setValue(value);
}
}
//-----------------------------------------------------------------------
/**
* Gets the entrySet view of the map.
* Changes made to the view affect this map.
* To simply iterate through the entries, use {@link #mapIterator()}.
*
* @return the entrySet view
*/
@Override
public Set<Map.Entry<K, V>> entrySet() {
if (entrySet == null) {
entrySet = new EntrySet<K, V>(this);
}
return entrySet;
}
/**
* Creates an entry set iterator.
* Subclasses can override this to return iterators with different properties.
*
* @return the entrySet iterator
*/
protected Iterator<Map.Entry<K, V>> createEntrySetIterator() {
if (size() == 0) {
return EmptyIterator.INSTANCE;
}
return new EntrySetIterator<K, V>(this);
}
/**
* EntrySet implementation.
*/
protected static class EntrySet <K,V> extends AbstractSet<Map.Entry<K, V>> {
/**
* The parent map
*/
protected final AbstractHashedMap<K, V> parent;
protected EntrySet(AbstractHashedMap<K, V> parent) {
super();
this.parent = parent;
}
@Override
public int size() {
return parent.size();
}
@Override
public void clear() {
parent.clear();
}
public boolean contains(Map.Entry<K, V> entry) {
Map.Entry<K, V> e = entry;
Entry<K, V> match = parent.getEntry(e.getKey());
return (match != null && match.equals(e));
}
@Override
public boolean remove(Object obj) {
if (obj instanceof Map.Entry == false) {
return false;
}
if (contains(obj) == false) {
return false;
}
Map.Entry<K, V> entry = (Map.Entry<K, V>) obj;
K key = entry.getKey();
parent.remove(key);
return true;
}
@Override
public Iterator<Map.Entry<K, V>> iterator() {
return parent.createEntrySetIterator();
}
}
/**
* EntrySet iterator.
*/
protected static class EntrySetIterator <K,V> extends HashIterator<K, V> implements Iterator<Map.Entry<K, V>> {
protected EntrySetIterator(AbstractHashedMap<K, V> parent) {
super(parent);
}
@Override
public HashEntry<K, V> next() {
return super.nextEntry();
}
}
//-----------------------------------------------------------------------
/**
* Gets the keySet view of the map.
* Changes made to the view affect this map.
* To simply iterate through the keys, use {@link #mapIterator()}.
*
* @return the keySet view
*/
@Override
public Set<K> keySet() {
if (keySet == null) {
keySet = new KeySet<K, V>(this);
}
return keySet;
}
/**
* Creates a key set iterator.
* Subclasses can override this to return iterators with different properties.
*
* @return the keySet iterator
*/
protected Iterator<K> createKeySetIterator() {
if (size() == 0) {
return EmptyIterator.INSTANCE;
}
return new KeySetIterator<K, V>(this);
}
/**
* KeySet implementation.
*/
protected static class KeySet <K,V> extends AbstractSet<K> {
/**
* The parent map
*/
protected final AbstractHashedMap<K, V> parent;
protected KeySet(AbstractHashedMap<K, V> parent) {
super();
this.parent = parent;
}
@Override
public int size() {
return parent.size();
}
@Override
public void clear() {
parent.clear();
}
@Override
public boolean contains(Object key) {
return parent.containsKey(key);
}
@Override
public boolean remove(Object key) {
boolean result = parent.containsKey(key);
parent.remove(key);
return result;
}
@Override
public Iterator<K> iterator() {
return parent.createKeySetIterator();
}
}
/**
* KeySet iterator.
*/
protected static class KeySetIterator <K,V> extends HashIterator<K, V> implements Iterator<K> {
protected KeySetIterator(AbstractHashedMap<K, V> parent) {
super(parent);
}
@Override
public K next() {
return super.nextEntry().getKey();
}
}
//-----------------------------------------------------------------------
/**
* Gets the values view of the map.
* Changes made to the view affect this map.
* To simply iterate through the values, use {@link #mapIterator()}.
*
* @return the values view
*/
@Override
public Collection<V> values() {
if (values == null) {
values = new Values(this);
}
return values;
}
/**
* Creates a values iterator.
* Subclasses can override this to return iterators with different properties.
*
* @return the values iterator
*/
protected Iterator<V> createValuesIterator() {
if (size() == 0) {
return EmptyIterator.INSTANCE;
}
return new ValuesIterator<K, V>(this);
}
/**
* Values implementation.
*/
protected static class Values <K,V> extends AbstractCollection<V> {
/**
* The parent map
*/
protected final AbstractHashedMap<K, V> parent;
protected Values(AbstractHashedMap<K, V> parent) {
super();
this.parent = parent;
}
@Override
public int size() {
return parent.size();
}
@Override
public void clear() {
parent.clear();
}
@Override
public boolean contains(Object value) {
return parent.containsValue(value);
}
@Override
public Iterator<V> iterator() {
return parent.createValuesIterator();
}
}
/**
* Values iterator.
*/
protected static class ValuesIterator <K,V> extends HashIterator<K, V> implements Iterator<V> {
protected ValuesIterator(AbstractHashedMap<K, V> parent) {
super(parent);
}
@Override
public V next() {
return super.nextEntry().getValue();
}
}
//-----------------------------------------------------------------------
/**
* HashEntry used to store the data.
* <p/>
* If you subclass <code>AbstractHashedMap</code> but not <code>HashEntry</code>
* then you will not be able to access the protected fields.
* The <code>entryXxx()</code> methods on <code>AbstractHashedMap</code> exist
* to provide the necessary access.
*/
protected static class HashEntry <K,V> implements Map.Entry<K, V>, KeyValue<K, V> {
/**
* The next entry in the hash chain
*/
protected HashEntry<K, V> next;
/**
* The hash code of the key
*/
protected int hashCode;
/**
* The key
*/
private K key;
/**
* The value
*/
private V value;
protected HashEntry(HashEntry<K, V> next, int hashCode, K key, V value) {
super();
this.next = next;
this.hashCode = hashCode;
this.key = key;
this.value = value;
}
@Override
public K getKey() {
return key;
}
public void setKey(K key) {
this.key = key;
}
@Override
public V getValue() {
return value;
}
@Override
public V setValue(V value) {
V old = this.value;
this.value = value;
return old;
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof Map.Entry == false) {
return false;
}
Map.Entry other = (Map.Entry) obj;
return (getKey() == null ? other.getKey() == null : getKey().equals(other.getKey())) && (getValue() == null ? other.getValue() == null : getValue().equals(other.getValue()));
}
@Override
public int hashCode() {
return (getKey() == null ? 0 : getKey().hashCode()) ^ (getValue() == null ? 0 : getValue().hashCode());
}
@Override
public String toString() {
return new StringBuilder().append(getKey()).append('=').append(getValue()).toString();
}
}
/**
* Base Iterator
*/
protected static abstract class HashIterator <K,V> {
/**
* The parent map
*/
protected final AbstractHashedMap parent;
/**
* The current index into the array of buckets
*/
protected int hashIndex;
/**
* The last returned entry
*/
protected HashEntry<K, V> last;
/**
* The next entry
*/
protected HashEntry<K, V> next;
/**
* The modification count expected
*/
protected int expectedModCount;
protected HashIterator(AbstractHashedMap<K, V> parent) {
super();
this.parent = parent;
HashEntry<K, V>[] data = parent.data;
int i = data.length;
HashEntry<K, V> next = null;
while (i > 0 && next == null) {
next = data[--i];
}
this.next = next;
this.hashIndex = i;
this.expectedModCount = parent.modCount;
}
public boolean hasNext() {
return (next != null);
}
protected HashEntry<K, V> nextEntry() {
if (parent.modCount != expectedModCount) {
throw new ConcurrentModificationException();
}
HashEntry<K, V> newCurrent = next;
if (newCurrent == null) {
throw new NoSuchElementException(AbstractHashedMap.NO_NEXT_ENTRY);
}
HashEntry<K, V>[] data = parent.data;
int i = hashIndex;
HashEntry<K, V> n = newCurrent.next;
while (n == null && i > 0) {
n = data[--i];
}
next = n;
hashIndex = i;
last = newCurrent;
return newCurrent;
}
protected HashEntry<K, V> currentEntry() {
return last;
}
public void remove() {
if (last == null) {
throw new IllegalStateException(AbstractHashedMap.REMOVE_INVALID);
}
if (parent.modCount != expectedModCount) {
throw new ConcurrentModificationException();
}
parent.remove(last.getKey());
last = null;
expectedModCount = parent.modCount;
}
@Override
public String toString() {
if (last != null) {
return "Iterator[" + last.getKey() + "=" + last.getValue() + "]";
} else {
return "Iterator[]";
}
}
}
//-----------------------------------------------------------------------
/**
* Writes the map data to the stream. This method must be overridden if a
* subclass must be setup before <code>put()</code> is used.
* <p/>
* Serialization is not one of the JDK's nicest topics. Normal serialization will
* initialise the superclass before the subclass. Sometimes however, this isn't
* what you want, as in this case the <code>put()</code> method on read can be
* affected by subclass state.
* <p/>
* The solution adopted here is to serialize the state data of this class in
* this protected method. This method must be called by the
* <code>writeObject()</code> of the first serializable subclass.
* <p/>
* Subclasses may override if they have a specific field that must be present
* on read before this implementation will work. Generally, the read determines
* what must be serialized here, if anything.
*
* @param out the output stream
*/
protected void doWriteObject(ObjectOutputStream out) throws IOException {
out.writeFloat(loadFactor);
out.writeInt(data.length);
out.writeInt(size);
for (MapIterator it = mapIterator(); it.hasNext();) {
out.writeObject(it.next());
out.writeObject(it.getValue());
}
}
/**
* Reads the map data from the stream. This method must be overridden if a
* subclass must be setup before <code>put()</code> is used.
* <p/>
* Serialization is not one of the JDK's nicest topics. Normal serialization will
* initialise the superclass before the subclass. Sometimes however, this isn't
* what you want, as in this case the <code>put()</code> method on read can be
* affected by subclass state.
* <p/>
* The solution adopted here is to deserialize the state data of this class in
* this protected method. This method must be called by the
* <code>readObject()</code> of the first serializable subclass.
* <p/>
* Subclasses may override if the subclass has a specific field that must be present
* before <code>put()</code> or <code>calculateThreshold()</code> will work correctly.
*
* @param in the input stream
*/
protected void doReadObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
loadFactor = in.readFloat();
int capacity = in.readInt();
int size = in.readInt();
init();
data = new HashEntry[capacity];
for (int i = 0; i < size; i++) {
K key = (K) in.readObject();
V value = (V) in.readObject();
put(key, value);
}
threshold = calculateThreshold(data.length, loadFactor);
}
//-----------------------------------------------------------------------
/**
* Clones the map without cloning the keys or values.
* <p/>
* To implement <code>clone()</code>, a subclass must implement the
* <code>Cloneable</code> interface and make this method public.
*
* @return a shallow clone
*/
@Override
protected Object clone() {
try {
AbstractHashedMap cloned = (AbstractHashedMap) super.clone();
cloned.data = new HashEntry[data.length];
cloned.entrySet = null;
cloned.keySet = null;
cloned.values = null;
cloned.modCount = 0;
cloned.size = 0;
cloned.init();
cloned.putAll(this);
return cloned;
} catch (CloneNotSupportedException ex) {
return null; // should never happen
}
}
/**
* Compares this map with another.
*
* @param obj the object to compare to
* @return true if equal
*/
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof Map == false) {
return false;
}
Map map = (Map) obj;
if (map.size() != size()) {
return false;
}
MapIterator it = mapIterator();
try {
while (it.hasNext()) {
Object key = it.next();
Object value = it.getValue();
if (value == null) {
if (map.get(key) != null || map.containsKey(key) == false) {
return false;
}
} else {
if (value.equals(map.get(key)) == false) {
return false;
}
}
}
} catch (ClassCastException ignored) {
return false;
} catch (NullPointerException ignored) {
return false;
}
return true;
}
/**
* Gets the standard Map hashCode.
*
* @return the hash code defined in the Map interface
*/
@Override
public int hashCode() {
int total = 0;
Iterator it = createEntrySetIterator();
while (it.hasNext()) {
total += it.next().hashCode();
}
return total;
}
/**
* Gets the map as a String.
*
* @return a string version of the map
*/
@Override
public String toString() {
if (size() == 0) {
return "{}";
}
StringBuilder buf = new StringBuilder(32 * size());
buf.append('{');
MapIterator it = mapIterator();
boolean hasNext = it.hasNext();
while (hasNext) {
Object key = it.next();
Object value = it.getValue();
buf.append(key == this ? "(this Map)" : key).append('=').append(value == this ? "(this Map)" : value);
hasNext = it.hasNext();
if (hasNext) {
buf.append(',').append(' ');
}
}
buf.append('}');
return buf.toString();
}
}
| [
"heaven_2004_1986@163.com"
] | heaven_2004_1986@163.com |
5111081afe6a821542c1ea66daabad55c2eca635 | db4a6f4db0cdbe56e041ed8a1ebeb2b2c2049cf5 | /wawebapp/src/main/java/de/behrfried/wikianalyzer/wawebapp/server/service/DataAccess.java | 3f875ec71480f7ed8099263f5df23915c9ef3bc0 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | marhkb/wikianalyzer | d07fc2dbaf10373d50bbdb2b00187a8dc493e970 | 9eb314a6e8e05bd1f4b6c64a4b6f5bffd72628d5 | refs/heads/master | 2020-06-06T10:47:22.331150 | 2013-06-30T19:53:03 | 2013-06-30T19:53:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 714 | java | /*
* Copyright 2013 Marcus Behrendt & Robert Friedrichs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.behrfried.wikianalyzer.wawebapp.server.service;
public interface DataAccess {
}
| [
"marcus.behrendt.86@gmail.com"
] | marcus.behrendt.86@gmail.com |
bc85a4134caff4852b1e9f9edcadb106450fa00a | 10a07f7cdd7e977905e61a900f7ad5f3d9bca6a1 | /src/main/java/recorder/gui/panel/GradientPanel.java | e9c0c25414ce7a649ad28a1cf47837e96e32db5b | [] | no_license | gonnot/codjo-tools-event-recorder | 3123a9b86333693350ca9db021c2df0ff589d132 | 1c008679f88e21242c57d4c09d30d1cddc20b150 | refs/heads/master | 2021-01-15T20:19:24.322197 | 2012-08-27T14:26:27 | 2012-08-27T14:26:27 | null | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 1,470 | java | /*
* codjo.net
*
* Common Apache License 2.0
*/
package recorder.gui.panel;
import java.awt.Color;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.LayoutManager;
import java.awt.Paint;
import javax.swing.JPanel;
import javax.swing.UIManager;
/**
* Panneau avec un dégradé en fond.
*
* <p>
* Utilise les couleurs 'control' définit dans le UIManager avec le background.
* </p>
*/
public class GradientPanel extends JPanel {
public GradientPanel() {
setBackground(UIManager.getColor("InternalFrame.activeTitleBackground"));
}
public GradientPanel(LayoutManager lm, Color background) {
super(lm);
setBackground(background);
}
public GradientPanel(LayoutManager layout) {
super(layout);
setBackground(UIManager.getColor("InternalFrame.activeTitleBackground"));
}
public void paintComponent(Graphics graphics) {
super.paintComponent(graphics);
if (!isOpaque()) {
return;
}
Color control = UIManager.getColor("control");
int width = getWidth();
int height = getHeight();
Graphics2D g2Graphics2D = (Graphics2D)graphics;
Paint storedPaint = g2Graphics2D.getPaint();
g2Graphics2D.setPaint(new GradientPaint(0, 0, getBackground(), width, 0, control));
g2Graphics2D.fillRect(0, 0, width, height);
g2Graphics2D.setPaint(storedPaint);
}
}
| [
"arnaud.marconnet@codjo.net"
] | arnaud.marconnet@codjo.net |
2c78127a25808a1142d376a57f2ca677e947d640 | 1caadc8e782b9af0bcf14ede67d3dd3222354d2b | /myInstagramServer/src/main/java/trash/GreetingController.java | 775817f24dbb631ba5e03092b6c8cbe1246b4e28 | [] | no_license | okanbasar/JavaRepository | 7445d73fafe0a57cb905c0a9b2ca1ad210381012 | 7056d739004d11a59cdf77987fb9a667837c158c | refs/heads/master | 2021-01-22T07:03:11.828456 | 2015-03-20T12:03:32 | 2015-03-20T12:03:32 | 29,677,103 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 639 | java | package trash;
import java.util.concurrent.atomic.AtomicLong;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class GreetingController {
private static final String template = "Hello, %s!";
private final AtomicLong counter = new AtomicLong();
@RequestMapping("/greeting")
public Greeting greeting(@RequestParam(value="name", defaultValue="World") String name) {
return new Greeting(counter.incrementAndGet(), String.format(template, name));
}
}
| [
"okanbasar.metu@gmail.com"
] | okanbasar.metu@gmail.com |
5b14e8146a62979701fe7326fc27b7adc687c7a1 | 1d34d0322a21a0de65102c7e291a23ae084d9be2 | /powerjob-server/src/main/java/com/github/kfcfans/powerjob/server/persistence/core/model/JobInfoDO.java | b8c7b8d651d28447b335ecc8e68d804efc5a3dc6 | [
"Apache-2.0"
] | permissive | tanjcf/MAS-PowerJobRevise | b0e48f20ab727fa40f1a2726ca7af21fa02c890c | c089af72fad3eddc61561c3b5a11dee5f270998f | refs/heads/master | 2023-01-23T10:06:03.364369 | 2020-12-08T03:16:07 | 2020-12-08T03:16:07 | 312,196,878 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,258 | java | package com.github.kfcfans.powerjob.server.persistence.core.model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.util.Date;
/**
* 任务信息表
*
* @author tjq
* @since 2020/3/29
*/
@Data
@Entity
@NoArgsConstructor
@AllArgsConstructor
@Table(indexes = {@Index(columnList = "appId")})
public class JobInfoDO {
@Id
@GeneratedValue(strategy = GenerationType.AUTO, generator = "native")
@GenericGenerator(name = "native", strategy = "native")
private Long id;
/* ************************** 任务基本信息 ************************** */
// 任务名称
private String jobName;
// 任务描述
private String jobDescription;
// 任务所属的应用ID
private Long appId;
// 任务自带的参数
private String jobParams;
/* ************************** 定时参数 ************************** */
// 时间表达式类型(CRON/API/FIX_RATE/FIX_DELAY)
private Integer timeExpressionType;
// 时间表达式,CRON/NULL/LONG/LONG
private String timeExpression;
/* ************************** 执行方式 ************************** */
// 执行类型,单机/广播/MR
private Integer executeType;
// 执行器类型,Java/Shell
private Integer processorType;
// 执行器信息(可能需要存储整个脚本文件)
@Lob
@Column
private String processorInfo;
/* ************************** 运行时配置 ************************** */
// 最大同时运行任务数,默认 1
private Integer maxInstanceNum;
// 并发度,同时执行某个任务的最大线程数量
private Integer concurrency;
// 任务整体超时时间
private Long instanceTimeLimit;
/* ************************** 重试配置 ************************** */
private Integer instanceRetryNum;
private Integer taskRetryNum;
// 1 正常运行,2 停止(不再调度)
private Integer status;
// 下一次调度时间
private Long nextTriggerTime;
/* ************************** 繁忙机器配置 ************************** */
// 最低CPU核心数量,0代表不限
private double minCpuCores;
// 最低内存空间,单位 GB,0代表不限
private double minMemorySpace;
// 最低磁盘空间,单位 GB,0代表不限
private double minDiskSpace;
/* ************************** 集群配置 ************************** */
// 指定机器运行,空代表不限,非空则只会使用其中的机器运行(多值逗号分割)
private String designatedWorkers;
// 最大机器数量
private Integer maxWorkerCount;
// 报警用户ID列表,多值逗号分隔
private String notifyUserIds;
private Date gmtCreate;
private Date gmtModified;
/* ************************sql血缘关系配置************************ */
// 用于自动生成关联任务流
private String wfName;
// 输入表
private String inputTables;
// 用于关联对用表条件 表字段类型, 一条sql job用于到任务不做考虑使用频率很低
private String refTableUuid;
}
| [
"jctanfking@163.com"
] | jctanfking@163.com |
c817941433adb3909bb70b38a6163c579500a470 | 310bcb75496c5d174aae04eaf7be2c86b624132d | /.svn/pristine/0c/0ca1c38871d5c4761399d2886ea84573ee6641bf.svn-base | 754c31e66320358506f9bbd1205fdc531d6a28c2 | [] | no_license | hxwab/Project | 31ce2b46189c09ea8b9979d079d63e1c8a44ca65 | cca000fd2eac0093c552827b63f2c504ff10c96f | refs/heads/master | 2021-01-10T10:15:32.337711 | 2015-10-28T07:20:21 | 2015-10-28T07:20:21 | 45,095,440 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,773 | package csdc.model;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.hibernate.annotations.GenericGenerator;
@Entity
@Table(name="T_AGENCY")
@JsonIgnoreProperties({"password"})
public class Agency implements Serializable {
private static final long serialVersionUID = -5510630957096098893L;
@Id
@Column(name="C_ID", unique = true, nullable = false, length=40)
@GeneratedValue(generator="idGenerator")
@GenericGenerator(name="idGenerator", strategy="uuid")
private String id; //机构id(PK)
@Column(name="C_NAME", length=200)
private String name; //机构中文名称
@Column(name="C_ENGLISH_NAME", length=200)
private String englishName; //机构英文名称
@Column(name="C_TYPE", nullable = false)
private Integer type; //机构类型[0:非高校; 1:高校]
@Column(name="C_CODE", length=40)
private String code; //机构代码
@Column(name="C_ABBR", length=40)
private String abbr; //名称缩写
@Column(name="C_ADDRESS", length=400)
private String address; //所在地址
@Column(name="C_DIRECTOR_NAME", length=200)
private String directorName; //负责人姓名
@ManyToOne
@JoinColumn(name="C_DIRECTOR_ID")
private Person director; //负责人ID(FK)
@Column(name="C_POSTCODE", length=40)
private String postCode; //邮编
@Column(name="C_MOBILE_PHONE", length=400)
private String mobilePhone; //手机
@Column(name="C_OFFICE_PHONE", length=400)
private String officePhone; //办公电话
@Column(name="C_OFFICE_FAX", length=400)
private String officeFax; //办公传真
@Column(name="C_EMAIL", length=400)
private String email; //电子邮箱
@Column(name="C_HOMEPAGE", length=100)
private String homePage; //机构主页
@Column(name="C_INTRODUCTION")
private String introduction; //机构简介
@Temporal(TemporalType.TIMESTAMP)
@Column(name="C_CREATE_DATE")
private Date createDate; //创建时间
@Temporal(TemporalType.TIMESTAMP)
@Column(name="C_UPDATE_DATE")
private Date updateDate; //数据更新时间
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEnglishName() {
return englishName;
}
public void setEnglishName(String englishName) {
this.englishName = englishName;
}
public String getCode() {
return code;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public void setCode(String code) {
this.code = code;
}
public String getAbbr() {
return abbr;
}
public void setAbbr(String abbr) {
this.abbr = abbr;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getDirectorName() {
return directorName;
}
public void setDirectorName(String directorName) {
this.directorName = directorName;
}
public Person getDirectory() {
return director;
}
public void setDirectory(Person director) {
this.director = director;
}
public String getPostCode() {
return postCode;
}
public void setPostCode(String postCode) {
this.postCode = postCode;
}
public String getMobilePhone() {
return mobilePhone;
}
public void setMobilePhone(String mobilePhone) {
this.mobilePhone = mobilePhone;
}
public String getOfficePhone() {
return officePhone;
}
public void setOfficePhone(String officePhone) {
this.officePhone = officePhone;
}
public String getOfficeFax() {
return officeFax;
}
public void setOfficeFax(String officeFax) {
this.officeFax = officeFax;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getHomePage() {
return homePage;
}
public void setHomePage(String homePage) {
this.homePage = homePage;
}
public String getIntroduction() {
return introduction;
}
public void setIntroduction(String introduction) {
this.introduction = introduction;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public Date getUpdateDate() {
return updateDate;
}
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
}
| [
"hxwab2010@126.com"
] | hxwab2010@126.com | |
69f0c26aa84c3460441e6390378bf9e8e0b18fa4 | bf294b98f2bd44289c798b610b828d435df0f543 | /src/main/java/com/unmsm/sistemaVentas/dao/AutorDaoImpl.java | c1f73ce241fa02ea3758a6b632581d0b7df77f17 | [] | no_license | gian350/LibroAutor | 8ab04b42040fdb271da11f14902c77190629086d | 3802af9d8e1b165c69a32cdac6541bce4998d8c5 | refs/heads/main | 2023-03-04T20:37:43.221316 | 2021-02-13T19:34:41 | 2021-02-13T19:34:41 | 338,653,541 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,273 | java | package com.unmsm.sistemaVentas.dao;
import java.util.Iterator;
import java.util.List;
import javax.transaction.Transactional;
import org.springframework.stereotype.Repository;
import com.unmsm.sistemaVentas.model.Autor;
@Repository
@Transactional
public class AutorDaoImpl extends AbstractSession implements AutorDao{
@Override
public void saveAutor(Autor autor) {
// TODO Auto-generated method stub
getSession().persist(autor);
}
@Override
public void deleteAutor(int idAutor) {
// TODO Auto-generated method stub
Autor autor = findById(idAutor);
if(autor != null) {
getSession().delete(autor);
}
}
@Override
public void updateAutor(Autor autor) {
// TODO Auto-generated method stub
getSession().update(autor);
}
@Override
public List<Autor> findAllAutor() {
// TODO Auto-generated method stub
return getSession().createQuery("from Autor").list();
}
@Override
public Autor findById(int idAutor) {
// TODO Auto-generated method stub
return (Autor) getSession().get(Autor.class,idAutor);
}
@Override
public Autor findByName(String nombre) {
// TODO Auto-generated method stub
return (Autor) getSession().createQuery("from Autor where nombre = :nombre").setParameter("nombre", nombre).uniqueResult();
}
}
| [
"gian_ru350@hotmail.com"
] | gian_ru350@hotmail.com |
eb1a04c0336759c55f2eb5978d3e9e4b2502880d | 81719679e3d5945def9b7f3a6f638ee274f5d770 | /aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/transform/EndpointBatchRequestMarshaller.java | 97297f81c7bf62a7be116f0c7b73cf17a5389707 | [
"Apache-2.0"
] | permissive | ZeevHayat1/aws-sdk-java | 1e3351f2d3f44608fbd3ff987630b320b98dc55c | bd1a89e53384095bea869a4ea064ef0cf6ed7588 | refs/heads/master | 2022-04-10T14:18:43.276970 | 2020-03-07T12:15:44 | 2020-03-07T12:15:44 | 172,681,373 | 1 | 0 | Apache-2.0 | 2019-02-26T09:36:47 | 2019-02-26T09:36:47 | null | UTF-8 | Java | false | false | 2,002 | java | /*
* Copyright 2014-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.pinpoint.model.transform;
import java.util.List;
import javax.annotation.Generated;
import com.amazonaws.SdkClientException;
import com.amazonaws.services.pinpoint.model.*;
import com.amazonaws.protocol.*;
import com.amazonaws.annotation.SdkInternalApi;
/**
* EndpointBatchRequestMarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class EndpointBatchRequestMarshaller {
private static final MarshallingInfo<List> ITEM_BINDING = MarshallingInfo.builder(MarshallingType.LIST).marshallLocation(MarshallLocation.PAYLOAD)
.marshallLocationName("Item").build();
private static final EndpointBatchRequestMarshaller instance = new EndpointBatchRequestMarshaller();
public static EndpointBatchRequestMarshaller getInstance() {
return instance;
}
/**
* Marshall the given parameter object.
*/
public void marshall(EndpointBatchRequest endpointBatchRequest, ProtocolMarshaller protocolMarshaller) {
if (endpointBatchRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(endpointBatchRequest.getItem(), ITEM_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
}
| [
""
] | |
b598a59772d1b22e4ae9fbfe0248c03ad5879366 | 86b683331285bd0b2c04e58acc10fd3cf30ff5c0 | /src/com/nintendods/core/TeachStrangerLabQuestion.java | bb10d5e005785c865558b98008250bc6489e72e9 | [] | no_license | mleong1105/the-sociopath | 5ca4a1527bd9e7777e868de0bc99c9c07216e31a | 3cea26d3cecce96cd6d47c38894d568bd02bc77d | refs/heads/main | 2023-05-24T07:45:23.085376 | 2021-06-07T15:28:23 | 2021-06-07T15:28:23 | 374,700,499 | 0 | 0 | null | 2021-06-07T14:44:04 | 2021-06-07T14:44:03 | null | UTF-8 | Java | false | false | 947 | java | package com.nintendods.core;
import java.util.Random;
/**
* Event 2: Teaching a stranger how to solve lab questions
* A student will teach another student
* Random chance of determining whether or not successfully taught
* If successfully taught: rep relative to that person = 10 + 2 (initial rep)
* If not successfully taught: rep relative is 2 (initial rep)
*/
public class TeachStrangerLabQuestion extends Event {
Student studentBeingTaught;
public TeachStrangerLabQuestion(Student student, Student other) {
super(student);
studentBeingTaught = other;
}
@Override
public void execute() {
Random rand = new Random();
student.addFriend(studentBeingTaught, 2, 0);
// Randomly determine if successfully taught stranger
if (rand.nextInt(2) == 0) {
student.setFriendRep(studentBeingTaught, student.getFriendRep(studentBeingTaught) + 10);
}
}
}
| [
"awebmekhilef@gmail.com"
] | awebmekhilef@gmail.com |
e2e3c7519fef093c6e867a56708c5e68878e94a5 | 18bb083180afcf3cf187efb363dbb5f429254b84 | /src/main/java/cn/jeeweb/core/tags/form/FileInputTag.java | 9378e8e421d14d909acfc70fc958ba87dcd82688 | [
"Apache-2.0"
] | permissive | Wandonson/jeeweb-mybatis-springboot | 7f1533d49f97fc835598e604bdc3414ac979f3ca | de2be9a489aa6803ab508ce9b165272bfc00cda6 | refs/heads/master | 2020-04-28T04:04:25.238187 | 2018-08-28T03:43:14 | 2018-08-28T03:43:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,322 | java | package cn.jeeweb.core.tags.form;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.jsp.JspException;
import org.springframework.web.servlet.tags.form.TagWriter;
import cn.jeeweb.core.tags.html.manager.HtmlComponentManager;
import cn.jeeweb.core.utils.PropertiesUtil;
import cn.jeeweb.core.utils.SpringContextHolder;
import cn.jeeweb.core.utils.StringUtils;
import cn.jeeweb.modules.sys.tags.SysFunctions;
/**
*
* All rights Reserved, Designed By www.jeeweb.cn
*
* @title: FileInputTag.java
* @package cn.jeeweb.core.tags.form
* @description: http://plugins.krajee.com/file-avatar-upload-demo#avatar-upload
* -1 文档
* @author: auth_team
* @date: 2017年5月24日 上午8:58:15
* @version V1.0
* @copyright: 2017 www.jeeweb.cn Inc. All rights reserved.
*
*/
@SuppressWarnings("serial")
public class FileInputTag extends HiddenInputTag {
protected HtmlComponentManager htmlComponentManager = SpringContextHolder.getApplicationContext()
.getBean(HtmlComponentManager.class);
protected String fileInputType = "fileinput"; // 文本上传类型
protected Boolean multiple = Boolean.TRUE;// 是否多文件上传
protected String uploadUrl = "";// 文件上传的URL路径
protected String deleteUrl = "";// 删除URL
protected String initUrl = "";// 初始化的URL
protected String uploadExtraData = "{}";// 参数名称的扩展参数
protected String uploadExtraFieldData = "";// 参数名称的扩展参数名称,多个逗号隔开
protected String extend = "";// 接收的文件后缀
protected String buttonText = "选择文件";// 按钮文本
protected String fileInputSetting = "{}"; // JS格式
protected String fileInputSettingCallback = ""; // 配置方法,为js方法,返回配置
protected String uploadSuccessCallback = ""; // 上传成功回调
protected String refreshCallback = "";// 刷新数据的时候回调
protected Boolean showCaption = Boolean.FALSE; // 是否显示标题
protected Boolean dropZoneEnabled = Boolean.FALSE;
protected Boolean autoUpload = null; // 是否自动上传
protected int maxFileCount = 10;
protected int maxFileSize = 0;
protected String theme = ""; // 样式
protected String saveType = "id"; // 默认id为ID,filepath,为路径
protected String showType = "file";// 是否多文件上传,file,avatar
protected String idField = "id";
protected String filepathField = "filepath";
protected String fileInputWidth = "100%";
protected String fileInputHeight = "100%";
public HtmlComponentManager getHtmlComponentManager() {
return htmlComponentManager;
}
public void setHtmlComponentManager(HtmlComponentManager htmlComponentManager) {
this.htmlComponentManager = htmlComponentManager;
}
public String getFileInputType() {
return fileInputType;
}
public void setFileInputType(String fileInputType) {
this.fileInputType = fileInputType;
}
public Boolean getMultiple() {
return multiple;
}
public void setMultiple(Boolean multiple) {
this.multiple = multiple;
}
public String getFileInputSetting() {
return fileInputSetting;
}
public void setFileInputSetting(String fileInputSetting) {
this.fileInputSetting = fileInputSetting;
}
public String getFileInputSettingCallback() {
return fileInputSettingCallback;
}
public void setFileInputSettingCallback(String fileInputSettingCallback) {
this.fileInputSettingCallback = fileInputSettingCallback;
}
public Boolean getDropZoneEnabled() {
return dropZoneEnabled;
}
public void setDropZoneEnabled(Boolean dropZoneEnabled) {
this.dropZoneEnabled = dropZoneEnabled;
}
public int getMaxFileCount() {
return maxFileCount;
}
public void setMaxFileCount(int maxFileCount) {
this.maxFileCount = maxFileCount;
}
public String getUploadUrl() {
return uploadUrl;
}
public void setUploadUrl(String uploadUrl) {
this.uploadUrl = uploadUrl;
}
public String getInitUrl() {
return initUrl;
}
public void setInitUrl(String initUrl) {
this.initUrl = initUrl;
}
public String getDeleteUrl() {
return deleteUrl;
}
public void setDeleteUrl(String deleteUrl) {
this.deleteUrl = deleteUrl;
}
public String getUploadExtraData() {
return uploadExtraData;
}
public void setUploadExtraData(String uploadExtraData) {
this.uploadExtraData = uploadExtraData;
}
public String getExtend() {
return extend;
}
public void setExtend(String extend) {
this.extend = extend;
}
public Boolean getAutoUpload() {
return autoUpload;
}
public void setAutoUpload(Boolean autoUpload) {
this.autoUpload = autoUpload;
}
public String getButtonText() {
return buttonText;
}
public void setButtonText(String buttonText) {
this.buttonText = buttonText;
}
public String getUploadExtraFieldData() {
return uploadExtraFieldData;
}
public void setUploadExtraFieldData(String uploadExtraFieldData) {
this.uploadExtraFieldData = uploadExtraFieldData;
}
public String getUploadSuccessCallback() {
return uploadSuccessCallback;
}
public void setUploadSuccessCallback(String uploadSuccessCallback) {
this.uploadSuccessCallback = uploadSuccessCallback;
}
public String getRefreshCallback() {
return refreshCallback;
}
public void setRefreshCallback(String refreshCallback) {
this.refreshCallback = refreshCallback;
}
public Boolean getShowCaption() {
return showCaption;
}
public void setShowCaption(Boolean showCaption) {
this.showCaption = showCaption;
}
public String getTheme() {
return theme;
}
public void setTheme(String theme) {
this.theme = theme;
}
public String getSaveType() {
return saveType;
}
public void setSaveType(String saveType) {
this.saveType = saveType;
}
public String getShowType() {
return showType;
}
public void setShowType(String showType) {
this.showType = showType;
}
public String getIdField() {
return idField;
}
public void setIdField(String idField) {
this.idField = idField;
}
public String getFilepathField() {
return filepathField;
}
public void setFilepathField(String filepathField) {
this.filepathField = filepathField;
}
public String getFileInputWidth() {
return fileInputWidth;
}
public void setFileInputWidth(String fileInputWidth) {
this.fileInputWidth = fileInputWidth;
}
public String getFileInputHeight() {
return fileInputHeight;
}
public void setFileInputHeight(String fileInputHeight) {
this.fileInputHeight = fileInputHeight;
}
@Override
protected int writeTagContent(TagWriter tagWriter) throws JspException {
tagWriter.startTag("input");
writeDefaultAttributes(tagWriter);
tagWriter.writeAttribute("type", "hidden");
if (isDisabled()) {
tagWriter.writeAttribute(DISABLED_ATTRIBUTE, "disabled");
}
String value = getDisplayString(getBoundValue(), getPropertyEditor());
tagWriter.writeAttribute("value", processFieldValue(getName(), value, "hidden"));
tagWriter.endTag();
// 输出编辑器代码片段
writeFragment();
return SKIP_BODY;
}
private void writeFragment() throws JspException {
if (showType.equals("avatar")) {
if (StringUtils.isEmpty(extend)) {
extend = "jpg,png,gif";
}
if (autoUpload == null) {
autoUpload = Boolean.TRUE;
}
this.saveType = "filepath";
}
if (autoUpload == null) {
autoUpload = Boolean.FALSE;
}
Map<String, Object> rootMap = new HashMap<String, Object>();
String ctx = pageContext.getServletContext().getContextPath();
String adminPath = pageContext.getServletContext().getContextPath() + SysFunctions.getAdminUrlPrefix();
String staticPath = pageContext.getServletContext().getContextPath() + "/static";
rootMap.put("ctx", ctx);
rootMap.put("adminPath", adminPath);
rootMap.put("staticPath", staticPath);
rootMap.put("uploadUrl", uploadUrl);
rootMap.put("deleteUrl", deleteUrl);
rootMap.put("initUrl", initUrl);
rootMap.put("multiple", multiple);
rootMap.put("buttonText", buttonText);
rootMap.put("uploadExtraData", uploadExtraData);
rootMap.put("uploadExtraFieldData", uploadExtraFieldData);
rootMap.put("path", resolveId());
rootMap.put("refreshCallback", refreshCallback);
rootMap.put("dropZoneEnabled", dropZoneEnabled);
rootMap.put("maxFileCount", maxFileCount);
rootMap.put("theme", theme);
rootMap.put("autoUpload", autoUpload);
rootMap.put("saveType", saveType);
rootMap.put("idField", idField);
rootMap.put("filepathField", filepathField);
rootMap.put("fileInputWidth", fileInputWidth);
rootMap.put("fileInputHeight", fileInputHeight);
String value = getDisplayString(getBoundValue(), getPropertyEditor());
rootMap.put("value", processFieldValue(getName(), value, "hidden"));
PropertiesUtil propertiesUtil = new PropertiesUtil("upload.properties");
if (StringUtils.isEmpty(extend)) {
extend = propertiesUtil.getString("upload.allowed.extension");
}
if (maxFileSize==0) {
int maxFileSize = propertiesUtil.getInt("upload.max.size");
rootMap.put("maxFileSize", String.valueOf(maxFileSize));
}
// 处理extend 加入引号
String[] extendStrs = extend.split(",");
List<String> extendList = new ArrayList<String>();
for (String extendIn : extendStrs) {
extendList.add(extendIn.trim());
}
String extendStr = "'" + StringUtils.join(extendList, "','") + "'";
rootMap.put("extend", extendStr);
rootMap.put("buttonText", buttonText);
rootMap.put("fileInputSetting", fileInputSetting);
rootMap.put("showCaption", showCaption);
rootMap.put("fileInputSettingCallback", fileInputSettingCallback);
rootMap.put("uploadSuccessCallback", uploadSuccessCallback);
rootMap.put("showType", showType);
// rootMap.put("name", name);
String fragment = htmlComponentManager.getFragmentComponent(getComponentKey(), rootMap);
if (!StringUtils.isEmpty(fragment) && !fragment.equals("null")) {
// 获得编辑器
try {
super.pageContext.getOut().write(fragment);
} catch (IOException e) {
e.printStackTrace();
}
}
}
private String getComponentKey() {
/*
* if (showType.equals("avatar")) { return fileInputType + "-avatar"; }
*/
return fileInputType + "-file";
}
public int getMaxFileSize() {
return maxFileSize;
}
public void setMaxFileSize(int maxFileSize) {
this.maxFileSize = maxFileSize;
}
}
| [
"465265897@qq.com"
] | 465265897@qq.com |
f8be5385842ef9e60f7a48911ea1b5b7d3fdd218 | dc5ccf3166380cf5c9d180b83579c51437fb5b13 | /backend/src/main/java/de/viadee/cleancode/spacestation/modules/Module.java | 6e3cf5388d96b0916f35fabd31aac7f199621657 | [] | no_license | lakemaster/clean-code-kompakt-space-station | 69f72b5fa75417fdce1ce0ac14cf1c06a7a330bc | a4928563eedb3a85c7da36771f0487a3f44720de | refs/heads/master | 2023-03-10T09:04:53.375435 | 2021-02-25T13:06:05 | 2021-02-25T13:06:05 | 341,811,666 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 317 | java | package de.viadee.cleancode.spacestation.modules;
public interface Module {
Double getWeight();
int getPowerConsumption();
Double getAirConsumption();
boolean isConnected();
DailyWorkResult doDailyWork();
void tvController(boolean onOrOff);
void adjustRoomTemperature(int temperature);
}
| [
"lakelord@jojobi.de"
] | lakelord@jojobi.de |
972b562b1f27b04f2007754d6a5f994a1d176751 | a4608cc748ec3537dec9277047b8dc2af3173661 | /app/src/main/java/com/coolweather/android/ChooseAreaFragment.java | 8cbc7b6b3e827c1d40a06852103109ef9b4d8509 | [
"Apache-2.0"
] | permissive | laiyuanding/coolweather | 5f254e62a2313c333c73e7bd0c63137c7a9d5e26 | 875279e792519fb6ac664730d02e412c04c1483c | refs/heads/master | 2020-04-03T05:52:26.411571 | 2018-10-30T15:54:47 | 2018-10-30T15:54:47 | 155,058,180 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,051 | java | package com.coolweather.android;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.coolweather.android.db.City;
import com.coolweather.android.db.County;
import com.coolweather.android.db.Province;
import com.coolweather.android.util.HttpUtil;
import com.coolweather.android.util.Utility;
import org.litepal.crud.DataSupport;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Response;
public class ChooseAreaFragment extends Fragment {
private static final String TAG = "ChooseAreaFragment";
public static final int LEVEL_PROVINCE = 0;
public static final int LEVEL_CITY = 1;
public static final int LEVEL_COUNTY = 2;
private ProgressDialog progressDialog;
private TextView titleText;
private Button backButton;
private ListView listView;
private ArrayAdapter<String> adapter;
private List<String> dataList = new ArrayList<>();
/**
* 省列表
*/
private List<Province> provinceList;
/**
* 市列表
*/
private List<City> cityList;
/**
* 县列表
*/
private List<County> countyList;
/**
* 选中的省份
*/
private Province selectedProvince;
/**
* 选中的城市
*/
private City selectedCity;
/**
* 当前选中的级别
*/
private int currentLevel;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.choose_area, container, false);
titleText = (TextView) view.findViewById(R.id.title_text);
backButton = (Button) view.findViewById(R.id.back_button);
listView = (ListView) view.findViewById(R.id.list_view);
adapter = new ArrayAdapter<>(getContext(), android.R.layout.simple_list_item_1, dataList);
listView.setAdapter(adapter);
return view;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (currentLevel == LEVEL_PROVINCE) {
selectedProvince = provinceList.get(position);
queryCities();
} else if (currentLevel == LEVEL_CITY) {
selectedCity = cityList.get(position);
queryCounties();
} else if (currentLevel == LEVEL_COUNTY) {
String weatherId = countyList.get(position).getWeatherId();
//getActivity() instanceof MainActivity为
/**
* getActivity()是指当前的的activity实例,因为当前ChooseAreaFragment
* 是给MainActivity和WeatherActivity都有作为引用
* 当getActivity() instanceof MainActivity为true时,是指挂载在MainActivity
* getActivity() instanceof WeatherActivity为true时,是指挂载在WeatherActivity
*/
if (getActivity() instanceof MainActivity) {
Intent intent = new Intent(getActivity(), WeatherActivity.class);
intent.putExtra("weather_id", weatherId);
startActivity(intent);
getActivity().finish();
} else if (getActivity() instanceof WeatherActivity) {
WeatherActivity activity = (WeatherActivity) getActivity();
activity.drawerLayout.closeDrawers();
activity.swipeRefresh.setRefreshing(true);
activity.requestWeather(weatherId);
}
}
}
});
backButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (currentLevel == LEVEL_COUNTY) {
queryCities();
} else if (currentLevel == LEVEL_CITY) {
queryProvinces();
}
}
});
queryProvinces();
}
/**
* 查询全国所有的省,优先从数据库查询,如果没有查询到再去服务器上查询。
*/
private void queryProvinces() {
titleText.setText("中国");
backButton.setVisibility(View.GONE);
provinceList = DataSupport.findAll(Province.class);
if (provinceList.size() > 0) {
dataList.clear();
for (Province province : provinceList) {
dataList.add(province.getProvinceName());
}
adapter.notifyDataSetChanged();
listView.setSelection(0);
currentLevel = LEVEL_PROVINCE;
} else {
String address = "http://guolin.tech/api/china";
queryFromServer(address, "province");
}
}
/**
* 查询选中省内所有的市,优先从数据库查询,如果没有查询到再去服务器上查询。
*/
private void queryCities() {
titleText.setText(selectedProvince.getProvinceName());
backButton.setVisibility(View.VISIBLE);
cityList = DataSupport.where("provinceid = ?", String.valueOf(selectedProvince.getId())).find(City.class);
if (cityList.size() > 0) {
dataList.clear();
for (City city : cityList) {
dataList.add(city.getCityName());
}
adapter.notifyDataSetChanged();
listView.setSelection(0);
currentLevel = LEVEL_CITY;
} else {
int provinceCode = selectedProvince.getProvinceCode();
String address = "http://guolin.tech/api/china/" + provinceCode;
queryFromServer(address, "city");
}
}
/**
* 查询选中市内所有的县,优先从数据库查询,如果没有查询到再去服务器上查询。
*/
private void queryCounties() {
titleText.setText(selectedCity.getCityName());
backButton.setVisibility(View.VISIBLE);
countyList = DataSupport.where("cityid = ?", String.valueOf(selectedCity.getId())).find(County.class);
if (countyList.size() > 0) {
dataList.clear();
for (County county : countyList) {
dataList.add(county.getCountyName());
}
adapter.notifyDataSetChanged();
listView.setSelection(0);
currentLevel = LEVEL_COUNTY;
} else {
int provinceCode = selectedProvince.getProvinceCode();
int cityCode = selectedCity.getCityCode();
String address = "http://guolin.tech/api/china/" + provinceCode + "/" + cityCode;
queryFromServer(address, "county");
}
}
/**
* 根据传入的地址和类型从服务器上查询省市县数据。
*/
private void queryFromServer(String address, final String type) {
showProgressDialog();
HttpUtil.sendOkHttpRequest(address, new Callback() {
@Override
public void onResponse(Call call, Response response) throws IOException {
String responseText = response.body().string();
boolean result = false;
if ("province".equals(type)) {
result = Utility.handleProvinceResponse(responseText);
} else if ("city".equals(type)) {
result = Utility.handleCityResponse(responseText, selectedProvince.getId());
} else if ("county".equals(type)) {
result = Utility.handleCountyResponse(responseText, selectedCity.getId());
}
if (result) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
closeProgressDialog();
if ("province".equals(type)) {
queryProvinces();
} else if ("city".equals(type)) {
queryCities();
} else if ("county".equals(type)) {
queryCounties();
}
}
});
}
}
@Override
public void onFailure(Call call, IOException e) {
// 通过runOnUiThread()方法回到主线程处理逻辑
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
closeProgressDialog();
Toast.makeText(getContext(), "加载失败", Toast.LENGTH_SHORT).show();
}
});
}
});
}
/**
* 显示进度对话框
*/
private void showProgressDialog() {
if (progressDialog == null) {
progressDialog = new ProgressDialog(getActivity());
progressDialog.setMessage("正在加载...");
progressDialog.setCanceledOnTouchOutside(false);
}
progressDialog.show();
}
/**
* 关闭进度对话框
*/
private void closeProgressDialog() {
if (progressDialog != null) {
progressDialog.dismiss();
}
}
}
| [
"659939580@qq.com"
] | 659939580@qq.com |
0f5357e9d02634333cd0d2645061814a30c5b606 | 421b736ead0c7c71906b560e2f76cad1cca0e232 | /4 semestre/paradgma/trab 2/src/Estagiario.java | 4d63d5c519d528a03e0883fd3dbcef9dd5b39cc2 | [] | no_license | luandamato/Facu | 76ecc7cbd7d2a811cf3e404768d91e26ca69170d | 25a3238e5a37906de0ae8f125fcb6b20b4c19bc5 | refs/heads/main | 2023-03-30T06:05:11.337243 | 2021-04-12T02:42:18 | 2021-04-12T02:42:18 | 291,163,873 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,016 | java | import java.util.Objects;
public class Estagiario extends Empregado{
private double valecoxinha;
public Estagiario (int ID, String nome, int departamento, double salario, double valecoxinha){
super(ID, nome, departamento, salario);
this.valecoxinha = valecoxinha;
}
public void setValecoxinha( double valecoxinha ){
this. valecoxinha = valecoxinha;
}
public double pagamento(){
// Calcula o salário líquido
return(this.getSalario()+this.valecoxinha);
}
public String toString(){
return "Estagiario: " +super.toString() + ", vale coxinha=" + this.valecoxinha;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Estagiario that = (Estagiario) o;
return Double.compare(that.valecoxinha, valecoxinha) == 0;
}
@Override
public int hashCode() {
return Objects.hash(valecoxinha);
}
}
| [
"luandamato@gmail.com"
] | luandamato@gmail.com |
f2410f3f4156b4058313ddff3ebb5f74e6970216 | 2afb643065e4c93cf84a5c5744b063dd2fb28759 | /MyWeather/app/src/main/java/com/android/MyWeather/bean/Casts.java | 0ef7840b773f90e8ce039d129f61e6e6a2f8c9c9 | [] | no_license | WCY369/AndroidProject | 948b7c45f37d6abb090f28e1757c0f145b4ea8fb | 719ec4564572c787d19a4585cfe22b439d477355 | refs/heads/main | 2023-01-21T16:29:25.807796 | 2020-12-03T07:03:53 | 2020-12-03T07:03:53 | 304,481,356 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,614 | java | package com.android.MyWeather.bean;
/**
* 预报数据list结构,元素cast,按顺序为当天、第二天、第三天、第四天的预报数据
*/
public class Casts {
private String date;
private String week;
private String dayweather;
private String nightweather;
private String daytemp;
private String nighttemp;
private String daywind;
private String nightwind;
private String daypower;
private String nightpower;
public String getDate() {
return date;
}
@Override
public String toString() {
return "Casts{" +
"date='" + date + '\'' +
", week='" + week + '\'' +
", dayweather='" + dayweather + '\'' +
", nightweather='" + nightweather + '\'' +
", daytemp='" + daytemp + '\'' +
", nighttemp='" + nighttemp + '\'' +
", daywind='" + daywind + '\'' +
", nightwind='" + nightwind + '\'' +
", daypower='" + daypower + '\'' +
", nightpower='" + nightpower + '\'' +
'}';
}
public void setDate(String date) {
this.date = date;
}
public String getWeek() {
return week;
}
public void setWeek(String week) {
this.week = week;
}
public String getDayweather() {
return dayweather;
}
public void setDayweather(String dayweather) {
this.dayweather = dayweather;
}
public String getNightweather() {
return nightweather;
}
public void setNightweather(String nightweather) {
this.nightweather = nightweather;
}
public String getDaytemp() {
return daytemp;
}
public void setDaytemp(String daytemp) {
this.daytemp = daytemp;
}
public String getNighttemp() {
return nighttemp;
}
public void setNighttemp(String nighttemp) {
this.nighttemp = nighttemp;
}
public String getDaywind() {
return daywind;
}
public void setDaywind(String daywind) {
this.daywind = daywind;
}
public String getNightwind() {
return nightwind;
}
public void setNightwind(String nightwind) {
this.nightwind = nightwind;
}
public String getDaypower() {
return daypower;
}
public void setDaypower(String daypower) {
this.daypower = daypower;
}
public String getNightpower() {
return nightpower;
}
public void setNightpower(String nightpower) {
this.nightpower = nightpower;
}
}
| [
"44944127+WCY369@users.noreply.github.com"
] | 44944127+WCY369@users.noreply.github.com |
9e47811f563bfef2b91b1b97a61ccb47b6d5e57f | 57a72bdb0e5df42064083eb3986863bd0c2925bc | /src/com/museum/javabeans/Track.java | 86621bef87411aa7564c5c076f4a4778cd496f54 | [] | no_license | scox/Server | ec1bfe9cac0743d0cf8aed5134a29ce1e25e9dbd | 6ebf17961a0712cb1cf168a4d64d347bc026233d | refs/heads/master | 2016-09-15T22:19:39.453598 | 2012-04-29T15:49:24 | 2012-04-29T15:49:24 | 3,662,159 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 698 | java | /**
*
* @author Sam
* Date: 14/02/2012
* Track.java: Reusable track bean containing information needed by the client
* regarding an individual track
*
*/
package com.museum.javabeans;
public class Track {
private String trackInfo;
private String audioLocation;
public String getAudioLocation() {
return audioLocation;
}
public void setAudioLocation(String audioLocation) {
this.audioLocation = "/media/audios/" + audioLocation;
}
public String getTrackInfo() {
return trackInfo;
}
public void setTrackInfo(String trackInfo) {
this.trackInfo = trackInfo;
}
} | [
"samcox88@hotmail.co.uk"
] | samcox88@hotmail.co.uk |
193dbeb850485f0e5a4ad9dfb3bd0260bfc2ceb6 | f59a47472d9c2813ad40c50bdbc2aa2f4392192b | /QulixTeachingSite/src/test/java/ft/TestBase.java | 82d4e0840f41a8d7c0cfea24b20c53be3b020ed4 | [] | no_license | alexeyrakitsky/QulixTeachingSite | 9411d54ab79d483f4acc035774afce9310acaa77 | c0c0efba3aa3843459800d6cfc69c8ca34a8a978 | refs/heads/master | 2020-07-01T04:01:46.176120 | 2019-08-06T14:05:25 | 2019-08-06T14:05:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,461 | java | package ft;
import org.apache.log4j.Logger;
import org.openqa.selenium.WebDriver;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import pages.MainPage;
import pages.MessageData;
import pages.MessagesPage;
import pages.WebDriverSingleton;
import java.lang.reflect.Method;
import java.util.concurrent.TimeUnit;
public class TestBase {
private static final Logger logger = Logger.getLogger(TestBase.class);
MainPage mainPage;
MessagesPage messagesPage;
MessageData messageData;
private WebDriverSingleton webDriverSingleton;
@BeforeClass
public void init() {
WebDriver driver = webDriverSingleton.getInstance();
mainPage = new MainPage(driver);
messagesPage = new MessagesPage(driver);
driver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS);
mainPage.goToMainPage();
mainPage.goToLoginPage();
mainPage.login("admin", "password");
}
@AfterClass
public void tearDown() {
WebDriverSingleton.quit();
}
@BeforeMethod(alwaysRun = true)
public void logTestStart(Method m) {
logger.info("Start test " + m.getName());
}
@AfterMethod(alwaysRun = true)
public void logTestStop(Method m) {
logger.info("Stop test " + m.getName());
}
}
| [
"n.ragimzade1@gmail.com"
] | n.ragimzade1@gmail.com |
727b21f2d5458d8053343ba006e1e10cac424b0f | d685de5d4705afbcb97e92fbc5e0be34fe75618a | /src/test/java/features/step_definitions/WrongCCOrdersStepDefinition.java | 201da644aa8b558b430e89281ec3e7338cee22ab | [] | no_license | gi-rafffa/ZipJetCucumberAndroid | 11899b044ef5a28e15e6b9bcf16dff4d460a0dfa | 274007044d0d0698199482278b1904bb2b7cb4c8 | refs/heads/master | 2021-03-27T16:05:58.551666 | 2017-06-09T08:32:42 | 2017-06-09T08:32:42 | 87,295,086 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,433 | java | package test.java.features.step_definitions;
import cucumber.api.java.en.And;
import cucumber.api.java.en.Then;
import test.java.framework.Application;
import test.java.framework.Constants;
import test.java.views.OrderSummaryView;
public class WrongCCOrdersStepDefinition {
@SuppressWarnings("rawtypes")
public Application application;
/*
@And("^Fill incorrect Credit Card for (.*) and save$")
public void andFillCorrectCCForCity(String city) throws Throwable {
MakePositiveOrderStepDefinition positiveorder = new MakePositiveOrderStepDefinition();
if (city.equals("Berlin")) positiveorder.andFillCCAndSave(Constants.CC_VISA_NUMBER, Constants.CC_VISA_DATE_WRONG, Constants.CC_VISA_CVC);
if (city.equals("London")) positiveorder.andFillCCAndSave(Constants.CC_MASTERCARD_NUMBER_WRONG, Constants.CC_MASTERCARD_DATE, Constants.CC_MASTERCARD_CVC);
if (city.equals("Paris")) positiveorder.andFillCCAndSave(Constants.CC_AMERICANEXPRESS_NUMBER, Constants.CC_AMERICANEXPRESS_DATE, Constants.CC_AMERICANEXPRESS_CVC_WRONG);
}
@Then(value = "^I stay on Order Summary screen$")
public void thenIRedirectedToThePaymentScreen() throws Throwable {
application = Application.getInstance();
application.orderSummaryView = new OrderSummaryView(application.driver);
application.orderSummaryView.isSummaryViewDispalyed();
application.driver.quit();
application.setInstanceNull();
}
*/
}
| [
"gi-rafffa@yandex.ru"
] | gi-rafffa@yandex.ru |
2d12b1c8d4f6115b078117feb2e6e745b861bcf3 | 16a0c66006c004d7f59dc1d3e56c944eb06122c7 | /test/level09/lesson11/home02/Solution.java | 83e4afc1e40182789bb4dfce8eaba22354571627 | [] | no_license | lemniscat/JavaRush | b21c625338433205c11e827e40854b208553eadb | 8abfbd034e1e1d164458362ec2ae7fc05000ee6a | refs/heads/master | 2021-01-21T13:21:30.050748 | 2015-09-30T11:54:27 | 2015-09-30T11:54:27 | 28,217,255 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 606 | java | package com.javarush.test.level09.lesson11.home02;
/* Обратный отсчёт от 10 до 0
Написать в цикле обратный отсчёт от 10 до 0. Для задержки иcпользовать Thread.sleep(100);
Обернуть вызов sleep в try..catch.
*/
public class Solution
{
public static void main(String[] args)
{
for (int i = 10; i >= 0; i--)
{
System.out.println(i);
try
{
Thread.sleep(100);
}
catch (Exception e) {e.printStackTrace();}
}
}
}
| [
"asgard.88tm@gmail.com"
] | asgard.88tm@gmail.com |
1546528d172cfa4dfddacd002cf7e3efe5bd626a | 89416a628fa2c94132e218c3eee146f369f6dfd2 | /src/main/java/co/com/ias/AvesAdmin/AvesAdmin/entities/AvesPais.java | cbacbaac40b12ada7a1df9f90a2f9d054e006cc2 | [] | no_license | honzeng/Back-end | 2a515c3a10c9a55ed7129c4883e0fab0405ecadb | 48b74fd2f2ce0745f8295a681219d45afc04cf73 | refs/heads/master | 2020-04-26T16:40:19.286174 | 2019-03-04T09:56:33 | 2019-03-04T09:56:33 | 173,687,614 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 596 | java | package co.com.ias.AvesAdmin.AvesAdmin.entities;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
@Entity
@Table(name = "tont_aves_pais")
public class AvesPais implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@ManyToOne(fetch = FetchType.EAGER)
private Paises Paises;
@Id
@ManyToOne(fetch = FetchType.EAGER)
private Aves Aves;
}
| [
"honzeng@gmail.com"
] | honzeng@gmail.com |
9d553a8f2daa6b8d89c2d2194988a4a498ea9775 | 44b70a440559640e22c478d9e156861c13ae1f5d | /src/main/java/UnirestTest/test2.java | 0e80557df8544d6a7a688c0b353ccd1a8c4f6bd1 | [
"MIT"
] | permissive | Felix94-hub/SNOMED-CT-Matching | 601ec806553f4629674b22136f8a7b0a3ad11925 | 30789adb2d3948e086384392451903712f4186a0 | refs/heads/develop | 2023-06-20T01:53:07.768343 | 2021-07-18T17:18:41 | 2021-07-18T17:18:41 | 353,677,979 | 0 | 0 | MIT | 2021-04-08T10:02:34 | 2021-04-01T11:32:55 | Java | UTF-8 | Java | false | false | 2,638 | java |
package UnirestTest;
import java.util.Arrays;
import org.json.JSONObject;
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.http.exceptions.UnirestException;
import org.json.*;
public class test2 {
public static void main(String[] args) throws UnirestException {
// String body = Unirest.get("https://snowstorm.test-nictiz.nl/MAIN/concepts?activeFilter=true")
// .queryString("term", Arrays.asList("age"))
// .queryString("termActive", "true")
String body = Unirest.get("https://snowstorm.test-nictiz.nl/browser/MAIN/descriptions?")
.queryString("term", "age")
.queryString("semanticTag", "finding")
//900000000000003001 (FSN)
// .queryString("descriptionType", "900000000000003001")
// .queryString("active", "true")
// .queryString("conceptActive", "true")
// .queryString("lang", "english")
// .queryString("groupByConcept", "true")
// .queryString("preferredIn", "900000000000509007")
// .queryString("preferredIn", "900000000000508004")
// .queryString("type", "900000000000013009")
.asString().getBody();
// Swagger Filter: https://snowstorm.test-nictiz.nl/MAIN/concepts?activeFilter=true&term=age&termActive=true&offset=0&limit=10
// original Filter: https://browser.ihtsdotools.org/snowstorm/snomed-ct/browser/MAIN/2021-01-31/descriptions?&limit=100&term=age&active=true&conceptActive=true&lang=english&searchMode=WHOLE_WORD&groupByConcept=true&preferredIn=900000000000509007&preferredIn=900000000000508004&type=900000000000013009
//System.out.println(body);
String jsonString = body;
JSONObject obj = new JSONObject(jsonString);
JSONArray arr = obj.getJSONArray("items");
// for (int i = 0; i < arr.length(); i++) {
//
// String concept_id = arr.getJSONObject(i).getString("conceptId");
// JSONObject pt = arr.getJSONObject(i).getJSONObject("pt");
// JSONObject fsn = arr.getJSONObject(i).getJSONObject("fsn");
//
// System.out.println(i+1+". " + "\tConcept ID: " + concept_id + "\n\tPrefered name: " + pt.get("term") + "\n\tFully specified name: " + fsn.get("term") +"\n ");
//
// }
for (int i = 0; i < arr.length(); i++) {
String termCT = arr.getJSONObject(i).getString("term");
// JSONObject concept_id = arr.getJSONObject(i).getJSONObject("conceptId");
// JSONObject pt = arr.getJSONObject(i).getJSONObject("pt");
// JSONObject fsn = arr.getJSONObject(i).getJSONObject("fsn");
System.out.println(i + 1 + ". " + "\tTerm: " + termCT + "\n ");
}
}
}
| [
"bui@mail.hs-ulm.de"
] | bui@mail.hs-ulm.de |
745951902fcdc4d6757dd1b1ed57cc83eb426793 | 9bac6b22d956192ba16d154fca68308c75052cbb | /icmsint-ejb/src/main/java/hk/judiciary/icmsint/model/sysinf/inf/gccij2d/NumericCT.java | 8b9a409ee2068bda83a7b15ba81640ddec93bb61 | [] | no_license | peterso05168/icmsint | 9d4723781a6666cae8b72d42713467614699b66d | 79461c4dc34c41b2533587ea3815d6275731a0a8 | refs/heads/master | 2020-06-25T07:32:54.932397 | 2017-07-13T10:54:56 | 2017-07-13T10:54:56 | 96,960,773 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,558 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2017.06.20 at 04:47:35 AM CST
//
package hk.judiciary.icmsint.model.sysinf.inf.gccij2d;
import java.math.BigDecimal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
/**
* Numeric information that is assigned or is determined by calculation, counting, or sequencing. It does not require a unit of quantity or unit of measure.
*
*
* <p>Java class for Numeric.CT complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="Numeric.CT">
* <simpleContent>
* <extension base="<http://www.w3.org/2001/XMLSchema>decimal">
* </extension>
* </simpleContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Numeric.CT", namespace = "CCT", propOrder = {
"value"
})
@XmlSeeAlso({
AgeV10CT.class,
AgeV11CT.class,
ChapterV10CT.class,
ChapterV11CT.class,
VersionNumberV10CT.class,
TimeBarOffenceV10CT.class,
TimeBarDiscoverV10CT.class,
HearingWeightV10CT.class,
PenaltyWeightV10CT.class,
VariableTypeV10CT.class,
OrderInternalNumberV10CT.class,
YearV10CT.class,
MonthV10CT.class,
WeekV10CT.class,
DayV10CT.class,
HourV10CT.class,
AmountV10CT.class,
AppealInternalNumberV10CT.class,
ReviewInternalNumberV10CT.class,
MinuteV10CT.class,
MinuteV11CT.class,
SecondV10CT.class,
PartyNoV10CT.class,
AmountV11CT.class,
HearingElapsedTimeV10CT.class
})
public class NumericCT {
@XmlValue
protected BigDecimal value;
/**
* Gets the value of the value property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getValue() {
return value;
}
/**
* Sets the value of the value property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setValue(BigDecimal value) {
this.value = value;
}
}
| [
"chiu.cheukman@gmail.com"
] | chiu.cheukman@gmail.com |
6e0fa2ed3aaea90a85aa4b6b5853688814da3414 | 177cfebe5dbe3320a959be0a320d361443cc4a01 | /Monthly-Challenges/July-2020/Day 25 - Find Minimum in Rotated Sorted Array II/Solution.java | 64f372565496f59439c25eb74eba18d82f5bbb0b | [
"MIT"
] | permissive | Apekshamarutip1/Leetcode-Solutions | f5c1926f5570671e8b6914ba04c623dd21de7f6e | 527357297b8c6f8f0220f406e33dfec8ba5c0ea4 | refs/heads/main | 2023-06-25T03:27:24.795852 | 2021-07-27T23:22:23 | 2021-07-27T23:22:23 | 391,527,679 | 1 | 0 | MIT | 2021-08-01T04:44:51 | 2021-08-01T04:44:51 | null | UTF-8 | Java | false | false | 485 | java | class Solution {
public int findMin(int[] num) {
int lo = 0;
int hi = num.length - 1;
int mid = 0;
while (lo < hi) {
mid = lo + (hi - lo) / 2;
if (num[mid] > num[hi]) {
lo = mid + 1;
} else if (num[mid] < num[hi]) {
hi = mid;
} else {
// when num[mid] and num[hi] are same
hi--;
}
}
return num[lo];
}
} | [
"varun.sathreya@gmail.com"
] | varun.sathreya@gmail.com |
5b2881f1125154461944dfcccedeb6f0a208aa95 | fa5e9b0d5c06a33c676070e201c74da594ac5612 | /app/src/test/java/com/example/vaibhav/preferences_light_mode/ExampleUnitTest.java | c9539b468d61c416999507b03c9c2d7a56728223 | [] | no_license | wsdesignuiux/PreferencesLightMode | 4430273abdae5694cf20fcb318ae987ecc175fec | 52828a7bc75cf33be0728058f9df3a8f9d81c559 | refs/heads/master | 2020-04-06T22:02:53.532397 | 2018-11-17T10:02:46 | 2018-11-17T10:02:46 | 157,823,004 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 403 | java | package com.example.vaibhav.preferences_light_mode;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"wsdesignuiux@gmail.com"
] | wsdesignuiux@gmail.com |
d6305b599fa9f76ca51c5b70a006a6b2a3d47886 | 60a3d4b0d0e61d1509b9e2be59e1acf3e0f0f2a9 | /src/main/java/com/chris/sso/demo/user/dao/UserRepository.java | b380517ad250d8a4cd5605d363a8823c8711522a | [] | no_license | MNWJJ/JWTOAuth2SSO | 4361386b000b638629308ffcc6db93764b1531f5 | e18214a82f1a719c4520763a8cc044c1c856213b | refs/heads/master | 2023-08-17T16:31:18.613493 | 2021-09-26T05:49:07 | 2021-09-26T05:49:07 | 410,168,421 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 285 | java | package com.chris.sso.demo.user.dao;
import com.chris.sso.demo.user.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface UserRepository extends JpaRepository<User, Integer> {
List<User> findByName(String name);
}
| [
"553383509@qq.com"
] | 553383509@qq.com |
f69f2cce9062b0dc96a25327e70215299368e167 | a7409f4f5996cfcecafcccd829ba909796271de2 | /part06-Part06_12.JokeManager/src/main/java/Program.java | 8ba86b733a5cdbb4b1ac470f8f295bc1f5d58abe | [] | no_license | prymakD/mooc-java-programming-1part | 72173f4ff0be1b0925886df442973f634fe3d4f6 | faeca0baff44144b9d5a998246df4d6fbf0fa70f | refs/heads/main | 2023-06-02T17:55:44.294542 | 2021-06-22T18:54:56 | 2021-06-22T18:54:56 | 367,697,222 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 199 | java |
import java.util.*;
public class Program {
public static void main(String[] args) {
JokeManager manager = new JokeManager();
Scanner scanner = new Scanner(System.in);
}
}
| [
"primachila@yandex.ru"
] | primachila@yandex.ru |
27588baedcecc5255edadea0510342ca0c6eefa3 | 9508868f54802408df2ca922453c6ba1af01c60e | /src/main/java/com/kepler/com/caucho/burlap/client/BurlapProxyFactory.java | a825713660a179896fb55a12a65609de084b9ee8 | [] | no_license | easonlong/Kepler-All | de94c8258e55a1443eb5ce27b4659a835830890d | 3633dde36fb85178b0288fc3f0eb4a25134ce8d1 | refs/heads/master | 2020-09-01T06:29:32.330733 | 2019-02-20T04:52:16 | 2019-02-20T04:52:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,147 | java | /*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001-2004 Caucho Technology, 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:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. 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.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Caucho Technology (http://www.caucho.com/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "Burlap", "Resin", and "Caucho" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* info@caucho.com.
*
* 5. Products derived from this software may not be called "Resin"
* nor may "Resin" appear in their names without prior written
* permission of Caucho Technology.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 CAUCHO TECHNOLOGY OR ITS 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.
*
* @author Scott Ferguson
*/
package com.kepler.com.caucho.burlap.client;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.Proxy;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.Name;
import javax.naming.NamingException;
import javax.naming.RefAddr;
import javax.naming.Reference;
import javax.naming.spi.ObjectFactory;
import com.kepler.com.caucho.burlap.io.AbstractBurlapInput;
import com.kepler.com.caucho.burlap.io.BurlapInput;
import com.kepler.com.caucho.burlap.io.BurlapOutput;
import com.kepler.com.caucho.burlap.io.BurlapRemoteObject;
import com.kepler.com.caucho.burlap.io.BurlapRemoteResolver;
import com.kepler.com.caucho.services.client.ServiceProxyFactory;
/**
* Factory for creating Burlap client stubs. The returned stub will
* call the remote object for all methods.
*
* <pre>
* String url = "http://localhost:8080/ejb/hello";
* HelloHome hello = (HelloHome) factory.create(HelloHome.class, url);
* </pre>
*
* After creation, the stub can be like a regular Java class. Because
* it makes remote calls, it can throw more exceptions than a Java class.
* In particular, it may throw protocol exceptions.
*
* The factory can also be configured as a JNDI resource. The factory
* expects to parameters: "type" and "url", corresponding to the two
* arguments to <code>create</code>
*
* In Resin 3.0, the above example would be configured as:
* <pre>
* <reference>
* <name>hessian/hello</name>
* <factory>com.caucho.hessian.client.HessianProxyFactory</factory>
* <init url="http://localhost:8080/ejb/hello"/>
* type="test.HelloHome"/>
* </reference>
* </pre>
*
* To get the above resource, use JNDI as follows:
* <pre>
* Context ic = new InitialContext();
* HelloHome hello = (HelloHome) ic.lookup("java:comp/env/burlap/hello");
*
* System.out.println("Hello: " + hello.helloWorld());
* </pre>
*
* <h3>Authentication</h3>
*
* <p>The proxy can use HTTP basic authentication if the user and the
* password are set.
*/
public class BurlapProxyFactory implements ServiceProxyFactory, ObjectFactory {
private BurlapRemoteResolver _resolver;
private String _user;
private String _password;
private String _basicAuth;
private long _readTimeout;
private boolean _isOverloadEnabled = false;
/**
* Creates the new proxy factory.
*/
public BurlapProxyFactory()
{
_resolver = new BurlapProxyResolver(this);
}
/**
* Sets the user.
*/
public void setUser(String user)
{
_user = user;
_basicAuth = null;
}
/**
* Sets the password.
*/
public void setPassword(String password)
{
_password = password;
_basicAuth = null;
}
/**
* Returns true if overloaded methods are allowed (using mangling)
*/
public boolean isOverloadEnabled()
{
return _isOverloadEnabled;
}
/**
* set true if overloaded methods are allowed (using mangling)
*/
public void setOverloadEnabled(boolean isOverloadEnabled)
{
_isOverloadEnabled = isOverloadEnabled;
}
/**
* Returns the remote resolver.
*/
public BurlapRemoteResolver getRemoteResolver()
{
return _resolver;
}
/**
* Creates the URL connection.
*/
protected URLConnection openConnection(URL url)
throws IOException
{
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
if (_basicAuth != null)
conn.setRequestProperty("Authorization", _basicAuth);
else if (_user != null && _password != null) {
_basicAuth = "Basic " + base64(_user + ":" + _password);
conn.setRequestProperty("Authorization", _basicAuth);
}
return conn;
}
/**
* Creates a new proxy with the specified URL. The API class uses
* the java.api.class value from _hessian_
*
* @param url the URL where the client object is located.
*
* @return a proxy to the object with the specified interface.
*/
public Object create(String url)
throws MalformedURLException, ClassNotFoundException
{
BurlapMetaInfoAPI metaInfo;
metaInfo = (BurlapMetaInfoAPI) create(BurlapMetaInfoAPI.class, url);
String apiClassName =
(String) metaInfo._burlap_getAttribute("java.api.class");
if (apiClassName == null)
throw new BurlapRuntimeException(url + " has an unknown api.");
ClassLoader loader = Thread.currentThread().getContextClassLoader();
Class apiClass = Class.forName(apiClassName, false, loader);
return create(apiClass, url);
}
/**
* Creates a new proxy with the specified URL. The returned object
* is a proxy with the interface specified by api.
*
* <pre>
* String url = "http://localhost:8080/ejb/hello");
* HelloHome hello = (HelloHome) factory.create(HelloHome.class, url);
* </pre>
*
* @param api the interface the proxy class needs to implement
* @param url the URL where the client object is located.
*
* @return a proxy to the object with the specified interface.
*/
public Object create(Class api, String urlName)
throws MalformedURLException
{
if (api == null)
throw new NullPointerException();
URL url = new URL(urlName);
try {
// clear old keepalive connections
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setConnectTimeout(10);
conn.setReadTimeout(10);
conn.setRequestProperty("Connection", "close");
InputStream is = conn.getInputStream();
is.close();
conn.disconnect();
} catch (IOException e) {
}
BurlapProxy handler = new BurlapProxy(this, url);
return Proxy.newProxyInstance(api.getClassLoader(),
new Class[] { api,
BurlapRemoteObject.class },
handler);
}
public AbstractBurlapInput getBurlapInput(InputStream is)
{
AbstractBurlapInput in = new BurlapInput(is);
in.setRemoteResolver(getRemoteResolver());
return in;
}
public BurlapOutput getBurlapOutput(OutputStream os)
{
BurlapOutput out = new BurlapOutput(os);
return out;
}
/**
* JNDI object factory so the proxy can be used as a resource.
*/
public Object getObjectInstance(Object obj, Name name,
Context nameCtx,
Hashtable<?,?> environment)
throws Exception
{
Reference ref = (Reference) obj;
String api = null;
String url = null;
String user = null;
String password = null;
for (int i = 0; i < ref.size(); i++) {
RefAddr addr = ref.get(i);
String type = addr.getType();
String value = (String) addr.getContent();
if (type.equals("type"))
api = value;
else if (type.equals("url"))
url = value;
else if (type.equals("user"))
setUser(value);
else if (type.equals("password"))
setPassword(value);
}
if (url == null)
throw new NamingException("`url' must be configured for BurlapProxyFactory.");
// XXX: could use meta protocol to grab this
if (api == null)
throw new NamingException("`type' must be configured for BurlapProxyFactory.");
ClassLoader loader = Thread.currentThread().getContextClassLoader();
Class apiClass = Class.forName(api, false, loader);
return create(apiClass, url);
}
/**
* Creates the Base64 value.
*/
private String base64(String value)
{
StringBuffer cb = new StringBuffer();
int i = 0;
for (i = 0; i + 2 < value.length(); i += 3) {
long chunk = (int) value.charAt(i);
chunk = (chunk << 8) + (int) value.charAt(i + 1);
chunk = (chunk << 8) + (int) value.charAt(i + 2);
cb.append(encode(chunk >> 18));
cb.append(encode(chunk >> 12));
cb.append(encode(chunk >> 6));
cb.append(encode(chunk));
}
if (i + 1 < value.length()) {
long chunk = (int) value.charAt(i);
chunk = (chunk << 8) + (int) value.charAt(i + 1);
chunk <<= 8;
cb.append(encode(chunk >> 18));
cb.append(encode(chunk >> 12));
cb.append(encode(chunk >> 6));
cb.append('=');
}
else if (i < value.length()) {
long chunk = (int) value.charAt(i);
chunk <<= 16;
cb.append(encode(chunk >> 18));
cb.append(encode(chunk >> 12));
cb.append('=');
cb.append('=');
}
return cb.toString();
}
public static char encode(long d)
{
d &= 0x3f;
if (d < 26)
return (char) (d + 'A');
else if (d < 52)
return (char) (d + 'a' - 26);
else if (d < 62)
return (char) (d + '0' - 52);
else if (d == 62)
return '+';
else
return '/';
}
}
| [
"shenjiawei@didichuxing.com"
] | shenjiawei@didichuxing.com |
7a5a045393a40c9a434a896a2c6219f04bc11dc1 | 33b2d2c45d84eede111519071b6b25cb5019f411 | /src/jm/util/Convert.java | baf4344b4a5fdf117e21a7ec76465e70fffd4d20 | [] | no_license | mgtcardenas/CONIELECOMP2019 | 5bdb4f11223cd61189ee93911b8f02962b3907f0 | 84c704668b9b72ce36a42a6bb63568ca2585992d | refs/heads/master | 2020-04-25T13:10:05.609561 | 2019-09-12T16:02:39 | 2019-09-12T16:02:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,524 | java | /*
* Convert.java 0.2 30th June 2002
*
* Copyright (C) 2001 Adam Kirby
*
* <This Java Class is part of the jMusic API version 1.5, March 2004.>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package jm.util;
import jm.constants.Frequencies;
import jm.constants.Pitches;
import jm.music.data.Note;
import jm.music.data.Part;
import jm.music.data.Phrase;
import jm.music.data.Score;
import java.lang.reflect.Field;
/**
* Static methods allowing conversion of standard JMusic data types (like
* Phrase) to and from XML.
*
* Also supports a separate custom encoding for pitch and rhythm values pairs
* which is much terser than XML.
*
* @author Adam Kirby
* @version 0.2, 30th June 2002
*/
public class Convert {
private Convert() {
}
//--- Key signature/scale degree conversions ---//
// /**
// * Integer constant describing the number of semitone intervals in any
// * given octave.
// */
// private static final int SEMITONES_PER_OCTAVE = 12;
//
// /**
// * Returns the scale degree of the specified pitch in the specified key
// * signature.
// *
// * @param note Note whose pitch is to represented as a degree.
// * @param keySignature KeySignature to be compared with
// * @return Integer describing the pitch of the note, relative
// * to the tonic of the key signature.
// */
// private static int noteToScaleDegree(
// final Note note,
// final KeySignature keySignature)
// throws
// ConversionException {
// int tonic = keySignature.getTonic();
// int pitch = note.getPitch();
// if (pitch == Note.REST) {
// throw new ConversionException(
// "Note is a rest. Cannot convert to scale degree.");
// }
//
// // Make pitch relative to the tonic
// pitch -= tonic;
//
// // Pitch must be positive for % function to work correctly
// if (pitch < 0) {
//
// // Give pitch a positive value with an equivalent degree of the
// // scale
// pitch += ((-pitch / SEMITONES_PER_OCTAVE) + 1)
// * SEMITONES_PER_OCTAVE;
// }
//
// return pitch % SEMITONES_PER_OCTAVE;
// }
//--- String encoding conversions ---//
public static final String DEFAULT_SEPARATOR = ",";
public static final String LEFT_BRACKET = "[";
public static final String RIGHT_BRACKET = "]";
/**
* Converts a list of pitch and rhythm-value pairs, each value separated by
* a non-digit, to the Phrase that those values represent.
*
* @param string String of value separated by commas
* @return Phrase described by the String.
*/
public static Phrase pitchAndRhythmStringToPhrase(final String string) {
StringProcessor processor = new StringProcessor(string);
Phrase phrase = new Phrase();
try {
while (true) {
phrase.addNote(new Note(
(int) processor.getNextRhythm(), processor.getNextRhythm()));
}
} catch (EOSException e) {
/* This is okay. Continue. */
}
return phrase;
}
/**
* Converts a Phrase, to a list of comma separated values alternately
* describing the pitch and rhyhtm value of each Note in the phrase.
*
* @param phrase Phrase to be converted
* @return String describing the Phrase
*/
public static String phraseToPitchAndRhythmString(final Phrase phrase) {
Note[] noteArray = phrase.getNoteArray();
/*
* Assuming each pitch and rhythm value pair take no more than 10
* characters to describe.
*/
StringBuffer stringBuffer = new StringBuffer(noteArray.length * 10);
/* Describe all but the last note */
for (int i = 0; i < (noteArray.length - 1); i++) {
// stringBuffer.append(LEFT_BRACKET);
stringBuffer.append(noteArray[i].getPitch());
stringBuffer.append(DEFAULT_SEPARATOR);
stringBuffer.append(
limitDecimalPlaces(noteArray[i].getRhythmValue(), 3));
// stringBuffer.append(RIGHT_BRACKET);
stringBuffer.append(DEFAULT_SEPARATOR);
}
if (noteArray.length > 0) {
/* Describe the final note */
// stringBuffer.append(LEFT_BRACKET);
stringBuffer.append(noteArray[noteArray.length - 1].getPitch());
stringBuffer.append(DEFAULT_SEPARATOR);
stringBuffer.append(
limitDecimalPlaces(
noteArray[noteArray.length - 1].getRhythmValue(),
3));
// stringBuffer.append(RIGHT_BRACKET);
}
return stringBuffer.toString();
}
/**
* Converts a list of pitch, rhythm-value and dynamic sets, each value
* separated by a non-digit, to the Phrase that those values represent.
*
* @param string String of value separated by commas
* @return Phrase described by the String.
*/
public static Phrase pitchRhythmAndDynamicStringToPhrase(final String string) {
StringProcessor processor = new StringProcessor(string);
Phrase phrase = new Phrase();
try {
while (true) {
phrase.addNote(new Note(
(int) processor.getNextRhythm(),
processor.getNextRhythm(),
(int) processor.getNextRhythm()));
}
} catch (EOSException e) {
/* This is okay. Continue. */
}
return phrase;
}
/**
* Converts a Phrase, to a list of comma separated values alternately
* describing the pitch, rhyhtm value and dynamic of each Note in the
* phrase.
*
* @param phrase Phrase to be converted
* @return String describing the Phrase
*/
public static String phraseToPitchRhythmAndDynamicString(
final Phrase phrase) {
Note[] noteArray = phrase.getNoteArray();
/*
* Assuming each pitch and rhythm value pair take no more than 10
* characters to describe.
*/
StringBuffer stringBuffer = new StringBuffer(noteArray.length * 12);
/* Describe all but the last note */
for (int i = 0; i < (noteArray.length - 1); i++) {
stringBuffer.append(LEFT_BRACKET);
stringBuffer.append(noteArray[i].getPitch());
stringBuffer.append(DEFAULT_SEPARATOR);
stringBuffer.append(
limitDecimalPlaces(noteArray[i].getRhythmValue(), 3));
stringBuffer.append(DEFAULT_SEPARATOR);
stringBuffer.append(noteArray[i].getDynamic());
stringBuffer.append(RIGHT_BRACKET);
stringBuffer.append(DEFAULT_SEPARATOR);
}
if (noteArray.length > 0) {
/* Describe the final note */
stringBuffer.append(LEFT_BRACKET);
stringBuffer.append(noteArray[noteArray.length - 1].getPitch());
stringBuffer.append(DEFAULT_SEPARATOR);
stringBuffer.append(
limitDecimalPlaces(
noteArray[noteArray.length - 1].getRhythmValue(),
3));
stringBuffer.append(DEFAULT_SEPARATOR);
stringBuffer.append(noteArray[noteArray.length - 1].getDynamic());
stringBuffer.append(RIGHT_BRACKET);
}
return stringBuffer.toString();
}
// /** Old, to be removed */
// public static String scoreToHttpGetEncodedString(final Score score) {
// StringBuffer buffer = new StringBuffer();
// int count = 0;
// int scoresize = score.size();
// for (int i = 0; i < scoresize; i++) {
// Part part = score.getPart(i);
// int partsize = part.size();
// for (int j = 0; j < partsize; j++) {
// Phrase phrase = part.getPhrase(j);
// count++;
// buffer.append("PnRV");
// buffer.append(count);
// buffer.append("=");
// buffer.append(Convert.phraseToPitchAndRhythmString(phrase));
// buffer.append("&");
// }
// }
// return buffer.toString();
// }
static String limitDecimalPlaces(final double d,
final int places) {
String dString = Double.toString(d);
int lastIndex = dString.lastIndexOf(".") + places + 1;
if (lastIndex > dString.length()) {
lastIndex = dString.length();
}
return dString.substring(0, lastIndex);
}
// previously EOSException,
// length reduced to resolve pre-OSX MacOS filename length limitations
private static class EOSException extends Exception {
}
// previously PitchAndRhythmStringProcessor,
// length reduced to resolve pre-OSX MacOS filename length limitations
private static class StringProcessor {
private int i = 0;
private String string;
StringProcessor(final String string) {
this.string = string;
}
private int getNextPitch() throws ConversionException,
EOSException {
StringBuffer buffer = new StringBuffer();
try {
/* Ignore leading non-digit characters */
while (! Character.isDigit(string.charAt(i++))) {
}
buffer.append(string.charAt(i - 1));
while (Character.isDigit(string.charAt(i++))) {
buffer.append(string.charAt(i - 1));
}
if (string.charAt(i - 1) == '.') {
throw new ConversionException("Double value not expected");
}
return Integer.parseInt(buffer.toString());
} catch (IndexOutOfBoundsException e) {
if (buffer.length() > 0) {
return Integer.parseInt(buffer.toString());
}
throw new EOSException();
}
}
private double getNextRhythm() throws EOSException {
StringBuffer buffer = new StringBuffer();
try {
/* Ignore leading non-digit characters */
while (! Character.isDigit(string.charAt(i++))
&& string.charAt(i) != '.') {
}
buffer.append(string.charAt(i - 1));
while (Character.isDigit(string.charAt(i))
|| string.charAt(i) == '.') {
buffer.append(string.charAt(i));
i++;
}
return Double.valueOf(buffer.toString()).doubleValue();
} catch (IndexOutOfBoundsException e) {
if (buffer.length() > 0) {
return Double.valueOf(buffer.toString()).doubleValue();
}
throw new EOSException();
}
}
}
//--- XML conversions ---//
public static String scoreToXMLString(final Score score) {
return XMLParser.scoreToXMLString(score);
}
public static String partToXMLString(final Part part) {
return XMLParser.partToXMLString(part);
}
public static String phraseToXMLString(final Phrase phrase) {
return XMLParser.phraseToXMLString(phrase);
}
public static String noteToXMLString(final Note note) {
return XMLParser.noteToXMLString(note);
}
public static Score xmlStringToScore(final String string)
throws ConversionException
{
return XMLParser.xmlStringToScore(string);
}
public static Part xmlStringToPart(final String string)
throws ConversionException
{
return XMLParser.xmlStringToPart(string);
}
public static Phrase xmlStringToPhrase(final String string)
throws ConversionException
{
return XMLParser.xmlStringToPhrase(string);
}
public static Note xmlStringToNote(final String string)
throws ConversionException
{
return XMLParser.xmlStringToNote(string);
}
// Addition by Andrew Brown
/**
* Get the frequency of a given MIDI pitch
*
* @param midiPitch pitch value from 0 - 127
* @return frequency a value in hertz
* @see Class description of {@link Pitches}.
* @see Class description of {@link Frequencies}.
*/
public static final float getFrequencyByMidiPitch(final int midiPitch) {
float freq = -1.0f;
if (midiPitch >= 0 && midiPitch <= 127) {
freq = (float)(6.875 * Math.pow(2.0, ((3 + midiPitch) / 12.0)));
}
return freq;
}
/*
* Pitch and frequency conversions
* These methods contributed by Marcel Karras, Oct 2008.
*/
/**
* Get the midi pitch of a given frequency.
*
* @param frequency frequency value in Hz
* @return pitch a value from 0..127
* @see Class description of {@link Pitches}.
* @see Class description of {@link Frequencies}.
*/
public static final int getMidiPitchByFrequency(final float frequency) {
// check frequency bounds
// lower bound: frequency(CN1) / (2^(1/12))
// upper bound: frequency(G9) * (2^(1/12))
float powerOfTwo = (float) Math.pow(2, (1f / 12f));
if (frequency <(Frequencies.FRQ[Pitches.CN1] / powerOfTwo) ||
frequency > (Frequencies.FRQ[Pitches.G9] * powerOfTwo)) {
return -1;
}
// round to the best matching pitch value (0..127)
int pitch = Math.round((float) (12 *(Math.log(frequency / 6.875) / Math.log(2)) - 3));
return pitch;
}
/**
* Get the midi note name for a given pitch value.
*
* @param pitch a value from 0..127
* @return midi note name like in {@link Pitches}
* @see Class description of {@link Pitches}.
* @see Class description of {@link Frequencies}.
*/
public static final String getNameOfMidiPitch(final int pitch) {
// use java reflection API
final Field[] fields = Pitches.class.getFields();
if (fields != null) {
for (int i=0; i<fields.length; i++) {
Field f = fields[i];
// try to find the pitch member variable
try {
if (f.getInt(null) == pitch)
return f.getName();
} catch (IllegalArgumentException e) {
return "";
} catch (IllegalAccessException e) {
return "";
}
}
}
return "";
}
} | [
"mgtcardenas@gmail.com"
] | mgtcardenas@gmail.com |
75be4761632ae9d3dfbbc82a3874028dd71316d1 | 26331af0023461a3e9b3653a4db376db1dbbf251 | /webmagic-web/src/main/java/com/webmagic/controller/TeamMemberController.java | fcedd0b176f2178b2c286b5176ffadb93d2c1bc5 | [] | no_license | dfggking/webmagic-module | b874ff336ac3c54f33d342f78c10ae1ffbbc0a68 | a243b84ecd12064bb3fcfdd0fbdb38396d526ca3 | refs/heads/master | 2022-12-21T16:06:03.719619 | 2020-06-02T09:27:14 | 2020-06-02T09:27:14 | 154,348,030 | 0 | 1 | null | 2022-12-16T04:31:51 | 2018-10-23T15:00:59 | Java | UTF-8 | Java | false | false | 1,120 | java | package com.webmagic.controller;
import com.webmagic.controller.base.BaseController;
import com.webmagic.mapper.WebsiteConfigMapper;
import com.webmagic.model.Member;
import com.webmagic.mapper.MemberMapper;
import com.webmagic.model.WebsiteConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import java.util.List;
/**
* @author jinyingfei - 835317619@qq.com
* @create 2018-10-02
*/
@Controller
@RequestMapping("team/member")
public class TeamMemberController extends BaseController {
@Autowired
private MemberMapper memberMapper;
@Autowired
private WebsiteConfigMapper websiteConfigMapper;
@RequestMapping("list")
public ModelAndView list() {
List<Member> list = memberMapper.selectAll();
ModelAndView mv = new ModelAndView();
mv.addObject(RESULT, SUCCESS);
mv.addObject(LIST, list);
WebsiteConfig wc = websiteConfigMapper.selectByPrimaryKey(0);
mv.addObject(ENTITY, wc);
return mv;
}
}
| [
"835317619@qq.com"
] | 835317619@qq.com |
25472b0059f418617d775e0c9432ad8994846f46 | 6bff17460b8c6a42fc1ffd97fc9cbb43b3548179 | /app/src/main/java/com/gersoncardenas/pizzadoblepizza/MainFragment.java | c5ef715af67d89f74214564d541ea6eb20b653da | [] | no_license | gersonfcr26/PizzaDoblePizza | ff6698d6c47bfc3e0c7ba76cc73372186f161baa | 6ff21c77bfe44ab9912583ced81f4ef5b13d396c | refs/heads/master | 2021-01-10T11:20:20.005362 | 2015-06-05T04:19:52 | 2015-06-05T04:19:52 | 36,911,489 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 659 | java | package com.gersoncardenas.pizzadoblepizza;
import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public class MainFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_main, container, false);
}
@Override
public void onDestroyView() {
super.onDestroyView();
}
}
| [
"gersonfcr26@gmail.com"
] | gersonfcr26@gmail.com |
5aa2ec7d68ed43a680df4aa525fc2aed267cef27 | e6e71ddaf681588028cbc6e8a3d0c776e6c177a9 | /AdXAgent/PrevAgent_jar/NAMM-JarGameStart/AgentNAMM.java | d0e351541edfbabc3f089e869e09b6bf704be9f8 | [] | no_license | alunmeredith/IntelligentAgents | 4aff0bb420da5470e1a239eb5c6fb3533dbad398 | 22c57646d170aefdc8c958a870ec16b6de285b2e | refs/heads/master | 2021-05-04T10:55:39.725388 | 2016-09-24T02:37:39 | 2016-09-24T02:37:39 | 47,033,290 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 110,145 | java | package soton.intagts;
import com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription;
import edu.umich.eecs.tac.props.Ad;
import edu.umich.eecs.tac.props.BankStatus;
import edu.umich.eecs.tac.props.Query;
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map;
import java.util.Queue;
import java.util.Random;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import edu.umich.eecs.tac.util.sampling.SynchronizedMutableSampler;
import org.apache.commons.math3.stat.descriptive.rank.Median;
import se.sics.isl.transport.Transportable;
import se.sics.tasim.aw.Agent;
import se.sics.tasim.aw.Message;
import se.sics.tasim.props.SimulationStatus;
import se.sics.tasim.props.StartInfo;
import tau.tac.adx.ads.properties.AdType;
import tau.tac.adx.demand.Campaign;
import tau.tac.adx.demand.CampaignStats;
import tau.tac.adx.devices.Device;
import tau.tac.adx.props.*;
import tau.tac.adx.report.adn.AdNetworkKey;
import tau.tac.adx.report.adn.AdNetworkReport;
import tau.tac.adx.report.adn.AdNetworkReportEntry;
import tau.tac.adx.report.adn.MarketSegment;
import tau.tac.adx.report.demand.*;
import tau.tac.adx.report.demand.campaign.auction.CampaignAuctionReport;
import tau.tac.adx.report.publisher.AdxPublisherReport;
import tau.tac.adx.report.publisher.AdxPublisherReportEntry;
import tau.tac.adx.users.properties.Age;
import tau.tac.adx.users.properties.Gender;
import tau.tac.adx.users.properties.Income;
import java.io.*;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.commons.math3.stat.*;
/**
* `
* @author Mariano Schain
* Test plug-in
*
*/
public class AgentNAMM extends Agent {
private final Logger log = Logger
.getLogger(AgentNAMM.class.getName());
/*
* Basic simulation information. An agent should receive the {@link
* StartInfo} at the beginning of the game or during recovery.
*/
@SuppressWarnings("unused")
private StartInfo startInfo;
/**
* Messages received:
*
* We keep all the {@link CampaignReport campaign reports} delivered to the
* agent. We also keep the initialization messages {@link PublisherCatalog}
* and {@link InitialCampaignMessage} and the most recent messages and
* reports {@link CampaignOpportunityMessage}, {@link CampaignReport}, and
* {@link AdNetworkDailyNotification}.
*/
private final Queue<CampaignReport> campaignReports;
private PublisherCatalog publisherCatalog;
private InitialCampaignMessage initialCampaignMessage;
private AdNetworkDailyNotification adNetworkDailyNotification;
/*
* The addresses of server entities to which the agent should send the daily
* bids data
*/
private String demandAgentAddress;
private String adxAgentAddress;
/*
* we maintain a list of queries - each characterized by the web site (the
* publisher), the device type, the ad type, and the user market segment
*/
private AdxQuery[] queries;
/**
* Information regarding the latest campaign opportunity announced
*/
private CampaignData pendingCampaign;
/**
* We maintain a collection (mapped by the campaign id) of the campaigns won
* by our agent.
*/
private Map<Integer, CampaignData> myCampaigns;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Collection of campaigns thrown in the game
//private List<CampaignData> campaignsInGame;
private Map<Integer, CampaignData> campaignsInGame;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*
* the bidBundle to be sent daily to the AdX
*/
private AdxBidBundle bidBundle;
/*
* The current bid level for the user classification service
*/
double ucsBid;
/*
* Defines the minimum fraction of learnt data coming from historic data over game data
*/
final double HISTORIC_FRAC = 0.5;
/*
* The targeted service level for the user classification service
*/
int ucsTargetLevel;
/*
* Track the quality of the previous day
*/
double quality = 1;
/*
* Track performance data of whole game
* Currently unused
*/
private PerformanceData performanceData;
/*
* The bid campaign bid we send.
* Note it is not reset each day on purpose so there is a default value in case we fail to calculate a bid in time.
*/
double cmpBid;
/*
* current day of simulation
*/
private int day;
private String[] publisherNames;
private CampaignData currCampaign;
/* Saving Historic Campaigns as global variable */
historicCampaignData historicCampaigns = new historicCampaignData();
/**
* This property is the instance of a new NAMM class to keep record of all Ad-Net reports during a game execution.
* The idea is to use historic data as reference to estimate new bid prices or provide values for some strategies.
*/
private ImpressionHistory impressionBidHistory;
public AgentNAMM() {
campaignReports = new LinkedList<CampaignReport>();
impressionBidHistory = new ImpressionHistory();
//campaignsInGame = new ArrayList<CampaignData>();
}
/**
* Upon recieving a message from the server handle the information with the appropriate method
* @param message
*/
@Override
protected void messageReceived(Message message) {
try {
Transportable content = message.getContent();
// Dumps all received messages to log
log.fine(message.getContent().getClass().toString());
this.log.log(Level.ALL, message.getContent().getClass().toString());
if (content instanceof InitialCampaignMessage) {
handleInitialCampaignMessage((InitialCampaignMessage) content);
} else if (content instanceof CampaignOpportunityMessage) {
handleICampaignOpportunityMessage((CampaignOpportunityMessage) content);
} else if (content instanceof CampaignReport) {
handleCampaignReport((CampaignReport) content);
} else if (content instanceof AdNetworkDailyNotification) {
handleAdNetworkDailyNotification((AdNetworkDailyNotification) content);
} else if (content instanceof AdxPublisherReport) {
handleAdxPublisherReport((AdxPublisherReport) content);
} else if (content instanceof SimulationStatus) {
handleSimulationStatus((SimulationStatus) content);
} else if (content instanceof PublisherCatalog) {
handlePublisherCatalog((PublisherCatalog) content);
} else if (content instanceof AdNetworkReport) {
handleAdNetworkReport((AdNetworkReport) content);
} else if (content instanceof StartInfo) {
handleStartInfo((StartInfo) content);
} else if (content instanceof BankStatus) {
handleBankStatus((BankStatus) content);
} else if(content instanceof CampaignAuctionReport) {
hadnleCampaignAuctionReport((CampaignAuctionReport) content);
}
else {
System.out.println("UNKNOWN Message Received: " + content);
}
} catch (NullPointerException e) {
System.out.println(e.getMessage());
e.printStackTrace();
this.log.log(Level.SEVERE,
"Exception thrown while trying to parse message." + e);
System.out.println(e.getMessage());
e.printStackTrace();
}
}
private void hadnleCampaignAuctionReport(CampaignAuctionReport content) {
// ingoring
}
private void handleBankStatus(BankStatus content) {
System.out.println("Day " + day + ": " + content.toString());
}
/**
* Processes the start information.
*
* @param startInfo
* the start information.
*/
protected void handleStartInfo(StartInfo startInfo) {
this.startInfo = startInfo;
System.out.println("Game Starting:" + startInfo);
}
/**
* Process the reported set of publishers
*
* @param publisherCatalog
*/
private void handlePublisherCatalog(PublisherCatalog publisherCatalog) {
this.publisherCatalog = publisherCatalog;
generateAdxQuerySpace();
getPublishersNames();
}
/**
* On day 0, a campaign (the "initial campaign") is allocated to each
* competing agent. The campaign starts on day 1. The address of the
* server's AdxAgent (to which bid bundles are sent) and DemandAgent (to
* which bids regarding campaign opportunities may be sent in subsequent
* days) are also reported in the initial campaign message
*/
private void handleInitialCampaignMessage(
InitialCampaignMessage campaignMessage) {
System.out.println(campaignMessage.toString());
day = 0;
initialCampaignMessage = campaignMessage;
demandAgentAddress = campaignMessage.getDemandAgentAddress();
adxAgentAddress = campaignMessage.getAdxAgentAddress();
CampaignData campaignData = new CampaignData(initialCampaignMessage);
campaignData.setBudget(initialCampaignMessage.getBudgetMillis()/1000.0);
currCampaign = campaignData;
genCampaignQueries(currCampaign);
// initialise performance data tracking
performanceData = new PerformanceData();
/*
* The initial campaign is already allocated to our agent so we add it
* to our allocated-campaigns list.
*/
System.out.println("Day " + day + ": Allocated campaign - " + campaignData);
myCampaigns.put(initialCampaignMessage.getId(), campaignData);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
campaignsInGame.put(initialCampaignMessage.getId(), campaignData);
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Load historic campaigns into a list
String workingDir = System.getProperty("user.dir");
System.out.println("Loading Historic Campaigns...");
historicCampaigns.loadDataFromFile(workingDir + "\\cmpLog.csv");
System.out.println("Number of Campaigns loaded:" + historicCampaigns.getNumberOfRecords());
}
/**
* On day n ( > 0) a campaign opportunity is announced to the competing
* agents. The campaign starts on day n + 2 or later and the agents may send
* (on day n) related bids (attempting to win the campaign). The allocation
* (the winner) is announced to the competing agents during day n + 1.
*/
private void handleICampaignOpportunityMessage(
CampaignOpportunityMessage com) {
day = com.getDay();
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//campaignsInGame.add(pendingCampaign);
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// For campaigns that finished yesterday set performance metrics.
for (Map.Entry<Integer, CampaignData> entry : myCampaigns.entrySet()) {
CampaignData campaign = entry.getValue();
if ((entry.getValue().dayEnd == day - 1)) {
System.out.println("...");
long imps = (long)(campaign.stats.getOtherImps() + campaign.stats.getTargetedImps());
double revenue = campaign.budget * ERRcalc(campaign, imps);
// Update ended campaign
campaign.update(revenue);
// Update performance data
performanceData.updateData(campaign);
// Print relevant performance statistics
System.out.printf(
"Day %d: Campaign(%d) Completed________________________________\n" +
" Day Start:%d End:%d Duration:%d days \n" +
" Reach:%d (per day:%.2f) Impression Target:%d \n" +
" Impressions:%d Targeted:%d Untargeted:%d \n" +
" Target Fulfillment:%d%% Reach Fulfillment:%d%% \n" +
" Revenue:%.3f Budget:%.3f Bid:%.3f \n" +
" Bid:2nd Ratio: %.2f \n" +
" Impression Cost:%.2f Estimate:%.2f Accuracy:%d%% \n" +
" UCS Cost:%.2f Estimated:%.2f Accuracy:%d%% \n" + /* UCS cost estimate approximates with non-overlapping campaigns */
" Profit:%.2f (Per Impression, millis:%d) \n" + /* Above gives underestimate for profit */
" Profit: Estimated:%.2f Accuracy:%d%% | uncorrected:%.2f Accuracy:%d%%)\n" +
" Quality Change:%.2f Estimate:%.2f Accuracy:%d%% \n",
day, campaign.id,
campaign.dayStart, campaign.dayEnd, campaign.dayEnd - campaign.dayStart,
campaign.reachImps, (double)(campaign.reachImps / (campaign.dayEnd - campaign.dayStart)), campaign.impressionTarget,
(long)(campaign.stats.getTargetedImps() + campaign.stats.getOtherImps()),
(long)campaign.stats.getTargetedImps(), (long)campaign.stats.getOtherImps(),
(long)(campaign.impTargetFulfillment*100), (long)(campaign.reachFulfillment*100),
campaign.revenue, campaign.budget, campaign.cmpBid,
campaign.bidVs2ndRatio,
campaign.stats.getCost(), campaign.estImpCost ,(long)(campaign.estCostAcc*100),
campaign.ucsCost, campaign.estUcsCost, (long)(campaign.estUcsCostAcc*100),
campaign.profit, (long)((campaign.profit/(campaign.stats.getOtherImps() + campaign.stats.getTargetedImps()))*1000),
campaign.profitEstimate, (long)(campaign.estProfitAcc*100), campaign.uncorrectedProfitEstimate,
(long)(campaign.uncorrectedProfitAcc*100),
campaign.qualityChange, campaign.estQualityChange, (long)(campaign.estQualityChangeAcc*100));
/* Currently not properly implemented game overview
System.out.printf(
"Day %d: Performance Report (%d Campaigns complete)_____________________________\n" +
" Revenue:%.3f \n" +
" Profit:%.3f (per Imp(millis):%.3f) Estimated profit accuracy:%.3f (uncorrected:%.3f)\n" +
" bid vs 2nd price ratio: %.2f \n" +
" Estimated cost accuracy: %d%% (impressions:%d%%. Ucs:%d%%) \n" +
" Impression Target Fulfillment:%d%% Reach Fulfillment:%d%% \n",
day,performanceData.numCamps,
performanceData.revenue,
performanceData.profit, performanceData.profitPerImpression*1000, performanceData.estProfitAcc, performanceData.uncorrectedProfitEstimateAcc,
performanceData.avBidVs2ndRatio,
(long)(performanceData.estCostAcc*100), (long)(performanceData.estImpCostAcc*100), (long)(performanceData.estUcsCostAcc*100),
(long)(performanceData.impTargetFulfillment*100), (long)(performanceData.reachFulfillment*100)
);*/
}
}
/**
* React to new campaign opportunity message by choosing an appropriate bidding strategy
* evaluating and sending both campaign and ucs bids
*/
pendingCampaign = new CampaignData(com);
System.out.println("Day " + day + ": Campaign opportunity" + pendingCampaign);
long cmpimps = com.getReachImps();
int startDays = 5;
// Starting strategy for first few days
if (day <= startDays) {
cmpBid = campaignStartingStrategy();
}
// Quality recovery when quality is too low
else if (adNetworkDailyNotification.getQualityScore() < 1) { // Condition for Quality strategy
cmpBid = campaignQualityRecoveryStrategy();
}
else cmpBid = campaignProfitStrategy();
System.out.println("Day " + day + ": Campaign - Bid: " + (long)(cmpBid*1000));
// If bid is too high, just bid the maximum value.
if (cmpBid >= bidTooHigh(cmpimps, 95)) {
cmpBid = 0.001 * cmpimps * adNetworkDailyNotification.getQualityScore() - 0.001;
System.out.print(" " + (long)(cmpBid*1000) + "-too high!");
}
// If bid is too low, bid the "minimum value"
double lowBid = bidTooLow(cmpimps, 30);
if (cmpBid <= lowBid) {
cmpBid = lowBid + 0.001;
System.out.println(" " + (long)(cmpBid*1000) + "-too low!");
}
/*
* The campaign requires com.getReachImps() impressions. The competing
* Ad Networks bid for the total campaign Budget (that is, the ad
* network that offers the lowest budget gets the campaign allocated).
* The advertiser is willing to pay the AdNetwork at most 1$ CPM,
* therefore the total number of impressions may be treated as a reserve
* (upper bound) price for the auction.
*/
/*
* Adjust ucs bid s.t. target level is achieved. Note: The bid for the
* user classification service is piggybacked
*/
// TODO: Nikola UCS bid calculation here
// Random random = new Random();
if (adNetworkDailyNotification != null) {
double ucsLevel = adNetworkDailyNotification.getServiceLevel();
//ucsBid = 0.1 + random.nextDouble()/10.0;
ucsBid = ucsBidCalculator(1);
System.out.println("Day " + day + ": ucs level reported: " + ucsLevel);
} else {
System.out.println("Day " + day + ": Initial ucs bid is " + ucsBid);
}
/* Note: Campaign bid is in millis */
System.out.println("Day " + day + ": Submitting Campaign bid (millis): " + (long)(cmpBid*1000));
System.out.println("Day " + day + ": Submitting UCS service bid: " + ucsBid);
AdNetBidMessage bids = new AdNetBidMessage(ucsBid, pendingCampaign.id, (long)(cmpBid*1000));
sendMessage(demandAgentAddress, bids);
/* TODO ALUN: Fix bug where day 0 isn't bid for
* - Harder than expected the error moves position on the first day of each run
*/
}
/**
* On day n ( > 0), the result of the UserClassificationService and Campaign
* auctions (for which the competing agents sent bids during day n -1) are
* reported. The reported Campaign starts in day n+1 or later and the user
* classification service level is applicable starting from day n+1.
*/
private void handleAdNetworkDailyNotification(
AdNetworkDailyNotification notificationMessage) {
////////////////////////////////////////////////////////////////////////////////////////////////////////////
campaignsInGame.put(pendingCampaign.id, pendingCampaign);
/////////////////////////////////////////////////////////////////////////////////////////////////////////
adNetworkDailyNotification = notificationMessage;
System.out.println("Day " + day + ": Daily notification for campaign "
+ adNetworkDailyNotification.getCampaignId());
String campaignAllocatedTo = " allocated to "
+ notificationMessage.getWinner();
if ((pendingCampaign.id == adNetworkDailyNotification.getCampaignId())
&& (notificationMessage.getCostMillis() != 0)) {
/* add campaign to list of won campaigns */
pendingCampaign.setBudget(notificationMessage.getCostMillis() / 1000.0);
pendingCampaign.setBid(cmpBid);
pendingCampaign.setBidVs2ndRatio();
currCampaign = pendingCampaign;
genCampaignQueries(currCampaign);
// Test for impressionTarget function
pendingCampaign.setImpressionTargets();
myCampaigns.put(pendingCampaign.id, pendingCampaign);
campaignAllocatedTo = " WON at cost (Millis)"
+ notificationMessage.getCostMillis();
}
System.out.println("Day " + day + ": " + campaignAllocatedTo
+ ". UCS Level set to " + notificationMessage.getServiceLevel()
+ " at price " + notificationMessage.getPrice()
+ " Quality Score is: " + notificationMessage.getQualityScore());
// Attribute the ucs cost to any running campaigns.
int ongoingCamps = 0;
// count the number of ongoing campaigns
for (Map.Entry<Integer, CampaignData> entry : myCampaigns.entrySet()) {
CampaignData campaign = entry.getValue();
if( (day <= campaign.dayEnd) && (day >= campaign.dayStart)){
ongoingCamps ++;
}
}
// send each campaign an even split of ucs cost
for (Map.Entry<Integer, CampaignData> entry : myCampaigns.entrySet()) {
CampaignData campaign = entry.getValue();
if( (day <= campaign.dayEnd) && (day >= campaign.dayStart)){
campaign.ucsCost += notificationMessage.getPrice() / ongoingCamps;
}
}
}
/**
* The SimulationStatus message received on day n indicates that the
* calculation time is up and the agent is requested to send its bid bundle
* to the AdX.
*/
private void handleSimulationStatus(SimulationStatus simulationStatus) {
System.out.println("Day " + day + " : Simulation Status Received");
System.out.println("###SIMSTAT### " + simulationStatus.toString());
sendBidAndAds();
ImpressionCostEstimator();
System.out.println("Day " + day + " ended. Starting next day");
++day;
}
/**
* Miguel
*
*/
protected void sendBidAndAds() {
/**
* TODO: MB, Remove this block for final version
*/
// FileWriter csvWriter;
// try{
// csvWriter = new FileWriter("c:\\temp\\queries.csv");
// StringBuilder csvLine = new StringBuilder();
bidBundle = new AdxBidBundle();
int dayBiddingFor = day + 1;
double rbid = 10000.0;
/**
* add bid entries w.r.t. each active campaign with remaining contracted cmpBidMillis
* impressions.
*
* for now, a single entry per active campaign is added for queries of
* matching target segment.
*/
if ((dayBiddingFor >= currCampaign.dayStart)
&& (dayBiddingFor <= currCampaign.dayEnd)
&& (currCampaign.impsTogo() > 0)) {
int entCount = 0;
int qryCount = 0;
/**
* TODO: MB, Consider overachieving campaigns when quality < 1
*/
for (AdxQuery query : currCampaign.campaignQueries) {
if (currCampaign.impsTogo() - entCount > 0) {
//System.out.println("###QUERY### " + query.toString());
/**
* among matching entries with the same campaign id, the AdX
* randomly chooses an entry according to the designated
* weight. by setting a constant weight 1, we create a
* uniform probability over active campaigns(irrelevant because we are bidding only on one campaign)
*/
if (query.getDevice() == Device.pc) {
if (query.getAdType() == AdType.text) {
entCount++;
} else {
entCount += currCampaign.videoCoef;
}
} else {
if (query.getAdType() == AdType.text) {
entCount+=currCampaign.mobileCoef;
} else {
entCount += currCampaign.videoCoef + currCampaign.mobileCoef;
}
}
rbid = ImpressionBidCalculator(entCount - qryCount, query);
bidBundle.addQuery(query, rbid, new Ad(null), currCampaign.id, 1);
System.out.println("#####SENDBIDANDADS##### BidVal:" + rbid + " PPM:" + rbid/(entCount-qryCount));
//System.out.println("###QUERY### " + query.toString() + ", CampaingId: " + currCampaign.id);
qryCount = entCount;
}
}
double impressionLimit = currCampaign.impsTogo();
double budgetLimit = currCampaign.budget;
bidBundle.setCampaignDailyLimit(currCampaign.id,
(int) impressionLimit, budgetLimit);
System.out.println("Day " + day + " Bid Bundle: Updated " + entCount
+ " Bid Bundle entries for Campaign id " + currCampaign.id);
log.log(Level.ALL, "## Bid Bundle ##; currCampaign: " + currCampaign.id + "; " + (long)currCampaign.budget);
}
if (bidBundle != null) {
System.out.println("Day " + day + ": Sending BidBundle");
sendMessage(adxAgentAddress, bidBundle);
/*for (Map.Entry<Integer, CampaignData> campaign : myCampaigns.entrySet()) {
System.out.println("-----------------------------------------------------------------------------------------------------------------");
System.out.println("CAMPAIGN" + campaign.getValue().id + "-->"+ "reachImps = "+campaign.getValue().reachImps +"; dayStart = " + campaign.getValue().dayStart + "; dayEnd = "+ campaign.getValue().dayEnd + "; TargetSegmentSize = " + MarketSegment.usersInMarketSegments().get(campaign.getValue().targetSegment));// campaign.getValue().targetSegment.hashCode() );
System.out.println("----CAMPAIGN" + campaign.getValue().id + "--> Popularity:" + campaign.getValue().popInSegmentOfOurCampaign + ". ReservePrice Estimated:" + campaign.getValue().ReservePriceEstimated + ", ReservePrice Today" + campaign.getValue().ReservePriceThisDay + ". IMPRESSION COST ESTIMATE TODAY:" + campaign.getValue().impCostEstThisDay + "------");
System.out.println("-----------------------------------------------------------------------------------------------------------------");
}*/
}
}
/**
* Campaigns performance w.r.t. each allocated campaign
*/
private void handleCampaignReport(CampaignReport campaignReport) {
campaignReports.add(campaignReport);
/*
* for each campaign, the accumulated statistics from day 1 up to day
* n-1 are reported
*/
for (CampaignReportKey campaignKey : campaignReport.keys()) {
int cmpId = campaignKey.getCampaignId();
CampaignStats cstats = campaignReport.getCampaignReportEntry(
campaignKey).getCampaignStats();
myCampaigns.get(cmpId).setStats(cstats);
System.out.println("Day " + day + ": Updating campaign " + cmpId + " stats: "
+ cstats.getTargetedImps() + " tgtImps "
+ cstats.getOtherImps() + " nonTgtImps. Cost of imps is "
+ cstats.getCost());
}
}
/**
* Users and Publishers statistics: popularity and ad type orientation
*/
private void handleAdxPublisherReport(AdxPublisherReport adxPublisherReport) {
System.out.println("Publishers Report: ");
for (PublisherCatalogEntry publisherKey : adxPublisherReport.keys()) {
AdxPublisherReportEntry entry = adxPublisherReport
.getEntry(publisherKey);
System.out.println(entry.toString());
}
}
/**
*
* @param //AdNetworkReport
*/
private void handleAdNetworkReport(AdNetworkReport adnetReport) {
AdNetworkReportEntry repEntry;
System.out.println("Day " + day + " : AdNetworkReport: ");
for (AdNetworkKey adKey : adnetReport.keys()) {
repEntry = adnetReport.getEntry(adKey);
if(repEntry.getCost() > 0.0001) {
impressionBidHistory.impressionList.add(new ImpressionRecord(repEntry));
}
}
System.out.println("#####BIDIMPRHISTORY##### NItems " + impressionBidHistory.impressionList.size() +
"\n ### Male stats: " + impressionBidHistory.getStatsPerSegment(MarketSegment.MALE, null, null).toString() +
"\n ### Female-HighIncome stats: " + impressionBidHistory.getStatsPerSegment(MarketSegment.FEMALE, null, MarketSegment.HIGH_INCOME).toString());
}
@Override
protected void simulationSetup() {
day = 0;
bidBundle = new AdxBidBundle();
/* initial bid between 0.1 and 0.2 */
ucsBid = 0.2;
myCampaigns = new HashMap<Integer, CampaignData>();
campaignsInGame = new HashMap<Integer, CampaignData>();
log.fine("AdNet " + getName() + " simulationSetup");
impressionBidHistory.loadFile();
impressionBidHistory.saveFile();
}
@Override
protected void simulationFinished() {
impressionBidHistory.saveFile();
campaignSaveFile();
campaignReports.clear();
bidBundle = null;
}
/**
* A user visit to a publisher's web-site results in an impression
* opportunity (a query) that is characterized by the the publisher, the
* market segment the user may belongs to, the device used (mobile or
* desktop) and the ad type (text or video).
*
* An array of all possible queries is generated here, based on the
* publisher names reported at game initialization in the publishers catalog
* message
*/
private void generateAdxQuerySpace() {
if (publisherCatalog != null && queries == null) {
Set<AdxQuery> querySet = new HashSet<AdxQuery>();
/*
* for each web site (publisher) we generate all possible variations
* of device type, ad type, and user market segment
*/
for (PublisherCatalogEntry publisherCatalogEntry : publisherCatalog) {
String publishersName = publisherCatalogEntry
.getPublisherName();
for (MarketSegment userSegment : MarketSegment.values()) {
Set<MarketSegment> singleMarketSegment = new HashSet<MarketSegment>();
singleMarketSegment.add(userSegment);
querySet.add(new AdxQuery(publishersName,
singleMarketSegment, Device.mobile, AdType.text));
querySet.add(new AdxQuery(publishersName,
singleMarketSegment, Device.pc, AdType.text));
querySet.add(new AdxQuery(publishersName,
singleMarketSegment, Device.mobile, AdType.video));
querySet.add(new AdxQuery(publishersName,
singleMarketSegment, Device.pc, AdType.video));
}
/**
* An empty segments set is used to indicate the "UNKNOWN"
* segment such queries are matched when the UCS fails to
* recover the user's segments.
*/
querySet.add(new AdxQuery(publishersName,
new HashSet<MarketSegment>(), Device.mobile,
AdType.video));
querySet.add(new AdxQuery(publishersName,
new HashSet<MarketSegment>(), Device.mobile,
AdType.text));
querySet.add(new AdxQuery(publishersName,
new HashSet<MarketSegment>(), Device.pc, AdType.video));
querySet.add(new AdxQuery(publishersName,
new HashSet<MarketSegment>(), Device.pc, AdType.text));
}
queries = new AdxQuery[querySet.size()];
querySet.toArray(queries);
}
}
/*generates an array of the publishers names
* */
private void getPublishersNames() {
if (null == publisherNames && publisherCatalog != null) {
ArrayList<String> names = new ArrayList<String>();
for (PublisherCatalogEntry pce : publisherCatalog) {
names.add(pce.getPublisherName());
}
publisherNames = new String[names.size()];
names.toArray(publisherNames);
}
}
/*
* generates the campaign queries relevant for the specific campaign, and assign them as the campaigns campaignQueries field
*/
private void genCampaignQueries(CampaignData campaignData) {
Set<AdxQuery> campaignQueriesSet = new HashSet<AdxQuery>();
for (String PublisherName : publisherNames) {
campaignQueriesSet.add(new AdxQuery(PublisherName,
campaignData.targetSegment, Device.mobile, AdType.text));
campaignQueriesSet.add(new AdxQuery(PublisherName,
campaignData.targetSegment, Device.mobile, AdType.video));
campaignQueriesSet.add(new AdxQuery(PublisherName,
campaignData.targetSegment, Device.pc, AdType.text));
campaignQueriesSet.add(new AdxQuery(PublisherName,
campaignData.targetSegment, Device.pc, AdType.video));
}
campaignData.campaignQueries = new AdxQuery[campaignQueriesSet.size()];
campaignQueriesSet.toArray(campaignData.campaignQueries);
//System.out.println("!!!!!!!!!!!!!!!!!!!!!!"+Arrays.toString(campaignData.campaignQueries)+"!!!!!!!!!!!!!!!!");
}
/**
* Definition of class Campaign Data which stores all variables and statistics associated with campaigns.
*/
private class CampaignData {
/* campaign attributes as set by server */
int game;
Long reachImps;
long dayStart;
long dayEnd;
Set<MarketSegment> targetSegment;
double videoCoef;
double mobileCoef;
int id;
private AdxQuery[] campaignQueries;//array of queries relevant for the campaign.
/* campaign info as reported */
CampaignStats stats; // targeted imps, other imps and cost of imps
double budget;
double revenue;
double profitEstimate;
double cmpBid;
long impressionTarget;
double uncorrectedProfitEstimate;
double costEstimate;
double estImpCost;
double estUcsCost;
double qualityChange;
double estQualityChange;
double ucsCost;
/* Performance data */
double estCostAcc;
double estProfitAcc;
double uncorrectedProfitAcc;
double estQualityChangeAcc;
double impTargetFulfillment;
double bidVs2ndRatio;
double profit;
double profitPerImpression;
double reachFulfillment;
double estUcsCostAcc;
double popInSegmentOfOurCampaign;
double impCostAvg;
double ReservePriceEstimated;
double ReservePriceThisDay;
double impressionCostEstimate;
double impCostEstThisDay;
public CampaignData(InitialCampaignMessage icm) {
reachImps = icm.getReachImps();
dayStart = icm.getDayStart();
dayEnd = icm.getDayEnd();
targetSegment = icm.getTargetSegment();
videoCoef = icm.getVideoCoef();
mobileCoef = icm.getMobileCoef();
id = icm.getId();
stats = new CampaignStats(0, 0, 0);
budget = 0.0;
impressionTarget = reachImps;
revenue = 0;
profit = 0.0;
ucsCost = 0;
profitEstimate = 0.0;
uncorrectedProfitEstimate = 0.0;
costEstimate = 0.0;
estCostAcc = 0.0;
estProfitAcc = 0.0;
uncorrectedProfitAcc = 0.0;
impTargetFulfillment = 0.0;
estUcsCostAcc = 0.0;
bidVs2ndRatio = 0.0;
profit = 0.0;
profitPerImpression = 0.0;
reachFulfillment = 0.0;
estImpCost = 0.0;
estUcsCost = 0.0;
qualityChange = 0.0;
estQualityChange = 0.0;
estQualityChangeAcc = 0.0;
popInSegmentOfOurCampaign = 0;
impCostAvg = 0;
ReservePriceEstimated = 0;
ReservePriceThisDay = 0;
impCostEstThisDay = 0;
impressionCostEstimate = 0;
game = startInfo.getSimulationID();
}
public CampaignData(int game, Long reachImps, long dayStart, long dayEnd, Set<MarketSegment> targetSegment,
double videoCoef, double mobileCoef, int id, AdxQuery[] campaignQueries,
CampaignStats cstats, double budget, double revenue, double profitEstimate,
double cmpBid, long impressionTarget, double uncorrectedProfitEstimate,
double costEstimate, double estImpCost, double estUcsCost, double qualityChange,
double estQualityChange, double ucsCost, double estCostAcc, double estProfitAcc,
double uncorrectedProfitAcc, double estQualityChangeAcc, double impTargetFulfillment,
double bidVs2ndRatio, double profit, double profitPerImpression, double reachFulfillment,
double estUcsCostAcc) {
this.game = game;
this.reachImps = reachImps;
this.dayStart = dayStart;
this.dayEnd = dayEnd;
this.targetSegment = targetSegment;
this.videoCoef = videoCoef;
this.mobileCoef = mobileCoef;
this.id = id;
this.campaignQueries = campaignQueries;
this.stats = cstats;
this.budget = budget;
this.revenue = revenue;
this.profitEstimate = profitEstimate;
this.cmpBid = cmpBid;
this.impressionTarget = impressionTarget;
this.uncorrectedProfitEstimate = uncorrectedProfitEstimate;
this.costEstimate = costEstimate;
this.estImpCost = estImpCost;
this.estUcsCost = estUcsCost;
this.qualityChange = qualityChange;
this.estQualityChange = estQualityChange;
this.ucsCost = ucsCost;
this.estCostAcc = estCostAcc;
this.estProfitAcc = estProfitAcc;
this.uncorrectedProfitAcc = uncorrectedProfitAcc;
this.estQualityChangeAcc = estQualityChangeAcc;
this.impTargetFulfillment = impTargetFulfillment;
this.bidVs2ndRatio = bidVs2ndRatio;
this.profit = profit;
this.profitPerImpression = profitPerImpression;
this.reachFulfillment = reachFulfillment;
this.estUcsCostAcc = estUcsCostAcc;
}
public CampaignData(CampaignOpportunityMessage com) {
dayStart = com.getDayStart();
dayEnd = com.getDayEnd();
id = com.getId();
reachImps = com.getReachImps();
targetSegment = com.getTargetSegment();
mobileCoef = com.getMobileCoef();
videoCoef = com.getVideoCoef();
stats = new CampaignStats(0, 0, 0);
budget = 0.0;
cmpBid = 0.0;
estUcsCostAcc = 0.0;
impressionTarget = reachImps;
revenue = 0;
profit = 0.0;
profitEstimate = 0.0;
uncorrectedProfitEstimate = 0.0;
costEstimate = 0.0;
reachFulfillment = 0.0;
estImpCost = 0.0;
qualityChange = 0.0;
estUcsCost = 0.0;
estQualityChange = 0.0;
ucsCost = 0;
estQualityChangeAcc = 0.0;
game = startInfo.getSimulationID();
popInSegmentOfOurCampaign = 0;
impCostAvg = 0;
ReservePriceEstimated = 0;
ReservePriceThisDay = 0;
impCostEstThisDay = 0;
impressionCostEstimate = 0;
}
// updates campaign statistics after it has ended
public void update(double revenue) {
this.setRevenue(revenue);
this.setProfit();
this.setEstCostAcc();
this.setUncorrectedProfitAcc();
this.setEstProfitAcc();
this.setImpTargetFulfillment();
this.setProfitPerImpression();
this.setReachFulfillment();
this.setBidVs2ndRatio();
this.setQualityChange();
this.setEstQualityChangeAcc();
this.setEstUcsCostAcc();
}
// Setters
// TODO ALUN: debug setters
public void setQualityChange() {
// Detects change in quality score from yesterday,
// attributes change equally to all campaigns ended in that time
System.out.println("Quality:" + adNetworkDailyNotification.getQualityScore() + "yesterday's quality" + quality
+ "estimated quality change:" + this.estQualityChange);
int count=0;
for (Map.Entry<Integer, CampaignData> entry : myCampaigns.entrySet()) {
long end = entry.getValue().dayEnd;
if (end == day - 1) {count++;}
}
qualityChange = (adNetworkDailyNotification.getQualityScore() - quality)/count;
quality = adNetworkDailyNotification.getQualityScore();
}
public void setEstQualityChangeAcc() {
estQualityChangeAcc = estQualityChange / qualityChange;
}
public void setEstUcsCostAcc() {
estUcsCostAcc = estUcsCost / ucsCost;
}
public void setBudget(double d) { budget = d; }
public void setRevenue(double r) { revenue = r; }
public void setBid(double b) { cmpBid = b; }
public void setEstCostAcc(){
estCostAcc = estImpCost / stats.getCost();
}
public void setEstProfitAcc(){
estProfitAcc = (profitEstimate) / profit;
}
public void setUncorrectedProfitAcc(){
uncorrectedProfitAcc = (uncorrectedProfitEstimate) / profit;
}
public void setReachFulfillment(){
reachFulfillment = (stats.getTargetedImps() + stats.getOtherImps()) / reachImps;
}
public void setImpTargetFulfillment(){
impTargetFulfillment = (stats.getTargetedImps() + stats.getOtherImps()) / impressionTarget;
}
public void setBidVs2ndRatio(){
bidVs2ndRatio = this.cmpBid * adNetworkDailyNotification.getQualityScore() / budget;
}
public void setProfit(){
profit = revenue - stats.getCost();
}
public void setProfitPerImpression(){
profitPerImpression = profit / (stats.getTargetedImps() + stats.getOtherImps());
}
@Override
// toString returns only the server stored statistics on a campaign
public String toString() {
return "Campaign ID " + id + ": " + "day " + dayStart + " to "
+ dayEnd + " " + targetSegment + ", reach: " + reachImps
+ " coefs: (v=" + videoCoef + ", m=" + mobileCoef + ")";
}
// ToWrite returns all the stats for writing to CSV files
public String toWrite() {
return startInfo.getSimulationID() + "," + id + "," + dayStart + "," + dayEnd + "," + reachImps + ","
+ targetSegment.toString().replace(',',':') + "," + videoCoef + ","
+ mobileCoef + "," + stats.getCost() + "," + stats.getTargetedImps() + "," + stats.getOtherImps() + ","
+ budget + "," + revenue + "," + profitEstimate + "," + cmpBid + "," + impressionTarget + "," +
uncorrectedProfitEstimate + "," + costEstimate + "," + estImpCost + "," +
estUcsCost + "," + qualityChange + "," + estQualityChange + "," + ucsCost + "," + estCostAcc
+ "," +estProfitAcc + "," + uncorrectedProfitAcc + "," + estQualityChangeAcc + "," + impTargetFulfillment
+ "," + bidVs2ndRatio + "," + profit + "," + profitPerImpression + "," + reachFulfillment + "," +
estUcsCostAcc;
}
//CSV file header
final String FILE_HEADER = "id,dayStart,dayEnd,reachImps,targetSegment,videoCoef,mobileCoef," +
"adxCost,targetedImps,untargetedImps,budget,revenue,profitEstimate,cmpBid,impressionTarget," +
"uncorrectedProfitEstimate,costEstimate,estImpCost,estUcsCost,qualityChange,estQualityChange," +
"ucsCost,estCostAcc,estProfitAcc,uncorrectedProffitAcc,estQualityChangeAcc,impTargetFulfillment," +
"bidVs2ndRatio,profit,profitPerImpression,reachFulfillment,estUcsCostAcc";
int impsTogo() {
return (int) Math.max(0, reachImps - stats.getTargetedImps());
}
void setStats(CampaignStats s) {
stats.setValues(s);
}
public AdxQuery[] getCampaignQueries() {
return campaignQueries;
}
public void setCampaignQueries(AdxQuery[] campaignQueries) {
this.campaignQueries = campaignQueries;
}
/**
* Calculates an estimate for impression targets (and profit) to maximise estimated profit.
* Considers the effect of short term cost of the campaign, long term effect of quality change
* and inaccuracies in previous predictions. By evaluating estimated profits for a variety of
* different impression targets.
*/
private void setImpressionTargets() {
long target = 0;
double estProfit = -99999, ERR, estQuality = 0, estCost = 0;
// Consider a range of possible impression targets
for (double multiplier = 0.6; multiplier <= 2; multiplier+= 0.02){ // loop over range of impression targets
long tempTarget = (long)(this.reachImps*multiplier);
// Estimate quality change
double currentQuality = adNetworkDailyNotification.getQualityScore();
double lRate = 0.6, Budget;
ERR = ERRcalc(this, target);
double tempEstQuality = (1 - lRate)*currentQuality + lRate*ERR;
// If we haven't won the campaign yet estimate the budget.
if (this.budget != 0){ Budget = this.budget; }
else Budget = 0; //TODO ALUN: mean budget/impression from past * impressions;
// Budget = sliding scale of historic average budget to game average budget
// Go from 100% historical to 50% historical
// Evaluate per impression then multiply by number of impressions
// Loop over entries in the game and calculate an average
// Loop over entries in the history and take an average
// Estimate cost to run campaign at this level
double tempEstCost = campaignCost(this, tempTarget, false);
double tempEstProfit = Budget * ERR + qualityEffect(this, estQuality) - tempEstCost;
// Decide which impression target is most cost efficient
if (tempEstProfit > estProfit) {
target = tempTarget;
estProfit = tempEstProfit;
estCost = tempEstCost;
estQuality = tempEstQuality;
}
}
// Save ucs cost and impression cost estimate to the campaign.
campaignCost(this, target, true);
// Factor in any bias we may have (adjust for difference in prediction and result)
// TODO historic data
double cumProfitEstimate = 0.0;
double cumProfit = 0.0;
// calculate total profit and estimated profit from ended campaigns.
for (Map.Entry<Integer, CampaignData> entry : myCampaigns.entrySet()) {
if (entry.getValue().dayEnd < day){
CampaignData campaign = entry.getValue();
cumProfit += campaign.profit;
cumProfitEstimate += campaign.uncorrectedProfitEstimate;
}
}
// error factor: ratio between average profit and average estimated profit
double profitError = cumProfit / cumProfitEstimate;
uncorrectedProfitEstimate = estProfit - qualityEffect(this,estQuality);
profitEstimate = uncorrectedProfitEstimate * profitError;
impressionTarget = target;
costEstimate = estCost;
}
}
/**
* Class for storing campaign data from previous games to be used in historic calculations
*/
private class historicCampaignData {
public ArrayList<CampaignData> historicCampaigns;
public historicCampaignData() {
historicCampaigns = new ArrayList<>();
}
public int getNumberOfRecords() {
return historicCampaigns.size();
}
public CampaignData getValue(int i) {
return historicCampaigns.get(i);
}
// Calculates the Xth% quantile
// Allows for flexible conservatism
public double expectedLowBid(int confidence){
DescriptiveStatistics statsCalc = new DescriptiveStatistics();
for (CampaignData rEntry : historicCampaigns) {
if (rEntry.profit < 0) {
statsCalc.addValue(rEntry.cmpBid/(rEntry.stats.getTargetedImps()+rEntry.stats.getOtherImps()));
}
}
double quantile = statsCalc.getPercentile(confidence);
double mean = statsCalc.getMean();
return quantile*pendingCampaign.reachImps;
}
// Sets the maximum bid price to be 1.1 * the average of top 10% of successful historic campaigns
public double expectedHighBid(double confidence){
DescriptiveStatistics statsCalc = new DescriptiveStatistics();
for (CampaignData rEntry : historicCampaigns) {
// for non randomly assigned campaigns
if((rEntry.budget - rEntry.cmpBid) > 0.001){
statsCalc.addValue(rEntry.cmpBid/rEntry.reachImps);
}
}
double quantile = statsCalc.getPercentile(confidence);
return quantile*pendingCampaign.reachImps;
}
/* DescriptiveStatistics statsCalc = new DescriptiveStatistics();
double mean = 0;
for(ImpressionRecord rEntry : impressionList) {
if(rEntry.segGender == sGender) {
statsCalc.addValue(rEntry.costImpr);
}
}
mean = statsCalc.getMean();
System.out.println("#####STATMEAN##### Historic mean per gender " + sGender + ":" + mean);
return mean;
} */
/**
* Loads the historic campaign data from the csv file in filepath
*/
public void loadDataFromFile(String filepath) {
try {
Scanner scanner = new Scanner(new FileReader(filepath));
String line;
line = scanner.nextLine();
CampaignData record;
scanner.nextLine();
while(scanner.hasNextLine()) {
line = scanner.nextLine();
String[] results = line.split(",");
int game = Integer.parseInt(results[0]);
int id = Integer.parseInt( results[1] );
long dayStart = Long.parseLong(( results[2] ));
long dayEnd = Long.parseLong(( results[3] ));
Long reachImps = Long.parseLong(( results[4] ));
String targetSegment = results[5]; //TODO ALUN: store target segment as correct type
double videoCoef = Double.parseDouble((results[6]));
double mobileCoef = Double.parseDouble((results[7]));
double adxCost = Double.parseDouble((results[8]));
double targetedImps = Double.parseDouble((results[9]));
double untargetedImps = Double.parseDouble((results[10]));
double budget = Double.parseDouble((results[11]));
double revenue = Double.parseDouble((results[12]));
double profitEstimate = Double.parseDouble((results[13]));
double cmpBid = Double.parseDouble((results[14]));
long impressionTarget = Long.parseLong(( results[15] ));
double uncorrectedProfitEstimate = Double.parseDouble((results[16]));
double costEstimate = Double.parseDouble((results[17]));
double estImpCost = Double.parseDouble((results[18]));
double estUcsCost = Double.parseDouble((results[19]));
double qualityChange = Double.parseDouble((results[20]));
double estQualityChange = Double.parseDouble((results[21]));
double ucsCost = Double.parseDouble((results[22]));
double estCostAcc = Double.parseDouble((results[23]));
double estProfitAcc = Double.parseDouble((results[24]));
double uncorrectedProfitAcc = Double.parseDouble((results[25]));
double estQualityChangeAcc = Double.parseDouble((results[26]));
double impTargetFulfillment = Double.parseDouble((results[27]));
double bidVs2ndRatio = Double.parseDouble((results[28]));
double profit = Double.parseDouble((results[29]));
double profitPerImpression = Double.parseDouble((results[30]));
double reachFulfillment = Double.parseDouble((results[31]));
double estUcsCostAcc = Double.parseDouble((results[32]));
//TODO ALUN: fix target segment and campaign queries
record = new CampaignData(game,reachImps, dayStart, dayEnd, currCampaign.targetSegment, videoCoef, mobileCoef, id,
currCampaign.campaignQueries, new CampaignStats(targetedImps,untargetedImps,adxCost),budget, revenue, profitEstimate, cmpBid,
impressionTarget, uncorrectedProfitEstimate, costEstimate, estImpCost, estUcsCost,
qualityChange, estQualityChange, ucsCost, estCostAcc, estProfitAcc, uncorrectedProfitAcc,
estQualityChangeAcc, impTargetFulfillment, bidVs2ndRatio, profit, profitPerImpression,
reachFulfillment, estUcsCostAcc);
historicCampaigns.add(record);
}
scanner.close();
} catch (Exception e) {
System.out.println("Error: " + e.getMessage());
}
}
}
/**
* User defined methods
*/
/*
* ALUN: different methods for each campaign strategy
*/
public double expectedLowBid(double confidence){
DescriptiveStatistics statsCalc = new DescriptiveStatistics();
int numUnprofitable = 0;
// only list unprofitable campaigns
for (Map.Entry<Integer, CampaignData> entry : myCampaigns.entrySet()) {
CampaignData campaign = entry.getValue();
if (campaign.profit < 0) {
numUnprofitable++;
statsCalc.addValue(campaign.cmpBid/campaign.reachImps);
}
}
double lowBid = statsCalc.getPercentile(confidence);
// Only returns a value if there are enough datapoints
if (numUnprofitable <= 3) {lowBid = 0;}
return lowBid*pendingCampaign.reachImps;
}
// Returns maximum value in the current game
public double expectedHighBid(){
DescriptiveStatistics statsCalc = new DescriptiveStatistics();
// only list non-randomly given campaigns
for (Map.Entry<Integer, CampaignData> entry : myCampaigns.entrySet()) {
CampaignData campaign = entry.getValue();
if (campaign.profit < 0) {
statsCalc.addValue(campaign.cmpBid/campaign.reachImps);
}
}
double highBid = statsCalc.getMax();
return highBid*pendingCampaign.reachImps;
}
// Method for calculating an ERR value for a specific target.
private double ERRcalc(CampaignData campaign, long target) {
double a = 4.08577, b = 3.08577, fracComplete = (double)target/(double)campaign.reachImps;
double ERR = (2/a) * (( Math.atan((a*fracComplete) - b )) - Math.atan(-b));
return ERR;
}
/**
Goes through historical (previously trained) data and evaluates when the bid is too low to be profitable
at a confidence level given.
Does not take into account environmental factors (is not a prediction of profitability) just a lower bound.
Therefore keep the confidence high
NOTE: this function should be turned off while training historical data
*/
private double bidTooLow(long cmpimps, int confidence) {
// Scales between historic and current values
// gets median value of unprofitable campaigns (removes 2 s.d. from that and sets as minimum bid)
// Median so outliers don't push it too far, 2 s.d. to be conservative because no other variables being considered
double bidLowCurrent = expectedLowBid(confidence);
double bidLowHistoric = historicCampaigns.expectedLowBid(confidence);
int length = startInfo.getNumberOfDays();
if(bidLowCurrent == 0) bidLowCurrent = bidLowHistoric;
double bidLow = (HISTORIC_FRAC * bidLowHistoric * (length - day)/length) +
((1-HISTORIC_FRAC) * bidLowCurrent * day/length);
double reserve = cmpimps * 0.0001 / adNetworkDailyNotification.getQualityScore();
if (bidLow < reserve) {bidLow = reserve;}
System.out.println(" Min: " + (long)(bidLow*1000));
return bidLow;
}
/**
* Goes through all previously successful bids and evaulates the maximum value to which
* a successful bid can be place, either the 90% quantile of previous games, max successful
*campaign in this game (or reserve price).
*/
private double bidTooHigh(long cmpimps, int percentFailure) {
double bidHighHistoric = historicCampaigns.expectedHighBid(percentFailure);
double bidHighCurrent = expectedHighBid();
double reserve = (0.001*cmpimps*percentFailure)/100;
double bidHigh = Math.min(1.1*Math.max(bidHighHistoric, bidHighCurrent), reserve);
// Make sure bid is still below maximum price.
double bidMax = 0.001 * cmpimps * adNetworkDailyNotification.getQualityScore();
if(bidHigh >= reserve) {bidHigh = bidMax;}
System.out.print(" MaxBid: " + (long)(1000*bidMax) + " MinMax: " + (long)(1000*bidHigh));
return bidHigh;
}
/**
* Method for computing campaign bid to maximise profit
* Currently just bids randomly between min and max as before
* In progress: version will bid the average successful second price.
* Not great because it creates a system where we assign our value based on other agents value.
*/
private double campaignProfitStrategy() {
Random random = new Random();
double bid, bidFactor;
double totalCostPerImp = 0.0;
if (myCampaigns.size() > 1) {
for (Map.Entry<Integer, CampaignData> entry : myCampaigns.entrySet()) {
if (entry.getValue().dayStart != 1) {
totalCostPerImp += entry.getValue().budget / entry.getValue().reachImps;
}
}
bidFactor = (random.nextInt(40)/100) + 0.8;
bid = pendingCampaign.reachImps * totalCostPerImp / (myCampaigns.size() -1) * bidFactor;
}
else bid = (double)random.nextInt(pendingCampaign.reachImps.intValue())/1000; //Random bid initially
System.out.println("Day " + day + ": Campaign - Base bid(millis): " + (long)(1000*bid));
return bid;
/* Main strategy
* estimates the cost of pendingCampaign - campaignCost(pendingCampaign);
* Add some level of minimum profit (risk)
* Bid this value... easy peasy.
* pendingCampaign.setImpressiontarget();
* return (pendingCampaign.estProfit + pendingCampaign.estCost ) * 1.1;
*/
}
/*
* Method for computing the quality recovery campaign bid strategy
* Multiply profit strategy by quality squared, first to turn our bid into an effective bid.
* Second to try and win more campaigns than our value assigns.
* Quality associated with revenue is accounted for already, this effect is to account for
* the reduced number of won campaigns.
*/
private double campaignQualityRecoveryStrategy() {
double bid = campaignProfitStrategy() * Math.pow(adNetworkDailyNotification.getQualityScore(),2);
System.out.println("Day " + day + ": Campaign - Quality Recovery Strategy");
/*
TODO ALUN: Historic Data
TODO: ferocity of quality recovery should be based on our ability to complete the campaigns and the number of campaigns we currently have.
- if impression targets for current campaigns is above average impressions per day then have a negative
quality recovery effect.
*/
// Retrieve average impressions per day
// This isn't great because it doesn't represent the number of impressions we COULD get per day.
// Retrieve sum of impression targets for current campaiagns.
// Augment bid by profit strategy * quality rating * fraction of
return bid;
}
/*
* Method for computing the campaign bid for starting strategy
* TODO ALUN: Evaluate how to base these weights.
*/
private double campaignStartingStrategy() {
double cmpBid;
long campaignLength = pendingCampaign.dayEnd - pendingCampaign.dayStart + 1;
if(campaignLength == 10){ // long campaign
cmpBid = campaignProfitStrategy()*0.8;
System.out.println("Day " + day + ": Campaign - Long campaign Starting Strategy");
}
else if (campaignLength == 5){ // medium campaign
cmpBid = campaignProfitStrategy()*1.5;
System.out.println("Day: " + day + " Campaign - Medium campaign Starting Strategy");
}
else { // short campaign
cmpBid = campaignProfitStrategy()*2;
System.out.println("Day " + day + ": Short campaign Starting Strategy");
}
return cmpBid;
}
/*
* Evaluates the effect of estimated quality change on future revenue.
*/
private double qualityEffect(CampaignData Campaign, double estQuality) {
// Days remaining after campaign ends
long daysRemaining = 60 - Campaign.dayEnd;
double pastIncome = 0.0;
for (Map.Entry<Integer, CampaignData> entry : myCampaigns.entrySet()) {
CampaignData campaign = entry.getValue();
if (campaign.dayEnd < day)
pastIncome += campaign.revenue;
else { // Smooths out estimate by adding fractional completeness of ongoing campaigns (approximated by budget)
pastIncome += campaign.budget * (1 - campaign.impsTogo()/campaign.reachImps);
}
}
double historicDailyIncome = 1;// TODO ALUN: machine learning
double pastDailyIncome = pastIncome / day;
// Linearly reduces reliance on historic data --> dynamic data over time
long revenueRemaining = (long)((daysRemaining/60)*daysRemaining*historicDailyIncome
+ pastDailyIncome*(1-daysRemaining/60)*daysRemaining);
double qualityChange = estQuality - adNetworkDailyNotification.getQualityScore();
// todo use a more accurate model than linear quality change * revenueRemaining
return qualityChange * revenueRemaining;
}
/*
* Estimates the total cost of running a campaign based on the sum UCS and impression estimation functions.
* Total cost = impression cost of campaign + ucs cost
*/
private double campaignCost(CampaignData Campaign, long targetImp, boolean save) {
double totalCost = 0;
double impressionCost = 0;
double ucsCost = 0;
// todo campaign cost = cost paid of past impressions paid for + cost of future impressions
// todo try not to include ucs cost twice for overlapping campaigns.
// loop over each day of the campaign
if( Campaign.dayEnd < day) {totalCost = Campaign.stats.getCost();} //todo include historic ucs cost here
else
for (int Day = (int)Campaign.dayStart; Day <= (int)Campaign.dayEnd; Day++) {
if (Day < day){
totalCost += Campaign.stats.getCost();
Day = day -1; // Because reports cumulative stats.
}
// evaluate best UCS/impression cost combination estimation
ucsTargetLevel = bestImpUcsCombination(targetImp);
// add the UCS cost to the Impression cost estimate and sum
// TODO add desperation coefficient to bid
impressionCost += impressionCostEstimate(targetImp/(Campaign.dayEnd-Campaign.dayStart), Day, ucsTargetLevel);
ucsCost += ucsCostEstimate(ucsTargetLevel); //todo divide ucs cost by #overlapping campaigns
}
if ((save == true)& (day == Campaign.dayStart - 1)) {Campaign.estImpCost = impressionCost; Campaign.estUcsCost = ucsCost;};
totalCost += impressionCost + ucsCost;
return totalCost;
}
/**
// Write a class of performance metrics which update daily throughout the game (and print out)
// Print these performance metrics to a file so they can be manually inspected.
// estimated cost accuracy, estimated profit accuracy, impression target fulfillment, price bid vs second price.
// Profit, profit per impression.
*/
private class PerformanceData {
// averages over campaigns
double avBidVs2ndRatio;
double avReachImps;
double profitPerImpression;
double reachFulfillment;
long daystart; // Average day we bought campaigns in the game.
double perDayUcsCost;
double perImpImpCost;
double perImpTargetedImpCost;
double perImpUntargetedImpCos;
double perDayImp;
double perDayTargetedImp;
double perDayUntargetedImp;
double cmpProportionShort;
double cmpProportionMedium;
double cmpProportionLong;
double cmpProportionLowReach;
double cmpProportionMedReach;
double getCmpProportionHighReach;
double cmpBudget;
double cmpBid;
double cmpRevenue;
double targetPerReach; // impression target set per impression in the campaign
// Estimates
double profitEstimate;
double getUncorrectedProfitEstimate;
// Prediction ability
double impTargetFulfillment;
double estCostAcc;
double estUcsCostAcc;
double estImpCostAcc;
double estProfitAcc;
double uncorrectedProfitEstimateAcc;
// Running totals
double revenue;
double profit;
int numCamps;
double ucsCost;
double impCost;
/* Possible additions
* Overlapping segments (average number of competitors & average % of user population bid for)
*
*/
public PerformanceData() {
estCostAcc = 0.0;
estProfitAcc = 0.0;
impTargetFulfillment = 0.0;
reachFulfillment = 0.0;
avBidVs2ndRatio= 0.0;
profit = 0.0;
profitPerImpression = 0.0;
revenue= 0.0;
numCamps = 0;
uncorrectedProfitEstimateAcc=0.0;
estUcsCostAcc =0.0;
estImpCostAcc =0.0;
}
public void setReachFulfillment(CampaignData a) {
reachFulfillment = (reachFulfillment * (numCamps - 1) + a.reachFulfillment) / numCamps;
}
public void setEstUcsCostAcc(CampaignData a) {
estUcsCostAcc = (estUcsCostAcc * (numCamps - 1) + a.estUcsCost) / numCamps;
}
public void setEstImpCostAcc(CampaignData a) {
estImpCostAcc = (estImpCostAcc * (numCamps - 1) + a.estImpCost) /numCamps;
}
public void setEstCostAcc(CampaignData a) {
estCostAcc = (estCostAcc * (numCamps - 1) + a.estCostAcc) / numCamps;
}
public void setEstProfitAcc(CampaignData b){
estProfitAcc = (estProfitAcc * (numCamps - 1) + b.estProfitAcc) / numCamps;
}
public void setUncorrectedProfitEstimate(CampaignData b){
uncorrectedProfitEstimateAcc = (uncorrectedProfitEstimateAcc * (numCamps - 1) + b.uncorrectedProfitEstimate) / numCamps;
}
public void setImpTargetFulfillment(CampaignData c){
impTargetFulfillment = (impTargetFulfillment * (numCamps - 1) + c.impTargetFulfillment) / numCamps;
}
public void setBidVs2ndRatio(CampaignData d) {
if (d.budget != d.cmpBid){
avBidVs2ndRatio = (avBidVs2ndRatio * (numCamps - 1) + d.bidVs2ndRatio) / numCamps;
}
}
public void setProfit(CampaignData e){
profit += e.profit;
}
public void setRevenue(CampaignData e){
revenue += e.revenue;
}
public void setProfitPerImpression(CampaignData f){
profitPerImpression = (profitPerImpression * (numCamps - 1) + f.profitPerImpression) / numCamps;
}
public void incrementNumCamps(){ numCamps = numCamps + 1;}
public void updateData(CampaignData x){
incrementNumCamps();
setEstCostAcc(x);
setEstProfitAcc(x);
setImpTargetFulfillment(x);
setBidVs2ndRatio(x);
setProfit(x);
setRevenue(x);
setProfitPerImpression(x);
setUncorrectedProfitEstimate(x);
setEstImpCostAcc(x);
setEstUcsCostAcc(x);
setReachFulfillment(x);
setEstUcsCostAcc(x);
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Impression cost estimate
* This method takes an impression target as an input and evaluates the estimated cost to achieve that value given
* the day and UCS target.
* Again later it will be useful to be able to estimate costs for a range of impressions to choose a local optimum.
* May include functionality to recall past actual costs / estimates.
* USE: use this function for campaign bids by evaluating the best impression/UCS combination then summing over
* all days of the prospective campaign to evaluate total cost to complete campaign.
*/
private double impressionCostEstimate(long impTarget, long day, int ucsTargetLevel) {
return 0.0006*impTarget;
}
private double ImpressionCostEstimator() {
double EstimateCostOfImpressionsToday = 0;
CampaignData itemFor1, itemFor2;
// TODO;
try {
/*for (CampaignData itemFor2 : campaignsInGame) {
System.out.println("##################################3 " + day);
System.out.println(itemFor2);
}*/
/*for (Map.Entry<Integer, CampaignData> campaignInGame : campaignsInGame.entrySet()) {
System.out.println("algo???");
System.out.println(campaignInGame.getValue().dayStart);
}*/
for (Map.Entry<Integer, CampaignData> campaign : myCampaigns.entrySet()) {
itemFor1 = campaign.getValue();
if (itemFor1.dayStart <= day) {
if (itemFor1.dayEnd >= day) {
itemFor1.popInSegmentOfOurCampaign = 1;
itemFor1.popInSegmentOfOurCampaign = itemFor1.reachImps / ((double) (itemFor1.dayEnd - itemFor1.dayStart) * (double) MarketSegment.usersInMarketSegments().get(itemFor1.targetSegment));
//System.out.println("Popularity of our campaign: " + itemFor1.popInSegmentOfOurCampaign);
/*itemFor1.popInSegmentOfOurCampaign = itemFor1.reachImps / ((itemFor1.dayEnd - itemFor1.dayStart));
System.out.println("Popularity of our campaign (1): " + itemFor1.popInSegmentOfOurCampaign);
itemFor1.popInSegmentOfOurCampaign = itemFor1.reachImps / (MarketSegment.usersInMarketSegments().get(itemFor1.targetSegment));
System.out.println("Popularity of our campaign (2): " + itemFor1.popInSegmentOfOurCampaign);
itemFor1.popInSegmentOfOurCampaign = 1 / ((double)(itemFor1.dayEnd - itemFor1.dayStart) * (double)MarketSegment.usersInMarketSegments().get(itemFor1.targetSegment));
System.out.println("Popularity of our campaign (3): " + itemFor1.popInSegmentOfOurCampaign);
*/
for (Map.Entry<Integer, CampaignData> campInGame : campaignsInGame.entrySet()) {
itemFor2 = campInGame.getValue();
/*System.out.println("Campaigns thrown by the game " + itemFor2.id);*/
if (itemFor2.dayStart <= day) {
if (itemFor2.dayEnd >= day) {
if (itemFor2.id != itemFor1.id) {
if (itemFor1.targetSegment.contains(MarketSegment.MALE)) {
if (!itemFor2.targetSegment.contains(MarketSegment.FEMALE)) {
//System.out.println("Competing campaign: " + itemFor2.id + "not female");
if (itemFor1.targetSegment.contains(MarketSegment.OLD)) {
if (!itemFor2.targetSegment.contains(MarketSegment.YOUNG)) {
if (itemFor1.targetSegment.contains(MarketSegment.HIGH_INCOME)) {
if (!itemFor2.targetSegment.contains(MarketSegment.LOW_INCOME)) {
itemFor1.popInSegmentOfOurCampaign = itemFor1.popInSegmentOfOurCampaign + itemFor2.reachImps / ((double) (itemFor2.dayEnd - itemFor2.dayStart) * (double) MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment));
/*System.out.println("PRUEBA PRUEBA PRUEBA PRUEBA PRUEAB PRUEBA");
System.out.println("Campaign competing: " + campInGame + "size of MARKET SEGMENT" + MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment) + "; with OUR campaign: " + campaign + "size of OUR marketSegment" + MarketSegment.usersInMarketSegments().get(itemFor1.targetSegment));
*/
}
} else if (itemFor1.targetSegment.contains(MarketSegment.LOW_INCOME)) {
if (!itemFor2.targetSegment.contains(MarketSegment.HIGH_INCOME)) {
itemFor1.popInSegmentOfOurCampaign = itemFor1.popInSegmentOfOurCampaign + itemFor2.reachImps / ((double) (itemFor2.dayEnd - itemFor2.dayStart) * (double) MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment));
/*System.out.println("PRUEBA PRUEBA PRUEBA PRUEBA PRUEAB PRUEBA");
System.out.println("Campaign competing: " + campInGame + "size of MARKET SEGMENT" + MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment) + "; with OUR campaign: " + campaign + "size of OUR marketSegment" + MarketSegment.usersInMarketSegments().get(itemFor1.targetSegment));
*/
}
} else {
itemFor1.popInSegmentOfOurCampaign = itemFor1.popInSegmentOfOurCampaign + itemFor2.reachImps / ((double) (itemFor2.dayEnd - itemFor2.dayStart) * (double) MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment));
/*System.out.println("PRUEBA PRUEBA PRUEBA PRUEBA PRUEAB PRUEBA");
System.out.println("Campaign competing: " + campInGame + "size of MARKET SEGMENT" + MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment) + "; with OUR campaign: " + campaign + "size of OUR marketSegment" + MarketSegment.usersInMarketSegments().get(itemFor1.targetSegment));
*/
}
}
} else if (itemFor1.targetSegment.contains(MarketSegment.YOUNG)) {
if (!itemFor2.targetSegment.contains(MarketSegment.OLD)) {
if (itemFor1.targetSegment.contains(MarketSegment.HIGH_INCOME)) {
if (!itemFor2.targetSegment.contains(MarketSegment.LOW_INCOME)) {
itemFor1.popInSegmentOfOurCampaign = itemFor1.popInSegmentOfOurCampaign + itemFor2.reachImps / ((double) (itemFor2.dayEnd - itemFor2.dayStart) * (double) MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment));
/*System.out.println("PRUEBA PRUEBA PRUEBA PRUEBA PRUEAB PRUEBA");
System.out.println("Campaign competing: " + campInGame + "size of MARKET SEGMENT" + MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment) + "; with OUR campaign: " + campaign + "size of OUR marketSegment" + MarketSegment.usersInMarketSegments().get(itemFor1.targetSegment));
*/
}
} else if (itemFor1.targetSegment.contains(MarketSegment.LOW_INCOME)) {
if (!itemFor2.targetSegment.contains(MarketSegment.HIGH_INCOME)) {
itemFor1.popInSegmentOfOurCampaign = itemFor1.popInSegmentOfOurCampaign + itemFor2.reachImps / ((double) (itemFor2.dayEnd - itemFor2.dayStart) * (double) MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment));
/*System.out.println("PRUEBA PRUEBA PRUEBA PRUEBA PRUEAB PRUEBA");
System.out.println("Campaign competing: " + campInGame + "size of MARKET SEGMENT" + MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment) + "; with OUR campaign: " + campaign + "size of OUR marketSegment" + MarketSegment.usersInMarketSegments().get(itemFor1.targetSegment));
*/
}
} else {
itemFor1.popInSegmentOfOurCampaign = itemFor1.popInSegmentOfOurCampaign + itemFor2.reachImps / ((double) (itemFor2.dayEnd - itemFor2.dayStart) * (double) MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment));
/*System.out.println("PRUEBA PRUEBA PRUEBA PRUEBA PRUEAB PRUEBA");
System.out.println("Campaign competing: " + campInGame + "size of MARKET SEGMENT" + MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment) + "; with OUR campaign: " + campaign + "size of OUR marketSegment" + MarketSegment.usersInMarketSegments().get(itemFor1.targetSegment));
*/
}
}
} else {
if (itemFor1.targetSegment.contains(MarketSegment.HIGH_INCOME)) {
if (!itemFor2.targetSegment.contains(MarketSegment.LOW_INCOME)) {
itemFor1.popInSegmentOfOurCampaign = itemFor1.popInSegmentOfOurCampaign + itemFor2.reachImps / ((double) (itemFor2.dayEnd - itemFor2.dayStart) * (double) MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment));
/*System.out.println("PRUEBA PRUEBA PRUEBA PRUEBA PRUEAB PRUEBA");
System.out.println("Campaign competing: " + campInGame + "size of MARKET SEGMENT" + MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment) + "; with OUR campaign: " + campaign + "size of OUR marketSegment" + MarketSegment.usersInMarketSegments().get(itemFor1.targetSegment));
*/
}
} else if (itemFor1.targetSegment.contains(MarketSegment.LOW_INCOME)) {
if (!itemFor2.targetSegment.contains(MarketSegment.HIGH_INCOME)) {
itemFor1.popInSegmentOfOurCampaign = itemFor1.popInSegmentOfOurCampaign + itemFor2.reachImps / ((double) (itemFor2.dayEnd - itemFor2.dayStart) * (double) MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment));
/*System.out.println("PRUEBA PRUEBA PRUEBA PRUEBA PRUEAB PRUEBA");
System.out.println("Campaign competing: " + campInGame + "size of MARKET SEGMENT" + MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment) + "; with OUR campaign: " + campaign + "size of OUR marketSegment" + MarketSegment.usersInMarketSegments().get(itemFor1.targetSegment));
*/
}
} else {
itemFor1.popInSegmentOfOurCampaign = itemFor1.popInSegmentOfOurCampaign + itemFor2.reachImps / ((double) (itemFor2.dayEnd - itemFor2.dayStart) * (double) MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment));
/*System.out.println("PRUEBA PRUEBA PRUEBA PRUEBA PRUEAB PRUEBA");
System.out.println("Campaign competing: " + campInGame + "size of MARKET SEGMENT" + MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment) + "; with OUR campaign: " + campaign + "size of OUR marketSegment" + MarketSegment.usersInMarketSegments().get(itemFor1.targetSegment));
*/
}
}
}
} else if (itemFor1.targetSegment.contains(MarketSegment.FEMALE)) {
if (!itemFor2.targetSegment.contains(MarketSegment.MALE)) {
if (itemFor1.targetSegment.contains(MarketSegment.OLD)) {
if (!itemFor2.targetSegment.contains(MarketSegment.YOUNG)) {
if (itemFor1.targetSegment.contains(MarketSegment.HIGH_INCOME)) {
if (!itemFor2.targetSegment.contains(MarketSegment.LOW_INCOME)) {
itemFor1.popInSegmentOfOurCampaign = itemFor1.popInSegmentOfOurCampaign + itemFor2.reachImps / ((double) (itemFor2.dayEnd - itemFor2.dayStart) * (double) MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment));
/*System.out.println("PRUEBA PRUEBA PRUEBA PRUEBA PRUEAB PRUEBA");
System.out.println("Campaign competing: " + campInGame + "size of MARKET SEGMENT" + MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment) + "; with OUR campaign: " + campaign + "size of OUR marketSegment" + MarketSegment.usersInMarketSegments().get(itemFor1.targetSegment));
*/
}
} else if (itemFor1.targetSegment.contains(MarketSegment.LOW_INCOME)) {
if (!itemFor2.targetSegment.contains(MarketSegment.HIGH_INCOME)) {
itemFor1.popInSegmentOfOurCampaign = itemFor1.popInSegmentOfOurCampaign + itemFor2.reachImps / ((double) (itemFor2.dayEnd - itemFor2.dayStart) * (double) MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment));
/*System.out.println("PRUEBA PRUEBA PRUEBA PRUEBA PRUEAB PRUEBA");
System.out.println("Campaign competing: " + campInGame + "size of MARKET SEGMENT" + MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment) + "; with OUR campaign: " + campaign + "size of OUR marketSegment" + MarketSegment.usersInMarketSegments().get(itemFor1.targetSegment));
*/
}
} else {
itemFor1.popInSegmentOfOurCampaign = itemFor1.popInSegmentOfOurCampaign + itemFor2.reachImps / ((double) (itemFor2.dayEnd - itemFor2.dayStart) * (double) MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment));
/*System.out.println("PRUEBA PRUEBA PRUEBA PRUEBA PRUEAB PRUEBA F,O nuestra, notM, notY");
System.out.println("Campaign competing: " + campInGame + "size of MARKET SEGMENT" + MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment) + "; with OUR campaign: " + campaign + "size of OUR marketSegment" + MarketSegment.usersInMarketSegments().get(itemFor1.targetSegment));
*/
}
}
} else if (itemFor1.targetSegment.contains(MarketSegment.YOUNG)) {
if (!itemFor2.targetSegment.contains(MarketSegment.OLD)) {
if (itemFor1.targetSegment.contains(MarketSegment.HIGH_INCOME)) {
if (!itemFor2.targetSegment.contains(MarketSegment.LOW_INCOME)) {
itemFor1.popInSegmentOfOurCampaign = itemFor1.popInSegmentOfOurCampaign + itemFor2.reachImps / ((double) (itemFor2.dayEnd - itemFor2.dayStart) * (double) MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment));
/*System.out.println("PRUEBA PRUEBA PRUEBA PRUEBA PRUEAB PRUEBA");
System.out.println("Campaign competing: " + campInGame + "size of MARKET SEGMENT" + MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment) + "; with OUR campaign: " + campaign + "size of OUR marketSegment" + MarketSegment.usersInMarketSegments().get(itemFor1.targetSegment));
*/
}
} else if (itemFor1.targetSegment.contains(MarketSegment.LOW_INCOME)) {
if (!itemFor2.targetSegment.contains(MarketSegment.HIGH_INCOME)) {
itemFor1.popInSegmentOfOurCampaign = itemFor1.popInSegmentOfOurCampaign + itemFor2.reachImps / ((double) (itemFor2.dayEnd - itemFor2.dayStart) * (double) MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment));
/*System.out.println("PRUEBA PRUEBA PRUEBA PRUEBA PRUEAB PRUEBA");
System.out.println("Campaign competing: " + campInGame + "size of MARKET SEGMENT" + MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment) + "; with OUR campaign: " + campaign + "size of OUR marketSegment" + MarketSegment.usersInMarketSegments().get(itemFor1.targetSegment));
*/
}
} else {
itemFor1.popInSegmentOfOurCampaign = itemFor1.popInSegmentOfOurCampaign + itemFor2.reachImps / ((double) (itemFor2.dayEnd - itemFor2.dayStart) * (double) MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment));
/*System.out.println("PRUEBA PRUEBA PRUEBA PRUEBA PRUEAB PRUEBA");
System.out.println("Campaign competing: " + campInGame + "size of MARKET SEGMENT" + MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment) + "; with OUR campaign: " + campaign + "size of OUR marketSegment" + MarketSegment.usersInMarketSegments().get(itemFor1.targetSegment));
*/
}
}
} else {
if (itemFor1.targetSegment.contains(MarketSegment.HIGH_INCOME)) {
if (!itemFor2.targetSegment.contains(MarketSegment.LOW_INCOME)) {
itemFor1.popInSegmentOfOurCampaign = itemFor1.popInSegmentOfOurCampaign + itemFor2.reachImps / ((double) (itemFor2.dayEnd - itemFor2.dayStart) * (double) MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment));
/*System.out.println("PRUEBA PRUEBA PRUEBA PRUEBA PRUEAB PRUEBA");
System.out.println("Campaign competing: " + campInGame + "size of MARKET SEGMENT" + MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment) + "; with OUR campaign: " + campaign + "size of OUR marketSegment" + MarketSegment.usersInMarketSegments().get(itemFor1.targetSegment));
*/
}
} else if (itemFor1.targetSegment.contains(MarketSegment.LOW_INCOME)) {
if (!itemFor2.targetSegment.contains(MarketSegment.HIGH_INCOME)) {
itemFor1.popInSegmentOfOurCampaign = itemFor1.popInSegmentOfOurCampaign + itemFor2.reachImps / ((double) (itemFor2.dayEnd - itemFor2.dayStart) * (double) MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment));
/*System.out.println("PRUEBA PRUEBA PRUEBA PRUEBA PRUEAB PRUEBA");
System.out.println("Campaign competing: " + campInGame + "size of MARKET SEGMENT" + MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment) + "; with OUR campaign: " + campaign + "size of OUR marketSegment" + MarketSegment.usersInMarketSegments().get(itemFor1.targetSegment));
*/
}
} else {
itemFor1.popInSegmentOfOurCampaign = itemFor1.popInSegmentOfOurCampaign + itemFor2.reachImps / ((double) (itemFor2.dayEnd - itemFor2.dayStart) * (double) MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment));
/*System.out.println("PRUEBA PRUEBA PRUEBA PRUEBA PRUEAB PRUEBA");
System.out.println("Campaign competing: " + campInGame + "size of MARKET SEGMENT" + MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment) + "; with OUR campaign: " + campaign + "size of OUR marketSegment" + MarketSegment.usersInMarketSegments().get(itemFor1.targetSegment));
*/
}
}
}
} else {
if (itemFor1.targetSegment.contains(MarketSegment.OLD)) {
if (!itemFor2.targetSegment.contains(MarketSegment.YOUNG)) {
if (itemFor1.targetSegment.contains(MarketSegment.HIGH_INCOME)) {
if (!itemFor2.targetSegment.contains(MarketSegment.LOW_INCOME)) {
itemFor1.popInSegmentOfOurCampaign = itemFor1.popInSegmentOfOurCampaign + itemFor2.reachImps / ((double) (itemFor2.dayEnd - itemFor2.dayStart) * (double) MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment));
/*System.out.println("PRUEBA PRUEBA PRUEBA PRUEBA PRUEAB PRUEBA O,H nuestra, notY,notL");
System.out.println("Campaign competing: " + campInGame + "size of MARKET SEGMENT" + MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment) + "; with OUR campaign: " + campaign + "size of OUR marketSegment" + MarketSegment.usersInMarketSegments().get(itemFor1.targetSegment));
*/
}
} else if (itemFor1.targetSegment.contains(MarketSegment.LOW_INCOME)) {
if (!itemFor2.targetSegment.contains(MarketSegment.HIGH_INCOME)) {
itemFor1.popInSegmentOfOurCampaign = itemFor1.popInSegmentOfOurCampaign + itemFor2.reachImps / ((double) (itemFor2.dayEnd - itemFor2.dayStart) * (double) MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment));
/*System.out.println("PRUEBA PRUEBA PRUEBA PRUEBA PRUEAB PRUEBA O,L nuestra, notY, not H");
System.out.println("Campaign competing: " + campInGame + "size of MARKET SEGMENT" + MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment) + "; with OUR campaign: " + campaign + "size of OUR marketSegment" + MarketSegment.usersInMarketSegments().get(itemFor1.targetSegment));
*/
}
} else {
itemFor1.popInSegmentOfOurCampaign = itemFor1.popInSegmentOfOurCampaign + itemFor2.reachImps / ((double) (itemFor2.dayEnd - itemFor2.dayStart) * (double) MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment));
/*System.out.println("PRUEBA PRUEBA PRUEBA PRUEBA PRUEAB PRUEBA O nuestra, notY");
System.out.println("Campaign competing: " + campInGame + "size of MARKET SEGMENT" + MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment) + "; with OUR campaign: " + campaign + "size of OUR marketSegment" + MarketSegment.usersInMarketSegments().get(itemFor1.targetSegment));
*/
}
}
} else if (itemFor1.targetSegment.contains(MarketSegment.YOUNG)) {
if (!itemFor2.targetSegment.contains(MarketSegment.OLD)) {
if (itemFor1.targetSegment.contains(MarketSegment.HIGH_INCOME)) {
if (!itemFor2.targetSegment.contains(MarketSegment.LOW_INCOME)) {
itemFor1.popInSegmentOfOurCampaign = itemFor1.popInSegmentOfOurCampaign + itemFor2.reachImps / ((double) (itemFor2.dayEnd - itemFor2.dayStart) * (double) MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment));
/*System.out.println("PRUEBA PRUEBA PRUEBA PRUEBA PRUEAB PRUEBA");
System.out.println("Campaign competing: " + campInGame + "size of MARKET SEGMENT" + MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment) + "; with OUR campaign: " + campaign + "size of OUR marketSegment" + MarketSegment.usersInMarketSegments().get(itemFor1.targetSegment));
*/
}
} else if (itemFor1.targetSegment.contains(MarketSegment.LOW_INCOME)) {
if (!itemFor2.targetSegment.contains(MarketSegment.HIGH_INCOME)) {
itemFor1.popInSegmentOfOurCampaign = itemFor1.popInSegmentOfOurCampaign + itemFor2.reachImps / ((double) (itemFor2.dayEnd - itemFor2.dayStart) * (double) MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment));
/*System.out.println("PRUEBA PRUEBA PRUEBA PRUEBA PRUEAB PRUEBA");
System.out.println("Campaign competing: " + campInGame + "size of MARKET SEGMENT" + MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment) + "; with OUR campaign: " + campaign + "size of OUR marketSegment" + MarketSegment.usersInMarketSegments().get(itemFor1.targetSegment));
*/
}
} else {
itemFor1.popInSegmentOfOurCampaign = itemFor1.popInSegmentOfOurCampaign + itemFor2.reachImps / ((double) (itemFor2.dayEnd - itemFor2.dayStart) * (double) MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment));
/*System.out.println("PRUEBA PRUEBA PRUEBA PRUEBA PRUEAB PRUEBA");
System.out.println("Campaign competing: " + campInGame + "size of MARKET SEGMENT" + MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment) + "; with OUR campaign: " + campaign + "size of OUR marketSegment" + MarketSegment.usersInMarketSegments().get(itemFor1.targetSegment));
*/
}
}
} else {
if (itemFor1.targetSegment.contains(MarketSegment.HIGH_INCOME)) {
if (!itemFor2.targetSegment.contains(MarketSegment.LOW_INCOME)) {
itemFor1.popInSegmentOfOurCampaign = itemFor1.popInSegmentOfOurCampaign + itemFor2.reachImps / ((double) (itemFor2.dayEnd - itemFor2.dayStart) * (double) MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment));
/*System.out.println("PRUEBA PRUEBA PRUEBA PRUEBA PRUEAB PRUEBA");
System.out.println("Campaign competing: " + campInGame + "size of MARKET SEGMENT" + MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment) + "; with OUR campaign: " + campaign + "size of OUR marketSegment" + MarketSegment.usersInMarketSegments().get(itemFor1.targetSegment));
*/
}
} else if (itemFor1.targetSegment.contains(MarketSegment.LOW_INCOME)) {
if (!itemFor2.targetSegment.contains(MarketSegment.HIGH_INCOME)) {
itemFor1.popInSegmentOfOurCampaign = itemFor1.popInSegmentOfOurCampaign + itemFor2.reachImps / ((double) (itemFor2.dayEnd - itemFor2.dayStart) * (double) MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment));
/*System.out.println("PRUEBA PRUEBA PRUEBA PRUEBA PRUEAB PRUEBA");
System.out.println("Campaign competing: " + campInGame + "size of MARKET SEGMENT" + MarketSegment.usersInMarketSegments().get(itemFor2.targetSegment) + "; with OUR campaign: " + campaign + "size of OUR marketSegment" + MarketSegment.usersInMarketSegments().get(itemFor1.targetSegment));
*/
}
}
}
}
}
}
}
}
if (itemFor1.dayStart == day) {
///// Initial Reserve Price (between 0 and 0.005) -> Set as Maximum
itemFor1.ReservePriceEstimated = 0.005;
} else {
// Trying with average value of impressions in a game: 0.0012
itemFor1.ReservePriceEstimated = (0.2 * (double) itemFor1.ReservePriceEstimated + 0.8 * (0.0012) * (double) itemFor1.popInSegmentOfOurCampaign);
}
//int randomNumber = random.nextInt(2) - 1; add random number between 0.04 and -0.04 -> Set as Maximum
itemFor1.ReservePriceThisDay = itemFor1.ReservePriceEstimated + 0.04;
// Cost Estimate by a factor of 0.0012
itemFor1.impCostEstThisDay = itemFor1.ReservePriceEstimated + (0.1) * itemFor1.popInSegmentOfOurCampaign / adNetworkDailyNotification.getServiceLevel();
//itemFor1.impressionCostEstimate = itemFor1.impCostEstThisDay*(60-day)/60 + itemFor1.impCostAvg*(day)/60;
EstimateCostOfImpressionsToday = EstimateCostOfImpressionsToday + itemFor1.impCostEstThisDay;
// Correct with days: at the end there is less competence *60/(60+day)
//System.out.println("####################################################################");
System.out.println("Active Campaigns NAMM: " + campaign.getValue().id +"; Estimation: " +itemFor1.impCostEstThisDay);
//System.out.println("####################################################################");
/*System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
System.out.println("CAMPAIGN" + itemFor1.id + "-->" + "reachImps = " + itemFor1.reachImps + "; dayStart = " + itemFor1.dayStart + "; dayEnd = " + itemFor1.dayEnd + "; TargetSegmentSize = " + MarketSegment.usersInMarketSegments().get(itemFor1.targetSegment));
System.out.println("----CAMPAIGN" + itemFor1.id + "--> Popularity:" + itemFor1.popInSegmentOfOurCampaign + ". IMPRESSION COST ESTIMATE TODAY:" +itemFor1.impCostEstThisDay + "------");
System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
*/
}
}
/*System.out.println("################################################ Prueba 2");
System.out.println("Campañas activas de NAMM: " + campaign.getValue().id);
*/
}
}
catch(Exception ex){
System.out.println(ex.getMessage());
ex.printStackTrace();
}
System.out.println("Estimate Cost of all impressions: " + EstimateCostOfImpressionsToday);
return EstimateCostOfImpressionsToday;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Nicola: UCS cost estimate
* This function estimates the cost to achieve a specific ucs tier. Note that ucsTarget is the integer tier not the
* percentage of users classified. (1 = 100%, 2 = 90%, 3 = 81% ...).
* Expansion: Factor in changes to unknown and known impression costs.
*/
private double ucsCostEstimate(int ucsTargetLevel) {
// TODO;
return 0.15; // default bidding is random (and so are dummy agents)
}
/**
* Nicola: Best UCS impression cost combination
* This function queries impression and UCS cost estimations over the entire range of UCS costs to evaluate the
* cheapest cost to achieve our impression target.
*/
private int bestImpUcsCombination(long targetImpressions){
// TODO Return desired UCS classification;
return 1; // default desire to get first place (100%)
}
/**
* Nicola: UCS bid
* This method takes a UCS target and tries to evaluate the bid required to reach that target.
* Expansion: include a sense of risk aversion to this function. i.e. when it is more important to achieve a
* specific UCS level (like incomplete campaign due that day) we want to overbid.
* Will use a combination of machine learning techniques and recalling recorded values to produce estimate.
*/
private double ucsBidCalculator(int ucsTargetLevel){
// TODO;
return ucsBid();
}
private double ucsBid(){
double initbid = 0.9999;
double scale = 0.4371;
double ucsbid;
if(day <= 10)
{ucsbid = initbid;}
else
{ucsbid = scale*Math.cbrt(myCampaigns.size());} // avg n of campaigns 60/8=7.5 cbrt(7.5)=1.957434
return ucsbid; // avg bid = 0.8556
}
/**
* Miguel: This method calculates how to bid for unknown users.
*/
private double untargetedImpressionBidCalculator(double impressionTarget){
// TODO;
return 0;
}
/**
* Miguel: This method evaluates the bid for each impression query.
*/
private double ImpressionBidCalculator(int impressionTarget, AdxQuery iQuery){
BasicStatisticValues histImprStats;
histImprStats = impressionBidHistory.getStatsPerAllCriteria(iQuery);
return histImprStats.mean * impressionTarget * 1000;
}
/**
* Class to keep a record of all historic bid results coming from the server. This ie useful for
* future estimates and support in general the campaigns and impressions bidding strategy.
*/
private class ImpressionHistory {
// Main collection. Record list of type ImpressionRecord defined below
public List<ImpressionRecord> impressionList;
/**
* Constructor method. Basically initializes the ArrayList at the beginning of the game when
* an instance of AgentNAMM is
*/
public ImpressionHistory(){
impressionList = new ArrayList<ImpressionRecord>();
}
public BasicStatisticValues getStatsPerSegment(MarketSegment sGender, MarketSegment sAge, MarketSegment sIncome){
DescriptiveStatistics statsCalc = new DescriptiveStatistics();
BasicStatisticValues returnVal = new BasicStatisticValues();
if(sGender != null && sAge != null && sIncome != null){
for(ImpressionRecord rEntry : impressionList) {
if(rEntry.mktSegGender == sGender && rEntry.mktSegAge == sAge && rEntry.mktSegIncome == sIncome && rEntry.lostCount == 0) {
statsCalc.addValue(rEntry.costImpr);
}
}
}
else if (sGender != null && sAge != null) {
for(ImpressionRecord rEntry : impressionList) {
if(rEntry.mktSegGender == sGender && rEntry.mktSegAge == sAge && rEntry.lostCount == 0) {
statsCalc.addValue(rEntry.costImpr);
}
}
}
else if (sAge != null && sIncome != null) {
for(ImpressionRecord rEntry : impressionList) {
if(rEntry.mktSegAge == sAge && rEntry.mktSegIncome == sIncome && rEntry.lostCount == 0) {
statsCalc.addValue(rEntry.costImpr);
}
}
}
else if (sGender != null && sIncome != null) {
for(ImpressionRecord rEntry : impressionList) {
if(rEntry.mktSegGender == sGender && rEntry.mktSegIncome == sIncome && rEntry.lostCount == 0) {
statsCalc.addValue(rEntry.costImpr);
}
}
}
else if (sGender != null) {
for(ImpressionRecord rEntry : impressionList) {
if(rEntry.mktSegGender == sGender && rEntry.lostCount == 0) {
statsCalc.addValue(rEntry.costImpr);
}
}
}
else if (sAge != null) {
for(ImpressionRecord rEntry : impressionList) {
if(rEntry.mktSegAge == sAge && rEntry.lostCount == 0) {
statsCalc.addValue(rEntry.costImpr);
}
}
}
else if (sIncome != null) {
for(ImpressionRecord rEntry : impressionList) {
if(rEntry.mktSegIncome == sIncome && rEntry.lostCount == 0) {
statsCalc.addValue(rEntry.costImpr);
}
}
}
if(statsCalc.getN() > 0){
returnVal.mean = statsCalc.getMean();
returnVal.std = statsCalc.getStandardDeviation();
returnVal.var = statsCalc.getVariance();
returnVal.max = statsCalc.getMax();
returnVal.min = statsCalc.getMin();
}
return returnVal;
}
/**
* Calculates statistics for historic bid data, filtered by the query criteria
* @param pQuery
* @return
*/
public BasicStatisticValues getStatsPerAllCriteria(AdxQuery pQuery){
DescriptiveStatistics statsCalc = new DescriptiveStatistics();
BasicStatisticValues returnVal = new BasicStatisticValues();
MarketSegment sGender, sAge, sIncome;
if(pQuery.getMarketSegments().contains(MarketSegment.MALE)) {
sGender = MarketSegment.MALE;
}
else if(pQuery.getMarketSegments().contains(MarketSegment.FEMALE)) {
sGender = MarketSegment.FEMALE;
}
else {
sGender = null;
}
if(pQuery.getMarketSegments().contains(MarketSegment.YOUNG)) {
sAge = MarketSegment.YOUNG;
}
else if(pQuery.getMarketSegments().contains(MarketSegment.OLD)) {
sAge = MarketSegment.OLD;
}
else {
sAge = null;
}
if(pQuery.getMarketSegments().contains(MarketSegment.HIGH_INCOME)) {
sIncome = MarketSegment.HIGH_INCOME;
}
else if(pQuery.getMarketSegments().contains(MarketSegment.LOW_INCOME)) {
sIncome = MarketSegment.LOW_INCOME;
}
else {
sIncome = null;
}
// System.out.println("#####STATSALLCRITERIA##### " + pQuery.toString());
if(sGender != null && sAge != null && sIncome != null){
// System.out.print("#####STATSALLCRITERIA##### Gender + Age + Income");
for(ImpressionRecord rEntry : impressionList) {
if(rEntry.mktSegGender == sGender && rEntry.mktSegAge == sAge && rEntry.mktSegIncome == sIncome && rEntry.adType == pQuery.getAdType() && rEntry.dev == pQuery.getDevice()) {
// && rEntry.pub == pQuery.getPublisher() && rEntry.lostCount == 0
statsCalc.addValue(rEntry.costImpr);
//System.out.print(".");
}
}
}
else if (sGender != null && sAge != null) {
System.out.print("#####STATSALLCRITERIA##### Gender + Age");
for(ImpressionRecord rEntry : impressionList) {
if(rEntry.mktSegGender == sGender && rEntry.mktSegAge == sAge && rEntry.adType == pQuery.getAdType() && rEntry.dev == pQuery.getDevice()) {
statsCalc.addValue(rEntry.costImpr);
System.out.print(".");
}
}
}
else if (sAge != null && sIncome != null) {
System.out.print("#####STATSALLCRITERIA##### Age + Income");
for(ImpressionRecord rEntry : impressionList) {
if(rEntry.mktSegAge == sAge && rEntry.mktSegIncome == sIncome && rEntry.adType == pQuery.getAdType() && rEntry.dev == pQuery.getDevice()) {
statsCalc.addValue(rEntry.costImpr);
System.out.print(".");
}
}
}
else if (sGender != null && sIncome != null) {
System.out.print("#####STATSALLCRITERIA##### Gender + Income");
for(ImpressionRecord rEntry : impressionList) {
if(rEntry.mktSegGender == sGender && rEntry.mktSegIncome == sIncome && rEntry.adType == pQuery.getAdType() && rEntry.dev == pQuery.getDevice()) {
statsCalc.addValue(rEntry.costImpr);
System.out.print(".");
}
}
}
else if (sGender != null) {
System.out.print("#####STATSALLCRITERIA##### Gender");
for(ImpressionRecord rEntry : impressionList) {
if(rEntry.mktSegGender == sGender && rEntry.adType == pQuery.getAdType() && rEntry.dev == pQuery.getDevice()) {
statsCalc.addValue(rEntry.costImpr);
System.out.print(".");
}
}
}
else if (sAge != null) {
System.out.print("#####STATSALLCRITERIA##### Age");
for(ImpressionRecord rEntry : impressionList) {
if(rEntry.mktSegAge == sAge && rEntry.adType == pQuery.getAdType() && rEntry.dev == pQuery.getDevice()) {
statsCalc.addValue(rEntry.costImpr);
System.out.print(".");
}
}
}
else if (sIncome != null) {
System.out.print("#####STATSALLCRITERIA##### Income");
for(ImpressionRecord rEntry : impressionList) {
if(rEntry.mktSegIncome == sIncome && rEntry.adType == pQuery.getAdType() && rEntry.dev == pQuery.getDevice()) {
statsCalc.addValue(rEntry.costImpr);
System.out.print(".");
}
}
}
// System.out.println("#####STATSALLCRITERIA##### Items added: " + statsCalc.getN());
if(statsCalc.getN() > 0) {
returnVal.mean = statsCalc.getMean();
returnVal.std = statsCalc.getStandardDeviation();
returnVal.var = statsCalc.getVariance();
returnVal.max = statsCalc.getMax();
returnVal.min = statsCalc.getMin();
}
else {
returnVal.mean = 0.000005;
returnVal.std = 0;
returnVal.var = 0;
returnVal.max = 0.000005;
returnVal.min = 0.000005;
}
return returnVal;
}
/**
* Method to save a file with the historic impressions bidding data
*/
public void saveFile(){
String workingDir = System.getProperty("user.dir");
String fName = workingDir + "/BHFull.csv";
String fLine;
System.out.println("#####SAVEFILE##### Starting file save. Length:" + impressionList.size());
try {
FileWriter csvFw = new FileWriter(fName);
csvFw.write("GameId,BidDay,CampId,AdType,Device,Publisher,Gender,MktGender,Income,MktIncome,Age,MktAge,BidCount,WinCount,TotalCost,CostImpr,LostCount" + System.lineSeparator());
for(ImpressionRecord sRecord : impressionList){
fLine = sRecord.toCsv();
if(fLine != null) {csvFw.write(fLine + System.lineSeparator());}
}
csvFw.close();
} catch(IOException ex){
System.out.println("##### ERR Writing the CSV File #####");
}
}
public void loadFile(){
String workingDir = System.getProperty("user.dir");
String fName = workingDir + "/BHFull.csv";
String fLine;
BufferedReader br;
ImpressionRecord iRecord;
AdType fAdType;
Device fDevice;
Gender fGender;
Income fIncome;
Age fAge;
String[] fValues;
try {
br = new BufferedReader(new FileReader(fName));
fLine = br.readLine(); // Ignores the first line that contains the headers
while ((fLine = br.readLine()) != null) {
fValues = fLine.split(",");
// 0:GameId,1:BidDay,2:CampId,3:AdType,4:Device,5:Publisher,6:Gender,7:MktGender,8:Income,9:MktIncome,10:Age,11:MktAge,12:BidCount,13:WinCount,14:TotalCost,15:CostImpr,16:LostCount
if(fValues[3].toString() == "text") { fAdType = AdType.text; } else { fAdType = AdType.video; }
if(fValues[4].toString() == "pc") { fDevice = Device.pc; } else { fDevice = Device.mobile; }
if(fValues[6].toString() == "male") { fGender = Gender.male; } else { fGender = Gender.female; }
if(fValues[8].toString() == "low") { fIncome = Income.low; } else if(fValues[8].toString() == "medium") { fIncome = Income.medium; }
else if(fValues[8].toString() == "high") { fIncome = Income.high; } else { fIncome = Income.very_high; }
if(fValues[10].toString() == "Age_18_24") { fAge = Age.Age_18_24; } else if(fValues[10].toString() == "Age_25_34") { fAge = Age.Age_25_34; }
else if(fValues[10].toString() == "Age_35_44") { fAge = Age.Age_35_44; } else if(fValues[10].toString() == "Age_45_54") { fAge = Age.Age_45_54; }
else if(fValues[10].toString() == "Age_55_64") { fAge = Age.Age_55_64; } else { fAge = Age.Age_65_PLUS; }
iRecord = new ImpressionRecord(Integer.parseInt(fValues[0]), Integer.parseInt(fValues[1]), Integer.parseInt(fValues[2]),
fAdType, fDevice, fValues[5].toString(), fGender, fIncome, fAge, Integer.parseInt(fValues[12]), Integer.parseInt(fValues[13]), Double.parseDouble(fValues[14]));
impressionBidHistory.impressionList.add(iRecord);
System.out.println("#####CSVLINE##### - " + fValues[3] + "," + fValues[4] + "," + fValues[6] + "," + fValues[8] + "," + fValues[10]);
}
System.out.println("#####LOADFILE##### Load file complete: " + impressionBidHistory.impressionList.size());
br.close();
}
catch (IOException ex) {
System.out.println("#####LOADFILE##### EXCEPTION WHEN READING THE CSV!!!!!!");
}
}
}
/**
* Class to store a single line of data coming from the AdNet Report.
* This class is used within Impression History to have a collection of historic records. This allows the
* calculation of statistics and other indices to take decisions during the trading.
*/
private class ImpressionRecord {
public int simId = 0;
public int bidDay = 0;
public int campId = 0;
public AdType adType = AdType.text;
public Device dev = Device.pc;
public String pub = "";
public Gender segGender = Gender.male;
public MarketSegment mktSegGender = MarketSegment.MALE;
public Income segIncome = Income.medium;
public MarketSegment mktSegIncome = MarketSegment.HIGH_INCOME;
public Age segAge = Age.Age_18_24;
public MarketSegment mktSegAge = MarketSegment.YOUNG;
public int bidCount = 0;
public int winCount = 0;
public double totalCost = 0;
public double costImpr = 0;
public int lostCount = 0;
public ImpressionRecord(int pSimId, int pBidDay, int pCampId, AdType pAdType, Device pDev, String pPub, Gender pSegGender,
Income pSegIncome, Age pSegAge, int pBidCount, int pWinCount, double pTotalCost){
simId = pSimId;
bidDay = pBidDay;
campId = pCampId;
adType = pAdType;
dev = pDev;
pub = pPub;
segGender = pSegGender;
mktSegGender = (segGender == Gender.male)? MarketSegment.MALE : MarketSegment.FEMALE;
segIncome = pSegIncome;
mktSegIncome = (segIncome == Income.high || segIncome == Income.very_high) ? MarketSegment.HIGH_INCOME : MarketSegment.LOW_INCOME;
segAge = pSegAge;
mktSegAge = (segAge == Age.Age_18_24 || segAge == Age.Age_25_34 || segAge == Age.Age_35_44) ? MarketSegment.YOUNG : MarketSegment.OLD;
bidCount = pBidCount;
winCount = pWinCount;
totalCost = pTotalCost / 1000;
costImpr = pTotalCost / pWinCount;
lostCount = pBidCount - pWinCount;
}
public ImpressionRecord(AdNetworkReportEntry pReportEntry){
simId = startInfo.getSimulationID();
bidDay = day -1;
campId = pReportEntry.getKey().getCampaignId();
adType = pReportEntry.getKey().getAdType();
dev = pReportEntry.getKey().getDevice();
pub = pReportEntry.getKey().getPublisher();
segGender = pReportEntry.getKey().getGender();
mktSegGender = (segGender == Gender.male)? MarketSegment.MALE : MarketSegment.FEMALE;
segIncome = pReportEntry.getKey().getIncome();
mktSegIncome = (segIncome == Income.high || segIncome == Income.very_high) ? MarketSegment.HIGH_INCOME : MarketSegment.LOW_INCOME;
segAge = pReportEntry.getKey().getAge();
mktSegAge = (segAge == Age.Age_18_24 || segAge == Age.Age_25_34 || segAge == Age.Age_35_44) ? MarketSegment.YOUNG : MarketSegment.OLD;
bidCount = pReportEntry.getBidCount();
winCount = pReportEntry.getWinCount();
totalCost = pReportEntry.getCost() / 1000;
costImpr = totalCost / winCount;
lostCount = bidCount - winCount;
}
public String toCsv(){
//if(totalCost > 0.000001) {
return simId + "," + bidDay + "," + campId + "," + adType.toString() + "," +
dev.toString() + "," + pub + "," + segGender.toString() + "," + mktSegGender.toString() + "," +
segIncome.toString() + "," + mktSegIncome.toString() + "," + segAge.toString() + "," +
mktSegAge.toString() + "," + bidCount + "," + winCount + "," + totalCost + "," + costImpr + "," + lostCount;
//}
//else {
// return null;
//}
}
}
private class BasicStatisticValues {
public double mean;
public double std;
public double var;
public double min;
public double max;
public String toString() {
return "Mean: " + mean + ", Std: " + std + ", Var: " + var + ", Min: " + min + ", Max: " + max;
}
}
public void campaignSaveFile(){
String workingDir = System.getProperty("user.dir");
String fName = workingDir + "\\CmpLog.csv";
// TODO ALUN: fix so it doesn't print header every time
//CSV file header
final String FILE_HEADER = "game,id,dayStart,dayEnd,reachImps,targetSegment,videoCoef,mobileCoef," +
"adxCost,targetedImps,untargetedImps,budget,revenue,profitEstimate,cmpBid,impressionTarget," +
"uncorrectedProfitEstimate,costEstimate,estImpCost,estUcsCost,qualityChange,estQualityChange," +
"ucsCost,estCostAcc,estProfitAcc,uncorrectedProffitAcc,estQualityChangeAcc,impTargetFulfillment," +
"bidVs2ndRatio,profit,profitPerImpression,reachFulfillment,estUcsCostAcc";
try {
FileWriter csvFw = new FileWriter(fName, true);
// TODO: include FILEHEADER when writing new file
//csvFw.write(FILE_HEADER + System.lineSeparator());
//Add a new line separator after the header
for (Map.Entry<Integer, CampaignData> entry : myCampaigns.entrySet()) {
CampaignData campaign = entry.getValue();
csvFw.append(campaign.toWrite() + System.lineSeparator());
}
csvFw.close();
System.out.println("Printed campaign csv successfully");
} catch(IOException ex){
System.out.println("##### ERR Writing the CSV File #####");
}
}
}
| [
"miballeuk@outlook.com"
] | miballeuk@outlook.com |
b068d64fd9e46f2e7ed0595fddd083db2897aa84 | f9c94c23839e0451d3c6c09c407d71fb679a524c | /java-client/src/main/java/com/couchbase/client/java/env/ClusterEnvironment.java | e76b8249051392c3c83e3236533047ac4941d537 | [] | no_license | plokhotnyuk/couchbase-jvm-clients | 6127e97dbb77c9e46854c1f992afdbdee8c4dd8a | e12fe43f5d04f40e1aa3f5d9bd3c2095bccaafff | refs/heads/master | 2020-06-10T18:36:18.585785 | 2019-05-21T09:36:06 | 2019-06-24T13:44:15 | 193,707,958 | 1 | 0 | null | 2019-06-25T12:57:23 | 2019-06-25T12:57:23 | null | UTF-8 | Java | false | false | 2,897 | java | /*
* Copyright (c) 2018 Couchbase, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.couchbase.client.java.env;
import com.couchbase.client.core.env.ConnectionStringPropertyLoader;
import com.couchbase.client.core.env.CoreEnvironment;
import com.couchbase.client.core.env.Credentials;
import com.couchbase.client.core.env.RoleBasedCredentials;
public class ClusterEnvironment extends CoreEnvironment {
private ClusterEnvironment(Builder builder) {
super(builder);
}
@Override
protected Package agentPackage() {
return ClusterEnvironment.class.getPackage();
}
@Override
protected String defaultAgentTitle() {
return "java";
}
public static ClusterEnvironment create(final String username, final String password) {
return builder(username, password).build();
}
public static ClusterEnvironment create(final Credentials credentials) {
return builder(credentials).build();
}
public static ClusterEnvironment create(final String connectionString, String username, String password) {
return builder(connectionString, username, password).build();
}
public static ClusterEnvironment create(final String connectionString, Credentials credentials) {
return builder(connectionString, credentials).build();
}
public static ClusterEnvironment.Builder builder(final String username, final String password) {
return builder(new RoleBasedCredentials(username, password));
}
public static ClusterEnvironment.Builder builder(final Credentials credentials) {
return new ClusterEnvironment.Builder(credentials);
}
public static ClusterEnvironment.Builder builder(final String connectionString, final String username, final String password) {
return builder(connectionString, new RoleBasedCredentials(username, password));
}
public static ClusterEnvironment.Builder builder(final String connectionString, final Credentials credentials) {
return builder(credentials).load(new ConnectionStringPropertyLoader(connectionString));
}
public static class Builder extends CoreEnvironment.Builder<Builder> {
Builder(Credentials credentials) {
super(credentials);
}
public Builder load(final ClusterPropertyLoader loader) {
loader.load(this);
return this;
}
public ClusterEnvironment build() {
return new ClusterEnvironment(this);
}
}
}
| [
"michael@nitschinger.at"
] | michael@nitschinger.at |
4134ac14ef747fd1f98ae9ed9bc8cbef20fe8445 | 402e4cb2891ea8e15ffec45b3d80dde36b650d72 | /src/main/java/travelcompare/restapi/data/repository/UserRepository.java | 5a630b282b1ddecca8a5d216449cf4fdc80f3d0c | [] | no_license | fwuen/TravelCompareServer | 042d6c7cd87f138502ccae97f079c39382f530d4 | 88ce4dcc44c77868575cc94bc15247f45302ec87 | refs/heads/master | 2021-09-05T10:11:46.512797 | 2018-01-24T14:59:28 | 2018-01-24T14:59:28 | 119,031,523 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 569 | java | package travelcompare.restapi.data.repository;
import lombok.NonNull;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import travelcompare.restapi.data.model.User;
import java.util.Optional;
@Repository
public interface UserRepository extends CrudRepository<User, Long> {
Optional<User> findFirstByEmailEqualsIgnoreCase(@NonNull String email);
Optional<User> findFirstByIdEquals(long id);
boolean existsByEmailEqualsIgnoreCase(@NonNull String email);
boolean existsByIdEquals(long id);
}
| [
"syntarex@gmail.com"
] | syntarex@gmail.com |
0d68ffc1f91edbfac0fb38f13d57dde5b2510843 | 514130a2b6f230963368c6a4eab9b0c0240a5adc | /geo-locator/src/edu/cmu/geoparser/ui/CommandLine/CmdInputParser.java | 25d5155c2e3f8552fc987a2b63f6652de186c65c | [
"Apache-2.0"
] | permissive | pcrease/geolocator | 3aca252a4953fe276bb4671e9ff342c6b6b5e9f2 | 33e300f0ac03527359cb034f9a78d194c4bfcd60 | refs/heads/master | 2020-06-03T14:50:57.224830 | 2014-01-04T14:09:56 | 2014-01-04T14:09:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,213 | java | /**
*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*
* @author Wei Zhang, Language Technology Institute, School of Computer Science, Carnegie-Mellon University.
* email: wei.zhang@cs.cmu.edu
*
*/
package edu.cmu.geoparser.ui.CommandLine;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import org.apache.lucene.document.Document;
import edu.cmu.geoparser.Disambiguation.ContextDisamb;
import edu.cmu.geoparser.model.LocEntity;
import edu.cmu.geoparser.model.Sentence;
import edu.cmu.geoparser.model.Tweet;
import edu.cmu.geoparser.parser.english.EnglishParser;
import edu.cmu.geoparser.resource.gazindexing.CollaborativeIndex.CollaborativeIndex;
/**
* This demo shows the on-the-fly tagging of the sample text or JSON
*
*/
public class CmdInputParser {
public static void main(String argv[]) throws IOException {
boolean misspell = argv[0].equals("mis") ? true : false;
/**
* Use the collaborative index version instead of the in-memory version. Which aims to reduce
* memory usage.
*/
CollaborativeIndex ci = new CollaborativeIndex().config("GazIndex/StringIndex",
"GazIndex/InfoIndex", "mmap", "mmap").open();
/**
* This is the main construction function for the English parser. The Spanish parser has the
* same form.
*/
EnglishParser enparser = new EnglishParser("res/", ci, false);
/**
* Initialize a context disambiguation class c.
*/
ContextDisamb c = new ContextDisamb();
String text = null;
Tweet t = new Tweet();
ArrayList<Document> cand;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in, "utf-8"));
System.out.print(">");
while ((text = br.readLine()) != null) {
if (text.length() == 0)
continue;
t.setSentence(new Sentence().setSentenceString(text));
List<LocEntity> match = enparser.parse(t);
if (match == null || match.size() == 0) {
System.out.println("No toponyms in text.");
continue;
}
/**
* if matches are found:
*/
//System.out.println("The locations found :\n" + match);
/**
* The parsing output will give you parsed results in the form of tp{XXX}tp, or TP{XXX}TP. The
* next lines are for stripping the first and last three characters.
*/
for (LocEntity s : match) {
System.out.println("["+s+"]");
cand = ci.getDocumentsByPhraseStrict(s.getTokenString());
if (cand == null) {
System.out.println("No results.");
continue;
}
for (int i = 0; i < cand.size(); i++) {
System.out.println();
System.out.println("ID : " + cand.get(i).get("ID"));
System.out.println("Lat : " + cand.get(i).get("LATITUDE"));
System.out.println("Lon : " + cand.get(i).get("LONGTITUDE"));
System.out.println("POP : " + cand.get(i).get("POPULATION"));
System.out.println("CNTRY_STATE : " + cand.get(i).get("COUNTRYSTATE"));
System.out.println("FEATURE : " + cand.get(i).get("FEATURE"));
System.out.println("TIMEZONE : " + cand.get(i).get("TIMEZONE"));
}
}
System.out.print(">");
}// end of while
}
}
| [
"wynnzh@gmail.com"
] | wynnzh@gmail.com |
8d83078c3dc1b4c13a0815722be644196ad5e3c3 | 1800dbc89ed7abc10b4bf71c5d032a1170121c22 | /workspace/bigdata.smartcar.loggen/src/main/java/com/wikibook/bigdata/smartcar/loggen/CarMasterIncomeMain.java | 7c2b1e654248659336990f83d7a37f9d15d3b428 | [] | no_license | wikibook/bigdata | 59c539adc630bfa3763ab2b84fea2682b5896091 | 9aa826449fcc5fed27d8144d74a365853f54ad85 | refs/heads/master | 2022-11-11T06:47:49.972260 | 2020-04-23T05:00:46 | 2020-04-23T05:00:46 | 75,913,807 | 20 | 22 | null | 2022-11-04T22:44:55 | 2016-12-08T07:24:49 | Java | UTF-8 | Java | false | false | 3,820 | java | package com.wikibook.bigdata.smartcar.loggen;
import java.text.DecimalFormat;
import java.util.Random;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class CarMasterIncomeMain {
public static Logger logger = LogManager.getLogger("CarMasterIncome");
public static void main(String[] args) {
System.setProperty("logFilename", "./SmartCar/CarMaster2Income.txt");
org.apache.logging.log4j.core.LoggerContext ctx =
(org.apache.logging.log4j.core.LoggerContext) LogManager.getContext(false);
ctx.reconfigure();
String prefixName = "";
String postfixNum = "";
String carNum = "";
String sex = "";
String carSize = "";
for(int i=0; i <= 25 ; i++) {
prefixName = getCarPrefixName(i);
if(i==0) logger.info("carNum|sex|age|marriage|region|job|capacity|year|type|income");
for(int j=1; j <= 100; j++) {
postfixNum = getCarPostFixNum(j);
carNum = prefixName + postfixNum;
sex = getSex();
carSize = getCarSize();
logger.info(carNum + "|" + sex + "|" + getAge() + "|" + getMarriage() + "|" + getRegion() + "|" + getJob()
+ "|" + carSize + "|" + getCarYear() + "|" + getCarType() + "|" + getIncome(carSize));
}
}
System.out.println("########## CarMasterIncome LogGen is Finished ##########");
}
public static String getSex() {
String[] rData = {"남", "여"};
String result = rData[randomRange(0, 1)] ;
return result;
}
public static String getAge() {
String result = String.valueOf(randomRange(15, 70));
return result;
}
public static String getRegion() {
String[] rData = {"경기","서울","강원","인천","충북","충남","대전","경북","경남","대구","전북","전남","울산","부산","광주","제주","세종"};
String result = rData[randomRange(0, 16)] ;
return result;
}
public static String getJob() {
String[] rData = {"회사원","공무원","개인사업","전문직","프리랜서","주부","학생"};
String result = rData[randomRange(0, 6)] ;
return result;
}
public static String getMarriage() {
String[] rData = {"기혼", "미혼"};
String result = rData[randomRange(0, 1)] ;
return result;
}
public static String getCarSize() {
Random rValue = new Random();
int rg = 0;
rg = (int)(Math.abs(Math.ceil(1.0 * rValue.nextGaussian() + 4.5)));
if(rg < 0) rg = 0; else if(rg > 9) rg=9;
String[] rData = {"1000","1500", "2000", "2500", "3000", "3500", "4000", "4500", "5000", "5500"};
String result = rData[rg];
return result;
}
public static int getIncome(String inCome) {
int tInCome = Integer.parseInt(inCome);
int rNum = randomRange(0, 4);
tInCome += (tInCome * randomRange2(1, 3));
if(rNum == 0) {
tInCome += randomRange(100, 1000);
}
return tInCome;
}
public static String getCarYear() {
String result = String.valueOf(randomRange(2000, 2016));
return result;
}
public static String getCarType() {
String[] rData = {"A", "B" ,"C", "D", "E", "F", "G", "H", "I", "J"};
String result = rData[randomRange(0, 7)] ;
return result;
}
public static String getCarPrefixName(int num) {
String[] carNumPrefix = {"A", "B" , "C" , "D" , "E" , "F", "G", "H", "I", "J", "K", "L", "M", "N"
, "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"};
String prefixName = carNumPrefix[num] ;
return prefixName;
}
public static String getCarPostFixNum(int num) {
DecimalFormat format = new DecimalFormat("0000");
String carNum = format.format(num);
return carNum;
}
public static int randomRange(int n1, int n2) {
return (int)((Math.random() * (n2 - n1 + 1)) + n1);
}
public static double randomRange2(int n1, int n2) {
double num = ((int)(Math.random() * n2 + n1) * 0.1);
return num;
}
}
| [
"k2w@kt.com"
] | k2w@kt.com |
bf5b1bf7a183253b6542f844a789c48bee4ad133 | c53068134fedd0cc6b6032938ba3cc0599513c67 | /EjercicioP4_MovJoined/src/app/modelo/Coche.java | 536343e6b685ab28accfcf05286b111907a500b1 | [] | no_license | arellano84/persistence-jpa | e127d964f120914361b208c06e069d032f52de9c | 00484e70615de99b4076fc74f477a457ec289d0e | refs/heads/master | 2016-08-12T04:02:03.832146 | 2016-02-24T21:00:37 | 2016-02-24T21:00:37 | 52,471,716 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 999 | java | package app.modelo;
import java.io.Serializable;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.Table;
@Entity
@DiscriminatorValue(value="CO")
@Table(name="propuesto4_coche")
public class Coche extends Vehiculo implements Serializable {
private static final long serialVersionUID = 1L;
int puertas;
float longitud;
public Coche() {
}
public Coche(String modelo, float velocidad, int potencia, int puertas, float longitud) {
super(modelo, velocidad, potencia);
this.puertas = puertas;
this.longitud = longitud;
}
public int getPuertas() {
return puertas;
}
public void setPuertas(int puertas) {
this.puertas = puertas;
}
public float getLongitud() {
return longitud;
}
public void setLongitud(float longitud) {
this.longitud = longitud;
}
@Override
public String toString() {
return "Coche [puertas=" + puertas + ", longitud=" + longitud + "]";
}
}
| [
"ing.arellano@gmail.com"
] | ing.arellano@gmail.com |
9be0a1123c891fb780ed12f6073016df590c669b | dcb5e84b676cfa08f7eb7b5c8d80039fc6639c29 | /src/main/java/de/flapdoodle/embed/process/types/Wrapped.java | 9b6896cc3091a9ad9be151b5029fc9d2b81f65a5 | [
"Apache-2.0"
] | permissive | flapdoodle-oss/de.flapdoodle.embed.process | 5703b88aec0c2bb78ca0291471a9023a3d1c4a1f | 5fc4225ea7a3b1f4a6ecc191a6b17937ae989115 | refs/heads/main | 2023-07-22T11:25:00.509789 | 2023-07-16T13:03:27 | 2023-07-16T13:03:27 | 5,412,556 | 224 | 104 | Apache-2.0 | 2023-09-14T19:36:23 | 2012-08-14T12:37:01 | Java | UTF-8 | Java | false | false | 1,185 | java | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.flapdoodle.embed.process.types;
import org.immutables.value.Value;
import org.immutables.value.Value.Style.ImplementationVisibility;
@Value.Style(
typeAbstract = "_*",
typeImmutable = "*",
visibility = ImplementationVisibility.PUBLIC,
defaults = @Value.Immutable(builder = false, copy = false))
public @interface Wrapped {} | [
"michael@mosmann.de"
] | michael@mosmann.de |
f28ffa867b9cc8e3c502c285ad72b210460090c1 | ea94e67f56721cc61f3b559b1e0ea61246aceed5 | /src/org/uwiga/dao/CustomerDaoImpl.java | e5a9fb76eafe2426537ec0d905bf0806129b693e | [] | no_license | bagus-stimata/uwiga-workshop-pbo | fb2214757ca9cd56babe7affec317c9549b1dd70 | 599f080a9e73a641e001ab46852c6889cf78d619 | refs/heads/master | 2021-01-15T13:48:47.842912 | 2014-03-09T03:50:21 | 2014-03-09T03:50:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 817 | java | package org.uwiga.dao;
import java.util.*;
import org.uwiga.model.Customer;
public class CustomerDaoImpl implements CustomerDao {
//Tempat penyimanan >> Nantinya akan diganti dengan database
List<Customer> listCustomer = new ArrayList<>();
@Override
public void saveOrUpdate(Customer obj) {
// System.out.println(obj.getIdCustomer());
// System.out.println(obj.getName());
listCustomer.add(obj);
}
@Override
public void delete(Customer obj) {
listCustomer.remove(obj);
}
@Override
public List<Customer> findAll() {
// for (Customer item : customers){
// System.out.println(item);
// }
return listCustomer;
}
@Override
public List<Customer> findById() {
// Customer cust = new Customer();
// int index = customers.indexOf(cust);
// cust = customers.get(index);
return null;
}
}
| [
"uwiga_informati2010@yahoo.co.id"
] | uwiga_informati2010@yahoo.co.id |
7aeb2cdca81d2a99fe330a8ac124b5178b0baf6b | 64f76e1fac011cc179bd5f70143035f4fe209e51 | /src/kadai5adult/Kadai5.java | 95317b7a913fd3ae0d3b9aa2e774e413b1052da2 | [] | no_license | hsmtkk/techacademyjava | 7d324b5a4626f18691ec026ce9083668d7ec9bcb | a3c3af304d6cd13083796e8f21d0b7bc77dce652 | refs/heads/master | 2021-09-12T11:43:47.256676 | 2018-04-16T10:45:46 | 2018-04-16T10:45:46 | 109,827,547 | 0 | 0 | null | null | null | null | SHIFT_JIS | Java | false | false | 585 | java | package kadai5adult;
import java.util.Random;
public class Kadai5 {
public static void main(String[] args) {
int age = (new Random()).nextInt(100);
System.out.println(age + "歳");
if (0 <= age && age < 20) {
sout("未成年");
} else if (20 <= age) {
sout("成人");
if (20 <= age && age < 30) {
sout("20代");
} else if (30 <= age && age < 40) {
sout("30代");
} else {
sout("中高年");
}
} else {
sout("不正な年齢指定");
}
}
private static void sout(String s) {
System.out.println(s);
}
}
| [
"hsmtkk@gmail.com"
] | hsmtkk@gmail.com |
3630c0dbfbcf2541b3d338274d1a606fc635eaf0 | d46daef0abad86c0b13963ae5877e9dd58c42931 | /src/renderEngine/DisplayManager.java | 12c701e8492b1738705d944c38d7c5db23c36b51 | [] | no_license | thomasthechen/3D-Shooter-Game | 196f13c134457f5641f8d084bb923d5455d00a54 | 131baf68d51ca73f4c95361b167589f3dfeb7f06 | refs/heads/master | 2021-01-24T00:33:08.268222 | 2018-02-24T19:38:55 | 2018-02-24T19:38:55 | 122,769,813 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,533 | java | package renderEngine;
import org.lwjgl.LWJGLException;
import org.lwjgl.Sys;
import org.lwjgl.opengl.ContextAttribs;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.PixelFormat;
public class DisplayManager {
private static final int WIDTH = 1280;
private static final int HEIGHT = 720;
private static final int FPS_CAP = 120;
private static long lastFrameTime;
private static float delta;
public static void createDisplay() {
ContextAttribs attribs = new ContextAttribs(3,2).withForwardCompatible(true).withProfileCore(true);
try {
Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT));
Display.create(new PixelFormat(), attribs);
Display.setTitle("Response Hit: Planetary Aggression");
Display.setLocation(75, 0);
} catch (LWJGLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
GL11.glViewport(0, 0, WIDTH, HEIGHT);
lastFrameTime = getCurrentTime();
}
public static void updateDisplay(){
Display.sync(FPS_CAP);
Display.update();
long currentFrameTime = getCurrentTime();
delta = (currentFrameTime - lastFrameTime)/1000f;
lastFrameTime = currentFrameTime;
}
public static float getFrameTimeSeconds(){
return delta;
}
public static void closeDisplay(){
Display.destroy();
}
private static long getCurrentTime(){
return Sys.getTime() * 1000 / Sys.getTimerResolution();
}
}
| [
"thomasthechen1@gmail.com"
] | thomasthechen1@gmail.com |
515bf3ea0afbd42c658a67d3efbc88edaf05c89b | d2cbad193ca5952c6966a0ded004d52bead03dea | /2019-08-19-泛型类/src/ArrayListDemo.java | c94fcd3e2509c86771316f2d3312d171d1c560df | [] | no_license | haozhang27/java | 9184537b3edc514713db3dd2fd02351f746e02c9 | 1de305dd1460dd86028502cea7e6b564b015d8c5 | refs/heads/master | 2021-07-18T00:04:26.012311 | 2020-09-08T15:09:20 | 2020-09-08T15:09:20 | 203,134,797 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,451 | java | import java.util.ArrayList;
import java.util.List;
class Method {
private List<List<Integer>> generate0 (int numRows) {
List<List<Integer>> list = new ArrayList<>(numRows);
for (int i = 0; i < numRows; i++) {
List<Integer> nums = new ArrayList<>();
nums.add(1);
for (int j = 0; j <= i - 2; j++) {
List<Integer> preNums = list.get(i - 1);
int p = preNums.get(j);
int q = preNums.get(j + 1);
int n = p + q;
nums.add(n);
}
if (i != 0) {
nums.add(1);
}
list.add(nums);
}
return list;
}
private List<List<Integer>> generate1 (int numRows) {
List<List<Integer>> list;
/**
* outList 是一种引用,List 类型的接口引用
* outList 逻辑上是一种线性表
* 线性表的元素类型是 List</Integer>
* List 类型的引用接口
* 元素类型是 Integer 类类型的引用
* Integer 是 int 的包装类
*/
list = new ArrayList<>();
for (int i = 0; i < numRows; i++) {
list.add(new ArrayList<>(100));
}
list.get(0).add(1);
list.get(1).add(1);
list.get(1).add(1);
for (int i = 2; i < numRows; i++) {
List<Integer> nums = list.get(i);
nums.add(1);
for (int j = 1; j < i; j++) {
int num = list.get(i - 1).get(j - 1) +
list.get(i - 1).get(j);
nums.add(num);
}
nums.add(1);
}
return list;
}
private List<List<Integer>> generate2 (int numRows) {
List<List<Integer>> list = new ArrayList<>();
for (int i = 0; i < numRows; i++) {
list.add(new ArrayList<>());
}
for (int i = 1; i <= numRows; i++) {
for (int j = 0; j < i; j++) {
list.get(i).add(1);
}
}
return list;
}
public void testMethod (Method m, int n) {
System.out.println(m.generate0(n));
System.out.println(m.generate1(n));
System.out.println(m.generate2(n));
}
}
public class ArrayListDemo {
public static void main(String[] args) {
Method method = new Method();
method.testMethod(method, 6);
}
}
| [
"15592536102@163.com"
] | 15592536102@163.com |
03cd73a2049a79828e5504f9d8606e413ec654fe | dbda86008c3e14aabf0b6d77328073c473939d7a | /src/given/leetcode/editor/cn/LongestSubstringWithAtMostKDistinctCharacters_340.java | 60d6a981fae43340343dd4403ce7fa7160979900 | [] | no_license | GivenCui/leetcodeInJava | 02be2e62877223914cc1c9620cf80f09361c4158 | 7ce6a66f463b8bed5c61043f83b9cb1a151a86f7 | refs/heads/master | 2023-04-21T19:05:57.485379 | 2021-05-04T23:43:09 | 2021-05-04T23:43:09 | 361,595,925 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,506 | java | package given.leetcode.editor.cn;
//给定一个字符串 s ,找出 至多 包含 k 个不同字符的最长子串 T。
//
// 示例 1:
//
// 输入: s = "eceba", k = 2
//输出: 3
//解释: 则 T 为 "ece",所以长度为 3。
//
// 示例 2:
//
// 输入: s = "aa", k = 1
//输出: 2
//解释: 则 T 为 "aa",所以长度为 2。
//
// Related Topics 哈希表 双指针 字符串 Sliding Window
// 👍 125 👎 0
import java.util.HashMap;
// 340 至多包含 K 个不同字符的最长子串
public class LongestSubstringWithAtMostKDistinctCharacters_340 {
public static void main(String[] args) {
// 测试
Solution solution = new LongestSubstringWithAtMostKDistinctCharacters_340().new Solution();
System.out.println(solution.lengthOfLongestSubstringKDistinct("eceba", 2)); // 3
System.out.println(solution.lengthOfLongestSubstringKDistinct("eceba", 3)); // 4
System.out.println(solution.lengthOfLongestSubstringKDistinct("aa", 1)); // 2
System.out.println(solution.lengthOfLongestSubstringKDistinct("aa", 5)); // 2
}
//leetcode submit region begin(Prohibit modification and deletion)
// O(n) 执行耗时:7 ms,击败了82.32% 的Java用户
// O(1) 内存消耗:38.9 MB,击败了23.88% 的Java用户
class Solution {
public int lengthOfLongestSubstringKDistinct(String s, int k) {
if (s == null) return 0;
int len = s.length();
if (len <= k) return len; // 2个字符时, 至多包含两个不同字符的最长子串的长度是本身字符串长度
HashMap<Character, Integer> map = new HashMap<>();
int maxLen = k;
int left = 0, right = 0;
while (right < len) {
map.put(s.charAt(right), right++);
if (map.size() <= k) {
int subLen = right - left;
// System.out.println(s.substring(left, right));
maxLen = maxLen > subLen ? maxLen : subLen;
} else {
int oldestIndex = Integer.MAX_VALUE;
for (Integer value : map.values()) {
oldestIndex = oldestIndex > value ? value : oldestIndex;
}
left = oldestIndex + 1;
map.remove(s.charAt(oldestIndex));
}
}
return maxLen;
}
}
//leetcode submit region end(Prohibit modification and deletion)
} | [
"wow952100544@163.com"
] | wow952100544@163.com |
ea73c59a09f59bda0303e59d85ad596e6491b194 | aae446f7bbc953c3280c95a3fdb1b0e69b56000a | /09-Javaoopinteraction0/src/buyandsell/Main03.java | c356d31c3145141d1f45ac5deddaf29550dbf82a | [] | no_license | Ryu-kwonhee/javabasic | 499ee2c0c4e86099ee0ce2c5cd48167c0c3b151e | 48645def241fdb7bd5a4510872edfd14b308d3e6 | refs/heads/master | 2023-07-13T04:24:39.518230 | 2021-08-15T00:59:16 | 2021-08-15T00:59:16 | 380,178,606 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 223 | java | package buyandsell;
public class Main03 {
public static void main(String[] args) {
Seller2 s2 = new Seller2(10);
Buyer buyer = new Buyer(10000);
buyer.buyApple(s2, 5);
s2.showSeller2();
buyer.showBuyer2();
}
}
| [
"wnsgkdl123@naver.com"
] | wnsgkdl123@naver.com |
b7ccb60198607678ed282231488daa3542104c5e | aa53a0f1ec8aaab82f2de0a5f828679c1792613a | /app/src/main/java/org/login/com/threadfragmentroomnavigationbar/db/dao/UserDao.java | e1a1b0f79a3eab63171e17e845ea2656c0d3228d | [] | no_license | MonimCse/Splash-Fragment-Room-ORM- | e7cebab99226f928ef1505af19b81c02420fc6fe | 87dd8a0605da5380db08189d78f41690b895f6bf | refs/heads/master | 2020-03-19T16:00:05.684507 | 2018-07-07T14:14:32 | 2018-07-07T14:14:32 | 136,695,401 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 628 | java | package org.login.com.threadfragmentroomnavigationbar.db.dao;
import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.Query;
import org.login.com.threadfragmentroomnavigationbar.db.entities.User;
import java.util.ArrayList;
import java.util.List;
@Dao
public interface UserDao {
@Query("select * from User")
List<User> getAll();
@Query("select * from User where email=:email and password=:password")
User checkLogin(String email,String password);
@Insert
long insert(User user);
@Insert
void insert(List<User> users);
}
| [
"cse.monim@gmail.com"
] | cse.monim@gmail.com |
87d8640cf608a28dd95e0493c1f877bc66b53f3c | 7f298c2bf9ff5a61eeb87e3929e072c9a04c8832 | /spring-test/src/test/java/org/springframework/test/context/junit/jupiter/SpringJUnitJupiterConstructorInjectionTests.java | bc24e6a68c8b886022a97b9e1e0903a4a9f1af7c | [
"Apache-2.0"
] | permissive | stwen/my-spring5 | 1ca1e85786ba1b5fdb90a583444a9c030fe429dd | d44be68874b8152d32403fe87c39ae2a8bebac18 | refs/heads/master | 2023-02-17T19:51:32.686701 | 2021-01-15T05:39:14 | 2021-01-15T05:39:14 | 322,756,105 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,271 | java | /*
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.context.junit.jupiter;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit.SpringJUnitJupiterTestSuite;
import org.springframework.test.context.junit.jupiter.comics.Dog;
import org.springframework.test.context.junit.jupiter.comics.Person;
import static org.junit.jupiter.api.Assertions.*;
/**
* Integration tests which demonstrate support for autowiring individual
* parameters in test class constructors using {@link Autowired @Autowired}
* and {@link Value @Value} with the Spring TestContext Framework and JUnit Jupiter.
*
* <p>To run these tests in an IDE that does not have built-in support for the JUnit
* Platform, simply run {@link SpringJUnitJupiterTestSuite} as a JUnit 4 test.
*
* @author Sam Brannen
* @see SpringExtension
* @see SpringJUnitJupiterAutowiredConstructorInjectionTests
* @since 5.0
*/
@SpringJUnitConfig(TestConfig.class)
@TestPropertySource(properties = "enigma = 42")
class SpringJUnitJupiterConstructorInjectionTests {
final ApplicationContext applicationContext;
final Person dilbert;
final Dog dog;
final Integer enigma;
final TestInfo testInfo;
SpringJUnitJupiterConstructorInjectionTests(ApplicationContext applicationContext, @Autowired Person dilbert,
@Autowired Dog dog, @Value("${enigma}") Integer enigma, TestInfo testInfo) {
this.applicationContext = applicationContext;
this.dilbert = dilbert;
this.dog = dog;
this.enigma = enigma;
this.testInfo = testInfo;
}
@Test
void applicationContextInjected() {
assertNotNull(applicationContext, "ApplicationContext should have been injected by Spring");
assertEquals(this.dilbert, applicationContext.getBean("dilbert", Person.class));
}
@Test
void beansInjected() {
assertNotNull(this.dilbert, "Dilbert should have been @Autowired by Spring");
assertEquals("Dilbert", this.dilbert.getName(), "Person's name");
assertNotNull(this.dog, "Dogbert should have been @Autowired by Spring");
assertEquals("Dogbert", this.dog.getName(), "Dog's name");
}
@Test
void propertyPlaceholderInjected() {
assertNotNull(this.enigma, "Enigma should have been injected via @Value by Spring");
assertEquals(Integer.valueOf(42), this.enigma, "enigma");
}
@Test
void testInfoInjected() {
assertNotNull(this.testInfo, "TestInfo should have been injected by JUnit");
}
}
| [
"xianhao_gan@qq.com"
] | xianhao_gan@qq.com |
eb4bfb1c1f65fa5a5b158088e437c784360420c0 | 1931d013d485a0f63e6210eea4bafb8e59eb731e | /src/com/java02014/genius/util/GeniusException.java | 8cbab86ff071a71edbfae368b96ab9379c224dd1 | [] | no_license | java02014/Genius | 62596ff8c0375e2f850a311d6f575278df9cfa8f | d5c994f7eb12b19e05a5ca97a866ac96bead5eeb | refs/heads/master | 2020-05-19T14:17:02.851341 | 2015-04-08T07:59:26 | 2015-04-08T07:59:26 | 33,590,872 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,156 | java | /*
* Copyright (C) 2014 Qiujuer <qiujuer@live.cn>
* WebSite http://www.qiujuer.net
* Created 11/24/2014
* Changed 01/14/2015
* Version 1.0.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.java02014.genius.util;
/**
* Created by QiuJu on 2014/11/24.
*/
public class GeniusException extends RuntimeException {
private static final long serialVersionUID = -1L;
public GeniusException(String detailMessage) {
super(detailMessage);
}
public GeniusException(Throwable throwable) {
super(throwable);
}
public GeniusException(String detailMessage, Throwable throwable) {
super(detailMessage, throwable);
}
} | [
"yawei@jiaolianx.com"
] | yawei@jiaolianx.com |
4b6c9c5c32d663dc0fb144d1fc5a0cd548211929 | ca217730cff9435b03347587d61d2ef28b478f7e | /old/tileentities/SCPTileEntity076.java | 3d6e2494b83df71ffe265edd81b6505751b7cec7 | [] | no_license | Ordinastie/SCPCraft | e8c4c78cc86ac0e7f364156058f35ce30adf059d | 547a204bb14fc33adefb9926baca2f5188d89421 | refs/heads/master | 2023-07-18T19:50:59.231189 | 2014-03-21T23:59:54 | 2014-03-21T23:59:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,623 | java | package SCPCraft.tileentities;
import java.util.Iterator;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.Packet132TileEntityData;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class SCPTileEntity076 extends TileEntity
{
/** The stored delay before a new spawn. */
public int delay = -1;
/**
* The string ID of the mobs being spawned from this spawner. Defaults to pig, apparently.
*/
private String mobID = "SCP-076";
/** The extra NBT data to add to spawned entities */
private NBTTagCompound spawnerTags = null;
public double yaw;
public double yaw2 = 0.0D;
@SideOnly(Side.CLIENT)
private Entity spawnedMob;
public SCPTileEntity076()
{
}
@SideOnly(Side.CLIENT)
public String getMobID()
{
return this.mobID;
}
public void setMobID(String par1Str)
{
this.mobID = par1Str;
}
/**
* Allows the entity to update its state. Overridden in most subclasses, e.g. the mob spawner uses this to count
* ticks and creates a new spawn inside its implementation.
*/
public void updateEntity()
{
if (this.worldObj.isRemote)
{
double var1 = (double)((float)this.xCoord + this.worldObj.rand.nextFloat());
double var3 = (double)((float)this.yCoord + this.worldObj.rand.nextFloat());
double var5 = (double)((float)this.zCoord + this.worldObj.rand.nextFloat());
this.worldObj.spawnParticle("smoke", var1, var3, var5, 0.0D, 0.0D, 0.0D);
this.worldObj.spawnParticle("flame", var1, var3, var5, 0.0D, 0.0D, 0.0D);
this.worldObj.spawnParticle("smoke", var1 + 1, var3, var5, 0.0D, 0.0D, 0.0D);
this.worldObj.spawnParticle("flame", var1 + 1, var3, var5, 0.0D, 0.0D, 0.0D);
this.worldObj.spawnParticle("smoke", var1, var3, var5 + 1, 0.0D, 0.0D, 0.0D);
this.worldObj.spawnParticle("flame", var1, var3, var5 + 1, 0.0D, 0.0D, 0.0D);
this.worldObj.spawnParticle("smoke", var1, var3 + 1, var5, 0.0D, 0.0D, 0.0D);
this.worldObj.spawnParticle("flame", var1, var3 + 1, var5, 0.0D, 0.0D, 0.0D);
this.worldObj.spawnParticle("smoke", var1 + 1, var3 + 1, var5, 0.0D, 0.0D, 0.0D);
this.worldObj.spawnParticle("flame", var1 + 1, var3 + 1, var5, 0.0D, 0.0D, 0.0D);
this.worldObj.spawnParticle("smoke", var1, var3 + 1, var5 + 1, 0.0D, 0.0D, 0.0D);
this.worldObj.spawnParticle("flame", var1, var3 + 1, var5 + 1, 0.0D, 0.0D, 0.0D);
this.yaw2 = this.yaw % 360.0D;
this.yaw += 4.545454502105713D;
}
else
{
if (this.delay == -1)
{
this.updateDelay();
}
//10 ticks = 1 second
if(this.delay == 90)worldObj.playSoundEffect((double)((float)this.xCoord + 0.5F), (double)((float)this.yCoord + 0.5F), (double)((float)this.zCoord + 0.5F), "sounds.StoneDoorOpen", 0.5F, 1F);
for (int var11 = 0; var11 < 1; ++var11)
{
Entity var2 = EntityList.createEntityByName(this.mobID, this.worldObj);
if (var2 == null)
{
return;
}
int var12 = this.worldObj.getEntitiesWithinAABB(var2.getClass(), AxisAlignedBB.getAABBPool().getAABB((double)this.xCoord, (double)this.yCoord, (double)this.zCoord, (double)(this.xCoord + 256), (double)(this.yCoord + 256), (double)(this.zCoord + 256)).expand(256.0D, 40.0D, 256.0D)).size();
if (var12 >= 1)
{
this.updateDelay();
return;
}
if (var2 != null)
{
if (this.delay > 0)
{
--this.delay;
System.out.println(delay);
return;
}
double var4 = (double)this.xCoord + 0.5D;
double var6 = (double)this.yCoord + 1D;
double var8 = (double)this.zCoord + 0.5D;
var2.setLocationAndAngles(var4, var6, var8, this.worldObj.rand.nextFloat() * 360.0F, 0.0F);
this.writeNBTTagsTo(var2);
this.worldObj.spawnEntityInWorld(var2);
}
}
}
super.updateEntity();
}
public void writeNBTTagsTo(Entity par1Entity)
{
if (this.spawnerTags != null)
{
NBTTagCompound var2 = new NBTTagCompound();
par1Entity.addEntityID(var2);
Iterator var3 = this.spawnerTags.getTags().iterator();
while (var3.hasNext())
{
NBTBase var4 = (NBTBase)var3.next();
var2.setTag(var4.getName(), var4.copy());
}
par1Entity.readFromNBT(var2);
}
}
/**
* Sets the delay before a new spawn (base delay of 200 + random number up to 600).
*/
private void updateDelay()
{
this.delay = 200 + this.worldObj.rand.nextInt(5000);
}
/**
* Reads a tile entity from NBT.
*/
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readFromNBT(par1NBTTagCompound);
this.mobID = par1NBTTagCompound.getString("EntityId");
this.delay = par1NBTTagCompound.getShort("Delay");
if (par1NBTTagCompound.hasKey("SpawnData"))
{
this.spawnerTags = par1NBTTagCompound.getCompoundTag("SpawnData");
}
else
{
this.spawnerTags = null;
}
}
/**
* Writes a tile entity to NBT.
*/
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeToNBT(par1NBTTagCompound);
par1NBTTagCompound.setString("EntityId", this.mobID);
par1NBTTagCompound.setShort("Delay", (short)this.delay);
if (this.spawnerTags != null)
{
par1NBTTagCompound.setCompoundTag("SpawnData", this.spawnerTags);
}
}
@SideOnly(Side.CLIENT)
/**
* will create the entity from the internalID the first time it is accessed
*/
public Entity getMobEntity()
{
if (this.spawnedMob == null)
{
Entity var1 = EntityList.createEntityByName(this.getMobID(), (World)null);
this.writeNBTTagsTo(var1);
this.spawnedMob = var1;
}
return this.spawnedMob;
}
/**
* Overriden in a sign to provide the text.
*/
public Packet getDescriptionPacket()
{
NBTTagCompound var1 = new NBTTagCompound();
this.writeToNBT(var1);
return new Packet132TileEntityData(this.xCoord, this.yCoord, this.zCoord, 1, var1);
}
}
| [
"ntzrmtthihu777@gmail.com"
] | ntzrmtthihu777@gmail.com |
17fe0f0e18481f4204b95fcd3edcdaaab4d41512 | 813a61d076cfb635edf1f24ac29d25dae8892b63 | /src/com/BaseType/BaseTypeDemo.java | 88d85d4a7adc8c9cc985018993172233f323cb13 | [] | no_license | upupuup/ZDemo | 85aa5304585e6b0f6632723aaca405d18316e920 | c0628f5b8e5dddd3f6faaf34a92e14f41acfc735 | refs/heads/master | 2021-06-21T18:31:01.224961 | 2021-01-25T01:07:29 | 2021-01-25T01:07:29 | 165,954,453 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 489 | java | package com.BaseType;
public class BaseTypeDemo {
public static void main(String[] args) {
short s1 = 1;
// 错误的方式,因为1是int,s1 + 1需要向下转型,否则会报错
// s1 = s1 + 1;
s1 = (short) (s1 + 1);
System.out.println(s1);
s1 += 1;
System.out.println(s1);
// 错误的方式,因为3.4是双精度,赋值给float需要向下转型
// float f1 = 3.4;
float f1 = 3.4f;
}
}
| [
"woyaojiayou_a@163.com"
] | woyaojiayou_a@163.com |
522bcc897e328e6925eef32230b8ef8371f97f3e | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/3/3_cec41acb2a06d66ed1e672c3fc4927242843197e/Main/3_cec41acb2a06d66ed1e672c3fc4927242843197e_Main_s.java | be8397c0088d9474f7bedaf9b8c4778ce2e0aba5 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 3,956 | java | /*
* This file is part of Spoutcraft Launcher (http://wiki.getspout.org/).
*
* Spoutcraft Launcher is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Spoutcraft Launcher is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.spoutcraft.launcher;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.ArrayList;
import javax.swing.UIManager;
import org.spoutcraft.launcher.gui.LoginForm;
import org.spoutcraft.launcher.logs.SystemConsoleListener;
import com.beust.jcommander.JCommander;
public class Main {
static String[] args_temp;
public static int build = -1;
static File recursion;
public Main() throws Exception {
main(new String[0]);
}
public static void reboot(String memory) {
try {
String pathToJar = Main.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath();
ArrayList<String> params = new ArrayList<String>();
if (PlatformUtils.getPlatform() == PlatformUtils.OS.windows) {
params.add("javaw"); // Windows-specific
} else {
params.add("java"); // Linux/Mac/whatever
}
params.add(memory);
params.add("-classpath");
params.add(pathToJar);
params.add("org.spoutcraft.launcher.Main");
for (String arg : args_temp) {
params.add(arg);
}
ProcessBuilder pb = new ProcessBuilder(params);
Process process = pb.start();
if(process == null)
throw new Exception("!");
System.exit(0);
} catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) throws Exception {
Options options = new Options();
try {
new JCommander(options, args);
} catch (Exception ex) {
ex.printStackTrace();
}
MinecraftUtils.setOptions(options);
recursion = new File(PlatformUtils.getWorkingDirectory(), "rtemp");
args_temp = args;
boolean relaunch = false;
try {
if (!recursion.exists()) {
relaunch = true;
} else {
recursion.delete();
}
} catch (Exception e) {
//e.printStackTrace();
}
if (relaunch) {
if (SettingsUtil.getMemorySelection() < 6) {
int mem = 1 << (9 + SettingsUtil.getMemorySelection());
recursion.createNewFile();
reboot("-Xmx" + mem + "m");
}
}
PlatformUtils.getWorkingDirectory().mkdirs();
new File(PlatformUtils.getWorkingDirectory(), "spoutcraft").mkdir();
SystemConsoleListener listener = new SystemConsoleListener();
listener.initialize();
System.out.println("------------------------------------------");
System.out.println("Spoutcraft Launcher is starting....");
System.out.println("Spoutcraft Launcher Build: " + getBuild());
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
System.out.println("Warning: Can't get system LnF: " + e);
}
LoginForm login = new LoginForm();
login.setVisible(true);
}
private static int getBuild() {
if (build == -1) {
File buildInfo = new File(PlatformUtils.getWorkingDirectory(), "launcherVersion");
if (buildInfo.exists()) {
try {
BufferedReader bf = new BufferedReader(new FileReader(buildInfo));
String version = bf.readLine();
build = Integer.parseInt(version);
}
catch (Exception e) {
e.printStackTrace();
}
}
}
return build;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
beda1aedd9872e97d758695bf4c9c80884002c5a | 44bb8ff849d28a650424805601efd7ddcf4a60e7 | /src/main/java/com/deity/struts/util/UserManager.java | 214e9519dd16693d0412ce2bf6ab3ada73a3ccfe | [] | no_license | DeityWD/struts1 | 7a356c06571c390067cabe30c3103e27859ea3af | a7bf423a98624538a8a9126ad3bfb56271c892dc | refs/heads/master | 2021-01-20T09:19:41.391779 | 2017-05-04T09:18:13 | 2017-05-04T09:18:13 | 90,232,576 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 242 | java | package com.deity.struts.util;
public class UserManager {
public static String login(String account,String password) {
if (account.equals("admin") && password.equals("admin")) {
return "success";
}else{
return "error";
}
}
}
| [
"1175497396@qq.com"
] | 1175497396@qq.com |
e7e5b9fd3a48ee100b226330fe9822fbf4c0efc1 | 3d08e5543bb601d0a99bc22ff1ebd4d8a335ab4e | /src/org/kratenok/task/Task2.java | d99bbbdf309e8d85cff32cba83b11151dc3ab917 | [] | no_license | Gizmund/HomeWork3 | 07f1e69af9b023a3da26467431eecfa64552b7d1 | 46d08e926f5c18720a8641c985b8e0c28f5098e3 | refs/heads/master | 2020-03-28T07:51:21.053091 | 2018-09-08T11:30:53 | 2018-09-08T11:30:53 | 147,927,677 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 905 | java | package org.kratenok.task;
import java.util.Scanner;
public class Task2 {
public static void main(String[] args) {
Integer[] array = new Integer[10];
Scanner scan = new Scanner(System.in);
int sum = 0;
for (int i = 0; i < array.length; i++) {
if (scan.hasNextInt()) {
array[i] = scan.nextInt();
sum = sum + array[i];
System.out.println("В элемент под номером " + i + " записано значение " + array[i]);
} else {
System.out.println("Вы ввели неверное значение " + scan.next());
System.out.println("Попробуйте еще раз");
i--;
}
}
System.out.println("Среднее арифметическое элементов " + sum/array.length);
}
}
| [
"qaseqwe@gmail.com"
] | qaseqwe@gmail.com |
9c3aa4d99102884ee46fc204eca8a4dbba104c9b | cbfacf551b7c9e447286987389e2e2dc62763341 | /LprimeFace/src/java/diu/edu/bd/controller/PManpowerChartBean.java | b15128f7700debe74e18a82d724c4975e07fd7a9 | [] | no_license | skpodder/java-project | 0f45fe0b9e404d6ad80e23fd7cf5f3049e4ab7ca | 4f2b0949e4af58a9b733da0a7d7b275d3893b644 | refs/heads/master | 2021-01-22T05:57:28.113291 | 2017-02-12T12:35:01 | 2017-02-12T12:35:01 | 81,723,800 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,499 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package diu.edu.bd.controller;
import diu.edu.bd.util.DatabaseUtil;
import java.io.Serializable;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.naming.NamingException;
import org.primefaces.model.chart.BarChartModel;
import org.primefaces.model.chart.ChartSeries;
/**
*
* @author sagar
*/
@ManagedBean
@RequestScoped
public class PManpowerChartBean implements Serializable{
public BarChartModel barChartModel=new BarChartModel();
DatabaseUtil databaseUtil=new DatabaseUtil();
/**
* Creates a new instance of PCuttingChartBean
*/
public PManpowerChartBean() {
try {
Statement stm=databaseUtil.getKpi().getConnection().createStatement();
ResultSet rsm=stm.executeQuery("SELECT monthname(date) Month ,sum(cuttingTotalManPower) cutting,sum( p.`finishingTotalManPower`) finishing FROM kpi.pimanPower p group by month");
ChartSeries finishing=new ChartSeries();
finishing.setLabel("finishing");
ChartSeries cutting=new ChartSeries();
cutting.setLabel("cutting");
ChartSeries month=new ChartSeries();
month.setLabel("KPI");
while(rsm.next()){
cutting.set(rsm.getString(1), rsm.getInt(2));
finishing.set(rsm.getString(1), rsm.getInt(3));
month.set(rsm.getString(1), rsm.getInt(3)+rsm.getInt(2));
}
barChartModel.addSeries(finishing);
barChartModel.addSeries(cutting);
barChartModel.addSeries(month);
} catch (SQLException ex) {
Logger.getLogger(PCuttingChartBean.class.getName()).log(Level.SEVERE, null, ex);
} catch (NamingException ex) {
Logger.getLogger(PCuttingChartBean.class.getName()).log(Level.SEVERE, null, ex);
}
}
public BarChartModel getBarChartModel() {
return barChartModel;
}
public void setBarChartModel(BarChartModel barChartModel) {
this.barChartModel = barChartModel;
}
public DatabaseUtil getDatabaseUtil() {
return databaseUtil;
}
public void setDatabaseUtil(DatabaseUtil databaseUtil) {
this.databaseUtil = databaseUtil;
}
} | [
"skpodder007@gmail.com"
] | skpodder007@gmail.com |
d7474818a74d3648f3cb023f252832c4bd5dbf8a | 3392d5bcf699b334c8f1a53c2504c4609373adc7 | /src/main/java/com/yuga/modules/cms/dao/ArticleDao.java | dd715857050871fbee5d885dfa132cc1a41c87e8 | [] | no_license | zengkang007/yuga-admin-web | c59eb674dce8ae3931bf7a5c66930bb947b0cbc5 | 8a032388173e2e999578d8d7a11049e10cebb432 | refs/heads/master | 2021-01-11T04:29:47.622038 | 2017-04-13T15:51:05 | 2017-04-13T15:51:05 | 71,149,959 | 0 | 1 | null | 2016-10-25T08:39:45 | 2016-10-17T14:56:19 | JavaScript | UTF-8 | Java | false | false | 1,006 | java | /**
* Copyright © 2012-2014 <a href="https://github.com/thinkgem/ksm">ksm</a> All rights reserved.
*/
package com.yuga.modules.cms.dao;
import java.util.List;
import com.yuga.common.persistence.CrudDao;
import com.yuga.common.persistence.annotation.MyBatisDao;
import com.yuga.modules.cms.entity.Article;
import com.yuga.modules.cms.entity.Category;
/**
* 文章DAO接口
* @author ThinkGem
* @version 2013-8-23
*/
@MyBatisDao
public interface ArticleDao extends CrudDao<Article> {
public List<Article> findByIdIn(String[] ids);
// {
// return find("from Article where id in (:p1)", new Parameter(new Object[]{ids}));
// }
public int updateHitsAddOne(String id);
// {
// return update("update Article set hits=hits+1 where id = :p1", new Parameter(id));
// }
public int updateExpiredWeight(Article article);
public List<Category> findStats(Category category);
// {
// return update("update Article set weight=0 where weight > 0 and weightDate < current_timestamp()");
// }
}
| [
"x86power"
] | x86power |
ede89e1722ec06a5f1c84c6183e50d64a65ff3e5 | ba0d4324a7121a2ef01e9c63cf928ada6953e304 | /SinchDemo/SinchDemo/gen/com/sinch/demo/Manifest.java | b115e003e47eb483a36ead11d833e02447aa5610 | [] | no_license | itkindlebit/SinchCall | 1ab1550536b6007e2fbb2a2ad47d48fb80603b66 | e9c7fbeae0bff81a869e1cf42625f2669d4727b9 | refs/heads/master | 2020-05-04T19:49:27.970534 | 2015-01-23T07:00:16 | 2015-01-23T07:00:16 | 29,668,474 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 376 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.sinch.demo;
public final class Manifest {
public static final class permission {
public static final String C2D_MESSAGE="com.sinch.demo.permission.C2D_MESSAGE";
}
}
| [
"ram.sharma@kindlebit.com"
] | ram.sharma@kindlebit.com |
1d7916834ddb97fe82def0726822950490e2261f | cd937b33e944c65163e770932294ce0309aa5196 | /app/src/main/java/uk/ac/qub/eeecs/gage/world/Sprite.java | 4ca155382549e0c78460de1843765d17352f80ac | [] | no_license | Jbt3377/Minecraft-Card-Game | c8e9db4e9bdfe887322eae5c5fef0fc813988311 | 6d62975023395509af997e586227a9e45a2106dd | refs/heads/master | 2022-12-03T00:56:08.334549 | 2020-04-21T12:32:45 | 2020-04-21T12:33:28 | 259,166,408 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,963 | java | package uk.ac.qub.eeecs.gage.world;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import uk.ac.qub.eeecs.gage.engine.ElapsedTime;
import uk.ac.qub.eeecs.gage.engine.graphics.IGraphics2D;
import uk.ac.qub.eeecs.gage.util.GraphicsHelper;
import uk.ac.qub.eeecs.gage.util.Vector2;
/**
* Simple sprite class (supporting rotation)
*
* @version 1.0
*/
public class Sprite extends GameObject {
// /////////////////////////////////////////////////////////////////////////
// Default values
// /////////////////////////////////////////////////////////////////////////
/**
* Default maximum acceleration and velocity
*/
public static float DEFAULT_MAX_ACCELERATION = Float.MAX_VALUE;
public static float DEFAULT_MAX_VELOCITY = Float.MAX_VALUE;
/**
* Default maximum angular acceleration and velocity
*/
public static float DEFAULT_MAX_ANGULAR_ACCELERATION = Float.MAX_VALUE;
public static float DEFAULT_MAX_ANGULAR_VELOCITY = Float.MAX_VALUE;
// /////////////////////////////////////////////////////////////////////////
// Properties
// /////////////////////////////////////////////////////////////////////////
/**
* Acceleration and velocity of the sprite, alongside maximum values.
* Position is inherited from game object.
*/
public Vector2 velocity = new Vector2();
public Vector2 acceleration = new Vector2();
public float maxAcceleration = DEFAULT_MAX_ACCELERATION;
public float maxVelocity = DEFAULT_MAX_VELOCITY;
/**
* Orientation alongside angular velocity and acceleration, with maximum
* values.
*/
public float orientation;
public float angularVelocity;
public float angularAcceleration;
public float maxAngularAcceleration = DEFAULT_MAX_ANGULAR_ACCELERATION;
public float maxAngularVelocity = DEFAULT_MAX_ANGULAR_VELOCITY;
/**
* Internal matrix use to support draw requests
*/
protected Matrix drawMatrix = new Matrix();
// /////////////////////////////////////////////////////////////////////////
// Constructors
// /////////////////////////////////////////////////////////////////////////
/**
* Create a new Sprite
*
* @param gameScreen Gamescreen to which this sprite belongs
*/
public Sprite(GameScreen gameScreen) {
super(gameScreen);
}
/**
* Create a new sprite. The size will be set to that of the associated
* bitmap
*
* @param x Centre y location of the sprite
* @param y Centre x location of the sprite
* @param bitmap Bitmap used to represent this sprite
* @param gameScreen Gamescreen to which this sprite belongs
*/
public Sprite(float x, float y, Bitmap bitmap, GameScreen gameScreen) {
super(x, y, bitmap, gameScreen);
}
/**
* Create a new sprite.
*
* @param x Centre y location of the sprite
* @param y Centre x location of the sprite
* @param width Width of the sprite
* @param height Height of the sprite
* @param bitmap Bitmap used to represent this sprite
* @param gameScreen Gamescreen to which this sprite belongs
*/
public Sprite(float x, float y, float width, float height, Bitmap bitmap,
GameScreen gameScreen) {
super(x, y, width, height, bitmap, gameScreen);
}
// /////////////////////////////////////////////////////////////////////////
// Configuration Methods
// /////////////////////////////////////////////////////////////////////////
// /////////////////////////////////////////////////////////////////////////
// Update and Draw
// /////////////////////////////////////////////////////////////////////////
/*
* (non-Javadoc)
*
* @see
* uk.ac.qub.eeecs.gage.world.GameObject#update(uk.ac.qub.eeecs.gage.engine
* .ElapsedTime)
*/
@Override
public void update(ElapsedTime elapsedTime) {
float dt = (float) elapsedTime.stepTime;
// Ensure the maximum acceleration isn't exceeded
if (acceleration.lengthSquared() > maxAcceleration * maxAcceleration) {
acceleration.normalise();
acceleration.multiply(maxAcceleration);
}
// Update the velocity using the acceleration and ensure the
// maximum velocity has not been exceeded
velocity.add(acceleration.x * dt, acceleration.y * dt);
if (velocity.lengthSquared() > maxVelocity * maxVelocity) {
velocity.normalise();
velocity.multiply(maxVelocity);
}
// Update the position using the velocity
position.add(velocity.x * dt, velocity.y * dt);
// Ensure the maximum angular acceleration isn't exceeded
if (angularAcceleration < -maxAngularAcceleration
|| angularAcceleration > maxAngularAcceleration) {
angularAcceleration = Math.signum(angularAcceleration)
* maxAngularAcceleration;
}
// Update the angular velocity using the angular acceleration and
// ensure the maximum angular velocity has not been exceeded
angularVelocity += angularAcceleration * dt;
if (angularVelocity < -maxAngularVelocity
|| angularVelocity > maxAngularVelocity) {
angularVelocity = Math.signum(angularVelocity) * maxAngularVelocity;
}
// Update the orientation using the angular velocity
orientation += angularVelocity * dt;
}
/*
* (non-Javadoc)
*
* @see
* uk.ac.qub.eeecs.gage.world.GameObject#draw(uk.ac.qub.eeecs.gage.engine
* .ElapsedTime, uk.ac.qub.eeecs.gage.engine.graphics.IGraphics2D,
* uk.ac.qub.eeecs.gage.world.LayerViewport,
* uk.ac.qub.eeecs.gage.world.ScreenViewport)
*/
@Override
public void draw(ElapsedTime elapsedTime, IGraphics2D graphics2D,
LayerViewport layerViewport, ScreenViewport screenViewport) {
if (GraphicsHelper.getSourceAndScreenRect(this, layerViewport,
screenViewport, drawSourceRect, drawScreenRect)) {
float scaleX =
(float) drawScreenRect.width()
/ (float) drawSourceRect.width();
float scaleY =
(float) drawScreenRect.height()
/ (float) drawSourceRect.height();
// Build an appropriate transformation matrix
drawMatrix.reset();
drawMatrix.postScale(scaleX, scaleY);
drawMatrix.postRotate(orientation, scaleX * mBitmap.getWidth()
/ 2.0f, scaleY * mBitmap.getHeight() / 2.0f);
drawMatrix.postTranslate(drawScreenRect.left, drawScreenRect.top);
// Draw the image
graphics2D.drawBitmap(mBitmap, drawMatrix, null);
}
}
} | [
"beattyjoshua55@Gmail.com"
] | beattyjoshua55@Gmail.com |
16d64a9aec10ed9983005e9f8f41f38040638d61 | 6b41b73fb5a0ec3a1cfeab31afc204ebc0682156 | /src/main/java/ChatClient.java | 3e602e7db3589d8d549aa372f01189f6076b149a | [] | no_license | rafaoncloud/secure-chat-java-8 | 16bd659b484e3ba333fc26e635afd7e7d6a06322 | 7154f48312e210e59296af7f5db50c2db2b99cd4 | refs/heads/master | 2020-05-25T14:46:50.023898 | 2019-05-25T12:44:20 | 2019-05-25T12:44:20 | 187,854,036 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,874 | java | package main.java;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
import java.net.UnknownHostException;
import java.security.InvalidKeyException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.UnrecoverableEntryException;
import java.security.cert.CertificateException;
import java.util.Base64;
public class ChatClient implements Runnable
{
private Socket socket = null;
private Thread thread = null;
private DataInputStream console = null;
private DataOutputStream streamOut = null;
private ChatClientThread client = null;
// Added - Cryptography
private SymmetricEncryption crypt = null;
private Certification cert = null;
public ChatClient(String serverName, int serverPort, int clientID)
{
System.out.println("Establishing connection to server...");
try
{
System.out.println("[LOG] Reading up certification key stores and set up signature...");
cert = new Certification(clientID);
// Establishes connection with server (name and port)
socket = new Socket(serverName, serverPort);
System.out.println("Connected to server: " + socket);
start();
} catch (UnknownHostException uhe)
{
// Host unkwnown
System.out.println("Error establishing connection - host unknown: " + uhe.getMessage());
} catch (IOException ioexception)
{
// Other error establishing connection
System.out.println("Error establishing connection - unexpected exception: " + ioexception.getMessage());
} // Added
catch (CertificateException e)
{
e.printStackTrace();
} catch (NoSuchAlgorithmException e)
{
e.printStackTrace();
} catch (InvalidKeyException e)
{
e.printStackTrace();
} catch (UnrecoverableEntryException e)
{
e.printStackTrace();
} catch (KeyStoreException e)
{
e.printStackTrace();
}
}
public void run()
{
String msg = null;
while (thread != null)
{
try
{
// Added - Encrypt Message
msg = console.readLine();
//String encryptedMsg = crypt.encrypt(msg);
String encryptedMsg = crypt.encrypt(msg, cert.getMyPublicAlias(), cert.sign(msg));
// Sends message from console to server
streamOut.writeUTF(encryptedMsg);
streamOut.flush();
} catch (IOException ioexception)
{
System.out.println("Error sending string to server: " + ioexception.getMessage());
stop();
} catch (Exception e)
{
e.printStackTrace();
}
}
}
public void handle(String msg)
{
// Added - Decrypted Message
String decryptedMsg = null;
try
{
decryptedMsg = crypt.decrypt(msg, cert).getPlainText();
} catch (Exception e)
{
e.printStackTrace();
}
// Receives message from server
if (msg.equals(".quit"))
{
// Leaving, quit command
System.out.println("Exiting...Please press RETURN to exit ...");
stop();
} else
// else, writes message received from server to console
System.out.println(decryptedMsg);
}
// Inits new client thread
public void start() throws IOException
{
console = new DataInputStream(System.in);
streamOut = new DataOutputStream(socket.getOutputStream());
if (thread == null)
{
client = new ChatClientThread(this, socket);
thread = new Thread(this);
thread.start();
}
}
// Stops client thread
public void stop()
{
if (thread != null)
{
thread.stop();
thread = null;
}
try
{
if (console != null)
console.close();
if (streamOut != null)
streamOut.close();
if (socket != null)
socket.close();
} catch (IOException ioe)
{
System.out.println("Error closing thread...");
}
client.close();
client.stop();
}
public void installKey(String msg)
{
String encodedKey = msg;
// Cryptography - Added
System.out.println("[LOG] Receiving first message and setting up Symmetric Encryption...");
// Decode the base64 encoded string (key)
byte[] decodedKey = Base64.getDecoder().decode(encodedKey);
SecretKey key = new SecretKeySpec(decodedKey, 0, decodedKey.length, "AES");
System.out.println("[LOG] Installing Key...");
crypt = new SymmetricEncryption(key);
}
public static void main(String args[])
{
ChatClient client = null;
if (args.length != 3)
// Displays correct usage syntax on stdout
System.out.println("Usage: java ChatClient host port clientID");
else
// Calls new client
client = new ChatClient(args[0], Integer.parseInt(args[1]), Integer.parseInt(args[2]));
}
}
class ChatClientThread extends Thread
{
private Socket socket = null;
private ChatClient client = null;
private DataInputStream streamIn = null;
public ChatClientThread(ChatClient _client, Socket _socket)
{
client = _client;
socket = _socket;
open();
start();
}
public void open()
{
try
{
streamIn = new DataInputStream(socket.getInputStream());
} catch (IOException ioe)
{
System.out.println("Error getting input stream: " + ioe);
client.stop();
}
}
public void close()
{
try
{
if (streamIn != null)
streamIn.close();
} catch (IOException ioe)
{
System.out.println("Error closing input stream: " + ioe);
}
}
public void run()
{
try
{
// Added - Cryptography
client.installKey(streamIn.readUTF());
System.out.println("-------- Welcome --------");
while (true)
{
client.handle(streamIn.readUTF());
}
} catch (IOException ioe)
{
System.out.println("Listening error: " + ioe.getMessage());
client.stop();
}
}
}
| [
"rfchenriques@gmail.com"
] | rfchenriques@gmail.com |
812332f5014a558eb01f4fdb3ffe7a35e5ba76bc | 84b02978d30adc4e43201458c15fd84d8d99123e | /ILOTTOANDROID_REDPOS/app/src/main/java/com/smartdevsolutions/ilottoandroid/Utility/MyApplication.java | 64ced83e830691f4a9087f123bdd41b1ab669eeb | [] | no_license | teecode/ANDROID-PAYONE | 94391d9275ea88b1bb595478dfd5d7b58311d6bd | 74264926a4b4ac04c64c10d8084ac257c811e66a | refs/heads/master | 2021-09-26T23:57:45.580053 | 2018-11-04T23:20:43 | 2018-11-04T23:20:43 | 113,961,192 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,462 | java | package com.smartdevsolutions.ilottoandroid.Utility;
import android.app.Application;
import com.smartdevsolutions.ilottoandroid.ApiResource.AddBetSlipResource;
import com.smartdevsolutions.ilottoandroid.ApiResource.AddTicketResource;
import com.smartdevsolutions.ilottoandroid.ApiResource.DailyGameResource;
import com.smartdevsolutions.ilottoandroid.ApiResource.DeviceResource;
import com.smartdevsolutions.ilottoandroid.ApiResource.TicketResource;
import java.io.File;
import java.io.IOException;
import java.security.InvalidParameterException;
import java.util.List;
import android_serialport_api.SerialPort;
import hdx.HdxUtil;
/**
* Created by T360-INNOVATIVZ on 22/05/2017.
*/
public class MyApplication extends Application {
private AddTicketResource CurrentTicket;
private TicketResource CheckTicketCurrentTicket;
private AddBetSlipResource CurrentBet;
private DailyGameResource SelectedGame;
private DeviceResource CurrentTerminal;
public String getToken() {
return Token;
}
public void setToken(String token) {
Token = token;
}
private String Token;
private List<DailyGameResource> FetchedGames;
private List<Customer> CashiersInShop;
private SerialPort mSerialPort = null;
public SerialPort getSerialPort() throws SecurityException, IOException, InvalidParameterException {
if (mSerialPort == null) {
/* Read serial port parameters */
//SharedPreferences sp = getSharedPreferences("android_serialport_api.sample_preferences", MODE_PRIVATE);
String path = HdxUtil.GetPrinterPort();//dev/ttyS3
int baudrate = 115200;//Integer.decode(sp.getString("BAUDRATE", "-1"));
/* Open the serial port */
mSerialPort = new SerialPort(new File(path), baudrate, 0);
}
return mSerialPort;
}
public void closeSerialPort() {
if (mSerialPort != null) {
mSerialPort.close();
mSerialPort = null;
}
}
public DailyGameResource getSelectedGame() {
return SelectedGame;
}
public void setSelectedGame(DailyGameResource selectedGame) {
SelectedGame = selectedGame;
}
public AddTicketResource getCurrentTicket() {
return CurrentTicket;
}
public void setCurrentTicket(AddTicketResource currentTicket) {
CurrentTicket = currentTicket;
}
public TicketResource getCheckTicketCurrentTicket() {
return CheckTicketCurrentTicket;
}
public void setCheckTicketCurrentTicket(TicketResource checkTicketCurrentTicket) {
CheckTicketCurrentTicket = checkTicketCurrentTicket;
}
public List<DailyGameResource> getFetchedGames() {
return FetchedGames;
}
public void setFetchedGames(List<DailyGameResource> fetchedGames) {
FetchedGames = fetchedGames;
}
public DeviceResource getCurrentTerminal() {
return CurrentTerminal;
}
public void setCurrentTerminal(DeviceResource currentTerminal) {
CurrentTerminal = currentTerminal;
}
public AddBetSlipResource getCurrentBet() {
return CurrentBet;
}
public void setCurrentBet(AddBetSlipResource currentBet) {
CurrentBet = currentBet;
}
public void setCashiersInShop(List<Customer> Cashiers)
{
CashiersInShop = Cashiers;
}
public List<Customer> getCashiersInShop() {
return CashiersInShop;
}
}
| [
"ogunseye.timilehin@gmail.com"
] | ogunseye.timilehin@gmail.com |
4a099226da2407869394c98dce87a9e188034713 | 963e64a180798ca399d4ade95e3d920a795155f5 | /app/src/main/java/info/tracking/list/holder/LatLngViewHolder.java | a39a7fb6dd369370780965d626fae9bd91614391 | [] | no_license | AnkurYadavv/Tracking | 5b870e805329f25792606ad0cd1e3a81d8c33e32 | b9a33e8d7d0df467242825491480e8713b578e34 | refs/heads/master | 2021-01-21T12:41:06.015057 | 2017-09-01T08:24:06 | 2017-09-01T08:24:06 | 102,081,266 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 451 | java | package info.tracking.list.holder;
/**
* Created by Asus on 05-05-2017.
*/
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;
import info.tracking.R;
public class LatLngViewHolder extends RecyclerView.ViewHolder{
public TextView latLngTxt;
public LatLngViewHolder(View itemView) {
super(itemView);
latLngTxt=(TextView)itemView.findViewById(R.id.latLngTxt);
}
} | [
"ankur@webdior.com"
] | ankur@webdior.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.