blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
132
path
stringlengths
2
382
src_encoding
stringclasses
34 values
length_bytes
int64
9
3.8M
score
float64
1.5
4.94
int_score
int64
2
5
detected_licenses
listlengths
0
142
license_type
stringclasses
2 values
text
stringlengths
9
3.8M
download_success
bool
1 class
40ee911556428dac1fe611595ad2e8373a1224a6
Java
liveqmock/EASExt
/src/com/creditease/eas/hr/service/impl/BankInformationServiceImpl.java
UTF-8
961
2.078125
2
[]
no_license
package com.creditease.eas.hr.service.impl; import java.util.Map; import org.springframework.stereotype.Service; import com.creditease.eas.hr.kingdee.query.BankInformationQuery; import com.creditease.eas.hr.service.IBankInformationService; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @Service("bankInformationServiceImpl") public class BankInformationServiceImpl implements IBankInformationService { BankInformationQuery bankquery=new BankInformationQuery(); @Override public String getBankInfo(int pageSize, int pageNo) { Map<String, Object> map=bankquery.getBankInfo(pageSize, pageNo); Gson gson=new GsonBuilder().create(); String json=gson.toJson(map); return json; } @Override public String getBankInfoById(String fid, int pageSize, int pageNo) { Map<String, Object> map=bankquery.getBankInfoById(fid, pageSize, pageNo); Gson gson=new GsonBuilder().create(); String json=gson.toJson(map); return json; } }
true
3884ed3be7b01ef09950deff248c72cf2cd1e545
Java
pablixa/PSW1
/Cliente/src/cliente/Cliente.java
UTF-8
582
2.875
3
[]
no_license
package cliente; import java.io.IOException; import java.net.Socket; import java.util.Scanner; import java.util.logging.Level; import java.util.logging.Logger; public class Cliente { public static void main(String[] args) { Scanner tec = new Scanner(System.in); try { Socket clientSocket = new Socket("localhost", 1234); } catch (IOException ex) { Logger.getLogger(Cliente.class.getName()).log(Level.SEVERE, null, ex); } System.out.println("Conexão realizada com sucesso!"); } }
true
75b8db4d3d9abb1724717cc1f2904462f50fb81c
Java
HectorWatanabe/PATTERN-DESIGN
/CREACIONALES/src/Builder/Usuario.java
UTF-8
1,740
3.1875
3
[]
no_license
/* * 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 Builder; /** * * @author Hector */ public class Usuario { private String usuario; private String contrasena; private boolean extender; private String correo; private String direccion; private Usuario(String usuario, String contrasena) { this.usuario = usuario; this.contrasena = contrasena; this.correo = ""; this.direccion = ""; } public static Usuario make(String usuario, String contrasena){ return new Usuario(usuario, contrasena); } public BuilderUsuario setExtender(boolean extender) { if(!extender){ throw new IllegalArgumentException("No es posible asignar falso"); } this.extender = extender; return new BuilderUsuario(this); } public static class BuilderUsuario{ private Usuario usuario; public BuilderUsuario(Usuario usuario){ this.usuario = usuario; } public BuilderUsuario setCorreo(String correo) { this.usuario.correo = correo; return this; } public BuilderUsuario setDireccion(String direccion) { this.usuario.direccion = direccion; return this; } public Usuario build(){ return usuario; } } @Override public String toString() { return this.usuario + " " + this.contrasena + " " + this.correo + " " + this.direccion; } }
true
306a0d93c3252231002af5fafa5069b75ad4b752
Java
OSGP/open-smart-grid-platform
/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/glue/steps/ws/smartmetering/smartmeteringbundle/BundledSetRandomisationSettingsSteps.java
UTF-8
1,018
1.742188
2
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
// SPDX-FileCopyrightText: Copyright Contributors to the GXF project // // SPDX-License-Identifier: Apache-2.0 package org.opensmartgridplatform.cucumber.platform.smartmetering.glue.steps.ws.smartmetering.smartmeteringbundle; import io.cucumber.java.en.Given; import java.util.Map; import org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.SetRandomisationSettingsRequest; import org.opensmartgridplatform.cucumber.platform.smartmetering.support.ws.smartmetering.bundle.SetRandomisationSettingsRequestBuilder; public class BundledSetRandomisationSettingsSteps extends BaseBundleSteps { @Given("the bundle request contains a set randomisation settings action with parameters") public void theBundleRequestContainsASetRandomisationSettingsActionWithParameters( final Map<String, String> parameters) { final SetRandomisationSettingsRequest action = new SetRandomisationSettingsRequestBuilder().fromParameterMap(parameters).build(); this.addActionToBundleRequest(action); } }
true
4ed1059d8c2c544ae08234e35a94368bddfc7001
Java
medic0803/Ginkgo-RnD-Project-Floodlight
/src/main/java/org/sdnplatform/sync/client/ShellCommand.java
UTF-8
2,080
2.6875
3
[ "Apache-2.0" ]
permissive
package org.sdnplatform.sync.client; import java.io.IOException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.MappingJsonFactory; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; /** * A user command for the command line client * @author readams */ public abstract class ShellCommand { protected static final ObjectMapper mapper = new ObjectMapper(); protected static final MappingJsonFactory mjf = new MappingJsonFactory(mapper); static { mapper.configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true); } /** * Execute the command on the given tokens * @param tokens the argument tokens. The first token will be the command * @param line the whole command line * @return whether to exit the shell after the command */ public abstract boolean execute(String[] tokens, String line) throws Exception; /** * Return syntax description * @return the syntax string */ public abstract String syntaxString(); /** * Parse a JSON object * @param jp the JSON parse * @return the JSON node * @throws IOException */ protected JsonNode validateJson(JsonParser jp) throws IOException { JsonNode parsed = null; try { parsed = jp.readValueAsTree(); } catch (JsonProcessingException e) { System.err.println("Could not parse JSON: " + e.getMessage()); return null; } return parsed; } /** * Serialize a JSON object as bytes * @param value the object to serialize * @return the serialized bytes * @throws Exception */ protected byte[] serializeJson(JsonNode value) throws Exception { return mapper.writeValueAsBytes(value); } }
true
aedc49d408142d13f1969634a57dfde45590106c
Java
meirshved/Gatechub-Facebook
/src/test/java/ProjectTestBase.java
UTF-8
1,225
1.9375
2
[]
no_license
import com.aventstack.extentreports.ExtentReports; import com.aventstack.extentreports.ExtentTest; import org.junit.After; import org.junit.AfterClass; import org.junit.BeforeClass; import org.openqa.selenium.WebDriver; public class ProjectTestBase { protected static WebDriver driverFirefox; protected static ExtentReports extentReports; protected static ExtentTest extentTest; protected static CommonMethods commonMethods = new CommonMethods(); protected static boolean passed = false; @BeforeClass public static void projectTestBase(){ // webDriver for the ptoject commonMethods.setWebDriver(); driverFirefox = commonMethods.getDriverFirefox(); // extentReport for the project commonMethods.setExtentReports(); extentReports = commonMethods.getExtentReports(); // ExtentTest extentTest = extentReports.createTest("Gatechub-Facebook","open, navigate, refresh"); } @After public void afterEachTest(){ passed = false; } @AfterClass public static void tearsDown() throws InterruptedException { Thread.sleep(1000); extentReports.flush(); driverFirefox.quit(); } }
true
09d4e10eeb060bab80e730a1dbd702385f78fdea
Java
Eliatt/CouponSystem
/Coupon/src/main/java/dao/CustomerDAO.java
UTF-8
337
2.109375
2
[]
no_license
package dao; import entities.Customer; public interface CustomerDAO { Boolean isCustomerExists(String email, String password); void addCustomer(Customer customer); void updateCustomer(Customer customer); void deleteCustomer(Long customerID); Customer getOneCustomer(Long customerID); }
true
533667710c9682da2aa4972d2c0e01b718464cc0
Java
SerhiisTest/testExercise
/src/main/java/ua/in/poddyachiy/organization/project/entity/Exam.java
UTF-8
1,329
2.234375
2
[]
no_license
package ua.in.poddyachiy.organization.project.entity; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; /** * @author spid * @since */ @Entity @Table(name = "EXAM") public class Exam { @Id @Column(name = "EXAM_ID") Integer exam_id; @Column(name = "COURSE_ID") Integer courseId; @Column(name = "TITLE") private String title; @Column(name = "KNOWLEGDE_LEVEL") private String knowledgeLevel; @Column(name = "APPROXIMATE_DURATION_MINS") private Integer approximateDurationMins; public Integer getExam_id() { return exam_id; } public void setExam_id(Integer exam_id) { this.exam_id = exam_id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getKnowledgeLevel() { return knowledgeLevel; } public void setKnowledgeLevel(String knowledgeLevel) { this.knowledgeLevel = knowledgeLevel; } public Integer getApproximateDurationMins() { return approximateDurationMins; } public void setApproximateDurationMins(Integer approximateDurationMins) { this.approximateDurationMins = approximateDurationMins; } }
true
89bd4e189288d4c9a27a279b920f642cc465c2bc
Java
Samuel-Oliveira/Java-Efd-Icms
/src/main/java/br/com/swconsultoria/efd/icms/registros/blocoC/RegistroC791.java
UTF-8
1,181
2.046875
2
[ "MIT" ]
permissive
/** * */ package br.com.swconsultoria.efd.icms.registros.blocoC; import lombok.EqualsAndHashCode; /** * @author Samuel Oliveira */ @EqualsAndHashCode public class RegistroC791 { private final String reg = "C791"; private String uf; private String vl_bc_icms_st; private String vl_icms_st; /** * @return the uf */ public String getUf() { return uf; } /** * @param uf the uf to set */ public void setUf(String uf) { this.uf = uf; } /** * @return the vl_bc_icms_st */ public String getVl_bc_icms_st() { return vl_bc_icms_st; } /** * @param vl_bc_icms_st the vl_bc_icms_st to set */ public void setVl_bc_icms_st(String vl_bc_icms_st) { this.vl_bc_icms_st = vl_bc_icms_st; } /** * @return the vl_icms_st */ public String getVl_icms_st() { return vl_icms_st; } /** * @param vl_icms_st the vl_icms_st to set */ public void setVl_icms_st(String vl_icms_st) { this.vl_icms_st = vl_icms_st; } /** * @return the reg */ public String getReg() { return reg; } }
true
87d416dad609d135d2520bdb1a2fa0e48883f2f7
Java
SFV-CORE/ETEC3
/Programacao_computadores/JMenu/src/jmenu/JConFuncionarios.java
UTF-8
17,868
1.960938
2
[]
no_license
/* * 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 jmenu; /** * * @author Lenovo */ public class JConFuncionarios extends javax.swing.JFrame { /** * Creates new form JConFuncionarios */ public JConFuncionarios() { initComponents(); this.setLocationRelativeTo(null); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { btnConsultar = new javax.swing.JButton(); lblTitulo = new javax.swing.JLabel(); lblCargo = new javax.swing.JLabel(); txtCdFun = new javax.swing.JTextField(); txtNome = new javax.swing.JTextField(); lblCdFun = new javax.swing.JLabel(); lblNome = new javax.swing.JLabel(); lblSexo = new javax.swing.JLabel(); lblDtAd = new javax.swing.JLabel(); ftxtDtAd = new javax.swing.JFormattedTextField(); btnLimpar = new javax.swing.JButton(); txtSexo = new javax.swing.JTextField(); txtCargo = new javax.swing.JTextField(); jMenuBar1 = new javax.swing.JMenuBar(); jmMenuPrincipal = new javax.swing.JMenu(); btnMenuPrincipal = new javax.swing.JMenuItem(); jmCadAlt = new javax.swing.JMenu(); btnCadAltCargos = new javax.swing.JMenuItem(); btnCadAltFuncionarios = new javax.swing.JMenuItem(); jmConsulta = new javax.swing.JMenu(); btnConCargo = new javax.swing.JMenuItem(); btnConFuncionarios = new javax.swing.JMenuItem(); jmOpcoes = new javax.swing.JMenu(); btnSair = new javax.swing.JMenuItem(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Consultar Funcionários"); btnConsultar.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N btnConsultar.setText("Consultar"); btnConsultar.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); lblTitulo.setFont(new java.awt.Font("SansSerif", 0, 18)); // NOI18N lblTitulo.setText("Consulta de Funcionário"); lblCargo.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N lblCargo.setText("Cargo"); txtCdFun.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N txtNome.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N lblCdFun.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N lblCdFun.setText("Código do Funcionário"); lblNome.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N lblNome.setText("Nome "); lblSexo.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N lblSexo.setText("Sexo"); lblDtAd.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N lblDtAd.setText("Data de admissão"); ftxtDtAd.setEnabled(false); btnLimpar.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N btnLimpar.setText("Limpar"); btnLimpar.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); txtSexo.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N txtSexo.setEnabled(false); txtCargo.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N txtCargo.setEnabled(false); jmMenuPrincipal.setText("Menu Principal"); jmMenuPrincipal.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); jmMenuPrincipal.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N btnMenuPrincipal.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N btnMenuPrincipal.setText("Menu Principal"); btnMenuPrincipal.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnMenuPrincipal.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnMenuPrincipalActionPerformed(evt); } }); jmMenuPrincipal.add(btnMenuPrincipal); jMenuBar1.add(jmMenuPrincipal); jmCadAlt.setText("Cadastro/Alterar"); jmCadAlt.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); jmCadAlt.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N btnCadAltCargos.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N btnCadAltCargos.setText("Cargos"); btnCadAltCargos.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnCadAltCargos.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnCadAltCargosActionPerformed(evt); } }); jmCadAlt.add(btnCadAltCargos); btnCadAltFuncionarios.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N btnCadAltFuncionarios.setText("Funcionários"); btnCadAltFuncionarios.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnCadAltFuncionarios.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnCadAltFuncionariosActionPerformed(evt); } }); jmCadAlt.add(btnCadAltFuncionarios); jMenuBar1.add(jmCadAlt); jmConsulta.setText("Consulta"); jmConsulta.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); jmConsulta.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N btnConCargo.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N btnConCargo.setText("Cargos"); btnConCargo.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnConCargo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnConCargoActionPerformed(evt); } }); jmConsulta.add(btnConCargo); btnConFuncionarios.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N btnConFuncionarios.setText("Funcionários"); btnConFuncionarios.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnConFuncionarios.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnConFuncionariosActionPerformed(evt); } }); jmConsulta.add(btnConFuncionarios); jMenuBar1.add(jmConsulta); jmOpcoes.setText("Opções"); jmOpcoes.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); jmOpcoes.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N btnSair.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N btnSair.setText("Sair"); btnSair.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnSair.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnSairActionPerformed(evt); } }); jmOpcoes.add(btnSair); jMenuBar1.add(jmOpcoes); setJMenuBar(jMenuBar1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap(40, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lblCdFun) .addComponent(lblNome)) .addGap(74, 74, 74) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txtNome, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtCdFun, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lblSexo) .addComponent(lblCargo) .addComponent(lblDtAd) .addComponent(btnLimpar, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(104, 104, 104) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(txtSexo, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(ftxtDtAd, javax.swing.GroupLayout.DEFAULT_SIZE, 108, Short.MAX_VALUE) .addComponent(txtCargo))) .addGroup(layout.createSequentialGroup() .addGap(86, 86, 86) .addComponent(btnConsultar))))) .addGap(34, 34, 34)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(lblTitulo, javax.swing.GroupLayout.PREFERRED_SIZE, 206, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(105, 105, 105)))) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(26, 26, 26) .addComponent(lblTitulo) .addGap(38, 38, 38) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtCdFun, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lblCdFun)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtNome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lblNome)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtSexo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lblSexo)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblDtAd) .addComponent(ftxtDtAd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblCargo) .addComponent(txtCargo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 33, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btnLimpar) .addComponent(btnConsultar)) .addGap(47, 47, 47)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void btnCadAltCargosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCadAltCargosActionPerformed // TODO add your handling code here: new JCadAltCargo().setVisible(true); this.dispose(); }//GEN-LAST:event_btnCadAltCargosActionPerformed private void btnCadAltFuncionariosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCadAltFuncionariosActionPerformed // TODO add your handling code here: new JCadAltFuncionario().setVisible(true); this.dispose(); }//GEN-LAST:event_btnCadAltFuncionariosActionPerformed private void btnConCargoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnConCargoActionPerformed // TODO add your handling code here: new JConCargo().setVisible(true); this.dispose(); }//GEN-LAST:event_btnConCargoActionPerformed private void btnConFuncionariosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnConFuncionariosActionPerformed // TODO add your handling code here: new JConFuncionarios().setVisible(true); this.dispose(); }//GEN-LAST:event_btnConFuncionariosActionPerformed private void btnSairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSairActionPerformed // TODO add your handling code here: System.exit(0); }//GEN-LAST:event_btnSairActionPerformed private void btnMenuPrincipalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMenuPrincipalActionPerformed // TODO add your handling code here: new JMenuPrincipal().setVisible(true); this.dispose(); }//GEN-LAST:event_btnMenuPrincipalActionPerformed /** * @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(JConFuncionarios.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(JConFuncionarios.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(JConFuncionarios.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(JConFuncionarios.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 JConFuncionarios().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JMenuItem btnCadAltCargos; private javax.swing.JMenuItem btnCadAltFuncionarios; private javax.swing.JMenuItem btnConCargo; private javax.swing.JMenuItem btnConFuncionarios; private javax.swing.JButton btnConsultar; private javax.swing.JButton btnLimpar; private javax.swing.JMenuItem btnMenuPrincipal; private javax.swing.JMenuItem btnSair; private javax.swing.JFormattedTextField ftxtDtAd; private javax.swing.JMenuBar jMenuBar1; private javax.swing.JMenu jmCadAlt; private javax.swing.JMenu jmConsulta; private javax.swing.JMenu jmMenuPrincipal; private javax.swing.JMenu jmOpcoes; private javax.swing.JLabel lblCargo; private javax.swing.JLabel lblCdFun; private javax.swing.JLabel lblDtAd; private javax.swing.JLabel lblNome; private javax.swing.JLabel lblSexo; private javax.swing.JLabel lblTitulo; private javax.swing.JTextField txtCargo; private javax.swing.JTextField txtCdFun; private javax.swing.JTextField txtNome; private javax.swing.JTextField txtSexo; // End of variables declaration//GEN-END:variables }
true
29e3069455d0f90b866f8e96f401307dbf6c47a2
Java
lluohao/book
/src/com/code/servlet/GetUserMsgServlet.java
UTF-8
1,028
2.234375
2
[]
no_license
package com.code.servlet; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import net.sf.json.JSONObject; import com.code.entity.User; import com.code.service.IUserService; import com.code.service.fact.ServiceFactory; public class GetUserMsgServlet extends HttpServlet { @Override protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String userIdStr=request.getParameter("userId"); int userId=0; try{ userId=Integer.parseInt(userIdStr); }catch(Exception e){} IUserService userService=ServiceFactory.getInstance().newUserService(); User user=userService.findUser(userId); JSONObject obj=JSONObject.fromObject(user); response.setContentType("text/html;charset=UTF-8"); PrintWriter out=response.getWriter(); out.print(obj.toString()); } }
true
abf4561d5a627b5427bd1ebeec17a4b8b74248e1
Java
MiguelBCN/Ejercicios-Programacion1-UB
/Fibonnacci.java
UTF-8
442
3.40625
3
[]
no_license
public class Fibonnacci { public static void main(String[] args) { int x = 1, y = 1, z; System.out.println(x); System.out.println(y); for (int i = 0; i < 45; i++) { z = sum(x, y); x = y; y = z; System.out.println(z); } System.out.println("ENd"); } public static int sum(int val1, int val2) { return val1 + val2; } }
true
48312964cde64d27f8eaaaa6116a27ec97047660
Java
syurov/quartz-ui
/server/core/quartz-ui-database/src/main/java/com/easy/quartz/database/Config.java
UTF-8
682
1.867188
2
[ "Apache-2.0" ]
permissive
package com.easy.quartz.database; import liquibase.integration.spring.SpringLiquibase; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import javax.sql.DataSource; @Configuration public class Config { @Autowired DataSource dataSource; @Bean SpringLiquibase liquibase() { SpringLiquibase springLiquibase = new SpringLiquibase(); springLiquibase.setChangeLog("classpath:db/changelog/db.changelog-master.xml"); springLiquibase.setDataSource(dataSource); //springLiquibase.setDropFirst(true); return springLiquibase; } }
true
853d23b8f9ac1f104ae3da321f0462ac1dcf0ad7
Java
meishanjianke/netty-demo
/src/main/java/com/alibaba/netty/dubborpc/publicinterface/HelloService.java
UTF-8
135
1.75
2
[]
no_license
package com.alibaba.netty.dubborpc.publicinterface; /** * 接口 */ public interface HelloService { String hello(String mes); }
true
81aa29e9e6e7a5bdce980194fd1e4681f8dde9f8
Java
arish7792/JavaProgramsPractice
/Node1.java
UTF-8
261
2.671875
3
[]
no_license
package practice; public class Node1 { int data; Node1 next; Node1(int data){ this.data = data; this.next = null; } public static void main(String[] args) { Node1 first = new Node1(1); first.next = new Node1(2); //first.next.next } }
true
6ed4a6211a2e233914a0e491123dab6108bcb9ed
Java
alt-ee/swengproject
/src/main/java/datastorage/LineDataStorage.java
UTF-8
2,373
3.65625
4
[]
no_license
package datastorage; import java.awt.Color; import java.util.Objects; public class LineDataStorage { private final int x1; private final int y1; private final int x2; private final int y2; private final Color colour; private final int duration; /** * Construct a line * * @param x1 X coordinate of start point * @param y1 Y coordinate of start point * @param x2 X coordinate of end point * @param y2 Y coordinate of end point * @param colour Colour of the shape as a java.awt.Color object * @param duration Duration to display the shape for in seconds. If 0 then shape will be displayed indefinitely. */ public LineDataStorage(int x1, int y1, int x2, int y2, Color colour, int duration) { this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2; this.colour = colour; this.duration = duration; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; LineDataStorage that = (LineDataStorage) o; return x1 == that.x1 && y1 == that.y1 && x2 == that.x2 && y2 == that.y2 && duration == that.duration && colour.equals(that.colour); } @Override public int hashCode() { return Objects.hash(x1, y1, x2, y2, colour, duration); } /** * @return X coordinate of start point */ public int getX1() { return x1; } /** * @return Y coordinate of start point */ public int getY1() { return y1; } /** * @return X coordinate of end point */ public int getX2() { return x2; } /** * @return Y coordinate of end point */ public int getY2() { return y2; } /** * @return colour of shape */ public Color getColour() { return colour; } //return colour in form of hex string public String getColourInHex() { int RGB = colour.getRGB(); String hex = String.format("#%06X", (0xffffff & RGB)); return hex; } /** * @return duration to display shape for */ public int getDuration() { return duration; } }
true
5006009faae42884459a74aa8be8efeb57f3f4d6
Java
DanielZim/JavaFXEagle
/Eagle-Demonstrator/src/model/sceneObjects/coordinateTransformables/Signal.java
UTF-8
8,219
2.671875
3
[]
no_license
package model.sceneObjects.coordinateTransformables; import javafx.scene.Group; import javafx.scene.Node; import model.BoundingBox; import model.ContactRef; import model.sceneObjects.EagleBoard; import utils.CoordinateTransformer; import java.util.ArrayList; import java.util.Collection; import java.util.List; /** * The type Signal. */ public class Signal implements ICoordinateTransformable { // required private EagleBoard board; private String name; // optional private int classNumber; private boolean airWiresHidden; private List<ContactRef> contactRefs; private List<EaglePolygon> polygons; private List<Wire> wires; private List<Via> vias; private boolean isSetClassNumber; private boolean isSetAirWiresHidden; private boolean isSetContactRefs; private boolean isSetPolygons; private boolean isSetWires; private boolean isSetVias; /** * Instantiates a new Signal. * * @param board the board * @param name the name */ public Signal(EagleBoard board, String name) { this.board = board; this.name = name; this.classNumber = 0; this.airWiresHidden = false; this.contactRefs = new ArrayList<>(); this.polygons = new ArrayList<>(); this.wires = new ArrayList<>(); this.vias = new ArrayList<>(); this.isSetClassNumber = false; this.isSetAirWiresHidden = false; this.isSetContactRefs = false; this.isSetPolygons = false; this.isSetWires = false; this.isSetVias = false; } @Override public Node getSceneNode() { return getSceneNode(0, 0); } @Override public Node getSceneNode(double referenceX, double referenceY) { Group sceneNode = new Group(); if(getIsSetPolygons()) { for (EaglePolygon poly : getPolygons()) { sceneNode.getChildren().add(poly.getSceneNode()); } } if(getIsSetWires()) { for(Wire wire : getWires()) { sceneNode.getChildren().add(wire.getSceneNode()); } } if(getIsSetVias()) { for(Via via : getVias()) { sceneNode.getChildren().add(via.getSceneNode()); } } return sceneNode; } @Override public BoundingBox getBoundingBox() { return getBoundingBox(0, 0); } @Override public BoundingBox getBoundingBox(double referenceX, double referenceY) { BoundingBox bbox = null; if(getIsSetPolygons()) { for (EaglePolygon poly : getPolygons()) { BoundingBox polyBbox = poly.getBoundingBox(referenceX, referenceY); if(polyBbox != null) { bbox = polyBbox.merge(bbox); } } } if(getIsSetWires()) { for(Wire wire : getWires()) { BoundingBox wireBbox = wire.getBoundingBox(referenceX, referenceY); if(wireBbox != null) { bbox = wireBbox.merge(bbox); } } } if(getIsSetVias()) { for(Via via : getVias()) { BoundingBox viaBbox = via.getBoundingBox(referenceX, referenceY); if(viaBbox != null) { bbox = viaBbox.merge(bbox); } } } return bbox; } @Override public void transformCoordinates(CoordinateTransformer ct, boolean signTransformation) { for (EaglePolygon polygon : getPolygons()) { polygon.transformCoordinates(ct, signTransformation); } for (Wire wire : getWires()) { wire.transformCoordinates(ct, signTransformation); } for (Via via : getVias()) { via.transformCoordinates(ct, signTransformation); } } /** * Add contact ref. * * @param ref the ref */ public void addContactRef(ContactRef ref) { this.contactRefs.add(ref); this.isSetContactRefs = true; } /** * Add contact refs. * * @param contactRefs the contact refs */ public void addContactRefs(Collection<? extends ContactRef> contactRefs) { this.contactRefs.addAll(contactRefs); this.isSetContactRefs = true; } /** * Add polygon. * * @param polygon the polygon */ public void addPolygon(EaglePolygon polygon) { this.polygons.add(polygon); this.isSetPolygons = true; } /** * Add polygons. * * @param polygons the polygons */ public void addPolygons(Collection<? extends EaglePolygon> polygons) { this.polygons.addAll(polygons); this.isSetPolygons = true; } /** * Add wire. * * @param wire the wire */ public void addWire(Wire wire) { this.wires.add(wire); this.isSetWires = true; } /** * Add wires. * * @param wires the wires */ public void addWires(Collection<? extends Wire> wires) { this.wires.addAll(wires); this.isSetWires = true; } /** * Add via. * * @param via the via */ public void addVia(Via via) { this.vias.add(via); this.isSetVias = true; } /** * Add vias. * * @param vias the vias */ public void addVias(Collection<? extends Via> vias) { this.vias.addAll(vias); this.isSetVias = true; } /** * Sets class number. * * @param classNumber the class number */ public void setClassNumber(int classNumber) { this.classNumber = classNumber; this.isSetClassNumber = true; } /** * Sets air wires hidden. * * @param airWiresHidden the air wires hidden */ public void setAirWiresHidden(boolean airWiresHidden) { this.airWiresHidden = airWiresHidden; this.isSetAirWiresHidden = true; } /** * Gets board. * * @return the board */ public EagleBoard getBoard() { return board; } /** * Gets name. * * @return the name */ public String getName() { return name; } /** * Gets class number. * * @return the class number */ public int getClassNumber() { return classNumber; } /** * Gets air wires hidden. * * @return the air wires hidden */ public boolean getAirWiresHidden() { return airWiresHidden; } /** * Gets contact refs. * * @return the contact refs */ public List<ContactRef> getContactRefs() { return contactRefs; } /** * Gets polygons. * * @return the polygons */ public List<EaglePolygon> getPolygons() { return polygons; } /** * Gets wires. * * @return the wires */ public List<Wire> getWires() { return wires; } /** * Gets vias. * * @return the vias */ public List<Via> getVias() { return vias; } /** * Gets is set class number. * * @return the is set class number */ public boolean getIsSetClassNumber() { return isSetClassNumber; } /** * Gets is set air wires hidden. * * @return the is set air wires hidden */ public boolean getIsSetAirWiresHidden() { return isSetAirWiresHidden; } /** * Gets is set contact refs. * * @return the is set contact refs */ public boolean getIsSetContactRefs() { return isSetContactRefs; } /** * Gets is set polygons. * * @return the is set polygons */ public boolean getIsSetPolygons() { return isSetPolygons; } /** * Gets is set wires. * * @return the is set wires */ public boolean getIsSetWires() { return isSetWires; } /** * Gets is set vias. * * @return the is set vias */ public boolean getIsSetVias() { return isSetVias; } }
true
1b6e681c82c033549f3d2b34148c18935420258d
Java
kidsandcode/minecraft-kidsandcode
/src/main/java/com/kidsandcode/moddingone/entities/model/CustomModel.java
UTF-8
753
2.1875
2
[]
no_license
package com.kidsandcode.moddingone.entities.model; import com.kidsandcode.moddingone.entities.CustomEntity; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import net.minecraft.client.renderer.entity.model.EntityModel; public class CustomModel<T extends CustomEntity> extends EntityModel<T> { public CustomModel() { } @Override public void setRotationAngles(T entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { } @Override public void render(MatrixStack matrixStackIn, IVertexBuilder bufferIn, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float alpha) { } }
true
4bee04bd40d70742166c7fc3e00bb0b45f335e95
Java
sengeiou/demo-1
/sc-payment/sc-payment-dubbo/src/main/java/com/yatang/sc/payment/flow/weixin/WeixinRefundFacedeService.java
UTF-8
4,234
2.046875
2
[]
no_license
package com.yatang.sc.payment.flow.weixin; import com.yatang.sc.payment.domain.PayRefundPO; import com.yatang.sc.payment.domain.PaymentConfigPO; import com.yatang.sc.payment.dto.response.RefundResponseDto; import com.yatang.sc.payment.exception.RefundException; import com.yatang.sc.payment.exception.ValidationSignException; import com.yatang.sc.payment.flow.AbstractRefundFacedService; import com.yatang.sc.payment.util.WeiXinPayUtils; import com.yatang.sc.payment.util.XmlUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.util.Map; import java.util.concurrent.ExecutionException; @Service("weixinRefundFacedeService") public class WeixinRefundFacedeService extends AbstractRefundFacedService { @Override protected RefundResponseDto requestRefund(PayRefundPO pRefundPO, PaymentConfigPO pPaymentConfigPO, PayRefundPO payRefundPO) throws RefundException, ValidationSignException { try { Map<String, String> paramMap = WeiXinPayUtils.convertRefundParamToMap(pRefundPO, pPaymentConfigPO); String xmlParam = XmlUtils.mapToXml(paramMap); xmlParam = new String(xmlParam.getBytes("UTF-8"), "ISO8859-1"); String refundApi = pPaymentConfigPO.getRefundApi(); if (!refundApi.contains(pPaymentConfigPO.getPayServer())) { refundApi = pPaymentConfigPO.getPayServer() + refundApi; } String responseStr = WeiXinPayUtils.sendRequestViaSSL(refundApi, xmlParam, pPaymentConfigPO.getCertPassword(), pPaymentConfigPO.getCertPath()); Map<String, String> responseMap = null; if (StringUtils.isNotEmpty(responseStr)) { responseMap = XmlUtils.xml2Map(responseStr, "xml"); } RefundResponseDto refundResponseDto; if (responseMap == null || responseMap.isEmpty()) { refundResponseDto = new RefundResponseDto(); mLogger.error("微信支付退款错误,返回值为空:{}", pRefundPO.getRefundNo()); refundResponseDto.setSuccess(false); refundResponseDto.setMsg("微信支付退款错误,返回值为空:" + pRefundPO.getRefundNo()); return refundResponseDto; } String returnCode = responseMap.get("return_code"); if ("FAIL".equals(returnCode)) { refundResponseDto = new RefundResponseDto(); refundResponseDto.setSuccess(false); refundResponseDto.setMsg(responseMap.get("return_msg")); return refundResponseDto; } WeiXinPayUtils.validateSign(responseMap, pPaymentConfigPO.getSignKey()); String resultCode = responseMap.get("result_code"); if ("SUCCESS".equals(resultCode)) { refundResponseDto = new RefundResponseDto(); refundResponseDto.setRefundAmount(Double.valueOf(responseMap.get("refund_fee")) / 100);//微信单位为分 refundResponseDto.setRefundTradeNo(responseMap.get("refund_id")); refundResponseDto.setRefundNo(responseMap.get("out_refund_no")); } else { refundResponseDto = new RefundResponseDto(); refundResponseDto.setSuccess(false); String error = responseMap.get("err_code_des"); if (StringUtils.isEmpty(error)) { error = responseMap.get("return_msg"); } refundResponseDto.setMsg(error); } return refundResponseDto; } catch (UnsupportedEncodingException pE) { mLogger.error("退款异常:{}", pRefundPO.getRefundNo()); throw new RefundException("退款异常.", pE); } catch (ExecutionException pE) { mLogger.error("退款异常:{}", pRefundPO.getRefundNo()); throw new RefundException("退款异常.", pE); } catch (IOException pE) { mLogger.error("退款异常:{}", pRefundPO.getRefundNo()); throw new RefundException("退款异常.", pE); } } }
true
f4b80c852415f2cc6e95d291088c5b316952d9e0
Java
sriram1127/Algorithms
/src/CompareVersion.java
UTF-8
1,125
3.671875
4
[]
no_license
public class CompareVersion { public static void main(String[] args) { System.out.println(new CompareVersion().compareVersion("1.0.1", "1")); } public int compareVersion(String version1, String version2) { String v1[] = version1.split("\\."); String v2[] = version2.split("\\."); int length = v1.length > v2.length ? v2.length : v1.length; int result = 0, j; for (j = 0; j < length; j++) { if (Double.parseDouble(v1[j]) > Double.parseDouble(v2[j])) { result = 1; break; } else if (Double.parseDouble(v1[j]) < Double.parseDouble(v2[j])) { result = -1; break; } else { if (v1[j].length() < v2[j].length()) { result = 1; } else if (v1[j].length() > v2[j].length()) { result = -1; } } } if (result == 0 && v1.length != v2.length) { if (v1.length > v2.length) { while (j < v1.length) { if (Double.parseDouble(v1[j]) > 0) { result = 1; break; } ++j; } } else { while (j < v2.length) { if (Double.parseDouble(v2[j]) > 0) { result = -1; break; } ++j; } } } return result; } }
true
24575194248456fa6f5cf2ae0e1a32e20b6f59b5
Java
tomfisher/timbus-context-population-tools-tacet
/TACET/net.miginfocom.miglayout/net/miginfocom/demo/HiDPISimulator.java
UTF-8
17,860
1.976563
2
[ "BSD-3-Clause" ]
permissive
package net.miginfocom.demo; import net.miginfocom.layout.PlatformDefaults; import net.miginfocom.layout.UnitValue; import net.miginfocom.swing.MigLayout; import org.jvnet.substance.SubstanceLookAndFeel; import org.jvnet.substance.fonts.SubstanceFontUtilities; import org.jvnet.substance.skin.SubstanceBusinessBlackSteelLookAndFeel; import javax.swing.*; import javax.swing.border.LineBorder; import javax.swing.plaf.FontUIResource; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; import java.util.*; /* * License (BSD): * ============== * * Copyright (c) 2004, Mikael Grev, MiG InfoCom AB. (miglayout (at) miginfocom (dot) com) * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list * of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this * list of conditions and the following disclaimer in the documentation and/or other * materials provided with the distribution. * Neither the name of the MiG InfoCom AB nor the names of its contributors may be * used to endorse or promote products derived from this software without specific * prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * @version 1.0 * @author Mikael Grev, MiG InfoCom AB * Date: 2006-sep-08 */ /** A demo application that shows some components in a GUI and how they will look on a HiDPI screen. */ public class HiDPISimulator { static final String SYSTEM_LAF_NAME = "System"; static final String SUBSTANCE_LAF_NAME = "Substance"; static final String OCEAN_LAF_NAME = "Ocean"; static final String NUMBUS_LAF_NAME = "Nimbus (Soon..)"; static JFrame APP_GUI_FRAME; static HiDPIDemoPanel HiDPIDEMO_PANEL; static JPanel SIM_PANEL; static JPanel MIRROR_PANEL; static JScrollPane MAIN_SCROLL; static JTextArea TEXT_AREA; static boolean SCALE_LAF = false; static boolean SCALE_FONTS = true; static boolean SCALE_LAYOUT = true; static boolean PAINT_GHOSTED = false; static BufferedImage GUI_BUF = null; static BufferedImage ORIG_GUI_BUF = null; static int CUR_DPI = PlatformDefaults.getDefaultDPI(); static HashMap<String, Font> ORIG_DEFAULTS; private static JPanel createScaleMirror() { return new JPanel(new MigLayout()) { protected void paintComponent(Graphics g) { super.paintComponent(g); if (GUI_BUF != null) { Graphics2D g2 = (Graphics2D) g.create(); double dpi = getToolkit().getScreenResolution(); AffineTransform oldTrans = g2.getTransform(); g2.scale(dpi / CUR_DPI, dpi / CUR_DPI); g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); g2.drawImage(GUI_BUF, 0, 0, null); g2.setTransform(oldTrans); if (ORIG_GUI_BUF != null && PAINT_GHOSTED) { g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.2f)); g2.drawImage(ORIG_GUI_BUF, 0, 0, null); } g2.dispose(); } } public Dimension getPreferredSize() { return ORIG_GUI_BUF != null ? new Dimension(ORIG_GUI_BUF.getWidth(), ORIG_GUI_BUF.getHeight()) : new Dimension(100, 100); } public Dimension getMinimumSize() { return getPreferredSize(); } }; } private static JPanel createSimulator() { final JRadioButton scaleCompsFonts = new JRadioButton("UIManager Font Substitution", true); final JRadioButton scaleCompsLaf = new JRadioButton("Native Look&Feel Scaling", false); final JRadioButton scaleCompsNone = new JRadioButton("No Scaling", false); final JRadioButton scaleLayoutMig = new JRadioButton("Native MigLayout Gap Scaling", true); final JRadioButton scaleLayoutNone = new JRadioButton("No Gap Scaling", false); final JComboBox lafCombo = new JComboBox(new String[] {SYSTEM_LAF_NAME, SUBSTANCE_LAF_NAME, OCEAN_LAF_NAME, NUMBUS_LAF_NAME}); final ButtonGroup bg1 = new ButtonGroup(); final ButtonGroup bg2 = new ButtonGroup(); final JCheckBox ghostCheck = new JCheckBox("Overlay \"Optimal\" HiDPI Result"); scaleCompsLaf.setEnabled(false); bg1.add(scaleCompsFonts); bg1.add(scaleCompsLaf); bg1.add(scaleCompsNone); bg2.add(scaleLayoutMig); bg2.add(scaleLayoutNone); Vector<String> dpiStrings = new Vector<String>(); for (float f = 0.5f; f < 2.01f; f += 0.1f) dpiStrings.add(Math.round(PlatformDefaults.getDefaultDPI() * f) + " DPI (" + Math.round(f * 100f + 0.499f) + "%)"); final JComboBox dpiCombo = new JComboBox(dpiStrings); dpiCombo.setSelectedIndex(5); JPanel panel = new JPanel(new MigLayout("alignx center, insets 10px, flowy", "[]", "[]3px[]0px[]")); JLabel lafLabel = new JLabel("Look & Feel:"); JLabel sliderLabel = new JLabel("Simulated DPI:"); JLabel scaleLabel = new JLabel("Component/Text Scaling:"); JLabel layoutLabel = new JLabel("LayoutManager Scaling:"); JLabel visualsLabel = new JLabel("Visual Aids:"); panel.add(lafLabel, ""); panel.add(lafCombo, "wrap"); panel.add(sliderLabel, ""); panel.add(dpiCombo, "wrap"); panel.add(scaleLabel, ""); panel.add(scaleCompsFonts, ""); panel.add(scaleCompsLaf, ""); panel.add(scaleCompsNone, "wrap"); panel.add(layoutLabel, ""); panel.add(scaleLayoutMig, ""); panel.add(scaleLayoutNone, "wrap"); panel.add(visualsLabel, ""); panel.add(ghostCheck, ""); lockFont(dpiCombo, scaleCompsFonts, scaleCompsLaf, scaleLayoutMig, scaleCompsNone, lafCombo, ghostCheck, panel, lafLabel, sliderLabel, scaleLayoutNone, scaleLabel, layoutLabel, visualsLabel); lafCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { GUI_BUF = null; try { Object s = lafCombo.getSelectedItem(); dpiCombo.setSelectedIndex(5); if (s.equals(SYSTEM_LAF_NAME)) { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } else if (s.equals(SUBSTANCE_LAF_NAME)) { UIManager.setLookAndFeel(new SubstanceBusinessBlackSteelLookAndFeel()); } else if (s.equals(OCEAN_LAF_NAME)) { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } else { JOptionPane.showMessageDialog(APP_GUI_FRAME, "Nimbus will be included as soon as it is ready!"); } if (ORIG_DEFAULTS != null) { for (String key : ORIG_DEFAULTS.keySet()) UIManager.put(key, null); } ORIG_DEFAULTS = null; if (UIManager.getLookAndFeel().getName().toLowerCase().contains("windows")) { UIManager.put("TextArea.font", UIManager.getFont("TextField.font")); } else { UIManager.put("TextArea.font", null); } SwingUtilities.updateComponentTreeUI(APP_GUI_FRAME); MAIN_SCROLL.setBorder(null); if (s.equals(SYSTEM_LAF_NAME)) { if (scaleCompsLaf.isSelected()) scaleCompsFonts.setSelected(true); scaleCompsLaf.setEnabled(false); } else if (s.equals(SUBSTANCE_LAF_NAME)) { scaleCompsLaf.setEnabled(true); } else if (s.equals(OCEAN_LAF_NAME)) { if (scaleCompsLaf.isSelected()) scaleCompsFonts.setSelected(true); scaleCompsLaf.setEnabled(false); } setDPI(CUR_DPI); } catch (Exception ex) { ex.printStackTrace(); } } }); ghostCheck.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { GUI_BUF = null; PAINT_GHOSTED = ghostCheck.isSelected(); APP_GUI_FRAME.repaint(); } }); scaleLayoutMig.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { GUI_BUF = null; SCALE_LAYOUT = scaleLayoutMig.isSelected(); setDPI(CUR_DPI); } }); ItemListener il = new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { GUI_BUF = null; SCALE_LAF = scaleCompsLaf.isSelected(); SCALE_FONTS = scaleCompsFonts.isSelected(); setDPI(CUR_DPI); } } }; scaleCompsLaf.addItemListener(il); scaleCompsFonts.addItemListener(il); scaleCompsNone.addItemListener(il); dpiCombo.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { GUI_BUF = null; CUR_DPI = Integer.parseInt(dpiCombo.getSelectedItem().toString().substring(0, 3).trim()); setDPI(CUR_DPI); } } }); return panel; } private static void lockFont(Component ... comps) { for (Component c : comps) { Font f = c.getFont(); c.setFont(f.deriveFont((float) f.getSize())); } } private static void revalidateGUI() { APP_GUI_FRAME.getContentPane().invalidate(); APP_GUI_FRAME.repaint(); } private synchronized static void setDPI(int dpi) { float scaleFactor = dpi / (float) Toolkit.getDefaultToolkit().getScreenResolution(); TEXT_AREA.setSize(0, 0); // To reset for Swing TextArea horizontal size bug... PlatformDefaults.setHorizontalScaleFactor(.1f);// Only so that the cache will be invalidated for sure PlatformDefaults.setHorizontalScaleFactor(SCALE_LAYOUT ? scaleFactor : null); PlatformDefaults.setVerticalScaleFactor(SCALE_LAYOUT ? scaleFactor : null); float fontScale = SCALE_FONTS ? dpi / (float) Toolkit.getDefaultToolkit().getScreenResolution() : 1f; if (ORIG_DEFAULTS == null) { ORIG_DEFAULTS = new HashMap<String, Font>(); Set entries = new HashSet(UIManager.getLookAndFeelDefaults().keySet()); for (Iterator it = entries.iterator(); it.hasNext();) { String key = it.next().toString(); Object value = UIManager.get(key); if (value instanceof Font) ORIG_DEFAULTS.put(key, (Font) value); } } Set entries = ORIG_DEFAULTS.entrySet(); for (Iterator<Map.Entry<String, Font>> it = entries.iterator(); it.hasNext();) { Map.Entry<String, Font> e = it.next(); Font origFont = e.getValue(); if (SCALE_LAF == false) { UIManager.put(e.getKey(), new FontUIResource(origFont.deriveFont(origFont.getSize() * fontScale))); } else { UIManager.put(e.getKey(), null); } } if (SCALE_LAF) { scaleSubstanceLAF(scaleFactor); } else if (UIManager.getLookAndFeel().getName().toLowerCase().contains("substance")) { scaleSubstanceLAF(1); } SwingUtilities.updateComponentTreeUI(HiDPIDEMO_PANEL); revalidateGUI(); } private static void scaleSubstanceLAF(float factor) { SubstanceLookAndFeel.setFontPolicy(SubstanceFontUtilities.getScaledFontPolicy(factor)); try { UIManager.setLookAndFeel(new SubstanceBusinessBlackSteelLookAndFeel()); } catch (Exception exc) { } SwingUtilities.updateComponentTreeUI(APP_GUI_FRAME); MAIN_SCROLL.setBorder(null); } public static void main(String[] args) { try { System.setProperty("apple.laf.useScreenMenuBar", "true"); System.setProperty("com.apple.mrj.application.apple.menu.about.name", "HiDPI Simulator"); } catch(Exception ex) {} PlatformDefaults.setDefaultHorizontalUnit(UnitValue.LPX); PlatformDefaults.setDefaultVerticalUnit(UnitValue.LPY); SwingUtilities.invokeLater(new Runnable() { public void run() { try { // UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } catch (Exception ex) { ex.printStackTrace(); } if (UIManager.getLookAndFeel().getName().toLowerCase().contains("windows")) UIManager.put("TextArea.font", UIManager.getFont("TextField.font")); APP_GUI_FRAME = new JFrame("Resolution Independence Simulator"); // RepaintManager.currentManager(APP_GUI_FRAME).setDoubleBufferingEnabled(false); JPanel uberPanel = new JPanel(new MigLayout("fill, insets 0px, nocache")); JPanel mainPanel = new JPanel(new MigLayout("fill, insets 0px, nocache")) { public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g.create(); g2.setPaint(new GradientPaint(0, 0, new Color(20, 20, 30), 0, getHeight(), new Color(90, 90, 110), false)); g2.fillRect(0, 0, getWidth(), getHeight()); g2.setFont(g2.getFont().deriveFont(Font.BOLD, 13)); g2.setPaint(Color.WHITE); g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); g2.drawString("Left panel shows the scaled version. Right side shows how this would look on a HiDPI screen. It should look the same as the original panel!", 10, 19); g2.dispose(); } }; HiDPIDEMO_PANEL = new HiDPIDemoPanel(); SIM_PANEL = createSimulator(); MIRROR_PANEL = createScaleMirror(); MAIN_SCROLL = new JScrollPane(mainPanel); MAIN_SCROLL.setBorder(null); mainPanel.add(HiDPIDEMO_PANEL, "align center center, split, span, width pref!"); mainPanel.add(MIRROR_PANEL, "id mirror, gap 20px!, width pref!"); uberPanel.add(SIM_PANEL, "dock south"); uberPanel.add(MAIN_SCROLL, "dock center"); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); APP_GUI_FRAME.setContentPane(uberPanel); APP_GUI_FRAME.setSize(Math.min(1240, screenSize.width), Math.min(950, screenSize.height - 30)); APP_GUI_FRAME.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); APP_GUI_FRAME.setLocationRelativeTo(null); APP_GUI_FRAME.setVisible(true); } }); } } class HiDPIDemoPanel extends JPanel { public HiDPIDemoPanel() { super(new MigLayout()); JLabel jLabel1 = new JLabel("A Small Label:"); JTextField jTextField1 = new JTextField(10); JButton jButton1 = new JButton("Cancel"); JButton jButton2 = new JButton("OK"); JButton jButton4 = new JButton("Help"); JList jList1 = new JList(); JLabel jLabel2 = new JLabel("Label:"); JTextField jTextField2 = new JTextField(10); JLabel jLabel3 = new JLabel("This is another section"); JSeparator jSeparator1 = new JSeparator(); JTextArea jTextArea1 = new JTextArea("Some general text that takes place, doesn't offend anyone and fills some pixels.", 3, 30); // colums set always! JLabel jLabel4 = new JLabel("Some Text Area"); JLabel jLabel6 = new JLabel("Some List:"); JComboBox jComboBox1 = new JComboBox(); JCheckBox jCheckBox1 = new JCheckBox("Orange"); JScrollBar scroll1 = new JScrollBar(JScrollBar.VERTICAL); JScrollBar scroll2 = new JScrollBar(JScrollBar.HORIZONTAL, 30, 40, 0, 100); JRadioButton radio = new JRadioButton("Apple"); JProgressBar prog = new JProgressBar(); prog.setValue(50); JSpinner spinner = new JSpinner(new SpinnerNumberModel(50, 0, 100, 1)); JTree tree = new JTree(); tree.setOpaque(false); tree.setEnabled(false); jList1.setModel(new AbstractListModel() { String[] strings = { "Donald Duck", "Mickey Mouse", "Pluto", "Cartman" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } }); jList1.setVisibleRowCount(4); jList1.setBorder(new LineBorder(Color.GRAY)); jTextArea1.setLineWrap(true); jTextArea1.setWrapStyleWord(true); jTextArea1.setBorder(new LineBorder(Color.GRAY)); jComboBox1.setModel(new DefaultComboBoxModel(new String[] {"Text in ComboBox"})); jCheckBox1.setMargin(new java.awt.Insets(0, 0, 0, 0)); add(jLabel1, "split, span"); add(jTextField1, ""); add(jLabel2, "gap unrelated"); add(jTextField2, "wrap"); add(jLabel3, "split, span"); add(jSeparator1, "growx, span, gap 2, wrap unrelated"); add(jLabel4, "wrap 2"); add(jTextArea1, "span, wmin 150, wrap unrelated"); add(jLabel6, "wrap 2"); add(jList1, "split, span"); add(scroll1, "growy"); add(prog, "width 80!"); add(tree, "wrap unrelated"); add(scroll2, "split, span, growx"); add(spinner, "wrap unrelated"); add(jComboBox1, "span, split"); add(radio, ""); add(jCheckBox1, "wrap unrelated"); add(jButton4, "split, span, tag help2"); add(jButton2, "tag ok"); add(jButton1, "tag cancel"); HiDPISimulator.TEXT_AREA = jTextArea1; } public void paint(Graphics g) { if (HiDPISimulator.GUI_BUF == null) { BufferedImage bi = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = bi.createGraphics(); super.paint(g2); g2.dispose(); g.drawImage(bi, 0, 0, null); HiDPISimulator.GUI_BUF = bi; if (HiDPISimulator.CUR_DPI == PlatformDefaults.getDefaultDPI()) HiDPISimulator.ORIG_GUI_BUF = bi; SwingUtilities.invokeLater(new Runnable() { public void run() { HiDPISimulator.MIRROR_PANEL.revalidate(); HiDPISimulator.MIRROR_PANEL.repaint(); } }); } else { super.paint(g); } } }
true
fb02525bfbc0629213ff2a4d272dcaf5e1e51a68
Java
DavidSon2017/Elemy_project
/java_server/src/ConnectData.java
UHC
6,458
2.796875
3
[]
no_license
package newpr; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Calendar; import java.util.StringTokenizer; public class ConnectData { static class data { public int start_time; public int finish_time; public int result_floor; data(int st, int ft, int rf) { start_time = st; finish_time = ft; result_floor = rf; } } static data[] datas; static int count = 0; //Ϸ縶 ׳ Ŭ͸ ҷ(ùð~ð : ) public static void loadClusResult(){ //isweekend = 0 , isweekend = 1 ָ int isweekend = getDayofWeek(); try { Class.forName("com.mysql.jdbc.Driver"); System.out.println("̹ ˻ !!"); } catch (ClassNotFoundException e) { System.out.println("̹ ˻ !"); } Connection con = null; String url = "jdbc:mysql://127.0.0.1:3306/clus"; String user = "root"; String pass = "1234"; try { con = DriverManager.getConnection(url, user, pass); System.out.println("My-SQL !!"); } catch (SQLException e) { System.out.println("My-SQL "); } try { Statement stmt = con.createStatement(); String buf ="select count(*) cnt from result where is_weekend="+isweekend; ResultSet rs = stmt.executeQuery(buf); while(rs.next()){ count = rs.getInt("cnt"); } datas = new data[count]; int idx = 0; buf ="select * from result where is_weekend="+isweekend+" order by start_time"; rs = stmt.executeQuery(buf); while (rs.next()) { String starttime = rs.getString("start_time"); String finishtime = rs.getString("finish_time"); int resultfloor = rs.getInt("result_floor"); int st = inttime(starttime); int ft = inttime(finishtime); datas[idx] = new data(st, ft, resultfloor); idx++; // System.out.println(starttime+"~"+finishtime+" -> // "+resultfloor+""); } // while } catch (SQLException e) { System.out.println("SQLException:" + e.getMessage()); } System.out.println("-----------------------------------"); for (int i = 0; i < count; i++) { System.out.println(chartime(datas[i].start_time) + " ~ " + chartime(datas[i].finish_time) + " -> " + datas[i].result_floor + ""); } System.out.println("-----------------------------------"); } //ȣ , ȣȣ . getclusfloor Լ ؼ Ŭ͸ ˾ƿ´, "0 ƴҰ쿡" ͷ . public static int getclusfloor(){ String timestr = getCurrentTime(); //ð //String timestr = "17:50:30"; int timeint = inttime(timestr); int clusfloor = 0; for (int i = 0; i < count; i++) { if (datas[i].start_time <= timeint && timeint <= datas[i].finish_time) { clusfloor = datas[i].result_floor; break; } else clusfloor = 0; } clusfloor = 10; System.out.println(" ð " + timestr + "(" + timeint + ")" + "̹Ƿ Ŭ͸ \"" + clusfloor + "\" Դϴ."); return clusfloor; } // ð. public static String getCurrentTime() { String str; Calendar aCalendar = Calendar.getInstance(); int hour = aCalendar.get(Calendar.HOUR_OF_DAY); int min = aCalendar.get(Calendar.MINUTE); int sec = aCalendar.get(Calendar.SECOND); str = hour + ":" + min + ":" + sec; return str; } // ¥. public static String getCurrentDay(){ String str; Calendar aCalendar = Calendar.getInstance(); int year = aCalendar.get(Calendar.YEAR); int month = aCalendar.get(Calendar.MONTH)+1; int date = aCalendar.get(Calendar.DATE); str = year + "-" + month + "-" + date; return str; } // . ( 0, ָ 1) public static int getDayofWeek(){ Calendar aCalendar = Calendar.getInstance(); int dayofweek = aCalendar.get(Calendar.DAY_OF_WEEK); //DAY_OF_WEEK : Ͽ 1, 2 , ,,, 7 if(dayofweek == 1 || dayofweek ==7) return 1; else return 0; } //ڿð Ʈð. (9:12 -> 178) public static int inttime(String str) { int time = 0; int cnt = 1; StringTokenizer s = new StringTokenizer(str, ":"); while (s.hasMoreTokens()) { String ss = s.nextToken(); if (cnt == 1) time += (Integer.parseInt(ss) * 3600); // ó else if (cnt == 2) time += (Integer.parseInt(ss) * 60); // ó else time += Integer.parseInt(ss); // ó cnt++; } return time; } public static String chartime(int t){ String str; int hour = t / 3600; int minute = (t - (hour * 3600)) / 60; int second = t - (3600 * hour) - (60 * minute); str = hour + ":"+minute+":"+second; return str; } // . public static void saveData(String data){ int floor = Integer.parseInt(data); try { Class.forName("com.mysql.jdbc.Driver"); //System.out.println("̹ ˻ !!"); } catch (ClassNotFoundException e) { System.out.println("̹ ˻ !"); } Connection con = null; String url = "jdbc:mysql://127.0.0.1:3306/clus"; String user = "root"; String pass = "1234"; try { con = DriverManager.getConnection(url, user, pass); //System.out.println("My-SQL !!"); } catch (SQLException e) { System.out.println("My-SQL "); } try { Statement stmt = con.createStatement(); String currentDay = ConnectData.getCurrentDay(); String currentTime = ConnectData.getCurrentTime(); int dayofweek = ConnectData.getDayofWeek(); String sql = "insert into datas values('"+currentDay+"','"+ currentTime+"','"+floor+"','"+dayofweek+"','0')"; if(stmt.executeUpdate(sql)>0){ System.out.println("Data ߰ : '"+currentDay+"','"+ currentTime+"','"+floor+"','"+dayofweek+"','0'"); } else System.out.println("Data ߰ "); } catch (SQLException e) { System.out.println("SQLException:" + e.getMessage()); } } }
true
567ce9f062b4dce24c2c27ae4be4fa77d64c8b62
Java
wlq/ssmz
/src/main/java/sy/service/impl/PaperServiceImpl.java
UTF-8
3,902
2.171875
2
[]
no_license
package sy.service.impl; import java.util.ArrayList; import java.util.List; import java.util.UUID; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import sy.dao.BaseDaoI; import sy.model.Tpaper; import sy.pageModel.DataGrid; import sy.pageModel.EmpiricalResearch; import sy.pageModel.Paper; import sy.service.PaperServiceI; @Service("paperService") public class PaperServiceImpl extends BaseServiceImpl implements PaperServiceI{ private BaseDaoI<Tpaper> paperDao; public BaseDaoI<Tpaper> getpaperDao() { return paperDao; } @Autowired public void setpaperDao(BaseDaoI<Tpaper> paperDao) { this.paperDao = paperDao; } @Transactional(propagation = Propagation.SUPPORTS) public DataGrid datagrid(Paper paper) { DataGrid j = new DataGrid(); j.setRows(getpapersFromTpapers(find(paper))); j.setTotal(total(paper)); return j; } private List<Paper> getpapersFromTpapers(List<Tpaper> tpapers) { List<Paper> papers = new ArrayList<Paper>(); if (tpapers != null && tpapers.size() > 0) { for (Tpaper tb : tpapers) { Paper b = new Paper(); BeanUtils.copyProperties(tb, b); papers.add(b); } } return papers; } private List<Tpaper> find(Paper paper) { String hql = "select new Tpaper( t.cid, t.cname,t.cckeyword, t.cekeyword,t.csummary, t.clanguage, t.cfcontactid,t.cccontactid, t.cperiodical, t.cissue,t.cstate, t.cpublishtime, t.cclassify, t.cinde,t.ctypeman, t.ctypetime, t.cflag) from Tpaper t where 1=1 "; List<Object> values = new ArrayList<Object>(); hql = addWhere(paper, hql, values); if (paper.getSort() != null && paper.getOrder() != null) { hql += " order by " + paper.getSort() + " " + paper.getOrder(); } return paperDao.find(hql, values, paper.getPage(), paper.getRows()); } private Long total(Paper paper) { String hql = "select count(*) from Tpaper t where 1=1 "; List<Object> values = new ArrayList<Object>(); hql = addWhere(paper, hql, values); return paperDao.count(hql, values); } private String addWhere(Paper paper, String hql, List<Object> values) { if (paper.getCname() != null && !paper.getCname().trim().equals("")) { hql += " and t.cname like ? "; values.add("%%" + paper.getCname().trim() + "%%"); } if (paper.getCfcontactid() != null) { hql += " and t.cfcontactid like ? "; values.add("%%" + paper.getCfcontactid().trim() + "%%"); } return hql; } public void add(Paper paper) { if (paper.getCid() == null || paper.getCid().trim().equals("")) { paper.setCid(UUID.randomUUID().toString()); } paper.setCflag("1"); Tpaper t = new Tpaper(); BeanUtils.copyProperties(paper, t); paperDao.save(t); } public void update(Paper paper) { Tpaper t = paperDao.get(Tpaper.class, paper.getCid()); if (t != null) { BeanUtils.copyProperties(paper, t, new String[] { "cid" }); } } public void delete(String ids) { if (ids != null) { for (String id : ids.split(",")) { Tpaper t = paperDao.get(Tpaper.class, id); if (t != null) { paperDao.delete(t); } } } } public Tpaper get(Paper paper) { Tpaper menu = paperDao.get(Tpaper.class, paper.getCid()); return menu; } public void changeFlag(Paper paper) { // TODO Auto-generated method stub Tpaper t = paperDao.get(Tpaper.class, paper.getCid()); String cstatus = t.getCflag(); String hql = " "; /// if (Integer.parseInt(cstatus) == 0) { hql = "update tpaper c set c.cflag= 1 where c.cid=?"; }else{ hql = "update tpaper c set c.cflag= 0 where c.cid=?"; } System.out.println(hql); try { paperDao.updateStatus(hql,paper.getCid()); } catch (Exception e) { e.printStackTrace(); } } }
true
0a7fa5254b8e401aa71c574439569e417d2f2b7f
Java
sunshaochi/Aodi
/app/src/main/java/com/iris/cada/newfragment/DiagDetailsFragment.java
UTF-8
9,589
1.984375
2
[]
no_license
package com.iris.cada.newfragment; import java.util.ArrayList; import java.util.List; import com.iris.cada.adapter.DiagDetailsAdapter; import com.iris.cada.fragment.BaseFragment; import com.iris.cada.R; import android.content.Context; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; /** * @author ChuanJing * @date 2016年10月9日 下午2:25:52 *诊断页面 fragment */ public class DiagDetailsFragment extends BaseFragment { private ListView fragment_diag_lv; private Context Context; private List<String> datas; private TextView newspepolnumber;//新增浅客人数 private TextView averagelnumber;//团队平均人数 private TextView ratelnumber;//成交率 private TextView averagel_rate_number;//平均成交率 private TextView Profitnumber;//利润贡献 private TextView averagel_Profit_number;//利润平均 private TextView gp_number;//gp2数值 private TextView averagel_gp_number;//gp2平均 private TextView replacementnumber;//置换率 private TextView averagel_replacement_number;//置换平均 private ImageView fine_logo,carloan_logo,insurance_logo,extended_logo; private TextView icul_name,carloan_name,insurance_name,extended_name; private TextView finenumber,fine_profit_number;//精品加装率//平均单车盈利 private TextView fine_averagel_number,fine_averagel_profit_number;//精品加装率团队平均//盈利平均 private TextView datas_name1,datas_name2,datas_name3,datas_name4; private TextView carloannumber,carloan_profit_number;//车贷渗透率//平均单车盈利 private TextView carloa_averagel_number,carloa_averagel_profit_number;//精品加装率平均//盈利平均 private TextView insurancenumber,insurance_profit_number;//保险渗透率//平均单车盈利 private TextView insurance_averagel_number,insurance_averagel_profit_number;//保险加装率平均//盈利平均 private TextView extendednumber,extended_profit_number;//延保渗透率//平均单车盈利 private TextView extended_averagel_number,extended_averagel_profit_number;//延保加装率平均//盈利平均 private TextView diagdetal_dates; @Override public void refresh() { // TODO Auto-generated method stub } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_diagdetails, container, false); initView(view); bindata(); //datas=new ArrayList<String>(); //datas.add("111"); //datas.add("123"); //fragment_diag_lv.setAdapter(new DiagDetailsAdapter(getActivity(),datas)); return view; } private void initView(View view) { //新增 newspepolnumber=(TextView) view.findViewById(R.id.fragment_diadetail_datas_linner_add_right_newspepolnumber);//新增潜客 averagelnumber=(TextView) view.findViewById(R.id.fragment_diadetail_datas_linner_add_right_averagelnumber); ratelnumber=(TextView) view.findViewById(R.id.fragment_diadetail_datas_linner_deal_right_ratelnumber); averagel_rate_number=(TextView) view.findViewById(R.id.fragment_diadetail_datas_linner_deal_right_averagelnumber); Profitnumber=(TextView) view.findViewById(R.id.fragment_diadetail_datas_linner_profit_right_Profitnumber); averagel_Profit_number=(TextView) view.findViewById(R.id.fragment_diadetail_datas_linner_profit_right_averagelnumber); gp_number=(TextView) view.findViewById(R.id.fragment_diadetail_datas_linner_gp2_right_gpnumber); averagel_gp_number=(TextView) view.findViewById(R.id.fragment_diadetail_gp2_linner_profit_right_averagelnumber); replacementnumber=(TextView) view.findViewById(R.id.fragment_diadetail_datas_linner_replacement_right_replacementnumber); averagel_replacement_number=(TextView) view.findViewById(R.id.fragment_diadetail_datas_linner_replacement_right_averagelnumber); View diagdetail_Fine_incl= view.findViewById(R.id.fragment_diagdetail_Fine_incl); View diagdetail_carloan_incl= view.findViewById(R.id.fragment_diagdetail_carloan_incl); View iagdetail_insurance_incl= view.findViewById(R.id.fragment_diagdetail_insurance_incl); View diagdetail_extended_incl= view.findViewById(R.id.fragment_diagdetail_extended_incl); datas_name1=(TextView) diagdetail_Fine_incl.findViewById(R.id.datas_name); datas_name2=(TextView) diagdetail_carloan_incl.findViewById(R.id.datas_name); datas_name3=(TextView) iagdetail_insurance_incl.findViewById(R.id.datas_name); datas_name4=(TextView) diagdetail_extended_incl.findViewById(R.id.datas_name); //延保数据 extendednumber=(TextView) diagdetail_extended_incl.findViewById(R.id.fragment_diadetail_datas_linner_gp2_right_newspepolnumber); extended_profit_number=(TextView) diagdetail_extended_incl.findViewById(R.id.fragment_diadetail_datas_linner_replacement_right_newspepolnumber); extended_averagel_number=(TextView) diagdetail_extended_incl.findViewById(R.id.fragment_diadetail_gp2_linner_profit_right_averagelnumber); extended_averagel_profit_number=(TextView) diagdetail_extended_incl.findViewById(R.id.fragment_diadetail_datas_linner_replacement_right_averagelnumber); //保险数据 insurancenumber=(TextView) iagdetail_insurance_incl.findViewById(R.id.fragment_diadetail_datas_linner_gp2_right_newspepolnumber); insurance_profit_number=(TextView) iagdetail_insurance_incl.findViewById(R.id.fragment_diadetail_datas_linner_replacement_right_newspepolnumber); insurance_averagel_number=(TextView) iagdetail_insurance_incl.findViewById(R.id.fragment_diadetail_gp2_linner_profit_right_averagelnumber); insurance_averagel_profit_number=(TextView) iagdetail_insurance_incl.findViewById(R.id.fragment_diadetail_datas_linner_replacement_right_averagelnumber); //精品 数据 finenumber=(TextView) diagdetail_Fine_incl.findViewById(R.id.fragment_diadetail_datas_linner_gp2_right_newspepolnumber); carloan_profit_number=(TextView) diagdetail_Fine_incl.findViewById(R.id.fragment_diadetail_datas_linner_replacement_right_newspepolnumber); fine_averagel_number=(TextView) diagdetail_Fine_incl.findViewById(R.id.fragment_diadetail_gp2_linner_profit_right_averagelnumber); fine_averagel_profit_number=(TextView) diagdetail_Fine_incl.findViewById(R.id.fragment_diadetail_datas_linner_replacement_right_averagelnumber); //车贷数据 carloannumber=(TextView) diagdetail_carloan_incl.findViewById(R.id.fragment_diadetail_datas_linner_gp2_right_newspepolnumber); fine_profit_number=(TextView) diagdetail_carloan_incl.findViewById(R.id.fragment_diadetail_datas_linner_replacement_right_newspepolnumber); carloa_averagel_number=(TextView) diagdetail_carloan_incl.findViewById(R.id.fragment_diadetail_gp2_linner_profit_right_averagelnumber); carloa_averagel_profit_number=(TextView) diagdetail_carloan_incl.findViewById(R.id.fragment_diadetail_datas_linner_replacement_right_averagelnumber); //logo图 fine_logo=(ImageView) diagdetail_Fine_incl.findViewById(R.id.fragment_diadetail_gp2_linnder_profit_image); carloan_logo=(ImageView) diagdetail_carloan_incl.findViewById(R.id.fragment_diadetail_gp2_linnder_profit_image); insurance_logo=(ImageView) iagdetail_insurance_incl.findViewById(R.id.fragment_diadetail_gp2_linnder_profit_image); extended_logo=(ImageView) diagdetail_extended_incl.findViewById(R.id.fragment_diadetail_gp2_linnder_profit_image); //数据name icul_name=(TextView) diagdetail_Fine_incl.findViewById(R.id.fragment_diadetail_gp2_linner_profit_right_name); carloan_name=(TextView) diagdetail_carloan_incl.findViewById(R.id.fragment_diadetail_gp2_linner_profit_right_name); insurance_name=(TextView) iagdetail_insurance_incl.findViewById(R.id.fragment_diadetail_gp2_linner_profit_right_name); extended_name=(TextView) diagdetail_extended_incl.findViewById(R.id.fragment_diadetail_gp2_linner_profit_right_name); } private void bindata(){ newspepolnumber.setText("10"); averagelnumber.setText("20"); ratelnumber.setText("30"); averagel_rate_number.setText("40"); Profitnumber.setText("50"); averagel_Profit_number.setText("60"); gp_number.setText("70"); averagel_gp_number.setText("80"); replacementnumber.setText("90"); averagel_replacement_number.setText("11"); //精品,车贷,保险,延保,数据set finenumber.setText("11"); fine_profit_number.setText("11"); fine_averagel_number.setText("22"); fine_averagel_profit_number.setText("22"); carloannumber.setText("11"); carloan_profit_number.setText("11"); carloa_averagel_number.setText("22"); carloa_averagel_profit_number.setText("22"); insurancenumber.setText("11"); insurance_profit_number.setText("11"); insurance_averagel_number.setText("22"); insurance_averagel_profit_number.setText("22"); extendednumber.setText("11"); extended_profit_number.setText("11"); extended_averagel_number.setText("22"); extended_averagel_profit_number.setText("22"); fine_logo.setImageResource(R.drawable.icon_boutique); carloan_logo.setImageResource(R.drawable.icon_carloan); insurance_logo.setImageResource(R.drawable.icon_xinbao); extended_logo.setImageResource(R.drawable.icon_extendedwarranty); datas_name1.setText("精品"); datas_name2.setText("车贷"); datas_name3.setText("新保"); datas_name4.setText("保险"); icul_name.setText("加装率"); carloan_name.setText("渗透率"); insurance_name.setText("渗透率"); extended_name.setText("渗透率"); } }
true
25df36766a3fecf2552c26dfab5a75d0bfdf7b74
Java
jinzishuai/elasticbox-plugin
/src/main/java/com/elasticbox/jenkins/model/services/deployment/configuration/policies/CloudFormationDeploymentDataPolicies.java
UTF-8
1,025
2.125
2
[]
no_license
package com.elasticbox.jenkins.model.services.deployment.configuration.policies; import com.elasticbox.jenkins.model.box.AbstractBox; import com.elasticbox.jenkins.model.box.BoxType; import com.elasticbox.jenkins.model.box.policy.PolicyBox; import com.elasticbox.jenkins.model.repository.BoxRepository; import com.elasticbox.jenkins.model.repository.error.RepositoryException; import java.util.List; public class CloudFormationDeploymentDataPolicies extends AbstractDeploymentDataPoliciesHandler { @Override public List<PolicyBox> retrievePoliciesToDeploy( BoxRepository boxRepository, String workspace, AbstractBox boxToDeploy) throws RepositoryException { List<PolicyBox> cloudFormationPolicyBoxes = boxRepository.getCloudFormationPolicyBoxes(workspace); return matchRequirementsVsClaims(cloudFormationPolicyBoxes, boxToDeploy); } @Override public boolean canManage(AbstractBox boxToDeploy) { return boxToDeploy.getType() == BoxType.CLOUDFORMATION; } }
true
37a5f93d2361f1a3c0e29d2450983fa2f5b72f03
Java
xsongx/weibo
/weixinCrawler/src/cn/edu/nudt/nlp/crawler/ForwardInfo.java
UTF-8
2,204
2.375
2
[]
no_license
package cn.edu.nudt.nlp.crawler; import java.util.Date; import java.util.List; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.cfg.Configuration; import org.openqa.selenium.WebElement; import us.codecraft.webmagic.Page; public class ForwardInfo { //微博(转发)表forwardInfo private String forward_id;//微博(转发)ID private String origin_id;//微博(转发)源ID private Date forward_time;//微博(转发)时间 public static void setforward_time(Date forward_time) { forward_time = new Date(); } public Date getforward_time() { return forward_time; } public String getforward_id() { return forward_id; } public void setforward_id(String forward_id) { this.forward_id = forward_id; } public String getorigin_id() { return origin_id; } public void setorigin_id(String origin_id) { this.origin_id = origin_id; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ForwardInfo other = (ForwardInfo) obj; if (forward_id == null) { if (other.forward_id != null) return false; } else if (!forward_id.equals(other.forward_id)) return false; return true; } public static void main(String[] args) { //读取并解析配置文档 Configuration cfg = new Configuration().configure(); //读取并解析映射文件,创建SessionFactory SessionFactory sf = cfg.buildSessionFactory(); //打开session Session session = sf.openSession(); //开启事务 Transaction fwinfo = session.beginTransaction(); //持久化操作 ForwardInfo forward_id = new ForwardInfo(); session.save(forward_id); //提交事务 fwinfo.commit(); //关闭Session session.close(); //关闭SessionFactory sf.close(); } }
true
4014af8c98639c53805ff6949c2c21805c8a9c94
Java
hoguste/ApplicationSurveillanceExamens
/src/main/java/com/exam/myapp/controller/GradeController.java
UTF-8
1,534
2.09375
2
[]
no_license
package com.exam.myapp.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import com.exam.myapp.entity.Grade; import com.exam.myapp.service.GradeService; @Controller @RequestMapping(value = "/grade") public class GradeController { @Autowired private GradeService graService; public GradeService getGraService() { return graService; } public void setGraService(GradeService graService) { this.graService = graService; } @RequestMapping(value = "/ajout", method = RequestMethod.POST) public String ajout(Grade grade) { graService.ajout(grade); return "redirect:findAll"; } @RequestMapping(value = "/suppr", method = RequestMethod.DELETE) public String suppr(Long id) { graService.suppr(id); return "redirect:findAll"; } @RequestMapping(value = "/modif", method = RequestMethod.POST) public String modif(Grade grade) { graService.modif(grade); return "redirect:findAll"; } @RequestMapping(value = "/find", method = RequestMethod.GET) public String find(Long id, ModelMap model) { model.addAttribute("findGrade", graService.find(id)); return "grade"; } @RequestMapping(value = "/findAll", method = RequestMethod.GET) public String findAll(ModelMap model) { model.addAttribute("allGrade", graService.findAll()); return "grade"; } }
true
3257cf3fd9779c9b8ee3f93418fa6d6d73aab3ba
Java
pxson001/facebook-app
/classes7.dex_source_from_JADX/com/facebook/notifications/action/NotificationsActionExecutor$2.java
UTF-8
2,614
1.75
2
[]
no_license
package com.facebook.notifications.action; import com.facebook.graphql.enums.GraphQLNotifOptionClientActionType; import com.facebook.graphql.enums.GraphQLNotifOptionRowSetDisplayStyle; /* compiled from: no_crop */ /* synthetic */ class NotificationsActionExecutor$2 { static final /* synthetic */ int[] f8124a = new int[GraphQLNotifOptionClientActionType.values().length]; static final /* synthetic */ int[] f8125b = new int[GraphQLNotifOptionRowSetDisplayStyle.values().length]; static { try { f8125b[GraphQLNotifOptionRowSetDisplayStyle.SINGLE_SELECTOR.ordinal()] = 1; } catch (NoSuchFieldError e) { } try { f8124a[GraphQLNotifOptionClientActionType.OPEN_SUB_PAGE.ordinal()] = 1; } catch (NoSuchFieldError e2) { } try { f8124a[GraphQLNotifOptionClientActionType.OPEN_ACTION_SHEET.ordinal()] = 2; } catch (NoSuchFieldError e3) { } try { f8124a[GraphQLNotifOptionClientActionType.MODSUB.ordinal()] = 3; } catch (NoSuchFieldError e4) { } try { f8124a[GraphQLNotifOptionClientActionType.UNSUB.ordinal()] = 4; } catch (NoSuchFieldError e5) { } try { f8124a[GraphQLNotifOptionClientActionType.SERVER_ACTION.ordinal()] = 5; } catch (NoSuchFieldError e6) { } try { f8124a[GraphQLNotifOptionClientActionType.OPEN_EVENT_SETTING.ordinal()] = 6; } catch (NoSuchFieldError e7) { } try { f8124a[GraphQLNotifOptionClientActionType.OPEN_GROUP_SETTING.ordinal()] = 7; } catch (NoSuchFieldError e8) { } try { f8124a[GraphQLNotifOptionClientActionType.OPEN_SOUNDS_SETTING.ordinal()] = 8; } catch (NoSuchFieldError e9) { } try { f8124a[GraphQLNotifOptionClientActionType.OPEN_GROUP_DASHBOARD.ordinal()] = 9; } catch (NoSuchFieldError e10) { } try { f8124a[GraphQLNotifOptionClientActionType.OPEN_EVENT_DASHBOARD.ordinal()] = 10; } catch (NoSuchFieldError e11) { } try { f8124a[GraphQLNotifOptionClientActionType.OPEN_DEVICE_PUSH_SETTINGS.ordinal()] = 11; } catch (NoSuchFieldError e12) { } try { f8124a[GraphQLNotifOptionClientActionType.SHOW_MORE.ordinal()] = 12; } catch (NoSuchFieldError e13) { } try { f8124a[GraphQLNotifOptionClientActionType.HIDE.ordinal()] = 13; } catch (NoSuchFieldError e14) { } } }
true
dede5cc1853659f1d597379239471bae961520b1
Java
bungeni-org/bungeni-editor
/BungeniEditor/tags/0.9.958/BungeniEditorClient/src/org/bungeni/editor/selectors/IGenericPanel.java
UTF-8
718
2.34375
2
[]
no_license
package org.bungeni.editor.selectors; import java.awt.Component; import java.awt.Window; import org.bungeni.ooo.OOComponentHelper; /** * Generic selector panel class with methods for setting the OOo handle and accesing the frame * @author Ashok Hariharan */ public interface IGenericPanel { /** * The Frame containing the selector panel * @param frame */ public void setContainerFrame (Window frame); /** * The handle to the openoffice document * @param ooDocument */ public void setOOComponentHelper(OOComponentHelper ooDocument); /** * Returns a handle to the current selector panel, usually a 'return this;' * @return */ public Component getPanelComponent(); }
true
0f3fc24f6403b5b335787de6ad38c5752d178915
Java
vtjessie/GoVise-Practice
/src/A.java
UTF-8
1,135
3.515625
4
[]
no_license
/** * @author vtjessie * */ public class A implements C, D{ /** * instance field */ private int x; private boolean adminCreated = false; /** * private constructor for in class use * @param x random key val * @param adminCreated only for in class use */ private A(int x, boolean adminCreated){ this.x = x; this.adminCreated = adminCreated; } /** * constructor * @param x random key val */ public A(int x){ this.x = x; } /** * getter for X * @return val of x */ public int getX() { return x; } /** * setter for x * @param x enter new x val */ public void setX(int x) { this.x = x; } /** * toString * @return string rep of this obj */ @Override public String toString() { return "This is the " + x + " A"; } /** * adds one to x */ @Override public void addOne() { x++; } /** * subtracts one to x */ @Override public void subtractOne() { x--; } }
true
0f17f3d60b109ffdcdb99cf4145cefb23dafa888
Java
dukunpeng/MvpProject
/mvptest/src/main/java/com/example/newtest/contract/MainActivityContract.java
UTF-8
841
1.929688
2
[]
no_license
package com.example.newtest.contract; import com.example.newtest.base.IBaseModel; import com.example.newtest.base.IBasePresenter; import com.example.newtest.base.IBaseView; import com.example.newtest.bean.LoginInfo; import com.example.newtest.bean.SystemUpdateBean; import com.example.newtest.common.APPClientParam; import com.example.newtest.request.OkHttpClientManager; /** * Created by Mark on 2018/7/11. */ public interface MainActivityContract { interface Model extends IBaseModel { void getAndroidSystemUpdateData(APPClientParam apm, OkHttpClientManager.ResultCallback<SystemUpdateBean> callback); } interface View extends IBaseView { void initNavigation(); } interface Presenter extends IBasePresenter{ void checkForUpdateSystem(); void showFragment(int index); } }
true
e00bc2a2e1b8dfe884f696729104e4b5215e79b4
Java
solvillan/Programmering-2
/src/se/doverfelt/prog2/game21/gui/components/GameView.java
UTF-8
1,435
2.984375
3
[]
no_license
package se.doverfelt.prog2.game21.gui.components; import se.doverfelt.prog2.game21.EnumMode; import se.doverfelt.prog2.game21.Game21; import se.doverfelt.prog2.game21.gui.views.EasyView; import se.doverfelt.prog2.game21.gui.views.HardView; import se.doverfelt.prog2.game21.gui.views.PVPView; import javax.swing.*; /** * File Name: GameView.java * Author: Rickard Doverfelt * Class: TE21 / TI2 */ public class GameView extends JFrame{ private EnumMode mode; private BaseView mainView; public Game21 game; //Initialize the window public GameView(EnumMode mode, Game21 game21) { this.mode = mode; this.game = game21; if (mode != EnumMode.PVP) { initPVCWindow(mode); } else { initPVPWindow(); } this.setLocationRelativeTo(null); this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); this.setSize(400, 300); this.setVisible(true); this.setLocation(this.getLocation().x - (this.getWidth()/2), this.getLocation().y - (this.getHeight()/2)); } public BaseView getMainView() { return mainView; } private void initPVPWindow() { mainView = new PVPView(this); this.add(mainView); } private void initPVCWindow(EnumMode mode) { mainView = mode == EnumMode.COMP_EASY ? new EasyView(this) : new HardView(this); this.add(mainView); } }
true
c48e3992c1c5711a536052641a721d7d6069244c
Java
MarcinSc/generic-tcg
/generic-tcg/overpower-tcg/src/main/java/com/gempukku/tcg/overpower/filter/PlaceableOnCardsFilter.java
UTF-8
3,300
2.203125
2
[]
no_license
package com.gempukku.tcg.overpower.filter; import com.gempukku.tcg.GameObjects; import com.gempukku.tcg.digital.DigitalEnvironment; import com.gempukku.tcg.digital.DigitalObject; import com.gempukku.tcg.generic.GenericContextObjects; import com.gempukku.tcg.generic.effect.GameEffectContext; import com.gempukku.tcg.generic.evaluator.ConstantStringEvaluator; import com.gempukku.tcg.generic.evaluator.StringEvaluator; import com.gempukku.tcg.generic.filter.DigitalObjectFilter; import com.gempukku.tcg.generic.filter.Filters; import com.gempukku.tcg.generic.filter.PredicateFilter; import com.gempukku.tcg.generic.predicate.OwnerPredicate; import com.gempukku.tcg.generic.zone.player.DigitalObjectZoneManager; import com.gempukku.tcg.generic.util.DigitalObjectUtils; import com.gempukku.tcg.overpower.OverpowerContextObjects; import com.gempukku.tcg.overpower.card.OverpowerCardBlueprint; import com.gempukku.tcg.overpower.card.OverpowerCardManager; import javax.sql.rowset.Predicate; import java.util.List; public class PlaceableOnCardsFilter implements DigitalObjectFilter { private StringEvaluator _id; public void setId(StringEvaluator id) { _id = id; } @Override public boolean accept(GameObjects gameObjects, GameEffectContext context, DigitalObject possibleCardToPlaceOn) { final DigitalEnvironment digitalEnvironment = GenericContextObjects.extractGameObject(gameObjects, GenericContextObjects.DIGITAL_ENVIRONMENT); String cardToPlaceId = _id.getValue(gameObjects, context); final DigitalObject cardToPlaceObject = digitalEnvironment.getObjectById(cardToPlaceId); if (!cardToPlaceObject.getAttributes().get("owner").equals(possibleCardToPlaceOn.getAttributes().get("owner"))) return false; final OverpowerCardManager overpowerCardManager = OverpowerContextObjects.extractGameObject(gameObjects, OverpowerContextObjects.OVERPOWER_CARD_MANAGER); final OverpowerCardBlueprint possibleCharacterToPlaceOn = overpowerCardManager.getCardBlueprint(gameObjects, possibleCardToPlaceOn); if (!possibleCharacterToPlaceOn.getCardType().equals("character")) return false; final DigitalObjectZoneManager inPlay = OverpowerContextObjects.extractGameObject(gameObjects, OverpowerContextObjects.IN_PLAY_ZONE); final OverpowerCardBlueprint cardToPlace = overpowerCardManager.getCardBlueprint(gameObjects, cardToPlaceObject); if (!cardToPlace.getPlaceOnFilter().accept(gameObjects, context, possibleCardToPlaceOn)) return false; List<DigitalObject> cardsInPlay = inPlay.getDigitalObjectsInZone(gameObjects, null); final List<DigitalObject> placedOn = DigitalObjectUtils.filter(gameObjects, Filters.and(new PredicateFilter(new OwnerPredicate(possibleCardToPlaceOn.getAttributes().get("owner"))), new PlacedOnFilter(new ConstantStringEvaluator(possibleCardToPlaceOn.getId()))), context, cardsInPlay); for (DigitalObject cardPlacedOnCharacter : placedOn) { // Check if the card already has card of this type placed if (overpowerCardManager.getCardBlueprint(gameObjects, cardPlacedOnCharacter).getCardType().equals(cardToPlace.getCardType())) return false; } return true; } }
true
a6c86f59c76db84d031ffe7cfafa83b28614a36b
Java
EshanLekamge/TravelAnywhere.com
/CustomerDemo/src/com/customer/Customerinsert.java
UTF-8
1,455
2.21875
2
[]
no_license
package com.customer; import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet("/Customerinsert") public class Customerinsert extends HttpServlet { private static final long serialVersionUID = 1L; protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String name = request.getParameter("name"); String email = request.getParameter("email"); int cardnumber = Integer.parseInt(request.getParameter("cardnumber")); String expiredate = request.getParameter("expiredate"); int securitycode = Integer.parseInt(request.getParameter("securitycode")); int amount = Integer.parseInt(request.getParameter("amount")); String username = request.getParameter("uid"); String password = request.getParameter("psw"); boolean isTrue; isTrue = CustomerDBUtil.insertcustomer(name, email,cardnumber,expiredate,securitycode,amount ,username,password); if(isTrue == true) { RequestDispatcher dis = request.getRequestDispatcher("useraccount.jsp"); dis.forward(request, response); } else { RequestDispatcher dis2 = request.getRequestDispatcher("unsuccess.jsp"); dis2.forward(request, response); } } }
true
6fb71f31b589fa8e17cb373df9dde124bd34863f
Java
govindtbits/training2
/empfinal/src/main/java/com/tbitsglobal/services/EmpService.java
UTF-8
1,330
2.40625
2
[]
no_license
package com.tbitsglobal.services; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; //import com.tbitsglobal.Employee; //import com.tbitsglobal.EmployeeDao; import com.tbitsglobal.*; @Path("/tbits") public class EmpService { @GET @Path("/get") @Produces(MediaType.APPLICATION_JSON) public Response viewEmployee() { // String output = "this is a test msg"; // return Response.status(200).entity(output).build(); System.out.println("\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ "); //Employee emp=new Employee(); //Employee emp= EmployeeDao.getEmployeeByPrimaryKey(5); //Employee emp= EmployeeDao.createEmployee(new Employee("rdfg", "78988")); HelloWorld emp=new HelloWorld(); return Response.status(Response.Status.OK).entity(emp).build(); // if(emp == null) // { // System.out.println("this is a test msg 2"); // return Response.status(Response.Status.NO_CONTENT).entity(emp).build(); // } // else // { // System.out.println("employee:"); // return Response.status(Response.Status.OK).entity(emp).build(); // } } }
true
2770b33d821e480a780f18fcbfb57e9005ec4326
Java
TauKitty/ss13-gitwebhook-handler
/src/main/java/io/github/spair/service/dmm/ChunkDiffGenerator.java
UTF-8
5,156
2.203125
2
[ "MIT" ]
permissive
package io.github.spair.service.dmm; import io.github.spair.byond.ByondTypes; import io.github.spair.byond.dmm.MapRegion; import io.github.spair.byond.dmm.parser.Dmm; import io.github.spair.byond.dmm.render.DmmRender; import io.github.spair.service.dmm.entity.DmmChunkDiff; import io.github.spair.service.image.ImageHelper; import io.github.spair.service.image.ImageUploaderService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import javax.annotation.Nullable; import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.List; @Component final class ChunkDiffGenerator { private final ImageUploaderService imageUploaderService; private static final int SOFT_SPLIT_LIMIT = 4000; private static final int HARD_SPLIT_LIMIT = 8000; private static final int SOFT_SPLIT_FACTOR = 2; private static final int HARD_SPLIT_FACTOR = 4; @Autowired ChunkDiffGenerator(final ImageUploaderService imageUploaderService) { this.imageUploaderService = imageUploaderService; } List<DmmChunkDiff> generate(final List<MapRegion> chunks, @Nullable final Dmm oldDmm, @Nullable final Dmm newDmm) { List<DmmChunkDiff> dmmDiffChunks = new ArrayList<>(); chunks.forEach(mapRegion -> { final BufferedImage oldChunkImage = renderImage(oldDmm, mapRegion, false); final BufferedImage newChunkImage = renderImage(newDmm, mapRegion, false); final BufferedImage oldChunkAreaImage = renderImage(oldDmm, mapRegion, true); final BufferedImage newChunkAreaImage = renderImage(newDmm, mapRegion, true); List<String> oldImagesLinks = new ArrayList<>(); List<String> oldAreasImagesLinks = new ArrayList<>(); List<String> newImagesLinks = new ArrayList<>(); List<String> newAreasImagesLinks = new ArrayList<>(); List<String> diffImagesLinks = new ArrayList<>(); List<String> diffAreasImagesLinks = new ArrayList<>(); if (oldChunkImage != null) { oldImagesLinks = getImageLinks(oldChunkImage); } if (oldChunkAreaImage != null) { oldAreasImagesLinks = getImageLinks(oldChunkAreaImage); } if (newChunkImage != null) { newImagesLinks = getImageLinks(newChunkImage); } if (newChunkAreaImage != null) { newAreasImagesLinks = getImageLinks(newChunkAreaImage); } if (oldChunkImage != null && newChunkImage != null) { BufferedImage differenceImage = ImageHelper.getDifferenceImage(oldChunkImage, newChunkImage); diffImagesLinks = getImageLinks(differenceImage); } if (oldChunkAreaImage != null && newChunkAreaImage != null) { BufferedImage differenceImage = ImageHelper.getDifferenceImage(oldChunkAreaImage, newChunkAreaImage); diffAreasImagesLinks = getImageLinks(differenceImage); } dmmDiffChunks.add(DmmChunkDiff.builder() .oldChunkImagesLinks(oldImagesLinks).oldChunkAreasImagesLinks(oldAreasImagesLinks) .newChunkImagesLinks(newImagesLinks).newChunkAreasImagesLinks(newAreasImagesLinks) .diffImagesLinks(diffImagesLinks).diffAreasImagesLinks(diffAreasImagesLinks) .build() ); }); return dmmDiffChunks; } @Nullable private BufferedImage renderImage(@Nullable final Dmm dmm, final MapRegion mapRegion, final boolean areaMode) { if (dmm != null) { if (areaMode) { return DmmRender.renderToImage(dmm, mapRegion, ByondTypes.TURF, ByondTypes.OBJ, ByondTypes.MOB); } else { return DmmRender.renderToImage(dmm, mapRegion, ByondTypes.AREA); } } return null; } private List<String> getImageLinks(final BufferedImage image) { List<String> imageLinks = new ArrayList<>(); if (isToSoftSplit(image)) { ImageHelper.splitImage(image, SOFT_SPLIT_FACTOR).forEach(img -> imageLinks.add(imageUploaderService.uploadImage(img)) ); } else if (isToHardSplit(image)) { ImageHelper.splitImage(image, HARD_SPLIT_FACTOR).forEach(img -> imageLinks.add(imageUploaderService.uploadImage(img)) ); } else { imageLinks.add(imageUploaderService.uploadImage(image)); } return imageLinks; } // Full map render generates really BIG image, so splitting is necessary. private boolean isToSoftSplit(final BufferedImage image) { return image.getWidth() >= SOFT_SPLIT_LIMIT && image.getWidth() < HARD_SPLIT_LIMIT || image.getHeight() >= SOFT_SPLIT_LIMIT && image.getHeight() < HARD_SPLIT_LIMIT; } private boolean isToHardSplit(final BufferedImage image) { return image.getWidth() >= HARD_SPLIT_LIMIT || image.getHeight() >= HARD_SPLIT_LIMIT; } }
true
199eb63a8f1c17af5ccfb343568518ac9c57de2d
Java
stan-alam/exonum-java-binding
/exonum-java-binding-cryptocurrency-demo/src/main/java/com/exonum/binding/cryptocurrency/transactions/converters/TransactionMessageConverter.java
UTF-8
1,545
2.171875
2
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
/* * Copyright 2018 The Exonum 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 com.exonum.binding.cryptocurrency.transactions.converters; import com.exonum.binding.messages.BinaryMessage; import com.exonum.binding.messages.Message; import com.exonum.binding.messages.Transaction; /** * A converter between executable transaction & its binary message. * * @param <TransactionT> a type of transaction. You can have a single {@link * TransactionMessageConverter} that works with any transactions of this service or a converter * for each transaction type. */ public interface TransactionMessageConverter<TransactionT extends Transaction> { /** Converts a message into an executable transaction. */ TransactionT fromMessage(Message txMessage); /** * Returns a message, representing the given transaction. * * <p>In a more general case, one will have to provide the signature, network getId, etc., see * class level comment. */ BinaryMessage toMessage(TransactionT transaction); }
true
44e92f7e41ce8f6a54b68acdb9f0c8ec925ea7ac
Java
szqjige-nb/lyqc-base
/src/main/java/com/lyqc/yy/model/LyStore.java
UTF-8
1,548
1.609375
2
[]
no_license
package com.lyqc.yy.model; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; import java.util.Date; @Data public class LyStore implements Serializable { private static final long serialVersionUID = 6981130122569788343L; private Long id; private String appCode; private String dealerType; private String saleArea; private String saleArea2; private String companyName4; private String province4; private String city4; private String contactPerson; private String tel; private String isVip; private String onlineTime; private String flowSeq; private String dealerCompanyCode; private Date createTime; private String serialNo; @ApiModelProperty(name="belongDealer",value="所属门店id",dataType="String") private String belongDealer; @ApiModelProperty(name="belongDealerName",value="所属门店名称",dataType="String") private String belongDealerName; @ApiModelProperty(name="belongOperation",value="所属运营id",dataType="String") private String belongOperation; @ApiModelProperty(name="belongOperationName",value="所属运营名称",dataType="String") private String belongOperationName; @ApiModelProperty(name="belongMarket",value="所属市场id",dataType="String") private String belongMarket; @ApiModelProperty(name="belongMarketName",value="所属市场名称",dataType="String") private String belongMarketName; }
true
2498aa3987d905f8efa5d3a8234c68bc62d09c11
Java
keerthanaselvi1998/Spring-CoreModule
/src/com/cts/model/Employee.java
UTF-8
1,436
2.359375
2
[]
no_license
package com.cts.model; public class Employee { private byte SystemNo; private short roomNo; private int id; private String name; private Double salary; private char gender; private long mobileNumber; private String maritalStatus; private Account account; public byte getSystemNo() { return SystemNo; } public void setSystemNo(byte systemNo) { SystemNo = systemNo; } public short getRoomNo() { return roomNo; } public void setRoomNo(short roomNo) { this.roomNo = roomNo; } 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 Double getSalary() { return salary; } public void setSalary(Double salary) { this.salary = salary; } public char getGender() { return gender; } public void setGender(char gender) { this.gender = gender; } public long getMobileNumber() { return mobileNumber; } public void setMobileNumber(long mobileNumber) { this.mobileNumber = mobileNumber; } public String getMaritalStatus() { return maritalStatus; } public void setMaritalStatus(String maritalStatus) { this.maritalStatus = maritalStatus; } public Account getAccount() { return account; } public void setAccount(Account account) { this.account = account; } }
true
1c374e05da7a22a5bb0cf42dfacef67de4073b0c
Java
Nithy-Sree/Playground
/Time sheet/Main.java
UTF-8
958
2.125
2
[]
no_license
#include<iostream> using namespace std; int main() { int d1,d2,d3,d4,d5,d6,d7; cin>>d1>>d2>>d3>>d4>>d5>>d6>>d7; int bon,brate,r1,r2,r3,r4,r5,r6,r7,x=0; int edays,totaldays, totalrate; r1 = d1*150; r7 = d7*125; if(d2 <=8){ r2=d2*100; } else if(d2>8) { bon = d2-8; brate = bon*115; r2 = brate + 800; } if(d3 <=8){ r3=d3*100; } else if(d3>8) { bon = d3-8; brate = bon*115; r3 = brate + 800; } if(d4 <=8){ r4=d4*100; } else if(d4>8) { bon = d4-8; brate = bon*115; r4 = brate + 800; } if(d5<=8){ r5=d5*100; } else if(d5>8) { bon = d5-8; brate = bon*115; r5 = brate + 800; } if(d6 <=8){ r6=d6*100; } else if(d6>8) { bon = d6-8; brate = bon*115; r6 = brate + 800; } totaldays = d2+d3+d4+d5+d6; if(totaldays>40) { edays = totaldays-40; x=edays*25; } totalrate = r1+r2+r3+r4+r5+r6+r7+x; cout<<totalrate; }
true
cea55ad8ecdb8f58e906cdbc14e076a13084e73a
Java
M3GlamCode/TourApp
/app/src/main/java/com/example/barclays/tourguideapp/ListViewAdapter.java
UTF-8
1,735
2.453125
2
[]
no_license
package com.example.barclays.tourguideapp; import android.app.Activity; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v7.widget.AppCompatRatingBar; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.TextView; import java.util.ArrayList; public class ListViewAdapter extends ArrayAdapter<CustomList> { public ListViewAdapter(Activity activity, ArrayList<CustomList> hotelList) { super(activity, 0,hotelList); } @NonNull @Override public View getView(int position, @Nullable View listViewItem, @NonNull ViewGroup parent) { if (listViewItem == null){ listViewItem = LayoutInflater.from(getContext()).inflate(R.layout.list_hotel, parent, false); } CustomList currentItem = getItem(position); ImageView hotelImage = listViewItem.findViewById(R.id.hotel_image); hotelImage.setImageResource(currentItem.getHotelImage()); TextView hotelName = listViewItem.findViewById(R.id.hotel_name); hotelName.setText(currentItem.getHotelTitle()); TextView hotelDescription = listViewItem.findViewById(R.id.hotel_description); hotelDescription.setText(currentItem.getHotelContent()); AppCompatRatingBar ratingBar = listViewItem.findViewById(R.id.rating_bar); ratingBar.setRating((float) currentItem.getStarRating()); TextView rating = listViewItem.findViewById(R.id.rating_number); rating.setText(String.valueOf(currentItem.getStarRating())); return listViewItem; } }//end of public class
true
3192f757d87f574372c4d478507a2d30d2d71382
Java
18506711722/AION-alyunoss-spring-boot-starter
/alyunoss-spring-boot-starter/src/main/java/cn/javaisrubbish/alyunoss/AlyunossSpringBootStarterApplication.java
UTF-8
355
1.679688
2
[]
no_license
package cn.javaisrubbish.alyunoss; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class AlyunossSpringBootStarterApplication { public static void main(String[] args) { SpringApplication.run(AlyunossSpringBootStarterApplication.class, args); } }
true
8df4626623371bee2755761facf64dac70a1a8e0
Java
davidwillock/Stats
/src/main/java/com/charlie1/funds/model/jChartAsset.java
UTF-8
825
2.21875
2
[]
no_license
package com.charlie1.funds.model; public class jChartAsset { private String Fund; private String Asset; private int Count; private int Percent; public jChartAsset() {} public String getFund() { return Fund; } public void setFund(String fund) { Fund = fund; } public String getAsset() { return Asset; } public void setAsset(String asset) { Asset = asset; } public int getCount() { return Count; } public void setCount(int count) { Count = count; } public int getPercent() { return Percent; } public void setPercent(int percent) { Percent = percent; } @Override public String toString() { return "{\"Fund\":\"" + Fund + "\", \"Asset\":\"" + Asset + "\", \"Count\":\"" + Count + "\", \"Percent\":" + Percent + "\"}"; } }
true
4e45e527c268dbb5ab5a425a3d3f5cbd7f7c6b25
Java
luisgiraldo03/patroness
/src/Main.java
UTF-8
182
1.875
2
[]
no_license
import storage.Storage; import views.Menu; public class Main { public static Storage storage = null; public static void main(String[] args) { Menu menu = new Menu(); } }
true
b687fdee53d78d4c00b8373eba4622a2582c74a9
Java
andreifecioru/udacity
/android.developer/FunTravel/app/src/main/java/com/example/android/funtravel/model/ReviewList.java
UTF-8
371
2.03125
2
[]
no_license
package com.example.android.funtravel.model; import java.util.List; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; public class ReviewList { @SerializedName("reviews") @Expose private List<? extends ParcelableReview> mReviews; public List<? extends ParcelableReview> getReviews() { return mReviews; } }
true
e5fdc0269d4702578593cc48dab689526dd72fdc
Java
Llubitza-Linares/tercerParcial
/src/main/java/adapter/Cliente.java
UTF-8
1,042
2.6875
3
[]
no_license
package adapter; public class Cliente { public static void main(String[] args) { IArtefactoElectronico celular = new Celular("Samsung A50", 650, "5 años"); IArtefactoElectronico tableta = new Tablet("Samsung Tablet", 800, "4 años"); IArtefactoElectronico computadora = new Computadora("Asus", 1250 , "5 años"); IArtefactoElectronico televisor = new ArtefactoElectronico(new Televidor("Sony", 2500, "10 años")); IArtefactoElectronico refrigerador = new ArtefactoElectronico(new Refrigerador("Lexus", 5000, "7 años")); IArtefactoElectronico lavadora = new ArtefactoElectronico(new Lavadora("LG", 3500, "12 años")); celular.precio(); tableta.precio(); computadora.precio(); televisor.precio(); refrigerador.precio(); lavadora.precio(); celular.tiempoVida(); tableta.tiempoVida(); computadora.tiempoVida(); televisor.tiempoVida(); refrigerador.tiempoVida(); lavadora.tiempoVida(); } }
true
f7da038fe3c5ff8bcb2394b2fe41ae91f155d1d5
Java
qiuchili/ggnn_graph_classification
/program_data/JavaProgramData/75/623.java
UTF-8
1,306
2.609375
3
[ "MIT" ]
permissive
package <missing>; public class GlobalMembers { //******************************** //*???????? ** //*?????? 1300012855 ** //*???2013.10.30 ** //******************************** public static int Main() { int[] intime = new int[1000]; // ??????????????????????????? int outtime; int outtimemax = 0; int[] timeline = new int[1000]; // ??????????? int num = 0; // ????? int timenum = 0; // ???????? char dot; // ?????????????? for (int i = 0; i < 1000; i++) { timeline[i] = 0; // ??timeline?? } dot = 0; while (dot != 10) // ???????????? { intime[num] = Integer.parseInt(ConsoleInput.readToWhiteSpace(true)); num++; dot = System.in.read(); } // ?????num??+1?????num????? for (int i = 0; i < num; i++) // ??????????????????timeline?????????????? { outtime = Integer.parseInt(ConsoleInput.readToWhiteSpace(true)); outtimemax = outtime > outtimemax != 0? outtime : outtimemax; // ???????????? for (int j = intime[i]; j < outtime; j++) { timeline[j]++; // ????????????timeline? } System.in.read(); // ???????? } for (int i = 0; i < outtimemax; i++) { timenum = timeline[i] > timenum != 0? timeline[i] : timenum; // ??????? } System.out.print(num); System.out.print(' '); System.out.print(timenum); return 0; } }
true
42c963e2e1222ee38291f88110d6696fc339d98c
Java
fanhui1991/beetl
/beetl/src/main/java/com/text/modular/console/service/PicService.java
UTF-8
313
1.640625
2
[]
no_license
package com.text.modular.console.service; import java.util.List; import java.util.Map; /** * Created by FH on 2018/8/29. */ public interface PicService { List<Map<String,Object>> queryPicList(Map map); int queryPicCount(Map<String, Object> params); int insertPic(Map<String, Object> params); }
true
b6cf1be14736dc97cf21be519eb52dc19b20283f
Java
QualiMaster/QM-IConf
/QualiMasterApplication/src/de/uni_hildesheim/sse/qmApp/commands/P2UpdateHandler.java
UTF-8
583
1.851563
2
[ "Apache-2.0" ]
permissive
package de.uni_hildesheim.sse.qmApp.commands; import org.eclipse.equinox.internal.p2.ui.sdk.UpdateHandler; import de.uni_hildesheim.sse.qmApp.model.Utils.ConfigurationProperties; /** * Handler to enable or disable the P2 Update. * * @author Sass * */ @SuppressWarnings("restriction") public class P2UpdateHandler extends UpdateHandler { /** * The constructor. */ public P2UpdateHandler() { // constructor boolean enableUpdate = !ConfigurationProperties.DEMO_MODE.getBooleanValue(); super.setBaseEnabled(enableUpdate); } }
true
b60c1217c43c8820123ce2b5e326d71e007098b9
Java
matt2929/kids_book
/app/src/main/java/com/google/cloud/android/speech/Activities/AnalysisSpeechReport.java
UTF-8
1,188
1.953125
2
[]
no_license
package com.google.cloud.android.speech.Activities; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.ImageButton; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.TextView; import com.google.cloud.android.speech.R; import com.google.cloud.android.speech.customview.CustomAdapter; import com.google.cloud.android.speech.customview.DataModel; import java.util.Arrays; import java.util.Comparator; public class AnalysisSpeechReport extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_analysis_speech_report); TextView title = (TextView) findViewById(R.id.textView4); ListView listView = (ListView) findViewById(R.id.listOfDifficultWords); ImageButton imageLeft = (ImageButton) findViewById(R.id.imageButton2); TextView pageTitle = (TextView) findViewById(R.id.textView5); ImageButton right = (ImageButton) findViewById(R.id.imageButton); listView.setAdapter(new CustomAdapter(PageTurner.words_to_duration,getApplicationContext())); title.setText("Problem Words"); } }
true
a2f56275baefde8cd780a00c514791998898f52e
Java
anderson-tomkelski/UFFS
/programacao_1/Aula 15/tweet/Tweet.java
UTF-8
629
2.71875
3
[]
no_license
class Tweet{ private String autor; private String mensagem; protected int data; public String hash; public void setAutor(String autor){ this.autor = autor; } public String getAutor(){ return this.autor; } public void setMensagem(String msg){ this.mensagem = msg; } public String getMensagem(){ return this.mensagem; } public void setData(int data){ this.data = data; } public int getData(){ return this.data; } public void retweet(){ System.out.println("\nRT - Autor: " + getAutor() + "\nRT - Data: " + getData() + "\nRT - Mensagem: " + getMensagem() + "\nRT - Hash: " + this.hash); } }
true
960522a06cb3e6ae7088233beacaf94b101df3eb
Java
Ayangy/hb_think_tank
/src/main/java/com/yuwubao/util/PageUtil.java
UTF-8
1,042
2.765625
3
[]
no_license
package com.yuwubao.util; /** * Created by yangyu on 2018/1/16. */ public class PageUtil { private int totalPages; // 总页数 private int index; //第几页 private int size; //每页几条 private int totalElements; //总共多少条数据 public int getTotalPages() { return totalPages; } // 计算总页数 public void setTotalPages(int numPerPage,int totalRows) { if (totalRows % numPerPage == 0) { this.totalPages = totalRows / numPerPage; } else { this.totalPages = (totalRows / numPerPage) + 1; } } public int getIndex() { return index; } public void setIndex(int index) { this.index = index; } public int getSize() { return size; } public void setSize(int size) { this.size = size; } public int getTotalElements() { return totalElements; } public void setTotalElements(int totalElements) { this.totalElements = totalElements; } }
true
0c9bba37c7ce5b4a5a9053b30c0499c2362c5039
Java
hollowware/Java-homework
/Java-homework/src/op030_Currency/Main.java
UTF-8
1,023
3.515625
4
[]
no_license
package op030_Currency; import java.io.IOException; import java.io.RandomAccessFile; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main { private static Scanner input = new Scanner(System.in); public static void main(String[] args) { List<String> allCurencies = new ArrayList<String>(); ShowAvailableCurrencies.fillList(allCurencies); System.out.println("Available currencies: \n" + allCurencies); System.out.print("What currency you have?"); String from = input.next().toLowerCase(); System.out.print("Amount of that currency: "); double amountOfMoney = input.nextDouble(); System.out.print("Convert to currency: "); String to = input.next().toLowerCase(); CurrencyFileRoaming currencyChange = new CurrencyFileRoaming(from, to, amountOfMoney); currencyChange.readFile(from, to); currencyChange.Convert(amountOfMoney); } }
true
51701605283819abdd88d6c83e029f7a4d9ad4d0
Java
FengLin-GJ/online-test-system
/src/main/java/com/ots/action/Impl/ExamActionImpl.java
UTF-8
667
1.796875
2
[]
no_license
package com.ots.action.Impl; import com.opensymphony.xwork2.ActionSupport; import com.opensymphony.xwork2.ModelDriven; import com.ots.action.ExamAction; import com.ots.entity.Transcript; import com.ots.service.ExamService; public class ExamActionImpl extends ActionSupport implements ModelDriven<Transcript>, ExamAction { /** * */ private static final long serialVersionUID = 1L; private Transcript transcript = new Transcript(); public Transcript getModel() { // TODO Auto-generated method stub return transcript; } private ExamService examService; public void setExamService(ExamService examService) { this.examService = examService; } }
true
2a8b2eef5d7bb7cb3d76a000407e084d3be7061e
Java
WangYi0220/pdd
/src/main/java/com/tw/pdd/service/GoodsCategoryServiceImpl.java
UTF-8
1,998
2.09375
2
[]
no_license
package com.tw.pdd.service; import com.tw.pdd.common.RedisCacheManager; import com.tw.pdd.mapper.GoodsCategoryMapper; import com.tw.pdd.pojo.GoodsBrand; import com.tw.pdd.pojo.GoodsCategory; import com.tw.pdd.pojo.SeekData; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; @Service @Transactional public class GoodsCategoryServiceImpl implements GoodsCategoryService { @Autowired private GoodsCategoryMapper goodsCategoryMapper; @Autowired private RedisCacheManager redisCacheManager; /** * 获取商品一级分类 * * @return */ @Override public List<Object> getGoodsCategoryList() { if (redisCacheManager.hasKey("getGoodsCategoryList")) { return redisCacheManager.lGet("getGoodsCategoryList", 0, -1); } else { List<Object> goodsCategoryList = goodsCategoryMapper.getGoodsCategoryList(); redisCacheManager.lSet("getGoodsCategoryList", goodsCategoryList, 3600); return goodsCategoryList; } } /** * 搜索板块的数据 * * @return */ @Override public SeekData getSeekData() { if (redisCacheManager.hasKey("seekData")) { List<Object> seekData = redisCacheManager.lGet("seekData", 0, 1); return (SeekData) seekData.get(0); } else { SeekData seekData = new SeekData(); List<GoodsBrand> goodsBrandList = goodsCategoryMapper.getGoodsBrandList();//商品品牌 List<GoodsCategory> goodsCategoryList = goodsCategoryMapper.getGoodsCategoryAndGoodsCategoryDetail();//商品二级分类 seekData.setGoodsBrandList(goodsBrandList); seekData.setGoodsCategoryList(goodsCategoryList); redisCacheManager.lSet2("seekData", seekData, 3600); return seekData; } } }
true
001948fd1a9f63e64929fa3b98e468cad96479ee
Java
Fedcba13/kh_final
/UrbanTable/src/main/java/com/kh/urbantable/event/model/vo/Coupon.java
UTF-8
343
1.679688
2
[]
no_license
package com.kh.urbantable.event.model.vo; import java.sql.Date; import lombok.Data; @Data public class Coupon { private String couponId; private String memberId; private String couponDiscount; private Date couponStartDate; private Date couponEndDate; private int couponEnabled; private int couponMinPrice; }
true
294208b159151ae3a47f5ae2b0ce520c60f7ed1b
Java
patrickneubauer/XMLIntellEdit
/xmlintelledit/xmltext/src/main/java/isostdisois_13584_32ed_1techxmlschemaontomlSimplified/impl/GEOMETRICUNITCONTEXTImpl.java
UTF-8
14,400
1.539063
2
[ "MIT" ]
permissive
/** */ package isostdisois_13584_32ed_1techxmlschemaontomlSimplified.impl; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; import isostdisois_13584_32ed_1techxmlschemaontomlSimplified.DICUNIT; import isostdisois_13584_32ed_1techxmlschemaontomlSimplified.DICUNITREFERENCE; import isostdisois_13584_32ed_1techxmlschemaontomlSimplified.GEOMETRICUNITCONTEXT; import isostdisois_13584_32ed_1techxmlschemaontomlSimplified.Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>GEOMETRICUNITCONTEXT</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link isostdisois_13584_32ed_1techxmlschemaontomlSimplified.impl.GEOMETRICUNITCONTEXTImpl#getLengthUnit <em>Length Unit</em>}</li> * <li>{@link isostdisois_13584_32ed_1techxmlschemaontomlSimplified.impl.GEOMETRICUNITCONTEXTImpl#getLengthUnitId <em>Length Unit Id</em>}</li> * <li>{@link isostdisois_13584_32ed_1techxmlschemaontomlSimplified.impl.GEOMETRICUNITCONTEXTImpl#getLangleUnit <em>Langle Unit</em>}</li> * <li>{@link isostdisois_13584_32ed_1techxmlschemaontomlSimplified.impl.GEOMETRICUNITCONTEXTImpl#getAngleUnitId <em>Angle Unit Id</em>}</li> * </ul> * * @generated */ public class GEOMETRICUNITCONTEXTImpl extends MinimalEObjectImpl.Container implements GEOMETRICUNITCONTEXT { /** * The cached value of the '{@link #getLengthUnit() <em>Length Unit</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getLengthUnit() * @generated * @ordered */ protected DICUNIT lengthUnit; /** * The cached value of the '{@link #getLengthUnitId() <em>Length Unit Id</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getLengthUnitId() * @generated * @ordered */ protected DICUNITREFERENCE lengthUnitId; /** * The cached value of the '{@link #getLangleUnit() <em>Langle Unit</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getLangleUnit() * @generated * @ordered */ protected DICUNIT langleUnit; /** * The cached value of the '{@link #getAngleUnitId() <em>Angle Unit Id</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getAngleUnitId() * @generated * @ordered */ protected DICUNITREFERENCE angleUnitId; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected GEOMETRICUNITCONTEXTImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.Literals.GEOMETRICUNITCONTEXT; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public DICUNIT getLengthUnit() { return lengthUnit; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetLengthUnit(DICUNIT newLengthUnit, NotificationChain msgs) { DICUNIT oldLengthUnit = lengthUnit; lengthUnit = newLengthUnit; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.GEOMETRICUNITCONTEXT__LENGTH_UNIT, oldLengthUnit, newLengthUnit); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setLengthUnit(DICUNIT newLengthUnit) { if (newLengthUnit != lengthUnit) { NotificationChain msgs = null; if (lengthUnit != null) msgs = ((InternalEObject)lengthUnit).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.GEOMETRICUNITCONTEXT__LENGTH_UNIT, null, msgs); if (newLengthUnit != null) msgs = ((InternalEObject)newLengthUnit).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.GEOMETRICUNITCONTEXT__LENGTH_UNIT, null, msgs); msgs = basicSetLengthUnit(newLengthUnit, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.GEOMETRICUNITCONTEXT__LENGTH_UNIT, newLengthUnit, newLengthUnit)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public DICUNITREFERENCE getLengthUnitId() { return lengthUnitId; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetLengthUnitId(DICUNITREFERENCE newLengthUnitId, NotificationChain msgs) { DICUNITREFERENCE oldLengthUnitId = lengthUnitId; lengthUnitId = newLengthUnitId; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.GEOMETRICUNITCONTEXT__LENGTH_UNIT_ID, oldLengthUnitId, newLengthUnitId); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setLengthUnitId(DICUNITREFERENCE newLengthUnitId) { if (newLengthUnitId != lengthUnitId) { NotificationChain msgs = null; if (lengthUnitId != null) msgs = ((InternalEObject)lengthUnitId).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.GEOMETRICUNITCONTEXT__LENGTH_UNIT_ID, null, msgs); if (newLengthUnitId != null) msgs = ((InternalEObject)newLengthUnitId).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.GEOMETRICUNITCONTEXT__LENGTH_UNIT_ID, null, msgs); msgs = basicSetLengthUnitId(newLengthUnitId, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.GEOMETRICUNITCONTEXT__LENGTH_UNIT_ID, newLengthUnitId, newLengthUnitId)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public DICUNIT getLangleUnit() { return langleUnit; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetLangleUnit(DICUNIT newLangleUnit, NotificationChain msgs) { DICUNIT oldLangleUnit = langleUnit; langleUnit = newLangleUnit; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.GEOMETRICUNITCONTEXT__LANGLE_UNIT, oldLangleUnit, newLangleUnit); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setLangleUnit(DICUNIT newLangleUnit) { if (newLangleUnit != langleUnit) { NotificationChain msgs = null; if (langleUnit != null) msgs = ((InternalEObject)langleUnit).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.GEOMETRICUNITCONTEXT__LANGLE_UNIT, null, msgs); if (newLangleUnit != null) msgs = ((InternalEObject)newLangleUnit).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.GEOMETRICUNITCONTEXT__LANGLE_UNIT, null, msgs); msgs = basicSetLangleUnit(newLangleUnit, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.GEOMETRICUNITCONTEXT__LANGLE_UNIT, newLangleUnit, newLangleUnit)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public DICUNITREFERENCE getAngleUnitId() { return angleUnitId; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetAngleUnitId(DICUNITREFERENCE newAngleUnitId, NotificationChain msgs) { DICUNITREFERENCE oldAngleUnitId = angleUnitId; angleUnitId = newAngleUnitId; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.GEOMETRICUNITCONTEXT__ANGLE_UNIT_ID, oldAngleUnitId, newAngleUnitId); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setAngleUnitId(DICUNITREFERENCE newAngleUnitId) { if (newAngleUnitId != angleUnitId) { NotificationChain msgs = null; if (angleUnitId != null) msgs = ((InternalEObject)angleUnitId).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.GEOMETRICUNITCONTEXT__ANGLE_UNIT_ID, null, msgs); if (newAngleUnitId != null) msgs = ((InternalEObject)newAngleUnitId).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.GEOMETRICUNITCONTEXT__ANGLE_UNIT_ID, null, msgs); msgs = basicSetAngleUnitId(newAngleUnitId, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.GEOMETRICUNITCONTEXT__ANGLE_UNIT_ID, newAngleUnitId, newAngleUnitId)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.GEOMETRICUNITCONTEXT__LENGTH_UNIT: return basicSetLengthUnit(null, msgs); case Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.GEOMETRICUNITCONTEXT__LENGTH_UNIT_ID: return basicSetLengthUnitId(null, msgs); case Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.GEOMETRICUNITCONTEXT__LANGLE_UNIT: return basicSetLangleUnit(null, msgs); case Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.GEOMETRICUNITCONTEXT__ANGLE_UNIT_ID: return basicSetAngleUnitId(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.GEOMETRICUNITCONTEXT__LENGTH_UNIT: return getLengthUnit(); case Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.GEOMETRICUNITCONTEXT__LENGTH_UNIT_ID: return getLengthUnitId(); case Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.GEOMETRICUNITCONTEXT__LANGLE_UNIT: return getLangleUnit(); case Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.GEOMETRICUNITCONTEXT__ANGLE_UNIT_ID: return getAngleUnitId(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.GEOMETRICUNITCONTEXT__LENGTH_UNIT: setLengthUnit((DICUNIT)newValue); return; case Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.GEOMETRICUNITCONTEXT__LENGTH_UNIT_ID: setLengthUnitId((DICUNITREFERENCE)newValue); return; case Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.GEOMETRICUNITCONTEXT__LANGLE_UNIT: setLangleUnit((DICUNIT)newValue); return; case Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.GEOMETRICUNITCONTEXT__ANGLE_UNIT_ID: setAngleUnitId((DICUNITREFERENCE)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.GEOMETRICUNITCONTEXT__LENGTH_UNIT: setLengthUnit((DICUNIT)null); return; case Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.GEOMETRICUNITCONTEXT__LENGTH_UNIT_ID: setLengthUnitId((DICUNITREFERENCE)null); return; case Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.GEOMETRICUNITCONTEXT__LANGLE_UNIT: setLangleUnit((DICUNIT)null); return; case Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.GEOMETRICUNITCONTEXT__ANGLE_UNIT_ID: setAngleUnitId((DICUNITREFERENCE)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.GEOMETRICUNITCONTEXT__LENGTH_UNIT: return lengthUnit != null; case Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.GEOMETRICUNITCONTEXT__LENGTH_UNIT_ID: return lengthUnitId != null; case Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.GEOMETRICUNITCONTEXT__LANGLE_UNIT: return langleUnit != null; case Isostdisois_13584_32ed_1techxmlschemaontomlSimplifiedPackage.GEOMETRICUNITCONTEXT__ANGLE_UNIT_ID: return angleUnitId != null; } return super.eIsSet(featureID); } } //GEOMETRICUNITCONTEXTImpl
true
508e1a72399d908372afbe361bfa2634261944cd
Java
jovanagrabez/SepProject
/SEP/PayPal/src/main/java/com/sep/paypal/model/enumeration/PaymentMethod.java
UTF-8
97
1.890625
2
[]
no_license
package com.sep.paypal.model.enumeration; public enum PaymentMethod { CREDIT_CARD, PAYPAL }
true
de17fb44fefe365b4def3026bb6bf5d0790c0d6f
Java
marcolopes/dma
/org.dma.xml/src/stockFilePT201/impl/SAFdecimalTypeImpl.java
UTF-8
763
1.632813
2
[]
no_license
/* * XML Type: SAFdecimalType * Namespace: urn:StockFile:PT_2_01 * Java type: stockFilePT201.SAFdecimalType * * Automatically generated - do not modify. */ package stockFilePT201.impl; /** * An XML SAFdecimalType(@urn:StockFile:PT_2_01). * * This is an atomic type that is a restriction of stockFilePT201.SAFdecimalType. */ public class SAFdecimalTypeImpl extends org.apache.xmlbeans.impl.values.JavaDecimalHolderEx implements stockFilePT201.SAFdecimalType { private static final long serialVersionUID = 1L; public SAFdecimalTypeImpl(org.apache.xmlbeans.SchemaType sType) { super(sType, false); } protected SAFdecimalTypeImpl(org.apache.xmlbeans.SchemaType sType, boolean b) { super(sType, b); } }
true
d92d28b735fa299d3f22b7cff3ef43db457cf5fc
Java
isabella232/msgraph-beta-sdk-java
/src/main/java/com/microsoft/graph/requests/extensions/AccessReviewInstanceCollectionPage.java
UTF-8
1,583
1.648438
2
[ "MIT" ]
permissive
// ------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. // ------------------------------------------------------------------------------ package com.microsoft.graph.requests.extensions; import com.microsoft.graph.models.extensions.AccessReviewInstance; import com.microsoft.graph.requests.extensions.IAccessReviewInstanceCollectionRequestBuilder; import com.microsoft.graph.http.BaseCollectionPage; import com.microsoft.graph.requests.extensions.AccessReviewInstanceCollectionPage; import com.microsoft.graph.requests.extensions.AccessReviewInstanceCollectionResponse; // **NOTE** This file was generated by a tool and any changes will be overwritten. /** * The class for the Access Review Instance Collection Page. */ public class AccessReviewInstanceCollectionPage extends BaseCollectionPage<AccessReviewInstance, IAccessReviewInstanceCollectionRequestBuilder> implements IAccessReviewInstanceCollectionPage { /** * A collection page for AccessReviewInstance * * @param response the serialized AccessReviewInstanceCollectionResponse from the service * @param builder the request builder for the next collection page */ public AccessReviewInstanceCollectionPage(final AccessReviewInstanceCollectionResponse response, final IAccessReviewInstanceCollectionRequestBuilder builder) { super(response.value, builder, response.additionalDataManager()); } }
true
e27f433f797fc00b1a007d1640005d900400bc4a
Java
opus-x/covid19-alert-api-1
/src/main/java/com/immotef/corona/virus_reports/deeplinks/FirebaseAPIClient.java
UTF-8
1,108
1.835938
2
[]
no_license
package com.immotef.corona.virus_reports.deeplinks; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; //TODO move hardcoded strings to config file name = "${feign.name}", url = "${feign.url}" //@FeignClient(value = "FirebaseAPIClient", url = "https://firebasedynamiclinks.googleapis.com",configuration = FirebaseClientConfiguration.class) @FeignClient(value = "${firebase.api.client.name}", url = "${firebase.url}",configuration = FirebaseClientConfiguration.class) public interface FirebaseAPIClient { @RequestMapping(method = RequestMethod.POST, value = "/v1/shortLinks?key=${firebase.app_key}", produces = "application/json") public FirebaseDynamicLink getFirebaseDynamicLink(@RequestBody FirebaseDynamicLinkInfo requestBody); }
true
4fd239048e631d0d424eb82946bb3690365e1b4c
Java
guxiaoyan5/graduadtionProject
/Analysis/src/main/java/edu/run/student/StudentCSStatisticsToDB.java
UTF-8
3,305
2.296875
2
[]
no_license
package edu.run.student; import edu.Dao.Student.StudentCSKey; import edu.Dao.Student.StudentCSValue; import edu.Dao.Student.StudentDayCSKey; import edu.Dao.Student.StudentDayCSValue; import edu.Infomation.Consume; import edu.Infomation.Student.StudentCS; import edu.Infomation.Student.StudentDayCS; import edu.Infomation.Student.StudentMonthCS; import edu.util.StaticConstant; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.Mapper; import org.apache.hadoop.mapreduce.Reducer; import org.apache.hadoop.mapreduce.lib.db.DBConfiguration; import org.apache.hadoop.mapreduce.lib.db.DBInputFormat; import org.apache.hadoop.mapreduce.lib.db.DBOutputFormat; import java.io.IOException; import java.sql.Date; public class StudentCSStatisticsToDB { public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException { Configuration configuration = new Configuration(); configuration.set("mapreduce.framework.name", "yarn"); DBConfiguration.configureDB(configuration, StaticConstant.jdbcDriver, StaticConstant.jdbcUrl, StaticConstant.jdbcUser, StaticConstant.jdbcPassword); Job job = Job.getInstance(configuration, "student consume"); //job.addArchiveToClassPath(new Path("hdfs://master:9000/user/util/mysql-connector-java-5.1.49.jar")); job.setJarByClass(StudentCSStatisticsToDB.class); job.setMapperClass(StudentMap.class); job.setReducerClass(StudentReduce.class); job.setMapOutputKeyClass(StudentCSKey.class); job.setMapOutputValueClass(StudentCSValue.class); job.setOutputKeyClass(StudentCS.class); job.setOutputValueClass(StudentCS.class); job.setInputFormatClass(DBInputFormat.class); job.setOutputFormatClass(DBOutputFormat.class); DBOutputFormat.setOutput(job, "student_consumption_statistics", "sid", "consumption_count", "consumption_total_money", "consumption_average_money"); DBInputFormat.setInput(job, Consume.class, "consume", null, null, "sid", "execution_time", "money", "store_id ", "mode"); boolean result = job.waitForCompletion(true); System.exit(result ? 0 : 1); } static class StudentMap extends Mapper<Object, Consume, StudentCSKey, StudentCSValue> { @Override protected void map(Object key, Consume value, Context context) throws IOException, InterruptedException { context.write(new StudentCSKey(value.getSid()), new StudentCSValue(value.getMoney())); } } static class StudentReduce extends Reducer<StudentCSKey, StudentCSValue, StudentCS, StudentCS> { @Override protected void reduce(StudentCSKey key, Iterable<StudentCSValue> values, Context context) throws IOException, InterruptedException { int count = 0; float totalMoney = 0; for (StudentCSValue value : values) { count += 1; totalMoney += value.getMoney(); } float average = totalMoney / count; context.write(new StudentCS(key.getSid(), count, totalMoney, average), new StudentCS(key.getSid(), count, totalMoney, average)); } } }
true
dbe684e44cd68507c62adebf4c8140e92f3ad566
Java
suvdsophia/first
/first/src/secondCode.java
UTF-8
212
2.265625
2
[]
no_license
public class secondCode { public static void main(String[] args){ System.out.println("This is song lyrics"); System.out.println(); System.out.print("hello this is next line"); } }
true
c01060ec5289a8d1517044b91f37165b77412ff8
Java
Asmita301291/RadioButton
/app/src/main/java/com/example/radiobutton/MainActivity.java
UTF-8
2,365
2.4375
2
[]
no_license
package com.example.radiobutton; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends AppCompatActivity { private RadioGroup radiogroup; private RadioButton radioButton; Button btnsubmit; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); radiogroup= findViewById(R.id.radio_group); btnsubmit=findViewById(R.id.submit); radiogroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup radioGroup, int i) { radioButton=radioGroup.findViewById(i); // Toast.makeText(MainActivity.this,""+radioButton.getText(),Toast.LENGTH_SHORT).show(); } }); } public void submitRadioButton(View view) { int selectedid=radiogroup.getCheckedRadioButtonId(); /* if(selectedid==-1){ Toast.makeText(MainActivity.this,"You have not selected anything",Toast.LENGTH_SHORT).show(); } else{ Toast.makeText(MainActivity.this,""+radioButton.getText(),Toast.LENGTH_SHORT).show(); }*/ switch (selectedid){ case -1: Toast.makeText(MainActivity.this,"You have not selected anything",Toast.LENGTH_SHORT).show(); break; case 1: Toast.makeText(MainActivity.this,"You Select HTML ",Toast.LENGTH_SHORT).show(); Intent intent= new Intent(MainActivity.this,HtmlActivity.class); startActivity(intent); break; case 2: Toast.makeText(MainActivity.this,"You have selected CSS",Toast.LENGTH_SHORT).show(); break; case 5: Toast.makeText(MainActivity.this,"You have selected Android",Toast.LENGTH_SHORT).show(); Intent intent1= new Intent(MainActivity.this,Android.class); startActivity(intent1); break; } } }
true
adec745cb7521fb0df6d1d0d1bd64d1b1fd62235
Java
wndrws/bank-vault
/bank-vault-core/src/main/java/kspt/bank/enums/ManipulationType.java
UTF-8
78
1.921875
2
[ "MIT" ]
permissive
package kspt.bank.enums; public enum ManipulationType { NONE, PUT, GET }
true
56168a495d40fa07fe6706c39c0cd0329d723740
Java
kiver2016/RuoYi-Oracle
/zhzx-ims/src/main/java/com/zhzx/ims/mapper/OrderManagementMapper.java
UTF-8
1,478
2.109375
2
[ "MIT" ]
permissive
package com.zhzx.ims.mapper; import com.zhzx.ims.domain.OrderManagement; import java.util.List; /** * 订单信息Mapper接口 * * @author kiver * @date 2019-12-04 */ public interface OrderManagementMapper { /** * 查询订单信息 * * @param orderManagementId 订单信息ID * @return 订单信息 */ public OrderManagement selectOrderManagementById(Long orderManagementId); /** * 查询订单信息列表 * * @param orderManagement 订单信息 * @return 订单信息集合 */ public List<OrderManagement> selectOrderManagementList(OrderManagement orderManagement); /** * 新增订单信息 * * @param orderManagement 订单信息 * @return 结果 */ public int insertOrderManagement(OrderManagement orderManagement); /** * 修改订单信息 * * @param orderManagement 订单信息 * @return 结果 */ public int updateOrderManagement(OrderManagement orderManagement); /** * 删除订单信息 * * @param orderManagementId 订单信息ID * @return 结果 */ public int deleteOrderManagementById(Long orderManagementId); /** * 批量删除订单信息 * * @param orderManagementIds 需要删除的数据ID * @return 结果 */ public int deleteOrderManagementByIds(String[] orderManagementIds); }
true
67e48426ad34d78cd708b7fe2013e7ba1dc20218
Java
prateekengineer/JDexter
/src/main/java/org/jdexter/reader/DefaultReader.java
UTF-8
252
2.25
2
[]
no_license
package org.jdexter.reader; import org.jdexter.util.ReflectionUtil; public class DefaultReader extends Reader{ @Override public Object read(Class<?> classToRead) throws Exception { return ReflectionUtil.createDefaultInstance(classToRead); } }
true
abd064412b33a3f226263506264fc54262bc67bb
Java
zglbig/x2
/tools/src/main/java/org/baize/assemblybean/service/CheckType.java
UTF-8
8,269
2.578125
3
[]
no_license
package org.baize.assemblybean.service; import org.baize.LoggerUtils; import org.baize.StringUtils; import java.lang.reflect.Field; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; /** * 作者: 白泽 * 时间: 2017/11/3. * 描述: */ public class CheckType { /** * 根据类型获取该生成的类型 * @param t * @return */ public static String getArrType(String t,String beanName,String fieldName){ String type = ""; switch (t){ case "java.lang.String": type = "string"; break; case "java.lang.Double": type = "double"; break; case "java.lang.Boolean": type = "bool"; break; case "java.lang.Short": type = "short"; break; case "java.lang.Byte": type = "byte"; break; case "java.lang.Float": type = "float"; break; case "java.lang.Long": type = "long"; break; case "java.lang.Char": type = "char"; break; case "java.lang.Integer": type = "int"; break; case "String": type = "string"; break; case "double": type = "double"; break; case "boolean": type = "bool"; break; case "short": type = "short"; break; case "byte": type = "byte"; break; case "float": type = "float"; break; case "long": type = "long"; break; case "char": type = "char"; break; case "int": type = "int"; break; default: type = StringUtils.substringAfterLast(t,"."); } if (StringUtils.isBlank(type)) { type = "Object"; LoggerUtils.getPlatformLog().info("对象"+beanName+"的"+fieldName+"变量的类型属性"+t+"不正确:反射数据类型异常将自动转为string类型"); } return type; } // public static String getType(Type t,String beanName,String fieldName){ // String type = ""; // System.out.println(t.getTypeName()); // if(t == String.class) // type = "string"; // else if(t == byte.class) // type = "byte"; // else if(t == char.class) // type = "char"; // else if(t == short.class) // type = "string"; // else if(t == int.class) // type = "int"; // else if(t == boolean.class) // type = "bool"; // else if(t == float.class) // type = "float"; // else if(t == double.class) // type = "double"; // else if(t == long.class) // type = "long"; // else // type = t.getClass().getSimpleName(); // if (StringUtils.isBlank(type)) { // type = "Object"; // LoggerUtils.getLogicLog().debug("对象"+beanName+"的"+fieldName+"变量的类型属性"+t+"不正确:反射数据类型异常将自动转为string类型"); // } // return type; // } // public static String getType(Class<?> t,String beanName,String fieldName){ // String type = ""; // if(t == String.class) // type = "string"; // else if(t == byte.class) // type = "byte"; // else if(t == char.class) // type = "char"; // else if(t == short.class) // type = "string"; // else if(t == int.class) // type = "int"; // else if(t == boolean.class) // type = "bool"; // else if(t == float.class) // type = "float"; // else if(t == double.class) // type = "double"; // else if(t == long.class) // type = "long"; // else // type = t.getSimpleName(); // if (StringUtils.isBlank(type)) { // type = "Object"; // LoggerUtils.getLogicLog().debug("对象"+beanName+"的"+fieldName+"变量的类型属性"+t+"不正确:反射数据类型异常将自动转为string类型"); // } // return type; // } public static String checkProtocolType(String str,String clazz){ String type = ""; switch (str){ case "boolean": type = "Boolean.parseBoolean"; break; case "bool": type = "Boolean.parseBoolean"; break; case "int": type = "Integer.parseInt"; break; case "short": type = "Short.parseShort"; break; case "byte": type = "Byte.parseByte"; break; case "long": type = "Long.parseLong"; break; case "float": type = "Float.parseFloat"; break; case "double": type = "Double.parseDouble"; break; case "Bool": type = "Boolean.parseBoolean"; break; case "Boolean": type = "Boolean.parseBoolean"; break; case "Integer": type = "Integer.parseInt"; break; case "Short": type = "Short.parseShort"; break; case "Byte": type = "Byte.parseByte"; break; case "Long": type = "Long.parseLong"; break; case "Float": type = "Float.parseFloat"; break; case "Double": type = "Double.parseDouble"; break; default: type = "String"; break; } if(StringUtils.isEmpty(type)) LoggerUtils.getPlatformLog().debug("协议类"+clazz+"的"+str+"类型异常错误"); return type; } /** * 获取集合类型 * @param * @return */ public static String getGather(Field ft, String beanName, String fieldName){ String type = ""; switch (ft.getType().toString()){ case "interface java.util.List": String ty = getGatherType(false,ft.getGenericType(),beanName,fieldName); type = "List<"+ty+">"; break; case "interface java.util.Set": String ty1 = getGatherType(false,ft.getGenericType(),beanName,fieldName); type = "Set<"+ty1+">"; break; case "interface java.util.Map": String ty2 = getGatherType(true,ft.getGenericType(),beanName,fieldName); type = "Dictionary<"+ty2+">"; break; } if (StringUtils.isBlank(type)) LoggerUtils.getPlatformLog().debug("反射数据类型异常"); return type; } private static String getGatherType(boolean isMap, Type t, String beanName, String fieldName){ String type = ""; ParameterizedType pt = (ParameterizedType) t; if(isMap){ Class<?> genericClazz = (Class)pt.getActualTypeArguments()[0]; Class<?> genericClazz1 = (Class)pt.getActualTypeArguments()[1]; String k = CheckType.getArrType(genericClazz.getName(),beanName,fieldName); String v = CheckType.getArrType(genericClazz1.getName(),beanName,fieldName); type = k+","+v; }else { Class genericClazz = (Class)pt.getActualTypeArguments()[0]; type = CheckType.getArrType(genericClazz.getName(),beanName,fieldName); } if (StringUtils.isBlank(type)) LoggerUtils.getPlatformLog().debug("集合类型错误异常"); return type; } }
true
7d4e6c768120c2cbaed701a2047dc1abc4cb234a
Java
GSabiniPanini/little-cop3330-assignment3
/src/main/java/ex46/Grapher.java
UTF-8
588
3.390625
3
[]
no_license
/* * UCF COP3330 Summer 2021 Assignment 3 Solution * Copyright 2021 Glenroy Little */ package ex46; import java.util.ArrayList; import java.util.Map; public class Grapher { public void graphHistogram(ArrayList<Map.Entry<String, Integer>> freqlist) { for(Map.Entry<String, Integer> word : freqlist) { System.out.printf("%-10s%s%-20s%n", word.getKey(), ":", getAsterisks(word.getValue())); } } public String getAsterisks(int n){ String line = ""; for(int i=1;i<=n;i++) { line += "*"; } return line; } }
true
4af1388c00f662663c74cb308a87168c95a64ac0
Java
RadioVoice/shortestpaths
/src/RouteNode.java
UTF-8
3,338
3.5
4
[]
no_license
import java.math.BigInteger; import java.util.HashSet; import java.util.Objects; /** * Class representing a node with a cost to be reached attached to it. * @author Jack Bilotti */ public class RouteNode implements Comparable<RouteNode>{ private final Node node; private final BigInteger costToNode; private final RouteNode previous; private RouteNode(Node node, BigInteger costToNode, RouteNode previous){ this.node = node; this.costToNode = costToNode; this.previous = previous; } /** * Builder for the instantiation of a RouteNode * @param node represents the node of the RouteNode * @param costToNode represents the cost to be reached by the node * @param previous represents the previous node in the graph * @return Returns an instance of RouteNode */ public static RouteNode of(Node node, BigInteger costToNode, RouteNode previous){ Objects.requireNonNull(node); Objects.requireNonNull(costToNode); return new RouteNode(node, costToNode, previous); } /** * Builder for the instantiation of a RouteNode * @param edge represents the edge connecting the previous and current node * @param previous represents the previous node in the graph * @return Returns an instance of RouteNode */ public static RouteNode of(Edge edge, RouteNode previous){ Objects.requireNonNull(edge); Objects.requireNonNull(previous); Objects.requireNonNull(previous.getCostToNode()); return new RouteNode(edge.getDest(), previous.costAfterNode().add(edge.getCost()), previous); } /** * Builder for the instantiation of a RouteNode * @param node represents the main node of the routeNode * @return Returns an instance of RouteNode */ public static RouteNode of(Node node){ Objects.requireNonNull(node); return new RouteNode(node, null, null); } /** * * @return Returns a truth value as to whether the costToNode value is null or not */ public final boolean isCostToNodeKnown(){ return (costToNode != null); } /** * * @return Returns a value representing */ public final BigInteger costAfterNode(){ return costToNode.add(node.getCost()); } /** * * @param o represents the RouteNode to be compared to * @return Returns the value of comparing the RouteNode to the param. First compares value of the costToNode * then compares the nodes themselves */ public int compareTo(RouteNode o) { Objects.requireNonNull(o, "input is null"); boolean thisUnknown = !isCostToNodeKnown(); boolean oUnknown = !o.isCostToNodeKnown(); if(thisUnknown || oUnknown) return Boolean.compare(thisUnknown, oUnknown); else{ int comparedByCostToNode = costToNode.compareTo(o.costToNode); return (comparedByCostToNode!=0) ? comparedByCostToNode : node.compareTo(o.getNode()); } } public HashSet<Edge> getConnections(){ return getNode().getEdges(); } public Node getNode() { return node; } public BigInteger getCostToNode() { return costToNode; } public RouteNode getPrevious() { return previous; } }
true
a77d06e22991c847c5c0751695a445167a7dc17c
Java
usung0722/market
/app/src/main/java/com/example/lee/donglend2018/UsersAdapter.java
UTF-8
3,970
2.078125
2
[]
no_license
package com.example.lee.donglend2018; import android.app.Activity; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.AsyncTask; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.util.Base64; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; import com.bumptech.glide.Glide; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.util.ArrayList; import java.util.logging.Handler; import java.util.logging.LogRecord; public class UsersAdapter extends RecyclerView.Adapter<UsersAdapter.CustomViewHolder>{ private ArrayList<PersonalData> mList = null; private Activity context = null; public UsersAdapter(Activity context, ArrayList<PersonalData> list) { this.context = context; this.mList = list; } class CustomViewHolder extends RecyclerView.ViewHolder { protected TextView price; protected TextView selete; protected TextView titile; protected TextView contents; protected ImageView img; RelativeLayout parentLayout; public CustomViewHolder(View view) { super(view); this.selete = (TextView) view.findViewById(R.id.textView_list_selete); this.titile = (TextView) view.findViewById(R.id.textView_list_title); this.price = (TextView) view.findViewById(R.id.textView_list_price); this.img = (ImageView) view.findViewById(R.id.imageViewlist); parentLayout = itemView.findViewById(R.id.parent_layout); } } @Override public CustomViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) { View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_list, null); CustomViewHolder viewHolder = new CustomViewHolder(view); return viewHolder; } @Override public void onBindViewHolder(@NonNull final CustomViewHolder viewholder, final int position) { viewholder.selete.setText(mList.get(position).getMember_selete()); viewholder.titile.setText(mList.get(position).getMember_title()); viewholder.price.setText(mList.get(position).getMember_price()+"원"); Log.d("imgadd", "POST response - " + mList.get(position).getMember_img()); Glide.with(context).asBitmap().load("http://49.170.233.37/"+mList.get(position).getMember_img()).into(viewholder.img); viewholder.parentLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Log.d("call item", "onClick: clicked on: "+ mList.get(position).getMember_title()); Intent intent = new Intent(context, viewItem.class); intent.putExtra("id", mList.get(position).getMember_id()); intent.putExtra("selete", mList.get(position).getMember_selete()); intent.putExtra("title", mList.get(position).getMember_title()); intent.putExtra("price", mList.get(position).getMember_price()); intent.putExtra("contents", mList.get(position).getMember_contents()); intent.putExtra("img", "http://49.170.233.37/"+mList.get(position).getMember_img()); intent.putExtra("x", mList.get(position).getMember_x()); intent.putExtra("y", mList.get(position).getMember_y()); context.startActivity(intent); } }); } @Override public int getItemCount() { return (null != mList ? mList.size() : 0); } }
true
d2c3cc3aa8538848c95c8b9ccce380ae38824d22
Java
livcoding/CLXRegistration_OLD
/src/java/com/jilit/irp/data/common/CommonComboService.java
UTF-8
9,045
1.945313
2
[]
no_license
package com.jilit.irp.data.common; import com.jilit.irp.persistence.dao.DAOFactory; import com.jilit.irp.persistence.dto.Academicyear; import com.jilit.irp.persistence.dto.ProgramMaster; import com.jilit.irp.persistence.dto.ProgramType; import com.jilit.irp.persistence.dto.RegistrationMaster; import com.jilit.irp.persistence.dto.StudentCategory; import com.jilit.irp.persistence.dto.StudentQuota; import com.jilit.irp.util.JIRPSession; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.ui.ModelMap; /** * * @author mohit1.kumar */ @Service public class CommonComboService implements CommonComboIservice { @Autowired DAOFactory daoFactory; @Autowired JIRPSession jirpession; @Override public List getProgramMaster() { List list = new ArrayList(); String instituteid = jirpession.getJsessionInfo().getSelectedinstituteid(); try { list = daoFactory.getProgramMasterDAO().getProgramCode(instituteid); } catch (Exception ex) { ex.printStackTrace(); } return list; } public void getadmittedCatgory(ModelMap model) { String instituteid = jirpession.getJsessionInfo().getSelectedinstituteid(); try { List<Object[]> categoryList = daoFactory.getStudentAdmissionCategoryDAO().getadmittedCategory(instituteid); if (categoryList != null && categoryList.size() > 0) { model.put("admtCatg", categoryList); } } catch (Exception e) { e.printStackTrace(); } } public List getsub_admittedCategory(HttpServletRequest req) { List rtnlist = new ArrayList(); try { String instituteid = jirpession.getJsessionInfo().getSelectedinstituteid(); String admittedcategoryid = req.getParameter("admitCatId"); List<Object[]> subcategoryList = daoFactory.getStudentAdmissionSubCategoryDAO().getsub_admittedCategory(instituteid, admittedcategoryid); if (subcategoryList != null && subcategoryList.size() > 0) { rtnlist.add(subcategoryList); } } catch (Exception e) { e.printStackTrace(); } return rtnlist; } public void getAllStudentCategory(ModelMap model) { try { String instituteid = jirpession.getJsessionInfo().getSelectedinstituteid(); List<StudentCategory> list = (List<StudentCategory>) daoFactory.getStudentCategoryDAO().getStudentCategoryList(instituteid); model.put("category", list); } catch (Exception ex) { ex.printStackTrace(); } } public void getAllStudentQuota(ModelMap model) { try { String instituteid = jirpession.getJsessionInfo().getSelectedinstituteid(); List<StudentQuota> list = (List<StudentQuota>) daoFactory.getStudentQuotaDAO().getAllQuota(instituteid); model.put("quota", list); } catch (Exception ex) { ex.printStackTrace(); } } public void getAllRegsitrationCode(ModelMap model) { try { String instituteid = jirpession.getJsessionInfo().getSelectedinstituteid(); List<RegistrationMaster> list = (List<RegistrationMaster>) daoFactory.getRegistrationMasterDAO().getAllRegistrationCode(instituteid); model.put("regisList", list); } catch (Exception ex) { ex.printStackTrace(); } } @Override public void getAllProgramMaster(ModelMap model) { try { String instituteid = jirpession.getJsessionInfo().getSelectedinstituteid(); List list = (List) daoFactory.getProgramMasterDAO().getProgramCode(instituteid); model.put("programList", list); } catch (Exception e) { e.printStackTrace(); } } @Override public void getAllAcademicYear(ModelMap model) { try { String instituteid = jirpession.getJsessionInfo().getSelectedinstituteid(); List<Academicyear> list = (List<Academicyear>) daoFactory.getAcademicYearDAO().findAll(instituteid); model.put("acadYearList", list); } catch (Exception e) { e.printStackTrace(); } } @Override public void getAllProgramtype(ModelMap model) { try { String instituteid = jirpession.getJsessionInfo().getSelectedinstituteid(); List<ProgramType> list = (List<ProgramType>) daoFactory.getProgramTypeDAO().findAllInstituteWise(instituteid); model.put("programTypeList", list); } catch (Exception e) { e.printStackTrace(); } } @Override public void getAcademicYearDeactive(ModelMap model) { List list = null; try { String instituteid = jirpession.getJsessionInfo().getSelectedinstituteid(); list = (List<Object[]>) daoFactory.getAcademicYearDAO().getAcademicYearDeactiveWise(instituteid); model.addAttribute("acadYear", list); } catch (Exception e) { e.printStackTrace(); } } /** * @description This method is used for semester or registration code lov * for master and transaction data. * @param model */ public void getRegistrationCodeLov(ModelMap model) { List list = null; try { String instituteid = jirpession.getJsessionInfo().getSelectedinstituteid(); list = (List<Object[]>) daoFactory.getRegistrationMasterDAO().getRegistrationCodeForAcademicDataReset(instituteid); model.addAttribute("semester", list); } catch (Exception e) { e.printStackTrace(); } } public void getRegistrationCodeNofastrack(ModelMap model) { List list = null; try { String instituteid = jirpession.getJsessionInfo().getSelectedinstituteid(); list = (List<Object[]>) daoFactory.getRegistrationMasterDAO().getRegCodeForOST(instituteid); model.addAttribute("semester", list); } catch (Exception e) { e.printStackTrace(); } } public List getAllSectionMaster1_child_SMF(String instituteId, String programid, String academicyear, byte stynumber, String branchid) { List list = (List) daoFactory.getSectionMasterDAO().getSection_SMF(instituteId, programid, academicyear, stynumber, branchid); List<Object> retList = new ArrayList<Object>(); List l = new ArrayList(); HashMap data = null; for (int i = 0; i < list.size(); i++) { data = (HashMap) list.get(i); retList.add((String) data.get("sectioncode")); retList.add((String) data.get("sectiondesc")); retList.add((String) data.get("sectionid")); } l.add(retList); return l; } public List getSubsectionForStudentmaster(String sectionid, String instituteid, String academicyear, String programid, String styNo) { List list = null; List retlist = new ArrayList(); try { list = (List) daoFactory.getStudentMasterDAO().find("select new map(a.id.subsectionid as subsectionid, a.subsectioncode as subsectioncode) from ProgramWiseSubsection a where a.id.instituteid='" + instituteid + "' " + "and a.id.academicyear='" + academicyear + "' and a.id.programid='" + programid + "' and a.id.sectionid='" + sectionid + "' and a.id.stynumber='" + styNo + "' "); } catch (Exception ex) { ex.printStackTrace(); } return list; } /** * @description This method is used for the Registration Code or Semester * Code lov for Report data. * @param model */ public void getRegistrationCodeForReportWise(ModelMap model) { List list = null; try { String instituteid = jirpession.getJsessionInfo().getSelectedinstituteid(); list = (List<Object[]>) daoFactory.getRegistrationMasterDAO().getAllRegistrationCodeDesc(instituteid); model.addAttribute("regList", list); } catch (Exception e) { e.printStackTrace(); } } public List countryCode_TSM() { List<Object[]> countrylist = (List<Object[]>) daoFactory.getCountryMasterDAO().getAllCountryCode(); return countrylist; } public List stateCode_TSM(String countryid) { List<Object[]> statelist = (List<Object[]>) daoFactory.getStateMasterDAO().getAllStateCode(countryid); return statelist; } public List cityCode_TSM(String countryid, String stateid) { List rtnList = new ArrayList(); List<Object[]> citylist = (List<Object[]>) daoFactory.getCityMasterDAO().getAllCityCode(countryid, stateid); return citylist; } }
true
93ebb3dcb25b70f257b07afd81ee4657a54fde39
Java
Divier/proyectojee
/Circulemos2/FormulariosEJBClient/src/main/java/co/com/datatools/c2/dto/formularios/ResultadoConsultaDetalleCambioEstado.java
UTF-8
5,315
1.695313
2
[]
no_license
package co.com.datatools.c2.dto.formularios; import java.io.Serializable; import java.math.BigInteger; import java.util.Date; public class ResultadoConsultaDetalleCambioEstado implements Serializable { /** * */ private static final long serialVersionUID = 1L; private BigInteger idDetalleCambioEstado; private Integer idTipoAsignacion; private String nombreTipoAsignacion; private Integer idTipoFormulario; private String nombreTipoFormulario; private BigInteger idResponsable; private Integer idArea; private String nombreArea; private Integer idTipoIdentificacion; private String nombreTipoIdentificacion; private String numeroIdentificacion; private String nombreResponsable; private String folio; private String numeroInicial; private String numeroFinal; private Integer cantidadFormularios; private Date fechaMovimiento; private String observaciones; private String placa; private String nombreEstadoFormulario; private Integer idEstadoFormulario; public ResultadoConsultaDetalleCambioEstado() { } public BigInteger getIdDetalleCambioEstado() { return idDetalleCambioEstado; } public void setIdDetalleCambioEstado(BigInteger idDetalleCambioEstado) { this.idDetalleCambioEstado = idDetalleCambioEstado; } public Integer getIdTipoAsignacion() { return idTipoAsignacion; } public void setIdTipoAsignacion(Integer idTipoAsignacion) { this.idTipoAsignacion = idTipoAsignacion; } public String getNombreTipoAsignacion() { return nombreTipoAsignacion; } public void setNombreTipoAsignacion(String nombreTipoAsignacion) { this.nombreTipoAsignacion = nombreTipoAsignacion; } public Integer getIdTipoFormulario() { return idTipoFormulario; } public void setIdTipoFormulario(Integer idTipoFormulario) { this.idTipoFormulario = idTipoFormulario; } public String getNombreTipoFormulario() { return nombreTipoFormulario; } public void setNombreTipoFormulario(String nombreTipoFormulario) { this.nombreTipoFormulario = nombreTipoFormulario; } public BigInteger getIdResponsable() { return idResponsable; } public void setIdResponsable(BigInteger idResponsable) { this.idResponsable = idResponsable; } public Integer getIdArea() { return idArea; } public void setIdArea(Integer idArea) { this.idArea = idArea; } public String getNombreArea() { return nombreArea; } public void setNombreArea(String nombreArea) { this.nombreArea = nombreArea; } public Integer getIdTipoIdentificacion() { return idTipoIdentificacion; } public void setIdTipoIdentificacion(Integer idTipoIdentificacion) { this.idTipoIdentificacion = idTipoIdentificacion; } public String getNumeroIdentificacion() { return numeroIdentificacion; } public void setNumeroIdentificacion(String numeroIdentificacion) { this.numeroIdentificacion = numeroIdentificacion; } public String getNombreResponsable() { return nombreResponsable; } public void setNombreResponsable(String nombreResponsable) { this.nombreResponsable = nombreResponsable; } public String getFolio() { return folio; } public void setFolio(String folio) { this.folio = folio; } public String getNumeroInicial() { return numeroInicial; } public void setNumeroInicial(String numeroInicial) { this.numeroInicial = numeroInicial; } public String getNumeroFinal() { return numeroFinal; } public void setNumeroFinal(String numeroFinal) { this.numeroFinal = numeroFinal; } public Integer getCantidadFormularios() { return cantidadFormularios; } public void setCantidadFormularios(Integer cantidadFormularios) { this.cantidadFormularios = cantidadFormularios; } public Date getFechaMovimiento() { return fechaMovimiento; } public void setFechaMovimiento(Date fechaMovimiento) { this.fechaMovimiento = fechaMovimiento; } public String getObservaciones() { return observaciones; } public void setObservaciones(String observaciones) { this.observaciones = observaciones; } public String getPlaca() { return placa; } public void setPlaca(String placa) { this.placa = placa; } public String getNombreTipoIdentificacion() { return nombreTipoIdentificacion; } public void setNombreTipoIdentificacion(String nombreTipoIdentificacion) { this.nombreTipoIdentificacion = nombreTipoIdentificacion; } public String getNombreEstadoFormulario() { return nombreEstadoFormulario; } public void setNombreEstadoFormulario(String nombreEstadoFormulario) { this.nombreEstadoFormulario = nombreEstadoFormulario; } public Integer getIdEstadoFormulario() { return idEstadoFormulario; } public void setIdEstadoFormulario(Integer idEstadoFormulario) { this.idEstadoFormulario = idEstadoFormulario; } }
true
9bd233c842bd2e69ef15556ebb812e816c103ac9
Java
k0hlrabi/CoolColorsB
/src/will/awesome/coolcolors/MainActivity.java
UTF-8
1,321
2.25
2
[]
no_license
package will.awesome.coolcolors; import android.R; import android.app.Activity; import android.graphics.Point; import android.os.Bundle; import android.util.DisplayMetrics; import android.view.Display; import android.view.Menu; import android.view.MenuItem; import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; import android.view.WindowManager; import android.widget.LinearLayout; import android.widget.RelativeLayout; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); DrawingPanel a = new DrawingPanel(this); //Make a drawing panel //THis is my stupid way to get screen size and then DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); int height = metrics.heightPixels; int width = metrics.widthPixels; LayoutParams lp = new LayoutParams(height,width); //a.setLayoutParams(ViewGroup.LayoutParams.FILL_PARENT); a.setLayoutParams(lp); //end shitty method to get screensize setContentView(a);//the entire screen is dedicated to the DrawingPanel } }
true
d3e40dd399bda3f5a197199b7dd2e55ed5c825c0
Java
ngando59/ocr.jee-editeur-sous-titres
/src/com/ocr/beans/Subtitle.java
UTF-8
1,699
2.625
3
[]
no_license
package com.ocr.beans; import java.util.ArrayList; import com.ocr.model.SrtFile; /** * @author ngando * This class represent a subtitle object */ public class Subtitle { private int id; private String title; private String language; private SrtFile content; protected ArrayList<Translation> translations; public Subtitle() { super(); title = ""; language = ""; content = new SrtFile(); translations = new ArrayList<>(); } public Subtitle(String title, String language, SrtFile content) { super(); this.title = title; this.language = language; this.content = content; translations = new ArrayList<Translation>(); } public Subtitle(int id, String title, String language, SrtFile content) { this.id = id; this.title = title; this.language = language; this.content = content; this.translations = new ArrayList<Translation>(); } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getLanguage() { return language; } public void setLanguage(String language) { this.language = language; } public ArrayList<Translation> getTranslations() { return translations; } public void setTranslations(ArrayList<Translation> translations) { this.translations = translations; } public SrtFile getContent() { return content; } public void setContent(SrtFile content) { this.content = content; } /** * Add a translation de the subtitle * @param : translation to add * */ public void addTranslation(Translation translation) { this.translations.add(translation); } public int getId() { return id; } public void setId(int id) { this.id = id; } }
true
9096c5d306fb6ea2679e9a9714f71f84589a8782
Java
logginghub/core
/logginghub-frontend/src/main/java/com/logginghub/logging/frontend/visualisations/configuration/PatternConfiguration.java
UTF-8
1,067
2.078125
2
[ "Apache-2.0" ]
permissive
package com.logginghub.logging.frontend.visualisations.configuration; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; @XmlAccessorType(XmlAccessType.FIELD) public class PatternConfiguration { @XmlAttribute String pattern; @XmlAttribute String name; @XmlAttribute boolean debug = false; @XmlAttribute boolean cleanup = true; public String getName() { return name; } public void setName(String name) { this.name = name; } public boolean isDebug() { return debug; } public void setDebug(boolean debug) { this.debug = debug; } public boolean isCleanup() { return cleanup; } public void setCleanup(boolean cleanup) { this.cleanup = cleanup; } public String getPattern() { return pattern; } public void setPattern(String pattern) { this.pattern = pattern; } }
true
dcbe9158683818c4d3e335b186c28c80d4c70235
Java
viabcde/mycoding.github.io
/sshdemo/src/com/pb/dao/impl/BaseDaoImpl.java
UTF-8
2,864
2.578125
3
[]
no_license
package com.pb.dao.impl; import java.lang.reflect.ParameterizedType; import java.util.ArrayList; import java.util.List; import org.hibernate.SessionFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.orm.hibernate3.HibernateTemplate; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.TransactionDefinition; import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.support.DefaultTransactionDefinition; import com.pb.dao.IBaseDao; public abstract class BaseDaoImpl<T> implements IBaseDao<T> { private final Logger log = LoggerFactory.getLogger(this.getClass()); private Class<T> entityClass; private String className; private HibernateTemplate hibernateTemplate; private PlatformTransactionManager ptm; // 用于对事务进行处理 private DefaultTransactionDefinition dtd; // 默认事务定义 @SuppressWarnings("all") public BaseDaoImpl() { // 对泛型T所表示的类进行读取显示 try { entityClass = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0]; } catch (Exception e) { entityClass = (Class<T>) Object.class; e.printStackTrace(); } className = entityClass.getSimpleName(); // 泛型类的名称(非完全限定名) } /** * 通过IOC方式注入SessionFactory * @param sessionFactory */ public void setSessionFactory(SessionFactory sessionFactory){ // 实例化HibernateTemplate对象 hibernateTemplate =new HibernateTemplate(sessionFactory); } /** * 通过IOC方式注入ptm * @param ptm */ public void setPtm(PlatformTransactionManager ptm) { this.ptm=ptm; // 实例化默认事务定义 dtd=new DefaultTransactionDefinition(); // 设置传播特性 dtd.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); } /** * 按属性查询 */ @SuppressWarnings("unchecked") public List<T> findByProperty(String propertyName, Object value) { List<T> list = new ArrayList<T>(); log.debug("finding " + className + " instance with property: " + propertyName + ", value: " + value); try { // 定义查询语句 String queryString = "from " + className + " as model where model." + propertyName + "= ?"; list=hibernateTemplate.find(queryString,new Object[]{value}); } catch (Exception e) { log.error("find by property name failed", e); e.printStackTrace(); } return list; } /** * 保存对象 */ public boolean save(T instance) { TransactionStatus ts=null; try { // 取得事务状态,即:开始一个事务 ts=ptm.getTransaction(dtd); hibernateTemplate.save(instance); ptm.commit(ts); // 提交事务 return true; } catch (Exception e) { ptm.rollback(ts); // 回滚事务 e.printStackTrace(); } return false; } }
true
65cbe158519974d68639037a7ea758f8e64b20b9
Java
P79N6A/icse_20_user_study
/methods/Method_5483.java
UTF-8
179
2.171875
2
[]
no_license
@Override public void maybeThrowError() throws IOException { if (fatalError != null) { throw fatalError; } else { manifestLoaderErrorThrower.maybeThrowError(); } }
true
83f8c4befef00f6d5ef88e3ba09a884c8a68c741
Java
apache/servicecomb-java-chassis
/swagger/swagger-generator/generator-spring-data/src/main/java/org/apache/servicecomb/swagger/generator/springdata/SpringDataModule.java
UTF-8
4,614
1.75
2
[ "Apache-2.0" ]
permissive
/* * 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.servicecomb.swagger.generator.springdata; import java.util.ArrayList; import java.util.List; import org.apache.servicecomb.foundation.common.utils.SPIOrder; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort.Order; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.module.SimpleModule; import com.fasterxml.jackson.databind.type.TypeFactory; import com.fasterxml.jackson.databind.util.Converter; public class SpringDataModule extends SimpleModule implements SPIOrder { private static final long serialVersionUID = 1L; @JsonDeserialize(as = PageImpl.class) @JsonPropertyOrder(alphabetic = true) public static class PageMixin<T> { @JsonCreator public PageMixin(@JsonProperty(value = "content") List<T> content, @JsonProperty("pageable") Pageable pageable, @JsonProperty("total") long total) { } } @JsonDeserialize(as = PageRequest.class) @JsonPropertyOrder(alphabetic = true) public static class PageableMixin { @JsonCreator public PageableMixin(@JsonProperty(value = "pageNumber") int page, @JsonProperty("pageSize") int size, @JsonProperty(value = "sort") Sort sort) { } } public static class SortConverter implements Converter<SortMixin, Sort> { @Override public Sort convert(SortMixin value) { return Sort.by(value.getProperties()); } @Override public JavaType getInputType(TypeFactory typeFactory) { return typeFactory.constructType(SortMixin.class); } @Override public JavaType getOutputType(TypeFactory typeFactory) { return typeFactory.constructType(Sort.class); } } public static class SortMixinConverter implements Converter<Sort, SortMixin> { @Override public SortMixin convert(Sort value) { List<String> properties = new ArrayList<>(); for (Order order : value) { properties.add(order.getProperty()); } SortMixin result = new SortMixin(); result.setProperties(properties.toArray(new String[0])); return result; } @Override public JavaType getInputType(TypeFactory typeFactory) { return typeFactory.constructType(Sort.class); } @Override public JavaType getOutputType(TypeFactory typeFactory) { return typeFactory.constructType(SortMixin.class); } } @JsonPropertyOrder(alphabetic = true) @JsonDeserialize(converter = SortConverter.class) @JsonSerialize(converter = SortMixinConverter.class) public static class SortMixin { private String[] properties; @JsonCreator public SortMixin() { } public void setProperties(String[] properties) { this.properties = properties; } public String[] getProperties() { return this.properties; } } public SpringDataModule() { super("springData"); setMixInAnnotation(Page.class, PageMixin.class); setMixInAnnotation(Pageable.class, PageableMixin.class); setMixInAnnotation(Sort.class, SortMixin.class); setMixInAnnotation(PageImpl.class, PageMixin.class); setMixInAnnotation(PageRequest.class, PageableMixin.class); } @Override public Object getTypeId() { return getModuleName(); } @Override public int getOrder() { return Short.MAX_VALUE; } }
true
68f40bc41c2d6e40aeb9b56b36840f60d2d69fb2
Java
apache/netbeans
/platform/openide.loaders/test/unit/src/org/openide/loaders/DataShadowSlowness39981Test.java
UTF-8
6,807
2.15625
2
[ "Apache-2.0" ]
permissive
/* * 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.openide.loaders; import java.lang.ref.WeakReference; import java.util.*; import org.openide.filesystems.FileSystem; import org.openide.filesystems.Repository; import org.netbeans.junit.*; import org.openide.filesystems.*; /** Delete of an folder is said to be slow due to * poor implementation of DataShadow validate functionality. * @author Jaroslav Tulach */ public class DataShadowSlowness39981Test extends NbTestCase implements OperationListener { /** List of DataObject */ private List shadows, brokenShadows; /** folder to work with */ private DataFolder folder; /** fs we work on */ private FileSystem lfs; /** start time of the test */ private long time; /** number of created objects */ private int createdObjects; /** created children */ private DataObject[] arr; public DataShadowSlowness39981Test (String name) { super(name); } public static NbTestSuite suite () { return NbTestSuite.speedSuite (DataShadowSlowness39981Test.class, 20, 5); } protected void setUp() throws Exception { clearWorkDir(); lfs = TestUtilHid.createLocalFileSystem(getWorkDir (), new String[] { "shadows/", "brokenshadows", "folder/original.txt", "folder/orig.txt", "modify/" }); FileObject root = FileUtil.toFileObject(FileUtil.toFile(lfs.getRoot())); int count = getTestNumber (); shadows = createShadows ( DataObject.find (root.getFileObject("folder/original.txt")), DataFolder.findFolder (root.getFileObject("shadows")), count ); brokenShadows = /*Collections.EMPTY_LIST; */createShadows ( DataObject.find (root.getFileObject("folder/orig.txt")), DataFolder.findFolder (root.getFileObject("shadows")), count ); DataObject.find (root.getFileObject("folder/orig.txt")).delete (); ListIterator it = brokenShadows.listIterator (); while (it.hasNext ()) { DataObject obj = (DataObject)it.next (); assertFalse ("Is not valid", obj.isValid ()); assertTrue ("Used to be shadow", obj instanceof DataShadow); DataObject newObj = DataObject.find (obj.getPrimaryFile ()); assertTrue ("They are different", newObj != obj); assertFalse ("It is not shadow, as it is broken", newObj instanceof DataShadow); it.set (newObj); } FileObject files = root.getFileObject("modify"); for (int i = 0; i < 200; i++) { FileUtil.createData (files, "empty" + i + ".txt"); } assertEquals ("Children created", 200, files.getChildren ().length); folder = DataFolder.findFolder (files); time = System.currentTimeMillis (); } private static List createShadows (DataObject original, DataFolder target, int count) throws java.io.IOException { ArrayList list = new ArrayList (count); for (int i = 0; i < count; i++) { DataShadow shad = DataShadow.create(target, original.getName()+i, original, "shadow"); list.add (shad); } return list; } protected void tearDown() throws Exception { ArrayList weaks = new ArrayList(); addWeakRefs(Arrays.asList(arr), weaks); addWeakRefs(brokenShadows, weaks); addWeakRefs(shadows, weaks); addWeakRefs(Collections.singleton(lfs), weaks); addWeakRefs(Collections.singleton(folder), weaks); arr = null; brokenShadows = null; shadows = null; lfs = null; folder = null; WeakReference[] refArr = (WeakReference[])weaks.toArray(new WeakReference[0]); for (int i = 0; i < refArr.length; i++) { assertGC(i + " - gc(" + refArr[i].get() + "): ", refArr[i]); } } private static void addWeakRefs(Collection objects, List weakRefsToAdd) { Iterator it = objects.iterator(); while (it.hasNext()) { Object obj = it.next(); weakRefsToAdd.add(new WeakReference(obj)); } } private void createChildren () { DataLoaderPool pool = DataLoaderPool.getDefault (); pool.addOperationListener (this); arr = folder.getChildren (); pool.removeOperationListener (this); if (arr.length > createdObjects) { fail ("The children of the folder should not be created before the getChildren method is called. Children: " + arr.length + " created: " + createdObjects); } } public void test0 () throws Exception { createChildren (); } public void test10 () throws java.io.IOException { createChildren (); } public void test99 () throws java.io.IOException { createChildren (); } public void test245 () throws java.io.IOException { createChildren (); } public void test552 () throws java.io.IOException { createChildren (); } // public void test987 () throws Exception { // createChildren (); // } public void operationCopy (org.openide.loaders.OperationEvent.Copy ev) { } public void operationCreateFromTemplate (org.openide.loaders.OperationEvent.Copy ev) { } public void operationCreateShadow (org.openide.loaders.OperationEvent.Copy ev) { } public void operationDelete (OperationEvent ev) { } public void operationMove (org.openide.loaders.OperationEvent.Move ev) { } public void operationPostCreate (OperationEvent ev) { createdObjects++; } public void operationRename (org.openide.loaders.OperationEvent.Rename ev) { } }
true
21b6b051c5d2dd5ff6e48e31886524c5783959ce
Java
RESTfulSOAPMactavish/IF3110-2015-T3
/Identity/src/java/is/auth/AuthRSServlet.java
UTF-8
5,900
2.15625
2
[]
no_license
/* * 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 is.auth; import java.io.BufferedReader; import java.io.IOException; import java.io.PrintWriter; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.sql.Timestamp; import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.json.simple.*; import org.json.simple.parser.*; /** * * @author Asus */ public class AuthRSServlet extends HttpServlet { // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { /*final PrintWriter out = response.getWriter(); StringBuffer jb = new StringBuffer(); String line = null; try { BufferedReader reader = request.getReader(); while ((line = reader.readLine()) != null) jb.append(line); } catch (Exception e) {} out.println(jb.toString());*/ response.setContentType("text/html"); Class.forName("com.mysql.jdbc.Driver"); Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/stackexchange?zeroDateTimeBehavior=convertToNull", "root", ""); Statement stmt = conn.createStatement(); String sql = "UPDATE sessions SET ExpiredDate=NOW()+INTERVAL 5 MINUTE WHERE AccessToken = ?"; // Login query validation PreparedStatement dbStatement = conn.prepareStatement(sql); dbStatement.setString(1, request.getParameter("token")); dbStatement.executeUpdate(); //response.sendRedirect(request.getHeader("referer")+"&ret=true"); } catch (SQLException ex) { Logger.getLogger(AuthRSServlet.class.getName()).log(Level.SEVERE, null, ex); } catch (ClassNotFoundException ex) { Logger.getLogger(AuthRSServlet.class.getName()).log(Level.SEVERE, null, ex); } catch (Exception ex) {} } /** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Connection conn = null; String currentEmail = null; Timestamp exp = null; String Name = null; StringBuffer jb = new StringBuffer(); String line = null; try { BufferedReader reader = request.getReader(); while ((line = reader.readLine()) != null) jb.append(line); } catch (Exception e) {} //System.out.println(jb.toString()); try { JSONParser parser = new JSONParser(); Object tempObj = parser.parse(jb.toString()); JSONObject obj = (JSONObject) tempObj; String token = (String) obj.get("access_token"); response.setContentType("application/json;charset=UTF-8"); Class.forName("com.mysql.jdbc.Driver"); conn = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/stackexchange?zeroDateTimeBehavior=convertToNull", "root", ""); Statement stmt = conn.createStatement(); String sql; PreparedStatement dbStatement; //take the email from session asumsi bahwa token selalu bersama email sql = "SELECT Email, ExpiredDate FROM sessions WHERE AccessToken = ?"; dbStatement = conn.prepareStatement(sql); dbStatement.setString(1, token); ResultSet rsEmail = dbStatement.executeQuery(); //agar index berada di elemen pertama dan get email if(rsEmail.next()) { //returnExecution = returnExecution + 1; currentEmail = rsEmail.getString("Email"); exp = rsEmail.getTimestamp("ExpiredDate"); } sql = "SELECT Name FROM users WHERE Email = ?"; dbStatement = conn.prepareStatement(sql); dbStatement.setString(1, currentEmail); ResultSet rsName = dbStatement.executeQuery(); if(rsName.next()) { Name = rsName.getString("Name"); } PrintWriter out = response.getWriter(); JSONObject objOut = new JSONObject(); objOut.put("name", Name); objOut.put("email", currentEmail); objOut.put("expireddate", exp.toString()); out.println(objOut); } catch (SQLException | ClassNotFoundException ex) { Logger.getLogger(AuthRSServlet.class.getName()).log(Level.SEVERE, null, ex); } catch (ParseException ex) { Logger.getLogger(AuthRSServlet.class.getName()).log(Level.SEVERE, null, ex); } } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
true
6134b68b786b7d39e46708c4ca4b328729a1afdf
Java
apache/fineract
/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/StandingInstructionHistoryApiResource.java
UTF-8
6,715
1.734375
2
[ "Apache-2.0", "LGPL-2.0-or-later", "LicenseRef-scancode-unknown", "MIT" ]
permissive
/** * 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.fineract.portfolio.account.api; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; import jakarta.ws.rs.Produces; import jakarta.ws.rs.QueryParam; import jakarta.ws.rs.core.Context; import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.UriInfo; import java.time.LocalDate; import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.StringUtils; import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper; import org.apache.fineract.infrastructure.core.api.DateParam; import org.apache.fineract.infrastructure.core.data.DateFormat; import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings; import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer; import org.apache.fineract.infrastructure.core.service.Page; import org.apache.fineract.infrastructure.core.service.SearchParameters; import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext; import org.apache.fineract.portfolio.account.data.StandingInstructionDTO; import org.apache.fineract.portfolio.account.data.StandingInstructionHistoryData; import org.apache.fineract.portfolio.account.service.StandingInstructionHistoryReadPlatformService; import org.springframework.stereotype.Component; @Path("/v1/standinginstructionrunhistory") @Component @Tag(name = "Standing Instructions History", description = "The list capability of history can support pagination and sorting.") @RequiredArgsConstructor public class StandingInstructionHistoryApiResource { private final PlatformSecurityContext context; private final DefaultToApiJsonSerializer<StandingInstructionHistoryData> toApiJsonSerializer; private final ApiRequestParameterHelper apiRequestParameterHelper; private final StandingInstructionHistoryReadPlatformService standingInstructionHistoryReadPlatformService; @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Operation(summary = "Standing Instructions Logged History", description = "The list capability of history can support pagination and sorting \n\n" + "Example Requests :\n" + "\n" + "standinginstructionrunhistory\n" + "\n" + "standinginstructionrunhistory?orderBy=name&sortOrder=DESC\n" + "\n" + "standinginstructionrunhistory?offset=10&limit=50") @ApiResponses({ @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = StandingInstructionHistoryApiResourceSwagger.GetStandingInstructionRunHistoryResponse.class))) }) public String retrieveAll(@Context final UriInfo uriInfo, @QueryParam("sqlSearch") @Parameter(description = "sqlSearch") final String sqlSearch, @QueryParam("externalId") @Parameter(description = "externalId") final String externalId, @QueryParam("offset") @Parameter(description = "offset") final Integer offset, @QueryParam("limit") @Parameter(description = "limit") final Integer limit, @QueryParam("orderBy") @Parameter(description = "orderBy") final String orderBy, @QueryParam("sortOrder") @Parameter(description = "sortOrder") final String sortOrder, @QueryParam("transferType") @Parameter(description = "transferType") final Integer transferType, @QueryParam("clientName") @Parameter(description = "clientName") final String clientName, @QueryParam("clientId") @Parameter(description = "clientId") final Long clientId, @QueryParam("fromAccountId") @Parameter(description = "fromAccountId") final Long fromAccount, @QueryParam("fromAccountType") @Parameter(description = "fromAccountType") final Integer fromAccountType, @QueryParam("locale") @Parameter(description = "locale") final String locale, @QueryParam("dateFormat") @Parameter(description = "dateFormat") final String rawDateFormat, @QueryParam("fromDate") @Parameter(description = "fromDate") final DateParam fromDateParam, @QueryParam("toDate") @Parameter(description = "toDate") final DateParam toDateParam) { this.context.authenticatedUser().validateHasReadPermission(StandingInstructionApiConstants.STANDING_INSTRUCTION_RESOURCE_NAME); final DateFormat dateFormat = StringUtils.isBlank(rawDateFormat) ? null : new DateFormat(rawDateFormat); final SearchParameters searchParameters = SearchParameters.forAccountTransfer(sqlSearch, externalId, offset, limit, orderBy, sortOrder); LocalDate startDateRange = null; LocalDate endDateRange = null; if (fromDateParam != null) { startDateRange = fromDateParam.getDate("fromDate", dateFormat, locale); } if (toDateParam != null) { endDateRange = toDateParam.getDate("toDate", dateFormat, locale); } StandingInstructionDTO standingInstructionDTO = new StandingInstructionDTO(searchParameters, transferType, clientName, clientId, fromAccount, fromAccountType, startDateRange, endDateRange); final Page<StandingInstructionHistoryData> history = this.standingInstructionHistoryReadPlatformService .retrieveAll(standingInstructionDTO); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); return this.toApiJsonSerializer.serialize(settings, history); } }
true
b35ec2c5eaeaee6c23dc44fa2df8497699c06669
Java
hoho1988/testProX
/RyanTest/mi-orm-ot-system-api/src/main/java/com/hoho/test/dao/TestRepository.java
UTF-8
711
1.9375
2
[]
no_license
package com.hoho.test.dao; import java.util.List; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; import com.hoho.test.bean.Test; @Repository public interface TestRepository extends CrudRepository<Test, Long> { @Query(value = "select * From Test", nativeQuery = true) public List<Test> find(); @Modifying(clearAutomatically = true) @Query(value = "update test set name = ? where id = ?", nativeQuery = true)@Transactional public void update(String name,Long id); }
true
07dacc3d373cabf8bd0caf5aa15df24fa8b0c943
Java
fjakop/ngcalsync
/src/main/java/de/jakop/ngcalsync/obfuscator/DefaultCalendarEventObfuscator.java
UTF-8
2,526
2.234375
2
[ "BSD-2-Clause" ]
permissive
/** * Copyright © 2012, Frank Jakop * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package de.jakop.ngcalsync.obfuscator; import org.apache.commons.lang3.Validate; import de.jakop.ngcalsync.calendar.CalendarEvent; import de.jakop.ngcalsync.settings.PrivacySettings; /** * Obfuscates title, description and location, if requested. * * @author fjakop */ public class DefaultCalendarEventObfuscator implements ICalendarEventObfuscator { private final PrivacySettings privacySettings; /** * * @param privacySettings */ public DefaultCalendarEventObfuscator(final PrivacySettings privacySettings) { Validate.notNull(privacySettings); this.privacySettings = privacySettings; } @Override public void obfuscate(final CalendarEvent event) { if (!privacySettings.isTransferTitle()) { event.setTitle(event.getEventType().getName()); } if (!privacySettings.isTransferDescription()) { event.setContent(new String()); } if (!privacySettings.isTransferLocation()) { event.setLocation(new String()); } } }
true
bbf94be49e03cb68ca58c72f82301d011066ecd7
Java
Jchenjiang/shiro
/src/main/java/com/example/shiro/config/CustomRealm.java
UTF-8
3,551
2.71875
3
[]
no_license
package com.example.shiro.config; import org.apache.commons.lang3.StringUtils; import org.apache.shiro.SecurityUtils; import org.apache.shiro.authc.*; import org.apache.shiro.authz.AuthorizationInfo; import org.apache.shiro.authz.SimpleAuthorizationInfo; import org.apache.shiro.realm.AuthorizingRealm; import org.apache.shiro.subject.PrincipalCollection; import org.apache.shiro.util.ByteSource; import java.util.HashSet; import java.util.Set; public class CustomRealm extends AuthorizingRealm { //授权 @Override protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) { String username = (String) SecurityUtils.getSubject().getPrincipal(); SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(); Set<String> stringSet = new HashSet<>(); //设置权限 stringSet.add("user:show"); stringSet.add("user:admin"); info.setStringPermissions(stringSet); return info; } //这里唯一需要注意的是:你注册的加密方式和设置的加密方式还有Realm中身份认证的方式都是要一模一样的。 //本文中的加密 :MD5两次、salt=username+salt加密。 //登录认证 @Override protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException { //不加密的情况使用 /* System.out.println("-------身份认证方法--------"); String userName = (String) authenticationToken.getPrincipal(); String userPwd = new String((char[]) authenticationToken.getCredentials()); //根据用户名从数据库获取密码 String password = "123"; String username = "test"; if (!userName.equals(username)) { throw new AccountException("用户名不正确"); } else if (!userPwd.equals(password)) { throw new AccountException("密码不正确"); } return new SimpleAuthenticationInfo(userName, password, getName());*/ //加密情况使用 System.out.println("-------身份认证方法--------"); String account2 = StringUtils.EMPTY; String password2 = StringUtils.EMPTY; if (authenticationToken instanceof UsernamePasswordToken) { UsernamePasswordToken token2 = (UsernamePasswordToken)authenticationToken; account2 = token2.getUsername(); password2 = new String(token2.getPassword()); } if (StringUtils.isBlank(account2)) { throw new IncorrectCredentialsException("account must not be blank"); } if (StringUtils.isBlank(password2)) { throw new IncorrectCredentialsException("password must not be blank"); } System.out.println(account2); System.out.println(password2); System.out.println("-------身份认证方法--------"); String userName = (String) authenticationToken.getPrincipal(); String userPwd = new String((char[]) authenticationToken.getCredentials()); //根据用户名从数据库获取密码 String password = "2415b95d3203ac901e287b76fcef640b"; String username2 = "cj"; if (!userName.equals(username2)) { throw new AccountException("用户名不正确"); } //交给AuthenticatingRealm使用CredentialsMatcher进行密码匹配 return new SimpleAuthenticationInfo(userName, password, ByteSource.Util.bytes(userName + "salt"), getName()); } }
true
17a28d75b291044c119fa72aec039ba8d9e326d8
Java
VGolomoz/BankSystem_WebApp_JDBC-Servlet-MySQL
/src/main/java/project/DAO/queries/DBFields/UserAccFields.java
UTF-8
307
1.789063
2
[]
no_license
package project.DAO.queries.DBFields; public interface UserAccFields { String USER_ACC = "user_account"; String USER_ID = "user_Id"; String BALANCE = "balance"; String CURRENCY = "currency"; String VALIDITY = "validity"; String DEPOSIT = "deposit"; String CREDIT = "credit"; }
true
5a2f6b6e485e474d970a6f9ad96e65853670fa62
Java
sjayendra/Spring-Boot-liqui
/src/main/java/com/jay/liqui/repository/TransactionRepository.java
UTF-8
223
1.695313
2
[]
no_license
package com.jay.liqui.repository; import com.jay.liqui.model.Transaction; import org.springframework.data.jpa.repository.JpaRepository; public interface TransactionRepository extends JpaRepository<Transaction, Long> { }
true
59d9ae107938af26c121bba64c81ade0ecce8a91
Java
CamilleINGOUF/RechercheOpe
/RO-ws/SacADos/src/AlgoEvolutionnaire/EA.java
UTF-8
2,962
3
3
[]
no_license
package AlgoEvolutionnaire; import java.util.Collections; import Problem.*; public class EA { private Problem problem; private int mu; private int lambda; private Population parents; private Population genitors; private Population children; private ComparatorSolution comp; private double bestFitness = 0.0; public EA(Problem problem) { this.problem = problem; int size = problem.size; if(size > 10) mu = (int) (problem.size / 10f); else mu = 1; lambda = mu * 2; parents = new Population(mu); genitors = new Population(lambda); children = new Population(lambda); comp = new ComparatorSolution(); init(); } public double getBestFitness() { return bestFitness; } public void init() { for(int i = 0; i < mu; i++) { Solution s = new Solution(problem.size); s.randomSolution(); parents.add(s); } } public void evalPop() { for(Solution s : parents) problem.eval(s); for(Solution s : children) problem.eval(s); } public void selections() { for(int i = 0; i < lambda; i++) { int s1 = (int) (Math.random() * mu); int s2 = (int) (Math.random() * mu); Solution winner = parents.get(s1).getFitness() > parents.get(s2).getFitness() ? parents.get(s1): parents.get(s2); genitors.add(winner.clone()); } } public void croisementUniforme() { for(int i = 0; i < lambda; i += 2) { for(int j = 0; j < problem.size; j ++) { double pu = Math.random(); if(pu > 0.5) { int tempBit = genitors.get(i).get(j); genitors.get(i).set(j, genitors.get(i+1).get(j)); genitors.get(i+1).set(j, tempBit); } } } } public void mutation() { double pn = 1 / (float)problem.size; for(Solution s : genitors) { for(int i = 0; i < problem.size; i++) { double u = Math.random(); if(u < pn) { s.flip(i); } } children.add(s.clone()); } } public void remplacement() { Population everyone = parents.clone(); everyone.addAll(children.getSolutions()); Collections.sort(everyone.getSolutions(),comp); Collections.reverse(everyone.getSolutions()); for(int i = 0; i < mu; i ++) { parents.set(i, everyone.get(i)); } } public void run() { evalPop(); for(int i = 0; i < 1000; i++) { selections(); croisementUniforme(); mutation(); evalPop(); remplacement(); System.out.println(i); children.getSolutions().clear(); genitors.getSolutions().clear(); } System.out.println(parents.getSolutions().get(0).getFitness()); bestFitness = parents.getSolutions().get(0).getFitness(); //47218.0 } private void debug() { int parentsSize = 0; int genitorsSize = 0; int childrenSize = 0; for(Solution s : parents) parentsSize++; for(Solution s : genitors) genitorsSize++; for(Solution s : children) childrenSize++; System.out.println("Parents : "+parentsSize); System.out.println("Genitors : "+genitorsSize); System.out.println("Children : "+childrenSize); } }
true
7886bdd590e07ca19f71ab9c0cafd22124d3f806
Java
narci2010/toceansoft-base
/toceansoft-excel-service/src/main/java/com/toceansoft/common/excel/util/LetterUtil.java
UTF-8
883
2.5
2
[]
no_license
/* * Copyright 2010-2019 Tocean Group. * 版权:商业代码,未经许可,禁止任何形式拷贝、传播及使用 * 文件名:ExcelConfigExcludeController.java * 描述: * 修改人: liu * 修改时间:2019-02-14 16:55:43 * 跟踪单号: * 修改单号: * 修改内容: */ package com.toceansoft.common.excel.util; /** * 字母工具类. * * @author asr */ public final class LetterUtil { /** * 数字转字母. * * @param number 数字 * @return 字母 */ public static String numberToLetter(int number) { if (number <= 0) { return null; } String letter = ""; number--; do { if (letter.length() > 0) { number--; } letter = ((char) (number % 26 + (int) 'A')) + letter; number = (int) ((number - number % 26) / 26); } while (number > 0); return letter; } }
true
5613e14cc818cb79d3991a1bd20f3f2dcab26cc4
Java
zry123-art/qunawan
/qunawan-core/src/main/java/me/lindanpeng/qunawan/core/config/MybatisConfig.java
UTF-8
1,330
1.984375
2
[]
no_license
package me.lindanpeng.qunawan.core.config; import org.apache.ibatis.session.SqlSessionFactory; import org.mybatis.spring.SqlSessionFactoryBean; import org.mybatis.spring.SqlSessionTemplate; import org.mybatis.spring.annotation.MapperScan; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import javax.annotation.Resource; import javax.annotation.sql.DataSourceDefinition; import javax.sql.DataSource; @Configuration @MapperScan(basePackages={"me.lindanpeng.qunawan.core.dao"}) public class MybatisConfig { @Autowired @Qualifier("userDataSource") private DataSource userDataSource; @Bean(name = "sqlSessionFactory") public SqlSessionFactory sqlSessionFactoryBean() { SqlSessionFactoryBean bean = new SqlSessionFactoryBean(); bean.setDataSource(userDataSource); try { return bean.getObject(); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); } } @Bean public SqlSessionTemplate sqlSessionTemplate(SqlSessionFactory sqlSessionFactory) { return new SqlSessionTemplate(sqlSessionFactory); } }
true
b9bb87647eeca245a397a95703168297982a9167
Java
Jacob-Hughey/MedBot
/AndroidStudioProjects/MedBot/app/src/main/java/health/medbot/medbot/ViewVisitActivity.java
UTF-8
1,419
2.4375
2
[]
no_license
package health.medbot.medbot; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.CheckBox; import android.widget.EditText; public class ViewVisitActivity extends AppCompatActivity { private int vid; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_view_visit); } @Override protected void onResume() { super.onResume(); vid = getIntent().getIntExtra("vid", -1); Visit visit = MainActivity.db.userDao().getVisit(vid); loadVisitData(visit); } private void loadVisitData(Visit visit) { EditText dateView = findViewById(R.id.date); EditText heightView = findViewById(R.id.height); EditText weightView = findViewById(R.id.weight); //TODO: get sexually active status EditText symptomsView = findViewById(R.id.symptoms); EditText notesView = findViewById(R.id.notes); CheckBox isUrgentView = findViewById(R.id.isUrgent); dateView.setText(visit.getvDate()); heightView.setText(Double.toString(visit.getHeight())); weightView.setText(Double.toString(visit.getWeight())); symptomsView.setText(visit.getSymptoms()); notesView.setText(visit.getNotes()); isUrgentView.setChecked(visit.geturgentStatus()); } }
true
7a198fb32b062d941e532d97c712cbfdd94d2fee
Java
Jiang00/MyClean
/app/src/main/java/com/supers/clean/junk/adapter/FileAdapter.java
UTF-8
3,705
2.25
2
[]
no_license
package com.supers.clean.junk.adapter; import android.content.Context; import android.text.TextUtils; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; import com.supers.clean.junk.R; import com.supers.clean.junk.entity.JunkInfo; import com.supers.clean.junk.filemanager.FileUtils; import com.supers.clean.junk.filemanager.Util; import com.supers.clean.junk.util.CommonUtil; /** * Created by Ivy on 2017/4/21. */ public class FileAdapter extends MybaseAdapter<JunkInfo> { String name; public FileAdapter(Context context) { super(context); } public FileAdapter(Context context, String name) { super(context); this.name = name; } @Override public View getView(int position, View convertView, ViewGroup parent) { final JunkInfo info = getItem(position); final ViewHolder viewHolder; if (convertView == null) { viewHolder = new ViewHolder(); convertView = inflater.inflate(R.layout.layout_file_second_item, parent, false); viewHolder.file = (RelativeLayout) convertView.findViewById(R.id.file); viewHolder.file_icon = (ImageView) convertView.findViewById(R.id.file_icon); viewHolder.file_name = (TextView) convertView.findViewById(R.id.file_name); viewHolder.file_size = (TextView) convertView.findViewById(R.id.file_size); viewHolder.file_check = (ImageView) convertView.findViewById(R.id.file_check); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } if (TextUtils.equals("apk", name)) { viewHolder.file_icon.setImageDrawable(CommonUtil.getApkIcon(context, info.path)); } else if (TextUtils.equals("zip", name)) { viewHolder.file_icon.setImageResource(R.mipmap.file_zip_icon); } else if (TextUtils.equals("music", name)) { viewHolder.file_icon.setImageResource(R.mipmap.file_music_icon); } else if (TextUtils.equals("video", name)) { viewHolder.file_icon.setImageResource(R.mipmap.file_video_icon); } else if (TextUtils.equals("other", name)) { viewHolder.file_icon.setImageResource(R.mipmap.file_other_icon); } else { viewHolder.file_icon.setImageDrawable(info.icon); } viewHolder.file_name.setText(info.name); viewHolder.file_size.setText(Util.convertStorage(info.size)); if (info.isChecked) { viewHolder.file_check.setImageResource(R.mipmap.ram_passed); } else { viewHolder.file_check.setImageResource(R.mipmap.ram_normal); } viewHolder.file_check.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (info.isChecked) { viewHolder.file_check.setImageResource(R.mipmap.ram_normal); info.isChecked = false; } else { info.isChecked = true; viewHolder.file_check.setImageResource(R.mipmap.ram_passed); } } }); viewHolder.file.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { FileUtils.openFile(context, info.path); } }); return convertView; } class ViewHolder { RelativeLayout file; ImageView file_icon; TextView file_name; TextView file_size; ImageView file_check; } }
true
31a2997e69e0f887b209c27aff1a3176d6d2ad70
Java
thyferny/indwa-work
/AlpineMinerWeb/src/com/alpine/miner/impls/result/VisualAdapterARIMARPredictor.java
UTF-8
8,117
2.078125
2
[]
no_license
/** * COPYRIGHT 2011 (c) Alpine Data Labs. All Rights Reserved. * * VisualAdapterARIMARPredictor.java * * Author john zhao * * Version 1.0 * * Date July 5, 2011 */ package com.alpine.miner.impls.result; import java.sql.Types; import java.util.*; import com.alpine.datamining.api.AnalyticOutPut; import com.alpine.datamining.api.impl.output.AnalyzerOutPutARIMARPredict; import com.alpine.datamining.api.impl.output.DataTable; import com.alpine.datamining.api.impl.visual.TextTable; import com.alpine.datamining.api.utility.AlpineMath; import com.alpine.datamining.db.Column; import com.alpine.datamining.operator.timeseries.ARIMARPredictResult; import com.alpine.datamining.operator.timeseries.SingleARIMARPredictResult; import com.alpine.miner.impls.controller.DBUtil; import com.alpine.miner.impls.result.nls.VisualNLS; import com.alpine.miner.workflow.output.visual.VisualLine; import com.alpine.miner.workflow.output.visual.VisualizationModel; import com.alpine.miner.workflow.output.visual.VisualizationModelComposite; import com.alpine.miner.workflow.output.visual.VisualizationModelDataTable; import com.alpine.miner.workflow.output.visual.VisualizationModelLayered; import com.alpine.miner.workflow.output.visual.VisualizationModelLine; import com.alpine.utility.file.StringUtil; public class VisualAdapterARIMARPredictor extends VisualAdapterBaseARIMARPredictor implements OutPutVisualAdapter { @Override public VisualizationModel toVisualModel(AnalyticOutPut analyzerOutPut,Locale locale) throws RuntimeException { if(!(analyzerOutPut instanceof AnalyzerOutPutARIMARPredict)){ return null; } AnalyzerOutPutARIMARPredict model=(AnalyzerOutPutARIMARPredict)analyzerOutPut; ARIMARPredictResult aResult=model.getRet(); int maxLines=OutPutVisualAdapterFactory.getInstance().getMaxChartElements(); List<String> errorMessages = new ArrayList<String>(); List<SingleARIMARPredictResult> aRsults = aResult.getResults(); if(aRsults.size()>maxLines){ errorMessages.add(VisualNLS.getMessage(VisualNLS.BARS_EXCEED_LIMIT, locale, maxLines)); aRsults=aRsults.subList(0, maxLines-1) ; } List<VisualizationModel> models= new ArrayList<VisualizationModel>(); addTableResult(aRsults, models, locale, aResult.getGroupColumnName()); VisualizationModelLine lineModel =createLineModels(aRsults, locale); models.add( lineModel); VisualizationModelComposite visualModel= new VisualizationModelComposite(analyzerOutPut.getAnalyticNode().getName() ,models); if(errorMessages.size()>0){ lineModel.setErrorMessage(errorMessages); } return visualModel; } private void addTableResult( List<SingleARIMARPredictResult> results, List<VisualizationModel> models,Locale locale, String groupByColumnName) { if(results!=null&&results.size()>0){ VisualizationModel model = null; String outPutTitle = VisualNLS.getMessage(VisualNLS.TIMESERIES_PREDICTION_PREDICT,locale); if(StringUtil.isEmpty(groupByColumnName)){ SingleARIMARPredictResult aRresult = (SingleARIMARPredictResult) results.get(0); DataTable dataTable = getTableOutPut(aRresult); model = new VisualizationModelDataTable(outPutTitle, dataTable); }else{ List<String> keys = new ArrayList<String>() ; HashMap<String, VisualizationModel> modelMap = new HashMap<String, VisualizationModel>(); for (Iterator iterator = results.iterator(); iterator.hasNext();) { SingleARIMARPredictResult singleARIMARPredictResult = (SingleARIMARPredictResult) iterator .next(); DataTable dataTable = getTableOutPut(singleARIMARPredictResult); String key = singleARIMARPredictResult.getGroupByValue(); VisualizationModelDataTable tableModel=new VisualizationModelDataTable(singleARIMARPredictResult.getGroupByValue(), dataTable); keys.add(key); modelMap.put(key, tableModel) ; } model = new VisualizationModelLayered(outPutTitle, groupByColumnName, keys, modelMap) ; } models.add( model); } } private DataTable getTableOutPut(SingleARIMARPredictResult aResult) { Object[] idDataArray = aResult.getIDData(); double[] predictArray = aResult.getPredict(); double[] seArray = aResult.getSe(); TextTable table = new TextTable(); String[] titleArray = new String[] { ID, RESULT, SE }; String[] columnTypes = new String[]{DBUtil.TYPE_CATE, DBUtil.TYPE_NUMBER,DBUtil.TYPE_NUMBER}; table.addLine(titleArray); for (int i = 0; i < predictArray.length; i++) { table.addLine(new String[] { idDataArray[i].toString(), AlpineMath.powExpression(predictArray[i]),// String.valueOf(i+1) AlpineMath.powExpression(seArray[i]) }); } DataTable dataTable=getDataTable4TimeSeries(table,columnTypes); return dataTable; } private VisualizationModelLine createLineModels(List<SingleARIMARPredictResult> aResults ,Locale locale) { List<VisualLine> lines = new ArrayList<VisualLine>(); List<String[]> xLabels = new ArrayList<String[]> (); int index =0; boolean isDate=false; List<float[]> precisionList = new ArrayList<float[]>(); for (Iterator iterator = aResults.iterator(); iterator.hasNext();) { SingleARIMARPredictResult singleARIMARPredictResult = (SingleARIMARPredictResult) iterator .next(); List<String[]> xlabel = addLinesForSingleResult(lines, singleARIMARPredictResult,index, locale,precisionList); xLabels.addAll(xlabel) ; index=index+1; int idType = singleARIMARPredictResult.getType(); if (idType == Types.DATE || idType == Types.TIME || idType == Types.TIMESTAMP) { isDate=true; } } VisualizationModelLine lineModel=new VisualizationModelLine( VisualNLS.getMessage(VisualNLS.TIMESERIES_PREDICTION_SHARP,locale) , lines); lineModel.setMarkers(true); String[] precisionTitles = getPrecisionTitles(precisionList); lineModel.setxAxisTitle(aResults.get(0).getIdColumn().getName()+precisionTitles[0]); lineModel.setyAxisTitle(VisualNLS.getMessage(VisualNLS.VALUE,locale)+precisionTitles[1]) ; lineModel.setWidth(900) ; lineModel.setHeight(600) ; if(isDate == true){ handleDateLineModelLabel(lineModel,xLabelMap); } else{ handleNumericModelLabel(lineModel,xLabels); } return lineModel; } //max index =29 (max_count =30) protected List<String[]> addLinesForSingleResult(List<VisualLine> lines, SingleARIMARPredictResult aResult,int index,Locale locale,List<float[]> precisionList) { List<String[]> xLabels = new ArrayList<String[]> (); List<String[]> yLabels = new ArrayList<String[]> (); Column idAttribute = aResult.getIdColumn(); Object[] trainedIDs = aResult.getTrainLastIDData(); Object[] predictIDs = aResult.getIDData(); int idType = aResult.getType(); double[] trainLastArray = aResult.getTrainLastData(); double[] predictArray = aResult.getPredict(); String suffix =""; if(aResult.getGroupByValue()!=null&&aResult.getGroupByValue().trim().length()>0) { suffix = "_"+aResult.getGroupByValue(); } VisualLine trainedLine = new VisualLine( VisualNLS.getMessage(VisualNLS.TIMESERIES_PREDICTION_ORIGIN,locale) +suffix); VisualLine predictedLine = new VisualLine( VisualNLS.getMessage(VisualNLS.TIMESERIES_PREDICTION_PREDICT,locale) +suffix); // all from java.util.Date if (idType == Types.DATE || idType == Types.TIME || idType == Types.TIMESTAMP) { fillTimeLines(xLabels, yLabels, trainedIDs, trainLastArray, trainedLine); fillTimeLines(xLabels, yLabels, predictIDs, predictArray, predictedLine); } else { fillNoneTimeLines(xLabels,yLabels,trainedIDs,trainLastArray,predictIDs,predictArray,trainedLine,predictedLine,precisionList); //fillNoneTimeLine(xLabels, yLabels, trainedIDs, trainLastArray, trainedLine,precisionList); //fillNoneTimeLine(xLabels, yLabels, predictIDs, predictArray, predictedLine,precisionList); } lines.add(trainedLine); String color = getRandomColor(index) ; trainedLine.setColor(color); lines.add(predictedLine); predictedLine.setColor(color) ; return xLabels; } }
true
d8b8696d69be9a48122a73cd17cb03d823f97d71
Java
JennsiS/RadioLab
/PrincipalRadio.java
UTF-8
2,603
3.21875
3
[]
no_license
/** * @author Jennifer Sandoval, Esteban del Valle, Andrea Paniagua * @Carne 18962,18221,18733 * @date 15/01/19 * @name PrincipalRadio.java * <p>Esta clase contiene el menu en el que se interactua con el usuario para lograr utiliazr su radio</p> * */ import java.util.Scanner; public class PrincipalRadio { private static Scanner teclado; /** * * @param args */ public static void main(String[] args){ Scanner scan = new Scanner (System.in); Radio radio = (Radio) new RadioImp(); String op=" "; System.out.println("****************************"); System.out.println("Simulador de Radio"); System.out.println("****************************"); System.out.println("Indique la accion que desea realizar"); System.out.println("1. Encender radio"); System.out.println("2. Cambio de frecuencia (AM/FM)"); System.out.println("3. Cambio de emisoras"); System.out.println("4. Guardar una emisora"); System.out.println("5. Seleccionar emisora guardada"); System.out.println("6. Apagar radio"); System.out.println("7. Salir de la simulacion"); op= scan.nextLine(); while (op!="7"){ if (op.equals("1")) { radio.toggle(); } if (op.equals("2")) { radio.changeFrequency(); } if (op.equals("3")) { radio.changeStation(); } if (op.equals("4")) { System.out.println("Ingrese el numero del boton donde desea guardar la emisora actual"); int Button= scan.nextInt(); scan.nextLine(); radio.saveStation(Button); } if (op.equals("5")) { System.out.println("Ingrese el numero del boton de la emisora guardada"); int numButton = scan.nextInt(); scan.nextLine(); radio.changeStationButton(numButton); } if (op.equals("6")) { radio.toggle(); } System.out.println("****************************"); System.out.println("Simulador de Radio"); System.out.println("****************************"); System.out.println("Indique la accion que desea realizar"); System.out.println("1. Encender radio"); System.out.println("2. Cambio de frecuencia (AM/FM)"); System.out.println("3. Cambio de emisoras"); System.out.println("4. Guardar una emisora"); System.out.println("5. Seleccionar emisora guardada"); System.out.println("6. Apagar radio"); System.out.println("7. Salir de la simulacion"); op= scan.nextLine(); } } }
true
2f2e73c93aa1a1f831ba2c9f48c8394bfb37a191
Java
an3m0na/hadoop
/hadoop-tools/hadoop-posum/src/main/java/org/apache/hadoop/tools/posum/common/util/json/JsonFileReader.java
UTF-8
1,078
2.5625
3
[ "Apache-2.0", "BSD-2-Clause", "BSD-3-Clause", "LicenseRef-scancode-unknown" ]
permissive
package org.apache.hadoop.tools.posum.common.util.json; import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.ObjectMapper; import java.io.File; import java.io.IOException; import java.util.Iterator; public class JsonFileReader { private JsonParser jsonParser; public JsonFileReader(File file) throws IOException { jsonParser = new JsonFactory().createParser(file); jsonParser.setCodec(new ObjectMapper()); } public <T> T getNext(Class<T> tClass) throws IOException { jsonParser.nextToken(); if (jsonParser.hasCurrentToken()) return jsonParser.readValueAs(tClass); return null; } public void close() throws IOException { jsonParser.close(); } public <T> T readOne(Class<T> tClass) throws IOException { T ret = getNext(tClass); jsonParser.close(); return ret; } public <T> Iterator<T> readAll(Class<T> tClass) throws IOException { Iterator<T> ret = jsonParser.readValuesAs(tClass); jsonParser.close(); return ret; } }
true
735b5afc824c254151b0c3d7800b7f31fab0d021
Java
zyweistart/StartFramework
/jStart/src/main/java/start/application/web/ActionDispatcher.java
UTF-8
2,054
2.375
2
[]
no_license
package start.application.web; import java.util.Iterator; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import start.application.core.beans.BeanDefinition; import start.application.web.action.Action; import start.application.web.action.ActionResult; import start.application.web.action.ActionSupport; import start.application.web.annotation.Controller; import start.application.web.context.ContextLoaderListener; import start.application.web.context.WebApplicationContext; import start.application.web.interceptor.InterceptorHandler; /** * URL解析触发类 * @author zhenyao * */ public final class ActionDispatcher { private WebApplicationContext mWebApplicationContext; public ActionDispatcher() { mWebApplicationContext=ContextLoaderListener.getmWebApplicationContext(); } /** * 解析 * * @param name * 控制层的Action别名 */ public void start(HttpServletRequest request, HttpServletResponse response,String name) throws Exception { BeanDefinition bean = mWebApplicationContext.getBeanDefinitionInfoByName(name); // 只允许访问@Controller的Bean if (!bean.getPrototype().isAnnotationPresent(Controller.class)) { throw new IllegalAccessException(name+"无访问权限" ); } Action action = (Action)mWebApplicationContext.getBean(bean.getName()); ActionSupport support=new ActionSupport(request,response,action); if(!mWebApplicationContext.getInterceptors().isEmpty()){ //责任链模式执行拦截器 InterceptorHandler handler=null; Iterator<String> interceptors = mWebApplicationContext.getInterceptors().iterator(); while(interceptors.hasNext()){ InterceptorHandler currentHandler=(InterceptorHandler)mWebApplicationContext.getBean(interceptors.next()); currentHandler.setHandler(handler); handler=currentHandler; } //执行拦截器 handler.intercept(support); } //执行Action ActionResult result=action.execute(support); if (result != null) { result.doExecute(support); } } }
true
77d86e784a5c4bbaa1b0fa1fd7c2d2dfbd45e35b
Java
MahshidGanjeh/YaraTube
/app/src/main/java/com/yaratech/yaratube/productdetail/DetailPresenter.java
UTF-8
1,120
2.109375
2
[]
no_license
package com.yaratech.yaratube.productdetail; import android.content.Context; import android.util.Log; import com.yaratech.yaratube.data.model.DetailedProduct; import com.yaratech.yaratube.data.source.Repository; import com.yaratech.yaratube.data.source.WebService; import com.yaratech.yaratube.data.source.remote.RemoteDataSource; public class DetailPresenter implements DetailContract.Presenter { private Repository repository; private DetailContract.View mView; public DetailPresenter(DetailContract.View mView, Context context) { this.mView = mView; repository = new Repository(new RemoteDataSource(context)); } @Override public void loadDetail(int pid) { mView.showProgressbar(); repository.fetchDetailedProduct(new WebService.ApiResultCallBack() { @Override public void onSuccess(Object response) { mView.showDetail((DetailedProduct) response); mView.hideProgressbar(); } @Override public void onFail(Object message) { } }, pid); } }
true
a901e4e67fe95ae75c3dc84d7dc9bd1f7e174202
Java
sunil08/GoogleMapsApplication
/app/src/main/java/com/upskillcalendar/googlemapsapplication/FifthApp/MapMarkerAtCenter.java
UTF-8
2,753
2.171875
2
[]
no_license
package com.upskillcalendar.googlemapsapplication.FifthApp; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.View; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps.model.CameraPosition; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.MarkerOptions; import com.upskillcalendar.googlemapsapplication.R; public class MapMarkerAtCenter extends AppCompatActivity implements OnMapReadyCallback { private GoogleMap map; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_map_marker_at_center); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); SupportMapFragment supportMapFragment = (SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map4); supportMapFragment.getMapAsync(this); } @Override public void onMapReady(GoogleMap googleMap) { map = googleMap; // Add a marker in Delhi and move the camera LatLng markerLatLong = new LatLng(28.6139, 77.2090); MarkerOptions markerOptions = new MarkerOptions(); //markerOptions.icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_location)); markerOptions.position(markerLatLong).title("Delhi").draggable(true); map.addMarker(markerOptions); map.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(28.6139, 77.2090),25.0f)); map.setOnMapClickListener(new GoogleMap.OnMapClickListener() { @Override public void onMapClick(LatLng latLng) { Log.e("latitude is ",""+latLng.latitude); Log.e("longitude is ",""+latLng.longitude); } }); map.setOnCameraChangeListener(new GoogleMap.OnCameraChangeListener() { @Override public void onCameraChange(CameraPosition cameraPosition) { Log.e("latitude is ",""+cameraPosition.target.latitude); Log.e("longitude is ",""+cameraPosition.target.longitude); //map.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(28.6139, 77.2090),map.getCameraPosition().zoom)); } }); } }
true
0dae8b27bf4b2b5a5e29f76d8a7dce5c5eacce4b
Java
SubhaMaheswaran27/Squad1works
/producer/src/main/java/com/ing/producer/service/UserService.java
UTF-8
155
1.65625
2
[]
no_license
package com.ing.producer.service; import java.util.List; import com.ing.producer.entity.User; public interface UserService { List<User> getUser(); }
true
aaa8c37748dab834de2bfd37bcbb36ee2cbf89d8
Java
soMuchErrors/ml
/src/main/java/com/rainbow/machinelearning/dto/ResultNode.java
UTF-8
255
1.664063
2
[]
no_license
package com.rainbow.machinelearning.dto; import lombok.Data; /** * @author ${xiami} * @version $Id: ResultNode.java, v 0.1 2019年01月08日 15:16 Exp $ */ @Data public class ResultNode { private String resultName; private Double number; }
true