blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
0de8d4bd5b7d930438f7ed409b90296a990c5f1a
17af16244020643263de1dd41c69083e944fe830
/src/test/java/com/blog/TestMP.java
c08f8917062214a78860476526e42990392c85ff
[]
no_license
cansor888/easyblog
a40d3823720d511a8aa40f6fb870790c334285f0
49a3a6bfe96d8fb292703d767b5961a925f7b7b1
refs/heads/master
2023-05-30T23:57:29.459466
2021-07-09T04:36:15
2021-07-09T04:36:15
384,322,352
0
0
null
null
null
null
UTF-8
Java
false
false
3,807
java
package com.blog; import org.junit.Test; import com.baomidou.mybatisplus.annotation.DbType; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.generator.AutoGenerator; import com.baomidou.mybatisplus.generator.config.DataSourceConfig; import com.baomidou.mybatisplus.generator.config.GlobalConfig; import com.baomidou.mybatisplus.generator.config.PackageConfig; import com.baomidou.mybatisplus.generator.config.StrategyConfig; import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; public class TestMP { private static String author ="qiyao";//作者名称 private static String outputDir ="E:\\My project\\blog\\src\\main\\java";//生成的位置 private static String driver ="com.mysql.cj.jdbc.Driver";//驱动,注意版本 //连接路径,注意修改数据库名称 private static String url ="jdbc:mysql://localhost:3306/db_blog?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC"; private static String username ="root";//数据库用户名 private static String password ="123456";//数据库密码 private static String tablePrefix ="t_";//数据库表的前缀,如tbl_user private static String [] tables = {"t_blog","t_blogger","t_blogtype","t_comment"}; //生成的表 private static String parentPackage = "com.blog";//顶级包结构 private static String dao = "dao";//数据访问层包名称 private static String service = "service";//业务逻辑层包名称 private static String entity = "entity";//实体层包名称 private static String controller = "controller";//控制器层包名称 private static String mapperxml = "dao";//mapper映射文件包名称 /** * 代码生成 示例代码 */ @Test public void testGenerator() { //1. 全局配置 GlobalConfig config = new GlobalConfig(); config.setAuthor(author) // 作者 .setOutputDir(outputDir) // 生成路径 .setFileOverride(true) // 文件覆盖 .setIdType(IdType.AUTO) // 主键策略 .setServiceName("%sService") // 设置生成的service接口的名字的首字母是否为I,加%s则不生成I .setBaseResultMap(true) //映射文件中是否生成ResultMap配置 .setBaseColumnList(true); //生成通用sql字段 //2. 数据源配置 DataSourceConfig dsConfig = new DataSourceConfig(); dsConfig.setDbType(DbType.MYSQL) // 设置数据库类型 .setDriverName(driver) //设置驱动 .setUrl(url) //设置连接路径 .setUsername(username) //设置用户名 .setPassword(password); //设置密码 //3. 策略配置 StrategyConfig stConfig = new StrategyConfig(); stConfig.setCapitalMode(true) //全局大写命名 .setNaming(NamingStrategy.underline_to_camel) // 数据库表映射到实体的命名策略 .setTablePrefix(tablePrefix) //表前缀 .setInclude(tables); // 生成的表 //4. 包名策略配置 PackageConfig pkConfig = new PackageConfig(); pkConfig.setParent(parentPackage)//顶级包结构 .setMapper(dao) //数据访问层 .setService(service) //业务逻辑层 .setController(controller) //控制器 .setEntity(entity) //实体类 .setXml(mapperxml); //mapper映射文件 //5. 整合配置 AutoGenerator ag = new AutoGenerator(); ag.setGlobalConfig(config) .setDataSource(dsConfig) .setStrategy(stConfig) .setPackageInfo(pkConfig); //6. 执行 ag.execute(); } }
[ "3437530799@qq.com" ]
3437530799@qq.com
0406bd1f6a3d2e868dc7ae06d8abe9318d64a8bf
096c30d1ff256ed20db099f5cdcf6f8c8fa88255
/app/src/main/java/com/example/myspending/EditItemActivity.java
83bdc06e5d03540a2380125adfe93b6ccdc74792
[]
no_license
irfanramadhiya/My-Spending-App
1a5e6f43e4a6dbf8fdda06fc2dec1360482a8314
da2ed5be08ad57e0769b0495a1cea0070c7d8b74
refs/heads/master
2023-05-29T04:33:59.410571
2021-05-30T10:48:37
2021-05-30T10:48:37
372,189,023
0
0
null
null
null
null
UTF-8
Java
false
false
2,197
java
package com.example.myspending; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import java.util.ArrayList; public class EditItemActivity extends AppCompatActivity { Spending spending = new Spending(); ArrayList<Spending> spendings = new ArrayList<Spending>(); SpendingDB spendingDB = new SpendingDB(this); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_edit_item); Intent intent = getIntent(); int id = intent.getIntExtra("id", 0); EditText et_name, et_nominal; Button btn_submit; et_name = findViewById(R.id.et_name_edit); et_nominal = findViewById(R.id.et_nominal_edit); btn_submit = findViewById(R.id.btn_submit_edit); spending = spendingDB.getSpending(id); String name = spending.name; String nominal = "" + spending.nominal; et_name.setText(name); et_nominal.setText(nominal); btn_submit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String name = et_name.getText().toString(); String nominal = et_nominal.getText().toString(); if(name.isEmpty()){ Toast.makeText(EditItemActivity.this, "Please input the name of the spending", Toast.LENGTH_SHORT).show(); } else if(nominal.isEmpty()){ Toast.makeText(EditItemActivity.this, "Please input the nominal of the spending", Toast.LENGTH_SHORT).show(); } else { spending.name = name; spending.nominal = Integer.parseInt(nominal); spendingDB.updateSpending(spending, id); Intent intent = new Intent(EditItemActivity.this, MainActivity.class); startActivity(intent); } } }); } }
[ "irfan_ramadhiya@yahoo.co.id" ]
irfan_ramadhiya@yahoo.co.id
f98cc3e50efa83a050322f4b7b7ab825d60abf69
6274fd56f789694936547340e43936d292bb6d20
/Gongchengsheji2/src/UI/MainFrame.java
8db047c954df4d5c0b1c432d91c04c411ac35143
[]
no_license
Xingzuo888/daer
f056447f90ea454e2bc8c427b5112ee50dbfde5a
70df044f8d77ac49c0e52eb937a5531dc49dda5a
refs/heads/master
2020-04-08T07:22:39.996601
2018-11-26T09:06:29
2018-11-26T09:06:29
159,136,708
0
0
null
null
null
null
GB18030
Java
false
false
55,085
java
package UI; import java.awt.BorderLayout; import java.awt.Component; import java.awt.EventQueue; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Vector; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JFrame; import javax.swing.JInternalFrame; import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.JTextField; import javax.swing.SwingConstants; import javax.swing.border.EmptyBorder; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableCellRenderer; import Userdao.userdao; public class MainFrame extends JFrame { private JPanel contentPane; private final JInternalFrame internalFrame_addbook = new JInternalFrame("增加图书"); private final JInternalFrame internalFrame_setbook = new JInternalFrame("修改图书"); private final JInternalFrame internalFrame_delbook = new JInternalFrame("删除图书"); private final JInternalFrame internalFrame_addreader = new JInternalFrame("增加读者"); private final JInternalFrame internalFrame_setreader = new JInternalFrame("修改读者"); private final JInternalFrame internalFrame_delreader = new JInternalFrame("删除读者"); private final JInternalFrame internalFrame_borrowbook = new JInternalFrame("借书"); private final JInternalFrame internalFrame_returnbook = new JInternalFrame("还书"); private final JInternalFrame internalFrame_querybook = new JInternalFrame("查询所有图书信息"); private final JInternalFrame internalFrame_queryreader = new JInternalFrame("查询所有读者信息"); private final JInternalFrame internalFrame_1 = new JInternalFrame("查询所有的借书记录"); private final JInternalFrame internalFrame_2 = new JInternalFrame("查询超期借书记录"); private final JInternalFrame internalFrame_3 = new JInternalFrame("查询已被借出的书本"); private final JInternalFrame internalFrame_4 = new JInternalFrame("查询某出版社的书"); private final JInternalFrame internalFrame_5 = new JInternalFrame("查询某读者借的书"); private final JInternalFrame internalFrame_6 = new JInternalFrame("查询某读者归还某书的日期"); private final JInternalFrame internalFrame_7 = new JInternalFrame("查询某读者被罚款的总额"); private final JInternalFrame internalFrame_about = new JInternalFrame("关于我们"); private Book book = new Book(); private Reader reader = new Reader(); getSql sql = new getSql(); /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { MainFrame frame = new MainFrame(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public MainFrame() { setTitle("欢迎使用图书管理系统"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 670, 445); //创建菜单栏 JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar); //创建图书菜单 JMenu menu_Book = new JMenu("图书维护"); menuBar.add(menu_Book); //创建增加图书菜单项 JMenuItem menuItem_addbook = new JMenuItem("增加图书"); menuItem_addbook.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { getContentPane().add(internalFrame_addbook); internalFrame_addbook.getContentPane().setLayout(null); JLabel lblNewLabel_4 = new JLabel("请输入图书的信息"); lblNewLabel_4.setFont(new Font("宋体", Font.BOLD, 15)); lblNewLabel_4.setHorizontalAlignment(SwingConstants.CENTER); lblNewLabel_4.setBounds(190, 20, 243, 36); internalFrame_addbook.getContentPane().add(lblNewLabel_4); JLabel lblNewLabel = new JLabel("书名:"); lblNewLabel.setBounds(193, 66, 54, 15); internalFrame_addbook.getContentPane().add(lblNewLabel); JTextField textField_bookname = new JTextField(); textField_bookname.setBounds(257, 63, 136, 21); internalFrame_addbook.getContentPane().add(textField_bookname); textField_bookname.setColumns(10); JLabel lblNewLabel_1 = new JLabel("出版社:"); lblNewLabel_1.setBounds(193, 105, 54, 15); internalFrame_addbook.getContentPane().add(lblNewLabel_1); JTextField textField_bookpublish = new JTextField(); textField_bookpublish.setBounds(257, 102, 136, 21); internalFrame_addbook.getContentPane().add(textField_bookpublish); textField_bookpublish.setColumns(10); JLabel lblNewLabel_2 = new JLabel("作者:"); lblNewLabel_2.setBounds(193, 143, 54, 15); internalFrame_addbook.getContentPane().add(lblNewLabel_2); JTextField textField_bookauthor = new JTextField(); textField_bookauthor.setBounds(257, 140, 136, 21); internalFrame_addbook.getContentPane().add(textField_bookauthor); textField_bookauthor.setColumns(10); JLabel lblNewLabel_3 = new JLabel("价格:"); lblNewLabel_3.setBounds(193, 182, 54, 15); internalFrame_addbook.getContentPane().add(lblNewLabel_3); JTextField textField_bookprice = new JTextField(); textField_bookprice.setBounds(257, 179, 136, 21); internalFrame_addbook.getContentPane().add(textField_bookprice); textField_bookprice.setColumns(10); JButton btnNewButton = new JButton("添加"); btnNewButton.setBounds(191, 227, 93, 23); btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { book.setBname(textField_bookname.getText()); book.setBpublish(textField_bookpublish.getText()); book.setBauthor(textField_bookauthor.getText()); book.setBprice(Float.parseFloat((textField_bookprice.getText()))); //判断下添加信息是否成功 if(sql.addBook(book)) { JOptionPane.showMessageDialog(null, "增加图书成功");} else { JOptionPane.showMessageDialog(null, "增加图书失败");} textField_bookname.setText(null); textField_bookpublish.setText(null); textField_bookauthor.setText(null); textField_bookprice.setText(null); } }); internalFrame_addbook.getContentPane().add(btnNewButton); JButton btnNewButton_1 = new JButton("重置"); btnNewButton_1.setBounds(343, 227, 93, 23); btnNewButton_1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { textField_bookname.setText(null); textField_bookpublish.setText(null); textField_bookauthor.setText(null); textField_bookprice.setText(null); } }); internalFrame_addbook.getContentPane().add(btnNewButton_1); internalFrame_addbook.setVisible(true); internalFrame_setbook.dispose(); internalFrame_delbook.dispose(); internalFrame_addreader.dispose(); internalFrame_setreader.dispose(); internalFrame_delreader.dispose(); internalFrame_borrowbook.dispose(); internalFrame_returnbook.dispose(); internalFrame_querybook.dispose(); internalFrame_queryreader.dispose(); internalFrame_1.dispose(); internalFrame_2.dispose(); internalFrame_3.dispose(); internalFrame_4.dispose(); internalFrame_5.dispose(); internalFrame_6.dispose(); internalFrame_7.dispose(); internalFrame_about.dispose(); } }); menu_Book.add(menuItem_addbook); //创建修改图书菜单项 JMenuItem menuItem_setbook = new JMenuItem("修改图书"); menuItem_setbook.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { getContentPane().add(internalFrame_setbook); internalFrame_setbook.getContentPane().setLayout(null); JLabel lblNewLabel = new JLabel("请输入要修改图书的书名"); lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER); lblNewLabel.setFont(new Font("宋体", Font.PLAIN, 18)); lblNewLabel.setBounds(200, 10, 211, 40); internalFrame_setbook.getContentPane().add(lblNewLabel); JLabel lblNewLabel_1 = new JLabel("书名:"); lblNewLabel_1.setFont(new Font("宋体", Font.PLAIN, 15)); lblNewLabel_1.setHorizontalAlignment(SwingConstants.CENTER); lblNewLabel_1.setBounds(88, 68, 111, 32); internalFrame_setbook.getContentPane().add(lblNewLabel_1); JTextField textField = new JTextField(); textField.setBounds(195, 69, 209, 32); internalFrame_setbook.getContentPane().add(textField); textField.setColumns(10); JTable table = null; JButton btnNewButton = new JButton("查询"); btnNewButton.setBounds(429, 68, 86, 32); btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) {//点击了查询 } }); internalFrame_setbook.getContentPane().add(btnNewButton); table = new JTable(20,6); //创建表格 table.getColumnModel().getColumn(table.getColumnCount()-1).setCellRenderer(new TableCellRenderer() { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JCheckBox jc=new JCheckBox(); jc.setSelected(isSelected); jc.setHorizontalAlignment((int) 0.5f); return jc; } }); //添加复选框 JScrollPane jScrollPane=new JScrollPane(table); //将表格添加到滚动条中 jScrollPane.setBounds(48, 110, 555, 150); internalFrame_setbook.getContentPane().add(jScrollPane); JButton btnNewButton_1 = new JButton("修改"); btnNewButton_1.setBounds(500, 280, 86, 32); internalFrame_setbook.getContentPane().add(btnNewButton_1); internalFrame_addbook.dispose(); internalFrame_setbook.setVisible(true); internalFrame_delbook.dispose(); internalFrame_addreader.dispose(); internalFrame_setreader.dispose(); internalFrame_delreader.dispose(); internalFrame_borrowbook.dispose(); internalFrame_returnbook.dispose(); internalFrame_querybook.dispose(); internalFrame_queryreader.dispose(); internalFrame_1.dispose(); internalFrame_2.dispose(); internalFrame_3.dispose(); internalFrame_4.dispose(); internalFrame_5.dispose(); internalFrame_6.dispose(); internalFrame_7.dispose(); internalFrame_about.dispose(); } }); menu_Book.add(menuItem_setbook); //创建删除图书菜单项 JMenuItem menuItem_delbook = new JMenuItem("删除图书"); menuItem_delbook.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { getContentPane().add(internalFrame_delbook); internalFrame_delbook.getContentPane().setLayout(null); JLabel lblNewLabel = new JLabel("请输入要删除图书的书名"); lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER); lblNewLabel.setFont(new Font("宋体", Font.PLAIN, 18)); lblNewLabel.setBounds(200, 10, 211, 40); internalFrame_delbook.getContentPane().add(lblNewLabel); JLabel lblNewLabel_1 = new JLabel("书名:"); lblNewLabel_1.setFont(new Font("宋体", Font.PLAIN, 15)); lblNewLabel_1.setHorizontalAlignment(SwingConstants.CENTER); lblNewLabel_1.setBounds(88, 68, 111, 32); internalFrame_delbook.getContentPane().add(lblNewLabel_1); JTextField textField = new JTextField(); textField.setBounds(195, 69, 209, 32); internalFrame_delbook.getContentPane().add(textField); textField.setColumns(10); JButton btnNewButton = new JButton("查询"); btnNewButton.setBounds(429, 68, 86, 32); internalFrame_delbook.getContentPane().add(btnNewButton); JTable table = new JTable(20,6); //创建表格 table.getColumnModel().getColumn(table.getColumnCount()-1).setCellRenderer(new TableCellRenderer() { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JCheckBox jc=new JCheckBox(); jc.setSelected(isSelected); jc.setHorizontalAlignment((int) 0.5f); return jc; } }); //添加复选框 JScrollPane jScrollPane=new JScrollPane(table); //将表格添加到滚动条中 jScrollPane.setBounds(48, 110, 555, 150); internalFrame_delbook.getContentPane().add(jScrollPane); JButton btnNewButton_1 = new JButton("删除"); btnNewButton_1.setBounds(500, 280, 86, 32); internalFrame_delbook.getContentPane().add(btnNewButton_1); internalFrame_addbook.dispose(); internalFrame_setbook.dispose(); internalFrame_delbook.setVisible(true); internalFrame_addreader.dispose(); internalFrame_setreader.dispose(); internalFrame_delreader.dispose(); internalFrame_borrowbook.dispose(); internalFrame_returnbook.dispose(); internalFrame_querybook.dispose(); internalFrame_queryreader.dispose(); internalFrame_1.dispose(); internalFrame_2.dispose(); internalFrame_3.dispose(); internalFrame_4.dispose(); internalFrame_5.dispose(); internalFrame_6.dispose(); internalFrame_7.dispose(); internalFrame_about.dispose(); } }); menu_Book.add(menuItem_delbook); //创建读者菜单 JMenu menu_reader = new JMenu("读者维护"); menuBar.add(menu_reader); //创建增加读者菜单项 JMenuItem menuItem_addreader = new JMenuItem("增加读者"); menuItem_addreader.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { getContentPane().add(internalFrame_addreader); internalFrame_addreader.getContentPane().setLayout(null); JLabel lblNewLabel_4 = new JLabel("请输入读者的信息"); lblNewLabel_4.setFont(new Font("宋体", Font.BOLD, 15)); lblNewLabel_4.setHorizontalAlignment(SwingConstants.CENTER); lblNewLabel_4.setBounds(190, 20, 243, 36); internalFrame_addreader.getContentPane().add(lblNewLabel_4); JLabel lblNewLabel = new JLabel("姓名:"); lblNewLabel.setBounds(193, 66, 54, 15); internalFrame_addreader.getContentPane().add(lblNewLabel); JTextField textField_readername = new JTextField(); textField_readername.setBounds(257, 63, 136, 21); internalFrame_addreader.getContentPane().add(textField_readername); textField_readername.setColumns(10); JLabel lblNewLabel_1 = new JLabel("性别:"); lblNewLabel_1.setBounds(193, 105, 54, 15); internalFrame_addreader.getContentPane().add(lblNewLabel_1); JTextField textField_readersex = new JTextField(); textField_readersex.setBounds(257, 102, 136, 21); internalFrame_addreader.getContentPane().add(textField_readersex); textField_readersex.setColumns(10); JLabel lblNewLabel_2 = new JLabel("年龄:"); lblNewLabel_2.setBounds(193, 143, 54, 15); internalFrame_addreader.getContentPane().add(lblNewLabel_2); JTextField textField_readerage = new JTextField(); textField_readerage.setBounds(257, 140, 136, 21); internalFrame_addreader.getContentPane().add(textField_readerage); textField_readerage.setColumns(10); JLabel lblNewLabel_3 = new JLabel("职业:"); lblNewLabel_3.setBounds(193, 182, 54, 15); internalFrame_addreader.getContentPane().add(lblNewLabel_3); JTextField textField_readerprofession = new JTextField(); textField_readerprofession.setBounds(257, 179, 136, 21); internalFrame_addreader.getContentPane().add(textField_readerprofession); textField_readerprofession.setColumns(10); JButton btnNewButton = new JButton("添加"); btnNewButton.setBounds(191, 227, 93, 23); btnNewButton.addActionListener(new ActionListener() {//当用户点击添加时的反应事件 public void actionPerformed(ActionEvent e) { reader.setRname(textField_readername.getText());//设置读者名字 reader.setRsex(textField_readersex.getText());//设置读者性别 reader.setRage(Integer.parseInt(textField_readerage.getText()));//设置读者年龄并转化为Int型 reader.setRjob(textField_readerprofession.getText());//设置读者工作 //判断下添加信息是否成功 if(sql.addReader(reader)) { JOptionPane.showMessageDialog(null, "增加读者成功");} else { JOptionPane.showMessageDialog(null, "增加读者失败");} textField_readername.setText(null);//清空 textField_readersex.setText(null); textField_readerage.setText(null); textField_readerprofession.setText(null); } }); internalFrame_addreader.getContentPane().add(btnNewButton); JButton btnNewButton_1 = new JButton("重置"); btnNewButton_1.setBounds(343, 227, 93, 23); btnNewButton_1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { textField_readername.setText(null); textField_readersex.setText(null); textField_readerage.setText(null); textField_readerprofession.setText(null); } }); internalFrame_addreader.getContentPane().add(btnNewButton_1); internalFrame_addbook.dispose(); internalFrame_setbook.dispose(); internalFrame_delbook.dispose(); internalFrame_addreader.setVisible(true); internalFrame_setreader.dispose(); internalFrame_delreader.dispose(); internalFrame_borrowbook.dispose(); internalFrame_returnbook.dispose(); internalFrame_querybook.dispose(); internalFrame_queryreader.dispose(); internalFrame_1.dispose(); internalFrame_2.dispose(); internalFrame_3.dispose(); internalFrame_4.dispose(); internalFrame_5.dispose(); internalFrame_6.dispose(); internalFrame_7.dispose(); internalFrame_about.dispose(); } }); menu_reader.add(menuItem_addreader); //创建修改读者菜单项 JMenuItem menuItem_setreader = new JMenuItem("修改读者"); menuItem_setreader.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { getContentPane().add(internalFrame_setreader); internalFrame_setreader.getContentPane().setLayout(null); JLabel lblNewLabel = new JLabel("请输入要修改读者的姓名"); lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER); lblNewLabel.setFont(new Font("宋体", Font.PLAIN, 18)); lblNewLabel.setBounds(200, 10, 211, 40); internalFrame_setreader.getContentPane().add(lblNewLabel); JLabel lblNewLabel_1 = new JLabel("姓名:"); lblNewLabel_1.setFont(new Font("宋体", Font.PLAIN, 15)); lblNewLabel_1.setHorizontalAlignment(SwingConstants.CENTER); lblNewLabel_1.setBounds(88, 68, 111, 32); internalFrame_setreader.getContentPane().add(lblNewLabel_1); JTextField textField = new JTextField(); textField.setBounds(195, 69, 209, 32); internalFrame_setreader.getContentPane().add(textField); textField.setColumns(10); JButton btnNewButton = new JButton("查询"); btnNewButton.setBounds(429, 68, 86, 32); internalFrame_setreader.getContentPane().add(btnNewButton); JTable table = new JTable(20,6); //创建表格 table.getColumnModel().getColumn(table.getColumnCount()-1).setCellRenderer(new TableCellRenderer() { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JCheckBox jc=new JCheckBox(); jc.setSelected(isSelected); jc.setHorizontalAlignment((int) 0.5f); return jc; } }); //添加复选框 JScrollPane jScrollPane=new JScrollPane(table); //将表格添加到滚动条中 jScrollPane.setBounds(48, 110, 555, 150); internalFrame_setreader.getContentPane().add(jScrollPane); JButton btnNewButton_1 = new JButton("修改"); btnNewButton_1.setBounds(500, 280, 86, 32); internalFrame_setreader.getContentPane().add(btnNewButton_1); internalFrame_addbook.dispose(); internalFrame_setbook.dispose(); internalFrame_delbook.dispose(); internalFrame_addreader.dispose(); internalFrame_setreader.setVisible(true); internalFrame_delreader.dispose(); internalFrame_borrowbook.dispose(); internalFrame_returnbook.dispose(); internalFrame_querybook.dispose(); internalFrame_queryreader.dispose(); internalFrame_1.dispose(); internalFrame_2.dispose(); internalFrame_3.dispose(); internalFrame_4.dispose(); internalFrame_5.dispose(); internalFrame_6.dispose(); internalFrame_7.dispose(); internalFrame_about.dispose(); } }); menu_reader.add(menuItem_setreader); //创建删除读者菜单项 JMenuItem menuItem_delreader = new JMenuItem("删除读者"); menuItem_delreader.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { getContentPane().add(internalFrame_delreader); internalFrame_delreader.getContentPane().setLayout(null); JLabel lblNewLabel = new JLabel("请输入要删除读者的姓名"); lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER); lblNewLabel.setFont(new Font("宋体", Font.PLAIN, 18)); lblNewLabel.setBounds(200, 10, 211, 40); internalFrame_delreader.getContentPane().add(lblNewLabel); JLabel lblNewLabel_1 = new JLabel("姓名:"); lblNewLabel_1.setFont(new Font("宋体", Font.PLAIN, 15)); lblNewLabel_1.setHorizontalAlignment(SwingConstants.CENTER); lblNewLabel_1.setBounds(88, 68, 111, 32); internalFrame_delreader.getContentPane().add(lblNewLabel_1); JTextField textField = new JTextField(); textField.setBounds(195, 69, 209, 32); internalFrame_delreader.getContentPane().add(textField); textField.setColumns(10); JButton btnNewButton = new JButton("查询"); btnNewButton.setBounds(429, 68, 86, 32); internalFrame_delreader.getContentPane().add(btnNewButton); JTable table = new JTable(20,6); //创建表格 table.getColumnModel().getColumn(table.getColumnCount()-1).setCellRenderer(new TableCellRenderer() { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JCheckBox jc=new JCheckBox(); jc.setSelected(isSelected); jc.setHorizontalAlignment((int) 0.5f); return jc; } }); //添加复选框 JScrollPane jScrollPane=new JScrollPane(table); //将表格添加到滚动条中 jScrollPane.setBounds(48, 110, 555, 150); internalFrame_delreader.getContentPane().add(jScrollPane); JButton btnNewButton_1 = new JButton("删除"); btnNewButton_1.setBounds(500, 280, 86, 32); internalFrame_delreader.getContentPane().add(btnNewButton_1); internalFrame_addbook.dispose(); internalFrame_setbook.dispose(); internalFrame_delbook.dispose(); internalFrame_addreader.dispose(); internalFrame_setreader.dispose(); internalFrame_delreader.setVisible(true); internalFrame_borrowbook.dispose(); internalFrame_returnbook.dispose(); internalFrame_querybook.dispose(); internalFrame_queryreader.dispose(); internalFrame_1.dispose(); internalFrame_2.dispose(); internalFrame_3.dispose(); internalFrame_4.dispose(); internalFrame_5.dispose(); internalFrame_6.dispose(); internalFrame_7.dispose(); internalFrame_about.dispose(); } }); menu_reader.add(menuItem_delreader); //创建借还菜单 JMenu menu_brbook= new JMenu("借还书"); menuBar.add(menu_brbook); //创建借书菜单项 JMenuItem mntmNewMenuItem_borrowbook = new JMenuItem("借书"); mntmNewMenuItem_borrowbook.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { getContentPane().add(internalFrame_borrowbook); internalFrame_borrowbook.getContentPane().setLayout(null); JLabel lblNewLabel = new JLabel("请输入读者的编号和姓名"); lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER); lblNewLabel.setFont(new Font("宋体", Font.PLAIN, 18)); lblNewLabel.setBounds(200, 23, 211, 40); internalFrame_borrowbook.getContentPane().add(lblNewLabel); JLabel lblNewLabel_1 = new JLabel("编号:"); lblNewLabel_1.setFont(new Font("宋体", Font.PLAIN, 15)); lblNewLabel_1.setHorizontalAlignment(SwingConstants.CENTER); lblNewLabel_1.setBounds(101, 75, 64, 26); internalFrame_borrowbook.getContentPane().add(lblNewLabel_1); JTextField textField = new JTextField(); textField.setBounds(168, 73, 117, 26); internalFrame_borrowbook.getContentPane().add(textField); textField.setColumns(10); JLabel lblNewLabel_2 = new JLabel("姓名:"); lblNewLabel_2.setFont(new Font("宋体", Font.PLAIN, 15)); lblNewLabel_2.setHorizontalAlignment(SwingConstants.CENTER); lblNewLabel_2.setBounds(295, 75, 64, 26); internalFrame_borrowbook.getContentPane().add(lblNewLabel_2); JTextField textField_1 = new JTextField(); textField_1.setEditable(false); textField_1.setBounds(367, 73, 117, 26); internalFrame_borrowbook.getContentPane().add(textField_1); textField_1.setColumns(10); JLabel lblNewLabel_3 = new JLabel("请输入书的编号和书名"); lblNewLabel_3.setHorizontalAlignment(SwingConstants.CENTER); lblNewLabel_3.setFont(new Font("宋体", Font.PLAIN, 18)); lblNewLabel_3.setBounds(200, 129, 211, 40); internalFrame_borrowbook.getContentPane().add(lblNewLabel_3); JLabel lblNewLabel_4 = new JLabel("编号:"); lblNewLabel_4.setHorizontalAlignment(SwingConstants.CENTER); lblNewLabel_4.setFont(new Font("宋体", Font.PLAIN, 15)); lblNewLabel_4.setBounds(101, 178, 64, 26); internalFrame_borrowbook.getContentPane().add(lblNewLabel_4); JTextField textField_2 = new JTextField(); textField_2.setBounds(168, 179, 117, 26); internalFrame_borrowbook.getContentPane().add(textField_2); textField_2.setColumns(10); JLabel lblNewLabel_5 = new JLabel("书名:"); lblNewLabel_5.setHorizontalAlignment(SwingConstants.CENTER); lblNewLabel_5.setFont(new Font("宋体", Font.PLAIN, 15)); lblNewLabel_5.setBounds(295, 179, 64, 26); internalFrame_borrowbook.getContentPane().add(lblNewLabel_5); JTextField textField_3 = new JTextField(); textField_3.setEditable(false); textField_3.setBounds(367, 179, 117, 26); internalFrame_borrowbook.getContentPane().add(textField_3); textField_3.setColumns(10); JButton btnNewButton = new JButton("借书"); btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if(textField.getText() == "" || textField_2.getText() =="") { JOptionPane.showMessageDialog(null, "请输入如完整信息"); } else { if(sql.borrow(Integer.parseInt(textField.getText()),Integer.parseInt(textField_2.getText()))) { JOptionPane.showMessageDialog(null, "借书成功"); textField.setText(null); textField_1.setText(null); textField_2.setText(null); textField_3.setText(null); }else { JOptionPane.showMessageDialog(null, "借书失败"); } } } }); btnNewButton.setBounds(260, 240, 73, 26); internalFrame_borrowbook.getContentPane().add(btnNewButton); KeyListener key_Listener = new KeyListener() //当用户借书输入的编号按下Enter键 { public void keyTyped(KeyEvent e) {} public void keyReleased(KeyEvent e){} public void keyPressed(KeyEvent e){ if(e.getKeyChar() == KeyEvent.VK_ENTER ) { if(textField.getText() == "") { JOptionPane.showMessageDialog(null, "请输入读者编号"); }else { reader = sql.selectReaderId(Integer.parseInt(textField.getText())); if(reader == null) { JOptionPane.showMessageDialog(null, "未找到该读者"); textField.setText(""); }else if(reader.getRnumber() ==5) { JOptionPane.showMessageDialog(null, "该用户已经借了五本书了"); textField.setText(""); } else { textField_1.setText(reader.getRname()); } } } } }; KeyListener key_Listener_1 = new KeyListener() { public void keyTyped(KeyEvent e) {} public void keyReleased(KeyEvent e){} public void keyPressed(KeyEvent e){ if(e.getKeyChar() == KeyEvent.VK_ENTER ) { if(textField_2.getText() == "") { JOptionPane.showMessageDialog(null, "请输入图书编号"); }else { book = sql.selectBookId(Integer.parseInt(textField_2.getText())); if(book == null) { JOptionPane.showMessageDialog(null, "未找到该图书"); textField_2.setText(""); }else if(book.getBborrow() == 0){ JOptionPane.showMessageDialog(null, "该图书已借出"); textField_2.setText(""); } else { textField_3.setText(book.getBname()); } } } } }; textField.addKeyListener(key_Listener); textField_2.addKeyListener(key_Listener_1); internalFrame_addbook.dispose(); internalFrame_setbook.dispose(); internalFrame_delbook.dispose(); internalFrame_addreader.dispose(); internalFrame_setreader.dispose(); internalFrame_delreader.dispose(); internalFrame_borrowbook.setVisible(true); internalFrame_returnbook.dispose(); internalFrame_querybook.dispose(); internalFrame_queryreader.dispose(); internalFrame_1.dispose(); internalFrame_2.dispose(); internalFrame_3.dispose(); internalFrame_4.dispose(); internalFrame_5.dispose(); internalFrame_6.dispose(); internalFrame_7.dispose(); internalFrame_about.dispose(); } }); menu_brbook.add(mntmNewMenuItem_borrowbook); //创建还书菜单项 JMenuItem mntmNewMenuItem_returnbook = new JMenuItem("还书"); mntmNewMenuItem_returnbook.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { getContentPane().add(internalFrame_returnbook); internalFrame_returnbook.getContentPane().setLayout(null); JLabel lblNewLabel = new JLabel("请输入读者的编号和姓名"); lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER); lblNewLabel.setFont(new Font("宋体", Font.PLAIN, 18)); lblNewLabel.setBounds(200, 23, 211, 40); internalFrame_returnbook.getContentPane().add(lblNewLabel); JLabel lblNewLabel_1 = new JLabel("编号:"); lblNewLabel_1.setFont(new Font("宋体", Font.PLAIN, 15)); lblNewLabel_1.setHorizontalAlignment(SwingConstants.CENTER); lblNewLabel_1.setBounds(101, 75, 64, 26); internalFrame_returnbook.getContentPane().add(lblNewLabel_1); JTextField textField = new JTextField(); textField.setBounds(168, 73, 117, 26); internalFrame_returnbook.getContentPane().add(textField); textField.setColumns(10); JLabel lblNewLabel_2 = new JLabel("姓名:"); lblNewLabel_2.setFont(new Font("宋体", Font.PLAIN, 15)); lblNewLabel_2.setHorizontalAlignment(SwingConstants.CENTER); lblNewLabel_2.setBounds(295, 75, 64, 26); internalFrame_returnbook.getContentPane().add(lblNewLabel_2); JTextField textField_1 = new JTextField(); textField_1.setEditable(false); textField_1.setBounds(367, 73, 117, 26); internalFrame_returnbook.getContentPane().add(textField_1); textField_1.setColumns(10); JLabel lblNewLabel_3 = new JLabel("请输入书的编号和书名"); lblNewLabel_3.setHorizontalAlignment(SwingConstants.CENTER); lblNewLabel_3.setFont(new Font("宋体", Font.PLAIN, 18)); lblNewLabel_3.setBounds(200, 129, 211, 40); internalFrame_returnbook.getContentPane().add(lblNewLabel_3); JLabel lblNewLabel_4 = new JLabel("编号:"); lblNewLabel_4.setHorizontalAlignment(SwingConstants.CENTER); lblNewLabel_4.setFont(new Font("宋体", Font.PLAIN, 15)); lblNewLabel_4.setBounds(101, 178, 64, 26); internalFrame_returnbook.getContentPane().add(lblNewLabel_4); JTextField textField_2 = new JTextField(); textField_2.setBounds(168, 179, 117, 26); internalFrame_returnbook.getContentPane().add(textField_2); textField_2.setColumns(10); JLabel lblNewLabel_5 = new JLabel("书名:"); lblNewLabel_5.setHorizontalAlignment(SwingConstants.CENTER); lblNewLabel_5.setFont(new Font("宋体", Font.PLAIN, 15)); lblNewLabel_5.setBounds(295, 179, 64, 26); internalFrame_returnbook.getContentPane().add(lblNewLabel_5); JTextField textField_3 = new JTextField(); textField_3.setEditable(false); textField_3.setBounds(367, 179, 117, 26); internalFrame_returnbook.getContentPane().add(textField_3); textField_3.setColumns(10); JButton btnNewButton = new JButton("还书"); btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if(textField.getText() == "" || textField_2.getText() =="") { JOptionPane.showMessageDialog(null, "请输入如完整信息"); } else { if(sql.reBook(Integer.parseInt(textField.getText()),Integer.parseInt(textField_2.getText()))) { JOptionPane.showMessageDialog(null, "还书成功"); textField.setText(null); textField_1.setText(null); textField_2.setText(null); textField_3.setText(null); }else { JOptionPane.showMessageDialog(null, "还书失败"); } } } }); btnNewButton.setBounds(260, 240, 73, 26); internalFrame_returnbook.getContentPane().add(btnNewButton); KeyListener key_Listener = new KeyListener() //当用户借书输入的编号按下Enter键 { public void keyTyped(KeyEvent e) {} public void keyReleased(KeyEvent e){} public void keyPressed(KeyEvent e){ if(e.getKeyChar() == KeyEvent.VK_ENTER ) { if(textField.getText() == "") { JOptionPane.showMessageDialog(null, "请输入读者编号"); }else { reader = sql.selectReaderId(Integer.parseInt(textField.getText())); if(reader == null) { JOptionPane.showMessageDialog(null, "未找到该读者"); textField.setText(""); }else { textField_1.setText(reader.getRname()); } } } } }; KeyListener key_Listener_1 = new KeyListener() { public void keyTyped(KeyEvent e) {} public void keyReleased(KeyEvent e){} public void keyPressed(KeyEvent e){ if(e.getKeyChar() == KeyEvent.VK_ENTER ) { if(textField_2.getText() == "") { JOptionPane.showMessageDialog(null, "请输入图书编号"); }else { book = sql.selectBookId(Integer.parseInt(textField_2.getText())); if(book == null) { JOptionPane.showMessageDialog(null, "未找到该图书"); textField_2.setText(""); }else { textField_3.setText(book.getBname()); } } } } }; textField.addKeyListener(key_Listener); textField_2.addKeyListener(key_Listener_1); internalFrame_addbook.dispose(); internalFrame_setbook.dispose(); internalFrame_delbook.dispose(); internalFrame_addreader.dispose(); internalFrame_setreader.dispose(); internalFrame_delreader.dispose(); internalFrame_borrowbook.dispose(); internalFrame_returnbook.setVisible(true); internalFrame_querybook.dispose(); internalFrame_queryreader.dispose(); internalFrame_1.dispose(); internalFrame_2.dispose(); internalFrame_3.dispose(); internalFrame_4.dispose(); internalFrame_5.dispose(); internalFrame_6.dispose(); internalFrame_7.dispose(); internalFrame_about.dispose(); } }); menu_brbook.add(mntmNewMenuItem_returnbook); //创建信息查询菜单 JMenu menu_sertch = new JMenu("信息查询"); menuBar.add(menu_sertch); //查询所有图书信息 JMenuItem menuItem_querybook = new JMenuItem("查询所有图书信息"); menuItem_querybook.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { getContentPane().add(internalFrame_querybook); internalFrame_querybook.getContentPane().setLayout(null); JScrollPane jScrollPane=new JScrollPane(); //将表格添加到滚动条中 jScrollPane.setBounds(48, 25, 555, 300); internalFrame_querybook.getContentPane().add(jScrollPane); JTable table = new JTable(); table.setModel(new DefaultTableModel( new Object[][] { }, new String[] { "bno", "name", "publish", "author", "price", "borrowbook" } )); jScrollPane.setViewportView(table); //初始化表格 DefaultTableModel model = (DefaultTableModel) table.getModel(); userdao u=new userdao(); try { ResultSet rs =u.query(); while(rs.next()){ Vector v=new Vector<>(); v.add(rs.getInt("Bid")); v.add(rs.getString("Bname")); v.add(rs.getString("publish")); v.add(rs.getString("author")); v.add(rs.getFloat("price")); v.add(rs.getInt("borrowed")); model.addRow(v); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } internalFrame_addbook.dispose(); internalFrame_setbook.dispose(); internalFrame_delbook.dispose(); internalFrame_addreader.dispose(); internalFrame_setreader.dispose(); internalFrame_delreader.dispose(); internalFrame_borrowbook.dispose(); internalFrame_returnbook.dispose(); internalFrame_querybook.setVisible(true); internalFrame_queryreader.dispose(); internalFrame_1.dispose(); internalFrame_2.dispose(); internalFrame_3.dispose(); internalFrame_4.dispose(); internalFrame_5.dispose(); internalFrame_6.dispose(); internalFrame_7.dispose(); internalFrame_about.dispose(); } }); menu_sertch.add(menuItem_querybook); //查询所有读者信息 JMenuItem menuItem_queryreader = new JMenuItem("查询所有读者信息"); menuItem_queryreader.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { getContentPane().add(internalFrame_queryreader); internalFrame_queryreader.getContentPane().setLayout(null); JTable table = new JTable(); //创建表格 JScrollPane jScrollPane=new JScrollPane(table); //将表格添加到滚动条中 jScrollPane.setBounds(48, 25, 555, 300); internalFrame_queryreader.getContentPane().add(jScrollPane); internalFrame_addbook.dispose(); internalFrame_setbook.dispose(); internalFrame_delbook.dispose(); internalFrame_addreader.dispose(); internalFrame_setreader.dispose(); internalFrame_delreader.dispose(); internalFrame_borrowbook.dispose(); internalFrame_returnbook.dispose(); internalFrame_querybook.dispose(); internalFrame_queryreader.setVisible(true); internalFrame_1.dispose(); internalFrame_2.dispose(); internalFrame_3.dispose(); internalFrame_4.dispose(); internalFrame_5.dispose(); internalFrame_6.dispose(); internalFrame_7.dispose(); internalFrame_about.dispose(); } }); menu_sertch.add(menuItem_queryreader); //创建查询所有的借书记录菜单项 JMenuItem menuItem_1 = new JMenuItem("查询所有的借书记录"); menuItem_1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { getContentPane().add(internalFrame_1); internalFrame_1.getContentPane().setLayout(null); JTable table = new JTable(); //创建表格 JScrollPane jScrollPane=new JScrollPane(table); //将表格添加到滚动条中 jScrollPane.setBounds(48, 25, 555, 300); internalFrame_1.getContentPane().add(jScrollPane); internalFrame_addbook.dispose(); internalFrame_setbook.dispose(); internalFrame_delbook.dispose(); internalFrame_addreader.dispose(); internalFrame_setreader.dispose(); internalFrame_delreader.dispose(); internalFrame_borrowbook.dispose(); internalFrame_returnbook.dispose(); internalFrame_querybook.dispose(); internalFrame_queryreader.dispose(); internalFrame_1.setVisible(true); internalFrame_2.dispose(); internalFrame_3.dispose(); internalFrame_4.dispose(); internalFrame_5.dispose(); internalFrame_6.dispose(); internalFrame_7.dispose(); internalFrame_about.dispose(); } }); menu_sertch.add(menuItem_1); //创建查询超期借书记录菜单项 JMenuItem menuItem_2 = new JMenuItem("查询超期借书记录"); menuItem_2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { getContentPane().add(internalFrame_2); internalFrame_2.getContentPane().setLayout(null); JTable table = new JTable(); //创建表格 JScrollPane jScrollPane=new JScrollPane(table); //将表格添加到滚动条中 jScrollPane.setBounds(48, 25, 555, 300); internalFrame_2.getContentPane().add(jScrollPane); internalFrame_addbook.dispose(); internalFrame_setbook.dispose(); internalFrame_delbook.dispose(); internalFrame_addreader.dispose(); internalFrame_setreader.dispose(); internalFrame_delreader.dispose(); internalFrame_borrowbook.dispose(); internalFrame_returnbook.dispose(); internalFrame_querybook.dispose(); internalFrame_queryreader.dispose(); internalFrame_1.dispose(); internalFrame_2.setVisible(true); internalFrame_3.dispose(); internalFrame_4.dispose(); internalFrame_5.dispose(); internalFrame_6.dispose(); internalFrame_7.dispose(); internalFrame_about.dispose(); } }); menu_sertch.add(menuItem_2); //创建查询已被借出的书本菜单项 JMenuItem menuItem_3 = new JMenuItem("查询已被借出的书本"); menuItem_3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { getContentPane().add(internalFrame_3); internalFrame_3.getContentPane().setLayout(null); JTable table = new JTable(); //创建表格 JScrollPane jScrollPane=new JScrollPane(table); //将表格添加到滚动条中 jScrollPane.setBounds(48, 25, 555, 300); internalFrame_3.getContentPane().add(jScrollPane); internalFrame_addbook.dispose(); internalFrame_setbook.dispose(); internalFrame_delbook.dispose(); internalFrame_addreader.dispose(); internalFrame_setreader.dispose(); internalFrame_delreader.dispose(); internalFrame_borrowbook.dispose(); internalFrame_returnbook.dispose(); internalFrame_querybook.dispose(); internalFrame_queryreader.dispose(); internalFrame_1.dispose(); internalFrame_2.dispose(); internalFrame_3.setVisible(true); internalFrame_4.dispose(); internalFrame_5.dispose(); internalFrame_6.dispose(); internalFrame_7.dispose(); internalFrame_about.dispose(); } }); menu_sertch.add(menuItem_3); //创建查询某出版社的书菜单项 JMenuItem menuItem_4 = new JMenuItem("查询某出版社的书"); menuItem_4.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { getContentPane().add(internalFrame_4); internalFrame_4.getContentPane().setLayout(null); JLabel lblNewLabel = new JLabel("出版社名称:"); lblNewLabel.setFont(new Font("宋体", Font.BOLD, 15)); lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER); lblNewLabel.setBounds(88, 28, 111, 32); internalFrame_4.getContentPane().add(lblNewLabel); JTextField textField = new JTextField(); textField.setBounds(195, 29, 209, 32); internalFrame_4.getContentPane().add(textField); textField.setColumns(10); JButton btnNewButton = new JButton("查询"); btnNewButton.setFont(new Font("宋体", Font.BOLD, 12)); btnNewButton.setBounds(429, 28, 86, 32); internalFrame_4.getContentPane().add(btnNewButton); JTable table = new JTable(); //创建表格 JScrollPane jScrollPane=new JScrollPane(table); //将表格添加到滚动条中 jScrollPane.setBounds(48, 70, 555, 250); internalFrame_4.getContentPane().add(jScrollPane); internalFrame_addbook.dispose(); internalFrame_setbook.dispose(); internalFrame_delbook.dispose(); internalFrame_addreader.dispose(); internalFrame_setreader.dispose(); internalFrame_delreader.dispose(); internalFrame_borrowbook.dispose(); internalFrame_returnbook.dispose(); internalFrame_querybook.dispose(); internalFrame_queryreader.dispose(); internalFrame_1.dispose(); internalFrame_2.dispose(); internalFrame_3.dispose(); internalFrame_4.setVisible(true); internalFrame_5.dispose(); internalFrame_6.dispose(); internalFrame_7.dispose(); internalFrame_about.dispose(); } }); menu_sertch.add(menuItem_4); //创建查询某读者借的书菜单项 JMenuItem menuItem_5 = new JMenuItem("查询某读者借的书"); menuItem_5.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { getContentPane().add(internalFrame_5); internalFrame_5.getContentPane().setLayout(null); JLabel lblNewLabel = new JLabel("读者姓名:"); lblNewLabel.setFont(new Font("宋体", Font.BOLD, 15)); lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER); lblNewLabel.setBounds(88, 28, 111, 32); internalFrame_5.getContentPane().add(lblNewLabel); JTextField textField = new JTextField(); textField.setBounds(195, 29, 209, 32); internalFrame_5.getContentPane().add(textField); textField.setColumns(10); JButton btnNewButton = new JButton("查询"); btnNewButton.setFont(new Font("宋体", Font.BOLD, 12)); btnNewButton.setBounds(429, 28, 86, 32); internalFrame_5.getContentPane().add(btnNewButton); JTable table = new JTable(); //创建表格 JScrollPane jScrollPane=new JScrollPane(table); //将表格添加到滚动条中 jScrollPane.setBounds(48, 70, 555, 250); internalFrame_5.getContentPane().add(jScrollPane); internalFrame_addbook.dispose(); internalFrame_setbook.dispose(); internalFrame_delbook.dispose(); internalFrame_addreader.dispose(); internalFrame_setreader.dispose(); internalFrame_delreader.dispose(); internalFrame_borrowbook.dispose(); internalFrame_returnbook.dispose(); internalFrame_querybook.dispose(); internalFrame_queryreader.dispose(); internalFrame_1.dispose(); internalFrame_2.dispose(); internalFrame_3.dispose(); internalFrame_4.dispose(); internalFrame_5.setVisible(true); internalFrame_6.dispose(); internalFrame_7.dispose(); internalFrame_about.dispose(); } }); menu_sertch.add(menuItem_5); //创建查询某读者归还某书的日期菜单项 JMenuItem menuItem_6 = new JMenuItem("查询某读者归还某书的日期"); menuItem_6.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { getContentPane().add(internalFrame_6); internalFrame_6.getContentPane().setLayout(null); JLabel lblNewLabel = new JLabel("读者姓名:"); lblNewLabel.setFont(new Font("宋体", Font.BOLD, 15)); lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER); lblNewLabel.setBounds(48, 28, 97, 32); internalFrame_6.getContentPane().add(lblNewLabel); JTextField textField = new JTextField(); textField.setBounds(144, 29, 131, 32); internalFrame_6.getContentPane().add(textField); textField.setColumns(10); JLabel lblNewLabel_1 = new JLabel("书名:"); lblNewLabel_1.setHorizontalAlignment(SwingConstants.CENTER); lblNewLabel_1.setFont(new Font("宋体", Font.BOLD, 15)); lblNewLabel_1.setBounds(274, 28, 97, 32); internalFrame_6.getContentPane().add(lblNewLabel_1); JTextField textField_1 = new JTextField(); textField_1.setBounds(353, 29, 131, 32); internalFrame_6.getContentPane().add(textField_1); textField_1.setColumns(10); JButton btnNewButton = new JButton("查询"); btnNewButton.setFont(new Font("宋体", Font.BOLD, 12)); btnNewButton.setBounds(517, 28, 86, 32); internalFrame_6.getContentPane().add(btnNewButton); JTable table = new JTable(); //创建表格 JScrollPane jScrollPane=new JScrollPane(table); //将表格添加到滚动条中 jScrollPane.setBounds(48, 70, 555, 250); internalFrame_6.getContentPane().add(jScrollPane); internalFrame_addbook.dispose(); internalFrame_setbook.dispose(); internalFrame_delbook.dispose(); internalFrame_addreader.dispose(); internalFrame_setreader.dispose(); internalFrame_delreader.dispose(); internalFrame_borrowbook.dispose(); internalFrame_returnbook.dispose(); internalFrame_querybook.dispose(); internalFrame_queryreader.dispose(); internalFrame_1.dispose(); internalFrame_2.dispose(); internalFrame_3.dispose(); internalFrame_4.dispose(); internalFrame_5.dispose(); internalFrame_6.setVisible(true); internalFrame_7.dispose(); internalFrame_about.dispose(); } }); menu_sertch.add(menuItem_6); //创建查询某读者被罚款的总额菜单项 JMenuItem menuItem_7 = new JMenuItem("查询某读者被罚款的总额"); menuItem_7.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { getContentPane().add(internalFrame_7); internalFrame_7.getContentPane().setLayout(null); JLabel lblNewLabel = new JLabel("读者姓名:"); lblNewLabel.setFont(new Font("宋体", Font.BOLD, 15)); lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER); lblNewLabel.setBounds(88, 28, 111, 32); internalFrame_7.getContentPane().add(lblNewLabel); JTextField textField = new JTextField(); textField.setBounds(195, 29, 209, 32); internalFrame_7.getContentPane().add(textField); textField.setColumns(10); JButton btnNewButton = new JButton("查询"); btnNewButton.setFont(new Font("宋体", Font.BOLD, 12)); btnNewButton.setBounds(429, 28, 86, 32); internalFrame_7.getContentPane().add(btnNewButton); JTable table = new JTable(); //创建表格 JScrollPane jScrollPane=new JScrollPane(table); //将表格添加到滚动条中 jScrollPane.setBounds(48, 70, 555, 250); internalFrame_7.getContentPane().add(jScrollPane); internalFrame_addbook.dispose(); internalFrame_setbook.dispose(); internalFrame_delbook.dispose(); internalFrame_addreader.dispose(); internalFrame_setreader.dispose(); internalFrame_delreader.dispose(); internalFrame_borrowbook.dispose(); internalFrame_returnbook.dispose(); internalFrame_querybook.dispose(); internalFrame_queryreader.dispose(); internalFrame_1.dispose(); internalFrame_2.dispose(); internalFrame_3.dispose(); internalFrame_4.dispose(); internalFrame_5.dispose(); internalFrame_6.dispose(); internalFrame_7.setVisible(true); internalFrame_about.dispose(); } }); menu_sertch.add(menuItem_7); //创建帮助菜单 JMenu menu_help= new JMenu("帮助"); menuBar.add(menu_help); //创建关于我们菜单项 JMenuItem mntmNewMenuItem_about = new JMenuItem("关于我们"); mntmNewMenuItem_about.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { getContentPane().add(internalFrame_about); internalFrame_about.getContentPane().setLayout(null); JLabel lblNewLabel = new JLabel("软件作者:唐亿、韦星佐、田茂鑫"); lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER); lblNewLabel.setFont(new Font("宋体", Font.PLAIN, 18)); lblNewLabel.setBounds(72, 108, 302, 40); internalFrame_about.getContentPane().add(lblNewLabel); internalFrame_addbook.dispose(); internalFrame_setbook.dispose(); internalFrame_delbook.dispose(); internalFrame_addreader.dispose(); internalFrame_setreader.dispose(); internalFrame_delreader.dispose(); internalFrame_borrowbook.dispose(); internalFrame_returnbook.dispose(); internalFrame_querybook.dispose(); internalFrame_queryreader.dispose(); internalFrame_1.dispose(); internalFrame_2.dispose(); internalFrame_3.dispose(); internalFrame_4.dispose(); internalFrame_5.dispose(); internalFrame_6.dispose(); internalFrame_7.dispose(); internalFrame_about.setVisible(true); } }); menu_help.add(mntmNewMenuItem_about); //创建退出菜单项 JMenuItem mntmNewMenuItem_out = new JMenuItem("退出"); mntmNewMenuItem_out.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if(mntmNewMenuItem_out.getText().equals("退出")){ JOptionPane.showMessageDialog(getParent(), "感谢使用", "关闭", JOptionPane.INFORMATION_MESSAGE); sql.closeSql(); System.exit(0); return ; } } }); menu_help.add(mntmNewMenuItem_out); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(new BorderLayout(0, 0)); setContentPane(contentPane); } }
[ "1181144648@qq.com" ]
1181144648@qq.com
edf2be4c163e5d2e5b85a703bb8d36ec4cd22244
2717a90453cebc0f62948413d63ab0d21d394a6c
/wikipedia/src/main/java/org/wikipedia/page/snippet/ShareHandler.java
23f89dd27bfeb4704a23d2a39417c5f33e216f5e
[ "Apache-2.0" ]
permissive
carloshwa/apps-android-wikipedia
c6ff31b85abc69aa758803c3b5970df93aa46e6f
7434c9a054445156d3b439171680fcd577455824
refs/heads/master
2021-01-18T06:22:47.480075
2015-02-17T17:12:05
2015-02-17T18:11:43
30,888,415
0
0
null
2015-02-16T21:07:23
2015-02-16T21:07:23
null
UTF-8
Java
false
false
4,222
java
package org.wikipedia.page.snippet; import android.content.DialogInterface; import android.graphics.Bitmap; import android.view.View; import android.widget.ImageView; import org.wikipedia.PageTitle; import org.wikipedia.R; import org.wikipedia.page.BottomDialog; import org.wikipedia.page.PageActivity; import org.wikipedia.page.PageViewFragmentInternal; import org.wikipedia.util.ShareUtils; /** * Let user chose between sharing as text or as image. */ public class ShareHandler { private final PageActivity activity; private final ShareAFactFunnel funnel; public ShareHandler(PageActivity activity, ShareAFactFunnel funnel) { this.activity = activity; this.funnel = funnel; } public void shareSnippet(CharSequence input, boolean preferUrl) { final PageViewFragmentInternal curPageFragment = activity.getCurPageFragment(); if (curPageFragment == null) { return; } String selectedText = sanitizeText(input.toString()); final int minTextSnippetLength = 2; final PageTitle title = curPageFragment.getTitle(); if (selectedText.length() >= minTextSnippetLength) { String introText = activity.getString(R.string.snippet_share_intro, title.getDisplayText(), title.getCanonicalUri() + "?source=app"); Bitmap resultBitmap = new SnippetImage(activity, curPageFragment.getLeadImageBitmap(), curPageFragment.getImageBaseYOffset(), title.getDisplayText(), title.getDescription(), selectedText).createImage(); if (preferUrl) { new PreviewDialog(activity, resultBitmap, title.getDisplayText(), introText, selectedText, title.getCanonicalUri(), funnel).show(); } else { new PreviewDialog(activity, resultBitmap, title.getDisplayText(), introText, selectedText, selectedText, funnel).show(); } } else { // only share the URL ShareUtils.shareText(activity, title.getDisplayText(), title.getCanonicalUri()); } } private String sanitizeText(String selectedText) { return selectedText.replaceAll("\\[\\d+\\]", "") // [1] .replaceAll("\\(\\s*;\\s*", "\\(") // (; -> ( hacky way for IPA remnants .replaceAll("\\s{2,}", " ") .trim(); } } /** * A dialog to be displayed before sharing with two action buttons: * "Share as image", "Share as text". */ class PreviewDialog extends BottomDialog { public PreviewDialog(final PageActivity activity, final Bitmap resultBitmap, final String title, final String introText, final String selectedText, final String alternativeText, final ShareAFactFunnel funnel) { super(activity, R.layout.dialog_share_preview); ImageView previewImage = (ImageView) getDialogLayout().findViewById(R.id.preview_img); previewImage.setImageBitmap(resultBitmap); getDialogLayout().findViewById(R.id.share_as_image_button) .setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ShareUtils.shareImage(activity, resultBitmap, "*/*", title, title, introText, false); if (funnel != null) { funnel.logShareIntent(selectedText); } } }); getDialogLayout().findViewById(R.id.share_as_text_button) .setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ShareUtils.shareText(activity, title, alternativeText); } }); setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { resultBitmap.recycle(); } }); } }
[ "bsitzmann@wikimedia.org" ]
bsitzmann@wikimedia.org
75c9add0729a40a9dab70f9843688357923e2b64
173b67546b8894dfb1905ecf44fad26940a73ead
/src/test/java/com/epam/runner/Runner.java
f3f104c3d0c20e3427f8622b3cbe51b7bcb6d122
[]
no_license
killdkiller/BDD-Cucumber-Task
669395b9ca39aa72d69c4d27afde3b3adf1a52a1
4464840501b7cd25e43b8f177211736167eb654a
refs/heads/master
2021-01-11T13:57:25.154243
2017-06-20T16:48:52
2017-06-20T16:48:52
94,914,103
0
0
null
null
null
null
UTF-8
Java
false
false
331
java
package com.epam.runner; import org.junit.runner.RunWith; import cucumber.api.CucumberOptions; import cucumber.api.junit.Cucumber; @RunWith(Cucumber.class) @CucumberOptions( features = "features" ,glue={"com.epam.stepDefination"} ,plugin = {"html:target/cucumber-html-report"}) public class Runner { }
[ "noreply@github.com" ]
noreply@github.com
2758f8b78b78ec980a882805510215e992928cbd
3fd6dd3860d462c94e14bab69ea0676b9e8b3a1e
/src/jml/feature/selection/SupervisedFeatureSelection.java
90a50f25d525e1c306f7f6449775e475562b3e75
[ "Apache-2.0" ]
permissive
MingjieQian/JML
7c1ed9b3f2573967f6a5a1c470d947e2c5d74ac5
00afaa0e81fbfbdfbfbd7cfbbc6c0287bfb86eac
refs/heads/master
2020-03-30T23:59:30.257362
2015-12-05T04:46:20
2015-12-05T04:46:20
8,636,421
6
3
null
null
null
null
UTF-8
Java
false
false
1,933
java
package jml.feature.selection; import java.util.TreeMap; import jml.classification.Classifier; import org.apache.commons.math.linear.BlockRealMatrix; import org.apache.commons.math.linear.RealMatrix; /*** * Abstract class for supervised feature selection algorithms. * * @author Mingjie Qian * @version 1.0, Feb. 4th, 2012 */ public class SupervisedFeatureSelection extends FeatureSelection { /** * An n x c label matrix. */ protected RealMatrix Y; /** * Number of classes. */ private int nClass; public SupervisedFeatureSelection() { super(); } /** * Feed labels for this supervised feature selection algorithm. * * @param Y an n x c label matrix * */ public void feedLabels(RealMatrix Y) { this.Y = Y; nClass = Y.getColumnDimension(); } /** * Feed labels for this supervised feature selection algorithm. * * @param labels an n x c 2D {@code double} array * */ public void feedLabels(double[][] labels) { this.Y = new BlockRealMatrix(labels); nClass = Y.getColumnDimension(); } /** * Feed labels for this supervised feature selection algorithm. * * @param labels any integer array holding the original * integer labels * */ public void feedLabels(int[] labels) { nClass = Classifier.calcNumClass(labels); // int[] IDLabelMap = Classifier.getIDLabelMap(labels); TreeMap<Integer, Integer> labelIDMap = Classifier.getLabelIDMap(labels); int[] labelIDs = new int[labels.length]; for (int i = 0; i < labels.length; i++) { labelIDs[i] = labelIDMap.get(labels[i]); } int[] labelIndices = labelIDs; Y = Classifier.labelIndexArray2LabelMatrix(labelIndices, nClass); /*this.labels = labels; this.labelIDs = labelIndices;*/ } @Override /** * {@inheritDoc} */ public void run() { } /** * Get label matrix. * * @return an n x c label matrix * */ public RealMatrix getY() { return Y; } }
[ "qianmingjie@gmail.com" ]
qianmingjie@gmail.com
ad72150c5589e0b705332d38b1e00520e3f0879e
0d2b1617587ae1f01f31446fcd5c7d405a413b47
/Praktikum/Modul 2/Risky07208_si_perpustakaan/src/Entity/Risky07208_BukuEntity.java
ea81c5533ea1fc1b03b16d27802fc65e403f537e
[]
no_license
risky-ade/07208_pbo
baa27b67a1e08127caa711d87941250a70d5028f
487b37118ab21c6a988924bcb619aa3cb62c5333
refs/heads/main
2023-02-17T09:22:25.010351
2021-01-17T11:07:23
2021-01-17T11:07:23
301,421,704
0
0
null
null
null
null
UTF-8
Java
false
false
1,845
java
package Entity; public class Risky07208_BukuEntity { private String Risky07208_judulbuku,Risky07208_tahunterbit,Risky07208_kodebuku,Risky07208_pengarang; int indexkategoripilbuku; // Constructor public Risky07208_BukuEntity(String Risky07208_judulbuku,String Risky07208_kodebuku, String Risky07208_tahunterbit, String Risky07208_pengarang,int indexkategoripilbuku){ this.Risky07208_judulbuku = Risky07208_judulbuku; this.Risky07208_kodebuku = Risky07208_kodebuku; this.Risky07208_tahunterbit = Risky07208_tahunterbit; this.Risky07208_pengarang = Risky07208_pengarang; this.indexkategoripilbuku=indexkategoripilbuku; } public void setRisky07208_judulbuku(String Risky07208_judulbuku) { this.Risky07208_judulbuku = Risky07208_judulbuku; } public void setRisky07208_tahunterbit(String Risky07208_tahunterbit) { this.Risky07208_tahunterbit = Risky07208_tahunterbit; } public void setRisky07208_kodebuku(String Risky07208_kodebuku) { this.Risky07208_kodebuku = Risky07208_kodebuku; } public void setRisky07208_pengarang(String Risky07208_pengarang) { this.Risky07208_pengarang = Risky07208_pengarang; } public void setIndexkategoripilbuku(int indexkategoripilbuku) { this.indexkategoripilbuku = indexkategoripilbuku; } public String getRisky07208_judulbuku() { return Risky07208_judulbuku; } public String getRisky07208_tahunterbit() { return Risky07208_tahunterbit; } public String getRisky07208_kodebuku() { return Risky07208_kodebuku; } public String getRisky07208_pengarang() { return Risky07208_pengarang; } public int getIndexkategoripilbuku() { return indexkategoripilbuku; } }
[ "riskyadesucahyo@gmail.com" ]
riskyadesucahyo@gmail.com
4cf8c7bacec861eb5f4d920c330d8d0a567700cb
3d1b9a2c8a6c51667f59eab232f53920e7b63178
/Students/Vijaica Paul - Augustin/Supermarket/src/Supermarket.java
c0fb0e0eca6b48f784f10a8108b927cbeffd5a65
[]
no_license
AugustinVijaica/POO2019-30223
f68ff6e1736f7fd2c998dd29cb759bbab9c33476
6d0debdf0ab9588a35abe7b578c9fb3f6ebe6944
refs/heads/master
2020-08-16T20:51:28.696962
2020-01-15T16:07:01
2020-01-15T16:07:01
215,551,479
0
0
null
2019-10-16T13:11:21
2019-10-16T13:11:20
null
UTF-8
Java
false
false
1,445
java
public class Supermarket { public Angajat[] lista_angajati= new Angajat[100]; public ClientFidel[] lista_clienti_fideli= new ClientFidel[100]; public Produs[] stoc_produse= new Produs[100]; public void addProdus(Produs p,int index) { if(stoc_produse[index].equals(null)) { stoc_produse[index]=p; } } public void addAngajat(Angajat a,int index) { if(lista_angajati[index].equals(null)) { lista_angajati[index]=a; } } public void addClientFidel(ClientFidel c,int index) { if(lista_clienti_fideli[index].equals(null)) { lista_clienti_fideli[index]=c; } } public void sortareClienti(ClientFidel[] lista, int nr) { ClientFidel aux; for(int i=0;i<nr;i++) { for(int j=0;j<nr-i-1;j++) { if(lista[j].suma>lista[j+1].suma) { aux=lista[j]; lista[j]=lista[j+1]; lista[j+1]=aux; } } } } public void printListaClienti(ClientFidel[] lista, int nr ) { for(int i=0;i<nr;i++) { lista[i].printInfo(); System.out.println("\n"); } } public void sortareAngajati(Angajat[] lista, int nr) { Angajat aux; for(int i=0;i<nr;i++) { for(int j=0;j<nr-i-1;j++) { if(lista[j].nr_clienti_serviti>lista[j+1].nr_clienti_serviti) { aux=lista[j]; lista[j]=lista[j+1]; lista[j+1]=aux; } } } } public void printListaAngajati(Angajat[] lista, int nr ) { for(int i=0;i<nr;i++) { lista[i].printInfo(); System.out.println("\n"); } } }
[ "augustinvijaica@gmail.com" ]
augustinvijaica@gmail.com
52c00434a172b8279a2653c44cc9bb69a2fd50f1
0b017da5772635c286a3448d68a330741e0d3662
/SEW-Projekt-master/Server/src/server/Server.java
83ee9d382862b28d0efb476ffd05368275221d59
[]
no_license
ertamustafa/SEW-Projekt
b994f6f8f5fb03f85fa851722ffbbe06b7de546c
e5f05553ce9b9d1878d9e14e89f7b062a47e6231
refs/heads/master
2021-01-19T21:06:29.951573
2017-06-05T07:17:06
2017-06-05T07:17:06
88,609,308
0
0
null
null
null
null
UTF-8
Java
false
false
420
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 server; /** * * @author Schueler */ public class Server { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here } }
[ "noreply@github.com" ]
noreply@github.com
c9b89a31a5e2d6829e3c99e0348e4034d74a2048
16f496f75d5c097aaa6ee1ffdfecf719fbdad593
/app/src/main/java/com/senter/demo/uhf/util/DataTransfer.java
da863efd3a75c13e6c41e26c5d1e3ed4521200e0
[]
no_license
victor-chevillotte/KleitzApp
8952e63df6086ec4a91c6356393ebe8084ed497c
e5ee38fde24fbe5c2b476364b7d3f6127d054119
refs/heads/main
2023-04-25T16:40:21.875924
2021-05-17T09:53:10
2021-05-17T09:53:10
368,110,380
0
0
null
null
null
null
UTF-8
Java
false
false
897
java
package com.senter.demo.uhf.util; /** * tool class */ public class DataTransfer { public static String xGetString(byte[] bs) { if (bs != null) { StringBuffer sBuffer = new StringBuffer(); for (int i = 0; i < bs.length; i++) { sBuffer.append(String.format("%02x ", bs[i])); } return sBuffer.toString(); } return "null"; } public static byte[] getBytesByHexString(String string) { string = string.replaceAll(" ", "");// delete spaces int len = string.length(); if (len % 2 == 1) { return null; } byte[] ret = new byte[len / 2]; for (int i = 0; i < ret.length; i++) { ret[i] = (byte) (Integer.valueOf(string.substring((i * 2), (i * 2 + 2)), 16) & 0xff); } return ret; } }
[ "46164574+victor-chevillotte@users.noreply.github.com" ]
46164574+victor-chevillotte@users.noreply.github.com
06708f2b8f79205efe44fe39f09a7c076e6ad825
fd2a6e28a302edaf457cb87bf0d36e63e51c0f77
/app/src/main/java/com/example/user/starwars/adapters/PlanetsAdapter.java
944ff4bbf5989057cad46a5784db16fbdf73bb2f
[]
no_license
sweter123/StarWars
287e9865eca871ffc9175c69e3cfe2a7fb0a979b
b4a311c340f29958d005b3e80fd1cc34b8d9d201
refs/heads/master
2021-01-09T20:07:24.535328
2016-07-19T14:25:03
2016-07-19T14:25:03
62,878,075
0
1
null
null
null
null
UTF-8
Java
false
false
2,088
java
package com.example.user.starwars.adapters; 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.user.starwars.R; import com.example.user.starwars.SWAPI.planets.Planet; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; /** * Created by user on 14.07.2016. */ public class PlanetsAdapter extends RecyclerView.Adapter<PlanetsAdapter.PeopleViewHolder>{ private List<Planet> items; LayoutInflater layoutInflater; PeopleClickListener callback; public interface PeopleClickListener { void onPersonClick(Planet person); } public PlanetsAdapter(List<Planet> items) { this.items = items; } @Override public PeopleViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { layoutInflater = LayoutInflater.from(parent.getContext()); View view = layoutInflater.inflate(R.layout.people_list_row, parent, false); return new PeopleViewHolder(view); } @Override public void onBindViewHolder(PeopleViewHolder holder, int position) { final Planet person = items.get(position); holder.nameView.setText(person.getName()); } @Override public int getItemCount() { return items.size(); } public void setItems(List<Planet> list){ items = list; notifyDataSetChanged(); } public void setOnClickListener(PeopleClickListener callback) { this.callback = callback; } class PeopleViewHolder extends RecyclerView.ViewHolder{ @BindView(R.id.text1) TextView nameView; public PeopleViewHolder(View itemView) { super(itemView); ButterKnife.bind(this, itemView); } @OnClick(R.id.text1) public void onItemClick() { if(callback != null) { callback.onPersonClick(items.get(getAdapterPosition())); } } } }
[ "bortekwalaszak69@gmail.com" ]
bortekwalaszak69@gmail.com
d6ba3a302e10b83c745178d274d5d4effedcf5ff
b7c3d6a367dac11b68161818adbf072af78ec634
/src/main/java/com/haivuit/app/config/apidoc/package-info.java
2a254ea1e0eeb56dc8f653ab7e38a3f5f38e7f65
[]
no_license
haivuit91/JhipsterDemo
145982a9a99bc0c59eababe48f59116574c58658
8248ec9f39dd96e5dfed00a0522a4becefe14a15
refs/heads/master
2021-01-10T11:32:28.786848
2015-12-15T09:01:51
2015-12-15T09:01:51
48,031,178
0
0
null
null
null
null
UTF-8
Java
false
false
76
java
/** * Swagger api specific code. */ package com.haivuit.app.config.apidoc;
[ "haivuit91@gmail.com" ]
haivuit91@gmail.com
4718b877bf926d2f04831469137fd6aca24e8130
94243e15cfe9cccdf3638d53527fa58327efac29
/habeascorpus_tokens/batik-1.7/sources/org/apache/batik/bridge/BridgeUpdateHandler.java
39ab48772da4dedd2a3184a93c9735a932462ab4
[]
no_license
habeascorpus/habeascorpus-data-withComments
4e0193450273f2d46ea9ef497746aaf93b5fc491
3a516954b42b24c93a8d1e292ff0a0907bed97ad
refs/heads/master
2021-01-20T21:53:35.264690
2015-05-22T14:59:36
2015-05-22T14:59:36
18,139,450
3
1
null
2023-03-20T11:51:26
2014-03-26T13:45:05
Java
UTF-8
Java
false
false
6,587
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. */ TokenNameCOMMENT_BLOCK Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. package TokenNamepackage org TokenNameIdentifier org . TokenNameDOT apache TokenNameIdentifier apache . TokenNameDOT batik TokenNameIdentifier batik . TokenNameDOT bridge TokenNameIdentifier bridge ; TokenNameSEMICOLON import TokenNameimport org TokenNameIdentifier org . TokenNameDOT apache TokenNameIdentifier apache . TokenNameDOT batik TokenNameIdentifier batik . TokenNameDOT css TokenNameIdentifier css . TokenNameDOT engine TokenNameIdentifier engine . TokenNameDOT CSSEngineEvent TokenNameIdentifier CSS Engine Event ; TokenNameSEMICOLON import TokenNameimport org TokenNameIdentifier org . TokenNameDOT apache TokenNameIdentifier apache . TokenNameDOT batik TokenNameIdentifier batik . TokenNameDOT dom TokenNameIdentifier dom . TokenNameDOT svg TokenNameIdentifier svg . TokenNameDOT AnimatedLiveAttributeValue TokenNameIdentifier Animated Live Attribute Value ; TokenNameSEMICOLON import TokenNameimport org TokenNameIdentifier org . TokenNameDOT w3c TokenNameIdentifier w3c . TokenNameDOT dom TokenNameIdentifier dom . TokenNameDOT events TokenNameIdentifier events . TokenNameDOT MutationEvent TokenNameIdentifier Mutation Event ; TokenNameSEMICOLON /** * Interface for objects interested in being notified of updates. * * @author <a href="mailto:vincent.hardy@apache.org">Vincent Hardy</a> * @author <a href="mailto:Thierry.Kormann@sophia.inria.fr">Thierry Kormann</a> * @version $Id: BridgeUpdateHandler.java 475477 2006-11-15 22:44:28Z cam $ */ TokenNameCOMMENT_JAVADOC Interface for objects interested in being notified of updates. * @author <a href="mailto:vincent.hardy@apache.org">Vincent Hardy</a> @author <a href="mailto:Thierry.Kormann@sophia.inria.fr">Thierry Kormann</a> @version $Id: BridgeUpdateHandler.java 475477 2006-11-15 22:44:28Z cam $ public TokenNamepublic interface TokenNameinterface BridgeUpdateHandler TokenNameIdentifier Bridge Update Handler { TokenNameLBRACE /** * Invoked when an MutationEvent of type 'DOMAttrModified' is fired. */ TokenNameCOMMENT_JAVADOC Invoked when an MutationEvent of type 'DOMAttrModified' is fired. void TokenNamevoid handleDOMAttrModifiedEvent TokenNameIdentifier handle DOM Attr Modified Event ( TokenNameLPAREN MutationEvent TokenNameIdentifier Mutation Event evt TokenNameIdentifier evt ) TokenNameRPAREN ; TokenNameSEMICOLON /** * Invoked when an MutationEvent of type 'DOMNodeInserted' is fired. */ TokenNameCOMMENT_JAVADOC Invoked when an MutationEvent of type 'DOMNodeInserted' is fired. void TokenNamevoid handleDOMNodeInsertedEvent TokenNameIdentifier handle DOM Node Inserted Event ( TokenNameLPAREN MutationEvent TokenNameIdentifier Mutation Event evt TokenNameIdentifier evt ) TokenNameRPAREN ; TokenNameSEMICOLON /** * Invoked when an MutationEvent of type 'DOMNodeRemoved' is fired. */ TokenNameCOMMENT_JAVADOC Invoked when an MutationEvent of type 'DOMNodeRemoved' is fired. void TokenNamevoid handleDOMNodeRemovedEvent TokenNameIdentifier handle DOM Node Removed Event ( TokenNameLPAREN MutationEvent TokenNameIdentifier Mutation Event evt TokenNameIdentifier evt ) TokenNameRPAREN ; TokenNameSEMICOLON /** * Invoked when an MutationEvent of type 'DOMCharacterDataModified' * is fired. */ TokenNameCOMMENT_JAVADOC Invoked when an MutationEvent of type 'DOMCharacterDataModified' is fired. void TokenNamevoid handleDOMCharacterDataModified TokenNameIdentifier handle DOM Character Data Modified ( TokenNameLPAREN MutationEvent TokenNameIdentifier Mutation Event evt TokenNameIdentifier evt ) TokenNameRPAREN ; TokenNameSEMICOLON /** * Invoked when an CSSEngineEvent is fired. */ TokenNameCOMMENT_JAVADOC Invoked when an CSSEngineEvent is fired. void TokenNamevoid handleCSSEngineEvent TokenNameIdentifier handle CSS Engine Event ( TokenNameLPAREN CSSEngineEvent TokenNameIdentifier CSS Engine Event evt TokenNameIdentifier evt ) TokenNameRPAREN ; TokenNameSEMICOLON /** * Invoked when the animated value of an animated attribute has changed. */ TokenNameCOMMENT_JAVADOC Invoked when the animated value of an animated attribute has changed. void TokenNamevoid handleAnimatedAttributeChanged TokenNameIdentifier handle Animated Attribute Changed ( TokenNameLPAREN AnimatedLiveAttributeValue TokenNameIdentifier Animated Live Attribute Value alav TokenNameIdentifier alav ) TokenNameRPAREN ; TokenNameSEMICOLON /** * Invoked when an 'other' animation value has changed. */ TokenNameCOMMENT_JAVADOC Invoked when an 'other' animation value has changed. void TokenNamevoid handleOtherAnimationChanged TokenNameIdentifier handle Other Animation Changed ( TokenNameLPAREN String TokenNameIdentifier String type TokenNameIdentifier type ) TokenNameRPAREN ; TokenNameSEMICOLON /** * Disposes this BridgeUpdateHandler and releases all resources. */ TokenNameCOMMENT_JAVADOC Disposes this BridgeUpdateHandler and releases all resources. void TokenNamevoid dispose TokenNameIdentifier dispose ( TokenNameLPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON } TokenNameRBRACE
[ "dma@cs.cmu.edu" ]
dma@cs.cmu.edu
35d4911fa5e7caffa5bbfc27159e41e64f58c484
7df54694adef264c3dfc8283074c39ef0d1372cf
/src/bank/CreditAccount.java
ade9d889e0632f45dae2ccd6bfade973d9843bcd
[]
no_license
Deuzez916/bank
8dc00fcfaa5a8bb54702a6079c4c148b450be644
6f9a407bda40072360942a2da2c327f63eb0dfbd
refs/heads/master
2023-09-05T16:59:24.359320
2021-11-17T10:05:18
2021-11-17T10:05:18
428,994,677
0
0
null
null
null
null
UTF-8
Java
false
false
2,278
java
package bank; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.PrintStream; import java.math.BigDecimal; import java.util.Scanner; public class CreditAccount { private long personalNumber; private int accountNumber; private String accountType = "c"; private double accountSum = 0; CreditAccount(long personalNumber) throws FileNotFoundException { getAccountNumberFromFile(); this.personalNumber = personalNumber; } CreditAccount(int accountNumber, double accountSum) { this.accountNumber = accountNumber; this.accountSum = accountSum; } private void getAccountNumberFromFile() throws FileNotFoundException { Scanner in = new Scanner(new File("AccountNumber.txt")); String s = in.nextLine(); int konto = Integer.parseInt(s); this.accountNumber = konto; PrintStream p = new PrintStream(new BufferedOutputStream(new FileOutputStream("AccountNumber.txt"))); konto++; p.println(konto); p.close(); } public double getAccountSum() { return accountSum; } public int getAccountNumber() { return accountNumber; } public String getAccountType() { return accountType; } public void addMoney(double transactionSum) { BigDecimal bdAccountSum = BigDecimal.valueOf(accountSum); BigDecimal bdTransactionSum = BigDecimal.valueOf(transactionSum); BigDecimal bdNewSum = bdAccountSum.add(bdTransactionSum); setAccountSum(bdNewSum.doubleValue()); } public void withdrawMoney(double transactionSum) { BigDecimal bdAccountSum = BigDecimal.valueOf(accountSum); BigDecimal bdTransactionSum = BigDecimal.valueOf(transactionSum); BigDecimal bdNewSum = bdAccountSum.subtract(bdTransactionSum); setAccountSum(bdNewSum.doubleValue()); } public void setAccountSum(double accountSum) { this.accountSum = accountSum; } public String toString() { return "Credit Account" + " ".repeat(15) + accountNumber + " ".repeat(25) + accountSum; } }
[ "linus.lindroth.92@gmail.com" ]
linus.lindroth.92@gmail.com
8b8091aee5145deb15a036eb59bb0728ab58c95e
6662501677288d05587a5ec3d8aa920b91b760ef
/src/com/sxkj/exception/CustomExceptionController.java
e9f399af1cc41e70f31ef6f9ff000bb5a46c57b6
[]
no_license
lss0555/SpringMvcDemo
f0de9ab4d530f57cdd0e66d460b795d406249a52
faf1ed4cfe5aef03067b39a21a54d705d702a7f1
refs/heads/master
2020-04-20T05:50:24.428028
2019-02-20T00:25:36
2019-02-20T00:25:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
962
java
package com.sxkj.exception; import com.sxkj.common.CustomException; import com.sxkj.model.TResult; import com.sxkj.model.TResultUtils; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; /** * @Description 自定义异常处理 * @Author lss0555 **/ @Controller public class CustomExceptionController { /** * 用于处理自定义异常 * @return */ // @ExceptionHandler({CustomException.class}) // @ResponseBody // public TResult handleException(CustomException e) { // return TResultUtils.error(e.getMessage()); // } // @RequestMapping("test_error") // @ResponseBody // public void test() { // throw new CustomException("出错了!"); // } }
[ "404629780@qq.com" ]
404629780@qq.com
abd584b55a1dfb6adac94896b06abc964f0f6fe3
cba6c3badbccfa2eb51f265cde0006628c9fd7c6
/src/main/java/cn/wolfcode/wms/mapper/SaleAccountMapper.java
d29d395604c489fa11a0e3237d4d6dd3ec9c7c71
[]
no_license
Lan-HY/WMS
cce9896b619d1ead4644fd1a961d756e23126716
5c934975399fe4239ebd80cf1c25c9ef66bade17
refs/heads/master
2021-09-10T05:51:24.659582
2018-03-20T13:38:46
2018-03-20T13:38:46
125,849,129
0
0
null
null
null
null
UTF-8
Java
false
false
343
java
package cn.wolfcode.wms.mapper; import cn.wolfcode.wms.domain.SaleAccount; import java.util.List; public interface SaleAccountMapper { int deleteByPrimaryKey(Long id); int insert(SaleAccount entity); SaleAccount selectByPrimaryKey(Long id); List<SaleAccount> selectAll(); int updateByPrimaryKey(SaleAccount entity); }
[ "979350564@qq.com" ]
979350564@qq.com
0a8264af86aa5c1c18a9ff7dfbf0220972fe53d7
878ab53504a55e760bf8ea2c6edd5be4d69e9a27
/src/test/java/com/liumapp/jspbasic/ParameterTest.java
4017ff521ddd481cbbb4356057181761843f3555
[]
no_license
liumapp/jsp-basic
09186b2cadc0365f04d16a24791c1073e1c5e5a1
625cff99f358a2e23b3165c4496625b20af4deab
refs/heads/master
2021-01-23T04:44:31.111018
2017-07-14T02:11:11
2017-07-14T02:11:11
92,938,520
0
0
null
null
null
null
UTF-8
Java
false
false
1,057
java
package com.liumapp.jspbasic; import com.liumapp.jspbasic.util.Calculate; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import java.util.Arrays; import java.util.Collection; import junit.framework.TestCase; /** * Created by liumapp on 6/26/17. * E-mail:liumapp.com@gmail.com * home-page:http://www.liumapp.com */ @RunWith(Parameterized.class) public class ParameterTest { int expected = 0; int input1 = 0; int input2 = 0; public ParameterTest( int expected , int input1 , int input2) { this.expected = expected; this.input1 = input1; this.input2 = input2; } @Parameterized.Parameters public static Collection<Object[]> t() { return Arrays.asList(new Object[][]{ {3,1,2}, {4,2,2} }); } @Test public void testAdd() { System.out.println("test add begin: while expected is " + expected); TestCase.assertEquals(expected , new Calculate().add(input1 ,input2)); } }
[ "liumapp.com@gmail.com" ]
liumapp.com@gmail.com
3a5eabc71df7e5a4cada3d4c3b5f64cf5f956935
fcd3a632e1ce76bb68ae00f1c39d1d7f25892d25
/app/src/main/java/com/example/rspl_rahul/mcashrst/CashOut.java
bf050755968c54424673d5a18bad5eacda295f03
[]
no_license
rcb4u/Mcashrst
ff9f1c20e3799dd421f46bace412e0357397c5b2
039ed33cf7edd69c4a6daffed188e471c1298e6a
refs/heads/master
2021-01-23T02:11:01.130748
2017-05-31T06:31:21
2017-05-31T06:31:21
92,912,256
1
1
null
null
null
null
UTF-8
Java
false
false
619
java
package com.example.rspl_rahul.mcashrst; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; public class CashOut extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_cash_out); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); } }
[ "chaudharirahul518@gmail.com" ]
chaudharirahul518@gmail.com
9805eedf98d034423bf7ad8dac316d25bc60b7e4
4eef4882be19f910ce841869b881396c8472deed
/InvertedIndex/tests/BaseTester.java
ee2e5c611015619faf564c918a4b72339082b2f0
[]
no_license
kssahoo/SoftwareDevelopment
04830bf6ee029cc978fe6d413fdba1211d273f16
8f1c4c5f5fffcc8d6360bb97fe759d370167a332
refs/heads/master
2021-01-24T16:10:40.686358
2015-02-21T08:59:31
2015-02-21T08:59:31
30,437,020
0
0
null
null
null
null
UTF-8
Java
false
false
6,182
java
import java.io.BufferedReader; import java.io.File; import java.net.InetAddress; import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.regex.Matcher; import org.junit.Assert; import org.junit.Test; public class BaseTester { /** * Directory of files on the lab computer. Do not modify this variable! */ public static final String CSLAB_DIR = "/home/public/cs212"; /** * Tests if the project setup is incorrect. */ @Test public void testEnvironment() { String message = "Unable to find input and output directories, " + "please check your project setup!"; Assert.assertTrue(message, isEnvironmentSetup()); } /** * Tests whether you are running from a lab computer. */ @Test public void testLabComputer() { try { // output system information for debugging purposes System.out.println("Host Address: " + InetAddress.getLocalHost().getHostAddress()); System.out.println(" Host Name: " + InetAddress.getLocalHost().getCanonicalHostName()); System.out.println(" Base Path: " + getBaseDirectory()); } catch (Exception ex) { System.out.println("Unable to determine host information."); } String errorMessage = "You must be testing from the CS lab " + "computers to pass this test."; Assert.assertTrue(errorMessage, isLabComputer()); } /** * Tests whether Driver runs without exceptions when given no arguments. */ @Test public void testNoArguments() { // assumes no exceptions are thrown with bad arguments String[] args = new String[] {}; Driver.main(args); } /** * Tries to determine if the tests are being run on a lab computer by * looking at the hostname and ip address. * * @return true if it appears the tests are being run on a lab computer */ public static boolean isLabComputer() { boolean lab = false; try { Path base = Paths.get(CSLAB_DIR); String addr = InetAddress.getLocalHost().getHostAddress(); String name = InetAddress.getLocalHost().getCanonicalHostName(); if (Files.isReadable(base) && addr.startsWith("138.202.171.") && name.endsWith(".cs.usfca.edu")) { lab = true; } else { lab = false; } } catch (Exception ex) { lab = false; } return lab; } /** * Gets the base directory to use for testing purposes. Either the CS Lab * directory or the current project directory. * * @return path of base directory */ public static String getBaseDirectory() { String base = isLabComputer() ? CSLAB_DIR : "."; try { base = Paths.get(base).toRealPath().toString(); } catch (Exception ex) { base = "."; } return base; } /** * Tests whether environment setup is correct, with a input and output * directory located within the base directory. */ public static boolean isEnvironmentSetup() { String base = getBaseDirectory(); Path input = Paths.get(base, "input"); Path output = Paths.get(base, "output"); return Files.isReadable(input) && Files.isReadable(output); } /** * Tests line-by-line if two files are equal. If one file contains extra * blank lines at the end of the file, the two are still considered equal. * * This test will pass even if the files are generated from different base * directories, and hence have slightly different absolute paths. * * @param path1 path to first file to compare with * @param path2 path to second file to compare with * @return true if the two files are equal */ public static boolean testFiles(Path path1, Path path2) { Charset charset = java.nio.charset.StandardCharsets.UTF_8; try ( BufferedReader reader1 = Files.newBufferedReader(path1, charset); BufferedReader reader2 = Files.newBufferedReader(path2, charset); ) { String line1 = reader1.readLine(); String line2 = reader2.readLine(); // used to output line mismatch int count = 0; // used to remove base directory from paths String pattern = Matcher.quoteReplacement(getBaseDirectory()); while(true) { count++; if ((line1 != null) && (line2 != null)) { if (!line1.trim().equals(line2.trim())) { // it is possible the base directory is different // replace base directory with CS_LAB directory line1 = line1.replaceFirst(pattern, CSLAB_DIR); line2 = line2.replaceFirst(pattern, CSLAB_DIR); // use consistent path separators line1 = line1.replaceAll(Matcher.quoteReplacement(File.separator), "/"); line2 = line2.replaceAll(Matcher.quoteReplacement(File.separator), "/"); // now compare lines again if (!line1.equals(line2)) { //System.out.println("WARNING: Mismatch found on line " // + count + " of " + path1.getFileName()); return false; } } line1 = reader1.readLine(); line2 = reader2.readLine(); } else { // discard extra blank lines at end of reader1 while ((line1 != null) && line1.trim().isEmpty()) { line1 = reader1.readLine(); } // discard extra blank lines at end of reader2 while ((line2 != null) && line2.trim().isEmpty()) { line2 = reader2.readLine(); } // only true if both are null, otherwise one file had // extra non-empty lines return (line1 == line2); } } } catch (Exception ex) { return false; } } /** * This helper method passes the necessary arguments to the Driver class, * and then tests the output. The expected output file should always be * in the "output" subdirectory of the base directory. The actual output * file should be in the current working directory. * * @param args arugments to pass to the Driver class * @param expected name of the expected output file * @param actual name of the actual output file * @throws Exception */ public static void testProject(String[] args, String expected, String actual) throws Exception { String base = getBaseDirectory(); Path path1 = Paths.get(".", actual); Path path2 = Paths.get(base, "output", expected); Files.deleteIfExists(path1); Driver.main(args); Assert.assertTrue(testFiles(path1, path2)); } }
[ "ksahoo@usfca.edu" ]
ksahoo@usfca.edu
0c50b6acfa204b4c7b70536c9027d8c635f92d81
7646e3668a8ef3f6168d6d66556477e53f14fb1a
/java/src/Problem18.java
c92702e4f4f82247bc6a87e28a3afe26c969cda0
[]
no_license
aweis/Project-euler
1d374a65dadc3c0b4ed9955d6e8d10ac03fd67f8
8ac25256a8efcac1b016ff57ae2e13b2cba287b2
refs/heads/master
2023-06-11T14:52:13.600648
2023-05-27T21:48:48
2023-05-27T21:48:48
3,072,361
1
0
null
null
null
null
UTF-8
Java
false
false
1,856
java
import java.io.BufferedReader; import java.io.FileReader; import java.util.LinkedList; /** * Created by adam on 2/16/14. */ public class Problem18 implements Euler { int[][] table; public Problem18() throws Exception { LinkedList<String> l = new LinkedList<String>(); BufferedReader in = new BufferedReader(new FileReader("text/Problem18b.txt")); String currentLine; while((currentLine = in.readLine()) != null) { l.addLast(currentLine); } table = new int[l.size()][l.getLast().split(" ").length]; int row = 0; for(String s : l) { int col = 0; for(String elem : s.split(" ")) { table[row][col] = Integer.parseInt(elem); col++; } row++; } } private void printTable() { for (int i = 0; i < table[0].length; i++) { for (int j = 0; j < table.length; j++) { System.out.print(table[i][j] + " "); } System.out.print("\n"); } } @Override public String answer() throws Exception { for(int row = 1; row < table[0].length; row++) { for(int col = 0; col < table.length; col++) { if (col == 0) { table[row][col]+= table[row-1][col]; } else if (col == table.length-1) { table[row][col]+= table[row-1][col-1]; } else { table[row][col] += Math.max(table[row-1][col-1], table[row-1][col]); } } } int max = 0; for(int i = 0; i < table[0].length; i++) { int temp = table[table.length-1][i]; if (temp > max) { max = temp; } } return Integer.toString(max); } }
[ "aweis@andrew.cmu.edu" ]
aweis@andrew.cmu.edu
58123ade9ac7d62d4f518b004acca27f2f203324
0501080cfc10eab5e92111d7c1128bb4ef61430f
/云端/cmw_project/src/main/java/com/project/service/impl/RoomEntityServiceImpl.java
6ca0c499daedd7efdf85acab7430136ef806d404
[]
no_license
lgq2015/DemoTest
4536fc9cd4261dc8b0432af3c87cc8671ebcf1fa
ee5d4d3a5c7e2a0b606107b29849f9561874e418
refs/heads/master
2023-05-13T03:43:33.480202
2019-08-29T08:33:19
2019-08-29T08:33:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,561
java
package com.project.service.impl; import com.project.dao.RoomEntityDao; import com.project.entity.DeviceEntity; import com.project.entity.RoomEntity; import com.project.service.DeviceEntityService; import com.project.service.RoomEntityService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; /** * Created by xieyanhao on 16/4/24. */ @Service public class RoomEntityServiceImpl implements RoomEntityService{ @Autowired private RoomEntityDao roomEntityDao; @Autowired private DeviceEntityService deviceEntityService; @Override @Transactional public void addRoom(RoomEntity entity) { roomEntityDao.save(entity); } @Override public RoomEntity getRoomById(int id) { return roomEntityDao.get(id); } @Override @Transactional public void updateRoom(RoomEntity entity) { roomEntityDao.update(entity); } @Override @Transactional public void deleteRoom(RoomEntity entity) { // 删除设备 List<DeviceEntity> deviceEntities = deviceEntityService.getDevicesByRoomId(entity.getId()); for (DeviceEntity deviceEntity : deviceEntities) { deviceEntityService.deleteDevice(deviceEntity); } roomEntityDao.delete(entity); } @Override public List<RoomEntity> getRoomsByFloorId(int floorId) { return roomEntityDao.getRoomsByFloorId(floorId); } }
[ "1277796119@qq.com" ]
1277796119@qq.com
fc784c846010270292008ef395cba761795b890c
cb6f3e18ed020a600153c07819563aea9036dcee
/src/main/java/io/github/jhipster/application/web/rest/JobResource.java
e352ac5cd2a2aea392f89e22abbcc945dcf66342
[]
no_license
GlobalGeneric/testjh2
b51f05d844a010326c30d711d96b326d29daf8d1
04a36bff82450b7a9d638a3b9c9cb19ffe37ab56
refs/heads/master
2020-03-12T16:03:37.285123
2018-04-23T14:31:32
2018-04-23T14:31:32
130,706,371
0
0
null
2018-04-23T14:31:33
2018-04-23T14:09:02
Java
UTF-8
Java
false
false
4,255
java
package io.github.jhipster.application.web.rest; import com.codahale.metrics.annotation.Timed; import io.github.jhipster.application.service.JobService; import io.github.jhipster.application.web.rest.errors.BadRequestAlertException; import io.github.jhipster.application.web.rest.util.HeaderUtil; import io.github.jhipster.application.service.dto.JobDTO; import io.github.jhipster.web.util.ResponseUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import java.net.URI; import java.net.URISyntaxException; import java.util.List; import java.util.Optional; /** * REST controller for managing Job. */ @RestController @RequestMapping("/api") public class JobResource { private final Logger log = LoggerFactory.getLogger(JobResource.class); private static final String ENTITY_NAME = "job"; private final JobService jobService; public JobResource(JobService jobService) { this.jobService = jobService; } /** * POST /jobs : Create a new job. * * @param jobDTO the jobDTO to create * @return the ResponseEntity with status 201 (Created) and with body the new jobDTO, or with status 400 (Bad Request) if the job has already an ID * @throws URISyntaxException if the Location URI syntax is incorrect */ @PostMapping("/jobs") @Timed public ResponseEntity<JobDTO> createJob(@RequestBody JobDTO jobDTO) throws URISyntaxException { log.debug("REST request to save Job : {}", jobDTO); if (jobDTO.getId() != null) { throw new BadRequestAlertException("A new job cannot already have an ID", ENTITY_NAME, "idexists"); } JobDTO result = jobService.save(jobDTO); return ResponseEntity.created(new URI("/api/jobs/" + result.getId())) .headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString())) .body(result); } /** * PUT /jobs : Updates an existing job. * * @param jobDTO the jobDTO to update * @return the ResponseEntity with status 200 (OK) and with body the updated jobDTO, * or with status 400 (Bad Request) if the jobDTO is not valid, * or with status 500 (Internal Server Error) if the jobDTO couldn't be updated * @throws URISyntaxException if the Location URI syntax is incorrect */ @PutMapping("/jobs") @Timed public ResponseEntity<JobDTO> updateJob(@RequestBody JobDTO jobDTO) throws URISyntaxException { log.debug("REST request to update Job : {}", jobDTO); if (jobDTO.getId() == null) { return createJob(jobDTO); } JobDTO result = jobService.save(jobDTO); return ResponseEntity.ok() .headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, jobDTO.getId().toString())) .body(result); } /** * GET /jobs : get all the jobs. * * @return the ResponseEntity with status 200 (OK) and the list of jobs in body */ @GetMapping("/jobs") @Timed public List<JobDTO> getAllJobs() { log.debug("REST request to get all Jobs"); return jobService.findAll(); } /** * GET /jobs/:id : get the "id" job. * * @param id the id of the jobDTO to retrieve * @return the ResponseEntity with status 200 (OK) and with body the jobDTO, or with status 404 (Not Found) */ @GetMapping("/jobs/{id}") @Timed public ResponseEntity<JobDTO> getJob(@PathVariable Long id) { log.debug("REST request to get Job : {}", id); JobDTO jobDTO = jobService.findOne(id); return ResponseUtil.wrapOrNotFound(Optional.ofNullable(jobDTO)); } /** * DELETE /jobs/:id : delete the "id" job. * * @param id the id of the jobDTO to delete * @return the ResponseEntity with status 200 (OK) */ @DeleteMapping("/jobs/{id}") @Timed public ResponseEntity<Void> deleteJob(@PathVariable Long id) { log.debug("REST request to delete Job : {}", id); jobService.delete(id); return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build(); } }
[ "jhipster-bot@users.noreply.github.com" ]
jhipster-bot@users.noreply.github.com
be5dc5cd4b6fd338cbf40bb802a4930566275534
99c0f39cb9ccf6aa7e32df87757406100e504dc4
/LinkListImpDoubleList/src/JavaADT/ListExample.java
e53059dff78e8f8ec4eeda700a4eac86b03bc7c5
[]
no_license
noojar/project_cos2103
6e69f70bfb25dcce7facbdfaca0b72debeaf0a2d
8eb80bee792c775c685e1b0c4c8e6999db67a92e
refs/heads/master
2020-04-13T01:37:32.517098
2019-02-08T07:59:58
2019-02-08T07:59:58
162,879,218
0
0
null
2019-01-14T21:22:54
2018-12-23T09:49:53
Java
UTF-8
Java
false
false
733
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 JavaADT; import java.util.Iterator; import java.util.List; import java.util.ArrayList; public class ListExample { public static void main(String[] args) { // List Example implement with ArrayList List<String> ls=new ArrayList<String>(); ls.add("one"); ls.add("Three"); ls.add("two"); ls.add("four"); Iterator it=ls.iterator(); while(it.hasNext()) { String value=(String)it.next(); System.out.println("Value :"+value); } } }
[ "kicaur00@gmail.com" ]
kicaur00@gmail.com
94c013f39fea921e86b7a5e94b64973603d47b4e
b902e6d67647dfe18bd98eae22b464a98664b114
/app/src/main/java/com/example/thiqah/testretrofit/data/source/local/UsersDbHelper.java
f2e941948d01f8b2c4d53c87a2e71a228f1ca7d0
[]
no_license
iFahad94/TestRetrofit
93944e32238ff157ed8a4b8a8ef107ba7cdef769
f638b153a9c1cc217de80f6f4e94be45a53be574
refs/heads/master
2021-07-09T16:44:50.934394
2017-10-11T11:51:54
2017-10-11T11:51:54
104,865,587
0
0
null
null
null
null
UTF-8
Java
false
false
1,418
java
package com.example.thiqah.testretrofit.data.source.local; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; public class UsersDbHelper extends SQLiteOpenHelper { public static final int DATABASE_VERSION = 1; public static final String DATABASE_NAME = "Tasks.db"; private static final String TEXT_TYPE = " TEXT"; private static final String INTEGER = " INTEGER"; private static final String COMMA_SEP = ","; private static final String SQL_CREATE_ENTRIES = "CREATE TABLE " + UsersPresistenceContract.UserEntry.TABLE_NAME + " (" + UsersPresistenceContract.UserEntry.COLUMN__ID + INTEGER + " PRIMARY KEY," + UsersPresistenceContract.UserEntry.COLUMN_NAME_TITLE + TEXT_TYPE + COMMA_SEP + UsersPresistenceContract.UserEntry.COLUMN_USER_ID + INTEGER + " )"; public UsersDbHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } public void onCreate(SQLiteDatabase db) { db.execSQL(SQL_CREATE_ENTRIES); } public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // Not required as at version 1 } public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) { // Not required as at version 1 } }
[ "fahad.at94@gmail.com" ]
fahad.at94@gmail.com
1cf237fd0e3800e628355d51b20cafbfd5690be9
861da57ae61279a8f153916710f8fcdaf4598251
/src/test/java/io/pello/java/homework/platform/controllers/HomeworkControllerTest.java
ad0e19abbb60a8eb1c0b43016e7d05b64777e29f
[]
no_license
pxai/java-homework-platform
8eaba2a73addfed4276541f8f5b7b331f7dff6f2
db197aba6ffd20a8d182533d150873ec1725d1f9
refs/heads/master
2021-09-04T19:45:45.227248
2018-01-21T20:36:09
2018-01-21T20:36:09
112,468,339
0
0
null
null
null
null
UTF-8
Java
false
false
2,569
java
package io.pello.java.homework.platform.controllers; import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.ui.Model; import io.pello.java.homework.platform.domain.Homework; import io.pello.java.homework.platform.domain.Message; import io.pello.java.homework.platform.services.HomeworkService; import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view; import java.util.ArrayList; import java.util.List; public class HomeworkControllerTest { @Mock HomeworkService homeworkService; @Mock Model model; HomeworkController controller; List<Homework> homeworks; @Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); homeworks = new ArrayList<Homework>(); controller = new HomeworkController(homeworkService); } @Test public void shouldReturnIndex() throws Exception { MockMvc mockMvc = MockMvcBuilders.standaloneSetup(controller).build(); mockMvc.perform(get("/homeworks")) .andExpect(status().isOk()) .andExpect(view().name("homeworks/homeworks")); } @Test public void listShouldCallGetHomework() throws Exception { String viewName = controller.list(model); assertEquals("homeworks/homeworks", viewName); verify(homeworkService, times(1)).getHomeworks(); verify(model, times(1)).addAttribute(eq("homeworks"), anyList()); } @Test public void listShouldReturnListOfHomework () throws Exception { // given initList(); when(homeworkService.getHomeworks()).thenReturn(homeworks); ArgumentCaptor<List<Message>> argumentCaptor = ArgumentCaptor.forClass(List.class); // when String viewName = controller.list(model); // then List<Message> listInController = argumentCaptor.getValue(); System.out.println(listInController); assertEquals(3, listInController.size()); } private void initList() { homeworks.add(new Homework()); homeworks.add(new Homework()); homeworks.add(new Homework()); } }
[ "pello_altadill@cuatrovientos.org" ]
pello_altadill@cuatrovientos.org
b55d09fbf19eebe4d44e28bf6b2637a270bb2578
371c01e0bee814bbdc0e843e6491988958e705a4
/ElectricityBill/src/com/wipro/eb/service/ConnectionService.java
3052a01206b5680236fc7bf51db866510b26e453
[]
no_license
180040133-HimaSindhuja/180040133_WTN_TM01
4f36de26b1377489e503a414cf09bb628420e900
11b80b57bb852d52355389c4876a47a71a7e883f
refs/heads/master
2023-05-13T14:08:28.695237
2021-06-11T06:18:40
2021-06-11T06:18:40
375,913,063
0
0
null
null
null
null
UTF-8
Java
false
false
1,434
java
package com.wipro.eb.service; import com.wipro.eb.entity.*; import com.wipro.eb.exception.*; public class ConnectionService { public boolean validate(int currentReading,int previousReading,String type) throws Exception { boolean result=true; if((currentReading < previousReading) || currentReading<0 || previousReading<0) { result=false; throw new InvalidReadingException(); } if(!((type.equalsIgnoreCase("Domestic"))||(type.equalsIgnoreCase("Commercial")))) { result=false; throw new InvalidConnectionException(); } return result; } public float calculateBillAmt(int cr,int pr,String type) throws Exception { float result=0; try { if(this.validate(cr, pr, type)) { Connection c; if(type.equalsIgnoreCase("Commercial")) { c=new Commercial(cr,pr); } else { c=new Domestic(cr,pr); } result=c.computeBill(); } } catch(InvalidReadingException ire) { result=-1; } catch(InvalidConnectionException ice) { result=-2; } return result; } public String generateBill(int cr,int pr,String type)throws Exception { float result =this.calculateBillAmt(cr, pr, type); if(result==-1) { return ("Invalid reading"); } else if(result==-1) { return ("Invalid Connection type"); } return (String.format("Amount to be paid:%.2f",result)); } }
[ "User@DESKTOP-4CR36CC" ]
User@DESKTOP-4CR36CC
7306b1cd4efbd86fc4c19acd2e575717e07c966b
a583fd3b352ca84c6bf28fce4730133466fac6cb
/Main app/src/androidTest/java/com/example/david/easycheckmeasureapp/ApplicationTest.java
7c1d7f235bc60ee9661ee9a3439e612e0e145e6f
[]
no_license
d7knight/Easy-Check-Measure-App
1bc49e07fc60508335fb3e05e97d6b0d4ca880bc
2bb6651033d9dd0898e54bd41e6a8a7d6e30e58f
refs/heads/master
2021-01-01T05:37:09.433576
2016-02-24T17:31:01
2016-02-24T17:31:01
35,388,127
0
0
null
null
null
null
UTF-8
Java
false
false
368
java
package com.example.david.easycheckmeasureapp; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
[ "d7knight@uwaterloo.ca" ]
d7knight@uwaterloo.ca
74cafe5fe30ad87cb9af118efea3faab689063e1
9f02f758d061ee7e2020395e1c59d617445229bc
/src/main/java/testDesignPattern/designRookie/Facade/ShapeFacade.java
476d2a3af76e113f7d96481405d3c5fa2c403386
[]
no_license
windlikelyc/LycAlgo
d9f538a999ee22b6f08f84d9ef11158bf5b60e21
a1a03a7342b2261408d11d799fef7cd289a12ee1
refs/heads/master
2021-01-21T12:31:35.505548
2018-06-21T08:56:59
2018-06-21T08:56:59
102,080,492
0
0
null
null
null
null
UTF-8
Java
false
false
432
java
package testDesignPattern.designRookie.Facade; public class ShapeFacade { private Shape circle; private Shape rectangel; private Shape square; public ShapeFacade(){ circle = new Circle(); rectangel = new Rectangle(); square = new Square(); } public void drawCircel(){ circle.draw(); } public void drawRectangle(){ rectangel.draw(); } public void drawSquare(){ square.draw(); } }
[ "liuyaochen@hsgene.com" ]
liuyaochen@hsgene.com
12b5ed52410978e0f16f841dd5fb9efb8518d373
2e18ac33fbd63f0618e266ee23969d84b72cee8e
/Lec16_OOP/src/com/lec/java/oop05/Interface01Main.java
ea35225c499198deb152c95f1dfb6e41390c01d5
[]
no_license
1029hera/Lec
31bc81933ecc4d096d748bb6d29511d96fb429c6
acedf50d78a853240ed007544ec017da519ae61e
refs/heads/main
2023-07-29T09:19:57.024928
2021-09-07T23:24:53
2021-09-07T23:24:53
404,147,329
0
0
null
null
null
null
UTF-8
Java
false
false
2,154
java
package com.lec.java.oop05; /* 인터페이스(interface): 1. 모든 메소드가 public abstract으로 선언되고, 2. 모든 멤버 변수가 public static final로 선언된 특별한 종류의 추상 클래스 인터페이스는 interface라고 선언 인터페이스를 구현(상속)하는 클래스에서는 implements 키워드를 사용 인터페이스를 구현(상속)할 때는 개수 제한이 없다. (다중상속) 메소드 선언에서 public abstract는 생략 가능 멤버 변수 선언에서 public static final은 생략 가능 */ public class Interface01Main { public static void main(String[] args) { System.out.println("인터페이스(interface)"); TestImpl test1 = new TestImpl(); test1.testAAA(); test1.testBBB(); TestImpl2 test2 = new TestImpl2(); //test2.MIN ?? //System.out.println(test2.MIN); // ambihuous 에러 System.out.println(TestInterface.MIN); System.out.println(TestInterface2.MIN); System.out.println("\n 프로그램 종료"); } // end main() } // end class interface TestInterface { public static final int MIN = 0; int MAX = 100; // 생략해도 public static final public static final String JAVA_STRING = "JAVA"; String CSHARP_STRING = "C#"; // 모든 메소드는 public abstract public abstract void testAAA(); void testBBB(); // 생략해도 public abstract } interface TestInterface2 { public static final int MIN = 1; public abstract void testAAA(); public abstract int testCCC(); } class TestImpl implements TestInterface { @Override public void testAAA() { System.out.println("AAA"); } @Override public void testBBB() { System.out.println("BBB"); } } // 다중 상속 class TestImpl2 implements TestInterface, TestInterface2{ @Override public int testCCC() { System.out.println("CCC"); return 0; } @Override public void testAAA() { System.out.println("AAA"); } @Override public void testBBB() { System.out.println("BBB"); } }
[ "noreply@github.com" ]
noreply@github.com
af90228cb38c1e2ae0b9749020ab34f89c8d39b0
89cc396de12ce4af271c23df78a0943d244500af
/src/main/java/io/github/vdubois/tracker/domain/User.java
25cd5de16599ae4c943add182df8e387c8e31217
[]
no_license
vdubois/tracker
ddc7a57f2a00f988e2c9d09e37201a4488aeee39
29a0c9dc02bd94940415fb0b6b0a082de60bb6ee
refs/heads/master
2021-07-05T17:54:05.867415
2015-12-15T16:54:17
2015-12-15T16:54:17
38,212,613
0
1
null
2020-09-18T14:07:13
2015-06-28T20:12:01
Java
UTF-8
Java
false
false
5,426
java
package io.github.vdubois.tracker.domain; import com.fasterxml.jackson.annotation.JsonIgnore; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import org.hibernate.annotations.Type; import org.hibernate.validator.constraints.Email; import org.joda.time.DateTime; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; import javax.persistence.ManyToMany; import javax.persistence.Table; import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; import java.io.Serializable; import java.util.HashSet; import java.util.Set; /** * A user. */ @Entity @Table(name = "JHI_USER") @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) public class User extends AbstractAuditingEntity implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @NotNull @Pattern(regexp = "^[a-z0-9]*$") @Size(min = 1, max = 50) @Column(length = 50, unique = true, nullable = false) private String login; @JsonIgnore @NotNull @Size(min = 60, max = 60) @Column(length = 60) private String password; @Size(max = 50) @Column(name = "first_name", length = 50) private String firstName; @Size(max = 50) @Column(name = "last_name", length = 50) private String lastName; @Email @Size(max = 100) @Column(length = 100, unique = true) private String email; @Column(nullable = false) private boolean activated = false; @Size(min = 2, max = 5) @Column(name = "lang_key", length = 5) private String langKey; @Size(max = 20) @Column(name = "activation_key", length = 20) @JsonIgnore private String activationKey; @Size(max = 20) @Column(name = "reset_key", length = 20) private String resetKey; @Type(type = "org.jadira.usertype.dateandtime.joda.PersistentDateTime") @Column(name = "reset_date", nullable = true) private DateTime resetDate = null; @JsonIgnore @ManyToMany @JoinTable( name = "JHI_USER_AUTHORITY", joinColumns = {@JoinColumn(name = "user_id", referencedColumnName = "id")}, inverseJoinColumns = {@JoinColumn(name = "authority_name", referencedColumnName = "name")}) @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) private Set<Authority> authorities = new HashSet<>(); public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getLogin() { return login; } public void setLogin(String login) { this.login = login; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public boolean getActivated() { return activated; } public void setActivated(boolean activated) { this.activated = activated; } public String getActivationKey() { return activationKey; } public void setActivationKey(String activationKey) { this.activationKey = activationKey; } public String getResetKey() { return resetKey; } public void setResetKey(String resetKey) { this.resetKey = resetKey; } public DateTime getResetDate() { return resetDate; } public void setResetDate(DateTime resetDate) { this.resetDate = resetDate; } public String getLangKey() { return langKey; } public void setLangKey(String langKey) { this.langKey = langKey; } public Set<Authority> getAuthorities() { return authorities; } public void setAuthorities(Set<Authority> authorities) { this.authorities = authorities; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } User user = (User) o; if (!login.equals(user.login)) { return false; } return true; } @Override public int hashCode() { return login.hashCode(); } @Override public String toString() { return "User{" + "login='" + login + '\'' + ", password='" + password + '\'' + ", firstName='" + firstName + '\'' + ", lastName='" + lastName + '\'' + ", email='" + email + '\'' + ", activated='" + activated + '\'' + ", langKey='" + langKey + '\'' + ", activationKey='" + activationKey + '\'' + "}"; } }
[ "dubois.vct@free.fr" ]
dubois.vct@free.fr
d26a37ef628d05a03b91dcbec20a3c1febb7fc2a
ef7b7ebd6470c0857a5ee7af4f1416fba54866e3
/choco-cp/src/main/java/choco/cp/solver/constraints/real/exp/RealPlus.java
ae30ed20f9c8e4cde8a600390a089eee7ca5efa0
[]
no_license
JLiangWaterloo/choco2
4ba197bb0ad13c419d0fe2344be7dc3e05b6b528
b6cbd88f942b2090b6860c6fe82c186c2b1b436d
refs/heads/master
2020-05-31T21:12:24.875908
2013-03-17T16:38:08
2013-03-17T16:38:08
8,834,140
0
3
null
null
null
null
UTF-8
Java
false
false
3,190
java
/** * Copyright (c) 1999-2010, Ecole des Mines de Nantes * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Ecole des Mines de Nantes nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package choco.cp.solver.constraints.real.exp; import choco.kernel.solver.ContradictionException; import choco.kernel.solver.Solver; import choco.kernel.solver.constraints.real.RealExp; import choco.kernel.solver.constraints.real.exp.AbstractRealBinTerm; import choco.kernel.solver.variables.real.RealInterval; import choco.kernel.solver.variables.real.RealMath; /** * An expression modelling a real addition. */ public final class RealPlus extends AbstractRealBinTerm { /** * Builds an addition expression for real constraint modelling. * @param solver is the current model * @param exp1 is the first expression operand * @param exp2 is the second expression operand */ public RealPlus(final Solver solver, final RealExp exp1, final RealExp exp2) { super(solver, exp1, exp2); } public String pretty() { return "("+exp1.pretty() + " + " + exp2.pretty()+")"; } /** * Tightens the expression to find the smallest interval containing values * the expression can equal according to operand domains. */ public void tighten() { RealInterval res = RealMath.add(exp1, exp2); inf.set(res.getInf()); sup.set(res.getSup()); } /** * Projects domain reduction on operands according to the expression * domain itself (due to constraint restrictions). * @throws choco.kernel.solver.ContradictionException if a domain becomes empty */ public void project() throws ContradictionException { exp1.intersect(RealMath.sub(this, exp2)); exp2.intersect(RealMath.sub(this, exp1)); } }
[ "paradoxical.reasoning@gmail.com" ]
paradoxical.reasoning@gmail.com
0c19c8327731eb7aec64f4ced25e9997fe919510
662f5ff38a46f98ee4ed02cb400309a264e2db82
/src/application/views/ComputerMenuControler.java
14ddbcd60ed240855e484e189514b867df32252d
[]
no_license
Izydorek/tictactoe
6c8bcb7c925c67b289732732c15d410213f41b7e
4f3ee7c44afd618773844bbf0b65d7df2e1a5668
refs/heads/master
2021-01-10T01:02:33.652819
2015-04-23T13:06:57
2015-04-23T13:06:57
31,661,586
0
0
null
null
null
null
UTF-8
Java
false
false
398
java
package application.views; import javafx.fxml.FXML; import javafx.scene.control.TextField; import javafx.scene.control.Toggle; public class ComputerMenuControler { @FXML private TextField name; // @FXML // private ToggleGroup @FXML private Toggle toggle1; @FXML private Toggle toggle2; @FXML private Toggle toggle3; @FXML private Toggle toggle4; }
[ "izydor.sporna@gmail.com" ]
izydor.sporna@gmail.com
7d435264cbdb5dce6efa189cf84f28396ec39773
169120d6972c7ae7f67cf4eb53aafe0120aa68b5
/src/test/java/com/tlw/ml/math3/MatrixLearn.java
398a2eccbd2352b3daec19a0b4352d9d648ccf69
[]
no_license
tlw-ray/bayes-study
cef819d755dae508f04c02e24a1d777661113385
e5fc899d113cadd2d4b9dde94b547d6018dc38dd
refs/heads/master
2021-06-24T14:05:23.807662
2020-11-05T15:41:39
2020-11-05T15:41:39
172,342,020
0
0
null
null
null
null
UTF-8
Java
false
false
1,610
java
package com.tlw.ml.math3; import org.apache.commons.math3.linear.*; import org.junit.Test; public class MatrixLearn { @Test public void testMatrixMulti(){ double[][] b = new double[][]{ {1, 2}, {3, 4}, }; RealMatrix realMatrix = new Array2DRowRealMatrix(b); System.out.println(realMatrix); RealMatrix multiRealMatrix = realMatrix.multiply(realMatrix); System.out.println("矩阵乘: " + multiRealMatrix); System.out.println("矩阵转置: " + realMatrix.transpose()); System.out.println("逆矩阵: " + new LUDecomposition(realMatrix).getSolver().getInverse()); } @Test public void testFunction(){ //矩阵解方程 // https://www.shuxuele.com/algebra/systems-linear-equations-matrices.html double[][] matrix1 = new double[][]{ {1, 1, 1}, {0, 2, 5}, {2, 5, -1} }; double[][] matrix2 = new double[][]{{6}, {-4}, {27}}; RealMatrix realMatrix1 = MatrixUtils.createRealMatrix(matrix1); RealMatrix realMatrix2 = MatrixUtils.createRealMatrix(matrix2); DecompositionSolver solver = new LUDecomposition(realMatrix1).getSolver(); RealMatrix realMatrix3 = solver.getInverse(); RealMatrix realMatrix4 = realMatrix3.multiply(realMatrix2); System.out.println(realMatrix1); System.out.println(realMatrix2); System.out.println(realMatrix3); System.out.println(realMatrix4); System.out.println(realMatrix1.multiply(realMatrix4)); } }
[ "tlw_ray@163.com" ]
tlw_ray@163.com
577eb5016eede6d839845700bdfed24ab9634f8e
fb1e661a1ea9bac41f3ed9890e7946f7bafe47d0
/app/src/main/java/edu/cnm/deepdive/quoteclient/controller/LoginActivity.java
f61de6a9403f473aff4468c6cc607714af10d4c9
[ "Apache-2.0" ]
permissive
ajaramillo76/quote-client-v3
650be1e1dca11e403f7279e1750a57082ddc3eb5
e87d7c4cd0cbbc55c4b54bff9386a61edcd314c5
refs/heads/master
2021-05-17T02:16:52.159209
2020-03-27T20:51:14
2020-03-27T20:51:14
250,571,974
0
0
Apache-2.0
2020-03-27T15:32:18
2020-03-27T15:32:17
null
UTF-8
Java
false
false
1,635
java
package edu.cnm.deepdive.quoteclient.controller; import android.content.Intent; import android.widget.Toast; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import edu.cnm.deepdive.quoteclient.R; import edu.cnm.deepdive.quoteclient.service.GoogleSignInService; public class LoginActivity extends AppCompatActivity { private static final int LOGIN_REQUEST_CODE = 1000; private GoogleSignInService repository; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); repository = GoogleSignInService.getInstance(); repository.refresh() .addOnSuccessListener((account) -> switchToMain()) .addOnFailureListener((ex) -> { setContentView(R.layout.activity_login); findViewById(R.id.sign_in).setOnClickListener((v) -> repository.startSignIn(this, LOGIN_REQUEST_CODE)); }); } @Override protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { if (requestCode == LOGIN_REQUEST_CODE) { repository.completeSignIn(data) .addOnSuccessListener((account) -> switchToMain()) .addOnFailureListener((ex) -> Toast.makeText(this, R.string.login_failure, Toast.LENGTH_LONG).show()); } else { super.onActivityResult(requestCode, resultCode, data); } } private void switchToMain() { Intent intent = new Intent(this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } }
[ "nick@nickbenn.com" ]
nick@nickbenn.com
0de2e453b44a4f44e58a95b2c9fb4e905e1df543
b245f9651d761897e5fc60c8353ba71af87f15f0
/src/main/java/swd/harjoitustyo1/ElokuvaListaus/domain/SignupForm.java
692a09c4cd3e7074a2d60ca141d75b55c7bb2a1d
[]
no_license
jholma/elokuvalistaus
cf782cf7b0282ef2abd027bd430e815756752004
27692b0248cf0b7f38bdf1e07487151a99f9bb66
refs/heads/master
2020-03-07T01:26:52.918725
2018-03-28T18:47:22
2018-03-28T18:47:22
127,184,052
0
0
null
null
null
null
UTF-8
Java
false
false
986
java
package swd.harjoitustyo1.ElokuvaListaus.domain; import javax.validation.constraints.Size; import org.hibernate.validator.constraints.NotEmpty; public class SignupForm { @NotEmpty @Size(min = 5, max = 30) private String username = ""; @NotEmpty @Size(min = 7, max = 30) private String password = ""; @NotEmpty @Size(min = 7, max = 30) private String email = ""; @NotEmpty @Size(min = 7, max = 30) private String passwordCheck = ""; public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getPasswordCheck() { return passwordCheck; } public void setPasswordCheck(String passwordCheck) { this.passwordCheck = passwordCheck; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } }
[ "janne.holma@myy.haaga-helia.fi" ]
janne.holma@myy.haaga-helia.fi
e7ca92831bd97f114166ecf2e1365206e1e9a0e4
c9fbffcb69c455e9bbd4ed3ceb9f6ddb4855f124
/src/TEACHER/TEACHERController.java
1f219f6ce8c34e6d653abbc793c448062e354587
[]
no_license
Sohail2915/School-Management-System
1ce6b7431b1077da43b3ffb6c229c54dba7474a5
41d565255a4d01532aeaa9e081bf3418458e9968
refs/heads/master
2020-09-20T20:32:57.099978
2019-11-28T06:31:53
2019-11-28T06:31:53
224,584,368
0
0
null
null
null
null
UTF-8
Java
false
false
16,200
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 TEACHER; import ass.FXMLloginController; import ass.SqlConection; import com.jfoenix.controls.JFXButton; import com.jfoenix.controls.JFXTextField; import static com.sun.javafx.tk.Toolkit.getToolkit; import java.awt.Graphics; import java.awt.HeadlessException; import java.awt.PrintJob; import java.awt.Toolkit; import java.io.IOException; import java.net.URL; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ResourceBundle; import java.util.logging.Level; import java.util.logging.Logger; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.DatePicker; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.input.KeyEvent; import javafx.scene.input.MouseEvent; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.Pane; import javafx.stage.Stage; import javax.swing.JOptionPane; import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JasperCompileManager; import net.sf.jasperreports.engine.JasperFillManager; import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.engine.JasperReport; import net.sf.jasperreports.view.JasperViewer; /** * FXML Controller class * * @author kamran qadeer */ public class TEACHERController implements Initializable { Connection con=null; ResultSet rs=null; PreparedStatement pst=null; private ObservableList<TableList>data; @FXML private JFXTextField Name; @FXML private JFXTextField FathNam; @FXML private JFXTextField ID; @FXML private JFXTextField Email; @FXML private DatePicker DatePick; @FXML private JFXButton ButtClear; @FXML private JFXButton ButAdd; @FXML private JFXButton ButtUpdate; @FXML private JFXTextField SearchFiled; @FXML private TableColumn<TableList,String> C3ID; @FXML private TableColumn<TableList,String> C1Nmae; @FXML private TableColumn<TableList,String> C2FathName; @FXML private TableColumn<TableList,String> C6DateOfBirth; @FXML private TableColumn<TableList,String> C4Email; @FXML private JFXTextField EduFile; @FXML private JFXTextField ExperFiled; @FXML private JFXTextField ConFiled; @FXML private JFXTextField SubAssFiled; @FXML private JFXTextField WeekLec; @FXML private TableColumn<TableList,String> C8edu; @FXML private TableColumn<TableList,String> C9expe; @FXML private TableColumn<TableList,String> C10subAss; @FXML private TableColumn<TableList,String> C7CWeekLec; @FXML private TableColumn<TableList,String> C5ConNum; @FXML private TableView<TableList> teachertable; @FXML private JFXButton PRINT; @FXML private Pane PrintPan; /** * Initializes the controller class. * @param url * @param rb */ @Override public void initialize(URL url, ResourceBundle rb) { con=SqlConection.ConnectDB(); data=FXCollections.observableArrayList(); setTable(); loadData(); SelectCell(); clearTextfiled(); search(); } private void SelectCell() { teachertable.setOnMouseClicked((MouseEvent event) -> { TEACHER.TableList t=teachertable.getItems().get(teachertable.getSelectionModel().getSelectedIndex()); Name.setText(t.getName()); FathNam.setText(t.getFname()); ID.setText(t.getId()); ExperFiled.setText(t.getExp()); Email.setText(t.getEmail()); ConFiled.setText(t.getCont()); EduFile.setText(t.getEdu()); WeekLec.setText(t.getTotalclass()); SubAssFiled.setText(t.getSubjAss()); }); } private void setTable() { C1Nmae.setCellValueFactory(new PropertyValueFactory<>("name")); C2FathName.setCellValueFactory(new PropertyValueFactory<>("fname")); C3ID.setCellValueFactory(new PropertyValueFactory<>("id")); C7CWeekLec.setCellValueFactory(new PropertyValueFactory<>("totalclass")); C4Email.setCellValueFactory(new PropertyValueFactory<>("email")); C5ConNum.setCellValueFactory(new PropertyValueFactory<>("cont")); C6DateOfBirth.setCellValueFactory(new PropertyValueFactory<>("dbd")); C10subAss.setCellValueFactory(new PropertyValueFactory<>("subjAss")); C8edu.setCellValueFactory(new PropertyValueFactory<>("edu")); C9expe.setCellValueFactory(new PropertyValueFactory<>("exp")); } private void loadData() { data.clear(); try { pst=con.prepareStatement("Select * from teacher"); rs=pst.executeQuery(); while(rs.next()) { String name = rs.getString("name"); String fname = rs.getString("fname"); String id = rs.getString("id"); String dbd = rs.getString("dbd"); String totalclass = rs.getString("totalclass"); String cont = rs.getString("cont"); String email = rs.getString("email"); String subjass = rs.getString("subjass"); String edu = rs.getString("edu"); String exp = rs.getString("exp"); data.add(new TableList(name,fname,id,totalclass,email,cont,dbd,subjass,edu,exp)); } } catch (SQLException ex) { Logger.getLogger(TEACHERController.class.getName()).log(Level.SEVERE, null, ex); } teachertable.setItems(data); } @FXML private void ButtClearAcc(ActionEvent event) { Name.clear(); FathNam.clear(); ID.clear(); Email.clear(); EduFile.clear(); ConFiled.clear(); SubAssFiled.clear(); WeekLec.clear(); ExperFiled.clear(); ConFiled.clear(); SearchFiled.clear(); DatePick.getEditor().clear(); } private void clearTextfiled() { ExperFiled.clear(); Name.clear(); FathNam.clear(); ID.clear(); Email.clear(); EduFile.clear(); ConFiled.clear(); SubAssFiled.clear(); WeekLec.clear(); ConFiled.clear(); SearchFiled.clear(); DatePick.getEditor().clear(); } private void search() { SearchFiled.setOnKeyReleased(e->{ if(SearchFiled.getText().equals("")) { loadData(); } else{ data.clear(); String sql="Select * from teacher where id like '%" + SearchFiled.getText() + "%'" +"UNION Select * from teacher where name like '%" + SearchFiled.getText() + "%'" +"UNION Select * from teacher where fname like '%" + SearchFiled.getText() + "%'" +"UNION Select * from teacher where totalclass like '%" + SearchFiled.getText() + "%'" +"UNION Select * from teacher where email like '%" + SearchFiled.getText() + "%'" +"UNION Select * from teacher where cont like '%" + SearchFiled.getText() + "%'" +"UNION Select * from teacher where subjass like '%" + SearchFiled.getText() + "%'" +"UNION Select * from teacher where exp like '%" + SearchFiled.getText() + "%'" +"UNION Select * from teacher where edu like '%" + SearchFiled.getText() + "%'" +"UNION Select * from teacher where dbd like '%" + SearchFiled.getText() + "%'"; try { pst=con.prepareStatement(sql); rs=pst.executeQuery(); while(rs.next()) { String name = rs.getString("name"); String fname = rs.getString("fname"); String id = rs.getString("id"); String dbd = rs.getString("dbd"); String totalclass = rs.getString("totalclass"); String cont = rs.getString("cont"); String email = rs.getString("email"); String subjass = rs.getString("subjass"); String edu = rs.getString("edu"); String exp = rs.getString("exp"); data.add(new TableList(name,fname,id,totalclass,email,cont,dbd,subjass,edu,exp)); } teachertable.setItems(data); } catch (SQLException ex) { Logger.getLogger(TEACHERController.class.getName()).log(Level.SEVERE, null, ex); } } }); } @FXML private void ButAddAcc(ActionEvent event) { String d=DatePick.getEditor().getText(); try{ con= SqlConection.ConnectDB(); if (Name.getText().equals("")) { JOptionPane.showMessageDialog( null, "Please enter name","Error", JOptionPane.ERROR_MESSAGE); return; } if (ID.getText().equals("")) { JOptionPane.showMessageDialog( null, "Please enter id","Error", JOptionPane.ERROR_MESSAGE); return; } if (EduFile.getText().equals("")) { JOptionPane.showMessageDialog( null, "Please enter EDUCATION","Error", JOptionPane.ERROR_MESSAGE); return; } if (ExperFiled.getText().equals("")) { JOptionPane.showMessageDialog( null, "Please enter EXPERIANCE number","Error", JOptionPane.ERROR_MESSAGE); return; } if (ConFiled.getText().equals("")) { JOptionPane.showMessageDialog( null, "Please enter contect number","Error", JOptionPane.ERROR_MESSAGE); return; } Statement stmt; stmt= con.createStatement(); String sql1="Select id from teacher where id= '" + ID.getText() + "'"; rs=stmt.executeQuery(sql1); if(rs.next()){ JOptionPane.showMessageDialog( null, "TEACHER id already exists","Error", JOptionPane.ERROR_MESSAGE); ID.setText(""); return; } String sql= "insert into teacher(name,fname,id,totalclass,email,cont,dbd,subjass,edu,exp)values('"+ Name.getText() + "','"+ FathNam.getText() + "','"+ ID.getText() + "','"+ WeekLec.getText() + "','"+ Email.getText() + "','"+ ConFiled.getText() + "','"+ d+ "','"+ SubAssFiled.getText()+ "','"+ EduFile.getText()+ "','"+ ExperFiled.getText()+"')"; pst=con.prepareStatement(sql); pst.execute(); pst.close(); JOptionPane.showMessageDialog(null,"Successfully add","STUDENT",JOptionPane.INFORMATION_MESSAGE); setTable(); loadData(); }catch(HeadlessException | SQLException ex){ JOptionPane.showMessageDialog(null,ex); } } @FXML private void ButtUpdateAcc(ActionEvent event) { String d=DatePick.getEditor().getText(); try { if (Name.getText().equals("")) { JOptionPane.showMessageDialog( null, "Please enter name","Error", JOptionPane.ERROR_MESSAGE); return; } if (ID.getText().equals("")) { JOptionPane.showMessageDialog( null, "Please enter id","Error", JOptionPane.ERROR_MESSAGE); return; } if (EduFile.getText().equals("")) { JOptionPane.showMessageDialog( null, "Please enter EDUCATION","Error", JOptionPane.ERROR_MESSAGE); return; } if (ExperFiled.getText().equals("")) { JOptionPane.showMessageDialog( null, "Please enter EXPERIANCE number","Error", JOptionPane.ERROR_MESSAGE); return; } if (ConFiled.getText().equals("")) { JOptionPane.showMessageDialog( null, "Please enter contect number","Error", JOptionPane.ERROR_MESSAGE); return; } else { con=SqlConection.ConnectDB(); String sql= "update teacher set name='"+ Name.getText() + "',fname='"+ FathNam.getText() + "',dbd='"+ DatePick.getEditor().getText() + "',totalclass='"+ WeekLec.getText() + "',email='"+ Email.getText() + "',cont='"+ ConFiled.getText()+ "',edu='"+ EduFile.getText() + "',exp='"+ ExperFiled.getText() + "',subjass='"+ SubAssFiled.getText() + "' where id='"+ ID.getText()+"'"; pst=con.prepareStatement(sql); int i=0; pst.executeUpdate(); loadData(); clearTextfiled(); JOptionPane.showMessageDialog(null,"Successfully updated","Record",JOptionPane.INFORMATION_MESSAGE); } } catch(HeadlessException | SQLException ex) { JOptionPane.showMessageDialog(null,ex); } } @FXML private void StudInformation(ActionEvent event) { try { Stage mainStage = new Stage(); Parent root = FXMLLoader.load(getClass().getResource("/STUDENT/StudentDetail.fxml")); Scene scene = new Scene(root); mainStage.setScene(scene); // ASS.loginstage.close(); mainStage.show(); mainStage.setResizable(true); mainStage.setTitle("STUDENT DETAIL"); } catch (IOException ex) { Logger.getLogger(FXMLloginController.class.getName()).log(Level.SEVERE, null, ex); } } @FXML private void StudentDelete(ActionEvent event) { TEACHER.TableList selectedForDeletion = teachertable.getSelectionModel().getSelectedItem(); String sq= "delete from teacher where id = ?"; try { if (ID.getText().equals("")) { JOptionPane.showMessageDialog( null, "Please SELECT THE ROW","Error", JOptionPane.ERROR_MESSAGE); return; } else { pst=con.prepareStatement(sq); pst.setString(1, ID.getText()); int i=pst.executeUpdate(); if(i==1) { JOptionPane.showMessageDialog(null,"Successfully DELETE","TEACHER",JOptionPane.INFORMATION_MESSAGE); loadData(); clearTextfiled(); } } } catch (SQLException ex) { Logger.getLogger(TEACHERController.class.getName()).log(Level.SEVERE, null, ex); } } @FXML private void printAcc(ActionEvent event) { try{ String report="C:\\Users\\kamran qadeer\\Documents\\NetBeansProjects\\unit1\\ASS\\src\\report\\Teacher.jrxml"; JasperReport js=JasperCompileManager.compileReport(report); JasperPrint jp=JasperFillManager.fillReport(js,null,con); JasperViewer.viewReport(jp); } catch(JRException e) { JOptionPane.showMessageDialog( null,e); } } }
[ "sohailasgharch315@gmail.com" ]
sohailasgharch315@gmail.com
2aa1820abf30924208f1080bf754a8b166b6c2d0
5db803e1ccbc172a98df596c916d024c3c71b239
/loja/src/test/java/loja/TesteServicoCliente.java
f6ee66043246f37d24dc25cfe760abdfa43819f8
[]
no_license
caiofb47/arqs
2b658231ae984b157bd3b858533b4f597c59985b
0b4dc755c5e68a38f1041d853ab6ce9d2ba1acaa
refs/heads/master
2020-03-10T09:51:49.826334
2018-06-29T00:56:04
2018-06-29T00:56:04
129,320,325
0
0
null
null
null
null
ISO-8859-1
Java
false
false
4,011
java
package loja; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import java.util.Date; import java.util.logging.Logger; import javax.inject.Inject; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.MethodSorters; import br.unibh.loja.entidades.Categoria; import br.unibh.loja.entidades.Cliente; import br.unibh.loja.entidades.Produto; import br.unibh.loja.negocio.DAO; import br.unibh.loja.negocio.ServicoCategoria; import br.unibh.loja.negocio.ServicoCliente; import br.unibh.loja.negocio.ServicoProduto; import br.unibh.loja.util.Resources; @RunWith(Arquillian.class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TesteServicoCliente { @Deployment public static Archive<?> createTestArchive() { // Cria o pacote que vai ser instalado no Wildfly para realizacao dos testes return ShrinkWrap.create(WebArchive.class, "testeseguro.war") .addClasses(Categoria.class, Cliente.class, Produto.class, Resources.class, DAO.class, ServicoCategoria.class, ServicoCliente.class, ServicoProduto.class) .addAsResource("META-INF/persistence.xml", "META-INF/persistence.xml") .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); } // Realiza as injecoes com CDI @Inject private Logger log; @Inject private ServicoCliente ss; @Test public void teste01_inserirSemErro() throws Exception { log.info("============> Iniciando o teste " + Thread.currentThread().getStackTrace()[1].getMethodName()); Cliente o = new Cliente(1L, "Caio", "caiologin", "123abc", "Batatas", "99999999999", "(31)33829019", "caiofb47@gmail.com", new Date(), new Date()); ss.insert(o); Cliente aux = (Cliente) ss.findByName("Caio").get(0); assertNotNull(aux); log.info("============> Finalizando o teste " + Thread.currentThread().getStackTrace()[1].getMethodName()); } @Test public void teste02_inserirComErro() throws Exception { log.info("============> Iniciando o teste " + Thread.currentThread().getStackTrace()[1].getMethodName()); try { Cliente o = new Cliente(1L, "C@io", "caiologin", "123abc", "Batátas", "99999999999", "(31)33829019", "caiofb47@gmail.com", new Date(), new Date()); ss.insert(o); } catch (Exception e){ assertTrue(checkString(e, "Caracteres permitidos: letras, espaços, ponto e aspas simples")); } log.info("============> Finalizando o teste " + Thread.currentThread().getStackTrace()[1].getMethodName()); } @Test public void teste03_atualizar() throws Exception { log.info("============> Iniciando o teste " + Thread.currentThread().getStackTrace()[1].getMethodName()); Cliente o = (Cliente) ss.findByName("Caio").get(0); o.setNome("Caio Fabio"); ss.update(o); Cliente aux = (Cliente) ss.findByName("Caio Fabio").get(0); assertNotNull(aux); log.info("============> Finalizando o teste " + Thread.currentThread().getStackTrace()[1].getMethodName()); } @Test public void teste04_excluir() throws Exception { log.info("============> Iniciando o teste " + Thread.currentThread().getStackTrace()[1].getMethodName()); Cliente o = (Cliente) ss.findByName("Caio Fabio").get(0); ss.delete(o); assertEquals(0, ss.findByName("Caio Fabio").size()); log.info("============> Finalizando o teste " + Thread.currentThread().getStackTrace()[1].getMethodName()); } private boolean checkString(Throwable e, String str) { if (e.getMessage().contains(str)) { return true; } else if (e.getCause() != null) { return checkString(e.getCause(), str); } return false; } }
[ "noreply@github.com" ]
noreply@github.com
4138eb222a59c1a7793f5f45e896d0260a8adfc9
147bad4bd0e0d43ac42dc7ddd048de6a4ce69f68
/android/src/com/tovalina/platformer/android/AndroidLauncher.java
e7c5fa37466518b0958d6314166705890c3d11d7
[]
no_license
AnaTovalin5/Platformer
e2e128c0d43cd836cbe856f324a5c8e476deee7f
8152eb445b7fcfe073c5b1f19e168d18cde2b0eb
refs/heads/master
2021-01-20T10:09:12.526387
2015-02-20T08:25:49
2015-02-20T08:25:49
26,661,274
0
0
null
null
null
null
UTF-8
Java
false
false
537
java
package com.tovalina.platformer.android; import android.os.Bundle; import com.badlogic.gdx.backends.android.AndroidApplication; import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration; import com.tovalina.platformer.Platformer; public class AndroidLauncher extends AndroidApplication { @Override protected void onCreate (Bundle savedInstanceState) { super.onCreate(savedInstanceState); AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); initialize(new Platformer(), config); } }
[ "astrostar98@gmail.com" ]
astrostar98@gmail.com
428d81aa1b12d23fa74a2e6521fd07a6cd9f97d9
c6c5e85e41ff2f2f105616f9bbe55b9ed807fee7
/JavaSource/org/unitime/timetable/model/CourseEvent.java
4595f6250ed517bfded7743112052e617ccfe2d0
[ "BSD-3-Clause", "EPL-1.0", "CC-BY-3.0", "LGPL-3.0-only", "LGPL-2.1-only", "LicenseRef-scancode-freemarker", "LicenseRef-scancode-warranty-disclaimer", "CDDL-1.0", "MIT", "Apache-2.0", "LicenseRef-scancode-public-domain", "LGPL-2.1-or-later", "LicenseRef-scancode-generic-cla", "LicenseRef-s...
permissive
apetro/unitime
60616c21a5caaeb11ec1f839a30aca910ed8f9de
0c8e78fe85b1296de03d4eabe4fbf8c7eb2e8493
refs/heads/master
2023-04-07T06:34:57.713178
2017-06-29T15:46:18
2017-06-29T15:46:18
95,915,875
0
0
Apache-2.0
2023-04-04T00:41:58
2017-06-30T18:57:36
Java
UTF-8
Java
false
false
2,776
java
/* * Licensed to The Apereo Foundation under one or more contributor license * agreements. See the NOTICE file distributed with this work for * additional information regarding copyright ownership. * * The Apereo Foundation licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * limitations under the License. * */ package org.unitime.timetable.model; import java.util.Collection; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import org.unitime.timetable.model.base.BaseCourseEvent; /** * @author Tomas Muller */ public class CourseEvent extends BaseCourseEvent { private static final long serialVersionUID = 1L; /*[CONSTRUCTOR MARKER BEGIN]*/ public CourseEvent () { super(); } /** * Constructor for primary key */ public CourseEvent (java.lang.Long uniqueId) { super(uniqueId); } /*[CONSTRUCTOR MARKER END]*/ public Set<Student> getStudents() { HashSet<Student> students = new HashSet(); if (isReqAttendance()==null || !isReqAttendance().booleanValue()) return students; for (Iterator i=getRelatedCourses().iterator();i.hasNext();) students.addAll(((RelatedCourseInfo)i.next()).getStudents()); return students; } public Set<DepartmentalInstructor> getInstructors() { HashSet<DepartmentalInstructor> instructors = new HashSet(); if (isReqAttendance()==null || !isReqAttendance().booleanValue()) return instructors; for (Iterator i=getRelatedCourses().iterator();i.hasNext();) instructors.addAll(((RelatedCourseInfo)i.next()).getInstructors()); return instructors; } public int getEventType() { return sEventTypeCourse; } public Collection<Long> getStudentIds() { HashSet<Long> studentIds = new HashSet(); for (Iterator i=getRelatedCourses().iterator();i.hasNext();) studentIds.addAll(((RelatedCourseInfo)i.next()).getStudentIds()); return studentIds; } @Override public Collection<StudentClassEnrollment> getStudentClassEnrollments() { HashSet<StudentClassEnrollment> enrollments = new HashSet(); for (RelatedCourseInfo owner: getRelatedCourses()) enrollments.addAll(owner.getStudentClassEnrollments()); return enrollments; } }
[ "muller@unitime.org" ]
muller@unitime.org
bccaee52723000ef25eadb10d016c52997063340
d59791ab0653ee5d789895742e131398d6106c4f
/pet-clinic-data/src/main/java/guru/springframework/sfgpetclinic/model/BaseEntity.java
8df8a872876364ad490fd3eafc3327d62eb8e000
[]
no_license
andry1997/sfg-pet-clinic
58db7df3fb200c9e3938db9433afcfa6011a8509
4fc7f245a36ef81ac9ce1b995b395c684b8668aa
refs/heads/main
2023-02-23T21:18:34.969660
2021-01-26T16:36:28
2021-01-26T16:36:28
329,962,682
0
0
null
2021-01-26T14:33:23
2021-01-15T16:19:05
Java
UTF-8
Java
false
false
765
java
package guru.springframework.sfgpetclinic.model; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.MappedSuperclass; import java.io.Serializable; // Va a definire una sola classe che verrà definita come Entity che poi verrà estesa dalle altre // questa classe specifica non verrà mappata nel DB @MappedSuperclass @Getter @Setter @NoArgsConstructor @AllArgsConstructor public class BaseEntity implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; public boolean isNew(){ return this.id == null; } }
[ "Americanidiot.97" ]
Americanidiot.97
ce1a7c0a2a1e420480399be4a11393cded786397
40ad7f3cbfcc711d0fe40c2becde9b726dd35d86
/query/spark-2.1/q99/java/q99_jobid_4_stageid_5_ResultTask_3_execid_1.java
434becf1be6949822a2a19fa1d0786018568df20
[]
no_license
kmadhugit/spark-tpcds-99-generated-code
f2ed0f40f031b58b6af2396b7248e776706dcc18
8483bdf3d8477e63bce1bb65493d2af5c9207ae7
refs/heads/master
2020-05-30T19:39:55.759974
2017-11-14T09:54:56
2017-11-14T09:54:56
83,679,481
1
1
null
2017-11-14T10:45:07
2017-03-02T13:15:25
Java
UTF-8
Java
false
false
20,778
java
/* 001 */ public Object generate(Object[] references) { /* 002 */ return new GeneratedIterator(references); /* 003 */ } /* 004 */ /* 005 */ final class GeneratedIterator extends org.apache.spark.sql.execution.BufferedRowIterator { /* 006 */ private Object[] references; /* 007 */ private scala.collection.Iterator[] inputs; /* 008 */ private boolean agg_initAgg; /* 009 */ private boolean agg_bufIsNull; /* 010 */ private long agg_bufValue; /* 011 */ private boolean agg_bufIsNull1; /* 012 */ private long agg_bufValue1; /* 013 */ private boolean agg_bufIsNull2; /* 014 */ private long agg_bufValue2; /* 015 */ private boolean agg_bufIsNull3; /* 016 */ private long agg_bufValue3; /* 017 */ private boolean agg_bufIsNull4; /* 018 */ private long agg_bufValue4; /* 019 */ private org.apache.spark.sql.execution.aggregate.HashAggregateExec agg_plan; /* 020 */ private org.apache.spark.sql.execution.UnsafeFixedWidthAggregationMap agg_hashMap; /* 021 */ private org.apache.spark.sql.execution.UnsafeKVExternalSorter agg_sorter; /* 022 */ private org.apache.spark.unsafe.KVIterator agg_mapIter; /* 023 */ private org.apache.spark.sql.execution.metric.SQLMetric agg_peakMemory; /* 024 */ private org.apache.spark.sql.execution.metric.SQLMetric agg_spillSize; /* 025 */ private scala.collection.Iterator inputadapter_input; /* 026 */ private UnsafeRow agg_result; /* 027 */ private org.apache.spark.sql.catalyst.expressions.codegen.BufferHolder agg_holder; /* 028 */ private org.apache.spark.sql.catalyst.expressions.codegen.UnsafeRowWriter agg_rowWriter; /* 029 */ private int agg_value16; /* 030 */ private UnsafeRow agg_result1; /* 031 */ private org.apache.spark.sql.catalyst.expressions.codegen.BufferHolder agg_holder1; /* 032 */ private org.apache.spark.sql.catalyst.expressions.codegen.UnsafeRowWriter agg_rowWriter1; /* 033 */ private org.apache.spark.sql.execution.metric.SQLMetric wholestagecodegen_numOutputRows; /* 034 */ private org.apache.spark.sql.execution.metric.SQLMetric wholestagecodegen_aggTime; /* 035 */ /* 036 */ public GeneratedIterator(Object[] references) { /* 037 */ this.references = references; /* 038 */ } /* 039 */ /* 040 */ public void init(int index, scala.collection.Iterator[] inputs) { /* 041 */ partitionIndex = index; /* 042 */ this.inputs = inputs; /* 043 */ agg_initAgg = false; /* 044 */ /* 045 */ this.agg_plan = (org.apache.spark.sql.execution.aggregate.HashAggregateExec) references[0]; /* 046 */ /* 047 */ this.agg_peakMemory = (org.apache.spark.sql.execution.metric.SQLMetric) references[1]; /* 048 */ this.agg_spillSize = (org.apache.spark.sql.execution.metric.SQLMetric) references[2]; /* 049 */ inputadapter_input = inputs[0]; /* 050 */ agg_result = new UnsafeRow(3); /* 051 */ this.agg_holder = new org.apache.spark.sql.catalyst.expressions.codegen.BufferHolder(agg_result, 96); /* 052 */ this.agg_rowWriter = new org.apache.spark.sql.catalyst.expressions.codegen.UnsafeRowWriter(agg_holder, 3); /* 053 */ /* 054 */ agg_result1 = new UnsafeRow(8); /* 055 */ this.agg_holder1 = new org.apache.spark.sql.catalyst.expressions.codegen.BufferHolder(agg_result1, 96); /* 056 */ this.agg_rowWriter1 = new org.apache.spark.sql.catalyst.expressions.codegen.UnsafeRowWriter(agg_holder1, 8); /* 057 */ this.wholestagecodegen_numOutputRows = (org.apache.spark.sql.execution.metric.SQLMetric) references[3]; /* 058 */ this.wholestagecodegen_aggTime = (org.apache.spark.sql.execution.metric.SQLMetric) references[4]; /* 059 */ /* 060 */ } /* 061 */ /* 062 */ private void agg_doAggregateWithKeys() throws java.io.IOException { /* 063 */ agg_hashMap = agg_plan.createHashMap(); /* 064 */ /* 065 */ while (inputadapter_input.hasNext()) { /* 066 */ InternalRow inputadapter_row = (InternalRow) inputadapter_input.next(); /* 067 */ boolean inputadapter_isNull = inputadapter_row.isNullAt(0); /* 068 */ UTF8String inputadapter_value = inputadapter_isNull ? null : (inputadapter_row.getUTF8String(0)); /* 069 */ boolean inputadapter_isNull1 = inputadapter_row.isNullAt(1); /* 070 */ UTF8String inputadapter_value1 = inputadapter_isNull1 ? null : (inputadapter_row.getUTF8String(1)); /* 071 */ boolean inputadapter_isNull2 = inputadapter_row.isNullAt(2); /* 072 */ UTF8String inputadapter_value2 = inputadapter_isNull2 ? null : (inputadapter_row.getUTF8String(2)); /* 073 */ boolean inputadapter_isNull3 = inputadapter_row.isNullAt(3); /* 074 */ long inputadapter_value3 = inputadapter_isNull3 ? -1L : (inputadapter_row.getLong(3)); /* 075 */ boolean inputadapter_isNull4 = inputadapter_row.isNullAt(4); /* 076 */ long inputadapter_value4 = inputadapter_isNull4 ? -1L : (inputadapter_row.getLong(4)); /* 077 */ boolean inputadapter_isNull5 = inputadapter_row.isNullAt(5); /* 078 */ long inputadapter_value5 = inputadapter_isNull5 ? -1L : (inputadapter_row.getLong(5)); /* 079 */ boolean inputadapter_isNull6 = inputadapter_row.isNullAt(6); /* 080 */ long inputadapter_value6 = inputadapter_isNull6 ? -1L : (inputadapter_row.getLong(6)); /* 081 */ boolean inputadapter_isNull7 = inputadapter_row.isNullAt(7); /* 082 */ long inputadapter_value7 = inputadapter_isNull7 ? -1L : (inputadapter_row.getLong(7)); /* 083 */ /* 084 */ UnsafeRow agg_unsafeRowAggBuffer = null; /* 085 */ /* 086 */ UnsafeRow agg_fastAggBuffer = null; /* 087 */ /* 088 */ if (agg_fastAggBuffer == null) { /* 089 */ // generate grouping key /* 090 */ agg_holder.reset(); /* 091 */ /* 092 */ agg_rowWriter.zeroOutNullBytes(); /* 093 */ /* 094 */ if (inputadapter_isNull) { /* 095 */ agg_rowWriter.setNullAt(0); /* 096 */ } else { /* 097 */ agg_rowWriter.write(0, inputadapter_value); /* 098 */ } /* 099 */ /* 100 */ if (inputadapter_isNull1) { /* 101 */ agg_rowWriter.setNullAt(1); /* 102 */ } else { /* 103 */ agg_rowWriter.write(1, inputadapter_value1); /* 104 */ } /* 105 */ /* 106 */ if (inputadapter_isNull2) { /* 107 */ agg_rowWriter.setNullAt(2); /* 108 */ } else { /* 109 */ agg_rowWriter.write(2, inputadapter_value2); /* 110 */ } /* 111 */ agg_result.setTotalSize(agg_holder.totalSize()); /* 112 */ agg_value16 = 42; /* 113 */ /* 114 */ if (!inputadapter_isNull) { /* 115 */ agg_value16 = org.apache.spark.unsafe.hash.Murmur3_x86_32.hashUnsafeBytes(inputadapter_value.getBaseObject(), inputadapter_value.getBaseOffset(), inputadapter_value.numBytes(), agg_value16); /* 116 */ } /* 117 */ /* 118 */ if (!inputadapter_isNull1) { /* 119 */ agg_value16 = org.apache.spark.unsafe.hash.Murmur3_x86_32.hashUnsafeBytes(inputadapter_value1.getBaseObject(), inputadapter_value1.getBaseOffset(), inputadapter_value1.numBytes(), agg_value16); /* 120 */ } /* 121 */ /* 122 */ if (!inputadapter_isNull2) { /* 123 */ agg_value16 = org.apache.spark.unsafe.hash.Murmur3_x86_32.hashUnsafeBytes(inputadapter_value2.getBaseObject(), inputadapter_value2.getBaseOffset(), inputadapter_value2.numBytes(), agg_value16); /* 124 */ } /* 125 */ if (true) { /* 126 */ // try to get the buffer from hash map /* 127 */ agg_unsafeRowAggBuffer = /* 128 */ agg_hashMap.getAggregationBufferFromUnsafeRow(agg_result, agg_value16); /* 129 */ } /* 130 */ if (agg_unsafeRowAggBuffer == null) { /* 131 */ if (agg_sorter == null) { /* 132 */ agg_sorter = agg_hashMap.destructAndCreateExternalSorter(); /* 133 */ } else { /* 134 */ agg_sorter.merge(agg_hashMap.destructAndCreateExternalSorter()); /* 135 */ } /* 136 */ /* 137 */ // the hash map had be spilled, it should have enough memory now, /* 138 */ // try to allocate buffer again. /* 139 */ agg_unsafeRowAggBuffer = /* 140 */ agg_hashMap.getAggregationBufferFromUnsafeRow(agg_result, agg_value16); /* 141 */ if (agg_unsafeRowAggBuffer == null) { /* 142 */ // failed to allocate the first page /* 143 */ throw new OutOfMemoryError("No enough memory for aggregation"); /* 144 */ } /* 145 */ } /* 146 */ } /* 147 */ /* 148 */ if (agg_fastAggBuffer != null) { /* 149 */ // update fast row /* 150 */ /* 151 */ } else { /* 152 */ // update unsafe row /* 153 */ /* 154 */ // common sub-expressions /* 155 */ boolean agg_isNull15 = false; /* 156 */ long agg_value20 = -1L; /* 157 */ if (!false) { /* 158 */ agg_value20 = (long) 0; /* 159 */ } /* 160 */ // evaluate aggregate function /* 161 */ boolean agg_isNull18 = true; /* 162 */ long agg_value23 = -1L; /* 163 */ /* 164 */ boolean agg_isNull20 = agg_unsafeRowAggBuffer.isNullAt(0); /* 165 */ long agg_value25 = agg_isNull20 ? -1L : (agg_unsafeRowAggBuffer.getLong(0)); /* 166 */ boolean agg_isNull19 = agg_isNull20; /* 167 */ long agg_value24 = agg_value25; /* 168 */ if (agg_isNull19) { /* 169 */ if (!agg_isNull15) { /* 170 */ agg_isNull19 = false; /* 171 */ agg_value24 = agg_value20; /* 172 */ } /* 173 */ } /* 174 */ /* 175 */ if (!inputadapter_isNull3) { /* 176 */ agg_isNull18 = false; // resultCode could change nullability. /* 177 */ agg_value23 = agg_value24 + inputadapter_value3; /* 178 */ /* 179 */ } /* 180 */ boolean agg_isNull17 = agg_isNull18; /* 181 */ long agg_value22 = agg_value23; /* 182 */ if (agg_isNull17) { /* 183 */ boolean agg_isNull22 = agg_unsafeRowAggBuffer.isNullAt(0); /* 184 */ long agg_value27 = agg_isNull22 ? -1L : (agg_unsafeRowAggBuffer.getLong(0)); /* 185 */ if (!agg_isNull22) { /* 186 */ agg_isNull17 = false; /* 187 */ agg_value22 = agg_value27; /* 188 */ } /* 189 */ } /* 190 */ boolean agg_isNull24 = true; /* 191 */ long agg_value29 = -1L; /* 192 */ /* 193 */ boolean agg_isNull26 = agg_unsafeRowAggBuffer.isNullAt(1); /* 194 */ long agg_value31 = agg_isNull26 ? -1L : (agg_unsafeRowAggBuffer.getLong(1)); /* 195 */ boolean agg_isNull25 = agg_isNull26; /* 196 */ long agg_value30 = agg_value31; /* 197 */ if (agg_isNull25) { /* 198 */ if (!agg_isNull15) { /* 199 */ agg_isNull25 = false; /* 200 */ agg_value30 = agg_value20; /* 201 */ } /* 202 */ } /* 203 */ /* 204 */ if (!inputadapter_isNull4) { /* 205 */ agg_isNull24 = false; // resultCode could change nullability. /* 206 */ agg_value29 = agg_value30 + inputadapter_value4; /* 207 */ /* 208 */ } /* 209 */ boolean agg_isNull23 = agg_isNull24; /* 210 */ long agg_value28 = agg_value29; /* 211 */ if (agg_isNull23) { /* 212 */ boolean agg_isNull28 = agg_unsafeRowAggBuffer.isNullAt(1); /* 213 */ long agg_value33 = agg_isNull28 ? -1L : (agg_unsafeRowAggBuffer.getLong(1)); /* 214 */ if (!agg_isNull28) { /* 215 */ agg_isNull23 = false; /* 216 */ agg_value28 = agg_value33; /* 217 */ } /* 218 */ } /* 219 */ boolean agg_isNull30 = true; /* 220 */ long agg_value35 = -1L; /* 221 */ /* 222 */ boolean agg_isNull32 = agg_unsafeRowAggBuffer.isNullAt(2); /* 223 */ long agg_value37 = agg_isNull32 ? -1L : (agg_unsafeRowAggBuffer.getLong(2)); /* 224 */ boolean agg_isNull31 = agg_isNull32; /* 225 */ long agg_value36 = agg_value37; /* 226 */ if (agg_isNull31) { /* 227 */ if (!agg_isNull15) { /* 228 */ agg_isNull31 = false; /* 229 */ agg_value36 = agg_value20; /* 230 */ } /* 231 */ } /* 232 */ /* 233 */ if (!inputadapter_isNull5) { /* 234 */ agg_isNull30 = false; // resultCode could change nullability. /* 235 */ agg_value35 = agg_value36 + inputadapter_value5; /* 236 */ /* 237 */ } /* 238 */ boolean agg_isNull29 = agg_isNull30; /* 239 */ long agg_value34 = agg_value35; /* 240 */ if (agg_isNull29) { /* 241 */ boolean agg_isNull34 = agg_unsafeRowAggBuffer.isNullAt(2); /* 242 */ long agg_value39 = agg_isNull34 ? -1L : (agg_unsafeRowAggBuffer.getLong(2)); /* 243 */ if (!agg_isNull34) { /* 244 */ agg_isNull29 = false; /* 245 */ agg_value34 = agg_value39; /* 246 */ } /* 247 */ } /* 248 */ boolean agg_isNull36 = true; /* 249 */ long agg_value41 = -1L; /* 250 */ /* 251 */ boolean agg_isNull38 = agg_unsafeRowAggBuffer.isNullAt(3); /* 252 */ long agg_value43 = agg_isNull38 ? -1L : (agg_unsafeRowAggBuffer.getLong(3)); /* 253 */ boolean agg_isNull37 = agg_isNull38; /* 254 */ long agg_value42 = agg_value43; /* 255 */ if (agg_isNull37) { /* 256 */ if (!agg_isNull15) { /* 257 */ agg_isNull37 = false; /* 258 */ agg_value42 = agg_value20; /* 259 */ } /* 260 */ } /* 261 */ /* 262 */ if (!inputadapter_isNull6) { /* 263 */ agg_isNull36 = false; // resultCode could change nullability. /* 264 */ agg_value41 = agg_value42 + inputadapter_value6; /* 265 */ /* 266 */ } /* 267 */ boolean agg_isNull35 = agg_isNull36; /* 268 */ long agg_value40 = agg_value41; /* 269 */ if (agg_isNull35) { /* 270 */ boolean agg_isNull40 = agg_unsafeRowAggBuffer.isNullAt(3); /* 271 */ long agg_value45 = agg_isNull40 ? -1L : (agg_unsafeRowAggBuffer.getLong(3)); /* 272 */ if (!agg_isNull40) { /* 273 */ agg_isNull35 = false; /* 274 */ agg_value40 = agg_value45; /* 275 */ } /* 276 */ } /* 277 */ boolean agg_isNull42 = true; /* 278 */ long agg_value47 = -1L; /* 279 */ /* 280 */ boolean agg_isNull44 = agg_unsafeRowAggBuffer.isNullAt(4); /* 281 */ long agg_value49 = agg_isNull44 ? -1L : (agg_unsafeRowAggBuffer.getLong(4)); /* 282 */ boolean agg_isNull43 = agg_isNull44; /* 283 */ long agg_value48 = agg_value49; /* 284 */ if (agg_isNull43) { /* 285 */ if (!agg_isNull15) { /* 286 */ agg_isNull43 = false; /* 287 */ agg_value48 = agg_value20; /* 288 */ } /* 289 */ } /* 290 */ /* 291 */ if (!inputadapter_isNull7) { /* 292 */ agg_isNull42 = false; // resultCode could change nullability. /* 293 */ agg_value47 = agg_value48 + inputadapter_value7; /* 294 */ /* 295 */ } /* 296 */ boolean agg_isNull41 = agg_isNull42; /* 297 */ long agg_value46 = agg_value47; /* 298 */ if (agg_isNull41) { /* 299 */ boolean agg_isNull46 = agg_unsafeRowAggBuffer.isNullAt(4); /* 300 */ long agg_value51 = agg_isNull46 ? -1L : (agg_unsafeRowAggBuffer.getLong(4)); /* 301 */ if (!agg_isNull46) { /* 302 */ agg_isNull41 = false; /* 303 */ agg_value46 = agg_value51; /* 304 */ } /* 305 */ } /* 306 */ // update unsafe row buffer /* 307 */ if (!agg_isNull17) { /* 308 */ agg_unsafeRowAggBuffer.setLong(0, agg_value22); /* 309 */ } else { /* 310 */ agg_unsafeRowAggBuffer.setNullAt(0); /* 311 */ } /* 312 */ /* 313 */ if (!agg_isNull23) { /* 314 */ agg_unsafeRowAggBuffer.setLong(1, agg_value28); /* 315 */ } else { /* 316 */ agg_unsafeRowAggBuffer.setNullAt(1); /* 317 */ } /* 318 */ /* 319 */ if (!agg_isNull29) { /* 320 */ agg_unsafeRowAggBuffer.setLong(2, agg_value34); /* 321 */ } else { /* 322 */ agg_unsafeRowAggBuffer.setNullAt(2); /* 323 */ } /* 324 */ /* 325 */ if (!agg_isNull35) { /* 326 */ agg_unsafeRowAggBuffer.setLong(3, agg_value40); /* 327 */ } else { /* 328 */ agg_unsafeRowAggBuffer.setNullAt(3); /* 329 */ } /* 330 */ /* 331 */ if (!agg_isNull41) { /* 332 */ agg_unsafeRowAggBuffer.setLong(4, agg_value46); /* 333 */ } else { /* 334 */ agg_unsafeRowAggBuffer.setNullAt(4); /* 335 */ } /* 336 */ /* 337 */ } /* 338 */ if (shouldStop()) return; /* 339 */ } /* 340 */ /* 341 */ agg_mapIter = agg_plan.finishAggregate(agg_hashMap, agg_sorter, agg_peakMemory, agg_spillSize); /* 342 */ } /* 343 */ /* 344 */ protected void processNext() throws java.io.IOException { /* 345 */ if (!agg_initAgg) { /* 346 */ agg_initAgg = true; /* 347 */ long wholestagecodegen_beforeAgg = System.nanoTime(); /* 348 */ agg_doAggregateWithKeys(); /* 349 */ wholestagecodegen_aggTime.add((System.nanoTime() - wholestagecodegen_beforeAgg) / 1000000); /* 350 */ } /* 351 */ /* 352 */ // output the result /* 353 */ /* 354 */ while (agg_mapIter.next()) { /* 355 */ wholestagecodegen_numOutputRows.add(1); /* 356 */ UnsafeRow agg_aggKey = (UnsafeRow) agg_mapIter.getKey(); /* 357 */ UnsafeRow agg_aggBuffer = (UnsafeRow) agg_mapIter.getValue(); /* 358 */ /* 359 */ boolean agg_isNull47 = agg_aggKey.isNullAt(0); /* 360 */ UTF8String agg_value52 = agg_isNull47 ? null : (agg_aggKey.getUTF8String(0)); /* 361 */ boolean agg_isNull48 = agg_aggKey.isNullAt(1); /* 362 */ UTF8String agg_value53 = agg_isNull48 ? null : (agg_aggKey.getUTF8String(1)); /* 363 */ boolean agg_isNull49 = agg_aggKey.isNullAt(2); /* 364 */ UTF8String agg_value54 = agg_isNull49 ? null : (agg_aggKey.getUTF8String(2)); /* 365 */ boolean agg_isNull50 = agg_aggBuffer.isNullAt(0); /* 366 */ long agg_value55 = agg_isNull50 ? -1L : (agg_aggBuffer.getLong(0)); /* 367 */ boolean agg_isNull51 = agg_aggBuffer.isNullAt(1); /* 368 */ long agg_value56 = agg_isNull51 ? -1L : (agg_aggBuffer.getLong(1)); /* 369 */ boolean agg_isNull52 = agg_aggBuffer.isNullAt(2); /* 370 */ long agg_value57 = agg_isNull52 ? -1L : (agg_aggBuffer.getLong(2)); /* 371 */ boolean agg_isNull53 = agg_aggBuffer.isNullAt(3); /* 372 */ long agg_value58 = agg_isNull53 ? -1L : (agg_aggBuffer.getLong(3)); /* 373 */ boolean agg_isNull54 = agg_aggBuffer.isNullAt(4); /* 374 */ long agg_value59 = agg_isNull54 ? -1L : (agg_aggBuffer.getLong(4)); /* 375 */ /* 376 */ agg_holder1.reset(); /* 377 */ /* 378 */ agg_rowWriter1.zeroOutNullBytes(); /* 379 */ /* 380 */ if (agg_isNull47) { /* 381 */ agg_rowWriter1.setNullAt(0); /* 382 */ } else { /* 383 */ agg_rowWriter1.write(0, agg_value52); /* 384 */ } /* 385 */ /* 386 */ if (agg_isNull48) { /* 387 */ agg_rowWriter1.setNullAt(1); /* 388 */ } else { /* 389 */ agg_rowWriter1.write(1, agg_value53); /* 390 */ } /* 391 */ /* 392 */ if (agg_isNull49) { /* 393 */ agg_rowWriter1.setNullAt(2); /* 394 */ } else { /* 395 */ agg_rowWriter1.write(2, agg_value54); /* 396 */ } /* 397 */ /* 398 */ if (agg_isNull50) { /* 399 */ agg_rowWriter1.setNullAt(3); /* 400 */ } else { /* 401 */ agg_rowWriter1.write(3, agg_value55); /* 402 */ } /* 403 */ /* 404 */ if (agg_isNull51) { /* 405 */ agg_rowWriter1.setNullAt(4); /* 406 */ } else { /* 407 */ agg_rowWriter1.write(4, agg_value56); /* 408 */ } /* 409 */ /* 410 */ if (agg_isNull52) { /* 411 */ agg_rowWriter1.setNullAt(5); /* 412 */ } else { /* 413 */ agg_rowWriter1.write(5, agg_value57); /* 414 */ } /* 415 */ /* 416 */ if (agg_isNull53) { /* 417 */ agg_rowWriter1.setNullAt(6); /* 418 */ } else { /* 419 */ agg_rowWriter1.write(6, agg_value58); /* 420 */ } /* 421 */ /* 422 */ if (agg_isNull54) { /* 423 */ agg_rowWriter1.setNullAt(7); /* 424 */ } else { /* 425 */ agg_rowWriter1.write(7, agg_value59); /* 426 */ } /* 427 */ agg_result1.setTotalSize(agg_holder1.totalSize()); /* 428 */ append(agg_result1); /* 429 */ /* 430 */ if (shouldStop()) return; /* 431 */ } /* 432 */ /* 433 */ agg_mapIter.close(); /* 434 */ if (agg_sorter == null) { /* 435 */ agg_hashMap.free(); /* 436 */ } /* 437 */ } /* 438 */ }
[ "kavana.bhat@in.ibm.com" ]
kavana.bhat@in.ibm.com
b53bd2d717c60efd67fca7d0064ff207aa43d062
82fa370b009e4697e9bcad9fc0b39ef1f8584b82
/GroupProject/GLM/app/src/main/java/edu/qc/seclass/glm/GLMDatabase.java
25657b9f97b199ccbd3ed09be5746781a9624648
[]
no_license
horwardL/Grocery-List-Manager
1395be13a32f0a50544531ba32b62b86e0b4a357
4148727e1f5ea3495924cb58e669eed5bcb07de0
refs/heads/master
2020-09-04T04:39:56.262786
2019-04-20T23:50:48
2019-04-20T23:50:48
219,659,165
0
0
null
null
null
null
UTF-8
Java
false
false
16,350
java
package edu.qc.seclass.glm; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.support.annotation.Nullable; import android.util.Log; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class GLMDatabase extends SQLiteOpenHelper { private static GLMDatabase glmdb; public static final String GROCERY_LIST = "GroceryListApp"; // // Columns for Grocery List Table // public static final String TABLE_GROCERY_LIST = "Grocery List"; // public static final String COLUMN_GROCERY_LIST_ID = "ID"; // public static final String COLUMN_GROCERY_LIST_NAME = "List Name"; // // // Columns for GroceryListRelationToItem // public static final String TABLE_GROCERY_LIST_RELATION_TO_ITEM = "Grocery List Relation ToItem"; // public static final String COLUMN_GROCERY_LIST_RELATION_TO_ITEM_GL_ID = "Grocery List ID"; // public static final String COLUMN_GROCERY_LIST_RELATION_TO_ITEM_ITEM_ID = "Item ID" // public static final String COLUMN_GROCERY_LIST_RELATION_TO_ITEM_QTY = "Quantity"; public static synchronized GLMDatabase getInstance(Context context){ if(glmdb == null){ glmdb = new GLMDatabase(context.getApplicationContext()); } return glmdb; } private GLMDatabase(Context context) { super(context, GROCERY_LIST, null, 1); } String[] itemTypes = new String[]{"Beverages", "Bread/Bakery", "Canned/Jarred Goods", "Dairy", "Dry/Baking Goods", "Frozen Foods", "Meat", "Produce", "Cleaners", "Paper Goods", "Personal Care", "Other"}; String[] Beverages = new String[]{"coffee", "tea", "soda"}; String[] Bread_Bakery = new String[]{"sandwich loaves", "dinner rools", "tortillas", "bagels"}; String[] Canned_Jarred_Goods = new String[]{"vegetables", "spaghetti sauce", "ketchup"}; String[] Dairy = new String[]{"cheeses", "eggs", "milk", "yogurt", "butter"}; String[] Dry_Baking_Goods = new String[]{"cereals", "flour", "sugar", "pasta", "mixes"}; String[] Frozen_Foods = new String[]{"waffles", "vegetables", "individual meals", "ice cream"}; String[] Meat = new String[]{"lunch meat", "poultry", "beef", "pork"}; String[] Produce = new String[]{"fruits", "vegetables"}; String[] Cleaners = new String[]{"all- purpose", "laundry detergent", "dishwashing liquid", "detergent"}; String[] Paper_Goods = new String[]{"paper towels", "toilet paper", "aluminum foil", "sandwich bags"}; String[] Personal_Care = new String[]{"shampoo", "soap", "hand soap", "shaving cream"}; String[] Other = new String[]{"baby items", "pet items", "batteries", "greeting cards"}; String[][] items = new String[][]{Beverages, Bread_Bakery, Canned_Jarred_Goods, Dairy, Dry_Baking_Goods, Frozen_Foods, Meat, Produce, Cleaners, Paper_Goods, Personal_Care, Other}; String CREATE_GROCERY_LIST_TABLE = "CREATE TABLE GROCERY_LIST (" + "ListID INTEGER PRIMARY KEY AUTOINCREMENT," + "GroceryListName VARCHAR(60) NOT NULL)"; String CREATE_ITEM_TYPE_TABLE = "CREATE TABLE ITEM_TYPE (" + "ID INTEGER PRIMARY KEY AUTOINCREMENT," + "type VARCHAR(50) NOT NULL)"; String CREATE_ITEM_LIST_TABLE = "CREATE TABLE ITEM_LIST (" + "ItemID INTEGER PRIMARY KEY AUTOINCREMENT," + "itemName VARCHAR(50) NOT NULL, typeID INTEGER NOT NULL, FOREIGN KEY (typeID) REFERENCES Item_Type(typeID) ON DELETE CASCADE)"; String CREATE_GROCERY_LIST_RELATION_TO_ITEMS = "CREATE TABLE GROCERY_LIST_RELATION_TO_ITEMS (" + "ListID INTEGER NOT NULL," + "ItemID INTEGER NOT NULL," + "Qty DOUBLE NOT NULL DEFAULT 0.0," + "isSelected INTEGER DEFAULT 0," + "PRIMARY KEY(ListID,ItemID)," // Composite Key + "FOREIGN KEY(ListID) REFERENCES GROCERY_LIST (ListID) ON DELETE CASCADE," + "FOREIGN KEY(ItemID) REFERENCES Item_List(ItemID) ON DELETE CASCADE)"; @Override public void onCreate(SQLiteDatabase db) { db.execSQL(CREATE_ITEM_TYPE_TABLE); db.execSQL(CREATE_ITEM_LIST_TABLE); db.execSQL(CREATE_GROCERY_LIST_TABLE); db.execSQL(CREATE_GROCERY_LIST_RELATION_TO_ITEMS); insertTypes(db); insertItems(db); Log.e("Database operations ","Tables Created "); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { } private void insertTypes(SQLiteDatabase db){ ContentValues values = new ContentValues(); for(String i:itemTypes){ values.put("type", i); db.insert("ITEM_TYPE", null, values); } } public String getListName(int listID){ String name = ""; SQLiteDatabase db = this.getReadableDatabase(); String q = "SELECT * FROM GROCERY_LIST WHERE ListID = " + listID + ";"; Cursor cursor = db.rawQuery(q, null); if(cursor.moveToFirst()) name = cursor.getString(1); cursor.close(); return name; } private void insertItems(SQLiteDatabase db){ ContentValues values = new ContentValues(); int tid = -1; for(int i=0;i<itemTypes.length;++i){ for(String j:items[i]){ tid = getTypeID(itemTypes[i], db); values.put("itemName", j); values.put("typeID", tid); db.insert("ITEM_LIST", null, values); } } } public void insertItem(Item_list item){ SQLiteDatabase db = this.getReadableDatabase(); ContentValues values = new ContentValues(); values.put("itemName", item.getName()); values.put("typeID", getTypeID(item.getType(), db)); db.insert("ITEM_LIST", null, values); } public ArrayList<Grocery_list> getList(){ ArrayList<Grocery_list> glist = new ArrayList<>(); String q = "SELECT * FROM GROCERY_LIST"; SQLiteDatabase db = this.getWritableDatabase(); Cursor cursor = db.rawQuery(q, null); if(cursor.moveToFirst()){ do{ Grocery_list gl = new Grocery_list(cursor.getString(1), false, cursor.getInt(0)); glist.add(gl); }while(cursor.moveToNext()); } cursor.close(); return glist; } int addList(String name){ SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put("GroceryListName", name); return (int)db.insert("GROCERY_LIST", null, values); } void renameList(long glID, String newName){ SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put("GroceryListName", newName); db.update("GROCERY_LIST", values, "ListID ="+glID, null); } void removeList(long glID){ SQLiteDatabase db = this.getWritableDatabase(); db.delete("GROCERY_LIST_RELATION_TO_ITEMS", "ListID = " + glID, null); db.delete("GROCERY_LIST", "ListID = '" + glID + "'", null); } ArrayList<String> getItemList(){ ArrayList<String> s = new ArrayList<>(); String i = ""; SQLiteDatabase db = this.getWritableDatabase(); String q = "SELECT * FROM GROCERY_LIST_RELATION_TO_ITEMS"; Cursor cursor = db.rawQuery(q, null); if(cursor.moveToFirst()) { do { i = cursor.getInt(0) + ", " + cursor.getInt(1) + ", " + cursor.getDouble(2) + ", " + cursor.getInt(3); s.add(i); } while (cursor.moveToNext()); } cursor.close(); return s; } int getListID(String name, SQLiteDatabase db){ int id = -1; String q = "SELECT * FROM GROCERY_LIST WHERE GroceryListName = '" + name + "';"; Cursor cursor = db.rawQuery(q, null); if(cursor.moveToFirst()) id = cursor.getInt(0); cursor.close(); return id; } int getListID(String name){ int id = -1; SQLiteDatabase db = this.getWritableDatabase(); String q = "SELECT * FROM GROCERY_LIST WHERE GroceryListName = '" + name + "';"; Cursor cursor = db.rawQuery(q, null); if(cursor.moveToFirst()) id = cursor.getInt(0); cursor.close(); return id; } int getItemID(String name){ int id = -1; String q = "SELECT * FROM ITEM_LIST WHERE itemName = '" + name + "';"; SQLiteDatabase db = this.getReadableDatabase(); Cursor cursor = db.rawQuery(q, null); if(cursor.moveToFirst()) id = cursor.getInt(0); cursor.close(); return id; } int getItemID(String itemName, SQLiteDatabase db) { int id = -1; String q = "SELECT * FROM ITEM_LIST WHERE itemName = '" + itemName + "';"; Cursor cursor = db.rawQuery(q, null); if (cursor.moveToFirst()){ id = cursor.getInt(0); } cursor.close(); return id; } void setSelected(int listID, Item_list item){ SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); if(item.isSelected()){ values.put("isSelected", 1); }else{ values.put("isSelected", 0); } db.update("GROCERY_LIST_RELATION_TO_ITEMS", values, "ListID = " + listID + " AND ItemID = " + getItemID(item.getName(), db), null); } public ArrayList<String> getTypes(){ return new ArrayList<>(Arrays.asList(itemTypes)); } public int getTypeID(String t){ int id = -1; String q = "SELECT * FROM ITEM_TYPE WHERE type = '" + t + "';"; SQLiteDatabase db = this.getReadableDatabase(); Cursor cursor = db.rawQuery(q, null); if(cursor.moveToFirst()) id = cursor.getInt(0); cursor.close(); return id; } public int getTypeID(String t, SQLiteDatabase db){ int id = -1; String q = "SELECT * FROM ITEM_TYPE WHERE type = '" + t + "';"; Cursor cursor = db.rawQuery(q, null); if(cursor.moveToFirst()) id = cursor.getInt(0); cursor.close(); return id; } ArrayList<String> getItemsByType(String type){ ArrayList<String> itemL = new ArrayList<>(); String item; SQLiteDatabase db = this.getWritableDatabase(); String q = "SELECT * FROM ITEM_LIST WHERE typeID = " + getTypeID(type, db); Cursor cursor = db.rawQuery(q, null); if(cursor.moveToFirst()){ do{ item = cursor.getString(1); itemL.add(item); }while(cursor.moveToNext()); } cursor.close(); return itemL; } void addItem(Item_list item, int listID){ double qua; SQLiteDatabase db = this.getWritableDatabase(); String q = "SELECT * FROM GROCERY_LIST_RELATION_TO_ITEMS WHERE ListID = " + listID + " AND ItemID = " + getItemID(item.getName(), db) + ";"; Cursor cursor = db.rawQuery(q, null); ContentValues values = new ContentValues(); if(cursor.moveToFirst()){ qua = cursor.getDouble(2) + Double.parseDouble(item.getQuant()); if(qua > 999999.0){ qua = 999999.0; } values.put("Qty", qua); db.update("GROCERY_LIST_RELATION_TO_ITEMS", values, "ListID = " + listID + " AND ItemID = " + getItemID(item.getName(), db), null); }else { values.put("ListID", listID); values.put("ItemID", getItemID(item.getName(), db)); values.put("Qty", item.getQuant()); db.insert("GROCERY_LIST_RELATION_TO_ITEMS", null, values); } cursor.close(); } public ArrayList<Item_list> getItemList(int listID){ ArrayList<Item_list> itemL = new ArrayList<>(); Item_list item; SQLiteDatabase db = this.getWritableDatabase(); int n; String name; double quan; int s; String q = "SELECT * FROM GROCERY_LIST_RELATION_TO_ITEMS WHERE ListID = " + listID; Cursor cursor = db.rawQuery(q, null); if(cursor.moveToFirst()){ do{ n = cursor.getInt(1); quan = cursor.getDouble(2); s = cursor.getInt(3); name = getItemName(n, db); item = s <= 0 ? new Item_list(name, getItemType(n, db), quan, false):new Item_list(name, getItemType(n, db), quan, true); itemL.add(item); }while(cursor.moveToNext()); } cursor.close(); return itemL; } String getItemName(int itemID, SQLiteDatabase db){ String name = ""; String q = "SELECT * FROM ITEM_LIST WHERE ItemID = " + itemID ; Cursor cursor = db.rawQuery(q, null); if(cursor.moveToFirst()) name = cursor.getString(1); cursor.close(); return name; } String getItemType(int itemID){ SQLiteDatabase db = this.getWritableDatabase(); String type = ""; String q = "SELECT ITEM_TYPE.*, ITEM_LIST.* FROM ITEM_TYPE, ITEM_LIST WHERE ITEM_LIST.ItemID = " + itemID + " AND ITEM_LIST.typeID = " + "ITEM_TYPE.ID"; Cursor cursor = db.rawQuery(q, null); if(cursor.moveToFirst()) type = cursor.getString(1); cursor.close(); return type; } String getItemType(int itemID, SQLiteDatabase db){ String type = ""; String q = "SELECT ITEM_TYPE.*, ITEM_LIST.* FROM ITEM_TYPE, ITEM_LIST WHERE ITEM_LIST.ItemID = " + itemID + " AND ITEM_LIST.typeID = " + "ITEM_TYPE.ID"; Cursor cursor = db.rawQuery(q, null); if(cursor.moveToFirst()) type = cursor.getString(1); cursor.close(); return type; } ArrayList<String> getSimilarItem(String text){ ArrayList<String> iList = new ArrayList<>(); String name; SQLiteDatabase db = this.getWritableDatabase(); String q = "SELECT * FROM ITEM_LIST WHERE itemName LIKE '%%" + text + "%%';"; Cursor cursor = db.rawQuery(q, null); if(cursor.moveToFirst()){ do{ name = cursor.getString(1); iList.add(name); }while(cursor.moveToNext()); } cursor.close(); return iList; } ArrayList<String> getItemType(String item){ String type = ""; ArrayList<String> types = new ArrayList<>(); SQLiteDatabase db = this.getWritableDatabase(); String q = "SELECT ITEM_TYPE.*, ITEM_LIST.* FROM ITEM_TYPE, ITEM_LIST WHERE itemName = '" + item + "' AND typeID = ID"; Cursor cursor = db.rawQuery(q, null); if(cursor.moveToFirst()) { do{ type = cursor.getString(1); types.add(type); }while(cursor.moveToNext()); } cursor.close(); return types; } void deleteItem(Item_list item, int glID){ int itemID = -1; SQLiteDatabase db = this.getWritableDatabase(); String q = "SELECT * FROM ITEM_LIST WHERE itemName = '" + item.getName() + "' AND typeID =" + getTypeID(item.getType()) + ";"; Cursor cursor = db.rawQuery(q, null); if(cursor.moveToFirst()){ itemID = cursor.getInt(0); } cursor.close(); db.delete("GROCERY_LIST_RELATION_TO_ITEMS", "ListID = " + glID + " AND ItemID = " + itemID, null); } void editListItem(Item_list item, int glID){ int itemID = -1; SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); String q = "SELECT * FROM ITEM_LIST WHERE itemName = '" + item.getName() + "' AND typeID =" + getTypeID(item.getType()) + ";"; Cursor cursor = db.rawQuery(q, null); if(cursor.moveToFirst()){ itemID = cursor.getInt(0); } cursor.close(); values.put("Qty", Double.parseDouble(item.getQuant())); db.update("GROCERY_LIST_RELATION_TO_ITEMS", values,"ListID = " + glID + " AND ItemID = " + itemID, null); } }
[ "hwloh14@example.com" ]
hwloh14@example.com
21c52fe336b0f9dd106d267b34ee5a6e5c320a12
e6babaad75247b87573fca66d46133072cddc16d
/src/main/java/com/bsuir/vas/service/PaymentServiceImpl.java
72378fe81c15352929524c7a564986b1fd5f9aa8
[]
no_license
VladMigura/vas-api
0c03ed789467d607e5f92c2688c2e1433ee5b4ad
a9501ff601de6b6082015db05f0d63ea339de94d
refs/heads/master
2020-04-02T11:07:59.949042
2018-10-24T16:35:05
2018-10-24T16:35:05
154,372,570
0
0
null
null
null
null
UTF-8
Java
false
false
1,693
java
package com.bsuir.vas.service; import com.bsuir.vas.entity.ParticipantEntity; import com.bsuir.vas.entity.PaymentEntity; import com.bsuir.vas.exception.NotFoundException; import com.bsuir.vas.model.PaymentModel; import com.bsuir.vas.repository.ParticipantRepository; import com.bsuir.vas.repository.PaymentRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.stereotype.Component; @Component public class PaymentServiceImpl implements PaymentService { @Autowired private ParticipantRepository participantRepository; @Autowired private PaymentRepository paymentRepository; @Override @PreAuthorize("@securityUtility.isAuthenticated()") public PaymentModel createPayments(PaymentModel paymentModel) { ParticipantEntity participantEntity = participantRepository.findOneById(paymentModel.getParticipantId()); if(participantEntity != null) { paymentModel.getYears().forEach(year -> { PaymentEntity paymentEntity = PaymentEntity.builder() .participantEntity(participantEntity) .year(year) .build(); paymentRepository.save(paymentEntity); }); return paymentModel; } throw new NotFoundException("Participant is not found!"); } @Override @PreAuthorize("@securityUtility.isAuthenticated()") public void deletePayments(PaymentModel paymentModel) { paymentRepository.deleteAllByParameters(paymentModel.getParticipantId(), paymentModel.getYears()); } }
[ "vladmigura@Pavels-iMac-2.local" ]
vladmigura@Pavels-iMac-2.local
1eb0ae4efcaa8878b32c388cd15be7320fc39e14
b9096391f4c0ed556b95b8de26f5c84f672fffef
/src/com/practice/javabase/AboutInterface.java
b71da3702a403f92921c0f439f6727d9cfd53784
[]
no_license
123CLOUD123/mixed-learning
110406bb850e340bc9c1af6536f12c3e8553ba95
40a281e27b123735906a863b9c9c189425fa8677
refs/heads/master
2023-06-28T07:06:43.487361
2021-07-23T03:22:53
2021-07-23T03:22:53
195,952,664
0
0
null
null
null
null
UTF-8
Java
false
false
641
java
package com.practice.javabase; /** * 测试接口中的字段自动是public static final * @author Cloud * */ public class AboutInterface { public static void main(String[] args) { //编译不通过,提示final域 // TestInterface.s = "hello"; // 可通过接口名称引用变量 // 思考:接口不可被实例化,所以其中的字段只能在虚拟机加载的时候被读取并保存在虚拟机中,所以只能应该是static System.out.println(TestInterface.s); } } interface TestInterface { //加private编译不通过,提示only public // private String s = "test"; String s = "test"; }
[ "cloudzhanghi@foxmail.com" ]
cloudzhanghi@foxmail.com
353ee3395242902d954276c88b741c83e92f1ee6
44e7adc9a1c5c0a1116097ac99c2a51692d4c986
/aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/SecurityProfileTargetMapping.java
ede98d1f930d5f84999d88a1bf6b019d9e272912
[ "Apache-2.0" ]
permissive
QiAnXinCodeSafe/aws-sdk-java
f93bc97c289984e41527ae5bba97bebd6554ddbe
8251e0a3d910da4f63f1b102b171a3abf212099e
refs/heads/master
2023-01-28T14:28:05.239019
2020-12-03T22:09:01
2020-12-03T22:09:01
318,460,751
1
0
Apache-2.0
2020-12-04T10:06:51
2020-12-04T09:05:03
null
UTF-8
Java
false
false
6,291
java
/* * Copyright 2015-2020 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.iot.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** * <p> * Information about a security profile and the target associated with it. * </p> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class SecurityProfileTargetMapping implements Serializable, Cloneable, StructuredPojo { /** * <p> * Information that identifies the security profile. * </p> */ private SecurityProfileIdentifier securityProfileIdentifier; /** * <p> * Information about the target (thing group) associated with the security profile. * </p> */ private SecurityProfileTarget target; /** * <p> * Information that identifies the security profile. * </p> * * @param securityProfileIdentifier * Information that identifies the security profile. */ public void setSecurityProfileIdentifier(SecurityProfileIdentifier securityProfileIdentifier) { this.securityProfileIdentifier = securityProfileIdentifier; } /** * <p> * Information that identifies the security profile. * </p> * * @return Information that identifies the security profile. */ public SecurityProfileIdentifier getSecurityProfileIdentifier() { return this.securityProfileIdentifier; } /** * <p> * Information that identifies the security profile. * </p> * * @param securityProfileIdentifier * Information that identifies the security profile. * @return Returns a reference to this object so that method calls can be chained together. */ public SecurityProfileTargetMapping withSecurityProfileIdentifier(SecurityProfileIdentifier securityProfileIdentifier) { setSecurityProfileIdentifier(securityProfileIdentifier); return this; } /** * <p> * Information about the target (thing group) associated with the security profile. * </p> * * @param target * Information about the target (thing group) associated with the security profile. */ public void setTarget(SecurityProfileTarget target) { this.target = target; } /** * <p> * Information about the target (thing group) associated with the security profile. * </p> * * @return Information about the target (thing group) associated with the security profile. */ public SecurityProfileTarget getTarget() { return this.target; } /** * <p> * Information about the target (thing group) associated with the security profile. * </p> * * @param target * Information about the target (thing group) associated with the security profile. * @return Returns a reference to this object so that method calls can be chained together. */ public SecurityProfileTargetMapping withTarget(SecurityProfileTarget target) { setTarget(target); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getSecurityProfileIdentifier() != null) sb.append("SecurityProfileIdentifier: ").append(getSecurityProfileIdentifier()).append(","); if (getTarget() != null) sb.append("Target: ").append(getTarget()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof SecurityProfileTargetMapping == false) return false; SecurityProfileTargetMapping other = (SecurityProfileTargetMapping) obj; if (other.getSecurityProfileIdentifier() == null ^ this.getSecurityProfileIdentifier() == null) return false; if (other.getSecurityProfileIdentifier() != null && other.getSecurityProfileIdentifier().equals(this.getSecurityProfileIdentifier()) == false) return false; if (other.getTarget() == null ^ this.getTarget() == null) return false; if (other.getTarget() != null && other.getTarget().equals(this.getTarget()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getSecurityProfileIdentifier() == null) ? 0 : getSecurityProfileIdentifier().hashCode()); hashCode = prime * hashCode + ((getTarget() == null) ? 0 : getTarget().hashCode()); return hashCode; } @Override public SecurityProfileTargetMapping clone() { try { return (SecurityProfileTargetMapping) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.iot.model.transform.SecurityProfileTargetMappingMarshaller.getInstance().marshall(this, protocolMarshaller); } }
[ "" ]
5ae05c2a4aba95eaa302c7becf71f11c001c4fec
0486072dc6ac43ba3c6471a4d695ed36a59d92e5
/week11-week11_42.MovingFigure/src/movingfigure/KeyboardListener.java
6eaa478a4e48374ae89bab117ed4ccdaceccf4b4
[]
no_license
martin-hawk/mooc-2013-OOProgrammingWithJava-PART2
253363d8ba1085d8b3b7b7644c057cba0a984808
e9e16ea527f18a3c0ed9980e18e19508ab8a45b7
refs/heads/master
2020-04-09T04:25:33.344638
2019-08-31T11:31:04
2019-08-31T11:31:04
160,020,410
0
0
null
null
null
null
UTF-8
Java
false
false
1,231
java
/* * This program code is written by Martynas Vanagas. * This code is to be used for learning purposes. */ package movingfigure; import java.awt.Component; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; /** * * @author Martynas Vanagas */ public class KeyboardListener implements KeyListener { private Component component; private Figure figure; public KeyboardListener(Component component, Figure figure) { this.component = component; this.figure = figure; } @Override public void keyTyped(KeyEvent e) { } @Override public void keyPressed(KeyEvent e) { // System.out.println("Keystroke " + e.getKeyCode() + " pressed."); switch (e.getKeyCode()) { case KeyEvent.VK_UP: figure.move(0, -1); break; case KeyEvent.VK_DOWN: figure.move(0, 1); break; case KeyEvent.VK_LEFT: figure.move(-1, 0); break; case KeyEvent.VK_RIGHT: figure.move(1, 0); break; } component.repaint(); } @Override public void keyReleased(KeyEvent e) { } }
[ "martynas.vanagas@gmail.com" ]
martynas.vanagas@gmail.com
3690777b7cd6474c15476475c0e27d299d551811
9f7f60c9cda4230f4c5daf7c18f3f1d675db41ba
/network/src/main/java/ru/searchingfox/network/packets/Packet.java
14ab8e5b6d93ceb2a6fc05fb1ff154ec2c52aebf
[]
no_license
Sonicxd2/searchingfox
0ccc2f90c5e3cba132ab9025a662dc6177a23f42
f89e43865fa85b92018301af36686f385bd804cd
refs/heads/master
2020-03-23T07:26:27.064198
2018-07-17T10:08:42
2018-07-17T10:08:42
141,268,421
0
0
null
null
null
null
UTF-8
Java
false
false
246
java
package ru.searchingfox.network.packets; import java.io.Serializable; public class Packet implements Serializable { final int id; public Packet(int id) { this.id = id; } public int getId() { return id; } }
[ "iam@sonicxd2.ru" ]
iam@sonicxd2.ru
762e933d7a10fa996fbc0a8f79a8914620582e39
1da7f65b13c49f3bd40d3b54de008ab843338144
/src/main/java/dcdmod/Vfx/Kuuga_SpecialPower.java
95206c0c9958106c0aeb1fd0e7d3da28fc370c37
[]
no_license
q541257877/KR-DCD
dac71e21d0b600b556b4778e338e59162db9f6f6
5299af610f484d878687baef0d5343f99d153223
refs/heads/master
2022-02-14T15:22:19.731095
2019-08-13T13:27:25
2019-08-13T13:27:25
197,047,158
0
2
null
2019-07-23T14:37:34
2019-07-15T17:56:24
Java
UTF-8
Java
false
false
1,505
java
package dcdmod.Vfx; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.megacrit.cardcrawl.core.AbstractCreature; import com.megacrit.cardcrawl.vfx.AbstractGameEffect; import dcdmod.Patches.AbstractAnimation; public class Kuuga_SpecialPower extends AbstractGameEffect { private final String id; private boolean start = true; private AbstractCreature target; public static int x; public Kuuga_SpecialPower(AbstractCreature target) { this.duration = 0.96F;//倒数时间 this.startingDuration = 0.96F;//持续时间 this.target = target; this.id = "kuuga_SpecialPower" + x; } public void update() { this.duration -= Gdx.graphics.getDeltaTime(); if(this.duration < this.startingDuration && start) { x += 1; String KUUGA_ATTACKED_ATLAS = "img/char/DCD_Animation/kuuga/FAR/Kuuga_SpecialPower.atlas"; String KUUGA_ATTACKED_JSON = "img/char/DCD_Animation/kuuga/FAR/Kuuga_SpecialPower.json"; new AbstractAnimation(this.id, KUUGA_ATTACKED_ATLAS, KUUGA_ATTACKED_JSON, 0.8f, this.target.drawX, this.target.drawY + this.target.hb_h/2, this.target.hb_w, this.target.hb_h, 1.0f); AbstractAnimation kuuga_attacked = AbstractAnimation.getAnimation(this.id); kuuga_attacked.setMovable(false); kuuga_attacked.state.setAnimation(0, "normal", true); start = false; } if (this.duration < 0.0F) { AbstractAnimation.clear(this.id); this.isDone = true; } } public void render(SpriteBatch sb) { } public void dispose() { } }
[ "541257877@qq.com" ]
541257877@qq.com
e4d3c913eae17e108e3c199a49d8cfc47085aa42
51205cf9affa6ba78871e1358a865552b641e06c
/src/main/java/com/fsggs/server/models/game/maps/IGalaxyEntity.java
6be0f1ba19cc27aad5020be6b0aafd0fd0ca50ba
[]
no_license
fsggs/fsggs.server
aec35f4b04b3f5786497ee3f68eba90caee8d63f
baf0eddada3a40ac4df7734644ba69d2a2af0566
refs/heads/master
2020-12-10T21:55:26.849827
2017-05-05T14:42:00
2017-05-05T14:42:43
49,297,483
0
0
null
null
null
null
UTF-8
Java
false
false
79
java
package com.fsggs.server.models.game.maps; public interface IGalaxyEntity { }
[ "devinterx@gmail.com" ]
devinterx@gmail.com
8966f096e9d949ca52a54c8e2a233e1485b15f16
be73270af6be0a811bca4f1710dc6a038e4a8fd2
/crash-reproduction-moho/results/MATH-95b-3-29-NSGA_II-LineCoverage:ExceptionType:StackTraceSimilarity/org/apache/commons/math/distribution/AbstractContinuousDistribution_ESTest_scaffolding.java
07f7c58a53ee5206079b6aa6df44b556ce524029
[]
no_license
STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application
cf118b23ecb87a8bf59643e42f7556b521d1f754
3bb39683f9c343b8ec94890a00b8f260d158dfe3
refs/heads/master
2022-07-29T14:44:00.774547
2020-08-10T15:14:49
2020-08-10T15:14:49
285,804,495
0
0
null
null
null
null
UTF-8
Java
false
false
2,725
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Mon Apr 06 08:00:20 UTC 2020 */ package org.apache.commons.math.distribution; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; @EvoSuiteClassExclude public class AbstractContinuousDistribution_ESTest_scaffolding { @org.junit.Rule public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); @BeforeClass public static void initEvoSuiteFramework() { org.evosuite.runtime.RuntimeSettings.className = "org.apache.commons.math.distribution.AbstractContinuousDistribution"; org.evosuite.runtime.GuiSupport.initialize(); org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; org.evosuite.runtime.Runtime.getInstance().resetRuntime(); } @Before public void initTestCase(){ threadStopper.storeCurrentThreads(); threadStopper.startRecordingTime(); org.evosuite.runtime.GuiSupport.setHeadless(); org.evosuite.runtime.Runtime.getInstance().resetRuntime(); org.evosuite.runtime.agent.InstrumentingAgent.activate(); } @After public void doneWithTestCase(){ threadStopper.killAndJoinClientThreads(); org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); } private static void initializeClasses() { org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(AbstractContinuousDistribution_ESTest_scaffolding.class.getClassLoader() , "org.apache.commons.math.distribution.AbstractContinuousDistribution", "org.apache.commons.math.FunctionEvaluationException", "org.apache.commons.math.analysis.UnivariateRealFunction", "org.apache.commons.math.distribution.FDistributionImpl", "org.apache.commons.math.MathException", "org.apache.commons.math.analysis.UnivariateRealSolverUtils", "org.apache.commons.math.distribution.ContinuousDistribution", "org.apache.commons.math.distribution.FDistribution", "org.apache.commons.math.distribution.Distribution", "org.apache.commons.math.distribution.AbstractDistribution", "org.apache.commons.math.ConvergenceException", "org.apache.commons.math.distribution.AbstractContinuousDistribution$1" ); } }
[ "pouria.derakhshanfar@gmail.com" ]
pouria.derakhshanfar@gmail.com
3a54393e315971174dc1c37ac3c57963bac606a8
84953b4cf92381936b78517c6b12687182e94071
/src/mefju/testswt/TestWindow.java
0384988fd332ee1fdc7af9813eeea1bc06e0d07c
[]
no_license
mefju7/testSwt
c49b070ec80c07021e0207538121de1ae58cfb8d
6371482f9b5da0fd7264220a3e0f0e98dd08f1b9
refs/heads/master
2020-05-18T01:41:34.953488
2015-04-15T11:40:56
2015-04-15T11:40:56
32,989,504
0
0
null
2015-04-10T12:47:58
2015-03-27T14:06:37
Java
UTF-8
Java
false
false
2,330
java
package mefju.testswt; import mefju.testswt.data.GeoM2TConverter; import mefju.testswt.data.GeoT2MConverter; import org.eclipse.core.databinding.DataBindingContext; import org.eclipse.core.databinding.UpdateValueStrategy; import org.eclipse.core.databinding.beans.PojoProperties; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; public class TestWindow extends Shell { @SuppressWarnings("unused") private DataBindingContext m_bindingContext; private TestData myData; private Text firstTextTrial; private Text geoText; public TestWindow(Display display) throws Exception { super(display, SWT.SHELL_TRIM); myData=new TestData(); if(myData==null) { System.out.println("something very wrong 2015-04-07/1"); throw new Exception("no data"); } setSize(800, 600); setLayout(null); firstTextTrial = new Text(this, SWT.BORDER); firstTextTrial.setBounds(68, 62, 264, 36); geoText = new Text(this, SWT.BORDER); geoText.setBounds(66, 128, 406, 21); m_bindingContext = initDataBindings(); } @Override protected void checkSubclass() { // Disable the check that prevents subclassing of SWT components } protected DataBindingContext initDataBindings() { DataBindingContext bindingContext = new DataBindingContext(); // IObservableValue observeTextTextObserveWidget = WidgetProperties.text(SWT.Modify).observe(firstTextTrial); IObservableValue nameDataObserveValue = PojoProperties.value("name").observe(myData); bindingContext.bindValue(observeTextTextObserveWidget, nameDataObserveValue, null, null); // IObservableValue observeTextGeoTextObserveWidget = WidgetProperties.text(SWT.Modify).observe(geoText); IObservableValue wpMyDataObserveValue = PojoProperties.value("wp").observe(myData); UpdateValueStrategy geot2m = new UpdateValueStrategy(); geot2m.setConverter(new GeoT2MConverter()); UpdateValueStrategy geom2t = new UpdateValueStrategy(); geom2t.setConverter(new GeoM2TConverter()); bindingContext.bindValue(observeTextGeoTextObserveWidget, wpMyDataObserveValue, geot2m, geom2t); // return bindingContext; } }
[ "matthias.nowak@marintek.sintef.no" ]
matthias.nowak@marintek.sintef.no
f444329bcd8d1fd901b7e657562054280fd6339b
99f164e96e13db29deef720de9fa4ce0bd114c62
/mediatek/packages/apps/MediatekDM/src/com/mediatek/mediatekdm/mdm/SimpleHttpConnection.java
65e10c126e2d460dc59c8f1c1adc50664b758cb0
[]
no_license
GrapheneCt/android_kernel_zte_run4g_mod
75bb5092273ba4cd75d10f3fa09968853a822300
fbba1d6727878b70954cc4186a7b30504527cd20
refs/heads/master
2020-09-07T14:50:54.230550
2019-11-10T16:37:19
2019-11-10T16:37:19
220,814,914
0
0
null
2019-11-10T16:11:22
2019-11-10T16:11:22
null
UTF-8
Java
false
false
12,597
java
package com.mediatek.mediatekdm.mdm; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.InetSocketAddress; import java.net.MalformedURLException; import java.net.Proxy; import java.net.SocketTimeoutException; import java.net.URL; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSocketFactory; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; public class SimpleHttpConnection implements PLHttpConnection { class CertTrustManager implements X509TrustManager { public void checkClientTrusted(X509Certificate[] arg0, String arg1) { mLogger.logMsg(MdmLogLevel.DEBUG, "[checkClientTrusted] " + arg0 + arg1); } public void checkServerTrusted(X509Certificate[] arg0, String arg1) throws CertificateException { mLogger.logMsg(MdmLogLevel.DEBUG, "[checkServerTrusted] X509Certificate amount:" + arg0.length + ", cryptography: " + arg1); } public X509Certificate[] getAcceptedIssuers() { mLogger.logMsg(MdmLogLevel.DEBUG, "[getAcceptedIssuers] "); return null; } } private HttpURLConnection mConnection; private MdmEngine mEngine; private PLLogger mLogger = null; private Proxy.Type mProxyType = null; private URL mUrl = null; private TrustManager[] mTrustManagerArray = new TrustManager[] { new CertTrustManager() }; public SimpleHttpConnection(MdmEngine engine) { mEngine = engine; mLogger = MdmEngine.getLogger(); } @Override public boolean addRequestProperty(String field, String value) { mLogger.logMsg(MdmLogLevel.DEBUG, "addRequestProperty: " + field + " = " + value); if (mConnection == null) { mLogger.logMsg(MdmLogLevel.ERROR, "AddRequestProperty: mConnection=" + mConnection); return false; } try { mConnection.setRequestProperty(field, value); return true; } catch (IllegalStateException e) { mLogger.logMsg(MdmLogLevel.ERROR, "AddRequestProperty: IllegalStateException"); } catch (NullPointerException e) { mLogger.logMsg(MdmLogLevel.ERROR, "AddRequestProperty: NullPointerException"); } catch (Exception e) { mLogger.logMsg(MdmLogLevel.ERROR, "AddRequestProperty: Exception"); } return false; } @Override public boolean closeComm() { mLogger.logMsg(MdmLogLevel.DEBUG, "closeComm()"); if (mConnection == null) { mLogger.logMsg(MdmLogLevel.ERROR, "closeComm: mConnection=" + mConnection); return false; } mConnection.disconnect(); return true; } @Override public void destroy() { // nothing to do } @Override public int getContentLength() { mLogger.logMsg(MdmLogLevel.DEBUG, "getContentLength()"); if (mConnection == null) { mLogger.logMsg(MdmLogLevel.ERROR, "getContentLength: mConnection=" + mConnection); return -1; } if (!waitResponse()) { mLogger.logMsg(MdmLogLevel.ERROR, "getHeadField: timeout"); return -1; } int length = mConnection.getContentLength(); if (length < 0) { try { /* for chunked ?? */ length = mConnection.getInputStream().available(); } catch (IOException e) { mLogger.logMsg(MdmLogLevel.ERROR, "in.available: IOException " + e.getMessage()); e.printStackTrace(); } } mLogger.logMsg(MdmLogLevel.DEBUG, "getContentLength() return " + length); return length; } @Override public String getHeadField(String field) { mLogger.logMsg(MdmLogLevel.DEBUG, "getHeadField: field=" + field); if (mConnection == null) { mLogger.logMsg(MdmLogLevel.ERROR, "getHeadField: mConnection=" + mConnection); return null; } if (!waitResponse()) { mLogger.logMsg(MdmLogLevel.ERROR, "getHeadField: timeout"); return null; } return mConnection.getHeaderField(field); } @Override public int getHeadFieldInt(String field, int defValue) { mLogger.logMsg(MdmLogLevel.DEBUG, "getHeadFieldInt: field=" + field + " ,defValue=" + defValue); if (mConnection == null) { mLogger.logMsg(MdmLogLevel.ERROR, "getHeadFieldInt: mConnection=" + mConnection); return defValue; } if (!waitResponse()) { mLogger.logMsg(MdmLogLevel.ERROR, "getHeadField: timeout"); return defValue; } return mConnection.getHeaderFieldInt(field, defValue); } @Override public String getURL() { if (mConnection == null) { mLogger.logMsg(MdmLogLevel.ERROR, "getURL: mConnection=" + mConnection); return null; } return mConnection.getURL().toString(); } /** * @param uri * @param proxyType : 0 -- DIRECT, 1 -- PROXY(HTTP??), 2 --SOCKS * @param proxyAddr * @param proxyPort */ public boolean initialize(String uri, int proxyType, String proxyAddr, int proxyPort) { mLogger.logMsg(MdmLogLevel.DEBUG, "initialize: uri=" + uri + ", proxyType=" + proxyType + ", proxyAddr=" + proxyAddr + ", proxyPort=" + proxyPort); try { mUrl = new URL(uri); mLogger.logMsg(MdmLogLevel.DEBUG, "Host is " + mUrl.getHost()); mLogger.logMsg(MdmLogLevel.DEBUG, "Port is " + mUrl.getPort()); } catch (MalformedURLException e) { mLogger.logMsg(MdmLogLevel.ERROR, "SimpleHttpConnection: invalid URL: " + uri); return false; } switch (proxyType) { case 0: mProxyType = Proxy.Type.DIRECT; break; case 1: mProxyType = Proxy.Type.HTTP; break; case 2: mProxyType = Proxy.Type.SOCKS; break; default: return false; } try { if (mProxyType == Proxy.Type.DIRECT) { mConnection = (HttpURLConnection) mUrl.openConnection(); } else { InetSocketAddress addr = new InetSocketAddress(proxyAddr, proxyPort); mConnection = (HttpURLConnection) mUrl.openConnection(new Proxy(mProxyType, addr)); } return true; } catch (IOException e) { mLogger.logMsg(MdmLogLevel.DEBUG, "SimpleHttpConnection: IOException"); e.printStackTrace(); return false; } catch (IllegalArgumentException e) { mLogger.logMsg(MdmLogLevel.DEBUG, "SimpleHttpConnection: IllegalArgumentException"); return false; } catch (UnsupportedOperationException e) { mLogger.logMsg(MdmLogLevel.DEBUG, "SimpleHttpConnection: UnsupportedOperationException"); return false; } } @Override public boolean openComm() { mLogger.logMsg(MdmLogLevel.DEBUG, "openComm()"); if (mConnection == null) { mLogger.logMsg(MdmLogLevel.ERROR, "openComm: mConnection=" + mConnection); return false; } if (mConnection instanceof HttpsURLConnection) { mLogger.logMsg(MdmLogLevel.DEBUG, "openComm(): https connection"); HttpsURLConnection connection = (HttpsURLConnection) mConnection; try { // TODO: Implement HostnameVerifier HostnameVerifier hv = new HostnameVerifier() { public boolean verify(String urlHostName, SSLSession session) { mLogger.logMsg(MdmLogLevel.DEBUG, "verify:" + urlHostName); return true; } }; SSLContext sc = SSLContext.getInstance("TLS"); sc.init(null, mTrustManagerArray, null); SSLSocketFactory sslf = sc.getSocketFactory(); connection.setHostnameVerifier(hv); connection.setSSLSocketFactory(sslf); } catch (Exception e) { mLogger.logMsg(MdmLogLevel.ERROR, "openComm(): https exception!!!"); e.printStackTrace(); } } else { mLogger.logMsg(MdmLogLevel.DEBUG, "openComm(): http connection"); } mConnection.setConnectTimeout(mEngine.getConnectionTimeout() * 1000); mConnection.setReadTimeout(mEngine.getReadTimeout() * 1000); mConnection.setDoOutput(true); mConnection.setDoInput(true); mConnection.setRequestProperty("Accept-Encoding", "identity"); /* general header */ addRequestProperty("Cache-Control", "private"); addRequestProperty("Connection", "close"); addRequestProperty("Accept", "application/vnd.syncml+xml, application/vnd.syncml+wbxml, */*"); addRequestProperty("Accept-Language", "en"); addRequestProperty("Accept-Charset", "utf-8"); return true; } @Override public int recvData(byte[] buffer) { mLogger.logMsg(MdmLogLevel.DEBUG, "recvData: buflen=" + buffer.length); if (mConnection == null) { mLogger.logMsg(MdmLogLevel.ERROR, "recvData: mConnection=" + mConnection); return -1; } try { InputStream in = mConnection.getInputStream(); int ret = in.read(buffer); return ret; } catch (SocketTimeoutException e) { mLogger.logMsg(MdmLogLevel.ERROR, "recvData: SocketTimeoutException!!"); } catch (IOException e) { mLogger.logMsg(MdmLogLevel.ERROR, "recvData: IOException!!"); } return -1; } @Override public int sendData(byte[] data) { mLogger.logMsg(MdmLogLevel.DEBUG, "sendData: len=" + data.length); if (mConnection == null) { mLogger.logMsg(MdmLogLevel.ERROR, "sendData: mConnection=" + mConnection); return -1; } addRequestProperty("Content-Length", String.valueOf(data.length)); try { OutputStream out = mConnection.getOutputStream(); out.write(data, 0, data.length); out.flush(); } catch (IOException e) { mLogger.logMsg(MdmLogLevel.ERROR, "sendData IOException: " + e); mLogger.logMsg(MdmLogLevel.ERROR, "Message: " + e.getMessage()); mLogger.logMsg(MdmLogLevel.ERROR, "Cause: " + e.getCause()); e.printStackTrace(); return -1; } catch (IndexOutOfBoundsException e) { mLogger.logMsg(MdmLogLevel.ERROR, "sendData: IndexOutOfBoundsException!!"); return -1; } mLogger.logMsg(MdmLogLevel.DEBUG, "sendData: return " + data.length); return data.length; } private boolean waitResponse() { InputStream is = null; byte[] buf = new byte[8192]; ByteArrayOutputStream bos = new ByteArrayOutputStream(); boolean debug = true; try { mLogger.logMsg(MdmLogLevel.DEBUG, "waitResponse: enterring getInputStream..."); mConnection.getInputStream(); return true; } catch (IOException e) { mLogger.logMsg(MdmLogLevel.ERROR, "waitResponse: IOException"); e.printStackTrace(); } if (debug) { is = mConnection.getErrorStream(); try { while (true) { int rd = is.read(buf, 0, 8192); if (rd == -1) { break; } bos.write(buf, 0, rd); } } catch (IOException e) { mLogger.logMsg(MdmLogLevel.ERROR, "is.read: IOException"); e.printStackTrace(); } String responseDump = new String(buf); mLogger.logMsg(MdmLogLevel.DEBUG, "waitResponse: " + responseDump); } return false; } }
[ "danile71@gmail.com" ]
danile71@gmail.com
d3afe10f5516f347c05c22382528386816bf7655
ea54e519f86aca5b45f2b879b7181f49f412335a
/org.eclipse.swtbot.swt.recorder/src/org/eclipse/swtbot/swt/recorder/methodargs/NullArgument.java
444bb04f6becb57afb9d69834267b2a304c14b47
[]
no_license
speedracer-zz/swtbot
d1204ddc8f1b7452a0b42e0ffd2f4c22d4e88518
9d9a06e8384fc29fa4bd760eff64628d550a9263
refs/heads/master
2021-05-29T13:31:36.611055
2009-11-16T15:20:53
2009-11-16T15:20:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
859
java
/******************************************************************************* * Copyright (c) 2008 Ketan Padegaonkar and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Ketan Padegaonkar - initial API and implementation *******************************************************************************/ package org.eclipse.swtbot.swt.recorder.methodargs; /** * Represents a 'no arg' argument. * * @author Ketan Padegaonkar &lt;KetanPadegaonkar [at] gmail [dot] com&gt; * @version $Id$ */ public class NullArgument extends AbstractSWTBotEventArguments { public String asString() { return ""; //$NON-NLS-1$ } }
[ "ketanpadegaonkar@gmail.com" ]
ketanpadegaonkar@gmail.com
a441733bc66726bebb0fd91457b4b1389dc6bcf2
a33aac97878b2cb15677be26e308cbc46e2862d2
/data/libgdx/ParticleShader_getDefaultDepthFunc.java
bc13f18e3620d9f097d10c73e9ea27f5b7054f41
[]
no_license
GabeOchieng/ggnn.tensorflow
f5d7d0bca52258336fc12c9de6ae38223f28f786
7c62c0e8427bea6c8bec2cebf157b6f1ea70a213
refs/heads/master
2022-05-30T11:17:42.278048
2020-05-02T11:33:31
2020-05-02T11:33:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
122
java
public int getDefaultDepthFunc() { return config.defaultDepthFunc == -1 ? GL20.GL_LEQUAL : config.defaultDepthFunc; }
[ "bdqnghi@gmail.com" ]
bdqnghi@gmail.com
3c71bb40f89eaa95425444e8f726542c66d17077
0f998b982477b5e8c56d4560e7db368673af966b
/src/main/AudioBuffer.java
2ef17778c744e80cd8562db2860412dd3662f284
[]
no_license
hlwgroups/RuneScape-MIDI-Player-Suite
2cc49ee30f1b8fc22b541f0403996aa51d4d9f59
6612a77458ab69f4212a38f8fcbdd701b458ad6c
refs/heads/master
2022-04-12T08:51:27.541628
2020-02-09T20:07:41
2020-02-09T20:07:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,125
java
package main; public class AudioBuffer extends AbstractSound { public int sampleRate; public byte[] samples; public int start; public int end; boolean bool; AudioBuffer(int sRate, byte[] data, int loopStart, int loopEnd) { sampleRate = sRate; samples = data; start = loopStart; end = loopEnd; } AudioBuffer(int sRate, byte[] data, int loopStart, int loopEnd, boolean effect) { sampleRate = sRate; samples = data; start = loopStart; end = loopEnd; bool = effect; } public AudioBuffer resample(Resampler resampler) { this.samples = resampler.resample(this.samples); this.sampleRate = resampler.scaleRate(this.sampleRate); if(this.start == this.end) { this.start = this.end = resampler.scalePosition(this.start); } else { this.start = resampler.scalePosition(this.start); this.end = resampler.scalePosition(this.end); if(this.start == this.end) { --this.start; } } return this; } }
[ "lequietriot@gmail.com" ]
lequietriot@gmail.com
28730ad4506d57eef6d7eb81d1f309f56495710b
4128ce16aa95ff6aca24a42f081e2227c2c67143
/app/src/test/java/com/xoroc/rubydoc/ExampleUnitTest.java
990b7345fe7feda41404c66714151378bfe00410
[]
no_license
ahmadhasankhan/RubyAndRailsOfficialGuide
78b4c3caf204031dfac3536c547ce49804906903
ea49afb4d2223f9190e4776bf442a1c81846b791
refs/heads/master
2021-01-01T19:48:44.006017
2017-07-28T23:14:44
2017-07-28T23:14:44
98,694,752
0
0
null
null
null
null
UTF-8
Java
false
false
395
java
package com.xoroc.rubydoc; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "er.ahmad.hassan@gmail.com" ]
er.ahmad.hassan@gmail.com
441305dbd1950ee1083dc56b4823f7737de9f5c8
7ffbe1e21a04fcc3b2bcf8161a637d8ee25316cb
/src/com/meisi/bean/Appointment.java
feff4fd96536a467b6bd4e219126bf0bda227540
[]
no_license
ryq506587454/meisi_web
a8538f190c458d7fcd46e502107cb3c1a36b96af
875be1254a69dacf1c0d3e085f46f23c2d2b01aa
refs/heads/master
2021-07-24T05:52:55.633402
2020-04-03T09:04:04
2020-04-03T09:04:04
131,591,248
0
0
null
null
null
null
UTF-8
Java
false
false
996
java
package com.meisi.bean; /* * 预约记录表 */ import java.util.Date; import com.meisi.bean.User; public class Appointment { private int apptId; //约课记录ID private Date courseTime; //开课时间 private String courseName; //课程名称 private long courseDuration; //课程时长 private User user; //本课用户 public int getApptId() { return apptId; } public void setApptId(int apptId) { this.apptId = apptId; } public Date getCourseTime() { return courseTime; } public void setCourseTime(Date courseTime) { this.courseTime = courseTime; } public String getCourseName() { return courseName; } public void setCourseName(String courseName) { this.courseName = courseName; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } public long getCourseDuration() { return courseDuration; } public void setCourseDuration(long courseDuration) { this.courseDuration = courseDuration; } }
[ "506587454@qq.com" ]
506587454@qq.com
cc1c9c09558d0f3a6fcea871e76729beded8a576
394c8a769ce9a87012e66d1bef68457f34a6afee
/src/main/java/com/yandan/demo/service/SignTimesWorkService.java
17d662ed04d41f5e1c6d619f5e4f2fdc118de3e0
[]
no_license
YD-chen-min/daleme
5ef9962a63b53adc90375feba755eb8d15da9f1c
5f47b9a8e8f5e67ce796a91cda65f55f5403928a
refs/heads/master
2023-03-24T12:54:45.054917
2021-03-21T03:14:10
2021-03-21T03:14:10
349,083,784
1
1
null
null
null
null
UTF-8
Java
false
false
1,621
java
package com.yandan.demo.service; import com.yandan.demo.VO.SignTimesWorkVO; import com.yandan.demo.dataobject.DaySignTimesWork; import com.yandan.demo.dataobject.SignTimesWork; import com.yandan.demo.dataobject.WorkInfo; import com.yandan.demo.exception.ApiException; import java.util.List; /** * Create by yandan * 2020/11/19 23:09 */ public interface SignTimesWorkService { /** * 添加一条记录 * @param signTimesWork * @return */ SignTimesWork addSignTimesWork(SignTimesWork signTimesWork) throws ApiException; /** * 根据员工列表添加记录 * @param workInfoList * @return */ List<SignTimesWork> addByWorkInfo(List<WorkInfo> workInfoList) throws ApiException; /** * 根据员工每日打卡次数更新数据(属于同一部门的) * @param daySignTimesWorkList * @return */ List<SignTimesWork> updateByDaySignTimesWork(List<DaySignTimesWork> daySignTimesWorkList) throws ApiException; /** * 获取所有数据 * @return */ List<SignTimesWork> getAll(); /** * 通过部门id获取列表 * @param departmentId * @return */ List<SignTimesWork> getByDepartmentId(String departmentId); /** * signTimeWork列表 转 signTimeWorkVO 列表 * @param signTimesWorkList * @return */ List<SignTimesWorkVO> signTimesWork2SignTimesWorkVO(List<SignTimesWork> signTimesWorkList); /** * 根据员工信息添加记录 * @param workInfo * @return */ SignTimesWork addByWorkInfo(WorkInfo workInfo) throws ApiException; }
[ "2862409435@qq.com" ]
2862409435@qq.com
94c3b41995538ef95d68541f94e6d0b06add4850
c8b4a7d2cf450517ad0b539dbc969204b73f75b2
/Android学习Demo/AnimatorPro/app/src/main/java/com/example/chunyu/animatorpro/MainActivity.java
2bcbb453fac045a66c02981b468822774916c15d
[]
no_license
KingChunYu/Java_Learning
5b051c6adcfd4872ed4091bad4ae99ae728fe5f7
d48b6783309f6a704163b3d66ac936787f2a1168
refs/heads/master
2021-01-10T16:44:05.274042
2016-11-30T01:47:05
2016-11-30T01:47:05
47,482,810
3
0
null
null
null
null
UTF-8
Java
false
false
886
java
package com.example.chunyu.animatorpro; import android.animation.ValueAnimator; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.TextView; public class MainActivity extends AppCompatActivity { TextView textView; MyAnimView myAnimView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // textView = (TextView)findViewById(R.id.myTextView); myAnimView = (MyAnimView)findViewById(R.id.myAnimView); myAnimView.startAnimation(); } void animatorWithObjectEvaluator(TextView textView) { Point p1 = new Point(0, 0); Point p2 = new Point(300, 300); ValueAnimator anim = ValueAnimator.ofObject(new PointEvaluator(), p1, p2); anim.setDuration(5000); } }
[ "jcy23401@163.com" ]
jcy23401@163.com
d3de051c2f1e0cab5a8fa9ecd6047be59fe5ccdb
f73edf666ae80ebc5a94a32bc19a107683ba43b1
/caracteristicas-java/src/main/java/br/com/moreiravictor/classes/exercicio/Supervisor.java
e63a5200067f9c6326b2df147cfff2a230a100da
[]
no_license
victorsmoreira/java
a7220c55cec46fc9c82dbe3e5d0db777bce97872
79463ef5d75dd9174d73ace58e74615ecee76450
refs/heads/main
2023-03-29T06:40:02.760628
2021-04-07T00:51:40
2021-04-07T00:51:40
352,827,261
0
0
null
2021-04-07T00:51:41
2021-03-30T00:55:08
Java
UTF-8
Java
false
false
294
java
package br.com.moreiravictor.classes.exercicio; public class Supervisor extends Funcionario{ public Supervisor(Double salario){ super(); } public Supervisor(){ } public Double calculaImposto(){ return this.getSalario()*0.05; } }
[ "victorsmoreira@outlook.com" ]
victorsmoreira@outlook.com
5691ef507fc7ff45ef0e9be324c52c59846418d1
b5dfc00b5b1924494dfbb2de9e4ddc87e2983686
/LGCameraApp/java/com/lge/camera/listeners/CameraAutoFocusOnCafCallback.java
ed1bffcc25ada29295aa5acb838ffbe071e504f7
[]
no_license
nikich340/LGCamera
cb8c9fdc27a17d5814ea123039d9f8463bbb60bd
f73337f78389e14590519a42f05697fc2812cd4c
refs/heads/master
2021-05-30T18:15:51.969765
2016-01-11T11:58:29
2016-01-11T11:58:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
728
java
package com.lge.camera.listeners; import android.hardware.Camera; import android.hardware.Camera.AutoFocusCallback; public class CameraAutoFocusOnCafCallback implements AutoFocusCallback { private CameraAutoFocusOnCafCallbackFunction mGet; public interface CameraAutoFocusOnCafCallbackFunction { void callbackAutoFocusOnCaf(boolean z, Camera camera); } public CameraAutoFocusOnCafCallback(CameraAutoFocusOnCafCallbackFunction function) { this.mGet = null; this.mGet = function; } public void onAutoFocus(boolean success, Camera camera) { if (this.mGet != null) { this.mGet.callbackAutoFocusOnCaf(success, camera); } } }
[ "nikich340@gmail.com" ]
nikich340@gmail.com
fccfe19fdee22f379cb20d190e08d53a2e1fbbb2
6694991fd7e963b8df9c1a798a1e50fdba8bacef
/app/src/main/java/victor/cominotti/channelmessaging/AdapterChannel.java
038d3e5cf1cdab5a58707c8c6df4ed376f4f0e30
[]
no_license
VictorCo/ChannelMessaging
45145fa4c27bbe7e8a011846093365a3ace80a99
c1d919ee890dcbff087a82adb1a5706296dd1a74
refs/heads/master
2020-05-20T17:57:49.627619
2017-03-09T23:27:36
2017-03-09T23:27:36
84,498,282
0
0
null
null
null
null
UTF-8
Java
false
false
1,418
java
package victor.cominotti.channelmessaging; import android.content.Context; import android.support.annotation.NonNull; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import java.lang.reflect.Array; import java.util.ArrayList; /** * Created by Victor Cominotti on 16/02/2017. */ public class AdapterChannel extends ArrayAdapter<WebServiceChannel> { private final Context context; private ArrayList<WebServiceChannel> wsc; public AdapterChannel(Context context, ArrayList<WebServiceChannel> wsc){ super(context,R.layout.showchannel, wsc); this.context = context; this.wsc = wsc; } @Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View rowView = inflater.inflate(R.layout.showchannel, parent, false); TextView txtVChannelNumber = (TextView)rowView.findViewById(R.id.txtVChannelNumber); txtVChannelNumber.setText("Channel " + wsc.get(position).channelID); TextView txtVNumberUsers = (TextView)rowView.findViewById(R.id.txtVNumberUsers); txtVNumberUsers.setText("Nombre d'utilisateurs connectés : " + wsc.get(position).connectedusers); return rowView; } }
[ "cominotti.victor@gmail.com" ]
cominotti.victor@gmail.com
2f8e098adf1bd0646f411fb5113baef86db88f70
8278cb2637a3af487f0dd7740fa3b8c03a67419e
/01_JavaFundamentals/Arrays/Assignment2.java
507227105a92f1a855fd0210f1305098b83a0349
[]
no_license
tukykarmakar/WIPRO_PJP_Java
6e825316dcd3d1b3f240368636ba9ed70025d997
1ffff799deec2f4eb26f4f4f854ca1225ff56d6c
refs/heads/master
2021-05-26T10:15:06.895477
2020-04-10T15:09:24
2020-04-10T15:09:24
254,092,088
0
0
null
null
null
null
UTF-8
Java
false
false
434
java
class Assignment2 { public static void main(String args[]) { int array[] = {1, 2, 3, 4, 5}; int i, max = array[0], min = max; for (i = 0; i < array.length; i++) { if (max < array[i]) max = array[i]; if (min > array[i]) min = array[i]; } System.out.println("The maximum of the elements in the array is " + max); System.out.println("The minimum of the elements in the array is " + min); } }
[ "noreply@github.com" ]
noreply@github.com
6cc3ca919e314f3775b86728f70e9862ca1eac83
d0e161e55c6ad81664ee4db1078d4a648e377b1b
/ebi/components/exist-db/src/main/java/org/exist/indexing/IndexWorker.java
5598d65a77b1463ce4fedfb103f11fc619429bd4
[ "Apache-2.0" ]
permissive
ktisha/archive
9b5b391d9c564fadf943f319487af772141c5b92
9b4cbf73429019da6111f7a630cbc0c2c5e6d6f4
refs/heads/master
2021-01-18T14:58:05.413232
2015-03-19T14:41:16
2015-03-19T14:41:16
32,526,780
0
0
null
null
null
null
UTF-8
Java
false
false
8,722
java
/* * eXist Open Source Native XML Database * Copyright (C) 2001-07 The eXist Project * http://exist-db.org * * This program 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 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 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * $Id$ */ package org.exist.indexing; import org.exist.collections.Collection; import org.exist.dom.DocumentImpl; import org.exist.dom.DocumentSet; import org.exist.dom.NodeProxy; import org.exist.dom.NodeSet; import org.exist.dom.StoredNode; import org.exist.storage.DBBroker; import org.exist.storage.NodePath; import org.exist.util.DatabaseConfigurationException; import org.exist.util.Occurrences; import org.exist.xquery.XQueryContext; import org.w3c.dom.NodeList; import java.util.Map; /** * Provide concurrent access to the index structure. Implements the core operations on the index. * The methods in this class are used in a multi-threaded environment. Every thread accessing the * database will have exactly one IndexWorker for every index. {@link org.exist.indexing.Index#getWorker(DBBroker)} * should thus return a new IndexWorker whenever it is called. Implementations of IndexWorker have * to take care of synchronizing access to shared resources. */ public interface IndexWorker { /** * A key to a QName {@link java.util.List} "hint" to be used when the index scans its index entries */ public static final String VALUE_COUNT = "value_count"; /** * Returns an ID which uniquely identifies this worker's index. * @return a unique name identifying this worker's index. */ public String getIndexId(); /** * Returns a name which uniquely identifies this worker's index. * @return a unique name identifying this worker's index. */ public String getIndexName(); /** * Read an index configuration from an collection.xconf configuration document. * * This method is called by the {@link org.exist.collections.CollectionConfiguration} while * reading the collection.xconf configuration file for a given collection. The configNodes * parameter lists all top-level child nodes below the &lt;index&gt; element in the * collection.xconf. The IndexWorker should scan this list and handle those elements * it understands. * * The returned Object will be stored in the collection configuration structure associated * with each collection. It can later be retrieved from the collection configuration, e.g. to * check if a given node should be indexed or not. * * @param configNodes lists the top-level child nodes below the &lt;index&gt; element in collection.xconf * @param namespaces the active prefix/namespace map * @return an arbitrary configuration object to be kept for this index in the collection configuration * @throws DatabaseConfigurationException if a configuration error occurs */ Object configure(IndexController controller, NodeList configNodes, Map namespaces) throws DatabaseConfigurationException; /** * Notify this worker to operate on the specified document. * * @param doc the document which is processed */ void setDocument(DocumentImpl doc); /** * Notify this worker to operate on the specified document, using the mode * given. Mode will be one of {@link StreamListener#UNKNOWN}, {@link StreamListener#STORE}, * {@link StreamListener#REMOVE_SOME_NODES} or {@link StreamListener#REMOVE_ALL_NODES}. * * @param doc the document which is processed * @param mode the current operation mode */ void setDocument(DocumentImpl doc, int mode); /** * Notify this worker to operate using the mode * given. Mode will be one of {@link StreamListener#UNKNOWN}, {@link StreamListener#STORE}, * {@link StreamListener#REMOVE_SOME_NODES} or {@link StreamListener#REMOVE_ALL_NODES}. * * @param mode the current operation mode */ void setMode(int mode); /** * Returns the document for the next operation. * * @return the document */ DocumentImpl getDocument(); /** * Returns the mode for the next operation. * * @return the document */ int getMode(); /** * When adding or removing nodes to or from the document tree, it might become * necessary to reindex some parts of the tree, in particular if indexes are defined * on mixed content nodes. This method will call * {@link IndexWorker#getReindexRoot(org.exist.dom.StoredNode, org.exist.storage.NodePath, boolean)} * on each configured index. It will then return the top-most root. * * @param node the node to be modified. * @param path path the NodePath of the node * @param includeSelf if set to true, the current node itself will be included in the check * @return the top-most root node to be reindexed */ StoredNode getReindexRoot(StoredNode node, NodePath path, boolean includeSelf); /** * Return a stream listener to index the current document in the current mode. * There will never be more than one StreamListener being used per thread, so it is safe * for the implementation to reuse a single StreamListener. * * Parameter mode specifies the type of the current operation. * * @return a StreamListener */ StreamListener getListener(); /** * Returns a {@link org.exist.indexing.MatchListener}, which can be used to filter * (and manipulate) the XML output generated by the serializer when serializing * query results. The method should return null if the implementation is not interested * in receiving serialization events. * * @param proxy the NodeProxy which is being serialized * @return a MatchListener or null if the implementation does not want to receive * serialization events */ MatchListener getMatchListener(DBBroker broker, NodeProxy proxy); /** * Flush the index. This method will be called when indexing a document. The implementation should * immediately process all data it has buffered (if there is any), release as many memory resources * as it can and prepare for being reused for a different job. */ void flush(); /** * Remove all indexes for the given collection, its subcollections and * all resources.. * * @param collection The collection to remove * @param broker The broker that will perform the operation */ void removeCollection(Collection collection, DBBroker broker); /** * Checking index could be delegated to a worker. Use this method to do so. * @param broker The broker that will perform the operation * @return Whether or not the index if in a suitable state */ boolean checkIndex(DBBroker broker); /** * Return <strong>aggregated</strong> (on a document count basis) * index entries for the specified document set. Aggregation can only occur if * the index entries can be compared, i.e. if the index implements * {@link org.exist.indexing.OrderedValuesIndex}, otherwise each entry will be considered * as a single occurence. * @param context * @param docs The documents to which the index entries belong * @param contextSet * @param hints Some "hints" for retrieving the index entries. See such hints in * {@link org.exist.indexing.OrderedValuesIndex} and {@link org.exist.indexing.QNamedKeysIndex}. * @return Occurrences objects that contain : * <ol> * <li>a <strong>string</strong> representation of the index entry. This may change in the future.</li> * <li>the number of occurrences for the index entry over all the documents</li> * <li>the list of the documents in which the index entry is</li> * </ol> */ public Occurrences[] scanIndex(XQueryContext context, DocumentSet docs, NodeSet contextSet, Map hints); //TODO : a scanIndex() method that would return an unaggregated list of index entries ? }
[ "Ekaterina.Tuzova@jetbrains.com" ]
Ekaterina.Tuzova@jetbrains.com
74862a70f91d73296183b6d869bb4fb91643b9eb
ab8fd9092bca902811f85cd5b145e8b0d3455b80
/src/com/version1/socialswaysim/PolynomialRegressionMoorePenrose.java
11efdd8c08aa8442bf12beee467c84c1ac5f1ce3
[]
no_license
jarvis11/SocialSwaySimulation
a0b7f5ce2e62638497488e3f5ff69891e1e711c9
e0a08494f83eb93c2fd4b3a11851cc1d3f77d95c
refs/heads/master
2021-01-19T07:50:27.562410
2014-01-21T19:40:41
2014-01-21T19:40:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
15,431
java
package com.version1.socialswaysim; import Jama.Matrix; /** * Created by bhaskarravi on 12/9/13. * Confidential property of SocialSway. All rights reserved. * * The following class uses the Moore-Penrose pseudo inverse to calculate the coefficients of a polynomial regression * to the nth degree. This polynomial regression can then be trained to fit Facebook bidding data in order to accurately * predict bid type and amount during a given time T for a Facebook AdGroup. */ public class PolynomialRegressionMoorePenrose { private int degree; //degree of Polynomial private Matrix coeffs; //Matrix of Polynomial Coefficients private double SSE; //Sum of Squares due to error private double SST; //Total error sum private double error; //Non r2 standard error /** * Method: PolynomialRegressionMoorePenrose * EXECUTION OF A POLYNOMIAL REGRESSION USING THE MOORE PENROSE METHOD * finds coefficient matrix for the appropriate data set using the formula: * [coeffs] = PseudoInv(x) * y * @param x - vector of the independent variable * @param y - vector of the dependent variable with intent to predict * @param degree - degree of the fitted polynomial */ public PolynomialRegressionMoorePenrose(double[] x, double[] y, int degree) { this.degree = degree; //Create matrices out of x and y vectors using Jama Matrix xM = createXMatrix(x); Matrix yM = createYMatrix(y); //MoorePenrose formula: PseudoInv(x) * y = w, w being a vector of weights Matrix A = getPseudoInverse(xM); coeffs = A.times(yM); //CALCULATE VARIABLES NEEDED TO DETERMINE R2 //FIT CALCULATION USING COEFF OF DETERMINATION double sum = 0.0; for(int i = 0; i < x.length; i++){ sum += y[i]; } double mean = sum / x.length; for(int i = 0; i < x.length; i++){ double dev = y[i] - mean; SST += dev*dev; //Calculate total total squared deviation from mean } //Sum of squares due to error calculation Matrix residuals = xM.times(coeffs).minus(yM); SSE = residuals.norm2() * residuals.norm2(); //error calculation using standard in-sample error for validation purposes for(int i = 0; i < x.length; i++){ error += Math.pow((y[i] - predict(x[i])),2) / x.length; } } /** * Method: createXMatrix * converts x-data array into matrix form * @param x - vector of the independent variable * @return - Matrix representation of the independent variable */ public Matrix createXMatrix(double[] x){ //INIT X MATRIX (a row for each x value X the number of terms in the polynomial) Matrix xMatrix = new Matrix(x.length, degree + 1); //comb through all x values for(int i = 0; i < x.length; i++){ //for each x value create a point vector double[] pointVector = getXPointVector(x[i]); for(int j = 0; j < pointVector.length; j++){ //distribute each x vector into the respective row of the xMatrix xMatrix.set(i, j, pointVector[j]); } } //matrix of each x value taken out to polynomial degree in the form 1, x, x^2, ... return xMatrix; } /** * Method: createYMatrix * converts y-data array into matrix form for compatibility with Jama * @param y - vector of the dependent variable with intent to predict * @return - Matrix representation of the dependent variable */ public Matrix createYMatrix(double[] y){ // n x 1 Matrix of all y values Matrix yMatrix = new Matrix(y.length, 1); for(int i = 0; i < y.length; i++){ yMatrix.set(i, 0, y[i]); } return yMatrix; } /** * Method: getPseudoInverse * finds the pseudoinverse of a given Matrix x * @param x - Matrix who's pseudoinverse is to be calculated * @return - The pseudoinverse of X */ //Finds and returns pseudoinverse of a given matrix x public Matrix getPseudoInverse(Matrix x){ //compute and return pseudo-inverse of input matrix x if(x.getRowDimension() == x.getColumnDimension()){ // if x is a square matrix, Jama's inverse method takes the standard inverse of the Matrix // return the formula to calculate the pseudoinverse of the matrix return (((x.transpose()).times(x)).inverse()).times(x.transpose()); } else{ //if x is not a square matrix, Jama's inverse method returns the pseudoinverse of the Matrix return x.inverse(); } } /** * Method: getXPointVector * returns the x vector at a given point x * @param x - A single point x from the set x[] * @return - Weighted vector at the given point x */ public double[] getXPointVector(double x){ double[] xVector = new double[degree + 1]; for (int i = 0; i <= degree; i++){ //x vector takes the form of [x^0, x^1, ..., x^degree] xVector[i] = Math.pow(x, i); } return xVector; } /** * Method: getCoeffs * returns a value of the coefficient matrix formed through the MP regression * @param index - index of coefficient matrix * @return - coefficient at index index */ public double getCoeffs(int index){ return coeffs.get(index,0); } /** * Method: getDegree * @return - degree of polynomial */ public int getDegree(){ return degree; } /** * Method: predict * predicts the y value for a given x value * @param x - point at which to predict value of polynomial * @return - value y at a given point x */ public double predict(double x){ double y = 0.0; //calculate xVector at a given point x double[] xVector = getXPointVector(x); //plug x and corresponding weights into polynomial to find y for(int j = degree; j >= 0; j--){ y += getCoeffs(j) * xVector[j]; } return y; } /** * Method: getR2 * calculates Coefficient of Determination to determine polynomial fit * @return - r2 value */ public double getR2() { return 1.0 - SSE/SST; } /** * Method: getError * @return - standard error of polynomial */ public double getError(){ return error; } /** * Method: toString * Override of java toString method in order to print out polynomial */ public String toString() { String s = ""; int j = degree; while(Math.abs(getCoeffs(j)) < 1E-5){ j--; } for(j = degree; j >=0; j--){ if(j== 0) { s += String.format("%.2f ", getCoeffs(j)); } else if (j==1){ s += String.format("%.2f N + ", getCoeffs(j)); } else { s+= String.format("%.2f N^%d + ", getCoeffs(j), j); } } return s+ " (R^2 = " + String.format("%.3f", getR2()) + ")"; } /** * * * * MULTI DIMENSIONAL POLYNOMIAL REGRESSION * The following section adapts the: * * getXPointVector * createXMatrix * predict * PolynomialRegressionMoorePenrose * * methods in order to account for two independent variables entering the regression. * * * METHODS STILL IN ALPHA STAGE -- NOT READY FOR DEPLOYMENT * */ /** * Method: PolynomialRegressionMoorePenrose * @param x1 - first set of independent variables * @param x2 - second set of independent variables * @param y - vector of the dependent variable with intent to predict * @param degree - degree of the fitted polynomial * * Multi-dimension version of regression found above, which can take into account two * independent vectors in order to gain a 3-dimensional polynomial fit for y. */ public PolynomialRegressionMoorePenrose(double[] x1, double[]x2, double[] y, int degree) { this.degree = degree; //Create matrices out of x and y vectors using Jama //xMatrix now takes into account 2 x vectors Matrix xM = createXMatrix(x1, x2); Matrix yM = createYMatrix(y); //MoorePenrose formula: PseudoInv(x) * y = w, w being a vector of weights Matrix A = getPseudoInverse(xM); coeffs = A.times(yM); //FIT CALCULATION USING COEFF OF DETERMINATION double sum = 0.0; for(int i = 0; i < x1.length; i++){ sum += y[i]; } double mean = sum / x1.length; for(int i = 0; i < x1.length; i++){ double dev = y[i] - mean; SST += dev*dev; //Calculate total total squared deviation from mean } //Sum of squares due to error calculation Matrix residuals = xM.times(coeffs).minus(yM); SSE = residuals.norm2() * residuals.norm2(); //error calculation using standard in-sample error for validation purposes for(int i = 0; i < x1.length; i++){ //error takes into account prediction with both x vectors //predict y based on x: {x1, x2} error += Math.pow((y[i] - predict(x1[i], x2[i])),2) / x1.length; } } /** * Method: getXPointVector * @param x1 - independent variable x1 at point: (x1, x2) * @param x2 - independent variable x2 at point: (x1, x2) * @return - returns a vector containing value of points at each index of the multidimensional polynomial * polynomial takes the form: a + bx1 + cx2 + dx1x2 + ex1^2 + fx2^2 ... * * Modification of getXPointVector method to create a polynomial with 3 dimensional structure */ public double[] getXPointVector(double x1, double x2){ double[] xVector = new double[(degree+1)*(degree+2) / 2]; int i; int j; int index; //loop determining all independent x1 terms and adding them to vector for(index = 0; index <= degree; index++) { xVector[index] = Math.pow(x1, index); } //loop determining all independent x2 terms and adding them to vector for(j = 1; j <= degree; j++) { xVector[index] = Math.pow(x2, j); index++; } //loop calculating all dependent x1 and x2 combinations for(i = 1; i < degree; i++) { for(j = 1; j < degree; j++) { if(i+j <= degree){ xVector[index] = Math.pow(x1, i) * Math.pow(x2, j); index++; } } } return xVector; } /** * Method: createXMatrix * @param x1 - first set of independent variables * @param x2 - second set of independent variables * @return - Matrix representation of the independent variable set * * Modification of createXMethod to create a matrix off two x-sets */ public Matrix createXMatrix(double[] x1, double[] x2){ Matrix xMatrix = new Matrix(x1.length, (degree+1)*(degree+2) / 2); //comb through all x values for(int i = 0; i < x1.length; i++){ //for each x value create a point vector double[] pointVector = getXPointVector(x1[i], x2[i]); for(int j = 0; j < pointVector.length; j++){ //distribute each x vector into the respective row of the xMatrix xMatrix.set(i, j, pointVector[j]); } } return xMatrix; } /** * Method: predict * @param x1 - independent variable x1 at point: (x1, x2) * @param x2 - independent variable x2 at point: (x1, x2) * @return - prediction y at point (x1, x2) * * Modification of prediction method to take into account multiple dimensions */ public double predict(double x1, double x2){ double y = 0.0; //calculate xVector at a given point x double[] xVector = getXPointVector(x1, x2); //plug x and corresponding weights into polynomial to find y for(int j = degree; j >= 0; j--){ y += getCoeffs(j) * xVector[j]; } return y; } /** * Method: print2DMatrix * @return - returns a string containing printout of polynomial * */ public String print2DMatrix() { String s = ""; int j = degree; int index; while(Math.abs(getCoeffs(j)) < 1E-5){ j--; } for(index = 1; index <= degree; index++){ if (index==1){ s += String.format("%.2f N1 + ", getCoeffs(index)); } else { s+= String.format("%.2f N1^%d + ", getCoeffs(index), index); } } for(j = 1; j <= degree; j++) { if(j==1){ s += String.format("%.2f N2 + ", getCoeffs(index)); } else { s+= String.format("%.2f N2^%d + ", getCoeffs(index), j); } index++; } for(int i = 1; i < degree; i++ ){ for(j = 1; j < degree; j++ ){ if(i+j <= degree){ if(i == 1 && j != 1){ s+= String.format("%.2f N1 N2^%d + ", getCoeffs(index), j); } else if(j == 1 && i != 1){ s+= String.format("%.2f N1^%d N2 + ", getCoeffs(index), i); } else if(i == 1 && j == 1){ s+= String.format("%.2f N1 N2 + ", getCoeffs(index)); } else{ s+= String.format("%.2f N1^%d N2^%d + ", getCoeffs(index), i, j); } index++; } } } //Add constant to equation s += String.format("%.2f", getCoeffs(0)); return s+ " (R^2 = " + String.format("%.3f", getR2()) + ")"; } /** * * FOR TESTING PURPOSES ONLY * */ public static void main(String[] args) { double[] x1 = { 10, 20, 40, 80, 160, 200 }; double[] x2 = {10, 200, 450, 800, 100, 2000}; double[] y = { 100, 350, 1500, 6700, 20160, 40000 }; double[] CTR = {0.1, 0.057, .027, .012, .00794, .005}; PolynomialRegressionMoorePenrose regression = new PolynomialRegressionMoorePenrose(x1, x2, y, 2); PolynomialRegressionMoorePenrose regression1D = new PolynomialRegressionMoorePenrose(x2, y, 3); PolynomialRegressionMoorePenrose regression3 = new PolynomialRegressionMoorePenrose(x1, y, CTR, 1); System.out.println(regression1D); System.out.println(regression3.print2DMatrix()); System.out.println(regression.predict(40, 450)); // System.out.println(regression3.print2DMatrix()); System.out.println(regression3.predict(80, 6700)); //System.out.println(regression3.print2DMatrix()); // System.out.println(regression); // System.out.println(regression.getDegree()); // System.out.println(regression.predict(200)); } }
[ "bvravi11@gmail.com" ]
bvravi11@gmail.com
0d5c7162c94fcd8dc9b7b898db77a5ed6d5a95bc
15d425f7c7eeeef732fdfe249c10b771ee6a342c
/src/main/java/core/appState/CheckpointsAppState.java
47218bbef7914d33852e601a84700e2938c62014
[]
no_license
matpie33/game
a6c9ffd0319f1ba68931b4b2c50476ddb27d82d2
53cef5c854873aeee0b0b94e357e0d15b9b0003c
refs/heads/master
2022-02-10T10:39:29.666078
2020-09-27T13:34:38
2020-09-27T13:34:38
248,271,255
0
0
null
2022-02-01T01:02:39
2020-03-18T15:33:14
Java
UTF-8
Java
false
false
2,161
java
package core.appState; import com.jme3.app.Application; import com.jme3.app.SimpleApplication; import com.jme3.app.state.BaseAppState; import core.controllers.CheckpointsConditionsController; import core.controllers.GameSaveAndLoadController; import core.util.CheckPointsFileCreator; import dto.GameStateDTO; import dto.SavedGameStateDTO; public class CheckpointsAppState extends BaseAppState { private SimpleApplication simpleApplication; private CheckPointsFileCreator checkPointsFileCreator; private CheckpointsConditionsController checkpointsConditionsController; private AddLevelObjects addLevelObjects; private GameSaveAndLoadController gameSaveAndLoadController = new GameSaveAndLoadController(); private SavedGameStateDTO savedState; public CheckpointsAppState(GameStateDTO gameStateDTO) { addLevelObjects = new AddLevelObjects(gameStateDTO); } @Override protected void initialize(Application app) { simpleApplication = ((SimpleApplication) app); checkPointsFileCreator = new CheckPointsFileCreator(); checkpointsConditionsController = new CheckpointsConditionsController( simpleApplication.getRootNode()); addObjectsToMap(app); } private void addObjectsToMap(Application app) { if (gameSaveAndLoadController.doesCheckpointExist()) { savedState = gameSaveAndLoadController.load(); } addLevelObjects.addObjects(app.getStateManager(), app); addLevelObjects.initializeCamera(simpleApplication.getRootNode()); } @Override protected void cleanup(Application app) { } @Override protected void onEnable() { } @Override protected void onDisable() { } @Override public void update(float tpf) { if (checkpointsConditionsController.isNextCheckpointConditionPassedWithUpdateCheckpoint()) { saveCheckpoint(); } super.update(tpf); } private void saveCheckpoint() { gameSaveAndLoadController.save(simpleApplication.getRootNode(), simpleApplication.getStateManager()); } public SavedGameStateDTO getCheckpoint() { return savedState; } public boolean hasCheckpoint() { return savedState != null; } }
[ "Spaaw@poczta.fm" ]
Spaaw@poczta.fm
46a017c17b4dc0574ef47b3123735db0bce3fd44
0d017407e6cfd4f9d751b56e2757e9e3ba7cbe19
/HappyDog.Java/src/main/java/wang/doghappy/java/module/tag/repository/JpaTagRepository.java
ea9b4b1a114f138ea54bdcb8079d0db42d241452
[]
no_license
doghappy/HappyDog
8358e357e76b7ed34d6ced4ac0d29b09bbe1825b
05e0fe96d4322cda05316223fa64e03e072ef1ea
refs/heads/master
2023-03-18T22:35:31.568723
2022-03-04T07:11:11
2022-03-04T07:11:11
131,945,916
3
1
null
2023-03-04T04:50:17
2018-05-03T05:29:19
C#
UTF-8
Java
false
false
250
java
//package wang.doghappy.java.module.tag.repository; // //import org.springframework.data.jpa.repository.JpaRepository; //import wang.doghappy.java.module.tag.model.Tag; // //public interface JpaTagRepository extends JpaRepository<Tag, Integer> { //}
[ "hero_wong@outlook.com" ]
hero_wong@outlook.com
b7e6170683161d55e336cfb424a4e9b148349d68
993d50950daca1cc9840e1ce83c078fa1d0ad3f5
/src/main/java/me/arui/algorithm/sorting/StraightInsertionSort.java
76364fd8b633bd49d9c3007c8e0c919237edf796
[]
no_license
open-ruic/algorithm
0de3b127186fcadd737737318ce6bf82bd922145
89f33771a8daba7d9cb4909a7d67d7eb708ec7cd
refs/heads/master
2022-07-06T05:30:10.382218
2019-01-23T01:33:16
2019-01-23T01:33:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,739
java
package me.arui.algorithm.sorting; /** * 直接插入排序算法 * <p> * 运作如下: * 将一个记录插入一个有序的队列,从而得到一个新的有序,记录数增加1的新的队列 */ public class StraightInsertionSort { private int initialCapacity = 10; private int[] data; private int size = 0; public StraightInsertionSort() { data = new int[initialCapacity]; } public StraightInsertionSort(int initialCapacity) { this.initialCapacity = initialCapacity; data = new int[initialCapacity]; } public void insert(int number) { if (size == initialCapacity) { throw new IndexOutOfBoundsException(); } if (size == 0) { data[0] = number; } else { int tmp = number; for (int i = 0; i < size; i++) { if (data[i] > tmp) { int old = data[i]; data[i] = tmp; tmp = old; } if (i == size - 1) { data[i + 1] = tmp; } } } size++; } public String toString() { StringBuffer str = new StringBuffer(); for (int i = 0; i < size; i++) { str.append(data[i]); str.append("-"); } return str.toString(); } public static void main(String[] args) { StraightInsertionSort sorting = new StraightInsertionSort(); sorting.insert(1); sorting.insert(2); sorting.insert(5); sorting.insert(4); sorting.insert(3); System.out.println(sorting.size); System.out.println(sorting.toString()); } }
[ "chenrui1988@gmail.com" ]
chenrui1988@gmail.com
cbe804eb168f2eb9e45339fcb3eef61a1842cd37
52a89d2960b2af0faf91b7762c0401aa491f8ba5
/src/main/java/sslify/ConfigPropertiesFactoryImpl.java
e696912c1e276576e69acae8e392c0831d684afc
[ "ISC" ]
permissive
ramonvanalteren/sslify
0863c1d8b10b28e266c991124327697337bab129
48fdb61637a6c3e2a9d53f49d9a812c83c0edeb3
refs/heads/master
2021-01-15T22:28:40.806754
2012-01-02T18:34:28
2012-01-02T18:34:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,130
java
package sslify; import com.google.inject.Singleton; import lombok.NonNull; import org.jetbrains.annotations.NotNull; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.EnumMap; import java.util.Map; @Singleton public class ConfigPropertiesFactoryImpl implements ConfigPropertiesFactory { private static final String CONF_FILE_SUFFIX = ".conf.properties"; private static Map<ConfigProperties.Domain, String> DomainMapping = new EnumMap<ConfigProperties.Domain, String>(ConfigProperties.Domain.class); static { DomainMapping.put(ConfigProperties.Domain.LDAP, "ldap"); DomainMapping.put(ConfigProperties.Domain.REPOSITORY, "repo"); DomainMapping.put(ConfigProperties.Domain.X509, "x509"); DomainMapping.put(ConfigProperties.Domain.HTTP_SERVER, "http.server"); } private static final Map<ConfigProperties.Domain, ConfigProperties> loaded = new EnumMap<ConfigProperties.Domain, ConfigProperties>(ConfigProperties.Domain.class); /* Optimisticly non-synchronized */ @NotNull @Override public ConfigProperties get(@NonNull ConfigProperties.Domain domain) throws ConfigProperties.ConfigLoadingException { if (loaded.containsKey(domain)) return loaded.get(domain); final ConfigProperties props = new ConfigProperties(); final String fullName = DomainMapping.get(domain) + CONF_FILE_SUFFIX; InputStream inputStream = null; try { inputStream = ConfigFileLocator.getInputStream(fullName); props.load(inputStream); loaded.put(domain, props); return props; } catch (FileNotFoundException e) { throw new ConfigProperties.ConfigLoadingException(e); } catch (IOException e) { throw new ConfigProperties.ConfigLoadingException(e); } finally { if (inputStream != null) try { inputStream.close(); } catch (IOException ignored) { } } } }
[ "pierre@spotify.com" ]
pierre@spotify.com
9666caf1ada636626ca08337dbcfbe8e0caf2b19
140d222eeee573715214aa18eee19ee1f1602604
/src/main/java/com/selectica/CanSee/eclm/definitions/CNDABO/actions/SetStatusDraftAction.java
950f06748486eb1fc7cd62856c5211f2457f9c6f
[]
no_license
LeoSigal/CoolDemo
586d549c65d20b62c8b63f60b538b453f4ad9983
cfbc3653ba40c72e49c79f4c1581de7423030ea8
refs/heads/master
2016-09-09T20:17:58.590807
2015-06-19T16:44:15
2015-06-19T16:44:15
37,732,398
0
0
null
null
null
null
UTF-8
Java
false
false
736
java
package com.selectica.CanSee.eclm.definitions.CNDABO.actions; import com.selectica.CanSee.eclm.definitions.ContractStatus; import com.selectica.CanSee.stubs.CNDADetails; import com.selectica.rcfscripts.AbstractBOWriteScript; /** * Created by vshilkin on 09/01/2015. */ public class SetStatusDraftAction extends AbstractBOWriteScript<Boolean> { /* thisComponent.setValue("CNDABO/ReqCNDADetails/contractStatus","Draft"); thisComponent.save(); */ @Override public Boolean process() throws Exception { CNDADetails info = getHelper().getInfoComponentStub(); info.setContractStatus(ContractStatus.DRAFT.getStatus()); return getHelper().saveComponent(info); } }
[ "user@rcfproj.aws.selectica.net" ]
user@rcfproj.aws.selectica.net
5deb9a0d1f2f49ebb47f434f3c0b0951ee82a94a
c745b5a7b2014704d5340407fbe3ebc93b8154b1
/Zadaci fajlovi/src/Zadatak9.java
cd73e8570cd9496e0a16e40dfbff4e5dbbe3c5ba
[]
no_license
NikolinaNikolic/Zadaca_fajlovi
97f4cb3c3936f2e843904aa40df2d7996731d521
c861081b17d00efeea163d9b6cbaffbc7057456d
refs/heads/master
2020-03-27T14:09:28.204782
2018-08-31T13:48:45
2018-08-31T13:48:45
146,647,169
0
0
null
null
null
null
UTF-8
Java
false
false
1,052
java
import java.io.FileNotFoundException; import java.io.FileReader; import java.util.Scanner; public class Zadatak9 { public static void main(String[] args) throws FileNotFoundException { /*. Napisati program koji čita rečenice iz filea i vraća svaku riječ u rečenicu sa početnim velikim * slovom. Da li će program da prima ime filea kao argument ili ne, na vama je. (Rečenica “Hello world“ * u outputu treba biti pretvorena u “Hello World“) */ FileReader file=new FileReader("velika_slova.txt"); Scanner input = new Scanner(file); while (input.hasNext()) { String line=input.nextLine(); for(int i=0;i<line.length();i++) { char c=Character.toUpperCase(line.charAt(0)); line=c+line.substring(1); if(line.charAt(i)==' ') { c=Character.toUpperCase(line.charAt(i+1)); line=line.substring(0, i) + " "+ c + line.substring(i+2); } } System.out.println(line); } } }
[ "nikolinan1993@gmail.com" ]
nikolinan1993@gmail.com
3e4f468a2361cc741ab3a16c9d8e03d005406259
dc53a25659299817d654572203f6ea22a5019b8c
/LittleWeb/src/main/java/com/example/demo/Dao/Impl/commentDaoImpl.java
b4e2cc09fb82e7109850d6263fcf1f748ab03903
[]
no_license
gggyt/invitation
c61b29f70e7fcaa6fd4d3145c1c5183adc1cf4dc
1669b51dd2ab8b5392c2c4d56cd34dbde34ba988
refs/heads/master
2020-03-19T07:13:59.755648
2018-06-25T07:15:20
2018-06-25T07:15:20
136,097,768
2
0
null
null
null
null
UTF-8
Java
false
false
1,226
java
package com.example.demo.Dao.Impl; import com.example.demo.Dao.commentDao; import com.example.demo.Entity.Comment; import com.example.demo.mapper.CommentMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import java.util.List; /** * Created by ggg on 2018/5/29. */ @Repository public class commentDaoImpl implements commentDao { @Autowired private CommentMapper commentMapper; @Override public void addComment(Comment comment) { commentMapper.addComment(comment); } @Override public List<Comment> findCommentById(int id){ return commentMapper.findCommentById(id); } @Override public List<Comment> findCommentByPId(int id){ return commentMapper.findCommentByPId(id); } @Override public int finAllNumByName(String name){ return commentMapper.finAllNumByName(name); } @Override public void deleteByWaid(int id) { commentMapper.deleteByWaid(id); } @Override public void deleteById(int id){ commentMapper.deleteById(id); } @Override public void deleteByPId(int id){ commentMapper.deleteByPId(id); } }
[ "1051404409@qq.com" ]
1051404409@qq.com
6507e02feff48df259c9b4072ebeff2dc7b871a6
2ae788b09eda6d863a284b15c90a9c178baa32cc
/KOF2015/src/com/common/FighterInfo.java
2888b5d24a542831d5931a7bfd29f0ef4ea85569
[]
no_license
ShawnWu20147/KOF2015
af1399c9041033b8333e7507760d4aa546a06728
61e2e0fefb3343c4f857dbfb5b3928fc66f9e596
refs/heads/master
2016-08-12T12:53:55.525941
2015-12-15T12:42:08
2015-12-15T12:42:11
47,522,729
8
1
null
null
null
null
GB18030
Java
false
false
4,613
java
package com.common; import java.io.Serializable; public class FighterInfo implements Serializable{ public int id; public String name; public int ability; //never change public int fighter_type; //never change public int base_hp; public int base_attack; public int base_defence; public int base_hit; public int base_block; public int base_attack_anger; public int base_attacked_anger; public int base_power_anger; public int base_powered_anger; public String description; public String skill_name; public String skill_descrption; public int skill_type; public double skill_ratio; public String skill_state_description; public int skill_state_type; public int skill_state_ratio; public FighterInfo(int id,String name,int ability,int fighter_type,int base_hp,int base_attack,int base_defence ,int base_hit,int base_block,int base_attack_anger,int base_attacked_anger,int base_power_anger,int base_powered_anger , String description,String skill_name,String skill_description ,int skill_type,double skill_ratio,String skill_state_description,int skill_state_type,int skill_state_ratio){ this.id=id; this.name=name; this.ability=ability; this.fighter_type=fighter_type; this.base_hp=base_hp; this.base_attack=base_attack; this.base_defence=base_defence; this.base_hit=base_hit; this.base_block=base_block; this.base_attack_anger=base_attack_anger; this.base_attacked_anger=base_attacked_anger; this.base_power_anger=base_power_anger; this.base_powered_anger=base_powered_anger; this.description=description; this.skill_name=skill_name; this.skill_descrption=skill_description; this.skill_type=skill_type; this.skill_ratio=skill_ratio; this.skill_state_description=skill_state_description; this.skill_state_type=skill_state_type; this.skill_state_ratio=skill_state_ratio; } private String getType(int i){ switch(i){ case 0:return "攻"; case 1:return "技"; case 2:return "防"; } return null; } public String toStringHtml(){ String a="编号:"+id; String b="姓名:"+name; String c="资质:"+ability; String d="格斗家类型:"+getType(fighter_type); String e="基本生命:"+base_hp; String f="基本攻击:"+base_attack; String g="基本防御:"+base_defence; String h="基本暴击:"+base_hit+"%"; String i="基本格挡:"+base_block+"%"; String j="攻击时怒气增加:"+base_attack_anger; String k="被攻击时怒气增加:"+base_attacked_anger; String l="放大招时怒气增加:"+base_power_anger; String m="被大招时怒气增加:"+base_powered_anger; String n="格斗家描述:"+description; String o="格斗家大招:["+skill_name+"]:"+skill_descrption; String p="大招类型:"+getPowerType(skill_type); String q="大招倍率:"+skill_ratio; String r="大招额外效果:"+skill_state_description; String all="<html>"+"<p>" +a+"</p>"+"<p>"+b+"</p>"+"<p>"+c+"</p>"+"<p>"+d+"</p>"+"<p>"+e+"</p>"+"<p>"+f+"</p>"+"<p>"+g+"</p>"+"<p>"+h+"</p>"+"<p>"+i+"</p>"+"<p>"+j+"</p>"+"<p>"+k+"</p>"+"<p>" +l+"</p>"+"<p>"+m+"</p>"+"<p>"+n+"</p>"+"<p>"+o+"</p>"+"<p>"+p+"</p>"+"<p>"+q+"</p>"+"<p>"+r+"</p>"+"</html>"; return all; } @Override public String toString() { String a="编号:"+id; String b="姓名:"+name; String c="资质:"+ability; String d="格斗家类型:"+getType(fighter_type); String e="基本生命:"+base_hp; String f="基本攻击:"+base_attack; String g="基本防御:"+base_defence; String h="基本暴击:"+base_hit+"%"; String i="基本格挡:"+base_block+"%"; String j="攻击时怒气增加:"+base_attack_anger; String k="被攻击时怒气增加:"+base_attacked_anger; String l="放大招时怒气增加:"+base_power_anger; String m="被大招时怒气增加:"+base_powered_anger; String n="格斗家描述:"+description; String o="格斗家大招:["+skill_name+"]:"+skill_descrption; String p="大招类型:"+getPowerType(skill_type); String q="大招倍率:"+skill_ratio; String r="大招额外效果:"+skill_state_description; String all=a+"\n"+b+"\n"+c+"\n"+d+"\n"+e+"\n"+f+"\n"+g+"\n"+h+"\n"+i+"\n"+j+"\n"+k+"\n" +l+"\n"+m+"\n"+n+"\n"+o+"\n"+p+"\n"+q+"\n"+r+"\n"; return all; } private String getPowerType(int skill_type2) { switch(skill_type2){ case 0: return "横杀"; case 1: return "单杀.前"; case 2: return "全屏杀"; case 3: return "全体回血"; case 4: return "竖杀.前"; case 5: return "竖杀.后"; case 6: return "单杀.后"; case 7: return "随机杀.(3人)"; } return null; } }
[ "shawnwu20147@gmail.com" ]
shawnwu20147@gmail.com
8cd9cd1668c64fe6d1391b9e6cfb419fd20860df
14c9e8689071592840a004758d32cdaab7b5b892
/src/Ejercicio2/Ejercicio2.java
44e8e7fc86430d5c3aaec6e81194bab64aa70344
[]
no_license
LuccaFerreyra/EjerciciosJavaEgg
73ddcb6bd63106344f1ea9429b16052d1da0ed32
4621f861345e4a3eacf9afa1f2e549d52fe69214
refs/heads/master
2023-08-18T10:01:32.666276
2021-09-01T13:31:20
2021-09-01T13:31:20
402,069,026
0
0
null
null
null
null
UTF-8
Java
false
false
499
java
package Ejercicio2; import java.util.Scanner; public class Ejercicio2 { public static void main(String[] args) { Scanner leer = new Scanner (System.in).useDelimiter("\n"); System.out.println("Este ess otro MAIN!!"); System.out.println("pido dos numero y muestro la suma "); int num =leer.nextInt(); int num2 =leer.nextInt(); /// Otro metodo int suma = num+num2; /// System.out.println("suma:"+(num+num2)); } }
[ "lucca.ferreyra@hotmail.com" ]
lucca.ferreyra@hotmail.com
47750763916716315f45efa43c2bca108bdbcd73
29810d77b9c2a4ec9dfa4cb120b879df27f3b64a
/data/serializer/src/main/java/tech/pegasys/teku/provider/BLSSignatureDeserializer.java
2d868785a5bba2b65284b18a4546a9cac57daf29
[ "Apache-2.0", "LicenseRef-scancode-free-unknown" ]
permissive
txrx-research/teku
6240e0b8f23964afc42620bf3a7efcf87292a236
5af09bf98e0fb25c930768aa189520cb840dcf94
refs/heads/master
2023-07-18T15:44:26.259658
2020-12-02T19:35:45
2020-12-02T19:35:45
264,846,751
4
3
Apache-2.0
2021-09-14T08:46:46
2020-05-18T06:23:03
Java
UTF-8
Java
false
false
1,121
java
/* * Copyright 2020 ConsenSys AG. * * 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 tech.pegasys.teku.provider; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonDeserializer; import java.io.IOException; import tech.pegasys.teku.api.schema.BLSSignature; public class BLSSignatureDeserializer extends JsonDeserializer<BLSSignature> { @Override public BLSSignature deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { return BLSSignature.fromHexString(p.getValueAsString()); } }
[ "noreply@github.com" ]
noreply@github.com
cb134a192959aba4aeb719c44006b1f63f61b0b9
6688283b89ea3c44a1658285c816f6edc10732e9
/src/main/java/com/corejava/Bubble.java
7c61e724792429557fe3bb0dc572514616b2b3ec
[]
no_license
power006/core-java
36cd65ad9fa492e8919b7187653306709f7e4ccb
a5d0b447e8fed45a78f7ac2382ecfaaac93dc9f2
refs/heads/master
2021-05-18T00:41:19.341239
2020-03-29T12:21:24
2020-03-29T12:21:24
251,028,420
0
0
null
2020-10-13T20:44:24
2020-03-29T12:37:43
Java
UTF-8
Java
false
false
355
java
package com.corejava; import java.util.Arrays; /** * Hello world! * */ public class Bubble { public static void main( String[] args ) { int[] arr={10,23,12,35,19}; int key=12; int res=Arrays.binarySearch(arr, key); if(res>=0) { System.out.println(key + " find index at " + res); } } }
[ "powernaidu4@gmail.com" ]
powernaidu4@gmail.com
7851ccc9edaefe1a48fbf1267bd7c8859a84e04d
1ba2f16a03b9adb1de586ea738edbdb54cfc7762
/app/src/main/java/com/example/mostafa/eatit/Model/Order.java
d762e0c72e614e45b8b5727332768f88a3d489ba
[]
no_license
Mostafaelnagar/Resturant-App
152ccbf43f7768c7edaabd94aff8258c076252ef
cc3ce85f664bc226033a45a4e68221cdede82c44
refs/heads/master
2020-04-27T01:13:26.301242
2019-03-05T14:28:21
2019-03-05T14:28:21
173,958,930
0
0
null
null
null
null
UTF-8
Java
false
false
1,294
java
package com.example.mostafa.eatit.Model; /** * Created by mostafa on 9/30/2017. */ public class Order { private String ProductId; private String ProductName; private String Quantity; private String Price; private String Discount; public Order() { } public Order(String productId, String productName, String quantity, String price, String discount) { ProductId = productId; ProductName = productName; Quantity = quantity; Price = price; Discount = discount; } public String getProductId() { return ProductId; } public void setProductId(String productId) { ProductId = productId; } public String getProductName() { return ProductName; } public void setProductName(String productName) { ProductName = productName; } public String getQuantity() { return Quantity; } public void setQuantity(String quantity) { Quantity = quantity; } public String getPrice() { return Price; } public void setPrice(String price) { Price = price; } public String getDiscount() { return Discount; } public void setDiscount(String discount) { Discount = discount; } }
[ "melnagar271@gmail.com" ]
melnagar271@gmail.com
0296a386cff4d9da79ab95486f9f1528e64bd463
92c05d53f62a99b4abd45c1923055ec535743687
/springBootTest/springBootDemo/src/test/java/com/example/springBootDemo/SpringBootDemoApplicationTests.java
528420b9c5a784d48d8e403f76fccb61cd1fa99f
[]
no_license
dhh-git/master
0a02c1c89646ff53d0fb93aebcfb9dea3decaca8
f387ec35047f69d71d47143ecde901e139ecfe24
refs/heads/master
2023-05-10T05:26:56.320653
2021-05-23T09:45:25
2021-05-23T09:45:25
369,985,287
0
0
null
2021-05-23T09:45:25
2021-05-23T07:11:04
Java
UTF-8
Java
false
false
226
java
package com.example.springBootDemo; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class SpringBootDemoApplicationTests { @Test void contextLoads() { } }
[ "d1554313350@163.com" ]
d1554313350@163.com
3b932945459f0efcb777404f0633762f9e25c079
6189252b6bfabf326452a2133e4f53a95a7422fe
/lab403-DeviceAPI-Web/src/main/java/egovframework/hyb/ios/gps/web/EgovGPSiOSAPIController.java
972d0ef8859948cef3442c0c500da0c0d7c778eb
[]
no_license
sec9590/egovframe
d013fd542284e3ee4bd5ed206bef84958696b9c2
7103722df0d10ff76a4b6dba10469f7c9da4e4f5
refs/heads/master
2022-12-16T06:32:46.576711
2019-07-04T02:09:43
2019-07-04T02:09:43
194,581,045
0
1
null
2022-12-06T00:32:16
2019-07-01T01:42:10
Java
UTF-8
Java
false
false
4,460
java
/* * Copyright 2008-2009 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 egovframework.hyb.ios.gps.web; import java.util.List; import egovframework.hyb.ios.gps.service.EgovGPSiOSAPIService; import egovframework.hyb.ios.gps.service.GPSiOSAPIDefaultVO; import egovframework.hyb.ios.gps.service.GPSiOSAPIVO; import egovframework.rte.fdl.property.EgovPropertyService; import javax.annotation.Resource; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.ui.ModelMap; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.support.SessionStatus; import org.springframework.web.servlet.ModelAndView; /** * @Class Name : EgovGPSAPIController * @Description : EgovGPSAPI Controller Class * @Modification Information * @ * @ 수정일 수정자 수정내용 * @ * @ 2012.07.31 이한철 최초 작성 * * @author 디바이스 API 실행환경 개발팀 * @since 2012. 06. 18 * @version 1.0 * @see * * Copyright (C) by MOPAS All right reserved. */ @Controller public class EgovGPSiOSAPIController { /** EgovGPSAPIService */ @Resource(name = "EgovGPSAPIService") private EgovGPSiOSAPIService egovGPSAPIService; /** propertiesService */ @Resource(name = "propertiesService") protected EgovPropertyService propertiesService; /** * gps 정보 목록을 조회한다. * * @param searchVO * - 조회할 정보가 담긴 GPSAPIDefaultVO * @param model * @return ModelAndView * @exception Exception */ @RequestMapping(value = "/gps/gpsInfoList.do") public ModelAndView selectGPSInfoList( @ModelAttribute("searchVO") GPSiOSAPIDefaultVO searchVO, ModelMap model) throws Exception { ModelAndView jsonView = new ModelAndView("jsonView"); List<?> gpsInfoList = egovGPSAPIService.selectGPSInfoList(searchVO); jsonView.addObject("gpsInfoList", gpsInfoList); jsonView.addObject("resultState", "OK"); return jsonView; } /** * gps 정보를 등록한다. * * @param searchVO * - 등록할 정보가 담긴 GPSAPIDefaultVO * @param status * @return ModelAndView * @exception Exception */ @RequestMapping("/gps/addGPSInfo.do") public ModelAndView insertGPSInfo( @ModelAttribute("searchVO") GPSiOSAPIDefaultVO searchVO, GPSiOSAPIVO sampleVO, BindingResult bindingResult, Model model, SessionStatus status) throws Exception { /* * if (bindingResult.hasErrors()) { model.addAttribute("sampleVO", * sampleVO); return "/sample/egovSampleRegister"; } */ ModelAndView jsonView = new ModelAndView("jsonView"); egovGPSAPIService.insertGPSInfo(sampleVO); jsonView.addObject("resultState", "OK"); jsonView.addObject("resultMessage", "추가되었습니다."); return jsonView; } /** * gps 정보 목록을 삭제한다. * * @param sampleVO * - 삭제할 정보가 담긴 VO * @param status * @return ModelAndView * @exception Exception */ @RequestMapping("/gps/deleteGPSInfo.do") public ModelAndView deleteGPSInfo(GPSiOSAPIVO sampleVO, @ModelAttribute("searchVO") GPSiOSAPIDefaultVO searchVO, SessionStatus status) throws Exception { egovGPSAPIService.deleteGPSInfo(sampleVO); ModelAndView jsonView = new ModelAndView("jsonView"); jsonView.addObject("resultState", "OK"); jsonView.addObject("resultMessage", "삭제되었습니다."); return jsonView; } }
[ "sec9590@gmail.com" ]
sec9590@gmail.com
8a13c0e080290a1e2fe1637b33d4059e9956d0c3
a6a6fb681bc0222e16454bb3ddb79696e6ea1ad5
/disassembly_2020-07-06/sources/com/accessorydm/exception/http/ExceptionHttpContent.java
bb9abf61cb78e65e815e4c410e440a8252fe6cd1
[]
no_license
ThePBone/GalaxyBudsLive-Disassembly
6f9c1bf03c0fd27689dcc2440f754039ac54b7a1
ad119a91b20904f8efccc797f3084005811934c8
refs/heads/master
2022-11-23T13:20:54.555338
2020-07-28T21:33:30
2020-07-28T21:33:30
282,281,940
3
2
null
null
null
null
UTF-8
Java
false
false
219
java
package com.accessorydm.exception.http; public class ExceptionHttpContent extends RuntimeException { public ExceptionHttpContent() { } public ExceptionHttpContent(String str) { super(str); } }
[ "thebone.main@gmail.com" ]
thebone.main@gmail.com
63678f729ab0a80fbb998be04321e61c00b54014
139960e2d7d55e71c15e6a63acb6609e142a2ace
/mobile_app1/module798/src/main/java/module798packageJava0/Foo20.java
41bf6c6064c3c54ee7731383033d012b14f6ffed
[ "Apache-2.0" ]
permissive
uber-common/android-build-eval
448bfe141b6911ad8a99268378c75217d431766f
7723bfd0b9b1056892cef1fef02314b435b086f2
refs/heads/master
2023-02-18T22:25:15.121902
2023-02-06T19:35:34
2023-02-06T19:35:34
294,831,672
83
7
Apache-2.0
2021-09-24T08:55:30
2020-09-11T23:27:37
Java
UTF-8
Java
false
false
349
java
package module798packageJava0; import java.lang.Integer; public class Foo20 { Integer int0; Integer int1; public void foo0() { new module798packageJava0.Foo19().foo4(); } public void foo1() { foo0(); } public void foo2() { foo1(); } public void foo3() { foo2(); } public void foo4() { foo3(); } }
[ "oliviern@uber.com" ]
oliviern@uber.com
1fe2bb8fb7c06ad2510e7c5bf489e0695658c7b8
66bb288f3e25f22d35e25e4baaa27e7a2b7b7d98
/medical/src/main/java/cn/edu/hdu/innovate/medical/vo/PassMoneyBillVO.java
d99e93d6199bb65bed282924fa683e852c1e2a52
[]
no_license
Z-HNAN/medical
92cd11550ac01b48f488349b4282130a510064bf
adb410486af9fb41a89f4f0475a8b30c4c94eeea
refs/heads/master
2020-04-08T12:12:51.534193
2018-12-08T11:40:55
2018-12-08T11:40:55
159,337,452
3
0
null
null
null
null
UTF-8
Java
false
false
302
java
package cn.edu.hdu.innovate.medical.vo; import lombok.Getter; import lombok.Setter; import java.math.BigDecimal; /** * 放款模型 * @author Z_HNAN * */ @Getter @Setter public class PassMoneyBillVO { // 银行卡号 private String bankNumber; // 汇款金额 private BigDecimal amount; }
[ "zhn68033@163.com" ]
zhn68033@163.com
0ee98c46389746a596374039e5dbeb92eb5bd7ab
666a23211acd5e8c5c8278ffbb3032a17f992b75
/android/app/build/generated/source/r/debug/com/google/android/gms/R.java
b6f0d22b3a61bedca07e1514fbe24d89a6493adc
[]
no_license
reactexcel/ConnectAdmin
8e3c10a7d209e193efec97fdb20152eb61141bf8
7963a2205a4def7cddb49b5e2ef46521cea2f209
refs/heads/master
2021-07-03T19:35:45.911882
2017-09-23T09:48:02
2017-09-23T09:48:02
104,555,405
0
0
null
null
null
null
UTF-8
Java
false
false
1,144
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.google.android.gms; public final class R { public static final class array { } public static final class attr { } public static final class color { } public static final class dimen { } public static final class drawable { } public static final class id { public static final int center = 0x7f0e001e; public static final int none = 0x7f0e0010; public static final int normal = 0x7f0e000c; public static final int radio = 0x7f0e005b; public static final int text = 0x7f0e0090; public static final int text2 = 0x7f0e008e; public static final int wrap_content = 0x7f0e001a; } public static final class integer { public static final int google_play_services_version = 0x7f0b0006; } public static final class layout { } public static final class string { public static final int common_google_play_services_unknown_issue = 0x7f070013; } public static final class style { } public static final class styleable { } }
[ "atul.etech2011@gmail.com" ]
atul.etech2011@gmail.com
ecec22ae2208622af46cb2891e74a6e04e228ed2
7ed76c2b7b244493f7e103c0873b20b20aad0456
/src/main/java/cn/michael/leetcode/package-info.java
968c4eb0b5140ff432aab064067eb448652366e8
[]
no_license
hufenggang/michael-leetcode
14d534c99a08a6deab9f2441f1b069632227a598
a0fc07d60611219b854986065eeedade5fbf9999
refs/heads/master
2023-08-27T23:42:10.204730
2021-10-19T23:47:15
2021-10-19T23:47:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
91
java
/** * Created by hufenggang on 2021/10/14. * * Leetcode */ package cn.michael.leetcode;
[ "hufenggang@accesscorporate.com.cn" ]
hufenggang@accesscorporate.com.cn
856875ae14afa60e93859082f8a44af061f5521c
1e730e773f701e802531f9a3f4bfe6254c9da008
/BDDData/src/main/java/com/expleo/qa/utility/BDDTestUtil.java
8800662008c4939d5474f94755cc4f6c8555ed77
[]
no_license
dhivyasimman/SampleProject
6d1daffe3d0fcb64a98adff9bcd576e2b9caa247
626f3891868ddf70d294bd70928cd350a77694a6
refs/heads/master
2021-07-16T17:37:44.114695
2019-11-04T18:46:47
2019-11-04T18:46:47
219,253,425
2
0
null
2020-10-13T17:10:39
2019-11-03T04:54:46
Java
UTF-8
Java
false
false
159
java
package com.expleo.qa.utility; public class BDDTestUtil { public static long PAGE_LOAD_TIMEOUT = 200; public static long IMPLICIT_WAIT = 1000; }
[ "dhivya@user-HP" ]
dhivya@user-HP
53288f5ef5cb40da87b324a7d41cc3f1d480a6c5
481c63d821e424ba91343119d6e0541dfee1a92a
/src/com/learn/patterns/design/behavioral/command/impl1/EditCommand.java
c3d1e141cb7a3f60eb679325c5d124670caf2b48
[]
no_license
kgthulin/java-design-patterns
db680870a89b5c84eb4a0192be5b3f526a098232
40256cbef67eeacea64630c2687acf9b3a87e869
refs/heads/main
2023-08-19T15:44:43.485900
2021-08-28T07:21:05
2021-08-28T07:21:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
188
java
package com.learn.patterns.design.behavioral.command.impl1; public class EditCommand implements Command { @Override public void execute() { System.out.println("Edit Executed"); } }
[ "kaungthu31@gmail.com" ]
kaungthu31@gmail.com
4d001143a24ce35e4484e4b937d0f6c2b479e6f6
e578e1dd6f58db78a2c23c3e64ff0265b2fcfb8e
/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesNodes.java
fb597fc7b7d4290fca9e046512406c4f57fe59a1
[ "LGPL-2.1-only", "LicenseRef-scancode-other-permissive", "EPL-1.0", "Classpath-exception-2.0", "CC-BY-3.0", "CC-BY-2.5", "GPL-2.0-only", "CC-PDDC", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-3-Clause", "GCC-exception-3.1", "CDDL-1.0", "MIT", "CDDL-1.1", "BSD-2-Clause-Views...
permissive
MSDS-ABLE/toposch
ca7c585f61738a262639bc07e27915b30b08221f
181977dae6953f8bca026cadd4722979e9ec0d43
refs/heads/master
2023-09-01T09:25:27.817000
2020-05-31T04:03:08
2020-05-31T04:03:08
267,599,209
5
0
Apache-2.0
2023-08-15T17:41:32
2020-05-28T13:35:50
Java
UTF-8
Java
false
false
37,199
java
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.hadoop.yarn.server.resourcemanager.webapp; import static org.apache.hadoop.yarn.webapp.WebServicesTestUtils.assertResponseStatusCode; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.io.StringReader; import java.util.ArrayList; import java.util.EnumSet; import javax.ws.rs.core.MediaType; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.http.JettyUtils; import org.apache.hadoop.yarn.api.records.ContainerStatus; import org.apache.hadoop.yarn.api.records.NodeId; import org.apache.hadoop.yarn.api.records.NodeState; import org.apache.hadoop.yarn.api.records.Resource; import org.apache.hadoop.yarn.api.records.ResourceUtilization; import org.apache.hadoop.yarn.server.api.records.NodeHealthStatus; import org.apache.hadoop.yarn.server.api.records.NodeStatus; import org.apache.hadoop.yarn.server.api.records.OpportunisticContainersStatus; import org.apache.hadoop.yarn.server.resourcemanager.MockRM; import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager; import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode; import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeEvent; import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeEventType; import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeImpl; import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeStartedEvent; import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeStatusEvent; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerNodeReport; import org.apache.hadoop.yarn.util.RackResolver; import org.apache.hadoop.yarn.util.YarnVersionInfo; import org.apache.hadoop.yarn.webapp.GenericExceptionHandler; import org.apache.hadoop.yarn.webapp.GuiceServletConfig; import org.apache.hadoop.yarn.webapp.JerseyTestBase; import org.apache.hadoop.yarn.webapp.WebServicesTestUtils; import org.codehaus.jettison.json.JSONArray; import org.codehaus.jettison.json.JSONException; import org.codehaus.jettison.json.JSONObject; import org.junit.Before; import org.junit.Test; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; import org.xml.sax.InputSource; import com.google.common.base.Joiner; import com.google.inject.Guice; import com.google.inject.servlet.ServletModule; import com.sun.jersey.api.client.ClientResponse; import com.sun.jersey.api.client.ClientResponse.Status; import com.sun.jersey.api.client.UniformInterfaceException; import com.sun.jersey.api.client.WebResource; import com.sun.jersey.guice.spi.container.servlet.GuiceContainer; import com.sun.jersey.test.framework.WebAppDescriptor; public class TestRMWebServicesNodes extends JerseyTestBase { private static MockRM rm; private static class WebServletModule extends ServletModule { @Override protected void configureServlets() { bind(JAXBContextResolver.class); bind(RMWebServices.class); bind(GenericExceptionHandler.class); rm = new MockRM(new Configuration()); rm.getRMContext().getContainerTokenSecretManager().rollMasterKey(); rm.getRMContext().getNMTokenSecretManager().rollMasterKey(); rm.disableDrainEventsImplicitly(); bind(ResourceManager.class).toInstance(rm); serve("/*").with(GuiceContainer.class); } } static { GuiceServletConfig.setInjector( Guice.createInjector(new WebServletModule())); } @Before @Override public void setUp() throws Exception { super.setUp(); GuiceServletConfig.setInjector( Guice.createInjector(new WebServletModule())); } public TestRMWebServicesNodes() { super(new WebAppDescriptor.Builder( "org.apache.hadoop.yarn.server.resourcemanager.webapp") .contextListenerClass(GuiceServletConfig.class) .filterClass(com.google.inject.servlet.GuiceFilter.class) .contextPath("jersey-guice-filter").servletPath("/").build()); } @Test public void testNodes() throws JSONException, Exception { testNodesHelper("nodes", MediaType.APPLICATION_JSON); } @Test public void testNodesSlash() throws JSONException, Exception { testNodesHelper("nodes/", MediaType.APPLICATION_JSON); } @Test public void testNodesDefault() throws JSONException, Exception { testNodesHelper("nodes/", ""); } @Test public void testNodesDefaultWithUnHealthyNode() throws JSONException, Exception { WebResource r = resource(); getRunningRMNode("h1", 1234, 5120); // h2 will be in NEW state getNewRMNode("h2", 1235, 5121); RMNode node3 = getRunningRMNode("h3", 1236, 5122); NodeId nodeId3 = node3.getNodeID(); RMNode node = rm.getRMContext().getRMNodes().get(nodeId3); NodeHealthStatus nodeHealth = NodeHealthStatus.newInstance(false, "test health report", System.currentTimeMillis()); NodeStatus nodeStatus = NodeStatus.newInstance(nodeId3, 1, new ArrayList<ContainerStatus>(), null, nodeHealth, null, null, null); ((RMNodeImpl) node) .handle(new RMNodeStatusEvent(nodeId3, nodeStatus, null)); rm.waitForState(nodeId3, NodeState.UNHEALTHY); ClientResponse response = r.path("ws").path("v1").path("cluster").path("nodes") .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class); assertEquals(MediaType.APPLICATION_JSON_TYPE + "; " + JettyUtils.UTF_8, response.getType().toString()); JSONObject json = response.getEntity(JSONObject.class); assertEquals("incorrect number of elements", 1, json.length()); JSONObject nodes = json.getJSONObject("nodes"); assertEquals("incorrect number of elements", 1, nodes.length()); JSONArray nodeArray = nodes.getJSONArray("node"); // 3 nodes, including the unhealthy node and the new node. assertEquals("incorrect number of elements", 3, nodeArray.length()); } private RMNode getRunningRMNode(String host, int port, int memory) { RMNodeImpl rmnode1 = getNewRMNode(host, port, memory); sendStartedEvent(rmnode1); return rmnode1; } private void sendStartedEvent(RMNode node) { ((RMNodeImpl) node) .handle(new RMNodeStartedEvent(node.getNodeID(), null, null)); } private void sendLostEvent(RMNode node) { ((RMNodeImpl) node) .handle(new RMNodeEvent(node.getNodeID(), RMNodeEventType.EXPIRE)); } private RMNodeImpl getNewRMNode(String host, int port, int memory) { NodeId nodeId = NodeId.newInstance(host, port); RMNodeImpl nodeImpl = new RMNodeImpl(nodeId, rm.getRMContext(), nodeId.getHost(), nodeId.getPort(), nodeId.getPort() + 1, RackResolver.resolve(nodeId.getHost()), Resource.newInstance(memory, 4), YarnVersionInfo.getVersion()); rm.getRMContext().getRMNodes().put(nodeId, nodeImpl); return nodeImpl; } @Test public void testNodesQueryNew() throws JSONException, Exception { WebResource r = resource(); getRunningRMNode("h1", 1234, 5120); // h2 will be in NEW state RMNode rmnode2 = getNewRMNode("h2", 1235, 5121); ClientResponse response = r.path("ws").path("v1").path("cluster") .path("nodes").queryParam("states", NodeState.NEW.toString()) .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class); assertEquals(MediaType.APPLICATION_JSON_TYPE + "; " + JettyUtils.UTF_8, response.getType().toString()); JSONObject json = response.getEntity(JSONObject.class); assertEquals("incorrect number of elements", 1, json.length()); JSONObject nodes = json.getJSONObject("nodes"); assertEquals("incorrect number of elements", 1, nodes.length()); JSONArray nodeArray = nodes.getJSONArray("node"); assertEquals("incorrect number of elements", 1, nodeArray.length()); JSONObject info = nodeArray.getJSONObject(0); verifyNodeInfo(info, rmnode2); } @Test public void testNodesQueryStateNone() throws JSONException, Exception { WebResource r = resource(); getNewRMNode("h1", 1234, 5120); getNewRMNode("h2", 1235, 5121); ClientResponse response = r.path("ws").path("v1").path("cluster") .path("nodes") .queryParam("states", NodeState.DECOMMISSIONED.toString()) .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class); assertEquals(MediaType.APPLICATION_JSON_TYPE + "; " + JettyUtils.UTF_8, response.getType().toString()); JSONObject json = response.getEntity(JSONObject.class); assertEquals("incorrect number of elements", 1, json.length()); assertEquals("nodes is not empty", new JSONObject().toString(), json.get("nodes").toString()); } @Test public void testNodesQueryStateInvalid() throws JSONException, Exception { WebResource r = resource(); getNewRMNode("h1", 1234, 5120); getNewRMNode("h2", 1235, 5121); try { r.path("ws").path("v1").path("cluster").path("nodes") .queryParam("states", "BOGUSSTATE").accept(MediaType.APPLICATION_JSON) .get(JSONObject.class); fail("should have thrown exception querying invalid state"); } catch (UniformInterfaceException ue) { ClientResponse response = ue.getResponse(); assertResponseStatusCode(Status.BAD_REQUEST, response.getStatusInfo()); assertEquals(MediaType.APPLICATION_JSON_TYPE + "; " + JettyUtils.UTF_8, response.getType().toString()); JSONObject msg = response.getEntity(JSONObject.class); JSONObject exception = msg.getJSONObject("RemoteException"); assertEquals("incorrect number of elements", 3, exception.length()); String message = exception.getString("message"); String type = exception.getString("exception"); String classname = exception.getString("javaClassName"); WebServicesTestUtils .checkStringContains( "exception message", "org.apache.hadoop.yarn.api.records.NodeState.BOGUSSTATE", message); WebServicesTestUtils.checkStringMatch("exception type", "IllegalArgumentException", type); WebServicesTestUtils.checkStringMatch("exception classname", "java.lang.IllegalArgumentException", classname); } } @Test public void testNodesQueryStateLost() throws JSONException, Exception { WebResource r = resource(); RMNode rmnode1 = getRunningRMNode("h1", 1234, 5120); sendLostEvent(rmnode1); RMNode rmnode2 = getRunningRMNode("h2", 1235, 5121); sendLostEvent(rmnode2); ClientResponse response = r.path("ws").path("v1").path("cluster") .path("nodes").queryParam("states", NodeState.LOST.toString()) .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class); assertEquals(MediaType.APPLICATION_JSON_TYPE + "; " + JettyUtils.UTF_8, response.getType().toString()); JSONObject json = response.getEntity(JSONObject.class); JSONObject nodes = json.getJSONObject("nodes"); assertEquals("incorrect number of elements", 1, nodes.length()); JSONArray nodeArray = nodes.getJSONArray("node"); assertEquals("incorrect number of elements", 2, nodeArray.length()); for (int i = 0; i < nodeArray.length(); ++i) { JSONObject info = nodeArray.getJSONObject(i); String[] node = info.get("id").toString().split(":"); NodeId nodeId = NodeId.newInstance(node[0], Integer.parseInt(node[1])); RMNode rmNode = rm.getRMContext().getInactiveRMNodes().get(nodeId); WebServicesTestUtils.checkStringMatch("nodeHTTPAddress", "", info.getString("nodeHTTPAddress")); if (rmNode != null) { WebServicesTestUtils.checkStringMatch("state", rmNode.getState().toString(), info.getString("state")); } } } @Test public void testSingleNodeQueryStateLost() throws JSONException, Exception { WebResource r = resource(); getRunningRMNode("h1", 1234, 5120); RMNode rmnode2 = getRunningRMNode("h2", 1234, 5121); sendLostEvent(rmnode2); ClientResponse response = r.path("ws").path("v1").path("cluster") .path("nodes").path("h2:1234").accept(MediaType.APPLICATION_JSON) .get(ClientResponse.class); assertEquals(MediaType.APPLICATION_JSON_TYPE + "; " + JettyUtils.UTF_8, response.getType().toString()); JSONObject json = response.getEntity(JSONObject.class); JSONObject info = json.getJSONObject("node"); String id = info.get("id").toString(); assertEquals("Incorrect Node Information.", "h2:1234", id); RMNode rmNode = rm.getRMContext().getInactiveRMNodes().get(rmnode2.getNodeID()); WebServicesTestUtils.checkStringMatch("nodeHTTPAddress", "", info.getString("nodeHTTPAddress")); if (rmNode != null) { WebServicesTestUtils.checkStringMatch("state", rmNode.getState().toString(), info.getString("state")); } } @Test public void testNodesQueryRunning() throws JSONException, Exception { WebResource r = resource(); getRunningRMNode("h1", 1234, 5120); // h2 will be in NEW state getNewRMNode("h2", 1235, 5121); ClientResponse response = r.path("ws").path("v1").path("cluster") .path("nodes").queryParam("states", "running") .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class); assertEquals(MediaType.APPLICATION_JSON_TYPE + "; " + JettyUtils.UTF_8, response.getType().toString()); JSONObject json = response.getEntity(JSONObject.class); assertEquals("incorrect number of elements", 1, json.length()); JSONObject nodes = json.getJSONObject("nodes"); assertEquals("incorrect number of elements", 1, nodes.length()); JSONArray nodeArray = nodes.getJSONArray("node"); assertEquals("incorrect number of elements", 1, nodeArray.length()); } @Test public void testNodesQueryHealthyFalse() throws JSONException, Exception { WebResource r = resource(); getRunningRMNode("h1", 1234, 5120); // h2 will be in NEW state getNewRMNode("h2", 1235, 5121); ClientResponse response = r.path("ws").path("v1").path("cluster") .path("nodes").queryParam("states", "UNHEALTHY") .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class); assertEquals(MediaType.APPLICATION_JSON_TYPE + "; " + JettyUtils.UTF_8, response.getType().toString()); JSONObject json = response.getEntity(JSONObject.class); assertEquals("incorrect number of elements", 1, json.length()); assertEquals("nodes is not empty", new JSONObject().toString(), json.get("nodes").toString()); } public void testNodesHelper(String path, String media) throws JSONException, Exception { WebResource r = resource(); RMNode rmnode1 = getRunningRMNode("h1", 1234, 5120); RMNode rmnode2 = getRunningRMNode("h2", 1235, 5121); ClientResponse response = r.path("ws").path("v1").path("cluster") .path(path).accept(media).get(ClientResponse.class); assertEquals(MediaType.APPLICATION_JSON_TYPE + "; " + JettyUtils.UTF_8, response.getType().toString()); JSONObject json = response.getEntity(JSONObject.class); assertEquals("incorrect number of elements", 1, json.length()); JSONObject nodes = json.getJSONObject("nodes"); assertEquals("incorrect number of elements", 1, nodes.length()); JSONArray nodeArray = nodes.getJSONArray("node"); assertEquals("incorrect number of elements", 2, nodeArray.length()); JSONObject info = nodeArray.getJSONObject(0); String id = info.get("id").toString(); if (id.matches("h1:1234")) { verifyNodeInfo(info, rmnode1); verifyNodeInfo(nodeArray.getJSONObject(1), rmnode2); } else { verifyNodeInfo(info, rmnode2); verifyNodeInfo(nodeArray.getJSONObject(1), rmnode1); } } @Test public void testSingleNode() throws JSONException, Exception { getRunningRMNode("h1", 1234, 5120); RMNode rmnode2 = getRunningRMNode("h2", 1235, 5121); testSingleNodeHelper("h2:1235", rmnode2, MediaType.APPLICATION_JSON); } @Test public void testSingleNodeSlash() throws JSONException, Exception { RMNode rmnode1 = getRunningRMNode("h1", 1234, 5120); getRunningRMNode("h2", 1235, 5121); testSingleNodeHelper("h1:1234/", rmnode1, MediaType.APPLICATION_JSON); } @Test public void testSingleNodeDefault() throws JSONException, Exception { RMNode rmnode1 = getRunningRMNode("h1", 1234, 5120); getRunningRMNode("h2", 1235, 5121); testSingleNodeHelper("h1:1234/", rmnode1, ""); } public void testSingleNodeHelper(String nodeid, RMNode nm, String media) throws JSONException, Exception { WebResource r = resource(); ClientResponse response = r.path("ws").path("v1").path("cluster") .path("nodes").path(nodeid).accept(media).get(ClientResponse.class); assertEquals(MediaType.APPLICATION_JSON_TYPE + "; " + JettyUtils.UTF_8, response.getType().toString()); JSONObject json = response.getEntity(JSONObject.class); assertEquals("incorrect number of elements", 1, json.length()); JSONObject info = json.getJSONObject("node"); verifyNodeInfo(info, nm); } @Test public void testNonexistNode() throws JSONException, Exception { // add h1 node in NEW state getNewRMNode("h1", 1234, 5120); // add h2 node in NEW state getNewRMNode("h2", 1235, 5121); WebResource r = resource(); try { r.path("ws").path("v1").path("cluster").path("nodes") .path("node_invalid:99").accept(MediaType.APPLICATION_JSON) .get(JSONObject.class); fail("should have thrown exception on non-existent nodeid"); } catch (UniformInterfaceException ue) { ClientResponse response = ue.getResponse(); assertResponseStatusCode(Status.NOT_FOUND, response.getStatusInfo()); assertEquals(MediaType.APPLICATION_JSON_TYPE + "; " + JettyUtils.UTF_8, response.getType().toString()); JSONObject msg = response.getEntity(JSONObject.class); JSONObject exception = msg.getJSONObject("RemoteException"); assertEquals("incorrect number of elements", 3, exception.length()); String message = exception.getString("message"); String type = exception.getString("exception"); String classname = exception.getString("javaClassName"); verifyNonexistNodeException(message, type, classname); } } // test that the exception output defaults to JSON @Test public void testNonexistNodeDefault() throws JSONException, Exception { getNewRMNode("h1", 1234, 5120); getNewRMNode("h2", 1235, 5121); WebResource r = resource(); try { r.path("ws").path("v1").path("cluster").path("nodes") .path("node_invalid:99").get(JSONObject.class); fail("should have thrown exception on non-existent nodeid"); } catch (UniformInterfaceException ue) { ClientResponse response = ue.getResponse(); assertResponseStatusCode(Status.NOT_FOUND, response.getStatusInfo()); assertEquals(MediaType.APPLICATION_JSON_TYPE + "; " + JettyUtils.UTF_8, response.getType().toString()); JSONObject msg = response.getEntity(JSONObject.class); JSONObject exception = msg.getJSONObject("RemoteException"); assertEquals("incorrect number of elements", 3, exception.length()); String message = exception.getString("message"); String type = exception.getString("exception"); String classname = exception.getString("javaClassName"); verifyNonexistNodeException(message, type, classname); } } // test that the exception output works in XML @Test public void testNonexistNodeXML() throws JSONException, Exception { getNewRMNode("h1", 1234, 5120); getNewRMNode("h2", 1235, 5121); WebResource r = resource(); try { r.path("ws").path("v1").path("cluster").path("nodes") .path("node_invalid:99").accept(MediaType.APPLICATION_XML) .get(JSONObject.class); fail("should have thrown exception on non-existent nodeid"); } catch (UniformInterfaceException ue) { ClientResponse response = ue.getResponse(); assertResponseStatusCode(Status.NOT_FOUND, response.getStatusInfo()); assertEquals(MediaType.APPLICATION_XML_TYPE + "; " + JettyUtils.UTF_8, response.getType().toString()); String msg = response.getEntity(String.class); System.out.println(msg); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); InputSource is = new InputSource(); is.setCharacterStream(new StringReader(msg)); Document dom = db.parse(is); NodeList nodes = dom.getElementsByTagName("RemoteException"); Element element = (Element) nodes.item(0); String message = WebServicesTestUtils.getXmlString(element, "message"); String type = WebServicesTestUtils.getXmlString(element, "exception"); String classname = WebServicesTestUtils.getXmlString(element, "javaClassName"); verifyNonexistNodeException(message, type, classname); } } private void verifyNonexistNodeException(String message, String type, String classname) { assertTrue("exception message incorrect", "java.lang.Exception: nodeId, node_invalid:99, is not found" .matches(message)); assertTrue("exception type incorrect", "NotFoundException".matches(type)); assertTrue("exception className incorrect", "org.apache.hadoop.yarn.webapp.NotFoundException".matches(classname)); } @Test public void testInvalidNode() throws JSONException, Exception { getNewRMNode("h1", 1234, 5120); getNewRMNode("h2", 1235, 5121); WebResource r = resource(); try { r.path("ws").path("v1").path("cluster").path("nodes") .path("node_invalid_foo").accept(MediaType.APPLICATION_JSON) .get(JSONObject.class); fail("should have thrown exception on non-existent nodeid"); } catch (UniformInterfaceException ue) { ClientResponse response = ue.getResponse(); assertResponseStatusCode(Status.BAD_REQUEST, response.getStatusInfo()); assertEquals(MediaType.APPLICATION_JSON_TYPE + "; " + JettyUtils.UTF_8, response.getType().toString()); JSONObject msg = response.getEntity(JSONObject.class); JSONObject exception = msg.getJSONObject("RemoteException"); assertEquals("incorrect number of elements", 3, exception.length()); String message = exception.getString("message"); String type = exception.getString("exception"); String classname = exception.getString("javaClassName"); WebServicesTestUtils.checkStringMatch("exception message", "Invalid NodeId \\[node_invalid_foo\\]. Expected host:port", message); WebServicesTestUtils.checkStringMatch("exception type", "IllegalArgumentException", type); WebServicesTestUtils.checkStringMatch("exception classname", "java.lang.IllegalArgumentException", classname); } } @Test public void testNodesXML() throws JSONException, Exception { WebResource r = resource(); RMNodeImpl rmnode1 = getNewRMNode("h1", 1234, 5120); // MockNM nm2 = rm.registerNode("h2:1235", 5121); ClientResponse response = r.path("ws").path("v1").path("cluster") .path("nodes").accept(MediaType.APPLICATION_XML) .get(ClientResponse.class); assertEquals(MediaType.APPLICATION_XML_TYPE + "; " + JettyUtils.UTF_8, response.getType().toString()); String xml = response.getEntity(String.class); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); InputSource is = new InputSource(); is.setCharacterStream(new StringReader(xml)); Document dom = db.parse(is); NodeList nodesApps = dom.getElementsByTagName("nodes"); assertEquals("incorrect number of elements", 1, nodesApps.getLength()); NodeList nodes = dom.getElementsByTagName("node"); assertEquals("incorrect number of elements", 1, nodes.getLength()); verifyNodesXML(nodes, rmnode1); } @Test public void testSingleNodesXML() throws JSONException, Exception { WebResource r = resource(); // add h2 node in NEW state RMNodeImpl rmnode1 = getNewRMNode("h1", 1234, 5120); // MockNM nm2 = rm.registerNode("h2:1235", 5121); ClientResponse response = r.path("ws").path("v1").path("cluster") .path("nodes").path("h1:1234").accept(MediaType.APPLICATION_XML) .get(ClientResponse.class); assertEquals(MediaType.APPLICATION_XML_TYPE + "; " + JettyUtils.UTF_8, response.getType().toString()); String xml = response.getEntity(String.class); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); InputSource is = new InputSource(); is.setCharacterStream(new StringReader(xml)); Document dom = db.parse(is); NodeList nodes = dom.getElementsByTagName("node"); assertEquals("incorrect number of elements", 1, nodes.getLength()); verifyNodesXML(nodes, rmnode1); } @Test public void testNodes2XML() throws JSONException, Exception { WebResource r = resource(); getNewRMNode("h1", 1234, 5120); getNewRMNode("h2", 1235, 5121); ClientResponse response = r.path("ws").path("v1").path("cluster") .path("nodes").accept(MediaType.APPLICATION_XML) .get(ClientResponse.class); assertEquals(MediaType.APPLICATION_XML_TYPE + "; " + JettyUtils.UTF_8, response.getType().toString()); String xml = response.getEntity(String.class); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); InputSource is = new InputSource(); is.setCharacterStream(new StringReader(xml)); Document dom = db.parse(is); NodeList nodesApps = dom.getElementsByTagName("nodes"); assertEquals("incorrect number of elements", 1, nodesApps.getLength()); NodeList nodes = dom.getElementsByTagName("node"); assertEquals("incorrect number of elements", 2, nodes.getLength()); } @Test public void testQueryAll() throws Exception { WebResource r = resource(); getRunningRMNode("h1", 1234, 5120); // add h2 node in NEW state getNewRMNode("h2", 1235, 5121); // add lost node RMNode nm3 = getRunningRMNode("h3", 1236, 5122); sendLostEvent(nm3); ClientResponse response = r.path("ws").path("v1").path("cluster") .path("nodes") .queryParam("states", Joiner.on(',').join(EnumSet.allOf(NodeState.class))) .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class); assertEquals(MediaType.APPLICATION_JSON_TYPE + "; " + JettyUtils.UTF_8, response.getType().toString()); JSONObject json = response.getEntity(JSONObject.class); JSONObject nodes = json.getJSONObject("nodes"); assertEquals("incorrect number of elements", 1, nodes.length()); JSONArray nodeArray = nodes.getJSONArray("node"); assertEquals("incorrect number of elements", 3, nodeArray.length()); } @Test public void testNodesResourceUtilization() throws JSONException, Exception { WebResource r = resource(); RMNode rmnode1 = getRunningRMNode("h1", 1234, 5120); NodeId nodeId1 = rmnode1.getNodeID(); RMNodeImpl node = (RMNodeImpl) rm.getRMContext().getRMNodes().get(nodeId1); NodeHealthStatus nodeHealth = NodeHealthStatus.newInstance(true, "test health report", System.currentTimeMillis()); ResourceUtilization nodeResource = ResourceUtilization.newInstance(4096, 0, (float) 10.5); ResourceUtilization containerResource = ResourceUtilization.newInstance( 2048, 0, (float) 5.05); NodeStatus nodeStatus = NodeStatus.newInstance(nodeId1, 0, new ArrayList<ContainerStatus>(), null, nodeHealth, containerResource, nodeResource, null); node.handle(new RMNodeStatusEvent(nodeId1, nodeStatus, null)); rm.waitForState(nodeId1, NodeState.RUNNING); ClientResponse response = r.path("ws").path("v1").path("cluster") .path("nodes").accept(MediaType.APPLICATION_JSON) .get(ClientResponse.class); assertEquals(MediaType.APPLICATION_JSON_TYPE + "; " + JettyUtils.UTF_8, response.getType().toString()); JSONObject json = response.getEntity(JSONObject.class); assertEquals("incorrect number of elements", 1, json.length()); JSONObject nodes = json.getJSONObject("nodes"); assertEquals("incorrect number of elements", 1, nodes.length()); JSONArray nodeArray = nodes.getJSONArray("node"); assertEquals("incorrect number of elements", 1, nodeArray.length()); JSONObject info = nodeArray.getJSONObject(0); // verify the resource utilization verifyNodeInfo(info, rmnode1); } public void verifyNodesXML(NodeList nodes, RMNode nm) throws JSONException, Exception { for (int i = 0; i < nodes.getLength(); i++) { Element element = (Element) nodes.item(i); verifyNodeInfoGeneric(nm, WebServicesTestUtils.getXmlString(element, "state"), WebServicesTestUtils.getXmlString(element, "rack"), WebServicesTestUtils.getXmlString(element, "id"), WebServicesTestUtils.getXmlString(element, "nodeHostName"), WebServicesTestUtils.getXmlString(element, "nodeHTTPAddress"), WebServicesTestUtils.getXmlLong(element, "lastHealthUpdate"), WebServicesTestUtils.getXmlString(element, "healthReport"), WebServicesTestUtils.getXmlInt(element, "numContainers"), WebServicesTestUtils.getXmlLong(element, "usedMemoryMB"), WebServicesTestUtils.getXmlLong(element, "availMemoryMB"), WebServicesTestUtils.getXmlLong(element, "usedVirtualCores"), WebServicesTestUtils.getXmlLong(element, "availableVirtualCores"), WebServicesTestUtils.getXmlString(element, "version"), WebServicesTestUtils.getXmlInt(element, "nodePhysicalMemoryMB"), WebServicesTestUtils.getXmlInt(element, "nodeVirtualMemoryMB"), WebServicesTestUtils.getXmlFloat(element, "nodeCPUUsage"), WebServicesTestUtils.getXmlInt(element, "aggregatedContainersPhysicalMemoryMB"), WebServicesTestUtils.getXmlInt(element, "aggregatedContainersVirtualMemoryMB"), WebServicesTestUtils.getXmlFloat(element, "containersCPUUsage"), WebServicesTestUtils.getXmlInt(element, "numRunningOpportContainers"), WebServicesTestUtils.getXmlLong(element, "usedMemoryOpportGB"), WebServicesTestUtils.getXmlInt(element, "usedVirtualCoresOpport"), WebServicesTestUtils.getXmlInt(element, "numQueuedContainers")); } } public void verifyNodeInfo(JSONObject nodeInfo, RMNode nm) throws JSONException, Exception { assertEquals("incorrect number of elements", 18, nodeInfo.length()); JSONObject resourceInfo = nodeInfo.getJSONObject("resourceUtilization"); verifyNodeInfoGeneric(nm, nodeInfo.getString("state"), nodeInfo.getString("rack"), nodeInfo.getString("id"), nodeInfo.getString("nodeHostName"), nodeInfo.getString("nodeHTTPAddress"), nodeInfo.getLong("lastHealthUpdate"), nodeInfo.getString("healthReport"), nodeInfo.getInt("numContainers"), nodeInfo.getLong("usedMemoryMB"), nodeInfo.getLong("availMemoryMB"), nodeInfo.getLong("usedVirtualCores"), nodeInfo.getLong("availableVirtualCores"), nodeInfo.getString("version"), resourceInfo.getInt("nodePhysicalMemoryMB"), resourceInfo.getInt("nodeVirtualMemoryMB"), resourceInfo.getDouble("nodeCPUUsage"), resourceInfo.getInt("aggregatedContainersPhysicalMemoryMB"), resourceInfo.getInt("aggregatedContainersVirtualMemoryMB"), resourceInfo.getDouble("containersCPUUsage"), nodeInfo.getInt("numRunningOpportContainers"), nodeInfo.getLong("usedMemoryOpportGB"), nodeInfo.getInt("usedVirtualCoresOpport"), nodeInfo.getInt("numQueuedContainers")); } public void verifyNodeInfoGeneric(RMNode node, String state, String rack, String id, String nodeHostName, String nodeHTTPAddress, long lastHealthUpdate, String healthReport, int numContainers, long usedMemoryMB, long availMemoryMB, long usedVirtualCores, long availVirtualCores, String version, int nodePhysicalMemoryMB, int nodeVirtualMemoryMB, double nodeCPUUsage, int containersPhysicalMemoryMB, int containersVirtualMemoryMB, double containersCPUUsage, int numRunningOpportContainers, long usedMemoryOpportGB, int usedVirtualCoresOpport, int numQueuedContainers) throws JSONException, Exception { ResourceScheduler sched = rm.getResourceScheduler(); SchedulerNodeReport report = sched.getNodeReport(node.getNodeID()); OpportunisticContainersStatus opportunisticStatus = node.getOpportunisticContainersStatus(); WebServicesTestUtils.checkStringMatch("state", node.getState().toString(), state); WebServicesTestUtils.checkStringMatch("rack", node.getRackName(), rack); WebServicesTestUtils.checkStringMatch("id", node.getNodeID().toString(), id); WebServicesTestUtils.checkStringMatch("nodeHostName", node.getNodeID().getHost(), nodeHostName); WebServicesTestUtils.checkStringMatch("healthReport", String.valueOf(node.getHealthReport()), healthReport); String expectedHttpAddress = node.getNodeID().getHost() + ":" + node.getHttpPort(); WebServicesTestUtils.checkStringMatch("nodeHTTPAddress", expectedHttpAddress, nodeHTTPAddress); WebServicesTestUtils.checkStringMatch("version", node.getNodeManagerVersion(), version); if (node.getNodeUtilization() != null) { ResourceUtilization nodeResource = ResourceUtilization.newInstance( nodePhysicalMemoryMB, nodeVirtualMemoryMB, (float) nodeCPUUsage); assertEquals("nodeResourceUtilization doesn't match", node.getNodeUtilization(), nodeResource); } if (node.getAggregatedContainersUtilization() != null) { ResourceUtilization containerResource = ResourceUtilization.newInstance( containersPhysicalMemoryMB, containersVirtualMemoryMB, (float) containersCPUUsage); assertEquals("containerResourceUtilization doesn't match", node.getAggregatedContainersUtilization(), containerResource); } long expectedHealthUpdate = node.getLastHealthReportTime(); assertEquals("lastHealthUpdate doesn't match, got: " + lastHealthUpdate + " expected: " + expectedHealthUpdate, expectedHealthUpdate, lastHealthUpdate); if (report != null) { assertEquals("numContainers doesn't match: " + numContainers, report.getNumContainers(), numContainers); assertEquals("usedMemoryMB doesn't match: " + usedMemoryMB, report .getUsedResource().getMemorySize(), usedMemoryMB); assertEquals("availMemoryMB doesn't match: " + availMemoryMB, report .getAvailableResource().getMemorySize(), availMemoryMB); assertEquals("usedVirtualCores doesn't match: " + usedVirtualCores, report .getUsedResource().getVirtualCores(), usedVirtualCores); assertEquals("availVirtualCores doesn't match: " + availVirtualCores, report .getAvailableResource().getVirtualCores(), availVirtualCores); } if (opportunisticStatus != null) { assertEquals("numRunningOpportContainers doesn't match: " + numRunningOpportContainers, opportunisticStatus.getRunningOpportContainers(), numRunningOpportContainers); assertEquals("usedMemoryOpportGB doesn't match: " + usedMemoryOpportGB, opportunisticStatus.getOpportMemoryUsed(), usedMemoryOpportGB); assertEquals( "usedVirtualCoresOpport doesn't match: " + usedVirtualCoresOpport, opportunisticStatus.getOpportCoresUsed(), usedVirtualCoresOpport); assertEquals("numQueuedContainers doesn't match: " + numQueuedContainers, opportunisticStatus.getQueuedOpportContainers(), numQueuedContainers); } } }
[ "zhujy@super01.ivic.org.cn" ]
zhujy@super01.ivic.org.cn
e2816a0b336aeff49802d5055eb10ba6694588d0
73b76832fca6ee2b2ea77d993e6bda5bf4e4e85f
/app/src/app/src/main/java/com/example/tarecoapp/PetActivity.java
0a98855607ac8cc320d23e3b56a8003e2c85c918
[]
no_license
caio-davi/AggiesInvent-VETMED
b2bad594507e597caee58ca5ff447e68ac464699
290faa47b0233d6c01177ae520f6893e10c49427
refs/heads/main
2023-02-26T09:16:07.001461
2021-01-24T18:19:19
2021-01-24T18:19:19
332,087,667
0
0
null
null
null
null
UTF-8
Java
false
false
905
java
package com.example.tarecoapp; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.animation.AnimationUtils; public class PetActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_pet); } public void onProfileClick(View view) { view.startAnimation(AnimationUtils.loadAnimation(this, R.anim.image_click)); Intent intent = new Intent(this, UserProfileActivity.class); startActivity(intent); } public void onTarecoClick(View view) { view.startAnimation(AnimationUtils.loadAnimation(this, R.anim.image_click)); Intent intent = new Intent(this, PetProfileActivity.class); startActivity(intent); } }
[ "denisrcs@gmail.com" ]
denisrcs@gmail.com
a8879ca67340b617700e1ac7c8caa8491e51f06e
c7c23ce17f3fc3500ae885bb0077b91e9a2a7acc
/bizcore/WEB-INF/bcex_core_src/com/doublechaintech/bcex/secuserblocking/SecUserBlockingManagerImpl.java
f07de8c2f7ffa90cdad764920071cb784abc5be3
[]
no_license
doublechaintech/bcex-biz-suite
94250e04264bd8b0a2905ea512e407fc3a639b78
c5aa55629b3fe4222789a8931f3e0d92f165a161
refs/heads/master
2020-09-05T19:35:58.182241
2019-11-12T10:06:02
2019-11-12T10:06:02
220,193,679
4
1
null
null
null
null
UTF-8
Java
false
false
28,940
java
package com.doublechaintech.bcex.secuserblocking; import java.util.Date; import java.util.Map; import java.util.List; import java.util.ArrayList; import java.util.Arrays; import java.math.BigDecimal; import com.terapico.caf.DateTime; import com.doublechaintech.bcex.BaseEntity; import com.doublechaintech.bcex.Message; import com.doublechaintech.bcex.SmartList; import com.doublechaintech.bcex.MultipleAccessKey; import com.doublechaintech.bcex.BcexUserContext; //import com.doublechaintech.bcex.BaseManagerImpl; import com.doublechaintech.bcex.BcexCheckerManager; import com.doublechaintech.bcex.CustomBcexCheckerManager; import com.doublechaintech.bcex.secuser.SecUser; import com.doublechaintech.bcex.secuserblocking.SecUserBlocking; import com.doublechaintech.bcex.userdomain.UserDomain; public class SecUserBlockingManagerImpl extends CustomBcexCheckerManager implements SecUserBlockingManager { private static final String SERVICE_TYPE = "SecUserBlocking"; @Override public String serviceFor(){ return SERVICE_TYPE; } protected void throwExceptionWithMessage(String value) throws SecUserBlockingManagerException{ Message message = new Message(); message.setBody(value); throw new SecUserBlockingManagerException(message); } protected SecUserBlocking saveSecUserBlocking(BcexUserContext userContext, SecUserBlocking secUserBlocking, String [] tokensExpr) throws Exception{ //return getSecUserBlockingDAO().save(secUserBlocking, tokens); Map<String,Object>tokens = parseTokens(tokensExpr); return saveSecUserBlocking(userContext, secUserBlocking, tokens); } protected SecUserBlocking saveSecUserBlockingDetail(BcexUserContext userContext, SecUserBlocking secUserBlocking) throws Exception{ return saveSecUserBlocking(userContext, secUserBlocking, allTokens()); } public SecUserBlocking loadSecUserBlocking(BcexUserContext userContext, String secUserBlockingId, String [] tokensExpr) throws Exception{ checkerOf(userContext).checkIdOfSecUserBlocking(secUserBlockingId); checkerOf(userContext).throwExceptionIfHasErrors( SecUserBlockingManagerException.class); Map<String,Object>tokens = parseTokens(tokensExpr); SecUserBlocking secUserBlocking = loadSecUserBlocking( userContext, secUserBlockingId, tokens); //do some calc before sent to customer? return present(userContext,secUserBlocking, tokens); } public SecUserBlocking searchSecUserBlocking(BcexUserContext userContext, String secUserBlockingId, String textToSearch,String [] tokensExpr) throws Exception{ checkerOf(userContext).checkIdOfSecUserBlocking(secUserBlockingId); checkerOf(userContext).throwExceptionIfHasErrors( SecUserBlockingManagerException.class); Map<String,Object>tokens = tokens().allTokens().searchEntireObjectText("startsWith", textToSearch).initWithArray(tokensExpr); SecUserBlocking secUserBlocking = loadSecUserBlocking( userContext, secUserBlockingId, tokens); //do some calc before sent to customer? return present(userContext,secUserBlocking, tokens); } protected SecUserBlocking present(BcexUserContext userContext, SecUserBlocking secUserBlocking, Map<String, Object> tokens) throws Exception { addActions(userContext,secUserBlocking,tokens); SecUserBlocking secUserBlockingToPresent = secUserBlockingDaoOf(userContext).present(secUserBlocking, tokens); List<BaseEntity> entityListToNaming = secUserBlockingToPresent.collectRefercencesFromLists(); secUserBlockingDaoOf(userContext).alias(entityListToNaming); return secUserBlockingToPresent; } public SecUserBlocking loadSecUserBlockingDetail(BcexUserContext userContext, String secUserBlockingId) throws Exception{ SecUserBlocking secUserBlocking = loadSecUserBlocking( userContext, secUserBlockingId, allTokens()); return present(userContext,secUserBlocking, allTokens()); } public Object view(BcexUserContext userContext, String secUserBlockingId) throws Exception{ SecUserBlocking secUserBlocking = loadSecUserBlocking( userContext, secUserBlockingId, viewTokens()); return present(userContext,secUserBlocking, allTokens()); } protected SecUserBlocking saveSecUserBlocking(BcexUserContext userContext, SecUserBlocking secUserBlocking, Map<String,Object>tokens) throws Exception{ return secUserBlockingDaoOf(userContext).save(secUserBlocking, tokens); } protected SecUserBlocking loadSecUserBlocking(BcexUserContext userContext, String secUserBlockingId, Map<String,Object>tokens) throws Exception{ checkerOf(userContext).checkIdOfSecUserBlocking(secUserBlockingId); checkerOf(userContext).throwExceptionIfHasErrors( SecUserBlockingManagerException.class); return secUserBlockingDaoOf(userContext).load(secUserBlockingId, tokens); } protected<T extends BaseEntity> void addActions(BcexUserContext userContext, SecUserBlocking secUserBlocking, Map<String, Object> tokens){ super.addActions(userContext, secUserBlocking, tokens); addAction(userContext, secUserBlocking, tokens,"@create","createSecUserBlocking","createSecUserBlocking/","main","primary"); addAction(userContext, secUserBlocking, tokens,"@update","updateSecUserBlocking","updateSecUserBlocking/"+secUserBlocking.getId()+"/","main","primary"); addAction(userContext, secUserBlocking, tokens,"@copy","cloneSecUserBlocking","cloneSecUserBlocking/"+secUserBlocking.getId()+"/","main","primary"); addAction(userContext, secUserBlocking, tokens,"sec_user_blocking.addSecUser","addSecUser","addSecUser/"+secUserBlocking.getId()+"/","secUserList","primary"); addAction(userContext, secUserBlocking, tokens,"sec_user_blocking.removeSecUser","removeSecUser","removeSecUser/"+secUserBlocking.getId()+"/","secUserList","primary"); addAction(userContext, secUserBlocking, tokens,"sec_user_blocking.updateSecUser","updateSecUser","updateSecUser/"+secUserBlocking.getId()+"/","secUserList","primary"); addAction(userContext, secUserBlocking, tokens,"sec_user_blocking.copySecUserFrom","copySecUserFrom","copySecUserFrom/"+secUserBlocking.getId()+"/","secUserList","primary"); }// end method of protected<T extends BaseEntity> void addActions(BcexUserContext userContext, SecUserBlocking secUserBlocking, Map<String, Object> tokens){ public SecUserBlocking createSecUserBlocking(BcexUserContext userContext,String who, String comments) throws Exception { checkerOf(userContext).checkWhoOfSecUserBlocking(who); checkerOf(userContext).checkCommentsOfSecUserBlocking(comments); checkerOf(userContext).throwExceptionIfHasErrors(SecUserBlockingManagerException.class); SecUserBlocking secUserBlocking=createNewSecUserBlocking(); secUserBlocking.setWho(who); secUserBlocking.setBlockTime(userContext.now()); secUserBlocking.setComments(comments); secUserBlocking = saveSecUserBlocking(userContext, secUserBlocking, emptyOptions()); onNewInstanceCreated(userContext, secUserBlocking); return secUserBlocking; } protected SecUserBlocking createNewSecUserBlocking() { return new SecUserBlocking(); } protected void checkParamsForUpdatingSecUserBlocking(BcexUserContext userContext,String secUserBlockingId, int secUserBlockingVersion, String property, String newValueExpr,String [] tokensExpr)throws Exception { checkerOf(userContext).checkIdOfSecUserBlocking(secUserBlockingId); checkerOf(userContext).checkVersionOfSecUserBlocking( secUserBlockingVersion); if(SecUserBlocking.WHO_PROPERTY.equals(property)){ checkerOf(userContext).checkWhoOfSecUserBlocking(parseString(newValueExpr)); } if(SecUserBlocking.COMMENTS_PROPERTY.equals(property)){ checkerOf(userContext).checkCommentsOfSecUserBlocking(parseString(newValueExpr)); } checkerOf(userContext).throwExceptionIfHasErrors(SecUserBlockingManagerException.class); } public SecUserBlocking clone(BcexUserContext userContext, String fromSecUserBlockingId) throws Exception{ return secUserBlockingDaoOf(userContext).clone(fromSecUserBlockingId, this.allTokens()); } public SecUserBlocking internalSaveSecUserBlocking(BcexUserContext userContext, SecUserBlocking secUserBlocking) throws Exception { return internalSaveSecUserBlocking(userContext, secUserBlocking, allTokens()); } public SecUserBlocking internalSaveSecUserBlocking(BcexUserContext userContext, SecUserBlocking secUserBlocking, Map<String,Object> options) throws Exception { //checkParamsForUpdatingSecUserBlocking(userContext, secUserBlockingId, secUserBlockingVersion, property, newValueExpr, tokensExpr); synchronized(secUserBlocking){ //will be good when the secUserBlocking loaded from this JVM process cache. //also good when there is a ram based DAO implementation //make changes to SecUserBlocking. if (secUserBlocking.isChanged()){ } secUserBlocking = saveSecUserBlocking(userContext, secUserBlocking, options); return secUserBlocking; } } public SecUserBlocking updateSecUserBlocking(BcexUserContext userContext,String secUserBlockingId, int secUserBlockingVersion, String property, String newValueExpr,String [] tokensExpr) throws Exception { checkParamsForUpdatingSecUserBlocking(userContext, secUserBlockingId, secUserBlockingVersion, property, newValueExpr, tokensExpr); SecUserBlocking secUserBlocking = loadSecUserBlocking(userContext, secUserBlockingId, allTokens()); if(secUserBlocking.getVersion() != secUserBlockingVersion){ String message = "The target version("+secUserBlocking.getVersion()+") is not equals to version("+secUserBlockingVersion+") provided"; throwExceptionWithMessage(message); } synchronized(secUserBlocking){ //will be good when the secUserBlocking loaded from this JVM process cache. //also good when there is a ram based DAO implementation //make changes to SecUserBlocking. secUserBlocking.changeProperty(property, newValueExpr); secUserBlocking = saveSecUserBlocking(userContext, secUserBlocking, tokens().done()); return present(userContext,secUserBlocking, mergedAllTokens(tokensExpr)); //return saveSecUserBlocking(userContext, secUserBlocking, tokens().done()); } } public SecUserBlocking updateSecUserBlockingProperty(BcexUserContext userContext,String secUserBlockingId, int secUserBlockingVersion, String property, String newValueExpr,String [] tokensExpr) throws Exception { checkParamsForUpdatingSecUserBlocking(userContext, secUserBlockingId, secUserBlockingVersion, property, newValueExpr, tokensExpr); SecUserBlocking secUserBlocking = loadSecUserBlocking(userContext, secUserBlockingId, allTokens()); if(secUserBlocking.getVersion() != secUserBlockingVersion){ String message = "The target version("+secUserBlocking.getVersion()+") is not equals to version("+secUserBlockingVersion+") provided"; throwExceptionWithMessage(message); } synchronized(secUserBlocking){ //will be good when the secUserBlocking loaded from this JVM process cache. //also good when there is a ram based DAO implementation //make changes to SecUserBlocking. secUserBlocking.changeProperty(property, newValueExpr); secUserBlocking = saveSecUserBlocking(userContext, secUserBlocking, tokens().done()); return present(userContext,secUserBlocking, mergedAllTokens(tokensExpr)); //return saveSecUserBlocking(userContext, secUserBlocking, tokens().done()); } } protected Map<String,Object> emptyOptions(){ return tokens().done(); } protected SecUserBlockingTokens tokens(){ return SecUserBlockingTokens.start(); } protected Map<String,Object> parseTokens(String [] tokensExpr){ return tokens().initWithArray(tokensExpr); } protected Map<String,Object> allTokens(){ return SecUserBlockingTokens.all(); } protected Map<String,Object> viewTokens(){ return tokens().allTokens() .sortSecUserListWith("id","desc") .analyzeAllLists().done(); } protected Map<String,Object> mergedAllTokens(String []tokens){ return SecUserBlockingTokens.mergeAll(tokens).done(); } //-------------------------------------------------------------- //-------------------------------------------------------------- public void delete(BcexUserContext userContext, String secUserBlockingId, int secUserBlockingVersion) throws Exception { //deleteInternal(userContext, secUserBlockingId, secUserBlockingVersion); } protected void deleteInternal(BcexUserContext userContext, String secUserBlockingId, int secUserBlockingVersion) throws Exception{ secUserBlockingDaoOf(userContext).delete(secUserBlockingId, secUserBlockingVersion); } public SecUserBlocking forgetByAll(BcexUserContext userContext, String secUserBlockingId, int secUserBlockingVersion) throws Exception { return forgetByAllInternal(userContext, secUserBlockingId, secUserBlockingVersion); } protected SecUserBlocking forgetByAllInternal(BcexUserContext userContext, String secUserBlockingId, int secUserBlockingVersion) throws Exception{ return secUserBlockingDaoOf(userContext).disconnectFromAll(secUserBlockingId, secUserBlockingVersion); } public int deleteAll(BcexUserContext userContext, String secureCode) throws Exception { /* if(!("dElEtEaLl".equals(secureCode))){ throw new SecUserBlockingManagerException("Your secure code is not right, please guess again"); } return deleteAllInternal(userContext); */ return 0; } protected int deleteAllInternal(BcexUserContext userContext) throws Exception{ return secUserBlockingDaoOf(userContext).deleteAll(); } //disconnect SecUserBlocking with domain in SecUser protected SecUserBlocking breakWithSecUserByDomain(BcexUserContext userContext, String secUserBlockingId, String domainId, String [] tokensExpr) throws Exception{ //TODO add check code here SecUserBlocking secUserBlocking = loadSecUserBlocking(userContext, secUserBlockingId, allTokens()); synchronized(secUserBlocking){ //Will be good when the thread loaded from this JVM process cache. //Also good when there is a RAM based DAO implementation secUserBlockingDaoOf(userContext).planToRemoveSecUserListWithDomain(secUserBlocking, domainId, this.emptyOptions()); secUserBlocking = saveSecUserBlocking(userContext, secUserBlocking, tokens().withSecUserList().done()); return secUserBlocking; } } protected void checkParamsForAddingSecUser(BcexUserContext userContext, String secUserBlockingId, String login, String mobile, String email, String pwd, String weixinOpenid, String weixinAppid, String accessToken, int verificationCode, DateTime verificationCodeExpire, DateTime lastLoginTime, String domainId,String [] tokensExpr) throws Exception{ checkerOf(userContext).checkIdOfSecUserBlocking(secUserBlockingId); checkerOf(userContext).checkLoginOfSecUser(login); checkerOf(userContext).checkMobileOfSecUser(mobile); checkerOf(userContext).checkEmailOfSecUser(email); checkerOf(userContext).checkPwdOfSecUser(pwd); checkerOf(userContext).checkWeixinOpenidOfSecUser(weixinOpenid); checkerOf(userContext).checkWeixinAppidOfSecUser(weixinAppid); checkerOf(userContext).checkAccessTokenOfSecUser(accessToken); checkerOf(userContext).checkVerificationCodeOfSecUser(verificationCode); checkerOf(userContext).checkVerificationCodeExpireOfSecUser(verificationCodeExpire); checkerOf(userContext).checkLastLoginTimeOfSecUser(lastLoginTime); checkerOf(userContext).checkDomainIdOfSecUser(domainId); checkerOf(userContext).throwExceptionIfHasErrors(SecUserBlockingManagerException.class); } public SecUserBlocking addSecUser(BcexUserContext userContext, String secUserBlockingId, String login, String mobile, String email, String pwd, String weixinOpenid, String weixinAppid, String accessToken, int verificationCode, DateTime verificationCodeExpire, DateTime lastLoginTime, String domainId, String [] tokensExpr) throws Exception { checkParamsForAddingSecUser(userContext,secUserBlockingId,login, mobile, email, pwd, weixinOpenid, weixinAppid, accessToken, verificationCode, verificationCodeExpire, lastLoginTime, domainId,tokensExpr); SecUser secUser = createSecUser(userContext,login, mobile, email, pwd, weixinOpenid, weixinAppid, accessToken, verificationCode, verificationCodeExpire, lastLoginTime, domainId); SecUserBlocking secUserBlocking = loadSecUserBlocking(userContext, secUserBlockingId, allTokens()); synchronized(secUserBlocking){ //Will be good when the secUserBlocking loaded from this JVM process cache. //Also good when there is a RAM based DAO implementation secUserBlocking.addSecUser( secUser ); secUserBlocking = saveSecUserBlocking(userContext, secUserBlocking, tokens().withSecUserList().done()); userContext.getManagerGroup().getSecUserManager().onNewInstanceCreated(userContext, secUser); return present(userContext,secUserBlocking, mergedAllTokens(tokensExpr)); } } protected void checkParamsForUpdatingSecUserProperties(BcexUserContext userContext, String secUserBlockingId,String id,String login,String mobile,String email,String pwd,String weixinOpenid,String weixinAppid,String accessToken,int verificationCode,DateTime verificationCodeExpire,DateTime lastLoginTime,String [] tokensExpr) throws Exception { checkerOf(userContext).checkIdOfSecUserBlocking(secUserBlockingId); checkerOf(userContext).checkIdOfSecUser(id); checkerOf(userContext).checkLoginOfSecUser( login); checkerOf(userContext).checkMobileOfSecUser( mobile); checkerOf(userContext).checkEmailOfSecUser( email); checkerOf(userContext).checkPwdOfSecUser( pwd); checkerOf(userContext).checkWeixinOpenidOfSecUser( weixinOpenid); checkerOf(userContext).checkWeixinAppidOfSecUser( weixinAppid); checkerOf(userContext).checkAccessTokenOfSecUser( accessToken); checkerOf(userContext).checkVerificationCodeOfSecUser( verificationCode); checkerOf(userContext).checkVerificationCodeExpireOfSecUser( verificationCodeExpire); checkerOf(userContext).checkLastLoginTimeOfSecUser( lastLoginTime); checkerOf(userContext).throwExceptionIfHasErrors(SecUserBlockingManagerException.class); } public SecUserBlocking updateSecUserProperties(BcexUserContext userContext, String secUserBlockingId, String id,String login,String mobile,String email,String pwd,String weixinOpenid,String weixinAppid,String accessToken,int verificationCode,DateTime verificationCodeExpire,DateTime lastLoginTime, String [] tokensExpr) throws Exception { checkParamsForUpdatingSecUserProperties(userContext,secUserBlockingId,id,login,mobile,email,pwd,weixinOpenid,weixinAppid,accessToken,verificationCode,verificationCodeExpire,lastLoginTime,tokensExpr); Map<String, Object> options = tokens() .allTokens() //.withSecUserListList() .searchSecUserListWith(SecUser.ID_PROPERTY, "is", id).done(); SecUserBlocking secUserBlockingToUpdate = loadSecUserBlocking(userContext, secUserBlockingId, options); if(secUserBlockingToUpdate.getSecUserList().isEmpty()){ throw new SecUserBlockingManagerException("SecUser is NOT FOUND with id: '"+id+"'"); } SecUser item = secUserBlockingToUpdate.getSecUserList().first(); item.updateLogin( login ); item.updateMobile( mobile ); item.updateEmail( email ); item.updatePwd( pwd ); item.updateWeixinOpenid( weixinOpenid ); item.updateWeixinAppid( weixinAppid ); item.updateAccessToken( accessToken ); item.updateVerificationCode( verificationCode ); item.updateVerificationCodeExpire( verificationCodeExpire ); item.updateLastLoginTime( lastLoginTime ); //checkParamsForAddingSecUser(userContext,secUserBlockingId,name, code, used,tokensExpr); SecUserBlocking secUserBlocking = saveSecUserBlocking(userContext, secUserBlockingToUpdate, tokens().withSecUserList().done()); synchronized(secUserBlocking){ return present(userContext,secUserBlocking, mergedAllTokens(tokensExpr)); } } protected SecUser createSecUser(BcexUserContext userContext, String login, String mobile, String email, String pwd, String weixinOpenid, String weixinAppid, String accessToken, int verificationCode, DateTime verificationCodeExpire, DateTime lastLoginTime, String domainId) throws Exception{ SecUser secUser = new SecUser(); secUser.setLogin(login); secUser.setMobile(mobile); secUser.setEmail(email); secUser.setClearTextOfPwd(pwd); secUser.setWeixinOpenid(weixinOpenid); secUser.setWeixinAppid(weixinAppid); secUser.setAccessToken(accessToken); secUser.setVerificationCode(verificationCode); secUser.setVerificationCodeExpire(verificationCodeExpire); secUser.setLastLoginTime(lastLoginTime); UserDomain domain = new UserDomain(); domain.setId(domainId); secUser.setDomain(domain); secUser.setCurrentStatus("INIT"); return secUser; } protected SecUser createIndexedSecUser(String id, int version){ SecUser secUser = new SecUser(); secUser.setId(id); secUser.setVersion(version); return secUser; } protected void checkParamsForRemovingSecUserList(BcexUserContext userContext, String secUserBlockingId, String secUserIds[],String [] tokensExpr) throws Exception { checkerOf(userContext).checkIdOfSecUserBlocking(secUserBlockingId); for(String secUserIdItem: secUserIds){ checkerOf(userContext).checkIdOfSecUser(secUserIdItem); } checkerOf(userContext).throwExceptionIfHasErrors(SecUserBlockingManagerException.class); } public SecUserBlocking removeSecUserList(BcexUserContext userContext, String secUserBlockingId, String secUserIds[],String [] tokensExpr) throws Exception{ checkParamsForRemovingSecUserList(userContext, secUserBlockingId, secUserIds, tokensExpr); SecUserBlocking secUserBlocking = loadSecUserBlocking(userContext, secUserBlockingId, allTokens()); synchronized(secUserBlocking){ //Will be good when the secUserBlocking loaded from this JVM process cache. //Also good when there is a RAM based DAO implementation secUserBlockingDaoOf(userContext).planToRemoveSecUserList(secUserBlocking, secUserIds, allTokens()); secUserBlocking = saveSecUserBlocking(userContext, secUserBlocking, tokens().withSecUserList().done()); deleteRelationListInGraph(userContext, secUserBlocking.getSecUserList()); return present(userContext,secUserBlocking, mergedAllTokens(tokensExpr)); } } protected void checkParamsForRemovingSecUser(BcexUserContext userContext, String secUserBlockingId, String secUserId, int secUserVersion,String [] tokensExpr) throws Exception{ checkerOf(userContext).checkIdOfSecUserBlocking( secUserBlockingId); checkerOf(userContext).checkIdOfSecUser(secUserId); checkerOf(userContext).checkVersionOfSecUser(secUserVersion); checkerOf(userContext).throwExceptionIfHasErrors(SecUserBlockingManagerException.class); } public SecUserBlocking removeSecUser(BcexUserContext userContext, String secUserBlockingId, String secUserId, int secUserVersion,String [] tokensExpr) throws Exception{ checkParamsForRemovingSecUser(userContext,secUserBlockingId, secUserId, secUserVersion,tokensExpr); SecUser secUser = createIndexedSecUser(secUserId, secUserVersion); SecUserBlocking secUserBlocking = loadSecUserBlocking(userContext, secUserBlockingId, allTokens()); synchronized(secUserBlocking){ //Will be good when the secUserBlocking loaded from this JVM process cache. //Also good when there is a RAM based DAO implementation secUserBlocking.removeSecUser( secUser ); secUserBlocking = saveSecUserBlocking(userContext, secUserBlocking, tokens().withSecUserList().done()); deleteRelationInGraph(userContext, secUser); return present(userContext,secUserBlocking, mergedAllTokens(tokensExpr)); } } protected void checkParamsForCopyingSecUser(BcexUserContext userContext, String secUserBlockingId, String secUserId, int secUserVersion,String [] tokensExpr) throws Exception{ checkerOf(userContext).checkIdOfSecUserBlocking( secUserBlockingId); checkerOf(userContext).checkIdOfSecUser(secUserId); checkerOf(userContext).checkVersionOfSecUser(secUserVersion); checkerOf(userContext).throwExceptionIfHasErrors(SecUserBlockingManagerException.class); } public SecUserBlocking copySecUserFrom(BcexUserContext userContext, String secUserBlockingId, String secUserId, int secUserVersion,String [] tokensExpr) throws Exception{ checkParamsForCopyingSecUser(userContext,secUserBlockingId, secUserId, secUserVersion,tokensExpr); SecUser secUser = createIndexedSecUser(secUserId, secUserVersion); SecUserBlocking secUserBlocking = loadSecUserBlocking(userContext, secUserBlockingId, allTokens()); synchronized(secUserBlocking){ //Will be good when the secUserBlocking loaded from this JVM process cache. //Also good when there is a RAM based DAO implementation secUserBlocking.copySecUserFrom( secUser ); secUserBlocking = saveSecUserBlocking(userContext, secUserBlocking, tokens().withSecUserList().done()); userContext.getManagerGroup().getSecUserManager().onNewInstanceCreated(userContext, (SecUser)secUserBlocking.getFlexiableObjects().get(BaseEntity.COPIED_CHILD)); return present(userContext,secUserBlocking, mergedAllTokens(tokensExpr)); } } protected void checkParamsForUpdatingSecUser(BcexUserContext userContext, String secUserBlockingId, String secUserId, int secUserVersion, String property, String newValueExpr,String [] tokensExpr) throws Exception{ checkerOf(userContext).checkIdOfSecUserBlocking(secUserBlockingId); checkerOf(userContext).checkIdOfSecUser(secUserId); checkerOf(userContext).checkVersionOfSecUser(secUserVersion); if(SecUser.LOGIN_PROPERTY.equals(property)){ checkerOf(userContext).checkLoginOfSecUser(parseString(newValueExpr)); } if(SecUser.MOBILE_PROPERTY.equals(property)){ checkerOf(userContext).checkMobileOfSecUser(parseString(newValueExpr)); } if(SecUser.EMAIL_PROPERTY.equals(property)){ checkerOf(userContext).checkEmailOfSecUser(parseString(newValueExpr)); } if(SecUser.PWD_PROPERTY.equals(property)){ checkerOf(userContext).checkPwdOfSecUser(parseString(newValueExpr)); } if(SecUser.WEIXIN_OPENID_PROPERTY.equals(property)){ checkerOf(userContext).checkWeixinOpenidOfSecUser(parseString(newValueExpr)); } if(SecUser.WEIXIN_APPID_PROPERTY.equals(property)){ checkerOf(userContext).checkWeixinAppidOfSecUser(parseString(newValueExpr)); } if(SecUser.ACCESS_TOKEN_PROPERTY.equals(property)){ checkerOf(userContext).checkAccessTokenOfSecUser(parseString(newValueExpr)); } if(SecUser.VERIFICATION_CODE_PROPERTY.equals(property)){ checkerOf(userContext).checkVerificationCodeOfSecUser(parseInt(newValueExpr)); } if(SecUser.VERIFICATION_CODE_EXPIRE_PROPERTY.equals(property)){ checkerOf(userContext).checkVerificationCodeExpireOfSecUser(parseTimestamp(newValueExpr)); } if(SecUser.LAST_LOGIN_TIME_PROPERTY.equals(property)){ checkerOf(userContext).checkLastLoginTimeOfSecUser(parseTimestamp(newValueExpr)); } checkerOf(userContext).throwExceptionIfHasErrors(SecUserBlockingManagerException.class); } public SecUserBlocking updateSecUser(BcexUserContext userContext, String secUserBlockingId, String secUserId, int secUserVersion, String property, String newValueExpr,String [] tokensExpr) throws Exception{ checkParamsForUpdatingSecUser(userContext, secUserBlockingId, secUserId, secUserVersion, property, newValueExpr, tokensExpr); Map<String,Object> loadTokens = this.tokens().withSecUserList().searchSecUserListWith(SecUser.ID_PROPERTY, "eq", secUserId).done(); SecUserBlocking secUserBlocking = loadSecUserBlocking(userContext, secUserBlockingId, loadTokens); synchronized(secUserBlocking){ //Will be good when the secUserBlocking loaded from this JVM process cache. //Also good when there is a RAM based DAO implementation //secUserBlocking.removeSecUser( secUser ); //make changes to AcceleraterAccount. SecUser secUserIndex = createIndexedSecUser(secUserId, secUserVersion); SecUser secUser = secUserBlocking.findTheSecUser(secUserIndex); if(secUser == null){ throw new SecUserBlockingManagerException(secUser+" is NOT FOUND" ); } secUser.changeProperty(property, newValueExpr); secUserBlocking = saveSecUserBlocking(userContext, secUserBlocking, tokens().withSecUserList().done()); return present(userContext,secUserBlocking, mergedAllTokens(tokensExpr)); } } /* */ public void onNewInstanceCreated(BcexUserContext userContext, SecUserBlocking newCreated) throws Exception{ ensureRelationInGraph(userContext, newCreated); sendCreationEvent(userContext, newCreated); } }
[ "zhangxilai@doublechaintech.com" ]
zhangxilai@doublechaintech.com
782d57f48b4067aba39357b260070c8865ae26f7
d031053cc68795e86d38113b731fe23fa68564c0
/hb-02-one-to-one-bi/src/com/luv2code/hibernate/demo/GetInstructorDetailDemo.java
b6dfa04e533fa9197c8f543307ae7f10becb06a0
[]
no_license
mounika439/Spring-Hibernate-Code-Examples
053f9b68221c5f8e3f7c1d6abe60134eeea30327
f559108b8e54f2a2aa51ec65a58547f6f070b32b
refs/heads/master
2020-03-26T02:58:31.604758
2018-08-12T03:11:04
2018-08-12T03:11:04
144,433,711
0
0
null
null
null
null
UTF-8
Java
false
false
1,426
java
package com.luv2code.hibernate.demo; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; import com.luv2code.hibernate.demo.entity.Instructor; import com.luv2code.hibernate.demo.entity.InstructorDetail; import com.luv2code.hibernate.demo.entity.Student; public class GetInstructorDetailDemo { public static void main(String[] args) { //create session factory SessionFactory factory = new Configuration() .configure("hibernate.cfg.xml") .addAnnotatedClass(Instructor.class) .addAnnotatedClass(InstructorDetail.class) .buildSessionFactory(); //create session Session session = factory.getCurrentSession(); try{ //start a transaction session.beginTransaction(); int theId = 2; // get the instructor detail object InstructorDetail tempInstructorDetail = session.get(InstructorDetail.class, theId); // print the instructor detail object System.out.println("tempInstructorDetail : "+tempInstructorDetail); // print associated instructor System.out.println("the associacted Instructor " + tempInstructorDetail.getInstructor()); //commit transaction session.getTransaction().commit(); System.out.println("Done"); }catch(Exception e){ e.printStackTrace(); // handle the leak issue } finally{ factory.close(); } } }
[ "uppala.mounika13@gmail.com" ]
uppala.mounika13@gmail.com
bf00b299de06067ff83698aefd8a3787c364f0db
986fbc8d16bd8011e16c4cdc1fcb950981348049
/src/main/java/cn/guanmai/station/interfaces/invoicing/StockRecordService.java
271325ff728d50491faedd9abd586ee77539f039
[]
no_license
wdkimsea/test_station
9a47e7df6756621d624e818555c0409fdfe2cb8d
9607c321a3f9aa45d8c2fef328b917cc72183b72
refs/heads/master
2023-01-19T00:47:59.028105
2020-11-22T01:16:36
2020-11-22T01:16:36
314,933,825
0
0
null
null
null
null
UTF-8
Java
false
false
2,980
java
package cn.guanmai.station.interfaces.invoicing; import java.util.List; import cn.guanmai.station.bean.invoicing.RefundStockRecordBean; import cn.guanmai.station.bean.invoicing.SplitStockInRecordBean; import cn.guanmai.station.bean.invoicing.SplitStockOutRecordBean; import cn.guanmai.station.bean.invoicing.StockAbandonGoodsRecordBean; import cn.guanmai.station.bean.invoicing.InStockRecordBean; import cn.guanmai.station.bean.invoicing.StockIncreaseRecordBean; import cn.guanmai.station.bean.invoicing.StockLossRecordBean; import cn.guanmai.station.bean.invoicing.OutStockRecordBean; import cn.guanmai.station.bean.invoicing.ReturnStockRecordBean; import cn.guanmai.station.bean.invoicing.param.InStockRecordFilterParam; import cn.guanmai.station.bean.invoicing.param.OutStockRecordFilterParam; import cn.guanmai.station.bean.invoicing.param.StockRecordFilterParam; /* * @author liming * @date Jan 8, 2019 7:37:59 PM * @des 库存记录相关接口 * @version 1.0 */ public interface StockRecordService { /** * 成品入库记录 * * @param paramBean * @return * @throws Exception */ public List<InStockRecordBean> inStockRecords(InStockRecordFilterParam stockInRecordFilterParam) throws Exception; /** * 商户退货入库记录 * * @param paramBean * @return * @throws Exception */ public List<RefundStockRecordBean> refundRecords(StockRecordFilterParam paramBean) throws Exception; /** * 商户退货放弃取货记录 * * @param stockRecordFilterParam * @return * @throws Exception */ public List<StockAbandonGoodsRecordBean> abandonGoodsRecords(StockRecordFilterParam stockRecordFilterParam) throws Exception; /** * 成品出库记录 * * @param paramBean * @return * @throws Exception */ public List<OutStockRecordBean> outStockRecords(OutStockRecordFilterParam paramBean) throws Exception; /** * 成品退货记录 * * @param paramBean * @return * @throws Exception */ public List<ReturnStockRecordBean> returnStockRecords(StockRecordFilterParam paramBean) throws Exception; /** * 库存报溢记录 * * @param paramBean * @return * @throws Exception */ public List<StockIncreaseRecordBean> increaseStockRecords(StockRecordFilterParam paramBean) throws Exception; /** * 库存报损记录 * * @param stockRecordFilterParam * @return * @throws Exception */ public List<StockLossRecordBean> lossStockRecords(StockRecordFilterParam stockRecordFilterParam) throws Exception; /** * 分割入库记录 * * @param stockRecordFilterParam * @return * @throws Exception */ public List<SplitStockInRecordBean> splitStockInRecords(StockRecordFilterParam stockRecordFilterParam) throws Exception; /** * 分割出库记录 * * @param stockRecordFilterParam * @return * @throws Exception */ public List<SplitStockOutRecordBean> splitStockOutRecords(StockRecordFilterParam stockRecordFilterParam) throws Exception; }
[ "yangjinhai@guanmai.cn" ]
yangjinhai@guanmai.cn
9db22df73fc993ae86c7d01d97230be92ad183dc
67c511c505b13bc3da56c28d6d324ee4166778ca
/SolutionJavaAPI/src/main/java/annotation/SolutionAnnotationTest.java
a4fa715d80d0b9316e3c865ce8e90e6eb0827b50
[]
no_license
cenxui/SolutionJavaAPI
eb7246632d071bd397f2c452deadc9ef35c2d26b
6011fb2c7bfa989736cc23cc0507ca0ff4d60603
refs/heads/master
2020-08-05T13:05:56.598835
2017-04-18T14:01:58
2017-04-18T14:01:58
67,761,217
1
0
null
null
null
null
UTF-8
Java
false
false
1,384
java
package annotation; import java.lang.annotation.Native; import java.lang.reflect.Array; import java.util.Arrays; import java.util.stream.Stream; import com.google.gson.internal.Streams; import annotation.interfaces.ClassInterface; import annotation.interfaces.Fresh; import annotation.interfaces.FruitType; import annotation.interfaces.Fruits; import annotation.interfaces.RunWith; import annotation.interfaces.TypeCast; @RunWith(SolutionAnnotationTest.class) public class SolutionAnnotationTest { public static void main(String[] args) { Class<Apple> apple = Apple.class; // Object object = new @ClassInterface Object(); // // String string = (@TypeCast String)object; System.out.println("AnnotatedInterfaces : " + apple.getAnnotatedInterfaces().length); System.out.println("Annotations : " + apple.getAnnotations().length); System.out.println("" + apple.getConstructors().length); Arrays.asList(apple.getConstructors()[0].getAnnotations()).forEach(System.out::println); } @Fruits(type = FruitType.APPLE, regions = "Japan") private static class Apple { @RunWith(Apple.class) @Fruits(type = FruitType.APPLE, regions = "Japen") public Apple() { // TODO Auto-generated constructor stub } /** * */ @Fresh public void eat(String food) { } } private static class JapanApple extends Apple { } }
[ "cenxuilin@gmail.com" ]
cenxuilin@gmail.com
e3ea0dd353028c6ff38546e45938b42d863a8de7
c79a207f5efdc03a2eecea3832b248ca8c385785
/com.googlecode.jinahya/xmlpull-accessible/src/test/java/com/googlecode/jinahya/xmlpull/xs/XSDateTimeAdapterTest.java
eff0c2bbe6945b02c118e91d791e0ec43e2bd6cf
[]
no_license
jinahya/jinahya
977e51ac2ad0af7b7c8bcd825ca3a576408f18b8
5aef255b49da46ae62fb97bffc0c51beae40b8a4
refs/heads/master
2023-07-26T19:08:55.170759
2015-12-02T07:32:18
2015-12-02T07:32:18
32,245,127
2
1
null
2023-07-12T19:42:46
2015-03-15T04:34:19
Java
UTF-8
Java
false
false
1,501
java
/* * Copyright 2011 Jin Kwon <jinahya at gmail.com>. * * 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.googlecode.jinahya.xmlpull.xs; import java.io.IOException; import java.util.Date; import org.testng.annotations.Test; import org.xmlpull.v1.XmlPullParserException; /** * * @author Jin Kwon <jinahya at gmail.com> */ public class XSDateTimeAdapterTest extends XSTemporalAdapterTest<XSDateTimeAdapter> { private static final String[] XS_DATE_TIME_STRINGS = new String[]{ "2001-10-26T21:32:52", "2001-10-26T21:32:52+02:00", "2001-10-26T19:32:52Z", "2001-10-26T19:32:52+00:00", "-2001-10-26T21:32:52", "2001-10-26T21:32:52.12679" }; @Test public void testParse() throws XmlPullParserException, IOException { testParse(new XSDateTimeAdapter(), XS_DATE_TIME_STRINGS); } @Test public void testSerialize() throws IOException { testSerialize(new XSDateTimeAdapter(), new Date()); } }
[ "onacit@e3df469a-503a-0410-a62b-eff8d5f2b914" ]
onacit@e3df469a-503a-0410-a62b-eff8d5f2b914
9b40d476a021a240c5b49547e26cf8a2fda1e69d
adc2b9e1b9b64dae100ba25f841f3628c5599db0
/src/project4/GameDisplay.java
04c09e583640afe2e956bc066050aadfaf8b77a9
[]
no_license
Gorillun/Concurrent3
83749ab07e68cb6bbd33c339b7165eef4070f512
f45833f877e960f02ec3d9aa098629243f2f1fc4
refs/heads/master
2021-08-23T11:55:50.318779
2017-12-04T20:18:43
2017-12-04T20:18:43
113,090,477
0
0
null
null
null
null
UTF-8
Java
false
false
14,627
java
/* Keith Fosmire CSC375 Concurrent Programming Fall 2016 Prject3 DETAILS: This project uses the concept of parallel programming by using ConcuurentRecursiveAction and fork() Join(). The game looks for possible moves throught the sweeper class until it finds no more possible moves */ package project4; import java.awt.Color; import java.awt.Dimension; import java.awt.GridLayout; import java.awt.Image; import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; import java.util.Random; import java.util.StringTokenizer; import java.util.concurrent.ForkJoinPool; import java.util.logging.Level; import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.SwingUtilities; /** * * @author keith */ public class GameDisplay extends JPanel implements ActionListener { private static final int SML_SIDE = 3; private static final int SIDE = SML_SIDE * SML_SIDE; private static final int GAP = 3; private static final Color BG = Color.BLACK; private static final Dimension BTN_PREF_SIZE = new Dimension(80, 80); private JButton[] buttons = new JButton[81]; private boolean firstMove = true; private JButton buttonA; private JButton buttonB; private JButton leaped; private JButton[] playButtons = new JButton[45]; private int numButtons = 0; private Thread player; private Thread sweeper; private int score; private Thread t; private boolean auto = true; private JPanel panel = new JPanel(new GridLayout(9, 9)); private ForkJoinPool pool; private Sweep sweep; private boolean stop = true; public GameDisplay() { setBackground(BG); setLayout(new GridLayout(1, 1, GAP, GAP)); setBorder(BorderFactory.createEmptyBorder(GAP, GAP, GAP, GAP)); add(panel); for (int i = 0; i < buttons.length; i++) { buttons[i] = new JButton(); if (i == 0) { buttons[i].setName("play"); } else { buttons[i].setName("x"); } buttons[i].setBackground(Color.BLUE); buttons[i].setPreferredSize(BTN_PREF_SIZE); buttons[i].addActionListener(this); panel.add(buttons[i]); } setGamePieces(); } private static void createAndShowGui() { GameDisplay mainPanel = new GameDisplay(); JFrame frame = new JFrame("Peg Solitaire"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(mainPanel); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(() -> { createAndShowGui(); }); } public void setGamePieces() { Image imgB; Image imgM; sweep = new Sweep(buttons, 0, 81, panel); pool = new ForkJoinPool(); try { imgB = ImageIO.read(getClass().getResource("empty.png")); imgM = ImageIO.read(getClass().getResource("marble.png")); int i = 3; while (i < 6) { buttons[i].setBackground(Color.WHITE); buttons[i].setIcon(new ImageIcon(imgM)); buttons[i].setName("m"); ++i; } i = 12; while (i < 15) { buttons[i].setBackground(Color.WHITE); buttons[i].setIcon(new ImageIcon(imgM)); buttons[i].setName("m"); ++i; } i = 21; while (i < 24) { buttons[i].setBackground(Color.WHITE); buttons[i].setIcon(new ImageIcon(imgM)); buttons[i].setName("m"); ++i; } i = 27; while (i < 54) { if (i == 40) { buttons[i].setBackground(Color.WHITE); buttons[i].setIcon(new ImageIcon(imgB)); buttons[i].setName("b"); } else { buttons[i].setBackground(Color.WHITE); buttons[i].setIcon(new ImageIcon(imgM)); buttons[i].setName("m"); } ++i; } i = 57; while (i < 60) { buttons[i].setBackground(Color.WHITE); buttons[i].setIcon(new ImageIcon(imgM)); buttons[i].setName("m"); ++i; } i = 66; while (i < 69) { buttons[i].setBackground(Color.WHITE); buttons[i].setIcon(new ImageIcon(imgM)); buttons[i].setName("m"); ++i; } i = 75; while (i < 78) { buttons[i].setBackground(Color.WHITE); buttons[i].setIcon(new ImageIcon(imgM)); buttons[i].setName("m"); ++i; } } catch (IOException ex) { System.out.println(ex); } } @Override public void actionPerformed(ActionEvent e) { setBackground(BG); JButton temp = (JButton) e.getSource(); if (temp.getName().equals("play")) { autoPlay(); sweeper(); stop = true; } else { if (temp.getBackground().equals(Color.BLUE)) { } else if (temp.getIcon() != null && firstMove) { firstMove = false; buttonA = temp; } else if (temp.getIcon() != null && !firstMove) { buttonB = temp; firstMove = true; try { Image imgB = ImageIO.read(getClass().getResource("empty.png")); Image imgM = ImageIO.read(getClass().getResource("marble.png")); //temp.setIcon((new ImageIcon())); if (buttonB.getName().equals("b") && buttonA.getName().equals("m")) { int xA, xB, yA, yB; xA = buttonA.getX(); yA = buttonA.getY(); xB = buttonB.getX(); yB = buttonB.getY(); if (xA == xB && yA != yB) { if (yA > yB) { if (yA - yB == 160) { Point p = new Point(); p.setLocation(xB, yB + 80); temp = (JButton) panel.getComponentAt(p); if (temp.getName().equals("m")) { temp.setIcon(new ImageIcon(imgB)); temp.setName("b"); buttonA.setIcon(new ImageIcon(imgB)); buttonA.setName("b"); buttonB.setIcon(new ImageIcon(imgM)); buttonB.setName("m"); buttonA = null; buttonB = null; } else { buttonA = null; buttonB = null; } } } else { if (yB - yA == 160) { Point p = new Point(); p.setLocation(xB, yA + 80); temp = (JButton) panel.getComponentAt(p); if (temp.getName().equals("m")) { temp.setIcon(new ImageIcon(imgB)); temp.setName("b"); buttonA.setIcon(new ImageIcon(imgB)); buttonA.setName("b"); buttonB.setIcon(new ImageIcon(imgM)); buttonB.setName("m"); buttonA = null; buttonB = null; } else { buttonA = null; buttonB = null; } } } } else if (yA == yB) { if (xA > xB) { if (xA - xB == 160) { Point p = new Point(); p.setLocation(xB + 80, yB); temp = (JButton) panel.getComponentAt(p); if (temp.getName().equals("m")) { temp.setIcon(new ImageIcon(imgB)); temp.setName("b"); buttonA.setIcon(new ImageIcon(imgB)); buttonA.setName("b"); buttonB.setIcon(new ImageIcon(imgM)); buttonB.setName("m"); buttonA = null; buttonB = null; } else { buttonA = null; buttonB = null; } } } else { if (xB - xA == 160) { Point p = new Point(); p.setLocation(xA + 80, yA); temp = (JButton) panel.getComponentAt(p); if (temp.getName().equals("m")) { temp.setIcon(new ImageIcon(imgB)); temp.setName("b"); buttonA.setIcon(new ImageIcon(imgB)); buttonA.setName("b"); buttonB.setIcon(new ImageIcon(imgM)); buttonB.setName("m"); buttonA = null; buttonB = null; } else { buttonA = null; buttonB = null; } } } } else { buttonA = null; buttonB = null; } } } catch (IOException ex) { Logger.getLogger(GameDisplay.class.getName()).log(Level.SEVERE, null, ex); } //checkScore(); } } } public void checkScore() { return; } public void autoPlay() { player = new Thread() { public void run() { while (stop) { Random ran = new Random(); int rN = ran.nextInt(80); JButton a = buttons[rN]; if (a.getName().equals("m")) { int x = a.getX(); int y = a.getY(); JButton leaped; JButton land; if (!(x + 160 >= 640)) { leaped = (JButton) panel.getComponentAt(x + 80, y); land = (JButton) panel.getComponentAt(x + 160, y); if (land.getName().equals("b") && leaped.getName().equals("m")) { a.doClick(); land.doClick(); } } if ((x - 160 >= 0)) { leaped = (JButton) panel.getComponentAt(x - 80, y); land = (JButton) panel.getComponentAt(x - 160, y); if (land.getName().equals("b") && leaped.getName().equals("m")) { a.doClick(); land.doClick(); } } if (!(y + 160 >= 640)) { leaped = (JButton) panel.getComponentAt(x, y + 80); land = (JButton) panel.getComponentAt(x, y + 160); if (land.getName().equals("b") && leaped.getName().equals("m")) { a.doClick(); land.doClick(); } } if ((y - 160 >0)) { leaped = (JButton) panel.getComponentAt(x, y - 80); land = (JButton) panel.getComponentAt(x, y - 160); if (land.getName().equals("b") && leaped.getName().equals("m")) { a.doClick(); land.doClick(); } } } } } }; player.start(); } public void sweeper() { sweeper = new Thread() { public void run() { while (stop) { pool.invoke(sweep); while (!sweep.isDone()) { } //System.out.println(sweep.getResult()); } } }; sweeper.start(); } public void youLose() { setBackground(Color.RED); JOptionPane.showMessageDialog(this, "YOU LOST! CLICK TO TRY AGAIN", "LOSER", JOptionPane.QUESTION_MESSAGE); } }
[ "keith.m.fosmire@gmail.com" ]
keith.m.fosmire@gmail.com
798af7a0a78f80f6034b907e8a149c4236c9155b
fe6dd6c6e47164f8b16d584ab3e42c99b608555e
/app/src/main/java/com/tokayoapp/Adapter/ViewpagerAdapterRedemptionItemDetail.java
2a69d10c44daa71bc2f285144fae24ce02bc0d6e
[]
no_license
abhilashasharma2021/Tokayoo
e8684b39bdac7865600a82bf27a1a011339feecb
7bea414df0e92aa927564777fa61c47c1787002d
refs/heads/master
2023-04-02T19:54:04.050902
2021-04-03T03:58:15
2021-04-03T03:58:15
335,620,548
0
0
null
null
null
null
UTF-8
Java
false
false
2,076
java
package com.tokayoapp.Adapter; import android.content.Context; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import androidx.annotation.NonNull; import androidx.viewpager.widget.PagerAdapter; import androidx.viewpager.widget.ViewPager; import com.squareup.picasso.Picasso; import com.tokayoapp.Modal.RedemptionDetailModal; import com.tokayoapp.Modal.RewardDetailModal; import com.tokayoapp.R; import java.util.List; public class ViewpagerAdapterRedemptionItemDetail extends PagerAdapter { private Context context; private LayoutInflater layoutInflater; List<RedemptionDetailModal> redemptionDetailModals; public ViewpagerAdapterRedemptionItemDetail(Context context, List<RedemptionDetailModal> redemptionDetailModals) { this.context=context; this.redemptionDetailModals=redemptionDetailModals; } @Override public int getCount() { return redemptionDetailModals.size(); } @Override public boolean isViewFromObject(@NonNull View view, @NonNull Object object) { return view==object; } @NonNull @Override public Object instantiateItem(@NonNull ViewGroup container, int position) { layoutInflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view=layoutInflater.inflate(R.layout.custom_enlarge_image_layout,null); RedemptionDetailModal data = redemptionDetailModals.get(position); ImageView imageView=(ImageView)view.findViewById(R.id.my_image); Log.e("dsfsfv",data.getPath()); Picasso.with(context).load(data.getPath()+data.getImage()).into(imageView); ViewPager viewPager=(ViewPager)container; viewPager.addView(view); return view; } @Override public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) { ViewPager viewPager=(ViewPager)container; View view=(View)object; viewPager.removeView(view); } }
[ "suhanashuri584@gmail.com" ]
suhanashuri584@gmail.com
e18f77ee15c3ab4bef63cd87ca7681f9c9f03479
af0b7b9401cdb58ecf140a687f20d046f89f238f
/app/src/main/java/com/example/shahriar_vaio/mydaytodolisthabittracker/Splash.java
5d728b46c45602daa4c1171d1e6abca01cab2ac9
[]
no_license
Ttasmiyah/Project_MyDay
206d388ca1f4a86bec911ea88c54dc98440ab43f
fe98c056c24ca4aa23a70bc994cef70e708c45e3
refs/heads/master
2020-04-26T14:23:14.771293
2019-03-03T18:21:46
2019-03-03T18:21:46
173,612,231
0
0
null
null
null
null
UTF-8
Java
false
false
1,420
java
package com.example.shahriar_vaio.mydaytodolisthabittracker; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.ImageView; import android.widget.TextView; import maes.tech.intentanim.CustomIntent; public class Splash extends AppCompatActivity { private TextView tv; private ImageView iv; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); tv = findViewById(R.id.tvID); iv = findViewById(R.id.ivID); Animation myAnim = AnimationUtils.loadAnimation(this,R.anim.mytransition); tv.setAnimation(myAnim); iv.setAnimation(myAnim); final Intent intent = new Intent(this, MainActivity.class); Thread timer = new Thread(){ public void run() { try { sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } finally { startActivity(intent); //CustomIntent.customType(Splash.this,"rotateout-to-rotatein"); finish(); } } }; timer.start(); } }
[ "tasmyah.t07@gmail.com" ]
tasmyah.t07@gmail.com
f7f7e36c0facbbc8408601cd2bddf4de3e361395
c7a0674925e07304b6bbb17fe641cdfb18e60981
/app/src/main/java/com/example/michaelasafo_comp304_a5/MapsActivity.java
54ab4512e94c87389651bdb586ae7b88279ff469
[]
no_license
mojoelectrical/Android-Restaurant_Directory
6623d73834eb6e22c2326927efe44f7a5d3d5baf
968358cccf4b6db87014e7a3ffdc8ab5422af928
refs/heads/master
2023-07-18T17:27:48.682351
2021-09-09T19:06:02
2021-09-09T19:06:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,339
java
package com.example.michaelasafo_comp304_a5; import androidx.fragment.app.FragmentActivity; import android.os.Bundle; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.MarkerOptions; public class MapsActivity extends FragmentActivity implements OnMapReadyCallback { private GoogleMap mMap; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_maps); // Obtain the SupportMapFragment and get notified when the map is ready to be used. SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map); mapFragment.getMapAsync(this); } @Override public void onMapReady(GoogleMap googleMap) { mMap = googleMap; // Add a marker in Sydney and move the camera LatLng sydney = new LatLng(-34, 151); mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney")); mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney)); } }
[ "michael_asafo@hotmail.com" ]
michael_asafo@hotmail.com
4ae24b0ceeab82a88c6be38fae6205216b663c7c
e9603903c16baf07510829de5977268c6fa083d8
/src/socket/SocketClient.java
bdcc0571f65b79d65bc83a9d3f821f6a62b917d7
[]
no_license
GTianLong/MyUtil
d947c1f71c2c0f0bac4734e28328fe5119638cbc
8f14a6baaae20b72ed6b3768069307194518b75f
refs/heads/master
2020-04-17T20:18:51.018134
2019-01-22T02:26:09
2019-01-22T02:26:09
166,900,107
0
0
null
null
null
null
UTF-8
Java
false
false
1,157
java
package socket; import java.io.IOException; import java.net.InetSocketAddress; import java.net.SocketAddress; import java.nio.ByteBuffer; import java.nio.channels.SocketChannel; /** * @program: MyUtils * @description: SocketClient * @author: GTL * @create: 2019-01-22 09:56 **/ public class SocketClient { public void sendSocket(String sendMsg) throws IOException { SocketChannel socketChannel=null; socketChannel=SocketChannel.open(); SocketAddress socketAddress=new InetSocketAddress("127.0.0.1",8080); socketChannel.connect(socketAddress); ByteBuffer buffer=ByteBuffer.allocate(1024*1024); buffer.clear(); buffer=buffer.put(sendMsg.getBytes("UTF-8")); buffer.flip(); socketChannel.write(buffer); buffer.clear(); //从服务端读取消息 int readLenth=socketChannel.read(buffer); buffer.flip(); byte[] bytes=new byte[readLenth]; buffer.get(bytes); StringBuffer receiveMsg=new StringBuffer(); receiveMsg.append(new String(bytes,"UTF-8")); buffer.clear(); socketChannel.close(); } }
[ "869553051@qq.com" ]
869553051@qq.com
2ca8160d2830896899de7f83eadb70450c27be4d
735005f6541e7a66fd57a7fc5c574ac1fc444db6
/src/com/shastram/web8085/client/ui/ExamplesLoadCommand.java
dddf6face6d6e868ae624f1524c5d8bfd083e742
[]
no_license
selfmodify/web8085
1a11b81ed16831c87d85e115c70bc14c8b2d99cd
969c886fc38275cf4a1b2793b32b65daaaa96e9a
refs/heads/master
2021-05-28T13:12:06.231726
2015-05-05T04:33:30
2015-05-05T04:33:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,882
java
package com.shastram.web8085.client.ui; import com.google.gwt.core.client.Scheduler.ScheduledCommand; import com.google.gwt.http.client.Request; import com.google.gwt.http.client.RequestBuilder; import com.google.gwt.http.client.RequestCallback; import com.google.gwt.http.client.RequestException; import com.google.gwt.http.client.Response; import com.google.gwt.user.client.ui.MenuItem; import com.shastram.web8085.client.ClientUtils; import com.shastram.web8085.client.pattern.SignalSlot; public class ExamplesLoadCommand implements ScheduledCommand { protected MenuItem item; protected String code; public ExamplesLoadCommand() { } public ExamplesLoadCommand(MenuItem item) { this.item = item; } @Override public void execute() { } protected void loadRemoteExample(final String name) { RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, "/simulator/test_cases/" + name); builder.setCallback(new RequestCallback() { @Override public void onResponseReceived(Request request, Response response) { if (response.getStatusCode() == Response.SC_OK) { code = response.getText(); SignalSlot.instance.notifyAbout( SignalSlot.Signals.EXAMPLE_SOURCE_CODE_AVAILABLE, "name", name, "code", code); } else { ClientUtils.showError(response.getStatusText()); } } @Override public void onError(Request request, Throwable exception) { ClientUtils.showError(exception.getMessage()); } }); try { builder.send(); } catch (RequestException e) { ClientUtils.showError(e.getMessage()); } } }
[ "kumar.vijay@gmail.com" ]
kumar.vijay@gmail.com
8693c70f5ee142cbe701918fb36b88304c9990f8
4a51b04557720c200227aac7415c27d5fdbacd5b
/src/main/java/com/jstarcraft/recommendation/evaluator/AbstractEvaluator.java
d63a0b3389cc1f882cf27fa56431ce29772d62c3
[ "Apache-2.0" ]
permissive
sjsdfg/jstarcraft-recommendation-1.0
dc1e709f11e5d07b49a55f680f1070852fcc3d81
2f4f16e58c587fb0ad05871b2c43044027739272
refs/heads/master
2020-05-15T15:12:15.448309
2019-04-20T05:11:56
2019-04-20T05:11:56
182,365,813
1
0
Apache-2.0
2019-04-20T05:47:18
2019-04-20T05:47:17
null
UTF-8
Java
false
false
972
java
package com.jstarcraft.recommendation.evaluator; import java.util.Collection; import java.util.List; import com.jstarcraft.core.utility.KeyValue; /** * 抽象评估器 * * @author Birdy * */ public abstract class AbstractEvaluator<T> implements Evaluator<T> { /** * 统计列表 * * @param checkCollection * @param recommendList * @return */ protected abstract int count(Collection<T> checkCollection, List<KeyValue<Integer, Float>> recommendList); /** * 测量列表 * * @param checkCollection * @param recommendList * @return */ protected abstract float measure(Collection<T> checkCollection, List<KeyValue<Integer, Float>> recommendList); @Override public final KeyValue<Integer, Float> evaluate(Collection<T> checkCollection, List<KeyValue<Integer, Float>> recommendList) { return new KeyValue<>(count(checkCollection, recommendList), measure(checkCollection, recommendList)); } }
[ "Birdy@DESKTOP-0JF93DF" ]
Birdy@DESKTOP-0JF93DF