text
stringlengths
10
2.72M
package com.tencent.mm.plugin.webview.ui.tools.jsapi; import android.content.DialogInterface; import android.content.DialogInterface.OnCancelListener; class g$117 implements OnCancelListener { final /* synthetic */ i qiH; final /* synthetic */ g qiK; g$117(g gVar, i iVar) { this.qiK = gVar; this.qiH = iVar; } public final void onCancel(DialogInterface dialogInterface) { g.a(this.qiK, this.qiH, "chooseIdCard:cancel", null); } }
package com.webcloud.func.email.model; import java.io.Serializable; /** * 邮件信息模型 * * @author ZhangZheng * @date 2014-01-20 */ public class EmailVo implements Serializable { private static final long serialVersionUID = -6126070893021672329L; private String content; private String fileList; private String flag; private String from; private boolean hasFile;// 是否有附件 private int id; private String sentDate; private String subject; private String to; public EmailVo() { super(); } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public String getFileList() { return fileList; } public void setFileList(String fileList) { this.fileList = fileList; } public String getFlag() { return flag; } public void setFlag(String flag) { this.flag = flag; } public String getFrom() { return from; } public void setFrom(String from) { this.from = from; } public boolean isHasFile() { return hasFile; } public void setHasFile(boolean hasFile) { this.hasFile = hasFile; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getSentDate() { return sentDate; } public void setSentDate(String sentDate) { this.sentDate = sentDate; } public String getSubject() { return subject; } public void setSubject(String subject) { this.subject = subject; } public String getTo() { return to; } public void setTo(String to) { this.to = to; } }
package evm.dmc.core.api; import javax.annotation.PostConstruct; import org.springframework.context.ApplicationContextAware; import java.util.Map; import java.util.Set; import evm.dmc.api.model.FrameworkModel; //import evm.dmc.core.api.DMCDataLoader; //import evm.dmc.core.api.DMCDataSaver; import evm.dmc.core.api.DMCFunction; import evm.dmc.core.api.exceptions.NoSuchFunctionException; /** * The Interface Framework. Interface describes common methods for using * Framework objects * * @author id23cat */ public interface Framework extends ApplicationContextAware { /** * Method is used for first initialization of framework or resetting * settings to default. */ @PostConstruct void initFramework(); /** * Method must return list of short descriptors or identifiers of functions * provided by framework. * * @return the function descriptors */ Set<String> getFunctionDescriptors(); Map<String, Class<?>> getSaverDescriptors(); Map<String, Class<?>> getLoaderDescriptors(); /** * Gets the DMC function. * * @param descriptor * the descriptor * @return the DMC function * @throws NoSuchFunctionException TODO */ DMCFunction getDMCFunction(String descriptor) throws NoSuchFunctionException; <T> T getDMCFunction(String descriptor, Class<T> type) throws NoSuchFunctionException; <T> T getDMCDataSaver(String descriptor, Class<T> type) throws NoSuchFunctionException; <T> T getDMCDataLoader(String descriptor, Class<T> type) throws NoSuchFunctionException; void setFrameworkModel(FrameworkModel frameworkModel); FrameworkModel getFrameworkModel(); }
/* * 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 impl; /** * * @author технодом */ public class Stuudent implements Comparable <Stuudent> { private int id; private String name; public Stuudent (int id, String name) { this.id = id; this.name = name; } public void setID (int id) { this.id = id; } public void setName (String name) { this.name = name; } public int getID () { return id; } public String getName () { return name; } public boolean equals (Stuudent other) { return this.getID() == other.getID(); } public int compareTo(Stuudent other) { if (this.equals(other)) return 0; else if (this.getID() > other.getID()) return 1; else return -1; // return name.compareTo(other.getName()); } public String toString ( ){ return name + ":" + id; } }
/* SampleServer.java */ import java.rmi.*; public interface SampleServer extends Remote { public int sum(int a,int b) throws RemoteException; }
package org.simpleflatmapper.converter.impl; import org.simpleflatmapper.converter.Converter; public class NumberLongConverter implements Converter<Number, Long> { @Override public Long convert(Number in) { if (in == null) return null; return in.longValue(); } public String toString() { return "NumberToLong"; } }
package com.shopify.payinfo; import java.util.Map; import javax.servlet.http.HttpSession; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.servlet.ModelAndView; import com.shopify.common.SpConstants; import com.shopify.common.util.UtilFn; import com.shopify.shop.ShopData; @Controller public class PayinfoController { private Logger LOGGER = LoggerFactory.getLogger(PayinfoController.class); @Autowired private PayinfoService payinfoservice; /** * 결제저장 * @param model * @return */ public int shipment(PayinfoData pData) { int cnt = payinfoservice.insertPayinfo(pData); return cnt; } }
/* * 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 gui; import dao.ClienteDAO; import dao.JurosDAO; import dao.VendaDAO; import java.awt.Color; import java.io.File; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.swing.JOptionPane; import model.Cliente; import util.AutoCompletion; import static util.DateConvert.DateConvert; import util.ValidaCPF; /** * * @author USER */ public class Main extends javax.swing.JFrame { public static Cliente cliente = new Cliente(); /** * Creates new form Main */ public Main() { try { this.setIconImage(ImageIO.read(new File("img/icon.png"))); } catch (IOException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } initComponents(); jLnome.setVisible(false); jLcelular.setVisible(false); jLcpf.setVisible(false); jLrg.setVisible(false); jLtelefone.setVisible(false); jLemail.setVisible(false); jLendereco.setVisible(false); jLnasc.setVisible(false); jLbairro.setVisible(false); jLcidade.setVisible(false); jLestado.setVisible(false); jLemAbertoQntd.setText(""); jLabertasQntd.setText(""); jLtotalCQntd.setText(""); jLjurosTotValor.setText(""); // Inicializador de Juros JurosDAO.checarJuros(); // Campo de Busca //ClienteDAO.ClienteBusca(jCBcliente); //AutoCompletion.enable(jCBcliente); AtualizarBusca(); } public void AtualizarBusca() { ClienteDAO.ClienteBusca(jCBcliente); AutoCompletion.enable(jCBcliente); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPmain = new javax.swing.JPanel(); jPnGerenciamento = new javax.swing.JPanel(); jLcliente = new javax.swing.JLabel(); jBpesquisar = new javax.swing.JButton(); jBcadastrar = new javax.swing.JButton(); jCBcliente = new javax.swing.JComboBox<>(); jPnCliente = new javax.swing.JPanel(); jLnomeF = new javax.swing.JLabel(); jLcpfF = new javax.swing.JLabel(); jLrgF = new javax.swing.JLabel(); jLtelF = new javax.swing.JLabel(); jLcelF = new javax.swing.JLabel(); jLendeF = new javax.swing.JLabel(); jLemailF = new javax.swing.JLabel(); jLbairroF = new javax.swing.JLabel(); jLcidadeF = new javax.swing.JLabel(); jLnascF = new javax.swing.JLabel(); jLestadoF = new javax.swing.JLabel(); jLnome = new javax.swing.JLabel(); jLcpf = new javax.swing.JLabel(); jLrg = new javax.swing.JLabel(); jLcelular = new javax.swing.JLabel(); jLtelefone = new javax.swing.JLabel(); jLemail = new javax.swing.JLabel(); jLendereco = new javax.swing.JLabel(); jLbairro = new javax.swing.JLabel(); jLcidade = new javax.swing.JLabel(); jLestado = new javax.swing.JLabel(); jLnasc = new javax.swing.JLabel(); jBalterar = new javax.swing.JButton(); jPnVendas = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); Tabela = new javax.swing.JTable(); jBvenda = new javax.swing.JButton(); jBpagamento = new javax.swing.JButton(); jPnResumo = new javax.swing.JPanel(); jLtotalC = new javax.swing.JLabel(); jLemAberto = new javax.swing.JLabel(); jLtotalCQntd = new javax.swing.JLabel(); jLemAbertoQntd = new javax.swing.JLabel(); jLabertasQntd = new javax.swing.JLabel(); jLfechadas = new javax.swing.JLabel(); jLjurosTot = new javax.swing.JLabel(); jLjurosTotValor = new javax.swing.JLabel(); jMbBarra = new javax.swing.JMenuBar(); jMadmin = new javax.swing.JMenu(); jMiJuros = new javax.swing.JMenu(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("TryFatus"); setAutoRequestFocus(false); setBackground(java.awt.Color.cyan); jPmain.setBackground(new java.awt.Color(56, 56, 56)); jPnGerenciamento.setBackground(new java.awt.Color(56, 56, 56)); jPnGerenciamento.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Gerenciamento", javax.swing.border.TitledBorder.LEFT, javax.swing.border.TitledBorder.TOP, new java.awt.Font("Times New Roman", 1, 14), new java.awt.Color(153, 153, 153))); // NOI18N jLcliente.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N jLcliente.setText("Cliente:"); jLcliente.setForeground(new Color(187,187,187)); jBpesquisar.setText("Pesquisar"); jBpesquisar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBpesquisarActionPerformed(evt); } }); jBcadastrar.setText("Cadastrar Novo"); jBcadastrar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBcadastrarActionPerformed(evt); } }); jCBcliente.setEditable(true); jCBcliente.setFont(new java.awt.Font("Times New Roman", 0, 16)); // NOI18N jCBcliente.setBackground(new Color(69,73,74)); jCBcliente.setForeground(new Color(187, 187, 187)); javax.swing.GroupLayout jPnGerenciamentoLayout = new javax.swing.GroupLayout(jPnGerenciamento); jPnGerenciamento.setLayout(jPnGerenciamentoLayout); jPnGerenciamentoLayout.setHorizontalGroup( jPnGerenciamentoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPnGerenciamentoLayout.createSequentialGroup() .addContainerGap() .addComponent(jLcliente) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jCBcliente, javax.swing.GroupLayout.PREFERRED_SIZE, 340, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jBpesquisar) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jBcadastrar, javax.swing.GroupLayout.DEFAULT_SIZE, 146, Short.MAX_VALUE) .addContainerGap()) ); jPnGerenciamentoLayout.setVerticalGroup( jPnGerenciamentoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPnGerenciamentoLayout.createSequentialGroup() .addContainerGap() .addGroup(jPnGerenciamentoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLcliente) .addComponent(jBpesquisar) .addComponent(jBcadastrar) .addComponent(jCBcliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPnCliente.setBackground(new java.awt.Color(56, 56, 56)); jPnCliente.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Dados do Cliente", javax.swing.border.TitledBorder.LEFT, javax.swing.border.TitledBorder.TOP, new java.awt.Font("Times New Roman", 1, 14), new java.awt.Color(153, 153, 153))); // NOI18N jLnomeF.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N jLnomeF.setText("Nome:"); jLnomeF.setForeground(new Color(187,187,187)); jLcpfF.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N jLcpfF.setText("CPF:"); jLcpfF.setForeground(new Color(187,187,187)); jLrgF.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N jLrgF.setText("RG:"); jLrgF.setForeground(new Color(187,187,187)); jLtelF.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N jLtelF.setText("Telefone:"); jLtelF.setForeground(new Color(187,187,187)); jLcelF.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N jLcelF.setText("Celular:"); jLcelF.setForeground(new Color(187,187,187)); jLendeF.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N jLendeF.setText("Endereço:"); jLendeF.setForeground(new Color(187,187,187)); jLemailF.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N jLemailF.setText("Email:"); jLemailF.setForeground(new Color(187,187,187)); jLbairroF.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N jLbairroF.setText("Bairro:"); jLbairroF.setForeground(new Color(187,187,187)); jLcidadeF.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N jLcidadeF.setText("Cidade:"); jLcidadeF.setForeground(new Color(187,187,187)); jLnascF.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N jLnascF.setText("Nascimento:"); jLnascF.setForeground(new Color(187,187,187)); jLestadoF.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N jLestadoF.setText("Estado:"); jLestadoF.setForeground(new Color(187,187,187)); jLnome.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N jLnome.setText("Fulano deTal nome grande"); jLnome.setEnabled(false); jLnome.setForeground(new Color(187, 187, 187)); jLcpf.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N jLcpf.setText("000.000.000-00"); jLcpf.setEnabled(false); jLrg.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N jLrg.setText("666.666.666"); jLrg.setEnabled(false); jLcelular.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N jLcelular.setText("11940028922"); jLcelular.setEnabled(false); jLtelefone.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N jLtelefone.setText("4832553537"); jLtelefone.setEnabled(false); jLemail.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N jLemail.setText("aaaaaaaa@hotmail.com"); jLemail.setEnabled(false); jLendereco.setText("aaaaaaaaaaa"); jLendereco.setEnabled(false); jLbairro.setText("Vila Nova Alvorada"); jLbairro.setEnabled(false); jLcidade.setText("São José do Rio Preto"); jLcidade.setEnabled(false); jLestado.setText("SC"); jLestado.setEnabled(false); jLnasc.setText("07/03/2001"); jLnasc.setEnabled(false); jBalterar.setText("Alterar Dados"); jBalterar.setEnabled(false); jBalterar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBalterarActionPerformed(evt); } }); javax.swing.GroupLayout jPnClienteLayout = new javax.swing.GroupLayout(jPnCliente); jPnCliente.setLayout(jPnClienteLayout); jPnClienteLayout.setHorizontalGroup( jPnClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPnClienteLayout.createSequentialGroup() .addContainerGap() .addGroup(jPnClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPnClienteLayout.createSequentialGroup() .addComponent(jLnomeF) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLnome)) .addGroup(jPnClienteLayout.createSequentialGroup() .addComponent(jLcpfF) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLcpf)) .addGroup(jPnClienteLayout.createSequentialGroup() .addComponent(jLrgF) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLrg)) .addGroup(jPnClienteLayout.createSequentialGroup() .addComponent(jLcelF) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLcelular)) .addGroup(jPnClienteLayout.createSequentialGroup() .addComponent(jLtelF) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLtelefone)) .addGroup(jPnClienteLayout.createSequentialGroup() .addComponent(jLemailF) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLemail)) .addGroup(jPnClienteLayout.createSequentialGroup() .addComponent(jLendeF) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLendereco)) .addGroup(jPnClienteLayout.createSequentialGroup() .addComponent(jLbairroF) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLbairro)) .addGroup(jPnClienteLayout.createSequentialGroup() .addComponent(jLcidadeF) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLcidade)) .addGroup(jPnClienteLayout.createSequentialGroup() .addComponent(jLestadoF) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLestado)) .addGroup(jPnClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jBalterar) .addGroup(jPnClienteLayout.createSequentialGroup() .addComponent(jLnascF) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLnasc)))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPnClienteLayout.setVerticalGroup( jPnClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPnClienteLayout.createSequentialGroup() .addGap(18, 18, 18) .addGroup(jPnClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLnomeF) .addComponent(jLnome)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPnClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLcpfF) .addComponent(jLcpf)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPnClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLrgF) .addComponent(jLrg)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPnClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLcelF) .addComponent(jLcelular)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPnClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLtelF) .addComponent(jLtelefone)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPnClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLemailF) .addComponent(jLemail)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPnClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLendeF) .addComponent(jLendereco)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPnClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLbairroF) .addComponent(jLbairro)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPnClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLcidadeF) .addComponent(jLcidade)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPnClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLestadoF) .addComponent(jLestado)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPnClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLnascF) .addComponent(jLnasc)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jBalterar) .addContainerGap()) ); jPnVendas.setBackground(new java.awt.Color(56, 56, 56)); jPnVendas.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Registro de Vendas", javax.swing.border.TitledBorder.LEFT, javax.swing.border.TitledBorder.TOP, new java.awt.Font("Times New Roman", 1, 14), new java.awt.Color(153, 153, 153))); // NOI18N Tabela.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { "ID", "Produto", "Valor Total", "Valor Pago", "Parcelas", "Método de Pagamento", "Data da Compra", "Vencimento" } ) { boolean[] canEdit = new boolean [] { false, false, false, false, false, false, false, false }; public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit [columnIndex]; } }); Tabela.setToolTipText(""); Tabela.getTableHeader().setReorderingAllowed(false); jScrollPane1.setViewportView(Tabela); jBvenda.setText("Adicionar Venda"); jBvenda.setEnabled(false); jBvenda.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBvendaActionPerformed(evt); } }); jBpagamento.setText("Registrar Pagamento"); jBpagamento.setEnabled(false); jBpagamento.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBpagamentoActionPerformed(evt); } }); javax.swing.GroupLayout jPnVendasLayout = new javax.swing.GroupLayout(jPnVendas); jPnVendas.setLayout(jPnVendasLayout); jPnVendasLayout.setHorizontalGroup( jPnVendasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPnVendasLayout.createSequentialGroup() .addContainerGap() .addComponent(jScrollPane1) .addContainerGap()) .addGroup(jPnVendasLayout.createSequentialGroup() .addGap(132, 132, 132) .addComponent(jBvenda) .addGap(161, 161, 161) .addComponent(jBpagamento) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPnVendasLayout.setVerticalGroup( jPnVendasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPnVendasLayout.createSequentialGroup() .addGap(15, 15, 15) .addGroup(jPnVendasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jBvenda) .addComponent(jBpagamento)) .addGap(35, 35, 35) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 223, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(16, Short.MAX_VALUE)) ); jPnResumo.setBackground(new java.awt.Color(56, 56, 56)); jPnResumo.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Resumo Financeiro", javax.swing.border.TitledBorder.LEFT, javax.swing.border.TitledBorder.TOP, new java.awt.Font("Times New Roman", 1, 14), new java.awt.Color(153, 153, 153))); // NOI18N jLtotalC.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N jLtotalC.setText("Total em Compras:"); jLtotalC.setForeground(new Color(187,187,187)); jLemAberto.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N jLemAberto.setText("Em Aberto:"); jLemAberto.setForeground(new Color(187,187,187)); jLtotalCQntd.setFont(new java.awt.Font("Dialog", 1, 13)); // NOI18N jLtotalCQntd.setText("899,57"); jLtotalCQntd.setEnabled(false); jLemAbertoQntd.setFont(new java.awt.Font("Dialog", 1, 13)); // NOI18N jLemAbertoQntd.setText("572,49"); jLemAbertoQntd.setEnabled(false); jLabertasQntd.setFont(new java.awt.Font("Dialog", 1, 13)); // NOI18N jLabertasQntd.setText("5"); jLabertasQntd.setEnabled(false); jLfechadas.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N jLfechadas.setText("Compras Abertas:"); jLfechadas.setForeground(new Color(187,187,187)); jLjurosTot.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N jLjurosTot.setText("Juros Total:"); jLjurosTot.setForeground(new Color(187,187,187)); jLjurosTotValor.setFont(new java.awt.Font("Dialog", 1, 13)); // NOI18N jLjurosTotValor.setText("5"); jLjurosTotValor.setForeground(new Color(187,187,187)); jLjurosTotValor.setEnabled(false); javax.swing.GroupLayout jPnResumoLayout = new javax.swing.GroupLayout(jPnResumo); jPnResumo.setLayout(jPnResumoLayout); jPnResumoLayout.setHorizontalGroup( jPnResumoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPnResumoLayout.createSequentialGroup() .addGap(72, 72, 72) .addComponent(jLtotalC) .addGap(7, 7, 7) .addComponent(jLtotalCQntd) .addGap(35, 35, 35) .addComponent(jLemAberto) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLemAbertoQntd) .addGap(42, 42, 42) .addComponent(jLfechadas) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabertasQntd) .addGap(47, 47, 47) .addComponent(jLjurosTot) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLjurosTotValor) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPnResumoLayout.setVerticalGroup( jPnResumoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPnResumoLayout.createSequentialGroup() .addContainerGap() .addGroup(jPnResumoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPnResumoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLfechadas) .addComponent(jLabertasQntd) .addComponent(jLjurosTot) .addComponent(jLjurosTotValor)) .addGroup(jPnResumoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLemAberto) .addComponent(jLemAbertoQntd)) .addGroup(jPnResumoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLtotalC) .addComponent(jLtotalCQntd))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); javax.swing.GroupLayout jPmainLayout = new javax.swing.GroupLayout(jPmain); jPmain.setLayout(jPmainLayout); jPmainLayout.setHorizontalGroup( jPmainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPmainLayout.createSequentialGroup() .addContainerGap() .addGroup(jPmainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPmainLayout.createSequentialGroup() .addGroup(jPmainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jPnGerenciamento, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPnVendas, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPnCliente, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addComponent(jPnResumo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); jPmainLayout.setVerticalGroup( jPmainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPmainLayout.createSequentialGroup() .addContainerGap() .addGroup(jPmainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(jPmainLayout.createSequentialGroup() .addComponent(jPnGerenciamento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPnVendas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jPnCliente, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPnResumo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jMadmin.setText("Admin"); jMiJuros.setText("Juros"); jMiJuros.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jMiJurosMouseClicked(evt); } }); jMadmin.add(jMiJuros); jMbBarra.add(jMadmin); setJMenuBar(jMbBarra); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPmain, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPmain, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); getAccessibleContext().setAccessibleDescription(""); pack(); }// </editor-fold>//GEN-END:initComponents private void jBcadastrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBcadastrarActionPerformed // TODO add your handling code here: Cadastro cadastro = new Cadastro(); cadastro.setVisible(true); }//GEN-LAST:event_jBcadastrarActionPerformed private void jBalterarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBalterarActionPerformed // TODO add your handling code here: Alterar alterar = new Alterar(); alterar.setVisible(true); }//GEN-LAST:event_jBalterarActionPerformed private void jBpesquisarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBpesquisarActionPerformed // TODO add your handling code here: String clienteS = jCBcliente.getSelectedItem().toString(); String substring = clienteS.substring(clienteS.length()-11, clienteS.length()); cliente = ClienteDAO.Busca(substring); jLnome.setText(cliente.getNome()); jLcelular.setText(cliente.getCelular()); jLcpf.setText(ValidaCPF.imprimeCPF(cliente.getCPF())); jLrg.setText(cliente.getRG()); jLtelefone.setText(cliente.getTelefone()); jLemail.setText(cliente.getEmail()); jLendereco.setText(cliente.getEndereco()); jLbairro.setText(cliente.getBairro()); jLcidade.setText(cliente.getCidade()); jLestado.setText(cliente.getEstado()); jLnasc.setText(DateConvert(cliente.getNascimento())); // jLnome.setVisible(true); jLcelular.setVisible(true); jLcpf.setVisible(true); jLrg.setVisible(true); jLtelefone.setVisible(true); jLemail.setVisible(true); jLendereco.setVisible(true); jLnasc.setVisible(true); jLbairro.setVisible(true); jLcidade.setVisible(true); jLestado.setVisible(true); jBalterar.setEnabled(true); jBvenda.setEnabled(true); jBpagamento.setEnabled(true); VendaDAO.PopularJTable("SELECT * FROM vendas WHERE Clientes_CPF='"+cliente.getCPF()+"'", Tabela); // jLemAbertoQntd.setText(VendaDAO.pegarValorAberto(cliente)+""); jLtotalCQntd.setText(VendaDAO.pegarTotal(cliente)+""); jLabertasQntd.setText(VendaDAO.pegarAbertos(cliente)+""); jLjurosTotValor.setText(JurosDAO.calcularJurosTotal(cliente)+""); }//GEN-LAST:event_jBpesquisarActionPerformed private void jBvendaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBvendaActionPerformed // TODO add your handling code here: Vendas venda = new Vendas(); venda.setVisible(true); }//GEN-LAST:event_jBvendaActionPerformed private void jBpagamentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBpagamentoActionPerformed // TODO add your handling code here: Pagamento pagto = new Pagamento(); pagto.setVisible(true); }//GEN-LAST:event_jBpagamentoActionPerformed private void jMiJurosMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMiJurosMouseClicked // TODO add your handling code here: JurosDAO.setarJuros(Double.parseDouble(JOptionPane.showInputDialog("Taxa de Juros do sistema: "+JurosDAO.pegarJuros()))); }//GEN-LAST:event_jMiJurosMouseClicked /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Main().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTable Tabela; private javax.swing.JButton jBalterar; private javax.swing.JButton jBcadastrar; private javax.swing.JButton jBpagamento; private javax.swing.JButton jBpesquisar; private javax.swing.JButton jBvenda; private javax.swing.JComboBox<String> jCBcliente; private javax.swing.JLabel jLabertasQntd; private javax.swing.JLabel jLbairro; private javax.swing.JLabel jLbairroF; private javax.swing.JLabel jLcelF; private javax.swing.JLabel jLcelular; private javax.swing.JLabel jLcidade; private javax.swing.JLabel jLcidadeF; private javax.swing.JLabel jLcliente; private javax.swing.JLabel jLcpf; private javax.swing.JLabel jLcpfF; private javax.swing.JLabel jLemAberto; private javax.swing.JLabel jLemAbertoQntd; private javax.swing.JLabel jLemail; private javax.swing.JLabel jLemailF; private javax.swing.JLabel jLendeF; private javax.swing.JLabel jLendereco; private javax.swing.JLabel jLestado; private javax.swing.JLabel jLestadoF; private javax.swing.JLabel jLfechadas; private javax.swing.JLabel jLjurosTot; private javax.swing.JLabel jLjurosTotValor; private javax.swing.JLabel jLnasc; private javax.swing.JLabel jLnascF; private javax.swing.JLabel jLnome; private javax.swing.JLabel jLnomeF; private javax.swing.JLabel jLrg; private javax.swing.JLabel jLrgF; private javax.swing.JLabel jLtelF; private javax.swing.JLabel jLtelefone; private javax.swing.JLabel jLtotalC; private javax.swing.JLabel jLtotalCQntd; private javax.swing.JMenu jMadmin; private javax.swing.JMenuBar jMbBarra; private javax.swing.JMenu jMiJuros; private javax.swing.JPanel jPmain; private javax.swing.JPanel jPnCliente; private javax.swing.JPanel jPnGerenciamento; private javax.swing.JPanel jPnResumo; private javax.swing.JPanel jPnVendas; private javax.swing.JScrollPane jScrollPane1; // End of variables declaration//GEN-END:variables }
package dev.rhenergy.customer; import javax.persistence.*; import javax.validation.constraints.Email; import javax.validation.constraints.NotEmpty; import java.util.Objects; @Entity(name = "Customer") @Table(name = "customer") public class CustomerEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "customer_id") private Integer customerId; @Column(name = "first_name") @NotEmpty private String firstName; @Column(name = "middle_name") private String middleName; @Column(name = "last_name") @NotEmpty private String lastName; @Column(name = "suffix") private String suffix; @Column(name = "email") @Email private String email; @Column(name = "phone") private String phone; public Integer getCustomerId() { return customerId; } public void setCustomerId(Integer customerId) { this.customerId = customerId; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getMiddleName() { return middleName; } public void setMiddleName(String middleName) { this.middleName = middleName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getSuffix() { return suffix; } public void setSuffix(String suffix) { this.suffix = suffix; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; CustomerEntity that = (CustomerEntity) o; return Objects.equals(customerId, that.customerId) && Objects.equals(firstName, that.firstName) && Objects.equals(middleName, that.middleName) && Objects.equals(lastName, that.lastName) && Objects.equals(suffix, that.suffix) && Objects.equals(email, that.email) && Objects.equals(phone, that.phone); } @Override public int hashCode() { return Objects.hash(customerId, firstName, middleName, lastName, suffix, email, phone); } @Override public String toString() { return "CustomerEntity{" + "customerId=" + customerId + ", firstName='" + firstName + '\'' + ", middleName='" + middleName + '\'' + ", lastName='" + lastName + '\'' + ", suffix='" + suffix + '\'' + ", email='" + email + '\'' + ", phone='" + phone + '\'' + '}'; } }
/* * 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 proyectocolas; /** * * @author LABAM */ public class Event { private int eventNumber; private char eventType; private Client client; private int arrivalTime; private int departureTime; public Event(int eventNumber, char eventType, Client client, int arrivalTime, int departureTime) { this.eventNumber = eventNumber; this.eventType = eventType; this.client = client; this.arrivalTime = arrivalTime; this.departureTime = departureTime; } public int getEventNumber() { return eventNumber; } public void setEventNumber(int eventNumber) { this.eventNumber = eventNumber; } public int getEventType() { return eventType; } public void setEventType(char eventType) { this.eventType = eventType; } public Client getClient() { return client; } public void setClient(Client client) { this.client = client; } public int getArrivalTime() { return arrivalTime; } public void setArrivalTime(int arrivalTime) { this.arrivalTime = arrivalTime; } public int getDepartureTime() { return departureTime; } public void setDepartureTime(int departureTime) { this.departureTime = departureTime; } }
package com.java.smart_garage.configuration; import java.math.BigInteger; import java.nio.charset.Charset; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Random; public class Md5Hashing { public static String md5(String input) { String md5 = null; if(null == input) return null; try { //Create MessageDigest object for MD5 MessageDigest digest = MessageDigest.getInstance("MD5"); //Update input string in message digest digest.update(input.getBytes(), 0, input.length()); //Converts message digest value in base 16 (hex) md5 = new BigInteger(1, digest.digest()).toString(16); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return md5; } public static String generateNewPassword(int length) { char[] letters = {'a', 'b', 'b', 'c', '4', '1', '8', '2', 'e', '0'}; StringBuilder sb = new StringBuilder(); for (int i = 0; i <letters.length ; i++) { char current = letters[new Random().nextInt(9)]; sb.append(current); } return sb.toString(); } public static String generateNewPhoneNumber() { String result = ""; for (int i = 0; i < 8; i++) { Random rand = new Random(); int randomNumber = rand.nextInt(10) - 1; result += randomNumber + ""; } return result; } }
/* * Copyright (c) 2010-2020 Founder Ltd. All Rights Reserved. * * This software is the confidential and proprietary information of * Founder. You shall not disclose such Confidential Information * and shall use it only in accordance with the terms of the agreements * you entered into with Founder. * */ package overload_test; class Print { public void print(int a, String b) { System.out.println(a + b); } public void print(String a, int b) { System.out.println(a + b); } public static void println(int a, String b) { System.out.println(a + b); } public static void println(String a, int b) { System.out.println(a + b); } }
package de.paluno.ledboard.tetris.keyboard; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.util.ArrayList; import java.util.List; import java.util.Optional; public class KeyBoard implements KeyListener { private final List<Key> pressedKeys; public KeyBoard(List<Key> pressedKeys) { this.pressedKeys = pressedKeys; } public synchronized List<Key> deliverPressedKeys() { List<Key> deliveredKeys = new ArrayList<>(); for (Key pressedKey : this.pressedKeys) { deliveredKeys.add(pressedKey); } this.pressedKeys.clear(); return deliveredKeys; } @Override public void keyTyped(KeyEvent e) { } @Override public void keyPressed(KeyEvent e) { Optional<Key> pressedKey = Key.fromKeyCode(e.getKeyCode()); pressedKey.ifPresent(key -> pressedKeys.add(key)); } @Override public void keyReleased(KeyEvent e) { } }
package scp.main.server; import java.net.Socket; import java.util.HashMap; import java.util.Map; import scp.main.networkencoder.NetworkEncoder; import scp.main.serverconn.ServerConnection; import scp.main.serverconn.User; public class Server { private final Map<Socket, User> users = new HashMap<>(); public Server() throws Throwable { } public void receiveMessage(String message, ServerConnection connection, Socket socket) throws Throwable { String msg = users.get(socket).getUsername() + ": " + message; for (Socket s : users.keySet()) if (s != socket) s.getOutputStream().write(NetworkEncoder.encodeMessage(msg)); } public void handleNewConnection(ServerConnection connection, Socket newConnection) throws Throwable { String name = NetworkEncoder.pollMessage(newConnection.getInputStream()).substring(7); User user = new User(newConnection, name); users.put(newConnection, user); } }
package design.mode.factory.FactoryMethod; import design.mode.factory.ICourse; import design.mode.factory.JavaCourse; public class JavaCourseFactory implements ICourseFactory { @Override public ICourse getCourse() { return new JavaCourse(); } }
package com.codegym.service.khachhang.Impl; import com.codegym.model.khachhang.KhachHang; import com.codegym.repository.khachhang.KhachHangRepository; import com.codegym.service.khachhang.KhachHangService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import java.util.List; @Service public class KhachHangServiceImpl implements KhachHangService { @Autowired KhachHangRepository khachHangRepository; @Override public List<KhachHang> findAll() { return khachHangRepository.findAll(); } @Override public KhachHang findById(String id) { return khachHangRepository.findById(id).orElse(null); } @Override public void save(KhachHang khachHang) { khachHangRepository.save(khachHang); } @Override public void remove(String id) { khachHangRepository.deleteById(id); } @Override public Page<KhachHang> findAll(Pageable pageable) { return khachHangRepository.findAll(pageable); } @Override public Page<KhachHang> findByHoTenContainingOrIdKhachHangContaining(String keyword, String keyword2, Pageable pageable) { return khachHangRepository.findByHoTenContainingOrIdKhachHangContaining(keyword,keyword2,pageable); } }
package test_06488587; /* ##################################################### # Module Name: COMP30820 Java Programming # # Date: 01/04/19 # # Question Number: 2 # # Description: Largest common suffix # # # ##################################################### */ public class Q2 { public static void main(String[] args) { // test cases // should return: "" (i.e. a string with no characters) System.out.println("test case 1: " + getLCS("hello", "HELLO")); // should return: "ing" System.out.println("test case 2: " + getLCS("computing", "working")); } // write this method public static String getLCS(String s1, String s2) { int str1Len = s1.length(); int str2Len = s2.length(); String smallestStr = ""; if(str1Len<str2Len){ smallestStr = s1; } else{ smallestStr = s2; } String output = ""; int index = -1; for (int i = 0; i < smallestStr.length(); i++){ if (s1.charAt(s1.length()-1-i) == s2.charAt(s2.length()-1-i)){ index = s1.length()-1-i; } else { break; } } if (index == -1){ return ""; } else{ output = s1.substring(index); return output; } } }
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Comparator; import java.util.List; public class Main01728 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(br.readLine()); int[][] arr = new int[N +1 ][N + 1]; for (int i = 0; i < N + 1; i++) { String[] strs = br.readLine().split(" "); for (int j = 0; j < N; j++) { arr[i][j] = Integer.parseInt(strs[j]); } } Marble[][] cache = new Marble[N][N]; for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { Marble marble = new Marble(); marble.speed = arr[1][i] - arr[0][j]; marble.i = arr[1][i]; marble.j = arr[0][j]; cache[i][j] = marble; } } List<Marble> marbleList = new ArrayList<>(); if (arr.length < 3) { for (int i = 0; i < cache[0].length; i++) { marbleList.add(cache[0][i]); } } else { for (int i = 0; i < N; i++) { int marble1 = arr[2][i]; for (int j = 0; j < N; j++) { int marble2 = arr[1][j]; int speed = marble1 - marble2; boolean found = false; for (Marble marble : cache[j]) { if (!marble.visit && marble.speed == speed && marble2 - speed == marble.j) { marble.visit = true; marbleList.add(marble); found = true; break; } } if (found) { break; } } } } marbleList.stream() .sorted(Comparator.comparingInt(marble -> marble.j)) .forEach((marble) -> System.out.println(marble.j + " " + marble.speed)); } static class Marble { int i; int j; int speed; boolean visit; } }
/** * Travis D. Seiler and Ryan M. Kinsley * MIST 7570, Spring 2013 * Dr. Dan Everett * @author tseiler and rkinsley * */ package jsportsreg.entity; import java.util.ArrayList; import java.util.List; /** * The class for the Divisions database table. * */ public class Division{ /* (non-Javadoc) * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((divisionDescription == null) ? 0 : divisionDescription .hashCode()); result = prime * result + ((divisionName == null) ? 0 : divisionName.hashCode()); result = prime * result + ((season == null) ? 0 : season.hashCode()); result = prime * result + ((sport == null) ? 0 : sport.hashCode()); return result; } /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof Division)) return false; Division other = (Division) obj; if (divisionDescription == null) { if (other.divisionDescription != null) return false; } else if (!divisionDescription.equals(other.divisionDescription)) return false; if (divisionName == null) { if (other.divisionName != null) return false; } else if (!divisionName.equals(other.divisionName)) return false; if (season == null) { if (other.season != null) return false; } else if (!season.equals(other.season)) return false; if (sport == null) { if (other.sport != null) return false; } else if (!sport.equals(other.sport)) return false; return true; } /** The primary key for the Division class. * */ private int divisionID; /** The description for the Division object. * */ private String divisionDescription; /** The name of the division. * */ private String divisionName; /** The Season the Division competes during. * */ private Season season; /** The sport the Division is associated with. * */ private Sport sport; /** The list of Players participating in the associated division. * */ private List<Player_Registration> playerRegistrations; /** Constructor to create a basic empty Division object. * */ public Division() { this.divisionID= -1; this.divisionDescription= ""; this.divisionName= ""; this.season= new Season(); this.sport= new Sport(); this.playerRegistrations = new ArrayList<Player_Registration>(); } /** Constructor to create a fully populated Division object. * @param divisionID * @param divisionDescription * @param divisionName * @param season * @param sport * @param playerRegistrations */ public Division(int divisionID, String divisionDescription, String divisionName, Season season, Sport sport, List<Player_Registration> playerRegistrations) { this.divisionID = divisionID; this.divisionDescription = divisionDescription; this.divisionName = divisionName; this.season = season; this.sport = sport; this.playerRegistrations = playerRegistrations; } /** Returns the division identifier, which is the primary key of the division table in the database. * This field is not needed during general use of the class. * @return */ public int getDivisionID() { return this.divisionID; } /** Sets the division identifier. * @param divisionID */ public void setDivisionID(int divisionID) { this.divisionID = divisionID; } /** Returns the description of the Division. * @return */ public String getDivisionDescription() { return this.divisionDescription; } /** Sets the division description. * @param divisionDescription */ public void setDivisionDescription(String divisionDescription) { this.divisionDescription = divisionDescription; } /** Returns the name of the division. * @return */ public String getDivisionName() { return this.divisionName; } /** Sets the name of the division. * @param divisionName */ public void setDivisionName(String divisionName) { this.divisionName = divisionName; } /** Returns the season associated with the division. * @return */ public Season getSeason() { return this.season; } /** Sets the season the division competes during. * @param season */ public void setSeason(Season season) { this.season = season; } /** Returns the sport associated with the division. * @return */ public Sport getSport() { return this.sport; } /** Sets the sport associated with the division. * @param sport */ public void setSport(Sport sport) { this.sport = sport; } /** Returns the list of players registered for this division. * @return */ public List<Player_Registration> getPlayerRegistrations() { return this.playerRegistrations; } /** Sets the list of players registered for this division. * @param playerRegistrations */ public void setPlayerRegistrations(List<Player_Registration> playerRegistrations) { this.playerRegistrations = playerRegistrations; } /** Adds a player to the list of registered players. * @param playerRegistration * @return */ public Player_Registration addPlayerRegistration(Player_Registration playerRegistration) { getPlayerRegistrations().add(playerRegistration); playerRegistration.setDivision(this); return playerRegistration; } /** Removes a player from the list of registered players. * @param playerRegistration * @return */ public Player_Registration removePlayerRegistration(Player_Registration playerRegistration) { getPlayerRegistrations().remove(playerRegistration); playerRegistration.setDivision(null); return playerRegistration; } }
package compilador.analisador.semantico; import java.lang.reflect.Method; import compilador.analisador.lexico.ParametrosAcoesSemanticas; import compilador.analisador.lexico.Token; import compilador.estruturas.Mapa; public class AnalisadorSemantico { /** * Mapa que relaciona o nome de cada subm‡quina com a sua tabela de chamadas de aŤ›es sem‰nticas. */ private Mapa<String, String[][][]> mapaAcoesSemanticas = new Mapa<String, String[][][]>(); public AnalisadorSemantico() { String[][][] tabelaAcoesSemanticas; // Subm‡quina programa tabelaAcoesSemanticas = new String[16][7][256]; tabelaAcoesSemanticas[5][3][125] = "programa_5_3_125_7"; tabelaAcoesSemanticas[0][1][5] = "programa_0_1_5_1"; tabelaAcoesSemanticas[0][1][3] = "programa_0_1_3_1"; tabelaAcoesSemanticas[0][1][4] = "programa_0_1_4_1"; tabelaAcoesSemanticas[0][1][6] = "programa_0_1_6_1"; tabelaAcoesSemanticas[0][1][9] = "programa_0_1_9_2"; tabelaAcoesSemanticas[0][1][15] = "programa_0_1_15_3"; tabelaAcoesSemanticas[11][1][3] = "programa_11_1_3_1"; tabelaAcoesSemanticas[11][1][4] = "programa_11_1_4_1"; tabelaAcoesSemanticas[11][1][6] = "programa_11_1_6_1"; tabelaAcoesSemanticas[11][1][10] = "programa_11_1_10_12"; tabelaAcoesSemanticas[1][2][0] = "programa_1_2_0_4"; tabelaAcoesSemanticas[12][2][0] = "programa_12_2_0_13"; tabelaAcoesSemanticas[13][3][123] = "programa_13_3_123_14"; tabelaAcoesSemanticas[2][2][0] = "programa_2_2_0_11"; tabelaAcoesSemanticas[8][3][41] = "programa_8_3_41_9"; tabelaAcoesSemanticas[3][3][123] = "programa_3_3_123_5"; tabelaAcoesSemanticas[9][3][123] = "programa_9_3_123_10"; tabelaAcoesSemanticas[15][3][125] = "programa_15_3_125_1"; tabelaAcoesSemanticas[4][3][40] = "programa_4_3_40_6"; tabelaAcoesSemanticas[10][3][125] = "programa_10_3_125_0"; this.mapaAcoesSemanticas.put("programa", tabelaAcoesSemanticas); // Subm‡quina parametros tabelaAcoesSemanticas = new String[15][7][256]; tabelaAcoesSemanticas[5][4][0] = "parametros_5_4_0_10"; tabelaAcoesSemanticas[0][1][3] = "parametros_0_1_3_1"; tabelaAcoesSemanticas[0][1][4] = "parametros_0_1_4_1"; tabelaAcoesSemanticas[0][1][6] = "parametros_0_1_6_1"; tabelaAcoesSemanticas[0][1][9] = "parametros_0_1_9_2"; tabelaAcoesSemanticas[11][3][91] = "parametros_11_3_91_12"; tabelaAcoesSemanticas[11][3][44] = "parametros_11_3_44_0"; tabelaAcoesSemanticas[6][2][0] = "parametros_6_2_0_7"; tabelaAcoesSemanticas[1][2][0] = "parametros_1_2_0_3"; tabelaAcoesSemanticas[12][4][0] = "parametros_12_4_0_13"; tabelaAcoesSemanticas[7][3][123] = "parametros_7_3_123_8"; tabelaAcoesSemanticas[13][3][93] = "parametros_13_3_93_14"; tabelaAcoesSemanticas[2][2][0] = "parametros_2_2_0_4"; tabelaAcoesSemanticas[14][3][44] = "parametros_14_3_44_0"; tabelaAcoesSemanticas[3][3][91] = "parametros_3_3_91_5"; tabelaAcoesSemanticas[3][3][44] = "parametros_3_3_44_0"; tabelaAcoesSemanticas[9][3][125] = "parametros_9_3_125_1"; tabelaAcoesSemanticas[4][1][3] = "parametros_4_1_3_1"; tabelaAcoesSemanticas[4][1][4] = "parametros_4_1_4_1"; tabelaAcoesSemanticas[4][1][6] = "parametros_4_1_6_1"; tabelaAcoesSemanticas[4][1][10] = "parametros_4_1_10_6"; tabelaAcoesSemanticas[10][3][93] = "parametros_10_3_93_11"; this.mapaAcoesSemanticas.put("parametros", tabelaAcoesSemanticas); // Subm‡quina declaracoes tabelaAcoesSemanticas = new String[16][7][256]; tabelaAcoesSemanticas[5][3][91] = "declaracoes_5_3_91_7"; tabelaAcoesSemanticas[5][3][44] = "declaracoes_5_3_44_2"; tabelaAcoesSemanticas[5][3][59] = "declaracoes_5_3_59_1"; tabelaAcoesSemanticas[11][3][93] = "declaracoes_11_3_93_12"; tabelaAcoesSemanticas[0][1][11] = "declaracoes_0_1_11_1"; tabelaAcoesSemanticas[0][1][3] = "declaracoes_0_1_3_2"; tabelaAcoesSemanticas[0][1][4] = "declaracoes_0_1_4_2"; tabelaAcoesSemanticas[0][1][6] = "declaracoes_0_1_6_2"; tabelaAcoesSemanticas[0][1][9] = "declaracoes_0_1_9_3"; tabelaAcoesSemanticas[6][2][0] = "declaracoes_6_2_0_8"; tabelaAcoesSemanticas[1][1][3] = "declaracoes_1_1_3_2"; tabelaAcoesSemanticas[1][1][4] = "declaracoes_1_1_4_2"; tabelaAcoesSemanticas[1][1][6] = "declaracoes_1_1_6_2"; tabelaAcoesSemanticas[1][1][9] = "declaracoes_1_1_9_3"; tabelaAcoesSemanticas[12][3][91] = "declaracoes_12_3_91_13"; tabelaAcoesSemanticas[12][3][44] = "declaracoes_12_3_44_2"; tabelaAcoesSemanticas[12][3][59] = "declaracoes_12_3_59_1"; tabelaAcoesSemanticas[7][4][0] = "declaracoes_7_4_0_11"; tabelaAcoesSemanticas[2][2][0] = "declaracoes_2_2_0_5"; tabelaAcoesSemanticas[13][4][0] = "declaracoes_13_4_0_14"; tabelaAcoesSemanticas[8][3][123] = "declaracoes_8_3_123_9"; tabelaAcoesSemanticas[3][2][0] = "declaracoes_3_2_0_4"; tabelaAcoesSemanticas[14][3][93] = "declaracoes_14_3_93_15"; tabelaAcoesSemanticas[15][3][44] = "declaracoes_15_3_44_2"; tabelaAcoesSemanticas[15][3][59] = "declaracoes_15_3_59_1"; tabelaAcoesSemanticas[4][1][3] = "declaracoes_4_1_3_2"; tabelaAcoesSemanticas[4][1][4] = "declaracoes_4_1_4_2"; tabelaAcoesSemanticas[4][1][6] = "declaracoes_4_1_6_2"; tabelaAcoesSemanticas[4][1][10] = "declaracoes_4_1_10_6"; tabelaAcoesSemanticas[10][3][125] = "declaracoes_10_3_125_2"; this.mapaAcoesSemanticas.put("declaracoes", tabelaAcoesSemanticas); // Subm‡quina comandos tabelaAcoesSemanticas = new String[37][7][256]; tabelaAcoesSemanticas[27][3][93] = "comandos_27_3_93_28"; tabelaAcoesSemanticas[5][3][40] = "comandos_5_3_40_14"; tabelaAcoesSemanticas[16][3][41] = "comandos_16_3_41_11"; tabelaAcoesSemanticas[11][3][59] = "comandos_11_3_59_13"; tabelaAcoesSemanticas[0][2][0] = "comandos_0_2_0_1"; tabelaAcoesSemanticas[0][1][0] = "comandos_0_1_0_2"; tabelaAcoesSemanticas[0][1][2] = "comandos_0_1_2_3"; tabelaAcoesSemanticas[0][1][13] = "comandos_0_1_13_4"; tabelaAcoesSemanticas[0][1][12] = "comandos_0_1_12_5"; tabelaAcoesSemanticas[0][1][14] = "comandos_0_1_14_6"; tabelaAcoesSemanticas[22][3][125] = "comandos_22_3_125_13"; tabelaAcoesSemanticas[17][3][40] = "comandos_17_3_40_10"; tabelaAcoesSemanticas[28][3][61] = "comandos_28_3_61_9"; tabelaAcoesSemanticas[1][3][46] = "comandos_1_3_46_7"; tabelaAcoesSemanticas[1][3][91] = "comandos_1_3_91_8"; tabelaAcoesSemanticas[1][3][61] = "comandos_1_3_61_9"; tabelaAcoesSemanticas[1][3][40] = "comandos_1_3_40_10"; tabelaAcoesSemanticas[23][3][93] = "comandos_23_3_93_25"; tabelaAcoesSemanticas[34][3][123] = "comandos_34_3_123_35"; tabelaAcoesSemanticas[12][3][44] = "comandos_12_3_44_15"; tabelaAcoesSemanticas[12][3][41] = "comandos_12_3_41_11"; tabelaAcoesSemanticas[29][3][46] = "comandos_29_3_46_7"; tabelaAcoesSemanticas[29][3][61] = "comandos_29_3_61_9"; tabelaAcoesSemanticas[2][3][40] = "comandos_2_3_40_30"; tabelaAcoesSemanticas[35][3][125] = "comandos_35_3_125_36"; tabelaAcoesSemanticas[13][2][0] = "comandos_13_2_0_1"; tabelaAcoesSemanticas[13][1][0] = "comandos_13_1_0_2"; tabelaAcoesSemanticas[13][1][2] = "comandos_13_1_2_3"; tabelaAcoesSemanticas[13][1][13] = "comandos_13_1_13_4"; tabelaAcoesSemanticas[13][1][12] = "comandos_13_1_12_5"; tabelaAcoesSemanticas[13][1][14] = "comandos_13_1_14_6"; tabelaAcoesSemanticas[8][4][0] = "comandos_8_4_0_23"; tabelaAcoesSemanticas[19][1][16] = "comandos_19_1_16_24"; tabelaAcoesSemanticas[19][3][62] = "comandos_19_3_62_24"; tabelaAcoesSemanticas[19][3][60] = "comandos_19_3_60_24"; tabelaAcoesSemanticas[19][1][17] = "comandos_19_1_17_24"; tabelaAcoesSemanticas[19][1][18] = "comandos_19_1_18_24"; tabelaAcoesSemanticas[19][1][19] = "comandos_19_1_19_24"; tabelaAcoesSemanticas[25][3][91] = "comandos_25_3_91_26"; tabelaAcoesSemanticas[25][3][61] = "comandos_25_3_61_9"; tabelaAcoesSemanticas[3][3][40] = "comandos_3_3_40_18"; tabelaAcoesSemanticas[36][2][0] = "comandos_36_2_0_1"; tabelaAcoesSemanticas[36][1][0] = "comandos_36_1_0_2"; tabelaAcoesSemanticas[36][1][1] = "comandos_36_1_1_21"; tabelaAcoesSemanticas[36][1][2] = "comandos_36_1_2_3"; tabelaAcoesSemanticas[36][1][13] = "comandos_36_1_13_4"; tabelaAcoesSemanticas[36][1][12] = "comandos_36_1_12_5"; tabelaAcoesSemanticas[36][1][14] = "comandos_36_1_14_6"; tabelaAcoesSemanticas[20][3][41] = "comandos_20_3_41_21"; tabelaAcoesSemanticas[31][1][16] = "comandos_31_1_16_33"; tabelaAcoesSemanticas[31][3][62] = "comandos_31_3_62_33"; tabelaAcoesSemanticas[31][3][60] = "comandos_31_3_60_33"; tabelaAcoesSemanticas[31][1][17] = "comandos_31_1_17_33"; tabelaAcoesSemanticas[31][1][18] = "comandos_31_1_18_33"; tabelaAcoesSemanticas[31][1][19] = "comandos_31_1_19_33"; tabelaAcoesSemanticas[9][2][0] = "comandos_9_2_0_17"; tabelaAcoesSemanticas[15][2][0] = "comandos_15_2_0_12"; tabelaAcoesSemanticas[15][4][0] = "comandos_15_4_0_12"; tabelaAcoesSemanticas[26][4][0] = "comandos_26_4_0_27"; tabelaAcoesSemanticas[4][3][40] = "comandos_4_3_40_16"; tabelaAcoesSemanticas[10][2][0] = "comandos_10_2_0_12"; tabelaAcoesSemanticas[10][4][0] = "comandos_10_4_0_12"; tabelaAcoesSemanticas[10][3][41] = "comandos_10_3_41_11"; tabelaAcoesSemanticas[32][3][41] = "comandos_32_3_41_34"; tabelaAcoesSemanticas[21][3][123] = "comandos_21_3_123_22"; this.mapaAcoesSemanticas.put("comandos", tabelaAcoesSemanticas); // Subm‡quina expressaoBooleana tabelaAcoesSemanticas = new String[13][7][256]; tabelaAcoesSemanticas[0][1][7] = "expressaoBooleana_0_1_7_1"; tabelaAcoesSemanticas[0][1][8] = "expressaoBooleana_0_1_8_1"; tabelaAcoesSemanticas[0][3][40] = "expressaoBooleana_0_3_40_4"; tabelaAcoesSemanticas[0][3][33] = "expressaoBooleana_0_3_33_5"; tabelaAcoesSemanticas[7][1][16] = "expressaoBooleana_7_1_16_11"; tabelaAcoesSemanticas[7][3][62] = "expressaoBooleana_7_3_62_11"; tabelaAcoesSemanticas[7][3][60] = "expressaoBooleana_7_3_60_11"; tabelaAcoesSemanticas[7][1][17] = "expressaoBooleana_7_1_17_11"; tabelaAcoesSemanticas[7][1][18] = "expressaoBooleana_7_1_18_11"; tabelaAcoesSemanticas[7][1][19] = "expressaoBooleana_7_1_19_11"; tabelaAcoesSemanticas[2][1][16] = "expressaoBooleana_2_1_16_6"; tabelaAcoesSemanticas[2][3][62] = "expressaoBooleana_2_3_62_6"; tabelaAcoesSemanticas[2][3][60] = "expressaoBooleana_2_3_60_6"; tabelaAcoesSemanticas[2][1][17] = "expressaoBooleana_2_1_17_6"; tabelaAcoesSemanticas[2][1][18] = "expressaoBooleana_2_1_18_6"; tabelaAcoesSemanticas[2][1][19] = "expressaoBooleana_2_1_19_6"; tabelaAcoesSemanticas[8][3][41] = "expressaoBooleana_8_3_41_1"; tabelaAcoesSemanticas[3][3][41] = "expressaoBooleana_3_3_41_9"; tabelaAcoesSemanticas[3][3][41] = "expressaoBooleana_3_3_41_9"; tabelaAcoesSemanticas[10][1][16] = "expressaoBooleana_10_1_16_12"; tabelaAcoesSemanticas[10][3][62] = "expressaoBooleana_10_3_62_12"; tabelaAcoesSemanticas[10][3][60] = "expressaoBooleana_10_3_60_12"; tabelaAcoesSemanticas[10][1][17] = "expressaoBooleana_10_1_17_12"; tabelaAcoesSemanticas[10][1][18] = "expressaoBooleana_10_1_18_12"; tabelaAcoesSemanticas[10][1][19] = "expressaoBooleana_10_1_19_12"; this.mapaAcoesSemanticas.put("expressaoBooleana", tabelaAcoesSemanticas); // Subm‡quina expressao tabelaAcoesSemanticas = new String[16][7][256]; tabelaAcoesSemanticas[5][3][41] = "expressao_5_3_41_3"; tabelaAcoesSemanticas[0][3][45] = "expressao_0_3_45_1"; tabelaAcoesSemanticas[0][3][43] = "expressao_0_3_43_1"; tabelaAcoesSemanticas[0][2][0] = "expressao_0_2_0_2"; tabelaAcoesSemanticas[0][4][0] = "expressao_0_4_0_3"; tabelaAcoesSemanticas[0][1][7] = "expressao_0_1_7_3"; tabelaAcoesSemanticas[0][1][8] = "expressao_0_1_8_3"; tabelaAcoesSemanticas[0][3][40] = "expressao_0_3_40_4"; tabelaAcoesSemanticas[11][3][93] = "expressao_11_3_93_12"; tabelaAcoesSemanticas[1][2][0] = "expressao_1_2_0_2"; tabelaAcoesSemanticas[1][4][0] = "expressao_1_4_0_3"; tabelaAcoesSemanticas[1][1][7] = "expressao_1_1_7_3"; tabelaAcoesSemanticas[1][1][8] = "expressao_1_1_8_3"; tabelaAcoesSemanticas[12][3][45] = "expressao_12_3_45_0"; tabelaAcoesSemanticas[12][3][43] = "expressao_12_3_43_0"; tabelaAcoesSemanticas[12][3][91] = "expressao_12_3_91_13"; tabelaAcoesSemanticas[12][3][42] = "expressao_12_3_42_0"; tabelaAcoesSemanticas[12][3][47] = "expressao_12_3_47_0"; tabelaAcoesSemanticas[7][4][0] = "expressao_7_4_0_11"; tabelaAcoesSemanticas[2][3][45] = "expressao_2_3_45_0"; tabelaAcoesSemanticas[2][3][43] = "expressao_2_3_43_0"; tabelaAcoesSemanticas[2][3][46] = "expressao_2_3_46_6"; tabelaAcoesSemanticas[2][3][91] = "expressao_2_3_91_7"; tabelaAcoesSemanticas[2][3][40] = "expressao_2_3_40_8"; tabelaAcoesSemanticas[2][3][42] = "expressao_2_3_42_0"; tabelaAcoesSemanticas[2][3][47] = "expressao_2_3_47_0"; tabelaAcoesSemanticas[13][4][0] = "expressao_13_4_0_14"; tabelaAcoesSemanticas[8][2][0] = "expressao_8_2_0_9"; tabelaAcoesSemanticas[8][4][0] = "expressao_8_4_0_9"; tabelaAcoesSemanticas[8][3][41] = "expressao_8_3_41_3"; tabelaAcoesSemanticas[3][3][45] = "expressao_3_3_45_0"; tabelaAcoesSemanticas[3][3][43] = "expressao_3_3_43_0"; tabelaAcoesSemanticas[3][3][42] = "expressao_3_3_42_0"; tabelaAcoesSemanticas[3][3][47] = "expressao_3_3_47_0"; tabelaAcoesSemanticas[14][3][93] = "expressao_14_3_93_3"; tabelaAcoesSemanticas[9][3][44] = "expressao_9_3_44_10"; tabelaAcoesSemanticas[9][3][41] = "expressao_9_3_41_3"; tabelaAcoesSemanticas[15][3][45] = "expressao_15_3_45_0"; tabelaAcoesSemanticas[15][3][43] = "expressao_15_3_43_0"; tabelaAcoesSemanticas[15][3][46] = "expressao_15_3_46_6"; tabelaAcoesSemanticas[15][3][42] = "expressao_15_3_42_0"; tabelaAcoesSemanticas[15][3][47] = "expressao_15_3_47_0"; tabelaAcoesSemanticas[10][2][0] = "expressao_10_2_0_9"; tabelaAcoesSemanticas[10][4][0] = "expressao_10_4_0_9"; this.mapaAcoesSemanticas.put("expressao", tabelaAcoesSemanticas); // Subm‡quina texto tabelaAcoesSemanticas = new String[13][7][256]; tabelaAcoesSemanticas[5][2][0] = "texto_5_2_0_6"; tabelaAcoesSemanticas[5][4][0] = "texto_5_4_0_6"; tabelaAcoesSemanticas[5][3][41] = "texto_5_3_41_1"; tabelaAcoesSemanticas[11][3][93] = "texto_11_3_93_1"; tabelaAcoesSemanticas[0][6][0] = "texto_0_6_0_1"; tabelaAcoesSemanticas[0][2][0] = "texto_0_2_0_2"; tabelaAcoesSemanticas[6][3][44] = "texto_6_3_44_7"; tabelaAcoesSemanticas[6][3][41] = "texto_6_3_41_1"; tabelaAcoesSemanticas[12][3][46] = "texto_12_3_46_3"; tabelaAcoesSemanticas[12][3][43] = "texto_12_3_43_0"; tabelaAcoesSemanticas[1][3][43] = "texto_1_3_43_0"; tabelaAcoesSemanticas[7][2][0] = "texto_7_2_0_6"; tabelaAcoesSemanticas[7][4][0] = "texto_7_4_0_6"; tabelaAcoesSemanticas[2][3][46] = "texto_2_3_46_3"; tabelaAcoesSemanticas[2][3][91] = "texto_2_3_91_4"; tabelaAcoesSemanticas[2][3][40] = "texto_2_3_40_5"; tabelaAcoesSemanticas[2][3][43] = "texto_2_3_43_0"; tabelaAcoesSemanticas[8][3][93] = "texto_8_3_93_9"; tabelaAcoesSemanticas[9][3][91] = "texto_9_3_91_10"; tabelaAcoesSemanticas[9][3][43] = "texto_9_3_43_0"; tabelaAcoesSemanticas[4][4][0] = "texto_4_4_0_8"; tabelaAcoesSemanticas[10][4][0] = "texto_10_4_0_11"; this.mapaAcoesSemanticas.put("texto", tabelaAcoesSemanticas); } public void executarAcaoSemantica(String nomeSubmaquina, int estado, Token token) { String[][][] tabelaAcoesSemanticas = this.mapaAcoesSemanticas.get(nomeSubmaquina); int valor; int classeToken = token.getClasse(); // Ajusta o valor de acordo com a classe do Token. if(classeToken == Token.CLASSE_IDENTIFICADOR || classeToken == Token.CLASSE_NUMERO_INTEIRO || classeToken == Token.CLASSE_STRING) valor = 0; else valor = token.getID(); try { String m = tabelaAcoesSemanticas[estado][token.getClasse()][valor]; if(m != null) { // Executa a aŤ‹o sem‰ntica usando Reflection. Class<?> classe = Class.forName("compilador.analisador.semantico.AcoesSemanticas"); Method metodo = classe.getMethod(m, new Class[0]); metodo.invoke(null, new Object[0]); } } catch(Exception e) { } } public static void armazenarToken(Token token) { ParametrosAcoesSemanticas.TOKEN = token; if(token.getClasse() == Token.CLASSE_IDENTIFICADOR) ParametrosAcoesSemanticas.TOKEN_ID_ANTERIOR = token; } }
package com.tencent.mm.plugin.account.friend.ui; import android.content.Context; import android.view.View; import android.view.View.OnClickListener; import com.tencent.mm.kernel.g; import com.tencent.mm.model.s; import com.tencent.mm.plugin.messenger.foundation.a.i; import com.tencent.mm.sdk.platformtools.bi; import com.tencent.mm.sdk.platformtools.x; import com.tencent.mm.storage.ab; import java.util.LinkedList; public final class a implements OnClickListener { private Context context; private a eLH; static /* synthetic */ void y(ab abVar) { com.tencent.mm.l.a abVar2; if (((int) abVar2.dhP) == 0) { ((i) g.l(i.class)).FR().U(abVar2); if (!bi.oW(abVar2.field_username)) { abVar2 = ((i) g.l(i.class)).FR().Yg(abVar2.field_username); } else { return; } } if (((int) abVar2.dhP) <= 0) { x.e("MicroMsg.AddContactListener", "addContact : insert contact failed"); } else { s.p(abVar2); } } public a(Context context, a aVar) { this.context = context; this.eLH = aVar; } public final void onClick(View view) { b bVar = (b) view.getTag(); String str = bVar.username; int i = bVar.eLK; int i2 = bVar.position; ab Yg = ((i) g.l(i.class)).FR().Yg(str); if (bi.oW(Yg.field_username)) { Yg.setUsername(str); } com.tencent.mm.pluginsdk.ui.applet.a aVar = new com.tencent.mm.pluginsdk.ui.applet.a(this.context, new 1(this, Yg, i2, str)); LinkedList linkedList = new LinkedList(); linkedList.add(Integer.valueOf(i)); aVar.c(str, linkedList); } }
package com.tencent.mm.plugin.fts; public interface e { void aPT(); }
package com.example.rxandroidapplication; import android.os.Bundle; import android.util.Log; import androidx.appcompat.app.AppCompatActivity; import io.reactivex.Observable; import io.reactivex.Observer; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.disposables.Disposable; import io.reactivex.functions.Function; import io.reactivex.functions.Predicate; import io.reactivex.observers.DisposableObserver; import io.reactivex.schedulers.Schedulers; public class OperatorExample extends AppCompatActivity { private static final String TAG = OperatorExample.class.getSimpleName(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // fromArray fromArrayOPerator(); // range operator fromRangeOperator(); // repeate operator fromRepeateOPerator(); //chaining of Operator fromPrintEvenNumber(); } private void fromPrintEvenNumber() { Observable.range(1,20) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .filter(new Predicate<Integer>() { @Override public boolean test(Integer integer) { return integer%2==0; } }) .map(new Function<Integer, String>() { @Override public String apply(Integer integer) { return integer+"is Even number"; } }) .subscribe(new Observer<String>() { @Override public void onSubscribe(Disposable d) { } @Override public void onNext(String s) { Log.d(TAG,"Number"+s); } @Override public void onError(Throwable e) { } @Override public void onComplete() { } }); } private void fromRepeateOPerator() { Observable.range(1,3) .repeat(2) .subscribe(new DisposableObserver<Integer>() { @Override public void onNext(Integer integer) { Log.d(TAG,"Repeate"+integer); } @Override public void onError(Throwable e) { } @Override public void onComplete() { } }); } private void fromRangeOperator() { Observable.range(2, 23) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new DisposableObserver<Integer>() { @Override public void onNext(Integer integer) { Log.d(TAG, "Number Range" + integer); } @Override public void onError(Throwable e) { Log.d(TAG, "Error" + e.getMessage()); } @Override public void onComplete() { Log.d(TAG, "All Emiter Completed"); } }); } private void fromArrayOPerator() { Integer[] number = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21}; Observable.fromArray(number) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new DisposableObserver<Integer>() { @Override public void onNext(Integer integer) { Log.d(TAG, "Number" + integer); } @Override public void onError(Throwable e) { Log.d(TAG, "Error" + e.getMessage()); } @Override public void onComplete() { Log.d(TAG, "All Emiter Completed"); } }); } }
package plp.orientadaObjetos3.modulo; import java.util.Iterator; import java.util.LinkedHashSet; import plp.orientadaObjetos1.expressao.leftExpression.Id; public class ListaId extends LinkedHashSet<Id> { /** * */ private static final long serialVersionUID = 2479577085391204540L; public ListaId() { super(); } public ListaId(Id valor) { super(); this.add(valor); } public ListaId(Id valor, ListaId lista) { super(); this.add(valor); this.addAll(lista); } public String toString() { StringBuffer buffer = new StringBuffer(); Iterator<Id> it = this.iterator(); boolean first = true; while (it.hasNext()) { if (first) { buffer.append(it.next()); first = false; } else buffer.append(", " + it.next()); } return buffer.toString(); } }
package org.search.flight; import java.time.LocalDate; import org.apache.log4j.Logger; import org.search.flight.utils.ProcessorUtilities; public class Application { static final Logger LOG = Logger.getLogger(Application.class); public static void main(String[] args) { if (args.length != 6) { LOG.error("Usage requires six parameters"); }else{ ProcessorUtilities.getProcessorUtilities().importSampleData(); int numberAdult = ProcessorUtilities.getProcessorUtilities().stringParseToInt(args[0]); int numberChild = ProcessorUtilities.getProcessorUtilities().stringParseToInt(args[1]); int numberInfant = ProcessorUtilities.getProcessorUtilities().stringParseToInt(args[2]); String idOriginAirport = args[3]; String idDestinationAirport = args[4]; LocalDate plannedDate = ProcessorUtilities.getProcessorUtilities().stringToLocalDate(args[5]); FlightSearchApp flightSearchApp = new FlightSearchApp(); flightSearchApp.calculateTrips(numberAdult, numberChild, numberInfant, idOriginAirport, idDestinationAirport, plannedDate); } } }
package com.allan.springbatchexample.repository; import com.allan.springbatchexample.model.Employee; import org.springframework.data.jpa.repository.JpaRepository; public interface EmployeeRepository extends JpaRepository<Employee, Long> { }
package com.quam.quamtest.utils; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapShader; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.PorterDuff; import android.graphics.PorterDuffXfermode; import android.renderscript.Allocation; import android.renderscript.Element; import android.renderscript.RenderScript; import android.renderscript.ScriptIntrinsicBlur; import android.support.annotation.NonNull; import android.support.annotation.StringDef; import android.support.v4.util.ArrayMap; import android.widget.ImageView; import com.squareup.picasso.Picasso; import com.squareup.picasso.Transformation; import java.lang.ref.WeakReference; import java.util.Map; public final class ImageUtils { private static final Map<String, WeakReference<Transformation>> transformCache = new ArrayMap<>(); private static final String BLUR = "blur"; private static final String CIRCLE = "circle"; @StringDef({BLUR, CIRCLE}) @interface TransformationType { } private ImageUtils() { } public static Transformation getOrCreateCache(@TransformationType String key, Context context) { WeakReference<Transformation> transformationWeakReference = transformCache.get(key); final Transformation transformation; if (transformationWeakReference == null) { transformation = createAndCache(key, context); return transformation; } else { transformation = transformationWeakReference.get(); if (transformation == null) { return createAndCache(key, context); } else { return transformation; } } } public static void clearTransformationCache() { if (transformCache.size() > 0) { transformCache.clear(); } } @NonNull private static Transformation createAndCache(@TransformationType String key, Context context) { final Transformation transformation; switch (key) { case BLUR: transformation = new BlurTransform(context); break; case CIRCLE: transformation = new CircleTransform(context); break; default: throw new IllegalArgumentException(); } transformCache.put(key, new WeakReference<>(transformation)); return transformation; } public static void loadBlur(Context context, String url, ImageView imageView, boolean cache) { final Transformation blurTransformation; if (cache) { blurTransformation = getOrCreateCache(BLUR, context); } else { blurTransformation = new BlurTransform(context); } Picasso.with(context) .load(url) .transform(blurTransformation) .fit() .centerCrop() .into(imageView); } public static void loadCircle(Context context, String url, ImageView imageView, boolean cache) { final Transformation circleTransformation; if (cache) { circleTransformation = getOrCreateCache(CIRCLE, context); } else { circleTransformation = new CircleTransform(context); } Picasso.with(context) .load(url) .transform(circleTransformation) .fit() .into(imageView); } private static class CircleTransform implements Transformation { private final int boarderSize; public CircleTransform(Context context) { boarderSize = SystemUtils.convertDpToPx(3, context); } @Override public Bitmap transform(Bitmap source) { final int size = Math.min(source.getWidth(), source.getHeight()); final int x = (source.getWidth() - size) / 2; final int y = (source.getHeight() - size) / 2; final Bitmap squaredBitmap = Bitmap.createBitmap(source, x, y, size, size); if (squaredBitmap != source) { source.recycle(); } final Bitmap bitmap = Bitmap.createBitmap(size, size, source.getConfig()); final Canvas canvas = new Canvas(bitmap); final Paint paint = new Paint(); final BitmapShader shader = new BitmapShader(squaredBitmap, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP); paint.setShader(shader); paint.setAntiAlias(true); final float radius = size / 2f; canvas.drawCircle(radius, radius, radius, paint); final int width = bitmap.getWidth(); final int height = bitmap.getHeight(); final int borderRadius = Math.min(height / 2, width / 2); final Bitmap output = Bitmap.createBitmap(width + 8, height + 8, Bitmap.Config.ARGB_8888); final Paint borderPaint = new Paint(); borderPaint.setAntiAlias(true); final Canvas borderCanvas = new Canvas(output); borderCanvas.drawARGB(0, 0, 0, 0); borderPaint.setStyle(Paint.Style.FILL); borderCanvas.drawCircle((width / 2) + 4, (height / 2) + 4, borderRadius, borderPaint); borderPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN)); borderCanvas.drawBitmap(bitmap, 4, 4, borderPaint); borderPaint.setXfermode(null); borderPaint.setStyle(Paint.Style.STROKE); borderPaint.setColor(Color.WHITE); borderPaint.setStrokeWidth(boarderSize); borderCanvas.drawCircle((width / 2) + 4, (height / 2) + 4, borderRadius, borderPaint); squaredBitmap.recycle(); return output; } @Override public String key() { return "circle"; } } private static class BlurTransform implements Transformation { private final RenderScript rs; public BlurTransform(Context context) { super(); rs = RenderScript.create(context); } @Override public Bitmap transform(Bitmap bitmap) { final Bitmap blurredBitmap = Bitmap.createBitmap(bitmap); final Allocation input = Allocation.createFromBitmap(rs, bitmap, Allocation.MipmapControl.MIPMAP_FULL, Allocation.USAGE_SHARED); final Allocation output = Allocation.createTyped(rs, input.getType()); final ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs)); script.setInput(input); script.setRadius(25); script.forEach(output); output.copyTo(blurredBitmap); bitmap.recycle(); return blurredBitmap; } @Override public String key() { return "blur"; } } }
import db.DbConnect; /** * @ClassName: Main * @Author: Leo * @Description: * @Date: 2019/3/28 21:27 */ public class Main { public static void main(String[] args) { DbConnect.getConnection(); } }
package com.yksoul.pay.payment.ways; import com.alibaba.fastjson.JSONObject; import com.alipay.api.AlipayApiException; import com.alipay.api.request.AlipayTradePrecreateRequest; import com.alipay.api.response.AlipayTradePrecreateResponse; import com.google.auto.service.AutoService; import com.yksoul.pay.api.IPaymentStrategy; import com.yksoul.pay.api.IPaymentWay; import com.yksoul.pay.domain.enums.AliPaymentEnum; import com.yksoul.pay.domain.model.PayModel; import com.yksoul.pay.exception.EasyPayException; import com.yksoul.pay.payment.AbstractAliPay; /** * @author yk * @version 1.0 * @date 2018-09-13 */ @AutoService(IPaymentStrategy.class) public class AliPayTradeScanCode extends AbstractAliPay { @Override public String onPay(PayModel payModel) throws EasyPayException { try { AlipayTradePrecreateRequest request = new AlipayTradePrecreateRequest(); JSONObject json = new JSONObject(); json.put("out_trade_no", payModel.getOrderSn()); json.put("total_amount", payModel.getTotalAmount()); json.put("subject", payModel.getSubject()); json.put("store_id", payModel.getStoreId()); json.put("timeout_express", "60m"); json.put("passback_params", payModel.getNotifyKey()); request.setBizContent(json.toJSONString()); AlipayTradePrecreateResponse response = aliPayConfig.getAlipayClient().execute(request); return response.getBody(); } catch (AlipayApiException e) { throw new EasyPayException(e); } } @Override public IPaymentWay supportsPayment() { return AliPaymentEnum.ALIPAY_TRADE_SCAN_CODE; } }
package com.practice.imdc.movieservice.constants; import com.practice.imdc.movieservice.model.Movie; import java.util.ArrayList; import java.util.List; public class DataUtil { public static List<Movie> movies = new ArrayList<>(); public static List<Movie> getMovies() { return movies; } public static Movie add(Movie movie) { movies.add(movie); return movie; } }
package com.mrlittlenew.controller; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @Controller public class PageController { protected static final Logger logger = LoggerFactory.getLogger(PageController.class); @RequestMapping("/test") public String test() { logger.debug("index test!!!"); return "testPage"; } }
/* * Sonar PHP Plugin * Copyright (C) 2010 Sonar PHP Plugin * dev@sonar.codehaus.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 3 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 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 02 */ package org.sonar.plugins.php.phpunit; import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import static org.sonar.plugins.php.phpunit.PhpUnitConfiguration.PHPUNIT_BOOTSTRAP_PROPERTY_KEY; import static org.sonar.plugins.php.phpunit.PhpUnitConfiguration.PHPUNIT_CONFIGURATION_PROPERTY_KEY; import static org.sonar.plugins.php.phpunit.PhpUnitConfiguration.PHPUNIT_COVERAGE_REPORT_FILE_PROPERTY_KEY; import static org.sonar.plugins.php.phpunit.PhpUnitConfiguration.PHPUNIT_DEFAULT_BOOTSTRAP; import static org.sonar.plugins.php.phpunit.PhpUnitConfiguration.PHPUNIT_DEFAULT_CONFIGURATION; import static org.sonar.plugins.php.phpunit.PhpUnitConfiguration.PHPUNIT_DEFAULT_COVERAGE_REPORT_FILE; import static org.sonar.plugins.php.phpunit.PhpUnitConfiguration.PHPUNIT_DEFAULT_FILTER; import static org.sonar.plugins.php.phpunit.PhpUnitConfiguration.PHPUNIT_DEFAULT_GROUP; import static org.sonar.plugins.php.phpunit.PhpUnitConfiguration.PHPUNIT_DEFAULT_LOADER; import static org.sonar.plugins.php.phpunit.PhpUnitConfiguration.PHPUNIT_DEFAULT_MAIN_TEST_FILE; import static org.sonar.plugins.php.phpunit.PhpUnitConfiguration.PHPUNIT_DEFAULT_REPORT_FILE_NAME; import static org.sonar.plugins.php.phpunit.PhpUnitConfiguration.PHPUNIT_DEFAULT_REPORT_FILE_PATH; import static org.sonar.plugins.php.phpunit.PhpUnitConfiguration.PHPUNIT_FILTER_PROPERTY_KEY; import static org.sonar.plugins.php.phpunit.PhpUnitConfiguration.PHPUNIT_GROUP_PROPERTY_KEY; import static org.sonar.plugins.php.phpunit.PhpUnitConfiguration.PHPUNIT_LOADER_PROPERTY_KEY; import static org.sonar.plugins.php.phpunit.PhpUnitConfiguration.PHPUNIT_MAIN_TEST_FILE_PROPERTY_KEY; import static org.sonar.plugins.php.phpunit.PhpUnitConfiguration.PHPUNIT_REPORT_FILE_NAME_PROPERTY_KEY; import static org.sonar.plugins.php.phpunit.PhpUnitConfiguration.PHPUNIT_REPORT_FILE_RELATIVE_PATH_PROPERTY_KEY; import static org.sonar.plugins.php.phpunit.PhpUnitConfiguration.PHPUNIT_SHOULD_RUN_COVERAGE_PROPERTY_KEY; import java.io.File; import java.io.IOException; import java.util.Arrays; import org.apache.commons.configuration.Configuration; import org.apache.maven.project.MavenProject; import org.junit.Ignore; import org.junit.Test; import org.sonar.api.resources.Project; import org.sonar.api.resources.ProjectFileSystem; /** * The Class PhpDependConfigurationTest. */ public class PhpUnitConfigurationTest { /** * Should get valid suffixe option. */ @Test public void testConfigurationParameters() { Project project = mock(Project.class); Configuration c = getMockConfiguration(project); when(c.getBoolean(PHPUNIT_SHOULD_RUN_COVERAGE_PROPERTY_KEY, true)).thenReturn(true); when(project.getConfiguration()).thenReturn(c); PhpUnitConfiguration config = new PhpUnitConfiguration(project); assertEquals(true, config.shouldRunCoverage()); when(c.getString(PHPUNIT_FILTER_PROPERTY_KEY, PHPUNIT_DEFAULT_FILTER)).thenReturn(PHPUNIT_DEFAULT_FILTER); assertEquals(PHPUNIT_DEFAULT_FILTER, config.getFilter()); when(c.getString(PHPUNIT_BOOTSTRAP_PROPERTY_KEY, PHPUNIT_DEFAULT_BOOTSTRAP)).thenReturn(PHPUNIT_DEFAULT_BOOTSTRAP); assertEquals(PHPUNIT_DEFAULT_BOOTSTRAP, config.getBootstrap()); when(c.getString(PHPUNIT_CONFIGURATION_PROPERTY_KEY, PHPUNIT_DEFAULT_CONFIGURATION)).thenReturn(PHPUNIT_DEFAULT_CONFIGURATION); assertEquals(PHPUNIT_DEFAULT_CONFIGURATION, config.getConfiguration()); when(c.getString(PHPUNIT_LOADER_PROPERTY_KEY, PHPUNIT_DEFAULT_LOADER)).thenReturn(PHPUNIT_DEFAULT_LOADER); assertEquals(PHPUNIT_DEFAULT_LOADER, config.getLoader()); when(c.getString(PHPUNIT_GROUP_PROPERTY_KEY, PHPUNIT_DEFAULT_GROUP)).thenReturn(PHPUNIT_DEFAULT_GROUP); assertEquals(PHPUNIT_DEFAULT_GROUP, config.getGroup()); when(c.getString(PHPUNIT_COVERAGE_REPORT_FILE_PROPERTY_KEY, PHPUNIT_DEFAULT_COVERAGE_REPORT_FILE)).thenReturn( PHPUNIT_DEFAULT_COVERAGE_REPORT_FILE); File expectedReportFile = new File(project.getFileSystem().getBuildDir(), config.getReportFileRelativePath() + File.separator + PHPUNIT_DEFAULT_COVERAGE_REPORT_FILE); assertEquals(expectedReportFile, config.getCoverageReportFile()); } /** * Should get valid suffixe option. */ @Test(expected = PhpUnitConfigurationException.class) public void shouldThrowExceptionIfReportFileDoesNotExist() { Project project = mock(Project.class); Configuration c = getMockConfiguration(project); when(project.getConfiguration()).thenReturn(c); PhpUnitConfiguration config = new PhpUnitConfiguration(project); config.getMainTestClass(); } /** * Should get valid suffixe option. * * @throws IOException */ @Test(expected = PhpUnitConfigurationException.class) @Ignore public void shouldThrowExceptionIfReportIsNotInTestOrSourceDirs() throws IOException { Project project = mock(Project.class); Configuration c = mock(Configuration.class); MavenProject mavenProject = mock(MavenProject.class); ProjectFileSystem fs = mock(ProjectFileSystem.class); when(project.getPom()).thenReturn(mavenProject); when(project.getFileSystem()).thenReturn(fs); File temp = File.createTempFile("fake", "file"); File baseDir = temp.getParentFile(); when(fs.getSourceDirs()).thenReturn(Arrays.asList(new File("C:\\projets\\PHP\\Monkey\\sources\\main"))); when(fs.getTestDirs()).thenReturn(Arrays.asList(new File("C:\\projets\\PHP\\Monkey\\sources\\test"))); when(fs.getBuildDir()).thenReturn(new File(baseDir, "target")); when(fs.getBasedir()).thenReturn(baseDir); when(c.getString(PHPUNIT_REPORT_FILE_NAME_PROPERTY_KEY, PHPUNIT_DEFAULT_REPORT_FILE_NAME)).thenReturn("phpunit.xml"); when(c.getString(PHPUNIT_MAIN_TEST_FILE_PROPERTY_KEY, PHPUNIT_DEFAULT_MAIN_TEST_FILE)).thenReturn(temp.getName()); when(c.getString(PHPUNIT_REPORT_FILE_RELATIVE_PATH_PROPERTY_KEY, PHPUNIT_DEFAULT_REPORT_FILE_PATH)).thenReturn("d:\\logs\\"); when(project.getConfiguration()).thenReturn(c); PhpUnitConfiguration config = new PhpUnitConfiguration(project); try { config.getMainTestClass(); } catch (PhpUnitConfigurationException e) { assertEquals(true, e.getMessage().contains("not present neither in test directories nor in source")); throw e; } } /** * Should get valid suffixe option. */ @Test public void shouldReturnDefaultReportFileWithDefaultPath() { Project project = mock(Project.class); Configuration configuration = mock(Configuration.class); MavenProject mavenProject = mock(MavenProject.class); ProjectFileSystem fs = mock(ProjectFileSystem.class); when(project.getPom()).thenReturn(mavenProject); when(project.getFileSystem()).thenReturn(fs); when(fs.getSourceDirs()).thenReturn(Arrays.asList(new File("C:\\projets\\PHP\\Monkey\\sources\\main"))); when(fs.getTestDirs()).thenReturn(Arrays.asList(new File("C:\\projets\\PHP\\Monkey\\Sources\\test"))); when(fs.getBuildDir()).thenReturn(new File("C:\\projets\\PHP\\Monkey\\target")); when(configuration.getString(PHPUNIT_REPORT_FILE_NAME_PROPERTY_KEY, PHPUNIT_DEFAULT_REPORT_FILE_NAME)).thenReturn( PHPUNIT_DEFAULT_REPORT_FILE_NAME); when(configuration.getString(PHPUNIT_REPORT_FILE_RELATIVE_PATH_PROPERTY_KEY, PHPUNIT_DEFAULT_REPORT_FILE_PATH)).thenReturn( PHPUNIT_DEFAULT_REPORT_FILE_PATH); when(project.getConfiguration()).thenReturn(configuration); PhpUnitConfiguration config = new PhpUnitConfiguration(project); assertEquals(config.getReportFile().getPath().replace('/', '\\'), "C:\\projets\\PHP\\Monkey\\target\\logs\\phpunit.xml"); } /** * Should get valid suffixe option. */ @Test public void shouldReturnDefaultReportFileWithCustomPath() { Project project = mock(Project.class); Configuration configuration = mock(Configuration.class); MavenProject mavenProject = mock(MavenProject.class); ProjectFileSystem fs = mock(ProjectFileSystem.class); when(project.getPom()).thenReturn(mavenProject); when(project.getFileSystem()).thenReturn(fs); when(fs.getSourceDirs()).thenReturn(Arrays.asList(new File("C:\\projets\\PHP\\Monkey\\sources\\main"))); when(fs.getTestDirs()).thenReturn(Arrays.asList(new File("C:\\projets\\PHP\\Monkey\\Sources\\test"))); when(fs.getBuildDir()).thenReturn(new File("C:\\projets\\PHP\\Monkey\\target")); when(configuration.getString(PHPUNIT_REPORT_FILE_NAME_PROPERTY_KEY, PHPUNIT_DEFAULT_REPORT_FILE_NAME)).thenReturn( PHPUNIT_DEFAULT_REPORT_FILE_NAME); when(configuration.getString(PHPUNIT_REPORT_FILE_RELATIVE_PATH_PROPERTY_KEY, PHPUNIT_DEFAULT_REPORT_FILE_PATH)).thenReturn("reports"); when(project.getConfiguration()).thenReturn(configuration); PhpUnitConfiguration config = new PhpUnitConfiguration(project); assertEquals(config.getReportFile().getPath().replace('/', '\\'), "C:\\projets\\PHP\\Monkey\\target\\reports\\phpunit.xml"); } /** * Should return custom report file with custom path. */ @Test public void shouldReturnCustomReportFileWithCustomPath() { Project project = mock(Project.class); Configuration configuration = mock(Configuration.class); MavenProject mavenProject = mock(MavenProject.class); ProjectFileSystem fs = mock(ProjectFileSystem.class); when(project.getPom()).thenReturn(mavenProject); when(project.getFileSystem()).thenReturn(fs); when(fs.getSourceDirs()).thenReturn(Arrays.asList(new File("C:\\projets\\PHP\\Monkey\\sources\\main"))); when(fs.getTestDirs()).thenReturn(Arrays.asList(new File("C:\\projets\\PHP\\Monkey\\Sources\\test"))); when(fs.getBuildDir()).thenReturn(new File("C:\\projets\\PHP\\Monkey\\target")); when(configuration.getString(PHPUNIT_REPORT_FILE_NAME_PROPERTY_KEY, PHPUNIT_DEFAULT_REPORT_FILE_NAME)).thenReturn("punit.summary.xml"); when(configuration.getString(PHPUNIT_REPORT_FILE_NAME_PROPERTY_KEY, PHPUNIT_DEFAULT_REPORT_FILE_NAME)).thenReturn("punit.summary.xml"); when(configuration.getString(PHPUNIT_REPORT_FILE_RELATIVE_PATH_PROPERTY_KEY, PHPUNIT_DEFAULT_REPORT_FILE_PATH)).thenReturn("reports"); when(project.getConfiguration()).thenReturn(configuration); PhpUnitConfiguration config = new PhpUnitConfiguration(project); assertEquals(config.getReportFile().getPath().replace('/', '\\'), "C:\\projets\\PHP\\Monkey\\target\\reports\\punit.summary.xml"); } private Configuration getMockConfiguration(Project project) { Configuration c = mock(Configuration.class); MavenProject mavenProject = mock(MavenProject.class); ProjectFileSystem fs = mock(ProjectFileSystem.class); when(project.getPom()).thenReturn(mavenProject); when(project.getFileSystem()).thenReturn(fs); when(fs.getSourceDirs()).thenReturn(Arrays.asList(new File("C:\\projets\\PHP\\Monkey\\sources\\main"))); when(fs.getTestDirs()).thenReturn(Arrays.asList(new File("C:\\projets\\PHP\\Monkey\\Sources\\test"))); when(fs.getBuildDir()).thenReturn(new File("C:\\projets\\PHP\\Monkey\\target")); when(fs.getBasedir()).thenReturn(new File("C:\\projets\\PHP\\Monkey\\")); when(c.getString(PHPUNIT_REPORT_FILE_NAME_PROPERTY_KEY, PHPUNIT_DEFAULT_REPORT_FILE_NAME)).thenReturn("phpunit.xml"); when(c.getString(PHPUNIT_MAIN_TEST_FILE_PROPERTY_KEY, PHPUNIT_DEFAULT_MAIN_TEST_FILE)).thenReturn("/out/of/dir/mainTestClass.php"); when(c.getString(PHPUNIT_REPORT_FILE_RELATIVE_PATH_PROPERTY_KEY, PHPUNIT_DEFAULT_REPORT_FILE_PATH)).thenReturn("d:\\logs\\"); return c; } }
package com.zhao.weather.webapi; import com.zhao.weather.common.URLCONST; import com.zhao.weather.callback.JsonCallback; import com.zhao.weather.callback.ResultCallback; import com.zhao.weather.callback.WeatherCallback; import com.zhao.weather.model.JsonModel; import com.zhao.weather.model.Weather; import com.zhao.weather.source.HttpDataSource; import com.zhao.weather.util.HttpUtil; import com.zhao.weather.util.StringHelper; import java.util.HashMap; import java.util.Map; /** * Created by zhao on 2017/4/19. */ public class CommonApi { /** * 获取天气信息 * @param city * @param day * @param callback */ public static void getWeather(String city, int day, final ResultCallback callback){ try { Map<String,Object> params = new HashMap<>(); params.put("city",java.net.URLEncoder.encode(city.replace("市",""), "gb2312")); params.put("password","DJOYnieT8234jlsK"); params.put("day",day); HttpDataSource.httpGetNoRSAByWeather(HttpUtil.makeURLNoRSA(URLCONST.method_weather,params), new WeatherCallback() { @Override public void onFinish(Weather weather) { callback.onFinish(weather,0); } @Override public void onError(Exception e) { callback.onError(e); } }); }catch (Exception e){ e.printStackTrace(); callback.onError(e); } } /** * 上传位置信息 * @param key * @param latitude * @param longitude * @param description * @param callback */ public static void updateLocation(String key,double latitude,double longitude,String description,final ResultCallback callback){ Map<String,Object> params = new HashMap<>(); if(!StringHelper.isEmpty(key)){ params.put("key",key); } params.put("latitude",latitude); params.put("longitude",longitude); if(!StringHelper.isEmpty(description)){ params.put("description",description); } HttpDataSource.httpGetNoRSA(HttpUtil.makeURLNoRSA(URLCONST.method_updateLocation, params), new JsonCallback() { @Override public void onFinish(JsonModel jsonModel) { callback.onFinish(jsonModel.getResult(),jsonModel.getError()); } @Override public void onError(Exception e) { callback.onError(e); } }); } }
package com.lyz.databinding.bean; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Canvas; import android.util.AttributeSet; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.widget.EditText; import android.widget.RelativeLayout; import android.widget.TextView; import com.lyz.databinding.R; /** * EditViewWithMsgHint.java * Author: liuzhige * Date: 2017/5/1 * * 编码格式: utf-8 * 开发单位: 中南大学软件学院嵌入式 * * 与网络实验室 * 版权: 本文件版权归属于长沙洋华机电设备有限公司 */ public class EditTextWithMsg extends RelativeLayout { private EditText inputEditText; //输入框 private TextView bottomMsg; //信息在输入框下面提示 private TextView rightMsg; //信息在输入框右边提示 static final int NONE = -1; private String inputContent; //输入框内容 private String msgContent; //信息提示内容 private boolean isShowMsg; //是否显示信息 private int msgTextColor; //信息字体颜色 private int inputGravity; public void setInputEditTextHeight(int inputEditTextHeight) { inputEditText.setHeight(inputEditTextHeight); } private int msgTextSize; //信息字体大小 private int inputContentTextSize;//输入框字体大小 private int inputEditTextWidth; //输入框宽度 private int msgPosition = NONE; private int inputEditTextHeight; //输入框高度 public boolean isShowMsg() { return isShowMsg; } public void setShowMsg(boolean showMsg) { isShowMsg = showMsg; } public void setMsgTextColor(int msgTextColor) { this.msgTextColor = msgTextColor; bottomMsg.setTextColor(msgTextColor); rightMsg.setTextColor(msgTextColor); } public void setMsgTextSize(int msgTextSize) { this.msgTextSize = msgTextSize; bottomMsg.setTextSize(msgTextSize); rightMsg.setTextSize(msgTextSize); } public void setInputContentTextSize(int inputContentTextSize) { this.inputContentTextSize = inputContentTextSize; inputEditText.setTextSize(inputContentTextSize); } public int getInputEditTextWidth() { return inputEditTextWidth; } public void setInputEditTextWidth(int inputEditTextWidth) { inputEditText.setWidth(inputEditTextWidth); } public String getInputContent() { inputContent = inputEditText.getText().toString(); return inputContent; } public void setInputContent(String inputContent) { this.inputContent = inputContent; inputEditText.setText(inputContent); } public String getMsgContent() { return msgContent; } public void setMsgContent(String msgContent) { this.msgContent = msgContent; bottomMsg.setText(msgContent); rightMsg.setText(msgContent); } public EditTextWithMsg(Context context) { this(context, null); } public EditTextWithMsg(Context context, AttributeSet attrs) { this(context, attrs, 0); } public EditTextWithMsg(final Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); LayoutInflater.from(context).inflate(R.layout.edittext_with_msg, this); inputEditText = (EditText) findViewById(R.id.input_content); bottomMsg = (TextView) findViewById(R.id.msg_content_bottom); rightMsg = (TextView) findViewById(R.id.msg_content_right); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.EditTextWithMsg); inputContent = a.getString(R.styleable.EditTextWithMsg_lzg_input_content); msgContent = a.getString(R.styleable.EditTextWithMsg_lzg_msg_content); isShowMsg = a.getBoolean(R.styleable.EditTextWithMsg_lzg_show_msg_content, false); msgTextColor = a.getColor(R.styleable.EditTextWithMsg_lzg_msg_text_color, getResources().getColor(R.color.colorPrimary)); msgTextSize = a .getDimensionPixelSize(R.styleable.EditTextWithMsg_lzg_msg_text_size, 24); inputContentTextSize = a.getDimensionPixelSize(R.styleable.EditTextWithMsg_lzg_input_text_size, 24); inputEditTextWidth = a .getDimensionPixelSize(R.styleable.EditTextWithMsg_lzg_input_content_width, 100); inputEditTextHeight = a .getDimensionPixelSize(R.styleable.EditTextWithMsg_lzg_input_content_height, 30); inputGravity = a.getInteger(R.styleable.EditTextWithMsg_lzg_input_content_gravity, 0); msgPosition = a.getInteger(R.styleable.EditTextWithMsg_lzg_msg_position, NONE); a.recycle(); initConfig(); } private void initConfig() { setInputEditTextHeight(inputEditTextHeight); setInputEditTextWidth(inputEditTextWidth); setMsgTextSize(msgTextSize); setInputEditTextGravity(); } private void setInputEditTextGravity() { if (inputGravity == 0) { inputEditText.setGravity(Gravity.START); } else if (inputGravity == 1) { inputEditText.setGravity(Gravity.CENTER); } else { inputEditText.setGravity(Gravity.END); } } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } //隐藏信息提示 private void hideMsgTextView() { bottomMsg.setVisibility(View.GONE); rightMsg.setVisibility(View.GONE); } /** * 显示信息 * * @param msgContent 信息内容,默认红色 */ public void showMsg(String msgContent) { hideMsgTextView(); if (isShowMsg) { if (msgPosition == 0) { bottomMsg.setVisibility(View.VISIBLE); bottomMsg.setTextColor(msgTextColor); setMsgContent(msgContent); } else { rightMsg.setVisibility(View.VISIBLE); rightMsg.setTextColor(msgTextColor); setMsgContent(msgContent); } } } /** * 显示信息 * * @param msgContent 信息内容 * @param msgTextColor 信息颜色 */ public void showMsg(String msgContent, int msgTextColor) { hideMsgTextView(); if (isShowMsg) { if (msgPosition == 0) { bottomMsg.setVisibility(View.VISIBLE); bottomMsg.setTextColor(msgTextColor); setMsgContent(msgContent); } else { rightMsg.setVisibility(View.VISIBLE); rightMsg.setTextColor(msgTextColor); setMsgContent(msgContent); } } } //显示错误边框 public void showErrorBg() { inputEditText.setBackgroundResource(R.drawable.bg_edittext_error); } //显示正常边框 public void showNormalBg() { inputEditText.setBackgroundResource(R.drawable.bg_edittext); } }
package br.ufrpe.wanderlustapp.role.gui; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.widget.EditText; import br.ufrpe.wanderlustapp.R; import br.ufrpe.wanderlustapp.infra.Sessao; import br.ufrpe.wanderlustapp.role.dominio.Role; public class CadastraRolesActivity extends AppCompatActivity { public static final String TITULO_APPVAR_INSERE = "Insere rolê"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_cadastra_roles); setTitle(TITULO_APPVAR_INSERE); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_formulario_role_salva, menu); return super.onCreateOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(@NonNull MenuItem item) { if(item.getItemId() == R.id.menu_formulario_role_ic_salva){ Role role = criaRole(); if(verficaCampos()) { Sessao.instance.setRole(role); } finish(); } return super.onOptionsItemSelected(item); } private boolean verficaCampos(){ EditText nome = findViewById(R.id.formulario_role_nome); EditText descricao = findViewById(R.id.formulario_role_descricao); return nome.length() > 0 && descricao.length() > 0; } private Role criaRole(){ Role role = new Role(); if(verficaCampos()){ preencheAtributosRole(role); } return role; } private void preencheAtributosRole(Role role) { EditText nome = findViewById(R.id.formulario_role_nome); EditText descricao = findViewById(R.id.formulario_role_descricao); role.setNome(nome.getText().toString()); role.setDescricao(descricao.getText().toString()); } }
package cb; //Short example of if...else statement public class Short_IF_Statement { public static void main(String[] args) { int x=50; int y=37; String res=(x<y)?"x is the smallest":"y is the smallest"; System.out.println(res); } }
package cn.fuego.misp.webservice.up.model; import cn.fuego.misp.webservice.json.MispBaseRspJson; /** * * @ClassName: LoginRsp * @Description: TODO * @author Tang Jun * @date 2014-10-20 上午10:59:34 * */ public class LoginRsp extends MispBaseRspJson { private String token; public String getToken() { return token; } public void setToken(String token) { this.token = token; } }
package com.example.bitm.tourmate; import android.content.Intent; import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.Window; import android.widget.AdapterView; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.FirebaseAuth; import java.util.ArrayList; public class EventProfileActivity extends AppCompatActivity { ListView listView; EventManager eventManager; FirebaseAuth Auth; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_event_profile); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); TextView mTitle = (TextView) toolbar.findViewById(R.id.toolbar_title); setSupportActionBar(toolbar);; Auth = FirebaseAuth.getInstance(); mTitle.setText("Event Profile"); getSupportActionBar().setDisplayShowTitleEnabled(false); listView= (ListView) findViewById(R.id.eventLV); eventManager=new EventManager(this); final ArrayList<Event> eventArrayList=eventManager.getAllEvent(); EventAdapter adapter=new EventAdapter(this,eventArrayList) { }; listView.setAdapter(adapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { Intent intent = new Intent(EventProfileActivity.this,TravelHome.class); intent.putExtra("id",eventArrayList.get(i).getEventID()); intent.putExtra("name",eventArrayList.get(i).getDesName()); intent.putExtra("fDate",eventArrayList.get(i).getFromaDate()); intent.putExtra("tDate",eventArrayList.get(i).getToDate()); intent.putExtra("estBudget",eventArrayList.get(i).getBudget()); startActivity(intent); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.logout: Auth.signOut(); Intent intent = new Intent(EventProfileActivity.this, MainActivity.class); startActivity(intent); break; } return false; } public void moveToAdd(View view) { Intent intent=new Intent(this,EventActivity.class); startActivity(intent); finish(); } }
package com.ibeiliao.pay.account.impl.dto; import java.io.Serializable; import java.util.Date; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; /** * 银行信息表 * */ public class Bank implements Serializable { private static final long serialVersionUID = -3074457344709293093L; /** id */ private int id; /** 银行名称 */ private String name; /** 状态 : 0:无效 1:有效 */ private short status = 1; /** 排序 */ private int seq = 50; /** 创建时间 */ private Date createTime; /** 修改时间 */ private Date updateTime; public void setId(int id) { this.id = id; } public int getId() { return id; } public void setName(String name) { this.name = name; } public String getName() { return name; } public void setStatus(short status) { this.status = status; } public short getStatus() { return status; } public void setSeq(int seq) { this.seq = seq; } public int getSeq() { return seq; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Date getCreateTime() { return createTime; } public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } public Date getUpdateTime() { return updateTime; } public String toString() { return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); } }
package Naveen; class Animal { void run() { System.out.println("Animal Runs"); } void sleep() { System.out.println("Animal Sleeps"); } } class Dog extends Animal{ void run() { System.out.println("Dog Runs"); } void sleep() { System.out.println("Dog Sleeps"); } } class Cat extends Animal{ void run() { System.out.println("Cat Runs"); } void sleep() { System.out.println("Dog Sleeps"); } } public class ObjectCasting { public static void main(String[] args) { // TODO Auto-generated method stub //Down Casting Animal anim = new Cat(); Cat cat = (Cat) anim; anim.run(); cat.run(); //Up Casting Dog dog = new Dog(); Animal a = (Animal) dog; a.sleep(); dog.sleep(); } }
/** * */ package com.wonders.task.excel.service; import java.util.List; import java.util.Map; /** * @ClassName: ExcelService * @Description: TODO(这里用一句话描述这个类的作用) * @author zhoushun * @date 2013-5-15 上午9:44:05 * */ public interface ExcelService { public <T> void saveAll(List<T> result); public List<Map<String,Object>> getData(String sql); /** * 返回map对象 * @param sql * @param key * @param value * @return */ public Map<String,String> getMapInfo(String sql,String key,String value); /** * 返回map对象 * @param sql * @param key * @param value * @return */ public Map<String,List<String>> getMapListInfo(String sql,String key,String value,Object[] object); /** * 返回对应BO对象 * @param sql * @param c * @param <T> * @return */ public <T> List<T> getBoInfo(String sql,Class<T> c); }
package com.timebusker.task; import com.alibaba.fastjson.JSON; import com.timebusker.entity.km.SubInfoPo; import com.timebusker.service.SyncSubInfoService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; import java.util.*; /** * @DESC:SyncSubInfoTask * @author:timebusker * @date:2018/7/7 */ @Configuration @EnableScheduling public class SyncSubInfoTask { private static final Logger log = LoggerFactory.getLogger(SyncSubInfoTask.class); private static final Map<String, String> submap = new HashMap<>(); @Autowired private SyncSubInfoService syncSubInfoService; @Scheduled(cron = "0/20 * * * * *") public void task1() { log.info("开始同步数据!"); // 查询需导出数据到HIVE的列表 List<String> list = syncSubInfoService.getSubExportToHive(); log.info("需要同步专题有:" + JSON.toJSONString(list)); for (String subid : list) { // 查询当前成功批次 SubInfoPo subkm = syncSubInfoService.getKmSubInfo(subid); if (null != submap.get(subkm.getSubId()) && subkm.getLastSuccessBatch().equals(submap.get(subkm.getSubId()))) { continue; } else { if (null != submap.get(subkm.getSubId())) { submap.replace(subkm.getSubId(), subkm.getLastSuccessBatch()); } else { submap.put(subkm.getSubId(), subkm.getLastSuccessBatch()); } } int task = syncSubInfoService.getLastSubExpTask(subkm.getSubId(), subkm.getLastSuccessBatch()); int exp = syncSubInfoService.getSubExportToHiveCnt(subkm.getSubId()); // 全部导出成功 if (task == exp) { log.info("当前同专题:" + subkm.getSubName() + "\t" + subkm.getSubId() + "\t" + subkm.getLastSuccessBatch()); com.timebusker.entity.qj.SubInfoPo sub = new com.timebusker.entity.qj.SubInfoPo(); sub.setDataSource(subkm.getDataSource()); sub.setExecStatus(subkm.getExecStatus()); sub.setIsRecoverExe(subkm.getIsRecoverExe()); sub.setLastSuccessBatch(subkm.getLastSuccessBatch()); sub.setLastSuccessDate(subkm.getLastSuccessDate()); sub.setLastSuccessRows(subkm.getLastSuccessRows()); sub.setMemo(subkm.getMemo()); sub.setRefSubId(subkm.getRefSubId()); sub.setRefSubName(subkm.getRefSubName()); sub.setRepeatInterval(subkm.getRepeatInterval()); sub.setStatus(subkm.getStatus()); sub.setSubAreaname(subkm.getSubAreaname()); sub.setSubDetailTable(subkm.getSubDetailTable()); sub.setSubEnable(0); sub.setSubExeClass(subkm.getSubExeClass()); sub.setSubExecTime(subkm.getSubExecTime()); sub.setSubId(subkm.getSubId()); sub.setSubLevel(subkm.getSubLevel()); sub.setSubName(subkm.getSubName()); sub.setSubResultTable(subkm.getSubResultTable()); sub.setSubType(subkm.getSubType()); sub.setZtType(subkm.getZtType()); syncSubInfoService.saveOrUpdateSubInfo(sub); log.info("同步成功:" + subkm.getSubName() + "\t" + subkm.getSubId() + "\t" + subkm.getLastSuccessBatch()); } } } // public static void main(String[] args) { // Map<String, String> smap = new HashMap<>(); // smap.put("1", "1"); // smap.put("2", "2"); // System.out.println(smap.get("3")); // smap.replace("1", "a"); // smap.put("11", "11"); // System.out.println(JSON.toJSONString(smap)); // } }
package com.ericlam.mc.minigames.core.factory.scoreboard; import com.ericlam.mc.minigames.core.character.GamePlayer; import com.ericlam.mc.minigames.core.character.TeamPlayer; import com.google.common.collect.ImmutableMap; /** * 被 {@link ScoreboardFactory} 創建的 計分版。 */ public interface GameBoard { /** * 設置計分版標題 * * @param title 標題 */ void setTitle(String title); /** * 添加玩家到計分版 * @param player 遊戲玩家 */ void addPlayer(GamePlayer player); /** * 根據玩家目前狀態切換計分版隊伍 * @param player 隊伍玩家 */ void switchTeam(TeamPlayer player); /** * 在計分版移除玩家 * @param player 遊戲玩家 */ void removePlayer(GamePlayer player); /** * 獲取計分版目前內容 * @return 計分版內容 文字 + 分數 */ ImmutableMap<String, Integer> getSidebarLine(); /** * 設置計分版內特定行的分數 * @param key 標識文字 * @param score 分數 */ void setScore(String key, int score); /** * 設置計分版內特定行的文字內容 * @param key 標識文字 * @param line 新文字內容, 支援顏色 */ void setLine(String key, String line); /** * 設置計分版內特定行的文字內容和分數 * @param key 標識文字 * @param line 新文字內容,支援顏色 * @param score 新分數 */ void setLine(String key, String line, int score); /** * 銷毀計分版,此動作將無法復原。 */ void destroy(); }
package com.company.greatLeast; public class Main { public static void main(String[] args) { Main main = new Main(); int a = 3, b = 12; System.out.println(main.solution(a,b).toString()); } public int[] solution(int n, int m) { int max = n > m ? n : m; int min = n < m ? n : m; int greates=1; int least=1; while (min != 0){ int k = max % min; max = min; min = k; greates = max; } least = n * m / greates; int[] answer = {greates,least}; return answer; } }
package entities.components; import org.openqa.selenium.By; public class TitleComponent extends BaseComponent { private By title = By.cssSelector("h2.title"); @Override public boolean isExist() { return isElementVisible(title); } @Override public boolean isExist(int timeout) { return isElementVisible(title, timeout); } public boolean isExist(String titleText) { return isElementVisible(getComponentPath(titleText)); } public String getTitleText() { return getDriver().findElement(title).getText(); } private By getComponentPath(String titleText) { return By.xpath("//div[contains(@class, 'title-component')]" + "//div[@class='title-left']//h2[contains(text(), '" + titleText + "')]"); } }
package com.tencent.mm.plugin.freewifi.e; import android.net.Uri; import com.tencent.mm.plugin.freewifi.k.b; import com.tencent.mm.plugin.freewifi.m; import com.tencent.mm.plugin.freewifi.model.j; import com.tencent.mm.plugin.freewifi.ui.FreeWifiFrontPageUI; import com.tencent.mm.plugin.freewifi.ui.FreeWifiFrontPageUI.a; import com.tencent.mm.plugin.freewifi.ui.FreeWifiFrontPageUI.d; import com.tencent.mm.sdk.platformtools.x; public final class i extends e implements a { protected String bJT; private int jkT; protected String jkW; protected String jkX; protected String jkY; private Uri jkZ; private String jla; protected String sign; static /* synthetic */ void a(i iVar, String str) { iVar.jkT++; FreeWifiFrontPageUI freeWifiFrontPageUI; d dVar; a aVar; if (iVar.jkT > 3) { x.i("MicroMsg.FreeWifi.Protocol33", "sessionKey=%s, step=%d, method=Protocol33.handle302Authentication, desc=Connection fail. Too many 302, exceeding 3 times", new Object[]{m.E(iVar.intent), Integer.valueOf(m.F(iVar.intent))}); freeWifiFrontPageUI = iVar.jkG; dVar = d.jnj; aVar = new a(); aVar.jmI = m.a(iVar.jkI, b.jiJ, 33); freeWifiFrontPageUI.a(dVar, aVar); return; } x.i("MicroMsg.FreeWifi.Protocol33", "sessionKey=%s, step=%d, method=Protocol33.handle302Authentication, desc=it discovers 302 Location and redirects. http response header Location=%s", new Object[]{m.E(iVar.intent), Integer.valueOf(m.F(iVar.intent)), str}); if (m.isEmpty(str)) { freeWifiFrontPageUI = iVar.jkG; dVar = d.jnj; aVar = new a(); aVar.jmI = m.a(iVar.jkI, b.jiJ, 34); freeWifiFrontPageUI.a(dVar, aVar); return; } 2 2 = new 2(iVar); Uri parse = Uri.parse(str); if ("post".equalsIgnoreCase(parse.getQueryParameter("method"))) { com.tencent.mm.plugin.freewifi.a.a.aOj(); com.tencent.mm.plugin.freewifi.a.a.a(str, parse.getEncodedQuery(), 2); return; } com.tencent.mm.plugin.freewifi.a.a.aOj(); com.tencent.mm.plugin.freewifi.a.a.a(str, 2); } public i(FreeWifiFrontPageUI freeWifiFrontPageUI) { super(freeWifiFrontPageUI); this.jkT = 0; this.jla = this.intent.getStringExtra("free_wifi_schema_uri"); this.jkZ = Uri.parse(this.jla); this.appId = this.jkZ.getQueryParameter("appId"); this.jkW = this.jkZ.getQueryParameter("shopId"); this.jkX = this.jkZ.getQueryParameter("authUrl"); this.jkY = this.jkZ.getQueryParameter("extend"); this.bJT = this.jkZ.getQueryParameter("timestamp"); this.sign = this.jkZ.getQueryParameter("sign"); x.i("MicroMsg.FreeWifi.Protocol33", "sessionKey=%s, step=%d, desc=Data retrieved. schemaUri=%s, appid=%s, shopId=%s, authUrl=%s, extend=%s, timestamp=%s, sign=%s", new Object[]{m.E(this.intent), Integer.valueOf(m.F(this.intent)), this.jkZ, this.appId, this.jkW, this.jkX, this.jkY, this.bJT, this.sign}); } public final void connect() { FreeWifiFrontPageUI freeWifiFrontPageUI; d dVar; a aVar; if (m.isEmpty(this.ssid)) { x.i("MicroMsg.FreeWifi.Protocol33", "sessionKey=%s, step=%d, desc=it cannot get ssid, so it fails. ", new Object[]{m.E(this.intent), Integer.valueOf(m.F(this.intent))}); freeWifiFrontPageUI = this.jkG; dVar = d.jnj; aVar = new a(); aVar.jmI = m.a(this.jkI, b.jiJ, 32); freeWifiFrontPageUI.a(dVar, aVar); } else if (m.isEmpty(this.jkX)) { x.i("MicroMsg.FreeWifi.Protocol33", "sessionKey=%s, step=%d, desc=authurl is empty, so it fails. ", new Object[]{m.E(this.intent), Integer.valueOf(m.F(this.intent))}); freeWifiFrontPageUI = this.jkG; dVar = d.jnj; aVar = new a(); aVar.jmI = m.a(this.jkI, b.jiJ, 32); freeWifiFrontPageUI.a(dVar, aVar); } else { StringBuilder stringBuilder = new StringBuilder(this.jkX); if (this.jkX.indexOf("?") == -1) { stringBuilder.append("?extend=").append(this.jkY); } else { stringBuilder.append("&extend=").append(this.jkY); } j.aON().aOv().post(new 1(this, stringBuilder.toString())); } } protected final void aPk() { j.aON().aOv().post(new 3(this)); } }
package factory.design.pattern.example; import java.util.ArrayList; import java.util.Date; public class HotelBooker { public ArrayList<Hotel> getHotelNames(String place,Date date) { //returns hotels available on date return null; } }
package com.example.afshindeveloper.afshindeveloperandroid.view.custom; import android.content.Context; import android.support.annotation.Nullable; import android.util.AttributeSet; import android.widget.TextView; import com.example.afshindeveloper.afshindeveloperandroid.MyApplication; import com.example.afshindeveloper.afshindeveloperandroid.view.activity.MainActivity; /** * Created by afshindeveloper on 24/09/2017. */ public class CustomFontTextView extends android.support.v7.widget.AppCompatTextView{ public CustomFontTextView(Context context) { super(context); if (!isInEditMode()){ setuptextview(); } } public CustomFontTextView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); if (!isInEditMode()){ setuptextview(); } } public CustomFontTextView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); if (!isInEditMode()){ setuptextview(); } } public CustomFontTextView(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context); if (!isInEditMode()){ setuptextview(); } } private void setuptextview(){ MyApplication myApplication=(MyApplication)getContext().getApplicationContext(); setTypeface(myApplication.getiraniansansfont()); } }
package testframeworks; import org.testng.Assert; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; public class TestNGIntro { @Test public void freddieLoginTest() { System.out.println("Execution login test"); } @Test public void freddieFeatureTest() { String userId = "xavier"; String actualId = "xavier1"; Assert.assertEquals(userId, actualId); } @BeforeMethod public void setup() { System.out.println("Setting up Test"); } @AfterMethod public void tearDown() { System.out.println("Closing"); } }
public class Student { //step 1 - define instance variables //these make up the properties of an object //they are usually private private String name; private int test1, test2, test3; //step 2 - Constructor //public < Name of class goes here > //this runs when the word NEW is used to make an object //its purpose is to initialize some or all properties public Student() { // name = ""; // test1 = 0; // test2 = 0; // test3 = 0; // System.out.println("Student was created"); //call another constuctor from here this("", 0, 0, 0); //chaining constructors } //another constructor //this one lets you assign properties as you make the student public Student(String str, int m1, int m2, int m3) { name = str; test1 = m1; test2 = m2; test3 = m3; } //3rd constructor //this one lets you clone properties from another student public Student(Student other) { // name = other.name; // test1 = other.test1; // test2 = other.test2; // test3 = other.test3; this(other.name, other.test1, other.test2, other.test3); } //step 3 - rest of the instance methods //this will make up the abilities of the object //sets name of student public void setName(String n) { name = n; } //retrieves name of student public String getName() { return name; } //set and get back a given mark public void setMark(int which, int score) { if (which == 1) { test1 = score; } else if (which == 2) { test2 = score; } else { test3 = score; } } public int getMark(int which) { if (which == 1) { return test1; } else if (which == 2) { return test2; } else { return test3; } } public int getAverage() { return (test1 + test2 + test3) / 3; } public int getHighest() { int highest = test1; if (test2 > highest) { highest = test2; } if (test3 > highest) { highest = test3; } return highest; } //this method runs automatically when you print an object //we are over-riding the toString found in Parent class public String toString() { String s = "Name:\t" + name; s += "\nTest1:\t" + test1; s += "\nTest2:\t" + test2; s += "\nTest3:\t" + test3; s += "\n-----------------"; s += "\nAverage: " + getAverage(); return s; } public String validateData() { String em = null; if (name.equals(""))//then a name was not entered { em = "Name is required."; } if (test1 < 0 || test1 > 100 || test2 < 0 || test2 > 100 || test3 < 0 || test3 > 100) { if (em == null) //then no error { em = "At least 1 mark is out of the acceptable range"; } else//add on to the message with += { em += "\nAt least 1 mark is out of the acceptable range"; } } if (em != null) //then we have an error so add the following line after it { em += "\nPlease re-enter all the data\n"; } return em; //return error message, either null or real message } }
/** * Helios, OpenSource Monitoring * Brought to you by the Helios Development Group * * Copyright 2007, Helios Development Group and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This 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.1 of * the License, or (at your option) any later version. * * This software 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 software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. * */ package com.heliosapm.script.fixtures; import java.util.Map; import java.util.Set; import javax.management.MBeanServerConnection; import javax.management.ObjectName; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.heliosapm.jmx.util.helpers.JMXHelper; import com.heliosapm.jmx.util.helpers.JMXHelper.MBeanEventHandler; import com.heliosapm.script.DeployedScript; /** * <p>Title: FixtureAccessor</p> * <p>Description: Provides a direct invoker to deployed fixtures which are otherwise limited by * the MXBean interface which is the only other acces point to fixtures.</p> * <p>Company: Helios Development Group LLC</p> * @author Whitehead (nwhitehead AT heliosdev DOT org) * <p><code>com.heliosapm.script.fixtures.FixtureAccessor</code></p> * @param <T> The type returned by the wrapped fixture */ public class FixtureAccessor<T> implements FixtureAccessorMBean<T> { /** The fixture this accessor invokes against */ protected final DeployedFixture<T> fixture; /** The accessor JMX ObjectName */ protected final ObjectName objectName; /** Instance logger */ protected final Logger log; /** * Creates a new FixtureAccessor for the passed fixture * @param fixture the fixture to create the accessor for * @return The created FixtureAccessor */ public static <T> FixtureAccessor<T> newFixtureAccessor(final DeployedFixture<T> fixture) { return new FixtureAccessor<T>(fixture); } /** * Creates a new FixtureAccessor * @param fixture The fixture this accessor invokes against */ public FixtureAccessor(final DeployedFixture<T> fixture) { this.fixture = fixture; // @Fixture(name="JMXConnector", type=javax.management.remote.JMXConnector.class, params=[ // @FixtureArg(name="jmxUrl", type=java.lang.String.class) log = LoggerFactory.getLogger(getClass().getName() + "." + fixture.getFixtureName()); objectName = JMXHelper.objectName(DeployedScript.FIXTURE_DOMAIN + ".invokers:name=" + fixture.getFixtureName() + ",type=" + fixture.getFixtureTypeName()); JMXHelper.registerMBean(this, objectName); log.info("Registered Fixture Invoker [{}]", objectName); JMXHelper.onMBeanUnregistered(objectName, new MBeanEventHandler() { public void onEvent(final MBeanServerConnection connection, final ObjectName on, final boolean reg) { JMXHelper.unregisterMBean(objectName); log.info("Unregistered Fixture Invoker [{}]", objectName); } }); FixtureCache.getInstance().put(this); } /** * Returns a set of the parameters keys * @return a set of the parameters keys */ public Set<String> getParamKeys() { return fixture.getParamKeys(); } /** * Returns a map of the parameter types keyed by the parameter name * @return a map of the parameter types keyed by the parameter name */ public Map<String, Class<?>> getParamTypes() { return fixture.getParamTypes(); } /** * {@inheritDoc} * @see com.heliosapm.script.fixtures.Fixture#get(java.util.Map) */ @Override public T get(final Map<String, Object> config) { return fixture.get(config); } /** * {@inheritDoc} * @see com.heliosapm.script.fixtures.Fixture#get() */ @Override public T get() { return fixture.get(); } /** * {@inheritDoc} * @see com.heliosapm.script.fixtures.FixtureAccessorMBean#getObjectName() */ @Override public ObjectName getObjectName() { return objectName; } /** * {@inheritDoc} * @see com.heliosapm.script.fixtures.FixtureAccessorMBean#getFixtureName() */ @Override public String getFixtureName() { return fixture.getFixtureName(); } /** * {@inheritDoc} * @see com.heliosapm.script.fixtures.FixtureAccessorMBean#getFixtureType() */ @Override public Class<T> getFixtureType() { return (Class<T>) fixture.getFixtureType(); } /** * {@inheritDoc} * @see com.heliosapm.script.fixtures.FixtureAccessorMBean#getFixtureTypeName() */ @Override public String getFixtureTypeName() { return fixture.getFixtureTypeName(); } /** * {@inheritDoc} * @see com.heliosapm.script.fixtures.FixtureAccessorMBean#getFixtureObjectName() */ @Override public ObjectName getFixtureObjectName() { return fixture.getObjectName(); } /** * {@inheritDoc} * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("FixtureAccessor ["); builder.append("name:").append(getFixtureName()).append(", type:").append(getFixtureTypeName()); builder.append("]"); return builder.toString(); } }
package ie.dit; public class Control { public static void main(String[]args) { double test; Square s1=new Square (3,5); test=s1.area(6,4); System.out.println(test); Circle c1=new Circle(6); test=c1.area(5); System.out.println(test); Sphere sp1=new Sphere(5); test=sp1.Volume(5); System.out.println(test); test=sp1.surfaceArea(5); System.out.println(test); } }
/* * 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.webbeans.test.managed.specialized; import org.apache.webbeans.test.AbstractUnitTest; import org.junit.Before; import org.junit.Test; import jakarta.enterprise.inject.Any; import jakarta.enterprise.inject.Instance; import jakarta.enterprise.inject.Produces; import jakarta.enterprise.inject.Specializes; import jakarta.inject.Inject; import java.util.Arrays; import java.util.Collections; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; public class SpecializeDeactivationTest extends AbstractUnitTest { @Inject private Init init; @Before public void reset() { Impl1.called = false; Impl2.called = false; SpeImpl1.called = false; } @Test public void normal() { startContainer(Arrays.<Class<?>>asList(Init.class, API.class, Impl1.class, Impl2.class), Collections.<String>emptyList(), true); assertEquals(2, init.init()); assertTrue(Impl1.called); assertTrue(Impl2.called); } @Test public void specialize() { startContainer(Arrays.<Class<?>>asList(Init.class, API.class, Impl1.class, Impl2.class, SpeImpl1.class), Collections.<String>emptyList(), true); assertEquals(2, init.init()); assertTrue(SpeImpl1.called); assertTrue(Impl2.called); } @Test public void specializeProducers() { startContainer(Arrays.asList(Init.class, API.class, Prod1.class, Prod2.class, Spe1.class, Prod3.class, Prod4.class), Collections.emptyList(), true); assertEquals(4, init.init()); assertTrue(SpeImpl1.called); assertTrue(Impl2.called); } public interface API { void init(); } public interface API2 { void init(); } public static class Prod1 { @Produces public API api1() { return new Impl1(); } @Produces public API2 api2() { return new Impl1(); } } public static class Prod3 { @Produces public API api1() { return new Impl1(); } } public static class Prod4 { @Produces public API api1() { return new Impl1(); } } public static class Spe1 extends Prod1 { @Produces @Override @Specializes public API api1() { return new SpeImpl1(); } @Produces @Override @Specializes public API2 api2() { return new SpeImpl1(); } } public static class Prod2 { @Produces public API api1() { return new Impl2(); } @Produces public API2 api2() { return new Impl2(); } } public static class Impl1 implements API, API2 { public static boolean called = false; @Override public void init() { called = true; } } @Specializes public static class SpeImpl1 extends Impl1 { public static boolean called = false; @Override public void init() { called = true; } } public static class Impl2 implements API, API2 { public static boolean called = false; @Override public void init() { called = true; } } public static class Init { @Inject @Any private Instance<API> impls; public int init() { int i = 0; for (final API api : impls) { api.init(); i++; } return i; } } }
package chapterTwo; public class ListNode { int val; ListNode next; public ListNode(int val2) { val = val2; } public void appendToTail(int val3) { ListNode end = new ListNode(val3); ListNode curr = this; while (curr.next != null) { curr = curr.next; } curr.next = end; } }
package com.example.maya.projectslideshow; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; /** * Created by Devon Cormack on 1/28/15. * * Class that directly accesses the SQLite database for the MyRuns application. */ public class MySQLiteHelper extends SQLiteOpenHelper{ private static final String DATABASE_CREATE = "CREATE TABLE IF NOT EXISTS IMAGES (" + "_id INTEGER PRIMARY KEY AUTOINCREMENT," + "timestamp DATETIME NOT NULL," + "image BLOB,"+ "lat real," + "long real);"; //The binary large object (BLOB) will be used to store //the image. Lat and long stored as REAL //Name of the table public static final String TABLE_IMAGES = "IMAGES"; //Columns in the table public static final String COLUMN_ID = "_id"; public static final String COLUMN_TIMESTAMP = "timestamp"; public static final String COLUMN_IMAGE = "image"; public static final String COLUMN_LAT = "lat"; public static final String COLUMN_LONG = "long"; //Database information private static final String DATABASE_NAME = "IMAGES.db"; private static final int DATABASE_VERSION = 1; public MySQLiteHelper(Context context){ super(context, DATABASE_NAME, null, DATABASE_VERSION); } /** * Create the database if it doesn't exist. * @param db - database to create */ @Override public void onCreate(SQLiteDatabase db) { db.execSQL(DATABASE_CREATE); } /** * Upgrade the database to a new version. * @param db - database to upgrade * @param oldVersion * @param newVersion */ @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { Log.w(MySQLiteHelper.class.getName(), "Upgrading database from version " + oldVersion + " to " + newVersion + ", which will destroy all old data"); db.execSQL("DROP TABLE IF EXISTS " + TABLE_IMAGES); onCreate(db); } }
package com.tencent.mm.plugin.appbrand.jsapi.op_report; import com.tencent.mm.plugin.appbrand.jsapi.h; final class a extends h { private static final int CTRL_INDEX = 246; private static final String NAME = "onStartReportPageData"; private static final a fWG = new a(); a() { } static synchronized void tm(String str) { synchronized (a.class) { fWG.aC(str, 0).ahM(); } } }
package voc.cn.cnvoccoin.network; public interface Publisher { <T> Publisher subscribe(Subscriber<T> s); void detach(); Publisher setHttpLoading(HttpLoading loading); }
import java.util.ArrayList; interface Package { double getBoxWeight(); } class Book { private String author; private String title; private double weight; public Book(String paramAuthor, String paramName, double paramWeight) { this.author = paramAuthor; this.title = paramName; this.weight = paramWeight; } public String getAuthor() { return author; } public String getTitle() { return title; } public double getWeight() { return weight; } } class CD { private String name; private int publishedYear; private double weight; public CD(String paramName, int paramYear) { this.name = paramName; this.publishedYear = paramYear; this.weight = 0.1; } public String getName() { return name; } public int getPublishedYear() { return publishedYear; } public double getWeight() { return weight; } } class Box implements Package { private final double weightLimit; private int itemCount; private ArrayList<Book> books; private ArrayList<CD> cds; private ArrayList<Box> boxes; public Box(double paramLimit) { this.weightLimit = paramLimit; this.itemCount = 0; books = new ArrayList<Book>(); cds = new ArrayList<CD>(); boxes = new ArrayList<Box>(); } public double getBoxWeight() { double weight = 0; for(Book b: books) { weight += b.getWeight(); } for(int i = 0; i < cds.size(); i++) { weight += 0.1; } for(Box bx: boxes) { weight += bx.getBoxWeight(); } return weight; } public int getItemCount() { verifyItemCount(); return this.itemCount; } public void verifyItemCount() { this.itemCount = this.books.size() + this.cds.size(); for(Box b: boxes) { this.itemCount += b.getItemCount(); } } public int getMiniBoxesAmount() { if(this.boxes.size() == 0) { return 0; } else { return this.boxes.size(); } } public void add(Book book) { if(getBoxWeight() + book.getWeight() <= this.weightLimit) { this.books.add(book); } else { System.out.println("Unable to add book because maximum weight achieved!"); } } public void add(CD cd) { if(getBoxWeight() + 0.1 <= this.weightLimit) { this.cds.add(cd); } else { System.out.println("Unable to add cd because maximum weight achieved!"); } } public void add(Box box) { if(this.getBoxWeight() + box.getBoxWeight() <= this.weightLimit) { this.boxes.add(box); } else { System.out.println("Unable to add this box to a bigger box!"); } } public String toString() { return "Box: " + getItemCount() + " items - Total weight: " + getBoxWeight() + "kg\nContaining: " + getMiniBoxesAmount() + " smaller boxes."; } }
package com.mlm.managedb; import com.basic.db.*; import com.global.App; import com.mlm.db.FPaket; import com.mlm.db.FPelanggan; import com.mlm.db.FPp; import com.mlm.db.FStatusPelanggan; import com.orientechnologies.orient.core.db.ODatabaseRecordThreadLocal; import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; import com.orientechnologies.orient.core.metadata.schema.OClass; import com.orientechnologies.orient.core.metadata.schema.OType; import com.orientechnologies.orient.object.db.OObjectDatabaseTx; public class StartDbMlm { /** * membuat schema,index dan relasi pada database di jalankan setelah * database di buat, jadi hanya sekali saja */ public void createSchemaDb() { OObjectDatabaseTx db = App.getDb(); OClass bos = db.getMetadata().getSchema().getClass(FBos.TABLE); OClass jenisPekerjaan = db.getMetadata().getSchema() .getClass(FJenisPekerjaan.TABLE); OClass numberId = db.getMetadata().getSchema().getClass(FNumberId.TABLE); OClass grp = db.getMetadata().getSchema().getClass(FGrp.TABLE); OClass usr = db.getMetadata().getSchema().getClass(FUsr.TABLE); OClass paket = db.getMetadata().getSchema().getClass(FPaket.TABLE); OClass pelanggan = db.getMetadata().getSchema() .getClass(FPelanggan.TABLE); OClass pp = db.getMetadata().getSchema() .getClass(FPp.TABLE); OClass statusPelanggan = db.getMetadata().getSchema() .getClass(FStatusPelanggan.TABLE); // table Jenis Pekerjaan jenisPekerjaan.createProperty(FJenisPekerjaan.CODE, OType.STRING) .createIndex(OClass.INDEX_TYPE.UNIQUE); jenisPekerjaan.createProperty(FJenisPekerjaan.NAMA, OType.STRING) .createIndex(OClass.INDEX_TYPE.UNIQUE); // tabel NumberId numberId.createProperty(FNumberId.NAMA_TABLE, OType.STRING).createIndex( OClass.INDEX_TYPE.UNIQUE); // table Grp grp.createProperty(FGrp.CODE, OType.STRING).createIndex( OClass.INDEX_TYPE.UNIQUE); grp.createProperty(FGrp.NAME, OType.STRING).createIndex( OClass.INDEX_TYPE.UNIQUE); // terjadi duplicate index // grp.createProperty(FGrp.USRS, OType.LINKSET); grp.createProperty(FGrp.CREATE_BY, OType.LINK, usr); grp.createProperty(FGrp.UPDATE_BY, OType.LINK, usr); // tabel Usr usr.createProperty(FUsr.USERNAME, OType.STRING).createIndex( OClass.INDEX_TYPE.UNIQUE); usr.createProperty(FUsr.CODE, OType.STRING).createIndex( OClass.INDEX_TYPE.UNIQUE); usr.createProperty(FUsr.GRP, OType.LINK, grp); usr.createProperty(FUsr.CREATE_BY, OType.LINK, usr); usr.createProperty(FUsr.UPDATE_BY, OType.LINK, usr); // tabel Paket paket.createProperty(FPaket.CODE, OType.STRING).createIndex( OClass.INDEX_TYPE.UNIQUE); paket.createProperty(FPaket.NAMA, OType.STRING).createIndex( OClass.INDEX_TYPE.UNIQUE); paket.createProperty(FPaket.DOWNLINES, OType.LINKLIST, pelanggan); // tabel Pelanggan pelanggan.createProperty(FPelanggan.CODE, OType.STRING).createIndex( OClass.INDEX_TYPE.UNIQUE); pelanggan.createProperty(FPelanggan.NAMA_TOKO, OType.STRING) .createIndex(OClass.INDEX_TYPE.UNIQUE); pelanggan.createProperty(FPelanggan.STATUS, OType.LINK, statusPelanggan); pelanggan.createProperty(FPelanggan.PAKETS, OType.LINKLIST, pp); // tabel Pp pp.createProperty(FPp.CODE, OType.STRING).createIndex( OClass.INDEX_TYPE.UNIQUE); pp.createProperty(FPp.PELANGGAN, OType.LINK, pelanggan); pp.createProperty(FPp.UP_LINE, OType.LINK, pelanggan); pp.createProperty(FPp.PAKET, OType.LINK, paket); pp.createProperty(FPp.DOWNLINES, OType.LINKLIST, pelanggan); // tabel Status Pelanggan statusPelanggan.createProperty(FStatusPelanggan.CODE, OType.STRING) .createIndex(OClass.INDEX_TYPE.UNIQUE); statusPelanggan.createProperty(FStatusPelanggan.NAMA, OType.STRING) .createIndex(OClass.INDEX_TYPE.UNIQUE); db.getMetadata().getSchema().save(); db.close(); ODatabaseDocumentTx dbd = App.getDbd(); ODatabaseRecordThreadLocal.INSTANCE.set(dbd); App.getUsrDao().factoryModelFirst(dbd); App.getGrpDao().factoryModelFirst(dbd); App.getJenisPekerjaanDao().createFirst(dbd); dbd.close(); } }
public class Stack { public static int stackSize = 100; int[] stackContainer = new int[stackSize]; int topIndex = -1; public void push(int element) { if (topIndex < stackSize) { topIndex++; stackContainer[topIndex] = element; } } public int pop() throws IllegalAccessException { int returnValue = -1; if (topIndex >= 0) { returnValue = stackContainer[topIndex]; topIndex--; } else { throw new IllegalAccessException(); } return returnValue; } public int peek() throws IllegalAccessException { if (topIndex < 0) { throw new IllegalAccessException(); } else { return stackContainer[topIndex]; } } }
package com.hand.bean; public class Demo { private int i; }
package com.tencent.mm.ui.transmit; import android.content.DialogInterface; import android.content.DialogInterface.OnCancelListener; import com.tencent.mm.sdk.b.a; class MMCreateChatroomUI$2 implements OnCancelListener { final /* synthetic */ MMCreateChatroomUI uDk; MMCreateChatroomUI$2(MMCreateChatroomUI mMCreateChatroomUI) { this.uDk = mMCreateChatroomUI; } public final void onCancel(DialogInterface dialogInterface) { MMCreateChatroomUI.a(this.uDk, false); if (MMCreateChatroomUI.e(this.uDk) != null) { MMCreateChatroomUI.e(this.uDk).bTO.bTN = true; a.sFg.m(MMCreateChatroomUI.e(this.uDk)); } } }
package model; import java.util.List; import javax.persistence.CascadeType; 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.OneToMany; import javax.persistence.OneToOne; import org.springframework.data.rest.core.annotation.RestResource; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; @Entity @Getter @Setter @NoArgsConstructor @AllArgsConstructor public class Generico1 { @Id @GeneratedValue(strategy= GenerationType.IDENTITY) private int id; private int inteiro1; private int inteiro2; private float float1; private float float2; private String string1; private String string2; private String string3; //ONE TO ONE// //RESTO EM GENERICO 2// @OneToOne @JoinColumn(name = "generico2") @RestResource(path = "generico2", rel="generico2") private Generico2 generico2; //ONE TO MANY// //MANY TO ONE EM GENERICO 3// @OneToMany(mappedBy = "generico3") private List<Generico3> generico3s; //MANY TO MANY //RESTO EM GENERICO 4// @ManyToMany(cascade = CascadeType.ALL) @JoinTable(name = "generico4", joinColumns = @JoinColumn(name = "generico4_id", referencedColumnName = "id"), inverseJoinColumns = @JoinColumn(name = "generico4_id", referencedColumnName = "id")) private List<Generico4> generico4s; public int getId() { return id; } public int getInteiro1() { return inteiro1; } public void setInteiro1(int inteiro1) { this.inteiro1 = inteiro1; } public int getInteiro2() { return inteiro2; } public void setInteiro2(int inteiro2) { this.inteiro2 = inteiro2; } public float getFloat1() { return float1; } public void setFloat1(float float1) { this.float1 = float1; } public float getFloat2() { return float2; } public void setFloat2(float float2) { this.float2 = float2; } public String getString1() { return string1; } public void setString1(String string1) { this.string1 = string1; } public String getString2() { return string2; } public void setString2(String string2) { this.string2 = string2; } public String getString3() { return string3; } public void setString3(String string3) { this.string3 = string3; } }
package com.kgisl.code; /** * Block */ public class Block { Block() { System.out.println("Executes 3rd: Constructor"); } { System.out.println("Executes 2nd: Instance initialization block"); } static { System.out.println("Excutes 1st: Static block always "); } public static void main(String[] args) { Block b = new Block(); } }
package AlgorithmsAndDataStructures.GraphInDepth; import AlgorithmsAndDataStructures.Stack.ArrayStack; import AlgorithmsAndDataStructures.Stack.Stack; /** * Created by User on 26.02.2017. */ public class Graph { private final int VERTEX_MAX = 100; private Vertex[] vertexList; private int vertexCount; private int[][] matrix; private Stack stack; public Graph() { matrix = new int[VERTEX_MAX][VERTEX_MAX]; for (int i = 0; i < VERTEX_MAX; i++) { for (int j = 0; j < VERTEX_MAX; j++) { matrix[i][j] = 0; } } vertexCount = 0; vertexList = new Vertex[VERTEX_MAX]; stack = new ArrayStack(100); } public void addVertex(int label) { vertexList[vertexCount++] = new Vertex(label); } public void addEdge(int begin, int end) { matrix[begin][end] = 1; } public int getSuccessor(int v) { for (int i = 0; i < vertexCount; i++) { if (matrix[v][i] == 1 && !vertexList[i].isVisited()) { return i; } } return -1; } public void dfs(int v) { vertexList[v].setVisited(true); stack.push(v); System.out.println(vertexList[v].getLabel()); while (!stack.isEmpty()) { int current = (int) stack.top(); int vertex = getSuccessor(current); if (vertex == -1) { stack.pop(); } else { vertexList[vertex].setVisited(true); System.out.println(vertexList[vertex].getLabel()); stack.push(vertex); } } for (int i = 0; i < vertexCount; i++) { vertexList[i].setVisited(false); } } }
package com.cskaoyan.service; import com.cskaoyan.bean.BaseResultVo; import com.cskaoyan.bean.DeviceType; import com.cskaoyan.bean.QueryStatus; import java.util.List; /** * @Author: zero * @Date: 2019/5/18 15:46 * @Version 1.0 */ public interface DeviceTypeService { BaseResultVo getDeviceTypeList(int rows, int page); BaseResultVo getDeviceTypeById(String searchValue, int rows, int page); BaseResultVo getDeviceTypeByName(String searchValue, int rows, int page); DeviceType[] getDeviceTypes(); DeviceType selectDeviceTypeById(String deviceTypeId); QueryStatus updateDeviceType(DeviceType deviceType); QueryStatus insertDeviceType(DeviceType deviceType); QueryStatus deleteDeviceType(String[] ids); }
package com.vilio.bps.inquiry.worldunion.service; import com.vilio.bps.inquiry.pojo.InquiryBaseValueBean; import com.vilio.bps.inquiry.worldunion.pojo.WUAutoPrice; import com.vilio.bps.inquiry.worldunion.pojo.WUGetQueryPrice; import java.util.Map; /** * Created by dell on 2017/5/12/0012. */ public interface WUInquiryPrice { public WUAutoPrice getAutoPrice(String cid, String bid, String hid, String area, String caseId) throws Exception; public WUGetQueryPrice getQueryPrice(Map paramMap) throws Exception; }
package com.tencent.mm.plugin.appbrand.jsapi.auth; import com.tencent.mm.ab.l; import com.tencent.mm.plugin.appbrand.jsapi.auth.JsApiLogin.LoginTask; import com.tencent.mm.protocal.c.aow; import com.tencent.mm.sdk.platformtools.x; import com.tencent.mm.u.a.d; import com.tencent.mm.u.a.d.a; class JsApiLogin$LoginTask$5 implements a<d> { final /* synthetic */ LoginTask fJD; final /* synthetic */ LoginTask.a fJF; final /* synthetic */ int fvO; JsApiLogin$LoginTask$5(LoginTask loginTask, LoginTask.a aVar, int i) { this.fJD = loginTask; this.fJF = aVar; this.fvO = i; } public final /* synthetic */ void b(int i, int i2, String str, l lVar) { d dVar = (d) lVar; x.i("MicroMsg.JsApiLogin", "onSceneEnd errType = %d, errCode = %d ,errMsg = %s", new Object[]{Integer.valueOf(i), Integer.valueOf(i2), str}); if (i != 0 || i2 != 0) { this.fJF.aid(); } else if (!(dVar instanceof d)) { x.i("MicroMsg.JsApiLogin", "not jslogin cgi reqeust"); this.fJF.aid(); } else if (this.fvO == 2) { x.i("MicroMsg.JsApiLogin", "press reject button"); this.fJF.aid(); } else { aow CX = dVar.CX(); int i3 = CX.rRd.bMH; String str2 = CX.rRd.bMI; x.i("MicroMsg.JsApiLogin", "stev NetSceneJSLoginConfirm jsErrcode %d", new Object[]{Integer.valueOf(i3)}); if (i3 == 0) { this.fJF.qe(CX.rRg); x.i("MicroMsg.JsApiLogin", "resp data code [%s]", new Object[]{r0}); return; } this.fJF.aid(); x.e("MicroMsg.JsApiLogin", "onSceneEnd NetSceneJSLoginConfirm %s", new Object[]{str2}); } } }
import javax.servlet.http.*; import javax.servlet.*; import javax.servlet.annotation.*; import java.io.*; @WebServlet(name="MyAnnotationServlet",urlPatterns={"/hello"}, initParams= { @WebInitParam(name="email",value="abc@gmail.com"), @WebInitParam(name="phone",value="1234567890") }) public class MyAnnotationServlet extends HttpServlet {String email,phone; public void init(ServletConfig config) throws ServletException { super.init(config); email=config.getInitParameter("email"); phone=config.getInitParameter("phone"); } public void service(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException { res.setContentType("text/html"); PrintWriter out=res.getWriter(); out.println("<html><body>"); out.println("hello Servlet from annotation"); out.println("<br>"); out.println("<h1>"+email+"</h1>"); out.println("<br>"); out.println("<h2>"+phone+"</h2>"); out.println("</body></html>"); out.close(); } }
package com.steven.base.base; import android.content.Context; import android.os.Bundle; import androidx.annotation.LayoutRes; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentActivity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.kingja.loadsir.callback.Callback; import com.kingja.loadsir.core.LoadService; import com.kingja.loadsir.core.LoadSir; import com.steven.base.mvp.BaseModel; import com.steven.base.mvp.BasePresenter; import com.steven.base.mvp.BaseView; import com.steven.base.rx.RxManager; import com.steven.base.util.TUtil; /** * @user steven * @createDate 2019/1/24 13:30 * @description 自定义 */ public abstract class ViewPagerFragment<T extends BasePresenter, E extends BaseModel> extends Fragment implements BaseView, Callback.OnReloadListener { /** * rootView是否初始化标志,防止回调函数在rootView为空的时候触发 */ private boolean hasCreateView; /** * 当前Fragment是否处于可见状态标志,防止因ViewPager的缓存机制而导致回调函数的触发 */ private boolean isFragmentVisible; /** * onCreateView()里返回的view,修饰为protected,所以子类继承该类时,在onCreateView里必须对该变量进行初始化 */ protected View rootView; public T mPresenter; public E mModel; public RxManager mRxManager; protected LoadService mBaseLoadService; protected FragmentActivity _mActivity; @Override public void onAttach(Context context) { super.onAttach(context); _mActivity = getActivity(); } @Override public void setUserVisibleHint(boolean isVisibleToUser) { super.setUserVisibleHint(isVisibleToUser); if (rootView == null) { return; } hasCreateView = true; if (isVisibleToUser) { onFragmentVisibleChange(true); isFragmentVisible = true; return; } if (isFragmentVisible) { onFragmentVisibleChange(false); isFragmentVisible = false; } } @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); initVariable(); } @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); if (!hasCreateView && getUserVisibleHint()) { onFragmentVisibleChange(true); isFragmentVisible = true; } } private void initVariable() { hasCreateView = false; isFragmentVisible = false; } /************************************************************** * 自定义的回调方法,子类可根据需求重写 *************************************************************/ /** * 当前fragment可见状态发生变化时会回调该方法 * 如果当前fragment是第一次加载,等待onCreateView后才会回调该方法,其它情况回调时机跟 {@link #setUserVisibleHint(boolean)}一致 * 在该回调方法中你可以做一些加载数据操作,甚至是控件的操作,因为配合fragment的view复用机制,你不用担心在对控件操作中会报 null 异常 * * @param isVisible true 不可见 -> 可见 * false 可见 -> 不可见 */ protected void onFragmentVisibleChange(boolean isVisible) { if (isVisible) { } } //新建类ViewPagerFragment,将上面代码复制粘贴进去,添加需要的import语句 -> 新建你需要的Fragment类,继承ViewPagerFragment,在onCreateView()里对rootView进行初始化 -> 重写onFragmentVisibleChange(),在这里进行你需要的操作,比如数据加载,控制显示等。 @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { if (rootView == null) { rootView = inflater.inflate(getLayoutId(), container, false); } mRxManager = new RxManager(); mPresenter = TUtil.getT(this, 0); mModel = TUtil.getT(this, 1); if (mPresenter != null) { mPresenter.mContext = this.getActivity(); } // 多状态管理类 if (!isCustomLoadingLayout()) { mBaseLoadService = LoadSir.getDefault().register(rootView, this); } initPresenter(); initView(savedInstanceState); return mBaseLoadService != null ? mBaseLoadService.getLoadLayout() : rootView; } /** * 简单页面无需mvp就不用管此方法即可,完美兼容各种实际场景的变通 */ public abstract void initPresenter(); /** * 初始化view * * @param savedInstanceState 保存数据 */ public abstract void initView(Bundle savedInstanceState); @LayoutRes protected abstract int getLayoutId(); @Override public void onReload(View view) { } @Override public void onError(String msg) { } protected boolean isCustomLoadingLayout() { return false; } }
package com.budget.spring.beans; public class MyUsers { private int adminId; public int getAdminId() { return adminId; } public void setAdminId(int adminId) { this.adminId = adminId; } }
package com.espendwise.manta.dao; import com.espendwise.manta.util.Constants; import com.espendwise.manta.util.QueryHelp; import com.espendwise.manta.util.RefCodeNames; import com.espendwise.manta.util.Utility; import com.espendwise.manta.model.data.ContentData; import org.apache.log4j.Logger; import javax.persistence.EntityManager; import javax.persistence.Query; import java.util.List; import java.util.Locale; import org.springframework.web.multipart.commons.*; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; public class ContentDAOImpl extends DAOImpl implements ContentDAO { private static final Logger logger = Logger.getLogger(ContentDAOImpl.class); public ContentDAOImpl(EntityManager entityManager) { super(entityManager); } @Override public byte[] findBestLogo(Long busEntityId, String path, Locale userLocale) { logger.info("findBestLogo()=> busEntityId: " + busEntityId + ", path: " + path + ", userLocale: " + userLocale ); List<String> locales = Utility.toList(userLocale.toString(), userLocale.getLanguage(), Constants.DEFAULT_LOCALE.toString(), Constants.DEFAULT_LOCALE.getLanguage(), Constants.CONTENT_DEFAULT_LOCALE_CD ); Query q = em.createQuery("Select content.contentId, content.localeCd from ContentData content" + " where content.contentTypeCd = (:contentTypeCd) " + " and content.contentUsageCd = (:contentUsageCd) " + " and content.contentStatusCd = (:contentStatusCd)" + " and content.path like :path " + " and content.localeCd in (:localeCd)"); q.setParameter("contentTypeCd", RefCodeNames.CONTENT_TYPE_CD.IMAGE); q.setParameter("contentUsageCd", RefCodeNames.CONTENT_USAGE_CD.LOGO_IMAGE); q.setParameter("path", QueryHelp.endWith(path)); q.setParameter("localeCd", locales); q.setParameter("contentStatusCd", RefCodeNames.CONTENT_STATUS_CD.ACTIVE); List contents = q.getResultList(); if(contents.isEmpty()) { return new byte[0]; } Long bestContentId = (long) Constants.ZERO; for (String locale : locales) { for (Object obj : contents) { Object[] c = (Object[]) obj; if (locale.equals(c[1])) { bestContentId = (Long) c[0]; break; } } } q = em.createQuery("Select content.binaryData from ContentData content" + " where content.contentId = (:bestContentId)"); q.setParameter("bestContentId", bestContentId); List datas = q.getResultList(); return datas.isEmpty() ? new byte[0] : (byte[]) datas.get(0); } @Override public void addContentSaveImage(String path, String imageType, CommonsMultipartFile imageFile) { if (imageFile == null) return; addContentSaveImage(path, imageType, imageFile.getBytes()); } @Override public void addContentSaveImage(String path, String imageType, byte[] imageFile) { logger.info("addContentSaveImage()=> path: " + path ); // remove old content path = "." + path; removeContent(path); // create and insert content ContentData d = new ContentData(); d.setShortDesc(imageType); d.setContentTypeCd("Image"); d.setContentStatusCd(RefCodeNames.CONTENT_STATUS_CD.ACTIVE); d.setLocaleCd("x"); d.setLanguageCd("x"); d.setContentUsageCd(imageType); d.setSourceCd("xsuite-app"); d.setPath(path); d.setBinaryData(imageFile); d = super.create(d); } public void copyContentImage(String oldPath, String newPath, String imageType) { Query q = em.createQuery("Select content from ContentData content" + " where content.path like :path "); q.setParameter("path", QueryHelp.endWith(oldPath)); List<ContentData> res = q.getResultList(); for (ContentData oldD : res) { ContentData d = new ContentData(); d.setShortDesc(oldD.getShortDesc()); d.setContentTypeCd(oldD.getContentTypeCd()); d.setContentStatusCd(RefCodeNames.CONTENT_STATUS_CD.ACTIVE); d.setLocaleCd(oldD.getLocaleCd()); d.setLanguageCd(oldD.getLanguageCd()); d.setContentUsageCd(oldD.getContentUsageCd()); d.setSourceCd(oldD.getSourceCd()); d.setPath(newPath); byte[] bindata = oldD.getBinaryData(); d.setBinaryData(bindata); d = super.create(d); } } @Override @Transactional(readOnly = false, propagation = Propagation.REQUIRED) public void removeContent(String path) { Query q = em.createQuery("Select content from ContentData content" + " where content.path like :path "); q.setParameter("path", QueryHelp.endWith(path)); List<ContentData> res = q.getResultList(); for (ContentData d : res) { em.remove(d); } } @Override public byte[] getImage(String path, String contentType, String contentUsage) { Query q = em.createQuery("Select content.binaryData from ContentData content" + // " where content.contentTypeCd = (:contentTypeCd) " + // " and content.contentUsageCd = (:contentUsageCd) " + " where content.path like (:path) " + " and content.contentStatusCd = (:contentStatusCd)"); // " and content.localeCd in (:localeCd)"); // q.setParameter("contentTypeCd", contentType); // q.setParameter("contentUsageCd", contentUsage); q.setParameter("path", QueryHelp.endWith(path)); q.setParameter("contentStatusCd", RefCodeNames.CONTENT_STATUS_CD.ACTIVE); List datas = q.getResultList(); byte[] res = datas.isEmpty() ? new byte[0] : (byte[]) datas.get(0); return res; } }
package com.gtfs.bean; import java.io.Serializable; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; @Entity @Table(name = "LIC_PREM_FREQ_ALLOW_AR_MST") public class LicPremFreqAllowARMst implements Serializable{ private Long id; private LicProductMst licProductMst; private Long saTerm; private String consTermFlag; private String premFreqAllow; private Double minSa; private Double maxSa; private Double premSlab; private String arRiderType; private Double arRiderValue; private Integer arMinAge; private Integer arMaxAge; private Long createdBy; private Long modifiedBy; private Long deletedBy; private Date createdDate; private Date modifiedDate; private Date deletedDate; private String deleteFlag; @Id @Column(name = "ID",nullable = false, precision = 22, scale = 0) public Long getId() { return id; } public void setId(Long id) { this.id = id; } @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "LIC_PROD_MST_ID") public LicProductMst getLicProductMst() { return licProductMst; } public void setLicProductMst(LicProductMst licProductMst) { this.licProductMst = licProductMst; } @Column(name = "SA_TERM", precision = 22, scale = 0) public Long getSaTerm() { return saTerm; } public void setSaTerm(Long saTerm) { this.saTerm = saTerm; } @Column(name = "CONS_TERM_FLAG", length=1) public String getConsTermFlag() { return consTermFlag; } public void setConsTermFlag(String consTermFlag) { this.consTermFlag = consTermFlag; } @Column(name = "PREM_FREQ_ALLOW", length=5) public String getPremFreqAllow() { return premFreqAllow; } public void setPremFreqAllow(String premFreqAllow) { this.premFreqAllow = premFreqAllow; } @Column(name = "MIN_SA", precision = 22, scale = 0) public Double getMinSa() { return minSa; } public void setMinSa(Double minSa) { this.minSa = minSa; } @Column(name = "MAX_SA", precision = 22, scale = 0) public Double getMaxSa() { return maxSa; } public void setMaxSa(Double maxSa) { this.maxSa = maxSa; } @Column(name = "PREM_SLAB", precision = 22, scale = 0) public Double getPremSlab() { return premSlab; } public void setPremSlab(Double premSlab) { this.premSlab = premSlab; } @Column(name = "AR_RIDER_TYPE", length=5) public String getArRiderType() { return arRiderType; } public void setArRiderType(String arRiderType) { this.arRiderType = arRiderType; } @Column(name = "AR_RIDER_VALUE", precision = 22, scale = 0) public Double getArRiderValue() { return arRiderValue; } public void setArRiderValue(Double arRiderValue) { this.arRiderValue = arRiderValue; } @Column(name = "CREATED_BY", precision = 22, scale = 0) public Long getCreatedBy() { return createdBy; } public void setCreatedBy(Long createdBy) { this.createdBy = createdBy; } @Column(name = "MODIFIED_BY", precision = 22, scale = 0) public Long getModifiedBy() { return modifiedBy; } public void setModifiedBy(Long modifiedBy) { this.modifiedBy = modifiedBy; } @Column(name = "DELETED_BY", precision = 22, scale = 0) public Long getDeletedBy() { return deletedBy; } public void setDeletedBy(Long deletedBy) { this.deletedBy = deletedBy; } @Temporal(TemporalType.DATE) @Column(name = "CREATED_DATE", length = 7) public Date getCreatedDate() { return createdDate; } public void setCreatedDate(Date createdDate) { this.createdDate = createdDate; } @Temporal(TemporalType.DATE) @Column(name = "MODIFIED_DATE", length = 7) public Date getModifiedDate() { return modifiedDate; } public void setModifiedDate(Date modifiedDate) { this.modifiedDate = modifiedDate; } @Temporal(TemporalType.DATE) @Column(name = "DELETED_DATE", length = 7) public Date getDeletedDate() { return deletedDate; } public void setDeletedDate(Date deletedDate) { this.deletedDate = deletedDate; } @Column(name = "DELETE_FLAG", length = 1) public String getDeleteFlag() { return deleteFlag; } public void setDeleteFlag(String deleteFlag) { this.deleteFlag = deleteFlag; } @Column(name = "AR_MIN_AGE", precision = 22, scale = 0) public Integer getArMinAge() { return arMinAge; } public void setArMinAge(Integer arMinAge) { this.arMinAge = arMinAge; } @Column(name = "AR_MAX_AGE", precision = 22, scale = 0) public Integer getArMaxAge() { return arMaxAge; } public void setArMaxAge(Integer arMaxAge) { this.arMaxAge = arMaxAge; } }
package model; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException; import java.security.*; public class RSA { public static KeyPair generateKeyPair() { try { KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA"); generator.initialize(2048, new SecureRandom()); return generator.generateKeyPair(); } catch (NoSuchAlgorithmException e) { System.out.println("Error: failed key pair generation (RSA class)"); return null; } } public static byte[] encrypt(byte[] data, PublicKey publicKey) { try { Cipher cipher = Cipher.getInstance("RSA"); cipher.init(Cipher.ENCRYPT_MODE, publicKey); return cipher.doFinal(data); } catch (NoSuchPaddingException | NoSuchAlgorithmException | InvalidKeyException | BadPaddingException | IllegalBlockSizeException e) { System.out.println("Error: failed encryption (RSA class)"); return null; } } public static byte[] decrypt(byte[] data, PrivateKey privateKey) { try { Cipher cipher = Cipher.getInstance("RSA"); cipher.init(Cipher.DECRYPT_MODE, privateKey); return cipher.doFinal(data); } catch (NoSuchPaddingException | NoSuchAlgorithmException | InvalidKeyException | BadPaddingException | IllegalBlockSizeException e) { System.out.println("Error: failed decryption (RSA class)"); e.printStackTrace(); return null; } } public static byte[] makeSignature(byte[] data, PrivateKey privateKey) { try { Signature sign = Signature.getInstance("SHA256withRSA"); sign.initSign(privateKey); sign.update(data); return sign.sign(); } catch (NoSuchAlgorithmException | InvalidKeyException | SignatureException e) { System.out.println("Error: failed to make a signature (RSA class)"); return null; } } public static boolean verifySignature(byte[] data, byte[] signature, PublicKey publicKey) { try { Signature sign = Signature.getInstance("SHA256withRSA"); sign.initVerify(publicKey); sign.update(data); return sign.verify(signature); } catch (NoSuchAlgorithmException | InvalidKeyException | SignatureException e) { System.out.println("Error: failed signature verification (RSA class)"); return false; } } }
package ru.otus.spring.barsegyan.domain; import org.hibernate.annotations.JoinFormula; import javax.persistence.*; import java.util.Set; import java.util.UUID; @Entity @Table(name = "chat") public class Chat { @Id @GeneratedValue @Column(name = "chat_id") private UUID id; @Column(name = "name") private String name; @ManyToMany(fetch = FetchType.LAZY) @JoinTable(name = "app_user_chat", joinColumns = @JoinColumn(name = "chat_id"), inverseJoinColumns = @JoinColumn(name = "app_user_id")) private Set<AppUser> members; @ManyToOne(fetch = FetchType.LAZY) @JoinFormula("(" + "select cm.chat_message_id " + "from chat_message cm " + "where cm.chat_id = chat_id " + "order by cm.sent_at desc " + "limit 1" + ")") private ChatMessage lastMessage; public Chat() { } public Chat(UUID id, String name, Set<AppUser> members, ChatMessage lastMessage) { this.id = id; this.name = name; this.members = members; this.lastMessage = lastMessage; } public Chat setName(String name) { this.name = name; return this; } public Chat setMembers(Set<AppUser> members) { this.members = members; return this; } public Chat addMembers(Set<AppUser> newMembers) { members.addAll(newMembers); return this; } public UUID getId() { return id; } public String getName() { return name; } public Set<AppUser> getMembers() { return members; } public ChatMessage getLastMessage() { return lastMessage; } }
package com.ibm.ive.tools.commandLine; import java.util.LinkedList; /** * @author sfoley * <p> * Handles options which might occur multiple times, each time with argument(s). */ public class ListOption extends ArgumentOption { private static String nullStrings[] = new String[0]; private LinkedList stringList; private ListOption dual; /** * Constructor for ListOption. * @param name * @param argCount */ public ListOption(String name, String description, int argCount) { super(name, description, argCount); } public ListOption(String name, int argCount) { super(name, argCount); } /** * Handles an appearance on the command line of this option. */ protected void handle(String args[], CommandLineParser fromParser) throws CommandLineException { int count = Math.min(argCount, args.length); for(int i=0; i<count; i++) { add(args[i]); } } public void add(String s) { if(stringList == null) { stringList = new LinkedList(); } stringList.add(s); if(dual != null) { if(dual.stringList != null && dual.stringList.contains(s)) { dual.stringList.remove(s); } } } public void add(String s[]) { for(int i=0; i<s.length; i++) { add(s[i]); } } /** * An element in this list will never appear (will be removed if necessary) * from the dual list */ public void setDual(ListOption dual) { this.dual = dual; } public String getString(int index) { if(stringList == null) { throw new IndexOutOfBoundsException(); } return (String) stringList.get(index); } public boolean contains(String s) { return stringList != null && stringList.contains(s); } public String[] getStrings() { return stringList == null ? nullStrings : (String[]) stringList.toArray(new String[stringList.size()]); } public boolean appears() { return stringList != null && stringList.size() > 0; } }
package br.com.uva; import java.io.File; public class Usuarios { String usuario; String senha; File db; int id = 1; String destinatario, data; double valor; Usuarios(String usuario, String senha) { this.usuario = usuario; this.senha = senha; } Usuarios() { } public void acrementaId(){ this.id = id++; } public void setDestinatario(String nome) { this.destinatario = nome; } public void setData(String data) { this.data = data; } public void setValor(double valor) { this.valor = valor; } public String getDestinatario() { return this.destinatario; } public String getData() { return this.data; } public double getValor() { return this.valor; } public String getNome() { return this.usuario; } public String getSenha() { return this.senha; } public void createFile() { String fl = this.getNome() + ".txt"; try { this.db = new File(fl); if (db.createNewFile()) { System.out.println("Arquivo criado: " + db.getName()); } else { System.out.println("Arquivo existente."); } } catch (Exception e) { System.out.println("Um erro ocorreu."); e.printStackTrace(); } } public File getFile() { return this.db; } }
package com.wifiesta.restaurant; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.FilterType; import org.springframework.context.annotation.PropertySource; @Configuration @ComponentScan(basePackages = { "com.wifiesta.restaurant" }, excludeFilters = @ComponentScan.Filter(value = Configuration.class, type = FilterType.ANNOTATION)) @PropertySource(value = { "classpath:conf/data.properties" }) public class TestConfig { }
package com.ethanchen.weatherapp; import android.Manifest; import android.content.Context; import android.content.Intent; import android.location.Address; import android.location.Geocoder; import android.location.Location; import android.location.LocationManager; import android.os.Bundle; import android.os.Handler; import android.support.annotation.Nullable; import android.support.v4.app.ActivityCompat; import android.support.v4.app.Fragment; import android.support.v7.widget.CardView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.JsonObjectRequest; import com.android.volley.toolbox.Volley; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.security.PrivateKey; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; public class CurrentCity extends Fragment { private static final String TAG = "CurrentCity"; private Map<String, String> states; private CardView first_card; private ImageView first_card_icon; private TextView first_card_temperature; private TextView first_card_summary; private TextView first_card_city; private TextView second_card_humidity; private TextView second_card_wind; private TextView second_card_visibility; private TextView second_card_pressure; private ListView third_card_list; private DateFormat dateFormat; private double lat = 0.0; private double lng = 0.0; private RequestQueue requestQueue; private String cityName; private String weatherJson; private String cityTemperature; Location gpsLoc = null, networkLoc = null; public static CurrentCity newInstance(String text) { CurrentCity f = new CurrentCity(text); return f; } public CurrentCity() { } public CurrentCity(String text) { //cityName = text; } @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.current_city, container, false); states = new HashMap<>(); states.put("Alabama","AL"); states.put("Alaska","AK"); states.put("Alberta","AB"); states.put("American Samoa","AS"); states.put("Arizona","AZ"); states.put("Arkansas","AR"); states.put("Armed Forces (AE)","AE"); states.put("Armed Forces Americas","AA"); states.put("Armed Forces Pacific","AP"); states.put("British Columbia","BC"); states.put("California","CA"); states.put("Colorado","CO"); states.put("Connecticut","CT"); states.put("Delaware","DE"); states.put("District Of Columbia","DC"); states.put("Florida","FL"); states.put("Georgia","GA"); states.put("Guam","GU"); states.put("Hawaii","HI"); states.put("Idaho","ID"); states.put("Illinois","IL"); states.put("Indiana","IN"); states.put("Iowa","IA"); states.put("Kansas","KS"); states.put("Kentucky","KY"); states.put("Louisiana","LA"); states.put("Maine","ME"); states.put("Manitoba","MB"); states.put("Maryland","MD"); states.put("Massachusetts","MA"); states.put("Michigan","MI"); states.put("Minnesota","MN"); states.put("Mississippi","MS"); states.put("Missouri","MO"); states.put("Montana","MT"); states.put("Nebraska","NE"); states.put("Nevada","NV"); states.put("New Brunswick","NB"); states.put("New Hampshire","NH"); states.put("New Jersey","NJ"); states.put("New Mexico","NM"); states.put("New York","NY"); states.put("Newfoundland","NF"); states.put("North Carolina","NC"); states.put("North Dakota","ND"); states.put("Northwest Territories","NT"); states.put("Nova Scotia","NS"); states.put("Nunavut","NU"); states.put("Ohio","OH"); states.put("Oklahoma","OK"); states.put("Ontario","ON"); states.put("Oregon","OR"); states.put("Pennsylvania","PA"); states.put("Prince Edward Island","PE"); states.put("Puerto Rico","PR"); states.put("Quebec","PQ"); states.put("Rhode Island","RI"); states.put("Saskatchewan","SK"); states.put("South Carolina","SC"); states.put("South Dakota","SD"); states.put("Tennessee","TN"); states.put("Texas","TX"); states.put("Utah","UT"); states.put("Vermont","VT"); states.put("Virgin Islands","VI"); states.put("Virginia","VA"); states.put("Washington","WA"); states.put("West Virginia","WV"); states.put("Wisconsin","WI"); states.put("Wyoming","WY"); states.put("Yukon Territory","YT"); dateFormat = new SimpleDateFormat("MM/dd/yyyy"); first_card = view.findViewById(R.id.first_card); first_card_icon = view.findViewById(R.id.first_card_icon); first_card_temperature = view.findViewById(R.id.first_card_temperature); first_card_summary = view.findViewById(R.id.first_card_summary); first_card_city = view.findViewById(R.id.first_card_city); second_card_humidity = view.findViewById(R.id.second_card_humidity); second_card_wind = view.findViewById(R.id.second_card_wind); second_card_visibility = view.findViewById(R.id.second_card_visibility); second_card_pressure = view.findViewById(R.id.second_card_pressure); third_card_list = view.findViewById(R.id.third_card_list); LocationManager locationManager = (LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE); gpsLoc = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); networkLoc = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); lat = gpsLoc.getLatitude(); lng = gpsLoc.getLongitude(); cityName = getCityFromGeo(lat, lng); first_card_city.setText(cityName); requestQueue = Volley.newRequestQueue(getActivity()); jsonParse(lat, lng); first_card.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { goToTabs(); } }); return view; } private String getCityFromGeo(double lat, double lng) { Geocoder geocoder = new Geocoder(getActivity().getApplicationContext(), Locale.getDefault()); try { List<Address> addresses = geocoder.getFromLocation(lat, lng, 1); if (addresses != null && addresses.size() > 0) { String city = addresses.get(0).getLocality(); String state = addresses.get(0).getAdminArea(); String country = addresses.get(0).getCountryCode(); if (country.equals("US")) { country = "USA"; } if (states.containsKey(state)) { return city + ", " + states.get(state) + ", " + country; } else { return city + ", " + country; } } return null; } catch (Exception e) { e.printStackTrace(); return null; } } private void jsonParse(double lat, double lng) { String url = "http://csci571hw7nodejs-env.huttzh528b.us-east-2.elasticbeanstalk.com/weather?latitude="+String.valueOf(lat)+"&longitude="+String.valueOf(lng); JsonObjectRequest request = new JsonObjectRequest(Request.Method.GET, url, null, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { try { weatherJson = response.toString(); JSONObject currentlyObj = response.getJSONObject("currently"); JSONObject dailyObj = response.getJSONObject("daily"); String currentlyIcon = "N/A"; if (currentlyObj.has("icon")) { currentlyIcon = currentlyObj.getString("icon"); } String currentlyTemperatureString = "N/A"; if (currentlyObj.has("temperature")) { int currentlyTemperature = (int) Math.round(currentlyObj.getDouble("temperature")); currentlyTemperatureString = currentlyTemperature + "°F"; } cityTemperature = currentlyTemperatureString; String currentlySummary = "N/A"; if (currentlyObj.has("summary")) { currentlySummary = currentlyObj.getString("summary"); } String currentlyHumidityString = "N/A"; if (currentlyObj.has("humidity")) { int currentlyHumidity = (int) Math.round(currentlyObj.getDouble("humidity") * 100); currentlyHumidityString = currentlyHumidity + "%"; } String currentlyWindSpeedString = "N/A"; if (currentlyObj.has("windSpeed")) { double currentlyWindSpeed = currentlyObj.getDouble("windSpeed"); currentlyWindSpeedString = String.format("%.2f", currentlyWindSpeed) + " mph"; } String currentlyVisibilityString = "N/A"; if (currentlyObj.has("visibility")) { double currentlyVisibility = currentlyObj.getDouble("visibility"); currentlyVisibilityString = String.format("%.2f", currentlyVisibility) + " km"; } String currentlyPressureString = "N/A"; if (currentlyObj.has("pressure")) { double currentlyPressure = currentlyObj.getDouble("pressure"); currentlyPressureString = String.format("%.2f", currentlyPressure) + " mb"; } JSONArray dailyDataArray = dailyObj.getJSONArray("data"); //ArrayList<String> dailyDate = new ArrayList<>(); //ArrayList<String> dailyIcon = new ArrayList<>(); //ArrayList<String> dailyTemperatureLow = new ArrayList<>(); //ArrayList<String> dailyTemperatureHigh = new ArrayList<>(); ArrayList<DailyItem> dailyItems = new ArrayList<>(); for (int i = 0; i < dailyDataArray.length(); i++) { JSONObject dayInfo = dailyDataArray.getJSONObject(i); long dayTime = dayInfo.getInt("time"); Date date = new Date(dayTime * 1000); String dateString = dateFormat.format(date); String dayIcon = dayInfo.getString("icon"); int dayTemperatureLow = (int) Math.round(dayInfo.getDouble("temperatureLow")); String dayTemperatureLowString = String.valueOf(dayTemperatureLow); int daytemperatureHigh = (int) Math.round(dayInfo.getDouble("temperatureHigh")); String daytemperatureHighString = String.valueOf(daytemperatureHigh); //dailyDate.add(dateString); //dailyIcon.add(dayIcon); //dailyTemperatureLow.add(dayTemperatureLowString); //dailyTemperatureHigh.add(daytemperatureHighString); if (dayIcon.equals("clear-night")) { DailyItem dailyItem = new DailyItem(dateString, R.drawable.clear_night, dayTemperatureLowString, daytemperatureHighString); dailyItems.add(dailyItem); } else if (dayIcon.equals("rain")) { DailyItem dailyItem = new DailyItem(dateString, R.drawable.rain, dayTemperatureLowString, daytemperatureHighString); dailyItems.add(dailyItem); } else if (dayIcon.equals("sleet")) { DailyItem dailyItem = new DailyItem(dateString, R.drawable.sleet, dayTemperatureLowString, daytemperatureHighString); dailyItems.add(dailyItem); } else if (dayIcon.equals("snow")) { DailyItem dailyItem = new DailyItem(dateString, R.drawable.snow, dayTemperatureLowString, daytemperatureHighString); dailyItems.add(dailyItem); } else if (dayIcon.equals("wind")) { DailyItem dailyItem = new DailyItem(dateString, R.drawable.wind, dayTemperatureLowString, daytemperatureHighString); dailyItems.add(dailyItem); } else if (dayIcon.equals("fog")) { DailyItem dailyItem = new DailyItem(dateString, R.drawable.fog, dayTemperatureLowString, daytemperatureHighString); dailyItems.add(dailyItem); } else if (dayIcon.equals("cloudy")) { DailyItem dailyItem = new DailyItem(dateString, R.drawable.cloudy, dayTemperatureLowString, daytemperatureHighString); dailyItems.add(dailyItem); } else if (dayIcon.equals("partly-cloudy-night")) { DailyItem dailyItem = new DailyItem(dateString, R.drawable.partly_cloudy_night, dayTemperatureLowString, daytemperatureHighString); dailyItems.add(dailyItem); } else if (dayIcon.equals("partly-cloudy-day")) { DailyItem dailyItem = new DailyItem(dateString, R.drawable.partly_cloudy_day, dayTemperatureLowString, daytemperatureHighString); dailyItems.add(dailyItem); } else { DailyItem dailyItem = new DailyItem(dateString, R.drawable.clear_day, dayTemperatureLowString, daytemperatureHighString); dailyItems.add(dailyItem); } } if (currentlyIcon.equals("clear-night")) { first_card_icon.setImageResource(R.drawable.clear_night); } else if (currentlyIcon.equals("rain")) { first_card_icon.setImageResource(R.drawable.rain); } else if (currentlyIcon.equals("sleet")) { first_card_icon.setImageResource(R.drawable.sleet); } else if (currentlyIcon.equals("snow")) { first_card_icon.setImageResource(R.drawable.snow); } else if (currentlyIcon.equals("wind")) { first_card_icon.setImageResource(R.drawable.wind); } else if (currentlyIcon.equals("fog")) { first_card_icon.setImageResource(R.drawable.fog); } else if (currentlyIcon.equals("cloudy")) { first_card_icon.setImageResource(R.drawable.cloudy); } else if (currentlyIcon.equals("partly-cloudy-night")) { first_card_icon.setImageResource(R.drawable.partly_cloudy_night); } else if (currentlyIcon.equals("partly-cloudy-day")) { first_card_icon.setImageResource(R.drawable.partly_cloudy_day); } else { first_card_icon.setImageResource(R.drawable.clear_day); } first_card_temperature.setText(currentlyTemperatureString); first_card_summary.setText(currentlySummary); second_card_humidity.setText(currentlyHumidityString); second_card_wind.setText(currentlyWindSpeedString); second_card_visibility.setText(currentlyVisibilityString); second_card_pressure.setText(currentlyPressureString); DailyListAdapter adapter = new DailyListAdapter(getActivity(), R.layout.third_card_list_item_layout, dailyItems); third_card_list.setAdapter(adapter); getActivity().findViewById(R.id.progressBar_lay1).setVisibility(View.GONE); } catch (JSONException e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { error.printStackTrace(); } }); requestQueue.add(request); } public void goToTabs() { Intent myIntent = new Intent(getActivity(), TabsActivity.class); myIntent.putExtra("weatherJson", weatherJson); myIntent.putExtra("cityName", cityName); myIntent.putExtra("cityTemperature", cityTemperature); startActivity(myIntent); } }
package com.mbirtchnell.ocmjea.domain; import javax.persistence.Entity; import javax.persistence.Id; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; @Entity @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) public abstract class Component implements Prototypable<Component> { @Id protected String id; private String name; private String detail; private String availability; private String applicability; public Component() { this.id = IdGenerator.generateId(); } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDetail() { return detail; } public void setDetail(String detail) { this.detail = detail; } public String getAvailability() { return availability; } public void setAvailability(String availability) { this.availability = availability; } public String getApplicability() { return applicability; } public void setApplicability(String applicability) { this.applicability = applicability; } public Component clone(Class<? extends Component> clazz) { Component clone = null; try { clone = clazz.newInstance(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } clone.setName(this.name); clone.setDetail(this.detail); clone.setAvailability(this.availability); clone.setApplicability(this.applicability); return clone; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); return result; } @Override public boolean equals(Object obj) { if(this == obj) return true; if(obj == null) return false; if(getClass() != obj.getClass()) return false; Component other = (Component) obj; if(id == null) { if(other.id != null) return false; } else if(!id.equals(other.id)) return false; return true; } }
package com.vilio.plms.service.base.impl; import com.vilio.plms.dao.SysInfoParamDao; import com.vilio.plms.exception.ErrorException; import com.vilio.plms.glob.GlobDict; import com.vilio.plms.service.Plms100100; import com.vilio.plms.service.base.BaseService; import com.vilio.plms.service.base.MessageService; import com.vilio.plms.service.base.OverdueService; import com.vilio.plms.service.quartz.impl.OverdueServiceImpl; import org.apache.log4j.Logger; import org.springframework.aop.framework.AopContext; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.math.BigDecimal; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; /** * Created by martin on 2017/8/25. */ @Service public class OverdueByContractServiceImpl extends BaseService implements OverdueService { private static final Logger logger = Logger.getLogger(OverdueByContractServiceImpl.class); @Resource MessageService messageService; @Resource SysInfoParamDao sysInfoParamDao; @Resource OverdueServiceImpl overdueService; public void overdue(String contractCode,String executeDate) throws ErrorException{ // List<HashMap> accountLockList = (List)sysInfoParamDao.qryAccountLockList(); // Map accountLock = new HashMap(); // if (accountLockList!=null&&accountLockList.size()>0){ // accountLock = accountLockList.get(0); // String itemCval = (String)accountLock.get("itemCval"); // if (itemCval!=null && "Y".equals(itemCval)){ // throw new ErrorException(ReturnCode.UPDATE_FAIL, ""); // } // } // String executeDate = (String)body.get("executeDate"); // SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); // Date executeTime = new Date(); // try { // executeTime = sdf.parse(calculationDate); // }catch(ParseException e){ // throw new ErrorException(ReturnCode.UPDATE_FAIL, ""); // } // List<HashMap> calculateOverdueInterestJobList = (List)sysInfoParamDao.qryCurrentDayOverdueJobList(); // if (calculateOverdueInterestJobList!=null&&calculateOverdueInterestJobList.size()>0){ // for (int i = 0;i<calculateOverdueInterestJobList.size();i++){ // HashMap calculateOverdueInterestJob = calculateOverdueInterestJobList.get(0); // executeTime = (Date)calculateOverdueInterestJob.get("executeTime"); // } // } // Calendar calendar = Calendar.getInstance(); // if (executeTime!=null) { // calendar.setTime(executeTime); // calendar.add(Calendar.DATE,1); // } // Date currentExecuteTime = calendar.getTime(); //计算calculationDate当天的罚息 // String calculationDate = (String)sdf.format(executeTime); //定时任务应该执行的日期 // String currentExecuteDate = (String)sdf.format(currentExecuteTime); // System.out.println(currentExecuteTime); // List<HashMap> payScheduleJobList = (List)sysInfoParamDao.qryCurrentDayPayScheduleJobList(executeDate); // if (payScheduleJobList==null||payScheduleJobList.size()==0){ // throw new ErrorException(ReturnCode.UPDATE_FAIL, ""); // } ((OverdueByContractServiceImpl) AopContext.currentProxy()).calculateOverdue(executeDate,contractCode); } @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED, rollbackFor = Exception.class) public void calculateOverdue(String currentExecuteDate,String contractCode){ Map map = new HashMap(); map.put("currentExecuteDate",currentExecuteDate); map.put("contractCode",contractCode); List<HashMap> overdueFirstDayRepaymentScheduleDetailList = (List)sysInfoParamDao.qryOverdueRepaymentScheduleDetailListByContractNo(map); System.out.println(overdueFirstDayRepaymentScheduleDetailList); if (overdueFirstDayRepaymentScheduleDetailList.size()>0) { for (int i = 0; i < overdueFirstDayRepaymentScheduleDetailList.size(); i++) { HashMap overdueRepaymentScheduleDetail = overdueFirstDayRepaymentScheduleDetailList.get(i); overdueService.calculateOverdueByScheduleDetail(overdueRepaymentScheduleDetail); } } } }
package com.wincentzzz.project.template.springhack.repositories; import com.wincentzzz.project.template.springhack.models.Doctor; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository public interface DoctorRepository extends JpaRepository<Doctor, Long> { Page<Doctor> findDoctorsByNameLikeAndSpecializationLike(String name, String specialization, Pageable pageable); }
/** * Javassonne * http://code.google.com/p/javassonne/ * * @author [Add Name Here] * @date Apr 1, 2009 * * Copyright 2009 Javassonne Team * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied. See the License for the specific language governing * permissions and limitations under the License. */ package org.javassonne.ui; import java.util.ArrayList; import java.util.List; import org.javassonne.messaging.Notification; import org.javassonne.messaging.NotificationManager; import org.javassonne.model.Meeple; import org.javassonne.model.Player; import org.javassonne.model.Tile; import org.javassonne.model.TileBoard; import org.javassonne.model.TileDeck; import org.javassonne.networking.LocalHost; public class GameState { private static final long serialVersionUID = 1L; private static GameState instance_ = null; private ArrayList<Player> players_; private int currentPlayer_; private TileDeck deck_; private Boolean gameInProgress_ = false; private Tile tileInHand_; private TileBoard board_; private List<Meeple> globalMeepleSet_ = new ArrayList<Meeple>(); private Mode mode_; // TODO - Make GameState listeners for appropriate Notifications, so that // the Mode is automatically updated public static enum Mode { PLAYING_LOCAL_GAME("Playing Local Game"), PLAYING_NW_GAME( "Playing Network Game"), IDLE("Idle"), IN_LOBBY("In the lobby"), WAITING( "Waiting for players"); // Paused game, or currently playing the game but stepped out public final String text; Mode(String s) { text = s; } } // Singelton implementation // -------------------------------------------------------- protected GameState() { mode_ = Mode.IN_LOBBY; // listen for the notifications we send. THis may seem backwards, // but we want to receive them if they come from the network so // we can update our data respectively. NotificationManager n = NotificationManager.getInstance(); n.addObserver(Notification.UPDATED_BOARD, this, "updatedBoard"); n.addObserver(Notification.UPDATED_CURRENT_PLAYER, this, "updatedCurrentPlayer"); n.addObserver(Notification.UPDATED_DECK, this, "updatedDeck"); n.addObserver(Notification.UPDATED_GAME_IN_PROGRESS, this, "updatedGameInProgress"); n.addObserver(Notification.UPDATED_TILE_IN_HAND, this, "updatedTileInHand"); n.addObserver(Notification.UPDATED_PLAYERS, this, "updatedPlayers"); n.addObserver(Notification.UPDATED_GLOBAL_MEEPLE_SET, this, "updatedGlobalMeepleSet"); } // Provide access to singleton public static GameState getInstance() { if (instance_ == null) { instance_ = new GameState(); } return instance_; } // Network Receive Functions // -------------------------------------------------------- public void updatedBoard(Notification n){ if (n.receivedFromHost() == true){ board_ = (TileBoard)n.argument(); } } public void updatedCurrentPlayer(Notification n){ if (n.receivedFromHost() == true){ currentPlayer_ = (Integer)n.argument(); } } public void updatedDeck(Notification n){ if (n.receivedFromHost() == true){ deck_ = (TileDeck)n.argument(); } } public void updatedGameInProgress(Notification n){ if (n.receivedFromHost() == true){ gameInProgress_ = (Boolean)n.argument(); } } public void updatedTileInHand(Notification n){ if (n.receivedFromHost() == true){ tileInHand_ = (Tile)n.argument(); } } public void updatedPlayers(Notification n){ if (n.receivedFromHost() == true){ players_ = (ArrayList<Player>)n.argument(); if (mode_ == Mode.PLAYING_NW_GAME){ // Which player are we? Make sure we set ourselves to be local, and make // everyone else remote. That way we don't let the interface place tiles // during their turns. String me = LocalHost.getName(); for (Player p : players_) { if (p.getName().equals(me)) p.setIsLocal(true); else p.setIsLocal(false); } } } } public void updatedGlobalMeepleSet(Notification n){ if (n.receivedFromHost() == true){ globalMeepleSet_ = (List<Meeple>)n.argument(); } } // Convenience Functions // -------------------------------------------------------- public void startGameWithPlayers(ArrayList<Player> players) { // Update our mode setPlayers(players); currentPlayer_ = 0; gameInProgress_ = true; } public void resetGameState() { // Update our mode setMode(Mode.IN_LOBBY); board_ = null; deck_ = null; tileInHand_ = null; gameInProgress_ = false; currentPlayer_ = 0; players_ = null; } public void advanceCurrentPlayer() { currentPlayer_ = (currentPlayer_ + 1) % players_.size(); NotificationManager.getInstance().sendNotification( Notification.UPDATED_CURRENT_PLAYER, currentPlayer_); } // Getters and Setter Functions // -------------------------------------------------------- public Player getCurrentPlayer() { return players_.get(currentPlayer_); } public int getCurrentPlayerIndex() { return currentPlayer_; } public void setCurrentPlayer(int i) { currentPlayer_ = i; NotificationManager.getInstance().sendNotification( Notification.UPDATED_CURRENT_PLAYER, currentPlayer_); } public boolean getGameInProgress() { return gameInProgress_; } public void setGameInProgress(boolean b) { gameInProgress_ = b; if (b) setMode(Mode.PLAYING_LOCAL_GAME); else setMode(Mode.IN_LOBBY); NotificationManager.getInstance().sendNotification( Notification.UPDATED_GAME_IN_PROGRESS, gameInProgress_); } public TileDeck getDeck() { return deck_; } public void setDeck(TileDeck deck) { deck_ = deck; NotificationManager.getInstance().sendNotification( Notification.UPDATED_DECK, deck); } public TileBoard getBoard() { return board_; } public void setBoard(TileBoard board) { board_ = board; NotificationManager.getInstance().sendNotification( Notification.UPDATED_BOARD, board); } public List<Meeple> globalMeepleSet() { return globalMeepleSet_; } public void setGlobalMeepleSet(List<Meeple> list) { globalMeepleSet_ = list; NotificationManager.getInstance().sendNotification( Notification.UPDATED_GLOBAL_MEEPLE_SET, globalMeepleSet_); } public void addMeepleToGlobalMeepleSet(Meeple meeple) { globalMeepleSet_.add(meeple); NotificationManager.getInstance().sendNotification( Notification.UPDATED_GLOBAL_MEEPLE_SET, globalMeepleSet_); } public void removeMeepleFromGlobalMeepleSet(Meeple meeple) { globalMeepleSet_.remove(meeple); NotificationManager.getInstance().sendNotification( Notification.UPDATED_GLOBAL_MEEPLE_SET, globalMeepleSet_); } public ArrayList<Player> getPlayers() { return players_; } public void setPlayers(ArrayList<Player> players) { players_ = players; if (mode_ == Mode.PLAYING_NW_GAME){ // Which player are we? Make sure we set ourselves to be local, and make // everyone else remote. That way we don't let the interface place tiles // during their turns. String me = LocalHost.getName(); for (Player p : players_) { if (p.getName().equals(me)) p.setIsLocal(true); else p.setIsLocal(false); } } NotificationManager.getInstance().sendNotification( Notification.UPDATED_PLAYERS, players_); } public Tile getTileInHand() { return tileInHand_; } public void setTileInHand(Tile t) { tileInHand_ = t; NotificationManager.getInstance().sendNotification( Notification.UPDATED_TILE_IN_HAND, t); } public Mode getMode() { return mode_; } public void setMode(Mode m) { if (m != mode_) NotificationManager.getInstance().sendNotification( Notification.GAME_MODE_CHANGED); mode_ = m; } }
package com.demo.common.exception; /** * Created by lin on 17-6-14. */ public enum ErrorKeyEnum { COMMON_FAIL("00000","操作失败"), COMMON_DELETE_FAIL("00001","operation.delete.fail"), COMMON_ADD_FAIL("00002","operation.add.fail"), COMMON_UPDATE_FAIL("00003","operation.update.fail"), //TODO:暂未设置对应value COMMON_REQUEST_PARAMETER_LESS("00001","请求参数缺失"), COMMON_PAGE_PARAMETER_NOT_FOUND_ERROR("00004","分页参数缺失"), COMMON_DATA_NOT_FOUND("00003","数据不存在"), COMMON_PASSWORD_EMPTY("00004","密码为空"), ; private final String errorCode; private final String errorKey; ErrorKeyEnum(String errorCode, String errorKey){ this.errorCode = errorCode; this.errorKey = errorKey; } public String getErrorCode() { return errorCode; } public String getErrorKey() { return errorKey; } }
package com.reclameaqui.api.repository; import java.util.Optional; import org.springframework.data.mongodb.repository.MongoRepository; import com.reclameaqui.api.documents.Company; public interface CompanyRepository extends MongoRepository<Company, String> { Optional<Company> findByCnpj(String cnpj); }
public class ConstantExamplesTest { public static void main(String[] args) { ConstantExamples ce_1 = new ConstantExamples(10); ConstantExamples ce_2 = new ConstantExamples(20); ConstantExamples ce_3 = new ConstantExamples(30); ce_1.getConstantValues(); System.out.println("****************"); ce_2.getConstantValues(); System.out.println("****************"); ce_3.getConstantValues(); } }
package Classes; public class Main { public static void main(String[] args) throws InvalidFormatTime { // enter time of opening and closing of the cinema System.out.println("Input time of the opening"); Time t = new Time(); t.inputTime(); System.out.println("Input time of the closing"); Time t1 = new Time(); t1.inputTime(); Cinema c= new Cinema(t,t1); c.menu(t,t1); } }
package io.github.boapps.eSzivacs.Datas; /** * Created by boa on 24/09/17. */ public class Teacher { private int id; private String name; private String email; private String phoneNumber; public Teacher(int id, String name, String email, String phoneNumber) { this.id = id; this.name = name; this.email = email; this.phoneNumber = phoneNumber; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPhoneNumber() { return phoneNumber; } public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; } }
package it.geosolutions.fra2015.tags; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.text.ParseException; import java.util.Locale; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.math.NumberUtils; import org.apache.log4j.Logger; public class SumFunction { private static Logger LOGGER = Logger.getLogger(SumFunction.class); private static final DecimalFormat df; static { DecimalFormatSymbols otherSymbols = new DecimalFormatSymbols(Locale.getDefault()); otherSymbols.setDecimalSeparator('.'); df = new DecimalFormat("#.00",otherSymbols); } public static String computeSum(String numbers) { String ret = ""; Double result = 0d; for(String s : StringUtils.splitPreserveAllTokens(numbers,";")){ s = s.trim(); if(s==null || s.isEmpty() || !NumberUtils.isNumber(s)){ //result = null; continue; }else{ try { result = result + df.parse(s).doubleValue(); } catch (ParseException e) { LOGGER.error(e.getMessage(), e); } } } if(result != null){ ret = df.format(result); } return ret; } }
package com.passing.spring.service.impl; import java.util.ArrayList; import java.util.List; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.HttpClient; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import net.sf.json.JSONObject; import com.passing.consts.AccessTokenGenConsts; import com.passing.struts.vo.AdmAccessTokenVo; import com.passing.util.LogUtil; /** * request to Azure DataMarket to get access token * * @author weishijie * */ public class AdmAuthentication { private String clientId; private String clientSecret; public AdmAuthentication(String clientId, String clientSecret) { this.clientId = clientId; this.clientSecret = clientSecret; } public AdmAccessTokenVo GetAccessToken() { try { return HttpPost(AccessTokenGenConsts.DATA_MARKET_ACCESS_URI); } catch (Exception e) { LogUtil.log.info(e); e.printStackTrace(); return null; } } /** * Make a http post request to the token service * * @param DatamarketAccessUri https://datamarket.accesscontrol.windows.net/v2/OAuth2-13 * @return AdmAccessTokenVo object * @throws Exception */ private AdmAccessTokenVo HttpPost(String DatamarketAccessUri) throws Exception { HttpClient httpClient = new DefaultHttpClient(); //建立HttpPost对象 HttpPost httppost = new HttpPost(DatamarketAccessUri); //建立一个NameValuePair数组,用于存储欲传送的参数 List<NameValuePair> params=new ArrayList<NameValuePair>(); //添加参数 params.add(new BasicNameValuePair("client_id", this.clientId)); params.add(new BasicNameValuePair("client_secret", this.clientSecret)); params.add(new BasicNameValuePair("grant_type", AccessTokenGenConsts.GRANT_TYPE)); params.add(new BasicNameValuePair("scope", AccessTokenGenConsts.SCOPE)); //设置编码 httppost.setEntity(new UrlEncodedFormEntity(params, "UTF-8")); //发送Post,并返回一个HttpResponse对象 HttpResponse response = httpClient.execute(httppost); String access_token = ""; String token_type = ""; String expires_in = ""; String scope = ""; //如果状态码为200,就是正常返回 if(response.getStatusLine().getStatusCode() == 200){ //如果是下载文件,可以用response.getEntity().getContent()返回InputStream String result=EntityUtils.toString(response.getEntity()); JSONObject jsonObj = JSONObject.fromObject(result); access_token = jsonObj.getString("access_token"); token_type = jsonObj.getString("token_type"); expires_in = jsonObj.getString("expires_in"); scope = jsonObj.getString("scope"); } AdmAccessTokenVo token = new AdmAccessTokenVo(access_token, token_type, expires_in, scope); return token; } }
import java.util.ArrayList; import java.util.List; import java.util.Vector; public class arraylisttovector { public static void main(String[] args) { List<String> al = new ArrayList<>(); al.add("a"); al.add("s"); al.add("d"); Vector<String> v = new Vector<>(al); System.out.println(v); } }
package com.example.homestay_kha.Controller; import android.content.Context; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.example.homestay_kha.Adapers.Adapter_tien_nghi; import com.example.homestay_kha.Controller.Interface.Tien_nghi_Interface; import com.example.homestay_kha.Model.Tien_nghi_model; import com.example.homestay_kha.R; import java.util.ArrayList; import java.util.List; public class Tien_nghi_Controller { Context context; Tien_nghi_model tien_nghi_model; public Tien_nghi_Controller(Context context, Tien_nghi_model tien_nghi_model) { this.context = context; this.tien_nghi_model = tien_nghi_model; } public void get_listTienNghi_Controller(Context context, RecyclerView recyclerView) { List<Tien_nghi_model> tien_nghi_models = new ArrayList<>(); RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(context); recyclerView.setLayoutManager(layoutManager); Adapter_tien_nghi adapter_tien_nghi = new Adapter_tien_nghi(tien_nghi_models, R.layout.tien_nghi_item,context); recyclerView.setAdapter(adapter_tien_nghi); Tien_nghi_Interface tien_nghi_interface = new Tien_nghi_Interface() { @Override public void getTiennghi(Tien_nghi_model tien_nghi_model) { tien_nghi_models.add(tien_nghi_model); adapter_tien_nghi.notifyDataSetChanged(); } }; tien_nghi_model.getTienNghiModel(tien_nghi_interface); } }
package com.liuxu.providertest; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.app.Activity; import android.content.ContentValues; import android.database.Cursor; public class MainActivity extends Activity implements OnClickListener { private static final String TAG = "MainActivity"; private String newId; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button addData = (Button) findViewById(R.id.add_data); Button queryData = (Button) findViewById(R.id.query_data); Button updateData = (Button) findViewById(R.id.update_data); Button deleteData = (Button) findViewById(R.id.delete_data); addData.setOnClickListener(this); queryData.setOnClickListener(this); updateData.setOnClickListener(this); deleteData.setOnClickListener(this); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.add_data: { Uri uri = Uri.parse("content://com.liuxu.sqlitetest.provider/book"); ContentValues values = new ContentValues(); values.put("name", "A Clash of Kings"); values.put("author", "George Martin"); values.put("pages", 1040); values.put("price", 22.85); Uri newUri = getContentResolver().insert(uri, values); newId = newUri.getPathSegments().get(1); } break; case R.id.query_data: { Uri uri = Uri.parse("content://com.liuxu.sqlitetest.provider/book"); Cursor cursor = getContentResolver().query(uri, null, null, null, null); if (cursor != null) { while (cursor.moveToNext()) { String name = cursor.getString(cursor .getColumnIndex("name")); String author = cursor.getString(cursor .getColumnIndex("author")); int pages = cursor.getInt(cursor.getColumnIndex("pages")); double price = cursor.getDouble(cursor .getColumnIndex("price")); Log.i(TAG, "book name is " + name); Log.i(TAG, "book author is " + author); Log.i(TAG, "book pages is " + pages); Log.i(TAG, "book price is " + price); //Log.i(TAG, newId); } cursor.close(); } } break; case R.id.update_data:{ //Log.i(TAG, newId); Uri uri = Uri.parse("content://com.liuxu.sqlitetest.provider/book/" + newId); ContentValues values = new ContentValues(); values.put("name", "A Storm of Swords"); values.put("pages", 1216); values.put("price", 24.05); getContentResolver().update(uri, values, null, null); } break; case R.id.delete_data: { Uri uri = Uri.parse("content://com.liuxu.sqlitetest.provider/book/" + newId); //Log.i(TAG, newId); getContentResolver().delete(uri, null, null); break; } } } }
package tests; import static org.junit.Assert.*; import org.junit.*; import resource.Player; /** * Unit tests for Player class * @see resource.Player */ public class TestPlayer { private Player player; @Before public void buildUp(){ player = new Player("Fred"); } /** * Check that addScore works correctly */ @Test public void testAddScore(){ player.addScore(1,12); assertTrue(player.getScores().containsValue(12) && player.getScores().containsKey(1)); } /** * Test that player Id is correctly incrementing with every new player */ @Test public void testPlayerIdIncrements(){ assertEquals(2, player.getId()); } /** * Test that a new, higher score for a quiz that's already been played * will replace the existing score in the map */ @Test public void testExistingQuizHigherScore(){ player.addScore(1,12); player.addScore(2,15); player.addScore(1,25); assertEquals(25,(int) player.getScores().get(1)); } /** * Test that a new but LOWER score for quiz that's already been played * will not replace anything and will not be added to the map */ @Test public void testExistingQuizLowerScore(){ player.addScore(1,12); player.addScore(2,15); player.addScore(1,5); assertEquals(12, (int) player.getScores().get(1)); } /** * test getHighScore correctly returns highest score */ @Test public void testGetHighScore(){ player.addScore(1,12); player.addScore(2,12); player.addScore(3,16); player.addScore(4,13); player.addScore(5,153); player.addScore(6,20); assertEquals(153,player.getHighScore()); } /** * Test override of equals() */ @Test public void testEqualsSameNameId(){ Player playerSame = new Player("Fred"); playerSame.setId(6); assertTrue(player.equals(playerSame)); //equality with obj with same name and id } @Test public void testEqualsDifferentNameId(){ Player player1 = new Player("Alan"); assertFalse(player.equals(player1)); //different name and id } @Test public void testEqualsSameNameDiffId(){ Player player2 = new Player("Fred"); assertFalse(player.equals(player2)); //same name, different id } }
/** * Software License Declaration. * <p> * wandaph.com, Co,. Ltd. * Copyright ? 2017 All Rights Reserved. * <p> * Copyright Notice * This documents is provided to wandaph contracting agent or authorized programmer only. * This source code is written and edited by wandaph Co,.Ltd Inc specially for financial * business contracting agent or authorized cooperative company, in order to help them to * install, programme or central control in certain project by themselves independently. * <p> * Disclaimer * If this source code is needed by the one neither contracting agent nor authorized programmer * during the use of the code, should contact to wandaph Co,. Ltd Inc, and get the confirmation * and agreement of three departments managers - Research Department, Marketing Department and * Production Department.Otherwise wandaph will charge the fee according to the programme itself. * <p> * Any one,including contracting agent and authorized programmer,cannot share this code to * the third party without the agreement of wandaph. If Any problem cannot be solved in the * procedure of programming should be feedback to wandaph Co,. Ltd Inc in time, Thank you! */ package com.kingcar.rent.pro.ui.carsource; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.PopupWindow; import android.widget.RadioButton; import android.widget.RadioGroup; import butterknife.Bind; import butterknife.ButterKnife; import com.kingcar.rent.pro.R; import com.kingcar.rent.pro.base.ToolBarActivity; import com.kingcar.rent.pro.widget.SpaceItemDecoration; import com.kingcar.rent.pro.widget.popup.CarScreenPopup; import com.kingcar.rent.pro.widget.popup.CarTypePopup; import razerdp.basepopup.BasePopupWindow; import static com.kingcar.rent.pro.widget.popup.CarTypePopup.CAR_TYPE_STYLE_XML_1; import static com.kingcar.rent.pro.widget.popup.CarTypePopup.CAR_TYPE_STYLE_XML_2; import static razerdp.basepopup.BasePopupWindow.*; /** * @author chenweiji * @version Id: CarSourceListActivity.java, v 0.1 2019/1/3 16:40 chenweiji Exp $$ */ public class CarSourceListActivity extends ToolBarActivity { @Bind(R.id.recyclerView) RecyclerView recyclerView; @Bind(R.id.radioBtn1) RadioButton radioBtn1; @Bind(R.id.radioBtn2) RadioButton radioBtn2; @Bind(R.id.radioBtn3) RadioButton radioBtn3; @Bind(R.id.radioBtn4) RadioButton radioBtn4; @Bind(R.id.radioGroup) RadioGroup radioGroup; private CarTypePopup carTypePopup; private CarTypePopup facadePopup; private CarTypePopup areaPopup; private CarScreenPopup screenPopup; @Override protected int getLayoutResId() { return R.layout.act_car_source_list; } @Override protected void init() { initTitleAndCanBack("奥迪A6"); initPopup(); LinearLayoutManager manager = new LinearLayoutManager(this); manager.setOrientation(LinearLayoutManager.VERTICAL); recyclerView.setLayoutManager(manager); recyclerView.addItemDecoration(new SpaceItemDecoration(5)); recyclerView.setAdapter(new CarSourceListAdapter()); } private void initPopup() { carTypePopup = new CarTypePopup(this,CAR_TYPE_STYLE_XML_1); facadePopup = new CarTypePopup(this,CAR_TYPE_STYLE_XML_2); areaPopup = new CarTypePopup(this,CAR_TYPE_STYLE_XML_2); screenPopup=new CarScreenPopup(this); radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.radioBtn1) { carTypePopup.showPopupWindow(R.id.radioGroup); }else if (checkedId == R.id.radioBtn2) { facadePopup.showPopupWindow(R.id.radioGroup); }else if (checkedId == R.id.radioBtn3) { areaPopup.showPopupWindow(R.id.radioGroup); }else if (checkedId == R.id.radioBtn4) { screenPopup.showPopupWindow(R.id.radioGroup); } } }); // areaPopup.setOnDismissListener(new OnDismissListener() { // @Override // public void onDismiss() { // radioBtn3.setChecked(false); // } // }); // // facadePopup.setOnDismissListener(new OnDismissListener() { // @Override // public void onDismiss() { // radioBtn2.setChecked(false); // } // }); // // screenPopup.setOnDismissListener(new OnDismissListener() { // @Override // public void onDismiss() { // radioBtn4.setChecked(false); // } // }); // // // carTypePopup.setOnDismissListener(new OnDismissListener() { // @Override // public void onDismiss() { // radioBtn1.setChecked(false); // } // }); } class CarSourceListAdapter extends RecyclerView.Adapter { @NonNull @Override public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = LayoutInflater.from(CarSourceListActivity.this).inflate(R.layout.item_car_source_list, parent, false); return new ViewHolder(view); } @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { } @Override public int getItemCount() { return 10; } class ViewHolder extends RecyclerView.ViewHolder { public ViewHolder(View itemView) { super(itemView); } } } }
/* * Copyright (c) 2014 Anthony Benavente * * 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.ambenavente.origins.gameplay.world.level; import org.newdawn.slick.geom.Rectangle; import java.util.Map; /** * Created with IntelliJ IDEA. * * @author Anthony Benavente * @version 2/21/14 */ public class ExitZone { private transient TiledMap parent; private boolean inUse; private int x; private int y; private int tilesWide; private int tilesTall; private int targetId; private Rectangle bounds; public ExitZone(TiledMap parent, int targetId, int x, int y, int tilesWide, int tilesTall) { this.parent = parent; this.targetId = targetId; this.x = x; this.y = y; this.tilesWide = tilesWide; this.tilesTall = tilesTall; this.bounds = new Rectangle(x * parent.getTileWidth(), y * parent.getTileHeight(), tilesWide * parent.getTileHeight(), tilesTall * parent.getTileHeight()); } public Rectangle getBounds() { return bounds; } public int getTargetId() { return targetId; } public boolean isInUse() { return inUse; } public void setInUse(boolean inUse) { this.inUse = inUse; } }
package com.tencent.liteav.beauty.b; public class c extends b { private static final String r = c.class.getSimpleName(); private float A = 0.0f; private f s; private a t; private p u = null; private int v = -1; private int w = -1; private float x = 0.0f; private float y = 0.0f; private float z = 0.0f; public int b(int i) { if (this.x > 0.0f || this.y > 0.0f || this.z > 0.0f) { int b; if (this.x != 0.0f) { b = this.s.b(i); } else { b = i; } i = this.t.a(b, i, i); } if (this.A > 0.0f) { return this.u.b(i); } return i; } public void a(int i, int i2) { if (this.v != i || this.w != i2) { new StringBuilder("onOutputSizeChanged mFrameWidth = ").append(i).append(" mFrameHeight = ").append(i2); this.v = i; this.w = i2; b(this.v, this.w); } } public boolean b(int i, int i2) { this.v = i; this.w = i2; new StringBuilder("init mFrameWidth = ").append(i).append(" mFrameHeight = ").append(i2); if (this.s == null) { this.s = new f(); this.s.a(true); if (!this.s.a()) { return false; } } this.s.a(this.v, this.w); if (this.t == null) { this.t = new a(); this.t.a(true); if (!this.t.a()) { return false; } } this.t.a(this.v, this.w); if (this.u == null) { this.u = new p(); this.u.a(true); if (!this.u.a()) { return false; } } this.u.a(this.v, this.w); return true; } public void e() { if (this.t != null) { this.t.d(); this.t = null; } if (this.s != null) { this.s.d(); this.s = null; } if (this.u != null) { this.u.d(); this.u = null; } } public void c(int i) { this.x = (float) i; if (this.t != null) { this.t.a((float) i); } } public void d(int i) { this.y = (float) i; if (this.t != null) { this.t.b((float) i); } } public void e(int i) { this.z = (float) i; if (this.t != null) { this.t.c((float) i); } } public void f(int i) { this.A = ((float) i) / 15.0f; if (this.u != null) { this.u.a(this.A); } } private static float b(float f) { if (f <= 1.0f) { return 0.1f; } if (((double) f) < 2.5d) { f = a((f - 1.0f) / 1.5f, 1.0f, 4.1f); } else if (f < 4.0f) { f = a((f - 2.5f) / 1.5f, 4.1f, 5.6f); } else if (((double) f) < 5.5d) { f = a((f - 4.0f) / 1.5f, 5.6f, 6.8f); } else if (((double) f) <= 7.0d) { f = a((f - 5.5f) / 1.5f, 6.8f, 7.0f); } return f / 10.0f; } private static float a(float f, float f2, float f3) { return ((f3 - f2) * f) + f2; } }
package quiz03; import java.util.Scanner; public class MainClass { /* * 현실에서 찾아볼 수 있는 물건등을 생각해서 클래스로 표현 * 멤버변수 2개이상, 메서드 2개이상 */ public static void main(String[] args) { DoorLock door = new DoorLock(); door.Menu(); } }
package app.home; import com.hqb.patshop.PatshopApplication; import com.hqb.patshop.app.home.service.impl.HomeServiceImpl; import com.hqb.patshop.app.login.service.LoginService; import com.hqb.patshop.mbg.dao.PmsProductCategoryDao; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(classes = {PatshopApplication.class}) public class HomeControllerTest { @Autowired private HomeServiceImpl homeService; @Autowired private LoginService loginService; @Autowired private PmsProductCategoryDao categoryDao; @Test public void testContent() { System.out.println(homeService.content()); } @Test public void testHomeBidProduct() { System.out.println(homeService.homeBidProduct("生活百货")); } @Test public void testProductDetail() { System.out.println(homeService.productDetail(28).getPmsProductModel()); } @Test public void testHomeHotBid() { System.out.println(homeService.homeHotProduct()); } @Test public void testLogin() { System.out.println(loginService.login(190)); } @Test public void testBid() { System.out.println("bid result " + homeService.bidProduct(28, 15.0, "18378583474")); } @Test public void testCategoryName(){ System.out.println(categoryDao.selectByCategoryName("生活百货")); } }
package com.elvarg.net.packet; import io.netty.buffer.ByteBuf; /** * Manages reading packet information from the netty's channel. * * @author relex lawl */ public class Packet { /** * The Packet constructor. * @param opcode The packet id. * @param packetType The packetType of packet being read. * @param buffer The buffer used to receive information from the netty's channel. */ public Packet(int opcode, ByteBuf buffer) { this.opcode = opcode; this.buffer = buffer; } /** * The packet id being received. */ private final int opcode; /** * Gets the packet id. * @return The packet id being sent. */ public int getOpcode() { return opcode; } /** * The buffer being used to read the packet information. */ private ByteBuf buffer; /** * Gets the buffer used to receive the packet information. * @return The ChannelBuffer instance. */ public ByteBuf getBuffer() { return buffer; } /** * Gets the size of the packet being read. * @return The size of the packet. */ public int getSize() { return buffer.readableBytes(); } public int getLength() { return buffer.capacity(); } /** * Reads an unsigned byte from the packet. * @return The unsigned byte. */ public byte readByte() { byte b = 0; try { b = buffer.readByte(); } catch(Exception e) { } return b; } /** * Reads a packetType-A byte from the packet. * @return The unsigned byte - 128. */ public byte readByteA() { return (byte) (readByte() - 128); } /** * Reads an inverse (negative) unsigned byte from the packet. * @return readByte() */ public byte readByteC() { return (byte) (-readByte()); } /** * Reads a packetType-S byte from the packet. * @return 128 - the unsigned byte value. */ public byte readByteS() { return (byte) (128 - readByte()); } /** * Reads an unsigned packetType-S byte from the packet. * @return The unsigned readByteS value. */ public int readUnsignedByteS() { return readByteS() & 0xff; } /** * Reads a byte array from the packet */ public Packet readBytes(byte[] bytes) { buffer.readBytes(bytes); return this; } /** * Reads said amount of bytes from the packet. * @param amount The amount of bytes to read. * @return The bytes array values. */ public byte[] readBytes(int amount) { byte[] bytes = new byte[amount]; for (int i = 0; i < amount; i++) { bytes[i] = readByte(); } return bytes; } /** * Reads the amount of bytes packetType-A. * @param amount The amount of bytes packetType-A to read. * @return The bytes array values. */ public byte[] readBytesA(int amount) { if (amount < 0) throw new NegativeArraySizeException("The byte array amount cannot have a negative value!"); byte[] bytes = new byte[amount]; for (int i = 0; i < amount; i++) { bytes[i] = (byte) (readByte() + 128); } return bytes; } /** * Reads said amount of reversed-bytes from the packet. * @param amount The amount of bytes to read. * @return The bytes array values. */ public byte[] readReversedBytesA(int amount) { byte[] bytes = new byte[amount]; int position = amount - 1; for (; position >= 0; position--) { bytes[position] = (byte) (readByte() + 128); } return bytes; } /** * Reads an unsigned byte. * @return The unsigned byte value read from the packet. */ public int readUnsignedByte() { return buffer.readUnsignedByte(); } /** * Reads a short value. * @return The short value read from the packet. */ public short readShort() { return buffer.readShort(); } /** * Reads a short packetType-A from the packet. * @return The short packetType-A value. */ public short readShortA() { int value = ((readByte() & 0xFF) << 8) | (readByte() - 128 & 0xFF); return (short) (value > 32767 ? value - 0x10000 : value); } /** * Reads a little-endian short from the packet. * @return The little-endian short value. */ public short readLEShort() { int value = (readByte() & 0xFF) | (readByte() & 0xFF) << 8; return (short) (value > 32767 ? value - 0x10000 : value); } /** * Reads a little-endian packetType-A short from the packet. * @return The little-endian packetType-A short value. */ public short readLEShortA() { int value = (readByte() - 128 & 0xFF) | (readByte() & 0xFF) << 8; return (short) (value > 32767 ? value - 0x10000 : value); } /** * Reads the unsigned short value from the packet. * @return The unsigned short value. */ public int readUnsignedShort() { return buffer.readUnsignedShort(); } /** * Reads the unsigned short value packetType-A from the packet. * @return The unsigned short packetType-A value. */ public int readUnsignedShortA() { int value = 0; value |= readUnsignedByte() << 8; value |= (readByte() - 128) & 0xff; return value; } /** * Reads an int value from the packet. * @return The int value. */ public int readInt() { return buffer.readInt(); } /** * Reads a single int value from the packet. * @return The single int value. */ public int readSingleInt() { byte firstByte = readByte(), secondByte = readByte(), thirdByte = readByte(), fourthByte = readByte(); return ((thirdByte << 24) & 0xFF) | ((fourthByte << 16) & 0xFF) | ((firstByte << 8) & 0xFF) | (secondByte & 0xFF); } /** * Reads a double int value from the packet. * @return The double int value. */ public int readDoubleInt() { int firstByte = readByte() & 0xFF, secondByte = readByte() & 0xFF, thirdByte = readByte() & 0xFF, fourthByte = readByte() & 0xFF; return ((secondByte << 24) & 0xFF) | ((firstByte << 16) & 0xFF) | ((fourthByte << 8) & 0xFF) | (thirdByte & 0xFF); } /** * Reads a triple int value from the packet. * @return The triple int value. */ public int readTripleInt() { return ((readByte() << 16) & 0xFF) | ((readByte() << 8) & 0xFF) | (readByte() & 0xFF); } /** * Reads the long value from the packet. * @return The long value. */ public long readLong() { return buffer.readLong(); } public byte[] getBytesReverse(int amount, ValueType type) { byte[] data = new byte[amount]; int dataPosition = 0; for (int i = buffer.writerIndex() + amount - 1; i >= buffer.writerIndex(); i--) { int value = buffer.getByte(i); switch (type) { case A: value -= 128; break; case C: value = -value; break; case S: value = 128 - value; break; case STANDARD: break; } data[dataPosition++] = (byte) value; } return data; } /** * Reads the string value from the packet. * @return The string value. */ public String readString() { StringBuilder builder = new StringBuilder(); byte value; while (buffer.isReadable() && (value = buffer.readByte()) != 10) { builder.append((char) value); } return builder.toString(); } /** * Reads a smart value from the packet. * @return The smart value. */ public int readSmart() { return buffer.getByte(buffer.readerIndex()) < 128 ? readByte() & 0xFF : (readShort() & 0xFFFF) - 32768; } /** * Reads a signed smart value from the packet. * @return The signed smart value. */ public int readSignedSmart() { return buffer.getByte(buffer.readerIndex()) < 128 ? (readByte() & 0xFF) - 64 : (readShort() & 0xFFFF) - 49152; } @Override public String toString() { return "Packet - [opcode, size] : [" + getOpcode() + ", " + getSize() + "]"; } }