id
stringlengths
36
36
text
stringlengths
1
1.25M
cf792851-f7bf-4cd2-8181-b34de69700d2
public void actionPerformed(java.awt.event.ActionEvent evt) { button3ActionPerformed(evt); }
3be88044-7fa0-49c7-92a8-2af4d05257cc
public void actionPerformed(java.awt.event.ActionEvent evt) { button4ActionPerformed(evt); }
7d79fa64-d4fb-4779-bcc4-d65c0213ba50
public void actionPerformed(java.awt.event.ActionEvent evt) { button5ActionPerformed(evt); }
45fedfd6-550d-45ba-a423-10f7627ae86a
private void button1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button1ActionPerformed gestioncliente.getCliente().setCedula(txtcedula.getText()); gestioncliente.getCliente().setCedula(txtcedula.getText()); gestioncliente.getCliente().setNombre(txtnombre.getText()); ...
f05a8128-3b84-4207-94a2-53b7eeb5cb49
private void button2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button2ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_button2ActionPerformed
6deb57f3-a06e-4c52-afa5-0ac682038db3
private void button3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button3ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_button3ActionPerformed
d7f59e5d-2e0d-440c-9d1f-3f6e1b312b5d
private void button4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button4ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_button4ActionPerformed
717e1a69-58d5-46e5-8b38-fd9f34331670
private void button5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button5ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_button5ActionPerformed
47988731-ba25-49a3-9739-a98699767760
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://down...
781b37a6-96af-4fba-a0ac-383663e37cc2
public void run() { new Cliente().setVisible(true); }
9e9164eb-6af8-431a-9def-7ee6ec891cbb
public GestionCliente() { Conexion.setCadena("jdbc:mysql://localhost/facturacion"); Conexion.setUsuario("root"); Conexion.setClave(""); }
45cb233e-826a-4490-abd4-2b8a308cd29c
public Cliente getCliente() { return cliente; }
40f631b4-8b2e-4da3-9ab8-61bc2ae7c950
public void setCliente (Cliente cliente){ this.cliente=cliente; }
88793cf2-1bd9-4366-be0e-f4ab61164d63
public void Grabar() throws SQLException { try{ Conexion.GetInstancia().Conectar(); Conexion.GetInstancia().Ejecutar("insert into cliente (cedula, nombre, direccion, cupo) values ('"+cliente.getCedula()+"','"+cliente.getNombre()+"','"+cliente.getDireccion()+"', "+cliente.getCupo()+")"); ...
7427ab33-af09-41f7-a2f7-c3f8add6aa04
public void Modificar() throws SQLException { try{ Conexion.GetInstancia().Conectar(); Conexion.GetInstancia().Ejecutar("update cliente (cedula, nombre, direccion, cupo) values ('"+cliente.getCedula()+"','"+cliente.getNombre()+"','"+cliente.getDireccion()+"', "+cliente.getCupo()+")"); Con...
2cc1a888-7469-489a-8bec-3e9a29a1a2ea
public void Nuevo() throws SQLException { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. }
75bff0cd-a597-4ed5-bc2f-2b2e8a450a7e
public void Eliminar() throws SQLException { try{ Conexion.GetInstancia().Conectar(); Conexion.GetInstancia().Ejecutar("delete from cliente where cedula='"+cliente.getCedula()+""); Conexion.GetInstancia().Desconectar(); } catch(SQLException ex){ throw ex; ...
f514379a-067c-4450-b099-3afea694b50b
public void Consultar() throws SQLException { try{ Conexion.GetInstancia().Conectar(); Conexion.GetInstancia().Ejecutar("select * from cliente"); Conexion.GetInstancia().Desconectar(); } catch(SQLException ex){ throw ex; } }
2aa82331-e157-4da3-a81b-ac4c070dce8d
public void Grabar () throws SQLException;
00a0686b-7c5b-4951-8e09-192804dcd842
public void Modificar() throws SQLException;
aeaff3e8-03a4-4eda-8b75-e045ee9139db
public void Nuevo() throws SQLException;
6a000951-c1c4-447d-b405-376ec157410e
public void Eliminar() throws SQLException;
02d27839-6189-419d-aadd-f1cf2c273a55
public void Consultar() throws SQLException;
2a757346-c55a-40fa-8d7c-9742b36ca25b
public String getCedula() { return Cedula; }
eb3a9567-7509-4dd1-a2e6-42234dcbd5c5
public void setCedula(String Cedula) { this.Cedula = Cedula; }
93a77929-0324-4c0a-9eef-e81409b6b563
public String getNombre() { return Nombre; }
6e251c7f-a823-4ca6-aa42-c79183b1dd87
public void setNombre(String Nombre) { this.Nombre = Nombre; }
4648d466-5b88-4e2f-8b22-7d8027248911
public String getDireccion() { return Direccion; }
a40fe962-d884-4cfe-8f11-4472d8b5635b
public void setDireccion(String Direccion) { this.Direccion = Direccion; }
5683cc35-2eba-43f8-88b7-730c0611e615
public double getCupo() { return Cupo; }
d728e6f8-639f-4c6c-a21b-47c385248326
public void setCupo(double Cupo) { this.Cupo = Cupo; }
06a279a4-5cc7-442f-bd38-a9349efd81cc
public Cliente(String Cedula, String Nombre, String Direccion, double Cupo) { this.Cedula = Cedula; this.Nombre = Nombre; this.Direccion = Direccion; this.Cupo = Cupo; }
4868c5ee-c9a7-4015-a371-2f02b96f964f
public static void main(String[] args) { System.out.println("A.main(String[] args)"); A a = new A(); a.mth1(Integer.parseInt(args[0])); }
313a8bf9-8dca-4851-a1ee-5139eeabd0f6
public void mth1(int count) { System.out.println("A.mth1(int count)"); B b = new B(); for(int i = 0; i < count; i++) { try { b.mth1(i); b.mth2(); } catch (Exception e) { System.err.println("error in A.mth1(int count)"); ...
bd20e829-26e7-423f-97c4-2f3a8071bb0d
public void mth1(int i) { System.out.println("B.mth1(int i)"); C c = new C(i); int result = c.mth1(); System.out.println("result = " + result); }
44cd6f1f-198d-4745-b8f7-5b57d265051f
public void mth2() { System.out.println("B.mth2()"); }
ee35a5d9-2e28-45d3-aa75-0710d1017158
public C(int i) { System.out.println("C.C(int i)"); this.i = i; }
bec6e0ee-85a9-4703-9ea6-5c00436b5ecc
public int mth1() { System.out.println("C.mth1()"); return 100/i; }
d7954132-0639-43cb-b9b4-91cb1d30ead7
public static void main(String[] args) throws IOException { InstruNumberCall instru = new InstruNumberCall(args[0], args[1], new LogProcessorMethodNumber()); //copy the project (args[0]) in the output directory (args[1]) instru.initOutputDirectory(); //instrumentalize the java code of ...
cf885b5e-ed57-448d-bfdc-9f7fc2234488
public InstruNumberCall(String projectDirectory, String outputDirectory, Processor processor) { this.projectDirectory = projectDirectory; this.outputDirectory = outputDirectory; this.processor = processor; }
cdeeedff-d688-41cd-a0e3-2d519ab541ad
public void instru() throws IOException { String src = projectDirectory + System.getProperty("file.separator") + srcDirectory; String out = outputDirectory + System.getProperty("file.separator") + srcDirectory; //initialize spoon Factory factory = initSpoon(src); //apply the pr...
9f0b3ebe-a3bb-4b07-bca9-fa036c6ed2d6
protected void initOutputDirectory() throws IOException { File dir = new File(outputDirectory); dir.mkdirs(); FileUtils.copyDirectory(new File(projectDirectory), dir); }
0fd2db13-9844-4a10-84d6-43fa741a2b65
protected Factory initSpoon(String srcDirectory) { StandardEnvironment env = new StandardEnvironment(); env.setVerbose(true); env.setDebug(true); DefaultCoreFactory f = new DefaultCoreFactory(); Factory factory = new FactoryImpl(f, env); SpoonCompiler c = new JDTBasedSpo...
4f461e0a-ed05-47b1-8284-818a4bfc870d
protected void applyProcessor(Factory factory, Processor processor) { ProcessingManager pm = new QueueProcessingManager(factory); pm.addProcessor(processor); pm.process(); }
9053b5d8-0f17-40d7-907c-3fcd4706ece8
protected void copyLoggerFile(String tmpDir, String src) throws IOException { File dir = new File(tmpDir+"/"+src+"/vv/spoonNumberCall/logger"); FileUtils.forceMkdir(dir); String packagePath = System.getProperty("user.dir")+"/src/main/java/vv/spoonNumberCall/logger/"; FileUtils.copyFileTo...
ef3b82aa-1a08-474b-8dce-fc6dcd9f43f8
public SimpleJavaOutputProcessor(File outputDirectory, PrettyPrinter printer) { super(outputDirectory, printer); }
9787f8ec-6898-4fc1-b395-91138dde7967
public void process(CtSimpleType<?> type) { if (type.isTopLevel()) createJavaFile(type); }
bac1fd98-fc16-407d-a83a-3e865d0ad380
@Override public void process(CtMethod element) { SourcePosition sp = element.getPosition(); CompilationUnit compileUnit = sp.getCompilationUnit(); //add /** before the invocation //SourceCodeFragment before = new SourceCodeFragment(compileUnit.beginOfLineIndex(sp.getSourceStart())...
ab403968-bb1d-41f3-bb17-aedb31a5748a
public void run() { LogWriterNum.writeLog(); }
7ba1ba3d-1c08-4615-8455-f0ca73e35650
public static void writeLog() { out(); fileWriter.close(); }
8eaf8a13-4842-4489-a86b-47cc5dbf80fa
public static void out() { try { PrintWriter writer = getWriter(); Iterator<Map.Entry<String, Integer>> entries=(callmethod.entrySet()).iterator(); while(entries.hasNext()){ Map.Entry entry=entries.next(); String st=entry.getKey()+"\t"+entry...
890a9300-3260-4ff6-9bf7-b7ef73a427d0
protected static PrintWriter getWriter() throws FileNotFoundException { if(fileWriter == null) { //ShutdownHookLog1 shutdownHook = new ShutdownHookLog1(); //Runtime.getRuntime().addShutdownHook(shutdownHook); fileWriter = new PrintWriter("logCompter"); } retur...
73d7ade2-3ac0-4db8-b683-3cfe411b6487
public static void addEntry(String key){ addHook(); if (callmethod.containsKey(key)){ int value=callmethod.get(key); value++; callmethod.put(key,value); } else { callmethod.put(key,1); } }
c7d1e79c-575e-4315-8770-adcc14b68ba1
public static void addHook(){ if(shutdownHook==null){ shutdownHook=new ShutdownHookLog1(); Runtime.getRuntime().addShutdownHook(shutdownHook); } }
859ef785-a6f8-4f81-919a-6ff13cdfc9f6
public Instru(String projectDirectory, String outputDirectory, Processor processor) { this.projectDirectory = projectDirectory; this.outputDirectory = outputDirectory; this.processor = processor; }
27587fad-073f-4b2b-8ae8-611034839500
public void instru() throws IOException { String src = projectDirectory + System.getProperty("file.separator") + srcDirectory; String out = outputDirectory + System.getProperty("file.separator") + srcDirectory; //initialize spoon Factory factory = initSpoon(src); //apply the pr...
0ae1e862-65fd-401f-8d4f-b6fc7d1c37ab
protected void initOutputDirectory() throws IOException { File dir = new File(outputDirectory); dir.mkdirs(); FileUtils.copyDirectory(new File(projectDirectory), dir); }
fc80de01-aee0-4a6f-b385-87917209f68b
protected Factory initSpoon(String srcDirectory) { StandardEnvironment env = new StandardEnvironment(); env.setVerbose(true); env.setDebug(true); DefaultCoreFactory f = new DefaultCoreFactory(); Factory factory = new FactoryImpl(f, env); SpoonCompiler c = new JDTBasedSpo...
cf9e28af-b9d6-475e-a5ef-6d02edd7956a
protected void applyProcessor(Factory factory, Processor processor) { ProcessingManager pm = new QueueProcessingManager(factory); pm.addProcessor(processor); pm.process(); }
57b2abf6-cf59-4e95-81ed-5126bc86964d
protected void copyLoggerFile(String tmpDir, String src) throws IOException { File dir = new File(tmpDir+"/"+src+"/vv/spoon/logger"); FileUtils.forceMkdir(dir); String packagePath = System.getProperty("user.dir")+"/src/main/java/vv/spoon/logger/"; FileUtils.copyFileToDirectory(new File(p...
7b76c969-88b2-4984-8bc8-ab545f65d0d3
public static void main(String[] args) throws IOException { Instru instru = new Instru(args[0], args[1], new LogProcessor()); //copy the project (args[0]) in the output directory (args[1]) instru.initOutputDirectory(); //instrumentalize the java code of output directory with LogProcess...
3fc4d3e5-a7d9-433f-9d31-cedd43066a54
public SimpleJavaOutputProcessor(File outputDirectory, PrettyPrinter printer) { super(outputDirectory, printer); }
85dc7884-2c36-4559-bb39-5faa27dcfbc4
public void process(CtSimpleType<?> type) { if (type.isTopLevel()) createJavaFile(type); }
63b1fe21-d8cb-436c-8310-25e6d1603095
@Override public boolean isToBeProcessed(CtInvocation candidate) { try { Class type = candidate.getTarget().getType().getActualClass(); CtExecutableReference executable = candidate.getExecutable(); if(type.equals(java.io.PrintStream.class) && isPrint(...
1cd7e36b-bf30-4971-932a-b2e082d72b28
@Override public void process(CtInvocation element) { SourcePosition sp = element.getPosition(); CompilationUnit compileUnit = sp.getCompilationUnit(); //add /** before the invocation SourceCodeFragment before = new SourceCodeFragment(compileUnit.beginOfLineIndex(sp.getSourceStart()...
9c92212b-d8ba-404c-84b1-b859d2fc901e
protected boolean isError(CtExpression target) { return target.toString().endsWith("err"); }
bc642c01-b000-49c2-957f-3e02513d368f
protected boolean isPrint(CtExecutableReference executable) { String toString = executable.toString(); return toString.startsWith("java.io.PrintStream.println(") || toString.startsWith("java.io.PrintStream.print("); }
79b9f9e6-80d9-423b-91fd-a046fb17fbb9
public void run() { LogWriter.writeLog(); }
5bdc24e4-c9fb-46a0-9a16-9e71b1058b69
public static void writeLog() { fileWriter.close(); }
71c56f92-ea0f-452e-84bc-0feaee16798e
public static void out(String string, boolean error) { try { PrintWriter writer = getWriter(); if(error) { writer.write("ERROR: "); } else { writer.write("INFO: "); } writer.write(string + "\n"); } catch (FileN...
50e43aca-60d4-421d-aa52-8697252c27cc
protected static PrintWriter getWriter() throws FileNotFoundException { if(fileWriter == null) { ShutdownHookLog shutdownHook = new ShutdownHookLog(); Runtime.getRuntime().addShutdownHook(shutdownHook); fileWriter = new PrintWriter("log"); } return fileWriter;...
5394846a-99cf-4eca-8fe8-29b4b004afb4
public void acceptStudent(String id) { updateStatus(id, "Y"); }
e995e09c-6b22-40f4-acbf-61d256257bc9
public void denyStudent(String id) { updateStatus(id, "D"); }
4cec9558-8013-4c3a-8087-3568d7b7d90b
public void ptStudent(String id) { updateStatus(id, "P"); }
604a71da-420f-474a-97fc-eb30896f5af1
void updateStatus(String id,String status) { try { conn = GetConnection.getConnection(); sql = "update cms_register_student set isAccept = '" + status + "' where id = ?"; pstat = conn.prepareStatement(sql); pstat.setString(1, id); pstat.executeUpdate(); } catch(Exception e) { e.printStackTrace(); ...
16a6054b-f1f7-4826-991b-074b2d4c9f63
public void deleteStudent(String id) { try { conn = GetConnection.getConnection(); sql = "delete from cms_register_student where id = ?"; pstat = conn.prepareStatement(sql); pstat.setString(1, id); pstat.executeUpdate(); } catch(Exception e) { e.printStackTrace(); } finally { if(pstat!=null) ...
d1df995c-6df8-4a71-8efd-815f31e8be61
public List<Student> getAllStudents() { return getStudents(" order by addtime"); }
2730d9ec-c077-4813-b514-00f894e50b98
public List<Student> getAcceptedStudents() { return getStudents("where isAccept = 'Y' or isAccept = 'P' order by isAccept desc"); }
31715e02-1164-47f8-a34f-9e0adf26a16a
public String getStatusById(String tidcard, String ttel) { List<Student> list = getStudents(" where idcard = '" + tidcard + "' and tel = '" + ttel + "'"); if(list==null || list.size()<1) { return null; } else { Student student = list.get(0); return student.getIsAcceptInner(); } }
9d50a422-1b89-4767-9e87-17dc69438616
List<Student> getStudents(String whereSql) { List<Student> acceptedStudents = new ArrayList<Student>(); ResultSet rs = null; try { conn = GetConnection.getConnection(); sql = "select id,name,sex,type,school,academy,major,grade,research,email,tel,teacher,idcard,isAccept,addtime from cms_register_student " + ...
589ff9bd-0f73-4718-8669-52ea2237f94a
public boolean addStudent(Student user) throws Exception { sql = "insert into cms_register_student values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; try { conn = GetConnection.getConnection(); pstat = conn.prepareStatement(sql); String id; if(user.getIdcard()!=null) { id = user.getIdcard(); } else { ...
afb86028-10e2-4b8b-94e9-7e6b44f17562
public static void main(String[] args) { // System.out.println(new Date().getTime() + "," + System.currentTimeMillis()); // new Dao().deleteStudent("99"); Testao dao = new Testao(); List<Student> allStudents = dao.getAllStudents(); System.out.println(allStudents.size()); System.out.println(dao.getAcceptedStud...
169d9409-ff34-4e6a-97eb-4692bb404537
@Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { List<Student> list = new ArrayList<Student>(); System.out.println("in UUServlet.service2..." + list.size()); String method = req.getParameter("method"); String id = req.getParameter("id"...
de8b51fd-ac0a-4d9e-811d-e8156b1fd76a
public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("in ActionServlet.service..."); request.setCharacterEncoding("utf-8"); Testao dao = new Testao(); String method = request.getParameter("method"); if(method!=null && method....
0d14f713-d31e-4d84-9ee9-1cb87a5b7333
@Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { System.out.println("in AAListServlet.service222..."); Testao dao = new Testao(); List<Student> acceptedStudents = dao.getAcceptedStudents(); req.setAttribute("list", acceptedStudents); ...
3bf8e861-6d00-41ae-b6c3-980c25dc04fb
public static Connection getConnection() { String driver = "org.gjt.mm.mysql.Driver"; String url = "jdbc:mysql://localhost:3306/cms?useUnicode=true&characterEncoding=utf-8"; Connection con = null; try { Class.forName(driver); try { System.out.println(url); con = DriverManager.getConnection(url, "r...
80d8ec27-cc8a-43cd-9401-6d4358c638b3
public String getId() { return id; }
932a285e-29bb-481f-885f-ee5cc21be97a
public void setId(String id) { this.id = id; }
4eb08e4d-5e5e-4fb1-9dd9-34379d29c7d3
public String getName() { return name; }
e12ac218-6d79-46f3-9870-154808c9d31d
public void setName(String name) { this.name = name; }
c0c6535e-d243-4fa2-bec8-3700831f6d94
public String getSex() { return sex; }
8baa39db-897f-43f7-9899-1075c3b96e1a
public void setSex(String sex) { this.sex = sex; }
84ae75fc-21e4-4eb6-b60b-6acdc58f7967
public String getSchool() { return school; }
a1518de6-1e46-49d5-8ba2-907d0500c153
public void setSchool(String school) { this.school = school; }
0c541509-6b51-4909-8186-8f45757c2493
public String getAcademy() { return academy; }
8a1ff4a0-01aa-4ce5-9bbd-eba8d3e878f4
public void setAcademy(String academy) { this.academy = academy; }
2a39fe9d-bc54-44c5-a2f3-6b1a67c4f64b
public String getMajor() { return major; }
43038a33-c233-454a-bedf-66e8489e0d7d
public void setMajor(String major) { this.major = major; }
70129be2-9ae3-4aa7-a8b7-030bc89ac7a7
public String getGrade() { return grade; }
37f048bf-52b7-462b-9b51-854ed141f341
public void setGrade(String grade) { this.grade = grade; }