blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
132 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
200a0d96a85a0bd299227499c41e5d29c2fbad0c
df4416014c49e795bc0cb39922fd67622ef0a596
/src/vabidu/Clientes.java
0d9db6504de1682511b69fed489b966248a9f293
[]
no_license
Ivans51/proyecto-java-mongodb
37ea3570dee79312e8606026b88c451d10e6b78a
542f7c3f65311132c3c2169e14cc77da31793cbb
refs/heads/master
2021-01-02T09:26:01.748203
2017-02-14T00:09:36
2017-02-14T00:09:36
78,690,386
0
1
null
null
null
null
UTF-8
Java
false
false
22,407
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package vabidu; import java.awt.Color; import javax.swing.plaf.basic.BasicInternalFrameUI; //Libreras de mongo import com.mongodb.BasicDBObject; import com.mongodb.DB; import com.mongodb.DBCollection; import com.mongodb.DBCursor; import com.mongodb.DBObject; import com.mongodb.MongoClient; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel; import org.bson.types.ObjectId; /** * * @author Ivans */ public class Clientes extends javax.swing.JInternalFrame { MongoClient mongoClient; DBCollection clientes; BasicDBObject cliente; String nombre, cedula, direccion, telefono; DefaultTableModel tabla; DBCursor cur; String col[] = {"Id", "Nombre", "Cedula", "Dirección", "Telefono"}; /** * Creates new form Clientes */ public Clientes() { mongoClient = new MongoClient("localhost", 27017); DB db = mongoClient.getDB("vabi"); clientes = db.getCollection("clientes"); clientes.createIndex(new BasicDBObject("cedula", 1), new BasicDBObject("unique", true)); initComponents(); tabla = new DefaultTableModel(col, 0) { @Override public boolean isCellEditable(int rowIndex, int columnIndex) { return false; } }; refrescar(); jPanel2.setBackground(Color.WHITE); this.getContentPane().setBackground(Color.WHITE); ((BasicInternalFrameUI) this.getUI()).setNorthPane(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() { jPanel2 = new javax.swing.JPanel(); jPanel3 = new javax.swing.JPanel(); jTextField3 = new javax.swing.JTextField(); jLabel4 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jTextField2 = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); jPanel4 = new javax.swing.JPanel(); jButton4 = new javax.swing.JButton(); jButton6 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jTextField9 = new javax.swing.JTextField(); jLabel5 = new javax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); jLabel11 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jTextField4 = new javax.swing.JTextField(); jButton5 = new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); jLabel10 = new javax.swing.JLabel(); setBorder(null); getContentPane().setLayout(new javax.swing.BoxLayout(getContentPane(), javax.swing.BoxLayout.LINE_AXIS)); jLabel4.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 14)); // NOI18N jLabel4.setText("Teléfono"); jLabel2.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 14)); // NOI18N jLabel2.setText("Nombre"); jLabel3.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 14)); // NOI18N jLabel3.setText("Dirección"); jButton4.setBackground(new java.awt.Color(254, 254, 254)); jButton4.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 14)); // NOI18N jButton4.setForeground(new java.awt.Color(0, 0, 0)); jButton4.setText("Salir"); jButton4.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); jButton4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton4ActionPerformed(evt); } }); jButton6.setBackground(new java.awt.Color(254, 254, 254)); jButton6.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 14)); // NOI18N jButton6.setForeground(new java.awt.Color(0, 0, 0)); jButton6.setText("Refrescar"); jButton6.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); jButton6.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton6ActionPerformed(evt); } }); jButton3.setBackground(new java.awt.Color(254, 254, 254)); jButton3.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 14)); // NOI18N jButton3.setForeground(new java.awt.Color(0, 0, 0)); jButton3.setText("Eliminar"); jButton3.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); jButton1.setBackground(new java.awt.Color(254, 254, 254)); jButton1.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 14)); // NOI18N jButton1.setForeground(new java.awt.Color(0, 0, 0)); jButton1.setText("Nuevo Cliente"); jButton1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jButton2.setBackground(new java.awt.Color(254, 254, 254)); jButton2.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 14)); // NOI18N jButton2.setForeground(new java.awt.Color(0, 0, 0)); jButton2.setText("Editar"); jButton2.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout.setHorizontalGroup( jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup() .addContainerGap() .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jButton2) .addGap(18, 18, Short.MAX_VALUE) .addComponent(jButton3) .addGap(25, 25, 25) .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jButton6) .addGap(519, 519, 519)) ); jPanel4Layout.setVerticalGroup( jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup() .addContainerGap(36, Short.MAX_VALUE) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton2) .addComponent(jButton1) .addComponent(jButton3) .addComponent(jButton4) .addComponent(jButton6)) .addGap(20, 20, 20)) ); jLabel5.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 14)); // NOI18N jLabel5.setText("Cédula"); jLabel11.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 18)); // NOI18N jLabel11.setText("Buscar"); jLabel6.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 14)); // NOI18N jLabel6.setText("Cédula"); jButton5.setBackground(new java.awt.Color(254, 254, 254)); jButton5.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 14)); // NOI18N jButton5.setForeground(new java.awt.Color(0, 0, 0)); jButton5.setText("Buscar"); jButton5.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); jButton5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton5ActionPerformed(evt); } }); jTable1.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null, null, null}, {null, null, null, null, null}, {null, null, null, null, null}, {null, null, null, null, null}, {null, null, null, null, null} }, new String [] { "Title 1", "Title 2", "Title 3", "Títle 4", "Títle 5" } )); jScrollPane1.setViewportView(jTable1); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) .addGroup(jPanel3Layout.createSequentialGroup() .addGap(42, 42, 42) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(jPanel3Layout.createSequentialGroup() .addComponent(jLabel5) .addGap(40, 40, 40) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel3Layout.createSequentialGroup() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel2) .addComponent(jLabel3) .addComponent(jLabel4)) .addGap(25, 25, 25) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTextField3) .addComponent(jTextField2) .addGroup(jPanel3Layout.createSequentialGroup() .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE))))) .addGap(156, 156, 156) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel11) .addGroup(jPanel3Layout.createSequentialGroup() .addComponent(jLabel6) .addGap(46, 46, 46) .addComponent(jTextField9, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jButton5))) .addGap(0, 7, Short.MAX_VALUE)) .addComponent(jScrollPane1)) .addContainerGap()) ); jPanel3Layout.setVerticalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addGap(12, 12, 12) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel5) .addComponent(jLabel11)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel6) .addComponent(jButton5) .addComponent(jTextField9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel3) .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addGap(10, 10, 10) .addComponent(jLabel4)) .addGroup(jPanel3Layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(33, 33, 33) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jLabel10.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 18)); // NOI18N jLabel10.setText("Registrar nuevo Cliente"); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(35, 35, 35) .addComponent(jLabel10) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel10) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); getContentPane().add(jPanel2); pack(); }// </editor-fold>//GEN-END:initComponents private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed this.dispose(); }//GEN-LAST:event_jButton4ActionPerformed private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed refrescar(); }//GEN-LAST:event_jButton6ActionPerformed private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed eliminar(); refrescar(); }//GEN-LAST:event_jButton3ActionPerformed private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: asignar(); crear(); refrescar(); }//GEN-LAST:event_jButton1ActionPerformed private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed asignar(); editar(); refrescar(); }//GEN-LAST:event_jButton2ActionPerformed private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed buscar(); }//GEN-LAST:event_jButton5ActionPerformed public void buscar() { int a = tabla.getRowCount() - 1; for (int i = a; i >= 0; i--) { tabla.removeRow(i); } // String opcion = (String) jComboBox1.getSelectedItem(); String valor = jTextField9.getText(); cliente = new BasicDBObject(); if (valor.equals("cedula")) { cliente.put(valor, new ObjectId(valor)); } else { cliente.put(valor, valor); } cur = clientes.find(cliente); while (cur.hasNext()) { DBObject obj = cur.next(); Object[] fila = { obj.get("_id"), obj.get("nombre"), obj.get("cedula"), obj.get("direccion"), obj.get("telefono") }; tabla.addRow(fila); } jTable1.setModel(tabla); cur.close(); } public final void refrescar() { int a = tabla.getRowCount() - 1; for (int i = a; i >= 0; i--) { tabla.removeRow(i); } cur = clientes.find(); while (cur.hasNext()) { DBObject obj = cur.next(); Object[] fila = { obj.get("_id"), obj.get("nombre"), obj.get("cedula"), obj.get("direccion"), obj.get("telefono") }; tabla.addRow(fila); } jTable1.setModel(tabla); cur.close(); } public void asignar() { nombre = jTextField2.getText(); cedula = jTextField1.getText(); direccion = jTextField3.getText(); telefono = jTextField4.getText(); } public void crear() { try { cliente = new BasicDBObject(); cliente.put("nombre", nombre); cliente.put("cedula", cedula); cliente.put("direccion", direccion); cliente.put("telefono", telefono); clientes.insert(cliente); } catch (Exception e) { JOptionPane.showMessageDialog(this, "La cedula ya existe"); } } public void eliminar() { try { int index = jTable1.getSelectedRow(); String valor = jTable1.getValueAt(index, 0).toString(); cliente = new BasicDBObject("_id", new ObjectId(valor)); clientes.remove(cliente); } catch (Exception e) { JOptionPane.showMessageDialog(this, "No has seleccionado una fila"); } } public void editar() { try { int index = jTable1.getSelectedRow(); String valor = jTable1.getValueAt(index, 0).toString(); cliente = new BasicDBObject(); cliente.append("$set", new BasicDBObject() .append("nombre", nombre) .append("cedula", cedula) .append("direccion", direccion) .append("telefono", telefono) ); BasicDBObject search = new BasicDBObject(); search.append("_id", new ObjectId(valor)); clientes.update(search, cliente); } catch (Exception e) { if (e.getMessage().equals("-1")) { JOptionPane.showMessageDialog(this, "No has seleccionado una fila"); } else { JOptionPane.showMessageDialog(this, "El Nombre Comercial ya existe"); } } } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JButton jButton4; private javax.swing.JButton jButton5; private javax.swing.JButton jButton6; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JPanel jPanel4; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTable jTable1; private javax.swing.JTextField jTextField1; private javax.swing.JTextField jTextField2; private javax.swing.JTextField jTextField3; private javax.swing.JTextField jTextField4; private javax.swing.JTextField jTextField9; // End of variables declaration//GEN-END:variables }
[ "ivans1041@gmail.com" ]
ivans1041@gmail.com
20b4003b5d26474d9ae8372f27ad84f468fbc8fd
4abc49537521fcf7b6368f32b13ff89a59154bed
/src/com/company/Main.java
c5c94d0fe2aa1f700b4dc73c53388557937f7223
[]
no_license
RiditaNizam/FirstHalf
a19ea05e02435b7a5d8ac09a19c56877e890c0a2
3db89ba1c18c1c9264de07a58c1d55c8bb61a938
refs/heads/master
2021-01-20T16:05:25.786030
2017-05-10T03:26:23
2017-05-10T03:26:23
90,816,774
0
0
null
null
null
null
UTF-8
Java
false
false
146
java
package com.company; public class Main { public static void main(String[] args) { FirstHalf firstHalfObject = new FirstHalf(); } }
[ "riditan@gmail.com" ]
riditan@gmail.com
2af8a4b08b21aab43e17074e058f86599fc8bc87
79634ad85055b371c1d483834b92ca6d0fe89e40
/.history/src/main/java/fr/kevindvz/App_20201021153704.java
9e915a96cf6fef8b58afce9f439ec047e07cb538
[]
no_license
KevinDvZ/kataDojo
d2d2189d4aed2a4a05099002e26de81c8d0bcd35
a635199f416f187a1fec8a8dd4a360c8e161a36f
refs/heads/main
2023-01-08T11:06:28.901320
2020-11-04T14:57:02
2020-11-04T14:57:02
310,032,025
0
0
null
null
null
null
UTF-8
Java
false
false
523
java
package fr.kevindvz; /** * Hello world! */ public final class App { private App() { } /** * Says hello to the world. * @param args The arguments of the program. */ public static void main(String[] args) { System.out.println("Hello World!"); public boolean leapYearTest(int anneeTestee) { boolean resultat; if (anneeTestee % 4 == 0) { resultat = true; } else { resultat = false; return resultat; } } }
[ "kevin.deveza@gmail.com" ]
kevin.deveza@gmail.com
3159eb83c1e31cfc35a0c7c5d6ca7feecdbfe6c8
c2a81a2a70129be19127081de88f330d0b4b2639
/app/src/main/java/com/mohamedtaha/imagine/mvp/view/ListSoundReaderView.java
7dd6d763bb7800d6d77851b91e95e0b10b5611f9
[]
no_license
mohamedmohamedtaha/QuranNew
835d53eda350d7e50491e12025fd95dae4bae1a1
b0650bb1393b4ec08b278e5c9a4603196cddb3ec
refs/heads/master
2022-04-30T10:31:21.822461
2022-03-27T18:18:46
2022-03-27T18:18:46
232,631,562
0
1
null
null
null
null
UTF-8
Java
false
false
415
java
package com.mohamedtaha.imagine.mvp.view; import com.mohamedtaha.imagine.mvp.model.ImageModel; import java.util.List; public interface ListSoundReaderView { void showProgress(); void hideProgress(); void noData(); void thereData(); void showAllData(List<ImageModel> imageModels); void showAfterSearch(); void showAfterQueryText(List<ImageModel> lstFound); void showAnimation(); }
[ "mohamed.taha169@yahoo.com" ]
mohamed.taha169@yahoo.com
66db67b45836cacda317a978cae6039ab04d62e5
80af7b757aa83116e0c2543c07f90b8b6d8ff1bd
/FakeWebby/src/com/guillermo/test/HttpServerTestDT.java
2fb2dc6e8e9bd8fb66dea67ec4bd43c81a5dedf6
[]
no_license
gmcruz/Fakey
5e8f57819f378c244664d2abe91991b9735bdf55
50065777a5525082fde93d775734d400bf7352b4
refs/heads/master
2020-05-16T00:58:28.031725
2014-08-22T08:32:25
2014-08-22T08:32:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
610
java
package com.guillermo.test; import java.net.InetSocketAddress; import com.sun.net.httpserver.HttpServer; public class HttpServerTestDT extends ServerTestDT{ public static final int port = 8282; public static void main(String[] args) throws Exception { /*Properties prop = System.getProperties(); prop.list(System.out);*/ HttpServer server = HttpServer.create(new InetSocketAddress(port), 0); server.createContext("/", new MyHandler()); server.setExecutor(null); // creates a default executor server.start(); } }
[ "g.cruz@partner.samsung.com" ]
g.cruz@partner.samsung.com
de54d3657d821173d50455cb29113e7124f161ab
e44352df8285adb3387e3aa391986a45dc880e29
/sssm/src/main/java/com/huohehuohe/ssm/utils/Sgt.java
8480e64c8eec24826a39bb18e2ea51ea947b4626
[]
no_license
yuyujq/-
0f7e5ffb31dde8741d35c72fd014f2a86f2a4cb6
6f008af74653968f58e38487cc7cbf37187f347f
refs/heads/master
2022-12-21T20:43:07.576747
2019-10-12T03:28:21
2019-10-12T03:28:21
214,564,403
0
0
null
2022-12-16T11:18:06
2019-10-12T02:36:40
Java
GB18030
Java
false
false
321
java
package com.huohehuohe.ssm.utils; import org.springframework.stereotype.Component; @Component public class Sgt implements CompactDisc { private String title = "yu jianqiu"; private String artist = "asdad"; public void play() { // TODO 自动生成的方法存根 System.out.println(title+" "+artist); } }
[ "yuyujq@outlook.com" ]
yuyujq@outlook.com
952d86f31e9a9f590b32aeacac5dda3cb1855eef
c5dc4969914a0d50e591bb04592fef8a625561eb
/src/main/java/com/huxin/miaosha/domain/OrderInfo.java
52f5b6d7a78ce306193f20ce7e2c161fe6f83693
[]
no_license
DrunkenRoger/miaosha_project
81df95a370a4dd2ae9fcf9d0e3ca0ea2308cf007
325a9cbcf9b3486d7964e339162623e91be44a43
refs/heads/master
2022-07-02T14:16:38.530027
2019-06-13T07:36:05
2019-06-13T07:36:05
191,714,449
1
0
null
2022-06-17T02:13:23
2019-06-13T07:37:41
Java
UTF-8
Java
false
false
1,789
java
package com.huxin.miaosha.domain; import java.util.Date; public class OrderInfo { private Long id; private Long userId; private Long goodsId; private Long deliveryAddrId; private String goodsName; private Integer goodsCount; private Double goodsPrice; private Integer orderChannel; private Integer status; private Date createDate; private Date payDate; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Long getUserId() { return userId; } public void setUserId(Long userId) { this.userId = userId; } public Long getGoodsId() { return goodsId; } public void setGoodsId(Long goodsId) { this.goodsId = goodsId; } public Long getDeliveryAddrId() { return deliveryAddrId; } public void setDeliveryAddrId(Long deliveryAddrId) { this.deliveryAddrId = deliveryAddrId; } public String getGoodsName() { return goodsName; } public void setGoodsName(String goodsName) { this.goodsName = goodsName; } public Integer getGoodsCount() { return goodsCount; } public void setGoodsCount(Integer goodsCount) { this.goodsCount = goodsCount; } public Double getGoodsPrice() { return goodsPrice; } public void setGoodsPrice(Double goodsPrice) { this.goodsPrice = goodsPrice; } public Integer getOrderChannel() { return orderChannel; } public void setOrderChannel(Integer orderChannel) { this.orderChannel = orderChannel; } public Integer getStatus() { return status; } public void setStatus(Integer status) { this.status = status; } public Date getCreateDate() { return createDate; } public void setCreateDate(Date createDate) { this.createDate = createDate; } public Date getPayDate() { return payDate; } public void setPayDate(Date payDate) { this.payDate = payDate; } }
[ "github.com/DrunkenRoger@email.com" ]
github.com/DrunkenRoger@email.com
5c152f8e0779d5774e9d1309521bca82eb31e26c
80b7000a61d6df473a9c13797c6e508cd989525b
/shared/src/main/java/com/vaadin/shared/customcomponent/CustomComponentState.java
f19afc8c42847c8205ef54c5a2511cc9a7b2e636
[ "CC-BY-ND-2.0", "Apache-2.0" ]
permissive
jforge/vaadin
7eafe6cbf5236d1f4623f98ec2cd9b96207b532e
66df157ecfe9cea75c3c01e43ca6f37ed6ef0671
refs/heads/master
2021-01-22T16:18:34.567594
2018-03-11T10:36:56
2018-03-11T10:36:56
36,787,942
0
0
Apache-2.0
2018-03-11T10:36:57
2015-06-03T07:42:18
Java
UTF-8
Java
false
false
843
java
/* * Copyright 2000-2016 Vaadin Ltd. * * 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.vaadin.shared.customcomponent; import com.vaadin.shared.AbstractComponentState; /** * Shared state for CustomComponent. * * @author Vaadin Ltd * @since 8.0 */ public class CustomComponentState extends AbstractComponentState { }
[ "review@vaadin.com" ]
review@vaadin.com
121e24628f237a2918989bf99a05b259625d9f94
a60fca722a0811da18245a89e82bd744b7cb9cd0
/Swing/Button2.java
1a55c9e9fc3a9eeb26caa80b777c351f0b0f66ed
[]
no_license
vampireslg/Java
e57f2b2be443059733a48c118ab454aa83387442
32a4288484d47863cefb4525c745cb6244a308fc
refs/heads/master
2016-09-06T07:21:36.674293
2013-03-25T07:37:35
2013-03-25T07:37:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
716
java
import javax.swing.*; import java.awt.*; import java.awt.event.*; import net.SwingConsole.*; public class Button2 extends JFrame{ private JButton b1=new JButton("Button 1"), b2=new JButton("Button 2"); private JTextField txt=new JTextField(20); class ButtonListener implements ActionListener{ public void actionPerformed(ActionEvent e){ String name=((JButton)e.getSource()).getText(); txt.setText(name); } } private ButtonListener bl=new ButtonListener(); public Button2(){ b1.addActionListener(bl); b2.addActionListener(bl); setLayout(new FlowLayout()); add(b1); add(b2); add(txt); } public static void main(String[] args){ run(new Button2(), 200, 140); } }
[ "gaoang@gaoang.(none)" ]
gaoang@gaoang.(none)
b40b2913c1a26ca73e34cbdb0df9a59b37374984
6fd1bda3860375cbf804b7acc8698074eb058964
/src/Airplane.java
981c3187cb7622b0afd84149c3b97853829f0066
[]
no_license
josmaier/PROG1_SoSe21HA
e25fd94d19533e47f0d1c5604ed8522e31c14d2c
fffbc5acd628ac3ff249769da86e5eb18e63fd8d
refs/heads/main
2023-06-01T07:22:07.988385
2021-07-02T17:16:45
2021-07-02T17:16:45
367,689,545
0
0
null
null
null
null
UTF-8
Java
false
false
728
java
public class Airplane { protected String manufacturer, serialNumber; protected int maxSpeed; protected int serialNr; protected int numberWings = 1; protected final int loopSpeed = 320; public Airplane(String manufacturer, int maxSpeed, int numberWings) { this.manufacturer = manufacturer; this.maxSpeed = maxSpeed; this.numberWings = numberWings; } public String getSerialNr(){ return Integer.toString(serialNr); } protected void setSerialNr(int serialnNr){ this.serialNr = serialNr; } public int getMaxSpeed(){ return maxSpeed; } public boolean getLooping() { return this.getMaxSpeed() >= loopSpeed; } }
[ "joscha.maier@live.de" ]
joscha.maier@live.de
4ff48923ed5bc5a73b4a85db610e9f5d98ec61e9
df5899fb091bdc427c5c6e8a88554c32d261516c
/project/src/com/hyjx/business/niuhp_study/NiuhpDept.java
9708dc3db4cf3d1147a37b3f85dae5c33932bde2
[]
no_license
nationalflage/edgo_parent
1bb91425c2a744e003bf61af16bbce2a174264a9
0cefe3223dcfcc9bf570e48458fd330cd7f3a789
refs/heads/master
2022-12-22T04:21:35.434293
2019-11-17T14:21:12
2019-11-17T14:21:12
222,259,485
0
0
null
2022-12-16T01:24:27
2019-11-17T14:20:08
Java
UTF-8
Java
false
false
3,242
java
package com.hyjx.business.niuhp_study; import java.util.List; /** * 部门实体类 * @author i * */ public class NiuhpDept { private String code; private String name; private String parentcode; private Integer orderid; private String codetable; private String validfag; private List<NiuhpDept>children; public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getParentcode() { return parentcode; } public void setParentcode(String parentcode) { this.parentcode = parentcode; } public Integer getOrderid() { return orderid; } public void setOrderid(Integer orderid) { this.orderid = orderid; } public String getCodetable() { return codetable; } public void setCodetable(String codetable) { this.codetable = codetable; } public String getValidfag() { return validfag; } public void setValidfag(String validfag) { this.validfag = validfag; } public List<NiuhpDept> getChildren() { return children; } public void setChildren(List<NiuhpDept> children) { this.children = children; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((children == null) ? 0 : children.hashCode()); result = prime * result + ((code == null) ? 0 : code.hashCode()); result = prime * result + ((codetable == null) ? 0 : codetable.hashCode()); result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + ((orderid == null) ? 0 : orderid.hashCode()); result = prime * result + ((parentcode == null) ? 0 : parentcode.hashCode()); result = prime * result + ((validfag == null) ? 0 : validfag.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; NiuhpDept other = (NiuhpDept) obj; if (children == null) { if (other.children != null) return false; } else if (!children.equals(other.children)) return false; if (code == null) { if (other.code != null) return false; } else if (!code.equals(other.code)) return false; if (codetable == null) { if (other.codetable != null) return false; } else if (!codetable.equals(other.codetable)) return false; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return false; if (orderid == null) { if (other.orderid != null) return false; } else if (!orderid.equals(other.orderid)) return false; if (parentcode == null) { if (other.parentcode != null) return false; } else if (!parentcode.equals(other.parentcode)) return false; if (validfag == null) { if (other.validfag != null) return false; } else if (!validfag.equals(other.validfag)) return false; return true; } @Override public String toString() { return "NiuhpDept [code=" + code + ", name=" + name + ", parentcode=" + parentcode + ", orderid=" + orderid + ", codetable=" + codetable + ", validfag=" + validfag + ", children=" + children + "]"; } }
[ "nationalflage@163.com" ]
nationalflage@163.com
2e378ea5908fa865dfa5e5c829720cf8a9c3c4e1
e9a6961729a033beef9b8f5366d4c9c7752da7fd
/cz.sml.swig/src/cz/sml/swig/shared/FolderMetadata.java
fd0e8c280b98df18c98089b8d0bdd3423c40dacf
[]
no_license
fhrbek/swig
c406fbc3a769a44936ef12b39eb4cb643bd505b7
95b3ae02218ba30b3d08e2d0646bffb39d2c1207
refs/heads/master
2021-01-12T05:35:54.903859
2019-10-22T14:09:15
2019-10-22T14:09:15
77,140,043
0
0
null
null
null
null
UTF-8
Java
false
false
2,432
java
package cz.sml.swig.shared; import com.google.gwt.user.client.rpc.IsSerializable; public class FolderMetadata implements IsSerializable { public enum FolderContentType { FOLDER, IMAGE, VIDEO, IMAGE_AND_VIDEO } private String name; private int folderCount = 0; private int imageCount = 0; private int videoCount = 0; FolderMetadata() { } public FolderMetadata(String name, int folderCount, int imageCount, int viedoCount) { this.name = name; this.folderCount = folderCount; this.imageCount = imageCount; this.videoCount = viedoCount; } public String getName() { return name; } public int getFolderCount() { return folderCount; } public int getImageCount() { return imageCount; } public int getVideoCount() { return videoCount; } @Override public String toString() { StringBuilder builder = new StringBuilder(name); builder.append(' '); builder.append(getContentSummary()); return builder.toString(); } public String getContentSummary() { StringBuilder builder = new StringBuilder(); if(folderCount != 0) { builder.append(folderCount); builder.append(' '); builder.append(plural("složka", folderCount)); } if(imageCount != 0) { if(folderCount != 0) builder.append(", "); builder.append(imageCount); builder.append(' '); builder.append(plural("obrázek", imageCount)); } if(videoCount != 0) { if(folderCount != 0 || imageCount != 0) builder.append(", "); builder.append(videoCount); builder.append(' '); builder.append(plural("klip", videoCount)); } if(folderCount == 0 && imageCount == 0 && videoCount == 0) builder.append("prázdná složka"); return builder.toString(); } public FolderContentType getContentType() { if(imageCount > 0 && videoCount > 0) return FolderContentType.IMAGE_AND_VIDEO; if(imageCount > 0) return FolderContentType.IMAGE; if(videoCount > 0) return FolderContentType.VIDEO; return FolderContentType.FOLDER; } private String plural(String noun, int count) { if(count >= 2 && count <= 4) { if("složka".equals(noun)) return "složky"; if("obrázek".equals(noun)) return "obrázky"; if("klip".equals(noun)) return "klipy"; } else if(count > 4) { if("složka".equals(noun)) return "složek"; if("obrázek".equals(noun)) return "obrázků"; if("klip".equals(noun)) return "klipů"; } return noun; } }
[ "filip.hrbek@gmail.com" ]
filip.hrbek@gmail.com
7f8b6db15c4646f580a45605c00c6c4a9263c365
53c22f713f661d323631de0d74d2b0a39882e476
/src/program/DbConnection.java
da9f582493d13c0f08776480435e8d0565ee278e
[]
no_license
Essasito/Baza-program
954cd3c31c224e715f1aa50e25df34c920ae957a
2ec631b294a22e8088a250ac693ccc8d5e87b291
refs/heads/master
2020-05-04T23:03:06.626517
2019-04-04T16:08:39
2019-04-04T16:08:39
179,531,533
0
0
null
null
null
null
UTF-8
Java
false
false
647
java
package program; import java.sql.Connection; import java.sql.DriverManager; import javax.swing.JOptionPane; public class DbConnection { Connection conn = null; public static Connection ConnectDb() { try { Class.forName("org.sqlite.JDBC"); Connection conn = DriverManager.getConnection("jdbc:sqlite:apteka.db"); JOptionPane.showMessageDialog(null, "Połączono z " +conn); return conn; }catch(Exception e){ JOptionPane.showMessageDialog(null, "Nie połączono z bazą danych"); return null; } } }
[ "37266446+Essasito@users.noreply.github.com" ]
37266446+Essasito@users.noreply.github.com
29c903502b45a70dd1d2b19341beaa9e2e5fbb9f
c0c7fba722cea1da64091a40824e706cfcbbd6d8
/exercicio_05/src/main/java/com/example/exercicio_05/exercicio_05.java
5021cbf8785f0dd757b6f4dd17b87e4f6308b022
[]
no_license
tiagolgomes/Exercicio_Aula_2018_09_05
ec9144cbd229406005a81291c2b5790a927866bb
572068ba7b3b4880e96a65399096cac28e05a397
refs/heads/master
2020-03-28T15:09:29.819310
2018-09-13T01:19:11
2018-09-13T01:19:11
148,561,858
0
0
null
null
null
null
UTF-8
Java
false
false
6,148
java
package com.example.exercicio_05; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.CheckBox; import android.widget.RadioButton; import android.widget.Spinner; import android.widget.TextView; // Exercicio 5. // // Modificar o App do Exercicio 4 para desabilitar uma questão depois de respondida. // Adicionar um botão no qual o usuário possa reiniciar o Quiz. public class exercicio_05 extends Activity { private Spinner spinnerPerguntas1; private Spinner spinnerPerguntas2; private Spinner spinnerPerguntas3; private Spinner spinnerPerguntas4; private Spinner spinnerPerguntas5; private CheckBox checkBox1; private CheckBox checkBox2; private CheckBox checkBox3; private CheckBox checkBox4; private CheckBox checkBox5; private TextView textView6; private boolean check1; private boolean check2; private boolean check3; private boolean check4; private boolean check5; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_exercicio_05); spinnerPerguntas1 = findViewById(R.id.spinnerPerguntas1); spinnerPerguntas2 = findViewById(R.id.spinnerPerguntas2); spinnerPerguntas3 = findViewById(R.id.spinnerPerguntas3); spinnerPerguntas4 = findViewById(R.id.spinnerPerguntas4); spinnerPerguntas5 = findViewById(R.id.spinnerPerguntas5); checkBox1 = findViewById(R.id.checkBox1); checkBox2 = findViewById(R.id.checkBox2); checkBox3 = findViewById(R.id.checkBox3); checkBox4 = findViewById(R.id.checkBox4); checkBox5 = findViewById(R.id.checkBox5); textView6 = findViewById(R.id.textView6); spinnerPerguntas1.setEnabled(false); spinnerPerguntas2.setEnabled(false); spinnerPerguntas3.setEnabled(false); spinnerPerguntas4.setEnabled(false); spinnerPerguntas5.setEnabled(false); } public void onRadioButtonClicked1(View view) { if (checkBox1.isChecked()){ spinnerPerguntas1.setEnabled(true); check1 = true; } else { spinnerPerguntas1.setEnabled(false); check1 = false; } } public void onRadioButtonClicked2(View view) { if (checkBox2.isChecked()){ spinnerPerguntas2.setEnabled(true); check2 = true; } else { spinnerPerguntas2.setEnabled(false); check2 = false; } } public void onRadioButtonClicked3(View view) { if (checkBox3.isChecked()){ spinnerPerguntas3.setEnabled(true); check3 = true; } else { spinnerPerguntas3.setEnabled(false); check3 = false; } } public void onRadioButtonClicked4(View view) { if (checkBox4.isChecked()){ spinnerPerguntas4.setEnabled(true); check4 = true; } else { spinnerPerguntas4.setEnabled(false); check4 = false; } } public void onRadioButtonClicked5(View view) { if (checkBox5.isChecked()){ spinnerPerguntas5.setEnabled(true); check5 = true; } else { spinnerPerguntas5.setEnabled(false); check5 = false; } } public void responder(View view){ String resposta1 = ""; String resposta2 = ""; String resposta3 = ""; String resposta4 = ""; String resposta5 = ""; if(check1){ resposta1 = spinnerPerguntas1.getSelectedItem().toString(); } if(check2){ resposta2 = spinnerPerguntas2.getSelectedItem().toString(); } if(check3){ resposta3 = spinnerPerguntas3.getSelectedItem().toString(); } if(check4){ resposta4 = spinnerPerguntas4.getSelectedItem().toString(); } if(check5){ resposta5 = spinnerPerguntas5.getSelectedItem().toString(); } int acertos = 0; int questoesRespondidas = 0; switch (resposta1) { case "Curitiba": acertos++; questoesRespondidas++; break; default: break; } switch (resposta2){ case "Branco": acertos++; questoesRespondidas++; break; default: break; } switch (resposta3){ case "10": acertos++; questoesRespondidas++; break; default: break; } switch (resposta4){ case "Goggle": acertos++; questoesRespondidas++; break; default: break; } switch (resposta5){ case "Verde": acertos++; questoesRespondidas++; break; default: break; } if (questoesRespondidas == 0){ textView6.setText(String.valueOf("Você deverá selecionar pelo menos uma questão!")); } else{ textView6.setText(String.valueOf("Seu resultado é: " + acertos + "/" + questoesRespondidas)); } } public void reiniciar (View view){ if (checkBox1.isChecked()){ checkBox1.toggle(); } if (checkBox2.isChecked()){ checkBox2.toggle(); } if (checkBox3.isChecked()){ checkBox3.toggle(); } if (checkBox4.isChecked()){ checkBox4.toggle(); } if (checkBox5.isChecked()){ checkBox5.toggle(); } spinnerPerguntas1.setEnabled(false); spinnerPerguntas2.setEnabled(false); spinnerPerguntas3.setEnabled(false); spinnerPerguntas4.setEnabled(false); spinnerPerguntas5.setEnabled(false); } }
[ "tiagolacerdagomes@gmail.com" ]
tiagolacerdagomes@gmail.com
1402e1907b2cc45db440b8339be9138f3b16b3b8
a5f519d05a2a4d582316e752a3c5468222c855e4
/src/main/java/net/danlew/Demo3.java
ea66cad4c1e7246076a27dc8eb839178823b7d48
[]
no_license
mrice/rxjava-demos
cef0698a42467b46116d5095ee93c9003fed79f6
9497b88f02a2c168b3ce46355cc482e99bb554fd
refs/heads/master
2021-01-01T16:20:36.179867
2015-01-10T06:42:43
2015-01-10T06:42:43
29,049,760
0
0
null
null
null
null
UTF-8
Java
false
false
332
java
/** * This was adopted from Dan Lew's "Grokking RxJava" series. * http://blog.danlew.net/ * */ package net.danlew; import rx.Observable; public class Demo3 { public static void main(String... args) { Observable.just("Hello, World").subscribe( s -> System.out.println("Hello, world") ); } }
[ "mrice@redhat.com" ]
mrice@redhat.com
f6d0c48dafbe1cf5acc4f49bbcef15111d237e79
ae2212263c700689c17be7c0b5622c4a0cd335e9
/jphp-runtime/src/php/runtime/lang/spl/exception/OutOfRangeException.java
9f0e7bef59735e2e3ab357f8d82a68158cd6ce10
[ "Apache-2.0" ]
permissive
nstdio/jphp
cd9721038c33ef2402e78d8921ac5796ce595fac
eefaac6d8195025ba53c2b7b0996a9c128b2ffb7
refs/heads/master
2022-02-05T18:36:34.695998
2020-07-07T08:00:12
2020-07-07T08:00:12
240,853,426
0
0
Apache-2.0
2020-02-16T07:59:39
2020-02-16T07:59:38
null
UTF-8
Java
false
false
446
java
package php.runtime.lang.spl.exception; import php.runtime.env.Environment; import php.runtime.reflection.ClassEntity; import static php.runtime.annotation.Reflection.Name; @Name("OutOfRangeException") public class OutOfRangeException extends RuntimeException { public OutOfRangeException(Environment env) { super(env); } public OutOfRangeException(Environment env, ClassEntity clazz) { super(env, clazz); } }
[ "dz@dim-s.net" ]
dz@dim-s.net
18067fba937d7c8ab9781ce023630435c2b83be8
502661950a5c4faad1de67d89a56e3cae94c8a16
/Arrays/subarray.java
973ea80567ce48b5d6b4c881aa56ea742f639c30
[]
no_license
anudeepreddy528/sample
01806a34e27bc5128373c46b76b17cded1ccb40c
b9f4332bb711bd6554de8405b3dd933d1515980b
refs/heads/master
2020-08-19T18:08:07.767691
2019-10-18T04:33:49
2019-10-18T04:33:49
215,941,474
0
0
null
null
null
null
UTF-8
Java
false
false
533
java
package Arrays; public class subarray { public static void main(String[] args) { int arr[] = new int[]{-2,1,-3,4,-1,2,1,-5,4}; maxsubarray(arr); } private static void maxsubarray(int[] arr) { int globalmax=arr[0],localmax=arr[0]; for(int i=1;i<arr.length;i++) { localmax = max(arr[i],arr[i]+localmax); if(localmax>globalmax) { globalmax=localmax; } } System.out.println("max sub array is "+globalmax); } private static int max(int i, int j) { if(i>j) { return i; } else return j; } }
[ "yogeshpahilwancapgemini@gmail.com" ]
yogeshpahilwancapgemini@gmail.com
723feadd2abbe0722a46992f9965585a20aaa890
46ae277c6c3e797513ebd5aacb0b2e7f9f7c2491
/Android/src/org/celstec/arlearn2/android/genItemActivities/YoutubeObjectActivity.java
1f0c551e48432495463c199b40d7ce1079cd28c7
[]
no_license
tedwp/arlearn
041e4406f474b5c8af1ff7235702c26deaf3ddd2
3ac6d3f772c7f15f396f8551bf1b37a16878b79a
refs/heads/master
2021-01-10T02:58:40.537198
2014-04-24T07:56:11
2014-04-24T07:56:11
48,293,742
1
0
null
null
null
null
UTF-8
Java
false
false
3,273
java
/******************************************************************************* * Copyright (C) 2013 Open Universiteit Nederland * * This library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library. If not, see <http://www.gnu.org/licenses/>. * * Contributors: Stefaan Ternier ******************************************************************************/ package org.celstec.arlearn2.android.genItemActivities; import java.util.StringTokenizer; import org.celstec.arlearn2.android.R; import org.celstec.arlearn2.beans.generalItem.GeneralItem; import org.celstec.arlearn2.beans.generalItem.NarratorItem; import org.celstec.arlearn2.beans.generalItem.YoutubeObject; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.view.View; import android.widget.ImageView; public class YoutubeObjectActivity extends NarratorItemActivity { private ImageView startVideoImage; private boolean firststart = false; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (!firststart) { firststart = true; startVideo(); } startVideoImage.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { startVideo(); } }); } private void startVideo() { // startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getVideoObject().getYoutubeUrl()))); String url = getVideoObject().getYoutubeUrl(); String id = null; if (url.startsWith("http://www.youtube.com") || url.startsWith("https://www.youtube.com")) { url = url.substring(url.indexOf("?")+1); if (url == null) url = ""; StringTokenizer st = new StringTokenizer(url, "&"); while (st.hasMoreTokens()) { StringTokenizer st2 = new StringTokenizer(st.nextToken(), "="); while (st2.hasMoreTokens()) { if (st2.nextToken().equals("v")) id = st2.nextToken(); } } } if (id != null) { Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("vnd.youtube:"+id)); startActivity(i); } } protected int getContentView() { return R.layout.gi_detail_videoobject; } protected void getGuiComponents() { super.getGuiComponents(); startVideoImage = (ImageView) findViewById(R.id.startVideo); } private YoutubeObject getVideoObject() { return (YoutubeObject) narratorBean; } // protected void unpackDataFromIntent() { // GeneralItem gi = (GeneralItem) getIntent().getExtras().getSerializable("generalItem"); // narratorBean = (YoutubeObject) gi; //TODO check cast // } @Override public YoutubeObject getGeneralItem() { return (YoutubeObject) narratorBean; } @Override public void setGeneralItem(GeneralItem gi) { narratorBean = (YoutubeObject) gi; } }
[ "stefaan.ternier@gmail.com" ]
stefaan.ternier@gmail.com
705515bc27d80d6b08a8154ead43011b7b7100cb
83c7668f1c06053f8382c62af19b6b94246c9a2a
/nsgl/src/nsgl/xml/XMLDocument.java
fc949f6e8e7966c290b82223cb829f668613f72a
[]
no_license
jgomezpe/nsgl-old
4cfb4aa9792c8179c6f6b5a4d6cf0767b27e23cb
899005b7e28a0d058d8084fc25fe374899e5333d
refs/heads/master
2022-01-11T19:35:30.059381
2019-07-16T03:04:23
2019-07-16T03:04:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,902
java
package nsgl.xml; import java.io.IOException; import java.io.InputStream; import java.net.URL; // //Unalcol core structure Pack 1.0 by Jonatan Gomez-Perdomo //https://github.com/jgomezpe/unalcol/tree/master/core/ // /** * * XMLDocument * <p>Unalcol version of a XML document node.</p> * * <P> * <A HREF="https://github.com/jgomezpe/unalcol/tree/master/core/src/unalcol/xml/XMLDocument.java" target="_blank"> * Source code </A> is available. * * <h3>License</h3> * * Copyright (c) 2014 by Jonatan Gomez-Perdomo. <br> * All rights reserved. <br> * * <p>Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * <ul> * <li> Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * <li> 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. * <li> Neither the name of the copyright owners, their employers, nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * </ul> * <p>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 OWNERS 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. * * * * @author <A HREF="http://disi.unal.edu.co/profesores/jgomezpe"> Jonatan Gomez-Perdomo </A> * (E-mail: <A HREF="mailto:jgomezpe@unal.edu.co">jgomezpe@unal.edu.co</A> ) * @version 1.0 */ public class XMLDocument extends XMLElementWrap{ protected static InputStream init( URL url ) throws IOException{ return url.openStream(); } protected static InputStream init(String url, String xmlFile) throws IOException{ return XMLUtil.is(url,xmlFile); } public XMLDocument(String url, String xmlFile) throws IOException{ this(init(url,xmlFile)); } public XMLDocument(URL url) throws IOException{ this( init(url) ); } public XMLDocument(InputStream is) throws IOException{ super( XMLUtil.load(is).getDocumentElement() ); is.close(); } public XMLDocument(String xmlStr){ super( XMLUtil.load(xmlStr).getDocumentElement() ); } }
[ "jgomezpe@unal.edu.co" ]
jgomezpe@unal.edu.co
514cf89e8d417801bdc7a773e0221d14583e92bc
42445e3d5ea8e748cfc92346210ac4104e41017d
/src/com/DP/A607.java
bf7cd0ae613a13d1978d2ad811221abc0277a732
[]
no_license
rg1999/DP
8e3539894e9d2cc26c79437a1891c7ffd2c28a13
6b5f3b714e7243c1555e09142a71060f456c6ef0
refs/heads/master
2020-08-08T16:03:09.784671
2019-10-06T17:33:20
2019-10-06T17:33:20
213,864,968
0
0
null
2019-10-09T08:37:11
2019-10-09T08:37:10
null
UTF-8
Java
false
false
1,249
java
package com.DP; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class A607 { public static void main(String[] args) throws IOException { BufferedReader inp = new BufferedReader(new InputStreamReader(System.in)); int size = Integer.parseInt(inp.readLine()); int[][] given = new int[1000002][2]; for(int i=0;i<size;i++){ String[] s1 = inp.readLine().split(" "); int a = Integer.parseInt(s1[0]); int b = Integer.parseInt(s1[1]); given[a+1][0] = 1; given[a+1][1] = b; } solve(given,size ); } static void solve(int[][] given,int size){ int[] dp = new int[1000002]; int max = 0; for(int i=1;i<1000002;i++){ if(given[i][0]==1){ dp[i] = dp[Math.max(i-given[i][1]-1,0)]+1; max = Math.max(dp[i],max); } else{ dp[i] = dp[i-1]; } } //print(dp); System.out.println(size-max); } static void print(int[] a){ for(int i=0;i<a.length;i++){ System.out.print(a[i]+" "); } System.out.println(); } }
[ "suman.saurav117@gmail.com" ]
suman.saurav117@gmail.com
3fa0641baac51ddcb0e43ac7da1295ab18a9ce35
f009dc33f9624aac592cb66c71a461270f932ffa
/src/main/java/com/alipay/api/domain/MybankCreditUserRoleCreateModel.java
dab77217f2ee1aff125ee784676ba4aa76fe973c
[ "Apache-2.0" ]
permissive
1093445609/alipay-sdk-java-all
d685f635af9ac587bb8288def54d94e399412542
6bb77665389ba27f47d71cb7fa747109fe713f04
refs/heads/master
2021-04-02T16:49:18.593902
2020-03-06T03:04:53
2020-03-06T03:04:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,920
java
package com.alipay.api.domain; import com.alipay.api.AlipayObject; import com.alipay.api.internal.mapping.ApiField; /** * 创建网商会员 * * @author auto create * @since 1.0, 2017-09-25 21:10:11 */ public class MybankCreditUserRoleCreateModel extends AlipayObject { private static final long serialVersionUID = 4275172177678145783L; /** * 客户身份编码-个人是身份证号码、企业是工商注册号、会员是会员编号-具体的数字编号 */ @ApiField("entity_code") private String entityCode; /** * 客户身份标识-个人是姓名、企业是公司名称、会员是会员名称,如支付宝的手机号或者邮箱号 */ @ApiField("entity_name") private String entityName; /** * 客户身份类型-个人是PERSON、企业是COMPAY、会员是具体的站点如ALIPAY或者MYBANK */ @ApiField("entity_type") private String entityType; /** * 扩展数据(map转换为json字符串) */ @ApiField("ext_data") private String extData; /** * 业务场景,7-代表网商贷在开放平台对外开放 */ @ApiField("scene_type") private String sceneType; public String getEntityCode() { return this.entityCode; } public void setEntityCode(String entityCode) { this.entityCode = entityCode; } public String getEntityName() { return this.entityName; } public void setEntityName(String entityName) { this.entityName = entityName; } public String getEntityType() { return this.entityType; } public void setEntityType(String entityType) { this.entityType = entityType; } public String getExtData() { return this.extData; } public void setExtData(String extData) { this.extData = extData; } public String getSceneType() { return this.sceneType; } public void setSceneType(String sceneType) { this.sceneType = sceneType; } }
[ "ben.zy@antfin.com" ]
ben.zy@antfin.com
56a56a1d9507fa6d2b5824ef93878c4af82fc052
dc932c9d4283c3b17194eea5f94fd99eb56fe744
/mediarollRest/src/main/java/fr/mediarollRest/mediarollRest/service/IMediaManagerService.java
37c584b258aef3632d3018c25bc2c173f7feb1a3
[]
no_license
gtandu/mediaroll
d3f81835ea3e1cbdfaa5bcd5b452d319c40d1a5e
6530a78ef551b476a8d9310bed9e599fd64097a1
refs/heads/master
2021-05-07T22:35:32.710882
2018-11-22T22:19:30
2018-11-22T22:20:02
107,264,877
2
0
null
null
null
null
UTF-8
Java
false
false
861
java
package fr.mediarollRest.mediarollRest.service; import java.io.FileInputStream; import java.io.IOException; import org.apache.tomcat.util.http.fileupload.FileUploadException; import org.springframework.web.multipart.MultipartFile; import fr.mediarollRest.mediarollRest.exception.MediaNotFoundException; import fr.mediarollRest.mediarollRest.exception.SpaceAvailableNotEnoughException; import fr.mediarollRest.mediarollRest.model.Account; import fr.mediarollRest.mediarollRest.model.Media; public interface IMediaManagerService { public Media saveMediaInFileSystem(Account account, MultipartFile media) throws FileUploadException, IOException, SpaceAvailableNotEnoughException; public boolean deleteMediaInFileSystem(Account account, String filePath); public FileInputStream getInputStreamFromMedia(String filePath) throws MediaNotFoundException; }
[ "tbrandon91@hotmail.fr" ]
tbrandon91@hotmail.fr
a779ee62a8261c84d21258b2747a21b7a5079564
c3381ece1e660f2d626480152349262a511aefb5
/icefrog-core/src/main/java/com/whaleal/icefrog/core/bean/copier/provider/BeanValueProvider.java
7a2413fcbf464a2429f1c2e0056d3800ece3b882
[ "Apache-2.0" ]
permissive
whaleal/icefrog
775e02be5b2fc8d04df1dd490aa765232cb0e6a4
c8dc384a3de1ed17077ff61ba733b1e2f37e32ab
refs/heads/v1-dev
2022-07-27T01:27:52.624849
2022-06-20T13:38:12
2022-06-20T13:38:12
414,203,703
9
5
Apache-2.0
2022-06-20T14:08:57
2021-10-06T12:30:31
Java
UTF-8
Java
false
false
2,186
java
package com.whaleal.icefrog.core.bean.copier.provider; import com.whaleal.icefrog.core.bean.BeanUtil; import com.whaleal.icefrog.core.bean.PropDesc; import com.whaleal.icefrog.core.bean.copier.ValueProvider; import com.whaleal.icefrog.core.util.StrUtil; import java.lang.reflect.Type; import java.util.Map; /** * Bean的值提供者 * * @author Looly * @author wh */ public class BeanValueProvider implements ValueProvider<String> { final Map<String, PropDesc> sourcePdMap; private final Object source; private final boolean ignoreError; /** * 构造方法 * * @param bean Bean * @param ignoreCase 是否忽略字段大小写 * @param ignoreError 是否忽略字段值读取错误 */ public BeanValueProvider( Object bean, boolean ignoreCase, boolean ignoreError ) { this.source = bean; this.ignoreError = ignoreError; sourcePdMap = BeanUtil.getBeanDesc(source.getClass()).getPropMap(ignoreCase); } @Override public Object value( String key, Type valueType ) { final PropDesc sourcePd = getPropDesc(key, valueType); Object result = null; if (null != sourcePd) { result = sourcePd.getValue(this.source, valueType, this.ignoreError); } return result; } @Override public boolean containsKey( String key ) { final PropDesc sourcePd = getPropDesc(key, null); // 字段描述不存在或忽略读的情况下,表示不存在 return null != sourcePd && sourcePd.isReadable(false); } /** * 获得属性描述 * * @param key 字段名 * @param valueType 值类型,用于判断是否为Boolean,可以为null * @return 属性描述 */ private PropDesc getPropDesc( String key, Type valueType ) { PropDesc sourcePd = sourcePdMap.get(key); if (null == sourcePd && (null == valueType || Boolean.class == valueType || boolean.class == valueType)) { //boolean类型字段字段名支持两种方式 sourcePd = sourcePdMap.get(StrUtil.upperFirstAndAddPre(key, "is")); } return sourcePd; } }
[ "hbn.king@gmail.com" ]
hbn.king@gmail.com
6a47f8b87fc7bc0ba85c94a5e233b34d78c53f47
b658300471f7d2f8ab5dd52fc702628d10196296
/src/dbConnection/GetConnection.java
c7a2eaa359bf50e48be0c679891366f55bb88393
[]
no_license
tonyliu0716/ExternalReporterForOpenEdx
d83061a8e78ed2c3e5811c863b804e04d02eaf81
f21e1eb154dddd100d138a94e2b817414b9f3eb4
refs/heads/master
2020-06-27T03:44:10.697775
2017-07-13T14:17:47
2017-07-13T14:17:47
97,044,595
0
0
null
null
null
null
UTF-8
Java
false
false
2,596
java
package dbConnection; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.Properties; import com.jcraft.jsch.JSch; import com.jcraft.jsch.Session; import entity.ConnectionAndSession; public class GetConnection { public static ConnectionAndSession getConnection() throws Exception { Connection conn = null; String strSshUser = "vagrant"; // SSH loging username String strSshPassword = "vagrant"; // SSH login password String strSshHost = "192.168.33.10"; // hostname or ip or SSH server //int nSshPort = 2222; // remote SSH host port number String strRemoteHost = "127.0.0.1"; // hostname or ip of your database server int nLocalPort = 3306; // local port number use to bind SSH tunnel int nRemotePort = 3306; // remote port number of your database String strDbUser = "root"; // database loging username String strDbPassword = ""; // database login password Session session = null; try { //SSH loging username final JSch jsch = new JSch(); session = jsch.getSession(strSshUser, strSshHost, 22); session.setPassword(strSshPassword); final Properties config = new Properties(); config.put("StrictHostKeyChecking", "no"); session.setConfig(config); session.connect(); session.setPortForwardingL(nLocalPort, strRemoteHost, nRemotePort); Class.forName("com.mysql.jdbc.Driver"); conn = DriverManager.getConnection("jdbc:mysql://localhost:" + nLocalPort, strDbUser, strDbPassword); System.out.println("Database connected correctly..."); } catch(Exception e) { GetConnection.closeConnection(conn, null); GetConnection.closeSession(session); e.printStackTrace(); } ConnectionAndSession cs = new ConnectionAndSession(); cs.setConn(conn); cs.setSession(session); return cs; } public static void closeConnection(Connection conn, PreparedStatement ps) throws Exception { if(conn != null) { try { conn.close(); } catch(SQLException e) { e.printStackTrace(); throw e; } } if(ps != null) { ps.close(); } System.out.println("Database has been closed.."); } public static void closeSession(Session session) { if(session != null) { session.disconnect(); } System.out.println("Session has been closed..."); } }
[ "tonyliu0716@gmail.com" ]
tonyliu0716@gmail.com
467665a9b7d4d0b26ca2de00a9ed42e65136108c
0a88876c7dc84ba4d9ee09e4ae5c1f22940a4a60
/src/main/java/net/eymbra/entities/model/MeganeuraEntityModel.java
3dd2f7c82b2170e72e9e9d2b5da34a5c313a9dbf
[ "CC0-1.0" ]
permissive
TheRayKid101/Prehistoric-Dinosaur-Biomes
0067fa512d03d9f4a175f623f84ed432b658296d
61bbbc470241d05f5bb1e7b0a56310c9bd10c33d
refs/heads/master
2023-03-14T18:09:51.967672
2021-03-01T06:39:13
2021-03-01T06:39:13
331,065,302
5
0
null
null
null
null
UTF-8
Java
false
false
6,462
java
package net.eymbra.entities.model; import net.eymbra.entities.DragonflyEntity; import net.minecraft.client.model.ModelPart; import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.entity.model.EntityModel; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.Entity; public class MeganeuraEntityModel<T extends Entity> extends EntityModel<T> { private final ModelPart root; private final ModelPart body; private final ModelPart head; private final ModelPart snout; private final ModelPart tail1; private final ModelPart tail2; private final ModelPart tail3; private final ModelPart tail4; private final ModelPart tailEndLeft; private final ModelPart tailEndRight; private final ModelPart tailStubLeft; private final ModelPart tailStubRight; private final ModelPart legs; private final ModelPart wingLeft; private final ModelPart wingLeft2; private final ModelPart wingRight; private final ModelPart wingRight2; public MeganeuraEntityModel() { textureWidth = 64; textureHeight = 32; root = new ModelPart(this); root.setPivot(0.0F, 0.0F, 0.0F); body = new ModelPart(this); body.setPivot(0.0F, 17.0F, 0.0F); root.addChild(body); body.setTextureOffset(0, 4).addCuboid(-1.5F, -1.0F, 0.0F, 3.0F, 2.0F, 5.0F, 0.0F, false); head = new ModelPart(this); head.setPivot(0.0F, 0.0F, 0.0F); body.addChild(head); setRotationAngle(head, 0.4098F, 0.0F, 0.0F); head.setTextureOffset(0, 0).addCuboid(-1.5F, -1.0F, -2.0F, 3.0F, 2.0F, 2.0F, 0.0F, false); snout = new ModelPart(this); snout.setPivot(0.0F, 0.0F, 0.0F); head.addChild(snout); snout.setTextureOffset(8, 0).addCuboid(-1.0F, 0.0F, -3.0F, 2.0F, 1.0F, 1.0F, 0.0F, false); tail1 = new ModelPart(this); tail1.setPivot(0.0F, 0.5F, 5.0F); body.addChild(tail1); setRotationAngle(tail1, -0.182F, 0.0F, 0.0F); tail1.setTextureOffset(0, 18).addCuboid(-0.5F, -0.5F, 0.0F, 1.0F, 1.0F, 2.0F, 0.0F, false); tail2 = new ModelPart(this); tail2.setPivot(0.0F, 0.0F, 2.0F); tail1.addChild(tail2); setRotationAngle(tail2, -0.182F, 0.0F, 0.0F); tail2.setTextureOffset(0, 21).addCuboid(-0.5F, -0.5F, 0.0F, 1.0F, 1.0F, 2.0F, 0.0F, false); tail3 = new ModelPart(this); tail3.setPivot(0.0F, 0.0F, 2.0F); tail2.addChild(tail3); setRotationAngle(tail3, 0.182F, 0.0F, 0.0F); tail3.setTextureOffset(0, 24).addCuboid(-0.5F, -0.5F, 0.0F, 1.0F, 1.0F, 2.0F, 0.0F, false); tail4 = new ModelPart(this); tail4.setPivot(0.0F, 0.0F, 2.0F); tail3.addChild(tail4); setRotationAngle(tail4, 0.2276F, 0.0F, 0.0F); tail4.setTextureOffset(0, 27).addCuboid(-0.5F, -0.5F, 0.0F, 1.0F, 1.0F, 2.0F, 0.0F, false); tailEndLeft = new ModelPart(this); tailEndLeft.setPivot(0.0F, 0.0F, 0.0F); tail4.addChild(tailEndLeft); setRotationAngle(tailEndLeft, 0.0F, -0.2618F, 0.0F); tailEndLeft.setTextureOffset(6, 18).addCuboid(-0.6F, 0.5F, 0.2F, 1.0F, 1.0F, 3.0F, 0.0F, false); tailEndRight = new ModelPart(this); tailEndRight.setPivot(0.0F, 0.0F, 0.0F); tail4.addChild(tailEndRight); setRotationAngle(tailEndRight, 0.0F, 0.2618F, 0.0F); tailEndRight.setTextureOffset(6, 22).addCuboid(-0.5F, 0.5F, 0.2F, 1.0F, 1.0F, 3.0F, 0.0F, false); tailStubLeft = new ModelPart(this); tailStubLeft.setPivot(0.0F, 0.0F, 0.0F); tail3.addChild(tailStubLeft); tailStubLeft.setTextureOffset(6, 26).addCuboid(-1.5F, -0.5F, 1.0F, 1.0F, 1.0F, 1.0F, 0.0F, false); tailStubRight = new ModelPart(this); tailStubRight.setPivot(0.0F, 0.0F, 0.0F); tail3.addChild(tailStubRight); tailStubRight.setTextureOffset(6, 28).addCuboid(0.5F, -0.5F, 1.0F, 1.0F, 1.0F, 1.0F, 0.0F, false); legs = new ModelPart(this); legs.setPivot(0.0F, 0.0F, 0.0F); body.addChild(legs); legs.setTextureOffset(0, 11).addCuboid(-2.5F, 1.0F, 0.0F, 5.0F, 2.0F, 5.0F, 0.0F, false); wingLeft = new ModelPart(this); wingLeft.setPivot(-1.5F, -1.0F, 0.5F); body.addChild(wingLeft); setRotationAngle(wingLeft, 0.0F, 0.0F, 0.182F); wingLeft.setTextureOffset(11, 0).addCuboid(-9.0F, 0.0F, -2.5F, 9.0F, 1.0F, 5.0F, 0.0F, true); wingLeft2 = new ModelPart(this); wingLeft2.setPivot(-1.5F, -1.0F, 4.5F); body.addChild(wingLeft2); setRotationAngle(wingLeft2, 0.0F, 0.0F, -0.182F); wingLeft2.setTextureOffset(20, 12).addCuboid(-7.0F, 0.0F, -2.5F, 7.0F, 1.0F, 5.0F, 0.0F, true); wingRight = new ModelPart(this); wingRight.setPivot(1.5F, -1.0F, 0.5F); body.addChild(wingRight); setRotationAngle(wingRight, 0.0F, 0.0F, -0.182F); wingRight.setTextureOffset(16, 6).addCuboid(0.0F, 0.0F, -2.5F, 9.0F, 1.0F, 5.0F, 0.0F, true); wingRight2 = new ModelPart(this); wingRight2.setPivot(1.5F, -1.0F, 4.5F); body.addChild(wingRight2); setRotationAngle(wingRight2, 0.0F, 0.0F, 0.2276F); wingRight2.setTextureOffset(14, 18).addCuboid(0.0F, 0.0F, -2.5F, 7.0F, 1.0F, 5.0F, 0.0F, true); } @Override public void setAngles(Entity entity, float limbAngle, float limbDistance, float animationProgress, float headYaw, float headPitch) { DragonflyEntity entitydragonfly = (DragonflyEntity) entity; if (entitydragonfly.isFlappingWings()) { entitydragonfly.wingState++; if (++entitydragonfly.wingState >= 10) { entitydragonfly.wingState = -10; } } else { entitydragonfly.wingState += 0.1F; if (++entitydragonfly.wingState >= 10) { entitydragonfly.wingState = -10; } } float f = entitydragonfly.wingState * 0.1F; this.wingLeft.roll = 0.0F + f; this.wingLeft2.roll = -0.11154F + f; this.wingRight.roll = 0.0F - f; this.wingRight2.roll = 0.14871F - f; // Tail this.tail1.pitch = (float) (Math.cos(Math.toRadians(90)) + (Math.cos(limbAngle * 0.6662F + 3.14F) * limbDistance) * 0.09F); this.tail2.pitch = (float) (Math.cos(Math.toRadians(95)) + (Math.cos(limbAngle * 0.6662F + 3.14F) * limbDistance) * 0.07F); this.tail3.pitch = (float) (Math.cos(Math.toRadians(97)) + (Math.cos(limbAngle * 0.6662F + 3.14F) * limbDistance) * 0.06F); this.tail4.pitch = (float) (Math.cos(Math.toRadians(100)) + (Math.cos(limbAngle * 0.6662F + 3.14F) * limbDistance) * 0.04F); } @Override public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, float red, float green, float blue, float alpha) { matrices.translate(-.1, .3, -.1); root.render(matrices, vertices, light, overlay); } public void setRotationAngle(ModelPart modelRenderer, float x, float y, float z) { modelRenderer.pitch = x; modelRenderer.roll = y; modelRenderer.yaw = z; } }
[ "rjbennett1001@Gmail.com" ]
rjbennett1001@Gmail.com
74e69db6a0f1b9c15665e63c27509228beec01a9
36fed9e8533552b9679f5f985a6465e7c8df1180
/app/src/main/java/com/hellohasan/smsreader/Activity/MainActivity.java
4c29dd367b758beb104aa35c0b9590a83efdf2f8
[]
no_license
hasancse91/smsreaderapp
7214e9b0f9d6c23e30fb2fda44704e0c5e921d0d
02dd291ccdb5ffdfb2904730e6e55517085d8e56
refs/heads/master
2021-01-18T16:56:26.208261
2016-09-20T17:49:47
2016-09-20T17:49:47
68,712,530
0
0
null
null
null
null
UTF-8
Java
false
false
8,522
java
package com.hellohasan.smsreader.Activity; import android.app.ProgressDialog; import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.database.sqlite.SQLiteException; import android.net.Uri; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.KeyEvent; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.NativeExpressAdView; import com.hellohasan.smsreader.HelperClasses.KeyNameClass; import com.hellohasan.smsreader.HelperClasses.NetworkCheckingClass; import com.hellohasan.smsreader.HelperClasses.Preferences; import com.hellohasan.smsreader.Interface.HttpResponseInterface; import com.hellohasan.smsreader.R; import com.hellohasan.smsreader.VolleyNetworkingClass.HttpConnectionClass; import org.json.JSONException; import org.json.JSONObject; import java.security.Key; import java.util.HashMap; import java.util.Map; public class MainActivity extends AppCompatActivity implements HttpResponseInterface { TextView textView; EditText phoneNumber; EditText apiLinkEditText; String phoneNumberString; String apiLinkString; StringBuilder smsBuilder; Preferences preference; ProgressDialog progressDialog; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); preference = Preferences.getInstance(this); phoneNumberString = preference.getUserPhoneNumber(); apiLinkString = preference.getApiLink(); progressDialog = new ProgressDialog(this); progressDialog.setTitle("Sending"); progressDialog.setMessage("SMS Data Sending to server..."); phoneNumber = (EditText) findViewById(R.id.phoneNumber); apiLinkEditText = (EditText) findViewById(R.id.apiLink); textView = (TextView) findViewById(R.id.textView); phoneNumber.setText(phoneNumberString); apiLinkEditText.setText(apiLinkString); addVisible(); } private void SmsRead(String phoneAddress) { smsBuilder = new StringBuilder(); final String SMS_URI_INBOX = "content://sms/inbox"; final String SMS_URI_ALL = "content://sms/"; try { Uri uri = Uri.parse(SMS_URI_INBOX); String[] projection = new String[]{"_id", "address", "person", "body", "date", "type"}; Cursor cur = getContentResolver().query(uri, projection, "address='"+phoneAddress+"'", null, "date desc"); if (cur.moveToFirst()) { int index_Address = cur.getColumnIndex("address"); int index_Person = cur.getColumnIndex("person"); int index_Body = cur.getColumnIndex("body"); int index_Date = cur.getColumnIndex("date"); int index_Type = cur.getColumnIndex("type"); do { String strAddress = cur.getString(index_Address); int intPerson = cur.getInt(index_Person); String strbody = cur.getString(index_Body); long longDate = cur.getLong(index_Date); int int_Type = cur.getInt(index_Type); smsBuilder.append("[ "); smsBuilder.append(strAddress + ", "); smsBuilder.append(intPerson + ", "); smsBuilder.append(strbody + ", "); smsBuilder.append(longDate + ", "); smsBuilder.append(int_Type); smsBuilder.append(" ]\n\n"); // String pid = cur.getString(0); // Toast.makeText(getApplicationContext(), pid, Toast.LENGTH_LONG).show(); // String deleteUri = "content://sms/conversations/" + pid; // getApplicationContext().getContentResolver().delete(Uri.parse(deleteUri), null, null); } while (cur.moveToNext()); if (!cur.isClosed()) { cur.close(); cur = null; } if(NetworkCheckingClass.isNetworkAvailable(this)){ progressDialog.show(); Map<String, String> data = new HashMap<>(); data.put(KeyNameClass.MESSAGE, smsBuilder.toString()); System.out.println("Data: "+data); HttpConnectionClass.requestHandler(getApplicationContext(), KeyNameClass.SEND_DATA,data,this); } } else { smsBuilder.append("no result!"); textView.setText(smsBuilder); Toast.makeText(getApplicationContext(), "There are no SMS. Or phone number invalid!", Toast.LENGTH_LONG).show(); } // end if } catch ( SQLiteException ex ) { Log.d("SQLiteException", ex.getMessage()); } } public void buttonAction(View view) { if(view.getId()==R.id.phoneNumberSubmitButton){ InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); phoneNumberString = phoneNumber.getText().toString(); apiLinkString = apiLinkEditText.getText().toString(); if(phoneNumberString.startsWith("01")){ phoneNumberString = "+88" + phoneNumberString; } else if(phoneNumberString.startsWith("8801")){ phoneNumberString = "+" + phoneNumberString; } phoneNumber.setText(phoneNumberString); apiLinkEditText.setText(apiLinkString); preference.setUserPhoneNumber(phoneNumberString); preference.setApiLink(apiLinkString); Toast.makeText(getApplicationContext(), "Phone and API link saved", Toast.LENGTH_LONG).show(); } else if(view.getId()==R.id.sendDataButton){ SmsRead(phoneNumberString); } } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main_menu, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.action_developer: Intent intentContact = new Intent(MainActivity.this, AboutUsActivity.class); startActivity(intentContact); return true; default: return super.onOptionsItemSelected(item); } } private void addVisible() { LinearLayout adLinearLayout=(LinearLayout)findViewById(R.id.adMainActivity); if(NetworkCheckingClass.isNetworkAvailable(getApplicationContext())) { assert adLinearLayout != null; adLinearLayout.setVisibility(View.VISIBLE); NativeExpressAdView mAdView; mAdView = (NativeExpressAdView) findViewById(R.id.add_view_native); AdRequest adRequest = new AdRequest.Builder() .addTestDevice("0A937A3A7E33A40C17B27564FFA5EBC1") //Hasan's device .addTestDevice("70A137903010A95B2C7EB8FF56D6F0CD") //Sunny's device .build(); assert mAdView != null; mAdView.loadAd(adRequest); } else { assert adLinearLayout != null; adLinearLayout.setVisibility(View.GONE); Toast.makeText(getApplicationContext(), "Gone", Toast.LENGTH_LONG).show(); } } @Override public void actionOnResponse(JSONObject obj) { progressDialog.dismiss(); try { if(obj.getBoolean(KeyNameClass.SUCCESS)) { textView.setText(smsBuilder); } else { textView.setText("no result!"); } Toast.makeText(getApplicationContext(), obj.getString(KeyNameClass.MESSAGE), Toast.LENGTH_LONG).show(); } catch (JSONException e) { e.printStackTrace(); } } }
[ "hasan_cse91@yahoo.com" ]
hasan_cse91@yahoo.com
7963b169f8010e5d5adab189c56242cdbdcbb523
c4b8b3ae751eb704e4a2b0878eee852c8f6de3ba
/HomeShoppingMall/HomeShoppingMallForUser/app/src/main/java/app/cn/extra/mall/user/vo/AddPayPassword.java
692fcbc77fbbd01acc88041b640dd196ebc6147a
[ "Apache-2.0" ]
permissive
xuanlv886/Android
335a577f7db1663015cf75e4184ec31f5eb5e6ae
2d979edae5c2b22e837bf1afb95c956d86bf3b8a
refs/heads/master
2020-03-31T08:01:31.928776
2018-10-08T09:31:38
2018-10-08T09:33:47
152,042,321
0
0
null
null
null
null
UTF-8
Java
false
false
1,410
java
package app.cn.extra.mall.user.vo; /** * Created by Administrator on 2018/3/19 0019. */ public class AddPayPassword { /** * errorString : * flag : true * data : {"errorString":"支付密码已存在","status":"false"} */ private String errorString; private String flag; private DataBean data; public String getErrorString() { return errorString; } public void setErrorString(String errorString) { this.errorString = errorString; } public String getFlag() { return flag; } public void setFlag(String flag) { this.flag = flag; } public DataBean getData() { return data; } public void setData(DataBean data) { this.data = data; } public static class DataBean { /** * errorString : 支付密码已存在 * status : false */ private String errorString; private String status; public String getErrorString() { return errorString; } public void setErrorString(String errorString) { this.errorString = errorString; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } } }
[ "liuziyu886" ]
liuziyu886
b054f19903db31fda047586c10886b59affbd3ca
68cbdb33d93cab638c74bfac39afb8de946f61ad
/src/main/java/com/iiht/training/eloan/entity/Users.java
bc885535eab06f45d757e566e6c4ed75524cdeda
[]
no_license
anandkumark024/SBA2
c566b40c03751856591a6cad4a16b62488d8aeb2
be17989006dec0d1362d1ee2331dcc4a9447495f
refs/heads/master
2023-01-31T21:01:55.873918
2020-12-03T14:44:33
2020-12-03T14:44:33
318,198,800
1
0
null
null
null
null
UTF-8
Java
false
false
2,169
java
package com.iiht.training.eloan.entity; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import javax.validation.constraints.Email; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; @Entity @Table(name="loan_nusr") public class Users { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(name="firstName") @NotNull(message="firstName is mandatory") @NotBlank(message="firstName can not be null") @Size(min=3,max=100,message="firstName must be 4 to 50 chars in length") private String firstName; @Column(name="lastName") @NotNull(message="lastName is mandatory") @NotBlank(message="lastName can not be null") @Size(min=3,max=100,message="lastName must be 4 to 50 chars in length") private String lastName; @Column(name="email") @NotNull(message="Mail Id is mandate") @NotBlank(message="Mail Id is mandate") @Email(message = "Email Id is not valied") private String email; @Column(name="mobile") @NotNull(message="Mobile number is mandate") @NotBlank(message="Mobile number is mandate") @Pattern(regexp = "[1-9][0-9]{9}",message = "Mobile number must be exactly ten digits") private String mobile; @Column(name="role") private String role; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getMobile() { return mobile; } public void setMobile(String mobile) { this.mobile = mobile; } public String getRole() { return role; } public void setRole(String role) { this.role = role; } }
[ "dell@dell-PC" ]
dell@dell-PC
35b7dbecdb7a3bb3b13baa7f8fa26c7aeafa89b6
ab251ae598bc704512e3562a0243237803d3ccff
/app/src/main/java/com/example/arttherapy1/MyApplication.java
ad025db87795abd893ed13505e54a2e6f0c75d20
[]
no_license
juliannanelson/ArtTherapy
fd3cc948f2c7f94b3361161c78f33aa0499ea02c
51f870db7d32da8d77a9c22ae0f243a449c24ca3
refs/heads/master
2020-03-26T20:41:30.228865
2018-08-20T02:28:41
2018-08-20T02:28:41
145,339,856
0
0
null
null
null
null
UTF-8
Java
false
false
492
java
package com.example.arttherapy1; import android.app.Application; import com.example.arttherapy1.Assignment; import java.util.ArrayList; /** * Created by julianna on 8/19/18. */ public class MyApplication extends Application { private ArrayList<Assignment> assignments = new ArrayList<Assignment>(); public ArrayList<Assignment> getAssignments() { return assignments; } public void addAssignment(Assignment asgn) { this.assignments.add(asgn); } }
[ "julianna@julianna-nelson.wireless.usm.maine.edu" ]
julianna@julianna-nelson.wireless.usm.maine.edu
ee11f42ba2022c02f0703e8b23e087a73243a8b1
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/5/5_fbea467d2afdfe6ecdd573b0769208c0a31cba83/PafDataCacheCalc/5_fbea467d2afdfe6ecdd573b0769208c0a31cba83_PafDataCacheCalc_t.java
cddd6130afe8f8362b473321e92a3c2dda53eca8
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
54,667
java
/* * File: @(#)PafDataSliceCacheCalc.java Package: com.pace.base.eval Project: PafServer * Created: Feb 1, 2007 By: AFarkas * Version: x.xx * * Copyright (c) 2005-2007 Palladium Group, Inc. All rights reserved. * * This software is the confidential and proprietary information of Palladium Group, Inc. * ("Confidential Information"). You shall not disclose such Confidential Information and * should use it only in accordance with the terms of the license agreement you entered into * with Palladium Group, Inc. * * * Date Author Version Changes xx/xx/xx xxxxxxxx x.xx .............. * */ package com.pace.base.mdb; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.apache.log4j.Logger; import com.pace.base.PafBaseConstants; import com.pace.base.PafErrSeverity; import com.pace.base.PafException; import com.pace.base.app.MdbDef; import com.pace.base.app.MeasureDef; import com.pace.base.app.MeasureType; import com.pace.base.app.PafApplicationDef; import com.pace.base.app.VarRptgFlag; import com.pace.base.app.VersionDef; import com.pace.base.app.VersionFormula; import com.pace.base.app.VersionType; import com.pace.base.app.VersionVarianceType; import com.pace.base.data.EvalUtil; import com.pace.base.data.Intersection; import com.pace.base.data.IntersectionUtil; import com.pace.base.data.MemberTreeSet; import com.pace.base.data.TimeSlice; import com.pace.base.funcs.IPafFunction; import com.pace.base.rules.Formula; import com.pace.base.rules.Rule; import com.pace.base.rules.RuleGroup; import com.pace.base.rules.RuleSet; import com.pace.base.state.EvalState; import com.pace.base.state.PafClientState; import com.pace.base.utility.LogUtil; import com.pace.base.utility.StringOdometer; import com.pace.base.utility.StringUtils; import com.pace.base.view.PafViewSection; /** * Manages all calculation operations against the PafDataSliceCache * * @version x.xx * @author AFarkas * */ public abstract class PafDataCacheCalc { private static Logger logger = Logger.getLogger(PafDataCacheCalc.class); private static Logger performanceLogger = Logger.getLogger(PafBaseConstants.PERFORMANCE_LOGGER_EVAL); private static Logger evalPerfLogger = Logger.getLogger(PafBaseConstants.PERFORMANCE_LOGGER_EVAL); /** * Aggregate data across the selected dimension. This is a convenience method * that calls aggDimension(aggDimension, dataCache, memberTree, memberFilters, * trackChanges) with the 'trackChanges' parameter set to 'DcChangeTrackOpt.APPEND'. * * @param aggDimension Name of dimension to aggregate * @param dataCache Paf data cache object * @param memberTree Hierarchy for aggregated dimension * * @return Paf data cache object * @throws PafException */ public static PafDataCache aggDimension(String aggDimension, PafDataCache dataCache, PafBaseTree memberTree) throws PafException { return aggDimension(aggDimension, dataCache, memberTree, DcTrackChangeOpt.APPEND); } /** * Aggregate data across the selected base dimension. This is a convenience method * that calls aggDimension(aggDimension, dataCache, memberTree, memberFilters, * appendChangedCells) with the 'memberFilters' parameter set to null. * * @param aggDimension Name of dimension to aggregate * @param dataCache Paf data cache object * @param memberTree Hierarchy for aggregated dimension * @param trackChanges Data cache change tracking method * * @return Paf data cache object * @throws PafException */ public static PafDataCache aggDimension(String aggDimension, PafDataCache dataCache, PafBaseTree memberTree, DcTrackChangeOpt trackChanges) throws PafException { return aggDimension(aggDimension, dataCache, memberTree, null, trackChanges); } /** * Aggregate data across the selected base dimension. This is a convenience method * that calls aggDimension(aggDimension, dataCache, memberTree, memberFilters, * trackChanges) with the 'trackChanges' parameter set to 'DcChangeTrackOpt.APPEND'. * * @param aggDimension Name of dimension to aggregate * @param dataCache Paf data cache object * @param memberTree Hierarchy for aggregated dimension * @param memberFilters Map of member lists, by dimension, that can be used to narrow the focus of the calculation process * @param trackChanges Data cache change tracking method * * @return Paf data cache object * @throws PafException */ public static PafDataCache aggDimension(String aggDimension, PafDataCache dataCache, PafBaseTree memberTree, Map<String, List<String>> memberFilters) throws PafException { return aggDimension(aggDimension, dataCache, memberTree, memberFilters, DcTrackChangeOpt.APPEND); } /** * Aggregate data across the selected base dimension, for the selected dimension member. * * @param aggDimension Name of dimension to aggregate * @param dataCache Paf data cache object * @param memberTree Hierarchy for aggregated dimension * @param memberFilter Map of member lists, by dimension, that can be used to narrow the focus of the calculation process * @param trackChanges Data cache change tracking method * * @return Paf data cache object * @throws PafException */ public static PafDataCache aggDimension(String aggDimension, PafDataCache dataCache, PafDimTree memberTree, Map<String, List<String>> memberFilter, DcTrackChangeOpt trackChanges) throws PafException { boolean isTimeAggregation = false; String measureDim = dataCache.getMeasureDim(), versionDim = dataCache.getVersionDim(); String timeDim = dataCache.getTimeDim(), yearDim = dataCache.getYearDim(); int timeAxis = dataCache.getAxisIndex(timeDim), yearAxis = dataCache.getAxisIndex(yearDim); String[] dimensions = dataCache.getBaseDimensions(); String[] planVersions = dataCache.getPlanVersions(); List<String> aggMemberNames = null; List<String> timeOpenPeriods = new ArrayList<String>(); Set<MeasureType> aggMeasureTypes = new HashSet<MeasureType>(Arrays.asList(new MeasureType[]{MeasureType.Aggregate, MeasureType.TimeBalFirst, MeasureType.TimeBalLast})); Map<String, List<String>> aggFilter = new HashMap<String, List<String>>(); MdbDef mdbDef = dataCache.getAppDef().getMdbDef(); StringOdometer cellIterator = null; // The fun starts now logger.debug(String.format("Starting aggregation process for dimension [%s]", aggDimension)); // Clone member filter so that it can be updated and used to drive the aggregation // process if (memberFilter != null) { aggFilter = new HashMap<String, List<String>>(memberFilter); } else { aggFilter = new HashMap<String, List<String>>(); } // Initialize changed cells list if (trackChanges == DcTrackChangeOpt.NONE) { dataCache.initChangedCells(); } // Check if this is a time dimension if (aggDimension.equals(timeDim)) { logger.debug("Aggregation of Time Dimension is detected. Time Balance processing will be applied to Time Balance members."); isTimeAggregation = true; } // Add filter for the Version dimension if it's not the aggregated dimension // and it doesn't already have a filter on it if (!aggDimension.equalsIgnoreCase(versionDim)) { if (!aggFilter.containsKey(versionDim)) { aggFilter.put(versionDim, Arrays.asList(planVersions)); } } //BEGIN(1) - TTN-584 //if time aggregation and member filter contains time filter if ( isTimeAggregation && aggFilter.containsKey(timeDim)) { //get time open periods if (aggFilter.get(timeDim) != null ) { timeOpenPeriods = aggFilter.get(timeDim); } //remove time filter from map aggFilter.remove(timeDim); } //END(1) - TTN-584 // Enter a list of filtered dimensions into the log String[] filteredDims = new ArrayList<String>(aggFilter.keySet()).toArray(new String[0]); logger.debug("Aggregation filters have been specified on the following dimensions: " + StringUtils.arrayToString(filteredDims)); // Validate aggregation filters dataCache.validateMemberFilter(aggFilter); // Main aggregation process - Aggregate the selected dimension across all // remaining dimensions. Only aggregate the following measure types: // Aggregate, TimeBalanceFirst, and TimeBalanceLast logger.debug("Starting main aggregation process for dimension [" + aggDimension + "]...."); // Get list of members to aggregate - level 1 and above in Post Order, // so that all children are calculated before their parents. logger.debug("Getting list of members to aggregate"); aggMemberNames = memberTree.getMemberNames(TreeTraversalOrder.POST_ORDER, 1); // Apply member filter to list of members to aggregate (TTN-1644). List<String> filteredMembers = aggFilter.get(aggDimension); if (filteredMembers != null && !filteredMembers.isEmpty()) { aggMemberNames.retainAll(filteredMembers); } // Modify the aggregation filter so that it can be used to generate all // the cell intersections that need to be included in the aggregation // process. // // Since the aggregation dimension is being iterated in the outer // loop, the filter on the aggregation dimension will be set to a // single "dummy" member. Map<String, List<String>> iteratorFilter = new HashMap<String, List<String>>(aggFilter); iteratorFilter.put(aggDimension, Arrays.asList(new String[]{"[MEMBER]"})); // Initialize the intersection iterator. To reduce overhead, the iterator // only gets created once, but will be reused for each aggregation member. cellIterator = dataCache.getCellIterator(dimensions, iteratorFilter); // Cycle through aggregation members for (String aggMemberName : aggMemberNames) { //BEGIN(2) - TTN-584 - Skip aggregation on elapsed periods if ( isTimeAggregation && timeOpenPeriods.size() > 0 && !timeOpenPeriods.contains(aggMemberName)) { logger.debug("Skipping aggregation on time member [" + aggMemberName + "]"); continue; } else { logger.debug("Aggregating member [" + aggMemberName + "]"); } //END(2) - TTN-584 // Process the aggregation member only if it has children PafDimMember aggMember = memberTree.getMember(aggMemberName); List<PafDimMember> children = aggMember.getChildren(); if (children.size() > 0) { // Cycle through all selected member intersections in the data cache // across the member being aggregated. // // Each iterated intersection is a time horizon-based intersection, and // with the exception of a time dimension aggregation, must be initially // converted to a time/year-based intersection. // // Time dimension aggregation, on the other hand, is handled a bit // differently. Since time aggregation occurs along the time horizon // tree, each child intersection being aggregated is first converted // to a time horizon intersection. After the aggregation, the // iterated intersection is then converted back to a time/year // based intersection, before being written back to the data cache. // // To reduce overhead, intersections are "translated" from a time/year // format to a time horizon format, and vice versa, instead of being // cloned (TTN-1595). // while (cellIterator.hasNext()) { // Get next member intersection String[] coords = cellIterator.nextValue(); // TTN-1851 Intersection intersection = new Intersection(dimensions, coords); intersection.setCoordinate(aggDimension, aggMemberName); // Initialize aggregation total double aggAmount = 0; // Only process measures with valid aggregation types String measure = intersection.getCoordinate(measureDim); MeasureType measureType = dataCache.getMeasureType(measure); if (aggMeasureTypes.contains(measureType) || (aggMember.isSynthetic() && measureType == MeasureType.NonAggregate)) { // Aggregate children across selected member intersection. When aggregating // across the "Time" dimension, the aggregation process must properly aggregate // any measures set with the "Time Balance First" or "Time Balance Last" property. if (!isTimeAggregation){ // Non-Time Aggregation - translate time horizon coordinate in aggregated // intersection to time year coordinates. TimeSlice.translateTimeHorizonCoords(coords, timeAxis, yearAxis); // Standard aggregation process - sum up children of selected member for (PafDimMember child:children) { intersection.setCoordinate(aggDimension, child.getKey()); double cellValue = dataCache.getCellValue(intersection); aggAmount = aggAmount + cellValue; } // If aggregation member is synthetic and measure is non-aggregate then // set the value to be the average of the children. (TTN-1644) if (measureType == MeasureType.NonAggregate) { aggAmount /= children.size(); } // Update aggregated member value (non-time aggregation) intersection.setCoordinate(aggDimension, aggMemberName); dataCache.setCellValue(intersection, aggAmount, trackChanges); } else { // Time aggregation if (measureType == MeasureType.Aggregate || (aggMember.isSynthetic() && measureType == MeasureType.NonAggregate)) { // Standard aggregation process along time hierarchy (TTN-1595) for (PafDimMember child:children) { TimeSlice.applyTimeHorizonCoord(intersection, child.getKey(), mdbDef); double cellValue = dataCache.getCellValue(intersection); aggAmount = aggAmount + cellValue; } // If aggregation member is synthetic and measure is non-aggregate then // set the value to be the average of the children. (TTN-1644) if (measureType == MeasureType.NonAggregate) { aggAmount /= children.size(); } } else if (measureType == MeasureType.TimeBalFirst) { // Time Balance First - selected time dimension member equals it's first child PafDimMember child = children.get(0); TimeSlice.applyTimeHorizonCoord(intersection, child.getKey(), mdbDef); // TTN-1595 aggAmount = dataCache.getCellValue(intersection); } else if (measureType == MeasureType.TimeBalLast) { // Time Balance Last - selected time dimension member equals it's last child PafDimMember child = children.get(children.size() - 1); TimeSlice.applyTimeHorizonCoord(intersection, child.getKey(), mdbDef); // TTN-1595 aggAmount = dataCache.getCellValue(intersection); } else { // Invalid Measure Type - Throw IllegalArgumentException (should never get here) String errMsg = "Agg Dimension error - invalid Measure Type of [" + measureType.toString() + "] encountered."; logger.error(errMsg); IllegalArgumentException iae = new IllegalArgumentException(errMsg); throw iae; } // Update aggregated time member value TimeSlice.applyTimeHorizonCoord(intersection, aggMemberName, mdbDef); dataCache.setCellValue(intersection, aggAmount, trackChanges); } } } // Next intersection } cellIterator.reset(); } // Next aggregation member // Return aggregated data cache return dataCache; } /** * Compute all attribute intersections. Any invalid intersections or intersections * containing derived calculations or non aggregate measures, are skipped. * * This is a convenience method for calcAllAttributeIntersections(dataCache, evalState, clientState, memberFilters) * where evalState has been set to null. * * @param dataCache Data cache * @param clientState Client state object * @param memberMap Map of member lists by dimension that specify the intersections to calculate * @param trackChanges Data cache change tracking method * * @return PafDatCache * @throws PafException */ public static PafDataCache calcAttributeIntersections(PafDataCache dataCache, PafClientState clientState, Map<String, List<String>> memberMap, DcTrackChangeOpt trackChanges) throws PafException { return calcAttributeIntersections(dataCache, null, clientState, memberMap, trackChanges); } /** * Compute all attribute intersections required to support the data slice. Any invalid * intersections, or intersections containing derived versions, are skipped. * * An optional member filter can be supplied, to narrow the intersections being calculated * * @param dataCache Data cache * @param clientState Client state * @param sliceParms Data slice parms * @param memberFilter Optional Map of member lists by dimension that can narrow the focus of the calculations * @param trackChanges Data cache change tracking method * * @return PafDatCache * @throws PafException */ public static PafDataCache calcAttributeIntersections(PafDataCache dataCache, PafClientState clientState, PafDataSliceParms sliceParms, Map<String, List<String>> memberFilter, DcTrackChangeOpt trackChanges) throws PafException { PafViewSection viewSection = dataCache.getPafMVS().getViewSection(); String versionDim = dataCache.getVersionDim(); String[] dimensionOrder = viewSection.getDimensionsPriority(); Map<String, List<String>> memberListMap = sliceParms.buildUowSpec(dimensionOrder).buildMemberFilter(); List<String> dataSliceVersions = memberListMap.get(versionDim); // Copy in optional member filter lists if (memberFilter != null) { for (String dim : memberFilter.keySet()) { memberListMap.put(dim, new ArrayList<String>(memberFilter.get(dim))); } } // Remove any derived versions and reference versions from member map HashSet<String> versionsToCalc = new HashSet<String>(dataSliceVersions); versionsToCalc.retainAll(dataCache.getBaseVersions()); // Add in any off-screen base versions, that are components to // any derived versions on the view. List<String> dsDerivedVersions = new ArrayList<String>(dataSliceVersions); dsDerivedVersions.retainAll(dataCache.getDerivedVersions()); versionsToCalc.addAll(dataCache.getComponentVersions(dsDerivedVersions)); // // Just calculate the current plan version // HashSet<String> versionsToCalc = new HashSet<String>(Arrays.asList(dataCache.getPlanVersions())); // Calculate attributes memberListMap.put(versionDim, new ArrayList<String>(versionsToCalc)); return PafDataCacheCalc.calcAttributeIntersections(dataCache, clientState, memberListMap, trackChanges); } /** * Compute attribute intersections specified in member map. Any invalid intersections * or intersections containing derived version calculations are skipped. * * @param dataCache Data cache * @param evalState Evaluation state object * @param clientState Client state object * @param memberMap Map of member lists by dimension that specify the intersections to calculate * @param trackChanges Data cache change tracking method * * @return PafDataCache * @throws PafException */ public static PafDataCache calcAttributeIntersections(PafDataCache dataCache, EvalState evalState, PafClientState clientState, Map<String, List<String>> memberMap, DcTrackChangeOpt trackChanges) throws PafException { PafViewSection viewSection = dataCache.getPafMVS().getViewSection(); final String measureDim = dataCache.getMeasureDim(); final String[] attributeDims = viewSection.getAttributeDims(); final String[] viewDims = viewSection.getDimensionsPriority(); final int timeIndex = dataCache.getAxisIndex(dataCache.getTimeDim()), yearIndex = dataCache.getAxisIndex(dataCache.getYearDim()); final Set<Intersection> invalidViewIs = viewSection.invalidAttrIntersections(); Map<String, Set<Intersection>> recalcIsByMsr = new HashMap<String, Set<Intersection>>(); final MemberTreeSet memberTrees = clientState.getUowTrees(); final RuleSet ruleSet = clientState.getCurrentMsrRuleset(); // Initialize data cache change tracking collection if (trackChanges == DcTrackChangeOpt.OVERWRITE) { dataCache.initChangedCells(); } // Iterate through all attribute intersections that have been selected for calculation StringOdometer cacheIterator = new StringOdometer(memberMap, viewDims); while(cacheIterator.hasNext()) { // Get next intersection and convert to a time/year based intersection String[] coordinates = cacheIterator.nextValue(); // TTN-1851 TimeSlice.translateTimeHorizonCoords(coordinates, timeIndex, yearIndex); Intersection attrIs = new Intersection(viewDims, coordinates); // Skip any invalid intersections. The view section's invalid intersection // collection only contains invalid intersections that are visible on the // view. Therefore, it may be necessary to perform an additional validation // to catch any attribute intersections that were originally in the view, // but were located in rows or columns that were subsequently suppressed // and removed from the view entirely. if (invalidViewIs.contains(attrIs) || dataCache.isInvalidAttributeIntersection(attrIs, attributeDims)) { continue; } // Skip any locked intersections if (evalState != null && evalState.getCurrentLockedCells().contains(attrIs)) { continue; } // Skip derived versions in case they're included in member filters String version = attrIs.getCoordinate(dataCache.getVersionDim()); VersionDef versionDef = dataCache.getVersionDef(version); if (PafBaseConstants.DERIVED_VERSION_TYPE_LIST.contains(versionDef.getType())) { continue; } // Build recalc intersections into map based upon measure, for later processing String measure = attrIs.getCoordinate(dataCache.getMeasureDim()); MeasureDef measureDef = dataCache.getMeasureDef(measure); if (measureDef.getType() == MeasureType.Recalc ) { if (!recalcIsByMsr.containsKey(measure)) recalcIsByMsr.put(measure, new HashSet<Intersection>()); recalcIsByMsr.get(measure).add(attrIs); continue; } // Calculate Attribute Intersection calcAttributeIntersection (dataCache, attrIs, measureDef.getType(), memberTrees, trackChanges); } // 2nd pass to do recalcs. Dependent on aggregates being calculated, and processing // recalc measures in rule group sequence, so that dependent recalcs are also processed if (!recalcIsByMsr.isEmpty()) { if (evalState == null) { evalState = new EvalState(clientState, dataCache); } for (RuleGroup rg : ruleSet.getRuleGroups()) { for (Rule r : rg.getRules()) { // if rule set measure is in list, then it's by definition a recalc // and should be processed at this point in time. String msrName = r.getFormula().getResultMeasure(); if (recalcIsByMsr.containsKey(msrName)) { // iterate over intersections, calculating them for (Intersection is : recalcIsByMsr.get(msrName)) { //evalFormula(r.getFormula(), measureDim, is, dataCache, new EvalState(null, clientState, dataCache)); evalFormula(r.getFormula(), measureDim, is, dataCache, evalState); } } } } } // Return updated data slice cache return dataCache; } // I'm dumping a copy of this method here for now... // arguably this much business logic should be up in the server private static void evalFormula(Formula formula, String axis, Intersection srcIs, Intersection targetIs, PafDataCache dataCache, EvalState evalState) throws PafException { // get formula terms String[] terms = formula.getExpressionTerms(); boolean[] funcFlags = formula.getFunctionTermFlags(); double[] values = new double[terms.length]; IPafFunction function = null; //lookup each term for (int i = 0; i < terms.length; i++) { // funcflags indicate a complex function that must be evaluated differently if (funcFlags[i]) { function = formula.extractFunctionTerms()[i]; values[i] = function.calculate(srcIs, dataCache, evalState ); } else { Intersection isTerm = srcIs.clone(); isTerm.setCoordinate(axis, terms[i].trim()); values[i] = dataCache.getCellValue(isTerm); } } double result = formula.evaluate(values); // check for division by 0, which returns positive infinity, set to 0 if ( Double.isInfinite(result) || Double.isNaN(result) ) result = 0; // update value in dataCache dataCache.setCellValue(targetIs, result); } // convenience method for above function private static void evalFormula(Formula formula, String axis, Intersection calcIs, PafDataCache dataCache, EvalState evalState) throws PafException { evalFormula(formula, axis, calcIs, calcIs, dataCache, evalState); } /** * Calculate a specific attribute intersection * * @param dataCache Data cache * @param attrIs Attribute intersection * @param measureType Measure type of intersection being calculated * @param memberTrees Collection of attribute and base trees corresponding to uow * * @throws PafException */ public static void calcAttributeIntersection(final PafDataCache dataCache, final Intersection attrIs, final MeasureType measureType, final MemberTreeSet memberTrees, DcTrackChangeOpt trackChanges) throws PafException { // Some attribute intersections map directly to a base intersection. If this // attribute intersection is an alias of a base intersection then, just // add the intersection to the data cache since no calculation is needed, // and exit method. List<AliasIntersectionType> aliasTypeProps = new ArrayList<AliasIntersectionType>(); if (dataCache.isAliasIntersection(attrIs, aliasTypeProps) && aliasTypeProps.contains(AliasIntersectionType.BASE_IS)) { Intersection baseIs = dataCache.generatePrimaryIntersection(attrIs, aliasTypeProps); // To avoid created unneeded data blocks, only add attribute // intersection to data cache if its corresponding base // intersection exists. if (dataCache.isExistingIntersection(baseIs)) { dataCache.addCell(attrIs); } return; } // Explode attribute intersection into corresponding base intersections. Iterator // coordinates are in Time Horizon format (TTN-1597). StringOdometer cacheIterator = EvalUtil.explodeAttributeIntersection(dataCache, attrIs, memberTrees); // Exit if no intersections were found if (cacheIterator == null) { return; } // Aggregate descendant base intersection values located in data cache. // // When the intersection being calculated is a non-aggregate measure, // a cell count will be maintained that allows the aggregate total // to be averaged over the number of existing descendants intersections. double total = 0; int cellCount = 0, timeAxis = dataCache.getTimeAxis(), yearAxis = dataCache.getYearAxis(); while(cacheIterator.hasNext()) { // Get next intersection coordinates String[] coords = cacheIterator.nextValue(); // TTN-1851 // Translate time horizon coordinates back into regular time & year coordinates (TTN-1597) TimeSlice.translateTimeHorizonCoords(coords, timeAxis, yearAxis); // Get base intersection's cell value add it to total. Intersection intersection = new Intersection(dataCache.getBaseDimensions(), coords); double cellValue = dataCache.getCellValue(intersection); total += cellValue; // Non-Aggregate measure - increment cell count only if intersections exists. if (measureType == MeasureType.NonAggregate) { if (dataCache.isExistingIntersection(intersection)) { cellCount++; } } } // Calculate the appropriate results based on the intersection measure type double result = 0; if (measureType != MeasureType.NonAggregate) { //For aggregate members, simply return total result = total; } else { // Non-aggregate measure - return average result = total / cellCount; } // Store results dataCache.setCellValue(attrIs, result, trackChanges); } /** * Return the valid floor member combinations for the specified * intersection, base dimensions and associated attributes. * * If all the attributes for a given base dimension aren't mapped * to the same base member level, then an empty set is returned. * * @param dataCache Data cache * @param attrIs Attribute intersection * @param baseDimNames Base dimension names * @param assocAttrMap Map of associated attribute dimensions by base dimension * @param uowTrees Collection of uow cache trees * * @return Set<Intersection> */ public static List<Intersection> getValidFloorMemberCombos(PafDataCache dataCache, Intersection attrIs, List<String> baseDimNames, Map<String, List<String>> assocAttrMap, MemberTreeSet uowTrees) { // Generate the valid base member combinations, across each base dimension, // for the specified attribute values List<String> memberComboDims = new ArrayList<String>(baseDimNames); Map<String, List<String>> baseMemberMap = new HashMap<String, List<String>>(); for (String baseDim : baseDimNames) { // Get list of valid base members for the current base dimension Set<String> assocAttributes = new HashSet<String>(assocAttrMap.get(baseDim)); memberComboDims.addAll(assocAttributes); List<String> baseMembers = AttributeUtil.getComponentBaseMembers(dataCache, baseDim, assocAttributes, attrIs, uowTrees); baseMemberMap.put(baseDim, baseMembers); } // Generate the valid member combinations StringOdometer odometer = new StringOdometer(baseMemberMap, baseDimNames.toArray(new String[0])); List<Intersection> floorMemberCombos = new ArrayList<Intersection>(); while(odometer.hasNext()) { String[] baseMembers = odometer.nextValue(); // TTN-1851 Intersection memberCombo = new Intersection(memberComboDims.toArray(new String[0])); for (int i = 0; i < baseDimNames.size(); i++) { // Set base member coordinate String baseDim = baseDimNames.get(i); String baseMember = baseMembers[i]; memberCombo.setCoordinate(baseDim, baseMember); // Set associated attribute coordinates PafBaseTree baseTree = (PafBaseTree) uowTrees.getTree(baseDim); for (String attrDim : assocAttrMap.get(baseDim)) { // getAttributeMembers will only return a single value in this case, // since baseMember is at the attribute mapping level. String attrValue = baseTree.getAttributeMembers(baseMember, attrDim).toArray(new String[0])[0]; memberCombo.setCoordinate(attrDim, attrValue); } } floorMemberCombos.add(memberCombo); } return floorMemberCombos; } /** * Calculate version dimension across all data intersections comprising derived * versions. * * This is a convenience method that calls calcVersionDim(dataCache, null). * * @param dataCache Paf data cache object * @param memberTrees Collection of member trees * * @return Paf data cache object * @throws PafException */ public static PafDataCache calcVersionDim(PafDataCache dataCache, MemberTreeSet memberTrees) throws PafException { return calcVersionDim(dataCache, new HashMap<String, List<String>>(), memberTrees); } /** * Calculate the "version" dimension across the data set represented in a * view section, as defined by the view sections corresponding data slice parms * * @param dataCache Paf Data Cache * @param dataSliceParms Data Slice definition corresponding to a selected view section * @param memberTrees Collection of member trees * * @return Updated Paf Data Cache * @throws PafException */ public static PafDataCache calcVersionDim(PafDataCache dataCache, PafDataSliceParms dataSliceParms, MemberTreeSet memberTrees) throws PafException { return calcVersionDim(dataCache, dataSliceParms.buildUowSpec().buildMemberFilter(), memberTrees); } /** * Calculate version dimension * * @param dataCache Paf data cache object * @param memberFilter Map of member lists, by dimension, that can be used to narrow the focus of the calculation process * @param memberTrees Collection of member trees * * @return Paf data cache object * @throws PafException */ public static PafDataCache calcVersionDim(PafDataCache dataCache, final Map<String, List<String>> memberFilter, MemberTreeSet memberTrees) throws PafException { long calcStart = 0, calcEnd = 0; String versionDim = dataCache.getVersionDim(); String yearDim = dataCache.getYearDim(); String[] dimensions = dataCache.getPafMVS().getViewSection().getDimensionsPriority(); List<String> years = null; Map<String, List<String>> updatedMemberFilter = new HashMap<String, List<String>>(); StringOdometer cellIterator = null; logger.info(String.format("Calculating version dimension: [%s]", versionDim)); calcStart = System.currentTimeMillis(); // Inspect member filter if (memberFilter != null && memberFilter.size() > 0){ List<String> filteredDims = new ArrayList<String>(memberFilter.keySet()); logger.debug("Calculation filters have been specified on the following dimensions: " + StringUtils.arrayListToString(filteredDims)); // Validate calculation filters dataCache.validateMemberFilter(memberFilter); // Clone member filter updatedMemberFilter = new HashMap<String, List<String>>(memberFilter); } // Modify the member filter so that it can be used to generate all // the cell intersections that need to be included in the calculation // process. This entails adding entries for any missing intersection // dimensions. // // Since the year and version dimensions each have their own explicit // loops, the filter on each of those dimensions will be set to a // single "dummy" member. updatedMemberFilter.put(versionDim, Arrays.asList(new String[]{"[MEMBER]"})); updatedMemberFilter.put(yearDim, Arrays.asList(new String[]{"[MEMBER]"})); // Get the list of derived versions to calculate List<String> derivedVersions = new ArrayList<String>(); List<String> versionFilter = memberFilter.get(versionDim); if (versionFilter == null) { // No versions specified - add all derived versions in data cache derivedVersions.addAll(dataCache.getDerivedVersions()); } else { // Version filter specified - pull out all the derived ones derivedVersions.addAll(versionFilter); derivedVersions.retainAll(dataCache.getDerivedVersions()); } // Exit if no derived versions were found if (derivedVersions.size() == 0) { logger.warn("Version calculation cancelled - no derived versions were found"); return dataCache; } else { logger.info("The following version members will be calculated: " + StringUtils.arrayListToString(derivedVersions)); } // Create the list of years to iterate List<String> yearFilter = memberFilter.get(yearDim); if (yearFilter == null) { // No filter, use all year members in data cache years = Arrays.asList(dataCache.getDimMembers(yearDim)); } else { // Use supplied filter years = yearFilter; } // Main calculation process - Calculate the Version dimension across all // other dimensions logger.info("Starting main calcuation process for dimension [" + versionDim + "]...."); cellIterator = dataCache.getCellIterator(dimensions, updatedMemberFilter); try { // Cycle through years for (String year : years){ // Cycle through each derived version for (String version : derivedVersions) { VersionType versionType = dataCache.getVersionType(version); VersionFormula formula = dataCache.getVersionDef(version).getVersionFormula(); logger.debug("Calculating: Year [ " + year + "] - Version [" + version + "]"); // Calculate version - cycle through each dimension intersection for current Year and Version while (cellIterator.hasNext()) { // Get next cell intersection String[] coords = cellIterator.nextValue(); // TTN-1851 Intersection intersection = new Intersection(dimensions, coords); intersection.setCoordinate(versionDim, version); intersection.setCoordinate(yearDim, year); // Skip any invalid time intersections if (!dataCache.hasValidTimeHorizonCoord(intersection)) { continue; } // Calculate version formula on current cell double cellValue = 0; switch (versionType) { case ContribPct: cellValue = calcContribPct(dataCache, intersection, formula, memberTrees); break; case Variance: cellValue = calcVariance(dataCache, intersection, formula); break; default: // Invalid versionType - throw IllegalArgumentException String errMsg = "calcVersion error - invalid version type of [" + versionType.toString() + "] found on version [" + version + "]"; logger.error(errMsg); IllegalArgumentException iae = new IllegalArgumentException(errMsg); throw iae; } // Store results in data cache dataCache.setCellValue(intersection, cellValue); } // Reset the dimension intersection iterator cellIterator.reset(); } } } catch (PafException pfe) { // throw Paf Exception throw pfe; } catch (Exception ex) { // throw Paf Exception String errMsg = ex.getMessage(); logger.error(errMsg); PafException pfe = new PafException(errMsg, PafErrSeverity.Error, ex); throw pfe; } // Return calculated data cache calcEnd = System.currentTimeMillis(); float calcElapsed = (float)(calcEnd - calcStart) / 1000; DecimalFormat decimalFormat = new DecimalFormat("[#,##0.00]"); String formattedTime = decimalFormat.format(calcElapsed); logger.info("Variance calculations completed in: " + formattedTime + " seconds") ; return dataCache; } /** * Calculate variance version * * @param dataCache Data cache * @param intersection Intersection being calculated * @param formula Version formula * * @return Calculated cell value * @throws PafException */ private static double calcVariance(PafDataCache dataCache, Intersection intersection, VersionFormula formula) throws PafException { double calcedVariance = 0; String measureDim = dataCache.getMeasureDim(); String versionDim = dataCache.getVersionDim(); VarRptgFlag varRptgFlag = null; // Get value of base version intersection Intersection baseIs = intersection.clone(); baseIs.setCoordinate(versionDim, formula.getBaseVersion()); double baseValue = dataCache.getCellValue(baseIs); // Get value of compare version intersection Intersection compareIs = intersection.clone(); compareIs.setCoordinate(versionDim, formula.getCompareVersion()); double compareValue = dataCache.getCellValue(compareIs); // Get Variance Reporting Flag for selected measure String measure = intersection.getCoordinate(measureDim); try { varRptgFlag = dataCache.getMeasureDef(measure).getVarRptgFlag(); } catch (RuntimeException e) { // No Measure Def found for selected measure - use default value of Revenue Reporting Flag varRptgFlag = VarRptgFlag.RevenueReporting; } // Calculate simple variance based on measure's variance reporting flag double simpleVariance; if (varRptgFlag == VarRptgFlag.RevenueReporting) { simpleVariance = baseValue - compareValue; } else { simpleVariance = compareValue - baseValue; } // Return a simple variance or percent variance based on variance type if (formula.getVarianceType() == VersionVarianceType.SimpleVariance) { calcedVariance = simpleVariance; } else { // Return percent variance if (baseValue == 0 && compareValue == 0) { // If both base and compare value are zero, then set the pct variance to zero calcedVariance = 0; } else if (compareValue == 0) { // If just the compare value is zero, then pct variance = base value / abs(base value) calcedVariance = baseValue / Math.abs(baseValue); } else { // Else, pct variance = simple variance / abs(compare value) calcedVariance = (simpleVariance / Math.abs(compareValue)); } } // Return calculated variance return calcedVariance; } /** * Calculate contribution percent version * * @param version Version dimension member * @param cellIndex Cell index corresponding to value being calculated * @param dataCache Paf data cache object * * @return Calculated cell value * @throws PafException */ private static double calcContribPct(PafDataCache dataCache, Intersection intersection, VersionFormula formula, MemberTreeSet memberTrees) throws PafException { double cellValue = 0; String versionDim = dataCache.getVersionDim(); // Get value of base version intersection by cloning current intersection // and setting the version to be the formula's base version Intersection baseIs = intersection.clone(); baseIs.setCoordinate(versionDim, formula.getBaseVersion()); double baseValue = dataCache.getCellValue(baseIs); // Get value of comparison intersection - Start by cloning the base // intersection and updates the values of the dimension members // represented in the compare specification. String[] compareDims = formula.getCompareIsDims(); String[] compareMemberSpecs = formula.getCompareIsMembers(); Intersection compareIs = baseIs.clone(); for (int i = 0; i < compareDims.length; i++) { String compareDim = compareDims[i]; String currMember = intersection.getCoordinate(compareDim); String compareMember = resolveMemberSpec(compareMemberSpecs[i], memberTrees.getTree(compareDim), currMember); compareIs.setCoordinate(compareDim, compareMember); } double compareValue = dataCache.getCellValue(compareIs); // Compute cell value - return 0 if compare value is zero if (compareValue != 0) { cellValue = baseValue / compareValue; } return cellValue; } /** * Resolve member specification * * @param memberSpec Member specification string * @param dimTree Dimension tree * @param currMbrName Current intersection member name * * @return member name */ public static String resolveMemberSpec(String memberSpec, PafDimTree dimTree, String currMbrName) { String resolvedMemberSpec = null; // If not a token, then just return member name (original membSpec value) if (!memberSpec.startsWith("@")) { return memberSpec; } // Get current member PafDimMember currMember = dimTree.getMember(currMbrName); // Check for PARENT token if (memberSpec.equalsIgnoreCase(PafBaseConstants.VF_TOKEN_PARENT)) { if (currMember == dimTree.getRootNode()) { // Return current member name if current member is root of tree resolvedMemberSpec = currMember.getKey(); } else { // Else return name of parent resolvedMemberSpec = currMember.getParent().getKey(); } return resolvedMemberSpec; } // Check for TOTAL token if (memberSpec.equalsIgnoreCase(PafBaseConstants.VF_TOKEN_UOWROOT)) { // Return name of root node resolvedMemberSpec = dimTree.getRootNode().getKey(); return resolvedMemberSpec; } // Invalid member spec token String errMsg = "Invalid member token in version formula"; logger.error(errMsg); throw new IllegalArgumentException(errMsg); } /** * Build contribution percent formula basis intersection * * @param is Changed intersection * @param evalState Evaluation state * * @return Changed intersection */ public static Intersection buildContribPctBasisIs (Intersection is, EvalState evalState) { String versionDim = evalState.getVersionDim(); PafApplicationDef appDef = evalState.getAppDef(); MemberTreeSet uowTrees = evalState.getClientState().getUowTrees(); // Get version info String version = is.getCoordinate(versionDim); VersionDef vd = appDef.getVersionDef(version); VersionFormula formula = vd.getVersionFormula(); // Build basis intersection. Start with clone of changed intersection, overriding // the version member with the formula base version. Next override any of the // dimension member specifications that are contained in the comparison definition. Intersection basisIs = is.clone(); basisIs.setCoordinate(versionDim, formula.getBaseVersion()); String[] basisDims = formula.getCompareIsDims(); String[] basisMembers = formula.getCompareIsMembers(); for (int i = 0; i < basisDims.length; i++) { String dim = basisDims[i]; String currMember = basisIs.getCoordinate(dim); PafDimTree dimTree = uowTrees.getTree(dim); String basisMember = PafDataCacheCalc.resolveMemberSpec(basisMembers[i], dimTree, currMember); basisIs.setCoordinate(dim, basisMember); } // Return basis intersection return basisIs; } /** * Calculate synthetic member intersections * * @param clientState Client state object * @param dataCache Data cache * @param dataSpecByVersion Specifies the intersections to calculate over, by version * * @throws PafException */ public static void calculateSyntheticMembers(PafClientState clientState, PafDataCache dataCache, Map<String, Map<Integer, List<String>>> dataSpecByVersion) throws PafException { long startTime = System.currentTimeMillis(); int timeAxis = dataCache.getTimeAxis(), yearAxis = dataCache.getYearAxis(); String activePlanVersion = clientState.getPlanningVersion().getName(); String measureDim = dataCache.getMeasureDim(), timeDim = dataCache.getTimeDim(); String timeHorizonDim = dataCache.getTimeHorizonDim(); String versionDim = dataCache.getVersionDim(), yearDim = dataCache.getYearDim(); String logMsg = null; String[] hierDims = clientState.getApp().getMdbDef().getHierDims(); String[] baseDims = dataCache.getBaseDimensions(); List<String> recalcMeasures = dataCache.getRecalcMeasures(); Set<String> versions = new HashSet<String>(); Map<String, List<String>> timeFilter = new HashMap<String, List<String>>(), baseDimCalcFilter = null; MemberTreeSet uowTrees = clientState.getUowTrees(); PafDimTree timeHorizonTree = uowTrees.getTree(timeHorizonDim); List<String> defEvalVersions = new ArrayList<String>(); //TODO TTN-1644 Refactor this into PafDataCacheCalc or Evaluation Package // Exit if no synthetic members to process List<String> dimsToCalc = new ArrayList<String>(); for (String dim : hierDims) { PafDimTree dimTree = uowTrees.getTree(dim); if (dimTree.hasSyntheticMembers()) { dimsToCalc.add(dim); } } if (timeHorizonTree.hasSyntheticMembers()) dimsToCalc.add(timeDim); if (dimsToCalc.isEmpty()) return; // Exit if no data to calculate if (dataSpecByVersion.isEmpty()) return; // // Get a list of any versions that are being calculated in a default evaluation // // as these versions will be skipped. // PafPlannerConfig plannerConfig = clientState.getPlannerConfig(); // if (plannerConfig.isDefaultEvalEnabledWorkingVersion()) { // defEvalVersions.add(activePlanVersion); // } // String[] evalRefVersions = plannerConfig.getDefaultEvalRefVersions(); // if (evalRefVersions != null && evalRefVersions.length> 0) { // List<String> evalRefVersionList = Arrays.asList(plannerConfig.getDefaultEvalRefVersions()); // defEvalVersions.addAll(evalRefVersionList); // } // Apply version filter. If no version filter is supplied than use the active // planning version. if (dataSpecByVersion != null && !dataSpecByVersion.isEmpty()) { versions = dataSpecByVersion.keySet(); } else { versions.add(activePlanVersion); } // Create a time/year filter. Select all uow time horizon periods, as synthetic members // need to be populated across elapsed and no-elapsed periods. timeFilter.put(yearDim, Arrays.asList(TimeSlice.getTimeHorizonYear())); List<String> openTimeHorizonPeriods = timeHorizonTree.getMemberNames(TreeTraversalOrder.POST_ORDER); timeFilter.put(timeDim, openTimeHorizonPeriods); // Process each version separately as they each may be populated across varying sets // of intersections; for (String version : versions) { // Skip processing, if default eval is enabled on this version, since any synthetic // members will also get calculated during default eval. if (defEvalVersions.contains(version)) { continue; } // Set version specific filters. Skip year & time dimensions as these will be // the same values for all versions. baseDimCalcFilter = new HashMap<String, List<String>>(timeFilter); baseDimCalcFilter.put(versionDim, new ArrayList<String>(Arrays.asList(new String[]{version}))); Map<Integer, List<String>> axisDataSpecs = dataSpecByVersion.get(version); for (int axis : axisDataSpecs.keySet()) { if (axis != timeAxis && axis!= yearAxis) { String dim = dataCache.getDimension(axis); List<String> members = new ArrayList<String>(axisDataSpecs.get(axis)); // Filter out any recalc measures if (dim.equals(measureDim)) { members.removeAll(recalcMeasures); } if (!members.isEmpty()) { baseDimCalcFilter.put(dim, members); } } } // Cycle through each hierarchical dimension and perform the necessary // calculations. // // Each dimension aggregation pass is grouped together with a recalc // measure pass. This is necessary to ensure that the required // synthetic member intersections are calculated and only synthetic // member intersections are calculated. for (String dim : dimsToCalc) { logMsg = String.format("Calculating synthetic member(s) on dimension: [%s]", dim); logger.info(logMsg); // Aggregate hierarchical or time horizon dimension PafDimTree dimTree; if (!dim.equals(timeDim)) { dimTree = uowTrees.getTree(dim); } else { dimTree = timeHorizonTree; } Map<String,List<String>> dimFilter = new HashMap<String, List<String>>(baseDimCalcFilter); dimFilter.put(dim, new ArrayList<String>(dimTree.getSyntheticMemberNames())); PafDataCacheCalc.aggDimension(dim, dataCache, dimTree, dimFilter, DcTrackChangeOpt.NONE); // Calculate re-calc measure intersections using the default rule set if (!recalcMeasures.isEmpty()) { // Initialization long recalcStartTime = System.currentTimeMillis(); EvalState evalState = new EvalState(null, clientState, dataCache); RuleSet ruleSet = clientState.getDefaultMsrRuleset(); Intersection is = new Intersection(baseDims); // Create an intersection iterator. To reduce overhead, this iterator is // reused for each calculated measure. So, it must be initialized with a // dummy measure. dimFilter.put(measureDim, new ArrayList<String>(Arrays.asList(new String[]{"[DUMMY]"}))); StringOdometer cellIterator = dataCache.getCellIterator(baseDims, dimFilter); // Process each recalc measure formula in the each rule group for (RuleGroup rg : ruleSet.getRuleGroups()) { for (Rule r : rg.getRules()) { // Evaluation any formula whose result term is a recalc measure across // the required synthetic intersections String msrName = r.getFormula().getResultMeasure(); if (recalcMeasures.contains(msrName)) { // Iterate over required synthetic intersections and calculate them. while (cellIterator.hasNext()) { String[] coords = cellIterator.nextValue(); // TTN-1851 TimeSlice.translateTimeHorizonCoords(coords, timeAxis, yearAxis); is.setCoordinates(coords); is.setCoordinate(measureDim, msrName); EvalUtil.evalFormula(r.getFormula(), measureDim, is, dataCache, evalState); } cellIterator.reset(); } } } logMsg = LogUtil.timedStep("Synthetic Member - Recalc Measure Calculation Pass", recalcStartTime); evalPerfLogger.info(logMsg); } } // Next dim } // Next version dataCache.clearDirty(); logMsg = LogUtil.timedStep("Synthetic Member Calculation", startTime); evalPerfLogger.info(logMsg); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
9dab33239fa886f8af3f49c111b76fd7644531b6
89c01f99a04ba72043701d3f95f979ec5a750881
/src/VIEW/ProdutoVIEW.java
12d0427bece50e3f9b66eac13673e7fd46e64b8d
[]
no_license
pedr0hug0/TDGSis
fb841a46328672a0357c2e209bc91721fd94f1b2
8553f4804d314b2c5caa1163dce3600448050df8
refs/heads/master
2022-04-18T21:34:07.130734
2020-04-20T23:14:33
2020-04-20T23:14:33
239,875,311
0
0
null
null
null
null
UTF-8
Java
false
false
73,944
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package VIEW; import CTR.tdgCTR; import DTO.CoresDTO; import DTO.ProdutoDTO; import dao.CoresDAO; import dao.ProdutoCoresDAO; import dao.ProdutoDAO; import java.awt.event.ItemEvent; import java.sql.SQLException; import javax.swing.DefaultListModel; import javax.swing.JList; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel; /** * * @author PeDr0_HuG0 */ public class ProdutoVIEW extends javax.swing.JFrame { /** * Creates new form ProdutoVIEW */ public ProdutoVIEW() { initComponents(); setExtendedState(MAXIMIZED_BOTH); //botao x fechar apenas janela setDefaultCloseOperation(ProdutoVIEW.HIDE_ON_CLOSE); //ocultando coluna ID ocultar_coluna_tabela(); tdgCTR.considerarEnterComoTab(txt_Ref); tdgCTR.considerarEnterComoTab(jCheckBox_Bordado); tdgCTR.considerarEnterComoTab(jCheckBox_Bolso); tdgCTR.considerarEnterComoTab(jCheckBox_Estampa); tdgCTR.considerarEnterComoTab(jCheckBox_Costas); tdgCTR.considerarEnterComoTab(jCheckBox_Manga); tdgCTR.considerarEnterComoTab(txt_qtd_cores); tdgCTR.considerarEnterComoTab(txt_rendimento); tdgCTR.considerarEnterComoTab(btn_add_cor); tdgCTR.considerarEnterComoTab(btn_remove_cor); listar_categoria_produto(); listar_categoria_cor(); //listar_cores_categoria(jComboBox_categoria.getSelectedItem().toString()); } /** * 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() { jPCadastrar = new javax.swing.JPanel(); jLabel2 = new javax.swing.JLabel(); jPanel1 = new javax.swing.JPanel(); jCheckBox_Bolso = new javax.swing.JCheckBox(); jCheckBox_Estampa = new javax.swing.JCheckBox(); jCheckBox_Bordado = new javax.swing.JCheckBox(); jCheckBox_Costas = new javax.swing.JCheckBox(); jCheckBox_Manga = new javax.swing.JCheckBox(); btn_Limpar = new javax.swing.JButton(); jLabel3 = new javax.swing.JLabel(); btn_Cadastrar = new javax.swing.JButton(); jLabel8 = new javax.swing.JLabel(); txt_Ref = new javax.swing.JTextField(); txt_id = new javax.swing.JTextField(); jLabel9 = new javax.swing.JLabel(); btn_Atualizar = new javax.swing.JButton(); txt_qtd_tamanho = new javax.swing.JTextField(); jLabel10 = new javax.swing.JLabel(); jComboBoxTipo_tamanho = new javax.swing.JComboBox(); jComboBox_Descricao = new javax.swing.JComboBox(); jLabel12 = new javax.swing.JLabel(); txt_rendimento = new javax.swing.JTextField(); jCheckBox_Especial = new javax.swing.JCheckBox(); jLabel11 = new javax.swing.JLabel(); jComboBox_categoria = new javax.swing.JComboBox(); btn_add_cor = new javax.swing.JButton(); btn_remove_cor = new javax.swing.JButton(); btn_config_cores = new javax.swing.JButton(); jLabel4 = new javax.swing.JLabel(); jScrollPane3 = new javax.swing.JScrollPane(); jTable_cor = new javax.swing.JTable(); jComboBox_cor = new javax.swing.JComboBox(); txt_qtd_cores = new javax.swing.JTextField(); jComboBox_id_cor = new javax.swing.JComboBox(); btn_config_cat = new javax.swing.JButton(); jScrollPane4 = new javax.swing.JScrollPane(); jTable_tamanho = new javax.swing.JTable(); jLabel13 = new javax.swing.JLabel(); jComboBox_categoria_tamanho = new javax.swing.JComboBox(); jComboBox_tamanho = new javax.swing.JComboBox(); btn_add_tamanho = new javax.swing.JButton(); btn_remove_tamanho = new javax.swing.JButton(); jPanel2 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); txt_ref_pesquisar = new javax.swing.JTextField(); btn_Excluir = new javax.swing.JButton(); btn_Listar = new javax.swing.JButton(); btn_Limpar_Lista = new javax.swing.JButton(); btn_Editar = new javax.swing.JButton(); btn_Pesquisar = new javax.swing.JButton(); jScrollPane2 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Cadastro de Produto"); setName("Cadastro Produto"); // NOI18N jPCadastrar.setBorder(javax.swing.BorderFactory.createTitledBorder("Cadastro de Referencia")); jLabel2.setText("Ref:"); jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder()); jCheckBox_Bolso.setText("Bolso"); jCheckBox_Estampa.setSelected(true); jCheckBox_Estampa.setText("Estampa"); jCheckBox_Bordado.setText("Bordado"); jCheckBox_Bordado.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jCheckBox_BordadoActionPerformed(evt); } }); jCheckBox_Costas.setText("Costas"); jCheckBox_Costas.setNextFocusableComponent(jCheckBox_Manga); jCheckBox_Manga.setText("Manga"); jCheckBox_Manga.setNextFocusableComponent(jComboBox_cor); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jCheckBox_Estampa) .addComponent(jCheckBox_Bordado) .addComponent(jCheckBox_Bolso) .addComponent(jCheckBox_Costas) .addComponent(jCheckBox_Manga)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jCheckBox_Bordado) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jCheckBox_Estampa) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jCheckBox_Bolso) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jCheckBox_Costas) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jCheckBox_Manga) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); btn_Limpar.setText("Limpar"); btn_Limpar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_LimparActionPerformed(evt); } }); jLabel3.setText("Descrição:"); btn_Cadastrar.setText("Cadastrar"); btn_Cadastrar.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { btn_CadastrarFocusGained(evt); } }); btn_Cadastrar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_CadastrarActionPerformed(evt); } }); jLabel8.setText("Tipo tamanho:"); txt_Ref.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR)); txt_Ref.addFocusListener(new java.awt.event.FocusAdapter() { public void focusLost(java.awt.event.FocusEvent evt) { txt_RefFocusLost(evt); } }); txt_id.setEnabled(false); jLabel9.setText("ID:"); btn_Atualizar.setText("Atualizar"); btn_Atualizar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_AtualizarActionPerformed(evt); } }); txt_qtd_tamanho.setBackground(new java.awt.Color(240, 240, 240)); txt_qtd_tamanho.setText("4"); txt_qtd_tamanho.setEnabled(false); jLabel10.setText("Qtd tamanho:"); jComboBoxTipo_tamanho.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "NORMAL", "JUVENIL", "ESPECIAL", "BABY", "KIDS", "MANUAL" })); jComboBoxTipo_tamanho.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { jComboBoxTipo_tamanhoItemStateChanged(evt); } }); jComboBoxTipo_tamanho.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { jComboBoxTipo_tamanhoKeyPressed(evt); } }); jComboBox_Descricao.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "-" })); jComboBox_Descricao.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { jComboBox_DescricaoItemStateChanged(evt); } }); jComboBox_Descricao.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jComboBox_DescricaoActionPerformed(evt); } }); jComboBox_Descricao.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { jComboBox_DescricaoKeyPressed(evt); } }); jLabel12.setText("Rendimento:"); txt_rendimento.setFocusable(false); jCheckBox_Especial.setText("NÃO É COLEÇÃO"); jLabel11.setText("Cat. Cor:"); jComboBox_categoria.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "CATEGORIA" })); jComboBox_categoria.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { jComboBox_categoriaItemStateChanged(evt); } }); jComboBox_categoria.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { jComboBox_categoriaFocusGained(evt); } }); btn_add_cor.setText("+"); btn_add_cor.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_add_corActionPerformed(evt); } }); btn_remove_cor.setText("-"); btn_remove_cor.setFocusable(false); btn_remove_cor.setRequestFocusEnabled(false); btn_remove_cor.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_remove_corActionPerformed(evt); } }); btn_config_cores.setText("CONFIG. CORES"); btn_config_cores.setFocusable(false); btn_config_cores.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_config_coresActionPerformed(evt); } }); jLabel4.setText("Qtd Cores:"); jTable_cor.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { "ID", "REF", "COR", "ID_COR" } ) { boolean[] canEdit = new boolean [] { false, false, false, false }; public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit [columnIndex]; } }); jTable_cor.setFocusable(false); jTable_cor.getTableHeader().setReorderingAllowed(false); jTable_cor.addComponentListener(new java.awt.event.ComponentAdapter() { public void componentResized(java.awt.event.ComponentEvent evt) { jTable_corComponentResized(evt); } }); jScrollPane3.setViewportView(jTable_cor); if (jTable_cor.getColumnModel().getColumnCount() > 0) { jTable_cor.getColumnModel().getColumn(0).setResizable(false); jTable_cor.getColumnModel().getColumn(1).setResizable(false); jTable_cor.getColumnModel().getColumn(2).setResizable(false); jTable_cor.getColumnModel().getColumn(3).setResizable(false); } jComboBox_cor.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { jComboBox_corKeyPressed(evt); } }); txt_qtd_cores.setEditable(false); txt_qtd_cores.setFocusable(false); txt_qtd_cores.setRequestFocusEnabled(false); jComboBox_id_cor.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "id_cor" })); btn_config_cat.setText("CAD. CATEGORIA"); btn_config_cat.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_config_catActionPerformed(evt); } }); jTable_tamanho.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { "ID", "REF", "TAMANHO", "ID_TAM" } ) { boolean[] canEdit = new boolean [] { false, false, false, false }; public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit [columnIndex]; } }); jTable_tamanho.setFocusable(false); jTable_tamanho.getTableHeader().setReorderingAllowed(false); jTable_tamanho.addComponentListener(new java.awt.event.ComponentAdapter() { public void componentResized(java.awt.event.ComponentEvent evt) { jTable_tamanhoComponentResized(evt); } }); jScrollPane4.setViewportView(jTable_tamanho); if (jTable_tamanho.getColumnModel().getColumnCount() > 0) { jTable_tamanho.getColumnModel().getColumn(0).setResizable(false); jTable_tamanho.getColumnModel().getColumn(1).setResizable(false); jTable_tamanho.getColumnModel().getColumn(2).setResizable(false); jTable_tamanho.getColumnModel().getColumn(3).setResizable(false); } jLabel13.setText("Cat. Tam:"); jComboBox_categoria_tamanho.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "CATEGORIA" })); jComboBox_categoria_tamanho.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { jComboBox_categoria_tamanhoItemStateChanged(evt); } }); jComboBox_categoria_tamanho.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { jComboBox_categoria_tamanhoFocusGained(evt); } }); jComboBox_tamanho.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { jComboBox_tamanhoKeyPressed(evt); } }); btn_add_tamanho.setText("+"); btn_add_tamanho.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_add_tamanhoActionPerformed(evt); } }); btn_remove_tamanho.setText("-"); btn_remove_tamanho.setFocusable(false); btn_remove_tamanho.setRequestFocusEnabled(false); btn_remove_tamanho.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_remove_tamanhoActionPerformed(evt); } }); javax.swing.GroupLayout jPCadastrarLayout = new javax.swing.GroupLayout(jPCadastrar); jPCadastrar.setLayout(jPCadastrarLayout); jPCadastrarLayout.setHorizontalGroup( jPCadastrarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPCadastrarLayout.createSequentialGroup() .addContainerGap() .addGroup(jPCadastrarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPCadastrarLayout.createSequentialGroup() .addGroup(jPCadastrarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPCadastrarLayout.createSequentialGroup() .addComponent(btn_Cadastrar) .addGap(18, 18, 18) .addComponent(btn_Atualizar) .addGap(18, 18, 18) .addComponent(btn_Limpar) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel9) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(txt_id, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPCadastrarLayout.createSequentialGroup() .addComponent(jLabel2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(txt_Ref, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jComboBox_Descricao, javax.swing.GroupLayout.PREFERRED_SIZE, 410, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(0, 0, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPCadastrarLayout.createSequentialGroup() .addGroup(jPCadastrarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPCadastrarLayout.createSequentialGroup() .addComponent(jLabel8) .addGap(2, 2, 2) .addComponent(jComboBoxTipo_tamanho, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel10) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(txt_qtd_tamanho, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPCadastrarLayout.createSequentialGroup() .addGroup(jPCadastrarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) .addGroup(jPCadastrarLayout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jComboBox_categoria_tamanho, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jComboBox_tamanho, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPCadastrarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(btn_add_tamanho) .addComponent(btn_remove_tamanho, javax.swing.GroupLayout.Alignment.TRAILING)))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPCadastrarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPCadastrarLayout.createSequentialGroup() .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jComboBox_categoria, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jComboBox_cor, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 317, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPCadastrarLayout.createSequentialGroup() .addComponent(jLabel4) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(txt_qtd_cores, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel12) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(txt_rendimento, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE))))) .addGroup(jPCadastrarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(btn_add_cor, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btn_remove_cor, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPCadastrarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jCheckBox_Especial) .addComponent(jComboBox_id_cor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btn_config_cat, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btn_config_cores, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); jPCadastrarLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btn_add_tamanho, btn_remove_tamanho}); jPCadastrarLayout.setVerticalGroup( jPCadastrarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPCadastrarLayout.createSequentialGroup() .addGroup(jPCadastrarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPCadastrarLayout.createSequentialGroup() .addGroup(jPCadastrarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(jLabel3) .addComponent(txt_Ref, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jComboBox_Descricao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPCadastrarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jComboBox_categoria, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel11) .addComponent(jComboBox_cor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btn_add_cor) .addComponent(jComboBox_categoria_tamanho, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel13) .addComponent(jComboBox_tamanho, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btn_add_tamanho)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPCadastrarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPCadastrarLayout.createSequentialGroup() .addGroup(jPCadastrarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(btn_remove_cor) .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btn_remove_tamanho)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPCadastrarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel10) .addComponent(jComboBoxTipo_tamanho, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel8) .addComponent(txt_qtd_tamanho, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPCadastrarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btn_Cadastrar) .addComponent(btn_Atualizar) .addComponent(btn_Limpar) .addComponent(jLabel9) .addComponent(txt_id, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(jPCadastrarLayout.createSequentialGroup() .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPCadastrarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4) .addComponent(txt_qtd_cores, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel12) .addComponent(txt_rendimento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(0, 0, Short.MAX_VALUE)))) .addGroup(jPCadastrarLayout.createSequentialGroup() .addComponent(jCheckBox_Especial) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jComboBox_id_cor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btn_config_cat) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btn_config_cores) .addGap(0, 0, Short.MAX_VALUE)) .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); jPCadastrarLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {btn_add_tamanho, btn_remove_tamanho}); jComboBox_id_cor.setVisible(false); jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Alterar / Excluir")); jLabel1.setText("Ref:"); btn_Excluir.setText("Excluir"); btn_Excluir.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_ExcluirActionPerformed(evt); } }); btn_Listar.setText("Listar Todos"); btn_Listar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_ListarActionPerformed(evt); } }); btn_Limpar_Lista.setText("Limpar"); btn_Limpar_Lista.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_Limpar_ListaActionPerformed(evt); } }); btn_Editar.setText("Editar"); btn_Editar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_EditarActionPerformed(evt); } }); btn_Pesquisar.setText("Pesquisar"); btn_Pesquisar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_PesquisarActionPerformed(evt); } }); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(txt_ref_pesquisar, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(btn_Pesquisar) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btn_Editar) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(btn_Excluir) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btn_Listar) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btn_Limpar_Lista) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(txt_ref_pesquisar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btn_Excluir) .addComponent(btn_Listar) .addComponent(btn_Limpar_Lista) .addComponent(btn_Editar) .addComponent(btn_Pesquisar)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jTable1.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { "ID", "REF", "Descrição", "Qtd Cores", "Qtd Tamanhos", "Bordado", "Estampa", "Bolso", "Tipo Tamanho", "Costas", "Manga", "Rendimento", "Especial" } )); jTable1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jTable1MouseClicked(evt); } }); jScrollPane2.setViewportView(jTable1); if (jTable1.getColumnModel().getColumnCount() > 0) { jTable1.getColumnModel().getColumn(0).setPreferredWidth(30); } javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPCadastrar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jPCadastrar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(5, 5, 5) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 234, Short.MAX_VALUE)) ); jPCadastrar.getAccessibleContext().setAccessibleName(""); getAccessibleContext().setAccessibleDescription(""); pack(); }// </editor-fold>//GEN-END:initComponents private void listar_categoria_produto(){ ProdutoDAO dao = new ProdutoDAO(); for (ProdutoDTO p : dao.listarCategorias() ) { jComboBox_Descricao.addItem(p.getCategoria()); } } private void listar_categoria_cor(){ CoresDAO dao = new CoresDAO(); jComboBox_categoria.removeAllItems(); for (CoresDTO c : dao.ListarCategoria()) { jComboBox_categoria.addItem(c.getCategoria()); } } private void listar_cores_categoria(String categoria){ CoresDAO dao = new CoresDAO(); jComboBox_cor.removeAllItems(); jComboBox_id_cor.removeAllItems(); for (CoresDTO c : dao.ListarCoresCategoria(categoria)) { jComboBox_cor.addItem(c.getCor()); jComboBox_id_cor.addItem(c.getId()); } } public void ocultar_coluna_tabela(){ //ocultar coluna ID da tabela jTable1.getColumnModel().getColumn( 0 ).setMaxWidth( 0 ); jTable1.getColumnModel().getColumn( 0 ).setMinWidth( 0 ); jTable1.getTableHeader().getColumnModel().getColumn( 0 ).setMaxWidth( 0 ); jTable1.getTableHeader().getColumnModel().getColumn( 0 ).setMinWidth( 0 ); //fim ocultar } private void btn_CadastrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_CadastrarActionPerformed // fazendo a validação dos dados if ((txt_Ref.getText().isEmpty()) || (txt_qtd_tamanho.getText().isEmpty()) || (txt_qtd_cores.getText().isEmpty()) || (txt_qtd_cores.getText().equals("") || (txt_rendimento.getText().equals("")))) { JOptionPane.showMessageDialog(null, "Os campos não podem retornar vazios"); } else if (txt_qtd_cores.getText().equals("0")){ JOptionPane.showMessageDialog(null, "É necessario adicionar uma cor!"); } else { // instanciando a classe Usuario do pacote modelo e criando seu objeto usuarios ProdutoDTO produtos = new ProdutoDTO(); produtos.setCodigo(txt_Ref.getText()); produtos.setDescricao(jComboBox_Descricao.getSelectedItem().toString()); produtos.setQtd_tamanho(Integer.parseInt(txt_qtd_tamanho.getText())); produtos.setQtd_cores(Integer.parseInt(txt_qtd_cores.getText())); produtos.setRendimento(Double.parseDouble(txt_rendimento.getText())); if (jCheckBox_Bordado.isSelected()){ produtos.setBordado(1); }else { produtos.setBordado(0); // false } if (jCheckBox_Estampa.isSelected()){ produtos.setEstampa(1); }else { produtos.setEstampa(0); // false } if (jCheckBox_Bolso.isSelected()){ produtos.setBolso(1); }else { produtos.setBolso(0); // false } if (jCheckBox_Costas.isSelected()){ produtos.setCostas(1); }else { produtos.setCostas(0); // false } if (jCheckBox_Manga.isSelected()){ produtos.setManga(1); }else { produtos.setManga(0); // false } produtos.setTipo_tamanho(jComboBoxTipo_tamanho.getSelectedItem().toString()); //se não é colecao(especial = 1) if (jCheckBox_Especial.isSelected()){ produtos.setEspecial(1); }else { produtos.setEspecial(0); // false } // instanciando a classe ProdutoDAO do pacote dao e criando seu objeto dao ProdutoDAO dao = new ProdutoDAO(); if (dao.adiciona(produtos)){ JOptionPane.showMessageDialog(null, "Produto "+txt_Ref.getText()+" inserido com sucesso! "); // apaga os dados preenchidos nos campos de texto txt_Ref.setText(""); txt_id.setText(""); //listando todos produtos DefaultTableModel model = (DefaultTableModel) jTable1.getModel(); model.setNumRows(0); model.addRow(new Object[]{produtos.getId(), produtos.getCodigo(), produtos.getDescricao(), produtos.getQtd_cores(), produtos.getQtd_tamanho(), produtos.getBordado(), produtos.getEstampa(), produtos.getBolso(), produtos.getTipo_tamanho(), produtos.getCostas(), produtos.getManga(), produtos.getRendimento(), produtos.getEspecial()}); txt_Ref.requestFocus(); } else { JOptionPane.showMessageDialog(null, "Erro, o produto "+txt_Ref.getText()+" não foi cadastrado! "); } //DefaultTableModel model = (DefaultTableModel) jTable1.getModel(); //Adiciona produto recem cadastrado(Id não atualiza) //model.addRow(new Object[]{produtos.getId(), produtos.getCodigo(), produtos.getDescricao(), produtos.getQtd_cores(), produtos.getQtd_tamanho(), produtos.getCor1(), produtos.getCor2(), produtos.getCor3(), produtos.getBordado(), produtos.getEstampa(), produtos.getBolso()}); } //setar_rendimento(); }//GEN-LAST:event_btn_CadastrarActionPerformed private void btn_LimparActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_LimparActionPerformed // TODO add your handling code here: txt_Ref.setText(""); //txt_Descricao.setText(""); //txt_qtd_tamanho.setText(""); //txt_qtd_cores.setText(""); txt_id.setText(""); txt_rendimento.setText(""); txt_Ref.requestFocus(); }//GEN-LAST:event_btn_LimparActionPerformed private void jCheckBox_BordadoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox_BordadoActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jCheckBox_BordadoActionPerformed private void btn_AtualizarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_AtualizarActionPerformed // TODO add your handling code here: ProdutoDTO produtos = new ProdutoDTO(); Integer linhaSelecionada = -1; linhaSelecionada = jTable1.getSelectedRow(); if (linhaSelecionada >= 0) { Integer id = (Integer) jTable1.getValueAt(linhaSelecionada, 0); String codigo = (String) jTable1.getValueAt(linhaSelecionada, 1); produtos.setId(id); produtos.setCodigo(txt_Ref.getText()); produtos.setDescricao(jComboBox_Descricao.getSelectedItem().toString()); produtos.setQtd_tamanho(Integer.parseInt(txt_qtd_tamanho.getText())); produtos.setQtd_cores(Integer.parseInt(txt_qtd_cores.getText())); //produtos.setCor1(txt_cor1.getText()); //produtos.setCor2(txt_cor2.getText()); //produtos.setCor3(txt_cor3.getText()); produtos.setRendimento(Double.parseDouble(txt_rendimento.getText())); if (jCheckBox_Bordado.isSelected()){ produtos.setBordado(1); }else { produtos.setBordado(0); // false } if (jCheckBox_Estampa.isSelected()){ produtos.setEstampa(1); }else { produtos.setEstampa(0); // false } if (jCheckBox_Bolso.isSelected()){ produtos.setBolso(1); }else { produtos.setBolso(0); // false } if (jCheckBox_Costas.isSelected()){ produtos.setCostas(1); }else { produtos.setCostas(0); // false } if (jCheckBox_Manga.isSelected()){ produtos.setManga(1); }else { produtos.setManga(0); // false } produtos.setTipo_tamanho(jComboBoxTipo_tamanho.getSelectedItem().toString()); //se é especial (não é colecao) if (jCheckBox_Especial.isSelected()){ produtos.setEspecial(1); }else { produtos.setEspecial(0); // false } // fazendo a validação dos dados if ((txt_Ref.getText().isEmpty()) || (txt_qtd_tamanho.getText().isEmpty()) || (txt_qtd_cores.getText().isEmpty()) || (txt_rendimento.getText().isEmpty())) { JOptionPane.showMessageDialog(null, "Os campos não podem retornar vazios"); } else { // instanciando a classe ProdutoDAO do pacote dao e criando seu objeto dao ProdutoDAO dao = new ProdutoDAO(); if (dao.alterar(produtos)){ JOptionPane.showMessageDialog(null, "Produto "+txt_Ref.getText()+" alterado para "+txt_ref_pesquisar.getText()+" com sucesso! "); // apaga os dados preenchidos nos campos de texto txt_Ref.setText(""); //txt_Descricao.setText(""); //txt_qtd_tamanho.setText(""); //txt_qtd_cores.setText(""); //txt_cor2.setText(""); //txt_cor1.setText(""); //txt_cor3.setText(""); txt_id.setText(""); txt_rendimento.setText(""); } else { JOptionPane.showMessageDialog(null, "Erro, o produto "+txt_Ref.getText()+" não foi alterado!"); } } }else{ JOptionPane.showMessageDialog(null, "Selecione uma linha!"); } // fim linha selecionada }//GEN-LAST:event_btn_AtualizarActionPerformed private void btn_ExcluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_ExcluirActionPerformed ProdutoDTO produtos = new ProdutoDTO(); Integer linhaSelecionada = -1; linhaSelecionada = jTable1.getSelectedRow(); if (linhaSelecionada >= 0) {//se linha selecionada Integer id = (Integer) jTable1.getValueAt(linhaSelecionada, 0); String codigo = (String) jTable1.getValueAt(linhaSelecionada, 1); //Confirmação String message = "Deseja realmente excluir a REF: "+codigo+" ?"; String title = "Confirmação"; int reply = JOptionPane.showConfirmDialog(null, message, title, JOptionPane.YES_NO_OPTION); if (reply == JOptionPane.YES_OPTION) {//sim //se confirmou DefaultTableModel model = (DefaultTableModel) jTable1.getModel(); produtos.setId(id);//setar o id pra excluir produtos.setCodigo(codigo); ProdutoDAO dao = new ProdutoDAO(); if (dao.excluir(produtos)){ JOptionPane.showMessageDialog(null, "REF "+codigo+" excluido com sucesso!"); } else { JOptionPane.showMessageDialog(null, "Erro, a REF "+codigo+" não foi excluido!"); } model.removeRow(linhaSelecionada); }else{ //não confirmou } } else{ //se linha não estiver selecionada JOptionPane.showMessageDialog(null, "Selecione uma linha!"); } // fim linha selecionada }//GEN-LAST:event_btn_ExcluirActionPerformed private void btn_ListarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_ListarActionPerformed // TODO add your handling code here: jTable1.setVisible(true); ProdutoDAO dao = new ProdutoDAO(); DefaultTableModel model = (DefaultTableModel) jTable1.getModel(); model.setNumRows(0); for (ProdutoDTO p : dao.getProdutos()) { model.addRow(new Object[]{p.getId(), p.getCodigo(), p.getDescricao(), p.getQtd_cores(), p.getQtd_tamanho(), p.getBordado(), p.getEstampa(), p.getBolso(), p.getTipo_tamanho(), p.getCostas(), p.getManga(), p.getRendimento(), p.getEspecial()}); } }//GEN-LAST:event_btn_ListarActionPerformed private void btn_Limpar_ListaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_Limpar_ListaActionPerformed // TODO add your handling code here: DefaultTableModel model = (DefaultTableModel) jTable1.getModel(); model.setNumRows(0); //String[] linha = new String[]{"Pedro", "15" , "Masculino"}; //model.addRow(linha); }//GEN-LAST:event_btn_Limpar_ListaActionPerformed private void btn_EditarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_EditarActionPerformed // TODO add your handling code here: Integer linhaSelecionada = -1; linhaSelecionada = jTable1.getSelectedRow(); if (linhaSelecionada >= 0) { Integer id = (Integer) jTable1.getValueAt(linhaSelecionada, 0); DefaultTableModel model = (DefaultTableModel) jTable1.getModel(); ProdutoDAO dao = new ProdutoDAO(); ProdutoDTO produto = dao.getProdutoById(id); txt_id.setText(Integer.toString(produto.getId())); txt_Ref.setText(produto.getCodigo()); jComboBox_Descricao.setSelectedItem(produto.getDescricao()); txt_qtd_cores.setText(Integer.toString(produto.getQtd_cores())); txt_qtd_tamanho.setText(Integer.toString(produto.getQtd_tamanho())); //trazer cores do produto listar_cores_ref(txt_Ref.getText()); txt_rendimento.setText(Double.toString(produto.getRendimento())); Integer bordado = produto.getBordado(); if ( bordado == 1){ jCheckBox_Bordado.setSelected(true); }else {// se for 0 ou outra coisa jCheckBox_Bordado.setSelected(false); } Integer estampa = produto.getEstampa(); if ( estampa == 1){ jCheckBox_Estampa.setSelected(true); }else {// se for 0 ou outra coisa jCheckBox_Estampa.setSelected(false); } Integer bolso = produto.getBolso(); if ( bolso == 1){ jCheckBox_Bolso.setSelected(true); }else {// se for 0 ou outra coisa jCheckBox_Bolso.setSelected(false); } jComboBoxTipo_tamanho.setSelectedItem(produto.getTipo_tamanho()); //linhaSelecionada = linha; Integer costas = produto.getCostas(); if ( costas == 1){ jCheckBox_Costas.setSelected(true); }else {// se for 0 ou outra coisa jCheckBox_Costas.setSelected(false); } Integer manga = produto.getManga(); if ( manga == 1){ jCheckBox_Manga.setSelected(true); }else {// se for 0 ou outra coisa jCheckBox_Manga.setSelected(false); } Integer especial = produto.getEspecial(); if ( especial == 1){ jCheckBox_Especial.setSelected(true); }else {// se for 0 ou outra coisa jCheckBox_Especial.setSelected(false); } } else { JOptionPane.showMessageDialog(null, "É necesário selecionar uma linha. Clique em Listar e selecione!"); } }//GEN-LAST:event_btn_EditarActionPerformed private void btn_PesquisarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_PesquisarActionPerformed // TODO add your handling code here: jTable1.setVisible(true); ProdutoDAO dao = new ProdutoDAO(); DefaultTableModel model = (DefaultTableModel) jTable1.getModel(); model.setNumRows(0); for (ProdutoDTO p : dao.getProdutosRef(txt_ref_pesquisar.getText())) { model.addRow(new Object[]{p.getId(), p.getCodigo(), p.getDescricao(), p.getQtd_cores(), p.getQtd_tamanho(), p.getBordado(), p.getEstampa(), p.getBolso(), p.getTipo_tamanho(), p.getCostas(), p.getManga(), p.getRendimento(), p.getEspecial() }); } }//GEN-LAST:event_btn_PesquisarActionPerformed private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1MouseClicked // se clicar na jtable }//GEN-LAST:event_jTable1MouseClicked private void jComboBoxTipo_tamanhoItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jComboBoxTipo_tamanhoItemStateChanged // TODO add your handling code here: if ( (jComboBoxTipo_tamanho.getSelectedItem().equals("ESPECIAL")) || (jComboBoxTipo_tamanho.getSelectedItem()=="BABY") || (jComboBoxTipo_tamanho.getSelectedItem()=="KIDS") ){ txt_qtd_tamanho.setText("3"); }else{ txt_qtd_tamanho.setText("4"); } }//GEN-LAST:event_jComboBoxTipo_tamanhoItemStateChanged private void jComboBox_DescricaoKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jComboBox_DescricaoKeyPressed // TODO add your handling code here: if(evt.getKeyCode() == evt.VK_ENTER){ jCheckBox_Bordado.requestFocus(); } }//GEN-LAST:event_jComboBox_DescricaoKeyPressed private void jComboBoxTipo_tamanhoKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jComboBoxTipo_tamanhoKeyPressed // TODO add your handling code here: if(evt.getKeyCode() == evt.VK_ENTER){ jComboBox_cor.requestFocus(); } }//GEN-LAST:event_jComboBoxTipo_tamanhoKeyPressed private void btn_CadastrarFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_btn_CadastrarFocusGained // TODO add your handling code here: tdgCTR geral = new tdgCTR(); geral.reagirEnter(btn_Cadastrar); }//GEN-LAST:event_btn_CadastrarFocusGained /* public void setar_rendimento(){ switch (jComboBox_Descricao.getSelectedItem().toString()) { case "01 MACHAO": txt_rendimento.setText("7"); jComboBoxTipo_tamanho.setSelectedItem("NORMAL"); break; //4,8 case "02 GOLA CARECA": txt_rendimento.setText("4.8"); jComboBoxTipo_tamanho.setSelectedItem("NORMAL"); break; case "03 GOLA V": txt_rendimento.setText("4.8"); jComboBoxTipo_tamanho.setSelectedItem("NORMAL"); break; case "04 GOLA POLO": txt_rendimento.setText("4.8"); jComboBoxTipo_tamanho.setSelectedItem("NORMAL"); break; //ESPECIAL 2,5 case "05 CARECA ESPECIAL": txt_rendimento.setText("2.5"); jComboBoxTipo_tamanho.setSelectedItem("ESPECIAL"); break; case "06 V ESPECIAL": txt_rendimento.setText("2.5"); jComboBoxTipo_tamanho.setSelectedItem("ESPECIAL"); break; case "07 POLO ESPECIAL": txt_rendimento.setText("2.5"); jComboBoxTipo_tamanho.setSelectedItem("ESPECIAL"); break; //JUVENIL 6 case "08 CARECA JUVENIL": txt_rendimento.setText("6"); jComboBoxTipo_tamanho.setSelectedItem("JUVENIL"); break; case "09 V JUVENIL": txt_rendimento.setText("6"); jComboBoxTipo_tamanho.setSelectedItem("JUVENIL"); break; case "10 POLO JUVENIL": txt_rendimento.setText("6"); jComboBoxTipo_tamanho.setSelectedItem("JUVENIL"); break; //MANGA LONGA 2,5 case "11 CARECA ML": txt_rendimento.setText("2.5"); jComboBoxTipo_tamanho.setSelectedItem("NORMAL"); break; case "12 V ML": txt_rendimento.setText("2.5"); jComboBoxTipo_tamanho.setSelectedItem("NORMAL"); break; case "13 POLO ML": txt_rendimento.setText("2.5"); jComboBoxTipo_tamanho.setSelectedItem("NORMAL"); break; //PIQUET 3,8 case "14 PIQUET": txt_rendimento.setText("3.8"); jComboBoxTipo_tamanho.setSelectedItem("NORMAL"); break; //PIQUET 3,8 case "15 P001": txt_rendimento.setText("3.8"); jComboBoxTipo_tamanho.setSelectedItem("NORMAL"); break; default: txt_rendimento.setText("1"); jComboBoxTipo_tamanho.setSelectedItem("NORMAL"); } } */ private void jComboBox_DescricaoItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jComboBox_DescricaoItemStateChanged // TODO add your handling code here: //pegar dados categoria **** }//GEN-LAST:event_jComboBox_DescricaoItemStateChanged private void DadosCategoria(String categoria){ ProdutoDAO dao = new ProdutoDAO(); for (ProdutoDTO p : dao.getDadosCategorias(categoria)) { jComboBoxTipo_tamanho.setSelectedItem(p.getTipo_tamanho()); txt_rendimento.setText(p.getRendimento().toString()); //p.getGrade(); } } private void txt_RefFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txt_RefFocusLost // TODO add your handling code here: String codigo = txt_Ref.getText(); if (txt_Ref.getText().equals("P001") || txt_Ref.getText().equals("p001")){ jComboBox_Descricao.setSelectedItem("15 P001"); } listar_cores_ref(txt_Ref.getText()); }//GEN-LAST:event_txt_RefFocusLost private void listar_cores_ref(String codigo){ //listar cores cadastradas na ref ProdutoCoresDAO dao = new ProdutoCoresDAO(); DefaultTableModel model = (DefaultTableModel) jTable_cor.getModel(); model.setNumRows(0); for (CoresDTO cores : dao.ListarProdutoCores(codigo)) { model.addRow(new Object[]{cores.getId(), cores.getCodigo(), cores.getCor(), cores.getId_cor()}); } } private void btn_config_coresActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_config_coresActionPerformed // TODO add your handling code here: new CoresVIEW().setVisible(true); }//GEN-LAST:event_btn_config_coresActionPerformed private void jComboBox_categoriaItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jComboBox_categoriaItemStateChanged // TODO add your handling code here: if (evt.getStateChange() == ItemEvent.SELECTED) { Object item = evt.getItem(); listar_cores_categoria(jComboBox_categoria.getSelectedItem().toString()); } }//GEN-LAST:event_jComboBox_categoriaItemStateChanged private void jComboBox_categoriaFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jComboBox_categoriaFocusGained // TODO add your handling code here: }//GEN-LAST:event_jComboBox_categoriaFocusGained private void btn_remove_corActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_remove_corActionPerformed // TODO add your handling code here: CoresDTO produto_cores = new CoresDTO(); Integer linhaSelecionada = -1; linhaSelecionada = jTable_cor.getSelectedRow(); if (linhaSelecionada >= 0) {//se linha selecionada Integer id = (Integer) jTable_cor.getValueAt(linhaSelecionada, 0); String cor = (String) jTable_cor.getValueAt(linhaSelecionada, 2); //se confirmou DefaultTableModel model = (DefaultTableModel) jTable_cor.getModel(); produto_cores.setId(id);//setar o id pra excluir produto_cores.setCor(cor); ProdutoCoresDAO dao = new ProdutoCoresDAO(); if (dao.excluir(produto_cores)){ model.removeRow(linhaSelecionada); } else { JOptionPane.showMessageDialog(null, "Erro, a COR "+cor+" não foi excluida!"); } } else{ //se linha não estiver selecionada JOptionPane.showMessageDialog(null, "Selecione uma linha!"); } // fim linha selecionada jComboBox_cor.requestFocus(); }//GEN-LAST:event_btn_remove_corActionPerformed private void btn_add_corActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_add_corActionPerformed // TODO add your handling code here: CoresDTO produto_cores = new CoresDTO(); String codigo = txt_Ref.getText(); String cor = jComboBox_cor.getSelectedItem().toString(); Integer index_da_cor = jComboBox_cor.getSelectedIndex(); Integer id_cor = Integer.parseInt(jComboBox_id_cor.getItemAt(index_da_cor).toString()); produto_cores.setCodigo(codigo); produto_cores.setCor(cor); produto_cores.setId_cor(id_cor); ProdutoCoresDAO dao = new ProdutoCoresDAO(); if (dao.adicionaProdutoCor(produto_cores)){ DefaultTableModel model = (DefaultTableModel) jTable_cor.getModel(); model.addRow(new Object[]{produto_cores.getId(),produto_cores.getCodigo(), produto_cores.getCor(), produto_cores.getId_cor()}); }else{ JOptionPane.showMessageDialog(null, "ERRO AO ADICIONAR COR"); } jComboBox_cor.requestFocus(); }//GEN-LAST:event_btn_add_corActionPerformed private void jTable_corComponentResized(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_jTable_corComponentResized // TODO add your handling code here: Integer qtd_cor = jTable_cor.getRowCount(); txt_qtd_cores.setText(qtd_cor.toString()); }//GEN-LAST:event_jTable_corComponentResized private void jComboBox_corKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jComboBox_corKeyPressed // TODO add your handling code here: if(evt.getKeyCode() == evt.VK_ENTER){ btn_add_cor.requestFocus(); } }//GEN-LAST:event_jComboBox_corKeyPressed private void btn_config_catActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_config_catActionPerformed // TODO add your handling code here: new ProdutoCategoriaVIEW().setVisible(true); }//GEN-LAST:event_btn_config_catActionPerformed private void jComboBox_DescricaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox_DescricaoActionPerformed // TODO add your handling code here: DadosCategoria(jComboBox_Descricao.getSelectedItem().toString()); }//GEN-LAST:event_jComboBox_DescricaoActionPerformed private void jTable_tamanhoComponentResized(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_jTable_tamanhoComponentResized // TODO add your handling code here: }//GEN-LAST:event_jTable_tamanhoComponentResized private void jComboBox_categoria_tamanhoItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jComboBox_categoria_tamanhoItemStateChanged // TODO add your handling code here: }//GEN-LAST:event_jComboBox_categoria_tamanhoItemStateChanged private void jComboBox_categoria_tamanhoFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jComboBox_categoria_tamanhoFocusGained // TODO add your handling code here: }//GEN-LAST:event_jComboBox_categoria_tamanhoFocusGained private void jComboBox_tamanhoKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jComboBox_tamanhoKeyPressed // TODO add your handling code here: }//GEN-LAST:event_jComboBox_tamanhoKeyPressed private void btn_add_tamanhoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_add_tamanhoActionPerformed // TODO add your handling code here: }//GEN-LAST:event_btn_add_tamanhoActionPerformed private void btn_remove_tamanhoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_remove_tamanhoActionPerformed // TODO add your handling code here: }//GEN-LAST:event_btn_remove_tamanhoActionPerformed /** * @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(ProdutoVIEW.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(ProdutoVIEW.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(ProdutoVIEW.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(ProdutoVIEW.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new ProdutoVIEW().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btn_Atualizar; private javax.swing.JButton btn_Cadastrar; private javax.swing.JButton btn_Editar; private javax.swing.JButton btn_Excluir; private javax.swing.JButton btn_Limpar; private javax.swing.JButton btn_Limpar_Lista; private javax.swing.JButton btn_Listar; private javax.swing.JButton btn_Pesquisar; private javax.swing.JButton btn_add_cor; private javax.swing.JButton btn_add_tamanho; private javax.swing.JButton btn_config_cat; private javax.swing.JButton btn_config_cores; private javax.swing.JButton btn_remove_cor; private javax.swing.JButton btn_remove_tamanho; private javax.swing.JCheckBox jCheckBox_Bolso; private javax.swing.JCheckBox jCheckBox_Bordado; private javax.swing.JCheckBox jCheckBox_Costas; private javax.swing.JCheckBox jCheckBox_Especial; private javax.swing.JCheckBox jCheckBox_Estampa; private javax.swing.JCheckBox jCheckBox_Manga; private javax.swing.JComboBox jComboBoxTipo_tamanho; private javax.swing.JComboBox jComboBox_Descricao; private javax.swing.JComboBox jComboBox_categoria; private javax.swing.JComboBox jComboBox_categoria_tamanho; private javax.swing.JComboBox jComboBox_cor; private javax.swing.JComboBox jComboBox_id_cor; private javax.swing.JComboBox jComboBox_tamanho; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel13; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JPanel jPCadastrar; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JScrollPane jScrollPane3; private javax.swing.JScrollPane jScrollPane4; private javax.swing.JTable jTable1; private javax.swing.JTable jTable_cor; private javax.swing.JTable jTable_tamanho; private javax.swing.JTextField txt_Ref; private javax.swing.JTextField txt_id; private javax.swing.JTextField txt_qtd_cores; private javax.swing.JTextField txt_qtd_tamanho; private javax.swing.JTextField txt_ref_pesquisar; private javax.swing.JTextField txt_rendimento; // End of variables declaration//GEN-END:variables }
[ "PeDr0_HuG0@PeDr0-PC" ]
PeDr0_HuG0@PeDr0-PC
221cc49735fe450c8f5784d44ff96012fac2dd89
eaca2cba9436767858f2b0e539aaec035a373bdb
/src/test/java/tests/day7/locators.java
93f56c2d184cb5bd6aaa8ef7fe44a970aa373cd3
[]
no_license
serkanserdar61/Summer2019OnlineTestNGSeleniumProject1
f854fdf2edb694b3e20825b96fe31d50951202a6
657271f80a2ee3bcc5a3b90757851ff931b06433
refs/heads/master
2023-05-10T22:19:22.092381
2019-12-19T23:11:58
2019-12-19T23:11:58
221,282,893
0
0
null
2023-05-09T18:17:18
2019-11-12T18:17:58
Java
UTF-8
Java
false
false
1,019
java
package tests.day7; import io.github.bonigarcia.wdm.WebDriverManager; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.List; public class locators { public static void main(String[] args) { WebDriverManager.chromedriver().setup(); WebDriver driver = new ChromeDriver(); driver.get("http://cybertekschool.com/"); driver.manage().window().maximize(); List<WebElement> links = driver.findElements(By.xpath("//a")); //size of the elements=number of links System.out.println("number of links " + links.size()); //loop through the collection of links for (WebElement each : links) { //print text of every link if (!each.getText().isEmpty()) {//bunu kullandiginda ici bos olanlari siler System.out.println(each.getText()); } } driver.quit(); } }
[ "serkanserdar61@gmail.com" ]
serkanserdar61@gmail.com
601f82744f8ba8696897ee63a521c2b42bfd7e59
dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9
/data_defect4j/preprossed_method_corpus/Math/38/org/apache/commons/math/util/FastMath_ulp_3031.java
4d72e9b406613eb92640a34d7bb1a29eb8a41f90
[]
no_license
hvdthong/NetML
dca6cf4d34c5799b400d718e0a6cd2e0b167297d
9bb103da21327912e5a29cbf9be9ff4d058731a5
refs/heads/master
2021-06-30T15:03:52.618255
2020-10-07T01:58:48
2020-10-07T01:58:48
150,383,588
1
1
null
2018-09-26T07:08:45
2018-09-26T07:08:44
null
UTF-8
Java
false
false
5,292
java
org apach common math util faster accur portabl altern link math link strict math strictmath larg scale comput fast math fastmath drop replac math strict math strictmath mean method math code math sin code math cbrt user directli chang method code fast math fastmath sin code fast math fastmath cbrt previou fast math fastmath speed achiev reli heavili optim compil code present jvm todai larg tabl larger tabl lazili initialis setup time penalis method note fast math fastmath extens insid apach common math call algorithm overhead tabl intialis occur end user call fast math fastmath method directli perform figur specif jvm hardwar evalu run fast math test perform fastmathtestperform test test directori sourc distribut fast math fastmath accuraci independ jvm reli ieee basic oper embed tabl oper accur ulp domain rang statement rough global observ behavior guarante number input william kahan' href http wikipedia org wiki round tabl maker 27 dilemma tabl maker' dilemma fast math fastmath addition method found math strict math strictmath link asinh link acosh link atanh method found math strict math strictmath provid fast math fastmath java virtual machin link copi sign copysign link expon getexpon link nextaft link nextup link scalb link copi sign copysign link expon getexpon link nextaft link nextup link scalb version fast math fastmath comput signific bit unit posit number param number ulp request ulp ulp doubl infinit isinfinit doubl posit infin ab doubl bit doubl longbitstodoubl doubl long bit doubletolongbit
[ "hvdthong@gmail.com" ]
hvdthong@gmail.com
91939ea4e9af1f73bfe9e158bc793186f2e3157b
907c89215c2979527ec7083bfdf8b02a4a4f592d
/QXQP-SSH/src/com/koi/service/impl/AppointmentServiceImpl.java
841559c56c9aaaea72cea35a4ee1096a9e39461e
[]
no_license
973319261/QXQP
ced6e7fca90b71b60e94213a49af4b4fa009c373
b73c1767bef8030e77705454571baec69b9ad5d5
refs/heads/main
2023-01-10T15:57:16.565941
2020-11-05T08:54:42
2020-11-05T08:54:42
310,236,277
3
0
null
null
null
null
UTF-8
Java
false
false
3,376
java
package com.koi.service.impl; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import net.sf.json.JSONArray; import net.sf.json.JsonConfig; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.koi.dao.IAppointmentDao; import com.koi.po.PwPredate; import com.koi.po.SysPreOtherCostDetail; import com.koi.po.SysPreProductDetail; import com.koi.po.SysPreRepairItemDetail; import com.koi.service.IAppointmentService; import com.koi.util.Bsgrid; import com.koi.util.Json; import com.koi.util.Util; @Transactional @Service("appointmentService") public class AppointmentServiceImpl implements IAppointmentService { @Autowired private IAppointmentDao appointmentDao; @Override public String predateNum() { Date date = new Date(); SimpleDateFormat sfdate = new SimpleDateFormat("yyyyMMdd"); SimpleDateFormat sfdatetime = new SimpleDateFormat("yyyyMMddHHmmss"); String d = sfdate.format(date); String dt = sfdatetime.format(date); int num = appointmentDao.predateNum(d) + 1; String str = "BJ" + dt + String.format("%04d", num); return str; } @Override public Object selectPredate(String predateNum, String toAudit, Long pageSize,Long curPage) { // TODO Auto-generated method stub Long totalRows = appointmentDao.selectPredateCount(predateNum, toAudit); Long startIndex = 1l;// 开始索引 if (curPage > 1) { startIndex += pageSize; } pageSize *= curPage;// 页面大小 List<PwPredate> list = appointmentDao.selectPredate(predateNum, toAudit, startIndex, pageSize); JsonConfig jsonConfig = Json.getJsontoDate("yyyy-MM-dd HH:mm:ss"); JSONArray json = JSONArray.fromObject(list, jsonConfig); Object obj = Bsgrid.getList(json, curPage, totalRows);// 设置返回的参数 return obj; } @Override public List<Object> selectPredateDetail(int predateID) { // TODO Auto-generated method stub return appointmentDao.selectPredateDetail(predateID); } @Override public int updateListPredate(String predate, String preRepairItem, String preProduct, String preOtherCost) { List<PwPredate> listPredate = Util.jsonToVo(predate, PwPredate.class); List<SysPreRepairItemDetail> listPreRepairItem = Util.jsonToVo(preRepairItem, SysPreRepairItemDetail.class); List<SysPreProductDetail> listPreProduct = Util.jsonToVo(preProduct, SysPreProductDetail.class); List<SysPreOtherCostDetail> listPreOtherCost = Util.jsonToVo(preOtherCost, SysPreOtherCostDetail.class); // TODO Auto-generated method stub return appointmentDao.updateListPredate(listPredate, listPreRepairItem, listPreProduct, listPreOtherCost); } @Override public boolean deleteListPredate(int predateID) { // TODO Auto-generated method stub return appointmentDao.deleteListPredate(predateID); } @Override public boolean toAudit(int psredateID) { // TODO Auto-generated method stub return appointmentDao.toAudit(psredateID); } @Override public boolean toNotAudit(int predateID) { // TODO Auto-generated method stub return appointmentDao.toNotAudit(predateID); } @Override public boolean selectToMainten(int predateID, String maintenanceNum) { // TODO Auto-generated method stub return appointmentDao.selectToMainten(predateID, maintenanceNum); } }
[ "973319261@qq.com" ]
973319261@qq.com
cc83d5cff267f500ee1da5d2bc348bb4d4c707ee
8d76aca5dc49ccfb2f4936ad9fa7f80861e5b0e1
/app/src/main/java/nova/sampleretrofit/ApiService.java
cb4ca6811292b0b54100f3b7bbd23f8ab62b0235
[]
no_license
SongMarco/SampleRetrofit
97120759e4c48ae2cd09d0f4ad168e68ebbcc467
7d97ea0e212ee23a2f8b2ff4786fdd21dfa6e724
refs/heads/master
2021-08-25T16:49:22.975070
2017-11-21T13:21:23
2017-11-21T13:21:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
831
java
package nova.sampleretrofit; import okhttp3.ResponseBody; import retrofit2.Call; import retrofit2.http.Field; import retrofit2.http.FormUrlEncoded; import retrofit2.http.GET; import retrofit2.http.POST; import retrofit2.http.Query; /** * Created by Administrator on 2017-11-21. */ public interface ApiService { public static final String API_URL = "http://jsonplaceholder.typicode.com/"; //int Version @GET("comments") Call<ResponseBody> getComment(@Query("postId") int postId); @POST("comments") Call<ResponseBody> getPostComment(@Query("postId") int postId); //스트링 버전 @GET("comments") Call<ResponseBody> getCommentStr(@Query("postId") String postId); @FormUrlEncoded @POST("comments") Call<ResponseBody> getPostCommentStr(@Field("postId") String postId); }
[ "jamsya@naver.com" ]
jamsya@naver.com
35add08e034c222d02b6f879bf5ea467f4f2d96c
8e13c338dec36021668e46798ff40c7ea9b6b065
/Mage.Sets/src/mage/cards/t/TazeemRoilmage.java
7a415356c9617d9c52b0a9f2bcf23552f61642c6
[ "MIT" ]
permissive
ninthworld/mage
c38aeeaa65a2a0afa908779b7c63ef2e1b1e413a
ba558f9a18032148a2936eedf874d90c97c7d46c
refs/heads/master
2022-07-29T23:17:30.439762
2022-07-02T22:20:41
2022-07-02T22:20:41
140,520,040
1
0
MIT
2018-07-11T04:08:35
2018-07-11T04:08:35
null
UTF-8
Java
false
false
2,065
java
package mage.cards.t; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.condition.common.KickedCondition; import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility; import mage.abilities.effects.common.ReturnToHandTargetEffect; import mage.abilities.keyword.KickerAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; import mage.filter.FilterCard; import mage.filter.common.FilterInstantOrSorceryCard; import mage.target.common.TargetCardInYourGraveyard; import java.util.UUID; /** * @author TheElk801 */ public final class TazeemRoilmage extends CardImpl { private static final FilterCard filter = new FilterInstantOrSorceryCard("instant or sorcery card from your graveyard"); public TazeemRoilmage(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}"); this.subtype.add(SubType.MERFOLK); this.subtype.add(SubType.WIZARD); this.power = new MageInt(2); this.toughness = new MageInt(1); // Kicker {4} this.addAbility(new KickerAbility("{4}")); // When Tazeem Roilmage enters the battlefield, if it was kicked, return target instant or sorcery card from your graveyard to your hand. Ability ability = new ConditionalInterveningIfTriggeredAbility( new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect(), false), KickedCondition.instance, "When {this} enters the battlefield, if it was kicked, " + "return target instant or sorcery card from your graveyard to your hand." ); ability.addTarget(new TargetCardInYourGraveyard(filter)); this.addAbility(ability); } private TazeemRoilmage(final TazeemRoilmage card) { super(card); } @Override public TazeemRoilmage copy() { return new TazeemRoilmage(this); } }
[ "theelk801@gmail.com" ]
theelk801@gmail.com
baf818290213ed7f5c3cf354bec0bb87add67778
956b86b774659579d30e706d2331371053332a3b
/app/src/main/java/cn/edu/gdmec/android/utils/AnalysisUtils.java
2f96aed2525da4ad979297f839ec88ac30419eff
[]
no_license
Nathan234604081/boxueguing
51f53e638c01f4029a1f54dfb9af0804b34df586
8d3050fb02a54cb1924e3736f6d77fc1dd3bf837
refs/heads/master
2021-09-02T23:22:48.567320
2018-01-04T03:13:48
2018-01-04T03:13:48
115,352,170
0
0
null
null
null
null
UTF-8
Java
false
false
5,531
java
package cn.edu.gdmec.android.utils; import android.content.Context; import android.content.SharedPreferences; import android.util.Xml; import android.widget.ImageView; import org.xmlpull.v1.XmlPullParser; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import cn.edu.gdmec.android.bean.CourseBean; import cn.edu.gdmec.android.bean.ExercisesBean; /** * Created by 23460 on 2017/12/25. */ public class AnalysisUtils { /*解析每章的习题*/ public static List<ExercisesBean> getExercisesInfos(InputStream is)throws Exception { XmlPullParser parser = Xml.newPullParser(); List<ExercisesBean> exercisesInfos = null; ExercisesBean exercisesInfo = null; int type = parser.getEventType(); while (type != XmlPullParser.END_DOCUMENT) { switch (type) { case XmlPullParser.START_TAG: if ("infos".equals(parser.getName())) { exercisesInfos = new ArrayList<ExercisesBean>(); } else if ("exercises".equals((parser.getName()))) { exercisesInfo = new ExercisesBean(); String ids = parser.getAttributeValue(0); exercisesInfo.subjectid = Integer.parseInt(ids); } else if ("subject".equals(parser.getName())) { String subject = parser.nextText(); exercisesInfo.subject = subject; } else if ("a".equals(parser.getName())) { String a = parser.nextText(); exercisesInfo.a = a; } else if ("b".equals(parser.getName())) { String b = parser.nextText(); exercisesInfo.b = b; } else if ("c".equals(parser.getName())) { String c = parser.nextText(); exercisesInfo.c = c; } else if ("d".equals(parser.getName())) { String d = parser.nextText(); exercisesInfo.d = d; } else if ("anwser".equals(parser.getName())) { String anwser = parser.nextText(); exercisesInfo.answer = Integer.parseInt(anwser); } break; case XmlPullParser.END_TAG: if ("exercises".equals(parser.getName())){ exercisesInfos.add(exercisesInfo); exercisesInfo=null; } break; } type=parser.next(); } return exercisesInfos; } /*设置ABCD选项是否可以点击*/ public static void setABCDEnable(boolean value , ImageView iv_a,ImageView iv_b,ImageView iv_c,ImageView iv_d){ iv_a.setEnabled(value); iv_b.setEnabled(value); iv_c.setEnabled(value); iv_d.setEnabled(value); } /*解析每章的课程视频信息*/ public static List<List<CourseBean>> getCourseInfos(InputStream is)throws Exception{ XmlPullParser parser=Xml.newPullParser(); parser.setInput(is,"utf-8"); List<List<CourseBean>> courseInfos=null; List<CourseBean> courseList=null; CourseBean courseInfo=null; int count=0; int type=parser.getEventType(); while (type!=XmlPullParser.END_DOCUMENT){ switch (type){ case XmlPullParser.START_TAG: if ("infos".equals(parser.getName())){ courseInfos=new ArrayList<List<CourseBean>>(); courseList=new ArrayList<CourseBean>(); }else if ("course".equals(parser.getName())){ courseInfo = new CourseBean(); String ids=parser.getAttributeValue(0); courseInfo.id=Integer.parseInt(ids); }else if ("imgtitlte".equals(parser.getName())){ String imgtitle = parser.nextText(); courseInfo.imgTitle=imgtitle; }else if ("title".equals(parser.getName())){ String title =parser.nextText(); courseInfo.title=title; }else if ("intro".equals(parser.getName())){ String intro=parser.nextText(); courseInfo.intro=intro; } break; case XmlPullParser.END_TAG: if ("course".equals(parser.getName())){ count++; courseList.add(courseInfo); if (count%2==0){//课程界面每两个数据是一组放在List集合中 courseInfos.add(courseList); courseList=null; courseList=new ArrayList<CourseBean>(); } courseInfo=null; } break; } type=parser.next(); } return courseInfos; } public static String readLoginUserName(Context context){ SharedPreferences sp=context.getSharedPreferences("loginInfo",Context.MODE_PRIVATE); String userName=sp.getString("loginUserName",""); return userName; } }
[ "32630807+Nathan234604081@users.noreply.github.com" ]
32630807+Nathan234604081@users.noreply.github.com
8032a9f7ab197e2d60f4e2f6fca4d3f445ba6f49
dc21470617b5b50c366e61c007bb174d4e375bec
/Gustavo/Professor.java
15c2cb59200bd2652ba2ceb50b4de38f89c6842c
[]
no_license
gusthavosouza/Repository
d68e7ff347d1e9be4ff926f4aa50cb2b87932891
2e4539c7cee769f3b0e71b1a5b59d4cd8d32243b
refs/heads/master
2016-09-06T16:41:00.585288
2015-08-26T23:49:20
2015-08-26T23:49:20
23,107,977
1
0
null
null
null
null
UTF-8
Java
false
false
1,231
java
public class Professor { int cod_prof; String nome; String email; String telefone; Professor(){ } Professor(int cod_prof, String nome, String email, String telefone){ this.cod_prof = cod_prof; this.nome = nome; this.email = email; this.telefone = telefone; } void imprimeProfessor(){ System.out.println("Nome: " + nome); System.out.println("Codigo: " +cod_prof); System.out.println("Email: "+ email); System.out.println("Telefone: " + telefone); } public static void main(String args[]){ Professor botelho = new Professor(105, "Carlos Botelho", "botelho@botelho.com.br", "(11) 45254542"); botelho.imprimeProfessor(); } } /* * * * * 2.3. Criar uma classe Java chamada Professor para modelar professores. A classe deve possuir os seguintes atributos de dados (propriedades): o cod_professor – Código do Professor - (tipo int) o nome_prof – Nome do Professor – (tipo String) o email_prof – Email do Professor – (tipo String) o fone_prof – Fone do Professor – (tipo String) A classe deve conter métodos para construir objetos (um construtor com parâmetros e outro sem parâmetros) e um método Imprime_Professor() que irá imprimir os dados do professor. * */
[ "gusthavo.souzapereira@gmail.com" ]
gusthavo.souzapereira@gmail.com
b66646f102fbc87edd34da8a58edb5aa881896dd
12ed5a00060c369a8040edae4067729232ed9f17
/spring-boot-07-data-mybatis/src/main/java/com/spring/config/MybatisConfig.java
589eba47176a13d385e946c772fa20a6244b9945
[]
no_license
SmartDragon1225/SmartDragon-SpringBoot-Framing
716314b4cadd94e364d57c721206e151b06b6b79
0ba537690316a2bd572ffc6a5f06d8762bd3d3e3
refs/heads/master
2023-05-10T11:32:58.903807
2021-05-31T06:49:45
2021-05-31T06:49:45
372,203,472
0
0
null
null
null
null
UTF-8
Java
false
false
626
java
package com.spring.config; import org.mybatis.spring.boot.autoconfigure.ConfigurationCustomizer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class MybatisConfig { @Bean public ConfigurationCustomizer configurationCustomizer() { return new ConfigurationCustomizer() { @Override public void customize(org.apache.ibatis.session.Configuration configuration) { //开启驼峰命名 configuration.setMapUnderscoreToCamelCase(true); } }; } }
[ "2455404279@qq.com" ]
2455404279@qq.com
05bd03de499e03d23333ed079cf653068c6a74e2
b2ecf66f88751c8197f632a465676d466deb7495
/cars/src/main/java/com/dayo/carDealership/models/Inventory.java
1ed78da9112a6109800b7aa4ead174d4cd74c9be
[]
no_license
Adedayo-1/cardealership
2d7298247533c2feb3f1de56fdcf4e79cdc1e26f
a4020ad9cfd1e1e10262d64e93c23e59460db14c
refs/heads/master
2022-12-28T05:08:51.399433
2020-08-04T05:05:44
2020-08-04T05:05:44
284,881,858
0
0
null
2020-10-14T00:10:00
2020-08-04T05:02:13
Java
UTF-8
Java
false
false
3,487
java
package com.dayo.carDealership.models; import java.util.ArrayList; import java.util.List; import com.dayo.carDealership.utils.Make; import com.dayo.carDealership.utils.Model; import com.dayo.carDealership.utils.Year; public class Inventory { List<Car> listCar; public Inventory() { listCar = new ArrayList<>(); // Car 1 Car car1 = new Car(); car1.setMakeName(Make.Toyota); car1.setMileage(135800); car1.setModelName(Model.Avalon); car1.setPrice(6200); car1.setYom(Year.Year2005); car1.setQuantity(5); car1.setId("A01"); listCar.add(car1); // Car 2 Car car2 = new Car(); car2.setMakeName(Make.Ford); car2.setMileage(180000); car2.setModelName(Model.Explorer); car2.setPrice(4300); car2.setYom(Year.Year2008); car2.setQuantity(5); car2.setId("B02"); listCar.add(car2); // Car 3 Car car3 = new Car(); car3.setMakeName(Make.Chevrolet); car3.setMileage(41000); car3.setModelName(Model.Aspen); car3.setPrice(12000); car3.setYom(Year.Year2011); car3.setQuantity(5); car3.setId("C03"); listCar.add(car3); // car 4 Car car4 = new Car(); car4.setMakeName(Make.Honda); car4.setMileage(0); car4.setModelName(Model.Civic); car4.setPrice(22000); car4.setYom(Year.Year2018); car4.setQuantity(5); car4.setId("D04"); listCar.add(car4); // Car 5 Car car5 = new Car(); car5.setMakeName(Make.Toyota); car5.setMileage(35800); car5.setModelName(Model.Camry); car5.setPrice(18200); car5.setYom(Year.Year2015); car5.setQuantity(5); car5.setId("E05"); listCar.add(car5); // Car 6 Car car6 = new Car(); car6.setMakeName(Make.Audi); car6.setMileage(75800); car6.setModelName(Model.Mustang); car6.setPrice(15200); car6.setYom(Year.Year2011); car6.setQuantity(5); car6.setId("F06"); listCar.add(car6); //Car 7 Car car7 = new Car(); car7.setMakeName(Make.Bmw); car7.setMileage(800); car7.setModelName(Model.Accord); car7.setPrice(35200); car7.setYom(Year.Year2018); car7.setQuantity(5); car7.setId("H08"); listCar.add(car7); //Car 8 Car car8 = new Car(); car8.setMakeName(Make.Nissan); car8.setMileage(195800); car8.setModelName(Model.PICKUP); car8.setPrice(600); car8.setYom(Year.Year2005); car8.setQuantity(5); car8.setId("J09"); listCar.add(car8); } public void print() { for (int i = 0; i < listCar.size(); i++) System.out.println(listCar.get(i).toString()); } public List <Car> roY(String yr) { List <Car>result = new ArrayList<>(); for (Car b : listCar) { if (b.getYom().toString().equals(yr)) { result.add(b); } } return result; } public List<Car>roP(double pr,double pr1){ List <Car>result = new ArrayList<>(); for (Car k : listCar) { if (k.getPrice() >= pr && k.getPrice() <= pr1) { result.add(k); } } return result; } public List<Car>roM(double min,double max){ List <Car>result = new ArrayList<>(); for (Car x : listCar) { if (x.getMileage() >= min && x.getMileage() <= max) { result.add(x); } } return result; } public List<Car>roMa(String mr){ List <Car>result = new ArrayList<>(); for(Car p : listCar) { if(p.getMakeName().toString().equals(mr)) { result.add(p); } } return result; } public Car purchase(String purch) { Car result = new Car(); for(Car b : listCar) { if(b.getId().equalsIgnoreCase(purch)) { result = b; return b; } } return result; } } //method to filter car parameters
[ "66980214+Adedayo-1@users.noreply.github.com" ]
66980214+Adedayo-1@users.noreply.github.com
bcb9bb9098304f2db540525fdb05100716911d7e
4aa80408cdef032a44eac57e2b90900e08ce94ff
/janino/src/main/java/org/codehaus/janino/Mod.java
4ea75ca8dfbf85261f37ea5efe51f5ea081d5456
[ "BSD-3-Clause" ]
permissive
ihasbini/janino
619861fbcac83b40a86ddd08767530a0044ab99b
7d5a10d1993351a302c7b353e6280541de44f68a
refs/heads/master
2020-06-10T21:22:05.898037
2019-06-25T17:15:48
2019-06-25T17:15:48
193,752,396
0
0
NOASSERTION
2019-06-25T17:19:56
2019-06-25T17:19:56
null
UTF-8
Java
false
false
10,901
java
/* * Janino - An embedded Java[TM] compiler * * Copyright (c) 2001-2010 Arno Unkrig. All rights reserved. * Copyright (c) 2015-2016 TIBCO Software Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the * following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the * following disclaimer in the documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holder 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 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.codehaus.janino; /** * This class defines constants and convenience methods for the handling of modifiers as defined by the JVM. * <p> * Notice: This class should be named {@code IClass.IModifier}, but changing the name would break existing client * code. Thus it won't be renamed until there's a really good reason to do it (maybe with a major design change). * </p> */ public final class Mod { private Mod() {} // Don't instantiate me! /** * An alias for '0' -- <em>no</em> modifiers. */ public static final short NONE = 0x0000; /** * The flag indicating 'public accessibility' of the modified element. Methods of interfaces are always {@link * #PUBLIC}. * * @see #PPP * @see #isPublicAccess(short) */ public static final short PUBLIC = 0x0001; /** * @return Whether the given modifier symbolizes {@link #PUBLIC} accessibility */ public static boolean isPublicAccess(short sh) { return (sh & Mod.PPP) == Mod.PUBLIC; } /** * The flag indicating 'private accessibility' of the modified element. * * @see #PPP * @see #isPrivateAccess(short) */ public static final short PRIVATE = 0x0002; /** * @return Whether the given modifier symbolizes {@link #PRIVATE} accessibility */ public static boolean isPrivateAccess(short sh) { return (sh & Mod.PPP) == Mod.PRIVATE; } /** * The flag indicating 'protected accessibility' of the modified element. * * @see #PPP * @see #isProtectedAccess(short) */ public static final short PROTECTED = 0x0004; /** * @return Whether the given modifier symbolizes {@link #PROTECTED} accessibility */ public static boolean isProtectedAccess(short sh) { return (sh & Mod.PPP) == Mod.PROTECTED; } /** * The flag indicating 'default accessibility' a.k.a. 'package accessibility' of the modified element. * * @see #PPP * @see #isPackageAccess(short) */ public static final short PACKAGE = 0x0000; /** * @return Whether the given modifier symbolizes {@link #PACKAGE} (a.k.a. 'default') accessibility */ public static boolean isPackageAccess(short sh) { return (sh & Mod.PPP) == Mod.PACKAGE; } /** * The mask to select the accessibility flags from modifiers. */ public static final short PPP = 0x0007; /** * @return The given <var>modifiers</var>, but with the accessibility part changed to <var>newAccess</var> */ public static short changeAccess(short modifiers, short newAccess) { return (short) ((modifiers & ~Mod.PPP) | newAccess); } /** * This flag is set on class or interface initialization methods, STATIC class fields, all interface fields, STATIC * methods, and STATIC nested classes. */ public static final short STATIC = 0x0008; /** * @return Whether the given modifier includes {@link #STATIC} */ public static boolean isStatic(short sh) { return (sh & Mod.STATIC) != 0; } /** * This flag is set on FINAL classes, FINAL fields and FINAL methods, and is mutually exclusive with {@link * #VOLATILE} and {@link #ABSTRACT}. */ public static final short FINAL = 0x0010; /** * @return Whether the given modifier includes {@link #INTERFACE} */ public static boolean isFinal(short sh) { return (sh & Mod.FINAL) != 0; } /** * This flag is always set on classes, and never set on any other element. Notice that it has the same value as * {@link #SYNCHRONIZED}, which is OK because {@link #SYNCHRONIZED} is for methods and {@link #SUPER} for classes. */ public static final short SUPER = 0x0020; /** * @return Whether the given modifier includes {@link #SUPER} */ public static boolean isSuper(short sh) { return (sh & Mod.SUPER) != 0; } /** * This flag is set on SYNCHRONIZED methods. Notice that it has the same value as {@link #SUPER}, which is OK * because {@link #SYNCHRONIZED} is for methods and {@link #SUPER} for classes. */ public static final short SYNCHRONIZED = 0x0020; /** * @return Whether the given modifier includes {@link #SYNCHRONIZED} */ public static boolean isSynchronized(short sh) { return (sh & Mod.SYNCHRONIZED) != 0; } /** * This flag is set on VOLATILE fields and is mutually exclusive with {@link #FINAL}. Notice that it has the same * value as {@link #BRIDGE}, which is OK because {@link #BRIDGE} is for methods and {@link #VOLATILE} for fields. */ public static final short VOLATILE = 0x0040; /** * @return Whether the given modifier includes {@link #VOLATILE} */ public static boolean isVolatile(short sh) { return (sh & Mod.VOLATILE) != 0; } /** * This flag is set on 'bridge methods' generated by the compiler. Notice that it has the same value as {@link * #VOLATILE}, which is OK because {@link #BRIDGE} is for methods and {@link #VOLATILE} for fields. */ public static final short BRIDGE = 0x0040; /** * @return Whether the given modifier includes {@link #BRIDGE} */ public static boolean isBridge(short sh) { return (sh & Mod.BRIDGE) != 0; } /** * This flag is set on TRANSIENT fields. Notice that it has the same value as {@link #VARARGS}, which is OK because * {@link #VARARGS} is for methods and {@link #TRANSIENT} for fields. */ public static final short TRANSIENT = 0x0080; /** * @return Whether the given modifier includes {@link #TRANSIENT} */ public static boolean isTransient(short sh) { return (sh & Mod.TRANSIENT) != 0; } /** * This flag is set on 'variable arity' (a.k.a. 'varargs') methods and constructors. Notice that it has the same * value as {@link #TRANSIENT}, which is OK because {@link #VARARGS} is for methods and {@link #TRANSIENT} for * fields. */ public static final short VARARGS = 0x0080; /** * @return Whether the given modifier includes {@link #VARARGS} */ public static boolean isVarargs(short sh) { return (sh & Mod.VARARGS) != 0; } /** * This flag is set on NATIVE methods, and is mutually exclusive with {@link #ABSTRACT}. */ public static final short NATIVE = 0x0100; /** * @return Whether the given modifier includes {@link #NATIVE} */ public static boolean isNative(short sh) { return (sh & Mod.NATIVE) != 0; } /** * This flag is set on interfaces (including nested interfaces), and requires that {@link #ABSTRACT} must also be * set. {@link #INTERFACE} is mutually exclusive with {@link #FINAL}, {@link #SUPER} and {@link #ENUM}. */ public static final short INTERFACE = 0x0200; /** * @return Whether the given modifier includes {@link #INTERFACE} */ public static boolean isInterface(short sh) { return (sh & Mod.INTERFACE) != 0; } /** * This flag is set on all interfaces, ABSTRACT classes and ABSTRACT methods, and is mutually exclusive with * {@link #FINAL}, {@link #NATIVE}, {@link #PRIVATE}, {@link #STATIC} and {@link #SYNCHRONIZED}. */ public static final short ABSTRACT = 0x0400; /** * @return Whether the given modifier includes {@link #ABSTRACT} */ public static boolean isAbstract(short sh) { return (sh & Mod.ABSTRACT) != 0; } /** * This flag is set on STRICTFP methods, and is mutually exclusive with {@link #ABSTRACT}. */ public static final short STRICTFP = 0x0800; /** * @return Whether the given modifier includes {@link #STRICTFP} */ public static boolean isStrictfp(short sh) { return (sh & Mod.STRICTFP) != 0; } // Poorly documented JDK 1.5 modifiers: /** * This flag is set on classes, methods and fields that were generated by the compiler and do not appear in the * source code. */ public static final short SYNTHETIC = 0x1000; /** * @return Whether the given modifier includes {@link #SYNTHETIC} */ public static boolean isSynthetic(short sh) { return (sh & Mod.SYNTHETIC) != 0; } /** * This flag is set on annotation types (including nested annotation types), and requires that {@link #INTERFACE} * is also set. */ public static final short ANNOTATION = 0x2000; /** * @return Whether the given modifier includes {@link #ANNOTATION} */ public static boolean isAnnotation(short sh) { return (sh & Mod.ANNOTATION) != 0; } /** * This flag is set on enumerated types (including nested enumerated types) and enumerated types' elements, and is * mutually exclusive with {@link #INTERFACE}. */ public static final short ENUM = 0x4000; /** * @return Whether the given modifier includes {@link #ENUM} */ public static boolean isEnum(short sh) { return (sh & Mod.ENUM) != 0; } }
[ "aunkrig@users.noreply.github.com" ]
aunkrig@users.noreply.github.com
eab95517c07a24f8c37b8e7a4aaf4419e436e86d
edf86065dcf1a6b2a82c4f4656a66a21344f5b4b
/src/hcisystem/GameModuleComponent.java
590c03824bcc2c4468be5d6e838e1a37da5cafef
[]
no_license
jais232/HCISystem
a0d74acadea7da8d0a002f46faea90593bcff133
5a735e60e7b450fb8340dac0f1bc69b56fbfc7fe
refs/heads/master
2020-08-14T13:06:31.504335
2018-09-09T11:36:17
2018-09-09T11:36:17
215,173,978
0
0
null
null
null
null
UTF-8
Java
false
false
1,575
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package hcisystem; import hcisystem.gesture_module.KeyboardInterfaceClass; import hcisystem.voice_module.FileControl; import hcisystem.voice_module.ReceiveAlerts; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author pra */ class GameModuleComponent { private static final String OUTSIDE_GAME_MODE = "$$get_outside_game_mode_$$"; public void receiveCommands() { String data; System.out.println("inside GameComponent"); try { while((data = ServerComponent.br.readLine()) != null) { if(data.equals(OUTSIDE_GAME_MODE)) { System.out.println("getting outside gameComponent"); break; } else { KeyboardInterfaceClass kic = new KeyboardInterfaceClass(); kic.executeKeyboardCommand(data); } } } catch (IOException ex) { Logger.getLogger(VoiceModuleComponent.class.getName()).log(Level.SEVERE, null, ex); } catch(Exception e) { System.out.println(e.getMessage()); } } }
[ "prashantdegaonkar@gmail.com" ]
prashantdegaonkar@gmail.com
efb5339f59bc860d33afbb5c7e20c27a66d6f237
8fa3ca7e4de707b679541717d9c83031e278181c
/src/main/java/com/netease/model/CommodityForBuyer.java
7175e6130e7b62fbea54a2948533b103b90f7103
[]
no_license
huyande/seller
e133cc0650faf61ba33e184ee9f6e4d97a79fa83
64522455c8ce939abbc53e3fac44252220907faa
refs/heads/master
2021-09-10T11:06:42.984530
2018-03-25T06:00:57
2018-03-25T06:00:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,474
java
package com.netease.model; import java.util.Date; /** * @author zhanglbjames@163.com * @version Created on 18-3-20. * * 用于orders和commodity联表查询的model,为用户提供购商品买数量的支持 */ public class CommodityForBuyer extends Commodity { private int purchasedQuantity; //购买数量 0表示未购买 private double perPriceSnapshot; // 购买时的单价 public int getPurchasedQuantity() { return purchasedQuantity; } public void setPurchasedQuantity(int purchasedQuantity) { this.purchasedQuantity = purchasedQuantity; } public double getPerPriceSnapshot() { return perPriceSnapshot; } public void setPerPriceSnapshot(double perPriceSnapshot) { this.perPriceSnapshot = perPriceSnapshot; } public CommodityForBuyer() { } public CommodityForBuyer(int id, String comCode, String title, String comAbstract, float perPrice, String detail, String picURI, int picType, int publisherId, Date pubTime, int storageAmount, int soldQuantity, int pubStatus,int purchasedQuantity,double perPriceSnapshot) { super(id, comCode, title, comAbstract, perPrice, detail, picURI, picType, publisherId, pubTime, storageAmount, soldQuantity, pubStatus); this.purchasedQuantity = purchasedQuantity; this.perPriceSnapshot = perPriceSnapshot; } }
[ "zhanglbjames@163.com" ]
zhanglbjames@163.com
3acaa134164e6936f6565859f32d4c1cb381205a
46eca1705dcc3c7c6a459ddb14cf25a755d63364
/his/backend/src/main/java/edu/neu/his/util/ExcelImportation.java
080ad8a4c785f748dd4218ab6b5f7cbbd5b6f5d9
[ "Unlicense" ]
permissive
XUranus/NEUBCourse
66e96ccd994569e89d23b43559ecd5c175117774
695a1c33c65357fb5bb170483e84fecb4368d224
refs/heads/main
2023-03-24T23:58:28.192567
2021-03-25T07:53:24
2021-03-25T07:53:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,620
java
package edu.neu.his.util; import org.apache.poi.ss.usermodel.CellType; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.InputStream; import java.lang.reflect.Field; import java.lang.reflect.ParameterizedType; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.function.Function; public class ExcelImportation<T> { private Logger logger = LoggerFactory.getLogger(ExcelImportation.class); private Map<String, Integer> indexMap = new HashMap<>(); private Map<String, Function<String, ?>> preFunctionMap = new HashMap<>(); private InputStream inputStream; private Class<T> entityClass; private Importable<T> importable; private int skip; private boolean append; public boolean isNullAsDefault() { return nullAsDefault; } public void setNullAsDefault(boolean nullAsDefault) { this.nullAsDefault = nullAsDefault; } private boolean nullAsDefault = true; private Map<String, Object> defaultMap; public ExcelImportation(InputStream inputStream, Class<T> entityClass, Importable<T> importable) { this.inputStream = inputStream; this.entityClass = entityClass; this.importable = importable; defaultMap = new HashMap<>(); defaultMap.put("int", 0); defaultMap.put("float", (float) 0); defaultMap.put("double", 0.0); defaultMap.put("java.lang.String", ""); defaultMap.put("boolean", false); } public Map<String, Integer> getIndexMap() { return indexMap; } public void setIndexMap(Map<String, Integer> indexMap) { this.indexMap = indexMap; } public Map<String, Function<String, ?>> getPreFunctionMap() { return preFunctionMap; } public void setPreFunctionMap(Map<String, Function<String, ?>> preFunctionMap) { this.preFunctionMap = preFunctionMap; } public InputStream getInputStream() { return inputStream; } public void setInputStream(InputStream inputStream) { this.inputStream = inputStream; } public Function<String, ?> addPreFunction(String field, Function<String, ?> function) { return this.preFunctionMap.put(field, function); } public void setColumnFields(String... fields) { for (int i = 0; i < fields.length; i++) { if (fields[i] != null) { this.indexMap.put(fields[i], i); } } } public void exec() { Workbook wb = null; try { wb = new XSSFWorkbook(inputStream); insertEachRow(wb); } catch (Exception e) { e.printStackTrace(); } } private <T> T parseRow(Row row, Class<T> entityClass, Map<String, Integer> indexMap, Map<String, Function<String, ?>> functionMap) throws IllegalAccessException, InstantiationException { Field[] fields = entityClass.getDeclaredFields(); T instance = entityClass.newInstance(); for (String key : indexMap.keySet()) { for (Field field : fields) { if (field.getName().equals(key)) { int cellIndex = indexMap.get(key); Cell cell = row.getCell(cellIndex); if (functionMap.get(key) != null) { String originInput; if(cell.getCellType() == CellType.STRING) originInput = cell.getStringCellValue(); else originInput = cell.getNumericCellValue() + ""; Function<String, ?> function = functionMap.get(key); Object result = function.apply(originInput); Class cls = field.getType(); if (!field.isAccessible()) field.setAccessible(true); field.set(instance, result); } else { setFieldValue(instance, field, cell); } logger.debug("Constructed an Field : {}, values {}", field.toString(), cell); } } logger.debug("Constructed an Object : {}", instance.toString()); } return instance; } private <T> void setFieldValue(T instance, Field field, Cell cell) throws IllegalAccessException { Class cls = field.getType(); boolean isStringType = false; String strValue = null; if (!field.isAccessible()) field.setAccessible(true); if (cell.getCellType() == CellType.STRING) { //logger.warn("Here is a type cast!"); isStringType = true; strValue = cell.getStringCellValue(); } switch (cls.getName()) { case "int": case "java.lang.Integer": if (isStringType) { field.set(instance, Integer.parseInt(strValue)); } else { field.set(instance, (int) cell.getNumericCellValue()); } break; case "double": case "java.lang.Double": if (isStringType) { field.set(instance, Double.parseDouble(strValue)); } else { field.set(instance, (double) cell.getNumericCellValue()); } break; case "float": case "java.lang.Float": if (isStringType) { field.set(instance, Float.parseFloat(strValue)); } else { field.set(instance, (float) cell.getNumericCellValue()); } break; case "boolean": case "java.lang.Boolean": field.set(instance, cell.getBooleanCellValue()); break; case "java.lang.String": if (isStringType) { field.set(instance, strValue); } else { cell.setCellType(CellType.STRING); field.set(instance, cell.getStringCellValue()); } break; } if(nullAsDefault && field.get(instance) == null){ field.set(instance, getDefaultValue(field.getName())); } } private Object getDefaultValue(String fieldType) { return defaultMap.get(fieldType); } private void insertEachRow(Workbook wb) throws InstantiationException, IllegalAccessException { Iterator<Sheet> sheetIterator = wb.sheetIterator(); while (sheetIterator.hasNext()) { Sheet sheet = sheetIterator.next(); int rowNums = sheet.getLastRowNum(); int colNums = sheet.getPhysicalNumberOfRows(); int initLine = skip; for (int i = initLine; i <= rowNums; i++) { Row row = sheet.getRow(i); T instance = parseRow(row, entityClass, indexMap, preFunctionMap); importable.insert(instance); } } } public Class<T> getTClass() { Class<T> tClass = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0]; return tClass; } public void skipLine(int count) { this.skip = count; } }
[ "2257238649wdx@gmail.com" ]
2257238649wdx@gmail.com
9d906144df2883d1d6431678cbeaecbd5b4fde55
45fe633ebd0ecce306ee4fc21ff52f0013c8a2e5
/src/main/java/com/example/config/DynamicDataSource.java
a50999b32f6e45ff6bbfde26d0e92ca96544bde5
[]
no_license
457575657/td-member
69f74f2b3301fb89f13a1e7cbec4e30fee9ee809
1da38d77935a6e4de9acbf2d0ec22233477a718b
refs/heads/master
2021-05-01T07:02:22.113488
2017-01-21T08:43:15
2017-01-21T08:43:15
79,633,614
0
0
null
null
null
null
UTF-8
Java
false
false
571
java
/** * @Title: DynamicDataSource.java * @Package com.niiwoo.dao.annotation * @Description: TODO(用一句话描述该文件做什么) * @author seven * @date 2014-10-14 上午9:32:33 * @version V1.0 */ package com.example.config; import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; public class DynamicDataSource extends AbstractRoutingDataSource{ @Override protected Object determineCurrentLookupKey() { System.out.println("========================== DynamicDataSource"); return HandleDataSource.getDataSource(); } }
[ "yepeiqin@tuandai.com" ]
yepeiqin@tuandai.com
58d5e79f1eef1ca23f922b7d801dc201348b6602
93f9c5530871ddf6ae7cd1723e4f2a3c5467cc81
/src/main/java/com/domain/entities/OneToManyBidirectional/v1/OneToManyBRepository.java
1787e91544ad383078a64a8b8caed1dbe6b9d466
[]
no_license
costia097/AnotherBack
ad6554d5a6bf67916c7a6a513a88c2f8446722d5
9a1a096411206501b01698f55bbd48baa7b9bfc5
refs/heads/master
2020-03-31T12:56:03.103702
2018-10-22T08:26:35
2018-10-22T08:26:35
152,234,907
0
0
null
null
null
null
UTF-8
Java
false
false
920
java
package com.domain.entities.OneToManyBidirectional.v1; import com.domain.entities.OneToManyBidirectional.v1.entity.Planet; import com.domain.entities.OneToManyBidirectional.v1.entity.SolarSystem; import org.hibernate.Hibernate; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; @Repository public class OneToManyBRepository { @Autowired private SessionFactory sessionFactory; @Transactional public void save(SolarSystem solarSystem) { sessionFactory.getCurrentSession().save(solarSystem); } @Transactional(readOnly = true) public Planet find() { Planet planet = sessionFactory.getCurrentSession().find(Planet.class, 2L); Hibernate.initialize(planet.getSolarSystem()); return planet; } }
[ "adaw36909@gmail.com" ]
adaw36909@gmail.com
e2e6b52683379433685f21a7fb197872bb4f9162
45f976fd23a24c504afc7747fa572733b1c813b3
/nabl2.terms/src/main/java/mb/nabl2/terms/build/ITermBuild.java
6134873b6d891729bbd80d4368d6188a04ea592a
[ "Apache-2.0" ]
permissive
jochembroekhoff/nabl
9d7a81fa4079530629d7038cfe713c61ad402b32
f63db38a092fe9d414e5564ccd722c64d48ab010
refs/heads/master
2023-05-07T15:34:20.532219
2021-05-26T18:33:14
2021-05-26T18:33:14
372,570,344
0
0
Apache-2.0
2021-06-02T10:43:10
2021-05-31T16:37:27
null
UTF-8
Java
false
false
4,603
java
package mb.nabl2.terms.build; import java.util.Arrays; import java.util.LinkedList; import javax.annotation.Nullable; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import mb.nabl2.terms.IApplTerm; import mb.nabl2.terms.IAttachments; import mb.nabl2.terms.IBlobTerm; import mb.nabl2.terms.IConsTerm; import mb.nabl2.terms.IIntTerm; import mb.nabl2.terms.IListTerm; import mb.nabl2.terms.INilTerm; import mb.nabl2.terms.IStringTerm; import mb.nabl2.terms.ITerm; import mb.nabl2.terms.ITermVar; import mb.nabl2.terms.Terms; public interface ITermBuild { default IApplTerm newAppl(String op, ITerm... args) { return newAppl(op, Arrays.asList(args)); } default IApplTerm newAppl(String op, Iterable<? extends ITerm> args) { return newAppl(op, args, null); } IApplTerm newAppl(String op, Iterable<? extends ITerm> args, @Nullable IAttachments attachments); default ITerm newTuple(ITerm... args) { return newTuple(Arrays.asList(args)); } default ITerm newTuple(Iterable<? extends ITerm> args) { return newTuple(args, null); } default ITerm newTuple(Iterable<? extends ITerm> args, @Nullable IAttachments attachments) { return Iterables.size(args) == 1 ? Iterables.getOnlyElement(args) : newAppl(Terms.TUPLE_OP, args, attachments); } default IListTerm newList(ITerm... elems) { return newList(Arrays.asList(elems)); } default IListTerm newList(Iterable<? extends ITerm> elems) { return newList(elems, null); } default IListTerm newList(Iterable<? extends ITerm> elems, @Nullable Iterable<IAttachments> attachments) { LinkedList<ITerm> elemsQueue = Lists.newLinkedList(elems); LinkedList<IAttachments> attachmentsQueue = attachments != null ? Lists.newLinkedList(attachments) : null; if(attachmentsQueue != null && attachmentsQueue.size() != elemsQueue.size() + 1) { throw new IllegalArgumentException( "Number of attachments does not correspond to number of elements in the list."); } IListTerm list = newNil(); if(attachmentsQueue != null) { list = list.withAttachments(attachmentsQueue.removeLast()); } return newListTail(elemsQueue, list, attachmentsQueue); } default IListTerm newListTail(Iterable<? extends ITerm> elems, IListTerm list) { return newListTail(elems, list, null); } default IListTerm newListTail(Iterable<? extends ITerm> elems, IListTerm list, @Nullable Iterable<IAttachments> attachments) { LinkedList<ITerm> elemsQueue = Lists.newLinkedList(elems); LinkedList<IAttachments> attachmentsQueue = attachments != null ? Lists.newLinkedList(attachments) : null; if(attachmentsQueue != null && attachmentsQueue.size() != elemsQueue.size()) { throw new IllegalArgumentException( "Number of attachments does not correspond to number of elements in the list."); } return newListTail(elemsQueue, list, attachmentsQueue); } default IListTerm newListTail(LinkedList<? extends ITerm> elems, IListTerm list, @Nullable LinkedList<IAttachments> attachments) { while(!elems.isEmpty()) { list = newCons(elems.removeLast(), list); if(attachments != null) { list = list.withAttachments(attachments.removeLast()); } } return list; } default INilTerm newNil() { return newNil(null); } public INilTerm newNil(@Nullable IAttachments attachments); default IConsTerm newCons(ITerm head, IListTerm tail) { return newCons(head, tail, null); } IConsTerm newCons(ITerm head, IListTerm tail, @Nullable IAttachments attachments); default IStringTerm newString(String value) { return newString(value, null); } IStringTerm newString(String value, @Nullable IAttachments attachments); default IIntTerm newInt(int value) { return newInt(value, null); } IIntTerm newInt(int value, @Nullable IAttachments attachments); default IBlobTerm newBlob(Object value) { return newBlob(value, null); } IBlobTerm newBlob(Object value, @Nullable IAttachments attachments); default ITermVar newVar(String resource, String name) { return newVar(resource, name, null); } ITermVar newVar(String resource, String name, @Nullable IAttachments attachments); }
[ "hendrik@van-antwerpen.net" ]
hendrik@van-antwerpen.net
b15d02c3450cf65d31b2b212b07b6ecba90817c2
e0ca941dea2eed93ef2ae96c5d9b468995d875db
/epf/src/main/java/com/spx/egl/EncoderSurface.java
1633abbc626cc4d8ae12e05a00cb159db415f553
[]
no_license
shaopx/VideoClipEditViewTest
3c0b7447eda4a3cc5e3373e8102ff20b1cb4737c
ae55128b4308200d005ff33c4829b594ced4e380
refs/heads/master
2022-04-30T00:26:13.535992
2022-04-08T10:28:56
2022-04-08T10:28:56
148,327,631
483
122
null
null
null
null
UTF-8
Java
false
false
5,031
java
package com.spx.egl; import android.opengl.EGL14; import android.opengl.EGLConfig; import android.opengl.EGLContext; import android.opengl.EGLDisplay; import android.opengl.EGLExt; import android.opengl.EGLSurface; import android.view.Surface; // Refer : https://android.googlesource.com/platform/cts/+/lollipop-release/tests/tests/media/src/android/media/cts/InputSurface.java /** * Holds state associated with a Surface used for MediaCodec encoder input. * <p> * The constructor takes a Surface obtained from MediaCodec.createInputSurface(), and uses that * to create an EGL window surface. Calls to eglSwapBuffers() cause a frame of data to be sent * to the video encoder. */ public class EncoderSurface { private static final int EGL_RECORDABLE_ANDROID = 0x3142; private EGLDisplay eglDisplay = EGL14.EGL_NO_DISPLAY; private EGLContext eglContext = EGL14.EGL_NO_CONTEXT; private EGLSurface eglSurface = EGL14.EGL_NO_SURFACE; private Surface surface; /** * Creates an EncoderSurface from a Surface. */ public EncoderSurface(Surface surface) { if (surface == null) { throw new NullPointerException(); } this.surface = surface; eglSetup(); } /** * Prepares EGL. We want a GLES 2.0 context and a surface that supports recording. */ private void eglSetup() { eglDisplay = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY); if (eglDisplay == EGL14.EGL_NO_DISPLAY) { throw new RuntimeException("unable to get EGL14 display"); } int[] version = new int[2]; if (!EGL14.eglInitialize(eglDisplay, version, 0, version, 1)) { eglDisplay = null; throw new RuntimeException("unable to initialize EGL14"); } // Configure EGL for recordable and OpenGL ES 2.0. We want enough RGB bits // to minimize artifacts from possible YUV conversion. int[] attribList = { EGL14.EGL_RED_SIZE, 8, EGL14.EGL_GREEN_SIZE, 8, EGL14.EGL_BLUE_SIZE, 8, EGL14.EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT, EGL_RECORDABLE_ANDROID, 1, EGL14.EGL_NONE }; EGLConfig[] configs = new EGLConfig[1]; int[] numConfigs = new int[1]; if (!EGL14.eglChooseConfig(eglDisplay, attribList, 0, configs, 0, configs.length, numConfigs, 0)) { throw new RuntimeException("unable to find RGB888+recordable ES2 EGL config"); } // Configure context for OpenGL ES 2.0. int[] attrib_list = { EGL14.EGL_CONTEXT_CLIENT_VERSION, 2, EGL14.EGL_NONE }; eglContext = EGL14.eglCreateContext(eglDisplay, configs[0], EGL14.EGL_NO_CONTEXT, attrib_list, 0); checkEglError("eglCreateContext"); if (eglContext == null) { throw new RuntimeException("null context"); } // Create a window surface, and attach it to the Surface we received. int[] surfaceAttribs = { EGL14.EGL_NONE }; eglSurface = EGL14.eglCreateWindowSurface(eglDisplay, configs[0], surface, surfaceAttribs, 0); checkEglError("eglCreateWindowSurface"); if (eglSurface == null) { throw new RuntimeException("surface was null"); } } /** * Discard all resources held by this class, notably the EGL context. Also releases the * Surface that was passed to our constructor. */ public void release() { if (eglDisplay != EGL14.EGL_NO_DISPLAY) { EGL14.eglDestroySurface(eglDisplay, eglSurface); EGL14.eglDestroyContext(eglDisplay, eglContext); EGL14.eglReleaseThread(); EGL14.eglTerminate(eglDisplay); } surface.release(); eglDisplay = EGL14.EGL_NO_DISPLAY; eglContext = EGL14.EGL_NO_CONTEXT; eglSurface = EGL14.EGL_NO_SURFACE; surface = null; } /** * Makes our EGL context and surface current. */ public void makeCurrent() { if (!EGL14.eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext)) { throw new RuntimeException("eglMakeCurrent failed"); } } /** * Calls eglSwapBuffers. Use this to "publish" the current frame. */ public void swapBuffers() { EGL14.eglSwapBuffers(eglDisplay, eglSurface); } /** * Sends the presentation time stamp to EGL. Time is expressed in nanoseconds. */ public void setPresentationTime(long nsecs) { EGLExt.eglPresentationTimeANDROID(eglDisplay, eglSurface, nsecs); } /** * Checks for EGL errors. */ private void checkEglError(String msg) { int error; if ((error = EGL14.eglGetError()) != EGL14.EGL_SUCCESS) { throw new RuntimeException(msg + ": EGL error: 0x" + Integer.toHexString(error)); } } }
[ "shaopx@gmail.com" ]
shaopx@gmail.com
9345f745bcb9ef33e9b9e7d96d0b37dc9bac7f20
09312337cae04db08ff7620a95389fc039322638
/ShopApp.java
dd2d46b9860fb5d62bf5cfba79e387e56cfd6a30
[]
no_license
Etherian/loops-conditionals-assignment
657ed9de81307efb1da9312a85de175809e76f90
29caecf9ef29059d21dfc81f636ee944632d0897
refs/heads/main
2023-04-18T16:29:23.313452
2021-05-06T23:22:21
2021-05-06T23:22:21
364,707,150
0
0
null
null
null
null
UTF-8
Java
false
false
1,594
java
package SCW.shop; public class ShopApp { public static void main(String[] args) { double tax = 0.2; System.out.println("Welcome!"); // Customer login Customer c = new Customer("Pinky", 3); Clothing.Size CustomerSize; switch (c.measurement) { case 1, 2, 3: CustomerSize = Clothing.Size.S; break; case 4, 5, 6: CustomerSize = Clothing.Size.M; break; case 7, 8, 9: CustomerSize = Clothing.Size.L; break; default: throw new RuntimeException("Invalid measurement"); } // Product Listing Clothing[] items = { new Clothing("Blue Jacket", 20.0, Clothing.size.M), new Clothing("Orange T-shirt", 10.5, Clothing.size.S), new Clothing("Blue T-shirt", 10.5, Clothing.size.S), new Clothing("Green Scarf", 5.0, Clothing.size.S) }; for (Clothing item: items) { if (item.size == CustomerSize) { System.out.printf("$%f4.2 %s10", item.price, item.description); } } // Shopping HashMap<Clothing, Integer> cart = new HashMap(); cart.put(item1, 1); cart.put(item2, 2); // Checkout double gross = cart.entrySet().toArray().stream().reduce( 0, (acc, entry) -> acc + entry.getValue() * entry.getKey().price ); System.out.printf("Total: $%f.2", total * (1 + tax)); } }
[ "etherain@gmail.com" ]
etherain@gmail.com
c73c822dc5e8cd226cb5714c2dab4ba2a6f0f583
0dcf5eef8bb070d7a9bc7edb2e191966463443fe
/JAVA EE SERVLET API 4.0/Chushka Application/src/main/java/chushka/web/servlets/ProductDetailServlet.java
5adbc014d075b2e9622e31148da3922427131f53
[]
no_license
inkarnasion/Java-Web-Development-Basic
dfb1fd0dd90c7d23938a1a93c8325bfee53986db
5f6aa946644fa5c300917a8c00ebfca0f3b3409c
refs/heads/master
2020-04-16T07:52:45.194016
2019-03-04T11:24:58
2019-03-04T11:24:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,867
java
package chushka.web.servlets; import chushka.domain.models.view.ProductDetailsVieweModel; import chushka.service.ProductService; import chushka.util.HtmlReader; import chushka.util.ModelMapper; import javax.inject.Inject; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; @WebServlet("/products/details") public class ProductDetailServlet extends HttpServlet { private static final String PRODUCT_DETAILS_HTML_FILE_PATH = "D:\\Java\\Java WEB 2019\\JAVA EE SERVLET API 4.0\\src\\main\\resources\\views\\details-product.html"; private final ProductService productService; private final HtmlReader htmlReader; private final ModelMapper modelMapper; @Inject public ProductDetailServlet(ProductService productService, HtmlReader htmlReader, ModelMapper modelMapper) { this.productService = productService; this.htmlReader = htmlReader; this.modelMapper = modelMapper; } @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { ProductDetailsVieweModel productDetailsVieweModel = this.modelMapper .map((this.productService.findProductByName(req.getQueryString().split("=")[1])), ProductDetailsVieweModel.class ); String htmlFileContent = this.htmlReader.readHtmlFile(PRODUCT_DETAILS_HTML_FILE_PATH) .replace("{{productName}}", productDetailsVieweModel.getName()) .replace("{{productDescription}}", productDetailsVieweModel.getDescription()) .replace("{{productType}}", productDetailsVieweModel.getType()); resp.getWriter().println(htmlFileContent); } }
[ "todor8009@gmail.com" ]
todor8009@gmail.com
1bc153171df0bba7a63b6ecc5c4f0591ad66bd0e
32286f7ca7c8d5b4d61efc90075de5edf81eb9ec
/mp/src/thirdparty/protobuf-2.3.0/java/src/main/java/com/google/protobuf/UninitializedMessageException.java
44cf43b0673c4ee6ce2d2b051c295928d9c14083
[ "LicenseRef-scancode-protobuf", "LicenseRef-scancode-unknown-license-reference" ]
permissive
saul/source-sdk-2013
0c20f31366d36b050e47c6fccc5e8e9815ac5de4
cc136aae767653f3290589eb9a230fb8aea82383
refs/heads/master
2021-01-18T03:32:36.266073
2013-08-05T19:09:20
2013-08-05T19:09:20
11,110,123
12
1
null
2013-08-05T19:01:21
2013-07-01T23:34:24
C++
UTF-8
Java
false
false
4,328
java
// Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. // http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. package com.google.protobuf; import java.util.Collections; import java.util.List; /** * Thrown when attempting to build a protocol message that is missing required * fields. This is a {@code RuntimeException} because it normally represents * a programming error: it happens when some code which constructs a message * fails to set all the fields. {@code parseFrom()} methods <b>do not</b> * throw this; they throw an {@link InvalidProtocolBufferException} if * required fields are missing, because it is not a programming error to * receive an incomplete message. In other words, * {@code UninitializedMessageException} should never be thrown by correct * code, but {@code InvalidProtocolBufferException} might be. * * @author kenton@google.com Kenton Varda */ public class UninitializedMessageException extends RuntimeException { private static final long serialVersionUID = -7466929953374883507L; public UninitializedMessageException(final MessageLite message) { super("Message was missing required fields. (Lite runtime could not " + "determine which fields were missing)."); missingFields = null; } public UninitializedMessageException(final List<String> missingFields) { super(buildDescription(missingFields)); this.missingFields = missingFields; } private final List<String> missingFields; /** * Get a list of human-readable names of required fields missing from this * message. Each name is a full path to a field, e.g. "foo.bar[5].baz". * Returns null if the lite runtime was used, since it lacks the ability to * find missing fields. */ public List<String> getMissingFields() { return Collections.unmodifiableList(missingFields); } /** * Converts this exception to an {@link InvalidProtocolBufferException}. * When a parsed message is missing required fields, this should be thrown * instead of {@code UninitializedMessageException}. */ public InvalidProtocolBufferException asInvalidProtocolBufferException() { return new InvalidProtocolBufferException(getMessage()); } /** Construct the description string for this exception. */ private static String buildDescription(final List<String> missingFields) { final StringBuilder description = new StringBuilder("Message missing required fields: "); boolean first = true; for (final String field : missingFields) { if (first) { first = false; } else { description.append(", "); } description.append(field); } return description.toString(); } }
[ "joe@valvesoftware.com" ]
joe@valvesoftware.com
68d6f4d14dbec466c72860361abbc876f6aac544
6096170f46afac1e4716c2dd783fadb19260258c
/src/main/java/pregunta1/developerComputer.java
5d99d67e9b6f086d7d4457dd556420046df8a516
[]
no_license
juanmorenomotta/ExamenFinal
48e8d5d0d2bfa8308d9b33cb45c01e26bd64acaf
05cd124325f33ed9f3ada8131e450e34837f4985
refs/heads/master
2021-08-16T00:33:39.344735
2017-11-18T16:34:54
2017-11-18T16:34:54
111,220,395
0
0
null
null
null
null
UTF-8
Java
false
false
92
java
package pregunta1; public interface developerComputer { public String getDescription(); }
[ "juanmorenomotta@gmail.com" ]
juanmorenomotta@gmail.com
cd57c77a1532c0883b8ceeebf7d4c9f25ceefe4c
6cb6c7faf478a290f92cbcfbc017c35673f96c36
/test/src/me/happyorks/test/test.java
50ff7d6fda97244f34704ab504315bef0b64a856
[]
no_license
howej18/JavaStuff
9c9c5297e82fc59dbc926960b92843cd4f16fe17
b81cc99c3015c50e2807380aa74bb267ac3ea5e5
refs/heads/master
2020-11-26T17:07:01.822909
2014-03-06T19:40:29
2014-03-06T19:40:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
135
java
package me.happyorks.test; public class test { public static void main(String args[]){ System.out.println("Hello world!!!"); } }
[ "jimmya7xforever@gmail.com" ]
jimmya7xforever@gmail.com
1fff0f5ce2914d353b1bbe94b1877dc606a36f30
7f28e8fca2b493f193c3746caa2e16be8620d6c5
/dadao_pointsrebate_cms/dadao_pointsrebate_cms_api/dadao_pointsrebate_cms_userinterface/src/main/java/com/dadao/category/controller/CategoryController.java
73ebe9dc4bd724a694274868e1bb686ef3b848b9
[]
no_license
xiaoniu0813/dadao_pointsrebate_parent
3704eb4ef89f5cd1a5204a74e8bc75baa4db9e8d
c53325886402b126bf7b86eb3f54b187fc456620
refs/heads/master
2021-05-11T22:18:49.704024
2018-01-15T02:46:34
2018-01-15T02:46:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,823
java
package com.dadao.category.controller; import com.dadao.category.entity.Category; import com.dadao.category.entity.CategoryPO; import com.dadao.category.service.CategoryService; import com.dadao.utils.DADAO; import com.dadao.utils.QueryResult; import com.dadao.utils.Result; import com.dadao.utils.ResultCode; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Created by yunqiang1 on 2017/7/18. */ @RestController public class CategoryController { @Autowired CategoryService categoryService; @PostMapping(value = "/findCategoryByPage" ) public Object findByPage(@RequestParam(value = "pageNum",required = false,defaultValue = "1") int pageNum, Category category, HttpServletRequest request, HttpServletResponse response) { category.setBeginIndex((pageNum-1)*category.getPageSize()); QueryResult queryResult = categoryService.findByPage(category); queryResult.setPageNum(pageNum); boolean flag = !(queryResult.getList().size() == 0); return DADAO.encryption(request, response, new Result(flag? ResultCode.SYS_SUCCESS:ResultCode.SYS_FAIL, queryResult)); } @PostMapping(value = "/updateCategory") public Object updatePage(Category category, HttpServletRequest request, HttpServletResponse response){ boolean flag = categoryService.updateCategory(category) == 1; return DADAO.encryption(request, response, new Result(flag? ResultCode.SYS_SUCCESS:ResultCode.SYS_FAIL,flag)); } @PostMapping(value = "/addCategory") public Object addCategory(CategoryPO categoryPO, HttpServletRequest request, HttpServletResponse response){ boolean flag = categoryService.save(categoryPO) == 1; return DADAO.encryption(request, response, new Result(flag? ResultCode.SYS_SUCCESS:ResultCode.SYS_FAIL,flag)); } @PostMapping(value = "/updateCategoryPicture") public Object updateCategoryPicture(Category category, HttpServletRequest request, HttpServletResponse response){ boolean flag = categoryService.updateCategoryPicture(category) == 1; return DADAO.encryption(request, response, new Result(flag? ResultCode.SYS_SUCCESS:ResultCode.SYS_FAIL,flag)); } @PostMapping(value = "/moveUP") public Object moveUP(Category category, HttpServletRequest request, HttpServletResponse response){ boolean flag = categoryService.moveUP(category.getCategoryId()) == 1; return DADAO.encryption(request, response, new Result(flag? ResultCode.SYS_SUCCESS:ResultCode.SYS_FAIL,flag)); } }
[ "xiaoniu0813@126.com" ]
xiaoniu0813@126.com
7af7e3dc01be546fe99809c54838255f8b7a4b83
f7b03ba6180554b5203368ea80d6b54bd55ae0ab
/src/loginsample/Account.java
070bc3e1de7351b937cff1a5915dcacbad9cc797
[]
no_license
lawlietsnow/LoginExample
5d42650d095b5d38c8cc82898577b3300d1baefb
8c1c8bcd7ca1d1c24a6fbfcbcb1fa305de759716
refs/heads/master
2020-04-20T20:15:11.279892
2019-02-07T05:26:00
2019-02-07T05:26:00
169,071,477
0
0
null
null
null
null
UTF-8
Java
false
false
521
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package loginsample; /** * * @author Administrator */ public class Account { public String user=""; public String password=""; public Account(String user,String password) { this.user=user; this.password=password; } public String toString(){ return this.user+" + "+this.password; } }
[ "thotang19@gmail.com" ]
thotang19@gmail.com
7f8719b72d7998b5193bc0f27141a6a9f95a8812
aa03e76d2c584e4e664f0745d1cd057d20679674
/pgtypes/src/test/java/nl/fontys/sebivenlo/pgtypes/SeasonTest.java
c6ff9f2eb4ccf6e9cd905f2eae0fcdb49d6d4a91
[]
no_license
sebivenlo/sebidao
6a93cb4c2359d333fcdb259fd5b899ff04f6dceb
6d53a5cdb30243b6be532e89f117768b2b37899c
refs/heads/master
2021-06-28T14:08:33.320271
2020-01-08T06:05:17
2020-01-08T06:05:17
176,164,663
3
5
null
null
null
null
UTF-8
Java
false
false
3,657
java
package nl.fontys.sebivenlo.pgtypes; import java.time.LocalDate; import static java.time.LocalDate.of; import java.time.Month; import static java.time.Month.*; import static java.time.temporal.ChronoUnit.DAYS; import java.util.List; import java.util.Map; import static nl.fontys.sebivenlo.pgtypes.Seasons.PriceClass.*; import org.junit.Assert; import org.junit.Test; import static org.junit.Assert.*; import org.junit.Ignore; import static nl.fontys.sebivenlo.pgtypes.Seasons.THIS_YEAR; /** * * @author Pieter van den Hombergh {@code pieter.van.den.hombergh@gmail.com} */ public class SeasonTest { Seasons ses = new Seasons(); // @Ignore( "Think TDD" ) @Test public void feb28IsMid() { assertEquals( MID, ses.getPriceClass( LocalDate.of( THIS_YEAR, 2, 28 ) ) ); // Assert.fail( "method feb28IsMid reached end. You know what to do." ); } // @Ignore( "Think TDD" ) @Test public void crocusCosts700() { LocalDateRange crocus = LocalDateRange.fromUntil( of( THIS_YEAR, 2, 20 ), of( THIS_YEAR, 2, 25 ) ); assertEquals( "5 day at 140", 700L, ses.getPrice( crocus ) ); // Assert.fail( "method crocusCosts700 reached end. You know what to do." ); } // @Ignore( "Think TDD" ) @Test public void extendedCrocusCosts() { LocalDate start = of( THIS_YEAR, 2, 20 ); LocalDate end = of( THIS_YEAR, MARCH, 8 ); LocalDateRange crocus = LocalDateRange.fromUntil( start, end ); long part1 = DAYS.between( start, of( THIS_YEAR, MARCH, 1 ) ); long part2 = DAYS.between( of( THIS_YEAR, MARCH, 1 ), end ); long expected = ses.getDayPrice( MID ) * part1 + ses.getDayPrice( LOW ) * part2; assertEquals( expected, ses.getPrice( crocus ) ); // Assert.fail( "method extendedCrocusCosts reached end. You know what to do." ); } // @Ignore( "Think TDD" ) @Test public void reallyLongHolidayCostsPlenty() { LocalDate start = of( THIS_YEAR, 2, 20 ); LocalDate end = of( THIS_YEAR, JUNE, 8 ); LocalDateRange longHoliday = LocalDateRange.fromUntil( start, end ); long e1 = DAYS.between( start, of( THIS_YEAR, MARCH, 1 ) ) * ses.getDayPrice( MID ); System.out.println( "e1 = " + e1 ); long e2 = of( THIS_YEAR, MARCH, 1 ).until( of( THIS_YEAR, MAY, 1 ), DAYS ) * ses.getDayPrice( LOW ); // march april System.out.println( "e2 = " + e2 ); long e3 = of( THIS_YEAR, MAY, 1 ).until(of( THIS_YEAR, MAY, 15 ),DAYS ) * ses.getDayPrice( MID ); // may System.out.println( "e3 = " + e3 ); long e4 = of( THIS_YEAR, MAY, 15 ).until( of( THIS_YEAR, JUNE, 8 ),DAYS ) * ses.getDayPrice( HIGH ); // 1/2 may-1/2 jun System.out.println( "e4 = " + e4 ); long price = ses.getPrice( longHoliday ); System.out.println( "price = " + price ); assertEquals( "hefty", e1 + e2 + e3 + e4, price ); // Assert.fail( "method reallyLongHolidayCostsPlenty reached end. You know what to do." ); } // @Ignore( "Think TDD" ) @Test public void seasonsBetween() { LocalDate start = of( THIS_YEAR, 2, 20 ); LocalDate end = of( THIS_YEAR, JUNE, 8 ); LocalDate endOfSummer = of( THIS_YEAR, Month.SEPTEMBER, 12 ); List<Map.Entry<LocalDateRange, Seasons.PriceClass>> seasonsBetween = ses.seasonsBetween( start, end ); assertEquals( 2, seasonsBetween.size() ); seasonsBetween = ses.seasonsBetween( start, endOfSummer ); assertEquals( 4, seasonsBetween.size() ); // Assert.fail( "method seasonsBetween reached end. You know what to do." ); } }
[ "p.vandenhonbergh@fontys.nl" ]
p.vandenhonbergh@fontys.nl
466c33af76dabe3569323b4ca2814dbc2be51142
5d64334f31413caa0f324a9a2ad46169e03f3c2b
/src/main/java/com/yue/websocket/ChatServer.java
3e4bdc46f5e0ee23db97753396a12906a042fbed
[]
no_license
YueRugy/netty
c01afefc49e183b3daff493bccc00e6511da6f48
3bfa0d7c949b9e0066551ee287b0232dbdd07792
refs/heads/master
2021-01-17T08:12:43.663809
2016-08-16T07:54:54
2016-08-16T07:54:54
61,861,409
0
0
null
null
null
null
UTF-8
Java
false
false
2,165
java
package com.yue.websocket; import io.netty.bootstrap.ServerBootstrap; import io.netty.channel.Channel; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelInitializer; import io.netty.channel.EventLoopGroup; import io.netty.channel.group.ChannelGroup; import io.netty.channel.group.DefaultChannelGroup; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.nio.NioServerSocketChannel; import io.netty.util.concurrent.GlobalEventExecutor; import java.net.InetSocketAddress; /** * Created by yue on 2016/7/8 */ public class ChatServer { private final ChannelGroup channelGroup = new DefaultChannelGroup(GlobalEventExecutor.INSTANCE);//1 private final EventLoopGroup group = new NioEventLoopGroup(); private Channel channel; public ChannelFuture start(InetSocketAddress address) { ServerBootstrap bootstrap = new ServerBootstrap(); //2 bootstrap.group(group) .channel(NioServerSocketChannel.class) .childHandler(createInitializer(channelGroup)); ChannelFuture future = bootstrap.bind(address); future.syncUninterruptibly(); channel = future.channel(); return future; } protected ChannelInitializer<Channel> createInitializer(ChannelGroup group) { //3 return new ChatServerInitializer(group); } public void destroy() { //4 if (channel != null) { channel.close(); } channelGroup.close(); group.shutdownGracefully(); } public static void main(String[] args) throws Exception { if (args.length != 1) { System.err.println("Please give port as argument"); System.exit(1); } int port = Integer.parseInt(args[0]); final ChatServer endpoint = new ChatServer(); ChannelFuture future = endpoint.start(new InetSocketAddress(port)); Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { endpoint.destroy(); } }); future.channel().closeFuture().syncUninterruptibly(); } }
[ "yueweichao0927@gmail.com" ]
yueweichao0927@gmail.com
e1fdf43a5513db4991ccee99e5549f1400532f02
d3c57bba8a1acbb0f8d00bc3b5397c5443af66b7
/src/test/java/net/greenrivertech/hliu/tsarandomizer/ExampleUnitTest.java
13e8022976541d8313146124ed5be329ad561e91
[]
no_license
ZeroHC/Lab3-Codes
e24282b784a0a8a506dde5d0e1790ac0cda5e8b1
0966526348594f620ed2a39a6440bbabafa0eb2c
refs/heads/master
2020-12-24T21:21:22.319062
2016-04-12T21:40:38
2016-04-12T21:40:38
56,099,773
0
0
null
null
null
null
UTF-8
Java
false
false
330
java
package net.greenrivertech.hliu.tsarandomizer; import org.junit.Test; import static org.junit.Assert.*; /** * To work on unit tests, switch the Test Artifact in the Build Variants view. */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "772185085@qq.com" ]
772185085@qq.com
a4ea9e12ec0afeebb9f31e1abb879072b0588e0d
55b7ddacc2ad1eea42d4b96d0113b6652efadc71
/java09_swing/src/SwingComponent.java
9527e04abcad15f1802bd5f1c4e806cac9092af7
[]
no_license
yisomee/java_lesson
17416d1d4789cc047526b6f991bd0359e6e8a12d
f49283e3e6d03490c5650752ea82492c090d2c13
refs/heads/main
2023-07-05T07:24:44.780469
2021-08-18T08:30:39
2021-08-18T08:30:39
397,524,413
0
0
null
null
null
null
UHC
Java
false
false
1,851
java
import java.awt.FlowLayout; import java.awt.Rectangle; import javax.swing.JCheckBox; import javax.swing.JFrame; import javax.swing.JPasswordField; import javax.swing.JScrollPane; import javax.swing.JSlider; import javax.swing.JTextArea; import javax.swing.JTextField; public class SwingComponent { JFrame frm = new JFrame("컴포넌트연습중"); Rectangle frmSize = new Rectangle(200,200,500,500);//x,y,w,h public SwingComponent() { frm.setTitle("Component"); //JTextField : 한줄의 문자열을 입력할 수 있는 컴퍼넌트 //JFrame ->FlowLayout을 변경 frm.setLayout(new FlowLayout()); JTextField tf = new JTextField(10); frm.add(tf); JTextField tf2 = new JTextField("ABCDEFG", 20); //값을 변경하기 tf2.setText("텍스트 필드의 값이 변경되었습니다."); try { String str1 = tf2.getText(); String str2 = tf2.getText(2,3); System.out.println("str1-->"+str1); System.out.println("str2-->"+str2); } catch (Exception e) { } frm.add(tf2); //JPasswordField : 문자를 마크업 해준다. JPasswordField pf = new JPasswordField(20); frm.add(pf); //JTextArea: 여러줄의 문자열을 입력하는 컴퍼넌트 JTextArea ta = new JTextArea(5, 30); JScrollPane sp = new JScrollPane(ta);//스크롤기능이 있는 컨테이너 frm.add(sp); //JCheckBox :여러개를 선택할 수 있는 컴퍼넌트 JCheckBox cb1 = new JCheckBox("사과"); JCheckBox cb2 = new JCheckBox("베", true); frm.add(cb1); frm.add(cb2); //JSlider : 스틱을 이용한 값 선책 JSlider s1 = new JSlider(JSlider.HORIZONTAL, 1, 10, 5); frm.add(s1); //x,y,w,h frm.setBounds(frmSize); frm.setVisible(true); frm.setDefaultCloseOperation(frm.DISPOSE_ON_CLOSE); } public static void main(String[] args) { new SwingComponent(); } }
[ "tlsrkdud67@naver.com" ]
tlsrkdud67@naver.com
6e65a49c083619929600afe47a8fa32033e32e13
e49ea1a0705553e59b26eaa6edcbea04086660cb
/mybatis1217_2/src/cn/itcast/mybatis/po/UserCustom.java
132db0a70c34b18093dbf16380aa0b32242d0342
[]
no_license
kingrockw/mybatisdemo
5dbcbaafecb64856896c494d5f4d152384c9cbf2
7127f4a1e5b8f0492f0ba0cff9e4e52843847c29
refs/heads/master
2021-01-16T19:11:00.178860
2017-08-26T10:25:28
2017-08-26T10:25:28
100,149,007
0
0
null
null
null
null
UTF-8
Java
false
false
468
java
package cn.itcast.mybatis.po; /** * * <p>Title: UserCustom</p> * <p>Description:扩展 pojo </p> * <p>Company: www.itcast.com</p> * @author 传智.燕青 * @date 2014-12-17下午4:51:49 * @version 1.0 */ public class UserCustom extends User { //学生类型,扩展字段 private String groupid; public String getGroupid() { return groupid; } public void setGroupid(String groupid) { this.groupid = groupid; } }
[ "kingrockw@sina.cn" ]
kingrockw@sina.cn
5e9d8a98fab18e823cde5f398681205f596e2569
8a26895d451bfb547eca702cabeea98b0814c53e
/src/main/java/org/launchcode/cheesemvc/models/data/MenuDao.java
8c377a3008555e68e26644df3217712e568490d4
[]
no_license
bkrus/cheese-mvc
801436b322e518dbdaadc1508b53fb7e0fff6fc9
fe67c5ad65e921cb14249bcdb30a8589f7c524a2
refs/heads/master
2021-08-31T00:44:17.361068
2017-12-20T01:48:12
2017-12-20T01:48:12
110,628,870
0
0
null
null
null
null
UTF-8
Java
false
false
337
java
package org.launchcode.cheesemvc.models.data; import org.launchcode.cheesemvc.models.Menu; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; import javax.transaction.Transactional; @Repository @Transactional public interface MenuDao extends CrudRepository<Menu, Integer>{ }
[ "bkrus17@gmail.com" ]
bkrus17@gmail.com
4997ce7f87531098fd22e3e1c19b57a19e415939
eb394250adea83470aa2450f41ddc589f57c0080
/src/main/java/com/rrasmo/owlsrunner/OwlUtils.java
dbeb0993cd682c8d21320ac45c1abaaa28e81eee
[]
no_license
rrasmo/owlsrunner
b09bd93da3c02d321c1070121ad2f66295d84734
4ffc66c6de292e4d2986eb71d879a46487941b23
refs/heads/master
2016-09-06T01:36:50.090061
2014-01-22T13:12:53
2014-01-22T13:12:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,239
java
package com.rrasmo.owlsrunner; import org.mindswap.owl.OWLKnowledgeBase; import org.mindswap.owl.OWLClass; import org.mindswap.owl.OWLProperty; import edu.stanford.smi.protegex.owl.model.*; import java.net.URI; import java.util.*; /** * A class to provide useful functions. * * @author Rafael Ramos */ public class OwlUtils { /** * Looks for the given Protege individual in the Mindswap kb. * @param kb * @param individualP * @return the M individual */ public static org.mindswap.owl.OWLIndividual getIndividualP2M(OWLKnowledgeBase kb, edu.stanford.smi.protegex.owl.model.OWLIndividual individualP) { org.mindswap.owl.OWLIndividual individualM = null; String individualURI = individualP.getURI(); individualM = kb.getIndividual(URI.create(individualURI)); return individualM; } /** * Creates an individual in the Mindswap kb from the given Protege individual. * @param kb * @param individualP * @return the M individual */ public static org.mindswap.owl.OWLIndividual createOrGetIndividualP2M(OWLKnowledgeBase kb, edu.stanford.smi.protegex.owl.model.OWLIndividual individualP) { org.mindswap.owl.OWLIndividual individualM; //if it already exists, get it and return it individualM = getIndividualP2M(kb,individualP); if(individualM != null) { return individualM; } //get the M class using the uri of the P class of the P individual OWLClass classM = kb.getClass(URI.create(individualP.getProtegeType().getURI())); //create an M individual of this class individualM = kb.createInstance(classM); //iterate through the properties to copy their values into those of the M individual Iterator propertyIterator = individualP.getRDFProperties().iterator(); while(propertyIterator.hasNext()) { RDFProperty propP = (RDFProperty) propertyIterator.next(); if(propP instanceof edu.stanford.smi.protegex.owl.model.OWLObjectProperty) { org.mindswap.owl.OWLObjectProperty objectPropM = kb.getObjectProperty(URI.create(propP.getURI())); //iterate through the values of this property Iterator valueIterator = individualP.getPropertyValues(propP).iterator(); while(valueIterator.hasNext()) { Object valueP = valueIterator.next(); if(valueP instanceof edu.stanford.smi.protegex.owl.model.OWLIndividual) { //convert the object value to M and add it org.mindswap.owl.OWLIndividual valueM = createOrGetIndividualP2M(kb,(edu.stanford.smi.protegex.owl.model.OWLIndividual) valueP); if(valueM != null) { individualM.addProperty(objectPropM,valueM); } } } } else if(propP instanceof edu.stanford.smi.protegex.owl.model.OWLDatatypeProperty) { org.mindswap.owl.OWLDataProperty dataPropM = kb.getDataProperty(URI.create(propP.getURI())); //iterate through the values of this property Iterator valueIterator = individualP.getPropertyValues(propP).iterator(); while(valueIterator.hasNext()) { //copy the value as a string String valueP = valueIterator.next().toString(); individualM.addProperty(dataPropM,valueP); } } } return individualM; } /** * Looks for the given Mindswap individual in the Protege model. * @param model * @param individualM * @return the P individual */ public static edu.stanford.smi.protegex.owl.model.OWLIndividual getIndividualM2P(OWLModel model, org.mindswap.owl.OWLIndividual individualM) { edu.stanford.smi.protegex.owl.model.OWLIndividual individualP = null; URI individualURI = individualM.getURI(); if(individualURI != null) { individualP = model.getOWLIndividual(model.getResourceNameForURI(individualURI.toString())); } return individualP; } /** * Creates an individual in the Protege model from the given Mindswap individual. * @param model * @param individualM * @param editable * @return the P individual */ public static edu.stanford.smi.protegex.owl.model.OWLIndividual createOrGetIndividualM2P(OWLModel model, org.mindswap.owl.OWLIndividual individualM, boolean editable) { edu.stanford.smi.protegex.owl.model.OWLIndividual individualP = null; //if it already exists, get it and return it individualP = getIndividualM2P(model,individualM); if(individualP != null) { return individualP; } //get the P class using the uri of the M class of the M individual OWLNamedClass classP = model.getOWLNamedClass(model.getResourceNameForURI(individualM.getType().getURI().toString())); //create an P individual of this class individualP = classP.createOWLIndividual(null); individualP.setEditable(editable); //iterate through the properties to copy their values into those of the P individual Iterator propertyIterator = individualM.getProperties().keySet().iterator(); while(propertyIterator.hasNext()) { OWLProperty propM = (OWLProperty) propertyIterator.next(); if(propM instanceof org.mindswap.owl.OWLObjectProperty) { edu.stanford.smi.protegex.owl.model.OWLObjectProperty propP = model.getOWLObjectProperty(model.getResourceNameForURI(propM.getURI().toString())); //iterate through the values of this property Iterator valuesIterator = individualM.getProperties((org.mindswap.owl.OWLObjectProperty) propM).iterator(); while(valuesIterator.hasNext()) { Object valueM = valuesIterator.next(); if(valueM instanceof org.mindswap.owl.OWLIndividual) { edu.stanford.smi.protegex.owl.model.OWLIndividual valueP = createOrGetIndividualM2P(model,(org.mindswap.owl.OWLIndividual) valueM,editable); if(valueP != null) { individualP.addPropertyValue(propP,valueP); } } } } else if(propM instanceof org.mindswap.owl.OWLDataProperty) { edu.stanford.smi.protegex.owl.model.OWLDatatypeProperty propP = model.getOWLDatatypeProperty(model.getResourceNameForURI(propM.getURI().toString())); //iterate through the values of this property Iterator valuesIterator = individualM.getProperties((org.mindswap.owl.OWLDataProperty) propM).iterator(); while(valuesIterator.hasNext()) { Object valueM = valuesIterator.next(); if(valueM instanceof org.mindswap.owl.OWLDataValue) { String literalString = ((org.mindswap.owl.OWLDataValue) valueM).getLexicalValue(); RDFSLiteral literalP = model.createRDFSLiteral(literalString,propP.getRangeDatatype()); individualP.addPropertyValue(propP,literalP); } } } } return individualP; } public static String prefixOfNode(String nodeName) { StringTokenizer tok = new StringTokenizer(nodeName,":"); return tok.nextToken(); } public static String localNameOfNode(String nodeName) { StringTokenizer tok = new StringTokenizer(nodeName,":"); tok.nextToken(); return tok.nextToken(); } }
[ "rrasmo@gmail.com" ]
rrasmo@gmail.com
3ec20a80c7bb0c21ede1cca2b947cf42151cd5ad
eff9edda524093cafcdb9d68a32d782eb56875f8
/app/src/main/java/com/example/android/miwok/FamilyActivity.java
2804aa927655e19f85f7d789ec3c349b310daf9c
[]
no_license
github4priya/MiwokTranslator
eb3c567f0834420cd8f6c68910e73e4d656df2a4
0bdb9eb57895b98a4277349e3ac70eb31f204dd2
refs/heads/master
2023-08-22T12:53:26.403936
2021-07-28T13:18:10
2021-07-28T13:18:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,894
java
package com.example.android.miwok; import androidx.appcompat.app.AppCompatActivity; import android.media.MediaPlayer; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.ListView; import java.util.ArrayList; public class FamilyActivity extends AppCompatActivity { private MediaPlayer mMediaPlayer; private MediaPlayer.OnCompletionListener mCompletionListener = new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mp) { releaseMediaPlayer(); } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.word_list); // Create a list of words final ArrayList<word> words = new ArrayList<word>(); words.add(new word("father", "ape", R.drawable.family_father, R.raw.family_father)); words.add(new word("mother", "eta", R.drawable.family_mother, R.raw.family_mother)); words.add(new word("son", "angsi", R.drawable.family_son, R.raw.family_son)); words.add(new word("daughter", "tune", R.drawable.family_daughter, R.raw.family_daughter)); words.add(new word("older brother", "taachi", R.drawable.family_older_brother, R.raw.family_older_brother)); words.add(new word("younger brother", "chalitti", R.drawable.family_younger_brother, R.raw.family_younger_brother)); words.add(new word("older sister", "tete", R.drawable.family_older_sister, R.raw.family_older_sister)); words.add(new word("younger sister", "kolliti", R.drawable.family_younger_sister, R.raw.family_younger_sister)); words.add(new word("grandmother", "ama", R.drawable.family_grandmother, R.raw.family_grandmother)); words.add(new word("grandfather", "paapa", R.drawable.family_grandfather, R.raw.family_grandfather)); // LinearLayout rootView = (LinearLayout) findViewById(R.id.rootView); // // for(int index=0; index<words.size(); index++) // { // TextView wordView = new TextView(this); // wordView.setText(words.get(index)); // rootView.addView(wordView); // } WordAdapter adapter = new WordAdapter(this, words, R.color.category_family); ListView listView = (ListView) findViewById(R.id.list); listView.setAdapter(adapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { //Toast.makeText(NumbersActivity.this, "List in item", Toast.LENGTH_SHORT).show(); word word = words.get(position); releaseMediaPlayer(); mMediaPlayer = MediaPlayer.create(FamilyActivity.this, word.getAudioResourceId()); mMediaPlayer.start(); mMediaPlayer.setOnCompletionListener(mCompletionListener); } }); } /** * Clean up the media player by releasing its resources. */ @Override protected void onStop(){ super.onStop(); //release the data releaseMediaPlayer(); } private void releaseMediaPlayer() { // If the media player is not null, then it may be currently playing a sound. if (mMediaPlayer != null) { // Regardless of the current state of the media player, release its resources // because we no longer need it. mMediaPlayer.release(); // Set the media player back to null. For our code, we've decided that // setting the media player to null is an easy way to tell that the media player // is not configured to play an audio file at the moment. mMediaPlayer = null; } } }
[ "priya.saps.2000@gmail.com" ]
priya.saps.2000@gmail.com
eaee43681f1b09f47566a886b69a0c0ff11c2cab
63d485007364af3980cb9461c89d11caa7f17c3a
/P01_sandwich-club-starter-code-master/app/src/main/java/com/udacity/sandwichclub/utils/JsonUtils.java
5582baba2bb525fce48bee2c43b9a3c4abf451ba
[]
no_license
marcduby/GoogleNanoAndroid2018
d3b5fd4b4916452186d92f275954fc0ebf9554dc
1b740bbb701389895c9214e41eba733dab76b29b
refs/heads/master
2021-07-16T05:15:19.046518
2018-11-30T19:57:47
2018-11-30T19:57:47
135,076,521
0
0
null
2018-11-30T19:55:48
2018-05-27T19:45:34
Java
UTF-8
Java
false
false
3,466
java
package com.udacity.sandwichclub.utils; import android.util.Log; import com.udacity.sandwichclub.model.Sandwich; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.List; /** * Class to use to parse a sandwich object from json * */ public class JsonUtils { public final static String JSON_NAME_KEY = "name"; public final static String JSON_MAIN_NAME_KEY = "mainName"; public final static String JSON_AKA_KEY = "alsoKnownAs"; public final static String JSON_PLACE_OF_ORIGIN_KEY = "placeOfOrigin"; public final static String JSON_DESCRIPTION_KEY = "description"; public final static String JSON_IMAGE_KEY = "image"; public final static String JSON_INGREDIENTS_KEY = "ingredients"; /** * parse the json into an sandwich object * * @param json the input json string to parse * @return a new sandwich object populated from the string; null if error */ public static Sandwich parseSandwichJson(String json) { // local variables Sandwich sandwich = new Sandwich(); String tempString = null; JSONObject jsonObject = null; JSONArray jsonArray = null; // get the json object try { jsonObject = new JSONObject(json); // set the place of origin tempString = jsonObject.getString(JSON_PLACE_OF_ORIGIN_KEY); sandwich.setPlaceOfOrigin(tempString); // set the description tempString = jsonObject.getString(JSON_DESCRIPTION_KEY); sandwich.setDescription(tempString); // set thre image location tempString = jsonObject.getString(JSON_IMAGE_KEY); sandwich.setImage(tempString); // get the list of ingredients and set them jsonArray = jsonObject.getJSONArray(JSON_INGREDIENTS_KEY); sandwich.setIngredients(getListStringFromJsonArray(jsonArray)); // set the name jsonObject = jsonObject.getJSONObject(JSON_NAME_KEY); tempString = jsonObject.getString(JSON_MAIN_NAME_KEY); sandwich.setMainName(tempString); // set the aka jsonArray = jsonObject.getJSONArray(JSON_AKA_KEY); sandwich.setAlsoKnownAs(getListStringFromJsonArray(jsonArray)); } catch (JSONException exception) { String message = "Got json parsing exception: " + exception.getMessage(); Log.i(JsonUtils.class.getName(), message); return null; } // return return sandwich; } /** * populate an array list from the json string array * * @param jsonArray the json string array * @return a string list * @throws JSONException if there is a json parsing exception */ private static List<String> getListStringFromJsonArray(JSONArray jsonArray) throws JSONException { // local variables List<String> stringList = new ArrayList<String>(); String tempString = null; // parse the json array for (int i = 0; i < jsonArray.length(); i++) { tempString = jsonArray.getString(i); stringList.add(tempString); } // return return stringList; } }
[ "mduby@broadinstitute.org" ]
mduby@broadinstitute.org
9d0690371ca2b30c5c38bfe0d120de845f1eac81
01ebbc94cd4d2c63501c2ebd64b8f757ac4b9544
/backend/gxqpt-standard/gxqpt-modular-api/src/main/java/com/hengyunsoft/platform/modular/api/ModularCategoryAndTagApi.java
ef697e76574b90923b124e7a3eb747e9592edfb5
[]
no_license
KevinAnYuan/gxq
60529e527eadbbe63a8ecbbad6aaa0dea5a61168
9b59f4e82597332a70576f43e3f365c41d5cfbee
refs/heads/main
2023-01-04T19:35:18.615146
2020-10-27T06:24:37
2020-10-27T06:24:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,601
java
//package com.hengyunsoft.platform.modular.api; // //import com.github.pagehelper.PageInfo; //import com.hengyunsoft.base.Result; //import com.hengyunsoft.page.plugins.openapi.OpenApiReq; //import com.hengyunsoft.platform.commons.config.FeignConfiguration; //import com.hengyunsoft.platform.modular.api.hystrix.ModularCategoryAndTagApiHystrix; //import com.hengyunsoft.platform.modular.dto.*; //import org.springframework.cloud.netflix.feign.FeignClient; //import org.springframework.web.bind.annotation.RequestBody; //import org.springframework.web.bind.annotation.RequestMapping; //import org.springframework.web.bind.annotation.RequestMethod; // //import java.util.List; // ///** // * @author wangs // * @createTime 2018-4-5 // */ //@FeignClient(name = "${gxqpt.gate.feign.server:gaxq-gate-server}",configuration = FeignConfiguration.class, path = "/api/modular", fallback = ModularCategoryAndTagApiHystrix.class) //public interface ModularCategoryAndTagApi { // // /** // * 保存模块申请信息 // * @param modularCategoryAndTagApplySaveDTO // * @createTime 2018-4-5 // * @author wangs // */ // @RequestMapping(value = "/mdapply/save", method = RequestMethod.POST) // Result<ModularCategoryAndTagApplyDTO> save(@RequestBody ModularCategoryAndTagApplySaveDTO modularCategoryAndTagApplySaveDTO); // // /** // * 通过模块申请信息 // * @param modularCategoryAndTagApplyDealDTO // * @createTime 2018-4-5 // * @author wangs // */ // @RequestMapping(value = "/mdapply/pass", method = RequestMethod.POST) // Result<Boolean> pass(@RequestBody ModularCategoryAndTagApplyDealDTO modularCategoryAndTagApplyDealDTO); // // /** // * 驳回模块申请信息 // * @param modularCategoryAndTagApplyDealDTO // * @createTime 2018-4-5 // * @author wangs // */ // @RequestMapping(value = "/mdapply/reject", method = RequestMethod.POST) // Result<Boolean> reject(@RequestBody ModularCategoryAndTagApplyDealDTO modularCategoryAndTagApplyDealDTO); // // /** // * 模块申请信息分页查询 // * @param openApiReq // * @createTime 2018-4-5 // * @author wangs // */ // @RequestMapping(value = "/mdapply/pageApply", method = RequestMethod.POST) // Result<PageInfo<ModularCategoryAndTagApplyDTO>> pageApply(@RequestBody OpenApiReq<ModularCategoryAndTagApplyQueryDTO> openApiReq); // // /** // * 模块申请已办事项分页查询 // * @param openApiReq // * @createTime 2018-4-5 // * @author wangs // */ // @RequestMapping(value = "/mdapply/pageDone", method = RequestMethod.POST) // Result<PageInfo<ModularCategoryAndTagApplyDTO>> pageDone(@RequestBody OpenApiReq<ModularCategoryAndTagApplyQueryDTO> openApiReq); // // /** // * 模块申请待办事项分页查询 // * @param openApiReq // * @createTime 2018-4-5 // * @author wangs // */ // @RequestMapping(value = "/mdapply/pageToDo", method = RequestMethod.POST) // Result<PageInfo<ModularCategoryAndTagApplyDTO>> pageToDo(@RequestBody OpenApiReq<ModularCategoryAndTagApplyQueryDTO> openApiReq); // // /** // * 分类列表查询 // * @createTime 2018-4-5 // * @author wangs // */ // @RequestMapping(value = "/category/findCategoryDef", method = RequestMethod.POST) // Result<List<MdCategoryDefDTO>> findCategoryDef(); // // /** // * 标签列表查询 // * @createTime 2018-4-5 // * @author wangs // */ // @RequestMapping(value = "/tag/findTagDef", method = RequestMethod.POST) // Result<List<MdTagDefDTO>> findTagDef(); // //}
[ "470382668@qq.com" ]
470382668@qq.com
489ad0e08318aa53c5abaa67c0e19d18d369ee27
8fa219b3163bf313a08ec22e7fe040e87d89504d
/p005/src/test/java/ru/mironenko/collectionspro/generic/store/UserStoreTest.java
53a3022504f370ad8abad92571246e42a976f523
[ "Apache-2.0" ]
permissive
mironeck/javacourse
558317a38afd61b50e77e675e911e8769d7005f8
3622f990b8fc816a4e659278f6f7d661ea6cac34
refs/heads/master
2020-05-21T17:54:37.510293
2018-06-08T20:05:14
2018-06-08T20:05:14
64,866,172
0
0
null
null
null
null
UTF-8
Java
false
false
1,033
java
package ru.mironenko.collectionspro.generic.store; import org.junit.Test; import javax.jws.soap.SOAPBinding; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.*; /** * Created by nikita on 29.03.2017. */ public class UserStoreTest { @Test public void whenAddElementInStore() { UserStore userStore = new UserStore(5); User one = new User("1"); User two = new User("2"); userStore.add(one); userStore.add(two); userStore.delete("2"); assertThat(userStore.get("1"), is(one)); assertNull(userStore.getList().get(1)); } @Test public void whenUpdateItemReturnNewItem() { UserStore userStore = new UserStore(5); User one = new User("1"); User two = new User("2"); User three = new User("3"); userStore.add(one); userStore.add(two); userStore.update("2", three); assertThat(userStore.get("3"), is(three)); } }
[ "mironec@tut.by" ]
mironec@tut.by
0db526aabb580bdf575dbf17774b330ebd34b3e9
1c76b9b8416f3d75b8ea8c02c7e795e67d17d189
/src/main/java/org/training/issuetracker/command/EditPropCommand.java
90a0abf8716c9550c7b967ea1705046fc189d578
[]
no_license
sergei-doroshenko/it-master
3e220441e7a39625903953843636a254ed345d4f
f4d3c12edd2c7fcd1f68037d501c22cba4f34908
refs/heads/master
2016-09-11T04:49:11.624398
2014-02-25T20:26:19
2014-02-25T20:26:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,764
java
package org.training.issuetracker.command; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.log4j.Logger; import org.training.issuetracker.constants.Constants; import org.training.issuetracker.data.db.PropImplDB.PropertyType; import org.training.issuetracker.domain.Status; import org.training.issuetracker.domain.User; import org.training.issuetracker.domain.DAO.DAOFactory; import org.training.issuetracker.domain.DAO.PropDAO; import org.training.issuetracker.exceptions.DaoException; import org.training.issuetracker.exceptions.ParameterNotFoundException; import org.training.issuetracker.security.PermissionInspector; import org.training.issuetracker.utils.ParameterParser; public class EditPropCommand extends AbstractWebCommand { private final Logger logger = Logger.getLogger("org.training.issuetracker.command"); public EditPropCommand(HttpServletRequest request, HttpServletResponse response) { super(request, response); } @Override public void execute() throws IOException, ServletException { PrintWriter out = getResponse().getWriter(); ParameterParser parser = new ParameterParser(getRequest()); User user = (User) getRequest().getSession().getAttribute(Constants.KEY_USER); PermissionInspector.checkPermission(user, this.getClass().getSimpleName()); PropDAO propDAO = DAOFactory.getDAO(PropDAO.class); try { String oper = parser.getStringParameter(Constants.KEY_OPERATION); String prop = parser.getStringParameter(Constants.KEY_PROP); PropertyType propType = PropertyType.valueOf(prop); long result = 0; switch (oper) { case Constants.OPER_ADD : { String name = parser.getStringParameter(Constants.KEY_NAME); Status status = new Status(); status.setName(name); result = propDAO.insertProp(propType, status); break; } case Constants.OPER_EDIT : { long id = Long.parseLong(parser.getStringParameter(Constants.KEY_ID)); String name = parser.getStringParameter(Constants.KEY_NAME); Status status = new Status(); status.setId(id); status.setName(name); result = propDAO.updateProp(propType, status); break; } case Constants.OPER_DELETE : { long id = Long.parseLong(parser.getStringParameter(Constants.KEY_ID)); result = propDAO.deleteProp(propType, id); break; } default : { break; } } out.print(result); } catch (DaoException | ParameterNotFoundException e) { e.printStackTrace(); out.print(e.getMessage()); getResponse().setStatus(HttpServletResponse.SC_BAD_REQUEST); } finally { out.flush(); out.close(); } } }
[ "6823298@gmail.com" ]
6823298@gmail.com
6b9f4add35be1e33f08758f822681c668b629a6b
0d0c78838e05b0b01d14e7d4e7619a45890403f0
/app/src/main/java/com/prakriti/servicetest/MainActivity.java
0c3e19571f9f9f4d27303b6e1f4f6f1fe7853db7
[]
no_license
prakriti-a/ServiceTestApp
bdc5e6e2ab449abe5b6ada5ac305c7d5d20e2523
3bb26be4d73def83b4f8adf82cc711d6eb167cd6
refs/heads/master
2023-07-14T03:49:48.588752
2021-08-30T17:26:49
2021-08-30T17:26:49
401,429,277
0
0
null
null
null
null
UTF-8
Java
false
false
3,411
java
package com.prakriti.servicetest; import androidx.appcompat.app.AppCompatActivity; import android.content.ComponentName; import android.content.Intent; import android.content.ServiceConnection; import android.os.Bundle; import android.os.IBinder; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.TextView; public class MainActivity extends AppCompatActivity implements View.OnClickListener { private TextView txtThreadCount; private Button btnStartService, btnStopService, btnBindService, btnUnbindService, btnGetRandomNum; private Intent serviceIntent; private MyService myService; private int count = 0; private boolean isServiceBound; private ServiceConnection serviceConnection; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Log.i(getString(R.string.TAG), "MainActivity, Thread ID: " + Thread.currentThread().getId()); txtThreadCount = findViewById(R.id.txtThreadCount); btnStartService = findViewById(R.id.btnStartService); btnStartService.setOnClickListener(this); btnStopService = findViewById(R.id.btnStopService); btnStopService.setOnClickListener(this); btnBindService = findViewById(R.id.btnBindService); btnBindService.setOnClickListener(this); btnUnbindService = findViewById(R.id.btnUnbindService); btnUnbindService.setOnClickListener(this); btnGetRandomNum = findViewById(R.id.btnGetRandomNum); btnGetRandomNum.setOnClickListener(this); serviceIntent = new Intent(getApplicationContext(), MyService.class); // services to be declared in Manifest } @Override public void onClick(View v) { switch (v.getId()) { case R.id.btnStartService: // services are started by explicit intents startService(serviceIntent); break; case R.id.btnStopService: // service must manage its own lifecycle, sys destroys it only for specific cases // stopSelf() or stopService() must be called stopService(serviceIntent); // not usually explicitly called break; case R.id.btnBindService: bindService(); break; case R.id.btnUnbindService: unbindService(); break; case R.id.btnGetRandomNum: getRandomNumber(); break; } } private void bindService() { if(serviceConnection == null) { serviceConnection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName name, IBinder service) { isServiceBound = true; // use IBinder service to initialise myService var MyService.MyServiceBinder myServiceBinder = (MyService.MyServiceBinder) service; myService = myServiceBinder.getService(); } @Override public void onServiceDisconnected(ComponentName name) { isServiceBound = false; } }; } } private void unbindService() { } private void getRandomNumber() { } }
[ "prakriti.a@telxsi.com" ]
prakriti.a@telxsi.com
3dd4c97f391f341e1c825277bc2ed360254e0d10
a105e73d9e671680d62f5cccd32b6cd815864594
/PIDBase/src/com/livechain/pid/query/.svn/text-base/DataQueryMgImpl.java.svn-base
cab5946b66bcaca19e9b0b8151b7cf3887b062fb
[]
no_license
AlenZhai/Work
0f70197fbd7a9dba581f5b0f2e0a9e50d3cf475e
959aaaa32311fa1274763d0cbbfdeacf0abb307d
refs/heads/master
2020-04-04T23:19:00.020575
2018-06-24T07:32:02
2018-06-24T07:32:02
18,752,416
0
1
null
null
null
null
UTF-8
Java
false
false
97
package com.livechain.pid.query; public class DataQueryMgImpl implements DataQuery { }
[ "zhaizhisheng@sina.com" ]
zhaizhisheng@sina.com
03d50b0e9ce4fc0b671130e21fb04b609af359b0
643c91584886bfa35661694838af5712c03e51f6
/app/src/main/java/com/crackbrain/tanveen/bd_prescription/Gynecology_dataProvider.java
5b2130dc72fb2dce074689d71f19661039730061
[]
no_license
alamin00/bD_prescription
425510faad42c1a0f8960caaa0ca15cc23f3832e
95bc3f3c8632c4e65bcc833042d2c2d8432c3df7
refs/heads/master
2020-06-04T07:20:15.939653
2015-09-18T18:45:29
2015-09-18T18:45:29
42,541,338
1
0
null
null
null
null
UTF-8
Java
false
false
1,044
java
package com.crackbrain.tanveen.bd_prescription; import java.util.ArrayList; import java.util.HashMap; import java.util.List; /** * Created by Al on 9/11/2015. */ public class Gynecology_dataProvider { public static HashMap<String, List<String>> getInfo() { HashMap<String, List<String>> diseaseDetails = new HashMap<String, List<String>>(); List<String> Gynecology = new ArrayList<String>(); Gynecology.add("Pregnancy Followup"); Gynecology.add("Pv Bleeding With Pregnancy"); Gynecology.add("B"); Gynecology.add("C"); Gynecology.add("D"); Gynecology.add("E"); Gynecology.add("F"); List<String> G_A = new ArrayList<String>(); G_A.add("k"); G_A.add("l"); G_A.add("m"); G_A.add("n"); G_A.add("o"); G_A.add("p"); G_A.add("q"); G_A.add("r"); G_A.add("s"); G_A.add("T"); diseaseDetails.put("Gynecology",Gynecology); diseaseDetails.put("Gynecoloy_A",G_A); return diseaseDetails; } }
[ "alamintvn@gmail.com" ]
alamintvn@gmail.com
c89cf1c14199b268c27a76aef83bac87fba5c428
34b0f6131fd9730c6fd92a48d9df0e12122513c7
/sdk-manager-web/src/main/java/com/spier/interceptor/EncryptionInterceptor.java
ee22373eda30f40b2d2411ad390f79d95f90d1c4
[]
no_license
KangnamJJ/smsTest
2d0d704fe4a2be2b213e82de29e795d9925ac5c7
b1dfa34f2e3cda2e19a3a115652217e19d4fd621
refs/heads/master
2022-12-17T00:03:57.706617
2019-06-11T02:55:03
2019-06-11T02:55:03
191,279,739
0
0
null
2022-12-06T00:31:42
2019-06-11T02:35:06
Java
UTF-8
Java
false
false
1,236
java
package com.spier.interceptor; import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.ModelAndView; /** * 加解密拦截器 * @author GHB * @version 1.0 * @date 2019.1.24 */ public class EncryptionInterceptor implements HandlerInterceptor { @Override public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handle, Exception ex) throws Exception { // TODO Auto-generated method stub Logger.getAnonymousLogger().log(Level.INFO, "afterCompletion……"); } @Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handle, ModelAndView modelAndView) throws Exception { // TODO Auto-generated method stub Logger.getAnonymousLogger().log(Level.INFO, "postHandle……"); } @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handle) throws Exception { // TODO Auto-generated method stub Logger.getAnonymousLogger().log(Level.INFO, "preHandle……"); return true; } }
[ "cjj827635091@163.com" ]
cjj827635091@163.com
85580e2d1aee9d5c998182fa50fc70a2bc83af95
640f0abf2179553f4073d06907dcbf1634c18419
/myzss/src/main/java/com/jason/myzss/service/authority/impl/RoleServiceImpl.java
822b318812fce498991bd5c53b30b5866809e7a8
[]
no_license
jasonyang8088/jason
355cd59d2e7027dfe143bbb1af8cf87f8f1ace04
0910c0e8d431b752c31bca77eb75e2f23140a6a8
refs/heads/master
2021-01-09T20:40:04.414797
2017-03-02T03:05:49
2017-03-02T03:05:49
62,386,577
0
0
null
null
null
null
UTF-8
Java
false
false
624
java
package com.jason.myzss.service.authority.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.jason.myzss.domain.authority.Role; import com.jason.myzss.repository.jpa.authority.RoleRepository; import com.jason.myzss.service.authority.RoleService; @Service public class RoleServiceImpl implements RoleService{ @Autowired private RoleRepository roleRepository; @Override public List<Role> findAll() { return roleRepository.findAll(); } @Override public void save(Role role) { roleRepository.save(role); } }
[ "yangqijie@xkw.cn" ]
yangqijie@xkw.cn
266cd4da56adb67d8adc9ac37ed5586b2b4e6f4d
840ecd0085b4365b66edd4bba9cc73f127978884
/app/src/main/java/dk/kaloyan/android/startgame/StartView.java
6c74ba8b4fba90b5a80b7dd37460b052d95ef9b8
[]
no_license
kpenov16/MinGalgeleg
3673446356d279e0812b5c7257e9a092dc19fcc0
9c5ef1c9bbced992bc47933bba01352b2b0e4bfb
refs/heads/master
2023-02-14T01:05:25.483181
2021-01-07T19:24:35
2021-01-07T19:24:35
297,284,254
0
0
null
null
null
null
UTF-8
Java
false
false
224
java
package dk.kaloyan.android.startgame; import java.util.Collection; import java.util.List; public interface StartView { void showChooseWordCategories(StartViewModel startViewModel); List<String> getCategories(); }
[ "s133967@student.dtu.dk" ]
s133967@student.dtu.dk
1d60954ae75be109ce92dd07cd9ecf31c20163f1
64dc65a97a375a90dc8639c9a17bb684f66ef31c
/src/skiing/Main.java
d092a79f34b0e3a0eae03fa5b8a74e60aafe99b9
[]
no_license
agungsb/Skiing
5eed1769ee7bbcef6f1c1f2cf28b3e13d4e63dba
07255d7dbecece5bc33b9e8285c076e0b3e977ea
refs/heads/master
2021-01-22T02:52:44.621663
2017-10-24T09:58:22
2017-10-24T09:58:22
41,070,738
0
1
null
null
null
null
UTF-8
Java
false
false
3,243
java
package skiing; import java.util.ArrayList; /** * * @author Agung Surya Bangsa */ public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { Skiing skiing = new Skiing(); skiing.readFile("skiing_map.txt"); String[] exp; int[][] grid; exp = skiing.getText().split("\\s+"); int gridX = Integer.parseInt(exp[0]); int gridY = Integer.parseInt(exp[1]); grid = new int[gridX][gridY]; int[] points = new int[exp.length - 2]; for (int i = 2; i < exp.length; i++) { points[i - 2] = Integer.parseInt(exp[i]); } int flag = 1; int gridXFlag = 0; int gridYFlag = 0; for (int i = flag - 1; i < points.length; i++) { // System.out.println(points[i]); grid[gridXFlag][gridYFlag] = points[i]; // System.out.println("[" + gridXFlag + "]" + "[" + gridYFlag + "] -> " + points[i]); gridYFlag++; if ((flag % gridX) == 0) { // System.out.println("newline"); gridXFlag++; gridYFlag = 0; } flag++; } ArrayList<Integer> steepest = new ArrayList<>(); // Hasil akhir steepest.add(0); int startX = 0, startY = 0; // System.out.println(grid[x][y]); for (int x = 0; x < gridX; x++) { for (int y = 0; y < gridY; y++) { Prediction prediction = new Prediction(grid, x, y, gridX, gridY); // System.out.println("Longest path on ["+x+"]["+y+"] -> " + prediction.getSteepest()); if (steepest.size() < prediction.getSteepest().size()) { steepest = prediction.getSteepest(); startX = x; startY = y; // System.out.println("Longest path on ["+x+"]["+y+"] -> " + steepest + ", Drop: " + (steepest.get(0) - steepest.get(steepest.size() - 1)) + ", Length: " + steepest.size()); } else if (steepest.size() == prediction.getSteepest().size()) { int iiSize = prediction.getSteepest().get(0) - prediction.getSteepest().get(prediction.getSteepest().size() - 1); int steepestSize = steepest.get(0) - steepest.get(steepest.size() - 1); if (steepestSize < iiSize) { steepest = prediction.getSteepest(); startX = x; startY = y; } // System.out.println("Longest path on ["+x+"]["+y+"] -> " + steepest + ", Drop: " + (steepest.get(0) - steepest.get(steepest.size() - 1)) + ", Length: " + steepest.size()); } } } System.out.println(steepest); System.out.println("Starting point: x=" + startX + ", y=" + startY); System.out.println("Length: " + steepest.size()); System.out.println("Drop: " + (steepest.get(0) - steepest.get(steepest.size() - 1))); String email = steepest.size() + "" + (steepest.get(0) - steepest.get(steepest.size() - 1) + "@redmart.com"); System.out.println("E-mail: " + email); } }
[ "agung.surya@gajahmerahterbang.com" ]
agung.surya@gajahmerahterbang.com
c0da080e464216289290024ead1c963fa35839bc
e8e38e258b9fbbb999121090fc5b226512e3155d
/jellyCore/src/main/java/com/jia/jelly/jellycore/utils/base_utils/CountdownUtils.java
1c978a12cd6d9053a79dfc4f9e0fab979b4c28f0
[]
no_license
yuanni168/jell_Smart
f0de953614d1bc8ffffcb8222c8dcf8fb31cee7c
af116661382d218a482418c7a7b94ff969f6ba57
refs/heads/master
2020-03-11T12:36:09.011337
2018-05-08T03:08:39
2018-05-08T03:08:39
130,001,704
0
0
null
null
null
null
UTF-8
Java
false
false
1,428
java
package com.jia.jelly.jellycore.utils.base_utils; import android.os.CountDownTimer; /** * Created by 繁华 on 2017/5/14. * 倒计时工具类 */ public class CountdownUtils { private static CountdownUtils instance = null; private setOnCountDownListener listener = null; private CountDownTimer timer = null; public static synchronized CountdownUtils getInstance(){ if(instance == null){ synchronized (CountdownUtils.class){ if(instance == null) instance = new CountdownUtils(); } } return instance; } public void start(int CountSecond, int IntervalSecond){ timer = new CountDownTimer(CountSecond,IntervalSecond){ @Override public void onTick(long millisUntilFinished) { if(listener != null) listener.onTick((int)(millisUntilFinished / 1000)); } @Override public void onFinish() { if(listener != null) listener.onFinish(); } }; timer.start(); } public void setCountdownListener(setOnCountDownListener listener){ this.listener = listener; } public void stop(){ timer.cancel(); } public interface setOnCountDownListener{ public void onTick(int second); public void onFinish(); } }
[ "906176697@qq.com" ]
906176697@qq.com
20d4172be216ed743b64c24a52b0590208f92957
88006ea48c1ec8de26c13f3f7f06c3e7d333850c
/devops/jvm/src/main/java/com/william/class1/ByteCode03.java
aa2743c79502b9bd65bc916eae1bfa8be37f36d3
[]
no_license
zdpwilliam/notes
db475f4e70b4201329139733439295823160b17b
213628dd6519b1b62ba1905e23e44336c3905c97
refs/heads/master
2023-02-23T08:13:54.486995
2023-02-17T02:53:47
2023-02-17T02:53:47
94,080,966
0
0
null
null
null
null
UTF-8
Java
false
false
244
java
package com.william.class1; import java.io.Serializable; /** * @Package com.william.class1 * @Description: * @Author deepen.zhang * @Date 2021/6/22 15:46 * @Version V1.0 */ public class ByteCode03 implements Serializable, Cloneable { }
[ "zhangdapeng07886@hellobike.com" ]
zhangdapeng07886@hellobike.com
ffc9aafb4556bc7af9a20a23ccdbef36a3a04e01
473b76b1043df2f09214f8c335d4359d3a8151e0
/benchmark/bigclonebenchdata_completed/2494612.java
c26acf7851fb2a05bdf5b96e0517841e79a8eeac
[]
no_license
whatafree/JCoffee
08dc47f79f8369af32e755de01c52d9a8479d44c
fa7194635a5bd48259d325e5b0a190780a53c55f
refs/heads/master
2022-11-16T01:58:04.254688
2020-07-13T20:11:17
2020-07-13T20:11:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,383
java
class c2494612 { public MyHelperClass log; public MyHelperClass jsdir; public MyHelperClass Arrays; public MyHelperClass listJavascript(){ return null; } private void update() throws IOException { MyHelperClass combined = new MyHelperClass(); FileOutputStream out = new FileOutputStream(combined); try { File[] _files =(File[])(Object) listJavascript(); List files =(List)(Object) new ArrayList(Arrays.asList(_files)); files.add(0, new File(jsdir.getAbsolutePath() + "/leemba.js")); files.add(0, new File(jsdir.getAbsolutePath() + "/jquery.min.js")); for (File js :(File[])(Object) (Object[])(Object)files) { FileInputStream fin = null; try { int count = 0; byte buf[] = new byte[16384]; fin = new FileInputStream(js); while ((count =(int)(Object) fin.read(buf)) > 0) out.write(buf, 0, count); } catch (Throwable t) { log.error("Failed to read file: " + js.getAbsolutePath(), t); } finally { if (fin != null) fin.close(); } } } finally { out.close(); } } } // Code below this line has been added to remove errors class MyHelperClass { public MyHelperClass asList(File[] o0){ return null; } public MyHelperClass error(String o0, Throwable o1){ return null; } public MyHelperClass getAbsolutePath(){ return null; }} class IOException extends Exception{ public IOException(String errorMessage) { super(errorMessage); } } class FileOutputStream { FileOutputStream(MyHelperClass o0){} FileOutputStream(){} public MyHelperClass write(byte[] o0, int o1, int o2){ return null; } public MyHelperClass close(){ return null; }} class File { File(String o0){} File(){} public MyHelperClass getAbsolutePath(){ return null; }} class List { public MyHelperClass add(int o0, File o1){ return null; }} class ArrayList { ArrayList(MyHelperClass o0){} ArrayList(){}} class FileInputStream { FileInputStream(File o0){} FileInputStream(){} public MyHelperClass read(byte[] o0){ return null; } public MyHelperClass close(){ return null; }}
[ "piyush16066@iiitd.ac.in" ]
piyush16066@iiitd.ac.in
e8d2239195a4bca47d277312eb96e0dfba77989e
d966b4acfc0a2f843e667208704f27e320923f9c
/sc-provider/sc-xzsd-pc/src/main/java/com/xzsd/pc/driver/service/DriverService.java
80749427cffe1be344d91f10c6edda1e89864f07
[]
no_license
wyx626401082/bookstore
0fbeae993deb9700d06d99edfac544cb2dbb0b9e
991596f0f1b0749805a2af13fa843d85bdff1ff6
refs/heads/master
2022-06-17T18:31:02.371347
2020-05-08T01:08:35
2020-05-08T01:08:35
255,057,967
0
0
null
null
null
null
UTF-8
Java
false
false
4,633
java
package com.xzsd.pc.driver.service; import com.neusoft.core.restful.AppResponse; import com.neusoft.util.StringUtil; import com.xzsd.pc.driver.dao.DriverDao; import com.xzsd.pc.driver.entity.DriverDO; import com.xzsd.pc.driver.entity.DriverVO; import com.xzsd.pc.utils.PasswordUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.Arrays; import java.util.List; import static com.neusoft.core.page.PageUtils.getPageInfo; /** * 司机管理实现类 * @author WangZeBin * @date 2020-04-18 */ @Service public class DriverService { @Resource DriverDao driverDao; /** * 新增司机 * @param driverDO 司机用户信息 * @return * @author WangZeBin * @date 2020-04-18 */ @Transactional(rollbackFor = Exception.class) public AppResponse addDriver(DriverDO driverDO) { //检测账号是否存在 int countUserAcct = driverDao.countUserAcct(driverDO); if(0 != countUserAcct) { return AppResponse.paramError("用户账号已存在,请重新输入!"); } //用户密码加密处理 String pwd = PasswordUtils.generatePassword(driverDO.getDriverPwd()); driverDO.setDriverPwd(pwd); //生成司机用户编号 driverDO.setUserId(StringUtil.getCommonCode(2)); //生成司机信息表编号 driverDO.setDriverId(StringUtil.getCommonCode(2)); driverDO.setIsDeleted(0); //新增司机用户 int countUser = driverDao.addDriver(driverDO); if(0 == countUser) { return AppResponse.bizError("新增司机用户信息失败,请重试!"); } //保存司机信息 int countDriver = driverDao.saveDriverInfo(driverDO); if(0 == countDriver) { return AppResponse.bizError("保存司机信息表失败,请重试!"); } return AppResponse.success("新增司机用户成功!"); } /** * 删除司机 * @param driverId 司机用户编号 * @param userId 当前用户编号 * @return * @author WangZeBin * @date 2020-04-18 */ @Transactional(rollbackFor = Exception.class) public AppResponse deleteDriver(String driverId, String userId) { List<String> listId = Arrays.asList(driverId.split(",")); AppResponse appResponse = AppResponse.success("删除司机用户成功!"); //删除司机 int count = driverDao.deleteDriver(listId,userId); if(0 == count) { appResponse = AppResponse.bizError("删除司机用户失败,请重试!"); } return appResponse; } /** * 修改司机信息 * @param driverDO 司机用户新信息 * @return * @author WangZeBin * @date 2020-04-18 */ @Transactional(rollbackFor = Exception.class) public AppResponse updateDriverById(DriverDO driverDO) { AppResponse appResponse = AppResponse.success("司机信息修改成功"); //检测账号是否存在 int countUserAcct = driverDao.countUserAcct(driverDO); if(0 != countUserAcct) { return AppResponse.success("用户账号已存在,请重新输入!"); } //密码加密处理 String pwd = PasswordUtils.generatePassword(driverDO.getDriverPwd()); driverDO.setDriverPwd(pwd); //修改司机用户信息 int count = driverDao.updateDriverById(driverDO); if(0 == count) { appResponse = AppResponse.versionError("数据有变化,请刷新!"); return appResponse; } return appResponse; } /** * 查询司机信息列表(分页) * @param driverDO 司机信息 * @return * @author WangZeBin * @date 2020-04-18 */ public AppResponse listDriver(DriverDO driverDO) { List<DriverVO> driverVOList = driverDao.listDriverByPage(driverDO); return AppResponse.success("查询司机信息列表成功!", getPageInfo(driverVOList)); } /** * 查询司机详情 * @param driverId 司机编号 * @return * @author WangZeBin * @date 2020-04-18 */ public AppResponse findDriverById(String driverId) { DriverVO driverVO = null; driverVO = driverDao.findDriverById(driverId); if (driverVO == null) { return AppResponse.success("无司机用户详情查询结果"); } return AppResponse.success("查询司机用户详情成功", driverVO); } }
[ "626401082@qq.com" ]
626401082@qq.com
43b71bad08a4b6c0c75edfe277b1e84300f40e84
383857b4202c86679913b8e464a21c762b7096eb
/BestPurchasShoppingMall/pinyougou-parent/pinyougou-sellergoods-service/src/main/java/com/pinyougou/sellergoods/service/impl/SellerServiceImpl.java
211492c04f34a4818b26efad570a6aca2579f34a
[]
no_license
VaguelyCloud/mytest
ab6dac4547200c8aa0c5877317a488e7e96a38c2
17f1fe75284514f8ac645f971f5ab0e3a99548b3
refs/heads/master
2020-03-28T23:27:52.842501
2018-09-18T13:20:14
2018-09-18T13:20:14
149,292,402
0
0
null
null
null
null
UTF-8
Java
false
false
5,527
java
package com.pinyougou.sellergoods.service.impl; import java.util.Date; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import com.alibaba.dubbo.config.annotation.Service; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import com.pinyougou.mapper.TbSellerMapper; import com.pinyougou.pojo.TbSeller; import com.pinyougou.pojo.TbSellerExample; import com.pinyougou.pojo.TbSellerExample.Criteria; import com.pinyougou.sellergoods.service.SellerService; import entity.PageResult; /** * 服务实现层 * @author Administrator * */ @Service public class SellerServiceImpl implements SellerService { @Autowired private TbSellerMapper sellerMapper; /** * 查询全部 */ @Override public List<TbSeller> findAll() { return sellerMapper.selectByExample(null); } /** * 按分页查询 */ @Override public PageResult findPage(int pageNum, int pageSize) { PageHelper.startPage(pageNum, pageSize); Page<TbSeller> page= (Page<TbSeller>) sellerMapper.selectByExample(null); return new PageResult(page.getTotal(), page.getResult()); } /** * 增加 */ @Override public void add(TbSeller seller) { seller.setStatus("0");//状态 seller.setCreateTime(new Date()); sellerMapper.insert(seller); } /** * 修改 */ @Override public void update(TbSeller seller){ sellerMapper.updateByPrimaryKey(seller); } /** * 根据ID获取实体 * @param id * @return */ @Override public TbSeller findOne(String id){ return sellerMapper.selectByPrimaryKey(id); } /** * 批量删除 */ @Override public void delete(String[] ids) { for( String id:ids){ sellerMapper.deleteByPrimaryKey(id); } } @Override public PageResult findPage(TbSeller seller, int pageNum, int pageSize) { PageHelper.startPage(pageNum, pageSize); TbSellerExample example=new TbSellerExample(); Criteria criteria = example.createCriteria(); if(seller!=null){ if(seller.getSellerId()!=null && seller.getSellerId().length()>0){ criteria.andSellerIdLike("%"+seller.getSellerId()+"%"); } if(seller.getName()!=null && seller.getName().length()>0){ criteria.andNameLike("%"+seller.getName()+"%"); } if(seller.getNickName()!=null && seller.getNickName().length()>0){ criteria.andNickNameLike("%"+seller.getNickName()+"%"); } if(seller.getPassword()!=null && seller.getPassword().length()>0){ criteria.andPasswordLike("%"+seller.getPassword()+"%"); } if(seller.getEmail()!=null && seller.getEmail().length()>0){ criteria.andEmailLike("%"+seller.getEmail()+"%"); } if(seller.getMobile()!=null && seller.getMobile().length()>0){ criteria.andMobileLike("%"+seller.getMobile()+"%"); } if(seller.getTelephone()!=null && seller.getTelephone().length()>0){ criteria.andTelephoneLike("%"+seller.getTelephone()+"%"); } if(seller.getStatus()!=null && seller.getStatus().length()>0){ criteria.andStatusLike("%"+seller.getStatus()+"%"); } if(seller.getAddressDetail()!=null && seller.getAddressDetail().length()>0){ criteria.andAddressDetailLike("%"+seller.getAddressDetail()+"%"); } if(seller.getLinkmanName()!=null && seller.getLinkmanName().length()>0){ criteria.andLinkmanNameLike("%"+seller.getLinkmanName()+"%"); } if(seller.getLinkmanQq()!=null && seller.getLinkmanQq().length()>0){ criteria.andLinkmanQqLike("%"+seller.getLinkmanQq()+"%"); } if(seller.getLinkmanMobile()!=null && seller.getLinkmanMobile().length()>0){ criteria.andLinkmanMobileLike("%"+seller.getLinkmanMobile()+"%"); } if(seller.getLinkmanEmail()!=null && seller.getLinkmanEmail().length()>0){ criteria.andLinkmanEmailLike("%"+seller.getLinkmanEmail()+"%"); } if(seller.getLicenseNumber()!=null && seller.getLicenseNumber().length()>0){ criteria.andLicenseNumberLike("%"+seller.getLicenseNumber()+"%"); } if(seller.getTaxNumber()!=null && seller.getTaxNumber().length()>0){ criteria.andTaxNumberLike("%"+seller.getTaxNumber()+"%"); } if(seller.getOrgNumber()!=null && seller.getOrgNumber().length()>0){ criteria.andOrgNumberLike("%"+seller.getOrgNumber()+"%"); } if(seller.getLogoPic()!=null && seller.getLogoPic().length()>0){ criteria.andLogoPicLike("%"+seller.getLogoPic()+"%"); } if(seller.getBrief()!=null && seller.getBrief().length()>0){ criteria.andBriefLike("%"+seller.getBrief()+"%"); } if(seller.getLegalPerson()!=null && seller.getLegalPerson().length()>0){ criteria.andLegalPersonLike("%"+seller.getLegalPerson()+"%"); } if(seller.getLegalPersonCardId()!=null && seller.getLegalPersonCardId().length()>0){ criteria.andLegalPersonCardIdLike("%"+seller.getLegalPersonCardId()+"%"); } if(seller.getBankUser()!=null && seller.getBankUser().length()>0){ criteria.andBankUserLike("%"+seller.getBankUser()+"%"); } if(seller.getBankName()!=null && seller.getBankName().length()>0){ criteria.andBankNameLike("%"+seller.getBankName()+"%"); } } Page<TbSeller> page= (Page<TbSeller>)sellerMapper.selectByExample(example); return new PageResult(page.getTotal(), page.getResult()); } /** * 更新审核状态 * @param sellerId * @param status */ @Override public void updateStatus(String sellerId, String status) { TbSeller seller = sellerMapper.selectByPrimaryKey(sellerId); seller.setStatus(status); sellerMapper.updateByPrimaryKey(seller); } }
[ "zhengsiyang@itcast.cn" ]
zhengsiyang@itcast.cn
0624edc053e66b52f17fbcee40c8885b19778284
17db680875852ab062958337c60810bf817ec528
/src/main/java/com/felix/project/user/service/AdminService.java
eaebef479f78a2adcc81ee3de73acae80def5c05
[]
no_license
DavidYouFN/tourismManagementSystem
dd61b11af57197a1179f04bedac7511f1f58545d
8cdf8af2d88b2f9ac39db36872e90bec785bd31c
refs/heads/master
2022-06-24T13:05:06.411122
2019-06-06T05:19:24
2019-06-06T05:19:24
180,740,282
0
2
null
2022-06-17T02:10:14
2019-04-11T07:39:59
Java
UTF-8
Java
false
false
166
java
package com.felix.project.user.service; public interface AdminService { String getAdminInfo(); String adminLogin(String adminName, String adminPassword); }
[ "1422135791@qq.com" ]
1422135791@qq.com
c11e43cca35b72ccd93dfaa75533a82681d945f2
55bd8d64fa1a3105759e36681f8a9921114ab649
/Demo.java
63e31c804f47aa59cde9f933119e38821aebfbfc
[]
no_license
Vishnu94833/Second
23ba2161050c5bea2729a1fe36ba144fcc45842e
da053c94c6c5426e9476284c1f81d164e60782b7
refs/heads/master
2020-03-27T00:57:44.728111
2019-02-26T07:52:24
2019-02-26T07:52:24
145,670,168
0
0
null
null
null
null
UTF-8
Java
false
false
90
java
class Demo{ public static void main(String[]args){ System.out.println("successful"); } }
[ "vishnu94833@gmail.com" ]
vishnu94833@gmail.com
f1b66f67cf753865820c5a9c0595b6b4465840d3
3b6ba713c7dab1e3a973939a342ba81a1ed0677e
/src/main/java/fantasymanager/serializer/LocalDateDeserializer.java
76390e639c3732d64bf0792e562aeb67ea3580f7
[]
no_license
rpberenguer/bootwildfly
ead71208b5f3fbfb47457adea0e1aba784a92262
9bfff7e625355f8941771c3022049a21224195a9
refs/heads/master
2021-05-09T10:35:32.681743
2019-10-13T14:59:48
2019-10-13T14:59:48
118,969,362
0
0
null
2020-05-21T21:15:07
2018-01-25T21:23:12
Java
UTF-8
Java
false
false
693
java
package fantasymanager.serializer; import java.io.IOException; import java.time.LocalDate; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.deser.std.StdDeserializer; public class LocalDateDeserializer extends StdDeserializer<LocalDate> { /** * */ private static final long serialVersionUID = 7247022937877439255L; protected LocalDateDeserializer() { super(LocalDate.class); } @Override public LocalDate deserialize(JsonParser parser, DeserializationContext context) throws IOException { return LocalDate.parse(parser.readValueAs(String.class)); } }
[ "rgbla@DESKTOP-43I1PS3.home" ]
rgbla@DESKTOP-43I1PS3.home
7e3cb44a755e8ddf7a84ffc6c2caf775d456e352
73267be654cd1fd76cf2cb9ea3a75630d9f58a41
/services/dbss/src/main/java/com/huaweicloud/sdk/dbss/v1/model/DataBase.java
d08f544c749e24a9340073e74c8fd4dbdc29149a
[ "Apache-2.0" ]
permissive
huaweicloud/huaweicloud-sdk-java-v3
51b32a451fac321a0affe2176663fed8a9cd8042
2f8543d0d037b35c2664298ba39a89cc9d8ed9a3
refs/heads/master
2023-08-29T06:50:15.642693
2023-08-24T08:34:48
2023-08-24T08:34:48
262,207,545
91
57
NOASSERTION
2023-09-08T12:24:55
2020-05-08T02:27:00
Java
UTF-8
Java
false
false
9,625
java
package com.huaweicloud.sdk.dbss.v1.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.function.Consumer; /** * 数据库信息 */ public class DataBase { @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(value = "id") private String id; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(value = "name") private String name; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(value = "type") private String type; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(value = "version") private String version; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(value = "charset") private String charset; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(value = "ip") private String ip; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(value = "port") private String port; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(value = "os") private String os; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(value = "status") private String status; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(value = "instance_name") private String instanceName; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(value = "audit_status") private String auditStatus; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(value = "agent_url") private List<String> agentUrl = null; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(value = "db_classification") private String dbClassification; public DataBase withId(String id) { this.id = id; return this; } /** * 数据库ID * @return id */ public String getId() { return id; } public void setId(String id) { this.id = id; } public DataBase withName(String name) { this.name = name; return this; } /** * 数据库名称 * @return name */ public String getName() { return name; } public void setName(String name) { this.name = name; } public DataBase withType(String type) { this.type = type; return this; } /** * 添加的数据库类型: 枚举值:  MYSQL  ORACLE  POSTGRESQL  SQLSERVER  DAMENG  TAURUS  DWS  KINGBASE  GAUSSDBOPENGAUSS  GREENPLUM  HIGHGO  SHENTONG  GBASE8A  GBASE8S  GBASEXDM  MONGODB  DDS * @return type */ public String getType() { return type; } public void setType(String type) { this.type = type; } public DataBase withVersion(String version) { this.version = version; return this; } /** * 数据库版本 * @return version */ public String getVersion() { return version; } public void setVersion(String version) { this.version = version; } public DataBase withCharset(String charset) { this.charset = charset; return this; } /** * 数据库字符集 * @return charset */ public String getCharset() { return charset; } public void setCharset(String charset) { this.charset = charset; } public DataBase withIp(String ip) { this.ip = ip; return this; } /** * 数据库IP * @return ip */ public String getIp() { return ip; } public void setIp(String ip) { this.ip = ip; } public DataBase withPort(String port) { this.port = port; return this; } /** * 数据库端口 * @return port */ public String getPort() { return port; } public void setPort(String port) { this.port = port; } public DataBase withOs(String os) { this.os = os; return this; } /** * 数据库操作系统 * @return os */ public String getOs() { return os; } public void setOs(String os) { this.os = os; } public DataBase withStatus(String status) { this.status = status; return this; } /** * 开启状态(1:开启,0:关闭) * @return status */ public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public DataBase withInstanceName(String instanceName) { this.instanceName = instanceName; return this; } /** * 数据库实例名 * @return instanceName */ public String getInstanceName() { return instanceName; } public void setInstanceName(String instanceName) { this.instanceName = instanceName; } public DataBase withAuditStatus(String auditStatus) { this.auditStatus = auditStatus; return this; } /** * 数据库的运行状态 枚举值:  ACTIVE  SHUTOFF  ERROR * @return auditStatus */ public String getAuditStatus() { return auditStatus; } public void setAuditStatus(String auditStatus) { this.auditStatus = auditStatus; } public DataBase withAgentUrl(List<String> agentUrl) { this.agentUrl = agentUrl; return this; } public DataBase addAgentUrlItem(String agentUrlItem) { if (this.agentUrl == null) { this.agentUrl = new ArrayList<>(); } this.agentUrl.add(agentUrlItem); return this; } public DataBase withAgentUrl(Consumer<List<String>> agentUrlSetter) { if (this.agentUrl == null) { this.agentUrl = new ArrayList<>(); } agentUrlSetter.accept(this.agentUrl); return this; } /** * agent的唯一ID * @return agentUrl */ public List<String> getAgentUrl() { return agentUrl; } public void setAgentUrl(List<String> agentUrl) { this.agentUrl = agentUrl; } public DataBase withDbClassification(String dbClassification) { this.dbClassification = dbClassification; return this; } /** * 数据库分类,取值范围: RDS(表示RDS数据库)和 ECS(自建数据库) * @return dbClassification */ public String getDbClassification() { return dbClassification; } public void setDbClassification(String dbClassification) { this.dbClassification = dbClassification; } @Override public boolean equals(java.lang.Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } DataBase that = (DataBase) obj; return Objects.equals(this.id, that.id) && Objects.equals(this.name, that.name) && Objects.equals(this.type, that.type) && Objects.equals(this.version, that.version) && Objects.equals(this.charset, that.charset) && Objects.equals(this.ip, that.ip) && Objects.equals(this.port, that.port) && Objects.equals(this.os, that.os) && Objects.equals(this.status, that.status) && Objects.equals(this.instanceName, that.instanceName) && Objects.equals(this.auditStatus, that.auditStatus) && Objects.equals(this.agentUrl, that.agentUrl) && Objects.equals(this.dbClassification, that.dbClassification); } @Override public int hashCode() { return Objects.hash(id, name, type, version, charset, ip, port, os, status, instanceName, auditStatus, agentUrl, dbClassification); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class DataBase {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" version: ").append(toIndentedString(version)).append("\n"); sb.append(" charset: ").append(toIndentedString(charset)).append("\n"); sb.append(" ip: ").append(toIndentedString(ip)).append("\n"); sb.append(" port: ").append(toIndentedString(port)).append("\n"); sb.append(" os: ").append(toIndentedString(os)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); sb.append(" instanceName: ").append(toIndentedString(instanceName)).append("\n"); sb.append(" auditStatus: ").append(toIndentedString(auditStatus)).append("\n"); sb.append(" agentUrl: ").append(toIndentedString(agentUrl)).append("\n"); sb.append(" dbClassification: ").append(toIndentedString(dbClassification)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
[ "hwcloudsdk@huawei.com" ]
hwcloudsdk@huawei.com
5415971a67b83fbf13c2ac0dd24ba1aa37d3490e
df5d6e314bdf740534bef31e32a18d5f8949f907
/spring-angular/vegan/src/main/java/org/vegan/Hummus.java
777d042ad28c4c6d5a1b3babcb760c1414770901
[]
no_license
24adithya/spring-angular
0949c0553bf3ff6553c8a75d25e554daab0c4b10
40143728992d61d51f3c7bcf3292aff1cc863803
refs/heads/master
2020-03-19T02:08:15.472800
2018-06-22T14:52:01
2018-06-22T14:52:01
135,602,267
0
0
null
null
null
null
UTF-8
Java
false
false
286
java
package org.vegan; import org.vegan.services.VeganService; public class Hummus extends Lebanese{ @Override String name() { return "I am Hummus";//Remove hard coding and internationalize } @Override String offering() { return VeganService.Offerings.HUMMUS.toString(); } }
[ "24adithya@gmail.com" ]
24adithya@gmail.com
7d77dc9fa2a5b935c325a288f961880f04edc759
6d4b0129b24d2dcc7e8baed5d9e28d98b70fc9ca
/src/main/java/com/mycompany/bookstore/service/BookSeriesService.java
ac8f8ab9216581b41e3509e7ab67d6ac29e883ae
[]
no_license
AndiELezi/Bookstore
96917b8c0d0368eced13282539ed1e3276e7fa28
45c779cfb29a9a6b6b69338ecf3e98a2f6816a77
refs/heads/master
2023-07-31T06:50:39.433827
2021-09-30T14:46:29
2021-09-30T14:46:29
404,277,842
0
0
null
null
null
null
UTF-8
Java
false
false
959
java
package com.mycompany.bookstore.service; import com.mycompany.bookstore.repository.BookSeriesRepository; import com.mycompany.bookstore.service.dto.BookSeriesDTO; import com.mycompany.bookstore.web.rest.vm.BooksOnCategoryVM; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import java.util.Optional; @Service public class BookSeriesService { final private BookSeriesRepository bookSeriesRepository; public BookSeriesService(BookSeriesRepository bookSeriesRepository) { this.bookSeriesRepository = bookSeriesRepository; } public Page<BookSeriesDTO> getAllBookSeries(Pageable pageable) { return bookSeriesRepository.findAll(pageable).map(BookSeriesDTO::new); } public Optional<BookSeriesDTO> findBookSeries(Long bookSeriesId) { return bookSeriesRepository.findById(bookSeriesId).map(BookSeriesDTO::new); } }
[ "andielezi52@gmail.com" ]
andielezi52@gmail.com
f90a549a9eb0aabe10b31f238589e2adf159e10f
0af8b92686a58eb0b64e319b22411432aca7a8f3
/single-large-project/src/main/java/org/gradle/test/performancenull_460/Productionnull_45987.java
482334e634b8861958fb93ecfd57db098571287c
[]
no_license
gradle/performance-comparisons
b0d38db37c326e0ce271abebdb3c91769b860799
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
refs/heads/master
2023-08-14T19:24:39.164276
2022-11-24T05:18:33
2022-11-24T05:18:33
80,121,268
17
15
null
2022-09-30T08:04:35
2017-01-26T14:25:33
null
UTF-8
Java
false
false
588
java
package org.gradle.test.performancenull_460; public class Productionnull_45987 { private final String property; public Productionnull_45987(String param) { this.property = param; } public String getProperty() { return property; } private String prop0; public String getProp0() { return prop0; } public void setProp0(String value) { prop0 = value; } private String prop1; public String getProp1() { return prop1; } public void setProp1(String value) { prop1 = value; } }
[ "cedric.champeau@gmail.com" ]
cedric.champeau@gmail.com
1b6c48185e2869bda1b5b539b86d7c481f8d378d
9544c46b090ce560d500d3f3e92207c37aa152a9
/src/main/java/com/github/novotnyr/idea/jwt/ui/UiUtils.java
93acdeb228abbaa846e74b870624a3be66990a0b
[]
no_license
espartero/jwt-intellij-plugin
9158014eb75fbda8aa7d8aa51daa74f62852af12
f4bc607439c2774df6c695a6fa2f105f2520de05
refs/heads/master
2020-08-18T09:47:27.825827
2019-04-27T22:03:38
2019-04-27T22:03:38
215,775,852
0
0
null
2019-10-17T11:28:29
2019-10-17T11:28:29
null
UTF-8
Java
false
false
1,088
java
package com.github.novotnyr.idea.jwt.ui; import com.intellij.ui.PopupMenuListenerAdapter; import javax.swing.JPopupMenu; import javax.swing.JTable; import javax.swing.SwingUtilities; import javax.swing.event.PopupMenuEvent; import java.awt.Point; public class UiUtils { public static void configureTableRowSelectionOnPopup(final JPopupMenu popupMenu) { popupMenu.addPopupMenuListener(new PopupMenuListenerAdapter() { @Override public void popupMenuWillBecomeVisible(final PopupMenuEvent e) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { JTable table = (JTable) popupMenu.getInvoker(); int rowAtPoint = table.rowAtPoint(SwingUtilities.convertPoint(popupMenu, new Point(0, 0), table)); if (rowAtPoint > -1) { table.setRowSelectionInterval(rowAtPoint, rowAtPoint); } } }); } }); } }
[ "novotnr0@gmail.com" ]
novotnr0@gmail.com
193baf4a3bdc2808870294b910fb3334ba9d9816
647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4
/com.tencent.minihd.qq/assets/exlibs.1.jar/classes.jar/com/tencent/mobileqq/mp/mobileqq_mp$FollowRequest.java
ed20b1cb40a3f80c9369a3bafde2911cbb132a8f
[]
no_license
tsuzcx/qq_apk
0d5e792c3c7351ab781957bac465c55c505caf61
afe46ef5640d0ba6850cdefd3c11badbd725a3f6
refs/heads/main
2022-07-02T10:32:11.651957
2022-02-01T12:41:38
2022-02-01T12:41:38
453,860,108
36
9
null
2022-01-31T09:46:26
2022-01-31T02:43:22
Java
UTF-8
Java
false
false
1,340
java
package com.tencent.mobileqq.mp; import com.tencent.mobileqq.pb.MessageMicro; import com.tencent.mobileqq.pb.MessageMicro.FieldMap; import com.tencent.mobileqq.pb.PBField; import com.tencent.mobileqq.pb.PBStringField; import com.tencent.mobileqq.pb.PBUInt32Field; import com.tencent.mobileqq.pb.PBUInt64Field; public final class mobileqq_mp$FollowRequest extends MessageMicro { public static final int ACCOUNT_TYPE_FIELD_NUMBER = 3; public static final int EXT_FIELD_NUMBER = 2; public static final int LUIN_FIELD_NUMBER = 4; public static final int UIN_FIELD_NUMBER = 1; static final MessageMicro.FieldMap __fieldMap__ = MessageMicro.initFieldMap(new int[] { 8, 18, 24, 32 }, new String[] { "uin", "ext", "account_type", "luin" }, new Object[] { Integer.valueOf(0), "", Integer.valueOf(0), Long.valueOf(0L) }, FollowRequest.class); public final PBUInt32Field account_type = PBField.initUInt32(0); public final PBStringField ext = PBField.initString(""); public final PBUInt64Field luin = PBField.initUInt64(0L); public final PBUInt32Field uin = PBField.initUInt32(0); } /* Location: L:\local\mybackup\temp\qq_apk\com.tencent.minihd.qq\assets\exlibs.1.jar\classes.jar * Qualified Name: com.tencent.mobileqq.mp.mobileqq_mp.FollowRequest * JD-Core Version: 0.7.0.1 */
[ "98632993+tsuzcx@users.noreply.github.com" ]
98632993+tsuzcx@users.noreply.github.com
aa810705533d0f8b57d0af2a8e89433e14b52834
e9d3757388059ccd387ce2eb99320696bcca8ce0
/IntroProgramming/numsOfBGtext.java
6d570bd1da55f47461e95ddfe81c91274ee532fc
[ "MIT" ]
permissive
Mitaka206/Programming-Basics-Java
9563a954997d5b36e1b6083dd326129e857d004b
3cc4bc664e15ebd25e430937a588bbea92720886
refs/heads/master
2021-01-11T20:59:21.190887
2017-01-17T12:24:19
2017-01-17T12:24:19
79,224,406
1
0
null
null
null
null
UTF-8
Java
false
false
1,339
java
package mitaka206.IntroProgramming; import java.util.Scanner; /** * Created by Mitaka206 on 15.11.2016 г.. */ public class numsOfBGtext { //Напишете програма, която за дадена цифра (0-9), зададена като вход, извежда името на цифрата на български език public static void main(String[] args) { Scanner console = new Scanner(System.in); int a = Integer.parseInt(console.nextLine()); switch (a){ case 0: System.out.println("нула");break; case 1: System.out.println("едно");break; case 2: System.out.println("две");break; case 3: System.out.println("три");break; case 4: System.out.println("четири");break; case 5: System.out.println("пет");break; case 6: System.out.println("шест");break; case 7: System.out.println("седем");break; case 8: System.out.println("осем");break; case 9: System.out.println("девет");break; default: System.out.println("Error"); } } }
[ "mitaka206@gmail.com" ]
mitaka206@gmail.com
519ae2005696f602ed10b931e2680a4d4d8be78f
4effdb958a60a291bd8090d0e50acda5c7d636bd
/src/com/senzit/evidencer/server/model/LandEPath.java
b6c57c82f7effdb0c0d274d2116f38c9368cb9eb
[]
no_license
senzitgit/EviServer_2.4
c9582a06fd2b8d9c3b62fe11807b6fdc029f027d
d6ea5254c01b73d79c9000837f328524fde627db
refs/heads/master
2021-05-06T04:59:35.648737
2018-01-17T18:12:37
2018-01-17T18:12:37
115,032,311
0
0
null
null
null
null
UTF-8
Java
false
false
518
java
package com.senzit.evidencer.server.model; public class LandEPath { private String userName; private User user; private String lePath; public LandEPath(){} public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } public String getLePath() { return lePath; } public void setLePath(String lePath) { this.lePath = lePath; } }
[ "34739394+senzitgit@users.noreply.github.com" ]
34739394+senzitgit@users.noreply.github.com
319411d4cfdff314274c4b012bae58336117626b
3bdece59ba4502f5308eee7b8f1a7926fcbf2cde
/src/com/example/socialapp/MainActivity.java
d5aae4b402782617519d5c0134872d170e0b9924
[]
no_license
chaurasiadilip/SocialApp
818f32399e023e5206801769053854d3a3906544
72e74da72d6ac392beb5b906b0bc21c0a7728bee
refs/heads/master
2016-09-11T07:10:59.456690
2015-02-19T09:35:20
2015-02-19T09:35:20
31,008,416
0
0
null
null
null
null
UTF-8
Java
false
false
340
java
package com.example.socialapp; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
[ "chaurasia.dilip@gmail.com" ]
chaurasia.dilip@gmail.com
2c3d8efa6fefae94454b5389e360b8adf551d3ab
f20e1ecf2d473e93805b7967a771be0c57b4d836
/src/main/java/task16_transportation_lambda/transportation/repo/impl/TransportationCollectionRepoImpl.java
3a9a9f7328bed43a1d5095550d3cd9ad489b9cfb
[]
no_license
Tadashimi/EpamTasks
154fee6f1e322a4d4326678e45af3c611151c7b1
b3c9774ea9273614b5504ffc4085ed9493643832
refs/heads/master
2023-07-20T01:51:44.709725
2023-04-09T19:37:34
2023-04-09T19:37:34
225,715,328
1
0
null
2023-07-07T21:58:36
2019-12-03T21:03:51
Java
UTF-8
Java
false
false
1,646
java
package task16_transportation_lambda.transportation.repo.impl; import task16_transportation_lambda.storage.IdGenerator; import task16_transportation_lambda.transportation.domain.Transportation; import task16_transportation_lambda.transportation.repo.TransportationRepo; import java.util.Iterator; import java.util.List; import static task16_transportation_lambda.storage.Storage.transportationCollection; public class TransportationCollectionRepoImpl implements TransportationRepo { @Override public void save(Transportation transportation) { transportation.setId(IdGenerator.generateId()); transportationCollection.add(transportation); } @Override public Transportation findById(Long id) { for (Transportation transportation : transportationCollection) { if (transportation.getId().equals(id)) { return transportation; } } return null; } @Override public List<Transportation> getAll() { return transportationCollection; } @Override public boolean update(Transportation transportation) { return true; } @Override public boolean deleteById(Long id) { boolean deleted = false; Iterator<Transportation> iter = transportationCollection.iterator(); while (iter.hasNext()) { if (iter.next().getId().equals(id)) { iter.remove(); deleted = true; break; } } return deleted; } @Override public int countAll() { return transportationCollection.size(); } }
[ "tadashimi777@gmail.com" ]
tadashimi777@gmail.com
2bb1db6ffec5eeed2b4cf93b05710d62c50f07a9
13645b1fa88f71e76d378ce642fe4d9ef28cf02c
/RNA-RNA/app/src/main/java/com/example/sushil/androidmaterialtest/LoginActivity.java
025fb2a247bb80b02ff6d34fe0a67800fccf47ab
[]
no_license
Najaf-Khan/MobileApplicationsCameraAppSubmitted
6061b7a32e45381de08264a05bb9d871d387f8a9
524b4dd93e2ef2c3e2457fad61d876fdbadb043e
refs/heads/master
2021-09-02T22:31:13.688351
2018-01-03T23:27:29
2018-01-03T23:27:29
116,191,623
0
0
null
null
null
null
UTF-8
Java
false
false
2,241
java
package com.example.sushil.androidmaterialtest; import android.app.FragmentTransaction; import android.content.Intent; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.ImageView; import android.widget.Toast; public class LoginActivity extends ActionBarActivity implements View.OnClickListener { private ImageView imgView1; private ImageView imgView2; private Toolbar toolbar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); toolbar = (Toolbar) findViewById(R.id.app_loginbar); toolbar.setLogo(R.drawable.ic_action_plant); setSupportActionBar(toolbar); imgView1 = (ImageView) findViewById(R.id.imageView1); imgView2 = (ImageView) findViewById(R.id.imageView2); imgView1.setOnClickListener(this); imgView2.setOnClickListener(this); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_login, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.info) { return true; } return super.onOptionsItemSelected(item); } @Override public void onClick(View v) { if (v.getId() == R.id.imageView1) { startActivity(new Intent(this, MainActivity.class)); } else { CustomDialogClassSecond customDialogClassSecond = new CustomDialogClassSecond(this); customDialogClassSecond.show(); } } }
[ "najaf2014@namal.edu.pk" ]
najaf2014@namal.edu.pk
7f439fa8aef662900c9814330140cf3e04b0827e
41a6ceaa6e53a4bb667b6c6f77087711de4e9f49
/common/src/main/java/com/android/szh/common/abslistview/adapter/CommonAdapter.java
35f0f09e7bbd28468aa6aa20a006f52b5baf4311
[]
no_license
ZhongHaoHero666/AgileFrameModelForAndroid
1b2512591e2f83323cb0087346b2d2a31354de8b
54d30b0c7b9ab04d4c26c135c4d39e2a151d6ff8
refs/heads/master
2020-03-17T16:15:49.573714
2018-12-10T11:20:18
2018-12-10T11:20:18
133,742,426
25
1
null
null
null
null
UTF-8
Java
false
false
3,502
java
package com.android.szh.common.abslistview.adapter; import android.content.Context; import android.content.res.Resources; import android.view.View; import android.view.ViewGroup; import android.widget.AbsListView; import android.widget.BaseAdapter; import com.android.szh.common.abslistview.holder.AbsListViewHolder; import com.android.szh.common.adapter.IAdapter; import java.util.ArrayList; import java.util.Collection; import java.util.List; /** * {@link AbsListView}适配器 * Created by sunzhonghao on 2018/5/16. * desc: AbsListView 适配器 */ public abstract class CommonAdapter<DataType> extends BaseAdapter implements IAdapter<DataType> { /** * 上下文 */ private Context mContext; /** * 数据源 */ private final List<DataType> mDatas = new ArrayList<>(); public CommonAdapter(Collection<DataType> datas) { if (datas == null) { datas = new ArrayList<>(0); } this.mDatas.addAll(datas); } @Override public Context getContext() { return mContext; } @Override public Resources getResources() { return mContext.getResources(); } @Override public List<DataType> getDatas() { return mDatas; } @Override public void refresh(List<DataType> datas) { if (datas == null) { datas = new ArrayList<>(0); } this.mDatas.clear(); this.mDatas.addAll(datas); this.notifyDataSetChanged(); } @Override public void add(DataType data) { this.mDatas.add(data); this.notifyDataSetChanged(); } @Override public void add(int position, DataType data) { this.mDatas.add(position, data); this.notifyDataSetChanged(); } @Override public void addAll(List<DataType> datas) { if (datas == null || datas.isEmpty()) { return; } this.mDatas.addAll(datas); this.notifyDataSetChanged(); } @Override public void remove(int position) { this.mDatas.remove(position); this.notifyDataSetChanged(); } @Override public void remove(DataType data) { this.mDatas.remove(data); this.notifyDataSetChanged(); } @Override public void removeAll(List<DataType> datas) { if (datas == null || datas.size() == 0) { return; } this.mDatas.removeAll(datas); this.notifyDataSetChanged(); } @Override public void clear() { this.mDatas.clear(); this.notifyDataSetChanged(); } @Override public int getCount() { return mDatas == null ? 0 : mDatas.size(); } @Override public DataType getItem(int position) { return mDatas == null ? null : mDatas.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { if (mContext == null) { mContext = parent.getContext(); } int itemLayoutID = getItemLayoutID(getItemViewType(position)); AbsListViewHolder viewHolder = AbsListViewHolder.getViewHolder(convertView, parent, itemLayoutID); convert(viewHolder.getViewHolder(), getItem(position), position); return viewHolder.getConvertView(); } @Override public int getItemLayoutID(int viewType) { return getItemLayoutID(); } }
[ "sunzhonghao@9188.com" ]
sunzhonghao@9188.com
0a7ee6da6cce396d2ab2187949738341ae56b9e9
640618a5b338a19418e59def113346ac77f780f8
/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBStateBackend.java
794e22160a25e8dae716d909cdd0d3c806fc3d31
[ "Apache-2.0", "CC-BY-2.5", "LGPL-2.1-only", "LicenseRef-scancode-other-permissive", "GPL-2.0-only", "GCC-exception-3.1", "LicenseRef-scancode-public-domain", "BSD-3-Clause", "Python-2.0", "EPL-1.0", "MPL-2.0-no-copyleft-exception", "LicenseRef-scancode-proprietary-license", "LicenseRef-scanc...
permissive
zlx92/flink-self
04a1b1b9ef5e9d8367c1209dd7123f660b030ebf
3651f0f283973f80d2b1d64ac3ee0694f0f0f818
refs/heads/master
2022-10-10T04:57:11.051721
2020-03-03T14:04:11
2020-03-03T14:04:11
244,643,526
0
0
Apache-2.0
2022-10-06T09:53:17
2020-03-03T13:29:59
Java
UTF-8
Java
false
false
28,949
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.flink.contrib.streaming.state; import org.apache.flink.annotation.VisibleForTesting; import org.apache.flink.api.common.JobID; import org.apache.flink.api.common.typeutils.TypeSerializer; import org.apache.flink.configuration.CheckpointingOptions; import org.apache.flink.configuration.Configuration; import org.apache.flink.configuration.IllegalConfigurationException; import org.apache.flink.core.fs.Path; import org.apache.flink.metrics.MetricGroup; import org.apache.flink.runtime.execution.Environment; import org.apache.flink.runtime.query.TaskKvStateRegistry; import org.apache.flink.runtime.state.AbstractKeyedStateBackend; import org.apache.flink.runtime.state.AbstractStateBackend; import org.apache.flink.runtime.state.CheckpointStorage; import org.apache.flink.runtime.state.CompletedCheckpointStorageLocation; import org.apache.flink.runtime.state.ConfigurableStateBackend; import org.apache.flink.runtime.state.DefaultOperatorStateBackend; import org.apache.flink.runtime.state.KeyGroupRange; import org.apache.flink.runtime.state.LocalRecoveryConfig; import org.apache.flink.runtime.state.OperatorStateBackend; import org.apache.flink.runtime.state.StateBackend; import org.apache.flink.runtime.state.filesystem.FsStateBackend; import org.apache.flink.runtime.state.ttl.TtlTimeProvider; import org.apache.flink.util.AbstractID; import org.apache.flink.util.TernaryBoolean; import org.rocksdb.ColumnFamilyOptions; import org.rocksdb.DBOptions; import org.rocksdb.NativeLibraryLoader; import org.rocksdb.RocksDB; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.annotation.Nullable; import java.io.File; import java.io.IOException; import java.lang.reflect.Field; import java.net.URI; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Random; import java.util.UUID; import static org.apache.flink.contrib.streaming.state.RocksDBOptions.TIMER_SERVICE_FACTORY; import static org.apache.flink.util.Preconditions.checkNotNull; /** * A State Backend that stores its state in {@code RocksDB}. This state backend can * store very large state that exceeds memory and spills to disk. * * <p>All key/value state (including windows) is stored in the key/value index of RocksDB. * For persistence against loss of machines, checkpoints take a snapshot of the * RocksDB database, and persist that snapshot in a file system (by default) or * another configurable state backend. * * <p>The behavior of the RocksDB instances can be parametrized by setting RocksDB Options * using the methods {@link #setPredefinedOptions(PredefinedOptions)} and * {@link #setOptions(OptionsFactory)}. */ public class RocksDBStateBackend extends AbstractStateBackend implements ConfigurableStateBackend { /** * The options to chose for the type of priority queue state. */ public enum PriorityQueueStateType { HEAP, ROCKSDB } private static final long serialVersionUID = 1L; private static final Logger LOG = LoggerFactory.getLogger(RocksDBStateBackend.class); /** The number of (re)tries for loading the RocksDB JNI library. */ private static final int ROCKSDB_LIB_LOADING_ATTEMPTS = 3; /** Flag whether the native library has been loaded. */ private static boolean rocksDbInitialized = false; // ------------------------------------------------------------------------ // -- configuration values, set in the application / configuration /** The state backend that we use for creating checkpoint streams. */ private final StateBackend checkpointStreamBackend; /** Base paths for RocksDB directory, as configured. * Null if not yet set, in which case the configuration values will be used. * The configuration defaults to the TaskManager's temp directories. */ @Nullable private File[] localRocksDbDirectories; /** The pre-configured option settings. */ private PredefinedOptions predefinedOptions = PredefinedOptions.DEFAULT; /** The options factory to create the RocksDB options in the cluster. */ @Nullable private OptionsFactory optionsFactory; /** This determines if incremental checkpointing is enabled. */ private final TernaryBoolean enableIncrementalCheckpointing; /** This determines the type of priority queue state. */ private final PriorityQueueStateType priorityQueueStateType; /** The default rocksdb metrics options. */ private final RocksDBNativeMetricOptions defaultMetricOptions; // -- runtime values, set on TaskManager when initializing / using the backend /** Base paths for RocksDB directory, as initialized. */ private transient File[] initializedDbBasePaths; /** JobID for uniquifying backup paths. */ private transient JobID jobId; /** The index of the next directory to be used from {@link #initializedDbBasePaths}.*/ private transient int nextDirectory; /** Whether we already lazily initialized our local storage directories. */ private transient boolean isInitialized; // ------------------------------------------------------------------------ /** * Creates a new {@code RocksDBStateBackend} that stores its checkpoint data in the * file system and location defined by the given URI. * * <p>A state backend that stores checkpoints in HDFS or S3 must specify the file system * host and port in the URI, or have the Hadoop configuration that describes the file system * (host / high-availability group / possibly credentials) either referenced from the Flink * config, or included in the classpath. * * @param checkpointDataUri The URI describing the filesystem and path to the checkpoint data directory. * @throws IOException Thrown, if no file system can be found for the scheme in the URI. */ public RocksDBStateBackend(String checkpointDataUri) throws IOException { this(new Path(checkpointDataUri).toUri()); } /** * Creates a new {@code RocksDBStateBackend} that stores its checkpoint data in the * file system and location defined by the given URI. * * <p>A state backend that stores checkpoints in HDFS or S3 must specify the file system * host and port in the URI, or have the Hadoop configuration that describes the file system * (host / high-availability group / possibly credentials) either referenced from the Flink * config, or included in the classpath. * * @param checkpointDataUri The URI describing the filesystem and path to the checkpoint data directory. * @param enableIncrementalCheckpointing True if incremental checkpointing is enabled. * @throws IOException Thrown, if no file system can be found for the scheme in the URI. */ public RocksDBStateBackend(String checkpointDataUri, boolean enableIncrementalCheckpointing) throws IOException { this(new Path(checkpointDataUri).toUri(), enableIncrementalCheckpointing); } /** * Creates a new {@code RocksDBStateBackend} that stores its checkpoint data in the * file system and location defined by the given URI. * * <p>A state backend that stores checkpoints in HDFS or S3 must specify the file system * host and port in the URI, or have the Hadoop configuration that describes the file system * (host / high-availability group / possibly credentials) either referenced from the Flink * config, or included in the classpath. * * @param checkpointDataUri The URI describing the filesystem and path to the checkpoint data directory. * @throws IOException Thrown, if no file system can be found for the scheme in the URI. */ @SuppressWarnings("deprecation") public RocksDBStateBackend(URI checkpointDataUri) throws IOException { this(new FsStateBackend(checkpointDataUri)); } /** * Creates a new {@code RocksDBStateBackend} that stores its checkpoint data in the * file system and location defined by the given URI. * * <p>A state backend that stores checkpoints in HDFS or S3 must specify the file system * host and port in the URI, or have the Hadoop configuration that describes the file system * (host / high-availability group / possibly credentials) either referenced from the Flink * config, or included in the classpath. * * @param checkpointDataUri The URI describing the filesystem and path to the checkpoint data directory. * @param enableIncrementalCheckpointing True if incremental checkpointing is enabled. * @throws IOException Thrown, if no file system can be found for the scheme in the URI. */ @SuppressWarnings("deprecation") public RocksDBStateBackend(URI checkpointDataUri, boolean enableIncrementalCheckpointing) throws IOException { this(new FsStateBackend(checkpointDataUri), enableIncrementalCheckpointing); } /** * Creates a new {@code RocksDBStateBackend} that uses the given state backend to store its * checkpoint data streams. Typically, one would supply a filesystem or database state backend * here where the snapshots from RocksDB would be stored. * * <p>The snapshots of the RocksDB state will be stored using the given backend's * {@link StateBackend#createCheckpointStorage(JobID)}. * * @param checkpointStreamBackend The backend write the checkpoint streams to. */ public RocksDBStateBackend(StateBackend checkpointStreamBackend) { this(checkpointStreamBackend, TernaryBoolean.UNDEFINED); } /** * Creates a new {@code RocksDBStateBackend} that uses the given state backend to store its * checkpoint data streams. Typically, one would supply a filesystem or database state backend * here where the snapshots from RocksDB would be stored. * * <p>The snapshots of the RocksDB state will be stored using the given backend's * {@link StateBackend#createCheckpointStorage(JobID)}. * * @param checkpointStreamBackend The backend write the checkpoint streams to. * @param enableIncrementalCheckpointing True if incremental checkpointing is enabled. */ public RocksDBStateBackend(StateBackend checkpointStreamBackend, TernaryBoolean enableIncrementalCheckpointing) { this.checkpointStreamBackend = checkNotNull(checkpointStreamBackend); this.enableIncrementalCheckpointing = enableIncrementalCheckpointing; // for now, we use still the heap-based implementation as default this.priorityQueueStateType = PriorityQueueStateType.HEAP; this.defaultMetricOptions = new RocksDBNativeMetricOptions(); } /** * @deprecated Use {@link #RocksDBStateBackend(StateBackend)} instead. */ @Deprecated public RocksDBStateBackend(AbstractStateBackend checkpointStreamBackend) { this(checkpointStreamBackend, TernaryBoolean.UNDEFINED); } /** * @deprecated Use {@link #RocksDBStateBackend(StateBackend, TernaryBoolean)} instead. */ @Deprecated public RocksDBStateBackend(AbstractStateBackend checkpointStreamBackend, boolean enableIncrementalCheckpointing) { this(checkpointStreamBackend, TernaryBoolean.fromBoolean(enableIncrementalCheckpointing)); } /** * Private constructor that creates a re-configured copy of the state backend. * * @param original The state backend to re-configure. * @param config The configuration. */ private RocksDBStateBackend(RocksDBStateBackend original, Configuration config) { // reconfigure the state backend backing the streams final StateBackend originalStreamBackend = original.checkpointStreamBackend; this.checkpointStreamBackend = originalStreamBackend instanceof ConfigurableStateBackend ? ((ConfigurableStateBackend) originalStreamBackend).configure(config) : originalStreamBackend; // configure incremental checkpoints this.enableIncrementalCheckpointing = original.enableIncrementalCheckpointing.resolveUndefined( config.getBoolean(CheckpointingOptions.INCREMENTAL_CHECKPOINTS)); final String priorityQueueTypeString = config.getString(TIMER_SERVICE_FACTORY); this.priorityQueueStateType = priorityQueueTypeString.length() > 0 ? PriorityQueueStateType.valueOf(priorityQueueTypeString.toUpperCase()) : original.priorityQueueStateType; // configure local directories if (original.localRocksDbDirectories != null) { this.localRocksDbDirectories = original.localRocksDbDirectories; } else { final String rocksdbLocalPaths = config.getString(RocksDBOptions.LOCAL_DIRECTORIES); if (rocksdbLocalPaths != null) { String[] directories = rocksdbLocalPaths.split(",|" + File.pathSeparator); try { setDbStoragePaths(directories); } catch (IllegalArgumentException e) { throw new IllegalConfigurationException("Invalid configuration for RocksDB state " + "backend's local storage directories: " + e.getMessage(), e); } } } // configure metric options this.defaultMetricOptions = RocksDBNativeMetricOptions.fromConfig(config); // copy remaining settings this.predefinedOptions = original.predefinedOptions; this.optionsFactory = original.optionsFactory; } // ------------------------------------------------------------------------ // Reconfiguration // ------------------------------------------------------------------------ /** * Creates a copy of this state backend that uses the values defined in the configuration * for fields where that were not yet specified in this state backend. * * @param config the configuration * @return The re-configured variant of the state backend */ @Override public RocksDBStateBackend configure(Configuration config) { return new RocksDBStateBackend(this, config); } // ------------------------------------------------------------------------ // State backend methods // ------------------------------------------------------------------------ /** * Gets the state backend that this RocksDB state backend uses to persist * its bytes to. * * <p>This RocksDB state backend only implements the RocksDB specific parts, it * relies on the 'CheckpointBackend' to persist the checkpoint and savepoint bytes * streams. */ public StateBackend getCheckpointBackend() { return checkpointStreamBackend; } private void lazyInitializeForJob( Environment env, @SuppressWarnings("unused") String operatorIdentifier) throws IOException { if (isInitialized) { return; } this.jobId = env.getJobID(); // initialize the paths where the local RocksDB files should be stored if (localRocksDbDirectories == null) { // initialize from the temp directories initializedDbBasePaths = env.getIOManager().getSpillingDirectories(); } else { List<File> dirs = new ArrayList<>(localRocksDbDirectories.length); StringBuilder errorMessage = new StringBuilder(); for (File f : localRocksDbDirectories) { File testDir = new File(f, UUID.randomUUID().toString()); if (!testDir.mkdirs()) { String msg = "Local DB files directory '" + f + "' does not exist and cannot be created. "; LOG.error(msg); errorMessage.append(msg); } else { dirs.add(f); } //noinspection ResultOfMethodCallIgnored testDir.delete(); } if (dirs.isEmpty()) { throw new IOException("No local storage directories available. " + errorMessage); } else { initializedDbBasePaths = dirs.toArray(new File[dirs.size()]); } } nextDirectory = new Random().nextInt(initializedDbBasePaths.length); isInitialized = true; } private File getNextStoragePath() { int ni = nextDirectory + 1; ni = ni >= initializedDbBasePaths.length ? 0 : ni; nextDirectory = ni; return initializedDbBasePaths[ni]; } // ------------------------------------------------------------------------ // Checkpoint initialization and persistent storage // ------------------------------------------------------------------------ @Override public CompletedCheckpointStorageLocation resolveCheckpoint(String pointer) throws IOException { return checkpointStreamBackend.resolveCheckpoint(pointer); } @Override public CheckpointStorage createCheckpointStorage(JobID jobId) throws IOException { return checkpointStreamBackend.createCheckpointStorage(jobId); } // ------------------------------------------------------------------------ // State holding data structures // ------------------------------------------------------------------------ @Override public <K> AbstractKeyedStateBackend<K> createKeyedStateBackend( Environment env, JobID jobID, String operatorIdentifier, TypeSerializer<K> keySerializer, int numberOfKeyGroups, KeyGroupRange keyGroupRange, TaskKvStateRegistry kvStateRegistry, TtlTimeProvider ttlTimeProvider, MetricGroup metricGroup) throws IOException { // first, make sure that the RocksDB JNI library is loaded // we do this explicitly here to have better error handling String tempDir = env.getTaskManagerInfo().getTmpDirectories()[0]; ensureRocksDBIsLoaded(tempDir); // replace all characters that are not legal for filenames with underscore String fileCompatibleIdentifier = operatorIdentifier.replaceAll("[^a-zA-Z0-9\\-]", "_"); lazyInitializeForJob(env, fileCompatibleIdentifier); File instanceBasePath = new File( getNextStoragePath(), "job_" + jobId + "_op_" + fileCompatibleIdentifier + "_uuid_" + UUID.randomUUID()); LocalRecoveryConfig localRecoveryConfig = env.getTaskStateManager().createLocalRecoveryConfig(); return new RocksDBKeyedStateBackend<>( operatorIdentifier, env.getUserClassLoader(), instanceBasePath, getDbOptions(), getColumnOptions(), kvStateRegistry, keySerializer, numberOfKeyGroups, keyGroupRange, env.getExecutionConfig(), isIncrementalCheckpointsEnabled(), localRecoveryConfig, priorityQueueStateType, ttlTimeProvider, getMemoryWatcherOptions(), metricGroup); } @Override public OperatorStateBackend createOperatorStateBackend( Environment env, String operatorIdentifier) throws Exception { //the default for RocksDB; eventually there can be a operator state backend based on RocksDB, too. final boolean asyncSnapshots = true; return new DefaultOperatorStateBackend( env.getUserClassLoader(), env.getExecutionConfig(), asyncSnapshots); } // ------------------------------------------------------------------------ // Parameters // ------------------------------------------------------------------------ /** * Sets the path where the RocksDB local database files should be stored on the local * file system. Setting this path overrides the default behavior, where the * files are stored across the configured temp directories. * * <p>Passing {@code null} to this function restores the default behavior, where the configured * temp directories will be used. * * @param path The path where the local RocksDB database files are stored. */ public void setDbStoragePath(String path) { setDbStoragePaths(path == null ? null : new String[] { path }); } /** * Sets the directories in which the local RocksDB database puts its files (like SST and * metadata files). These directories do not need to be persistent, they can be ephemeral, * meaning that they are lost on a machine failure, because state in RocksDB is persisted * in checkpoints. * * <p>If nothing is configured, these directories default to the TaskManager's local * temporary file directories. * * <p>Each distinct state will be stored in one path, but when the state backend creates * multiple states, they will store their files on different paths. * * <p>Passing {@code null} to this function restores the default behavior, where the configured * temp directories will be used. * * @param paths The paths across which the local RocksDB database files will be spread. */ public void setDbStoragePaths(String... paths) { if (paths == null) { localRocksDbDirectories = null; } else if (paths.length == 0) { throw new IllegalArgumentException("empty paths"); } else { File[] pp = new File[paths.length]; for (int i = 0; i < paths.length; i++) { final String rawPath = paths[i]; final String path; if (rawPath == null) { throw new IllegalArgumentException("null path"); } else { // we need this for backwards compatibility, to allow URIs like 'file:///'... URI uri = null; try { uri = new Path(rawPath).toUri(); } catch (Exception e) { // cannot parse as a path } if (uri != null && uri.getScheme() != null) { if ("file".equalsIgnoreCase(uri.getScheme())) { path = uri.getPath(); } else { throw new IllegalArgumentException("Path " + rawPath + " has a non-local scheme"); } } else { path = rawPath; } } pp[i] = new File(path); if (!pp[i].isAbsolute()) { throw new IllegalArgumentException("Relative paths are not supported"); } } localRocksDbDirectories = pp; } } /** * Gets the configured local DB storage paths, or null, if none were configured. * * <p>Under these directories on the TaskManager, RocksDB stores its SST files and * metadata files. These directories do not need to be persistent, they can be ephermeral, * meaning that they are lost on a machine failure, because state in RocksDB is persisted * in checkpoints. * * <p>If nothing is configured, these directories default to the TaskManager's local * temporary file directories. */ public String[] getDbStoragePaths() { if (localRocksDbDirectories == null) { return null; } else { String[] paths = new String[localRocksDbDirectories.length]; for (int i = 0; i < paths.length; i++) { paths[i] = localRocksDbDirectories[i].toString(); } return paths; } } /** * Gets whether incremental checkpoints are enabled for this state backend. */ public boolean isIncrementalCheckpointsEnabled() { return enableIncrementalCheckpointing.getOrDefault(CheckpointingOptions.INCREMENTAL_CHECKPOINTS.defaultValue()); } // ------------------------------------------------------------------------ // Parametrize with RocksDB Options // ------------------------------------------------------------------------ /** * Sets the predefined options for RocksDB. * * <p>If a user-defined options factory is set (via {@link #setOptions(OptionsFactory)}), * then the options from the factory are applied on top of the here specified * predefined options. * * @param options The options to set (must not be null). */ public void setPredefinedOptions(PredefinedOptions options) { predefinedOptions = checkNotNull(options); } /** * Gets the currently set predefined options for RocksDB. * The default options (if nothing was set via {@link #setPredefinedOptions(PredefinedOptions)}) * are {@link PredefinedOptions#DEFAULT}. * * <p>If a user-defined options factory is set (via {@link #setOptions(OptionsFactory)}), * then the options from the factory are applied on top of the predefined options. * * @return The currently set predefined options for RocksDB. */ public PredefinedOptions getPredefinedOptions() { return predefinedOptions; } /** * Sets {@link org.rocksdb.Options} for the RocksDB instances. * Because the options are not serializable and hold native code references, * they must be specified through a factory. * * <p>The options created by the factory here are applied on top of the pre-defined * options profile selected via {@link #setPredefinedOptions(PredefinedOptions)}. * If the pre-defined options profile is the default * ({@link PredefinedOptions#DEFAULT}), then the factory fully controls the RocksDB * options. * * @param optionsFactory The options factory that lazily creates the RocksDB options. */ public void setOptions(OptionsFactory optionsFactory) { this.optionsFactory = optionsFactory; } /** * Gets the options factory that lazily creates the RocksDB options. * * @return The options factory. */ public OptionsFactory getOptions() { return optionsFactory; } /** * Gets the RocksDB {@link DBOptions} to be used for all RocksDB instances. */ public DBOptions getDbOptions() { // initial options from pre-defined profile DBOptions opt = predefinedOptions.createDBOptions(); // add user-defined options, if specified if (optionsFactory != null) { opt = optionsFactory.createDBOptions(opt); } // add necessary default options opt = opt.setCreateIfMissing(true); return opt; } /** * Gets the RocksDB {@link ColumnFamilyOptions} to be used for all RocksDB instances. */ public ColumnFamilyOptions getColumnOptions() { // initial options from pre-defined profile ColumnFamilyOptions opt = predefinedOptions.createColumnOptions(); // add user-defined options, if specified if (optionsFactory != null) { opt = optionsFactory.createColumnOptions(opt); } return opt; } public RocksDBNativeMetricOptions getMemoryWatcherOptions() { RocksDBNativeMetricOptions options = this.defaultMetricOptions; if (optionsFactory != null) { options = optionsFactory.createNativeMetricsOptions(options); } return options; } // ------------------------------------------------------------------------ // utilities // ------------------------------------------------------------------------ @Override public String toString() { return "RocksDBStateBackend{" + "checkpointStreamBackend=" + checkpointStreamBackend + ", localRocksDbDirectories=" + Arrays.toString(localRocksDbDirectories) + ", enableIncrementalCheckpointing=" + enableIncrementalCheckpointing + '}'; } // ------------------------------------------------------------------------ // static library loading utilities // ------------------------------------------------------------------------ private void ensureRocksDBIsLoaded(String tempDirectory) throws IOException { synchronized (RocksDBStateBackend.class) { if (!rocksDbInitialized) { final File tempDirParent = new File(tempDirectory).getAbsoluteFile(); LOG.info("Attempting to load RocksDB native library and store it under '{}'", tempDirParent); Throwable lastException = null; for (int attempt = 1; attempt <= ROCKSDB_LIB_LOADING_ATTEMPTS; attempt++) { try { // when multiple instances of this class and RocksDB exist in different // class loaders, then we can see the following exception: // "java.lang.UnsatisfiedLinkError: Native Library /path/to/temp/dir/librocksdbjni-linux64.so // already loaded in another class loader" // to avoid that, we need to add a random element to the library file path // (I know, seems like an unnecessary hack, since the JVM obviously can handle multiple // instances of the same JNI library being loaded in different class loaders, but // apparently not when coming from the same file path, so there we go) final File rocksLibFolder = new File(tempDirParent, "rocksdb-lib-" + new AbstractID()); // make sure the temp path exists LOG.debug("Attempting to create RocksDB native library folder {}", rocksLibFolder); // noinspection ResultOfMethodCallIgnored rocksLibFolder.mkdirs(); // explicitly load the JNI dependency if it has not been loaded before NativeLibraryLoader.getInstance().loadLibrary(rocksLibFolder.getAbsolutePath()); // this initialization here should validate that the loading succeeded RocksDB.loadLibrary(); // seems to have worked LOG.info("Successfully loaded RocksDB native library"); rocksDbInitialized = true; return; } catch (Throwable t) { lastException = t; LOG.debug("RocksDB JNI library loading attempt {} failed", attempt, t); // try to force RocksDB to attempt reloading the library try { resetRocksDBLoadedFlag(); } catch (Throwable tt) { LOG.debug("Failed to reset 'initialized' flag in RocksDB native code loader", tt); } } } throw new IOException("Could not load the native RocksDB library", lastException); } } } @VisibleForTesting static void resetRocksDBLoadedFlag() throws Exception { final Field initField = org.rocksdb.NativeLibraryLoader.class.getDeclaredField("initialized"); initField.setAccessible(true); initField.setBoolean(null, false); } }
[ "zhouluxiang@liepin.com" ]
zhouluxiang@liepin.com
df5d5b9d70ca17c69b7e49fc813dc5f146f12304
4d6541d579a11e09abbebe23f8dd29e001b829ae
/src/main/java/com/yoshio3/restclient/jaxb/entities/excel/UsedRangeOfWorkSheet.java
ae291e07ddeba87acdb09f648547e58626097e38
[]
no_license
girishmahajanaccionlabs/test-office-rest-excel
8792da61aea8ab7fd75aec15bdc0796df7c47d79
2357eb20a9fce0ed88cb71779a94adce4cb7ec01
refs/heads/master
2020-03-31T09:32:24.199677
2017-02-01T05:53:52
2017-02-01T05:53:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,042
java
/* * Copyright 2016 Yoshio Terada * * 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.yoshio3.restclient.jaxb.entities.excel; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; /** * * @author Yoshio Terada */ @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) public class UsedRangeOfWorkSheet { @JsonProperty("@odata.context") private String metaInfo1; @JsonProperty("@odata.type") private String metaInfo2; @JsonProperty("@odata.id") private String metaInfo3; private String address; private String addressLocal; private Integer cellCount; private Integer columnCount; private Boolean columnHidden; private Integer columnIndex; private List<List<String>> formulas; private List<List<String>> formulasLocal; private List<List<String>> formulasR1C1; //相対参照 private Boolean hidden; private List<List<String>> numberFormat; private Integer rowCount; private Boolean rowHidden; private Integer rowIndex; private List<List<String>> text; private List<List<String>> values; private List<List<String>> valueTypes; /** * @return the metaInfo1 */ public String getMetaInfo1() { return metaInfo1; } /** * @param metaInfo1 the metaInfo1 to set */ public void setMetaInfo1(String metaInfo1) { this.metaInfo1 = metaInfo1; } /** * @return the metaInfo2 */ public String getMetaInfo2() { return metaInfo2; } /** * @param metaInfo2 the metaInfo2 to set */ public void setMetaInfo2(String metaInfo2) { this.metaInfo2 = metaInfo2; } /** * @return the metaInfo3 */ public String getMetaInfo3() { return metaInfo3; } /** * @param metaInfo3 the metaInfo3 to set */ public void setMetaInfo3(String metaInfo3) { this.metaInfo3 = metaInfo3; } /** * @return the address */ public String getAddress() { return address; } /** * @param address the address to set */ public void setAddress(String address) { this.address = address; } /** * @return the addressLocal */ public String getAddressLocal() { return addressLocal; } /** * @param addressLocal the addressLocal to set */ public void setAddressLocal(String addressLocal) { this.addressLocal = addressLocal; } /** * @return the cellCount */ public Integer getCellCount() { return cellCount; } /** * @param cellCount the cellCount to set */ public void setCellCount(Integer cellCount) { this.cellCount = cellCount; } /** * @return the columnCount */ public Integer getColumnCount() { return columnCount; } /** * @param columnCount the columnCount to set */ public void setColumnCount(Integer columnCount) { this.columnCount = columnCount; } /** * @return the columnHidden */ public Boolean getColumnHidden() { return columnHidden; } /** * @param columnHidden the columnHidden to set */ public void setColumnHidden(Boolean columnHidden) { this.columnHidden = columnHidden; } /** * @return the columnIndex */ public Integer getColumnIndex() { return columnIndex; } /** * @param columnIndex the columnIndex to set */ public void setColumnIndex(Integer columnIndex) { this.columnIndex = columnIndex; } /** * @return the formulasLocal */ public List<List<String>> getFormulasLocal() { return formulasLocal; } /** * @param formulasLocal the formulasLocal to set */ public void setFormulasLocal(List<List<String>> formulasLocal) { this.formulasLocal = formulasLocal; } /** * @return the formulasR1C1 */ public List<List<String>> getFormulasR1C1() { return formulasR1C1; } /** * @param formulasR1C1 the formulasR1C1 to set */ public void setFormulasR1C1(List<List<String>> formulasR1C1) { this.formulasR1C1 = formulasR1C1; } /** * @return the hidden */ public Boolean getHidden() { return hidden; } /** * @param hidden the hidden to set */ public void setHidden(Boolean hidden) { this.hidden = hidden; } /** * @return the numberFormat */ public List<List<String>> getNumberFormat() { return numberFormat; } /** * @param numberFormat the numberFormat to set */ public void setNumberFormat(List<List<String>> numberFormat) { this.numberFormat = numberFormat; } /** * @return the rowCount */ public Integer getRowCount() { return rowCount; } /** * @param rowCount the rowCount to set */ public void setRowCount(Integer rowCount) { this.rowCount = rowCount; } /** * @return the rowHidden */ public Boolean getRowHidden() { return rowHidden; } /** * @param rowHidden the rowHidden to set */ public void setRowHidden(Boolean rowHidden) { this.rowHidden = rowHidden; } /** * @return the rowIndex */ public Integer getRowIndex() { return rowIndex; } /** * @param rowIndex the rowIndex to set */ public void setRowIndex(Integer rowIndex) { this.rowIndex = rowIndex; } /** * @return the text */ public List<List<String>> getText() { return text; } /** * @param text the text to set */ public void setText(List<List<String>> text) { this.text = text; } /** * @return the values */ public List<List<String>> getValues() { return values; } /** * @param values the values to set */ public void setValues(List<List<String>> values) { this.values = values; } /** * @return the valueTypes */ public List<List<String>> getValueTypes() { return valueTypes; } /** * @param valueTypes the valueTypes to set */ public void setValueTypes(List<List<String>> valueTypes) { this.valueTypes = valueTypes; } /** * @return the formulas */ public List<List<String>> getFormulas() { return formulas; } /** * @param formulas the formulas to set */ public void setFormulas(List<List<String>> formulas) { this.formulas = formulas; } @Override public String toString() { return "UsedRangeOfWorkSheet{" + "metaInfo1=" + metaInfo1 + ", metaInfo2=" + metaInfo2 + ", metaInfo3=" + metaInfo3 + ", address=" + address + ", addressLocal=" + addressLocal + ", cellCount=" + cellCount + ", columnCount=" + columnCount + ", columnHidden=" + columnHidden + ", columnIndex=" + columnIndex + ", formulas=" + formulas + ", formulasLocal=" + formulasLocal + ", formulasR1C1=" + formulasR1C1 + ", hidden=" + hidden + ", numberFormat=" + numberFormat + ", rowCount=" + rowCount + ", rowHidden=" + rowHidden + ", rowIndex=" + rowIndex + ", text=" + text + ", values=" + values + ", valueTypes=" + valueTypes + '}'; } }
[ "tyoshio2002@yahoo.co.jp" ]
tyoshio2002@yahoo.co.jp
f6571681bee1d7cc235d2e806e7fd0533cf03aef
66572faa55b7b67e6ca9399f4a0506555f5ba98c
/Extremem/src/main/java/com/amazon/corretto/benchmark/extremem/RelativeTime.java
9ff4c3732b995c9ffb596d98b783ea6ddafd52b3
[ "Apache-2.0" ]
permissive
earthling-amzn/heapothesys
44adefe2000d5ec7083db4a0647c9a6164bc05e1
4073f84f8443843459778e1c62798c774116bbb1
refs/heads/master
2023-01-19T19:52:50.314020
2020-11-20T13:08:38
2020-11-20T13:08:38
297,736,980
0
0
null
2020-09-22T18:27:32
2020-09-22T18:27:31
null
UTF-8
Java
false
false
10,957
java
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package com.amazon.corretto.benchmark.extremem; class RelativeTime extends HighResolutionTime { /** * Construct a RelativeTime object representing no passage of time. * * The code that invokes this constructor is expected to account for * the returned RelativeTime object's memory eventually becoming garbage, * possibly adjusting the accounting of its LifeSpan along the way * to becoming garbage. */ RelativeTime(ExtrememThread t) { this(t, 0, 0); } /** * Construct an Ephemeral RelativeTime object representing s seconds * plus ns nanoseconds from the moment in time at which the current JVM * began to execute. * * The code that invokes this constructor is expected to account for * the returned RelativeTime object's memory eventually becoming garbage, * possibly adjusting the accounting of its LifeSpan along the way * to becoming garbage. */ RelativeTime(ExtrememThread t, long s, int ns) { super(t, s, ns); // Memory behavior logged in superclass. } // I have confirmed through instrumentation that Thread.sleep() // sometimes delays less that the intended amount of time. This can // result in certain latency measurements being reported as // negative. For efficiency, would prefer not to check the current // time after Thread.sleep() returns, and would prefer not to issue // multiple Thread.sleep() requests. Since fixing Thread.sleep() is // beyond the scope of the extremem testbed effort, the current // workaround is to round any negative latency measurements up to // zero within RelativeTimeMetrics.addToLog(). /** * Sleep until this AbsoluteTime has been reached, returning an * Ephemeral approximation of the wakeup time. * * The code that invokes this service is expected to account for the * returned AbsoluteTime object's memory eventually becoming garbage, * possibly adjusting the accounting of its LifeSpan along the way * to becoming garbage. */ AbsoluteTime sleep(ExtrememThread t) { boolean sufficient_delay = false; AbsoluteTime now = AbsoluteTime.now(t); AbsoluteTime awake = now.addRelative(t, this); while (true) { RelativeTime delay = awake.difference(t, now); delay.garbageFootprint(t); if (!delay.isNegative()) { try { // I have confirmed through instrumentation that Thread.sleep() // sometimes delays less that the intended amount of time. This // can result in certain latency measurements being reported as // negative. Since I can't "FIX" the implementation of // Thread.sleep(), I'll instead round any negative latency // measurements up to zero whenever a negative latency is added to // a RelativeTimeMetrics log. Thread.sleep (delay.s * MillisPerSecond + delay.ns / NanosPerMilli, delay.ns % NanosPerMilli); now.garbageFootprint(t); return awake; } catch (InterruptedException x) { now.garbageFootprint(t); now = AbsoluteTime.now (t); // try it again } } } } /** * Return an Ephemeral RelativeTime instance representing the time * span between this and smaller. * * The code that invokes this service is expected to account for the * returned RelativeTime object's memory eventually becoming garbage, * possibly adjusting the accounting of its LifeSpan along the way * to becoming garbage. */ RelativeTime delta(ExtrememThread t, RelativeTime smaller) { long s = this.s - smaller.s; int ns = this.ns - smaller.ns; return new RelativeTime(t, s, ns); } /** * Return a new Ephemeral RelativeTime instance representing the * result of subtracting delta from this. * * The code that invokes this service is expected to account for the * returned RelativeTime object's memory eventually becoming garbage, * possibly adjusting the accounting of its LifeSpan along the way * to becoming garbage. */ RelativeTime subtractRelative(ExtrememThread t, RelativeTime delta) { long s = this.s - delta.s; int ns = this.ns - delta.ns; return new RelativeTime(t, s, ns); } /** * Return a new Ephemeral RelativeTime instance representing the sum * of this and delta. * * The code that invokes this service is expected to account for the * returned RelativeTime object's memory eventually becoming garbage, * possibly adjusting the accounting of its LifeSpan along the way * to becoming garbage. */ RelativeTime addRelative(ExtrememThread t, RelativeTime delta) { long s = this.s + delta.s; int ns = this.ns + delta.ns; return new RelativeTime(t, s, ns); } /** * Return a new Ephemeral RelativeTime instance representing the sum * of this and day days. * * The code that invokes this service is expected to account for the * returned RelativeTime object's memory eventually becoming garbage, * possibly adjusting the accounting of its LifeSpan along the way * to becoming garbage. */ RelativeTime addDay(ExtrememThread t, long day) { long s = this.s + day * 24 * 3600; return new RelativeTime(t, s, this.ns); } /** * Return a new Ephemeral RelativeTime instance representing the sum * of this and h hours. * * The code that invokes this service is expected to account for the * returned RelativeTime object's memory eventually becoming garbage, * possibly adjusting the accounting of its LifeSpan along the way * to becoming garbage. */ RelativeTime addHours(ExtrememThread t, long h) { long s = this.s + h * 3600; return new RelativeTime(t, s, this.ns); } /** * Return a new Ephemeral RelativeTime instance representing the sum * of this and m minutes. * * The code that invokes this service is expected to account for the * returned RelativeTime object's memory eventually becoming garbage, * possibly adjusting the accounting of its LifeSpan along the way * to becoming garbage. */ RelativeTime addMinutes(ExtrememThread t, long m) { long s = this.s + m * 60; return new RelativeTime(t, s, this.ns); } /** * Return a new Ephemeral RelativeTime instance representing the sum * of this and s seconds. * * The code that invokes this service is expected to account for the * returned RelativeTime object's memory eventually becoming garbage, * possibly adjusting the accounting of its LifeSpan along the way * to becoming garbage. */ RelativeTime addSeconds(ExtrememThread t, long delta_s) { long s = this.s + delta_s; return new RelativeTime(t, s, this.ns); } /** * Return a new Ephemeral RelativeTime instance representing the sum * of this and ms milliseconds. * * The code that invokes this service is expected to account for the * returned RelativeTime object's memory eventually becoming garbage, * possibly adjusting the accounting of its LifeSpan along the way * to becoming garbage. */ RelativeTime addMillis(ExtrememThread t, int ms) { long s = this.s + ms / 1000; int ns = this.ns + (ms % 1000) * HighResolutionTime.NanosPerMilli; return new RelativeTime(t, s, ns); } /** * Return a new Ephemeral RelativeTime instance representing the sum * of this and us microseconds. * * The code that invokes this service is expected to account for the * returned RelativeTime object's memory eventually becoming garbage, * possibly adjusting the accounting of its LifeSpan along the way * to becoming garbage. */ RelativeTime addMicros(ExtrememThread t, int us) { int ns = ( this.ns + ((us % HighResolutionTime.MicrosPerSecond) * HighResolutionTime.NanosPerMicro)); long s = this.s + us / HighResolutionTime.MicrosPerSecond; return new RelativeTime(t, s, ns); } /** * Return a new Ephemeral RelativeTime instance representing the sum * of this and ns nanoseconds. * * The code that invokes this service is expected to account for the * returned RelativeTime object's memory eventually becoming garbage, * possibly adjusting the accounting of its LifeSpan along the way * to becoming garbage. */ RelativeTime addNanos(ExtrememThread t, int delta_ns) { int ns = this.ns + delta_ns % HighResolutionTime.NanosPerSecond; long s = this.s + delta_ns / HighResolutionTime.NanosPerSecond; return new RelativeTime(t, s, ns); } /** * Return a new Ephemeral RelativeTime instance representing the * product of this and factor. * * The code that invokes this service is expected to account for the * returned RelativeTime object's memory eventually becoming garbage, * possibly adjusting the accounting of its LifeSpan along the way * to becoming garbage. */ RelativeTime multiplyBy(ExtrememThread t, int factor) { long ns = this.ns * (long) factor; long s = this.s * factor; s += ns / NanosPerSecond; ns = ns % NanosPerSecond; return new RelativeTime(t, s, (int) ns); } /** * Return a new Ephemeral RelativeTime instance representing the * quotient of dividing this by factor. * * The code that invokes this service is expected to account for the * returned RelativeTime object's memory eventually becoming garbage, * possibly adjusting the accounting of its LifeSpan along the way * to becoming garbage. */ RelativeTime divideBy(ExtrememThread t, int divisor) { long ns = this.ns / (long) divisor; long s = this.s / divisor; return new RelativeTime(t, s, (int) ns); } /** * Return 0 if this and other represent same time, -1 if this is * chronologically less than other, 1 if this is chronologically * greater than other. */ int compare(RelativeTime other) { if (this.s == other.s) { if (this.ns < other.ns) return -1; else if (this.ns == other.ns) return 0; else return 1; } else if (this.s > other.s) return 1; else return -1; } /** * This method, used primarily for reporting, returns an Ephemeral * String representation of this. * * The code that invokes toString is expected to account for the * returned String object's memory eventually becoming garbage, * possibly adjusting the accounting of its LifeSpan along the way * to becoming garbage. */ public String toString(ExtrememThread t) { String result, part1, part2; part1 = "RelativeTime: "; part2 = super.toString(t); int part1_len = part1.length(); int part2_len = part2.length(); int capacity = Util.ephemeralStringBuilder(t, part1_len); capacity = Util.ephemeralStringBuilderAppend(t, part1_len, capacity, part2_len); Util.ephemeralStringBuilderToString(t, part1_len + part2_len, capacity); result = part1 + part2; Util.abandonEphemeralString(t, part2_len); return result; } }
[ "kdnilsen@amazon.com" ]
kdnilsen@amazon.com
f4212f6cb8cd0cb52fe932dfe4d8387aacaa10c9
3044611fa5f90ad4b520b955a4fda826168e658f
/ancba-authorizer-oauth2/src/main/java/club/neters/AncbaAuthorizerApplication.java
8f780cd3a52cbb97bdfc5c7479603929141a3631
[ "MIT" ]
permissive
AlvaShui/ancba
2451403e2c9b797a0e8d3393bc8ca26a66f85424
28df166c61ea8442eb860e6acf9ffdacdfd8f8eb
refs/heads/master
2023-07-03T15:13:26.211848
2021-08-09T11:07:18
2021-08-09T11:07:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
571
java
package club.neters; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; /** * @author maven plugin * @date 2021/6/25 */ @SpringBootApplication @EnableDiscoveryClient public class AncbaAuthorizerApplication { public static void main(String[] args) { SpringApplication.run(AncbaAuthorizerApplication.class, args); System.out.println("=================鉴权认证中心启动成功============="); } }
[ "3143422472@qq.com" ]
3143422472@qq.com
3088f16afa11f03de9feec63f95b7af6934a50e2
b3c8b2db791c355dd43dcc286250d6ffb76f7461
/src/pl/sages/trzecidzien/vendingmachine/VendingMachneApp.java
f878791705057deb4a47b8b531cf7444046dd42e
[]
no_license
kzamb/Zerowka
4cbadbeefe93317cde30e19207ec44783a526b0c
8c367ceaebf68bf4de0ad7ad91e97bfa51ffed13
refs/heads/master
2021-01-19T12:52:11.157429
2017-08-27T11:55:31
2017-08-27T11:55:31
100,815,223
0
0
null
null
null
null
UTF-8
Java
false
false
369
java
package pl.sages.trzecidzien.vendingmachine; import java.util.Scanner; public class VendingMachneApp { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Wrzuc monete:"); //VendingMachne vendingMachine = createVendingMachine(); String s = scanner.nextLine(); } }
[ "kzamb@kablowka.net" ]
kzamb@kablowka.net
b30a0f6b061f07b3bca923d727bb81f11889c705
de93a491095898ccea711fb17cecd775f7d41def
/src/SelectionPackage/forSelTC.java
00c518f085a2e5080b1a800d899ea090edcb716f
[]
no_license
ivansmoot/StudentSelectionSystem
c849d285414a1cc1ff8f7a84b6a3b76c8f940a71
aa347dee15ecb382e42b2cf455a21ab31f81e586
refs/heads/master
2020-12-04T03:45:28.775260
2020-01-03T13:40:42
2020-01-03T13:40:42
231,596,154
0
0
null
null
null
null
GB18030
Java
false
false
1,333
java
package SelectionPackage; import javax.swing.*; import java.sql.*; import java.util.*; public class forSelTC extends JFrame{ Vector rowData=new Vector();//行数据 Vector columnNames=new Vector();//列名 Statement stmt=null;//创建接口 String sql=null; JTable jt=null;//创建表单 JScrollPane jsp=null; PreparedStatement ps=null; ResultSet rs=null;//声明返回结果 public forSelTC(String sql1){ sql=sql1; columnNames.add("教师号"); columnNames.add("课程号"); try{ CONN co=new CONN(); Connection dbConn1=co.CO();//添加数据库连接 stmt=(Statement)dbConn1.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);//可以任意向前后移动游标,ResultSet数据只读 rs=stmt.executeQuery(sql);//executeQuery()方法会把数据库响应的查询结果存放在ResultSet类对象中 while(rs.next()){ Vector hang=new Vector(); hang.add(rs.getString("tno"));System.out.print(rs.getString("tno")); hang.add(rs.getString("cno"));System.out.print(rs.getString("cno")); rowData.add(hang); } jt=new JTable(rowData,columnNames); jsp=new JScrollPane(jt); this.add(jsp); this.setSize(800,600); this.setVisible(true); }catch(SQLException e){ System.out.print("SQL Exception occur.Message is:"+e.getMessage()); } } }
[ "ivansmoot@163.com" ]
ivansmoot@163.com