blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
d222371481bd2cf278755254a2e165b7f277fe79
6dcf11607b3b4a2141950f0826699fe0db7a3eff
/app/src/main/java/ch/hundertdampf/android/buchverwaltung/database/BookDAO.java
e42c62c7e79bdee1258c799a7bdc7667b69b701c
[]
no_license
NoahSchaub/Buchverwaltung
3c46044b180745adcb1040c6e54cd95149a2f900
82758b7147448b9b3564487c0e9fa9a400c6ac57
refs/heads/master
2020-03-13T01:34:45.959458
2018-04-24T19:54:27
2018-04-24T19:54:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
691
java
package ch.hundertdampf.android.buchverwaltung.database; import android.arch.persistence.room.Dao; import android.arch.persistence.room.Delete; import android.arch.persistence.room.Insert; import android.arch.persistence.room.Query; import android.arch.persistence.room.Update; import ch.hundertdampf.android.buchverwaltung.entities.Book; /** * Created by Noah on 02.03.2018. */ @Dao public interface BookDAO { @Insert void insertAll(Book... books); @Delete void delete(Book book); @Update void update(Book... books); @Query("DELETE FROM books") void deleteAll(); @Query("SELECT * FROM books WHERE bookId=:id") Book getBookById(int id); }
[ "100dampf@gmail.com" ]
100dampf@gmail.com
3bd1ab9b800551631f7927223feda77ffcdaf079
025904936820215645b0fb9d3401e86bed89ba2f
/src/main/java/com/mcs/controller/admin/TagController.java
b579f09a8670110afeaed4b3b6ed0b3a314d5e43
[]
no_license
MCS5168/Blog
9ccc06845580b9d93fdfc4b18fea2067b35c7f93
f78f710a22e449dff9e2427bd1a33332a8331f8f
refs/heads/master
2023-03-08T21:53:53.591351
2021-02-22T02:53:15
2021-02-22T02:53:15
340,656,908
0
0
null
null
null
null
UTF-8
Java
false
false
3,187
java
package com.mcs.controller.admin; import com.mcs.pojo.Tag; import com.mcs.service.TagService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; import org.springframework.data.web.PageableDefault; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import javax.validation.Valid; @Controller @RequestMapping("/admin") public class TagController { @Autowired private TagService tagService; @GetMapping("/tags") public String tags(@PageableDefault(size = 10, sort = {"id"}, direction = Sort.Direction.DESC) Pageable pageable, Model model) { model.addAttribute("page", tagService.listTag(pageable)); return "admin/tags"; } @GetMapping("/tags/input") public String input(Model model) { model.addAttribute("tag", new Tag()); return "admin/tags-input"; } @GetMapping("/tags/{id}/input") public String editInput(@PathVariable Long id, Model model) { model.addAttribute("tag", tagService.getTag(id)); return "admin/tags-input"; } @PostMapping("/tags") public String post(@Valid Tag tag, BindingResult result, RedirectAttributes attributes) { Tag tag1 = tagService.getTagByName(tag.getName()); if (tag1 != null) { result.rejectValue("name", "nameError", "不能添加重复的分类"); } if (result.hasErrors()) { return "admin/tags-input"; } Tag t = tagService.saveTag(tag); if (t == null) { attributes.addFlashAttribute("message", "新增失败"); } else { attributes.addFlashAttribute("message", "新增成功"); } return "redirect:/admin/tags"; } @PostMapping("/tags/{id}") public String editPost(@Valid Tag tag, BindingResult result, @PathVariable Long id, RedirectAttributes attributes) { Tag tag1 = tagService.getTagByName(tag.getName()); if (tag1 != null) { result.rejectValue("name", "nameError", "不能添加重复的分类"); } if (result.hasErrors()) { return "admin/tags-input"; } Tag t = tagService.updateTag(id, tag); if (t == null) { attributes.addFlashAttribute("message", "更新失败"); } else { attributes.addFlashAttribute("message", "更新成功"); } return "redirect:/admin/tags"; } @GetMapping("/tags/{id}/delete") public String delete(@PathVariable Long id, RedirectAttributes attributes) { tagService.deleteTag(id); attributes.addFlashAttribute("message", "删除成功"); return "redirect:/admin/tags"; } }
[ "1763569073@qq.com" ]
1763569073@qq.com
1bc95142b42e2c95957e749a0002dbc845396ae6
dba87418d2286ce141d81deb947305a0eaf9824f
/sources/com/google/firebase/inappmessaging/internal/RateLimiterClient$$Lambda$8.java
ad59a24d092cd22e698616fff5d535a80ec94162
[]
no_license
Sluckson/copyOavct
1f73f47ce94bb08df44f2ba9f698f2e8589b5cf6
d20597e14411e8607d1d6e93b632d0cd2e8af8cb
refs/heads/main
2023-03-09T12:14:38.824373
2021-02-26T01:38:16
2021-02-26T01:38:16
341,292,450
0
1
null
null
null
null
UTF-8
Java
false
false
834
java
package com.google.firebase.inappmessaging.internal; import com.google.firebase.inappmessaging.internal.RateLimitProto; import p011io.reactivex.functions.Function; /* compiled from: RateLimiterClient */ final /* synthetic */ class RateLimiterClient$$Lambda$8 implements Function { private final RateLimiterClient arg$1; private RateLimiterClient$$Lambda$8(RateLimiterClient rateLimiterClient) { this.arg$1 = rateLimiterClient; } public static Function lambdaFactory$(RateLimiterClient rateLimiterClient) { return new RateLimiterClient$$Lambda$8(rateLimiterClient); } public Object apply(Object obj) { return this.arg$1.storageClient.write((RateLimitProto.RateLimit) obj).doOnComplete(RateLimiterClient$$Lambda$9.lambdaFactory$(this.arg$1, (RateLimitProto.RateLimit) obj)); } }
[ "lucksonsurprice94@gmail.com" ]
lucksonsurprice94@gmail.com
b9cad937f60d886fa57cc49636b9c8c205c29276
69a4f2d51ebeea36c4d8192e25cfb5f3f77bef5e
/methods/Method_8884.java
51c3427b5b6d1208e37e6b27d66fec5fd3142800
[]
no_license
P79N6A/icse_20_user_study
5b9c42c6384502fdc9588430899f257761f1f506
8a3676bc96059ea2c4f6d209016f5088a5628f3c
refs/heads/master
2020-06-24T08:25:22.606717
2019-07-25T15:31:16
2019-07-25T15:31:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,084
java
private void fixLayout(int viewWidth,int viewHeight){ if (bitmapToEdit == null) { return; } viewWidth-=AndroidUtilities.dp(28); viewHeight-=AndroidUtilities.dp(14 + 140 + 60) + (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0); float bitmapW; float bitmapH; if (orientation % 360 == 90 || orientation % 360 == 270) { bitmapW=bitmapToEdit.getHeight(); bitmapH=bitmapToEdit.getWidth(); } else { bitmapW=bitmapToEdit.getWidth(); bitmapH=bitmapToEdit.getHeight(); } float scaleX=viewWidth / bitmapW; float scaleY=viewHeight / bitmapH; if (scaleX > scaleY) { bitmapH=viewHeight; bitmapW=(int)Math.ceil(bitmapW * scaleY); } else { bitmapW=viewWidth; bitmapH=(int)Math.ceil(bitmapH * scaleX); } int bitmapX=(int)Math.ceil((viewWidth - bitmapW) / 2 + AndroidUtilities.dp(14)); int bitmapY=(int)Math.ceil((viewHeight - bitmapH) / 2 + AndroidUtilities.dp(14) + (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0)); LayoutParams layoutParams=(LayoutParams)textureView.getLayoutParams(); layoutParams.leftMargin=bitmapX; layoutParams.topMargin=bitmapY; layoutParams.width=(int)bitmapW; layoutParams.height=(int)bitmapH; curvesControl.setActualArea(bitmapX,bitmapY - (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0),layoutParams.width,layoutParams.height); blurControl.setActualAreaSize(layoutParams.width,layoutParams.height); layoutParams=(LayoutParams)blurControl.getLayoutParams(); layoutParams.height=viewHeight + AndroidUtilities.dp(38); layoutParams=(LayoutParams)curvesControl.getLayoutParams(); layoutParams.height=viewHeight + AndroidUtilities.dp(28); if (AndroidUtilities.isTablet()) { int total=AndroidUtilities.dp(86) * 10; layoutParams=(FrameLayout.LayoutParams)recyclerListView.getLayoutParams(); if (total < viewWidth) { layoutParams.width=total; layoutParams.leftMargin=(viewWidth - total) / 2; } else { layoutParams.width=LayoutHelper.MATCH_PARENT; layoutParams.leftMargin=0; } } }
[ "sonnguyen@utdallas.edu" ]
sonnguyen@utdallas.edu
1755106e18403304c188af29c066da01de092f9e
f9548bf59c80058e324b8caeeec7e0f37e5bcd7d
/Cube_CommandBase/src/org/usfirst/frc/team3663/robot/commands/C_CameraLightSet.java
383402de60a760d0bad168b54c7dfb91e1e89437
[]
no_license
team3663/StrongHold
9feeb072d5bcc2e96f77534dc7b7b8a0255d5924
eded3385e9ff7eb5e58468f82b212c74464b1327
refs/heads/master
2021-03-24T12:52:43.227307
2016-04-30T12:34:07
2016-04-30T12:34:07
51,338,124
0
0
null
null
null
null
UTF-8
Java
false
false
604
java
package org.usfirst.frc.team3663.robot.commands; import org.usfirst.frc.team3663.robot.Robot; import edu.wpi.first.wpilibj.command.Command; /** * */ public class C_CameraLightSet extends Command { private boolean state; public C_CameraLightSet(boolean pState) { state = pState; requires(Robot.ss_Camera); } protected void initialize() { } protected void execute() { Robot.ss_Camera.setLight(state); } protected boolean isFinished() { return true; } protected void end() { } protected void interrupted() { end(); } }
[ "curtis@loginet.com" ]
curtis@loginet.com
fb6ce3be5b61cbece81896653736b5829d6284bc
75d303983f1789b3b26b433117d9360001cd37d9
/BLG 546E - Object Oriented Concurrent Programming/BLG546E/src/blg546e/H/Listener.java
5cff760e79118e9680c68318b02525fabdcf6df6
[]
no_license
tugrulyatagan/itu_comp_eng_lectures
22452ef2af569bbc89de68809595bac5f992d89a
c6f62e142a7df5aaef68e3345833f2092b2f2364
refs/heads/master
2022-12-15T21:18:18.519189
2020-09-20T22:21:46
2020-09-20T22:21:46
297,064,338
14
2
null
null
null
null
UTF-8
Java
false
false
655
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 blg546e.H; import blg546e.BLG546E; import blg546e.Ornekler; /** * * @author ovatman */ public class Listener implements Runnable{ @Override public void run() { int localValue = Ornekler.VALUE; while(localValue < 5){ if(localValue != Ornekler.VALUE){ localValue = Ornekler.VALUE; System.out.println("Global değişken değişti!!!"); } } } }
[ "tugrulyatagan@gmail.com" ]
tugrulyatagan@gmail.com
fed7070743d1610830e0271cf15fb2a0c1223dac
68edeacd234bf6d517a28bc9302cbe3528039fe4
/src/asclepius/asclepius_mainUI.java
2c505dc08d8cda85272f962c5234f34d02915989
[]
no_license
SatouYuri/asclepius-project
580de53e44fef64fd9a1db9ef63c72facf9de155
f4eb788c2ea2db53f6c19239b36335137bfd5852
refs/heads/master
2020-05-15T06:07:02.832251
2019-06-05T17:32:06
2019-06-05T17:32:06
182,117,710
0
1
null
null
null
null
UTF-8
Java
false
false
9,273
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 asclepius; import javax.swing.SwingConstants; /** * * @author Acer */ public class asclepius_mainUI extends javax.swing.JFrame { /** * Creates new form asclepius_mainUI */ public asclepius_mainUI() { initComponents(); setLocationRelativeTo(null); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { panel_main = new javax.swing.JPanel(); panel_question = new javax.swing.JPanel(); label_question = new javax.swing.JLabel(); label_sym = new javax.swing.JLabel(); btn_yes = new javax.swing.JButton(); btn_no = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); panel_main.setBackground(new java.awt.Color(51, 255, 255)); panel_main.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Asclepius 2019", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.BOTTOM)); panel_question.setBackground(new java.awt.Color(0, 204, 204)); panel_question.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)); panel_question.setForeground(new java.awt.Color(102, 102, 102)); panel_question.setToolTipText(""); label_question.setBackground(new java.awt.Color(255, 255, 255)); label_question.setFont(new java.awt.Font("Agency FB", 0, 36)); // NOI18N label_question.setText("Você está sentindo esse sintoma?"); label_sym.setFont(new java.awt.Font("Kalinga", 1, 36)); // NOI18N label_sym.setText("..."); label_sym.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); javax.swing.GroupLayout panel_questionLayout = new javax.swing.GroupLayout(panel_question); panel_question.setLayout(panel_questionLayout); panel_questionLayout.setHorizontalGroup( panel_questionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panel_questionLayout.createSequentialGroup() .addContainerGap() .addGroup(panel_questionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(label_sym, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(panel_questionLayout.createSequentialGroup() .addComponent(label_question) .addGap(0, 0, Short.MAX_VALUE))) .addContainerGap()) ); panel_questionLayout.setVerticalGroup( panel_questionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panel_questionLayout.createSequentialGroup() .addContainerGap() .addComponent(label_question, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(label_sym, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); btn_yes.setBackground(new java.awt.Color(255, 255, 255)); btn_yes.setFont(new java.awt.Font("Agency FB", 1, 36)); // NOI18N btn_yes.setText("Sim"); btn_no.setBackground(new java.awt.Color(255, 255, 255)); btn_no.setFont(new java.awt.Font("Agency FB", 1, 36)); // NOI18N btn_no.setText("Não"); javax.swing.GroupLayout panel_mainLayout = new javax.swing.GroupLayout(panel_main); panel_main.setLayout(panel_mainLayout); panel_mainLayout.setHorizontalGroup( panel_mainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panel_mainLayout.createSequentialGroup() .addContainerGap() .addComponent(panel_question, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panel_mainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(btn_no, javax.swing.GroupLayout.PREFERRED_SIZE, 208, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btn_yes, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); panel_mainLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btn_no, btn_yes}); panel_mainLayout.setVerticalGroup( panel_mainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panel_mainLayout.createSequentialGroup() .addContainerGap() .addGroup(panel_mainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(panel_mainLayout.createSequentialGroup() .addComponent(btn_yes, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btn_no, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addComponent(panel_question, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(224, Short.MAX_VALUE)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(panel_main, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(panel_main, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()) ); pack(); }// </editor-fold>//GEN-END:initComponents /** * @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(asclepius_mainUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(asclepius_mainUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(asclepius_mainUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(asclepius_mainUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new asclepius_mainUI().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btn_no; private javax.swing.JButton btn_yes; private javax.swing.JLabel label_question; private javax.swing.JLabel label_sym; private javax.swing.JPanel panel_main; private javax.swing.JPanel panel_question; // End of variables declaration//GEN-END:variables }
[ "yurimetal4d@gmail.com" ]
yurimetal4d@gmail.com
fb96494eeeb7b5e5a8063d132537ba904b9b4131
b87ebd35a156e1392023629a6e8ec298b98aa726
/src/main/java/au/net/electronichealth/ns/cda/_2_0/ActRelationshipSymptomaticRelief.java
430b92330d77708dff68a9997897f1cfe6021f92
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "BSD-2-Clause" ]
permissive
AuDigitalHealth/cda-schema-java
8112f4f9c5b372e184c96ddabb9e83a35713e0ae
cec3eb9bd9fbf8c759fa9c8b38ac5a1ed9e15d3b
refs/heads/master
2023-02-24T19:31:16.548025
2021-02-08T04:32:39
2021-02-08T04:32:39
335,827,871
0
1
null
null
null
null
UTF-8
Java
false
false
1,149
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2021.02.03 at 09:15:32 AM AEST // package au.net.electronichealth.ns.cda._2_0; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for ActRelationshipSymptomaticRelief. * * <p>The following schema fragment specifies the expected content contained within this class. * <p> * <pre> * &lt;simpleType name="ActRelationshipSymptomaticRelief"> * &lt;restriction base="{urn:hl7-org:v3}cs"> * &lt;enumeration value="SYMP"/> * &lt;/restriction> * &lt;/simpleType> * </pre> * */ @XmlType(name = "ActRelationshipSymptomaticRelief") @XmlEnum public enum ActRelationshipSymptomaticRelief { SYMP; public String value() { return name(); } public static ActRelationshipSymptomaticRelief fromValue(String v) { return valueOf(v); } }
[ "peter.ball@digitalhealth.gov.au" ]
peter.ball@digitalhealth.gov.au
1c61e72ae4f5560fae45713b7f385d112954af84
dc492f4f8b990adbc1adc782ad00017b203b4a8a
/src/by/it/komarov/jd01_09/Test_jd01_09.java
476c82f686bb30d4d2f409e227c5a092523924a3
[]
no_license
vlkzk/JD2019-10-14
24808ead4bd138adbdbd4e00dfdca7497dc2a00d
decbf1b7204e119e38fdb5c543a84525e9b17343
refs/heads/master
2020-08-26T12:44:01.880630
2019-12-15T09:02:08
2019-12-15T09:02:08
217,013,559
1
1
null
2019-10-23T09:00:40
2019-10-23T09:00:39
null
UTF-8
Java
false
false
27,251
java
package by.it.komarov.jd01_09; import org.junit.Test; import java.io.*; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import static org.junit.Assert.*; @SuppressWarnings("all") //поставьте курсор на следующую строку и нажмите Ctrl+Shift+F10 public class Test_jd01_09 { @Test(timeout = 5000) public void testTaskA1__ConsoleRunner() throws Exception { run("3.8+26.2\n" + "87.4-23.1\n" + "1.04*5.9\n" + "12.7*5\n" + "6+12\n" + "7*3.1\n" + "4/8\n" + "9-0.9\n" + "end\n") .include("30.0") //3.8+26.2=30.0 .include("64.3") //87.4-23.1=64.3  .include("6.136") //1.04*5.9=6.136  .include("63.5") //12.7*5=63.5  .include("18.0") //6+12=18.0 .include("21.7") //7*3.1=21.7  .include("0.5") //4/8=0.5  .include("8.1") //9-0.9=8.1  ; } @Test(timeout = 5000) public void testTaskB1__ConsoleRunner() throws Exception { run("{2,3,4}*2\n" + "{3,6,9}/3\n" + "{2,3,4}-5\n" + "4+{2,3,4}\n" + "{2,3,4}+{5,6,7}\n" + "{5,6,7}-{2,3,4}\n" + "end\n") .include("{4.0, 6.0, 8.0}") //{2,3,4}*2 .include("{1.0, 2.0, 3.0}") //{3,6,9}/3 .include("{-3.0, -2.0, -1.0}") //{2,3,4}-5 .include("{6.0, 7.0, 8.0}") //4+{2,3,4} .include("{7.0, 9.0, 11.0}") //{2,3,4}+{5,6,7} .include("{3.0, 3.0, 3.0}") //{5,6,7}-{2,3,4} ; } @Test(timeout = 5000) public void testTaskC1__ConsoleRunner() throws Exception { run("{{1,2},{8,3}}-2\n" + "{{1,2},{8,3}}*{1,2}\n" + "{{1,2},{8,3}}*{{1,2},{8,3}}\n" + "{{1,2},{8,3}}+{{1,2},{8,3}}\n" + "end\n") .include("{{-1.0, 0.0}, {6.0, 1.0}}") //{{1,2},{8,3}}-2 .include("{5.0, 14.0}") //{{1,2},{8,3}}*{1,2} .include("{{17.0, 8.0}, {32.0, 25.0}}") //{{1,2},{8,3}} * {{1,2},{8,3}} .include("{{2.0, 4.0}, {16.0, 6.0}}") //{{1,2},{8,3}}+{{1,2},{8,3}} ; } @Test(timeout = 5000) public void testTaskA0_previos_tasks__Scalar() throws Exception { Test_jd01_09 ok = run("", false); Constructor c = ok.aClass.getDeclaredConstructor(double.class); System.out.println("Создание переменной типа Scalar на основе числа 0.12345"); Object scalar = c.newInstance(0.12345); System.out.println("было выполнено успешно. \nТестирование вывода значения 0.12345 через метод toString()"); System.out.flush(); assertEquals("Не было получено ожидаемое значение 0.12345", scalar.toString(), "0.12345"); System.out.println("выполнено успешно. Scalar=" + scalar); ///----------------------------------------------------------------------------------------------- c = ok.aClass.getDeclaredConstructor(double.class); scalar = c.newInstance(0.12345); c = ok.aClass.getDeclaredConstructor(ok.aClass); System.out.println("Создание переменной типа Scalar на основе объекта Scalar(0.12345)"); scalar = c.newInstance(scalar); System.out.println("было выполнено успешно. \nТестирование вывода значения 0.12345 через метод toString()"); System.out.flush(); assertEquals("Не было получено ожидаемое значение 0.12345", scalar.toString(), "0.12345"); System.out.println("выполнено успешно. Scalar=" + scalar); ///----------------------------------------------------------------------------------------------- c = ok.aClass.getDeclaredConstructor(String.class); System.out.println("Создание переменной типа Scalar на основе строки 0.12345"); scalar = c.newInstance("0.12345"); System.out.println("было выполнено успешно. \nТестирование вывода значения 0.12345 через метод toString()"); System.out.flush(); assertEquals("Не было получено ожидаемое значение 0.12345", scalar.toString(), "0.12345"); System.out.println("выполнено успешно. Scalar=" + scalar); c = ok.aClass.getDeclaredConstructor(double.class); Object v1 = c.newInstance(1.23); Object v2 = c.newInstance(4.56); Class<?> var = v2.getClass().getSuperclass(); String op = "add"; Method m = findMethod(ok.aClass, op, var); Object v3 = invoke(m, v1, v2); if (v3 == null) fail(op + " вернул null"); double res = Double.parseDouble(v3.toString()); assertEquals("Операция 1.23 + 4.56 работает некорректно", 5.79, res, 1e-10); c = ok.aClass.getDeclaredConstructor(double.class); v1 = c.newInstance(1.23); v2 = c.newInstance(4.56); var = v2.getClass().getSuperclass(); op = "sub"; m = findMethod(ok.aClass, op, var); v3 = invoke(m, v1, v2); if (v3 == null) fail(op + " вернул null"); res = Double.parseDouble(v3.toString()); assertEquals("Операция 1.23 - 4.56 работает некорректно", -3.33, res, 1e-10); c = ok.aClass.getDeclaredConstructor(double.class); v1 = c.newInstance(1.23); v2 = c.newInstance(4.56); var = v2.getClass().getSuperclass(); op = "mul"; m = findMethod(ok.aClass, op, var); v3 = invoke(m, v1, v2); if (v3 == null) fail(op + " вернул null"); res = Double.parseDouble(v3.toString()); assertEquals("Операция 1.23 * 4.56 работает некорректно", 5.6088, res, 1e-10); c = ok.aClass.getDeclaredConstructor(double.class); v1 = c.newInstance(1.23); v2 = c.newInstance(4.56); var = v2.getClass().getSuperclass(); op = "div"; m = findMethod(ok.aClass, op, var); v3 = invoke(m, v1, v2); if (v3 == null) fail(op + " вернул null"); res = Double.parseDouble(v3.toString()); assertEquals("Операция 1.23 / 4.56 работает некорректно", 0.269736842105263, res, 1e-10); } @Test(timeout = 5000) public void testTaskB0_previos_tasks__Vector() throws Exception { Test_jd01_09 ok = run("", false); Constructor c = ok.aClass.getDeclaredConstructor(double[].class); System.out.println("Создание переменной типа Vector на основе массива {1,2,4}"); Object vector = c.newInstance(new double[]{1, 2, 4}); System.out.println("было выполнено успешно. \nТестирование вывода значения {1,2,4} через метод toString()"); System.out.flush(); assertEquals("Не было получено ожидаемое значение {1.0, 2.0, 4.0}", vector.toString(), "{1.0, 2.0, 4.0}"); System.out.println("выполнено успешно. Vector=" + vector); ///----------------------------------------------------------------------------------------------- c = ok.aClass.getDeclaredConstructor(double[].class); vector = c.newInstance(new double[]{1, 2, 4}); c = ok.aClass.getDeclaredConstructor(ok.aClass); System.out.println("Создание переменной типа Vector на основе объекта Vector({1,2,4})"); vector = c.newInstance(vector); System.out.println("было выполнено успешно. \nТестирование вывода значения {1,2,4} через метод toString()"); System.out.flush(); assertEquals("Не было получено ожидаемое значение {1.0, 2.0, 4.0}", vector.toString(), "{1.0, 2.0, 4.0}"); System.out.println("выполнено успешно. Vector=" + vector); ///----------------------------------------------------------------------------------------------- c = ok.aClass.getDeclaredConstructor(String.class); System.out.println("Создание переменной типа Vector на основе строки {1,2,4}"); vector = c.newInstance("{1,2,4}"); System.out.println("было выполнено успешно. \nТестирование вывода значения {1,2,4} через метод toString()"); System.out.flush(); assertEquals("Не было получено ожидаемое значение {1.0, 2.0, 4.0}", vector.toString(), "{1.0, 2.0, 4.0}"); System.out.println("выполнено успешно. Vector=" + vector); c = ok.aClass.getDeclaredConstructor(double[].class); Object v1 = c.newInstance(new double[]{1, 2, 3}); Object v2 = c.newInstance(new double[]{4, 5, 6}); Class<?> var = v2.getClass().getSuperclass(); String op = "add"; Method m = findMethod(ok.aClass, op, var); Object v3 = invoke(m, v1, v2); if (v3 == null) fail(op + " вернул null"); assertEquals("Операция {1,2,3} + {4,5,6} работает некорректно", "{5.0, 7.0, 9.0}", v3.toString()); ///проверка операции со скаляром c = findClass("Scalar").getDeclaredConstructor(double.class); v2 = c.newInstance(1.0); v3 = invoke(m, v1, v2); if (v3 == null) fail(op + "со скаляром вернул null"); assertEquals("Операция со скаляром {1,2,3} + 1.0 работает некорректно", "{2.0, 3.0, 4.0}", v3.toString()); c = ok.aClass.getDeclaredConstructor(double[].class); v1 = c.newInstance(new double[]{1, 2, 3}); v2 = c.newInstance(new double[]{4, 5, 6}); var = v2.getClass().getSuperclass(); op = "sub"; m = findMethod(ok.aClass, op, var); v3 = invoke(m, v1, v2); if (v3 == null) fail(op + " вернул null"); assertEquals("Операция {1,2,3} - {4,5,6} работает некорректно", "{-3.0, -3.0, -3.0}", v3.toString()); ///проверка операции со скаляром c = findClass("Scalar").getDeclaredConstructor(double.class); v2 = c.newInstance(1.0); v3 = invoke(m, v1, v2); if (v3 == null) fail(op + "со скаляром вернул null"); assertEquals("Операция со скаляром {1,2,3} - 1.0 работает некорректно", "{0.0, 1.0, 2.0}", v3.toString()); /// c = ok.aClass.getDeclaredConstructor(double[].class); v1 = c.newInstance(new double[]{1, 2, 3}); v2 = c.newInstance(new double[]{4, 5, 6}); var = v2.getClass().getSuperclass(); op = "mul"; m = findMethod(ok.aClass, op, var); v3 = invoke(m, v1, v2); if (v3 == null) fail(op + " вернул null"); assertEquals("Скалярное произведение векторов {1,2,3} * {4,5,6} работает некорректно", "32.0", v3.toString()); ///проверка операции со скаляром c = findClass("Scalar").getDeclaredConstructor(double.class); v2 = c.newInstance(2.0); v3 = invoke(m, v1, v2); if (v3 == null) fail(op + "со скаляром вернул null"); assertEquals("Операция со скаляром {1,2,3} * 2.0 работает некорректно", "{2.0, 4.0, 6.0}", v3.toString()); c = ok.aClass.getDeclaredConstructor(double[].class); v1 = c.newInstance(new double[]{1, 2, 3}); v2 = c.newInstance(new double[]{4, 5, 6}); var = v2.getClass().getSuperclass(); op = "div"; m = findMethod(ok.aClass, op, var); ///проверка операции со скаляром c = findClass("Scalar").getDeclaredConstructor(double.class); Object v4 = c.newInstance(2.0); v3 = invoke(m, v1, v4); if (v3 == null) fail(op + "со скаляром вернул null"); assertEquals("Операция со скаляром {1,2,3} / 2.0 работает некорректно", "{0.5, 1.0, 1.5}", v3.toString()); } @Test(timeout = 5000) public void testTaskC0_previos_tasks__Matrix() throws Exception { Test_jd01_09 ok = run("", false); Constructor c = ok.aClass.getDeclaredConstructor(double[][].class); System.out.println("Создание переменной типа Matrix на основе массива {{1,2},{3,4}}"); Object matrix = c.newInstance(new Object[]{new double[][]{{1, 2}, {3, 4}}}); System.out.println("было выполнено успешно. \nТестирование вывода значения {{1,2},{3,4}} через метод toString()"); System.out.flush(); assertEquals("Не было получено ожидаемое значение {{1.0, 2.0}, {3.0, 4.0}}", matrix.toString().replaceAll(" ", ""), "{{1.0,2.0},{3.0,4.0}}"); System.out.println("выполнено успешно. Matrix=" + matrix); ///----------------------------------------------------------------------------------------------- c = ok.aClass.getDeclaredConstructor(double[][].class); matrix = c.newInstance(new Object[]{new double[][]{{1, 2}, {3, 4}}}); c = ok.aClass.getDeclaredConstructor(ok.aClass); System.out.println("Создание переменной типа Matrix на основе объекта Matrix({{1,2},{3,4}})"); matrix = c.newInstance(matrix); System.out.println("было выполнено успешно. \nТестирование вывода значения {{1,2},{3,4}} через метод toString()"); System.out.flush(); assertEquals("Не было получено ожидаемое значение {{1.0, 2.0}, {3.0, 4.0}}", matrix.toString().replaceAll(" ", ""), "{{1.0,2.0},{3.0,4.0}}"); System.out.println("выполнено успешно. Matrix=" + matrix); ///----------------------------------------------------------------------------------------------- c = ok.aClass.getDeclaredConstructor(String.class); System.out.println("Создание переменной типа Matrix на основе строки {{1,2},{3,4}}"); matrix = c.newInstance("{{1,2},{3,4}}"); System.out.println("было выполнено успешно. \nТестирование вывода значения {{1,2},{3,4}} через метод toString()"); System.out.flush(); assertEquals("Не было получено ожидаемое значение {{1.0, 2.0}, {3.0, 4.0}}", matrix.toString().replaceAll(" ", ""), "{{1.0,2.0},{3.0,4.0}}"); System.out.println("выполнено успешно. Matrix=" + matrix); c = ok.aClass.getDeclaredConstructor(String.class); Object v1 = c.newInstance("{{1, 2}, {3, 4}}"); Object v2 = c.newInstance("{{4, 5}, {7, 8}}"); Class<?> var = v2.getClass().getSuperclass(); String op = "add"; Method m = findMethod(ok.aClass, op, var); Object v3 = invoke(m, v1, v2); if (v3 == null) fail(op + " вернул null"); assertEquals("Операция {{1, 2}, {3, 4}} + {{4, 5}, {7, 8}} работает некорректно", "{{5.0, 7.0}, {10.0, 12.0}}", v3.toString()); ///проверка операции со скаляром c = findClass("Scalar").getDeclaredConstructor(double.class); v2 = c.newInstance(1.0); v3 = invoke(m, v1, v2); if (v3 == null) fail(op + "со скаляром вернул null"); assertEquals("Операция со скаляром {{1, 2}, {3, 4}} + 1.0 работает некорректно", "{{2.0, 3.0}, {4.0, 5.0}}", v3.toString()); c = ok.aClass.getDeclaredConstructor(String.class); v1 = c.newInstance("{{1, 2}, {3, 4}}"); v2 = c.newInstance("{{4, 5}, {7, 8}}"); var = v2.getClass().getSuperclass(); op = "sub"; m = findMethod(ok.aClass, op, var); v3 = invoke(m, v1, v2); if (v3 == null) fail(op + " вернул null"); assertEquals("Операция {{1, 2}, {3, 4}} - {{4, 5}, {7, 8}} работает некорректно", "{{-3.0, -3.0}, {-4.0, -4.0}}", v3.toString()); ///проверка операции со скаляром c = findClass("Scalar").getDeclaredConstructor(double.class); v2 = c.newInstance(1.0); v3 = invoke(m, v1, v2); if (v3 == null) fail(op + "со скаляром вернул null"); assertEquals("Операция со скаляром {{1, 2}, {3, 4}} - 1.0 работает некорректно", "{{0.0, 1.0}, {2.0, 3.0}}", v3.toString()); c = ok.aClass.getDeclaredConstructor(String.class); v1 = c.newInstance("{{1, 2}, {3, 4}}"); v2 = c.newInstance("{{4, 5}, {7, 8}}"); var = v2.getClass().getSuperclass(); op = "mul"; m = findMethod(ok.aClass, op, var); v3 = invoke(m, v1, v2); if (v3 == null) fail(op + " вернул null"); assertEquals("Операция {{1, 2}, {3, 4}} * {{4, 5}, {7, 8}} работает некорректно", "{{18.0, 21.0}, {40.0, 47.0}}", v3.toString()); ///проверка операции с вектором c = findClass("Vector").getDeclaredConstructor(double[].class); v2 = c.newInstance(new double[]{5, 6}); v3 = invoke(m, v1, v2); if (v3 == null) fail(op + "с вектором вернул null"); assertEquals("Операция с вектором {{1, 2}, {3, 4}} * {5, 6} работает некорректно", "{17.0, 39.0}", v3.toString()); ///проверка операции со скаляром c = findClass("Scalar").getDeclaredConstructor(double.class); v2 = c.newInstance(2.0); v3 = invoke(m, v1, v2); if (v3 == null) fail(op + "со скаляром вернул null"); assertEquals("Операция со скаляром {{1, 2}, {3, 4}} * 2.0 работает некорректно", "{{2.0, 4.0}, {6.0, 8.0}}", v3.toString()); } /* =========================================================================================================== НИЖЕ ВСПОМОГАТЕЛЬНЫЙ КОД ТЕСТОВ. НЕ МЕНЯЙТЕ В ЭТОМ ФАЙЛЕ НИЧЕГО. Но изучить как он работает - можно, это всегда будет полезно. =========================================================================================================== */ //------------------------------- методы ---------------------------------------------------------- private Class findClass(String SimpleName) { String full = this.getClass().getName(); String dogPath = full.replace(this.getClass().getSimpleName(), SimpleName); try { return Class.forName(dogPath); } catch (ClassNotFoundException e) { fail("\nERROR:Тест не пройден. Класс " + SimpleName + " не найден."); } return null; } private Method checkMethod(String className, String methodName, Class<?>... parameters) throws Exception { Class aClass = this.findClass(className); try { methodName = methodName.trim(); Method m; if (methodName.startsWith("static")) { methodName = methodName.replace("static", "").trim(); m = aClass.getDeclaredMethod(methodName, parameters); if ((m.getModifiers() & Modifier.STATIC) != Modifier.STATIC) { fail("\nERROR:Метод " + m.getName() + " должен быть статическим"); } } else m = aClass.getDeclaredMethod(methodName, parameters); m.setAccessible(true); return m; } catch (NoSuchMethodException e) { System.err.println("\nERROR:Не найден метод " + methodName + " либо у него неверная сигнатура"); System.err.println("ERROR:Ожидаемый класс: " + className); System.err.println("ERROR:Ожидаемый метод: " + methodName); return null; } } private Method findMethod(Class<?> cl, String name, Class... param) { try { return cl.getDeclaredMethod(name, param); } catch (NoSuchMethodException e) { fail("\nERROR:Тест не пройден. Метод " + cl.getName() + "." + name + " не найден\n"); } return null; } private Object invoke(Method method, Object o, Object... value) { try { method.setAccessible(true); return method.invoke(o, value); } catch (Exception e) { System.out.println(e.toString()); fail("\nERROR:Не удалось вызвать метод " + method.getName() + "\n"); } return null; } //метод находит и создает класс для тестирования //по имени вызывающего его метода, testTaskA1 будет работать с TaskA1 private static Test_jd01_09 run(String in) { return run(in, true); } private static Test_jd01_09 run(String in, boolean runMain) { Throwable t = new Throwable(); StackTraceElement trace[] = t.getStackTrace(); StackTraceElement element; int i = 0; do { element = trace[i++]; } while (!element.getMethodName().contains("test")); String[] path = element.getClassName().split("\\."); String nameTestMethod = element.getMethodName(); String clName = nameTestMethod.replace("test", ""); clName = clName.replaceFirst(".+__", ""); clName = element.getClassName().replace(path[path.length - 1], clName); System.out.println("\n---------------------------------------------"); System.out.println("Старт теста для " + clName); if (!in.isEmpty()) System.out.println("input:" + in); System.out.println("---------------------------------------------"); return new Test_jd01_09(clName, in, runMain); } //------------------------------- тест ---------------------------------------------------------- public Test_jd01_09() { //Конструктор тестов } //переменные теста private String className; private Class<?> aClass; private PrintStream oldOut = System.out; //исходный поток вывода private PrintStream newOut; //поле для перехвата потока вывода private StringWriter strOut = new StringWriter(); //накопитель строки вывода //Основной конструктор тестов private Test_jd01_09(String className, String in, boolean runMain) { //this.className = className; aClass = null; try { aClass = Class.forName(className); this.className = className; } catch (ClassNotFoundException e) { fail("ERROR:Не найден класс " + className + "\n"); } InputStream reader = new ByteArrayInputStream(in.getBytes()); System.setIn(reader); //перехват стандартного ввода System.setOut(newOut); //перехват стандартного вывода if (runMain) //если нужно запускать, то запустим, иначе оставим только вывод try { Class[] argTypes = new Class[]{String[].class}; Method main = aClass.getDeclaredMethod("main", argTypes); main.invoke(null, (Object) new String[]{}); System.setOut(oldOut); //возврат вывода, нужен, только если был запуск } catch (Exception x) { x.printStackTrace(); } } //проверка вывода private Test_jd01_09 is(String str) { assertTrue("ERROR:Ожидается такой вывод:\n<---начало---->\n" + str + "<---конец--->", strOut.toString().equals(str)); return this; } private Test_jd01_09 include(String str) { assertTrue("ERROR:Строка не найдена: " + str + "\n", strOut.toString().contains(str)); return this; } private Test_jd01_09 exclude(String str) { assertTrue("ERROR:Лишние данные в выводе: " + str + "\n", !strOut.toString().contains(str)); return this; } //логический блок перехвата вывода { newOut = new PrintStream(new OutputStream() { private byte bytes[] = new byte[1]; private int pos = 0; @Override public void write(int b) throws IOException { if (pos == 0 && b == '\r') //пропуск \r (чтобы win mac и linux одинаково работали return; //ок. теперь можно делать разбор if (pos == 0) { //определим кодировку https://ru.wikipedia.org/wiki/UTF-8 if ((b & 0b11110000) == 0b11110000) bytes = new byte[4]; else if ((b & 0b11100000) == 0b11100000) bytes = new byte[3]; else if ((b & 0b11000000) == 0b11000000) bytes = new byte[2]; else bytes = new byte[1]; } bytes[pos++] = (byte) b; if (pos == bytes.length) { //символ готов String s = new String(bytes); //соберем весь символ strOut.append(s); //запомним вывод для теста oldOut.append(s); //копию в обычный вывод pos = 0; //готовим новый символ } } }); } }
[ "anton.komaro116@gmail.com" ]
anton.komaro116@gmail.com
415728426391936cec7ba6064b09901659933b17
712d341ccff27928c381e69eb374c001547dbc3c
/app/src/com/readboy/wearlauncher/stepcounter/StepController.java
a8695ed3444725bb65b3ad641d795c2b148279b4
[]
no_license
SinceLiu/WearLauncherA6
b3106f77782689278ca468f1e820089acc016e00
36898d99842ba60e24180aad1681f8ef397ecda9
refs/heads/master
2020-04-08T06:41:21.061728
2019-09-24T12:31:31
2019-09-24T12:31:31
159,106,388
0
1
null
null
null
null
UTF-8
Java
false
false
1,864
java
package com.readboy.wearlauncher.stepcounter; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import java.util.ArrayList; /** * Created by 1 on 2017/5/4. */ public class StepController extends BroadcastReceiver { private static final String TAG = "StepController"; public static final String ACTION_STEP_ADD = "com.readboy.action.StepCountService.stepAdd"; private Context mContext; private int mStepCount; private ArrayList<StepChangeCallback> mStepChangeCallback = new ArrayList<>(); public StepController(Context context){ mContext = context; } /** 开启计步监听*/ public void registerStepAddReceiver() { final IntentFilter filter = new IntentFilter(); filter.addAction(ACTION_STEP_ADD); mContext.registerReceiver(this, filter); } /** 注销计步监听*/ public void unregisterStepAddReceiver() { mContext.unregisterReceiver(this); } public void addStepChangeCallback(StepChangeCallback cb){ mStepChangeCallback.add(cb); cb.onStepChange(mStepCount); } public void removeStepChangeCallback(StepChangeCallback cb){ mStepChangeCallback.remove(cb); } private void fireStepChange(){ for (StepChangeCallback cb : mStepChangeCallback){ cb.onStepChange(mStepCount); } } @Override public void onReceive(Context context, Intent intent) { if (ACTION_STEP_ADD.equals(intent.getAction())) { int steps = intent.getIntExtra("steps", 0); mStepCount = steps; fireStepChange(); } } public interface StepChangeCallback { void onStepChange(int step); } }
[ "lxx@readboy.com" ]
lxx@readboy.com
72c467a79879e82e1e3a45e1bb349c1087ea3036
4ceaa4d6ed6fd3402c01394d04df7df22afc6448
/Homestay/src/java/nguyen/models/Cart.java
259791303e5f378c3cdf9c00f96d654b56022ec6
[]
no_license
gabrielnguyen-zz/Homestay-Management
8f8e12d94073020417cd4d3927682e6fd78e2641
6002765e55789950f9bbba7a28b3b9e13a198cbb
refs/heads/master
2020-11-26T23:22:06.805659
2019-12-20T09:03:37
2019-12-20T09:03:37
229,228,748
0
0
null
null
null
null
UTF-8
Java
false
false
1,970
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 nguyen.models; import java.io.Serializable; import java.util.HashMap; import java.util.Map; /** * * @author Gabriel Nguyen */ public class Cart implements Serializable { private String customerName; private Map<String, InvoiceDTO> cart; public String getCustomerName() { return customerName; } public void setCustomerName(String customerName) { this.customerName = customerName; } public Cart(String customerName, Map<String, InvoiceDTO> cart) { this.customerName = customerName; this.cart = cart; } public void setCart(Map<String, InvoiceDTO> cart) { this.cart = cart; } public Map<String, InvoiceDTO> getCart() { return cart; } public void addToRoomCart(InvoiceDTO dto) throws Exception { if (cart == null) { cart = new HashMap<>(); int quantity = 1; dto.setRoomQuantity(quantity); cart.put(Integer.toString(dto.getRoomID()), dto); } else { cart.clear(); int quantity = 1; dto.setRoomQuantity(quantity); cart.put(Integer.toString(dto.getRoomID()), dto); } } // public void addToServiceCart(InvoiceDTO dto)throws Exception { int quantity = 1; if (this.cart.containsKey(dto.getRoomID() + "")) { quantity = this.cart.get(dto.getRoomID() + "").getServiceQuantity(); dto.setServiceQuantity(quantity); } else { dto.setServiceQuantity(quantity); } cart.put(Integer.toString(dto.getRoomID()), dto); } public void delete(String id)throws Exception{ if(this.cart.containsKey(id)){ this.cart.remove(id); } } }
[ "59083327+gabrielnguyen-zz@users.noreply.github.com" ]
59083327+gabrielnguyen-zz@users.noreply.github.com
3f2b532c437c7baeef5b1f21f775dd8e4a244a55
c356b29162ac7f1a2adab1f9548ba62d12c7e060
/src/gensnake/app/GenePool.java
aaac682d08e63e2319e436bd2a079d7a6e8b6e69
[]
no_license
philowaddell/snake-genetic-algorithm-wip
9110f2e90ed4deab55d059745f162a39ad29f041
314817cf5f99148bcefd0196fa7b26b340b29684
refs/heads/master
2022-03-30T09:55:27.424499
2020-01-31T18:43:42
2020-01-31T18:43:42
237,310,027
0
0
null
null
null
null
UTF-8
Java
false
false
659
java
package gensnake.app; import java.awt.Graphics; import java.awt.Point; import java.util.ArrayList; import gensnake.instance.Instance; public class GenePool { private ArrayList<Instance> pool; public GenePool() { Point origin; pool = new ArrayList<Instance>(); for( int i = 0; i < App.POOLS_DOWN; i++ ) { for( int j = 0; j < App.POOLS_ACROSS; j++ ) { origin = new Point( j * App.POOL_SIZE, i * App.POOL_SIZE); pool.add( new Instance( origin ) ); } } } public void tick() { for( Instance i : pool ) { i.tick(); } } public void render( Graphics g ) { for( Instance i : pool ) { i.render(g); } } }
[ "pw466@bath.ac.uk" ]
pw466@bath.ac.uk
da0b193ca3a7326b5ef64bc013b03ec0af85bd05
e7818f3c8f1a86472c3060993d28f52cbde749b2
/src/ru/barsopen/plsqlconverter/ast/typed/body_mode.java
72cf3d612ea2111e6dcedfb2be4b93a5f7aa7224
[]
no_license
liuyuanyuan/plsql-pgsql-converter
a9fbc59493b26b9ec06820358617a28cf35bc31a
428c86c09f3be7ef448fe704d7fff4abc90d97e6
refs/heads/master
2020-04-07T12:16:07.250078
2018-11-27T05:56:43
2018-11-27T05:56:43
158,360,845
1
0
null
null
null
null
UTF-8
Java
false
false
3,698
java
package ru.barsopen.plsqlconverter.ast.typed; public class body_mode implements function_impl, create_procedure_body_impl, _baseNode { public int _line = -1; public int _col = -1; public int _tokenStartIndex = -1; public int _tokenStopIndex = -1; public _baseNode _parent = null; public _baseNode _getParent() { return _parent; } public void _setParent(_baseNode value) { _parent = value; } public void _setBaseNode(_baseNode value) { this._parent = value; } public int _getLine() { return _line; } public int _getCol() { return _col; } public int _getTokenStartIndex() { return _tokenStartIndex; } public int _getTokenStopIndex() { return _tokenStopIndex; } ru.barsopen.plsqlconverter.util.AttachedComments _comments; public void setComments(ru.barsopen.plsqlconverter.util.AttachedComments comments) { this._comments = comments; } public ru.barsopen.plsqlconverter.util.AttachedComments getAttachedComments() { return this._comments; } public void _setCol(int col) { this._col = col; } public void _setLine(int line) { this._line = line; } public block block = null; public block get_block() { return this.block; } public void set_block(block value) { if (this.block != null) { this.block._setParent(null); } this.block = value; if (this.block != null) { this.block._setParent(this); } } public void _walk(_visitor visitor) { if (!visitor.enter(this)) { return; } if (this.block != null) { this.block._walk(visitor); } visitor.leave(this); } public java.util.List<_baseNode> _getChildren() { java.util.List<_baseNode> result = new java.util.ArrayList<_baseNode>(); if (this.block != null) { result.add(this.block); } return result; } public void _replace(_baseNode child, _baseNode replacement) { if (this.block == child) { this.set_block((ru.barsopen.plsqlconverter.ast.typed.block)replacement); return; } throw new RuntimeException("Failed to replace node: no such node"); } public org.antlr.runtime.tree.Tree unparse() { org.antlr.runtime.CommonToken _token = new org.antlr.runtime.CommonToken(ru.barsopen.plsqlconverter.PLSQLPrinter.BODY_MODE); _token.setLine(_line); _token.setCharPositionInLine(_col); _token.setText("BODY_MODE"); org.antlr.runtime.tree.CommonTree _result = new org.antlr.runtime.tree.CommonTree(_token); if (_comments != null) { org.antlr.runtime.tree.CommonTree commentsNode = new org.antlr.runtime.tree.CommonTree( new org.antlr.runtime.CommonToken(ru.barsopen.plsqlconverter.PLSQLPrinter.COMMENT)); org.antlr.runtime.tree.CommonTree commentsBeforeNode = new org.antlr.runtime.tree.CommonTree( new org.antlr.runtime.CommonToken(ru.barsopen.plsqlconverter.PLSQLPrinter.COMMENT, _comments.getBefore())); org.antlr.runtime.tree.CommonTree commentsAfterNode = new org.antlr.runtime.tree.CommonTree( new org.antlr.runtime.CommonToken(ru.barsopen.plsqlconverter.PLSQLPrinter.COMMENT, _comments.getAfter())); org.antlr.runtime.tree.CommonTree commentsInsideNode = new org.antlr.runtime.tree.CommonTree( new org.antlr.runtime.CommonToken(ru.barsopen.plsqlconverter.PLSQLPrinter.COMMENT, _comments.getInside())); commentsNode.addChild(commentsBeforeNode); commentsNode.addChild(commentsInsideNode); commentsNode.addChild(commentsAfterNode); _result.addChild(commentsNode); } _result.setTokenStartIndex(_tokenStartIndex); _result.setTokenStopIndex(_tokenStopIndex); if (block == null) { throw new RuntimeException(); } _result.addChild(block.unparse()); return _result; } }
[ "liuyuanyuan@highgo.com" ]
liuyuanyuan@highgo.com
e6277788861992e4940dcc799ff9e556df369b63
eb0a78040c6e290639d053cfcd45388ac83d9ab7
/HotelApp/src/main/java/HotelApp/dataAccessRepos/AdminRepo.java
f90d3303e74a53bff6c243e6f0433f634712d365
[]
no_license
BothIoan/HotelApp
4c9018878fb62644c5f1a90cebd8d0635f684ba8
ff9e281ee75ba68ee2ae38f1e3858b91747c1246
refs/heads/master
2022-12-16T16:28:19.068937
2020-09-21T15:56:31
2020-09-21T15:56:31
297,374,890
0
0
null
null
null
null
UTF-8
Java
false
false
296
java
package HotelApp.dataAccessRepos; import HotelApp.model.Admin; import org.springframework.data.jpa.repository.JpaRepository; import java.util.Optional; public interface AdminRepo extends JpaRepository<Admin, Long> { Optional<Admin> findByEmailAndPassword(String email, String password); }
[ "rodieee@pop-os.localdomain" ]
rodieee@pop-os.localdomain
ba84c160f1163766a63c73a83c18b29e01e72e87
d8cde34e7da8991972b354475a5d0320e5bce200
/.svn/pristine/f5/f5bd96a1938c47d296f6589646c1928769953308.svn-base
20616854018d5847065b22afecd6fd4ae2ebbf8b
[]
no_license
akundurkar/SME_SERVICES
c4609d9a8b0cde542372b2c7c5ae7ed691d6a1c3
e328b0ab1cac269ac0fd7d89ffb41a5d7d156622
refs/heads/master
2021-09-08T00:33:39.301369
2018-03-04T12:09:42
2018-03-04T12:09:42
123,549,799
0
0
null
null
null
null
UTF-8
Java
false
false
8,787
package in.adcast.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import in.adcast.common.utils.AppConstant; import in.adcast.dto.BranchDto; import in.adcast.dto.BranchScheduleDto; import in.adcast.dto.ServiceCategoryDto; import in.adcast.dto.ServiceDto; import in.adcast.dto.ServiceMasterdto; import in.adcast.dto.ServiceNamesDto; import in.adcast.dto.StaffDto; import in.adcast.dto.UserDto; import in.adcast.exception.CustomRuntimeException; import in.adcast.services.BranchService; import in.adcast.services.LoginService; @RestController public class BranchController { private static final String COMMON_SERVICE_PATH = "/rest/branch/"; @Autowired private BranchService branchService; @Autowired private LoginService service ; @RequestMapping(value=COMMON_SERVICE_PATH+"addNewBranch", method=RequestMethod.POST) public UserDto addNewBranch(@RequestBody BranchDto branchDto ,HttpServletResponse response){ boolean success; success = branchService.addNewBranch(branchDto); if(success) return service.findByUUID(branchDto.getUserId()); else return null; } @RequestMapping(value=COMMON_SERVICE_PATH+"/deleteLocationDetails", method =RequestMethod.POST) public String deleteLocationDetails(@RequestBody BranchDto branchDto){ boolean success = branchService.deleteLocationDetails(branchDto.getBranchId()); if(success){ return AppConstant.SUCCESS; } else{ return AppConstant.ERROR; } } @RequestMapping(value="/rest/updateBranchInformation", method=RequestMethod.POST) public BranchDto updateBranchInformation(@RequestBody BranchDto branchDtoReq ,HttpServletResponse response){ BranchDto branchDto = branchService.updateBranchInformation(branchDtoReq); if(branchDto != null) return branchDto; else return null; } @RequestMapping(value=COMMON_SERVICE_PATH+"setBranchSchedule", method=RequestMethod.POST) public String setBranchSchedule(@RequestBody BranchScheduleDto branchScheduleDto ,HttpServletResponse response){ boolean success = false ; success = branchService.setBranchSchedule(branchScheduleDto); if(success) return AppConstant.SUCCESS; else return AppConstant.ERROR; } @RequestMapping(value="/rest/addNewService", method=RequestMethod.POST) public String addNewService(@RequestBody ServiceDto serviceDtoReq ,HttpServletResponse response){ boolean success = false ; success = branchService.addNewService(serviceDtoReq); if(success) return AppConstant.SUCCESS; else return AppConstant.ERROR; } @RequestMapping(value="/rest/changeServiceDetails", method=RequestMethod.POST) public List<ServiceDto> changeServiceDetails(@RequestBody ServiceDto serviceDtoReq ,HttpServletResponse response){ return branchService.changeServiceDetails(serviceDtoReq); } @RequestMapping(value="/rest/showAllServicesAtBranch", method=RequestMethod.POST) public List<ServiceDto> showAllServicesAtBranch(@RequestBody ServiceDto serviceDtoReq ,HttpServletResponse response){ return branchService.showAllServicesAtBranch(serviceDtoReq); } @RequestMapping(value="/rest/deleteServiceDetails", method =RequestMethod.POST) public String deleteServiceDetails(@RequestBody ServiceDto serviceDto){ boolean success = branchService.deleteServiceDetails(serviceDto.getServiceId()); if(success){ return AppConstant.SUCCESS; } else{ return AppConstant.ERROR; } } @RequestMapping(value="/rest/addNewStaff", method=RequestMethod.POST) public List<StaffDto> addNewStaff(@RequestBody StaffDto staffDtoReq ,HttpServletResponse response){ return branchService.addNewStaff(staffDtoReq); } @RequestMapping(value="/rest/changeStaffDetails", method=RequestMethod.POST) public List<StaffDto> changeStaffDetails(@RequestBody StaffDto staffDtoReq ,HttpServletResponse response){ return branchService.changeStaffDetails(staffDtoReq); } @RequestMapping(value="/rest/addNewServiceGroup", method=RequestMethod.POST) public String addNewServiceGroup(@RequestBody ServiceMasterdto serviceMasterdto ,HttpServletResponse response) { boolean result = false ; result= branchService.addNewServiceGroup(serviceMasterdto); if(result) return AppConstant.SUCCESS; else return AppConstant.ERROR; } @RequestMapping(value=COMMON_SERVICE_PATH +"/list", method=RequestMethod.GET) public List<BranchDto> getAllLocation(@RequestParam(required = false) String userId) { List<BranchDto> branchDtoList = null; try{ branchDtoList = branchService.findAll(userId,null); }catch (Exception e){ e.printStackTrace(); throw new CustomRuntimeException("GENERAL EXCEPTION", e.getMessage(),HttpStatus.INTERNAL_SERVER_ERROR); } return branchDtoList; } @RequestMapping(value=COMMON_SERVICE_PATH +"/getCompanyLocation", method=RequestMethod.GET) public BranchDto getCompanyLocation(@RequestParam(required = false) Integer branchId) { BranchDto branchDto = null; try{ branchDto=branchService.getCompanyLocation(branchId); } catch (Exception e){ e.printStackTrace(); throw new CustomRuntimeException("GENERAL EXCEPTION", e.getMessage(),HttpStatus.INTERNAL_SERVER_ERROR); } return branchDto; } @RequestMapping(value=COMMON_SERVICE_PATH +"/listBranchesForOrg", method=RequestMethod.GET) public List<BranchDto> getAllLocationForOrganization(@RequestParam(required = false) Integer orgId) { List<BranchDto> branchDtoList = null; try{ branchDtoList = branchService.findAll(null,orgId); }catch (Exception e){ e.printStackTrace(); throw new CustomRuntimeException("GENERAL EXCEPTION", e.getMessage(),HttpStatus.INTERNAL_SERVER_ERROR); } return branchDtoList; } @RequestMapping(value="rest/listServices", method=RequestMethod.GET) public List<ServiceCategoryDto> listServices(@RequestParam(required = false) Integer organisationId) { List<ServiceCategoryDto> servicesDtoList = null; try{ servicesDtoList = branchService.listServicesByOrganisation(organisationId); }catch (Exception e){ e.printStackTrace(); throw new CustomRuntimeException("GENERAL EXCEPTION", e.getMessage(),HttpStatus.INTERNAL_SERVER_ERROR); } return servicesDtoList; } @RequestMapping(value=COMMON_SERVICE_PATH +"/searchServiceNameList", method=RequestMethod.GET) public List<ServiceNamesDto> searchServiceNameList(@RequestParam(required = false) String userId) { List<ServiceNamesDto> serviceNameList=null; try{ serviceNameList = branchService.searchServiceNameList(userId); } catch (Exception e){ e.printStackTrace(); throw new CustomRuntimeException("GENERAL EXCEPTION", e.getMessage(),HttpStatus.INTERNAL_SERVER_ERROR); } return serviceNameList; } @RequestMapping(value=COMMON_SERVICE_PATH +"/searchStaffNameList", method=RequestMethod.GET) public List<UserDto> searchStaffNameList(@RequestParam(required = false) Integer organisationId) { List<UserDto> staffNameList=null; try{ staffNameList = branchService.searchStaffNameList(organisationId); }catch(Exception e){ e.printStackTrace(); throw new CustomRuntimeException("GENERAL EXCEPTION", e.getMessage(),HttpStatus.INTERNAL_SERVER_ERROR); } return staffNameList; } @RequestMapping(value=COMMON_SERVICE_PATH +"/searchServiceDetailsList", method=RequestMethod.GET) public List<ServiceMasterdto> getAllServiceDetails(@RequestParam(required = false) String userId) { List<ServiceMasterdto> serviceDtoList = null; try{ serviceDtoList = branchService.getAllServiceDetails(userId); } catch (Exception e){ e.printStackTrace(); throw new CustomRuntimeException("GENERAL EXCEPTION", e.getMessage(),HttpStatus.INTERNAL_SERVER_ERROR); } return serviceDtoList; } @RequestMapping(value=COMMON_SERVICE_PATH +"/searchStaffDetailsList", method=RequestMethod.GET) public List<UserDto> getAllStaffDetails(@RequestParam(required = false) String userId) { List<UserDto> userDtosList = null; try{ userDtosList = branchService.getAllStaffDetails(userId); }catch(Exception e){ e.printStackTrace(); throw new CustomRuntimeException("GENERAL EXCEPTION", e.getMessage(),HttpStatus.INTERNAL_SERVER_ERROR); } return userDtosList; } }
[ "36983991+akundurkar@users.noreply.github.com" ]
36983991+akundurkar@users.noreply.github.com
431aca402a1345f289c4897d0cc424c9deddb864
77591a9a3188bb6e1a55ba82342eac5f03393890
/20.03 pt2/src/samochod.java
6a292469bbdf4e5a3e7eb37e8f565c36f9fad723
[]
no_license
USSbart/Praktyki
cb1468ccfad794074fb417256bc09143c1ba0df9
351bfb2e303c123d20a745d249606872779a3995
refs/heads/main
2023-03-29T06:12:12.458710
2021-03-20T13:25:48
2021-03-20T13:25:48
343,234,825
0
0
null
null
null
null
UTF-8
Java
false
false
517
java
public class samochod implements Pojazd{ @Override public void jedzDoPrzodu() { System.out.println("Jazda naprzód"); } @Override public void stop() { System.out.println("Zatrzymywanie"); } @Override public boolean awaria() { return false; } @Override public void skrecwLewo() { System.out.println("skrętka w lewo"); } @Override public void skrecwPrawo() { System.out.println("skrętka w prawo"); } }
[ "kalinowskibartosz@wp.pl" ]
kalinowskibartosz@wp.pl
072123058b95030a7d7333fb67414a6746d3a3b4
6a25101fe74b45553569d663ac9413c8a97a0cc6
/ORM_is-a_Table_per_ConcreetClass/src/classses/Company.java
a60472e6ae9c0a66d89c1ced4bd14ef02b23135d
[]
no_license
abhi-manyu/Hibernate
4ea8c61c64651e3f85bc45325b94dc7d00965e31
99235b01474760d2cb96090f823e4bf0e64a68e2
refs/heads/master
2022-12-23T19:06:48.651813
2020-03-15T18:03:32
2020-03-15T18:03:32
180,941,542
0
0
null
2022-12-16T02:55:53
2019-04-12T06:08:28
JavaScript
UTF-8
Java
false
false
461
java
package classses; public class Company { private int reg_no; private String name; public Company() { } public Company(int reg_no, String name) { super(); this.reg_no = reg_no; this.name = name; } public int getReg_no() { return reg_no; } public void setReg_no(int reg_no) { this.reg_no = reg_no; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
[ "abhim.moharana@gmail.com" ]
abhim.moharana@gmail.com
b9de7bad7a769d7a33c0f81e44efa52fc496e537
e3b1a99ff96c50674651236cbb5ad67c6a5332b0
/working-effectively-with-legacycode-java/src/main/java/com/uj/wrap/classes/s3/LoggingPayDispatcher.java
53202fa4198516073a4a093e31299f84c14df108
[]
no_license
unclejet/software-craftsman-ship
6388864bf4acaa0b543b0e26d65dd110a8ebac5b
6310c5b618f32cb84ff193e625b6c38a8469f460
refs/heads/master
2023-03-31T11:36:18.494187
2021-04-05T01:25:34
2021-04-05T01:25:34
292,982,586
0
0
null
null
null
null
UTF-8
Java
false
false
437
java
package com.uj.wrap.classes.s3; import com.uj.wrap.classes.s1.Employee; /** * @author :UncleJet * @date :Created in 2020/12/1 上午9:07 * @description: */ public class LoggingPayDispatcher { private Employee e; public LoggingPayDispatcher(Employee e) { this.e = e; } public void pay() { e.pay(); logPayment(); } private void logPayment() { //... } //... }
[ "unclejet@126.com" ]
unclejet@126.com
c4b94ab0636fa2335e2b13fc8070da7caef84458
3a407c069dc1ba52c0c59799eae0e1039ea8389f
/fuo/core/fuo.core/src/main/java/cn/night/fuo/rpc/process/async/RpcAsyncProcessor1.java
49f5ad4c36d88b30c271e232de74d43e6b242394
[]
no_license
NightPxy/demo
5569bc1c22d3fe339743d626bcd3aedbc5609d47
40385e86a8010691bf378c5c26891c500433e24c
refs/heads/master
2022-12-22T11:36:26.657788
2020-03-15T14:45:53
2020-03-15T14:45:53
240,574,481
0
0
null
2022-12-14T20:42:00
2020-02-14T18:32:15
Java
UTF-8
Java
false
false
1,499
java
package cn.night.fuo.rpc.process.async; import cn.night.fuo.rpc.handlers.RpcProcessHandler1; import java.util.function.Consumer; /** * Created by Night on 2020/2/24. */ public class RpcAsyncProcessor1<T, R> extends RpcAsyncProcessor<R> { private RpcProcessHandler1<T, R> handler; public RpcAsyncProcessor1(RpcAsyncContext context, RpcProcessHandler1<T, R> handler) { super(context); this.handler = handler; } public RpcAsyncProcessor1<T, R> name(String processName) { this.processName = processName; return this; } private T t1; public RpcAsyncProcessor1<T, R> apply(T t1) { this.t1 = t1; return this; } public RpcAsyncProcessor1<T, R> callback(Consumer<R> callback){ this.processCallback = callback; return this; } public RpcAsyncProcessor1<T, R> trace(String trace){ return this; } @Override void executeRpc() { String traceId = ""; try { log.info(() -> "trace:" + traceId + this.processName+ " 发送请求:{}" + this.t1.toString()); R response = this.handler.call(t1); log.info(() -> "trace:" + traceId + this.processName+ " 接受响应:{}" + response.toString()); if (this.processCallback != null) { this.processCallback.accept(response); } } catch (Exception e) { log.info(e, () -> "trace:" + traceId + " 发生异常"); } } }
[ "38695281@qq.com" ]
38695281@qq.com
0e475aeac785868b14b31460882d5ac31eaf43dd
cfc6be21a73f6fe30946fc40d9c60b88423be584
/UdeskSDKUI/src/main/java/cn/udesk/activity/UdeskFormActivity.java
3e00f80461d781872f29b67a467a64d8441a5676
[]
no_license
ixingzhi/Sendnar
ad4dcc0c21e7e5d653a699e19d3d6adb14dfbd84
00a2178d1f654f7b0ed31d12ba61ac0fae49508b
refs/heads/master
2020-03-19T07:47:27.885177
2018-07-09T11:01:43
2018-07-09T11:01:43
136,148,252
0
0
null
null
null
null
UTF-8
Java
false
false
2,065
java
package cn.udesk.activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import cn.udesk.R; import cn.udesk.UdeskSDKManager; import cn.udesk.UdeskUtil; import cn.udesk.config.UdekConfigUtil; import cn.udesk.config.UdeskBaseInfo; import cn.udesk.config.UdeskConfig; public class UdeskFormActivity extends UdeskBaseWebViewActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); loadingView(); } private void loadingView() { try { settingTitlebar(); String url = "https://" + UdeskSDKManager.getInstance().getDomain(this) + "/im_client/feedback.html" + UdeskUtil.getFormUrlPara(this); mwebView.loadUrl(url); } catch (Exception e) { e.printStackTrace(); } } /** * titlebar 的设置 */ private void settingTitlebar() { try { if (mTitlebar != null) { UdekConfigUtil.setUITextColor(UdeskConfig.udeskTitlebarTextLeftRightResId, mTitlebar.getLeftTextView(), mTitlebar.getRightTextView()); if (mTitlebar.getRootView() != null){ UdekConfigUtil.setUIbgDrawable(UdeskConfig.udeskTitlebarBgResId ,mTitlebar.getRootView()); } if (UdeskConfig.DEFAULT != UdeskConfig.udeskbackArrowIconResId) { mTitlebar.getUdeskBackImg().setImageResource(UdeskConfig.udeskbackArrowIconResId); } mTitlebar .setLeftTextSequence(getString(R.string.udesk_ok)); mTitlebar.setLeftLinearVis(View.VISIBLE); mTitlebar.setLeftViewClick(new OnClickListener() { @Override public void onClick(View v) { finish(); } }); } } catch (Exception e) { e.printStackTrace(); } } }
[ "xiedongdong.dev@gmail.com" ]
xiedongdong.dev@gmail.com
fdd2128eec4ce3f734276a7c8e4709091e5ab825
6166d590288bf6029257bb6359995727e99a66c0
/23-spring-data-jpa-cruddemo/src/main/java/com/ashish/springboot/cruddemo/service/EmployeeService.java
30c8816b9efc9bd45bda64b2347acd0167bcc61b
[]
no_license
yuvrajmahalle/spring-hibernate-and-spring-boot
5403bb82336c7ad0d7c478b59c2e039d4f1f979c
79e5616ec42ca0c6b8aedc981c2a2e025bda5b9d
refs/heads/main
2023-03-25T19:10:12.546808
2021-03-13T12:02:24
2021-03-13T12:02:24
338,768,698
0
0
null
null
null
null
UTF-8
Java
false
false
324
java
package com.ashish.springboot.cruddemo.service; import java.util.List; import com.ashish.springboot.cruddemo.entity.Employee; public interface EmployeeService { public List<Employee> findAll(); public Employee findById(int theId); public void save(Employee theEmployee); public void deleteById(int theId); }
[ "aashishmahalle90@gmail.com" ]
aashishmahalle90@gmail.com
f56bed6c5cfac59373be852db9acd1c74111874a
417016e054a4c343da9174d796c7c48c7de828c4
/Weather/src/jatx/weather/CitySearchActivity.java
345ee38c2799b8f8df0e21e309ede4826cbf49c0
[]
no_license
Sathen/jatx
a33f83504f90037c9659d6b6744b48d2ed390d08
9123fd2a64e5b5974d902ee4c2233fa466c375a0
refs/heads/master
2021-01-14T12:35:11.041063
2014-12-13T10:08:32
2014-12-13T10:08:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,028
java
package jatx.weather; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ListView; public class CitySearchActivity extends Activity { private Context mContext; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_city_search); mContext = this; final EditText searchText = (EditText) findViewById(R.id.searchText); final Button searchButton = (Button) findViewById(R.id.searchButton); final ListView citySearchListView = (ListView) findViewById(R.id.citySearchListView); searchButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String query = searchText.getText().toString(); CitySearchListAdapter csla = new CitySearchListAdapter(mContext, query); citySearchListView.setAdapter(csla); } }); } }
[ "e.tabatsky@gmail.com" ]
e.tabatsky@gmail.com
09f11b2474f18c9ca236f358b71ca7d45301432c
9d9fd06f479aaafa7f4f60b8ea1ccfbb6940ef46
/MAVGCL/src/com/comino/flight/widgets/charts/xy/XYChartWidget.java
e9d1ad45c98c7cd0a89aecbbb5f3f2f9da71bd84
[ "BSD-3-Clause", "BSD-2-Clause" ]
permissive
RamDG/MAVGCL
420db7137d44c8c8cfaea71bd44fd83be4e2ed59
006cd4244a2b69ed7c9c88797af948f73f50985e
refs/heads/master
2020-05-27T21:17:49.995187
2017-03-02T08:06:18
2017-03-02T08:06:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
24,259
java
/**************************************************************************** * * Copyright (c) 2017 Eike Mansfeld ecm@gmx.de. 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 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.comino.flight.widgets.charts.xy; import java.io.File; import java.io.IOException; import java.util.List; import java.util.prefs.Preferences; import javax.imageio.ImageIO; import org.mavlink.messages.MSP_CMD; import com.comino.flight.FXMLLoadHelper; import com.comino.flight.model.AnalysisDataModel; import com.comino.flight.model.AnalysisDataModelMetaData; import com.comino.flight.model.KeyFigureMetaData; import com.comino.flight.model.service.AnalysisModelService; import com.comino.flight.model.service.ICollectorRecordingListener; import com.comino.flight.observables.StateProperties; import com.comino.flight.prefs.MAVPreferences; import com.comino.flight.widgets.charts.control.IChartControl; import com.comino.flight.widgets.charts.line.XYDataPool; import com.comino.jfx.extensions.SectionLineChart; import com.comino.mav.control.IMAVController; import com.comino.msp.utils.MSPMathUtils; import com.emxsys.chart.extension.XYAnnotations.Layer; import javafx.application.Platform; import javafx.beans.property.BooleanProperty; import javafx.beans.property.FloatProperty; import javafx.beans.property.IntegerProperty; import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleFloatProperty; import javafx.beans.property.SimpleIntegerProperty; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.embed.swing.SwingFXUtils; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.fxml.FXML; import javafx.scene.SnapshotParameters; import javafx.scene.chart.NumberAxis; import javafx.scene.chart.XYChart; import javafx.scene.control.Button; import javafx.scene.control.CheckBox; import javafx.scene.control.ChoiceBox; import javafx.scene.control.Label; import javafx.scene.control.Slider; import javafx.scene.control.Tooltip; import javafx.scene.image.WritableImage; import javafx.scene.input.MouseEvent; import javafx.scene.layout.BorderPane; import javafx.scene.paint.Color; public class XYChartWidget extends BorderPane implements IChartControl, ICollectorRecordingListener { private static String[][] PRESETS = { { null , null }, { "LPOSX" , "LPOSY" }, { "LPOSVX" , "LPOSVY" }, { "VISIONX" , "VISIONY" }, { "SPLPOSX" , "SPLPOSY" }, { "PITCH" , "ROLL" }, { "ACCX" , "ACCY" }, }; private final static String[] PRESET_NAMES = { "None", "Loc.Position", "Loc.Speed", "Vision Position", "SP Loc.Position", "Attitude", "Acceleration" }; private final static String[] SCALES = { "Auto", "0.1", "0.2", "0.5","1", "2", "5", "10", "20","50", "100", "200" }; @FXML private SectionLineChart<Number,Number> linechart; @FXML private NumberAxis xAxis; @FXML private NumberAxis yAxis; @FXML private ChoiceBox<String> cseries1; @FXML private ChoiceBox<String> cseries2; @FXML private ChoiceBox<KeyFigureMetaData> cseries1_x; @FXML private ChoiceBox<KeyFigureMetaData> cseries1_y; @FXML private ChoiceBox<KeyFigureMetaData> cseries2_x; @FXML private ChoiceBox<KeyFigureMetaData> cseries2_y; @FXML private ChoiceBox<String> scale_select; @FXML private Slider rotation; @FXML private Label rot_label; @FXML private CheckBox normalize; @FXML private CheckBox auto_rotate; @FXML private Button export; @FXML private CheckBox force_zero; @FXML private CheckBox corr_zero; @FXML private CheckBox annotation; @FXML private CheckBox slam; private XYChart.Series<Number,Number> series1; private XYChart.Series<Number,Number> series2; private IMAVController control; private KeyFigureMetaData type1_x=null; private KeyFigureMetaData type1_y=null; private KeyFigureMetaData type2_x=null; private KeyFigureMetaData type2_y=null; private StateProperties state = null; private IntegerProperty timeFrame = new SimpleIntegerProperty(30); private FloatProperty scroll = new SimpleFloatProperty(0); private int resolution_ms = 50; private float scale = 0; private Preferences prefs = MAVPreferences.getInstance(); private int current_x_pt=0; private int current_x0_pt=0; private int current_x1_pt=0; private int frame_secs =30; private float rotation_rad = 0; private float[] p1 = new float[2]; private float[] p2 = new float[2]; private XYStatistics s1 = new XYStatistics(); private XYStatistics s2 = new XYStatistics(); private XYDashBoardAnnotation dashboard1 = null; private XYDashBoardAnnotation dashboard2 = null; private PositionAnnotation endPosition1 = null; private PositionAnnotation endPosition2 = null; private XYSLAMBlockAnnotation slamblocks = null; private XYDataPool pool = null; private boolean refreshRequest = false; private boolean isRunning = false; private float old_center_x, old_center_y; private AnalysisDataModelMetaData meta = AnalysisDataModelMetaData.getInstance(); private AnalysisModelService dataService = AnalysisModelService.getInstance(); private BooleanProperty isScrolling = new SimpleBooleanProperty(); public XYChartWidget() { FXMLLoadHelper.load(this, "XYChartWidget.fxml"); this.state = StateProperties.getInstance(); pool = new XYDataPool(); dataService.registerListener(this); } @Override public void update(long now) { if(isVisible() && !isDisabled() && isRunning) { Platform.runLater(() -> { updateGraph(refreshRequest); }); } } @FXML private void initialize() { this.dashboard1 = new XYDashBoardAnnotation(0,s1); this.dashboard2 = new XYDashBoardAnnotation(90,s2); this.endPosition1 = new PositionAnnotation("P",Color.DARKSLATEBLUE); this.endPosition2 = new PositionAnnotation("P",Color.DARKOLIVEGREEN); this.slamblocks = new XYSLAMBlockAnnotation(); linechart.lookup(".chart-plot-background").setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent click) { if (click.getClickCount() == 2) { System.out.println(xAxis.getValueForDisplay(click.getX())+":" +yAxis.getValueForDisplay(click.getY())); } } }); xAxis.setAutoRanging(true); xAxis.setForceZeroInRange(false); yAxis.setAutoRanging(true); yAxis.setForceZeroInRange(false); cseries1.getItems().addAll(PRESET_NAMES); cseries2.getItems().addAll(PRESET_NAMES); linechart.setLegendVisible(false); linechart.prefWidthProperty().bind(heightProperty().subtract(20).multiply(1.05f)); linechart.prefHeightProperty().bind(heightProperty().subtract(20)); initKeyFigureSelection(meta.getKeyFigures()); scale_select.getItems().addAll(SCALES); scale_select.getSelectionModel().select(0); xAxis.setLowerBound(-5); xAxis.setUpperBound(5); yAxis.setLowerBound(-5); yAxis.setUpperBound(5); xAxis.setTickUnit(1); yAxis.setTickUnit(1); linechart.prefHeightProperty().bind(heightProperty().subtract(10)); cseries1.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { if(PRESETS[newValue.intValue()][0]!=null) cseries1_x.getSelectionModel().select(meta.getMetaData(PRESETS[newValue.intValue()][0])); else cseries1_x.getSelectionModel().select(0); if(PRESETS[newValue.intValue()][1]!=null) cseries1_y.getSelectionModel().select(meta.getMetaData(PRESETS[newValue.intValue()][1])); else cseries1_y.getSelectionModel().select(0); prefs.putInt(MAVPreferences.XYCHART_FIG_1,newValue.intValue()); } }); cseries2.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { if(PRESETS[newValue.intValue()][0]!=null) cseries2_x.getSelectionModel().select(meta.getMetaData(PRESETS[newValue.intValue()][0])); else cseries2_x.getSelectionModel().select(0); if(PRESETS[newValue.intValue()][1]!=null) cseries2_y.getSelectionModel().select(meta.getMetaData(PRESETS[newValue.intValue()][1])); else cseries2_y.getSelectionModel().select(0); prefs.putInt(MAVPreferences.XYCHART_FIG_2,newValue.intValue()); } }); cseries1_x.getSelectionModel().selectedItemProperty().addListener((observable, ov, nv) -> { String x_desc = ""; if(nv!=null) { type1_x = nv; if(type1_x.hash!=0) x_desc = x_desc + type1_x.desc1+" ["+type1_x.uom+"] "; if(type2_x.hash!=0) x_desc = x_desc + type2_x.desc1+" ["+type2_x.uom+"] "; xAxis.setLabel(x_desc); updateRequest(); } }); cseries1_y.getSelectionModel().selectedItemProperty().addListener((observable, ov, nv) -> { String y_desc = ""; if(nv!=null) { type1_y = nv; if(type1_y.hash!=0) y_desc = y_desc + type1_y.desc1+" ["+type1_y.uom+"] "; if(type2_y.hash!=0) y_desc = y_desc + type2_y.desc1+" ["+type2_y.uom+"] "; yAxis.setLabel(y_desc); updateRequest(); } }); cseries2_x.getSelectionModel().selectedItemProperty().addListener((observable, ov, nv) -> { String x_desc = ""; if(nv!=null) { type2_x = nv; if(type1_x.hash!=0) x_desc = x_desc + type1_x.desc1+" ["+type1_x.uom+"] "; if(type2_x.hash!=0) x_desc = x_desc + type2_x.desc1+" ["+type2_x.uom+"] "; xAxis.setLabel(x_desc); corr_zero.setDisable(!(type1_y.hash!=0 && (type2_y.hash!=0))); updateRequest(); } }); cseries2_y.getSelectionModel().selectedItemProperty().addListener((observable, ov, nv) -> { String y_desc = ""; if(nv!=null) { type2_y = nv; if(type1_y.hash!=0) y_desc = y_desc + type1_y.desc1+" ["+type1_y.uom+"] "; if(type2_y.hash!=0) y_desc = y_desc + type2_y.desc1+" ["+type2_y.uom+"] "; yAxis.setLabel(y_desc); corr_zero.setDisable(!(type1_y.hash!=0 && (type2_y.hash!=0))); updateRequest(); } }); cseries1.getSelectionModel().select(prefs.getInt(MAVPreferences.XYCHART_FIG_1,0)); cseries2.getSelectionModel().select(prefs.getInt(MAVPreferences.XYCHART_FIG_2,0)); scale_select.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { if(newValue.intValue()>0) scale = Float.parseFloat(SCALES[newValue.intValue()]); else scale = 0; setScaling(scale); updateRequest(); prefs.putInt(MAVPreferences.XYCHART_SCALE,newValue.intValue()); } }); rotation.valueProperty().addListener(new ChangeListener<Number>() { public void changed(ObservableValue<? extends Number> ov, Number old_val, Number new_val) { auto_rotate.setSelected(false); rotation_rad = MSPMathUtils.toRad(new_val.intValue()); rot_label.setText("Rotation: ["+new_val.intValue()+"°]"); updateRequest(); } }); rotation.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent click) { if (click.getClickCount() == 2) { rotation_rad = 0; rotation.setValue(0); rot_label.setText("Rotation: [ 0°]"); } } }); rotation.setTooltip(new Tooltip("Double-click to set to 0°")); auto_rotate.setDisable(true); auto_rotate.selectedProperty().addListener((v,ov,nv) -> { rotation.setDisable(nv.booleanValue()); rotation.setValue(0); updateRequest(); }); export.setOnAction((ActionEvent event)-> { saveAsPng(System.getProperty("user.home")); }); timeFrame.addListener((v, ov, nv) -> { setXResolution(nv.intValue()); }); force_zero.setOnAction((ActionEvent event)-> { updateRequest(); prefs.putBoolean(MAVPreferences.XYCHART_CENTER,force_zero.isSelected()); }); force_zero.setSelected(prefs.getBoolean(MAVPreferences.XYCHART_CENTER, false)); corr_zero.setOnAction((ActionEvent event)-> { updateRequest(); prefs.putBoolean(MAVPreferences.XYCHART_OFFSET,force_zero.isSelected()); }); corr_zero.setSelected(prefs.getBoolean(MAVPreferences.XYCHART_OFFSET, false)); scroll.addListener((v, ov, nv) -> { current_x0_pt = dataService.calculateX0Index(nv.floatValue()); updateRequest(); }); annotation.selectedProperty().addListener((v, ov, nv) -> { updateRequest(); }); annotation.selectedProperty().set(true); slam.setSelected(prefs.getBoolean(MAVPreferences.XYCHART_SLAM, false)); rotation.setDisable(slam.isSelected()); slam.selectedProperty().addListener((v, ov, nv) -> { if(nv.booleanValue()) { rotation_rad = 0; rotation.setValue(0); } rotation.setDisable(nv.booleanValue()); updateRequest(); prefs.putBoolean(MAVPreferences.XYCHART_SLAM,slam.isSelected()); }); } private void setXResolution(int frame) { this.frame_secs = frame; if(frame >= 200) resolution_ms = 400; else if(frame >= 60) resolution_ms = 200; else if(frame >= 30) resolution_ms = 100; else if(frame >= 15) resolution_ms = 50; else resolution_ms = dataService.getCollectorInterval_ms(); current_x0_pt = dataService.calculateX0Index(1); current_x_pt = dataService.calculateX0Index(1); scroll.setValue(1); refreshChart(); } public void saveAsPng(String path) { SnapshotParameters param = new SnapshotParameters(); param.setFill(Color.BLACK); WritableImage image = linechart.snapshot(param, null); File file = new File(path+"/xychart.png"); try { ImageIO.write(SwingFXUtils.fromFXImage(image, null), "png", file); } catch (IOException e) { } } private void updateGraph(boolean refresh) { AnalysisDataModel m =null; if(disabledProperty().get()) return; if(auto_rotate.isSelected()) { rotation_rad = -control.getCurrentModel().attitude.y; } List<AnalysisDataModel> mList = dataService.getModelList(); if(refresh) { if(mList.size()==0 && dataService.isCollecting()) { refreshRequest = true; return; } // synchronized(this) { refreshRequest = false; series1.getData().clear(); series2.getData().clear(); pool.invalidateAll(); linechart.getAnnotations().clearAnnotations(Layer.FOREGROUND); linechart.getAnnotations().clearAnnotations(Layer.BACKGROUND); if(slam.isSelected()) { slamblocks.invalidate(); linechart.getAnnotations().add(slamblocks,Layer.BACKGROUND); } s1.setKeyFigures(type1_x, type1_y); if(type1_x.hash!=0 && type1_y.hash!=0 && annotation.isSelected() && mList.size()>0) { m = mList.get(0); rotateRad(p1,m.getValue(type1_x), m.getValue(type1_y), rotation_rad); linechart.getAnnotations().add(dashboard1, Layer.FOREGROUND); linechart.getAnnotations().add(endPosition1, Layer.FOREGROUND); linechart.getAnnotations().add( new PositionAnnotation(p1[0],p1[1],"S", Color.DARKSLATEBLUE) ,Layer.FOREGROUND); } s2.setKeyFigures(type2_x, type2_y); if(type2_x.hash!=0 && type2_y.hash!=0 && annotation.isSelected() && mList.size()>0) { m = mList.get(0); if(corr_zero.isSelected()) rotateRad(p2,m.getValue(type2_x)-(s2.center_x-s1.center_x), m.getValue(type2_y)-(s2.center_y-s1.center_y), rotation_rad); else rotateRad(p2,m.getValue(type2_x), m.getValue(type2_y), rotation_rad); linechart.getAnnotations().add(dashboard2, Layer.FOREGROUND); linechart.getAnnotations().add(endPosition2, Layer.FOREGROUND); linechart.getAnnotations().add( new PositionAnnotation(p2[0],p2[1],"S", Color.DARKOLIVEGREEN) ,Layer.FOREGROUND); } // } current_x_pt = current_x0_pt; current_x1_pt = current_x0_pt + timeFrame.intValue() * 1000 / dataService.getCollectorInterval_ms(); if(current_x_pt < 0) current_x_pt = 0; slamblocks.set(control.getCurrentModel().slam,scale); } if(mList.size()<1) return; if(force_zero.isSelected() || annotation.isSelected()) { s1.getStatistics(current_x0_pt,current_x1_pt,mList); s2.getStatistics(current_x0_pt,current_x1_pt,mList); } if(force_zero.isSelected() && scale > 0 ) { float x = 0; float y = 0; if(type1_x.hash!=0) { // if(type1_x.hash!=0 && type2_x.hash==0) { x = s1.center_x; y = s1.center_y; } if(type2_x.hash!=0 && type1_x.hash==0) { x = s2.center_x; y = s2.center_y; } // if(type2_x.hash!=0 && type1_x.hash!=0) { // x = (s1.center_x + s2.center_x ) / 2f; // y = (s1.center_y + s2.center_y ) / 2f; // } if(Math.abs(x - old_center_x)> scale/4) { x = (int)(x * 100) / (100f); xAxis.setLowerBound(x-scale); xAxis.setUpperBound(x+scale); old_center_x = x; } if(Math.abs(y - old_center_y)> scale/4) { y = (int)(y * 100) / (100f); yAxis.setLowerBound(y-scale); yAxis.setUpperBound(y+scale); old_center_y = y; } } if(current_x_pt<mList.size() && mList.size()>0 ) { int max_x = mList.size(); if(!state.getRecordingProperty().get() && current_x1_pt < max_x) max_x = current_x1_pt; while(current_x_pt<max_x) { //System.out.println(current_x_pt+"<"+max_x+":"+resolution_ms); if(((current_x_pt * dataService.getCollectorInterval_ms()) % resolution_ms) == 0) { m = mList.get(current_x_pt); if(current_x_pt > current_x1_pt) { current_x0_pt += resolution_ms / dataService.getCollectorInterval_ms(); current_x1_pt += resolution_ms / dataService.getCollectorInterval_ms(); if(series1.getData().size()>0) { pool.invalidate(series1.getData().get(0)); series1.getData().remove(0); } if(series2.getData().size()>0) { pool.invalidate(series2.getData().get(0)); series2.getData().remove(0); } } if(type1_x.hash!=0 && type1_y.hash!=0) { rotateRad(p1,m.getValue(type1_x), m.getValue(type1_y), rotation_rad); series1.getData().add(pool.checkOut(p1[0],p1[1])); } if(type2_x.hash!=0 && type2_y.hash!=0) { if(corr_zero.isSelected()) rotateRad(p2,m.getValue(type2_x)-(s2.center_x-s1.center_x), m.getValue(type2_y)-(s2.center_y-s1.center_y), rotation_rad); else rotateRad(p2,m.getValue(type2_x), m.getValue(type2_y), rotation_rad); series2.getData().add(pool.checkOut(p2[0],p2[1])); } } current_x_pt++; } endPosition1.setPosition(p1[0], p1[1]); endPosition2.setPosition(p2[0], p2[1]); } } public XYChartWidget setup(IMAVController control) { series1 = new XYChart.Series<Number,Number>(); linechart.getData().add(series1); series2 = new XYChart.Series<Number,Number>(); linechart.getData().add(series2); this.control = control; state.getRecordingProperty().addListener((o,ov,nv) -> { if(nv.booleanValue()) { current_x0_pt = 0; setXResolution(timeFrame.get()); scroll.setValue(0); isRunning = true; } else isRunning = false; }); current_x0_pt = dataService.calculateX0Index(1); current_x1_pt = current_x0_pt + timeFrame.intValue() * 1000 / dataService.getCollectorInterval_ms(); scale_select.getSelectionModel().select(prefs.getInt(MAVPreferences.XYCHART_SCALE,0)); try { scale = Float.parseFloat(scale_select.getSelectionModel().getSelectedItem()); setScaling(scale); } catch(NumberFormatException e) { } this.getParent().disabledProperty().addListener((l,o,n) -> { if(!n.booleanValue()) { current_x0_pt = dataService.calculateX0Index(scroll.get()); current_x1_pt = current_x0_pt + timeFrame.intValue() * 1000 / dataService.getCollectorInterval_ms(); updateRequest(); } }); return this; } public IntegerProperty getTimeFrameProperty() { return timeFrame; } @Override public FloatProperty getScrollProperty() { return scroll; } public BooleanProperty getIsScrollingProperty() { return isScrolling ; } @Override public void refreshChart() { if(frame_secs > 60) frame_secs = 60; current_x0_pt = control.getCollector().calculateX0Index(1); setScaling(scale); updateRequest(); } private void updateRequest() { slamblocks.invalidate(); if(!isDisabled()) { old_center_x = 0; old_center_y = 0; if(dataService.isCollecting()) { refreshRequest = true; Platform.runLater(() -> { updateGraph(true); }); } else { Platform.runLater(() -> { updateGraph(true); }); } } } private void setScaling(float scale) { if(scale>0) { force_zero.setDisable(false); xAxis.setAutoRanging(false); yAxis.setAutoRanging(false); xAxis.setLowerBound(-scale); xAxis.setUpperBound(+scale); yAxis.setLowerBound(-scale); yAxis.setUpperBound(+scale); if(scale>10) { xAxis.setTickUnit(10); yAxis.setTickUnit(10); } else if(scale>2) { xAxis.setTickUnit(1); yAxis.setTickUnit(1); } else if(scale>0.5f) { xAxis.setTickUnit(0.5); yAxis.setTickUnit(0.5); } else { xAxis.setTickUnit(0.1); yAxis.setTickUnit(0.1); } } else { xAxis.setAutoRanging(true); yAxis.setAutoRanging(true); force_zero.setDisable(true); force_zero.setSelected(false); } } private void rotateRad(float[] rotated, float posx, float posy, float heading_rad) { if(heading_rad!=0) { rotated[1] = ( posx - old_center_x ) * (float)Math.cos(heading_rad) + ( posy - old_center_y ) * (float)Math.sin(heading_rad) + old_center_x; rotated[0] = -( posx - old_center_x ) * (float)Math.sin(heading_rad) + ( posy - old_center_y ) * (float)Math.cos(heading_rad) + old_center_y; } else { rotated[1] = posx; rotated[0] = posy; } } private void initKeyFigureSelection(List<KeyFigureMetaData> kfl) { cseries1_x.getItems().clear(); cseries2_x.getItems().clear(); cseries1_y.getItems().clear(); cseries2_y.getItems().clear(); type1_x = new KeyFigureMetaData(); type2_x = new KeyFigureMetaData(); type1_y = new KeyFigureMetaData(); type2_y = new KeyFigureMetaData(); cseries1_x.getItems().add((type1_x)); cseries1_x.getItems().addAll(kfl); cseries1_y.getItems().add((type1_y)); cseries1_y.getItems().addAll(kfl); cseries1_x.getSelectionModel().select(0); cseries1_y.getSelectionModel().select(0); cseries2_x.getItems().add((type2_x)); cseries2_x.getItems().addAll(kfl); cseries2_y.getItems().add((type1_y)); cseries2_y.getItems().addAll(kfl); cseries2_x.getSelectionModel().select(0); cseries2_y.getSelectionModel().select(0); cseries1.getSelectionModel().select(0); cseries2.getSelectionModel().select(0); cseries1.getSelectionModel().select(0); cseries2.getSelectionModel().select(0); } }
[ "ecm@gmx.de" ]
ecm@gmx.de
64be87eb9258b3b161655fe941ed8b8e2bcc5edf
93438588e73d0a1773144e1d9a362b227b3230ac
/CrudEJB/ejbModule/com/model/User.java
1f89b1ea72792f5069421dc7f6067edbb5ecc525
[]
no_license
przemyslawhaptas/catering_company
69b98eb7cad6020e86526105c3041eea220a6cea
67453af482a3c96a776b8cf7541c1d10a486f0e4
refs/heads/master
2021-05-01T17:29:17.499946
2016-09-11T21:47:17
2016-09-11T21:47:17
66,262,525
0
0
null
null
null
null
UTF-8
Java
false
false
2,457
java
package com.model; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.NamedQuery; import javax.persistence.OneToOne; import javax.persistence.Table; @Entity @Table(name = "USERS") @NamedQuery(name="User.findUserByEmail", query="select u from User u where u.email = :email") public class User { public static final String FIND_BY_EMAIL = "User.findUserByEmail"; @Id @GeneratedValue(strategy=GenerationType.AUTO) private int id; @Column(unique = true) private String email; private String password; private String firstName; private String lastName; private String role; @OneToOne @JoinColumn(name = "payment_info_id") private PaymentInfo paymentInfo; @OneToOne @JoinColumn(name = "address_info_id") private AddressInfo addressInfo; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getRole() { return role.toLowerCase(); } public void setRole(String role) { this.role = role; } public PaymentInfo getPaymentInfo() { return paymentInfo; } public void setPaymentInfo(PaymentInfo paymentInfo) { this.paymentInfo = paymentInfo; } public AddressInfo getAddressInfo() { return addressInfo; } public void setAddressInfo(AddressInfo addressInfo) { this.addressInfo = addressInfo; } @Override public int hashCode() { return getId(); } @Override public boolean equals(Object obj) { if(obj instanceof User){ User user = (User) obj; return user.getEmail().equals(getEmail()); } return false; } }
[ "przemyslawhaptas@gmail.com" ]
przemyslawhaptas@gmail.com
e94d29724d90e9b9341a028b283927ab482d076c
129f58086770fc74c171e9c1edfd63b4257210f3
/src/testcases/CWE369_Divide_by_Zero/CWE369_Divide_by_Zero__float_URLConnection_modulo_67a.java
8924a108fbfaf130a96db629d53f51ebf7ff6d76
[]
no_license
glopezGitHub/Android23
1bd0b6a6c7ce3c7439a74f1e4dcef2c4c0fac4ba
6215d0684c4fbdc7217ccfbedfccfca69824cc5e
refs/heads/master
2023-03-07T15:14:59.447795
2023-02-06T13:59:49
2023-02-06T13:59:49
6,856,387
0
3
null
2023-02-06T18:38:17
2012-11-25T22:04:23
Java
UTF-8
Java
false
false
6,836
java
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE369_Divide_by_Zero__float_URLConnection_modulo_67a.java Label Definition File: CWE369_Divide_by_Zero__float.label.xml Template File: sources-sinks-67a.tmpl.java */ /* * @description * CWE: 369 Divide by zero * BadSource: URLConnection Read data from a web server with URLConnection * GoodSource: A hardcoded non-zero number (two) * Sinks: modulo * GoodSink: Check for zero before modulo * BadSink : Modulo by a value that may be zero * Flow Variant: 67 Data flow: data passed in a class from one method to another in different source files in the same package * * */ package testcases.CWE369_Divide_by_Zero; import testcasesupport.*; import java.sql.*; import javax.servlet.http.*; import java.security.SecureRandom; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; import java.net.URL; import java.net.URLConnection; import java.util.logging.Level; import java.util.logging.Logger; public class CWE369_Divide_by_Zero__float_URLConnection_modulo_67a extends AbstractTestCase { static class Container { public float a; } public void bad() throws Throwable { float data; data = -1.0f; /* Initialize data */ /* read input from URLConnection */ { URLConnection conn = (new URL("http://www.example.org/")).openConnection(); BufferedReader buffread = null; InputStreamReader instrread = null; try { instrread = new InputStreamReader(conn.getInputStream(), "UTF-8"); buffread = new BufferedReader(instrread); /* POTENTIAL FLAW: Read data from a web server with URLConnection */ String s_data = buffread.readLine(); // This will be reading the first "line" of the response body, // which could be very long if there are no newlines in the HTML if (s_data != null) { try { data = Float.parseFloat(s_data.trim()); } catch(NumberFormatException nfe) { IO.logger.log(Level.WARNING, "Number format exception parsing data from string", nfe); } } } catch( IOException ioe ) { IO.logger.log(Level.WARNING, "Error with stream reading", ioe); } finally { /* clean up stream reading objects */ try { if( buffread != null ) { buffread.close(); } } catch( IOException ioe ) { IO.logger.log(Level.WARNING, "Error closing BufferedReader", ioe); } try { if( instrread != null ) { instrread.close(); } } catch( IOException ioe ) { IO.logger.log(Level.WARNING, "Error closing InputStreamReader", ioe); } } } Container data_container = new Container(); data_container.a = data; (new CWE369_Divide_by_Zero__float_URLConnection_modulo_67b()).bad_sink(data_container ); } public void good() throws Throwable { goodG2B(); goodB2G(); } /* goodG2B() - use goodsource and badsink */ private void goodG2B() throws Throwable { float data; /* FIX: Use a hardcoded number that won't a divide by zero */ data = 2.0f; Container data_container = new Container(); data_container.a = data; (new CWE369_Divide_by_Zero__float_URLConnection_modulo_67b()).goodG2B_sink(data_container ); } /* goodB2G() - use badsource and goodsink */ private void goodB2G() throws Throwable { float data; data = -1.0f; /* Initialize data */ /* read input from URLConnection */ { URLConnection conn = (new URL("http://www.example.org/")).openConnection(); BufferedReader buffread = null; InputStreamReader instrread = null; try { instrread = new InputStreamReader(conn.getInputStream(), "UTF-8"); buffread = new BufferedReader(instrread); /* POTENTIAL FLAW: Read data from a web server with URLConnection */ String s_data = buffread.readLine(); // This will be reading the first "line" of the response body, // which could be very long if there are no newlines in the HTML if (s_data != null) { try { data = Float.parseFloat(s_data.trim()); } catch(NumberFormatException nfe) { IO.logger.log(Level.WARNING, "Number format exception parsing data from string", nfe); } } } catch( IOException ioe ) { IO.logger.log(Level.WARNING, "Error with stream reading", ioe); } finally { /* clean up stream reading objects */ try { if( buffread != null ) { buffread.close(); } } catch( IOException ioe ) { IO.logger.log(Level.WARNING, "Error closing BufferedReader", ioe); } try { if( instrread != null ) { instrread.close(); } } catch( IOException ioe ) { IO.logger.log(Level.WARNING, "Error closing InputStreamReader", ioe); } } } Container data_container = new Container(); data_container.a = data; (new CWE369_Divide_by_Zero__float_URLConnection_modulo_67b()).goodB2G_sink(data_container ); } /* Below is the main(). It is only used when building this testcase on its own for testing or for building a binary to use in testing binary analysis tools. It is not used when compiling all the testcases as one application, which is how source code analysis tools are tested. */ public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException { mainFromParent(args); } }
[ "guillermo.pando@gmail.com" ]
guillermo.pando@gmail.com
84501fa21f5bdb69cd1985dd99217c6b98a0c642
3aad35f31d6315d4fddaa7e7950b9284f1b0b459
/Mobile-ART/app/src/main/java/com/mvp/mobile_art/Model/Responses/OfferResponse.java
ce8cc4829c06f73a45120f6a0dcb98f677ae20b0
[]
no_license
BukhariMuslim/MasterClean-Care
47d349f1dc5a0d6508cc4d5869c8ae376ea725a1
7fd88e09aa01c546d83f87ba7ce4edc57b056568
refs/heads/master
2021-01-25T11:48:32.767283
2018-02-13T03:29:56
2018-02-13T03:29:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
391
java
package com.mvp.mobile_art.Model.Responses; import com.mvp.mobile_art.Model.Basic.Offer; import com.mvp.mobile_art.lib.models.Response; /** * Created by jcla123ns on 28/07/17. */ public class OfferResponse extends Response { private Offer offer; public Offer getOffer() { return offer; } public void setOffer(Offer offer) { this.offer = offer; } }
[ "Clarens.Jay@gmail.com" ]
Clarens.Jay@gmail.com
84c8abd1522ab5810a8c0cfa3cf8bf44db6c409d
5981e57584925905bda6ab095d7f549eeac3c620
/src/main/java/fr/dbo/poc/client/util/SimpleDTOSerializer.java
d4ced3d66aa3009b4ecbb25b53bba86e7e1d58b5
[]
no_license
dboissin/poc-atmosphere-gwt
a4393a3a19ab07e590bbb1179dd023726a675ae4
d75904c535fb31f65eb8609f3c2941cd6bed6db2
refs/heads/master
2016-09-05T15:00:47.787196
2011-05-15T16:05:12
2011-05-15T16:05:12
1,077,116
1
0
null
null
null
null
UTF-8
Java
false
false
298
java
package fr.dbo.poc.client.util; import org.atmosphere.gwt.client.AtmosphereGWTSerializer; import org.atmosphere.gwt.client.SerialTypes; import fr.dbo.poc.shared.dto.SimpleDTO; @SerialTypes(value = {SimpleDTO.class}) public abstract class SimpleDTOSerializer extends AtmosphereGWTSerializer { }
[ "damien.boissin@gmail.com" ]
damien.boissin@gmail.com
155f8ca5da2a2a2c0bedf7d1a751669d18c20a8d
750934af1ea5f7f96cd8b914717886af946bd170
/day10/src/code/day10/demo01_接口的定义和格式/Static.java
a2521132d7cce8a5199323390854e22b142b5f2a
[]
no_license
lokyxia/Java_Basic
44f02a415d861e2a4263355a143f99ada538d356
6d482fa704e21ed12090bfd9755e8564559f03fa
refs/heads/main
2023-01-24T15:17:00.753000
2020-12-06T15:02:40
2020-12-06T15:02:40
315,878,097
0
0
null
null
null
null
UTF-8
Java
false
false
409
java
package code.day10.demo01_接口的定义和格式; /** * 从Java8开始,接口允许定义静态方法 * 格式: * public static 返回值类型 方法名称(){ * 方法体 * } * 提示:就是将abstract或者default换成static即可,带上方法体 */ public interface Static { public static void methodStatic(){ System.out.println("这是接口的静态方法"); } }
[ "626841770@qq.com" ]
626841770@qq.com
187c70731edc7f05c570f5cb49772168c522f876
dbec52bb53d8276e9175e4fe27038f6a12d35b5b
/org/apache/naming/TransactionRef.java
a7239316389fe91a6aad4a82fbbe12bbd24f4229
[]
no_license
dingjun84/taobao-tomcat-catalina
78f5727c221c8e32b7c037202d4fdb2919c8f54f
46ad54aac50b6441943363e0e8de100edaa3f767
refs/heads/master
2021-01-23T12:57:03.276977
2016-06-05T14:09:45
2016-06-05T14:09:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,057
java
package org.apache.naming; import javax.naming.Reference; public class TransactionRef extends Reference { private static final long serialVersionUID = 1L; public static final String DEFAULT_FACTORY = "org.apache.naming.factory.TransactionFactory"; public TransactionRef() { this(null, null); } public TransactionRef(String factory, String factoryLocation) { super("javax.transaction.UserTransaction", factory, factoryLocation); } public String getFactoryClassName() { String factory = super.getFactoryClassName(); if (factory != null) { return factory; } factory = System.getProperty("java.naming.factory.object"); if (factory != null) { return null; } return "org.apache.naming.factory.TransactionFactory"; } } /* Location: D:\F\阿里云架构开发\taobao-tomcat-7.0.59\taobao-tomcat-7.0.59\lib\catalina.jar!\org\apache\naming\TransactionRef.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
[ "sinxsoft@gmail.com" ]
sinxsoft@gmail.com
e32d1ab88ff5dfffa35d10db00ed1df79c2f2914
1d38f00721bd1df43db749e805ccac3b7a7b1268
/src/main/java/http/RemoveSegmentFromPlaylistRequest.java
ffcb66f2f0e073a8cd7a9cfbe694279465aa300c
[]
no_license
AveryS00/WitchOfEndor
555910ae1b698ab6c8a34747d7ca30942d01ab6e
bdb9864209b07f236ddebe606d900a3e234a07c2
refs/heads/master
2020-09-10T19:06:14.425577
2019-12-13T02:42:15
2019-12-13T02:42:15
221,808,713
0
1
null
null
null
null
UTF-8
Java
false
false
339
java
package http; public class RemoveSegmentFromPlaylistRequest { public int location; public String playlistName; public RemoveSegmentFromPlaylistRequest() { } public RemoveSegmentFromPlaylistRequest(String playlistName, int location) { this.location = location; this.playlistName = playlistName; } }
[ "mjforte@wpi.edu" ]
mjforte@wpi.edu
89b3a3804d9360b45e481e0bd5992672396aa197
8fa6e740fdbab106e56eb004c0b7e28db58ea9e3
/Zafiro/src/Importaciones/ZafImp05/ZafImp05.java
61a6d65695a13b02710e6bad45ded9ca9fc945a0
[]
no_license
Bostel87/Zafiro_Escritorio
639d476ea105ce87267c8a9424d56c7f2e65c676
c47268d8df084cdd3d39f63026178333caed4f71
refs/heads/master
2020-11-24T17:04:46.216747
2019-12-16T15:24:34
2019-12-16T15:24:34
228,260,889
0
0
null
null
null
null
UTF-8
Java
false
false
82,590
java
/* * ZafImp05.java * * Created on 22 de agosto de 2013 */ package Importaciones.ZafImp05; import Librerias.ZafImp.ZafAjuInv; import Librerias.ZafImp.ZafImp; import Librerias.ZafImp.ZafSegAjuInv; import Librerias.ZafParSis.ZafParSis; import Librerias.ZafPerUsr.ZafPerUsr; import Librerias.ZafUtil.ZafUtil; import Librerias.ZafTblUti.ZafTblFilCab.ZafTblFilCab; import Librerias.ZafTblUti.ZafTblMod.ZafTblMod; import Librerias.ZafTblUti.ZafTblCelRenLbl.ZafTblCelRenLbl; import Librerias.ZafTblUti.ZafTblPopMnu.ZafTblPopMnu; import Librerias.ZafTblUti.ZafTblBus.ZafTblBus; import Librerias.ZafTblUti.ZafTblOrd.ZafTblOrd; import Librerias.ZafVenCon.ZafVenCon; import Librerias.ZafSelFec.ZafSelFec; import Librerias.ZafTblUti.ZafTblCelEdiButGen.ZafTblCelEdiButGen; import Librerias.ZafTblUti.ZafTblCelEdiChk.ZafTblCelEdiChk; import Librerias.ZafTblUti.ZafTblCelRenBut.ZafTblCelRenBut; import Librerias.ZafTblUti.ZafTblCelRenChk.ZafTblCelRenChk; import Librerias.ZafTblUti.ZafTblEvt.ZafTblCelRenAdapter; import Librerias.ZafTblUti.ZafTblEvt.ZafTblCelRenEvent; import java.sql.Connection; import java.sql.Statement; import java.sql.ResultSet; import java.sql.DriverManager; import java.util.Vector; import java.util.ArrayList; /** * * @author Ingrid Lino */ public class ZafImp05 extends javax.swing.JInternalFrame { //Constantes: Columnas del JTable static final int INT_TBL_DAT_LIN=0; static final int INT_TBL_DAT_COD_EMP=1; static final int INT_TBL_DAT_COD_LOC=2; static final int INT_TBL_DAT_COD_TIP_DOC=3; static final int INT_TBL_DAT_DES_COR_TIP_DOC=4; static final int INT_TBL_DAT_DES_LAR_TIP_DOC=5; static final int INT_TBL_DAT_COD_DOC=6; static final int INT_TBL_DAT_NUM_DOC=7; static final int INT_TBL_DAT_NUM_PED=8; static final int INT_TBL_DAT_FEC_DOC=9; static final int INT_TBL_DAT_COD_EXP=10; static final int INT_TBL_DAT_NOM_EXP=11; static final int INT_TBL_DAT_TOT_FOB_CFR=12; static final int INT_TBL_DAT_TOT_ARA_FOD_IVA=13; static final int INT_TBL_DAT_DIA_ARR=14; static final int INT_TBL_DAT_EST=15; static final int INT_TBL_DAT_CHK_ARR=16; static final int INT_TBL_DAT_CHK_CIE=17; static final int INT_TBL_DAT_BUT=18; static final int INT_TBL_DAT_BUT_NOT_PED=19; static final int INT_TBL_DAT_BUT_PED_EMB=20; static final int INT_TBL_DAT_CHK_AJU=21; static final int INT_TBL_DAT_BUT_DOC_AJU=22; //Variables private ZafSelFec objSelFecDoc; private ZafParSis objParSis; private ZafUtil objUti; private ZafPerUsr objPerUsr; private ZafTblFilCab objTblFilCab; private ZafTblMod objTblMod; private ZafThreadGUI objThrGUI; private ZafTblCelRenLbl objTblCelRenLbl; //Render: Presentar JLabel en JTable. private ZafTblCelRenChk objTblCelRenChk; //Render: Presentar JCheckBox en JTable. private ZafTblCelEdiChk objTblCelEdiChk; //Editor: JCheckBox en celda. private ZafTblCelRenBut objTblCelRenBut, objTblCelRenButNotPed, objTblCelRenButPedEmb, objTblCelRenButDocAju; private ZafTblCelEdiButGen objTblCelEdiButGen, objTblCelEdiButGenNotPed, objTblCelEdiButGenPedEmb, objTblCelEdiButGenDocAju; private ZafMouMotAda objMouMotAda; //ToolTipText en TableHeader. private ZafTblPopMnu objTblPopMnu; //PopupMenu: Establecer PopupMenú en JTable. private ZafTblBus objTblBus; //Editor de búsqueda. private ZafTblOrd objTblOrd; //JTable de ordenamiento. private ZafAjuInv objAjuInv; private ZafSegAjuInv objSegAjuInv; private ZafImp objImp; private ZafVenCon vcoEmp, vcoExp; private Connection con; private Statement stm; private ResultSet rst; private String strSQL, strAux; private Vector vecDat, vecCab, vecReg, vecAux; private boolean blnCon; //true: Continua la ejecución del hilo. private java.util.Date datFecAux; private int intCodTipDocPedEmb, intCodDocPedEmb; private int intRowsDocAju=-1; private int intCodEmpAju, intCodLocAju, intCodTipDocAju, intCodDocAju; private String strCodEmp, strNomEmp, strCodExp, strNomExp; private String strVersion =" v0.1.4"; /** Crea una nueva instancia de la clase ZafIndRpt. */ public ZafImp05(ZafParSis obj) { try { objParSis=(ZafParSis)obj.clone(); if(objParSis.getCodigoEmpresa()==objParSis.getCodigoEmpresaGrupo()) { initComponents(); if (!configurarFrm()) exitForm(); } else{ mostrarMsgInf("Este programa sólo puede ser ejecutado desde GRUPO."); dispose(); } } catch (CloneNotSupportedException e) { this.setTitle(this.getTitle() + " [ERROR]"); } } /** Configurar el formulario. */ private boolean configurarFrm() { boolean blnRes=true; try { //Titulo Programa. strAux=objParSis.getNombreMenu(); this.setTitle(strAux + strVersion); lblTit.setText(strAux); //Inicializar objetos. objUti=new ZafUtil(); objImp=new ZafImp(objParSis, javax.swing.JOptionPane.getFrameForComponent(this)); //Obtener los permisos del usuario. objPerUsr=new ZafPerUsr(objParSis); //Habilitar/Inhabilitar las opciones según el perfil del usuario. if (!objPerUsr.isOpcionEnabled(3212)) { butCon.setVisible(false); } if (!objPerUsr.isOpcionEnabled(3213)) { butCer.setVisible(false); } //Configurar ZafSelFec: objSelFecDoc=new ZafSelFec(); panFecDoc.add(objSelFecDoc); objSelFecDoc.setBounds(4, 0, 472, 68); objSelFecDoc.setCheckBoxVisible(false); objSelFecDoc.setCheckBoxChecked(true); objSelFecDoc.setTitulo("Fecha del documento"); //Configurar objetos. if(objParSis.getCodigoEmpresa()==objParSis.getCodigoEmpresaGrupo()){ configurarVenConEmp(); txtCodImp.setEditable(true); txtNomImp.setEditable(true); butImp.setEnabled(true); } else{ lblEmpImp.setVisible(false); txtCodImp.setVisible(false); txtNomImp.setVisible(false); butImp.setVisible(false); } //Configurar los JTables. configurarTblDat(); configurarVenConExp(); } catch(Exception e) { blnRes=false; objUti.mostrarMsgErr_F1(this, e); } return blnRes; } /** * Esta función configura el JTable "tblDat". * @return true: Si se pudo configurar el JTable. * <BR>false: En el caso contrario. */ private boolean configurarTblDat() { boolean blnRes=true; try { //Configurar JTable: Establecer el modelo. vecDat=new Vector(); //Almacena los datos vecCab=new Vector(22); //Almacena las cabeceras vecCab.clear(); vecCab.add(INT_TBL_DAT_LIN,""); vecCab.add(INT_TBL_DAT_COD_EMP,"Cód.Emp."); vecCab.add(INT_TBL_DAT_COD_LOC,"Cód.Loc."); vecCab.add(INT_TBL_DAT_COD_TIP_DOC,"Cód.Tip.Doc."); vecCab.add(INT_TBL_DAT_DES_COR_TIP_DOC,"Tip.Doc."); vecCab.add(INT_TBL_DAT_DES_LAR_TIP_DOC,"Tip.Doc."); vecCab.add(INT_TBL_DAT_COD_DOC,"Cód.Doc."); vecCab.add(INT_TBL_DAT_NUM_DOC,"Núm.Doc."); vecCab.add(INT_TBL_DAT_NUM_PED,"Núm.Ped."); vecCab.add(INT_TBL_DAT_FEC_DOC,"Fec.Doc."); vecCab.add(INT_TBL_DAT_COD_EXP,"Cód.Exp."); vecCab.add(INT_TBL_DAT_NOM_EXP,"Exportador"); vecCab.add(INT_TBL_DAT_TOT_FOB_CFR,"Tot.Fob.Cfr."); vecCab.add(INT_TBL_DAT_TOT_ARA_FOD_IVA,"Tot.Ara.Fod.Iva."); vecCab.add(INT_TBL_DAT_DIA_ARR,"Dia.Arr."); vecCab.add(INT_TBL_DAT_EST,"Est."); vecCab.add(INT_TBL_DAT_CHK_ARR,"Arr."); vecCab.add(INT_TBL_DAT_CHK_CIE,"Cie."); vecCab.add(INT_TBL_DAT_BUT,"Ing."); vecCab.add(INT_TBL_DAT_BUT_NOT_PED,"Not."); vecCab.add(INT_TBL_DAT_BUT_PED_EMB,"Emb."); vecCab.add(INT_TBL_DAT_CHK_AJU,"Est."); vecCab.add(INT_TBL_DAT_BUT_DOC_AJU,"Aju."); objTblMod=new ZafTblMod(); objTblMod.setHeader(vecCab); tblDat.setModel(objTblMod); //Configurar JTable: Establecer tipo de selección. tblDat.setRowSelectionAllowed(true); tblDat.setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); //Configurar JTable: Establecer el menú de contexto. objTblPopMnu=new ZafTblPopMnu(tblDat); //Configurar JTable: Establecer el tipo de redimensionamiento de las columnas. tblDat.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF); //Configurar JTable: Establecer el ancho de las columnas. javax.swing.table.TableColumnModel tcmAux=tblDat.getColumnModel(); tcmAux.getColumn(INT_TBL_DAT_LIN).setPreferredWidth(20); tcmAux.getColumn(INT_TBL_DAT_COD_EMP).setPreferredWidth(60); tcmAux.getColumn(INT_TBL_DAT_COD_LOC).setPreferredWidth(60); tcmAux.getColumn(INT_TBL_DAT_COD_TIP_DOC).setPreferredWidth(60); tcmAux.getColumn(INT_TBL_DAT_DES_COR_TIP_DOC).setPreferredWidth(60); tcmAux.getColumn(INT_TBL_DAT_DES_LAR_TIP_DOC).setPreferredWidth(20); tcmAux.getColumn(INT_TBL_DAT_COD_DOC).setPreferredWidth(60); tcmAux.getColumn(INT_TBL_DAT_NUM_DOC).setPreferredWidth(80); tcmAux.getColumn(INT_TBL_DAT_NUM_PED).setPreferredWidth(80); tcmAux.getColumn(INT_TBL_DAT_FEC_DOC).setPreferredWidth(70); tcmAux.getColumn(INT_TBL_DAT_COD_EXP).setPreferredWidth(30); tcmAux.getColumn(INT_TBL_DAT_NOM_EXP).setPreferredWidth(108); tcmAux.getColumn(INT_TBL_DAT_TOT_FOB_CFR).setPreferredWidth(90); tcmAux.getColumn(INT_TBL_DAT_TOT_ARA_FOD_IVA).setPreferredWidth(90); tcmAux.getColumn(INT_TBL_DAT_DIA_ARR).setPreferredWidth(45); tcmAux.getColumn(INT_TBL_DAT_EST).setPreferredWidth(30); tcmAux.getColumn(INT_TBL_DAT_CHK_ARR).setPreferredWidth(28); tcmAux.getColumn(INT_TBL_DAT_CHK_CIE).setPreferredWidth(28); tcmAux.getColumn(INT_TBL_DAT_BUT).setPreferredWidth(35); tcmAux.getColumn(INT_TBL_DAT_BUT_NOT_PED).setPreferredWidth(35); tcmAux.getColumn(INT_TBL_DAT_BUT_PED_EMB).setPreferredWidth(35); tcmAux.getColumn(INT_TBL_DAT_CHK_AJU).setPreferredWidth(28); tcmAux.getColumn(INT_TBL_DAT_BUT_DOC_AJU).setPreferredWidth(35); //Configurar JTable: Establecer las columnas que no se pueden redimensionar. //tcmAux.getColumn(INT_TBL_DAT_BUT_CTA).setResizable(false); //Configurar JTable: Establecer el tipo de reordenamiento de columnas. tblDat.getTableHeader().setReorderingAllowed(false); //Configurar JTable: Ocultar columnas del sistema. objTblMod.addSystemHiddenColumn(INT_TBL_DAT_COD_EMP, tblDat); objTblMod.addSystemHiddenColumn(INT_TBL_DAT_COD_LOC, tblDat); objTblMod.addSystemHiddenColumn(INT_TBL_DAT_COD_TIP_DOC, tblDat); objTblMod.addSystemHiddenColumn(INT_TBL_DAT_COD_DOC, tblDat); objTblMod.addSystemHiddenColumn(INT_TBL_DAT_COD_EXP, tblDat); objTblMod.addSystemHiddenColumn(INT_TBL_DAT_CHK_AJU, tblDat); //Configurar JTable: Mostrar ToolTipText en la cabecera de las columnas. objMouMotAda=new ZafMouMotAda(); tblDat.getTableHeader().addMouseMotionListener(objMouMotAda); //Configurar JTable: Editor de búsqueda. objTblBus=new ZafTblBus(tblDat); //Configurar JTable: Establecer la fila de cabecera. objTblFilCab=new ZafTblFilCab(tblDat); tcmAux.getColumn(INT_TBL_DAT_LIN).setCellRenderer(objTblFilCab); //Configurar JTable: Renderizar celdas. objTblCelRenLbl=new ZafTblCelRenLbl(); objTblCelRenLbl.setHorizontalAlignment(javax.swing.JLabel.RIGHT); objTblCelRenLbl.setTipoFormato(objTblCelRenLbl.INT_FOR_NUM); objTblCelRenLbl.setFormatoNumerico(objParSis.getFormatoNumero(),false,true); tcmAux.getColumn(INT_TBL_DAT_TOT_FOB_CFR).setCellRenderer(objTblCelRenLbl); tcmAux.getColumn(INT_TBL_DAT_TOT_ARA_FOD_IVA).setCellRenderer(objTblCelRenLbl); objTblCelRenLbl=null; //Configurar JTable: Establecer la clase que controla el ordenamiento. objTblOrd=new ZafTblOrd(tblDat); //Configurar JTable: Establecer columnas editables. vecAux=new Vector(); vecAux.add("" + INT_TBL_DAT_BUT); vecAux.add("" + INT_TBL_DAT_BUT_NOT_PED); vecAux.add("" + INT_TBL_DAT_BUT_PED_EMB); vecAux.add("" + INT_TBL_DAT_BUT_DOC_AJU); objTblMod.setColumnasEditables(vecAux); vecAux=null; //Configurar JTable: Renderizar celdas. objTblCelRenChk=new ZafTblCelRenChk(); tcmAux.getColumn(INT_TBL_DAT_CHK_ARR).setCellRenderer(objTblCelRenChk); tcmAux.getColumn(INT_TBL_DAT_CHK_CIE).setCellRenderer(objTblCelRenChk); tcmAux.getColumn(INT_TBL_DAT_CHK_AJU).setCellRenderer(objTblCelRenChk); objTblCelRenChk=null; //Configurar JTable: Editor de celdas. objTblCelEdiChk=new ZafTblCelEdiChk(tblDat); tcmAux.getColumn(INT_TBL_DAT_CHK_ARR).setCellEditor(objTblCelEdiChk); tcmAux.getColumn(INT_TBL_DAT_CHK_CIE).setCellEditor(objTblCelEdiChk); tcmAux.getColumn(INT_TBL_DAT_CHK_AJU).setCellEditor(objTblCelEdiChk); //PARA EL BOTON QUE LLAMA A LA VENTANA DE INGRESO POR IMPORTACION objTblCelRenBut=new ZafTblCelRenBut(); tblDat.getColumnModel().getColumn(INT_TBL_DAT_BUT).setCellRenderer(objTblCelRenBut); objTblCelEdiButGen=new ZafTblCelEdiButGen(); tblDat.getColumnModel().getColumn(INT_TBL_DAT_BUT).setCellEditor(objTblCelEdiButGen); objTblCelEdiButGen.addTableEditorListener(new Librerias.ZafTblUti.ZafTblEvt.ZafTableAdapter() { int intFilSel; public void beforeEdit(Librerias.ZafTblUti.ZafTblEvt.ZafTableEvent evt) { intFilSel=tblDat.getSelectedRow(); } public void actionPerformed(Librerias.ZafTblUti.ZafTblEvt.ZafTableEvent evt) { mostrarFormularioIngresoImportacion(intFilSel); } public void afterEdit(Librerias.ZafTblUti.ZafTblEvt.ZafTableEvent evt) { } }); //PARA EL BOTON QUE LLAMA A LA VENTANA DE NOTA DE PEDIDO objTblCelRenButNotPed=new ZafTblCelRenBut(); tblDat.getColumnModel().getColumn(INT_TBL_DAT_BUT_NOT_PED).setCellRenderer(objTblCelRenButNotPed); objTblCelEdiButGenNotPed=new ZafTblCelEdiButGen(); tblDat.getColumnModel().getColumn(INT_TBL_DAT_BUT_NOT_PED).setCellEditor(objTblCelEdiButGenNotPed); objTblCelEdiButGenNotPed.addTableEditorListener(new Librerias.ZafTblUti.ZafTblEvt.ZafTableAdapter() { int intFilSel; public void beforeEdit(Librerias.ZafTblUti.ZafTblEvt.ZafTableEvent evt) { intFilSel=tblDat.getSelectedRow(); } public void actionPerformed(Librerias.ZafTblUti.ZafTblEvt.ZafTableEvent evt) { mostrarFormularioNotaPedido(intFilSel); } public void afterEdit(Librerias.ZafTblUti.ZafTblEvt.ZafTableEvent evt) { } }); //PARA EL BOTON QUE LLAMA A LA VENTANA DE PEDIDO EMBARCADO objTblCelRenButPedEmb=new ZafTblCelRenBut(); tblDat.getColumnModel().getColumn(INT_TBL_DAT_BUT_PED_EMB).setCellRenderer(objTblCelRenButPedEmb); objTblCelEdiButGenPedEmb=new ZafTblCelEdiButGen(); tblDat.getColumnModel().getColumn(INT_TBL_DAT_BUT_PED_EMB).setCellEditor(objTblCelEdiButGenPedEmb); objTblCelEdiButGenPedEmb.addTableEditorListener(new Librerias.ZafTblUti.ZafTblEvt.ZafTableAdapter() { int intFilSel; public void beforeEdit(Librerias.ZafTblUti.ZafTblEvt.ZafTableEvent evt) { intFilSel=tblDat.getSelectedRow(); } public void actionPerformed(Librerias.ZafTblUti.ZafTblEvt.ZafTableEvent evt) { mostrarFormularioPedidoEmbarcado(intFilSel); } public void afterEdit(Librerias.ZafTblUti.ZafTblEvt.ZafTableEvent evt) { } }); //PARA EL BOTON QUE LLAMA A LA VENTANA DE DOCUMENTOS DE AJUSTES ASOCIADOS A LOS INGRESOS POR IMPORTACIÓN. objTblCelRenButDocAju=new ZafTblCelRenBut(); tblDat.getColumnModel().getColumn(INT_TBL_DAT_BUT_DOC_AJU).setCellRenderer(objTblCelRenButDocAju); objTblCelRenButDocAju.addTblCelRenListener(new ZafTblCelRenAdapter() { @Override public void beforeRender(ZafTblCelRenEvent evt) { switch (objTblCelRenButDocAju.getColumnRender()) { case INT_TBL_DAT_BUT_DOC_AJU: if(objTblMod.isChecked(objTblCelRenButDocAju.getRowRender(), INT_TBL_DAT_CHK_AJU)) objTblCelRenButDocAju.setText("..."); else objTblCelRenButDocAju.setText(""); break; } } }); objTblCelEdiButGenDocAju=new ZafTblCelEdiButGen(); tblDat.getColumnModel().getColumn(INT_TBL_DAT_BUT_DOC_AJU).setCellEditor(objTblCelEdiButGenDocAju); objTblCelEdiButGenDocAju.addTableEditorListener(new Librerias.ZafTblUti.ZafTblEvt.ZafTableAdapter() { int intFilSel; public void beforeEdit(Librerias.ZafTblUti.ZafTblEvt.ZafTableEvent evt) { intFilSel=tblDat.getSelectedRow(); if(!objTblMod.isChecked(intFilSel, INT_TBL_DAT_CHK_AJU)) objTblCelEdiButGenDocAju.setCancelarEdicion(true); } public void actionPerformed(Librerias.ZafTblUti.ZafTblEvt.ZafTableEvent evt) { if(objTblMod.isChecked(intFilSel, INT_TBL_DAT_CHK_AJU)) mostrarFormularioDocumentoAjuste(intFilSel); } public void afterEdit(Librerias.ZafTblUti.ZafTblEvt.ZafTableEvent evt) { } }); objTblMod.setModoOperacion(objTblMod.INT_TBL_EDI); //Libero los objetos auxiliares. tcmAux=null; } catch(Exception e) { blnRes=false; objUti.mostrarMsgErr_F1(this, e); } return blnRes; } /** * Esta clase hereda de la clase MouseMotionAdapter que permite manejar eventos de * del mouse (mover el mouse; arrastrar y soltar). * Se la usa en el sistema para mostrar el ToolTipText adecuado en la cabecera de * las columnas. Es necesario hacerlo porque el ancho de las columnas a veces * resulta muy corto para mostrar leyendas que requieren más espacio. */ private class ZafMouMotAda extends java.awt.event.MouseMotionAdapter { public void mouseMoved(java.awt.event.MouseEvent evt) { int intCol=tblDat.columnAtPoint(evt.getPoint()); String strMsg=""; switch (intCol) { case INT_TBL_DAT_COD_EMP: strMsg="Código de la empresa del Ingreso de Importación"; break; case INT_TBL_DAT_COD_LOC: strMsg="Código del local del Ingreso de Importación"; break; case INT_TBL_DAT_COD_TIP_DOC: strMsg="Código del tipo de documento del Ingreso de Importación"; break; case INT_TBL_DAT_DES_COR_TIP_DOC: strMsg="Descripción corta del tipo de documento del Ingreso de Importación"; break; case INT_TBL_DAT_DES_LAR_TIP_DOC: strMsg="Descripción larga del tipo de documento del Ingreso de Importación"; break; case INT_TBL_DAT_COD_DOC: strMsg="Código del documento del Ingreso de Importación"; break; case INT_TBL_DAT_NUM_DOC: strMsg="Número del documento del Ingreso de Importación "; break; case INT_TBL_DAT_NUM_PED: strMsg="Número del Pedido del Ingreso de Importación"; break; case INT_TBL_DAT_FEC_DOC: strMsg="Fecha del documento del Ingreso de Importación"; break; case INT_TBL_DAT_COD_EXP: strMsg="Código del Exportador del Ingreso de Importación"; break; case INT_TBL_DAT_NOM_EXP: strMsg="Nombre del Exportador del Ingreso de Importación"; break; case INT_TBL_DAT_TOT_FOB_CFR: strMsg="Total FOB / CFR"; break; case INT_TBL_DAT_TOT_ARA_FOD_IVA: strMsg="Total de arancel, fodinfa e Iva"; break; case INT_TBL_DAT_DIA_ARR: strMsg="Dias de arribo que tiene el pedido sin cerrar."; break; case INT_TBL_DAT_EST: strMsg="Estado del ingreso por importación"; break; case INT_TBL_DAT_CHK_ARR: strMsg="Indica si pedido ha sido arribado."; break; case INT_TBL_DAT_CHK_CIE: strMsg="Indica si pedido ha sido cerrado."; break; case INT_TBL_DAT_BUT: strMsg="Muestra formulario del Ingreso de Importación"; break; case INT_TBL_DAT_BUT_NOT_PED: strMsg="Muestra formulario de la nota de pedido"; break; case INT_TBL_DAT_BUT_PED_EMB: strMsg="Muestra formulario del pedido embarcado"; break; case INT_TBL_DAT_CHK_AJU: strMsg="Existe documento de ajuste asociado"; break; case INT_TBL_DAT_BUT_DOC_AJU: strMsg="Muestra documentos de ajustes del pedido"; break; default: break; } tblDat.getTableHeader().setToolTipText(strMsg); } } private boolean configurarVenConEmp(){ boolean blnRes=true; String strTitVenCon=""; try{ //Listado de campos. ArrayList arlCam=new ArrayList(); arlCam.add("a1.co_emp"); arlCam.add("a1.tx_nom"); //Alias de los campos. ArrayList arlAli=new ArrayList(); arlAli.add("Código"); arlAli.add("Nombre"); //Ancho de las columnas. ArrayList arlAncCol=new ArrayList(); arlAncCol.add("50"); arlAncCol.add("414"); //Armar la sentencia SQL. if(objParSis.getCodigoUsuario()==1){ strSQL =""; strSQL+=" SELECT a1.co_emp, a1.tx_nom"; strSQL+=" FROM tbm_emp AS a1"; strSQL+=" WHERE a1.co_emp<>" + objParSis.getCodigoEmpresaGrupo() + ""; strSQL+=" AND a1.st_reg NOT IN('I','E')"; strSQL+=" ORDER BY a1.co_emp"; } else{ strSQL =""; strSQL+=" SELECT a1.co_emp, a1.tx_nom"; strSQL+=" FROM tbm_emp AS a1 INNER JOIN tbr_usremp AS a2"; strSQL+=" ON a1.co_emp=a2.co_emp AND a2.co_usr=" + objParSis.getCodigoUsuario() + ""; strSQL+=" WHERE a1.co_emp<>" + objParSis.getCodigoEmpresaGrupo() + ""; strSQL+=" AND a1.st_reg NOT IN('I','E')"; strSQL+=" ORDER BY a1.co_emp"; } vcoEmp=new ZafVenCon(javax.swing.JOptionPane.getFrameForComponent(this), objParSis, strTitVenCon, strSQL, arlCam, arlAli, arlAncCol); arlCam=null; arlAli=null; arlAncCol=null; //Configurar columnas. vcoEmp.setConfiguracionColumna(1, javax.swing.JLabel.RIGHT); } catch (Exception e){ blnRes=false; objUti.mostrarMsgErr_F1(this, e); } return blnRes; } private boolean mostrarVenConEmp(int intTipBus){ boolean blnRes=true; try{ switch (intTipBus){ case 0: //Mostrar la ventana de consulta. vcoEmp.setCampoBusqueda(2); vcoEmp.show(); if (vcoEmp.getSelectedButton()==vcoEmp.INT_BUT_ACE){ txtCodImp.setText(vcoEmp.getValueAt(1)); txtNomImp.setText(vcoEmp.getValueAt(2)); txtCodExp.setEditable(true); txtNomExp.setEditable(true); butExp.setEnabled(true); txtCodExp.setText(""); txtNomExp.setText(""); } break; case 1: //Búsqueda directa por "Número de cuenta". if (vcoEmp.buscar("a1.co_emp", txtCodImp.getText())){ txtCodImp.setText(vcoEmp.getValueAt(1)); txtNomImp.setText(vcoEmp.getValueAt(2)); txtCodExp.setEditable(true); txtNomExp.setEditable(true); butExp.setEnabled(true); txtCodExp.setText(""); txtNomExp.setText(""); } else{ vcoEmp.setCampoBusqueda(0); vcoEmp.setCriterio1(11); vcoEmp.cargarDatos(); vcoEmp.show(); if (vcoEmp.getSelectedButton()==vcoEmp.INT_BUT_ACE){ txtCodImp.setText(vcoEmp.getValueAt(1)); txtNomImp.setText(vcoEmp.getValueAt(2)); txtCodExp.setEditable(true); txtNomExp.setEditable(true); butExp.setEnabled(true); txtCodExp.setText(""); txtNomExp.setText(""); } else{ txtCodImp.setText(strCodEmp); } } break; case 2: //Búsqueda directa por "Descripción larga". if (vcoEmp.buscar("a1.tx_nom", txtNomImp.getText())){ txtCodImp.setText(vcoEmp.getValueAt(1)); txtNomImp.setText(vcoEmp.getValueAt(2)); txtCodExp.setEditable(true); txtNomExp.setEditable(true); butExp.setEnabled(true); txtCodExp.setText(""); txtNomExp.setText(""); } else{ vcoEmp.setCampoBusqueda(2); vcoEmp.setCriterio1(11); vcoEmp.cargarDatos(); vcoEmp.show(); if (vcoEmp.getSelectedButton()==vcoEmp.INT_BUT_ACE){ txtCodImp.setText(vcoEmp.getValueAt(1)); txtNomImp.setText(vcoEmp.getValueAt(2)); txtCodExp.setEditable(true); txtNomExp.setEditable(true); butExp.setEnabled(true); txtCodExp.setText(""); txtNomExp.setText(""); } else{ txtNomImp.setText(strNomEmp); } } break; } } catch (Exception e) { blnRes=false; objUti.mostrarMsgErr_F1(this, e); } return blnRes; } /** * Esta función configura la "Ventana de consulta" que será utilizada para * mostrar los "Proveedores". */ private boolean configurarVenConExp() { boolean blnRes=true; try { //Listado de campos. ArrayList arlCam=new ArrayList(); arlCam.add("a1.co_exp"); arlCam.add("a1.tx_nom"); arlCam.add("a1.tx_nom2"); //Alias de los campos. ArrayList arlAli=new ArrayList(); arlAli.add("Código"); arlAli.add("Nombre"); arlAli.add("Nombre alterno"); //Ancho de las columnas. ArrayList arlAncCol=new ArrayList(); arlAncCol.add("50"); arlAncCol.add("225"); arlAncCol.add("225"); //Armar la sentencia SQL. strSQL =""; strSQL+=" SELECT a1.co_exp, a1.tx_nom, a1.tx_nom2"; strSQL+=" FROM tbm_expImp AS a1"; strSQL+=" WHERE a1.st_reg='A'"; strSQL+=" ORDER BY a1.tx_nom"; vcoExp=new ZafVenCon(javax.swing.JOptionPane.getFrameForComponent(this), objParSis, "Listado de exportadores", strSQL, arlCam, arlAli, arlAncCol); arlCam=null; arlAli=null; arlAncCol=null; //Configurar columnas. vcoExp.setConfiguracionColumna(1, javax.swing.JLabel.RIGHT); } catch (Exception e) { blnRes=false; objUti.mostrarMsgErr_F1(this, e); } return blnRes; } /** * Esta función permite utilizar la "Ventana de Consulta" para seleccionar un * registro de la base de datos. El tipo de básqueda determina si se debe hacer * una básqueda directa (No se muestra la ventana de consulta a menos que no * exista lo que se está buscando) o presentar la ventana de consulta para que * el usuario seleccione la opcián que desea utilizar. * @param intTipBus El tipo de básqueda a realizar. * @return true: Si no se presentá ningán problema. * <BR>false: En el caso contrario. */ private boolean mostrarVenConExp(int intTipBus) { boolean blnRes=true; String strSQLTmp=""; try{ switch (intTipBus){ case 0: //Mostrar la ventana de consulta. vcoExp.setCampoBusqueda(1); vcoExp.show(); if (vcoExp.getSelectedButton()==vcoExp.INT_BUT_ACE) { txtCodExp.setText(vcoExp.getValueAt(1)); txtNomExp.setText(vcoExp.getValueAt(2)); } break; case 1: //Búsqueda directa por "Número de cuenta". if (vcoExp.buscar("a1.co_exp", txtCodExp.getText())) { txtCodExp.setText(vcoExp.getValueAt(1)); txtNomExp.setText(vcoExp.getValueAt(2)); } else { vcoExp.setCampoBusqueda(0); vcoExp.setCriterio1(11); vcoExp.cargarDatos(); vcoExp.show(); if (vcoExp.getSelectedButton()==vcoExp.INT_BUT_ACE) { txtCodExp.setText(vcoExp.getValueAt(1)); txtNomExp.setText(vcoExp.getValueAt(2)); } else { txtCodExp.setText(strCodExp); } } break; case 2: //Búsqueda directa por "Descripción larga". if (vcoExp.buscar("a1.tx_nom", txtNomExp.getText())) { txtCodExp.setText(vcoExp.getValueAt(1)); txtNomExp.setText(vcoExp.getValueAt(2)); } else { vcoExp.setCampoBusqueda(2); vcoExp.setCriterio1(11); vcoExp.cargarDatos(); vcoExp.show(); if (vcoExp.getSelectedButton()==vcoExp.INT_BUT_ACE) { txtCodExp.setText(vcoExp.getValueAt(1)); txtNomExp.setText(vcoExp.getValueAt(2)); } else { txtNomExp.setText(strNomExp); } } break; } } catch (Exception e) { blnRes=false; objUti.mostrarMsgErr_F1(this, e); } return blnRes; } /** 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. */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { bgrFil = new javax.swing.ButtonGroup(); lblTit = new javax.swing.JLabel(); panFrm = new javax.swing.JPanel(); tabFrm = new javax.swing.JTabbedPane(); panCon = new javax.swing.JPanel(); panFecDoc = new javax.swing.JPanel(); panFil = new javax.swing.JPanel(); optTod = new javax.swing.JRadioButton(); optFil = new javax.swing.JRadioButton(); lblEmpImp = new javax.swing.JLabel(); txtCodImp = new javax.swing.JTextField(); txtNomImp = new javax.swing.JTextField(); butImp = new javax.swing.JButton(); lblExp = new javax.swing.JLabel(); txtCodExp = new javax.swing.JTextField(); txtNomExp = new javax.swing.JTextField(); butExp = new javax.swing.JButton(); lblEstDoc = new javax.swing.JLabel(); cboEstDoc = new javax.swing.JComboBox(); chkMosNotPedAso = new javax.swing.JCheckBox(); chkMosPedEmbAso = new javax.swing.JCheckBox(); panRpt = new javax.swing.JPanel(); spnDat = new javax.swing.JScrollPane(); tblDat = new javax.swing.JTable(); panBar = new javax.swing.JPanel(); panBot = new javax.swing.JPanel(); butCon = new javax.swing.JButton(); butCer = new javax.swing.JButton(); panBarEst = new javax.swing.JPanel(); lblMsgSis = new javax.swing.JLabel(); panPrgSis = new javax.swing.JPanel(); pgrSis = new javax.swing.JProgressBar(); setClosable(true); setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); setIconifiable(true); setMaximizable(true); setResizable(true); setTitle("Título de la ventana"); addInternalFrameListener(new javax.swing.event.InternalFrameListener() { public void internalFrameActivated(javax.swing.event.InternalFrameEvent evt) { } public void internalFrameClosed(javax.swing.event.InternalFrameEvent evt) { } public void internalFrameClosing(javax.swing.event.InternalFrameEvent evt) { exitForm(evt); } public void internalFrameDeactivated(javax.swing.event.InternalFrameEvent evt) { } public void internalFrameDeiconified(javax.swing.event.InternalFrameEvent evt) { } public void internalFrameIconified(javax.swing.event.InternalFrameEvent evt) { } public void internalFrameOpened(javax.swing.event.InternalFrameEvent evt) { } }); lblTit.setFont(new java.awt.Font("MS Sans Serif", 1, 14)); // NOI18N lblTit.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); lblTit.setText("Título de la ventana"); lblTit.setPreferredSize(new java.awt.Dimension(138, 18)); getContentPane().add(lblTit, java.awt.BorderLayout.NORTH); panFrm.setPreferredSize(new java.awt.Dimension(475, 311)); panFrm.setLayout(new java.awt.BorderLayout()); tabFrm.setPreferredSize(new java.awt.Dimension(475, 311)); panCon.setBorder(javax.swing.BorderFactory.createTitledBorder("")); panCon.setLayout(new java.awt.BorderLayout()); panFecDoc.setPreferredSize(new java.awt.Dimension(0, 80)); panFecDoc.setLayout(new java.awt.BorderLayout()); panCon.add(panFecDoc, java.awt.BorderLayout.NORTH); panFil.setPreferredSize(new java.awt.Dimension(0, 250)); panFil.setLayout(null); bgrFil.add(optTod); optTod.setSelected(true); optTod.setText("Todos los documentos"); optTod.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { optTodItemStateChanged(evt); } }); panFil.add(optTod); optTod.setBounds(10, 10, 400, 20); bgrFil.add(optFil); optFil.setText("Sólo los documentos que cumplan el criterio seleccionado"); panFil.add(optFil); optFil.setBounds(10, 30, 400, 20); lblEmpImp.setText("Empresa(Importador):"); lblEmpImp.setToolTipText("Vendedor/Comprador"); panFil.add(lblEmpImp); lblEmpImp.setBounds(40, 60, 140, 20); txtCodImp.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtCodImpActionPerformed(evt); } }); txtCodImp.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { txtCodImpFocusGained(evt); } public void focusLost(java.awt.event.FocusEvent evt) { txtCodImpFocusLost(evt); } }); panFil.add(txtCodImp); txtCodImp.setBounds(180, 60, 70, 20); txtNomImp.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtNomImpActionPerformed(evt); } }); txtNomImp.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { txtNomImpFocusGained(evt); } public void focusLost(java.awt.event.FocusEvent evt) { txtNomImpFocusLost(evt); } }); panFil.add(txtNomImp); txtNomImp.setBounds(250, 60, 360, 20); butImp.setText("..."); butImp.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { butImpActionPerformed(evt); } }); panFil.add(butImp); butImp.setBounds(610, 60, 20, 20); lblExp.setText("Exportador:"); lblExp.setToolTipText("Vendedor/Comprador"); panFil.add(lblExp); lblExp.setBounds(40, 80, 140, 20); txtCodExp.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtCodExpActionPerformed(evt); } }); txtCodExp.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { txtCodExpFocusGained(evt); } public void focusLost(java.awt.event.FocusEvent evt) { txtCodExpFocusLost(evt); } }); panFil.add(txtCodExp); txtCodExp.setBounds(180, 80, 70, 20); txtNomExp.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtNomExpActionPerformed(evt); } }); txtNomExp.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { txtNomExpFocusGained(evt); } public void focusLost(java.awt.event.FocusEvent evt) { txtNomExpFocusLost(evt); } }); panFil.add(txtNomExp); txtNomExp.setBounds(250, 80, 360, 20); butExp.setText("..."); butExp.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { butExpActionPerformed(evt); } }); panFil.add(butExp); butExp.setBounds(610, 80, 20, 20); lblEstDoc.setText("Estado del documento:"); panFil.add(lblEstDoc); lblEstDoc.setBounds(40, 100, 140, 20); cboEstDoc.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Todos", "A:Activo", "I:Inactivo" })); panFil.add(cboEstDoc); cboEstDoc.setBounds(180, 100, 210, 20); chkMosNotPedAso.setSelected(true); chkMosNotPedAso.setText("Mostrar notas de pedidos asociadas"); chkMosNotPedAso.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { chkMosNotPedAsoActionPerformed(evt); } }); panFil.add(chkMosNotPedAso); chkMosNotPedAso.setBounds(40, 140, 310, 20); chkMosPedEmbAso.setSelected(true); chkMosPedEmbAso.setText("Mostrar pedidos embarcados asociados"); chkMosPedEmbAso.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { chkMosPedEmbAsoActionPerformed(evt); } }); panFil.add(chkMosPedEmbAso); chkMosPedEmbAso.setBounds(40, 160, 310, 20); panCon.add(panFil, java.awt.BorderLayout.CENTER); tabFrm.addTab("Filtro", panCon); panRpt.setLayout(new java.awt.BorderLayout()); tblDat.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null, null}, {null, null, null, null}, {null, null, null, null}, {null, null, null, null} }, new String [] { "Title 1", "Title 2", "Title 3", "Title 4" } ) { boolean[] canEdit = new boolean [] { true, false, true, true }; public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit [columnIndex]; } }); spnDat.setViewportView(tblDat); panRpt.add(spnDat, java.awt.BorderLayout.CENTER); tabFrm.addTab("Reporte", panRpt); panFrm.add(tabFrm, java.awt.BorderLayout.CENTER); getContentPane().add(panFrm, java.awt.BorderLayout.CENTER); panBar.setPreferredSize(new java.awt.Dimension(320, 42)); panBar.setLayout(new java.awt.BorderLayout()); panBot.setPreferredSize(new java.awt.Dimension(304, 26)); panBot.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT, 5, 0)); butCon.setText("Consultar"); butCon.setToolTipText("Ejecuta la consulta de acuerdo al filtro especificado."); butCon.setPreferredSize(new java.awt.Dimension(92, 25)); butCon.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { butConActionPerformed(evt); } }); panBot.add(butCon); butCer.setText("Cerrar"); butCer.setToolTipText("Cierra la ventana."); butCer.setPreferredSize(new java.awt.Dimension(92, 25)); butCer.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { butCerActionPerformed(evt); } }); panBot.add(butCer); panBar.add(panBot, java.awt.BorderLayout.CENTER); panBarEst.setPreferredSize(new java.awt.Dimension(320, 17)); panBarEst.setLayout(new java.awt.BorderLayout()); lblMsgSis.setText("Listo"); lblMsgSis.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED)); panBarEst.add(lblMsgSis, java.awt.BorderLayout.CENTER); panPrgSis.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED)); panPrgSis.setMinimumSize(new java.awt.Dimension(24, 26)); panPrgSis.setPreferredSize(new java.awt.Dimension(200, 15)); panPrgSis.setLayout(new java.awt.BorderLayout()); pgrSis.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED)); pgrSis.setBorderPainted(false); pgrSis.setDebugGraphicsOptions(javax.swing.DebugGraphics.NONE_OPTION); pgrSis.setPreferredSize(new java.awt.Dimension(100, 16)); panPrgSis.add(pgrSis, java.awt.BorderLayout.CENTER); panBarEst.add(panPrgSis, java.awt.BorderLayout.EAST); panBar.add(panBarEst, java.awt.BorderLayout.SOUTH); getContentPane().add(panBar, java.awt.BorderLayout.SOUTH); java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); setBounds((screenSize.width-700)/2, (screenSize.height-450)/2, 700, 450); }// </editor-fold>//GEN-END:initComponents private void optTodItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_optTodItemStateChanged if (optTod.isSelected()) { txtCodImp.setText(""); txtNomImp.setText(""); txtCodExp.setText(""); txtNomExp.setText(""); cboEstDoc.setSelectedIndex(0); } }//GEN-LAST:event_optTodItemStateChanged private void butConActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butConActionPerformed //Realizar acción de acuerdo a la etiqueta del botón ("Consultar" o "Detener"). if (butCon.getText().equals("Consultar")) { blnCon=true; if (objThrGUI==null) { objThrGUI=new ZafThreadGUI(); objThrGUI.start(); } } else { blnCon=false; } }//GEN-LAST:event_butConActionPerformed private void butCerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butCerActionPerformed exitForm(null); }//GEN-LAST:event_butCerActionPerformed /** Cerrar la aplicación. */ private void exitForm(javax.swing.event.InternalFrameEvent evt) {//GEN-FIRST:event_exitForm String strTit, strMsg; javax.swing.JOptionPane oppMsg=new javax.swing.JOptionPane(); strTit="Mensaje del sistema Zafiro"; strMsg="¿Está seguro que desea cerrar este programa?"; if (oppMsg.showConfirmDialog(this,strMsg,strTit,javax.swing.JOptionPane.YES_NO_OPTION,javax.swing.JOptionPane.QUESTION_MESSAGE)==javax.swing.JOptionPane.YES_OPTION) { dispose(); } }//GEN-LAST:event_exitForm private void txtCodImpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtCodImpActionPerformed txtCodImp.transferFocus(); }//GEN-LAST:event_txtCodImpActionPerformed private void txtCodImpFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtCodImpFocusGained strCodEmp=txtCodImp.getText(); txtCodImp.selectAll(); }//GEN-LAST:event_txtCodImpFocusGained private void txtCodImpFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtCodImpFocusLost if (!txtCodImp.getText().equalsIgnoreCase(strCodEmp)){ if (txtCodImp.getText().equals("")){ txtCodImp.setText(""); txtNomImp.setText(""); objTblMod.removeAllRows(); txtCodExp.setText(""); txtNomExp.setText(""); } else mostrarVenConEmp(1); } else txtCodImp.setText(strCodEmp); }//GEN-LAST:event_txtCodImpFocusLost private void txtNomImpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtNomImpActionPerformed txtNomImp.transferFocus(); }//GEN-LAST:event_txtNomImpActionPerformed private void txtNomImpFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtNomImpFocusGained strNomEmp=txtNomImp.getText(); txtNomImp.selectAll(); }//GEN-LAST:event_txtNomImpFocusGained private void txtNomImpFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtNomImpFocusLost if (!txtNomImp.getText().equalsIgnoreCase(strNomEmp)) { if (txtNomImp.getText().equals("")) { txtCodImp.setText(""); txtNomImp.setText(""); objTblMod.removeAllRows(); } else { mostrarVenConEmp(2); } } else txtNomImp.setText(strNomEmp); }//GEN-LAST:event_txtNomImpFocusLost private void butImpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butImpActionPerformed strCodEmp=txtCodImp.getText(); mostrarVenConEmp(0); }//GEN-LAST:event_butImpActionPerformed private void txtCodExpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtCodExpActionPerformed txtCodExp.transferFocus(); }//GEN-LAST:event_txtCodExpActionPerformed private void txtCodExpFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtCodExpFocusGained strCodExp=txtCodExp.getText(); txtCodExp.selectAll(); }//GEN-LAST:event_txtCodExpFocusGained private void txtCodExpFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtCodExpFocusLost //Validar el contenido de la celda sólo si ha cambiado. if (!txtCodExp.getText().equalsIgnoreCase(strCodExp)){ if (txtCodExp.getText().equals("")){ txtCodExp.setText(""); txtNomExp.setText(""); objTblMod.removeAllRows(); } else mostrarVenConExp(1); } else txtCodExp.setText(strCodExp); }//GEN-LAST:event_txtCodExpFocusLost private void txtNomExpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtNomExpActionPerformed txtNomExp.transferFocus(); }//GEN-LAST:event_txtNomExpActionPerformed private void txtNomExpFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtNomExpFocusGained strNomExp=txtNomExp.getText(); txtNomExp.selectAll(); }//GEN-LAST:event_txtNomExpFocusGained private void txtNomExpFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtNomExpFocusLost //Validar el contenido de la celda sólo si ha cambiado. if (!txtNomExp.getText().equalsIgnoreCase(strNomExp)) { if (txtNomExp.getText().equals("")) { txtCodExp.setText(""); txtNomExp.setText(""); objTblMod.removeAllRows(); } else { mostrarVenConExp(2); } } else txtNomExp.setText(strNomExp); }//GEN-LAST:event_txtNomExpFocusLost private void butExpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butExpActionPerformed strCodExp=txtCodExp.getText(); mostrarVenConExp(0); }//GEN-LAST:event_butExpActionPerformed private void chkMosNotPedAsoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkMosNotPedAsoActionPerformed if(chkMosNotPedAso.isSelected()){ objTblMod.removeSystemHiddenColumn(INT_TBL_DAT_BUT_NOT_PED, tblDat); } else{ objTblMod.addSystemHiddenColumn(INT_TBL_DAT_BUT_NOT_PED, tblDat); } }//GEN-LAST:event_chkMosNotPedAsoActionPerformed private void chkMosPedEmbAsoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkMosPedEmbAsoActionPerformed if(chkMosPedEmbAso.isSelected()){ objTblMod.removeSystemHiddenColumn(INT_TBL_DAT_BUT_PED_EMB, tblDat); } else{ objTblMod.addSystemHiddenColumn(INT_TBL_DAT_BUT_PED_EMB, tblDat); } }//GEN-LAST:event_chkMosPedEmbAsoActionPerformed /** Cerrar la aplicación. */ private void exitForm() { dispose(); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.ButtonGroup bgrFil; private javax.swing.JButton butCer; private javax.swing.JButton butCon; private javax.swing.JButton butExp; private javax.swing.JButton butImp; private javax.swing.JComboBox cboEstDoc; private javax.swing.JCheckBox chkMosNotPedAso; private javax.swing.JCheckBox chkMosPedEmbAso; private javax.swing.JLabel lblEmpImp; private javax.swing.JLabel lblEstDoc; private javax.swing.JLabel lblExp; private javax.swing.JLabel lblMsgSis; private javax.swing.JLabel lblTit; private javax.swing.JRadioButton optFil; private javax.swing.JRadioButton optTod; private javax.swing.JPanel panBar; private javax.swing.JPanel panBarEst; private javax.swing.JPanel panBot; private javax.swing.JPanel panCon; private javax.swing.JPanel panFecDoc; private javax.swing.JPanel panFil; private javax.swing.JPanel panFrm; private javax.swing.JPanel panPrgSis; private javax.swing.JPanel panRpt; private javax.swing.JProgressBar pgrSis; private javax.swing.JScrollPane spnDat; private javax.swing.JTabbedPane tabFrm; private javax.swing.JTable tblDat; private javax.swing.JTextField txtCodExp; private javax.swing.JTextField txtCodImp; private javax.swing.JTextField txtNomExp; private javax.swing.JTextField txtNomImp; // End of variables declaration//GEN-END:variables /** * Esta función muestra un mensaje informativo al usuario. Se podría utilizar * para mostrar al usuario un mensaje que indique el campo que es invalido y que * debe llenar o corregir. */ private void mostrarMsgInf(String strMsg) { javax.swing.JOptionPane oppMsg=new javax.swing.JOptionPane(); String strTit; strTit="Mensaje del sistema Zafiro"; oppMsg.showMessageDialog(this,strMsg,strTit,javax.swing.JOptionPane.INFORMATION_MESSAGE); } /** * Esta función muestra un mensaje "showConfirmDialog". Presenta las opciones * Si y No. El usuario es quien determina lo que debe hacer el sistema * seleccionando una de las opciones que se presentan. */ private int mostrarMsgCon(String strMsg) { javax.swing.JOptionPane oppMsg=new javax.swing.JOptionPane(); String strTit; strTit="Mensaje del sistema Zafiro"; return oppMsg.showConfirmDialog(this,strMsg,strTit,javax.swing.JOptionPane.YES_NO_OPTION,javax.swing.JOptionPane.QUESTION_MESSAGE); } /** * Esta función muestra un mensaje de error al usuario. Se podría utilizar * para mostrar al usuario un mensaje que indique que los datos no se grabaron * y que debe comunicar de este particular al administrador del sistema. */ private void mostrarMsgErr(String strMsg) { javax.swing.JOptionPane oppMsg=new javax.swing.JOptionPane(); String strTit; strTit="Mensaje del sistema Zafiro"; oppMsg.showMessageDialog(this,strMsg,strTit,javax.swing.JOptionPane.ERROR_MESSAGE); } private void mostrarFormularioIngresoImportacion(int fila){ String strCodEmp=objTblMod.getValueAt(fila, INT_TBL_DAT_COD_EMP).toString(); String strCodLoc=objTblMod.getValueAt(fila, INT_TBL_DAT_COD_LOC).toString(); String strCodTipDoc=objTblMod.getValueAt(fila, INT_TBL_DAT_COD_TIP_DOC).toString(); String strCodDoc=objTblMod.getValueAt(fila, INT_TBL_DAT_COD_DOC).toString(); Importaciones.ZafImp34.ZafImp34 objImp_34=new Importaciones.ZafImp34.ZafImp34(objParSis, Integer.parseInt(strCodEmp), Integer.parseInt(strCodLoc), Integer.parseInt(strCodTipDoc), Integer.parseInt(strCodDoc)); this.getParent().add(objImp_34,javax.swing.JLayeredPane.DEFAULT_LAYER); objImp_34.setVisible(true); objImp_34=null; } private void mostrarFormularioNotaPedido(int fila){ try{ ZafImp05_01 objImp05_01=new ZafImp05_01(objParSis);//datos de nota de pedido objImp05_01.setCodigoEmpresaIngresoImportacion(Integer.parseInt(objTblMod.getValueAt(fila, INT_TBL_DAT_COD_EMP).toString())); objImp05_01.setCodigoLocalIngresoImportacion(Integer.parseInt(objTblMod.getValueAt(fila, INT_TBL_DAT_COD_LOC).toString())); objImp05_01.setCodigoTipoDocumentoIngresoImportacion(Integer.parseInt(objTblMod.getValueAt(fila, INT_TBL_DAT_COD_TIP_DOC).toString())); objImp05_01.setCodigoDocumentoIngresoImportacion(Integer.parseInt(objTblMod.getValueAt(fila, INT_TBL_DAT_COD_DOC).toString())); objImp05_01.cargarDocumentos(); if(objImp05_01.getNumeroRegistros()==1){ //se carga el programa Nota de Pedido Importaciones.ZafImp32.ZafImp32 objImp_32=new Importaciones.ZafImp32.ZafImp32(objParSis, objImp05_01.getCodigoLocalNotaPedido(), objImp05_01.getCodigoTipoDocumentoNotaPedido(), objImp05_01.getCodigoDocumentoNotaPedido()); this.getParent().add(objImp_32,javax.swing.JLayeredPane.DEFAULT_LAYER); objImp_32.setVisible(true); objImp_32=null; } else{ this.getParent().add(objImp05_01,javax.swing.JLayeredPane.DEFAULT_LAYER); objImp05_01.setVisible(true); objImp05_01=null; } } catch (Exception e){ objUti.mostrarMsgErr_F1(this, e); } } private void mostrarFormularioPedidoEmbarcado(int fila){ int intCodEmpIngImp=0; int intCodLocIngImp=0; int intCodTipDocIngImp=0; int intCodDocIngImp=0; try{ con=DriverManager.getConnection(objParSis.getStringConexion(), objParSis.getUsuarioBaseDatos(), objParSis.getClaveBaseDatos()); if(con!=null){ stm=con.createStatement(); strSQL=""; strSQL+=" SELECT b1.co_emp, b1.co_loc, b1.co_tipDoc, b1.co_doc, b1.tx_desCor, b1.tx_desLar"; strSQL+=" , b1.co_tipDocIngImp, b1.co_docIngImp, COUNT(b1.co_docIngImp) AS ne_numRegPedEmb "; strSQL+=" FROM("; strSQL+=" SELECT a4.co_emp, a4.co_loc, a4.co_tipDoc, a4.co_doc"; strSQL+=" , a7.tx_desCor, a7.tx_desLar, a4.ne_numDoc, a4.tx_numDoc2"; strSQL+=" , a5.co_tipDoc AS co_tipDocIngImp, a5.co_doc AS co_docIngImp"; strSQL+=" FROM tbm_cabNotPedImp AS a1 INNER JOIN tbm_detNotPedImp AS a2"; strSQL+=" ON a1.co_emp=a2.co_emp AND a1.co_loc=a2.co_loc AND a1.co_tipDoc=a2.co_tipDoc AND a1.co_doc=a2.co_doc"; strSQL+=" INNER JOIN tbm_detPedEmbImp AS a3"; strSQL+=" ON a2.co_emp=a3.co_emp AND a2.co_loc=a3.co_locrel AND a2.co_tipdoc=a3.co_tipDocrel AND a2.co_doc=a3.co_docrel AND a2.co_reg=a3.co_regrel"; strSQL+=" INNER JOIN tbm_cabPedEmbImp AS a4"; strSQL+=" ON a3.co_emp=a4.co_emp AND a3.co_loc=a4.co_loc AND a3.co_tipDoc=a4.co_tipDoc AND a3.co_doc=a4.co_doc"; strSQL+=" INNER JOIN tbm_cabMovInv AS a5"; strSQL+=" ON a4.co_emp=a5.co_empRelPedEmbImp AND a4.co_loc=a5.co_locRelPedEmbImp"; strSQL+=" AND a4.co_tipDoc=a5.co_tipDocRelPedEmbImp AND a4.co_doc=a5.co_docRelPedEmbImp"; strSQL+=" INNER JOIN tbm_cabTipDoc AS a7"; strSQL+=" ON a4.co_emp=a7.co_emp AND a4.co_loc=a7.co_loc AND a4.co_tipDoc=a7.co_tipDoc"; strSQL+=" WHERE a4.st_reg NOT IN('E','I') AND a5.st_reg NOT IN('E','I')"; strSQL+=" AND a5.co_emp=" + objTblMod.getValueAt(fila, INT_TBL_DAT_COD_EMP) + " AND a5.co_loc=" + objTblMod.getValueAt(fila, INT_TBL_DAT_COD_LOC) + ""; strSQL+=" AND a5.co_tipDoc=" + objTblMod.getValueAt(fila, INT_TBL_DAT_COD_TIP_DOC) + " AND a5.co_doc=" + objTblMod.getValueAt(fila, INT_TBL_DAT_COD_DOC) + ""; strSQL+=" GROUP BY a5.co_emp, a5.co_loc, a5.co_tipDoc, a5.co_doc"; strSQL+=" , a7.tx_desCor, a7.tx_desLar, a4.ne_numDoc, a4.tx_numDoc2"; strSQL+=" , a4.co_emp, a4.co_loc, a4.co_tipDoc, a4.co_doc"; strSQL+=" ORDER BY a4.co_doc, a5.co_emp, a5.co_loc, a5.co_tipDoc, a5.co_doc"; strSQL+=" ) AS b1"; strSQL+=" GROUP BY b1.co_emp, b1.co_loc, b1.co_tipDoc, b1.co_doc"; strSQL+=" , b1.tx_desCor, b1.tx_desLar, b1.co_tipDocIngImp, b1.co_docIngImp"; rst=stm.executeQuery(strSQL); if(rst.next()){ if(rst.getInt("ne_numRegPedEmb")<=1){ intCodEmpIngImp=rst.getInt("co_emp"); intCodLocIngImp=rst.getInt("co_loc"); intCodTipDocIngImp=rst.getInt("co_tipDoc"); intCodDocIngImp=rst.getInt("co_doc"); } else{ intCodEmpIngImp=0; intCodLocIngImp=0; intCodTipDocIngImp=0; intCodDocIngImp=0; } } con.close(); con=null; rst.close(); rst=null; stm.close(); stm=null; //se carga el programa ingreso por importacion Importaciones.ZafImp33.ZafImp33 objImp_33=new Importaciones.ZafImp33.ZafImp33(objParSis, intCodTipDocIngImp, intCodDocIngImp); this.getParent().add(objImp_33,javax.swing.JLayeredPane.DEFAULT_LAYER); objImp_33.setVisible(true); //se limpia el objeto objImp_33=null; } } catch (java.sql.SQLException e){ objUti.mostrarMsgErr_F1(this, e); } catch (Exception e){ objUti.mostrarMsgErr_F1(this, e); } } private void mostrarFormularioDocumentoAjuste(int fila) { try { if(getDocumentosAjuste(fila)) { if(intRowsDocAju==1) { con = java.sql.DriverManager.getConnection(objParSis.getStringConexion(), objParSis.getUsuarioBaseDatos(), objParSis.getClaveBaseDatos()); if (con != null) { //Se carga el Ajuste de Inventario objAjuInv = new ZafAjuInv( javax.swing.JOptionPane.getFrameForComponent(this), objParSis, con, intCodEmpAju, intCodLocAju, intCodTipDocAju, intCodDocAju, objImp.INT_COD_MNU_PRG_AJU_INV, 'c'); objAjuInv.show(); //this.getParent().add(objAjuInv,javax.swing.JLayeredPane.DEFAULT_LAYER); //objAjuInv.setVisible(true); objAjuInv=null; con.close(); con=null; } } else { //Se carga el seguimiento de documento de ajustes. objSegAjuInv=new ZafSegAjuInv(javax.swing.JOptionPane.getFrameForComponent(this), true, objParSis, strSQL, false); objSegAjuInv.show(); objSegAjuInv=null; // this.getParent().add(objSegAjuInv,javax.swing.JLayeredPane.DEFAULT_LAYER); // objSegAjuInv.setVisible(true); } } } catch(java.sql.SQLException Evt){ objUti.mostrarMsgErr_F1(this, Evt); } catch (Exception e){ objUti.mostrarMsgErr_F1(this, e); } } private boolean getDocumentosAjuste(int fila) { boolean blnRes=true; try { con=DriverManager.getConnection(objParSis.getStringConexion(), objParSis.getUsuarioBaseDatos(), objParSis.getClaveBaseDatos()); if(con!=null) { stm=con.createStatement(); strSQL=""; strSQL+=" SELECT a.co_emp, a.co_loc, a.co_tipDoc, a.co_Doc, a.tx_desCor, a.tx_desLar, a.ne_numDoc, a.fe_doc, a1.tx_numDoc2"; strSQL+=" , 0 as co_itmMae, 0 as nd_Can, 0 as nd_canSol, 0 as nd_CanTrs, a.st_Aut "; strSQL+=" FROM ( "; strSQL+=" SELECT a1.co_emp, a1.co_loc, a1.co_tipDoc, a1.co_doc, a2.tx_desCor, a2.tx_desLar "; strSQL+=" , a1.ne_numDoc, a1.fe_doc, a.co_empRel, a.co_locRel, a.co_tipDocRel, a.co_docRel"; strSQL+=" , a1.st_aut "; //strSQL+=" , CASE WHEN a1.st_ingImp IS NULL THEN 'P' ELSE CASE WHEN a1.st_ingImp ='T' THEN 'A'"; //strSQL+=" ELSE CASE WHEN a1.st_ingImp IN ('D','C') THEN 'D' ELSE 'P' END END END AS st_aut "; strSQL+=" FROM tbr_cabMovInv as a "; strSQL+=" INNER JOIN tbm_cabMovInv as a1 ON a1.co_emp=a.co_emp AND a1.co_loc=a.co_loc AND a1.co_tipDoc=a.co_tipDoc AND a1.co_doc=a.co_doc "; strSQL+=" INNER JOIN tbm_cabTipDoc AS a2 ON a2.co_emp=a1.co_emp AND a2.co_loc=a1.co_loc AND a2.co_tipDoc=a1.co_tipDoc "; strSQL+=" WHERE a1.co_tipDoc in (select co_tipDoc from tbr_tipDocPrg where co_emp=" + objParSis.getCodigoEmpresa(); strSQL+=" and co_loc=" + objParSis.getCodigoLocal()+" and co_mnu= "+objImp.INT_COD_MNU_PRG_AJU_INV+") "; strSQL+=" AND a1.st_reg NOT IN('E'/*,'I'*/) "; //Se comenta para que presente los ajustes denegados, los mismos que tienen st_Reg='I' 31Ago2017 strSQL+=" GROUP BY a1.co_emp, a1.co_loc, a1.co_tipDoc, a1.co_doc, a2.tx_desCor, a2.tx_desLar "; strSQL+=" , a1.ne_numDoc, a1.fe_doc, a.co_empRel, a.co_locRel, a.co_tipDocRel, a.co_docRel, a1.st_ingImp "; strSQL+=" ) as a "; strSQL+=" INNER JOIN tbm_CabMovInv as a1 ON a1.co_emp=a.co_empRel AND a1.co_loc=a.co_locRel AND a1.co_tipDoc=a.co_tipDocRel AND a1.co_doc=a.co_docRel "; strSQL+=" WHERE a1.co_emp=" + objTblMod.getValueAt(fila, INT_TBL_DAT_COD_EMP); strSQL+=" AND a1.co_loc=" + objTblMod.getValueAt(fila, INT_TBL_DAT_COD_LOC); strSQL+=" AND a1.co_tipDoc=" + objTblMod.getValueAt(fila, INT_TBL_DAT_COD_TIP_DOC); strSQL+=" AND a1.co_doc=" + objTblMod.getValueAt(fila, INT_TBL_DAT_COD_DOC); strSQL+=" GROUP BY a.co_emp, a.co_loc, a.co_tipDoc, a.co_Doc, a.tx_desCor, a.tx_desLar, a.ne_numDoc, a.fe_doc, a1.tx_numDoc2, a.st_Aut"; strSQL+=" ORDER BY a1.tx_numDoc2, a.co_emp, a.co_loc, a.co_tipDoc, a.co_Doc"; rst=stm.executeQuery(strSQL); intRowsDocAju=0; while(rst.next()) { intCodEmpAju = rst.getInt("co_emp"); intCodLocAju = rst.getInt("co_loc"); intCodTipDocAju = rst.getInt("co_tipDoc"); intCodDocAju = rst.getInt("co_doc"); intRowsDocAju=rst.getRow(); } rst.close(); rst=null; stm.close(); stm=null; con.close(); con=null; } } catch (java.sql.SQLException e) { blnRes= false; objUti.mostrarMsgErr_F1(this, e); } catch (Exception e){ blnRes= false; objUti.mostrarMsgErr_F1(this, e); } return blnRes; } /** * Esta clase crea un hilo que permite manipular la interface gráfica de usuario (GUI). * Por ejemplo: se la puede utilizar para cargar los datos en un JTable donde la idea * es mostrar al usuario lo que está ocurriendo internamente. Es decir a medida que se * llevan a cabo los procesos se podría presentar mensajes informativos en un JLabel e * ir incrementando un JProgressBar con lo cual el usuario estaría informado en todo * momento de lo que ocurre. Si se desea hacer ésto es necesario utilizar ésta clase * ya que si no sólo se apreciaría los cambios cuando ha terminado todo el proceso. */ private class ZafThreadGUI extends Thread { public void run() { if (!cargarDetReg()) { //Inicializar objetos si no se pudo cargar los datos. lblMsgSis.setText("Listo"); pgrSis.setValue(0); butCon.setText("Consultar"); } //Establecer el foco en el JTable sólo cuando haya datos. if (tblDat.getRowCount()>0) { tabFrm.setSelectedIndex(1); tblDat.setRowSelectionInterval(0, 0); tblDat.requestFocus(); } objThrGUI=null; } } /** * Esta función permite consultar los registros de acuerdo al criterio seleccionado. * @return true: Si se pudo consultar los registros. * <BR>false: En el caso contrario. */ private boolean cargarDetReg() { boolean blnRes=true; String strFilFec=""; try { pgrSis.setIndeterminate(true); butCon.setText("Detener"); lblMsgSis.setText("Obteniendo datos..."); con=DriverManager.getConnection(objParSis.getStringConexion(), objParSis.getUsuarioBaseDatos(), objParSis.getClaveBaseDatos()); if (con!=null) { stm=con.createStatement(); //Fecha de documento if(objSelFecDoc.isCheckBoxChecked()){ switch (objSelFecDoc.getTipoSeleccion()){ case 0: //Búsqueda por rangos strFilFec+=" AND a1.fe_doc BETWEEN '" + objUti.formatearFecha(objSelFecDoc.getFechaDesde(), objSelFecDoc.getFormatoFecha(), objParSis.getFormatoFechaBaseDatos()) + "' AND '" + objUti.formatearFecha(objSelFecDoc.getFechaHasta(), objSelFecDoc.getFormatoFecha(), objParSis.getFormatoFechaBaseDatos()) + "'"; break; case 1: //Fechas menores o iguales que "Hasta". strFilFec+=" AND a1.fe_doc<='" + objUti.formatearFecha(objSelFecDoc.getFechaHasta(), objSelFecDoc.getFormatoFecha(), objParSis.getFormatoFechaBaseDatos()) + "'"; break; case 2: //Fechas mayores o iguales que "Desde". strFilFec+=" AND a1.fe_doc>='" + objUti.formatearFecha(objSelFecDoc.getFechaDesde(), objSelFecDoc.getFormatoFecha(), objParSis.getFormatoFechaBaseDatos()) + "'"; break; case 3: //Todo. break; } } //Programa Listado de ingresos por importacion strSQL =""; strSQL+=" SELECT b1.co_emp, b1.co_loc, b1.co_tipDoc, b1.co_doc, b1.tx_desCor, b1.tx_desLar, b1.ne_numDoc, b1.tx_numDoc2"; strSQL+=" , b1.fe_doc, b1.co_exp, b1.tx_nomExp, b1.st_reg, b1.fe_ingIngImp, b1.st_ingImp, b1.st_tieAju"; strSQL+=" , CASE WHEN b1.st_ingImp !='C' THEN ((current_date - b1.fe_ingIngImp)) END as ne_diaPed "; strSQL+=" , b1.nd_valDoc, SUM(b3.nd_valCarPag) as nd_valCarPag"; strSQL+=" FROM("; strSQL+=" SELECT a1.co_emp, a1.co_loc, a1.co_tipDoc, a1.co_doc, a2.tx_desCor, a2.tx_desLar, a1.ne_numDoc, a1.tx_numDoc2, a1.fe_doc"; strSQL+=" , CASE WHEN a5.co_exp IS NULL THEN a1.co_cli ELSE a5.co_exp END as co_exp"; strSQL+=" , CASE WHEN a5.co_exp IS NULL THEN a6.tx_nom ELSE a3.tx_nom END as tx_nomExp, a1.st_reg"; strSQL+=" , CAST(a1.fe_ingIngImp AS DATE) AS fe_ingIngImp "; strSQL+=" , CASE WHEN a1.st_ingImp IS NULL THEN 'P' ELSE a1.st_ingImp END as st_ingImp "; strSQL+=" , CASE WHEN a1.st_cieAjuInvIngImp IS NULL THEN 'N' ELSE a1.st_cieAjuInvIngImp END as st_tieAju"; strSQL+=" , SUM (a5.nd_cosTot) as nd_valDoc"; strSQL+=" FROM tbm_cabMovInv AS a1 INNER JOIN tbm_detMovInv AS a5"; strSQL+=" ON a1.co_emp=a5.co_emp AND a1.co_loc=a5.co_loc AND a1.co_tipDoc=a5.co_tipDoc AND a1.co_doc=a5.co_doc"; strSQL+=" INNER JOIN tbm_cabTipDoc AS a2 ON a1.co_emp=a2.co_emp AND a1.co_loc=a2.co_loc AND a1.co_tipDoc=a2.co_tipDoc"; strSQL+=" LEFT JOIN tbm_expImp AS a3 ON a5.co_exp=a3.co_exp"; strSQL+=" LEFT JOIN tbm_cli AS a6 ON(a1.co_emp=a6.co_emp AND a1.co_cli=a6.co_cli)"; if(cboEstDoc.getSelectedIndex()==0)//se presentan todos excepto los eliminados strSQL+=" WHERE a1.st_reg NOT IN ('E')"; else if(cboEstDoc.getSelectedIndex()==1)//se presentan solo los activos strSQL+=" WHERE a1.st_reg IN ('A')"; else if(cboEstDoc.getSelectedIndex()==2)//se presentan solo los activos strSQL+=" WHERE a1.st_reg IN ('I')"; strAux=txtCodImp.getText(); if (!strAux.equals("")) strSQL+=" AND a1.co_emp=" + strAux + ""; strAux=txtCodExp.getText(); if (!strAux.equals("")) strSQL+=" AND a5.co_exp=" + strAux + ""; strSQL+=" " + strFilFec; strSQL+=" GROUP BY a1.co_emp, a1.co_loc, a1.co_tipDoc, a1.co_doc, a2.tx_desCor, a2.tx_desLar, a1.ne_numDoc, a1.tx_numDoc2"; strSQL+=" , a1.fe_doc, a5.co_exp, a6.tx_nom, a3.tx_nom, a1.nd_tot, a1.st_reg, a1.fe_ingIngImp, a1.st_ingImp, a1.st_cieAjuInvIngImp"; strSQL+=" ) AS b1"; strSQL+=" INNER JOIN("; strSQL+=" SELECT a1.co_emp, a1.co_loc, a1.co_tipDoc, a1.co_doc, a1.nd_valCarPag"; strSQL+=" FROM tbm_carPagMovInv as a1 INNER JOIN tbm_detMovInv AS a2"; strSQL+=" ON a1.co_emp=a2.co_emp AND a1.co_loc=a2.co_loc AND a1.co_tipdoc=a2.co_tipDoc AND a1.co_doc=a2.co_doc"; strSQL+=" WHERE a1.co_CarPag IN(1,4,9)"; strSQL+=" GROUP BY a1.co_emp, a1.co_loc, a1.co_tipDoc, a1.co_doc, a2.co_exp, a1.nd_valCarPag"; strSQL+=" ) AS b3 ON b1.co_emp=b3.co_emp AND b1.co_loc=b3.co_loc AND b1.co_tipDoc=b3.co_tipDoc AND b1.co_doc=b3.co_doc "; strSQL+=" GROUP BY b1.co_emp, b1.co_loc, b1.co_tipDoc, b1.co_doc, b1.tx_desCor, b1.tx_desLar, b1.ne_numDoc, b1.tx_numDoc2"; strSQL+=" , b1.fe_doc, b1.co_exp, b1.tx_nomExp, b1.st_reg, b1.fe_ingIngImp, b1.st_ingImp, b1.st_tieAju, b1.nd_valDoc"; strSQL+=" ORDER BY b1.co_emp, b1.co_loc, b1.co_tipDoc, b1.co_doc"; System.out.println("cargarDetReg: "+strSQL); rst=stm.executeQuery(strSQL); //Limpiar vector de datos. vecDat.clear(); //Obtener los registros. lblMsgSis.setText("Cargando datos..."); while (rst.next()) { if (blnCon){ vecReg=new Vector(); vecReg.add(INT_TBL_DAT_LIN,""); vecReg.add(INT_TBL_DAT_COD_EMP, rst.getString("co_emp")); //co_empIngImp vecReg.add(INT_TBL_DAT_COD_LOC, rst.getString("co_loc")); //co_locIngImp vecReg.add(INT_TBL_DAT_COD_TIP_DOC, rst.getString("co_tipDoc")); //co_tipDocIngImp vecReg.add(INT_TBL_DAT_DES_COR_TIP_DOC, rst.getString("tx_desCor")); //tx_desCorTipDocIngImp vecReg.add(INT_TBL_DAT_DES_LAR_TIP_DOC, rst.getString("tx_desLar")); //tx_desCorTipDocIngImp vecReg.add(INT_TBL_DAT_COD_DOC, rst.getString("co_doc")); //co_docIngImp vecReg.add(INT_TBL_DAT_NUM_DOC, rst.getString("ne_numDoc")); //Núm.Doc. vecReg.add(INT_TBL_DAT_NUM_PED, rst.getString("tx_numDoc2")); //Núm.Ped. vecReg.add(INT_TBL_DAT_FEC_DOC, rst.getString("fe_doc")); //fe_doc vecReg.add(INT_TBL_DAT_COD_EXP, rst.getString("co_exp")); //co_exp vecReg.add(INT_TBL_DAT_NOM_EXP, rst.getString("tx_nomExp")); //tx_nomExp vecReg.add(INT_TBL_DAT_TOT_FOB_CFR, rst.getString("nd_valDoc")); //nd_valDoc vecReg.add(INT_TBL_DAT_TOT_ARA_FOD_IVA, rst.getString("nd_valCarPag"));//nd_valCarPag vecReg.add(INT_TBL_DAT_DIA_ARR, rst.getString("ne_diaPed")); //Dias de pedido sin cerrar. vecReg.add(INT_TBL_DAT_EST, rst.getString("st_reg")); //st_reg vecReg.add(INT_TBL_DAT_CHK_ARR, null);//Chk.Arr. vecReg.add(INT_TBL_DAT_CHK_CIE, null);//Chk.Cer. vecReg.add(INT_TBL_DAT_BUT, null);//Btn.Ing.Imp. vecReg.add(INT_TBL_DAT_BUT_NOT_PED, null);//Btn.Not.Ped. vecReg.add(INT_TBL_DAT_BUT_PED_EMB, null);//Btn.Ped.Emb. vecReg.add(INT_TBL_DAT_CHK_AJU, null);//Chk.Doc.Aju. vecReg.add(INT_TBL_DAT_BUT_DOC_AJU, null);//Btn.Doc.Aju. if(! ( (rst.getObject("st_tieAju")==null) || (rst.getString("st_tieAju").equals("N")) ) ) vecReg.setElementAt(new Boolean(true), INT_TBL_DAT_CHK_AJU); if(!rst.getString("st_ingImp").equals("P")) vecReg.setElementAt(new Boolean(true), INT_TBL_DAT_CHK_ARR); if(rst.getString("st_ingImp").equals("C")) vecReg.setElementAt(new Boolean(true), INT_TBL_DAT_CHK_CIE); vecDat.add(vecReg); } else { break; } } rst.close(); stm.close(); con.close(); rst=null; stm=null; con=null; //Asignar vectores al modelo. objTblMod.setData(vecDat); tblDat.setModel(objTblMod); vecDat.clear(); if (blnCon) lblMsgSis.setText("Se encontraron " + tblDat.getRowCount() + " registros."); else lblMsgSis.setText("Interrupción del usuario. Sólo se procesaron " + tblDat.getRowCount() + " registros."); butCon.setText("Consultar"); pgrSis.setIndeterminate(false); } } catch (java.sql.SQLException e) { blnRes=false; objUti.mostrarMsgErr_F1(this, e); } catch (Exception e) { blnRes=false; objUti.mostrarMsgErr_F1(this, e); } return blnRes; } }
[ "" ]
22215c39c525809ed3a3697fc3e0cf4a4a85ccfc
c639268b8f460440d8805e6abf407af80e231eb9
/monitor/src/main/java/com/eorionsolution/microservices/employeemonitor/monitor/service/EmployeeService.java
c4fd78553d73f52d9681859015d85092b110e2f5
[]
no_license
baocaixue/emp-sys
89539a890b2f8e7bdf98296fc3e787156f68ac5f
70136b8ae3daedd1fa4cf02362130075d5382ccb
refs/heads/master
2022-12-11T04:45:59.751664
2020-09-01T06:21:22
2020-09-01T06:21:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,067
java
package com.eorionsolution.microservices.employeemonitor.monitor.service; import com.eorionsolution.microservices.employeemonitor.domain.DeviceMessage; import com.eorionsolution.microservices.employeemonitor.monitor.domain.Employee; import com.eorionsolution.microservices.employeemonitor.monitor.repository.EmployeeAvatarRepository; import com.eorionsolution.microservices.employeemonitor.monitor.repository.EmployeeRepository; import lombok.AllArgsConstructor; import lombok.extern.log4j.Log4j2; import org.springframework.dao.DuplicateKeyException; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @Service @AllArgsConstructor @Log4j2 public class EmployeeService { private final EmployeeRepository employeeRepository; private final EmployeeAvatarRepository employeeAvatarRepository; private final DeviceMessageService deviceMessageService; private final RefreshDurationService refreshDurationService; private final EmployeeAvatarService employeeAvatarService; public Flux<Employee> findAll() { return employeeRepository.findAll(); } public Mono<Employee> save(Mono<Employee> employee) { return employee .flatMap(e -> employeeAvatarService .save(e.getEmployeeAvatar()) .map(e::setEmployeeAvatar) ).flatMap(employeeRepository::save); } public Mono<Object> checkExist(Mono<Employee> employee) { return employee.map(Employee::getSn) .flatMap(employeeRepository::findById) .flatMap(__ -> Mono.error(new DuplicateKeyException(""))) .switchIfEmpty(Mono.just(employee)); } public Flux<Employee> findEmployeesInByDuration() { return employeeRepository.findAllByMacInAndEnabledIsTrue( deviceMessageService.getMessagesByDuration(refreshDurationService.findOne()) .map(DeviceMessage::getMac)).sort((o1, o2) -> o2.getPriority() - o1.getPriority()); } public Flux<Employee> findEmployeesOutByDuration() { return employeeRepository.findAllByMacNotInAndEnabledIsTrue( deviceMessageService.getMessagesByDuration(refreshDurationService.findOne()) .map(DeviceMessage::getMac)).sort((o1, o2) -> o2.getPriority() - o1.getPriority()); } @Transactional public Mono<Void> deleteEmployeeCascadingWithAvatar(Mono<Employee> employee) { return employee .map(Employee::getSn) .filter(sn -> !StringUtils.isEmpty(sn)) .flatMap(employeeRepository::findById) .flatMap(e -> { var avatarId = e.getEmployeeAvatar().getId(); return employeeRepository.deleteBySn(e.getSn()) .then(employeeAvatarRepository.deleteById(avatarId)); }); } }
[ "535080691@qq.com" ]
535080691@qq.com
dcfdeb4e6a1f9a928eeac080c4792935f09356a0
4f0a67217dd8c6eaeb7657af2ccbeda5220a3025
/java/Remove Duplicates from Sorted Array.java
71e7fc0e6abc43ecb1909485ad559ae14e2408bb
[]
no_license
RudyGuo/leetcode
97c6392307246518641b6e1d4abc9941d109c430
2f98dd792f0a1eb2184c48d9331f6fe133f5b900
refs/heads/master
2016-09-06T07:18:27.115573
2015-05-10T14:16:21
2015-05-10T14:16:21
23,830,653
0
0
null
null
null
null
UTF-8
Java
false
false
911
java
// Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. // Do not allocate extra space for another array, you must do this in place with constant memory. // For example, // Given input array A = [1,1,2], // Your function should return length = 2, and A is now [1,2]. public class Solution { public int removeDuplicates(int[] A) { final int max = (int) Math.pow(2, 31); int length = A.length; int i = 0,comp = max,res = 0; while(i<length){ if(A[i]!=comp){ comp = A[i]; res ++; }else{ A[i] = max; } i++; } Arrays.sort(A); return res; } int removeDuplicates2(int A[]) { int n = A.length; if(n < 2) return n; int id = 1; for(int i = 1; i < n; ++i) if(A[i] != A[i-1]) A[id++] = A[i]; return id; } }
[ "guorudi@foxmail.com" ]
guorudi@foxmail.com
fde877bc0ad27be1a889828e7c9a0a247491c69b
cd1df111d8415405bce319f701281566d1ce1b04
/src/com/company/Student.java
04443dde4040dac0b66b34585b490d6dafa47db4
[]
no_license
alptugagcaQA/School
95d7ff978519b864f63c0e2d5b27445b0d03a57b
20a4500e8d091a302bc1053e7eed0cb3f5a4d875
refs/heads/master
2023-08-21T11:59:35.167912
2021-10-12T06:36:25
2021-10-12T06:36:25
416,213,802
0
0
null
null
null
null
UTF-8
Java
false
false
308
java
package com.company; public class Student extends Person { int year; Student(String name, String surname, int age, String gender,int year) { super(); this.name=name; this.surname=surname; this.age=age; this.gender=gender; this.year=year; } }
[ "alptug.agca@getir.com" ]
alptug.agca@getir.com
7dfabd002b4a8976ef61869225e00e49180b5d49
3950f4a43387185cd7db8e72f4eeb0f68940020c
/excel-upload-api/src/main/java/excelupload/RESTCheck.java
57bff266a0e01cfb1630375acb44ca6d2319bea0
[]
no_license
benjaminhuanghuang/excel-upload
3ff0a1732d8bc9025771e5f7828ee837fb60b8b5
c2400d265326f493c69fa00fd14c10581ce68f86
refs/heads/master
2020-03-29T17:59:45.777121
2018-09-28T02:57:30
2018-09-28T02:57:30
150,189,569
0
0
null
null
null
null
UTF-8
Java
false
false
351
java
package excelupload; import com.codahale.metrics.health.HealthCheck; public class RESTCheck extends HealthCheck { private final String version; public RESTCheck(String version) { this.version = version; } @Override protected Result check() throws Exception { return Result.healthy("Service is health"); } }
[ "bhuang@rms.com" ]
bhuang@rms.com
600258cfdd1ce39d9a9de4a8800a745f7af7dd46
47dbeab57fc72edfde86e625229b09e4c7e58b71
/src/br/edu/qi/dao/HorarioTurmaDao.java
3bdf959921ff02d3e5446e213ffbf9b59176cd55
[]
no_license
lucassveloso/Interdisciplinar-POOD
db6559a391c5555bba6d7b536d01c32b6d6f7cd6
f9fe450c030b2f506eec98c0f418f1bb6ab25047
refs/heads/master
2020-06-04T20:34:24.972343
2015-07-24T23:36:46
2015-07-24T23:36:46
38,790,388
0
0
null
null
null
null
ISO-8859-1
Java
false
false
2,030
java
package br.edu.qi.dao; import java.sql.ResultSet; import java.util.ArrayList; import br.edu.qi.dto.HorarioPessoa; import br.edu.qi.dto.HorarioTurma; public class HorarioTurmaDao extends GenericDao implements IDao<HorarioTurma> { private static final String INSERT = "insert into " + "horario_turmas values(?,?)"; private static final String SELECTTURMA = "select * from " + "horario_turmas where Id_turma=?"; private static final String SELECTHORARIO = "select * from " + "horario_turmas where Id_horario=?"; private static final String FINDALL = "select * from horario_turmas"; public void save(HorarioTurma obj) throws Exception { executeSQL(INSERT, obj.getIdHorario(), obj.getidTurma()); } public HorarioTurma findTurma(int id) throws Exception { HorarioTurma l = null; try { ResultSet rs = executeQuery(SELECTTURMA, id); if (rs.next()) { return l = new HorarioTurma(rs.getInt("Id_turma"),rs.getInt("Id_horario")); } } catch (Exception e) { throw new Exception("Id incorreto! " + e.getMessage()); } return l; } public ArrayList<HorarioTurma> findHorario(int id) throws Exception { ArrayList<HorarioTurma> l = new ArrayList<HorarioTurma>(); try { ResultSet rs = executeQuery(SELECTHORARIO, id); while (rs.next()) { l.add(new HorarioTurma(rs.getInt("Id_turma"),rs.getInt("Id_horario"))); } } catch (Exception e) { throw new Exception("Id incorreto! " + e.getMessage()); } return l; } public ArrayList<HorarioTurma> findAll() throws Exception { ArrayList<HorarioTurma> l = new ArrayList<HorarioTurma>(); try { ResultSet rs = executeQuery(FINDALL); while (rs.next()) { l.add(new HorarioTurma(rs.getInt("Id_turma"),rs.getInt("Id_horario"))); } } catch (Exception e) { throw new Exception( "Não foi possível achar todos as HorarioTurma! " + e.getMessage()); } return l; } @Override public HorarioTurma find(HorarioTurma obj) throws Exception { // TODO Auto-generated method stub return null; } }
[ "lucassveloso@hotmail.com" ]
lucassveloso@hotmail.com
4857b78b50cbe6663b3a20c000058195eb7670a2
ee365b1e64aa887d2de1c84c19b58fa0da30e738
/app/src/main/java/com/tcs/sonusourav/smartwatch/HeartbeatConnect.java
f2c9610ee1b2ab5ade0dc85bd54bfde792393ed6
[]
no_license
xixsuse/smartwatch
cb78409eabae38268a0913ed2e16e7a785c48bcd
1242b694b60465f8e3bcf806e0add987244ffbc5
refs/heads/master
2020-03-27T00:59:31.484582
2018-08-14T16:20:31
2018-08-14T16:20:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
19,491
java
package com.tcs.sonusourav.smartwatch; import android.annotation.SuppressLint; import android.app.Dialog; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothSocket; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.PackageManager; import android.os.Bundle; import android.os.Handler; import android.os.SystemClock; import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ImageButton; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.lang.reflect.Method; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Locale; import java.util.Set; import java.util.UUID; import static com.tcs.sonusourav.smartwatch.BluetoothActivity.MESSAGE_WRITE; public class HeartbeatConnect extends AppCompatActivity { // GUI Components private TextView mBluetoothStatus; private Button mConnectBtn; private ImageButton startbtn; private BluetoothAdapter mBTAdapter; private Set<BluetoothDevice> mPairedDevices; private ArrayAdapter<String> discoveredDevicesAdapter; private ArrayAdapter<String> pairedDevicesAdapter; private ArrayAdapter<String> mBTArrayAdapter; private ListView mDevicesListView; private Dialog dialog; private OutputStream outStream; private final String TAG = HeartbeatConnect.class.getSimpleName(); private Handler mHandler; // Our main handler that will receive callback notifications private ConnectedThread mConnectedThread; // bluetooth background worker thread to send and receive data private BluetoothSocket mBTSocket = null; // bi-directional client-to-client data path private final int writeMessage = 1234; private static final UUID BTMODULEUUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB"); // "random" unique identifier // #defines for identifying shared types between calling functions private final static int REQUEST_ENABLE_BT = 1; // used to identify adding bluetooth names private final static int MESSAGE_READ = 2; // used in bluetooth handler to identify message update private final static int CONNECTING_STATUS = 1; // used in bluetooth handler to identify message status private final static int MESSAGE_TOAST = 5; @SuppressLint("HandlerLeak") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.heartbeat_start); mBluetoothStatus = findViewById(R.id.hr_status_tv); mConnectBtn = findViewById(R.id.hr_button_connect); startbtn=findViewById(R.id.hr_analysis_btn); mBTAdapter = BluetoothAdapter.getDefaultAdapter(); // get a handle on the bluetooth radio // Ask for location permission if not already allowed if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_COARSE_LOCATION}, 1); mHandler = new Handler() { public void handleMessage(android.os.Message msg) { switch (msg.what){ case CONNECTING_STATUS: if (msg.arg1 == 1){ startbtn.setFocusable(true); startbtn.setClickable(true); Log.d("connected_state","true"); mBluetoothStatus.setText("Connected to Device: " + msg.obj); } else { mBluetoothStatus.setText("Connection Failed"); Log.d("connected_state", "false"); } break; case MESSAGE_WRITE: try { //attempt to place data on the outstream to the BT device outStream.write((writeMessage)); } catch (IOException e) { //if the sending fails this is most likely because device is no longer there Toast.makeText(getBaseContext(), "ERROR - Device not found", Toast.LENGTH_SHORT).show(); finish(); } break; case MESSAGE_READ: String readMessage = null; try { readMessage = new String((byte[]) msg.obj, "UTF-8"); Log.d("readMessage",readMessage); try { mBTSocket.close(); Toast.makeText(getApplicationContext(),readMessage,Toast.LENGTH_SHORT).show(); } catch (IOException e) { e.printStackTrace(); } Calendar c = Calendar.getInstance(); SimpleDateFormat sdf = new SimpleDateFormat("dd MMM YYYY HH:mm:ss a", Locale.US); String strDate = sdf.format(c.getTime()); Toast.makeText(getApplicationContext(),readMessage,Toast.LENGTH_SHORT).show(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } break; case MESSAGE_TOAST: Toast.makeText(getApplicationContext(), msg.getData().getString("toast"), Toast.LENGTH_SHORT).show(); break; } } }; if(mBTAdapter==null){ mBluetoothStatus.setText("Bluetooth not supported"); }else{ if(mBTAdapter.isEnabled()){ mBluetoothStatus.setText("Enabled"); mConnectBtn.setBackgroundResource(R.drawable.connect_button_activated); } else { mBluetoothStatus.setText("Disabled"); mConnectBtn.setBackgroundResource(R.drawable.connect_button_deactivated); } } mConnectBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { listPairedDevices(); } }); startbtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(HeartbeatConnect.this,HeartRateAnalysis.class)); } }); IntentFilter filter = new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED); registerReceiver(mReceiver, filter); } private final BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { final String action = intent.getAction(); if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)) { final int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR); switch (state) { case BluetoothAdapter.STATE_OFF: mBluetoothStatus.setText("Disabled"); mConnectBtn.setBackgroundResource(R.drawable.connect_button_deactivated); break; case BluetoothAdapter.STATE_ON: mBluetoothStatus.setText("Enabled"); mConnectBtn.setBackgroundResource(R.drawable.connect_button_activated); break; } } } }; public void onResume() { super.onResume(); if (mBTAdapter == null) { mBluetoothStatus.setText("Bluetooth not supported"); } else { if (mBTAdapter.isEnabled()) { mBluetoothStatus.setText("Enabled") ; } else mBluetoothStatus.setText("Disabled"); } } @Override public void onDestroy() { super.onDestroy(); unregisterReceiver(mReceiver); } private final BroadcastReceiver discoveryFinishReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (BluetoothDevice.ACTION_FOUND.equals(action)) { BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); if (device.getBondState() != BluetoothDevice.BOND_BONDED) { discoveredDevicesAdapter.add(device.getName() + "\n" + device.getAddress()); } }else if(BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(action)) { if(dialog.isShowing()){ if (discoveredDevicesAdapter.getCount() == 0) { Toast.makeText(getApplicationContext(), "No new device discovered", Toast.LENGTH_SHORT).show(); }else if(discoveredDevicesAdapter.getCount()==1){ Toast.makeText(getApplicationContext(), "New device discovered", Toast.LENGTH_SHORT).show(); } else Toast.makeText(getApplicationContext(), "New devices discovered", Toast.LENGTH_SHORT).show(); } } } }; @Override public void onPause() { super.onPause(); } // Enter here after user selects "yes" or "no" to enabling radio @Override protected void onActivityResult(int requestCode, int resultCode, Intent Data) { // Check which request we're responding to if (requestCode == REQUEST_ENABLE_BT) { // Make sure the request was successful if (resultCode == RESULT_OK) { // The user picked a contact. // The Intent's data Uri identifies which contact was selected. mBluetoothStatus.setText("Enabled"); } else mBluetoothStatus.setText("Disabled"); } } final BroadcastReceiver blReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (BluetoothDevice.ACTION_FOUND.equals(action)) { BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); // add the name to the list mBTArrayAdapter.add(device.getName() + "\n" + device.getAddress()); mBTArrayAdapter.notifyDataSetChanged(); } } }; private void listPairedDevices() { dialog = new Dialog(this); dialog.setContentView(R.layout.layout_bluetooth); dialog.setTitle("Bluetooth Devices"); if (mBTAdapter.isDiscovering()) { mBTAdapter.cancelDiscovery(); } mBTAdapter.startDiscovery(); //Initializing bluetooth adapters pairedDevicesAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1); discoveredDevicesAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1); //locate listviews and attatch the adapters ListView pairedListView = dialog.findViewById(R.id.pairedDeviceList); ListView discoveredListView = dialog.findViewById(R.id.discoveredDeviceList); pairedListView.setAdapter(pairedDevicesAdapter); discoveredListView.setAdapter(discoveredDevicesAdapter); // Register for broadcasts when a device is discovered IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND); registerReceiver(discoveryFinishReceiver, filter); // Register for broadcasts when discovery has finished filter = new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_FINISHED); registerReceiver(discoveryFinishReceiver, filter); mBTAdapter = BluetoothAdapter.getDefaultAdapter(); Set<BluetoothDevice> pairedDevices = mBTAdapter.getBondedDevices(); // If there are paired devices, add each one to the ArrayAdapter if (pairedDevices.size() > 0) { for (BluetoothDevice device : pairedDevices) { pairedDevicesAdapter.add(device.getName() + "\n" + device.getAddress()); } } else { pairedDevicesAdapter.add(getString(R.string.none_paired)); } // assign model to view pairedListView.setOnItemClickListener(mDeviceClickListener); discoveredListView.setOnItemClickListener(mDeviceClickListener); dialog.findViewById(R.id.cancelButton).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.setCancelable(true); dialog.show(); } private AdapterView.OnItemClickListener mDeviceClickListener = new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> av, View v, int arg2, long arg3) { if (!mBTAdapter.isEnabled()) { Toast.makeText(getBaseContext(), "Bluetooth not on", Toast.LENGTH_SHORT).show(); dialog.dismiss(); return; } mBluetoothStatus.setText("Connecting..."); // Get the device MAC address, which is the last 17 chars in the View String info = ((TextView) v).getText().toString(); final String address = info.substring(info.length() - 17); final String name = info.substring(0, info.length() - 17); // Spawn a new thread to avoid blocking the GUI one new Thread() { public void run() { boolean fail = false; BluetoothDevice device = mBTAdapter.getRemoteDevice(address); try { mBTSocket = createBluetoothSocket(device); } catch (IOException e) { fail = true; Toast.makeText(getBaseContext(), "Socket creation failed", Toast.LENGTH_SHORT).show(); } // Establish the Bluetooth socket connection. try { mBTSocket.connect(); } catch (IOException e) { try { fail = true; mBTSocket.close(); mHandler.obtainMessage(CONNECTING_STATUS, -1, -1) .sendToTarget(); } catch (IOException e2) { //insert code to deal with this Toast.makeText(getBaseContext(), "Socket creation failed", Toast.LENGTH_SHORT).show(); } } if (fail == false) { mConnectedThread = new ConnectedThread(mBTSocket); mConnectedThread.start(); try { outStream = mBTSocket.getOutputStream(); } catch (IOException e) { Toast.makeText(getBaseContext(), "ERROR - Could not create bluetooth outstream", Toast.LENGTH_SHORT).show(); } mHandler.obtainMessage(CONNECTING_STATUS, 1, -1, name) .sendToTarget(); } } }.start(); dialog.dismiss(); } }; private BluetoothSocket createBluetoothSocket(BluetoothDevice device) throws IOException { try { final Method m = device.getClass().getMethod("createInsecureRfcommSocketToServiceRecord", UUID.class); return (BluetoothSocket) m.invoke(device, BTMODULEUUID); } catch (Exception e) { Log.e(TAG, "Could not create Insecure RFComm Connection", e); } return device.createRfcommSocketToServiceRecord(BTMODULEUUID); } private class ConnectedThread extends Thread { private final BluetoothSocket mmSocket; private final InputStream mmInStream; private final OutputStream mmOutStream; public ConnectedThread(BluetoothSocket socket) { mmSocket = socket; InputStream tmpIn = null; OutputStream tmpOut = null; // Get the input and output streams, using temp objects because // member streams are final try { tmpIn = socket.getInputStream(); tmpOut = socket.getOutputStream(); } catch (IOException e) { } mmInStream = tmpIn; mmOutStream = tmpOut; } public void run() { byte[] buffer = new byte[1024]; // buffer store for the stream int bytes; // bytes returned from read() // Keep listening to the InputStream until an exception occurs while (true) { try { // Read from the InputStream bytes = mmInStream.available(); if (bytes != 0) { buffer = new byte[1024]; SystemClock.sleep(100); //pause and wait for rest of data. Adjust this depending on your sending speed. bytes = mmInStream.available(); // how many bytes are ready to be read? bytes = mmInStream.read(buffer, 0, bytes); // record how many bytes we actually read mHandler.obtainMessage(MESSAGE_READ, bytes, -1, buffer) .sendToTarget(); // Send the obtained bytes to the UI activity } } catch (IOException e) { e.printStackTrace(); break; } } } /* Call this from the main activity to send data to the remote device */ public void write(String input) { byte[] bytes = input.getBytes(); //converts entered String into bytes try { mmOutStream.write(bytes); } catch (IOException e) { } } /* Call this from the main activity to shutdown the connection */ public void cancel() { try { mmSocket.close(); } catch (IOException e) { } } } }
[ "sonusouravdx001@gmail.com" ]
sonusouravdx001@gmail.com
f072876324bee888a19736c8ac29f4e2ed95bacf
1cc621f0cf10473b96f10fcb5b7827c710331689
/Ex6/Procyon/com/jogamp/newt/event/WindowListener.java
b9d7da4cabc533f22c5053538f4a78d510173ecb
[]
no_license
nitaiaharoni1/Introduction-to-Computer-Graphics
eaaa16bd2dba5a51f0f7442ee202a04897cbaa1f
4467d9f092c7e393d9549df9e10769a4b07cdad4
refs/heads/master
2020-04-28T22:56:29.061748
2019-06-06T18:55:51
2019-06-06T18:55:51
175,635,562
0
0
null
null
null
null
UTF-8
Java
false
false
506
java
// // Decompiled by Procyon v0.5.30 // package com.jogamp.newt.event; public interface WindowListener extends NEWTEventListener { void windowResized(final WindowEvent p0); void windowMoved(final WindowEvent p0); void windowDestroyNotify(final WindowEvent p0); void windowDestroyed(final WindowEvent p0); void windowGainedFocus(final WindowEvent p0); void windowLostFocus(final WindowEvent p0); void windowRepaint(final WindowUpdateEvent p0); }
[ "nitaiaharoni1@gmail.com" ]
nitaiaharoni1@gmail.com
20b6d267b2dda1b2e21f56c480748f636183ffff
8fa57095215a5700317c04d526aa6b3cda5a6562
/src/ise/library/LambdaLayout.java
b2d69f226e3020fa306e5592c6f7800aa897aeae
[]
no_license
elek/antelope
abfbd12adc922a255881b39f2c222f951f9fba57
06cd88aa9590e0c9ea4532f7a0bd4b3068e3dfc1
refs/heads/master
2020-05-18T05:38:31.960113
2014-09-04T13:32:17
2014-09-04T13:32:17
23,663,211
1
0
null
null
null
null
UTF-8
Java
false
false
13,399
java
// $Id$ package ise.library; import java.awt.LayoutManager2; import java.awt.Component; import java.awt.Container; import java.awt.Dimension; import java.awt.Insets; import java.awt.Point; import java.io.Serializable; import java.util.BitSet; import java.util.Enumeration; import java.util.Hashtable; import java.util.Vector; /** * LambdaLayout, a Java layout manager.<br> * Copyright (C) 2001, Dale Anson<br> *<br> * This library is free software; you can redistribute it and/or<br> * modify it under the terms of the GNU Lesser General Public<br> * License as published by the Free Software Foundation; either<br> * version 2.1 of the License, or (at your option) any later version.<br> *<br> * This library is distributed in the hope that it will be useful,<br> * but WITHOUT ANY WARRANTY; without even the implied warranty of<br> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU<br> * Lesser General Public License for more details.<br> *<br> * You should have received a copy of the GNU Lesser General Public<br> * License along with this library; if not, write to the Free Software<br> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA<br> * <p> * LambdaLayout -- based on KappaLayout, but handles stretching of components * differently. From e-mail I've received about KappaLayout, many people are * expecting a different stretching behavior when resizing a Frame. LambdaLayout * has this expected behaviour, in that components with the 's' constraint set to * 'w', 'h', or 'wh'/'hw' will resize as the frame resizes. Like KappaLayout, * LambdaLayout respects the preferred size of components and will not shrink * a component to less than it's preferred size.<br> * Example use:<br> * This will put a button on a panel in the top of its cell, stretched to * fill the cell width, with a 3 pixel pad:<br> * <code> * Panel p = new Panel(new LambdaLayout()); * Button b = new Button("OK"); * p.add(b, "0, 0, 1, 2, 2, w, 3"); * </code> * <br> * The constraints string has this layout:<br> * "x, y, w, h, a, s, p"<br> * defined as follows:<br> * <ul> * <li>'x' is the column to put the component, default is 0<br> * <li>'y' is the row to put the component, default is 0<br> * <li>'w' is the width of the component in columns (column span), default is 1. * Can also be R or r, which means the component will span the remaining cells * in the row.<br> * <li>'h' is the height of the component in rows (row span), default is 1. * Can also be R or r, which means the component will span the remaining cells * in the column.<br> * <li>'a' is the alignment within the cell. 'a' can be a value between 0 and 8, * inclusive, (default is 0) and causes the alignment of the component within the cell to follow * this pattern:<br> * 8 1 2<br> * 7 0 3<br> * 6 5 4<br>, or<br> * 0 horizontal center, vertical center,<br> * 1 horizontal center, vertical top,<br> * 2 horizontal right, vertical top,<br> * 3 horizontal right, vertical center,<br> * 4 horizontal right, vertical bottom,<br> * 5 horizontal center, vertical bottom,<br> * 6 horizontal left, vertical bottom,<br> * 7 horizontal left, vertical center,<br> * 8 horizontal left, vertical top.<br> * <p> * By popular request, the alignment constraint can also be represented as:<br> * NW N NE<br> * &nbsp;W 0 E<br> * SW S SE<br> * which are compass directions for alignment within the cell. * <li>'s' is the stretch value. 's' can have these values:<br> * 'w' stretch to fill cell width<br> * 'h' stretch to fill cell height<br> * 'wh' or 'hw' stretch to fill both cell width and cell height<br> * '0' (character 'zero') no stretch (default) * <li>'p' is the amount of padding to put around the component. This much blank * space will be applied on all sides of the component, default is 0. * </ul> * Parameters may be omitted (default values will be used), e.g., * <code> p.add(new Button("OK), "1,4,,,w,");</code><br> * which means put the button at column 1, row 4, default 1 column wide, default * 1 row tall, stretch to fit width of column, no padding. <br> * Spaces in the parameter string are ignored, so these are identical:<br> * <code> p.add(new Button("OK), "1,4,,,w,");</code><br> * <code> p.add(new Button("OK), " 1, 4, , , w");</code><p> * Rather than use a constraints string, a Constraints object may be used * directly, similar to how GridBag uses a GridBagConstraint. E.g,<br> * <code> * Panel p = new Panel();<br> * LambdaLayout tl = new LambdaLayout();<br> * p.setLayout(tl);<br> * LambdaLayout.Constraints con = tl.getConstraint();<br> * con.x = 1;<br> * con.y = 2;<br> * con.w = 2;<br> * con.h = 2;<br> * con.s = "wh";<br> * panel.add(new Button("OK"), con);<br> * con.x = 3;<br> * panel.add(new Button("Cancel"), con);<br> * </code><br> * Note that the same Constraints can be reused, thereby reducing the number of * objects created.<p> * @author Dale Anson * @version $Revision$ */ public class LambdaLayout extends KappaLayout implements LayoutManager2, Serializable { /** * Required by LayoutManager, does all the real layout work. This is the only * method in LambdaLayout, all other methods are in KappaLayout. */ public void layoutContainer(Container parent) { synchronized(parent.getTreeLock()) { Insets insets = parent.getInsets(); int max_width = parent.getSize().width - (insets.left + insets.right); int max_height = parent.getSize().height - (insets.top + insets.bottom); int x = insets.left; // x and y location to put component in pixels int y = insets.top; int xfill = 0; // how much extra space to put between components int yfill = 0; // when stretching to fill entire container boolean add_xfill = false; boolean add_yfill = false; // make sure preferred size is known, a side effect is that countColumns // and countRows are automatically called. calculateDimensions(); // if necessary, calculate the amount of padding to add between the // components to fill the container if ( max_width > _preferred_width ) { int pad_divisions = 0; for ( int i = 0; i < _col_count; i++ ) { if ( _col_widths[i] >= 0 ) ++pad_divisions; } if ( pad_divisions > 0 ) xfill = (max_width - _preferred_width) / pad_divisions / 2; } if ( max_height > _preferred_height ) { int pad_divisions = 0; for ( int i = 0; i < _row_count; i++ ) { if ( _row_heights[i] >= 0 ) ++pad_divisions; } if ( pad_divisions > 0 ) yfill = (max_height - _preferred_height) / pad_divisions / 2; } // do the layout. Components are handled by columns, top to bottom, // left to right. Point cell = new Point(); for ( int current_col = 0; current_col < _col_count; current_col++ ) { // adjust x for previous column widths x = insets.left; for ( int n = 0; n < current_col; n++ ) { x += Math.abs(_col_widths[n]); if ( _col_widths[n] > 0 ) x += xfill * 2; } for ( int current_row = 0; current_row < _row_count; current_row++ ) { // adjust y for previous row heights y = insets.top; for ( int n = 0; n < current_row; n++ ) { y += Math.abs(_row_heights[n]); if ( _row_heights[n] > 0 ) { y += yfill * 2; } } cell.x = current_col; cell.y = current_row; Component c = (Component)_components.get(cell); if ( c != null && c.isVisible() ) { Dimension d = c.getPreferredSize(); Constraints q = (Constraints)_constraints.get(c); // calculate width of spanned columns = sum(preferred column // widths) + sum(xfill between columns) int sum_cols = 0; int sum_xfill = xfill * 2; for ( int n = current_col; n < current_col + q.w; n++ ) { sum_cols += Math.abs(_col_widths[n]); } if ( _col_widths[current_col] > 0 ) { for ( int n = current_col; n < current_col + q.w - 1; n++ ) { if ( _col_widths[n] > 0 ) sum_xfill += xfill * 2; } sum_cols += sum_xfill; } // calculate height of spanned rows int sum_rows = 0; int sum_yfill = yfill * 2; for ( int n = current_row; n < current_row + q.h; n++ ) { sum_rows += Math.abs(_row_heights[n]); } if ( _row_heights[current_row] > 0 ) { for ( int n = current_row; n < current_row + q.h - 1; n++ ) { if ( _row_heights[n] > 0 ) sum_yfill += yfill * 2; } sum_rows += sum_yfill; } int x_adj; int y_adj; // stretch if required if ( q.s.indexOf("w") != -1 && _col_widths[current_col] > 0 ) { d.width = sum_cols - q.p * 2; x_adj = q.p * 2; } else { x_adj = sum_cols - d.width; } if ( q.s.indexOf("h") != -1 && _row_heights[current_row] > 0 ) { d.height = sum_rows - q.p * 2; y_adj = q.p * 2; } else { y_adj = sum_rows - d.height; } // in each case, add the adjustment for the cell, then subtract // the correction after applying it. This prevents the corrections // from improperly accumulating across cells. Padding must be handled // explicitly for each case. // Alignment follows this pattern within the spanned cells: // 8 1 2 or NW N NE // 7 0 3 W 0 E // 6 5 4 SW S SE switch ( q.a ) { case N: // top center x += x_adj / 2 ; y += q.p; c.setBounds(x, y, d.width, d.height); x -= x_adj / 2; y -= q.p; break; case NE: // top right x += x_adj - q.p; y += q.p; c.setBounds(x, y, d.width, d.height); x -= x_adj - q.p; y -= q.p; break; case E: // center right x += x_adj - q.p; y += y_adj / 2; c.setBounds(x, y, d.width, d.height); x -= x_adj - q.p; y -= y_adj / 2; break; case SE: // bottom right x += x_adj - q.p; y += y_adj - q.p; c.setBounds(x, y, d.width, d.height); x -= x_adj - q.p; y -= y_adj - q.p; break; case S: // bottom center x += x_adj / 2; y += y_adj - q.p; c.setBounds(x, y, d.width, d.height); x -= x_adj / 2; y -= y_adj - q.p; break; case SW: // bottom left x += q.p; y += y_adj - q.p; c.setBounds(x, y, d.width, d.height); x -= q.p; y -= y_adj - q.p; break; case W: // center left x += q.p; y += y_adj / 2; c.setBounds(x, y, d.width, d.height); x -= q.p; y -= y_adj / 2; break; case NW: // top left x += q.p; y += q.p; c.setBounds(x, y, d.width, d.height); x -= q.p; y -= q.p; break; case 0: // dead center default: x += x_adj / 2; y += y_adj / 2; c.setBounds(x, y, d.width, d.height); x -= x_adj / 2; y -= y_adj / 2; break; } } } } } } }
[ "danson@cac97b45-5233-0410-80b0-ce5b3a02357d" ]
danson@cac97b45-5233-0410-80b0-ce5b3a02357d
d234fe821e08ef4247dd79293471b4b6bfc495a3
43ae59009dcdd5de74c13b650dae6f675aeaab64
/src/main/java/com/migesok/jaxb/adapter/javatime/ZonedDateTimeXmlAdapter.java
12e3910b0b2843c88a8888f3162d601794cc03d3
[ "Apache-2.0" ]
permissive
erlingegelund/jaxb-java-time-adapters
7257e51d8614981f5f514536313dedd939e0fc62
63de82969dd4b9f4478fff5ae7ca7b0620613db0
refs/heads/master
2020-03-31T05:14:44.667268
2018-08-17T20:53:45
2018-08-17T20:53:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
603
java
package com.migesok.jaxb.adapter.javatime; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; /** * {@code XmlAdapter} mapping JSR-310 {@code ZonedDateTime} to ISO-8601 string * <p> * String format details: {@link java.time.format.DateTimeFormatter#ISO_ZONED_DATE_TIME} * * @see javax.xml.bind.annotation.adapters.XmlAdapter * @see java.time.ZonedDateTime */ public class ZonedDateTimeXmlAdapter extends TemporalAccessorXmlAdapter<ZonedDateTime> { public ZonedDateTimeXmlAdapter() { super(DateTimeFormatter.ISO_ZONED_DATE_TIME, ZonedDateTime::from); } }
[ "mikhail.g.sokolov@gmail.com" ]
mikhail.g.sokolov@gmail.com
ed5dd259d84b42b1d7b0800405f183788642f029
cfd52bba018863b7eae0e62e2364a7c06549daac
/uportal-war/src/main/java/org/jasig/portal/character/stream/events/PortletTitlePlaceholderEventImpl.java
a01b1d589fd23d201de702844510d0982868c6ef
[ "LicenseRef-scancode-warranty-disclaimer", "BSD-3-Clause", "LicenseRef-scancode-free-unknown", "GPL-2.0-only", "xpp", "CC-BY-3.0", "EPL-1.0", "Classpath-exception-2.0", "CPL-1.0", "CDDL-1.0", "MIT", "LGPL-2.1-only", "MPL-2.0", "MPL-1.1", "LicenseRef-scancode-unknown-license-reference", ...
permissive
jpedraza/uPortal
950db4ed87e1b6deb2e699e55c8854506abf1c0d
98c7ea044aaf9e44203088d34b7ee37d7797fa88
refs/heads/master
2022-01-20T09:15:03.416502
2014-09-23T20:56:53
2014-09-23T20:56:53
24,393,457
1
0
Apache-2.0
2022-01-11T03:49:51
2014-09-23T23:38:37
null
UTF-8
Java
false
false
3,039
java
/** * Licensed to Jasig under one or more contributor license * agreements. See the NOTICE file distributed with this work * for additional information regarding copyright ownership. * Jasig 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.jasig.portal.character.stream.events; import org.jasig.portal.portlet.om.IPortletWindowId; /** * @author Eric Dalquist * @version $Revision$ */ public final class PortletTitlePlaceholderEventImpl extends PortletPlaceholderEventImpl implements PortletTitlePlaceholderEvent { private static final long serialVersionUID = 1L; private int hash = 0; public PortletTitlePlaceholderEventImpl(IPortletWindowId portletWindowId) { super(portletWindowId); } /* (non-Javadoc) * @see org.jasig.portal.character.stream.events.CharacterEvent#getEventType() */ @Override public CharacterEventTypes getEventType() { return CharacterEventTypes.PORTLET_TITLE; } @Override public int hashCode() { int h = hash; if (h == 0) { h = internalHashCode(); hash = h; } return h; } private int internalHashCode() { final int prime = 31; int result = 1; result = prime * result + ((this.getPortletWindowId() == null) ? 0 : this.getPortletWindowId().hashCode()); result = prime * result + ((this.getEventType() == null) ? 0 : this.getEventType().hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!PortletTitlePlaceholderEvent.class.isAssignableFrom(obj.getClass())) return false; PortletTitlePlaceholderEvent other = (PortletTitlePlaceholderEvent) obj; if (this.getEventType() == null) { if (other.getEventType() != null) return false; } else if (!this.getEventType().equals(other.getEventType())) return false; if (this.getPortletWindowId() == null) { if (other.getPortletWindowId() != null) return false; } else if (!this.getPortletWindowId().equals(other.getPortletWindowId())) return false; return true; } @Override public String toString() { return "PortletTitlePlaceholderEvent [" + "portletWindowId=" + this.getPortletWindowId() + "]"; } }
[ "eric.dalquist@gmail.com" ]
eric.dalquist@gmail.com
d83af3ba5ea0d5eac8d915ae9958c6596a10dcbc
fb50b1df7e2b09ea592193539034d42611c1dea2
/open4um/src/main/java/tp/kits3/open4um/dao/LikeDAO.java
d47b635985bbf05f37eb02e0d605b0a844350caa
[]
no_license
shanks195/open4um
e7d3b90ddb0e28f0b5ba726714c1e1bb134db253
9076b46ff99937de056269674fcf6376b4c826cc
refs/heads/main
2023-03-20T23:20:57.904970
2021-03-06T14:44:03
2021-03-06T14:44:03
345,097,876
0
0
null
null
null
null
UTF-8
Java
false
false
243
java
package tp.kits3.open4um.dao; import java.util.List; import tp.kits3.open4um.dto.LikePCDto; import tp.kits3.open4um.vo.Product; public interface LikeDAO { public void updatelike(LikePCDto likepc); public Product selectLikeP(int idpro); }
[ "robocon87@gmail.com" ]
robocon87@gmail.com
401272ae4005dd7f21ac8379dfeea137eda5d3ae
f9b3fc59fa79f89d31b60530c2c5ef75eb9e9b94
/app/src/main/java/comvv/example/administrator/viewutil/inject/InjectInvocationHandler.java
1e1d37315340c1f5334f7ec1fad61e9facc9c4f5
[]
no_license
watermelonRind/ViewUtils
ead52bcfe3d66b041a9469f0850a657bb5d57bdd
70000ee614c064156072b24de28ed1df9d6dfba4
refs/heads/master
2021-06-13T17:12:44.061158
2021-01-25T03:06:42
2021-01-25T03:06:42
101,026,644
0
0
null
null
null
null
UTF-8
Java
false
false
825
java
package comvv.example.administrator.viewutil.inject; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; /** * Created by Administrator on 2017/8/22. */ public class InjectInvocationHandler implements InvocationHandler { private Object receiver; private Method methodName; public InjectInvocationHandler(Object receiver, Method methodName) { this.receiver = receiver; this.methodName = methodName; } @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { //method 就是代理的方法啊 即 OnClick () String name = method.getName(); //调用自己的方法 if (methodName != null) { return methodName.invoke(receiver, args); } return null; } }
[ "15833164661@163.com" ]
15833164661@163.com
9ce3cb068cd7808b40c673cf82aa08a8ff765a51
abf10dfae87a7d0cb0f1dbc09f78464a38e78427
/src/localdatetime/LocalDateTest.java
026e2f925c930916ae130f49a878f8c0e9419de6
[ "MIT" ]
permissive
languno/java-tests
d750afc44d54dac8d23cac0e4fcbcb5a40e5953b
c1932a9b3e39fbc3f008ba0d641f86614138aaba
refs/heads/master
2021-09-07T08:34:57.603485
2018-02-20T11:10:58
2018-02-20T11:10:58
103,012,328
0
0
null
null
null
null
UTF-8
Java
false
false
680
java
package localdatetime; import java.time.LocalDate; import java.time.LocalTime; import java.time.format.DateTimeFormatter; public class LocalDateTest { public static void main(String[] args) { LocalDate ld = LocalDate.now(); System.out.println("LocalDate now: " + ld); LocalDate tomorrow2020 = ld.plusDays(1).withYear(2020); System.out.println("LocalDate tomorrow2020: " + tomorrow2020); LocalTime lt = LocalTime.now(); System.out.println("LocalTime now: " + lt); System.out.println("LocalTime now formatted: " + lt.format(DateTimeFormatter.ofPattern("HH:mm"))); LocalTime noon = LocalTime.NOON; System.out.println("LocalTime NOON: " + noon); } }
[ "languno@test.org" ]
languno@test.org
3db1de23b6ece4b70e96db55ff3b8dec6435bc7b
12c01591223f77c3bae0c1986add9f3e6e83fe54
/Company/src/main/java/com/sanjoyghosh/company/email/EarningsReminderEmail.java
41f8bb71160f0d72fe2ee833882d15811bc90a57
[]
no_license
stocksbhopal/Company
521ecf2383948692b78837f522b0940dc9a161f7
ee76dd8f74d2fc9341f44bdb2fed975eb44359f8
refs/heads/master
2021-06-03T23:14:44.415298
2017-12-30T20:13:17
2017-12-30T20:13:17
44,491,090
0
0
null
null
null
null
UTF-8
Java
false
false
5,349
java
package com.sanjoyghosh.company.email; /* * Copyright 2014-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ import java.io.IOException; import com.amazonaws.AmazonClientException; import com.amazonaws.auth.AWSCredentials; import com.amazonaws.auth.profile.ProfileCredentialsProvider; import com.amazonaws.regions.Region; import com.amazonaws.regions.Regions; import com.amazonaws.services.simpleemail.AmazonSimpleEmailServiceClient; import com.amazonaws.services.simpleemail.model.Body; import com.amazonaws.services.simpleemail.model.Content; import com.amazonaws.services.simpleemail.model.Destination; import com.amazonaws.services.simpleemail.model.Message; import com.amazonaws.services.simpleemail.model.SendEmailRequest; public class EarningsReminderEmail { static final String FROM = "stocksbhopal@gmail.com"; // Replace with your "From" address. This address must be verified. static final String TO = "sanjoy@yahoo.com"; // Replace with a "To" address. If you have not yet requested // production access, this address must be verified. static final String BODY = "This email was sent through Amazon SES by using the AWS SDK for Java."; static final String SUBJECT = "Amazon SES test (AWS SDK for Java)"; /* * Before running the code: * Fill in your AWS access credentials in the provided credentials * file template, and be sure to move the file to the default location * (~/.aws/credentials) where the sample code will load the * credentials from. * https://console.aws.amazon.com/iam/home?#security_credential * * WARNING: * To avoid accidental leakage of your credentials, DO NOT keep * the credentials file in your source directory. */ @SuppressWarnings("deprecation") public static void main(String[] args) throws IOException { // Construct an object to contain the recipient address. Destination destination = new Destination().withToAddresses(new String[]{TO}); // Create the subject and body of the message. Content subject = new Content().withData(SUBJECT); Content textBody = new Content().withData(BODY); Body body = new Body().withText(textBody); // Create a message with the specified subject and body. Message message = new Message().withSubject(subject).withBody(body); // Assemble the email. SendEmailRequest request = new SendEmailRequest().withSource(FROM).withDestination(destination).withMessage(message); try { System.out.println("Attempting to send an email through Amazon SES by using the AWS SDK for Java..."); /* * The ProfileCredentialsProvider will return your [default] * credential profile by reading from the credentials file located at * (~/.aws/credentials). * * TransferManager manages a pool of threads, so we create a * single instance and share it throughout our application. */ AWSCredentials credentials = null; try { credentials = new ProfileCredentialsProvider().getCredentials(); } catch (Exception e) { throw new AmazonClientException( "Cannot load the credentials from the credential profiles file. " + "Please make sure that your credentials file is at the correct " + "location (~/.aws/credentials), and is in valid format.", e); } // Instantiate an Amazon SES client, which will make the service call with the supplied AWS credentials. AmazonSimpleEmailServiceClient client = new AmazonSimpleEmailServiceClient(credentials); // Choose the AWS region of the Amazon SES endpoint you want to connect to. Note that your production // access status, sending limits, and Amazon SES identity-related settings are specific to a given // AWS region, so be sure to select an AWS region in which you set up Amazon SES. Here, we are using // the US East (N. Virginia) region. Examples of other regions that Amazon SES supports are US_WEST_2 // and EU_WEST_1. For a complete list, see http://docs.aws.amazon.com/ses/latest/DeveloperGuide/regions.html Region REGION = Region.getRegion(Regions.US_EAST_1); client.setRegion(REGION); // Send the email. client.sendEmail(request); System.out.println("Email sent!"); } catch (Exception ex) { System.out.println("The email was not sent."); System.out.println("Error message: " + ex.getMessage()); } } }
[ "sghosh@hytrust.com" ]
sghosh@hytrust.com
521c581dd4e5e194c7ce223bbf4b83d00d5672da
8d24fdf3b91db264ec5640e7015b9af4f41f9ab0
/CBI-MAV/src/it/zeussoft/cbiflat/mav/factory/CodiceFisso51Factory.java
4aac16805ac2cbbeee21eb9a426d29f3c0e1897f
[]
no_license
ZEUS1977/ItPatterns
1c9294587cece935801c1c90ea4666389214a31f
ebd5ab71acf08ac3ce28eb2d5a2651dc9911d89b
refs/heads/master
2021-01-09T20:40:57.110208
2017-02-13T15:34:39
2017-02-13T15:34:39
60,451,588
0
0
null
null
null
null
UTF-8
Java
false
false
408
java
package it.zeussoft.cbiflat.mav.factory; import it.zeussoft.cbiflat.mav.beans.CodiceFisso51; import it.zeussoft.cbiflat.mav.beans.input.ExcelFixedFormat; public class CodiceFisso51Factory { public void populateCodiceFisso(CodiceFisso51 cf51, ExcelFixedFormat row, int progressivo){ cf51.setProgressivo(Integer.toString(progressivo)); cf51.setNumeroDisposizione(Integer.toString(progressivo-1)); } }
[ "piergiorgio.buragina@gmail.com" ]
piergiorgio.buragina@gmail.com
bcf4b8294236bb551e16c449a427f9a4b2392018
6f7d8de3f64c05722ac99e5afb6eeaae14befab0
/src/main/java/com/app/myapp/model/Initializer.java
270db74dffd8e648b25916cd5d6e743bc0c3b466
[]
no_license
gabrielpbcode/company-app
32df3e66fcd3cb856ee5e750d0eb15896b487a05
63c45697e81b1a41a638c90570462bd8b8e7d36e
refs/heads/main
2023-05-31T07:13:37.381272
2021-07-06T13:52:49
2021-07-06T13:52:49
383,485,213
0
0
null
null
null
null
UTF-8
Java
false
false
303
java
package com.app.myapp.model; import lombok.Getter; import lombok.Setter; import javax.persistence.*; @Entity @Getter @Setter public class Initializer { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String value; private boolean initialized; }
[ "gabrielpbarruda@gmail.com" ]
gabrielpbarruda@gmail.com
f99068f7652bb15e198071fc0f8b43459d011eaa
8fe711e1903fd0296313937ab0a7cfd3d2bdebc4
/demo/src/main/java/com/example/demo22/aop/AnnotationAop.java
8661e344358fa6ae816d6b4b1ef5baeced5eebdd
[]
no_license
Chenbilang/dev
6ded16ab51bea1f904f2dcccbaaadb580486c0d2
3288c66835c7818d79fc4332b06eaf2e9791d02e
refs/heads/master
2020-05-17T21:54:03.254819
2019-04-30T08:39:58
2019-04-30T08:39:58
183,984,544
0
0
null
null
null
null
UTF-8
Java
false
false
843
java
package com.example.demo22.aop; import com.example.demo22.annotation.Test; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.springframework.stereotype.Component; import java.lang.annotation.Annotation; @Aspect @Component public class AnnotationAop { @Around(value = "execution(* com.example.demo22.annotation.*.*(..))") public void AnnotationTest(JoinPoint joinPoint) throws NoSuchMethodException { Annotation[] annotations = joinPoint.getSignature().getDeclaringType().getMethod("Test").getAnnotations(); for(Annotation annotation : annotations){ Test test=(Test)annotation; int value=test.value(); String name=test.name(); System.out.println(name+":"+value); } } }
[ "15016271589@163.com" ]
15016271589@163.com
ba176505332c4494f96b9208065a3f8a7f9af7c5
604e0bde353c4d340430af7b2ef9f41c86aaf8c2
/order/src/test/java/order/service/EmailPushServiceTest.java
43ded0c509d3cbee025ffbe567b13cc06c74b5e8
[]
no_license
jiandongc/ecommerce
bd0a20a85173bba2950ce0970ae2966776dffcad
26119617f814ecaf80a4a14f6512ddd3b48ffa69
refs/heads/master
2022-12-05T02:31:48.743862
2021-08-01T21:43:19
2021-08-01T21:43:19
30,383,000
3
0
null
2022-11-24T07:44:03
2015-02-05T22:53:49
Java
UTF-8
Java
false
false
4,191
java
package order.service; import email.data.GoogleReviewRequestData; import email.data.OrderConfirmationData; import email.data.OrderShippedData; import email.service.EmailService; import order.domain.Order; import order.mapper.GoogleReviewRequestDataMapper; import order.mapper.OrderConfirmationDataMapper; import order.mapper.OrderShippedDataMapper; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; import java.util.Optional; import static org.mockito.Matchers.any; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) public class EmailPushServiceTest { @Mock private OrderService orderService; @Mock private EmailService emailService; @Mock private OrderConfirmationDataMapper orderConfirmationDataMapper; @Mock private OrderShippedDataMapper orderShippedDataMapper; @Mock private GoogleReviewRequestDataMapper googleReviewRequestDataMapper; @InjectMocks private EmailPushService emailPushService; @Test public void shouldPushOrderConfirmationEmail(){ // Given OrderConfirmationData orderConfirmationData = OrderConfirmationData.builder().build(); when(orderService.findByOrderNumber("123-456-789")).thenReturn(Optional.of(new Order())); when(orderConfirmationDataMapper.map(any(Order.class), any(String.class), any(String.class), any(String.class), any(String.class))).thenReturn(orderConfirmationData); // When emailPushService.push("123-456-789", "order-confirmation"); // Then Mockito.verify(emailService).sendMessage(orderConfirmationData); } @Test public void shouldPushOrderShippedEmail(){ // Given OrderShippedData orderShippedData = OrderShippedData.builder().build(); when(orderService.findByOrderNumber("123-456-789")).thenReturn(Optional.of(new Order())); when(orderShippedDataMapper.map(any(Order.class))).thenReturn(orderShippedData); // When emailPushService.push("123-456-789", "order-shipped"); // Then Mockito.verify(emailService).sendMessage(orderShippedData); } @Test public void shouldPushGoogleReviewRequestEmail(){ // Given GoogleReviewRequestData googleReviewRequestData = GoogleReviewRequestData.builder().build(); when(orderService.findByOrderNumber("123-456-789")).thenReturn(Optional.of(new Order())); when(googleReviewRequestDataMapper.map(any(Order.class), any(String.class))).thenReturn(googleReviewRequestData); // When emailPushService.push("123-456-789", "google-review-request"); // Then Mockito.verify(emailService).sendMessage(googleReviewRequestData); } @Test public void shouldPushGoogleReviewRequestEmailWithVoucherCode(){ // Given GoogleReviewRequestData googleReviewRequestData = GoogleReviewRequestData.builder().build(); when(orderService.findByOrderNumber("123-456-789")).thenReturn(Optional.of(new Order())); when(googleReviewRequestDataMapper.map(any(Order.class), eq("voucherCode"))).thenReturn(googleReviewRequestData); // When emailPushService.pushGoogleReviewRequestMailWithVoucherCode("123-456-789", "voucherCode"); // Then Mockito.verify(emailService).sendMessage(googleReviewRequestData); } @Test public void shouldNotPushAnyEmailIfTypeIsUnknown(){ // Given when(orderService.findByOrderNumber("123-456-789")).thenReturn(Optional.of(new Order())); // When emailPushService.push("123-456-789", "unknown"); // Then Mockito.verifyZeroInteractions(emailService); } @Test public void shouldNotPushAnyEmailIfOrderNotFound(){ // Given when(orderService.findByOrderNumber("123-456-789")).thenReturn(Optional.empty()); // When emailPushService.push("123-456-789", "order-confirmation"); // Then Mockito.verifyZeroInteractions(emailService); } }
[ "jiandong.c@gmail.com" ]
jiandong.c@gmail.com
0bf3cb341b5850dfb04d9a595ca92487a7a7bf3c
cfe980502b84aafe0436824196b74061026643cd
/FourRowSolitaire/test/integration/IntCardTest.java
494ec891174385e9b5778b8207b53c4f2831ce93
[]
no_license
jbresett/FourRowSolitaire
e69b8fb46172cc2cdb6e6db2c1217ac185b957b9
abd7b9f7cb01885d0e1e76bd0a91874cebaf4bb5
refs/heads/master
2021-01-19T13:36:36.260731
2017-04-28T03:25:40
2017-04-28T03:25:40
82,428,545
0
4
null
2017-04-27T08:19:26
2017-02-19T01:57:41
Java
UTF-8
Java
false
false
1,724
java
package test.integration; import static org.testng.Assert.*; import org.testng.annotations.Test; import FourRowSolitaire.Card; public class IntCardTest { private Card.Suit suit; private int cardNumber, fullCardNumber; private Card card; public IntCardTest(int fullCardNumber) { this.card = new Card(fullCardNumber); this.suit = card.getSuit(); this.cardNumber = card.getNumber().ordinal(); this.fullCardNumber = fullCardNumber; } @Test public void equals() { assertEquals(card,card.clone(),"Card not .equal() to it's clone: " + card); } @Test public void color() { Card.Color color; switch (suit) { case DIAMONDS: case HEARTS: color = Card.Color.RED; // Red break; case CLUBS: case SPADES: color = Card.Color.BLACK; // black break; default: fail("Card suit is invalid."); return; } assertEquals(card.getColor(),color,"Card suit is invalid."); } @Test public void getNumber() { assertEquals(card.getNumber().ordinal(), cardNumber); assertEquals(card.getFullNumber(), fullCardNumber); } @Test public void getSuit() { assertEquals(card.getSuit(), suit); } @Test public void isHighlighted() { card.highlight(); assertTrue(card.isHighlighted()); card.unhighlight(); assertTrue(!card.isHighlighted()); } @Test public void isFaceUp() { card.setFaceUp(); assertTrue(card.isFaceUp()); card.setFaceDown(); assertTrue(!card.isFaceUp()); } @Test public void isValidSuit() { assertTrue(card.isValidSuit(card.getSuit().toString()),"Invalid Suit: " + cardNumber + " of " + suit + "(ID# " + fullCardNumber + ")"); assertTrue(!card.isValidSuit("Insert Random Text")); } }
[ "jbresett@asu.edu" ]
jbresett@asu.edu
f0e8754c8267b4564a6b11f3a7dfbf7bf3db2545
a225a49a2fc40de244dd5a79c421c1bd7e845037
/src/main/java/basepatterns/behavioral/state/DeveloperDay.java
9557d155af0fefe29074c3e8d16434e9b1b1adb1
[]
no_license
KrArkadiy/BasePatterns
81a4f2e96b357d3e5b1e1f2899ea30b628cde270
aeb1acdd4e340f80198f0c4f6f1ae4127d7893d9
refs/heads/master
2023-06-17T10:55:24.558546
2021-07-13T19:06:07
2021-07-13T19:06:07
385,708,721
0
0
null
null
null
null
UTF-8
Java
false
false
389
java
package main.java.basepatterns.behavioral.state; public class DeveloperDay { public static void main(String[] args) { Activity activity = new Sleeping(); Developer developer = new Developer(); developer.setActivity(activity); for (int i = 0; i < 10; i++) { developer.justDoIt(); developer.changeActivity(); } } }
[ "arkady.krylosov@yandex.ru" ]
arkady.krylosov@yandex.ru
94025baf0500a7ffcaabd867174e2e40aaa4b1ab
40e4e8fe857341acb32ff0bfe7b218f5415d6247
/src/chatteryClient/WriteThread.java
f23b7b9f9011ba63ad7633a7f82eb09430bd2f59
[]
no_license
Reiqu/chattery
e0ca755d75e0812e12c6b2ea99d585a3efdaf880
7bffcd6ac7ccc98cd9f548afbf407b7bf699f778
refs/heads/main
2023-08-02T05:04:14.527790
2021-10-07T15:13:17
2021-10-07T15:13:17
414,186,967
0
0
null
null
null
null
UTF-8
Java
false
false
1,794
java
package chatteryClient; import java.io.IOException; import java.io.ObjectOutputStream; import java.net.Socket; import shared.Message; import shared.MessageType; public class WriteThread extends Thread { private Socket socket; private Client client; private ObjectOutputStream output; private Message outgoingMessage; public WriteThread(Socket socket, Client client) { this.socket = socket; this.client = client; } public void run() { try { createOutput(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } this.setOutgoingMessage(new Message(client.getUsername(), null, MessageType.INITIAL, client.getChannel())); try { sendMessageIfExists(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void sendMessageIfExists() throws IOException { if (getOutgoingMessage() != null) { System.out.println("New outgoing message: " + "\n Name: " + getOutgoingMessage().getName() + "\n Nachricht: " + getOutgoingMessage().getText() + "\n Channel: " + getOutgoingMessage().getChannel() + "\n Type: " + getOutgoingMessage().getType()); output.writeObject(getOutgoingMessage()); setOutgoingMessage(null); } else { System.err.println("No message found. Cannot send anything"); } } private void createOutput() throws IOException { // Erstelle Outputstream, um ausgehende Message-Objekte zu senden output = new ObjectOutputStream(socket.getOutputStream()); } /** * @return the outgoingMessage */ public Message getOutgoingMessage() { return outgoingMessage; } /** * @param outgoingMessage the outgoingMessage to set */ public void setOutgoingMessage(Message outgoingMessage) { this.outgoingMessage = outgoingMessage; } }
[ "7108865@ez.edeka.net" ]
7108865@ez.edeka.net
d93aff2276f7eaba8afce1c3da27c2b544cbabf3
6a54b06295df6ec6fd0c5d5332d330de135fee0b
/basic/src/day29/Thread/wait/WaitNotifyExample1.java
0d14eb1a7ccec7a0997754e8febb05550e1baaa5
[]
no_license
xodnjs0317/java
a2e4a04549d5c7816cd76e9c21acebf17bdd7d12
096059a36d021885f8e07e26c156607f8b5ba85f
refs/heads/master
2023-01-08T22:47:28.273938
2020-10-30T06:34:49
2020-10-30T06:34:49
297,203,709
0
0
null
null
null
null
UTF-8
Java
false
false
345
java
package day29.Thread.wait; public class WaitNotifyExample1 { public static void main(String[] args) { DateBox dataBox = new DateBox(); ProducerThread producerThread = new ProducerThread(dataBox); ConsumerThread consumerThread = new ConsumerThread(dataBox); producerThread.start(); consumerThread.start(); } }
[ "KW505@505-18" ]
KW505@505-18
910b455d6dc7eaeaaf72b82760c15fd0f3a08cc8
ab86604678aa2ce1c282724a1c89cec8a1b2ca8a
/src/main/java/Completion.java
a96b32273f8a0d0892becda84ee80b334a6e29a5
[]
no_license
zakariyakassim/PostgresSQLJava
b840a203c4269bc070fd4b2c54651412dae4b514
e5517951aa75771e82a5be420e879aec07a3a54b
refs/heads/master
2020-03-23T05:16:03.957818
2018-07-16T12:15:08
2018-07-16T12:15:08
141,133,907
0
0
null
null
null
null
UTF-8
Java
false
false
312
java
import java.sql.Connection; public abstract class Completion { void onCompleted(User user) { System.out.println("connected"); } void onCompleted() { System.out.println("connected"); } void onRefused(Exception exception) { System.out.println("Refused"); } }
[ "zakariyakassim@live.com" ]
zakariyakassim@live.com
99522ec145845933f850e7c079586eb2fd58faf0
abad8a3abb84812d93d9825aa0da97b2c230579a
/src/test/java/com/cydeo/pages/AdidasPage.java
636da078406399e1cb2a343e4cc8f39ff090cf39
[]
no_license
kquezcore/cucumber-project-b23
75312d4c50252b0f227df34859417381460be12d
7172edf68fa971ef16b4e293dcd2b710703489ca
refs/heads/master
2023-08-13T05:16:25.412810
2021-10-18T14:53:38
2021-10-18T14:53:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,050
java
package com.cydeo.pages; import com.cydeo.utility.BrowserUtil; import com.cydeo.utility.Driver; import com.github.javafaker.Faker; import org.openqa.selenium.Alert; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import java.util.Arrays; import java.util.List; public class AdidasPage { public AdidasPage() { PageFactory.initElements(Driver.getDriver(), this); } @FindBy(xpath = "//h3[@class='price-container']") public WebElement purchasePrice; //a[.='Add to cart'] @FindBy(xpath = "//a[.='Add to cart']") public WebElement addCart; @FindBy(xpath = "(//a[@class='nav-link'])[1]") public WebElement homeLink; @FindBy(xpath = "//a[.='Cart']") public WebElement cart; @FindBy(xpath = "//button[.='Place Order']") public WebElement placeOrder; @FindBy(id = "name") public WebElement name; @FindBy(id = "country") public WebElement country; @FindBy(id = "city") public WebElement city; @FindBy(id = "card") public WebElement card; @FindBy(id = "month") public WebElement month; @FindBy(id = "year") public WebElement year; @FindBy(xpath = "//button[.='Purchase']") public WebElement purchaseButton; @FindBy(xpath = "//p[@class='lead text-muted ']") public WebElement confirmation; @FindBy(xpath = "//button[@class='confirm btn btn-lg btn-primary']") public WebElement OK; @FindBy(xpath = "//tbody//tr") public List<WebElement> allProductFromCart; public int addProduct(String category,String product){ // dynamic categories locator //a[.='"+category+"'] // dynamic products locator //a[normalize-space(.)='"+product+"'] Driver.getDriver().findElement(By.xpath("//a[.='"+category+"']")).click(); BrowserUtil.waitFor(1); Driver.getDriver().findElement(By.xpath("//a[normalize-space(.)='"+product+"']")).click(); BrowserUtil.waitFor(1); String priceString = purchasePrice.getText(); System.out.println("priceString = " + priceString); String[] priceArray = priceString.split(" "); System.out.println("Arrays.toString(priceArray) = " + Arrays.toString(priceArray)); priceString = priceArray[0].substring(1); int price = Integer.parseInt(priceString); //AddCart addCart.click(); //Explicit Wait WebDriverWait wait=new WebDriverWait(Driver.getDriver(), 5); wait.until(ExpectedConditions.alertIsPresent()); //Alert Alert alert=Driver.getDriver().switchTo().alert(); alert.accept(); //Go back home homeLink.click(); return price; } public int removeProduct(String product){ BrowserUtil.waitFor(1); // dynamic locator for productPrice in cartPage //tbody//td[.='"+product+"']/../td[3] String priceString = Driver.getDriver().findElement(By.xpath("//tbody//td[.='" + product + "']/../td[3]")).getText(); int price = Integer.parseInt(priceString); System.out.println("price = " + price); //dynamic locator for Delete button WebElement deleteButton = Driver.getDriver().findElement(By.xpath("//tbody//td[.='" + product + "']/../td/a")); deleteButton.click(); BrowserUtil.waitFor(3); //tbody//[.='"+product+"']/../td/a return price; } public void fillForm() { Faker faker=new Faker(); name.sendKeys(faker.name().fullName()); country.sendKeys(faker.country().name()); city.sendKeys(faker.country().capital()); card.sendKeys(faker.finance().creditCard()); month.sendKeys(String.valueOf(faker.number().numberBetween(1, 12))); year.sendKeys(String.valueOf(faker.number().numberBetween(2022, 2030))); } }
[ "quezadacore32@gmail.com" ]
quezadacore32@gmail.com
661ae9b363718ff4cdbdec0dbba0b1015c03b9e2
e946d0a3504c9ebe4605b85fcd7004431d26483c
/Helper/DatabaseUtil.java
afba339f91fbf53066b9498635a1c2a0cc7aea28
[]
no_license
mqm1999/lesson11
1999fd6ea4084614dc8e8e6606a03c405f611ef5
7d856f7d933e447da36d49b12c5758d4af42ecd1
refs/heads/master
2022-12-07T00:23:06.859725
2020-09-08T13:26:13
2020-09-08T13:26:13
293,739,742
0
0
null
null
null
null
UTF-8
Java
false
false
3,351
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 lesson11.Helper; // // //import java.sql.*; //import tat ca trong thu vien // ///** // * // * @author HP Pavilion // */ //public class Connector { // // private static Connector INSTANCE = null; // private static Connection connection = null; // // private Connector() { // // } // // public static Connector getInstance() { // if (INSTANCE == null) { // try { // Class.forName("com.mysql.jdbc.Driver"); // } catch (ClassNotFoundException e) { // System.out.println(e); // return null; // } //khai bao driver JDBC // // try { // INSTANCE = Connector.getInstance(); // connection = DriverManager.getConnection("jdbc:mysql://codedidungso.me/MaiQuangMinh", "root", "100000"); // return INSTANCE; // } catch (SQLException e) { // System.out.println(e); // return null; // } // } else { // return INSTANCE; // } // } // // public ResultSet executeQuery(String sql){ // ResultSet la tap. hop. cac' ban? ghi // try { // Statement statement = connection.createStatement(); // ResultSet rs = statement.executeQuery(sql); // return rs; // } catch (Exception e) { // return null; // } // } //} package lesson11.Helper; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.logging.Level; import java.util.logging.Logger; public class DatabaseUtil { Connection connection = null; public DatabaseUtil() { try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { System.out.println(e); return; } try { connection = DriverManager.getConnection("jdbc:mysql://codedidungso.me:3307/MaiQuangMinh", "root", "100000"); } catch (SQLException e) { System.out.println(e); } } public ResultSet executeQuery(String query) { try { Statement stmt = connection.createStatement(); System.out.println("Executing query: " + query); ResultSet rs = stmt.executeQuery(query); return rs; } catch (SQLException ex) { Logger.getLogger(DatabaseUtil.class.getName()).log(Level.SEVERE, null, ex); return null; } } public boolean updateQuery(String query) { try { Statement stmt = connection.createStatement(); System.out.println("Executing query: " + query); stmt.execute(query); return true; } catch (SQLException e) { return false; } } public boolean closeConnection() { try { connection.close(); return true; } catch (SQLException ex) { Logger.getLogger(DatabaseUtil.class.getName()).log(Level.SEVERE, null, ex); return false; } } }
[ "61899832+mqm1999@users.noreply.github.com" ]
61899832+mqm1999@users.noreply.github.com
c4f2fd7aaf4e8f8350725e26f1a134be8e88ebaf
c8b9bbd1a36a0e393d2884301314b8268e9839b8
/inheritance2/src/inheritance2/DatabaseLogger.java
08da4cda226c60af231dd2245a664bb38ca94fcb
[]
no_license
kachaq/java
f5cda55add75f257287cfec738a42e577acd49d3
147a5f4f333254337a17246f24dcfe7908b42615
refs/heads/main
2023-07-15T22:38:49.672478
2021-09-02T10:39:35
2021-09-02T10:39:35
400,032,586
0
0
null
null
null
null
UTF-8
Java
false
false
149
java
package inheritance2; public class DatabaseLogger extends Logger { @Override public void log() { System.out.println("Database Logged."); } }
[ "arbutun@gmail.com" ]
arbutun@gmail.com
865e92e1f7584495eb39340cc593c33925df1ebe
94d219b8ae44b8f0e0d20b5c3fac2f029e02c6d2
/src/main/java/abstractfactory/Door.java
73dd1f3279add10ea3d6ff85c09f4af2fa3978f0
[]
no_license
PlumpMath/designpattern-379
99abf962b0fb1358124a8ad70fe6f0a3081358e9
a1837e050d4c95c995368c67e997a9b6ca5fe204
refs/heads/master
2021-01-20T09:36:58.863635
2016-12-28T20:53:08
2016-12-28T20:53:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
121
java
package abstractfactory; /** * Created by guof on 21/12/16. */ public interface Door { String getDescription(); }
[ "guofei89@gmail.com" ]
guofei89@gmail.com
325ee0c1356b537eccf0e4616660853ed1891ba1
b5ac90ede7faa44e1474114a099962926044c74e
/src/main/java/com/kailismart/com/service/impl/OutMaterServiceImpl.java
b614f9ce954b34c25042e964d83a7268fa62198f
[]
no_license
clownSong/Kailismart
0486a2d58f1780175a35f4bac2009af2a3dfc101
cea8d8f1467ba2efb14a980d1793d0191c100513
refs/heads/master
2020-05-29T09:13:30.525872
2016-09-22T06:06:11
2016-09-22T06:06:11
68,892,333
0
0
null
null
null
null
UTF-8
Java
false
false
2,376
java
package com.kailismart.com.service.impl; import com.kailismart.com.entity.Count; import com.kailismart.com.entity.MaterOut; import com.kailismart.com.entity.MaterOutChild; import com.kailismart.com.mapper.OutMaterMapper; import com.kailismart.com.service.OutMaterChildService; import com.kailismart.com.service.OutMaterService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; import java.util.Map; import java.util.UUID; /** * Created by 宋正根 on 2016/8/30. */ @Service("outMaterService") public class OutMaterServiceImpl implements OutMaterService { @Autowired OutMaterMapper outMaterMapper; @Autowired OutMaterChildService outMaterChildService; public MaterOut getNowOutMater(String staffName,String data) { return outMaterMapper.getNowOutMater(staffName,data); } public Integer addOutMater(MaterOut materOut) { //添加出库单主对象到数据库 sdpm020 int state = outMaterMapper.addOutMater(materOut); List<MaterOutChild> materOutChildren = materOut.getMaterOuts(); if(state > 0){ //添加出库单材料到数据库 sdpm021 MaterOutChild child = null; for (int i = 0;i < materOutChildren.size();i++){ child = materOutChildren.get(i); child.setID(UUID.randomUUID().toString()); //生成材料主键id child.setMaterOutId(materOut.getID()); //设置出库单主表id outMaterChildService.addOutMater(child); //添加出库单到材料库 sdpm021表中 } } return state; } public List<MaterOut> getOutMaterList(Map<String, Object> params) { return outMaterMapper.getOutMaterList(params); } public List<Count> getCountForStaff(){ return outMaterMapper.getCountForStaff(); } public void updateState(MaterOut materOut) { outMaterMapper.updateState(materOut); } public MaterOut getOutMaterById(String outId) { return outMaterMapper.getOutMaterById(outId); } public List<MaterOut> getOutMaterByProjectId(String projectId) { return outMaterMapper.getOutMaterByProjectId(projectId); } }
[ "963398090@qq.com" ]
963398090@qq.com
4569b4b620c83e5589cca03d4a02540a109e17a0
cb5f27eb6960c64542023d7382d6b917da38f0fc
/sources/com/google/android/gms/internal/measurement/zzgu.java
50f829c01868e18a1e02256047ea3282976eaf7e
[]
no_license
djtwisty/ccah
a9aee5608d48448f18156dd7efc6ece4f32623a5
af89c8d3c216ec3371929436545227682e811be7
refs/heads/master
2020-04-13T05:33:08.267985
2018-12-24T13:52:39
2018-12-24T13:52:39
162,995,366
0
0
null
null
null
null
UTF-8
Java
false
false
768
java
package com.google.android.gms.internal.measurement; import android.content.Context; import java.util.concurrent.BlockingQueue; import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; public final class zzgu extends ThreadPoolExecutor { private final Context zzri; public zzgu(Context context, int i, int i2, long j, TimeUnit timeUnit, BlockingQueue<Runnable> blockingQueue, ThreadFactory threadFactory) { super(1, 1, 0, timeUnit, blockingQueue, threadFactory); this.zzri = context; } protected final void afterExecute(Runnable runnable, Throwable th) { if (th != null) { zzgp.zza("Uncaught exception: ", th, this.zzri); } } }
[ "alex@Alexs-MacBook-Pro.local" ]
alex@Alexs-MacBook-Pro.local
402cbd1abba9480437a96f30ab73ff8dbe225a97
26ed9cdb8874153b34fa906934db9fc19a7cb360
/MassiveCore/src/com/massivecraft/massivecore/store/GsonMongoConverter.java
f9cb50e9166e98c6d4bc23b3c014256156648df9
[ "MIT" ]
permissive
sarhatabaot/SuperFactions
9a10c0714d950011cef5c8d90d39f38ba1434119
3301cf0bb7ba66b720e01d9eb2530ac420e77b2a
refs/heads/master
2021-07-24T06:34:42.178446
2021-07-08T17:07:00
2021-07-08T17:07:00
185,599,748
0
0
null
2021-07-08T17:07:01
2019-05-08T12:16:18
Java
UTF-8
Java
false
false
5,396
java
package com.massivecraft.massivecore.store; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonNull; import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; import com.google.gson.internal.LazilyParsedNumber; import com.mongodb.BasicDBList; import com.mongodb.BasicDBObject; import com.mongodb.DBObject; import org.apache.commons.lang.StringUtils; import org.bson.types.ObjectId; import java.util.Map.Entry; public final class GsonMongoConverter { // -------------------------------------------- // // CONSTANTS // -------------------------------------------- // public static final String DOT_NORMAL = "."; public static final String DOT_MONGO = "<dot>"; public static final String DOLLAR_NORMAL = "$"; public static final String DOLLAR_MONGO = "<dollar>"; // -------------------------------------------- // // GSON 2 MONGO // -------------------------------------------- // public static String gson2MongoKey(String key) { key = StringUtils.replace(key, DOT_NORMAL, DOT_MONGO); key = StringUtils.replace(key, DOLLAR_NORMAL, DOLLAR_MONGO); return key; } public static BasicDBObject gson2MongoObject(JsonElement inElement, BasicDBObject out) { JsonObject in = inElement.getAsJsonObject(); for (Entry<String, JsonElement> entry : in.entrySet()) { String key = gson2MongoKey(entry.getKey()); JsonElement val = entry.getValue(); if (val.isJsonArray()) { out.put(key, gson2MongoArray(val)); } else if (val.isJsonObject()) { out.put(key, gson2MongoObject(val)); } else { out.put(key, gson2MongoPrimitive(val)); } } return out; } public static BasicDBObject gson2MongoObject(JsonElement inElement) { return gson2MongoObject(inElement, new BasicDBObject()); } public static BasicDBList gson2MongoArray(JsonElement inElement) { JsonArray in = inElement.getAsJsonArray(); BasicDBList out = new BasicDBList(); for (int i = 0; i < in.size(); i++) { JsonElement element = in.get(i); if (element.isJsonArray()) { out.add(gson2MongoArray(element)); } else if (element.isJsonObject()) { out.add(gson2MongoObject(element)); } else { out.add(gson2MongoPrimitive(element)); } } return out; } public static Object gson2MongoPrimitive(JsonElement inElement) { if (inElement.isJsonNull()) return null; JsonPrimitive in = inElement.getAsJsonPrimitive(); if (in.isBoolean()) { return in.getAsBoolean(); } if (in.isNumber()) { Number number = in.getAsNumber(); boolean floating; if (number instanceof LazilyParsedNumber) { floating = StringUtils.contains(number.toString(), '.'); } else { floating = (number instanceof Double || number instanceof Float); } if (floating) { return number.doubleValue(); } else { return number.longValue(); } } if (in.isString()) { return in.getAsString(); } throw new IllegalArgumentException("Unsupported value type for: " + in); } // -------------------------------------------- // // MONGO 2 GSON // -------------------------------------------- // public static String mongo2GsonKey(String key) { key = StringUtils.replace(key, DOT_MONGO, DOT_NORMAL); key = StringUtils.replace(key, DOLLAR_MONGO, DOLLAR_NORMAL); return key; } public static JsonObject mongo2GsonObject(DBObject inObject) { if (!(inObject instanceof BasicDBObject)) throw new IllegalArgumentException("Expected BasicDBObject as argument type!"); BasicDBObject in = (BasicDBObject)inObject; JsonObject jsonObject = new JsonObject(); for (Entry<String, Object> entry : in.entrySet()) { String key = mongo2GsonKey(entry.getKey()); Object val = entry.getValue(); if (val instanceof BasicDBList) { jsonObject.add(key, mongo2GsonArray((BasicDBList)val)); } else if (val instanceof BasicDBObject) { jsonObject.add(key, mongo2GsonObject((BasicDBObject)val)); } else { jsonObject.add(key, mongo2GsonPrimitive(val)); } } return jsonObject; } public static JsonArray mongo2GsonArray(DBObject inObject) { if (!(inObject instanceof BasicDBList)) throw new IllegalArgumentException("Expected BasicDBList as argument type!"); BasicDBList in = (BasicDBList)inObject; JsonArray jsonArray = new JsonArray(); for (int i = 0; i < in.size(); i++) { Object object = in.get(i); if (object instanceof BasicDBList) { jsonArray.add(mongo2GsonArray((BasicDBList) object)); } else if (object instanceof BasicDBObject) { jsonArray.add(mongo2GsonObject((BasicDBObject) object)); } else { jsonArray.add(mongo2GsonPrimitive(object)); } } return jsonArray; } public static JsonElement mongo2GsonPrimitive(Object inObject) { if (inObject == null) return JsonNull.INSTANCE; if (inObject instanceof Boolean) return new JsonPrimitive((Boolean) inObject); if (inObject instanceof Number) return new JsonPrimitive((Number) inObject); if (inObject instanceof String) return new JsonPrimitive((String) inObject); if (inObject instanceof Character) return new JsonPrimitive((Character) inObject); if (inObject instanceof ObjectId) return new JsonPrimitive(inObject.toString()); throw new IllegalArgumentException("Unsupported value type for: " + inObject); } }
[ "sarhatabaot1@gmail.com" ]
sarhatabaot1@gmail.com
aca2aa3d907718b0d9d820c2b4f1900958c099be
817b64d0b17967db17405a2cc463fba7cabc41a8
/src/main/java/pages/PIM.java
c180f3abebc8864cdf2e32396c40c774fa7e5aa1
[]
no_license
YashkevichArtem/FinalWork
7de60675476ec2d1546833ce386a117831bd7e1e
210c560ee574a9d5fe1d555eb01c4e3d1ea635fe
refs/heads/master
2023-07-16T16:31:05.284189
2021-09-08T14:17:10
2021-09-08T14:17:10
402,186,605
0
0
null
null
null
null
UTF-8
Java
false
false
2,546
java
package pages; import com.codeborne.selenide.SelenideElement; import io.qameta.allure.Step; import org.openqa.selenium.By; import static com.codeborne.selenide.Selenide.$; import static com.codeborne.selenide.Selenide.sleep; public class PIM extends AddUser{ SelenideElement pimModule = $("#menu_pim_viewPimModule"); SelenideElement empName = $("#empsearch_employee_name_empName"); SelenideElement searchBtn = $("#searchBtn"); SelenideElement slctEmp = $(By.xpath("//*[text()='0231']")); SelenideElement firstName = $("#personal_txtEmpFirstName"); SelenideElement lastName = $("#personal_txtEmpLastName"); SelenideElement empId = $("#personal_txtEmployeeId"); SelenideElement contactDetails = $("a[href*=\"contactDetails\"]"); SelenideElement workEmail = $("#contact_emp_work_email"); SelenideElement jobDetails = $("a[href*=\"JobDetails/\"]"); SelenideElement joinDate = $("#job_joined_date"); SelenideElement saveBtn = $("#btnSave"); SelenideElement startDateBtn = $("#job_contract_start_date"); SelenideElement endDateBtn = $("#job_contract_end_date"); SelenideElement reportTo = $("a[href*=\"ReportToDetails/\"]"); SelenideElement supName = $("td.supName"); @Step("Check personal details") public void perDetails(){ pimModule.click(); empName.sendKeys("Nathan Elliot"); searchBtn.click(); slctEmp.click(); } @Step("Check contact details") public void conDetails(){ contactDetails.click(); } @Step("Check report-to details") public void repDetails(){ reportTo.click(); } @Step("Check job details") public void jobDetails(){ jobDetails.click(); saveBtn.click(); startDateBtn.setValue("2021-01-01"); endDateBtn.setValue("2024-01-01"); saveBtn.click(); } SelenideElement addEmpBtn = $("#menu_pim_addEmployee"); SelenideElement firstNameField = $("#firstName"); SelenideElement lastNameField = $("#lastName"); SelenideElement subUnitBtn = $(By.xpath("//*[@id=\"job_sub_unit\"]/option[8]")); @Step("Add employee") public void newEmployee(){ pimModule.click(); addEmpBtn.click(); firstNameField.sendKeys("Senla"); lastNameField.sendKeys("Employee"); saveBtn.click(); jobDetails.click(); saveBtn.click(); startDateBtn.setValue("2021-01-01"); endDateBtn.setValue("2024-01-01"); subUnitBtn.click(); saveBtn.click(); } }
[ "yashkevich6235@gmail.com" ]
yashkevich6235@gmail.com
3aa4c5ed61b76d1c43e75967c7263b46f6506b83
e94846e1cdf4238ed542b44dfb66b532b6d9f6ad
/src/MyTitanPlayerGUI/UserIDError.java
cfd482f26991c7c28f4918fba345da010990a865
[]
no_license
trock5150/MyTitanPlayerProject
b37994866a414d4c17910ccf1f44b7df7815cc42
64e44a19d259e0d362d9dc9a48e0e2e0e6cee53f
refs/heads/master
2021-01-01T19:07:27.975928
2012-12-04T23:22:31
2012-12-04T23:22:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,864
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package MyTitanPlayerGUI; /** * * @author Rocky */ public class UserIDError extends javax.swing.JFrame { /** * Creates new form UserIDError */ public UserIDError() { initComponents(); } /** * 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() { okButton = new javax.swing.JButton(); userIDErrorLabel = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); okButton.setText("OK"); okButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { okButtonActionPerformed(evt); } }); userIDErrorLabel.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N userIDErrorLabel.setText("User ID must contain at least 6 characters!"); 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() .addComponent(userIDErrorLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 310, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addGap(116, 116, 116) .addComponent(okButton, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGap(28, 28, 28) .addComponent(userIDErrorLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(okButton) .addContainerGap(31, Short.MAX_VALUE)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed // TODO add your handling code here: dispose(); }//GEN-LAST:event_okButtonActionPerformed /** * @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(UserIDError.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(UserIDError.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(UserIDError.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(UserIDError.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* * Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new UserIDError().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton okButton; private javax.swing.JLabel userIDErrorLabel; // End of variables declaration//GEN-END:variables }
[ "trock5150@embarqmail.com" ]
trock5150@embarqmail.com
0fc3701cf7ad895c48fb2e5c89d1534a29037ea9
df6d359ad9f86a6f2134d008c08fd6cfabc37d97
/app/src/androidTest/java/com/example/centaepoint/lokronguide/ExampleInstrumentedTest.java
263a7196da1ff1a03c13c8bfb0a5bda6954528eb
[]
no_license
taesanitch/lokron
9ac83d1c70ab56a3fffba7008a5458dea839b16c
8f50c47e81e489c7958226c1dbeb5f0ba4f2f1bc
refs/heads/master
2021-04-30T04:03:57.193212
2018-02-18T12:20:01
2018-02-18T12:20:01
121,527,679
0
0
null
null
null
null
UTF-8
Java
false
false
771
java
package com.example.centaepoint.lokronguide; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.example.centaepoint.lokronguide", appContext.getPackageName()); } }
[ "Centaepoint@gmail.com" ]
Centaepoint@gmail.com
b4bc47c2ddd773633186b9fd42e9cd1b7256660c
c21e18642ade798f5515293d4ef2a2fe865f6a68
/src/main/java/fr/diginamic/chaines/ManipulationChaine.java
fc135da3a4e3f0e5ae0d63e6280e911f84427db7
[]
no_license
seniquel/approche-objet
42f0b3769315a9cba190dba34fb57f2deaa8f2e6
34042249261abe7d9308c00d5706d049753526c3
refs/heads/master
2022-11-06T02:06:13.579966
2020-06-22T16:45:05
2020-06-22T16:45:05
271,234,616
0
0
null
null
null
null
ISO-8859-1
Java
false
false
1,223
java
package fr.diginamic.chaines; import fr.diginamic.banque.entites.Client; import fr.diginamic.banque.entites.Compte; public class ManipulationChaine { public static void main(String[] args) { String chaine = "Durand;Marcel;012543;1 523.5"; char premierCaractere = chaine.charAt(0); System.out.println("Premier caractère: " + premierCaractere); int tailleChaine = chaine.length(); System.out.println("Taille de la chaine: "+ tailleChaine); int indexPremierPV = chaine.indexOf(';'); System.out.println("Index du premier \";\" : "+indexPremierPV); String nom = chaine.substring(0,indexPremierPV); System.out.println("Nom de famille en majuscule : "+nom.toUpperCase()); System.out.println("Nom de famille en minuscule : "+nom.toLowerCase()); String[] tabString = chaine.split(";"); System.out.println("Affichage du tableau :"); for (int i=0 ; i<tabString.length ; i++) { System.out.println(tabString[i]); } String prenom = tabString[1]; String num = tabString[2]; float solde = Float.valueOf(tabString[3].replace(" ","")); Client cl1 = new Client(nom,prenom); Compte co1 = new Compte(num,solde,cl1); System.out.println(cl1); System.out.println(co1); } }
[ "leo.senique@gmail.com" ]
leo.senique@gmail.com
644dcde7e71a7e4c603e732a6c0acf44aaf4a0da
c819a05ec2200f16ae1cbbf2decc9776e00cbcd3
/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/ResourceType.java
0f2929e1aefe3be67affc6fc3797fbafa2650a59
[ "Apache-2.0" ]
permissive
mohiaror/sling-org-apache-sling-servlets-resolver
d1096a5f84404a5fea621dbe51346444ce2de2db
99299120e631b23669b3e33447fd069fed4e997d
refs/heads/master
2022-12-04T00:29:31.606416
2020-08-24T21:19:49
2020-08-24T21:19:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,978
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.sling.servlets.resolver.bundle.tracker; import java.util.Objects; import java.util.regex.Pattern; import org.apache.commons.lang3.StringUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.osgi.framework.Version; /** * The {@code ResourceType} encapsulates details about a Sling resource type and provides methods for parsing resource type strings. * * <p>The following patterns are supported for parsing:</p> * <ol> * <li><tt>a/b/c</tt> - path-based</li> * <li><tt>a/b/c/1.0.0</tt> - path-based, versioned</li> * <li><tt>a.b.c</tt> - Java package name</li> * <li><tt>a.b.c/1.0.0</tt> - Java package name, versioned</li> * <li><tt>a</tt> - flat (sub-set of path-based)</li> * </ol> */ public final class ResourceType { private static final Pattern versionPattern = Pattern.compile("[\\d\\.]+(-.*)*$"); private final String type; private final String version; private final String resourceLabel; private final String toString; private ResourceType(@NotNull String type, @Nullable String version) { this.type = type; this.version = version; if (type.lastIndexOf('/') != -1) { resourceLabel = type.substring(type.lastIndexOf('/') + 1); } else if (type.lastIndexOf('.') != -1) { resourceLabel = type.substring(type.lastIndexOf('.') + 1); } else { resourceLabel = type; } toString = type + (version == null ? "" : "/" + version); } /** * Returns a resource type's label. The label is important for script selection, since it will provide the name of the main script * for this resource type. For more details check the Apache Sling * <a href="https://sling.apache.org/documentation/the-sling-engine/url-to-script-resolution.html#scripts-for-get-requests">URL to * Script Resolution</a> page * * @return the resource type label */ @NotNull public String getResourceLabel() { return resourceLabel; } /** * Returns the resource type string, without any version information. * * @return the resource type string */ @NotNull public String getType() { return type; } /** * Returns the version, if available. * * @return the version, if available; {@code null} otherwise */ @Nullable public String getVersion() { return version; } @Override public String toString() { return toString; } /** * Given a {@code resourceTypeString}, this method will extract a {@link ResourceType} object. * <p>The accepted patterns are:</p> * <ol> * <li><tt>a/b/c</tt> - path-based</li> * <li><tt>a/b/c/1.0.0</tt> - path-based, versioned</li> * <li><tt>a.b.c</tt> - Java package name</li> * <li><tt>a.b.c/1.0.0</tt> - Java package name, versioned</li> * <li><tt>a</tt> - flat (sub-set of path-based)</li> * </ol> * * @param resourceTypeString the resource type string to parse * @return a {@link ResourceType} object * @throws IllegalArgumentException if the {@code resourceTypeString} cannot be parsed */ @NotNull public static ResourceType parseResourceType(@NotNull String resourceTypeString) { String type = StringUtils.EMPTY; String version = null; if (StringUtils.isNotEmpty(resourceTypeString)) { int lastSlash = resourceTypeString.lastIndexOf('/'); if (lastSlash != -1 && !resourceTypeString.endsWith("/")) { String versionString = resourceTypeString.substring(lastSlash + 1); if (versionPattern.matcher(versionString).matches()) { try { version = Version.parseVersion(versionString).toString(); type = resourceTypeString.substring(0, lastSlash); } catch (IllegalArgumentException e) { type = resourceTypeString; } } else { type = resourceTypeString; } } else { type = resourceTypeString; } } if (StringUtils.isEmpty(type)) { throw new IllegalArgumentException(String.format("Cannot extract a type for the resourceTypeString %s.", resourceTypeString)); } return new ResourceType(type, version); } @Override public int hashCode() { return Objects.hash(type, version, resourceLabel); } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof ResourceType) { ResourceType other = (ResourceType) obj; return Objects.equals(type, other.type) && Objects.equals(version, other.version) && Objects.equals(resourceLabel, other.resourceLabel); } return false; } }
[ "pauls@apache.org" ]
pauls@apache.org
4e601fcf60e9be0d7aae4cd4972b0a24e82cfc6d
37c5d096d1cef4aa7b95e80b90ab4ce231b066db
/src/com/acme/domain/Service.java
bfd56599966fe8628b70dcbc79e26bebf57669e1
[]
no_license
hilliard/acmeordersystem
2841517691e2317fac6b34696759f4a1a6ee3e52
a6e2a4514ab0795502f294b43a5b3ac6d3fb2390
refs/heads/master
2021-01-10T18:07:00.137269
2016-12-21T14:55:35
2016-12-21T14:55:35
77,060,372
0
0
null
null
null
null
UTF-8
Java
false
false
905
java
package com.acme.domain; public class Service implements Product { private String name; private int estimatedTaskDuration; private boolean timeAndMaterials; public Service(String n, int dur, boolean tAndM) { this.estimatedTaskDuration = dur; this.name = n; this.timeAndMaterials = tAndM; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getEstimatedTaskDuration() { return estimatedTaskDuration; } public void setEstimatedTaskDuration(int estimatedTaskDuration) { this.estimatedTaskDuration = estimatedTaskDuration; } public boolean isTimeAndMaterials() { return timeAndMaterials; } public void setTimeAndMaterials(boolean timeAndMaterials) { this.timeAndMaterials = timeAndMaterials; } public String toString(){ return name + "(a " + estimatedTaskDuration + " day service)"; } }
[ "hilliards@gmail.com" ]
hilliards@gmail.com
5a518779dbe978c122726a4a5e446481bb87b60b
a61cd535440b31d78f2a90038306f02dc192f1f9
/src/fr/diginamic/resencement/RechercheDepartement.java
c9914ae1f1c33120537986a4c56c4e8739d9ceb5
[]
no_license
Victoria07/approcheObjet
e8ae11be94b65a62a9cabfdc3efce744870fa812
12ad6218278e9b54f6c90159aca601e25393ae11
refs/heads/master
2023-04-21T04:23:54.104623
2021-05-16T15:06:15
2021-05-16T15:06:15
362,054,345
0
0
null
null
null
null
UTF-8
Java
false
false
689
java
package fr.diginamic.resencement; import java.util.ArrayList; import java.util.Scanner; public class RechercheDepartement { public void traiter(ArrayList<Ville> villes) { // Département Scanner scannerDepartement = new Scanner(System.in);System.out.println("Veuillez choisir un département : "); String choixDepartement = scannerDepartement.nextLine();System.out.println("Vous avez saisi : "+choixDepartement); int totalDepartement = 0;for( int i = 0;i<villes.size();i++) { if (choixDepartement.equalsIgnoreCase(villes.get(i).getCodeDept())) { totalDepartement = totalDepartement + villes.get(i).getPopulationTotale(); } } System.out.println(totalDepartement); } }
[ "Victoria@DESKTOP-RQPGOGO.lan" ]
Victoria@DESKTOP-RQPGOGO.lan
e6080d5c99ef4bb7ac4818fb10a4f3b954dd8b06
d1b0907112057f30525fe6447045fc5066846c39
/app/src/androidTest/java/co/edu/ufpso/appcuartoahumado/ExampleInstrumentedTest.java
7757348d3baa13bab136379ef6bd1a58ca7b105e
[]
no_license
emgm/AppCuartoAhumado
cfce532970d9f86b2290fdcfd9f4809bce19ba41
1c0f06b5325ec88961d9372ec5e3f551f3813924
refs/heads/master
2020-04-10T18:22:53.912814
2018-12-14T19:15:09
2018-12-14T19:15:09
161,202,322
0
0
null
null
null
null
UTF-8
Java
false
false
742
java
package co.edu.ufpso.appcuartoahumado; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("co.edu.ufpso.appcuartoahumado", appContext.getPackageName()); } }
[ "emgonzalezm@ufpso.edu.co" ]
emgonzalezm@ufpso.edu.co
72b4b42dd1d4b25431d9d50d9b88e359fda21fa8
f5814d800c3d86a1b775756ecb600ded6a6d7a23
/GiHubTest/src/Test.java
2bdd3bcc24de48a37262e9c023ec5332b170b6ce
[]
no_license
synetcom1/GitHubTest
fa791e5f047ec66d65a81bface6931f0006468f4
5db1a733caec0d0ec2a18a958566d25ff6d5dd13
refs/heads/master
2021-04-22T19:29:52.193877
2020-03-25T03:45:32
2020-03-25T03:45:32
249,870,925
0
0
null
null
null
null
UTF-8
Java
false
false
119
java
public class Test { public static void main(String[] args) { System.out.println("This is a sample class"); } }
[ "tech.headinstructor@ciccc.ca" ]
tech.headinstructor@ciccc.ca
616d3c5a5a7b85cb8a11f3bae43791a809ea2765
b5c485493f675bcc19dcadfecf9e775b7bb700ed
/jee-utility-client-controller/src/main/java/org/cyk/utility/client/controller/component/menu/MenuBuilderMapGetterImpl.java
f049d2abd62f707e014c3bf95662d6ae95a9c3f9
[]
no_license
devlopper/org.cyk.utility
148a1aafccfc4af23a941585cae61229630b96ec
14ec3ba5cfe0fa14f0e2b1439ef0f728c52ec775
refs/heads/master
2023-03-05T23:45:40.165701
2021-04-03T16:34:06
2021-04-03T16:34:06
16,252,993
1
0
null
2022-10-12T20:09:48
2014-01-26T12:52:24
Java
UTF-8
Java
false
false
248
java
package org.cyk.utility.client.controller.component.menu; import java.io.Serializable; public class MenuBuilderMapGetterImpl extends AbstractMenuBuilderMapGetterImpl implements Serializable { private static final long serialVersionUID = 1L; }
[ "kycdev@gmail.com" ]
kycdev@gmail.com
9b0a66fcd4557ad4ebea3d7e84ddda26b2b3304b
c990b1cd635204d16088e6bf2fd6fe6d21c2624e
/src/main/java/it/partec/webappspringdata/repository/ClassRepository.java
b7c36407553cf8e0d551a498e0db959335d37f44
[]
no_license
davidecorsi/docker-spring-boot-from-java-image
8e9e234df67b23a23d228bbf538071b0c7cabc49
39c147183f162c0e956bdff196ce41114e841e23
refs/heads/main
2023-08-12T16:37:35.560226
2021-09-28T10:00:46
2021-09-28T10:00:46
411,184,382
0
1
null
null
null
null
UTF-8
Java
false
false
271
java
package it.partec.webappspringdata.repository; import org.springframework.data.jpa.repository.JpaRepository; import it.partec.webappspringdata.model.Class; public interface ClassRepository extends JpaRepository<Class, Long>{ public Class findByName(String name); }
[ "davide.corsi@par-tec.it" ]
davide.corsi@par-tec.it
b65961b338c37b1207e0581e7b00f73669a75c0c
d2e5ca2a6e3c93f114ba263618a0555296c7dda8
/Full_Reg_Suite/src/test/java/com/qualitest/pvh/pages/StoreLocator.java
1aad375cae10393f9f68b4855280ebd59377706c
[]
no_license
dennisstagliano/Ecomm-PVH
11fe8c3d7a9d0e8ad45084ed05721154310cbeff
6cc60341679844adcd1a986c846e58d80b6f25d6
refs/heads/master
2022-04-20T23:09:59.847298
2020-04-01T20:15:35
2020-04-01T20:15:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,701
java
package com.qualitest.pvh.pages; import static org.assertj.core.api.Assertions.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.qualitest.core.element.BaseElement; import com.qualitest.core.page.BasePage; import net.serenitybdd.core.annotations.findby.FindBy; public class StoreLocator extends BasePage { private static final Logger LOGGER = LoggerFactory.getLogger(StoreLocator.class); @FindBy(id = "address") private BaseElement searchLocation; @FindBy(xpath = "//*[@class='submitbutton']") protected BaseElement searchButton; @FindBy(xpath = "//*[@class='noresults']/p[1]") protected BaseElement noresultMessage; @FindBy(xpath = "//*[@id='Layer1']") protected BaseElement searchResultMap; /** * Method to retrieve value from search location text field * @return - Value of search location field */ private String getLocation() { LOGGER.info("Retriveing search location"); return searchLocation.waitUntilVisible().getAttribute("value"); } /** * Method to enter search location for store locator * @param location - search location e.g.: Edison, New Jersey */ protected void setLocation(String location) { LOGGER.info("Entering search location: " + location); searchLocation.type(location); } /** * Method to verify search location for store locator * @param location - expected default location e.g. Suffern NY 10901 */ public void verifySearchLocation(String location) { LOGGER.info("Verifying search location"); assertThat(getLocation()).as("Search Location").isEqualTo(location); } /** * Method to search store near provided location * @param location - search location e.g.: Edison, New Jersey */ public void searchStoreNear(String location) { setLocation(location); searchButton.click(); } /** * Method to verify no search result error message * @param message - Expected No search result error message */ public void verifyNoResultError(String message) { LOGGER.info("Verifying no search result message"); if(noresultMessage.isVisible()) { assertThat(noresultMessage.getText().toUpperCase()).as("No Result Error Message").contains(message.toUpperCase()); } else { sleep(15*1000); assertThat(noresultMessage.getText().toUpperCase()).as("No Result Error Message").contains(message.toUpperCase()); } } /** * Method to verify valid search result map is displayed */ public void verifyStoreLocatorResult() { LOGGER.info("Verifying valid search result is displayed"); assertThat(searchResultMap.isDisplayed()).as("Search Result Map is displayed").isTrue(); } }
[ "c-mmarup@BWO-LT17-69115.PVHCORP.COM" ]
c-mmarup@BWO-LT17-69115.PVHCORP.COM
4aeabc6b66b3541de587e36a325b6922e8815ef3
38bc9198deccdb8c0ece0e04c130cdc04d967fe2
/src/ca/mcgill/ecse211/lab5/OdometryCorrection.java
8c13b157194d0f23e5d86f24c187209f26de9fc8
[]
no_license
cvauclair/ecse211-lab5-team9
75dd53f97af7b5709f108d9aaff401f0f7d8fc91
daa2099809672acb4e1f8ec3ffd2f81942b9c27a
refs/heads/master
2021-07-17T10:58:43.711031
2017-10-24T19:31:03
2017-10-24T19:31:03
107,298,684
0
0
null
null
null
null
UTF-8
Java
false
false
2,952
java
package ca.mcgill.ecse211.lab5; /** * Created by Allison Mejia on 20/10/2017 */ import lejos.robotics.SampleProvider; public class OdometryCorrection extends Thread{ private static final long CORRECTION_PERIOD = 10; static Odometer odometer; SampleProvider ColorSensor; float[] colorData; static double tileSize; static double dist2wheel; public OdometryCorrection(Odometer odo,SampleProvider cs, float[] csData, double tileS, double dist2W){ this.odometer = odo; this.ColorSensor = cs; this.colorData = csData; this.tileSize = tileS; this.dist2wheel = dist2W; } public void run(){ while(true){ // Wait to detect line detectLine(this.ColorSensor,this.colorData,50,16,8); } } // Helper method that returns when a line is crossed, n indicates number of values to keep for moving average //Created by Christophe private static void detectLine(SampleProvider cs, float[] csData, int samplingFrequency, int threshold, int n){ float[] csValues = new float[n]; float movingAverage = 0; float lastMovingAverage = 0; float derivative = 0; int counter = 0; double Xo, Yo; //values returned by the odometer double lineTreshold = (double) 5/tileSize; //in cm = ~ 4.88 cm while(true){ cs.fetchSample(csData, 0); // Shift values and add new value for(int i = n-1; i > 0; i--){ csValues[i] = csValues[i-1]; } csValues[0] = csData[0] * 1000; // Increment counter counter++; // Compute moving average and derivative only if first n values have been measured if(counter >= n){ // If first time moving average is computed if(lastMovingAverage == 0){ lastMovingAverage = csValues[n-1]; } // Calculate the moving average movingAverage = lastMovingAverage + (csValues[0] - csValues[n-1])/n; // Calculate poor man's derivative derivative = movingAverage - lastMovingAverage; // Correct Odometer value if line is detected if(derivative > lineTreshold){ //range [0,12] Xo = (double) ( (odometer.getX()-dist2wheel) / tileSize); Yo = (double) ( (odometer.getY()-dist2wheel) / tileSize); if( Xo%1.0 <= lineTreshold && Yo%1.0 <=lineTreshold ){ //do nothing, we crossed a corner } else if( Xo%1.0 <= lineTreshold){ //we crossed a vertical line odometer.setX(((Xo - (Xo%1.0)) * tileSize) + dist2wheel ); } else if( Yo%1.0 <=lineTreshold){ //we crossed a horizonal line odometer.setY(((Yo- (Yo%1.0)) * tileSize) + dist2wheel ); } } } try { Thread.sleep(samplingFrequency); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }
[ "cfvauclair@gmail.com" ]
cfvauclair@gmail.com
e73fd508c9c7528ecda598d5fe91ca240576bf64
eabd9be629599d5fa297837c66bb6ca9ef8ec52e
/ch5/Solution54.java
20e70ec0fb85d1d1109aeb559627d197984b66fb
[]
no_license
shallwexuewei/CCAssignment
4b1ad69db5f0e50203a4553ac94e63a18a70ee4a
6ca7018c986c59684cf83a61908f6ed93850daf6
refs/heads/master
2021-01-18T05:28:59.949266
2015-10-20T04:42:09
2015-10-20T04:42:09
42,482,186
0
0
null
2015-09-14T23:09:26
2015-09-14T23:09:26
null
UTF-8
Java
false
false
3,770
java
package ch5.cbc.xuewei.ece.cmu; public class Solution54 { public static int[] nextNumber(int positiveInteger) { int[] result = new int[2]; boolean isTail0 = false; // true if the tail bit of the number is 0 if((positiveInteger & 1) == 0) { isTail0 = true; } int i = positiveInteger; int count0 = 0; // the number of tailing 0s int count1 = 0; // the number of 1s after rightmost non-trailing zero // count the number of tailing 0s while (((i & 1) == 0) && (i != 0)) { count0++; i >>>= 1; } // count the number of 1s after rightmost non-trailing zero while ((i & 1) == 1) { count1++; i >>>= 1; } int countTailing1s0s = count0 + count1; if (countTailing1s0s == 32 || countTailing1s0s == 0) { // in this case there is no bigger number, because all 1s are in the // right side of 0s result[0] = -1; } else { // the index of rightmost non-trailing zero int indexSpecial0 = count0 + count1; // used to flip the rightmost non-traling zero int mask = 1 << indexSpecial0; i = positiveInteger; // flip the rightmost non-traling zero i |= mask; // clear all bits after the position of the original rightmost // non-traling zero i &= ~(mask - 1); // flip (count1-1) zeros at the tail. i |= (1 << (count1 - 1)) - 1; result[0] = i; } // to calculate the next smallest number // from now on, // count1 is the number of tailing 1s // while count0 is the number of 0s after rightmost non-trailing 1 if (isTail0) { count1 = 0; if(count0 == 0) { // in this case there is no smaller number, because the number is 0 result[1] = -1; return result; } } else { i = positiveInteger >>> count1; if( i == 0) { // in this case there is no smaller number, because all 0s are in // the right side of 1s result[1] = -1; return result; } count0 = 0; // count the number of 1s after rightmost non-trailing zero while (((i & 1) == 0) && (i != 0)) { count0++; i >>>= 1; } } // the index of rightmost non-trailing 1 int indexSpecial1 = count0 + count1; i = positiveInteger; // clears all bits after rightmost non-trailing 1 i &= ((~0) << (indexSpecial1 + 1)); // make a mask with (count1+1) 1s at the tail int mask = (1 << (count1 + 1)) - 1; i |= mask << (count0 - 1); result[1] = i; return result; } public static void printResult(int[] result) { String[] strs = new String[2]; if(result[0] == -1) { strs[0] = "Error: no larger number!"; } else { strs[0] = Integer.toBinaryString(result[0]); } if(result[1] == -1) { strs[1] = "Error: no smaller number!"; } else { strs[1] = Integer.toBinaryString(result[1]); } System.out.println("next smallest number: \t" + strs[0]); System.out.println("next largest number: \t" + strs[1]); } /** * @param args */ public static void main(String[] args) { String binaryString = "1110110101110"; int num = Integer.parseInt(binaryString, 2); int[] result = Solution54.nextNumber(num); System.out.println("binary number: \t\t" + Integer.toBinaryString(num)); printResult(result); System.out.println("---------------------------------------------------------"); num = 1 << 31; result = Solution54.nextNumber(num); System.out.println("binary number: \t\t" + Integer.toBinaryString(num)); printResult(result); System.out.println("---------------------------------------------------------"); binaryString = "0000111111111"; num = Integer.parseInt(binaryString, 2); result = Solution54.nextNumber(num); System.out.println("binary number: \t\t" + Integer.toBinaryString(num)); printResult(result); System.out.println("---------------------------------------------------------"); } }
[ "wxuewei1991@gmail.com" ]
wxuewei1991@gmail.com
419b4a69e5c62f4e391b1d53fc43dc77ea828fab
5a2cb330b6f8e288141aa2612c51d04454e94e4c
/src/gov/nih/ncgc/util/DefaultAtomComparator.java
149051638d8ce47e2f8a85d0edc74b2a7a1dcf12
[]
no_license
ncats/scaffold-hopper
79a88598f80c4e5fe95c6cb5483baf8344dd43df
e9c341f591fb529140cc73fa5fde43e7eb56fe69
refs/heads/master
2021-11-23T06:55:32.601200
2021-10-25T02:48:09
2021-10-25T02:48:09
217,405,785
0
1
null
null
null
null
UTF-8
Java
false
false
2,213
java
// $Id: DefaultAtomComparator.java 3566 2009-11-15 06:21:22Z nguyenda $ package gov.nih.ncgc.util; import java.util.BitSet; import chemaxon.struc.MolAtom; import chemaxon.struc.MolBond; public class DefaultAtomComparator implements AtomComparator { boolean literal = false; // treat query atoms as literal? public DefaultAtomComparator () { this (false); } public DefaultAtomComparator (boolean literal) { this.literal = literal; } public boolean isLiteral () { return literal; } public void setLiteral (boolean literal) { this.literal = literal; } public boolean match (MolAtom a, MolAtom b) { int atnoA = a.getAtno(), atnoB = b.getAtno(); if (!literal) { if (atnoA == MolAtom.ANY || atnoB == MolAtom.ANY) { return true; } // treat pseudo atom same as ANY if (atnoA == MolAtom.PSEUDO || atnoB == MolAtom.PSEUDO) { return true; } if (atnoA == MolAtom.RGROUP && atnoB == MolAtom.RGROUP) { return a.getRgroup() == b.getRgroup(); } else if (atnoA == MolAtom.RGROUP || atnoB == MolAtom.RGROUP) { return true; } } BitSet aset = new BitSet (); BitSet bset = new BitSet (); if (!literal && atnoA == MolAtom.LIST) { int[] list = a.getList(); for (int i = 0; i < list.length; ++i) { aset.set(list[i]); } } else { aset.set(atnoA); } if (!literal && atnoB == MolAtom.LIST) { int[] list = b.getList(); for (int i = 0; i < list.length; ++i) { bset.set(list[i]); } } else { bset.set(atnoB); } /* return (aset.intersects(bset) && (a.isTerminalAtom() || b.isTerminalAtom() || a.getHybridizationState() == b.getHybridizationState())); */ return (aset.intersects(bset) && a.hasAromaticBond() == b.hasAromaticBond() ); } }
[ "caodac@gmail.com" ]
caodac@gmail.com
41e4bc03481c0c6e7422219637f5278b8419cae6
1197200a52bead624805030422c3579b64de4d38
/app/src/test/java/com/upward/androidmvptutorial/ExampleUnitTest.java
8804703fd9f1e93bc2456002178addc006d4a809
[]
no_license
tangdaojun/android-mpv-tutorial
69222676381c570640f48cd65ab66524d4651c91
e4ab88727e69c703698c04718b9dc18724edc1e0
refs/heads/master
2021-09-04T08:41:58.445189
2018-01-17T11:36:35
2018-01-17T11:36:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
322
java
package com.upward.androidmvptutorial; 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); } }
[ "upward.edu@gmail.com" ]
upward.edu@gmail.com
95624b636d3c6289dedb2e4770374c377589fc81
02470e5b45caae33fdaa8838075a7a8ab22324a1
/Zajecia4/src/Slider.java
45da7c967daa4c4c52305adafc85ab0a590c3b1e
[]
no_license
proenix/wsfip5java
093f70f2a54f6f889772d7356cc5be4c6ae4d464
654b14acb97bc299b7b954d963afafc7dcddbe93
refs/heads/master
2021-01-10T04:39:59.414914
2016-01-09T17:57:38
2016-01-09T17:57:38
44,008,928
0
0
null
null
null
null
UTF-8
Java
false
false
1,821
java
import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JSlider; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; public class Slider extends JFrame implements ChangeListener { private JLabel lCelsius, lFahrenheit; private JSlider sCelsius, sFahrenheit; private int tempCelsius, tempFahrenheit; public Slider() { setSize(400,450); setTitle("Przeliczanie stopni Celsiusza na Fahrenheita"); setLayout(null); sCelsius = new JSlider(0, 100, 0); sCelsius.setBounds(120, 50, 50, 300); sCelsius.setMajorTickSpacing(20); sCelsius.setMinorTickSpacing(5); sCelsius.setPaintTicks(true); sCelsius.setPaintLabels(true); sCelsius.addChangeListener(this); sCelsius.setOrientation(JSlider.VERTICAL); add(sCelsius); sFahrenheit = new JSlider(30, 212, 30); sFahrenheit.setBounds(220, 50, 50, 300); sFahrenheit.setMajorTickSpacing(20); sFahrenheit.setMinorTickSpacing(5); sFahrenheit.setPaintTicks(true); sFahrenheit.setPaintLabels(true); sFahrenheit.setEnabled(false); sFahrenheit.setOrientation(JSlider.VERTICAL); add(sFahrenheit); lCelsius = new JLabel("Celsius: "); lCelsius.setBounds(120, 10, 300, 50); add(lCelsius); lFahrenheit = new JLabel("Fahrenheit: "); lFahrenheit.setBounds(220, 10, 300, 50); add(lFahrenheit); } public static void main(String[] args) { Slider appMenu = new Slider(); appMenu.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); appMenu.setVisible(true); } @Override public void stateChanged(ChangeEvent arg0) { tempCelsius = sCelsius.getValue(); lCelsius.setText("Celsius: " + tempCelsius); tempFahrenheit = (int) Math.round(32 + (9.0/5.0) * tempCelsius); lFahrenheit.setText("Fahrenheit: " + tempFahrenheit); sFahrenheit.setValue(tempFahrenheit); } }
[ "piotr26ch@gmail.com" ]
piotr26ch@gmail.com
aef051091651be0db473903af0f355ec5792f9fe
9bb234f99bf421319282c60aa8e6bcb66a15f2e8
/actor/appium/src/main/java/org/getopentest/appium/Click.java
89780e3e6371cf3ad585492b5a32c509fb7c377b
[ "MIT" ]
permissive
adrianth/opentest
4f96f6c0d15740e02b5271e38548485f6e144842
dab544fef858d884cabf844cc28b907062ee48ef
refs/heads/master
2021-10-23T22:53:19.020342
2021-10-13T14:24:38
2021-10-13T14:24:38
116,105,715
0
1
null
2018-01-03T07:22:51
2018-01-03T07:22:51
null
UTF-8
Java
false
false
68
java
package org.getopentest.appium; public class Click extends Tap { }
[ "adrian.theo@gmail.com" ]
adrian.theo@gmail.com
be9cf613e1e95d54fc4bc44cbbdb14412ec4d7ab
10ccd4a913696094f34e28de5ee3d3652576f1fc
/src/main/java/diplom/Tests.java
556d100d9498d96e9072c050e3097a4f1eb2db26
[]
no_license
hetikk/diplom
bd606eba8ef3852079fe444eb27e5f0845ccd0c6
ec7f025d42822d373f9170ff43c9c4a23dbd84a6
refs/heads/master
2023-06-05T17:54:03.535038
2021-06-22T00:34:30
2021-06-22T00:34:30
308,755,296
0
0
null
2021-04-18T12:54:47
2020-10-30T22:16:09
Java
UTF-8
Java
false
false
3,799
java
package diplom; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; import org.apache.commons.io.FileUtils; import java.io.File; import java.io.IOException; import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; public class Tests { static Gson gson = new GsonBuilder().setPrettyPrinting().create(); public static void main(String[] args) throws Exception { Files.walk(Paths.get("C:\\Users\\hetikk\\IdeaProjects\\diplom\\src\\main\\java\\diplom")) .filter(p -> p.getFileName().toString().endsWith("java")) .forEach(f -> { System.out.println(f.getFileName()); try { System.out.println(FileUtils.readFileToString(f.toFile(), Charset.defaultCharset())); } catch (IOException e) { e.printStackTrace(); } System.out.println(); }); // final int[] wc = new int[]{5_000, 10_000, 15_000, 20_000, 25_000, 30_000}; // final int[] fc = new int[]{5, 10, 15, 20}; // final int[] fc = new int[]{5, 10, 15, 20}; List<Integer> collect = Stream.iterate(1, n -> n + 1).limit(20).collect(Collectors.toList()); // List<String> list = readDictionary(); // // // При фикс числе доков меняю число слов // for (int wci : wc) { // String dir = "C:\\Users\\hetikk\\IdeaProjects\\diplom\\sets\\clustering\\6\\6.1\\" + wci + "\\"; // for (int i = 0; i < 15; i++) { // Collections.shuffle(list); // String s = list.stream().limit(wci).collect(Collectors.joining(" ")); // FileUtils.write(new File(dir + (i + 1) + ".txt"), s, Charset.defaultCharset()); // } // } // // // При фикс числе слов меняю колво доков for (int fci : collect) { String dir = "C:\\Users\\hetikk\\IdeaProjects\\diplom\\sets\\clustering\\6\\6.4\\" + fci + "\\"; for (int i = 0; i < fci; i++) { Collections.shuffle(list); String s = list.stream().limit(15_000).collect(Collectors.joining(" ")); FileUtils.write(new File(dir + fci + "." + (i + 1) + ".txt"), s, Charset.defaultCharset()); } } } static void createDictionary() throws IOException { File f = new File("C:\\Users\\hetikk\\IdeaProjects\\diplom\\sets\\clustering\\5\\Новая папка — копия"); File[] files = f.listFiles(); List<String> words = new ArrayList<>(); // Set<String> words = new HashSet<>(); for (File file : files) { String[] s = FileUtils.readFileToString(file, Charset.defaultCharset()) .toLowerCase() .replaceAll("[^a-zа-я\\s]", "") .replaceAll("[\\s]+", " ") .split("\\s"); words.addAll(Arrays.asList(s)); } String json = gson.toJson(words); FileUtils.write(new File("C:\\Users\\hetikk\\IdeaProjects\\diplom\\sets\\dictionary.txt"), json, Charset.defaultCharset()); } static List<String> readDictionary() throws IOException { File f = new File("C:\\Users\\hetikk\\IdeaProjects\\diplom\\sets\\dictionary.txt"); String json = FileUtils.readFileToString(f, Charset.defaultCharset()); return gson.fromJson(json, new TypeToken<List<String>>() { }.getType()); } }
[ "noreply@github.com" ]
noreply@github.com
e14c788ca5a9ecd3b8bb3b03079b1ed94928d298
1971c0b1ede53de60e548520f5da0b0293b0139e
/Client Side/SocHub/app/src/main/java/com/example/mohamed/sochub/CatFrag.java
c65ad84284ad961d060c42472432a02a848826b7
[]
no_license
Maxi12001/lb3dha
75a15bc8a1494110d694a10a038de1ef18e5b1e8
612e60a04d2e907165ac6441047c8dceede42d1e
refs/heads/master
2020-03-19T17:37:48.576758
2018-06-10T01:18:24
2018-06-10T01:18:24
136,769,282
0
0
null
null
null
null
UTF-8
Java
false
false
3,930
java
package com.example.mohamed.sochub; import android.graphics.Color; import android.graphics.PorterDuff; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ListView; import android.widget.ProgressBar; import android.widget.TextView; import com.example.mohamed.sochub.Comman.HttpClient; import com.example.mohamed.sochub.Entitis.CallBackjson; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; /** * A simple {@link Fragment} subclass. */ public class CatFrag extends Fragment { private ListView CategoryList; public JSONArray Category; public MainPage xPage; ProgressBar load; public CatFrag() { // Required empty public constructor } /* @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); }*/ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view= inflater.inflate(R.layout.fragment_cat, container, false); CategoryList=(ListView)view.findViewById(R.id.Category); xPage=(MainPage)getActivity(); load=(ProgressBar)view.findViewById(R.id.progressBar2); load.getIndeterminateDrawable().setColorFilter(Color.BLACK, PorterDuff.Mode.MULTIPLY); HttpClient.Get(new CallBackjson() { @Override public void onResponse(JSONArray j) { Category=j; CatAdaptor myAdaptor=new CatAdaptor(); CategoryList.setAdapter(myAdaptor); load.setVisibility(View.GONE); CategoryList.setVisibility(View.VISIBLE); } },"CategoryFeed/GetCategory"); return view; } public class CatAdaptor extends BaseAdapter{ @Override public int getCount() { return Category.length(); } @Override public Object getItem(int position) { return null; } @Override public long getItemId(int position) { return 0; } @Override public View getView(int position, View convertView, ViewGroup parent) { try { JSONObject n=Category.getJSONObject(position); convertView=getLayoutInflater().inflate(R.layout.cat_card,null); final TextView catName=(TextView)convertView.findViewById(R.id.CatName); final TextView catId=(TextView)convertView.findViewById(R.id.CatId); final TextView catdsc=(TextView)convertView.findViewById(R.id.dsc); TextView noOfApeals=(TextView)convertView.findViewById(R.id.nofApeal); TextView more=(TextView)convertView.findViewById(R.id.More); final String catid,catname,no; catid=n.getString("CID"); catname=n.getString("CatName"); no=n.getString("Count"); catName.setText(catname); catId.setText(catid); more.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ((MainPage)getActivity()).setC_ID_name(catId.getText().toString(),catName.getText().toString()); ((MainPage)getActivity()).setFragment(1); } }); catId.setText(catid); catdsc.setText(n.getString("dscript")); noOfApeals.setText("No of Apeal: "+no); return convertView; } catch (JSONException e) { e.printStackTrace(); } return null; } } }
[ "mohmadshrf42@gmail.com" ]
mohmadshrf42@gmail.com
f1713760aadfa37ffa944706846021951b83a418
92608a20f0cca2460cd0cbcf406a6399fdcd0573
/go2nurse/common/src/main/java/com/cooltoo/go2nurse/chart/converter/Converter.java
7d91843186ca8b0fed1ca75abcf8363802beb6a1
[]
no_license
zhaoyi0113/cooltool_backend
7ba5ec04ecded4ee098aded8fbf4f942e857fd56
ed910a1f145eee569176da7f5c0336fd0ca0e0fc
refs/heads/master
2020-03-10T16:32:29.529746
2017-04-10T03:52:01
2017-04-10T03:52:01
129,476,320
0
0
null
null
null
null
UTF-8
Java
false
false
1,070
java
package com.cooltoo.go2nurse.chart.converter; import java.util.List; /** * Created by zhaolisong on 19/01/2017. */ public interface Converter<S, T> { /** * Convert the source object of type {@code S} to target type {@code T}. * @param source the source object to convert, which must be an instance of {@code S} (never {@code null}) * @return the converted object, which must be an instance of {@code T} (potentially {@code null}) * @throws IllegalArgumentException if the source cannot be converted to the desired target type */ T convert(S source); /** * Convert the source object list of type {@code S} to target type {@code T} list. * @param sources the source object list to convert, the element must be an instance of {@code S} (never {@code null}) * @return the converted object list, the element must be an instance of {@code T} (potentially {@code null}) * @throws IllegalArgumentException if the source cannot be converted to the desired target type */ List<T> convert(List<S> sources); }
[ "lisongzhao0@msn.cn" ]
lisongzhao0@msn.cn
c226da98b11370db671033a959c3f714602145a7
a6b8e66e944d57e8dfad5f8094547cccfc1631d3
/Solutions and Ideas/1001. Grid Illumination/1001. Grid Illumination.java
bb75d42a9849a3bc1c016943d14f96c941989de2
[]
no_license
DreamerYu/LeetCode-Summary
aa2540fa1491d604e4668985b47622ffb7e1470b
7c40c35dee34cba5f21cb968100aa04bb6fe7826
refs/heads/master
2020-05-04T01:12:53.021746
2019-05-24T04:39:30
2019-05-24T04:39:30
178,900,150
0
0
null
null
null
null
UTF-8
Java
false
false
2,074
java
class Solution { int[][] dirs = {{0,1}, {0,-1}, {1,0}, {-1,0}, {1,1}, {1,-1}, {-1,1}, {-1,-1}, {0,0}}; public int[] gridIllumination(int N, int[][] lamps, int[][] queries) { Map<Integer, Integer> m1 = new HashMap(); // row number to count of lamps Map<Integer, Integer> m2 = new HashMap(); // col number to count of lamps Map<Integer, Integer> m3 = new HashMap(); // diagonal x-y to count of lamps Map<Integer, Integer> m4 = new HashMap(); // diagonal x+y to count of lamps Map<Integer, Boolean> m5 = new HashMap(); // whether lamp is ON|OFF // increment counters while adding lamps for(int i=0; i<lamps.length; i++){ int x = lamps[i][0]; int y = lamps[i][1]; m1.put(x, m1.getOrDefault(x, 0) + 1); m2.put(y, m2.getOrDefault(y, 0) + 1); m3.put(x-y, m3.getOrDefault(x-y, 0) + 1); m4.put(x+y, m4.getOrDefault(x+y, 0) + 1); m5.put(N*x + y, true); } int[] ans = new int[queries.length]; // address queries for(int i=0; i<queries.length; i++){ int x = queries[i][0]; int y = queries[i][1]; ans[i] = (m1.getOrDefault(x, 0) > 0 || m2.getOrDefault(y, 0) > 0 || m3.getOrDefault(x-y, 0) > 0 || m4.getOrDefault(x+y, 0) > 0) ? 1 : 0; // switch off the lamps, if any for(int d=0; d<dirs.length; d++){ int x1 = x + dirs[d][0]; int y1 = y + dirs[d][1]; if(m5.containsKey(N*x1 + y1) && m5.get(N*x1 + y1)){ // the lamp is on, turn it off, so decrement the count of the lamps m1.put(x1, m1.getOrDefault(x1, 0) - 1); m2.put(y1, m2.getOrDefault(y1, 0) - 1); m3.put(x1 - y1, m3.getOrDefault(x1 - y1, 0) - 1); m4.put(x1 + y1, m4.getOrDefault(x1 + y1, 0) - 1); m5.put(N*x1+y1, false); } } } return ans; } }
[ "hongyu0831@gmail.com" ]
hongyu0831@gmail.com
393fbd0e7bbe0bbd267d228f1b659733065514ce
c0abbbbdf774a2093e38f4bc586eea68e7b404b5
/src/main/java/io/dataspaceconnector/controller/resource/type/AgreementController.java
0219944780b1ddb9bcc86d2bbb75dac947005425
[ "Apache-2.0" ]
permissive
trueg/DataspaceConnector
c22ce0e42179e3d1d50436d23e74d64fb5ca62c4
f9c6ac814eec601b9c526acf7ebadf269dc3d895
refs/heads/main
2023-07-16T16:03:35.213321
2021-08-31T14:42:57
2021-08-31T14:42:57
401,977,575
0
0
Apache-2.0
2021-09-01T07:53:00
2021-09-01T07:52:59
null
UTF-8
Java
false
false
3,282
java
/* * Copyright 2020 Fraunhofer Institute for Software and Systems Engineering * * 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 io.dataspaceconnector.controller.resource.type; import io.dataspaceconnector.config.BasePath; import io.dataspaceconnector.controller.resource.base.BaseResourceController; import io.dataspaceconnector.controller.resource.base.exception.MethodNotAllowed; import io.dataspaceconnector.controller.resource.base.tag.ResourceDescription; import io.dataspaceconnector.controller.resource.base.tag.ResourceName; import io.dataspaceconnector.controller.resource.view.agreement.AgreementView; import io.dataspaceconnector.controller.util.ResponseCode; import io.dataspaceconnector.controller.util.ResponseDescription; import io.dataspaceconnector.model.agreement.Agreement; import io.dataspaceconnector.model.agreement.AgreementDesc; import io.dataspaceconnector.service.resource.type.AgreementService; import io.swagger.v3.oas.annotations.Hidden; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.validation.Valid; import java.util.UUID; /** * Offers the endpoints for managing agreements. */ @RestController @RequestMapping(BasePath.AGREEMENTS) @Tag(name = ResourceName.AGREEMENTS, description = ResourceDescription.AGREEMENTS) public class AgreementController extends BaseResourceController<Agreement, AgreementDesc, AgreementView, AgreementService> { @Override @Hidden @ApiResponses(value = { @ApiResponse(responseCode = ResponseCode.METHOD_NOT_ALLOWED, description = ResponseDescription.METHOD_NOT_ALLOWED)}) public final ResponseEntity<AgreementView> create(final AgreementDesc desc) { throw new MethodNotAllowed(); } @Override @Hidden @ApiResponses(value = { @ApiResponse(responseCode = ResponseCode.METHOD_NOT_ALLOWED, description = ResponseDescription.METHOD_NOT_ALLOWED)}) public final ResponseEntity<AgreementView> update(@Valid final UUID resourceId, final AgreementDesc desc) { throw new MethodNotAllowed(); } @Override @Hidden @ApiResponses(value = { @ApiResponse(responseCode = ResponseCode.METHOD_NOT_ALLOWED, description = ResponseDescription.METHOD_NOT_ALLOWED)}) public final ResponseEntity<Void> delete(@Valid final UUID resourceId) { throw new MethodNotAllowed(); } }
[ "noreply@github.com" ]
noreply@github.com
cf26039c6c048cabe01c9a822466b6380d1c69c3
19f7e40c448029530d191a262e5215571382bf9f
/decompiled/instagram/sources/p000X/AGX.java
f27ef510c3ea05a01034f240210f1a48a56f3bca
[]
no_license
stanvanrooy/decompiled-instagram
c1fb553c52e98fd82784a3a8a17abab43b0f52eb
3091a40af7accf6c0a80b9dda608471d503c4d78
refs/heads/master
2022-12-07T22:31:43.155086
2020-08-26T03:42:04
2020-08-26T03:42:04
283,347,288
18
1
null
null
null
null
UTF-8
Java
false
false
615
java
package p000X; import android.content.Context; import androidx.recyclerview.widget.RecyclerView; /* renamed from: X.AGX */ public final class AGX implements C23232ADv { public final void A6S(Context context, Object obj, Object obj2, Object obj3) { ((RecyclerView) obj).setOverScrollMode(((AGQ) obj2).A02); } public final boolean Bng(Object obj, Object obj2, Object obj3, Object obj4) { if (((AGQ) obj).A02 != ((AGQ) obj2).A02) { return true; } return false; } public final void Bs0(Context context, Object obj, Object obj2, Object obj3) { } }
[ "stan@rooy.works" ]
stan@rooy.works
b4f51fd59b906dccd9563f9fa709ffcb12df8b44
e1abc54ec5024f9393a4d80dc71c248c64aed3d5
/SuperDeDuper/src/org/superdeduper/models/ID3v2Frame.java
96c5fc4a4cd65e9405e1f3ffe6c149a586b0fd49
[]
no_license
martinatime/SuperDeDuper_archived
e7580ee21263f13e238838e4692bdcc8f9922b51
82cadb93b6c544c093df158c1452805be2a6f022
refs/heads/master
2021-05-28T20:55:57.542198
2015-06-18T18:00:27
2015-06-18T18:00:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,089
java
package org.superdeduper.models; import java.nio.ByteBuffer; public class ID3v2Frame { private byte majorVersion; private byte revision; private byte flags; private int size; public ID3v2Frame(byte[] data) { if (data == null || data.length != 10) { throw new IllegalArgumentException("Invalid ID3 header"); } //System.out.println(new String(data)); // skip first 3 bytes as they are ID3 int runningIndex = 3; majorVersion = data[runningIndex++]; revision = data[runningIndex++]; flags = data[runningIndex++]; ByteBuffer byteBuffer = ByteBuffer.wrap(data, runningIndex,4); size = byteBuffer.getInt(); // if any of the lower 4 bits of the flags are set then the flags need to be zeroed int flagValidate = flags & 0x0F; if (flagValidate > 0) { flags = 0; } } public byte getMajorVersion() { return majorVersion; } public byte getRevision() { return revision; } public byte getFlags() { return flags; } public int getSize() { return size; } public boolean isUnsynchronisation() { int result = flags & 0x80; return result == 0x80; } public boolean isExtendedHeader() { int result = flags & 0x40; return result == 0x40; } public boolean isExperimentalIndicator() { int result = flags & 0x20; return result == 0x20; } public boolean isFooterPresent() { int result = flags & 0x10; return result == 0x10; } public String toString() { StringBuilder builder = new StringBuilder(); builder.append("majorVersion=").append(majorVersion).append("\n"); builder.append("revision=").append(revision).append("\n"); builder.append("flags=").append(flags).append("\n"); builder.append("isUnsynchronisation=").append(isUnsynchronisation()).append("\n"); builder.append("isExtendedHeader=").append(isExtendedHeader()).append("\n"); builder.append("isExperimentalIndicator=").append(isExperimentalIndicator()).append("\n"); builder.append("isFooterPresent=").append(isFooterPresent()).append("\n"); builder.append("size=").append(size).append("\n"); return builder.toString(); } }
[ "amartina@us.ibm.com" ]
amartina@us.ibm.com
b801be7fe7b92d9e70014faba29968878e39315d
5142177ff7b21a41475bd2fa1f3be515ae5393a5
/src/expression/exceptions/ExpressionParser.java
141e0dc00fa591e05e6816aa66645ca828df02c8
[]
no_license
AlexKrudu/kt_hw
1ad8348e5979559fafeff1b6a7745bc257669c42
b78395e783f78b8a1a3b47c8d140ad752ee9464f
refs/heads/master
2021-01-01T21:50:22.972622
2020-05-18T13:01:55
2020-05-18T13:01:55
239,356,124
0
0
null
null
null
null
UTF-8
Java
false
false
5,592
java
package expression.exceptions; import expression.*; import expression.operations.Operation; import expression.parser.token.Token; import expression.parser.token.TokenType; import expression.parser.token.Tokener; import java.util.EnumSet; import java.util.Set; public class ExpressionParser<T> implements Parser { private Tokener<T> tokens; private static Set<TokenType> operations = EnumSet.of(TokenType.DIVIDE, TokenType.SUBTRACT, TokenType.MULTIPLY, TokenType.ADD, TokenType.POW2, TokenType.LOG2); private static Set<TokenType> operands = EnumSet.of(TokenType.VARIABLE, TokenType.CONST); private Operation<T> op; public ExpressionParser(Operation<T> op) { this.op = op; } public ExpressionParser() { this.op = null; } @Override public TripleExpressionGeneric<T> parse(String expression) throws ParsingException { tokens = new Tokener<T>(expression); return Expression(); } private TripleExpressionGeneric<T> Expression() throws ParsingException { TripleExpressionGeneric<T> ter = Term(); Token cur = tokens.getCur(); loop: while (tokens.hasNext()) { switch (cur.getType()) { case ADD: ter = new Add<T>(ter, Term(), op); break; case SUBTRACT: ter = new Subtract<T>(ter, Term(), op); break; case RBRACKET: break loop; default: throw new ParsingException("Invalid expression!" + "\n" + tokens.getExpression()); } cur = tokens.getCur(); } return ter; } private TripleExpressionGeneric<T> Term() throws ParsingException { TripleExpressionGeneric<T> prim = Factor(); Token cur = tokens.getCur(); loop: while (tokens.hasNext()) { switch (cur.getType()) { case MULTIPLY: prim = new Multiply<T>(prim, Factor(), op); break; case DIVIDE: prim = new Divide<T>(prim, Factor(), op); break; case RBRACKET: case ADD: case SUBTRACT: break loop; default: if (operands.contains(cur.getType())) { throw new UnexpectedOperandException(tokens.getExpression(), cur.getPos()); } throw new ParsingException("Invalid expression!" + "\n" + tokens.getExpression()); } cur = tokens.getCur(); } return prim; } private TripleExpressionGeneric<T> Factor() throws ParsingException { TripleExpressionGeneric<T> vc; Token token = tokens.getNext(); switch (token.getType()) { case VARIABLE: vc = new Variable<T>(token.value()); tokens.getNext(); break; case CONST: try { Integer.parseInt(token.value()); } catch (Exception e) { throw new BadConstantException(tokens.getExpression(), token.getPos()); } vc = new Const<T>(op.parseNumber(token.value())); tokens.getNext(); break; case LBRACKET: vc = Expression(); if (tokens.getCur().getType() != TokenType.RBRACKET) { throw new MissingClosingParenthesisException(tokens.getExpression(), tokens.getCur().getPos()); } tokens.getNext(); break; case SUBTRACT: if (tokens.getNext().getType() == TokenType.CONST) { try { Integer.parseInt('-' + tokens.getCur().value()); } catch (Exception e) { throw new BadConstantException(tokens.getExpression(), token.getPos()); } vc = new Const<T>(op.parseNumber('-' + tokens.getCur().value())); tokens.getNext(); return vc; } tokens.getLast(); if (tokens.getNext().getType() == TokenType.END) { throw new UnexpectedOperationException(tokens.getExpression(), tokens.getLast().getPos()); } tokens.getLast(); vc = new Negate<T>(Factor(), op); break; case END: case RBRACKET: try { if (operations.contains(tokens.getLast().getType())) { throw new ExpectedOperandException(tokens.getExpression(), tokens.getNext().getPos()); } else if (tokens.getCur().getType() == TokenType.LBRACKET) { throw new EmptyInputException("Got empty expression in brackets! " + tokens.getExpression()); } } catch (IndexOutOfBoundsException e) { throw new EmptyInputException("Got empty input!" + tokens.getExpression()); } default: if (operations.contains(token.getType())) { throw new UnexpectedOperationException(tokens.getExpression(), token.getPos()); } throw new ParsingException("Invalid expression!" + "\n" + tokens.getExpression()); } return vc; } }
[ "KrudAlex@yandex.ru" ]
KrudAlex@yandex.ru
082c50feddd3d535dc8cfdef375edec932aa3142
6e7eb9cef9bc02642ad43dce0400ba89bad7876b
/src/main/java/com/homework/domain/recado/Recado.java
ddaa7fa79dd1d3a9a3e5a9646b22c95de00baec8
[ "MIT" ]
permissive
fabriciio95/homework
53079ba64090822ba88c63b5700cd9a6aa4f021f
079f2f691157c846b9178b379ed5f159646b0680
refs/heads/master
2023-04-18T00:34:00.160795
2021-05-08T03:47:41
2021-05-08T03:47:41
310,632,815
0
0
null
null
null
null
UTF-8
Java
false
false
1,211
java
package com.homework.domain.recado; import java.io.Serializable; import java.time.LocalDateTime; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Inheritance; import javax.persistence.InheritanceType; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import com.homework.domain.curso.Curso; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; @Entity @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) @Getter @Setter @EqualsAndHashCode(onlyExplicitlyIncluded = true) public abstract class Recado implements Serializable { private static final long serialVersionUID = 1L; @EqualsAndHashCode.Include @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @Column(nullable = false) private LocalDateTime data; @NotBlank @Column(nullable = false, length = 1000) private String corpo; @NotNull @ManyToOne @JoinColumn(name = "curso_id", nullable = false) private Curso curso; }
[ "fabriciusiqueira@gmail.com" ]
fabriciusiqueira@gmail.com
cf4b359ffc5d328a4bd6ee4f95d8c1f6578e5b89
961d80cda587150eda2f76d1a83e4bfd3ea2ff15
/src/main/java/sanek/nikitin/Service/UserService.java
ccb3b833c87b5b13851a2c96f83eb718fb8ea4a6
[]
no_license
ManyakRus/Sanek-boot
2360d13b1ce9ddd199b120abccc4af22ad180427
a73987c8449bebc035a6f75f2754e915f65bb5a3
refs/heads/master
2020-04-15T16:01:05.792636
2019-01-30T11:54:06
2019-01-30T11:54:06
164,815,392
0
0
null
null
null
null
UTF-8
Java
false
false
1,482
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 sanek.nikitin.Service; import java.util.Arrays; import java.util.HashSet; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.stereotype.Service; import sanek.nikitin.crud.IRoleJPA; import sanek.nikitin.crud.IUserJPA; import sanek.nikitin.entity.Role; import sanek.nikitin.entity.User; /** * @author Sanek * @date 24.01.2019 14:16:45 */ @Service("userService") public class UserService { private IUserJPA userJPA; private IRoleJPA roleJPA; private BCryptPasswordEncoder bCryptPasswordEncoder; @Autowired public UserService(IUserJPA userJPA, IRoleJPA roleJPA, BCryptPasswordEncoder bCryptPasswordEncoder) { this.userJPA = userJPA; this.roleJPA = roleJPA; this.bCryptPasswordEncoder = bCryptPasswordEncoder; } public User findUserByName(String name) { return userJPA.findByName(name); } public void saveUser(User user) { user.setPassword(bCryptPasswordEncoder.encode(user.getPassword())); Role userRole = roleJPA.findByName("ADMIN"); user.setRoleSet(new HashSet<Role>(Arrays.asList(userRole))); userJPA.save(user); } }
[ "Пользователь2@DESKTOP-B2ETKI2" ]
Пользователь2@DESKTOP-B2ETKI2
844110043e4f34eb1d3c9289b0e4ec4b11c230a0
c751f9c0297775ed5aaa235a6333e150be8bfd6e
/src/main/java/ru/mirea/soap/ObjectFactory.java
06c83cfb3cb9bb531ad95162ab562f8681530284
[]
no_license
Bradibor/soap
1eb2eede8759cd00b52ff1f90327a2ac8facb422
f91bd2201b752c745bb3ff197ac94a8a029a23d1
refs/heads/master
2020-05-02T16:40:35.845083
2019-03-27T21:18:51
2019-03-27T21:18:51
178,076,246
0
0
null
null
null
null
UTF-8
Java
false
false
2,053
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2019.03.28 at 12:05:43 AM MSK // package ru.mirea.soap; import javax.xml.bind.annotation.XmlRegistry; /** * This object contains factory methods for each * Java content interface and Java element interface * generated in the ru.mirea.soap package. * <p>An ObjectFactory allows you to programatically * construct new instances of the Java representation * for XML content. The Java representation of XML * content can consist of schema derived interfaces * and classes representing the binding of schema * type definitions, element declarations and model * groups. Factory methods for each of these are * provided in this class. * */ @XmlRegistry public class ObjectFactory { /** * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: ru.mirea.soap * */ public ObjectFactory() { } /** * Create an instance of {@link GetHuiResponse } * */ public GetHuiResponse createGetHuiResponse() { return new GetHuiResponse(); } /** * Create an instance of {@link GetCountryRequest } * */ public GetCountryRequest createGetCountryRequest() { return new GetCountryRequest(); } /** * Create an instance of {@link GetHuiRequest } * */ public GetHuiRequest createGetHuiRequest() { return new GetHuiRequest(); } /** * Create an instance of {@link GetCountryResponse } * */ public GetCountryResponse createGetCountryResponse() { return new GetCountryResponse(); } /** * Create an instance of {@link Country } * */ public Country createCountry() { return new Country(); } }
[ "just1bomb@gmail.com" ]
just1bomb@gmail.com
338509c067ea7082c10dc65504ebbff483457004
89be44270846bd4f32ca3f51f29de4921c1d298a
/bitcamp-project-server/v43_3/src/main/java/com/eomcs/lms/dao/mariadb/PhotoBoardDaoImpl.java
f26ede3d0e3d667eaea7e0f465807d8f14979062
[]
no_license
nayoung00/bitcamp-study
931b439c40a8fe10bdee49c0aaf449399d8fe801
b3d3c9135114cf17c7afd3ceaee83b5c2cedff29
refs/heads/master
2020-09-28T17:39:04.332086
2020-04-30T23:57:45
2020-04-30T23:57:45
226,825,309
0
0
null
null
null
null
UTF-8
Java
false
false
1,706
java
package com.eomcs.lms.dao.mariadb; import java.util.List; import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSessionFactory; import com.eomcs.lms.dao.PhotoBoardDao; import com.eomcs.lms.domain.PhotoBoard; public class PhotoBoardDaoImpl implements PhotoBoardDao { SqlSessionFactory sqlSessionFactory; public PhotoBoardDaoImpl(SqlSessionFactory sqlSessionFactory) { this.sqlSessionFactory = sqlSessionFactory; } @Override public int insert(PhotoBoard photoBoard) throws Exception { try (SqlSession sqlSession = sqlSessionFactory.openSession()) { int count = sqlSession.insert("PhotoBoardMapper.insertPhotoBoard", photoBoard); return count; } } @Override public List<PhotoBoard> findAllByLessonNo(int lessonNo) throws Exception { try (SqlSession sqlSession = sqlSessionFactory.openSession()) { return sqlSession.selectList(// "PhotoBoardMapper.selectPhotoBoard", lessonNo); } } @Override public PhotoBoard findByNo(int no) throws Exception { try (SqlSession sqlSession = sqlSessionFactory.openSession()) { return sqlSession.selectOne("PhotoBoardMapper.selectDetail", no); } } @Override public int update(PhotoBoard photoBoard) throws Exception { try (SqlSession sqlSession = sqlSessionFactory.openSession()) { int count = sqlSession.update(// "PhotoBoardMapper.updatePhotoBoard", photoBoard); return count; } } @Override public int delete(int no) throws Exception { try (SqlSession sqlSession = sqlSessionFactory.openSession()) { int count = sqlSession.delete("PhotoBoardMapper.deletePhotoBoard", no); return count; } } }
[ "invin1201@gmail.com" ]
invin1201@gmail.com
5d1f126c3dc817abb9c5cdf1da7ed09c91b25629
b7863c8f4450d6fa9492c1921c8bed482bbc4873
/bus-health/src/main/java/org/aoju/bus/health/mac/software/package-info.java
9eea2f515b82b9b2aecb8a97e8c032d2ba0b5286
[ "MIT" ]
permissive
BruceBruceZheng/bus
479284c8143fd70fdc4b4a9f33c81e5d64b5e15e
3123ed5301c0d08a5c4e933653995b9bb63acf5e
refs/heads/master
2023-08-23T20:27:17.715754
2021-10-14T05:57:36
2021-10-14T05:57:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
166
java
/** * 提供关于macOS上的软件和操作系统的信息 * * @author Kimi Liu * @version 6.3.0 * @since JDK 1.8+ */ package org.aoju.bus.health.mac.software;
[ "839536@qq.com" ]
839536@qq.com
521dcf860f069e6b2b43fd4423852eaec42a73b9
0da961a264159caaa4c4ff502405ccb2f284ee90
/app/src/main/java/com/example/sqlite2/DatabaseHelper.java
7cb3db6406fca7265f3e86e79bd527ee046adcc0
[]
no_license
EnriqueCrZ/AcadVirtualAndroid
cd8b9af68a20cdaaeb54d3ed0a67edfc8d5d1029
8a2dd9c306e9ce2d41a3f230c855114e5eead6a7
refs/heads/master
2023-01-16T01:54:06.867031
2020-11-07T02:28:01
2020-11-07T02:28:01
310,668,396
0
0
null
null
null
null
UTF-8
Java
false
false
7,165
java
package com.example.sqlite2; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; import android.widget.Toast; import androidx.annotation.Nullable; import java.sql.Blob; import java.util.ArrayList; import java.util.Date; import java.util.List; public class DatabaseHelper extends SQLiteOpenHelper { private Context context; public static final String DATABASE_NAME = "Academia.db"; public static final int DATABASE_VERSION = 1; public static final String TABLE_STUDENT = "student"; public static final String COLUMN_ID = "_id"; public static final String COLUMN_STUDENT_NAME = "student_name"; public static final String COLUMN_STUDENT_LAST = "student_last_name"; public static final String COLUMN_STUDENT_PICTURE = "picture"; public static final String TABLE_INSCRIPCION = "inscripcion"; public static final String COLUMN_ID2 = "_id"; public static final String COLUMN_CARNE = "carne"; public static final String COLUMN_DATE = "date"; public static final String COLUMN_STUDENT = "student_id"; public DatabaseHelper(@Nullable Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); this.context = context; } @Override public void onCreate(SQLiteDatabase db) { db.execSQL("CREATE TABLE " + TABLE_STUDENT + " (" + COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + COLUMN_STUDENT_NAME + " TEXT, " + COLUMN_STUDENT_LAST + " TEXT, " + COLUMN_STUDENT_PICTURE + " BLOB)"); db.execSQL("CREATE TABLE " + TABLE_INSCRIPCION + " (" + COLUMN_ID2 + " INTEGER PRIMARY KEY AUTOINCREMENT," + COLUMN_CARNE + " TEXT, " + COLUMN_DATE + " TEXT, " + COLUMN_STUDENT + " INTEGER)"); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS " + TABLE_STUDENT); db.execSQL("DROP TABLE IF EXISTS " + TABLE_INSCRIPCION); onCreate(db); } long addBook(String title, String author, byte[] image) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues cv = new ContentValues(); cv.put(COLUMN_STUDENT_NAME, title); cv.put(COLUMN_STUDENT_LAST, author); cv.put(COLUMN_STUDENT_PICTURE, image); long result = db.insert(TABLE_STUDENT, null, cv); if (result == -1) Toast.makeText(context, "Fallo en agregar registro", Toast.LENGTH_SHORT).show(); else Toast.makeText(context, title + " agregado exitosamente", Toast.LENGTH_SHORT).show(); return result; } Cursor readAllData() { String query = "SELECT * FROM " + TABLE_STUDENT; SQLiteDatabase db = this.getReadableDatabase(); Cursor cursor = null; if (db != null) cursor = db.rawQuery(query, null); return cursor; } public String[] readAllDataArray(){ String selectQuery = "select * from " + TABLE_STUDENT; SQLiteDatabase db = this.getReadableDatabase(); Cursor cursor = db.rawQuery(selectQuery,null); ArrayList<String> spinnerContent = new ArrayList<String>(); if(cursor.moveToFirst()){ do{ spinnerContent.add(cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHelper.COLUMN_ID)) + " - " + cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHelper.COLUMN_STUDENT_NAME)) + " " + cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHelper.COLUMN_STUDENT_LAST))); }while(cursor.moveToNext()); } cursor.close(); db.close(); String[] allSpinner = new String[spinnerContent.size()]; return spinnerContent.toArray(allSpinner); } long updateData(String row_id, String title, String author, byte[] pages) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues cv = new ContentValues(); cv.put(COLUMN_STUDENT_NAME, title); cv.put(COLUMN_STUDENT_LAST, author); cv.put(COLUMN_STUDENT_PICTURE, pages); long result = db.update(TABLE_STUDENT, cv, " _id=?", new String[]{row_id}); if (result == -1) Toast.makeText(context, "Fallo en actualizar registro", Toast.LENGTH_SHORT).show(); else Toast.makeText(context, String.valueOf(title) + " actualizado.", Toast.LENGTH_SHORT).show(); return result; } long deleteData(String row_id, String title) { SQLiteDatabase db = this.getWritableDatabase(); long result = db.delete(TABLE_STUDENT, " _id=?", new String[]{row_id}); if (result == -1) Toast.makeText(context, "Fallo en eliminar registro", Toast.LENGTH_SHORT).show(); else Toast.makeText(context, String.valueOf(title) + " eliminado.", Toast.LENGTH_SHORT).show(); return result; } void deleteAll() { SQLiteDatabase db = this.getWritableDatabase(); db.execSQL("DELETE FROM " + TABLE_STUDENT); } //Inscripcion public long addIns(String carne, String date, String id_alumno) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues cv = new ContentValues(); cv.put(COLUMN_CARNE, carne); cv.put(COLUMN_DATE, String.valueOf(date)); cv.put(COLUMN_STUDENT, id_alumno); long result = db.insert(TABLE_INSCRIPCION, null, cv); if (result == -1) Toast.makeText(context, "Fallo en agregar registro", Toast.LENGTH_SHORT).show(); else Toast.makeText(context, "Inscrito exitosamente", Toast.LENGTH_SHORT).show(); return result; } public Cursor readAllDataIns() { String query = "SELECT * FROM " + TABLE_INSCRIPCION; SQLiteDatabase db = this.getReadableDatabase(); Cursor cursor = null; if (db != null) cursor = db.rawQuery(query, null); return cursor; } public String studentName(String id){ String query = "SELECT " + COLUMN_STUDENT_NAME + " FROM " + TABLE_STUDENT + " WHERE " + COLUMN_ID + " = " + id; String student_name = ""; Log.d(student_name,"false"); SQLiteDatabase db = this.getReadableDatabase(); Cursor c = db.rawQuery(query,null); if(c.getCount() == 1){ c.moveToFirst(); student_name = c.getString(0); } c.close(); return student_name; } byte[] studentPicture(String id){ String query = "SELECT " + DatabaseHelper.COLUMN_STUDENT_PICTURE + " FROM " + DatabaseHelper.TABLE_STUDENT + " WHERE " + DatabaseHelper.COLUMN_ID + " = " + id; byte[] student_pic = new byte[0]; SQLiteDatabase db = this.getReadableDatabase(); Cursor c = db.rawQuery(query,null); if(c.getCount() == 1){ c.moveToFirst(); student_pic = c.getBlob(0); } c.close(); return student_pic; } }
[ "enriquecrz21@gmail.com" ]
enriquecrz21@gmail.com
3d535a6b9eb34f61f60337dc980acf4a111c678f
fdc263e845a391b1b008fec31ca42039bdfccb68
/google-api-grpc/proto-google-cloud-vision-v1p2beta1/src/main/java/com/google/cloud/vision/v1p2beta1/ImageAnnotationContext.java
c946f25c34fd708819dfb164f8c7099a2013c3b4
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
antoniolatela/google-cloud-java
d41fbc89262104cffab37b821669c2380f8ad4ef
0e58b7dead6b5f0a18913fb802ea7b34dbaf2449
refs/heads/master
2020-03-28T12:22:10.178603
2018-09-08T07:57:34
2018-09-08T07:57:34
null
0
0
null
null
null
null
UTF-8
Java
false
true
21,087
java
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/cloud/vision/v1p2beta1/image_annotator.proto package com.google.cloud.vision.v1p2beta1; /** * <pre> * If an image was produced from a file (e.g. a PDF), this message gives * information about the source of that image. * </pre> * * Protobuf type {@code google.cloud.vision.v1p2beta1.ImageAnnotationContext} */ public final class ImageAnnotationContext extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:google.cloud.vision.v1p2beta1.ImageAnnotationContext) ImageAnnotationContextOrBuilder { private static final long serialVersionUID = 0L; // Use ImageAnnotationContext.newBuilder() to construct. private ImageAnnotationContext(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private ImageAnnotationContext() { uri_ = ""; pageNumber_ = 0; } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private ImageAnnotationContext( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownFieldProto3( input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { java.lang.String s = input.readStringRequireUtf8(); uri_ = s; break; } case 16: { pageNumber_ = input.readInt32(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.vision.v1p2beta1.ImageAnnotatorProto.internal_static_google_cloud_vision_v1p2beta1_ImageAnnotationContext_descriptor; } protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.vision.v1p2beta1.ImageAnnotatorProto.internal_static_google_cloud_vision_v1p2beta1_ImageAnnotationContext_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.cloud.vision.v1p2beta1.ImageAnnotationContext.class, com.google.cloud.vision.v1p2beta1.ImageAnnotationContext.Builder.class); } public static final int URI_FIELD_NUMBER = 1; private volatile java.lang.Object uri_; /** * <pre> * The URI of the file used to produce the image. * </pre> * * <code>string uri = 1;</code> */ public java.lang.String getUri() { java.lang.Object ref = uri_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); uri_ = s; return s; } } /** * <pre> * The URI of the file used to produce the image. * </pre> * * <code>string uri = 1;</code> */ public com.google.protobuf.ByteString getUriBytes() { java.lang.Object ref = uri_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); uri_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int PAGE_NUMBER_FIELD_NUMBER = 2; private int pageNumber_; /** * <pre> * If the file was a PDF or TIFF, this field gives the page number within * the file used to produce the image. * </pre> * * <code>int32 page_number = 2;</code> */ public int getPageNumber() { return pageNumber_; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!getUriBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, uri_); } if (pageNumber_ != 0) { output.writeInt32(2, pageNumber_); } unknownFields.writeTo(output); } public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (!getUriBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, uri_); } if (pageNumber_ != 0) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(2, pageNumber_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.vision.v1p2beta1.ImageAnnotationContext)) { return super.equals(obj); } com.google.cloud.vision.v1p2beta1.ImageAnnotationContext other = (com.google.cloud.vision.v1p2beta1.ImageAnnotationContext) obj; boolean result = true; result = result && getUri() .equals(other.getUri()); result = result && (getPageNumber() == other.getPageNumber()); result = result && unknownFields.equals(other.unknownFields); return result; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + URI_FIELD_NUMBER; hash = (53 * hash) + getUri().hashCode(); hash = (37 * hash) + PAGE_NUMBER_FIELD_NUMBER; hash = (53 * hash) + getPageNumber(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static com.google.cloud.vision.v1p2beta1.ImageAnnotationContext parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.vision.v1p2beta1.ImageAnnotationContext parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.vision.v1p2beta1.ImageAnnotationContext parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.vision.v1p2beta1.ImageAnnotationContext parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.vision.v1p2beta1.ImageAnnotationContext parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.vision.v1p2beta1.ImageAnnotationContext parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.vision.v1p2beta1.ImageAnnotationContext parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static com.google.cloud.vision.v1p2beta1.ImageAnnotationContext parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public static com.google.cloud.vision.v1p2beta1.ImageAnnotationContext parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } public static com.google.cloud.vision.v1p2beta1.ImageAnnotationContext parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } public static com.google.cloud.vision.v1p2beta1.ImageAnnotationContext parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static com.google.cloud.vision.v1p2beta1.ImageAnnotationContext parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(com.google.cloud.vision.v1p2beta1.ImageAnnotationContext prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * <pre> * If an image was produced from a file (e.g. a PDF), this message gives * information about the source of that image. * </pre> * * Protobuf type {@code google.cloud.vision.v1p2beta1.ImageAnnotationContext} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:google.cloud.vision.v1p2beta1.ImageAnnotationContext) com.google.cloud.vision.v1p2beta1.ImageAnnotationContextOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.vision.v1p2beta1.ImageAnnotatorProto.internal_static_google_cloud_vision_v1p2beta1_ImageAnnotationContext_descriptor; } protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.vision.v1p2beta1.ImageAnnotatorProto.internal_static_google_cloud_vision_v1p2beta1_ImageAnnotationContext_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.cloud.vision.v1p2beta1.ImageAnnotationContext.class, com.google.cloud.vision.v1p2beta1.ImageAnnotationContext.Builder.class); } // Construct using com.google.cloud.vision.v1p2beta1.ImageAnnotationContext.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3 .alwaysUseFieldBuilders) { } } public Builder clear() { super.clear(); uri_ = ""; pageNumber_ = 0; return this; } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.google.cloud.vision.v1p2beta1.ImageAnnotatorProto.internal_static_google_cloud_vision_v1p2beta1_ImageAnnotationContext_descriptor; } public com.google.cloud.vision.v1p2beta1.ImageAnnotationContext getDefaultInstanceForType() { return com.google.cloud.vision.v1p2beta1.ImageAnnotationContext.getDefaultInstance(); } public com.google.cloud.vision.v1p2beta1.ImageAnnotationContext build() { com.google.cloud.vision.v1p2beta1.ImageAnnotationContext result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public com.google.cloud.vision.v1p2beta1.ImageAnnotationContext buildPartial() { com.google.cloud.vision.v1p2beta1.ImageAnnotationContext result = new com.google.cloud.vision.v1p2beta1.ImageAnnotationContext(this); result.uri_ = uri_; result.pageNumber_ = pageNumber_; onBuilt(); return result; } public Builder clone() { return (Builder) super.clone(); } public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return (Builder) super.setField(field, value); } public Builder clearField( com.google.protobuf.Descriptors.FieldDescriptor field) { return (Builder) super.clearField(field); } public Builder clearOneof( com.google.protobuf.Descriptors.OneofDescriptor oneof) { return (Builder) super.clearOneof(oneof); } public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return (Builder) super.setRepeatedField(field, index, value); } public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return (Builder) super.addRepeatedField(field, value); } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.google.cloud.vision.v1p2beta1.ImageAnnotationContext) { return mergeFrom((com.google.cloud.vision.v1p2beta1.ImageAnnotationContext)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.google.cloud.vision.v1p2beta1.ImageAnnotationContext other) { if (other == com.google.cloud.vision.v1p2beta1.ImageAnnotationContext.getDefaultInstance()) return this; if (!other.getUri().isEmpty()) { uri_ = other.uri_; onChanged(); } if (other.getPageNumber() != 0) { setPageNumber(other.getPageNumber()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } public final boolean isInitialized() { return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.cloud.vision.v1p2beta1.ImageAnnotationContext parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (com.google.cloud.vision.v1p2beta1.ImageAnnotationContext) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private java.lang.Object uri_ = ""; /** * <pre> * The URI of the file used to produce the image. * </pre> * * <code>string uri = 1;</code> */ public java.lang.String getUri() { java.lang.Object ref = uri_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); uri_ = s; return s; } else { return (java.lang.String) ref; } } /** * <pre> * The URI of the file used to produce the image. * </pre> * * <code>string uri = 1;</code> */ public com.google.protobuf.ByteString getUriBytes() { java.lang.Object ref = uri_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); uri_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * The URI of the file used to produce the image. * </pre> * * <code>string uri = 1;</code> */ public Builder setUri( java.lang.String value) { if (value == null) { throw new NullPointerException(); } uri_ = value; onChanged(); return this; } /** * <pre> * The URI of the file used to produce the image. * </pre> * * <code>string uri = 1;</code> */ public Builder clearUri() { uri_ = getDefaultInstance().getUri(); onChanged(); return this; } /** * <pre> * The URI of the file used to produce the image. * </pre> * * <code>string uri = 1;</code> */ public Builder setUriBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); uri_ = value; onChanged(); return this; } private int pageNumber_ ; /** * <pre> * If the file was a PDF or TIFF, this field gives the page number within * the file used to produce the image. * </pre> * * <code>int32 page_number = 2;</code> */ public int getPageNumber() { return pageNumber_; } /** * <pre> * If the file was a PDF or TIFF, this field gives the page number within * the file used to produce the image. * </pre> * * <code>int32 page_number = 2;</code> */ public Builder setPageNumber(int value) { pageNumber_ = value; onChanged(); return this; } /** * <pre> * If the file was a PDF or TIFF, this field gives the page number within * the file used to produce the image. * </pre> * * <code>int32 page_number = 2;</code> */ public Builder clearPageNumber() { pageNumber_ = 0; onChanged(); return this; } public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFieldsProto3(unknownFields); } public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:google.cloud.vision.v1p2beta1.ImageAnnotationContext) } // @@protoc_insertion_point(class_scope:google.cloud.vision.v1p2beta1.ImageAnnotationContext) private static final com.google.cloud.vision.v1p2beta1.ImageAnnotationContext DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new com.google.cloud.vision.v1p2beta1.ImageAnnotationContext(); } public static com.google.cloud.vision.v1p2beta1.ImageAnnotationContext getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<ImageAnnotationContext> PARSER = new com.google.protobuf.AbstractParser<ImageAnnotationContext>() { public ImageAnnotationContext parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new ImageAnnotationContext(input, extensionRegistry); } }; public static com.google.protobuf.Parser<ImageAnnotationContext> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<ImageAnnotationContext> getParserForType() { return PARSER; } public com.google.cloud.vision.v1p2beta1.ImageAnnotationContext getDefaultInstanceForType() { return DEFAULT_INSTANCE; } }
[ "noreply@github.com" ]
noreply@github.com
9c5f19f5c9cede6a8f6c738fa68662d8a92294a5
cc68bb64910dfdb4b6cfc91010b556750853c3eb
/src/main/java/com/msita/demo/repositories/UVRepository.java
20e18a7e060bde275f013092b8f221a22c5e8644
[]
no_license
hoangvanlinh908/websearchnew
411ac6bca328ae416dcb5f7e2c6f1a2fd5470569
e9c930bd880a9006adbafeca0d6d93176faa0434
refs/heads/master
2023-06-29T05:13:31.554637
2021-08-02T10:34:29
2021-08-02T10:34:29
389,143,486
0
0
null
null
null
null
UTF-8
Java
false
false
693
java
package com.msita.demo.repositories; import com.msita.demo.form.NhaTuyenDung; import com.msita.demo.form.UngVien; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; @Repository public interface UVRepository extends JpaRepository<UngVien,String> { @Query("SELECT u.MaUngVien FROM UngVien u WHERE u.Email = :email and u.MatKhau = :password") String quyery1(String email, String password ); @Query("SELECT u.MaUngVien FROM UngVien u WHERE u.Email = :email ") String quyery2(@Param("email")String email ); }
[ "hvlinh@enjoyworks.co.kr" ]
hvlinh@enjoyworks.co.kr
de8a6a5ae281d8305d03806fa919614abce44a3c
00791d2e2c9765b2bdba8d87ad1292e480ca160e
/app/src/main/java/com/brainfluence/pickmeuprebuild/ui/Logout/LogoutViewModel.java
24654f61585bab4fe048289aaded5e830ba59a50
[]
no_license
ImranChowdhuryFahim/Call-Ambulance
485c51f8ef9b770f468683ee02eacec5c01cff00
17c4e03e74dc0df407086227ec4cbc4d43d34735
refs/heads/master
2023-06-08T21:46:53.363305
2023-05-27T17:17:52
2023-05-27T17:17:52
364,435,405
0
0
null
null
null
null
UTF-8
Java
false
false
466
java
package com.brainfluence.pickmeuprebuild.ui.Logout; import androidx.lifecycle.LiveData; import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.ViewModel; public class LogoutViewModel extends ViewModel { private MutableLiveData<String> mText; public LogoutViewModel() { mText = new MutableLiveData<>(); mText.setValue("This is slideshow fragment"); } public LiveData<String> getText() { return mText; } }
[ "imran.cuet.cse17@gmail.com" ]
imran.cuet.cse17@gmail.com
86eb35df7272352c0fa58d9b1a185fb864655cdd
797f4e72e29e2f919c32ccf4e46b1075c49dc779
/src/academy/Academy.java
c4d2a7f78d5de3b1f5e3b2d82a7cf62b3d78981b
[]
no_license
nabinnayak477/Publons-Academy
fb3ece69e18cbad9f76f317f196c115bf20c7bbc
f562dfe455243c0eedf6d33f6cf869bd87f7f9bb
refs/heads/master
2023-02-20T11:57:31.899050
2021-01-26T19:23:31
2021-01-26T19:23:31
333,191,232
0
0
null
null
null
null
UTF-8
Java
false
false
437
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 academy; /** * * @author hp */ public class Academy { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here } }
[ "hp@DESKTOP-VPL52Q5" ]
hp@DESKTOP-VPL52Q5
c888145876f8c230a1e86fa402b0aab1d91f2ac4
9420bf2b18ae7efc908b7ededf21d461f7a0870c
/PracticaProyecto/src/main/java/com/upc/services/ISkillService.java
ceb566c41929aee565cc64da0d5b788383a00be4
[]
no_license
milecast/practicaB
eb0aedf90909091d56f34a3307dbfe678ecdcad3
5933907c82b2c738479611f2f44fdf56efaca85d
refs/heads/master
2022-10-17T08:43:41.384497
2020-06-12T12:49:16
2020-06-12T12:49:16
271,666,857
0
0
null
null
null
null
UTF-8
Java
false
false
198
java
package com.upc.services; import java.util.List; import com.upc.model.Skill; public interface ISkillService { List<Skill> getAll(int carrera_id, int tipo_id); Skill registrar(Skill skill); }
[ "Milena@DESKTOP-2EC7VMU" ]
Milena@DESKTOP-2EC7VMU
852f8b45b69255bbbc8a0605e2cebbe32a583a54
f0fac8dea55ef30689e3a6f66a9a31b80df6edbf
/cloud-redis/src/main/java/com/lingdonge/redis/annotation/EnableRedisBloomFilter.java
823c6e145dcae75699a3a50b3430a70ff12ed1ff
[]
no_license
youbooks/java-utility
c3ab7b7f3af29b74c8592928fef9e88fcab8e0e3
970e38e76de1b0c5943ae51fed20782d01288838
refs/heads/master
2020-12-01T21:42:13.115800
2019-07-25T02:30:21
2019-07-25T02:30:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
431
java
package com.lingdonge.redis.annotation; import com.lingdonge.redis.configuration.RedisBloomFilterAutoConfiguration; import org.springframework.context.annotation.Import; import java.lang.annotation.*; /** * 自动启用 RedisBloomFilterAutoConfiguration */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Import({RedisBloomFilterAutoConfiguration.class}) @Documented public @interface EnableRedisBloomFilter { }
[ "hackerpayne@gmail.com" ]
hackerpayne@gmail.com
2a6f71c0dbec4b0bbc1426b0b227de3e4914ce7d
24e4f852cf7c28121188d20ae91fd722ad375c3d
/src/main/java/com/example/thymeleaf/skierowanie/model/Miejsce.java
4106be2c4333c6712e698693ac68238a8ead12b9
[]
no_license
tmarecik/skierowanie_final
3c3bc0d89d687af77dfe44af27ef6192d8bf1099
c892c0b7f06287c89cc94bf3a5435f7c08427791
refs/heads/master
2021-01-04T20:24:20.888276
2020-02-15T16:16:47
2020-02-15T16:16:47
240,747,474
0
0
null
null
null
null
UTF-8
Java
false
false
2,225
java
package com.example.thymeleaf.skierowanie.model; import javax.persistence.*; import java.util.ArrayList; import java.util.List; @Entity @Table(name="fajne_miejsce_wpadaj") //to nadpisyuje nazwe tabeli w bazie, bez tego nazwa tabeli bedzie=nazwie klasy public class Miejsce { @Id @GeneratedValue Integer id; String adres; String kodPocztowy; String miasto; @Transient //tak zaznaczony parametr nie wejdzie do encji (bazy danych) String dyskoteka; @OneToMany(mappedBy = "miejsce") List<SkierowanieDoLekarza> skierowanieDoLekarzas = new ArrayList<>(); @OneToMany(mappedBy = "miejsce") List<Pracownik> pracowniks = new ArrayList<>(); public List<Pracownik> getPracowniks() { return pracowniks; } public void setPracowniks(List<Pracownik> pracowniks) { this.pracowniks = pracowniks; } public List<SkierowanieDoLekarza> getSkierowanieDoLekarzas() { return skierowanieDoLekarzas; } // public void setSkierowanieDoLekarzas(List<SkierowanieDoLekarza> skierowanieDoLekarzas) { this.skierowanieDoLekarzas = skierowanieDoLekarzas; } //hibernate bedzie zawsze szukal konstruktora domyslnego!!!! do stworzenia encji!! public Miejsce() { } public Miejsce(String adres, String kodPocztowy, String miasto, String dyskoteka) { this.adres = adres; this.kodPocztowy = kodPocztowy; this.miasto = miasto; this.dyskoteka = dyskoteka; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getAdres() { return adres; } public void setAdres(String adres) { this.adres = adres; } public String getKodPocztowy() { return kodPocztowy; } public void setKodPocztowy(String kodPocztowy) { this.kodPocztowy = kodPocztowy; } public String getMiasto() { return miasto; } public void setMiasto(String miasto) { this.miasto = miasto; } public String getDyskoteka() { return dyskoteka; } public void setDyskoteka(String dyskoteka) { this.dyskoteka = dyskoteka; } }
[ "tmarecik@wszib.edu.pl" ]
tmarecik@wszib.edu.pl