blob_id
stringlengths
40
40
__id__
int64
225
39,780B
directory_id
stringlengths
40
40
path
stringlengths
6
313
content_id
stringlengths
40
40
detected_licenses
list
license_type
stringclasses
2 values
repo_name
stringlengths
6
132
repo_url
stringlengths
25
151
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
70
visit_date
timestamp[ns]
revision_date
timestamp[ns]
committer_date
timestamp[ns]
github_id
int64
7.28k
689M
star_events_count
int64
0
131k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
23 values
gha_fork
bool
2 classes
gha_event_created_at
timestamp[ns]
gha_created_at
timestamp[ns]
gha_updated_at
timestamp[ns]
gha_pushed_at
timestamp[ns]
gha_size
int64
0
40.4M
gha_stargazers_count
int32
0
112k
gha_forks_count
int32
0
39.4k
gha_open_issues_count
int32
0
11k
gha_language
stringlengths
1
21
gha_archived
bool
2 classes
gha_disabled
bool
1 class
content
stringlengths
7
4.37M
src_encoding
stringlengths
3
16
language
stringclasses
1 value
length_bytes
int64
7
4.37M
extension
stringclasses
24 values
filename
stringlengths
4
174
language_id
stringclasses
1 value
entities
list
contaminating_dataset
stringclasses
0 values
malware_signatures
list
redacted_content
stringlengths
7
4.37M
redacted_length_bytes
int64
7
4.37M
alphanum_fraction
float32
0.25
0.94
alpha_fraction
float32
0.25
0.94
num_lines
int32
1
84k
avg_line_length
float32
0.76
99.9
std_line_length
float32
0
220
max_line_length
int32
5
998
is_vendor
bool
2 classes
is_generated
bool
1 class
max_hex_length
int32
0
319
hex_fraction
float32
0
0.38
max_unicode_length
int32
0
408
unicode_fraction
float32
0
0.36
max_base64_length
int32
0
506
base64_fraction
float32
0
0.5
avg_csv_sep_count
float32
0
4
is_autogen_header
bool
1 class
is_empty_html
bool
1 class
shard
stringclasses
16 values
6e2931de1133851b1b5422ff234bbd25d606e9b4
6,597,069,797,173
712d49a668a0dc37eeede553ce557108d3fb3dca
/appRentaVEJB/ejbModule/renta/model/login/ManagerLogin.java
f187c5ef9f4bfdcc075809b51f02915b1fdb82af
[]
no_license
yerson165/appAutomoviles
https://github.com/yerson165/appAutomoviles
8efe4ace7df9ca56226001c13ee8f1f1b29555d9
8dca594a392b089cef860a8561e138aaf0bd835b
refs/heads/master
2022-12-20T07:10:05.189000
2020-09-18T15:12:38
2020-09-18T15:12:38
294,144,027
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package renta.model.login; import javax.ejb.LocalBean; import javax.ejb.Stateless; /** * Session Bean implementation class ManagerLogin */ @Stateless @LocalBean public class ManagerLogin { /** * Default constructor. */ public ManagerLogin() { // TODO Auto-generated constructor stub } public String verificarUsuario(String codigoUsuario, String clave) { if(codigoUsuario.equals("Lucero") && clave.equals("555")) return "usuario"; else if (codigoUsuario.equals("Santiago")&& clave.equals("123")) return "gerente"; else return "usuario no existe"; } }
UTF-8
Java
634
java
ManagerLogin.java
Java
[ { "context": "io, String clave) {\n \tif(codigoUsuario.equals(\"Lucero\") && clave.equals(\"555\"))\n \t\treturn \"usuario\";", "end": 435, "score": 0.9900665283203125, "start": 429, "tag": "USERNAME", "value": "Lucero" }, { "context": "rn \"usuario\";\n \telse if (codigoUsuario.equals(\"Santiago\")&& clave.equals(\"123\")) \n \t\treturn \"gerente\";", "end": 530, "score": 0.9663627743721008, "start": 522, "tag": "USERNAME", "value": "Santiago" } ]
null
[]
package renta.model.login; import javax.ejb.LocalBean; import javax.ejb.Stateless; /** * Session Bean implementation class ManagerLogin */ @Stateless @LocalBean public class ManagerLogin { /** * Default constructor. */ public ManagerLogin() { // TODO Auto-generated constructor stub } public String verificarUsuario(String codigoUsuario, String clave) { if(codigoUsuario.equals("Lucero") && clave.equals("555")) return "usuario"; else if (codigoUsuario.equals("Santiago")&& clave.equals("123")) return "gerente"; else return "usuario no existe"; } }
634
0.656151
0.646688
29
20.862068
21.093756
72
false
false
0
0
0
0
0
0
0.551724
false
false
13
4eb891cdc6ca569a976608470bf1f9270bbc31ab
32,719,060,881,342
d6dd95c2f9111e4e33ab6c86f79753c95818b8b0
/dubbo/dubbo-file-transfer-provider/src/main/java/com/wjy/DubboFileTransferProviderApplication.java
bdbe494ecb18db6d997395ecef0da19901886af8
[]
no_license
series-wjy/my-document
https://github.com/series-wjy/my-document
399d62a84aa9a21efb252c8480e967d88073d2cc
c299fba856148d1bf9853d84fd32aa4ec22cdc3f
refs/heads/master
2023-06-22T23:07:46.836000
2022-05-09T10:39:42
2022-05-09T10:39:42
197,709,536
0
0
null
false
2023-06-14T22:26:21
2019-07-19T05:46:49
2022-03-31T01:54:39
2023-06-14T22:26:14
244,012
0
0
18
Java
false
false
package com.wjy; import com.alibaba.dubbo.remoting.http.servlet.DispatcherServlet; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ImportResource; @EnableAutoConfiguration @ComponentScan @ImportResource({"classpath*:META-INF/spring/module-*.xml"}) public class DubboFileTransferProviderApplication { public static void main(String[] args) throws Exception { SpringApplication.run(DubboFileTransferProviderApplication.class, args); } @Bean public ServletRegistrationBean servletRegistrationBean() { return new ServletRegistrationBean(new DispatcherServlet(), "/*"); } }
UTF-8
Java
913
java
DubboFileTransferProviderApplication.java
Java
[]
null
[]
package com.wjy; import com.alibaba.dubbo.remoting.http.servlet.DispatcherServlet; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ImportResource; @EnableAutoConfiguration @ComponentScan @ImportResource({"classpath*:META-INF/spring/module-*.xml"}) public class DubboFileTransferProviderApplication { public static void main(String[] args) throws Exception { SpringApplication.run(DubboFileTransferProviderApplication.class, args); } @Bean public ServletRegistrationBean servletRegistrationBean() { return new ServletRegistrationBean(new DispatcherServlet(), "/*"); } }
913
0.810515
0.810515
25
35.48
29.327284
80
false
false
0
0
0
0
0
0
0.48
false
false
13
ddf06f2e2107710171c1f42e2421aa3d5a623642
30,734,785,997,986
a522fad022f5ddd407822224ca6e9b4936c7535b
/maui/MeltDBConnector/src/maltcms/io/xml/ws/meltdb/KeystoreInitializer.java
3838f4713cbcc9532086d3c64cb5b98daa5a748d
[]
no_license
nilshoffmann/maui
https://github.com/nilshoffmann/maui
01154860f02618c50456036fac84f2660f8af0a6
acf30360b4bbee5a0afb6514bb6693da9bd795e9
refs/heads/master
2021-01-22T09:01:12.758000
2021-01-15T07:31:43
2021-01-15T07:31:43
39,154,886
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Maui, Maltcms User Interface. * Copyright (C) 2008-2014, The authors of Maui. All rights reserved. * * Project website: http://maltcms.sf.net * * Maui may be used under the terms of either the * * GNU Lesser General Public License (LGPL) * http://www.gnu.org/licenses/lgpl.html * * or the * * Eclipse Public License (EPL) * http://www.eclipse.org/org/documents/epl-v10.php * * As a user/recipient of Maui, you may choose which license to receive the code * under. Certain files or entire directories may not be covered by this * dual license, but are subject to licenses compatible to both LGPL and EPL. * License exceptions are explicitly declared in all relevant files or in a * LICENSE file in the relevant directories. * * Maui is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. Please consult the relevant license documentation * for details. */ package maltcms.io.xml.ws.meltdb; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import org.openide.modules.OnStart; /** * * @author Nils Hoffmann */ @OnStart public class KeystoreInitializer implements Runnable { @Override public void run() { BufferedInputStream fis = new BufferedInputStream(WebServiceClient.class.getClassLoader().getResourceAsStream("maltcms/io/xml/ws/meltdb/meltdbKeystore.ks")); File f; try { f = File.createTempFile("meltdbKeystore", "ks"); try (BufferedOutputStream fos = new BufferedOutputStream(new FileOutputStream(f))) { Logger.getLogger(getClass().getName()).info("Copying keystore data!"); int i; while ((i = fis.read()) != -1) { fos.write(i); } fos.flush(); } Logger.getLogger(getClass().getName()).info("Setting keystore properties"); System.setProperty("javax.net.ssl.trustStore", f.getAbsolutePath()); System.setProperty("javax.net.ssl.trustStorePassword", "changeit");//"meltdb-cert"); } catch (IOException ex) { Logger.getLogger(WebServiceClient.class.getName()).log(Level.SEVERE, null, ex); } } }
UTF-8
Java
2,458
java
KeystoreInitializer.java
Java
[ { "context": "rt org.openide.modules.OnStart;\n\n/**\n *\n * @author Nils Hoffmann\n */\n@OnStart\npublic class KeystoreInitializer imp", "end": 1330, "score": 0.9992412328720093, "start": 1317, "tag": "NAME", "value": "Nils Hoffmann" }, { "context": ".setProperty(\"javax.net.ssl.trustStorePassword\", \"changeit\");//\"meltdb-cert\");\n } catch (IOException ", "end": 2291, "score": 0.9988950490951538, "start": 2283, "tag": "PASSWORD", "value": "changeit" } ]
null
[]
/* * Maui, Maltcms User Interface. * Copyright (C) 2008-2014, The authors of Maui. All rights reserved. * * Project website: http://maltcms.sf.net * * Maui may be used under the terms of either the * * GNU Lesser General Public License (LGPL) * http://www.gnu.org/licenses/lgpl.html * * or the * * Eclipse Public License (EPL) * http://www.eclipse.org/org/documents/epl-v10.php * * As a user/recipient of Maui, you may choose which license to receive the code * under. Certain files or entire directories may not be covered by this * dual license, but are subject to licenses compatible to both LGPL and EPL. * License exceptions are explicitly declared in all relevant files or in a * LICENSE file in the relevant directories. * * Maui is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. Please consult the relevant license documentation * for details. */ package maltcms.io.xml.ws.meltdb; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import org.openide.modules.OnStart; /** * * @author <NAME> */ @OnStart public class KeystoreInitializer implements Runnable { @Override public void run() { BufferedInputStream fis = new BufferedInputStream(WebServiceClient.class.getClassLoader().getResourceAsStream("maltcms/io/xml/ws/meltdb/meltdbKeystore.ks")); File f; try { f = File.createTempFile("meltdbKeystore", "ks"); try (BufferedOutputStream fos = new BufferedOutputStream(new FileOutputStream(f))) { Logger.getLogger(getClass().getName()).info("Copying keystore data!"); int i; while ((i = fis.read()) != -1) { fos.write(i); } fos.flush(); } Logger.getLogger(getClass().getName()).info("Setting keystore properties"); System.setProperty("javax.net.ssl.trustStore", f.getAbsolutePath()); System.setProperty("javax.net.ssl.trustStorePassword", "<PASSWORD>");//"meltdb-cert"); } catch (IOException ex) { Logger.getLogger(WebServiceClient.class.getName()).log(Level.SEVERE, null, ex); } } }
2,453
0.677787
0.673312
68
35.14706
33.240772
165
false
false
0
0
0
0
0
0
0.470588
false
false
13
5c723e3526f363236e9d9803f7374ef4a2d805af
4,733,053,990,047
82badf5f269fa7b73faaaf6578a9394de12ccb47
/Board.java
38d549db3f89ec90c53d9a25a24d18d936fff6f6
[]
no_license
Racmo/Samoloty-i-statki
https://github.com/Racmo/Samoloty-i-statki
b09608a307ffadded07654562d7e672e21b8fbbd
a37f91ce597a4d8b5b63d06cc4e90b12f81b0318
refs/heads/master
2017-12-30T05:48:48.049000
2016-10-28T13:57:58
2016-10-28T13:57:58
72,211,882
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * 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 samoloty_statki; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import javax.swing.JPanel; import javax.swing.Timer; import javax.swing.ImageIcon; import java.awt.Image; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import sun.java2d.loops.DrawLine; public class Board extends JPanel implements ActionListener, MouseListener{ private Timer timer; private final int DELAY = 30; private Image background; boolean x; private int myszX, myszY; public Board() { ImageIcon ii = new ImageIcon("mapa.png"); this.background = ii.getImage(); initBoard(); } private void initBoard() { // addKeyListener(new TAdapter()); addMouseListener(this); setFocusable(true); timer = new Timer(DELAY, this); timer.start(); } @Override public void paintComponent(Graphics g) { super.paintComponent(g); doDrawing(g); Toolkit.getDefaultToolkit().sync(); } private void doDrawing(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.drawImage(background, 0, 0, this); //rysowanie linii/tras: for(int i=0; i<5; i++) //dla miast { PunktMapy miasto = Global.listaMiast.get(i); g2d.drawLine(miasto.getX()+(25/2), miasto.getY()+(25/2), Global.cross1.getX(), Global.cross1.getY()); } for(int i=5; i<10; i++) { PunktMapy miasto = Global.listaMiast.get(i); g2d.drawLine(miasto.getX()+(25/2), miasto.getY()+(25/2), Global.cross2.getX(), Global.cross2.getY()); } for(int i=0; i<2;i++) //dla lotnisk wojskowych { PunktMapy wojsko = Global.listaWojsko.get(i); g2d.drawLine(wojsko.getX()+(25/2), wojsko.getY()+(25/2), Global.cross1.getX(), Global.cross1.getY()); } for(int i=2; i<5;i++) { PunktMapy wojsko = Global.listaWojsko.get(i); g2d.drawLine(wojsko.getX()+(25/2), wojsko.getY()+(25/2), Global.cross2.getX(), Global.cross2.getY()); } for(int i=0; i<2;i++) //dla portow { PunktMapy port = Global.listaPorty.get(i); g2d.drawLine(port.getX()+(25/2), port.getY()+(25/2), Global.cross3.getX(), Global.cross3.getY()); } for(int i=2; i<5;i++) { PunktMapy port = Global.listaPorty.get(i); g2d.drawLine(port.getX()+(25/2), port.getY()+(25/2), Global.cross4.getX(), Global.cross4.getY()); } g2d.drawLine(Global.cross1.getX(),Global.cross1.getY(), Global.cross2.getX(),Global.cross2.getY()); g2d.drawLine(Global.cross3.getX(),Global.cross3.getY(), Global.cross4.getX(),Global.cross4.getY()); //rysowanie miast: for(PunktMapy miasto : Global.listaMiast){ g2d.drawImage(miasto.getObrazek(), miasto.getX(), miasto.getY(), this); } //rysowanie lotnisk wojskowych for(PunktMapy wojsko : Global.listaWojsko){ g2d.drawImage(wojsko.getObrazek(), wojsko.getX(), wojsko.getY(), this); } //rysowanie portow: for(Port port: Global.listaPorty) { g2d.drawImage(port.getObrazek(), port.getX(), port.getY(), this); } //rysowanie pojazdow: for(PunktMapy samolot : Global.listaSamolotow){ g2d.drawImage(samolot.getObrazek(), samolot.getX(), samolot.getY(), this); } } @Override public void actionPerformed(ActionEvent e) { repaint(); } //obsluga myszki @Override public void mouseClicked(MouseEvent e) { myszX = e.getX(); myszY = e.getY(); //klikniecie w pojazd: for(PunktMapy s: Global.listaSamolotow) { int samX = s.getX(); int samY = s.getY(); if( (myszX >= samX) && (myszX <= samX+50) && (myszY >= samY) && (myszY <= samY+30) ) { if(s instanceof SamolotPasazerski){ SamolotPasazerski sam = (SamolotPasazerski)s; SamolotOkno okno = new SamolotOkno(); okno.setSamolot(sam); okno.wypelinij_pola(); (new Thread(okno)).start(); okno.setVisible(true); } if(s instanceof SamolotWojskowy){ SamolotWojskowy x = (SamolotWojskowy)s; SamolotWojskowyOkno okno = new SamolotWojskowyOkno(); okno.setSamolot(x); okno.wypelinij_pola(); (new Thread(okno)).start(); okno.setVisible(true); } if(s instanceof StatekPasazerski) { StatekPasazerski x = (StatekPasazerski)s; StatekOkno okno = new StatekOkno(); okno.setStatek(x); okno.wypelinij_pola(); okno.setVisible(true); } if(s instanceof Lotniskowiec) { Lotniskowiec x = (Lotniskowiec)s; LotniskowiecOkno okno = new LotniskowiecOkno(); okno.IDLabel.setText(s.getID()); okno.uzbrojenieLabel.setText(x.getTypUzbrojenia()); okno.setVisible(true); } break; } } //klikniecie w przystanki: for(LotniskoCywilne p: Global.listaMiast) { int samX = p.getX(); int samY = p.getY(); if( (myszX >= samX) && (myszX <= samX+25) && (myszY >= samY) && (myszY <= samY+25) ) { System.out.println("Kliknieto miasto!"); MiastoOkno okno = new MiastoOkno(); okno.miastoLabel.setText(p.getID()); okno.polozenieLabel.setText("X: " + p.getX() + " Y: " + p.getY()); okno.setVisible(true); break; } } for(LotniskoWojskowe p: Global.listaWojsko) { int samX = p.getX(); int samY = p.getY(); if( (myszX >= samX) && (myszX <= samX+25) && (myszY >= samY) && (myszY <= samY+25) ) { System.out.println("Kliknieto lotnisko wojskowe!"); MiastoOkno okno = new MiastoOkno(); okno.miastoLabel.setText(p.getID()); okno.polozenieLabel.setText("X: " + p.getX() + " Y: " + p.getY()); okno.setVisible(true); break; } } for(Port p: Global.listaPorty) { int samX = p.getX(); int samY = p.getY(); if( (myszX >= samX) && (myszX <= samX+25) && (myszY >= samY) && (myszY <= samY+25) ) { System.out.println("Kliknieto miasto!"); MiastoOkno okno = new MiastoOkno(); okno.miastoLabel.setText(p.getID()); okno.polozenieLabel.setText("X: " + p.getX() + " Y: " + p.getY()); okno.setVisible(true); break; } } } @Override public void mouseEntered(MouseEvent e) { System.out.println("mouseEntered"); } @Override public void mouseExited(MouseEvent e) { System.out.println("mouseExited"); } @Override public void mousePressed(MouseEvent e) { System.out.println("mousePressed"); } @Override public void mouseReleased(MouseEvent e) { System.out.println("mouseReleased"); } }
UTF-8
Java
8,899
java
Board.java
Java
[]
null
[]
/* * 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 samoloty_statki; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import javax.swing.JPanel; import javax.swing.Timer; import javax.swing.ImageIcon; import java.awt.Image; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import sun.java2d.loops.DrawLine; public class Board extends JPanel implements ActionListener, MouseListener{ private Timer timer; private final int DELAY = 30; private Image background; boolean x; private int myszX, myszY; public Board() { ImageIcon ii = new ImageIcon("mapa.png"); this.background = ii.getImage(); initBoard(); } private void initBoard() { // addKeyListener(new TAdapter()); addMouseListener(this); setFocusable(true); timer = new Timer(DELAY, this); timer.start(); } @Override public void paintComponent(Graphics g) { super.paintComponent(g); doDrawing(g); Toolkit.getDefaultToolkit().sync(); } private void doDrawing(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.drawImage(background, 0, 0, this); //rysowanie linii/tras: for(int i=0; i<5; i++) //dla miast { PunktMapy miasto = Global.listaMiast.get(i); g2d.drawLine(miasto.getX()+(25/2), miasto.getY()+(25/2), Global.cross1.getX(), Global.cross1.getY()); } for(int i=5; i<10; i++) { PunktMapy miasto = Global.listaMiast.get(i); g2d.drawLine(miasto.getX()+(25/2), miasto.getY()+(25/2), Global.cross2.getX(), Global.cross2.getY()); } for(int i=0; i<2;i++) //dla lotnisk wojskowych { PunktMapy wojsko = Global.listaWojsko.get(i); g2d.drawLine(wojsko.getX()+(25/2), wojsko.getY()+(25/2), Global.cross1.getX(), Global.cross1.getY()); } for(int i=2; i<5;i++) { PunktMapy wojsko = Global.listaWojsko.get(i); g2d.drawLine(wojsko.getX()+(25/2), wojsko.getY()+(25/2), Global.cross2.getX(), Global.cross2.getY()); } for(int i=0; i<2;i++) //dla portow { PunktMapy port = Global.listaPorty.get(i); g2d.drawLine(port.getX()+(25/2), port.getY()+(25/2), Global.cross3.getX(), Global.cross3.getY()); } for(int i=2; i<5;i++) { PunktMapy port = Global.listaPorty.get(i); g2d.drawLine(port.getX()+(25/2), port.getY()+(25/2), Global.cross4.getX(), Global.cross4.getY()); } g2d.drawLine(Global.cross1.getX(),Global.cross1.getY(), Global.cross2.getX(),Global.cross2.getY()); g2d.drawLine(Global.cross3.getX(),Global.cross3.getY(), Global.cross4.getX(),Global.cross4.getY()); //rysowanie miast: for(PunktMapy miasto : Global.listaMiast){ g2d.drawImage(miasto.getObrazek(), miasto.getX(), miasto.getY(), this); } //rysowanie lotnisk wojskowych for(PunktMapy wojsko : Global.listaWojsko){ g2d.drawImage(wojsko.getObrazek(), wojsko.getX(), wojsko.getY(), this); } //rysowanie portow: for(Port port: Global.listaPorty) { g2d.drawImage(port.getObrazek(), port.getX(), port.getY(), this); } //rysowanie pojazdow: for(PunktMapy samolot : Global.listaSamolotow){ g2d.drawImage(samolot.getObrazek(), samolot.getX(), samolot.getY(), this); } } @Override public void actionPerformed(ActionEvent e) { repaint(); } //obsluga myszki @Override public void mouseClicked(MouseEvent e) { myszX = e.getX(); myszY = e.getY(); //klikniecie w pojazd: for(PunktMapy s: Global.listaSamolotow) { int samX = s.getX(); int samY = s.getY(); if( (myszX >= samX) && (myszX <= samX+50) && (myszY >= samY) && (myszY <= samY+30) ) { if(s instanceof SamolotPasazerski){ SamolotPasazerski sam = (SamolotPasazerski)s; SamolotOkno okno = new SamolotOkno(); okno.setSamolot(sam); okno.wypelinij_pola(); (new Thread(okno)).start(); okno.setVisible(true); } if(s instanceof SamolotWojskowy){ SamolotWojskowy x = (SamolotWojskowy)s; SamolotWojskowyOkno okno = new SamolotWojskowyOkno(); okno.setSamolot(x); okno.wypelinij_pola(); (new Thread(okno)).start(); okno.setVisible(true); } if(s instanceof StatekPasazerski) { StatekPasazerski x = (StatekPasazerski)s; StatekOkno okno = new StatekOkno(); okno.setStatek(x); okno.wypelinij_pola(); okno.setVisible(true); } if(s instanceof Lotniskowiec) { Lotniskowiec x = (Lotniskowiec)s; LotniskowiecOkno okno = new LotniskowiecOkno(); okno.IDLabel.setText(s.getID()); okno.uzbrojenieLabel.setText(x.getTypUzbrojenia()); okno.setVisible(true); } break; } } //klikniecie w przystanki: for(LotniskoCywilne p: Global.listaMiast) { int samX = p.getX(); int samY = p.getY(); if( (myszX >= samX) && (myszX <= samX+25) && (myszY >= samY) && (myszY <= samY+25) ) { System.out.println("Kliknieto miasto!"); MiastoOkno okno = new MiastoOkno(); okno.miastoLabel.setText(p.getID()); okno.polozenieLabel.setText("X: " + p.getX() + " Y: " + p.getY()); okno.setVisible(true); break; } } for(LotniskoWojskowe p: Global.listaWojsko) { int samX = p.getX(); int samY = p.getY(); if( (myszX >= samX) && (myszX <= samX+25) && (myszY >= samY) && (myszY <= samY+25) ) { System.out.println("Kliknieto lotnisko wojskowe!"); MiastoOkno okno = new MiastoOkno(); okno.miastoLabel.setText(p.getID()); okno.polozenieLabel.setText("X: " + p.getX() + " Y: " + p.getY()); okno.setVisible(true); break; } } for(Port p: Global.listaPorty) { int samX = p.getX(); int samY = p.getY(); if( (myszX >= samX) && (myszX <= samX+25) && (myszY >= samY) && (myszY <= samY+25) ) { System.out.println("Kliknieto miasto!"); MiastoOkno okno = new MiastoOkno(); okno.miastoLabel.setText(p.getID()); okno.polozenieLabel.setText("X: " + p.getX() + " Y: " + p.getY()); okno.setVisible(true); break; } } } @Override public void mouseEntered(MouseEvent e) { System.out.println("mouseEntered"); } @Override public void mouseExited(MouseEvent e) { System.out.println("mouseExited"); } @Override public void mousePressed(MouseEvent e) { System.out.println("mousePressed"); } @Override public void mouseReleased(MouseEvent e) { System.out.println("mouseReleased"); } }
8,899
0.489381
0.477357
251
33.454182
26.60005
114
false
false
0
0
0
0
0
0
0.665339
false
false
13
e44f75431d5823738ccfbf0156f85a1798a51024
15,358,803,069,957
0a5f79d34e32f639ccda5a7616ba94ee7e1b04f3
/src/test/StringReverseRecursion.java
f5d466c07f2d9c0bb8c29ce105cae5752cd802ba
[ "Unlicense" ]
permissive
bodydomelight/tij-problems
https://github.com/bodydomelight/tij-problems
0263b46f752000ec33b3a36aa813dd06ac4bd6ae
7a49fc4814958b3ff267c5e3554c1deadc867b5c
refs/heads/master
2016-09-05T14:45:07.183000
2014-08-20T21:39:02
2014-08-20T21:39:02
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package test; public class StringReverseRecursion { public static String reverse(String str) { if (str == null || str.length() <= 1) { return str; } return reverse(str.substring(1)) + str.charAt(0); //return new StringBuilder(str).reverse().toString(); } public static void main(String[] args) { System.out.println("zalando == " + reverse("zalando") + " : "+ "odnalaz".equals(reverse("zalando"))); } }
UTF-8
Java
487
java
StringReverseRecursion.java
Java
[]
null
[]
package test; public class StringReverseRecursion { public static String reverse(String str) { if (str == null || str.length() <= 1) { return str; } return reverse(str.substring(1)) + str.charAt(0); //return new StringBuilder(str).reverse().toString(); } public static void main(String[] args) { System.out.println("zalando == " + reverse("zalando") + " : "+ "odnalaz".equals(reverse("zalando"))); } }
487
0.566735
0.560575
15
30.466667
29.874998
109
false
false
0
0
0
0
0
0
0.466667
false
false
13
fa0139f66f094f818e6937e7312f483b9b19f77a
33,088,428,078,069
cd018172b01174ff4c4fcb5fc30e1b498d13d864
/bubsSpring/src/main/java/org/borko/spring/edu/memory/RDFMemory.java
7ab7ea2aa9d94ddf696f4300b3c03cf0eacc4484
[]
no_license
brashkov/personal-projects
https://github.com/brashkov/personal-projects
85e7606acb302b902d31c9ff623355ab776bdb21
6b705fc620a6678628ef8339614d70971634a3b4
refs/heads/master
2021-08-23T20:20:43.352000
2017-12-06T11:21:19
2017-12-06T11:21:19
113,307,166
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.borko.spring.edu.memory; import org.eclipse.rdf4j.model.IRI; import org.eclipse.rdf4j.model.Resource; import org.eclipse.rdf4j.model.Statement; import org.eclipse.rdf4j.model.vocabulary.FOAF; import org.eclipse.rdf4j.model.vocabulary.RDF; import org.eclipse.rdf4j.repository.RepositoryConnection; import org.eclipse.rdf4j.repository.RepositoryResult; import org.springframework.stereotype.Component; import org.borko.spring.edu.dao.PersonDAO; import org.borko.spring.edu.rdf4j.RdfGraph; import org.borko.spring.edu.vocabulary.VOC; @Component public class RDFMemory { private static RepositoryConnection CONNECTION = RdfGraph.getConnection(); // Initializing the connection private static String NAMESPACE = "http://workproject/"; private static IRI context = VOC.customIRI(NAMESPACE, "person"); /** * * @param person is of type PersonDAO * @return true or false / if the operation was successful or not */ public boolean add(PersonDAO person) { boolean indicator = false; Resource f_name = VOC.customIRI(NAMESPACE, person.getFirst_name()); // subject Resource l_name = VOC.customIRI(NAMESPACE, person.getLast_name()); //object if(isDuplicate(f_name, FOAF.LAST_NAME, l_name)){ CONNECTION.add(f_name,FOAF.LAST_NAME,l_name,context); System.err.println("Added "+person.toString()); indicator=true; }else { System.out.println("Person already exist"); } return indicator; } /** * * @param subject : the subject * @param predicate : the predicate * @param object : the object * @return true or false whether the specific RDF is already in the db */ private boolean isDuplicate(Resource subject,IRI predicate ,Resource object ) { return !CONNECTION.getStatements(subject, predicate, object, context).hasNext(); } /** * * @return true or false whether it cleared the whole database */ public boolean clearDB() { RepositoryResult<Statement> st = CONNECTION.getStatements(null, null, null, context); while (st.hasNext()) { Statement tmp = st.next(); System.err.println("Deleting "+tmp+"..."); CONNECTION.remove(tmp, context); } return true; } }
UTF-8
Java
2,170
java
RDFMemory.java
Java
[]
null
[]
package org.borko.spring.edu.memory; import org.eclipse.rdf4j.model.IRI; import org.eclipse.rdf4j.model.Resource; import org.eclipse.rdf4j.model.Statement; import org.eclipse.rdf4j.model.vocabulary.FOAF; import org.eclipse.rdf4j.model.vocabulary.RDF; import org.eclipse.rdf4j.repository.RepositoryConnection; import org.eclipse.rdf4j.repository.RepositoryResult; import org.springframework.stereotype.Component; import org.borko.spring.edu.dao.PersonDAO; import org.borko.spring.edu.rdf4j.RdfGraph; import org.borko.spring.edu.vocabulary.VOC; @Component public class RDFMemory { private static RepositoryConnection CONNECTION = RdfGraph.getConnection(); // Initializing the connection private static String NAMESPACE = "http://workproject/"; private static IRI context = VOC.customIRI(NAMESPACE, "person"); /** * * @param person is of type PersonDAO * @return true or false / if the operation was successful or not */ public boolean add(PersonDAO person) { boolean indicator = false; Resource f_name = VOC.customIRI(NAMESPACE, person.getFirst_name()); // subject Resource l_name = VOC.customIRI(NAMESPACE, person.getLast_name()); //object if(isDuplicate(f_name, FOAF.LAST_NAME, l_name)){ CONNECTION.add(f_name,FOAF.LAST_NAME,l_name,context); System.err.println("Added "+person.toString()); indicator=true; }else { System.out.println("Person already exist"); } return indicator; } /** * * @param subject : the subject * @param predicate : the predicate * @param object : the object * @return true or false whether the specific RDF is already in the db */ private boolean isDuplicate(Resource subject,IRI predicate ,Resource object ) { return !CONNECTION.getStatements(subject, predicate, object, context).hasNext(); } /** * * @return true or false whether it cleared the whole database */ public boolean clearDB() { RepositoryResult<Statement> st = CONNECTION.getStatements(null, null, null, context); while (st.hasNext()) { Statement tmp = st.next(); System.err.println("Deleting "+tmp+"..."); CONNECTION.remove(tmp, context); } return true; } }
2,170
0.725806
0.72212
75
27.933332
27.111786
106
false
false
0
0
0
0
0
0
1.813333
false
false
13
fd909415418a44683790d543aba66e434df7c6d4
26,654,567,069,486
08fcfa51b9d04cb0a80a587fbf040b9fdb43342f
/app/src/main/java/com/pepe/proyecto/MainActivity.java
cc7d06478d2adeab1499aee8203cc057d8bcf643
[]
no_license
JoseDeJesusMendozaBecerril/ProyectoMoviles
https://github.com/JoseDeJesusMendozaBecerril/ProyectoMoviles
a0888916aae706664b839972376a18c4c21525cd
775b755fdd5fcb157b9cb22191c61334d462ed85
refs/heads/main
2023-01-12T04:11:16.453000
2020-11-18T07:57:19
2020-11-18T07:57:19
313,471,199
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.pepe.proyecto; import androidx.appcompat.app.AppCompatActivity; import android.content.Context; import android.content.Intent; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.Bundle; import android.os.StrictMode; import android.provider.DocumentsContract; import android.view.View; import android.widget.Button; import android.widget.Toast; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; import java.util.ArrayList; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; public class MainActivity extends AppCompatActivity { Button btnviewInsertar; Button btnviewVisualizar; Button btnviewEliminar; Button btnviewActualizar; String archivoXMLCategorias= "https://blogpersonalpepe.000webhostapp.com/categorias.xml"; String archivoXMLMarcas = "https://blogpersonalpepe.000webhostapp.com/marcas.xml"; String archivoXMLTipos = "https://blogpersonalpepe.000webhostapp.com/tipos.xml"; ArrayList<Categoria> categorias; ArrayList<Marca> marcas; ArrayList<Tipo> tipos; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initComponents(); addMethods(); //PRUEBA downloadCatalogos(); System.out.println("Categorias"); imprimeCategorias(); System.out.println("Marcas"); imprimeMarcas(); System.out.println("Tipos"); imprimeTipos(); } public void initComponents(){ this.btnviewInsertar = (Button) findViewById(R.id.btnViewInserta); this.btnviewVisualizar = (Button) findViewById(R.id.btnViewVisualizar); this.btnviewEliminar = (Button) findViewById(R.id.btnViewEliminar); this.btnviewActualizar = (Button) findViewById(R.id.btnViewActualizar); } public void addMethods(){ this.btnviewInsertar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { changeActivity(v,1); } }); this.btnviewVisualizar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { changeActivity(v,2); } }); this.btnviewEliminar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { changeActivity(v,3); } }); this.btnviewActualizar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { changeActivity(v,4); } }); } public void changeActivity(View v , int op){ Intent intent = null; switch (op){ case 1: intent = new Intent(v.getContext(), InsertaActivity.class); break; case 2: intent = new Intent(v.getContext(), VisualizaActivity.class); break; case 3: intent = new Intent(v.getContext(), EliminaActivity.class); break; case 4: intent = new Intent(v.getContext(), ActualizaActivity.class); break; } startActivity(intent); } public void downloadCatalogos(){ StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().permitNetwork().build()); ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo(); if(networkInfo != null && networkInfo.isConnected()){ Toast.makeText(getApplicationContext(),"Conexion Establecida", Toast.LENGTH_SHORT).show(); categorias = leerCategorias(); marcas = leerMarcas(); tipos = leerTipos(); } } //----------------------------------------------------TRATAMIENTO DE XML ----------------------------- //LISTO public ArrayList<Categoria> leerCategorias(){ HttpURLConnection conn = null; ArrayList<Categoria> categorias = null; try{ URL url = new URL(archivoXMLCategorias); conn = (HttpURLConnection) url.openConnection(); conn.setReadTimeout(15000); conn.setConnectTimeout(15000); conn.connect(); int responseCode = conn.getResponseCode(); if(responseCode == HttpURLConnection.HTTP_OK){ Document doc = parseXML(conn.getInputStream()); //checar importacion categorias = parseCategoria(doc.getDocumentElement()); } else if(responseCode == HttpURLConnection.HTTP_CONFLICT){ return null; } } catch (Exception e){ e.printStackTrace(); } finally { if(conn != null){ conn.disconnect(); } } return categorias; } private ArrayList<Categoria> parseCategoria(Element raiz){ ArrayList<Categoria> categorias = new ArrayList<Categoria>(); NodeList items = raiz.getElementsByTagName("categoria"); for(int i=0; i < items.getLength(); i++){ Node nodoCategoria = items.item(i); Categoria categoria = new Categoria(); //Recorremos todos los hijos que tenga el nodo libro for(int j = 0; j < nodoCategoria.getChildNodes().getLength(); j++){ Node nodoActual = nodoCategoria.getChildNodes().item(j); if(nodoActual.getNodeType() == Node.ELEMENT_NODE){ if(nodoActual.getNodeName().equalsIgnoreCase("id")){ categoria.setId(nodoActual.getChildNodes().item(0).getNodeValue()); } else if(nodoActual.getNodeName().equalsIgnoreCase("nombre")){ categoria.setSeccion(nodoActual.getChildNodes().item(0).getNodeValue()); } } } categorias.add(categoria); } return categorias; } //LISTO public ArrayList<Marca> leerMarcas(){ HttpURLConnection conn = null; ArrayList<Marca> marcas = null; try{ URL url = new URL(archivoXMLMarcas); conn = (HttpURLConnection) url.openConnection(); conn.setReadTimeout(15000); conn.setConnectTimeout(15000); conn.connect(); int responseCode = conn.getResponseCode(); if(responseCode == HttpURLConnection.HTTP_OK){ Document doc = parseXML(conn.getInputStream()); //checar importacion marcas = parseMarca(doc.getDocumentElement()); } else if(responseCode == HttpURLConnection.HTTP_CONFLICT){ return null; } } catch (Exception e){ e.printStackTrace(); } finally { if(conn != null){ conn.disconnect(); } } return marcas; } private ArrayList<Marca> parseMarca(Element raiz){ ArrayList<Marca> marcas = new ArrayList<Marca>(); NodeList items = raiz.getElementsByTagName("marca"); for(int i=0; i < items.getLength(); i++){ Node nodoMarca = items.item(i); Marca marca = new Marca(); //Recorremos todos los hijos que tenga el nodo libro for(int j = 0; j < nodoMarca.getChildNodes().getLength(); j++){ Node nodoActual = nodoMarca.getChildNodes().item(j); if(nodoActual.getNodeType() == Node.ELEMENT_NODE){ if(nodoActual.getNodeName().equalsIgnoreCase("id")){ marca.setId(nodoActual.getChildNodes().item(0).getNodeValue()); } else if(nodoActual.getNodeName().equalsIgnoreCase("nombre")){ marca.setNombre(nodoActual.getChildNodes().item(0).getNodeValue()); } } } marcas.add(marca); } return marcas; } //LISTO public ArrayList<Tipo> leerTipos(){ HttpURLConnection conn = null; ArrayList<Tipo> tipos = null; try{ URL url = new URL(archivoXMLTipos); conn = (HttpURLConnection) url.openConnection(); conn.setReadTimeout(15000); conn.setConnectTimeout(15000); conn.connect(); int responseCode = conn.getResponseCode(); if(responseCode == HttpURLConnection.HTTP_OK){ Document doc = parseXML(conn.getInputStream()); //checar importacion tipos = parseTipo(doc.getDocumentElement()); } else if(responseCode == HttpURLConnection.HTTP_CONFLICT){ return null; } } catch (Exception e){ e.printStackTrace(); } finally { if(conn != null){ conn.disconnect(); } } return tipos; } private ArrayList<Tipo> parseTipo(Element raiz){ ArrayList<Tipo> tipos = new ArrayList<Tipo>(); NodeList items = raiz.getElementsByTagName("tipo"); for(int i=0; i < items.getLength(); i++){ Node nodoTipo = items.item(i); Tipo tipo = new Tipo(); //Recorremos todos los hijos que tenga el nodo libro for(int j = 0; j < nodoTipo.getChildNodes().getLength(); j++){ Node nodoActual = nodoTipo.getChildNodes().item(j); if(nodoActual.getNodeType() == Node.ELEMENT_NODE){ if(nodoActual.getNodeName().equalsIgnoreCase("id")){ tipo.setId(nodoActual.getChildNodes().item(0).getNodeValue()); } else if(nodoActual.getNodeName().equalsIgnoreCase("nombre")){ tipo.setNombre(nodoActual.getChildNodes().item(0).getNodeValue()); } } } tipos.add(tipo); } return tipos; } private Document parseXML(InputStream stream) throws ParserConfigurationException, IOException, SAXException{ DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); Document document = documentBuilder.parse(stream); return document; } public void cargarBD(){ System.out.println("Antes de cargar bd"); } private void imprimeCategorias(){ for (Categoria cat : categorias) { System.out.println("ID: " + cat.getId() + " SECCION: " + cat.getSeccion()); } } private void imprimeMarcas(){ for (Marca marca : marcas) { System.out.println("ID: " + marca.getId() + " NOMBRE: " + marca.getNombre()); } } private void imprimeTipos(){ for (Tipo tipo : tipos) { System.out.println("ID: " + tipo.getId() + " NOMBRE: " + tipo.getNombre()); } } }
UTF-8
Java
11,622
java
MainActivity.java
Java
[]
null
[]
package com.pepe.proyecto; import androidx.appcompat.app.AppCompatActivity; import android.content.Context; import android.content.Intent; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.Bundle; import android.os.StrictMode; import android.provider.DocumentsContract; import android.view.View; import android.widget.Button; import android.widget.Toast; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; import java.util.ArrayList; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; public class MainActivity extends AppCompatActivity { Button btnviewInsertar; Button btnviewVisualizar; Button btnviewEliminar; Button btnviewActualizar; String archivoXMLCategorias= "https://blogpersonalpepe.000webhostapp.com/categorias.xml"; String archivoXMLMarcas = "https://blogpersonalpepe.000webhostapp.com/marcas.xml"; String archivoXMLTipos = "https://blogpersonalpepe.000webhostapp.com/tipos.xml"; ArrayList<Categoria> categorias; ArrayList<Marca> marcas; ArrayList<Tipo> tipos; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initComponents(); addMethods(); //PRUEBA downloadCatalogos(); System.out.println("Categorias"); imprimeCategorias(); System.out.println("Marcas"); imprimeMarcas(); System.out.println("Tipos"); imprimeTipos(); } public void initComponents(){ this.btnviewInsertar = (Button) findViewById(R.id.btnViewInserta); this.btnviewVisualizar = (Button) findViewById(R.id.btnViewVisualizar); this.btnviewEliminar = (Button) findViewById(R.id.btnViewEliminar); this.btnviewActualizar = (Button) findViewById(R.id.btnViewActualizar); } public void addMethods(){ this.btnviewInsertar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { changeActivity(v,1); } }); this.btnviewVisualizar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { changeActivity(v,2); } }); this.btnviewEliminar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { changeActivity(v,3); } }); this.btnviewActualizar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { changeActivity(v,4); } }); } public void changeActivity(View v , int op){ Intent intent = null; switch (op){ case 1: intent = new Intent(v.getContext(), InsertaActivity.class); break; case 2: intent = new Intent(v.getContext(), VisualizaActivity.class); break; case 3: intent = new Intent(v.getContext(), EliminaActivity.class); break; case 4: intent = new Intent(v.getContext(), ActualizaActivity.class); break; } startActivity(intent); } public void downloadCatalogos(){ StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().permitNetwork().build()); ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo(); if(networkInfo != null && networkInfo.isConnected()){ Toast.makeText(getApplicationContext(),"Conexion Establecida", Toast.LENGTH_SHORT).show(); categorias = leerCategorias(); marcas = leerMarcas(); tipos = leerTipos(); } } //----------------------------------------------------TRATAMIENTO DE XML ----------------------------- //LISTO public ArrayList<Categoria> leerCategorias(){ HttpURLConnection conn = null; ArrayList<Categoria> categorias = null; try{ URL url = new URL(archivoXMLCategorias); conn = (HttpURLConnection) url.openConnection(); conn.setReadTimeout(15000); conn.setConnectTimeout(15000); conn.connect(); int responseCode = conn.getResponseCode(); if(responseCode == HttpURLConnection.HTTP_OK){ Document doc = parseXML(conn.getInputStream()); //checar importacion categorias = parseCategoria(doc.getDocumentElement()); } else if(responseCode == HttpURLConnection.HTTP_CONFLICT){ return null; } } catch (Exception e){ e.printStackTrace(); } finally { if(conn != null){ conn.disconnect(); } } return categorias; } private ArrayList<Categoria> parseCategoria(Element raiz){ ArrayList<Categoria> categorias = new ArrayList<Categoria>(); NodeList items = raiz.getElementsByTagName("categoria"); for(int i=0; i < items.getLength(); i++){ Node nodoCategoria = items.item(i); Categoria categoria = new Categoria(); //Recorremos todos los hijos que tenga el nodo libro for(int j = 0; j < nodoCategoria.getChildNodes().getLength(); j++){ Node nodoActual = nodoCategoria.getChildNodes().item(j); if(nodoActual.getNodeType() == Node.ELEMENT_NODE){ if(nodoActual.getNodeName().equalsIgnoreCase("id")){ categoria.setId(nodoActual.getChildNodes().item(0).getNodeValue()); } else if(nodoActual.getNodeName().equalsIgnoreCase("nombre")){ categoria.setSeccion(nodoActual.getChildNodes().item(0).getNodeValue()); } } } categorias.add(categoria); } return categorias; } //LISTO public ArrayList<Marca> leerMarcas(){ HttpURLConnection conn = null; ArrayList<Marca> marcas = null; try{ URL url = new URL(archivoXMLMarcas); conn = (HttpURLConnection) url.openConnection(); conn.setReadTimeout(15000); conn.setConnectTimeout(15000); conn.connect(); int responseCode = conn.getResponseCode(); if(responseCode == HttpURLConnection.HTTP_OK){ Document doc = parseXML(conn.getInputStream()); //checar importacion marcas = parseMarca(doc.getDocumentElement()); } else if(responseCode == HttpURLConnection.HTTP_CONFLICT){ return null; } } catch (Exception e){ e.printStackTrace(); } finally { if(conn != null){ conn.disconnect(); } } return marcas; } private ArrayList<Marca> parseMarca(Element raiz){ ArrayList<Marca> marcas = new ArrayList<Marca>(); NodeList items = raiz.getElementsByTagName("marca"); for(int i=0; i < items.getLength(); i++){ Node nodoMarca = items.item(i); Marca marca = new Marca(); //Recorremos todos los hijos que tenga el nodo libro for(int j = 0; j < nodoMarca.getChildNodes().getLength(); j++){ Node nodoActual = nodoMarca.getChildNodes().item(j); if(nodoActual.getNodeType() == Node.ELEMENT_NODE){ if(nodoActual.getNodeName().equalsIgnoreCase("id")){ marca.setId(nodoActual.getChildNodes().item(0).getNodeValue()); } else if(nodoActual.getNodeName().equalsIgnoreCase("nombre")){ marca.setNombre(nodoActual.getChildNodes().item(0).getNodeValue()); } } } marcas.add(marca); } return marcas; } //LISTO public ArrayList<Tipo> leerTipos(){ HttpURLConnection conn = null; ArrayList<Tipo> tipos = null; try{ URL url = new URL(archivoXMLTipos); conn = (HttpURLConnection) url.openConnection(); conn.setReadTimeout(15000); conn.setConnectTimeout(15000); conn.connect(); int responseCode = conn.getResponseCode(); if(responseCode == HttpURLConnection.HTTP_OK){ Document doc = parseXML(conn.getInputStream()); //checar importacion tipos = parseTipo(doc.getDocumentElement()); } else if(responseCode == HttpURLConnection.HTTP_CONFLICT){ return null; } } catch (Exception e){ e.printStackTrace(); } finally { if(conn != null){ conn.disconnect(); } } return tipos; } private ArrayList<Tipo> parseTipo(Element raiz){ ArrayList<Tipo> tipos = new ArrayList<Tipo>(); NodeList items = raiz.getElementsByTagName("tipo"); for(int i=0; i < items.getLength(); i++){ Node nodoTipo = items.item(i); Tipo tipo = new Tipo(); //Recorremos todos los hijos que tenga el nodo libro for(int j = 0; j < nodoTipo.getChildNodes().getLength(); j++){ Node nodoActual = nodoTipo.getChildNodes().item(j); if(nodoActual.getNodeType() == Node.ELEMENT_NODE){ if(nodoActual.getNodeName().equalsIgnoreCase("id")){ tipo.setId(nodoActual.getChildNodes().item(0).getNodeValue()); } else if(nodoActual.getNodeName().equalsIgnoreCase("nombre")){ tipo.setNombre(nodoActual.getChildNodes().item(0).getNodeValue()); } } } tipos.add(tipo); } return tipos; } private Document parseXML(InputStream stream) throws ParserConfigurationException, IOException, SAXException{ DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); Document document = documentBuilder.parse(stream); return document; } public void cargarBD(){ System.out.println("Antes de cargar bd"); } private void imprimeCategorias(){ for (Categoria cat : categorias) { System.out.println("ID: " + cat.getId() + " SECCION: " + cat.getSeccion()); } } private void imprimeMarcas(){ for (Marca marca : marcas) { System.out.println("ID: " + marca.getId() + " NOMBRE: " + marca.getNombre()); } } private void imprimeTipos(){ for (Tipo tipo : tipos) { System.out.println("ID: " + tipo.getId() + " NOMBRE: " + tipo.getNombre()); } } }
11,622
0.580193
0.574772
337
33.489613
27.263643
119
false
false
0
0
0
0
0
0
0.525223
false
false
13
68e5dc51a6d8b6d6a78bb6d17cabe956152a5bac
15,066,745,326,912
95e33b0c7fda00c71d8b7592928ee03ec5fa9f67
/src/main/java/com/as/backend/antscience/exceptions/InvalidParamsException.java
19853809d25924b4b634a95a459e629ff0753e60
[]
no_license
rayest/AntScienceBackend
https://github.com/rayest/AntScienceBackend
899a8c7ed5b6876a8527e991629bdcfdc61f1bd6
c1e448e3d23bc694528e6f9faac845ccb3857b6b
refs/heads/master
2021-05-09T11:28:22.350000
2018-03-01T10:02:29
2018-03-01T10:02:29
118,927,488
0
0
null
true
2018-01-25T15:02:32
2018-01-25T15:02:31
2018-01-08T17:03:46
2018-01-25T14:39:51
87
0
0
0
null
false
null
package com.as.backend.antscience.exceptions; /** * Created by xubt on 8/24/16. */ public class InvalidParamsException extends RuntimeException { public InvalidParamsException(String message) { super(message); } }
UTF-8
Java
234
java
InvalidParamsException.java
Java
[ { "context": ".backend.antscience.exceptions;\n\n/**\n * Created by xubt on 8/24/16.\n */\n\npublic class InvalidParamsExcept", "end": 69, "score": 0.9996444582939148, "start": 65, "tag": "USERNAME", "value": "xubt" } ]
null
[]
package com.as.backend.antscience.exceptions; /** * Created by xubt on 8/24/16. */ public class InvalidParamsException extends RuntimeException { public InvalidParamsException(String message) { super(message); } }
234
0.717949
0.696581
11
20.272728
22.201929
62
false
false
0
0
0
0
0
0
0.181818
false
false
13
4ba5f3e5e1443124cc6837b22f3314e0c90f36ab
5,291,399,725,208
32df5b091b36e0155c729d582f5c0dfba2de21f4
/SpellingCorrector/src/spell/Main.java
7d8fc19db0c1a044d5361e6ae8c97458e7b50093
[]
no_license
jordanchip/school-projects
https://github.com/jordanchip/school-projects
adfb2be028a7c93b812b4a2541d516f6520bde1e
b4a99f6874e4934ec18333b2c60022ac95321b7a
refs/heads/master
2020-05-31T01:16:03.567000
2015-09-23T17:06:34
2015-09-23T17:06:34
42,881,883
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package spell; import java.io.IOException; import spell.ISpellCorrector.NoSimilarWordFoundException; /** * A simple main class for running the spelling corrector. This class is not * used by the passoff program. */ public class Main { /** * Give the dictionary file name as the first argument and the word to correct * as the second argument. */ public static void main(String[] args) throws NoSimilarWordFoundException, IOException { String dict = args[0]; String word = args[1]; ISpellCorrector corrector = new SpellCorrector(); corrector.useDictionary(dict); System.out.println("Suggestion is: " + corrector.suggestSimilarWord(word)); } }
UTF-8
Java
679
java
Main.java
Java
[]
null
[]
package spell; import java.io.IOException; import spell.ISpellCorrector.NoSimilarWordFoundException; /** * A simple main class for running the spelling corrector. This class is not * used by the passoff program. */ public class Main { /** * Give the dictionary file name as the first argument and the word to correct * as the second argument. */ public static void main(String[] args) throws NoSimilarWordFoundException, IOException { String dict = args[0]; String word = args[1]; ISpellCorrector corrector = new SpellCorrector(); corrector.useDictionary(dict); System.out.println("Suggestion is: " + corrector.suggestSimilarWord(word)); } }
679
0.731959
0.729013
28
23.25
27.903692
89
false
false
0
0
0
0
0
0
1.142857
false
false
13
f0691537970dfa29ff63abfbb01c839d4cbad64c
17,669,495,503,047
c4794589a86698e2653e9f5277dbfc8997df2a43
/Clown 2.4/src/view/ResultTable.java
c0346622ee3cccb6ea8dea42e3d349548229f9b5
[]
no_license
Eduardoavargas/clowndb
https://github.com/Eduardoavargas/clowndb
55de4ee9de5e1fd2d12bb3ba84092acde2b018bd
028a450d4e77235de020111b625a7386ca2d5b65
refs/heads/master
2021-01-10T17:11:37.991000
2010-03-24T15:30:17
2010-03-24T15:30:17
49,994,842
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package view; import java.awt.Dimension; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.util.ArrayList; import java.util.List; import javax.swing.JTable; import javax.swing.event.ListSelectionListener; import javax.swing.table.DefaultTableModel; import control.ActionManager; import model.Cloth; @SuppressWarnings("serial") public class ResultTable extends JTable implements MouseListener { private MyDefaultTableModel tableModel; private List<Cloth> clothes; private PopupMenu popupMenu; public ResultTable(ActionManager am){ tableModel = new MyDefaultTableModel(); String[] names = {"Nro. Articulo", "Código", "Descripcion", "Color", "Talle", "Costo", "Cantidad", "P. por mayor", "P. por menor", "Sexo", "Año"}; tableModel.setColumnIdentifiers(names); setModel(tableModel); popupMenu = new PopupMenu(am); addMouseListener(this); setSize(new Dimension(1500,400)); } public void addResult(List<Cloth> clothes){ empty(); this.clothes = clothes; for(Cloth cloth : clothes){ addItem(cloth); } } private void addItem(Cloth cloth) { Object[] clothString = new Object[11]; clothString[0] = tableModel.getRowCount() + 1; clothString[1] = cloth.getCode(); clothString[2] = cloth.getDescription(); clothString[3] = cloth.getColor().toString(); clothString[4] = cloth.getSize(); clothString[5] = cloth.getCost(); clothString[6] = cloth.getAmount(); clothString[7] = cloth.getWholesalePrice(); clothString[8] = cloth.getRetailPrice(); clothString[9] = cloth.getSex(); clothString[10] = cloth.getYear(); tableModel.addRow(clothString); } public void empty(){ for (int i = tableModel.getRowCount() - 1; i >= 0; i--) { tableModel.removeRow(i); } } public List<Cloth> getSelectedObjects() { int[] selected = getSelectedRows(); List<Cloth> selectedClothes = new ArrayList<Cloth>(); for (int i = 0; i < selected.length; i++) { selectedClothes.add(clothes.get(i)); } return selectedClothes; } public void remove(Cloth cloth) { for (int i = tableModel.getRowCount() - 1; i >= 0; i--) { if(cloth.getCode().equalsIgnoreCase((String) tableModel.getValueAt(i, 1))){ tableModel.removeRow(i); break; } } } public Cloth getItem(int index) { return clothes.get(index); } public void addSelectionListener(ListSelectionListener listener){ getSelectionModel().addListSelectionListener(listener); } public void modifyCloth(Cloth cloth) { empty(); addResult(clothes); } class MyDefaultTableModel extends DefaultTableModel{ public MyDefaultTableModel() { super(); } public boolean isCellEditable(int row, int col) { return false; } } public void mouseClicked(MouseEvent e) { if(e.getModifiers()== e.BUTTON3_MASK) popupMenu.show(this, e.getX(), e.getY()); } public void mouseEntered(MouseEvent arg0) {} public void mouseExited(MouseEvent arg0) {} public void mousePressed(MouseEvent arg0) {} public void mouseReleased(MouseEvent arg0) {} }
ISO-8859-1
Java
3,153
java
ResultTable.java
Java
[]
null
[]
package view; import java.awt.Dimension; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.util.ArrayList; import java.util.List; import javax.swing.JTable; import javax.swing.event.ListSelectionListener; import javax.swing.table.DefaultTableModel; import control.ActionManager; import model.Cloth; @SuppressWarnings("serial") public class ResultTable extends JTable implements MouseListener { private MyDefaultTableModel tableModel; private List<Cloth> clothes; private PopupMenu popupMenu; public ResultTable(ActionManager am){ tableModel = new MyDefaultTableModel(); String[] names = {"Nro. Articulo", "Código", "Descripcion", "Color", "Talle", "Costo", "Cantidad", "P. por mayor", "P. por menor", "Sexo", "Año"}; tableModel.setColumnIdentifiers(names); setModel(tableModel); popupMenu = new PopupMenu(am); addMouseListener(this); setSize(new Dimension(1500,400)); } public void addResult(List<Cloth> clothes){ empty(); this.clothes = clothes; for(Cloth cloth : clothes){ addItem(cloth); } } private void addItem(Cloth cloth) { Object[] clothString = new Object[11]; clothString[0] = tableModel.getRowCount() + 1; clothString[1] = cloth.getCode(); clothString[2] = cloth.getDescription(); clothString[3] = cloth.getColor().toString(); clothString[4] = cloth.getSize(); clothString[5] = cloth.getCost(); clothString[6] = cloth.getAmount(); clothString[7] = cloth.getWholesalePrice(); clothString[8] = cloth.getRetailPrice(); clothString[9] = cloth.getSex(); clothString[10] = cloth.getYear(); tableModel.addRow(clothString); } public void empty(){ for (int i = tableModel.getRowCount() - 1; i >= 0; i--) { tableModel.removeRow(i); } } public List<Cloth> getSelectedObjects() { int[] selected = getSelectedRows(); List<Cloth> selectedClothes = new ArrayList<Cloth>(); for (int i = 0; i < selected.length; i++) { selectedClothes.add(clothes.get(i)); } return selectedClothes; } public void remove(Cloth cloth) { for (int i = tableModel.getRowCount() - 1; i >= 0; i--) { if(cloth.getCode().equalsIgnoreCase((String) tableModel.getValueAt(i, 1))){ tableModel.removeRow(i); break; } } } public Cloth getItem(int index) { return clothes.get(index); } public void addSelectionListener(ListSelectionListener listener){ getSelectionModel().addListSelectionListener(listener); } public void modifyCloth(Cloth cloth) { empty(); addResult(clothes); } class MyDefaultTableModel extends DefaultTableModel{ public MyDefaultTableModel() { super(); } public boolean isCellEditable(int row, int col) { return false; } } public void mouseClicked(MouseEvent e) { if(e.getModifiers()== e.BUTTON3_MASK) popupMenu.show(this, e.getX(), e.getY()); } public void mouseEntered(MouseEvent arg0) {} public void mouseExited(MouseEvent arg0) {} public void mousePressed(MouseEvent arg0) {} public void mouseReleased(MouseEvent arg0) {} }
3,153
0.680419
0.669946
118
24.720339
20.797606
89
false
false
0
0
0
0
0
0
1.923729
false
false
13
15cafb51486c16b96cf95d3a3d1f570b897bbaf0
34,437,047,780,993
c309358bb42528674d9449f29bbd8f7f36136678
/usbdeviceenumerator/src/main/java/uk/co/alt236/usbdeviceenumerator/sysbususb/SysBusUsbManager.java
7ca03abc65d3d60f2d482dd787c14d22f55b367c
[ "Apache-2.0" ]
permissive
xiat0tim/USB-Device-Info---Android
https://github.com/xiat0tim/USB-Device-Info---Android
3926bd9da991eec0244d370084a75e8b400215b6
4936b470ffaff85c6b50c6743308e1b8651a93b1
refs/heads/master
2020-07-04T05:36:49.796000
2016-11-16T10:56:31
2016-11-16T10:56:31
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/******************************************************************************* * Copyright 2011 Alexandros Schillings * <p/> * 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 * <p/> * http://www.apache.org/licenses/LICENSE-2.0 * <p/> * 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 uk.co.alt236.usbdeviceenumerator.sysbususb; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.HashMap; public class SysBusUsbManager { private static final String PATH_SYS_BUS_USB = "/sys/bus/usb/devices/"; private static final String DEVICE_START = "__DEV_START__"; private static final String DEVICE_END = "__DEV_END__"; private static final String COMMAND_GET_USB_INFO = "for DEVICE in /sys/bus/usb/devices/*; do " + " echo " + DEVICE_START + ";" + " [ -f $DEVICE/idProduct ] && echo PID: $(cat $DEVICE/idProduct);" + " [ -f $DEVICE/idVendor ] && echo BUSNUM: $(cat $DEVICE/busnum);" + " [ -f $DEVICE/idVendor ] && echo DEVCLASS: $(cat $DEVICE/bDeviceClass);" + " [ -f $DEVICE/idVendor ] && echo DEVNUM: $(cat $DEVICE/devnum);" + " [ -f $DEVICE/idVendor ] && echo DEVPROTOCOL: $(cat $DEVICE/bDeviceProtocol);" + " [ -f $DEVICE/idVendor ] && echo DEVSUBCLASS: $(cat $DEVICE/bDeviceSubClass);" + " [ -f $DEVICE/idVendor ] && echo MAXPOWER: $(cat $DEVICE/bMaxPower);" + " [ -f $DEVICE/idVendor ] && echo SERIAL: $(cat $DEVICE/serial);" + " [ -f $DEVICE/idVendor ] && echo SPEED: $(cat $DEVICE/speed);" + " [ -f $DEVICE/idVendor ] && echo VERSION: $(cat $DEVICE/version);" + " [ -f $DEVICE/idVendor ] && echo VID: $(cat $DEVICE/idVendor);" + " [ -f $DEVICE/product ] && echo MANUFACTURER: $(cat $DEVICE/manufacturer);" + " [ -f $DEVICE/product ] && echo PRODUCT: $(cat $DEVICE/product);" + " echo " + DEVICE_END + ";" + " done"; //final String TAG = this.getClass().getName(); private HashMap<String, SysBusUsbDevice> myUsbDevices; public SysBusUsbManager() { myUsbDevices = new HashMap<String, SysBusUsbDevice>(); } public static String getUsbInfoViaShell() { String res = (new ExecTerminal()).exec(COMMAND_GET_USB_INFO); res = res.replace(DEVICE_START + "\n" + DEVICE_END + "\n", ""); return res; } public HashMap<String, SysBusUsbDevice> getUsbDevices() { populateList(PATH_SYS_BUS_USB); return myUsbDevices; } private void populateList(String path) { SysBusUsbDevice usb; myUsbDevices.clear(); File dir = new File(path); if (!dir.isDirectory()) { return; } for (File child : dir.listFiles()) { if (".".equals(child.getName()) || "..".equals(child.getName())) { continue; // Ignore the self and parent aliases. } String parentPath = child.getAbsolutePath() + File.separator; usb = new SysBusUsbDevice(); usb.setDevicePath(parentPath); usb.setBusNumber(readFileContents(parentPath + "busnum")); usb.setDeviceClass(readFileContents(parentPath + "bDeviceClass")); usb.setDeviceNumber(readFileContents(parentPath + "devnum")); usb.setDeviceProtocol(readFileContents(parentPath + "bDeviceProtocol")); usb.setDeviceSubClass(readFileContents(parentPath + "bDeviceSubClass")); usb.setMaxPower(readFileContents(parentPath + "bMaxPower")); usb.setPID(readFileContents(parentPath + "idProduct")); usb.setReportedProductName(readFileContents(parentPath + "product")); usb.setReportedVendorName(readFileContents(parentPath + "manufacturer")); usb.setSerialNumber(readFileContents(parentPath + "serial")); usb.setSpeed(readFileContents(parentPath + "speed")); usb.setVID(readFileContents(parentPath + "idVendor")); usb.setUsbVersion(readFileContents(parentPath + "version")); if (usb.getBusNumber().length() > 0 && usb.getDeviceNumber().length() > 0) { String key = child.getName(); myUsbDevices.put(key, usb); } } } private String readFileContents(String filePath) { File file = new File(filePath); if (!file.exists()) { return ""; } if (file.isDirectory()) { return ""; } StringBuffer fileData = new StringBuffer(1000); BufferedReader reader; try { reader = new BufferedReader(new FileReader(filePath)); char[] buf = new char[1024]; int numRead = 0; while ((numRead = reader.read(buf)) != -1) { String readData = String.valueOf(buf, 0, numRead); fileData.append(readData); buf = new char[1024]; } reader.close(); } catch (FileNotFoundException e) { e.printStackTrace(); return ""; } catch (IOException e) { e.printStackTrace(); return ""; } String res = fileData.toString(); if (res == null) { res = ""; } return res.trim(); } }
UTF-8
Java
5,919
java
SysBusUsbManager.java
Java
[ { "context": "********************************\n * Copyright 2011 Alexandros Schillings\n * <p/>\n * Licensed under the Apache License, Ver", "end": 120, "score": 0.9998156428337097, "start": 99, "tag": "NAME", "value": "Alexandros Schillings" }, { "context": "ber().length() > 0) {\n String key = child.getName();\n myUsbDevices.put(key, usb);\n ", "end": 4788, "score": 0.9753015637397766, "start": 4775, "tag": "KEY", "value": "child.getName" } ]
null
[]
/******************************************************************************* * Copyright 2011 <NAME> * <p/> * 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 * <p/> * http://www.apache.org/licenses/LICENSE-2.0 * <p/> * 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 uk.co.alt236.usbdeviceenumerator.sysbususb; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.HashMap; public class SysBusUsbManager { private static final String PATH_SYS_BUS_USB = "/sys/bus/usb/devices/"; private static final String DEVICE_START = "__DEV_START__"; private static final String DEVICE_END = "__DEV_END__"; private static final String COMMAND_GET_USB_INFO = "for DEVICE in /sys/bus/usb/devices/*; do " + " echo " + DEVICE_START + ";" + " [ -f $DEVICE/idProduct ] && echo PID: $(cat $DEVICE/idProduct);" + " [ -f $DEVICE/idVendor ] && echo BUSNUM: $(cat $DEVICE/busnum);" + " [ -f $DEVICE/idVendor ] && echo DEVCLASS: $(cat $DEVICE/bDeviceClass);" + " [ -f $DEVICE/idVendor ] && echo DEVNUM: $(cat $DEVICE/devnum);" + " [ -f $DEVICE/idVendor ] && echo DEVPROTOCOL: $(cat $DEVICE/bDeviceProtocol);" + " [ -f $DEVICE/idVendor ] && echo DEVSUBCLASS: $(cat $DEVICE/bDeviceSubClass);" + " [ -f $DEVICE/idVendor ] && echo MAXPOWER: $(cat $DEVICE/bMaxPower);" + " [ -f $DEVICE/idVendor ] && echo SERIAL: $(cat $DEVICE/serial);" + " [ -f $DEVICE/idVendor ] && echo SPEED: $(cat $DEVICE/speed);" + " [ -f $DEVICE/idVendor ] && echo VERSION: $(cat $DEVICE/version);" + " [ -f $DEVICE/idVendor ] && echo VID: $(cat $DEVICE/idVendor);" + " [ -f $DEVICE/product ] && echo MANUFACTURER: $(cat $DEVICE/manufacturer);" + " [ -f $DEVICE/product ] && echo PRODUCT: $(cat $DEVICE/product);" + " echo " + DEVICE_END + ";" + " done"; //final String TAG = this.getClass().getName(); private HashMap<String, SysBusUsbDevice> myUsbDevices; public SysBusUsbManager() { myUsbDevices = new HashMap<String, SysBusUsbDevice>(); } public static String getUsbInfoViaShell() { String res = (new ExecTerminal()).exec(COMMAND_GET_USB_INFO); res = res.replace(DEVICE_START + "\n" + DEVICE_END + "\n", ""); return res; } public HashMap<String, SysBusUsbDevice> getUsbDevices() { populateList(PATH_SYS_BUS_USB); return myUsbDevices; } private void populateList(String path) { SysBusUsbDevice usb; myUsbDevices.clear(); File dir = new File(path); if (!dir.isDirectory()) { return; } for (File child : dir.listFiles()) { if (".".equals(child.getName()) || "..".equals(child.getName())) { continue; // Ignore the self and parent aliases. } String parentPath = child.getAbsolutePath() + File.separator; usb = new SysBusUsbDevice(); usb.setDevicePath(parentPath); usb.setBusNumber(readFileContents(parentPath + "busnum")); usb.setDeviceClass(readFileContents(parentPath + "bDeviceClass")); usb.setDeviceNumber(readFileContents(parentPath + "devnum")); usb.setDeviceProtocol(readFileContents(parentPath + "bDeviceProtocol")); usb.setDeviceSubClass(readFileContents(parentPath + "bDeviceSubClass")); usb.setMaxPower(readFileContents(parentPath + "bMaxPower")); usb.setPID(readFileContents(parentPath + "idProduct")); usb.setReportedProductName(readFileContents(parentPath + "product")); usb.setReportedVendorName(readFileContents(parentPath + "manufacturer")); usb.setSerialNumber(readFileContents(parentPath + "serial")); usb.setSpeed(readFileContents(parentPath + "speed")); usb.setVID(readFileContents(parentPath + "idVendor")); usb.setUsbVersion(readFileContents(parentPath + "version")); if (usb.getBusNumber().length() > 0 && usb.getDeviceNumber().length() > 0) { String key = child.getName(); myUsbDevices.put(key, usb); } } } private String readFileContents(String filePath) { File file = new File(filePath); if (!file.exists()) { return ""; } if (file.isDirectory()) { return ""; } StringBuffer fileData = new StringBuffer(1000); BufferedReader reader; try { reader = new BufferedReader(new FileReader(filePath)); char[] buf = new char[1024]; int numRead = 0; while ((numRead = reader.read(buf)) != -1) { String readData = String.valueOf(buf, 0, numRead); fileData.append(readData); buf = new char[1024]; } reader.close(); } catch (FileNotFoundException e) { e.printStackTrace(); return ""; } catch (IOException e) { e.printStackTrace(); return ""; } String res = fileData.toString(); if (res == null) { res = ""; } return res.trim(); } }
5,904
0.572901
0.56817
147
39.265305
29.511747
100
false
false
0
0
0
0
0
0
0.619048
false
false
13
3f35635f3b3e6df52d7c3f45386708f89ce0f456
27,736,898,798,809
cfa8f16c57f916ce1314b36d72fcad14c4f312c4
/src/test/java/com/codeshelf/edi/YetAnotherOutboundOrderImporterTest.java
1e20e7db852c57f0965d2b6aca6e85ffbcd53403
[]
no_license
bellmit/Codeshelf
https://github.com/bellmit/Codeshelf
e82049e29c600b14f656f86493d1efd5e5103388
db37a274660479795c3c785446e927402dfed7c3
refs/heads/master
2022-03-04T15:57:12.434000
2016-04-26T22:57:30
2016-04-26T22:57:30
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/******************************************************************************* * CodeShelf * Copyright (c) 2005-2015, All rights reserved *******************************************************************************/ package com.codeshelf.edi; import java.io.IOException; import java.util.UUID; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.codeshelf.model.domain.Facility; import com.codeshelf.model.domain.OrderDetail; import com.codeshelf.model.domain.OrderHeader; import com.codeshelf.model.domain.Point; import com.codeshelf.testframework.ServerTest; /** * It's time to start another test, since the other order import test class has almost 2000 lines now... */ public class YetAnotherOutboundOrderImporterTest extends ServerTest { @SuppressWarnings("unused") private static final Logger LOGGER = LoggerFactory.getLogger(YetAnotherOutboundOrderImporterTest.class); private UUID facilityId; @Before public void doBefore() { super.doBefore(); this.getTenantPersistenceService().beginTransaction(); facilityId = getTestFacility("O-" + getTestName(), "F-" + getTestName()).getPersistentId(); this.getTenantPersistenceService().commitTransaction(); } @Test public final void testNeedsScanField() throws IOException { beginTransaction(); Facility facility = Facility.staticGetDao().findByPersistentId(this.facilityId); String csvString = "orderGroupId,shipmentId,customerId,preAssignedContainerId,orderId,itemId,description,quantity,uom,orderDate,dueDate,workSequence,needsScan" + "\r\n1,USF314,COSTCO,123,123,10700589,Napa Valley Bistro - Jalape������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������o Stuffed Olives,1,each,2012-09-26 11:31:01,2012-09-26 11:31:03,0,yes" + "\r\n1,USF314,COSTCO,123,123,10706952,Italian Homemade Style Basil Pesto,1,each,2012-09-26 11:31:01,2012-09-26 11:31:03,0,no" + "\r\n1,USF314,COSTCO,123,123,10706962,Authentic Pizza Sauces,1,each,2012-09-26 11:31:01,2012-09-26 11:31:03,0,"; importOrdersData(facility, csvString); commitTransaction(); beginTransaction(); facility = facility.reload(); OrderHeader order = OrderHeader.staticGetDao().findByDomainId(facility, "123"); Assert.assertNotNull(order); Integer detailCount = order.getOrderDetails().size(); Assert.assertEquals((Integer) 3, detailCount); // ensure "yes" is interpreted as true OrderDetail detail1 = order.getOrderDetail("10700589-each"); Assert.assertNotNull(detail1); Assert.assertSame(true, detail1.getNeedsScan()); // ensure "no" is interpreted as false OrderDetail detail2 = order.getOrderDetail("10706952-each"); Assert.assertNotNull(detail2); Assert.assertSame(false, detail2.getNeedsScan()); // ensure undefined field is interpreted as false OrderDetail detail3 = order.getOrderDetail("10706962-each"); Assert.assertNotNull(detail3); Assert.assertSame(false, detail3.getNeedsScan()); commitTransaction(); } //******************** private helpers *********************** private Facility getTestFacility(String orgId, String facilityId) { Facility facility = Facility.createFacility(facilityId, "TEST", Point.getZeroPoint()); return facility; } }
UTF-8
Java
4,674
java
YetAnotherOutboundOrderImporterTest.java
Java
[]
null
[]
/******************************************************************************* * CodeShelf * Copyright (c) 2005-2015, All rights reserved *******************************************************************************/ package com.codeshelf.edi; import java.io.IOException; import java.util.UUID; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.codeshelf.model.domain.Facility; import com.codeshelf.model.domain.OrderDetail; import com.codeshelf.model.domain.OrderHeader; import com.codeshelf.model.domain.Point; import com.codeshelf.testframework.ServerTest; /** * It's time to start another test, since the other order import test class has almost 2000 lines now... */ public class YetAnotherOutboundOrderImporterTest extends ServerTest { @SuppressWarnings("unused") private static final Logger LOGGER = LoggerFactory.getLogger(YetAnotherOutboundOrderImporterTest.class); private UUID facilityId; @Before public void doBefore() { super.doBefore(); this.getTenantPersistenceService().beginTransaction(); facilityId = getTestFacility("O-" + getTestName(), "F-" + getTestName()).getPersistentId(); this.getTenantPersistenceService().commitTransaction(); } @Test public final void testNeedsScanField() throws IOException { beginTransaction(); Facility facility = Facility.staticGetDao().findByPersistentId(this.facilityId); String csvString = "orderGroupId,shipmentId,customerId,preAssignedContainerId,orderId,itemId,description,quantity,uom,orderDate,dueDate,workSequence,needsScan" + "\r\n1,USF314,COSTCO,123,123,10700589,Napa Valley Bistro - Jalape������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������o Stuffed Olives,1,each,2012-09-26 11:31:01,2012-09-26 11:31:03,0,yes" + "\r\n1,USF314,COSTCO,123,123,10706952,Italian Homemade Style Basil Pesto,1,each,2012-09-26 11:31:01,2012-09-26 11:31:03,0,no" + "\r\n1,USF314,COSTCO,123,123,10706962,Authentic Pizza Sauces,1,each,2012-09-26 11:31:01,2012-09-26 11:31:03,0,"; importOrdersData(facility, csvString); commitTransaction(); beginTransaction(); facility = facility.reload(); OrderHeader order = OrderHeader.staticGetDao().findByDomainId(facility, "123"); Assert.assertNotNull(order); Integer detailCount = order.getOrderDetails().size(); Assert.assertEquals((Integer) 3, detailCount); // ensure "yes" is interpreted as true OrderDetail detail1 = order.getOrderDetail("10700589-each"); Assert.assertNotNull(detail1); Assert.assertSame(true, detail1.getNeedsScan()); // ensure "no" is interpreted as false OrderDetail detail2 = order.getOrderDetail("10706952-each"); Assert.assertNotNull(detail2); Assert.assertSame(false, detail2.getNeedsScan()); // ensure undefined field is interpreted as false OrderDetail detail3 = order.getOrderDetail("10706962-each"); Assert.assertNotNull(detail3); Assert.assertSame(false, detail3.getNeedsScan()); commitTransaction(); } //******************** private helpers *********************** private Facility getTestFacility(String orgId, String facilityId) { Facility facility = Facility.createFacility(facilityId, "TEST", Point.getZeroPoint()); return facility; } }
4,674
0.621826
0.569152
88
41.06818
71.416321
627
false
false
0
0
0
0
0
0
2.238636
false
false
13
d842b16b2bc4cc14ab26468a28805a7836456572
21,028,159,941,151
c2e6f7c40edce79fd498a5bbaba4c2d69cf05e0c
/src/main/java/com/google/android/gms/internal/ads_identifier/zzg.java
3d76322cf67e951e5a534c35f073a192a4644526
[]
no_license
pengju1218/decompiled-apk
https://github.com/pengju1218/decompiled-apk
7f64ee6b2d7424b027f4f112c77e47cd420b2b8c
b60b54342a8e294486c45b2325fb78155c3c37e6
refs/heads/master
2022-03-23T02:57:09.115000
2019-12-28T23:13:07
2019-12-28T23:13:07
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.google.android.gms.internal.ads_identifier; import android.os.IBinder; import android.os.Parcel; public final class zzg extends zza implements zze { zzg(IBinder iBinder) { super(iBinder, "com.google.android.gms.ads.identifier.internal.IAdvertisingIdService"); } public final String getId() { Parcel a = a(1, a()); String readString = a.readString(); a.recycle(); return readString; } public final boolean zzb(boolean z) { Parcel a = a(); zzc.zza(a, true); Parcel a2 = a(2, a); boolean zza = zzc.zza(a2); a2.recycle(); return zza; } public final boolean zzc() { Parcel a = a(6, a()); boolean zza = zzc.zza(a); a.recycle(); return zza; } }
UTF-8
Java
807
java
zzg.java
Java
[]
null
[]
package com.google.android.gms.internal.ads_identifier; import android.os.IBinder; import android.os.Parcel; public final class zzg extends zza implements zze { zzg(IBinder iBinder) { super(iBinder, "com.google.android.gms.ads.identifier.internal.IAdvertisingIdService"); } public final String getId() { Parcel a = a(1, a()); String readString = a.readString(); a.recycle(); return readString; } public final boolean zzb(boolean z) { Parcel a = a(); zzc.zza(a, true); Parcel a2 = a(2, a); boolean zza = zzc.zza(a2); a2.recycle(); return zza; } public final boolean zzc() { Parcel a = a(6, a()); boolean zza = zzc.zza(a); a.recycle(); return zza; } }
807
0.576208
0.568773
33
23.454546
19.63468
95
false
false
0
0
0
0
0
0
0.69697
false
false
13
98703729a340c2d32aec060e21cec69a92575445
34,359,738,375,547
25acb8e655bdfe4d95ed488a9fd4fe51087d7827
/kodilla-basic-tests/src/main/java/com/kodilla/abstracts/homework/Shape.java
adc7c1c89c225ece16b26c2b7a451a3c077b6aea
[]
no_license
KrzysztofT1990/Krzysztof_Tracz-kodilla_tester
https://github.com/KrzysztofT1990/Krzysztof_Tracz-kodilla_tester
ec48e8ee7ec0c30ae73adfc8794fabc8efd86fda
441df64706e3258ae3a38d926c7f54c7f2cb2f3c
refs/heads/master
2023-05-31T10:15:28.520000
2021-06-21T17:24:10
2021-06-21T17:24:10
342,929,195
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.kodilla.abstracts.homework; public abstract class Shape { double polePowierzchni; double obwód; private double a; private double b; public Shape(double bokA, double bokB) { this.a = bokA; this.b = bokB; } public abstract double PolePowierzchni(double a, double b); public abstract double Obwód(double a, double b); public double getA() { return a; } public double getB() { return b; } }
UTF-8
Java
489
java
Shape.java
Java
[]
null
[]
package com.kodilla.abstracts.homework; public abstract class Shape { double polePowierzchni; double obwód; private double a; private double b; public Shape(double bokA, double bokB) { this.a = bokA; this.b = bokB; } public abstract double PolePowierzchni(double a, double b); public abstract double Obwód(double a, double b); public double getA() { return a; } public double getB() { return b; } }
489
0.61807
0.61807
27
17.037037
17.334362
63
false
false
0
0
0
0
0
0
0.518519
false
false
13
341df20e8da2481c56d8334ba3d84a21aec50813
936,302,919,890
d3d5958ce349e771b46bd357158b87ff2116c147
/src/SbeBankTaskInterview.java
dbf838a096c9f8d8f5eeab371e92363a48ca3953
[]
no_license
VladimirZhdanov/SbeBankTaskInterview
https://github.com/VladimirZhdanov/SbeBankTaskInterview
de986efe92fd1ff68b6897894db72f6fd84eafc4
f9946331b4cb7d68b730a2ff4591e7f9710e681c
refs/heads/master
2023-07-07T22:06:48.466000
2021-08-08T09:42:31
2021-08-08T09:42:31
393,917,436
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.math.BigDecimal; import java.util.*; import java.util.stream.Collectors; public class SbeBankTaskInterview { public static void main(String[] args) { Facture facture1 = new Facture("1", BigDecimal.TEN); Facture facture2 = new Facture("1", BigDecimal.TEN); Facture facture3 = new Facture("2", BigDecimal.TEN); Facture facture4 = new Facture("2", BigDecimal.ONE); List<Facture> factures = Arrays.asList(facture1, facture2, facture3, facture4); // 0. Общая сумма BigDecimal sum = factures.stream() .map(Facture::getSum) .filter(Objects::nonNull) .reduce(BigDecimal.ZERO, BigDecimal::add); System.out.println(sum); // 1. Сгруппировать счета с Facture Map<String, List<Facture>> accountMap = new HashMap<>(); factures.stream() .map(Facture::getAccount) .collect(Collectors.toSet()) .forEach(account -> factures.stream() .filter(it -> account.equals(it.account)) .forEach(facture -> { if (!accountMap.containsKey(account)) { accountMap.put(account, new ArrayList<>(Collections.singletonList(facture))); } else { accountMap.get(account).add(facture); } })); System.out.println(accountMap); // 2. Суммировать сумму по аккаунтам Map<String, BigDecimal> mapSum = new HashMap<>(); accountMap.forEach((k, v) -> { BigDecimal sumByAccount = v.stream() .map(Facture::getSum) .reduce(BigDecimal.ZERO, BigDecimal::add); mapSum.put(k, sumByAccount); }); System.out.println(mapSum); } static class Facture { private String account; private BigDecimal sum; public Facture(String account, BigDecimal sum) { this.account = account; this.sum = sum; } public String getAccount() { return account; } public void setAccount(String account) { this.account = account; } public BigDecimal getSum() { return sum; } public void setSum(BigDecimal sum) { this.sum = sum; } @Override public String toString() { return "Facture{" + "account='" + account + '\'' + ", sum=" + sum + '}'; } } }
UTF-8
Java
2,736
java
SbeBankTaskInterview.java
Java
[]
null
[]
import java.math.BigDecimal; import java.util.*; import java.util.stream.Collectors; public class SbeBankTaskInterview { public static void main(String[] args) { Facture facture1 = new Facture("1", BigDecimal.TEN); Facture facture2 = new Facture("1", BigDecimal.TEN); Facture facture3 = new Facture("2", BigDecimal.TEN); Facture facture4 = new Facture("2", BigDecimal.ONE); List<Facture> factures = Arrays.asList(facture1, facture2, facture3, facture4); // 0. Общая сумма BigDecimal sum = factures.stream() .map(Facture::getSum) .filter(Objects::nonNull) .reduce(BigDecimal.ZERO, BigDecimal::add); System.out.println(sum); // 1. Сгруппировать счета с Facture Map<String, List<Facture>> accountMap = new HashMap<>(); factures.stream() .map(Facture::getAccount) .collect(Collectors.toSet()) .forEach(account -> factures.stream() .filter(it -> account.equals(it.account)) .forEach(facture -> { if (!accountMap.containsKey(account)) { accountMap.put(account, new ArrayList<>(Collections.singletonList(facture))); } else { accountMap.get(account).add(facture); } })); System.out.println(accountMap); // 2. Суммировать сумму по аккаунтам Map<String, BigDecimal> mapSum = new HashMap<>(); accountMap.forEach((k, v) -> { BigDecimal sumByAccount = v.stream() .map(Facture::getSum) .reduce(BigDecimal.ZERO, BigDecimal::add); mapSum.put(k, sumByAccount); }); System.out.println(mapSum); } static class Facture { private String account; private BigDecimal sum; public Facture(String account, BigDecimal sum) { this.account = account; this.sum = sum; } public String getAccount() { return account; } public void setAccount(String account) { this.account = account; } public BigDecimal getSum() { return sum; } public void setSum(BigDecimal sum) { this.sum = sum; } @Override public String toString() { return "Facture{" + "account='" + account + '\'' + ", sum=" + sum + '}'; } } }
2,736
0.510448
0.504851
85
30.529411
23.104156
109
false
false
0
0
0
0
0
0
0.529412
false
false
13
7fc1228a96a9bca17bd3c0940489c4b133f98adf
32,641,751,493,151
73c2eb248778f32092ead4a5be7f17928ea651b0
/Struts2_Two_Session/src/com/rebron/loginSession/service/MessageService.java
2a5758cf0b555859f6a6a990398ec39c199a0aec
[]
no_license
Rebronss/Rebrons
https://github.com/Rebronss/Rebrons
8d577e9a5c9a602ace6034f50fe24ca3d874929e
158c468e3693e8cc148a37c2655c1032ec6c37e9
refs/heads/master
2020-04-29T07:59:11.613000
2019-03-16T12:56:57
2019-03-16T12:56:57
175,970,753
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.rebron.loginSession.service; import java.util.List; import com.rebron.loginSession.domain.Message; import com.rebron.loginSession.domain.User; public interface MessageService { boolean addPost(User user,Message message) throws Exception; List<Object> showMyPostById(User user)throws Exception; }
UTF-8
Java
330
java
MessageService.java
Java
[]
null
[]
package com.rebron.loginSession.service; import java.util.List; import com.rebron.loginSession.domain.Message; import com.rebron.loginSession.domain.User; public interface MessageService { boolean addPost(User user,Message message) throws Exception; List<Object> showMyPostById(User user)throws Exception; }
330
0.778788
0.778788
14
21.571428
23.116829
61
false
false
0
0
0
0
0
0
0.642857
false
false
13
d3aac01939998bd961f894e240c13b4eb0b236b2
19,232,863,579,405
adf548c6257b8d0532081474231b18548bd6521f
/src/main/java/edu/utah/nanofab/coralapi/exceptions/CoralConnectionException.java
9858d7cd685184d0f9e85e9a5163a2bfed6a5318
[ "MIT" ]
permissive
ufabdyop/coralapi
https://github.com/ufabdyop/coralapi
3748e8ab460fed5f0d1a92b185482bcc4d3830ab
232a1eb09840c0ce9eee31d9fefb6e1242f08c91
refs/heads/master
2021-01-19T01:28:22.348000
2017-08-23T21:38:25
2017-08-23T21:38:25
30,030,752
1
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.utah.nanofab.coralapi.exceptions; public class CoralConnectionException extends Exception { public CoralConnectionException(String string) { super(string); } }
UTF-8
Java
179
java
CoralConnectionException.java
Java
[]
null
[]
package edu.utah.nanofab.coralapi.exceptions; public class CoralConnectionException extends Exception { public CoralConnectionException(String string) { super(string); } }
179
0.798883
0.798883
9
18.888889
22.912609
57
false
false
0
0
0
0
0
0
0.666667
false
false
13
0fe59affa494f9790faa2e740caf61293abb8fa3
4,045,859,229,846
687d3e80180a1522e0174fc4c2afd53b53d9f981
/Laivanupotus/src/main/java/mainPackage/Main.java
5ac7356879705b16a7c0a9b51a75ca461fb1e698
[]
no_license
vislaava/Laivanupotus
https://github.com/vislaava/Laivanupotus
bcb4f6abd0905dab476dd2eac4a3c4c6bc615a01
c5adef34b036a1f0829e209215e4d5b9c0d1dd9e
refs/heads/master
2016-09-01T17:36:32.824000
2015-05-03T20:42:44
2015-05-03T20:42:44
32,033,258
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * 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 mainPackage; import kayttoliittymaPackage.GUI; import javax.swing.SwingUtilities; import upotus.laivanupotus.pelialusta.tekstikayttis.Peliruutu; import upotus.laivanupotus.pelialusta.Laivavarasto; import upotus.laivanupotus.pelialusta.tekstikayttis.Ruutujenhallitsija; /** * * @author Tanja */ public class Main { public static void main(String [] args) { GUI kayttoliittyma = new GUI(); SwingUtilities.invokeLater(kayttoliittyma); } }
UTF-8
Java
678
java
Main.java
Java
[ { "context": "kstikayttis.Ruutujenhallitsija;\n\n/**\n *\n * @author Tanja\n */\npublic class Main {\n public static void ma", "end": 487, "score": 0.9932307600975037, "start": 482, "tag": "NAME", "value": "Tanja" } ]
null
[]
/* * 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 mainPackage; import kayttoliittymaPackage.GUI; import javax.swing.SwingUtilities; import upotus.laivanupotus.pelialusta.tekstikayttis.Peliruutu; import upotus.laivanupotus.pelialusta.Laivavarasto; import upotus.laivanupotus.pelialusta.tekstikayttis.Ruutujenhallitsija; /** * * @author Tanja */ public class Main { public static void main(String [] args) { GUI kayttoliittyma = new GUI(); SwingUtilities.invokeLater(kayttoliittyma); } }
678
0.737463
0.737463
27
24.111111
24.644634
79
false
false
0
0
0
0
0
0
0.407407
false
false
13
cf357561842e7d0e60ca7727c3218ea9ac3742ab
5,703,716,620,239
a56fd00777838020a44ea4b3c0ca19f2c2a864bd
/domene/src/main/java/no/nav/foreldrepenger/mottak/tjeneste/dokumentforsendelse/DokumentforsendelseTjeneste.java
db498bcb97db68733c5d55b6b4522873210394cf
[ "MIT" ]
permissive
navikt/fpfordel
https://github.com/navikt/fpfordel
22df8eb0d409febef90ebf6609d67e3398f795e6
414969d15ea9250ce998b9807a9fd40ee2cc3f9b
refs/heads/master
2023-07-19T22:13:36.537000
2023-07-13T10:35:03
2023-07-13T10:35:03
204,694,095
3
2
MIT
false
2023-09-13T05:25:42
2019-08-27T12:03:16
2023-01-24T08:27:42
2023-09-13T05:25:42
6,416
4
3
3
Java
false
false
package no.nav.foreldrepenger.mottak.tjeneste.dokumentforsendelse; import no.nav.foreldrepenger.mottak.domene.dokument.Dokument; import no.nav.foreldrepenger.mottak.domene.dokument.DokumentMetadata; import no.nav.foreldrepenger.mottak.tjeneste.dokumentforsendelse.dto.ForsendelseStatusDto; import java.time.Duration; import java.util.List; import java.util.Optional; import java.util.UUID; public interface DokumentforsendelseTjeneste { Duration POLL_INTERVALL = Duration.ofSeconds(1); void lagreForsendelseValider(DokumentMetadata metadata, List<Dokument> dokumenter); ForsendelseStatusDto finnStatusinformasjon(UUID forsendelseId); Optional<ForsendelseStatusDto> finnStatusinformasjonHvisEksisterer(UUID forsendelseId); }
UTF-8
Java
746
java
DokumentforsendelseTjeneste.java
Java
[]
null
[]
package no.nav.foreldrepenger.mottak.tjeneste.dokumentforsendelse; import no.nav.foreldrepenger.mottak.domene.dokument.Dokument; import no.nav.foreldrepenger.mottak.domene.dokument.DokumentMetadata; import no.nav.foreldrepenger.mottak.tjeneste.dokumentforsendelse.dto.ForsendelseStatusDto; import java.time.Duration; import java.util.List; import java.util.Optional; import java.util.UUID; public interface DokumentforsendelseTjeneste { Duration POLL_INTERVALL = Duration.ofSeconds(1); void lagreForsendelseValider(DokumentMetadata metadata, List<Dokument> dokumenter); ForsendelseStatusDto finnStatusinformasjon(UUID forsendelseId); Optional<ForsendelseStatusDto> finnStatusinformasjonHvisEksisterer(UUID forsendelseId); }
746
0.839142
0.837802
20
36.299999
33.214603
91
false
false
0
0
0
0
0
0
0.65
false
false
13
ef30a702f11fd2c1c35f7b3559340092fae33add
3,856,880,693,689
717c58d0bbe61b806360796a61ec4ad7ab817191
/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/detector/server/jpp60/OperateJPP60.java
38e1d5b75e97ef1dd307797ffebd0769cec02d78
[]
no_license
robstryker/jbosstools-integration-tests
https://github.com/robstryker/jbosstools-integration-tests
a4bcd62548c31ae24071d6656fd6a2495421d5fe
eadc2573bfbd61985a1138ad5f6ff14fb9d92481
refs/heads/master
2023-08-30T08:00:38.343000
2015-07-28T14:26:50
2015-07-28T14:49:34
39,847,884
0
0
null
true
2015-07-28T17:23:13
2015-07-28T17:23:12
2015-05-07T15:27:56
2015-07-28T16:04:56
103,005
0
0
0
null
null
null
package org.jboss.tools.runtime.as.ui.bot.test.detector.server.jpp60; import org.jboss.tools.runtime.as.ui.bot.test.template.OperateServerTemplate; public class OperateJPP60 extends OperateServerTemplate { @Override protected String getServerName() { return DetectJPP60.SERVER_NAME; } }
UTF-8
Java
295
java
OperateJPP60.java
Java
[]
null
[]
package org.jboss.tools.runtime.as.ui.bot.test.detector.server.jpp60; import org.jboss.tools.runtime.as.ui.bot.test.template.OperateServerTemplate; public class OperateJPP60 extends OperateServerTemplate { @Override protected String getServerName() { return DetectJPP60.SERVER_NAME; } }
295
0.80339
0.783051
11
25.818182
28.644588
77
false
false
0
0
0
0
0
0
0.727273
false
false
13
5bdec159b073411111ab8cade867510a5d1941b9
11,716,670,840,915
6bcd836f7eb52183700f40e7bff9703e0d3c6a0f
/MiMusEditor/src/ui/table/MiMusTableViewer.java
78644cf98ec7987d06a75df9fc1e73130bb9a4e1
[]
no_license
JavierBJ/MiMus
https://github.com/JavierBJ/MiMus
c5a5c4207d7e9e51ea425704c5a477a7a212984b
adb2d8c9df61c250795f03ccd9508330dee0f8f4
refs/heads/master
2020-03-29T22:25:31.149000
2019-11-04T14:44:04
2019-11-04T14:44:04
150,419,639
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package ui.table; import java.util.Arrays; import java.util.List; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.widgets.Composite; /** * MiMusTableViewer is any Eclipse JFace TableViewer used * in the MiMus application. It contains common functionality * used in the project. * * @author Javier Beltrán Jorba * */ public abstract class MiMusTableViewer { protected Composite parent; protected TableViewer tv; protected String[] columnNames; public MiMusTableViewer(Composite parent) { this.parent = parent; } /** * Creates a JFace TableViewer. */ public abstract TableViewer createTableViewer(); /** * Updates the size of columns. */ public void packColumns() { for (int i = 0; i < columnNames.length; i++) { tv.getTable().getColumn(i).pack(); } } public void refresh() { tv.refresh(); } public List<String> getColumnNames() { return Arrays.asList(columnNames); } public void setColumnNames(String[] columnNames) { this.columnNames = columnNames; } public TableViewer getTv() { return tv; } public void setTv(TableViewer tv) { this.tv = tv; } }
UTF-8
Java
1,141
java
MiMusTableViewer.java
Java
[ { "context": "nctionality\n * used in the project.\n * \n * @author Javier Beltrán Jorba\n *\n */\npublic abstract class MiMusTableViewer {\n\n", "end": 340, "score": 0.9998806118965149, "start": 320, "tag": "NAME", "value": "Javier Beltrán Jorba" } ]
null
[]
package ui.table; import java.util.Arrays; import java.util.List; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.widgets.Composite; /** * MiMusTableViewer is any Eclipse JFace TableViewer used * in the MiMus application. It contains common functionality * used in the project. * * @author <NAME> * */ public abstract class MiMusTableViewer { protected Composite parent; protected TableViewer tv; protected String[] columnNames; public MiMusTableViewer(Composite parent) { this.parent = parent; } /** * Creates a JFace TableViewer. */ public abstract TableViewer createTableViewer(); /** * Updates the size of columns. */ public void packColumns() { for (int i = 0; i < columnNames.length; i++) { tv.getTable().getColumn(i).pack(); } } public void refresh() { tv.refresh(); } public List<String> getColumnNames() { return Arrays.asList(columnNames); } public void setColumnNames(String[] columnNames) { this.columnNames = columnNames; } public TableViewer getTv() { return tv; } public void setTv(TableViewer tv) { this.tv = tv; } }
1,126
0.704386
0.703509
60
18
18.019434
61
false
false
0
0
0
0
0
0
1.1
false
false
13
b2999c441909fc41d02cb5992f58c635773a4d4f
22,703,197,153,621
194360e47e4880b826b24884904c47dae7b4a8aa
/PartTimeGuideSystemv2.2/src/all/parttimeguidesystem/service/GetTopNumbyJobidservice.java
89ba3ec4d02e9ed582e373fcf87666ea3346f075
[]
no_license
super-d2/PartTimeCat
https://github.com/super-d2/PartTimeCat
d52f60206369c29cff7c0b88626a31963749e392
cf7b24a59ad0cff22f9a24f0107add6782cee889
refs/heads/master
2018-01-07T09:18:33.529000
2015-04-06T11:12:47
2015-04-06T11:12:47
33,478,333
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package all.parttimeguidesystem.service; import org.json.JSONException; import org.json.JSONObject; import all.parttimeguidesystem.db.MySharedPreferences; import all.parttimeguidesystem.net.NetJSonGetInfo; import all.parttimeguidesystem.net.NetUrl; import android.app.Activity; import android.os.Handler; import android.os.Message; public class GetTopNumbyJobidservice extends MyService { int goodtimes = 0;// 统计顶的次数 MySharedPreferences sf; public GetTopNumbyJobidservice(Activity activity, Handler handler, Object... objects) { super(activity, handler, objects); } @Override public void doInBackground() { NetJSonGetInfo net = NetJSonGetInfo.getInstance(); JSONObject topNumObject = net.getResultjObject( NetUrl.getIndexByName(NetUrl.GetCommentCountByLeagueAction), this.getParams()); JSONObject cJsonObject = net.getContentObject(topNumObject); if (cJsonObject != null) { try { goodtimes = cJsonObject.getInt("num"); } catch (JSONException e) { e.printStackTrace(); } } Message msg = Message.obtain(); msg.arg1 = goodtimes; this.getHandler().sendMessage(msg); } }
UTF-8
Java
1,180
java
GetTopNumbyJobidservice.java
Java
[]
null
[]
package all.parttimeguidesystem.service; import org.json.JSONException; import org.json.JSONObject; import all.parttimeguidesystem.db.MySharedPreferences; import all.parttimeguidesystem.net.NetJSonGetInfo; import all.parttimeguidesystem.net.NetUrl; import android.app.Activity; import android.os.Handler; import android.os.Message; public class GetTopNumbyJobidservice extends MyService { int goodtimes = 0;// 统计顶的次数 MySharedPreferences sf; public GetTopNumbyJobidservice(Activity activity, Handler handler, Object... objects) { super(activity, handler, objects); } @Override public void doInBackground() { NetJSonGetInfo net = NetJSonGetInfo.getInstance(); JSONObject topNumObject = net.getResultjObject( NetUrl.getIndexByName(NetUrl.GetCommentCountByLeagueAction), this.getParams()); JSONObject cJsonObject = net.getContentObject(topNumObject); if (cJsonObject != null) { try { goodtimes = cJsonObject.getInt("num"); } catch (JSONException e) { e.printStackTrace(); } } Message msg = Message.obtain(); msg.arg1 = goodtimes; this.getHandler().sendMessage(msg); } }
1,180
0.735445
0.733733
42
25.809525
20.163898
67
false
false
0
0
0
0
0
0
1.857143
false
false
13
68b5fa99c4c076ab48684accd3be04d90e61f07d
22,703,197,152,209
8cce28417868ba8cf86dbe9b3cb11fd86b57b1b1
/viewutil_lib/src/main/java/cn/qaii/viewutil_lib/util/JsonUtil.java
ea4ae20ff277c001d838fac910c92dbd09443aa3
[]
no_license
yixiugeaaa/IntelligentGateway
https://github.com/yixiugeaaa/IntelligentGateway
f934ec951fa9ff59ca8911af8b1e522af4e63f7a
a75e780a32d4ef1d4d7496894236be53e93f3cb5
refs/heads/master
2021-01-10T01:05:53.483000
2016-04-01T08:18:01
2016-04-01T08:18:01
53,634,073
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.qaii.viewutil_lib.util; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.List; import org.json.JSONArray; import org.json.JSONException; import com.google.gson.Gson; /** * * JsonUtil * * @author larry 2015-11-3 下午2:49:21 * @version 1.0.0 * */ public class JsonUtil { /** * 对象转换成json字符串 * * @param obj * @return */ public static String toJson(Object obj) { Gson gson = new Gson(); return gson.toJson(obj); } /** * json字符串转成对象 * * @param str * @param type * @return */ public static <T> T fromJson(String str, Type type) { Gson gson = new Gson(); return gson.fromJson(str, type); } /** * 解析数组 * * @param array * @param class1 * @return * @throws JSONException */ public static <T> List<T> getList(String json, Class<T> class1){ List<T> list = new ArrayList<T>(); try { if (json != null && json.startsWith("\ufeff")) { json = json.substring(1); } JSONArray array = new JSONArray(json); for (int i = 0; i < array.length(); i++) { list.add(JsonUtil.fromJson(array.get(i).toString(), class1)); } } catch (Exception e) { e.printStackTrace(); } return list; } /** * json字符串转成对象 * * @param str * @param type * @return */ public static <T> T fromJson(String str, Class<T> type) { Gson gson = new Gson(); return gson.fromJson(str, type); } }
UTF-8
Java
1,456
java
JsonUtil.java
Java
[ { "context": "gle.gson.Gson;\n\n/**\n * \n * JsonUtil\n * \n * @author larry 2015-11-3 下午2:49:21 \n * @version 1.0.0\n *\n */\npub", "end": 248, "score": 0.9246591329574585, "start": 243, "tag": "USERNAME", "value": "larry" } ]
null
[]
package cn.qaii.viewutil_lib.util; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.List; import org.json.JSONArray; import org.json.JSONException; import com.google.gson.Gson; /** * * JsonUtil * * @author larry 2015-11-3 下午2:49:21 * @version 1.0.0 * */ public class JsonUtil { /** * 对象转换成json字符串 * * @param obj * @return */ public static String toJson(Object obj) { Gson gson = new Gson(); return gson.toJson(obj); } /** * json字符串转成对象 * * @param str * @param type * @return */ public static <T> T fromJson(String str, Type type) { Gson gson = new Gson(); return gson.fromJson(str, type); } /** * 解析数组 * * @param array * @param class1 * @return * @throws JSONException */ public static <T> List<T> getList(String json, Class<T> class1){ List<T> list = new ArrayList<T>(); try { if (json != null && json.startsWith("\ufeff")) { json = json.substring(1); } JSONArray array = new JSONArray(json); for (int i = 0; i < array.length(); i++) { list.add(JsonUtil.fromJson(array.get(i).toString(), class1)); } } catch (Exception e) { e.printStackTrace(); } return list; } /** * json字符串转成对象 * * @param str * @param type * @return */ public static <T> T fromJson(String str, Class<T> type) { Gson gson = new Gson(); return gson.fromJson(str, type); } }
1,456
0.610714
0.596429
81
16.283951
16.258129
65
false
false
0
0
0
0
0
0
1.37037
false
false
13
b1c7c0d4a72e3d6e27d58ff54e0e9c518caa4b95
14,542,759,323,163
f6668a87ead018242d008bfeae56de5f5f126105
/20.07.04/src/HomeThread/ThreadArray.java
c854d714dcaa91323f0231586bf5dedc1afcab62
[]
no_license
evgeniy2702/EvgeniyZhurenkoJAVA
https://github.com/evgeniy2702/EvgeniyZhurenkoJAVA
e66061c1e00a0d1cf589204f6cc4708494a4ac36
b0aad10c7637300b980907dd77ae63d69066afa2
refs/heads/master
2022-12-27T13:24:34.665000
2020-10-03T16:45:39
2020-10-03T16:45:39
278,164,951
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package HomeThread; import java.util.Arrays; public class ThreadArray implements Runnable{ final ArrayRandom arrayRandom; public ThreadArray(ArrayRandom arrayRandom) { this.arrayRandom = arrayRandom; } @Override public void run() { synchronized (arrayRandom) { System.out.println("Старт потока " + Thread.currentThread().getName()); for (int i = 0; i < arrayRandom.l; i++) { arrayRandom.fullArr(); } System.out.println("Массив случайных чисел заполнился : "); Arrays.stream(arrayRandom.arr).forEach(o -> System.out.print(o + "; ")); System.out.println("\nКонец потока " + Thread.currentThread().getName()); arrayRandom.notifyAll(); } } }
UTF-8
Java
843
java
ThreadArray.java
Java
[]
null
[]
package HomeThread; import java.util.Arrays; public class ThreadArray implements Runnable{ final ArrayRandom arrayRandom; public ThreadArray(ArrayRandom arrayRandom) { this.arrayRandom = arrayRandom; } @Override public void run() { synchronized (arrayRandom) { System.out.println("Старт потока " + Thread.currentThread().getName()); for (int i = 0; i < arrayRandom.l; i++) { arrayRandom.fullArr(); } System.out.println("Массив случайных чисел заполнился : "); Arrays.stream(arrayRandom.arr).forEach(o -> System.out.print(o + "; ")); System.out.println("\nКонец потока " + Thread.currentThread().getName()); arrayRandom.notifyAll(); } } }
843
0.600506
0.599241
26
29.423077
27.446693
85
false
false
0
0
0
0
0
0
0.5
false
false
13
52e6329f512eb6009d87f6b9cc155bc6f7674f74
24,361,054,551,331
2f1f883b88c35fbdd7bcdad42b364df465f61279
/ses-app/ses-web-ros/src/main/java/com/redescooter/ses/web/ros/dao/CustomerServiceMapper.java
6a82d2688da60c437b0e0ce367ec8c10b7fd031e
[ "MIT" ]
permissive
RedElect/ses-server
https://github.com/RedElect/ses-server
bd4a6c6091d063217655ab573422f4cf37c8dcbf
653cda02110cb31a36d8435cc4c72e792467d134
refs/heads/master
2023-06-19T16:16:53.418000
2021-07-19T09:19:25
2021-07-19T09:19:25
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.redescooter.ses.web.ros.dao; import com.redescooter.ses.api.common.vo.CountByStatusResult; import com.redescooter.ses.api.common.vo.base.GeneralEnter; import com.redescooter.ses.api.common.vo.base.GeneralResult; import com.redescooter.ses.api.common.vo.base.PageEnter; import com.redescooter.ses.web.ros.vo.customer.*; import java.util.List; /** * @author Mr.lijiating * @version V1.0 * @Date: 19/12/2019 9:27 下午 * @ClassName: CustomerServiceMapper * @Function: TODO */ public interface CustomerServiceMapper { List<CountByStatusResult> countStatus(); int customerListCount(ListCustomerEnter enter); List<DetailsCustomerResult> customerList(ListCustomerEnter enter); int customerAccountCount(AccountListEnter enter); List<AccountListResult> queryAccountRecord(AccountListEnter enter); List<AccountListResult> queryAccountRecordEamil(GeneralEnter enter); List<ScooterCustomerResult> scooterCustomerResult(PageEnter enter); int scooterCustomerCount(PageEnter enter); // 获取E50产品的ID Long getProductId(); }
UTF-8
Java
1,086
java
CustomerServiceMapper.java
Java
[ { "context": "ustomer.*;\n\nimport java.util.List;\n\n/**\n * @author Mr.lijiating\n * @version V1.0\n * @Date: 19/12/2019 9:27 下午\n * ", "end": 384, "score": 0.9979658126831055, "start": 372, "tag": "USERNAME", "value": "Mr.lijiating" } ]
null
[]
package com.redescooter.ses.web.ros.dao; import com.redescooter.ses.api.common.vo.CountByStatusResult; import com.redescooter.ses.api.common.vo.base.GeneralEnter; import com.redescooter.ses.api.common.vo.base.GeneralResult; import com.redescooter.ses.api.common.vo.base.PageEnter; import com.redescooter.ses.web.ros.vo.customer.*; import java.util.List; /** * @author Mr.lijiating * @version V1.0 * @Date: 19/12/2019 9:27 下午 * @ClassName: CustomerServiceMapper * @Function: TODO */ public interface CustomerServiceMapper { List<CountByStatusResult> countStatus(); int customerListCount(ListCustomerEnter enter); List<DetailsCustomerResult> customerList(ListCustomerEnter enter); int customerAccountCount(AccountListEnter enter); List<AccountListResult> queryAccountRecord(AccountListEnter enter); List<AccountListResult> queryAccountRecordEamil(GeneralEnter enter); List<ScooterCustomerResult> scooterCustomerResult(PageEnter enter); int scooterCustomerCount(PageEnter enter); // 获取E50产品的ID Long getProductId(); }
1,086
0.779851
0.765858
38
27.210526
25.949503
72
false
false
0
0
0
0
0
0
0.421053
false
false
13
9178892289f0e2a171c3ff376b81237e299d6e99
14,482,629,786,414
ef4d83c8f7fdcba84e673ce282b3f1c81a6322d6
/mrdon_fenggui/src/org/fenggui/example/XMLTest.java
cb62123460dc67bc8fb24d4356b051d65bbe609c
[]
no_license
weimingtom/fenggui_playground
https://github.com/weimingtom/fenggui_playground
94e6dc85ad33530d0ffd5dc51e3572d499e8f28a
8a423f0f9fb05340de302cb7397a4c45d3939f2e
refs/heads/master
2020-12-04T10:20:09.076000
2016-09-08T17:23:54
2016-09-08T17:23:54
67,723,934
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * FengGUI - Java GUIs in OpenGL (http://www.fenggui.org) * * Copyright (c) 2005, 2006 FengGUI Project * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details: * http://www.gnu.org/copyleft/lesser.html#TOC3 * * $Id: XMLTest.java 327 2007-08-11 11:20:15Z Schabby $ */ package org.fenggui.example; import static javax.media.opengl.GL.GL_DEPTH_TEST; import static javax.media.opengl.GL.GL_LEQUAL; import static javax.media.opengl.GL.GL_LIGHTING; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import javax.media.opengl.GL; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLCanvas; import javax.media.opengl.GLEventListener; import javax.media.opengl.glu.GLU; import javax.swing.JFrame; import org.fenggui.ComboBox; import org.fenggui.Display; import org.fenggui.Label; import org.fenggui.List; import org.fenggui.background.PlainBackground; import org.fenggui.border.PlainBorder; import org.fenggui.composites.Window; import org.fenggui.render.jogl.EventBinding; import org.fenggui.render.jogl.JOGLBinding; import org.fenggui.theme.xml.IXMLStreamableException; import org.fenggui.theme.xml.XMLInputStream; import com.sun.opengl.util.Animator; /** * Base class for all test classes and example * classes. It opens a Swing Frame and initialized * the JOGL-Binding. * * @author Johannes, last edited by $Author: Schabby $, $Date: 2007-08-11 13:20:15 +0200 (Sa, 11 Aug 2007) $ * @version $Revision: 327 $ */ public class XMLTest extends JFrame { private static final long serialVersionUID = 1L; private GL gl; private GLU glu = new GLU(); private GLCanvas canvas; private Display display = null; private GLEventListener eventListener = null; private float rotAngle = 0; private boolean runsAsWebstart = false; private FengCharacterRenderer fengRenderer = null; public XMLTest() { this(false); } public XMLTest(boolean runsAsWebstart) { this.runsAsWebstart = runsAsWebstart; canvas = new GLCanvas(); eventListener = new GLEventListenerImplementation(); canvas.addGLEventListener(eventListener); getContentPane().add(canvas, java.awt.BorderLayout.CENTER); setSize(800, 800); setTitle("FengGUI - Test Template"); Animator animator = new Animator(canvas); animator.start(); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public final void setVisible(boolean b) { super.setVisible(b); } public GLCanvas getCanvas() { return canvas; } private class GLEventListenerImplementation implements GLEventListener { /* * (non-Javadoc) * * @see net.java.games.jogl.GLEventListener#display(net.java.games.jogl.GLDrawable) */ public void display(GLAutoDrawable arg0) { gl.glLoadIdentity(); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); glu.gluLookAt(0, 0, 800, 0, 230, 0, 0, 0, 1); gl.glPushMatrix(); gl.glRotatef(rotAngle, 0, 1, 0); // fengRenderer.display(); gl.glPopMatrix(); rotAngle += 0.05; display.display(); } public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { gl.glViewport(0, 0, width, height); gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); glu.gluPerspective(45, (double)width/(double)height, 4, 1000); gl.glMatrixMode(GL.GL_MODELVIEW); gl.glLoadIdentity(); // } public void displayChanged(GLAutoDrawable arg0, boolean arg1, boolean arg2) { // does nothing } /* * (non-Javadoc) * * @see net.java.games.jogl.GLEventListener#init(net.java.games.jogl.GLDrawable) */ public void init(GLAutoDrawable drawable) { gl = drawable.getGL(); gl.glClearColor(146f/255f, 164f/255f, 1, 0.0f); gl.glEnable(GL.GL_BLEND); gl.glDisable(GL.GL_TEXTURE_2D); gl.glEnable(GL_DEPTH_TEST); gl.glDepthFunc(GL_LEQUAL); gl.glShadeModel(GL.GL_SMOOTH); gl.glEnable(GL_LIGHTING); gl.glLightfv(GL.GL_LIGHT1, GL.GL_AMBIENT, new float[] {146f/255f, 164f/255f, 1f, 1.0f}, 0); gl.glLightfv(GL.GL_LIGHT1, GL.GL_DIFFUSE, new float[] {1f, 1f, 1f, 1.0f}, 0); gl.glLightfv(GL.GL_LIGHT1, GL.GL_POSITION, new float[] {-100, -100, 400}, 0); gl.glEnable(GL.GL_LIGHT1); // fengRenderer = new FengCharacterRenderer(gl); buildGUI(); } } public static void main(String[] args) { XMLTest f = new XMLTest(args.length > 0); f.setTitle("FengGUI - Test Almost Everything"); f.setVisible(true); } public void buildGUI() { setDisplay(new Display(new JOGLBinding(canvas))); new EventBinding(getCanvas(), getDisplay()); new Label(); new PlainBorder(); new ComboBox(); new List(); new PlainBackground(); new Window(); try { XMLInputStream xis = new XMLInputStream(new FileInputStream("data/xml/SimpleLayout.xml")); getDisplay().process(xis); getDisplay().addedToWidgetTree(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (IXMLStreamableException e) { e.printStackTrace(); } getDisplay().layout(); } public GL getGL() { return gl; } public GLU getGLU() { return glu; } public Display getDisplay() { return display; } public void setDisplay(Display display) { this.display = display; } }
UTF-8
Java
6,548
java
XMLTest.java
Java
[ { "context": "\n * \n * $Id: XMLTest.java 327 2007-08-11 11:20:15Z Schabby $\n */\npackage org.fenggui.example;\n\nimport static", "end": 736, "score": 0.9995179772377014, "start": 729, "tag": "USERNAME", "value": "Schabby" }, { "context": "nd initialized\n * the JOGL-Binding.\n * \n * @author Johannes, last edited by $Author: Schabby $, $Date: 2007-0", "end": 1840, "score": 0.9998507499694824, "start": 1832, "tag": "NAME", "value": "Johannes" }, { "context": ".\n * \n * @author Johannes, last edited by $Author: Schabby $, $Date: 2007-08-11 13:20:15 +0200 (Sa, 11 Aug 2", "end": 1873, "score": 0.9990465044975281, "start": 1866, "tag": "USERNAME", "value": "Schabby" } ]
null
[]
/* * FengGUI - Java GUIs in OpenGL (http://www.fenggui.org) * * Copyright (c) 2005, 2006 FengGUI Project * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details: * http://www.gnu.org/copyleft/lesser.html#TOC3 * * $Id: XMLTest.java 327 2007-08-11 11:20:15Z Schabby $ */ package org.fenggui.example; import static javax.media.opengl.GL.GL_DEPTH_TEST; import static javax.media.opengl.GL.GL_LEQUAL; import static javax.media.opengl.GL.GL_LIGHTING; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import javax.media.opengl.GL; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLCanvas; import javax.media.opengl.GLEventListener; import javax.media.opengl.glu.GLU; import javax.swing.JFrame; import org.fenggui.ComboBox; import org.fenggui.Display; import org.fenggui.Label; import org.fenggui.List; import org.fenggui.background.PlainBackground; import org.fenggui.border.PlainBorder; import org.fenggui.composites.Window; import org.fenggui.render.jogl.EventBinding; import org.fenggui.render.jogl.JOGLBinding; import org.fenggui.theme.xml.IXMLStreamableException; import org.fenggui.theme.xml.XMLInputStream; import com.sun.opengl.util.Animator; /** * Base class for all test classes and example * classes. It opens a Swing Frame and initialized * the JOGL-Binding. * * @author Johannes, last edited by $Author: Schabby $, $Date: 2007-08-11 13:20:15 +0200 (Sa, 11 Aug 2007) $ * @version $Revision: 327 $ */ public class XMLTest extends JFrame { private static final long serialVersionUID = 1L; private GL gl; private GLU glu = new GLU(); private GLCanvas canvas; private Display display = null; private GLEventListener eventListener = null; private float rotAngle = 0; private boolean runsAsWebstart = false; private FengCharacterRenderer fengRenderer = null; public XMLTest() { this(false); } public XMLTest(boolean runsAsWebstart) { this.runsAsWebstart = runsAsWebstart; canvas = new GLCanvas(); eventListener = new GLEventListenerImplementation(); canvas.addGLEventListener(eventListener); getContentPane().add(canvas, java.awt.BorderLayout.CENTER); setSize(800, 800); setTitle("FengGUI - Test Template"); Animator animator = new Animator(canvas); animator.start(); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public final void setVisible(boolean b) { super.setVisible(b); } public GLCanvas getCanvas() { return canvas; } private class GLEventListenerImplementation implements GLEventListener { /* * (non-Javadoc) * * @see net.java.games.jogl.GLEventListener#display(net.java.games.jogl.GLDrawable) */ public void display(GLAutoDrawable arg0) { gl.glLoadIdentity(); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); glu.gluLookAt(0, 0, 800, 0, 230, 0, 0, 0, 1); gl.glPushMatrix(); gl.glRotatef(rotAngle, 0, 1, 0); // fengRenderer.display(); gl.glPopMatrix(); rotAngle += 0.05; display.display(); } public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { gl.glViewport(0, 0, width, height); gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); glu.gluPerspective(45, (double)width/(double)height, 4, 1000); gl.glMatrixMode(GL.GL_MODELVIEW); gl.glLoadIdentity(); // } public void displayChanged(GLAutoDrawable arg0, boolean arg1, boolean arg2) { // does nothing } /* * (non-Javadoc) * * @see net.java.games.jogl.GLEventListener#init(net.java.games.jogl.GLDrawable) */ public void init(GLAutoDrawable drawable) { gl = drawable.getGL(); gl.glClearColor(146f/255f, 164f/255f, 1, 0.0f); gl.glEnable(GL.GL_BLEND); gl.glDisable(GL.GL_TEXTURE_2D); gl.glEnable(GL_DEPTH_TEST); gl.glDepthFunc(GL_LEQUAL); gl.glShadeModel(GL.GL_SMOOTH); gl.glEnable(GL_LIGHTING); gl.glLightfv(GL.GL_LIGHT1, GL.GL_AMBIENT, new float[] {146f/255f, 164f/255f, 1f, 1.0f}, 0); gl.glLightfv(GL.GL_LIGHT1, GL.GL_DIFFUSE, new float[] {1f, 1f, 1f, 1.0f}, 0); gl.glLightfv(GL.GL_LIGHT1, GL.GL_POSITION, new float[] {-100, -100, 400}, 0); gl.glEnable(GL.GL_LIGHT1); // fengRenderer = new FengCharacterRenderer(gl); buildGUI(); } } public static void main(String[] args) { XMLTest f = new XMLTest(args.length > 0); f.setTitle("FengGUI - Test Almost Everything"); f.setVisible(true); } public void buildGUI() { setDisplay(new Display(new JOGLBinding(canvas))); new EventBinding(getCanvas(), getDisplay()); new Label(); new PlainBorder(); new ComboBox(); new List(); new PlainBackground(); new Window(); try { XMLInputStream xis = new XMLInputStream(new FileInputStream("data/xml/SimpleLayout.xml")); getDisplay().process(xis); getDisplay().addedToWidgetTree(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (IXMLStreamableException e) { e.printStackTrace(); } getDisplay().layout(); } public GL getGL() { return gl; } public GLU getGLU() { return glu; } public Display getDisplay() { return display; } public void setDisplay(Display display) { this.display = display; } }
6,548
0.621869
0.599267
241
26.170124
23.487087
108
false
false
0
0
0
0
0
0
1.020747
false
false
13
5ebd3ad294f3d63a04d486aebbf5b4d2bad39061
15,728,170,292,129
ca6616c0a9487b68941b181af8e60c76158f532b
/usci/modules/eav/modules/persistance/src/main/java/kz/bsbnb/usci/eav/persistance/dao/impl/BaseEntityReportDateDaoImpl.java
8278e17301c2b761ac8403c5338681228639d788
[]
no_license
smukashev/essp
https://github.com/smukashev/essp
a830fe9c9985d8149bf708bb6c82027cfbf6d6f2
78a278b1d4b9717d72ec7cdb2fc79ac348380387
refs/heads/master
2020-03-15T15:21:37.258000
2017-11-02T08:01:02
2017-11-02T08:01:02
132,210,321
0
1
null
false
2018-06-07T05:52:19
2018-05-05T03:13:35
2018-05-10T06:17:28
2018-06-05T06:40:12
80,960
0
1
2
CSS
false
null
package kz.bsbnb.usci.eav.persistance.dao.impl; import kz.bsbnb.usci.eav.model.type.DataTypes; import kz.bsbnb.usci.eav.util.Errors; import kz.bsbnb.usci.eav.model.base.IBaseEntityReportDate; import kz.bsbnb.usci.eav.model.base.impl.BaseEntityReportDate; import kz.bsbnb.usci.eav.model.persistable.IPersistable; import kz.bsbnb.usci.eav.persistance.dao.IBaseEntityReportDateDao; import kz.bsbnb.usci.eav.persistance.db.JDBCSupport; import kz.bsbnb.usci.eav.util.DataUtils; import org.jooq.*; import org.jooq.impl.DSL; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import java.math.BigDecimal; import java.sql.Timestamp; import java.util.*; import static kz.bsbnb.eav.persistance.generated.Tables.EAV_BE_ENTITIES; import static kz.bsbnb.eav.persistance.generated.Tables.EAV_BE_ENTITY_REPORT_DATES; @Repository public class BaseEntityReportDateDaoImpl extends JDBCSupport implements IBaseEntityReportDateDao { private final Logger logger = LoggerFactory.getLogger(BaseEntityReportDateDaoImpl.class); @SuppressWarnings("SpringJavaAutowiringInspection") @Autowired private DSLContext context; @Override public IBaseEntityReportDate load(long baseEntityId, Date reportDate) { if (baseEntityId < 1) throw new IllegalArgumentException(Errors.compose(Errors.E120)); if (reportDate == null) throw new IllegalArgumentException(Errors.compose(Errors.E121)); String tableAlias = "rd"; Select select = context .select(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).ID, EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).CREDITOR_ID, EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).INTEGER_VALUES_COUNT, EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).DATE_VALUES_COUNT, EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).STRING_VALUES_COUNT, EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).BOOLEAN_VALUES_COUNT, EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).DOUBLE_VALUES_COUNT, EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).COMPLEX_VALUES_COUNT, EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).SIMPLE_SETS_COUNT, EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).COMPLEX_SETS_COUNT, EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).IS_CLOSED) .from(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias)) .where(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).ENTITY_ID.equal(baseEntityId)) .and(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).REPORT_DATE.eq(DataUtils.convert(reportDate))); List<Map<String, Object>> rows = queryForListWithStats(select.getSQL(), select.getBindValues().toArray()); if (rows.size() > 1) throw new IllegalArgumentException(Errors.compose(Errors.E122)); if (rows.size() < 1) throw new IllegalStateException(Errors.compose(Errors.E123, baseEntityId, DataTypes.formatDate(reportDate))); Map<String, Object> row = rows.get(0); long id = ((BigDecimal) row .get(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).ID.getName())).longValue(); long creditorId = ((BigDecimal) row .get(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).CREDITOR_ID.getName())).longValue(); long integerValuesCount = ((BigDecimal) row .get(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).INTEGER_VALUES_COUNT.getName())).longValue(); long dateValuesCount = ((BigDecimal) row .get(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).DATE_VALUES_COUNT.getName())).longValue(); long stringValuesCount = ((BigDecimal) row .get(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).STRING_VALUES_COUNT.getName())).longValue(); long booleanValuesCount = ((BigDecimal) row .get(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).BOOLEAN_VALUES_COUNT.getName())).longValue(); long doubleValuesCount = ((BigDecimal) row .get(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).DOUBLE_VALUES_COUNT.getName())).longValue(); long complexValuesCount = ((BigDecimal) row .get(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).COMPLEX_VALUES_COUNT.getName())).longValue(); long simpleSetsCount = ((BigDecimal) row .get(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).SIMPLE_SETS_COUNT.getName())).longValue(); long complexSetsCount = ((BigDecimal) row .get(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).COMPLEX_SETS_COUNT.getName())).longValue(); boolean isClosed = ((BigDecimal) row .get(EAV_BE_ENTITY_REPORT_DATES.IS_CLOSED.getName())).longValue() == 1; return new BaseEntityReportDate(id, creditorId, reportDate, integerValuesCount, dateValuesCount, stringValuesCount, booleanValuesCount, doubleValuesCount, complexValuesCount, simpleSetsCount, complexSetsCount, isClosed); } @Override public long insert(IPersistable persistable) { IBaseEntityReportDate baseEntityReportDate = (IBaseEntityReportDate) persistable; Insert insert = context .insertInto(EAV_BE_ENTITY_REPORT_DATES) .set(EAV_BE_ENTITY_REPORT_DATES.ENTITY_ID, baseEntityReportDate.getBaseEntity().getId()) .set(EAV_BE_ENTITY_REPORT_DATES.CREDITOR_ID, baseEntityReportDate.getBaseEntity().getMeta().isReference() ? 0 : baseEntityReportDate.getCreditorId()) .set(EAV_BE_ENTITY_REPORT_DATES.REPORT_DATE, DataUtils.convert(baseEntityReportDate.getReportDate())) .set(EAV_BE_ENTITY_REPORT_DATES.INTEGER_VALUES_COUNT, baseEntityReportDate.getIntegerValuesCount()) .set(EAV_BE_ENTITY_REPORT_DATES.DATE_VALUES_COUNT, baseEntityReportDate.getDateValuesCount()) .set(EAV_BE_ENTITY_REPORT_DATES.STRING_VALUES_COUNT, baseEntityReportDate.getStringValuesCount()) .set(EAV_BE_ENTITY_REPORT_DATES.BOOLEAN_VALUES_COUNT, baseEntityReportDate.getBooleanValuesCount()) .set(EAV_BE_ENTITY_REPORT_DATES.DOUBLE_VALUES_COUNT, baseEntityReportDate.getDoubleValuesCount()) .set(EAV_BE_ENTITY_REPORT_DATES.COMPLEX_VALUES_COUNT, baseEntityReportDate.getComplexValuesCount()) .set(EAV_BE_ENTITY_REPORT_DATES.SIMPLE_SETS_COUNT, baseEntityReportDate.getSimpleSetsCount()) .set(EAV_BE_ENTITY_REPORT_DATES.COMPLEX_SETS_COUNT, baseEntityReportDate.getComplexSetsCount()) .set(EAV_BE_ENTITY_REPORT_DATES.IS_CLOSED, DataUtils.convert(baseEntityReportDate.isClosed())); logger.debug(insert.toString()); long baseEntityReportDateId = insertWithId(insert.getSQL(), insert.getBindValues().toArray()); baseEntityReportDate.setId(baseEntityReportDateId); return baseEntityReportDateId; } @Override public void update(IPersistable persistable) { if (persistable.getId() < 1) throw new RuntimeException(Errors.compose(Errors.E124)); IBaseEntityReportDate baseEntityReportDate = (IBaseEntityReportDate) persistable; String tableAlias = "rd"; Update update = context .update(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias)) .set(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).INTEGER_VALUES_COUNT, baseEntityReportDate.getIntegerValuesCount()) .set(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).DATE_VALUES_COUNT, baseEntityReportDate.getDateValuesCount()) .set(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).STRING_VALUES_COUNT, baseEntityReportDate.getStringValuesCount()) .set(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).BOOLEAN_VALUES_COUNT, baseEntityReportDate.getBooleanValuesCount()) .set(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).DOUBLE_VALUES_COUNT, baseEntityReportDate.getDoubleValuesCount()) .set(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).COMPLEX_VALUES_COUNT, baseEntityReportDate.getComplexValuesCount()) .set(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).SIMPLE_SETS_COUNT, baseEntityReportDate.getSimpleSetsCount()) .set(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).COMPLEX_SETS_COUNT, baseEntityReportDate.getComplexSetsCount()) .set(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).IS_CLOSED, DataUtils.convert(baseEntityReportDate.isClosed())) .where(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).ID.equal(baseEntityReportDate.getId())); logger.debug(update.toString()); int count = updateWithStats(update.getSQL(), update.getBindValues().toArray()); if (count != 1) throw new RuntimeException(Errors.compose(Errors.E125)); } @Override public void delete(IPersistable persistable) { String tableAlias = "rd"; Delete delete = context .delete(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias)) .where(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).ID.equal(persistable.getId())); logger.debug(delete.toString()); int count = updateWithStats(delete.getSQL(), delete.getBindValues().toArray()); if (count != 1) throw new RuntimeException(Errors.compose(Errors.E119)); } @Override public void deleteAll(long baseSetId) { String tableAlias = "rd"; Delete delete = context .delete(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias)) .where(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).ENTITY_ID.equal(baseSetId)); logger.debug(delete.toString()); updateWithStats(delete.getSQL(), delete.getBindValues().toArray()); } @Override public Set<Date> getAvailableReportDates(long baseEntityId) { Set<Date> reportDates = new HashSet<>(); Select select = context .select(EAV_BE_ENTITY_REPORT_DATES.REPORT_DATE) .from(EAV_BE_ENTITY_REPORT_DATES) .where(EAV_BE_ENTITY_REPORT_DATES.ENTITY_ID.eq(baseEntityId)); logger.debug(select.toString()); List<Map<String, Object>> rows = queryForListWithStats(select.getSQL(), select.getBindValues().toArray()); for (Map<String, Object> row : rows) reportDates.add(DataUtils.convert((Timestamp) row.get(EAV_BE_ENTITY_REPORT_DATES.REPORT_DATE.getName()))); return reportDates; } @Override public Date getMinReportDate(long baseEntityId) { Select select = context .select(DSL.min(EAV_BE_ENTITY_REPORT_DATES.REPORT_DATE).as("min_report_date")) .from(EAV_BE_ENTITY_REPORT_DATES) .where(EAV_BE_ENTITY_REPORT_DATES.ENTITY_ID.eq(baseEntityId)); logger.debug(select.toString()); List<Map<String, Object>> rows = queryForListWithStats(select.getSQL(), select.getBindValues().toArray()); return DataUtils.convert((Timestamp) rows.get(0).get("min_report_date")); } @Override public Date getMinReportDate(long baseEntityId, Date reportDate) { Select select = context .select(DSL.min(EAV_BE_ENTITY_REPORT_DATES.REPORT_DATE).as("min_report_date")) .from(EAV_BE_ENTITY_REPORT_DATES) .where(EAV_BE_ENTITY_REPORT_DATES.ENTITY_ID.eq(baseEntityId)) .and(EAV_BE_ENTITY_REPORT_DATES.REPORT_DATE.greaterThan(DataUtils.convert(reportDate))); logger.debug(select.toString()); List<Map<String, Object>> rows = queryForListWithStats(select.getSQL(), select.getBindValues().toArray()); return DataUtils.convert((Timestamp) rows.get(0).get("min_report_date")); } @Override public boolean isLastReportDate(long baseEntityId, Date reportDate) { String tableAlias = "rd"; Select select = context .select(DSL.decode(DSL.max(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).REPORT_DATE), DataUtils.convert(reportDate), DSL.val(1, BigDecimal.class), DSL.val(0, BigDecimal.class)).as("is_last")) .from(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias)) .where(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).ENTITY_ID.eq(baseEntityId)) .and(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).REPORT_DATE. greaterOrEqual(DataUtils.convert(reportDate))); logger.debug(select.toString()); List<Map<String, Object>> rows = queryForListWithStats(select.getSQL(), select.getBindValues().toArray()); return rows.get(0).get("is_last").equals(BigDecimal.ONE); } @Override public Date getNextReportDate(long baseEntityId, Date reportDate) { String tableAlias = "rd"; Select select = context .select(DSL.min(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).REPORT_DATE).as("next_report_date")) .from(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias)) .where(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).ENTITY_ID.eq(baseEntityId)) .and(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).REPORT_DATE.greaterThan(DataUtils.convert(reportDate))); logger.debug(select.toString()); List<Map<String, Object>> rows = queryForListWithStats(select.getSQL(), select.getBindValues().toArray()); if (rows.size() != 0) { return DataUtils.convert((Timestamp) rows.get(0).get("next_report_date")); } return null; } @Override public Date getPreviousReportDate(long baseEntityId, Date reportDate) { String tableAlias = "rd"; Select select = context .select(DSL.max(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).REPORT_DATE).as("previous_report_date")) .from(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias)) .where(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).ENTITY_ID.eq(baseEntityId)) .and(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).REPORT_DATE.lessThan(DataUtils.convert(reportDate))); logger.debug(select.toString()); List<Map<String, Object>> rows = queryForListWithStats(select.getSQL(), select.getBindValues().toArray()); if (rows.size() != 0) { return DataUtils.convert((Timestamp) rows.get(0).get("previous_report_date")); } return null; } @Override public Date getMaxReportDate(long baseEntityId, Date reportDate) { Select select = context .select(DSL.max(EAV_BE_ENTITY_REPORT_DATES.REPORT_DATE).as("min_report_date")) .from(EAV_BE_ENTITY_REPORT_DATES) .where(EAV_BE_ENTITY_REPORT_DATES.ENTITY_ID.eq(baseEntityId)) .and(EAV_BE_ENTITY_REPORT_DATES.REPORT_DATE.lessOrEqual(DataUtils.convert(reportDate))); logger.debug(select.toString()); List<Map<String, Object>> rows = queryForListWithStats(select.getSQL(), select.getBindValues().toArray()); return DataUtils.convert((Timestamp) rows.get(0).get("min_report_date")); } @Override public Date getMaxReportDate(long baseEntityId) { String tableAlias = "rd"; Select select = context .select(DSL.max(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).REPORT_DATE).as("max_report_date")) .from(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias)) .where(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).ENTITY_ID.eq(baseEntityId)); logger.debug(select.toString()); List<Map<String, Object>> rows = queryForListWithStats(select.getSQL(), select.getBindValues().toArray()); return DataUtils.convert((Timestamp) rows.get(0).get("max_report_date")); } @Override public boolean exists(long baseEntityId, Date reportDate) { String reportDateTableAlias = "rd"; Select select = context.select(EAV_BE_ENTITY_REPORT_DATES.as(reportDateTableAlias).ID) .from(EAV_BE_ENTITY_REPORT_DATES.as(reportDateTableAlias)) .where(EAV_BE_ENTITY_REPORT_DATES.as(reportDateTableAlias).ENTITY_ID.eq(baseEntityId) .and(EAV_BE_ENTITY_REPORT_DATES.as(reportDateTableAlias).REPORT_DATE.eq(DataUtils.convert(reportDate)))); logger.debug(select.toString()); List<Map<String, Object>> rows = queryForListWithStats(select.getSQL(), select.getBindValues().toArray()); return rows.size() > 0; } }
UTF-8
Java
16,708
java
BaseEntityReportDateDaoImpl.java
Java
[]
null
[]
package kz.bsbnb.usci.eav.persistance.dao.impl; import kz.bsbnb.usci.eav.model.type.DataTypes; import kz.bsbnb.usci.eav.util.Errors; import kz.bsbnb.usci.eav.model.base.IBaseEntityReportDate; import kz.bsbnb.usci.eav.model.base.impl.BaseEntityReportDate; import kz.bsbnb.usci.eav.model.persistable.IPersistable; import kz.bsbnb.usci.eav.persistance.dao.IBaseEntityReportDateDao; import kz.bsbnb.usci.eav.persistance.db.JDBCSupport; import kz.bsbnb.usci.eav.util.DataUtils; import org.jooq.*; import org.jooq.impl.DSL; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import java.math.BigDecimal; import java.sql.Timestamp; import java.util.*; import static kz.bsbnb.eav.persistance.generated.Tables.EAV_BE_ENTITIES; import static kz.bsbnb.eav.persistance.generated.Tables.EAV_BE_ENTITY_REPORT_DATES; @Repository public class BaseEntityReportDateDaoImpl extends JDBCSupport implements IBaseEntityReportDateDao { private final Logger logger = LoggerFactory.getLogger(BaseEntityReportDateDaoImpl.class); @SuppressWarnings("SpringJavaAutowiringInspection") @Autowired private DSLContext context; @Override public IBaseEntityReportDate load(long baseEntityId, Date reportDate) { if (baseEntityId < 1) throw new IllegalArgumentException(Errors.compose(Errors.E120)); if (reportDate == null) throw new IllegalArgumentException(Errors.compose(Errors.E121)); String tableAlias = "rd"; Select select = context .select(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).ID, EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).CREDITOR_ID, EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).INTEGER_VALUES_COUNT, EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).DATE_VALUES_COUNT, EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).STRING_VALUES_COUNT, EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).BOOLEAN_VALUES_COUNT, EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).DOUBLE_VALUES_COUNT, EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).COMPLEX_VALUES_COUNT, EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).SIMPLE_SETS_COUNT, EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).COMPLEX_SETS_COUNT, EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).IS_CLOSED) .from(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias)) .where(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).ENTITY_ID.equal(baseEntityId)) .and(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).REPORT_DATE.eq(DataUtils.convert(reportDate))); List<Map<String, Object>> rows = queryForListWithStats(select.getSQL(), select.getBindValues().toArray()); if (rows.size() > 1) throw new IllegalArgumentException(Errors.compose(Errors.E122)); if (rows.size() < 1) throw new IllegalStateException(Errors.compose(Errors.E123, baseEntityId, DataTypes.formatDate(reportDate))); Map<String, Object> row = rows.get(0); long id = ((BigDecimal) row .get(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).ID.getName())).longValue(); long creditorId = ((BigDecimal) row .get(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).CREDITOR_ID.getName())).longValue(); long integerValuesCount = ((BigDecimal) row .get(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).INTEGER_VALUES_COUNT.getName())).longValue(); long dateValuesCount = ((BigDecimal) row .get(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).DATE_VALUES_COUNT.getName())).longValue(); long stringValuesCount = ((BigDecimal) row .get(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).STRING_VALUES_COUNT.getName())).longValue(); long booleanValuesCount = ((BigDecimal) row .get(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).BOOLEAN_VALUES_COUNT.getName())).longValue(); long doubleValuesCount = ((BigDecimal) row .get(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).DOUBLE_VALUES_COUNT.getName())).longValue(); long complexValuesCount = ((BigDecimal) row .get(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).COMPLEX_VALUES_COUNT.getName())).longValue(); long simpleSetsCount = ((BigDecimal) row .get(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).SIMPLE_SETS_COUNT.getName())).longValue(); long complexSetsCount = ((BigDecimal) row .get(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).COMPLEX_SETS_COUNT.getName())).longValue(); boolean isClosed = ((BigDecimal) row .get(EAV_BE_ENTITY_REPORT_DATES.IS_CLOSED.getName())).longValue() == 1; return new BaseEntityReportDate(id, creditorId, reportDate, integerValuesCount, dateValuesCount, stringValuesCount, booleanValuesCount, doubleValuesCount, complexValuesCount, simpleSetsCount, complexSetsCount, isClosed); } @Override public long insert(IPersistable persistable) { IBaseEntityReportDate baseEntityReportDate = (IBaseEntityReportDate) persistable; Insert insert = context .insertInto(EAV_BE_ENTITY_REPORT_DATES) .set(EAV_BE_ENTITY_REPORT_DATES.ENTITY_ID, baseEntityReportDate.getBaseEntity().getId()) .set(EAV_BE_ENTITY_REPORT_DATES.CREDITOR_ID, baseEntityReportDate.getBaseEntity().getMeta().isReference() ? 0 : baseEntityReportDate.getCreditorId()) .set(EAV_BE_ENTITY_REPORT_DATES.REPORT_DATE, DataUtils.convert(baseEntityReportDate.getReportDate())) .set(EAV_BE_ENTITY_REPORT_DATES.INTEGER_VALUES_COUNT, baseEntityReportDate.getIntegerValuesCount()) .set(EAV_BE_ENTITY_REPORT_DATES.DATE_VALUES_COUNT, baseEntityReportDate.getDateValuesCount()) .set(EAV_BE_ENTITY_REPORT_DATES.STRING_VALUES_COUNT, baseEntityReportDate.getStringValuesCount()) .set(EAV_BE_ENTITY_REPORT_DATES.BOOLEAN_VALUES_COUNT, baseEntityReportDate.getBooleanValuesCount()) .set(EAV_BE_ENTITY_REPORT_DATES.DOUBLE_VALUES_COUNT, baseEntityReportDate.getDoubleValuesCount()) .set(EAV_BE_ENTITY_REPORT_DATES.COMPLEX_VALUES_COUNT, baseEntityReportDate.getComplexValuesCount()) .set(EAV_BE_ENTITY_REPORT_DATES.SIMPLE_SETS_COUNT, baseEntityReportDate.getSimpleSetsCount()) .set(EAV_BE_ENTITY_REPORT_DATES.COMPLEX_SETS_COUNT, baseEntityReportDate.getComplexSetsCount()) .set(EAV_BE_ENTITY_REPORT_DATES.IS_CLOSED, DataUtils.convert(baseEntityReportDate.isClosed())); logger.debug(insert.toString()); long baseEntityReportDateId = insertWithId(insert.getSQL(), insert.getBindValues().toArray()); baseEntityReportDate.setId(baseEntityReportDateId); return baseEntityReportDateId; } @Override public void update(IPersistable persistable) { if (persistable.getId() < 1) throw new RuntimeException(Errors.compose(Errors.E124)); IBaseEntityReportDate baseEntityReportDate = (IBaseEntityReportDate) persistable; String tableAlias = "rd"; Update update = context .update(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias)) .set(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).INTEGER_VALUES_COUNT, baseEntityReportDate.getIntegerValuesCount()) .set(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).DATE_VALUES_COUNT, baseEntityReportDate.getDateValuesCount()) .set(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).STRING_VALUES_COUNT, baseEntityReportDate.getStringValuesCount()) .set(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).BOOLEAN_VALUES_COUNT, baseEntityReportDate.getBooleanValuesCount()) .set(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).DOUBLE_VALUES_COUNT, baseEntityReportDate.getDoubleValuesCount()) .set(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).COMPLEX_VALUES_COUNT, baseEntityReportDate.getComplexValuesCount()) .set(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).SIMPLE_SETS_COUNT, baseEntityReportDate.getSimpleSetsCount()) .set(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).COMPLEX_SETS_COUNT, baseEntityReportDate.getComplexSetsCount()) .set(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).IS_CLOSED, DataUtils.convert(baseEntityReportDate.isClosed())) .where(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).ID.equal(baseEntityReportDate.getId())); logger.debug(update.toString()); int count = updateWithStats(update.getSQL(), update.getBindValues().toArray()); if (count != 1) throw new RuntimeException(Errors.compose(Errors.E125)); } @Override public void delete(IPersistable persistable) { String tableAlias = "rd"; Delete delete = context .delete(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias)) .where(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).ID.equal(persistable.getId())); logger.debug(delete.toString()); int count = updateWithStats(delete.getSQL(), delete.getBindValues().toArray()); if (count != 1) throw new RuntimeException(Errors.compose(Errors.E119)); } @Override public void deleteAll(long baseSetId) { String tableAlias = "rd"; Delete delete = context .delete(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias)) .where(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).ENTITY_ID.equal(baseSetId)); logger.debug(delete.toString()); updateWithStats(delete.getSQL(), delete.getBindValues().toArray()); } @Override public Set<Date> getAvailableReportDates(long baseEntityId) { Set<Date> reportDates = new HashSet<>(); Select select = context .select(EAV_BE_ENTITY_REPORT_DATES.REPORT_DATE) .from(EAV_BE_ENTITY_REPORT_DATES) .where(EAV_BE_ENTITY_REPORT_DATES.ENTITY_ID.eq(baseEntityId)); logger.debug(select.toString()); List<Map<String, Object>> rows = queryForListWithStats(select.getSQL(), select.getBindValues().toArray()); for (Map<String, Object> row : rows) reportDates.add(DataUtils.convert((Timestamp) row.get(EAV_BE_ENTITY_REPORT_DATES.REPORT_DATE.getName()))); return reportDates; } @Override public Date getMinReportDate(long baseEntityId) { Select select = context .select(DSL.min(EAV_BE_ENTITY_REPORT_DATES.REPORT_DATE).as("min_report_date")) .from(EAV_BE_ENTITY_REPORT_DATES) .where(EAV_BE_ENTITY_REPORT_DATES.ENTITY_ID.eq(baseEntityId)); logger.debug(select.toString()); List<Map<String, Object>> rows = queryForListWithStats(select.getSQL(), select.getBindValues().toArray()); return DataUtils.convert((Timestamp) rows.get(0).get("min_report_date")); } @Override public Date getMinReportDate(long baseEntityId, Date reportDate) { Select select = context .select(DSL.min(EAV_BE_ENTITY_REPORT_DATES.REPORT_DATE).as("min_report_date")) .from(EAV_BE_ENTITY_REPORT_DATES) .where(EAV_BE_ENTITY_REPORT_DATES.ENTITY_ID.eq(baseEntityId)) .and(EAV_BE_ENTITY_REPORT_DATES.REPORT_DATE.greaterThan(DataUtils.convert(reportDate))); logger.debug(select.toString()); List<Map<String, Object>> rows = queryForListWithStats(select.getSQL(), select.getBindValues().toArray()); return DataUtils.convert((Timestamp) rows.get(0).get("min_report_date")); } @Override public boolean isLastReportDate(long baseEntityId, Date reportDate) { String tableAlias = "rd"; Select select = context .select(DSL.decode(DSL.max(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).REPORT_DATE), DataUtils.convert(reportDate), DSL.val(1, BigDecimal.class), DSL.val(0, BigDecimal.class)).as("is_last")) .from(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias)) .where(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).ENTITY_ID.eq(baseEntityId)) .and(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).REPORT_DATE. greaterOrEqual(DataUtils.convert(reportDate))); logger.debug(select.toString()); List<Map<String, Object>> rows = queryForListWithStats(select.getSQL(), select.getBindValues().toArray()); return rows.get(0).get("is_last").equals(BigDecimal.ONE); } @Override public Date getNextReportDate(long baseEntityId, Date reportDate) { String tableAlias = "rd"; Select select = context .select(DSL.min(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).REPORT_DATE).as("next_report_date")) .from(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias)) .where(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).ENTITY_ID.eq(baseEntityId)) .and(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).REPORT_DATE.greaterThan(DataUtils.convert(reportDate))); logger.debug(select.toString()); List<Map<String, Object>> rows = queryForListWithStats(select.getSQL(), select.getBindValues().toArray()); if (rows.size() != 0) { return DataUtils.convert((Timestamp) rows.get(0).get("next_report_date")); } return null; } @Override public Date getPreviousReportDate(long baseEntityId, Date reportDate) { String tableAlias = "rd"; Select select = context .select(DSL.max(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).REPORT_DATE).as("previous_report_date")) .from(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias)) .where(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).ENTITY_ID.eq(baseEntityId)) .and(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).REPORT_DATE.lessThan(DataUtils.convert(reportDate))); logger.debug(select.toString()); List<Map<String, Object>> rows = queryForListWithStats(select.getSQL(), select.getBindValues().toArray()); if (rows.size() != 0) { return DataUtils.convert((Timestamp) rows.get(0).get("previous_report_date")); } return null; } @Override public Date getMaxReportDate(long baseEntityId, Date reportDate) { Select select = context .select(DSL.max(EAV_BE_ENTITY_REPORT_DATES.REPORT_DATE).as("min_report_date")) .from(EAV_BE_ENTITY_REPORT_DATES) .where(EAV_BE_ENTITY_REPORT_DATES.ENTITY_ID.eq(baseEntityId)) .and(EAV_BE_ENTITY_REPORT_DATES.REPORT_DATE.lessOrEqual(DataUtils.convert(reportDate))); logger.debug(select.toString()); List<Map<String, Object>> rows = queryForListWithStats(select.getSQL(), select.getBindValues().toArray()); return DataUtils.convert((Timestamp) rows.get(0).get("min_report_date")); } @Override public Date getMaxReportDate(long baseEntityId) { String tableAlias = "rd"; Select select = context .select(DSL.max(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).REPORT_DATE).as("max_report_date")) .from(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias)) .where(EAV_BE_ENTITY_REPORT_DATES.as(tableAlias).ENTITY_ID.eq(baseEntityId)); logger.debug(select.toString()); List<Map<String, Object>> rows = queryForListWithStats(select.getSQL(), select.getBindValues().toArray()); return DataUtils.convert((Timestamp) rows.get(0).get("max_report_date")); } @Override public boolean exists(long baseEntityId, Date reportDate) { String reportDateTableAlias = "rd"; Select select = context.select(EAV_BE_ENTITY_REPORT_DATES.as(reportDateTableAlias).ID) .from(EAV_BE_ENTITY_REPORT_DATES.as(reportDateTableAlias)) .where(EAV_BE_ENTITY_REPORT_DATES.as(reportDateTableAlias).ENTITY_ID.eq(baseEntityId) .and(EAV_BE_ENTITY_REPORT_DATES.as(reportDateTableAlias).REPORT_DATE.eq(DataUtils.convert(reportDate)))); logger.debug(select.toString()); List<Map<String, Object>> rows = queryForListWithStats(select.getSQL(), select.getBindValues().toArray()); return rows.size() > 0; } }
16,708
0.661898
0.659265
333
49.174175
40.831371
130
false
false
0
0
0
0
0
0
0.573574
false
false
13
ba33b79edb6dd82764d526cb0fcf407cc31333d2
10,969,346,506,820
097808b471595457020751ae1d362e2bf5d3cee6
/src/Thread/thread2.java
d74ef2f0ac820cac78aae316c11990c87ed74f0e
[]
no_license
Hellosunmengqiang/JAVA-thread
https://github.com/Hellosunmengqiang/JAVA-thread
fd930d7506f189c501fbe39dc289f26f086725cf
63863eca01b46c6824ff7bd65b1c33b4734b19be
refs/heads/master
2020-04-28T00:27:06.918000
2019-04-09T13:27:28
2019-04-09T13:27:28
174,816,221
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Thread; public class thread2 { public static void main(String[] args) { Speak1 speak1=new Speak1(); Speakcar speakcar=new Speakcar(); speak1.start(); speakcar.start(); for(int i=0;i<=5;i++) { System.out.println("主人"+i+" "); } } } class Speak1 extends Thread { public void run() { for(int i=0;i<=8;i++) { System.out.println("大象"+i+" "); } } } class Speakcar extends Thread { public void run() { for(int i=0;i<=8;i++) { System.out.println("轿车"+i+" "); } } }
GB18030
Java
556
java
thread2.java
Java
[]
null
[]
package Thread; public class thread2 { public static void main(String[] args) { Speak1 speak1=new Speak1(); Speakcar speakcar=new Speakcar(); speak1.start(); speakcar.start(); for(int i=0;i<=5;i++) { System.out.println("主人"+i+" "); } } } class Speak1 extends Thread { public void run() { for(int i=0;i<=8;i++) { System.out.println("大象"+i+" "); } } } class Speakcar extends Thread { public void run() { for(int i=0;i<=8;i++) { System.out.println("轿车"+i+" "); } } }
556
0.549632
0.527574
35
13.542857
13.135215
41
false
false
0
0
0
0
0
0
1.628571
false
false
13
a821a05c1302d51fa1a963b447b2a729926c0e37
20,306,605,431,183
e5816bd6097b3a80a9231f34734c726804c80d45
/src/interview/LongestCommonPrefix.java
df32de74fb5b41042fab45ca8fe7fd68215785d7
[]
no_license
kanglo13/Algotithm
https://github.com/kanglo13/Algotithm
4e4742f64f95e9cdccc8f1eda300504a6c726d24
c38f44adf339052c878b3b2f1274ac9da10da83c
refs/heads/master
2023-08-28T18:05:02.875000
2021-10-16T12:40:11
2021-10-16T12:40:11
257,028,162
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package interview; /** * @author kanglo * @create 2020-10-2020/10/16 14:17 */ public class LongestCommonPrefix { public String longestCommonPrefix(String[]strs){ if (strs == null || strs.length == 0) return ""; String result = strs[0]; for (int i = 1;i < strs.length;i++){ int j = 0; while (j < result.length() && j < strs[i].length() && result.charAt(j) == strs[i].charAt(j)) j++; result = result.substring(0,j); if (result.equals("")) return result; } return result; } }
UTF-8
Java
639
java
LongestCommonPrefix.java
Java
[ { "context": "package interview;\r\n\r\n/**\r\n * @author kanglo\r\n * @create 2020-10-2020/10/16 14:17\r\n */\r\npublic", "end": 44, "score": 0.9990174174308777, "start": 38, "tag": "USERNAME", "value": "kanglo" } ]
null
[]
package interview; /** * @author kanglo * @create 2020-10-2020/10/16 14:17 */ public class LongestCommonPrefix { public String longestCommonPrefix(String[]strs){ if (strs == null || strs.length == 0) return ""; String result = strs[0]; for (int i = 1;i < strs.length;i++){ int j = 0; while (j < result.length() && j < strs[i].length() && result.charAt(j) == strs[i].charAt(j)) j++; result = result.substring(0,j); if (result.equals("")) return result; } return result; } }
639
0.483568
0.447574
22
27.045454
22.652468
104
false
false
0
0
0
0
0
0
0.590909
false
false
13
a4b07ce602611d86b608da61bd36704672d10c83
27,839,978,081,941
5450219cf6bf60edd885af7a18e78149e7257a5b
/01_intro_poo/ex02_funcionario/Funcionarios/src/Estagiario.java
1b05250ca1a2ba5b02e8133bc6e7031861058f12
[]
no_license
gabrieladipoggio/lista-de-exercicios-java
https://github.com/gabrieladipoggio/lista-de-exercicios-java
1eebb7a5e934099fb407ffdbe137d0f313adf887
7e6e61e971baeb71b4050e048bad392eaa72256e
refs/heads/main
2023-08-01T11:16:33.215000
2021-09-16T02:20:39
2021-09-16T02:20:39
404,454,160
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class Estagiario extends Funcionario{ private double horasTrabalhadas; private double valorHora; public Estagiario(double salario){ super(salario); } public void tirarXerox(){ System.out.println("Tirando xerox"); } public void calcularSalario(double horasTrabalhadas, double valorHora){ var valorSalario = horasTrabalhadas * valorHora; this.setSalario(valorSalario); System.out.println("O seu salário é: R$" + this.getSalario()); } }
UTF-8
Java
519
java
Estagiario.java
Java
[]
null
[]
public class Estagiario extends Funcionario{ private double horasTrabalhadas; private double valorHora; public Estagiario(double salario){ super(salario); } public void tirarXerox(){ System.out.println("Tirando xerox"); } public void calcularSalario(double horasTrabalhadas, double valorHora){ var valorSalario = horasTrabalhadas * valorHora; this.setSalario(valorSalario); System.out.println("O seu salário é: R$" + this.getSalario()); } }
519
0.676983
0.676983
20
24.9
24.087133
75
false
false
0
0
0
0
0
0
0.4
false
false
13
0ae5cca60cd547d4a4d53fb7fd59bef00e1f72b2
7,902,739,857,179
eea85e7765e9696d11eca27631185d1321628c35
/app/src/main/java/skku/fit4you_android/fragment/HomeFragment.java
d44336be918aac4a946825a8bc73a99ca5c25972
[]
no_license
kuk941025/Fit4YouAndroid
https://github.com/kuk941025/Fit4YouAndroid
0804acddfba264063885d2762aacd57dd512669f
1bb5aa94197aec855f638d82998d2bd4694625d7
refs/heads/master
2020-03-31T18:19:31.339000
2018-12-13T20:22:18
2018-12-13T20:22:18
152,454,285
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package skku.fit4you_android.fragment; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.design.widget.TabLayout; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.widget.NestedScrollView; import android.support.v4.widget.SwipeRefreshLayout; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.FrameLayout; import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; import android.widget.Toolbar; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Collections; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; import skku.fit4you_android.R; import skku.fit4you_android.activity.UploadClothingActivity; import skku.fit4you_android.dialog.FilterDialogInterface; import skku.fit4you_android.dialog.SetFilterDialog; import skku.fit4you_android.util.Constants; /** * A simple {@link Fragment} subclass. */ public class HomeFragment extends Fragment implements FilterDialogInterface { @BindView(R.id.home_tab) TabLayout tabLayout; @BindView(R.id.home_container) FrameLayout frameLayout; @BindView(R.id.home_toolbar_spinner_show_option) Spinner spinnerOption; @BindView(R.id.home_items_nested_scroll) NestedScrollView nestedScrollView; @BindView(R.id.home_refresh_layout) SwipeRefreshLayout swipeRefreshLayout; @BindView(R.id.layout_home_view) View viewSelectLayout; @BindView(R.id.layout_home_selected_filter) TextView txtSelectedFilter; @BindView(R.id.layout_home_btn_recommend) Button btnReoommend; @BindView(R.id.layout_home_btn_set_filter) Button btnSetFilter; private View fragView; private PopularClothesFragment popularClothesFragment = null; private PopularMallFragment popularMallFragment = null; private int flag_refresh_clothing, flag_refresh_mall; private int flag_detecting_scroll_twice = 0; private int filter_gender = 0, filter_weather = 0, option_sort = 1; /* Each fragment has unique page num Filter/sort information is referenced from this home fragment */ public HomeFragment() { // Required empty public constructor } @Override public void onOkClicked(int gender, int weather) { txtSelectedFilter.setText(Constants.GENDER[gender] + ", " + Constants.CLOTHING_WEATHER[weather]); filter_gender = gender; filter_weather = weather; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment if (fragView == null) { fragView = inflater.inflate(R.layout.fragment_home, container, false); ButterKnife.bind(this, fragView); flag_refresh_clothing = flag_refresh_mall = 0; nestedScrollView.setOnScrollChangeListener(new View.OnScrollChangeListener() { @Override public void onScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) { flag_detecting_scroll_twice++; //avoid detecting bottom detection twice if (flag_detecting_scroll_twice % 2 != 0) { if (scrollY == (nestedScrollView.getChildAt(0).getMeasuredHeight() - nestedScrollView.getMeasuredHeight())) { Toast.makeText(getActivity(), "bottom detected", Toast.LENGTH_LONG).show(); swipeRefreshLayout.setRefreshing(true); if (tabLayout.getSelectedTabPosition() == 0 && flag_refresh_clothing == 0) { popularClothesFragment.loadNextClothings(); } else if (tabLayout.getSelectedTabPosition() == 1 && flag_refresh_mall == 0) { popularMallFragment.loadNextItems(); } } } } }); swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { if (tabLayout.getSelectedTabPosition() == 0 && flag_refresh_clothing == 0) { popularClothesFragment.refreshAll(); } else if (tabLayout.getSelectedTabPosition() == 1 && flag_refresh_mall == 0) { popularMallFragment.refreshAll(); } } }); } return fragView; } @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (popularMallFragment == null || popularClothesFragment == null) { init(); } } private void initSpinner() { ArrayList<String> optionArray = new ArrayList<>(); Collections.addAll(optionArray, Constants.HomeShowOptions); ArrayAdapter<String> optionAdapter = new ArrayAdapter<>(getActivity(), android.R.layout.simple_spinner_dropdown_item, optionArray); spinnerOption.setAdapter(optionAdapter); spinnerOption.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { option_sort = position + 1; } @Override public void onNothingSelected(AdapterView<?> parent) { } }); // spinnerOption.getSelectedItem().toString(); } private void initFrag() { popularClothesFragment = new PopularClothesFragment(); popularMallFragment = new PopularMallFragment(); tabLayout.addOnTabSelectedListener(tabSelectedListener); getChildFragmentManager().beginTransaction().replace(R.id.home_container, popularClothesFragment).commit(); getChildFragmentManager().beginTransaction().addToBackStack(null); } private void init() { initFrag(); initSpinner(); } private TabLayout.OnTabSelectedListener tabSelectedListener = new TabLayout.OnTabSelectedListener() { @Override public void onTabSelected(TabLayout.Tab tab) { int pos = tab.getPosition(); Fragment selectedFragment = popularMallFragment; if (pos == 0) { selectedFragment = popularClothesFragment; txtSelectedFilter.setVisibility(View.VISIBLE); btnSetFilter.setVisibility(View.VISIBLE); btnReoommend.setVisibility(View.GONE); // viewSelectLayout.setVisibility(View.VISIBLE); // popularClothesFragment.notifyFrag(); } else if (pos == 1) { selectedFragment = popularMallFragment; txtSelectedFilter.setVisibility(View.GONE); btnSetFilter.setVisibility(View.GONE); btnReoommend.setVisibility(View.VISIBLE); // viewSelectLayout.setVisibility(View.GONE); // popularMallFragment.notifyFrag(); } getChildFragmentManager().beginTransaction().replace(R.id.home_container, selectedFragment).commit(); getChildFragmentManager().beginTransaction().addToBackStack(null); } @Override public void onTabUnselected(TabLayout.Tab tab) { } @Override public void onTabReselected(TabLayout.Tab tab) { } }; @OnClick(R.id.layout_home_btn_recommend) void onRecommendClicked(){ popularMallFragment.initMallListWithRecommendation(); } @OnClick(R.id.layout_home_btn_set_filter) void onSetFilterClicked(){ SetFilterDialog setFilterDialog = new SetFilterDialog(getActivity(), this); setFilterDialog.show(); } @OnClick(R.id.home_fab) void onFabAddClicked(){ Intent intent = new Intent(getActivity(), UploadClothingActivity.class); startActivity(intent); } public void searchKeyWords(String keywords){ //if clothing is selected if (tabLayout.getSelectedTabPosition() == 0){ popularClothesFragment.searchClothesKeyWords(keywords); } //if styling is selected else{ popularMallFragment.searchPostKeyWords(keywords); } } //called by fragments public void clothingStartRefreshing() { flag_refresh_clothing = 1; refreshLayoutUpdate(); } public void clothingEndRefreshing() { flag_refresh_clothing = 0; refreshLayoutUpdate(); } public void postStartRefreshing() { flag_refresh_mall = 1; refreshLayoutUpdate(); } public void postEndRefreshing() { flag_refresh_mall = 0; refreshLayoutUpdate(); } public int getOptionSort(){ return (option_sort); } public int getFilterGedner(){ return (filter_gender); } public int getFilterWeather(){ return (filter_weather); } private void refreshLayoutUpdate() { if (flag_refresh_clothing == 1 || flag_refresh_mall == 1) swipeRefreshLayout.setRefreshing(true); else if (flag_refresh_mall == 0 && flag_refresh_clothing == 0) swipeRefreshLayout.setRefreshing(false); } public void homeFragSelected() { // if (tabLayout.getSelectedTabPosition() == 0) popularClothesFragment.notifyFrag(); // else popularMallFragment.notifyFrag(); } }
UTF-8
Java
9,935
java
HomeFragment.java
Java
[]
null
[]
package skku.fit4you_android.fragment; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.design.widget.TabLayout; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.widget.NestedScrollView; import android.support.v4.widget.SwipeRefreshLayout; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.FrameLayout; import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; import android.widget.Toolbar; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Collections; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; import skku.fit4you_android.R; import skku.fit4you_android.activity.UploadClothingActivity; import skku.fit4you_android.dialog.FilterDialogInterface; import skku.fit4you_android.dialog.SetFilterDialog; import skku.fit4you_android.util.Constants; /** * A simple {@link Fragment} subclass. */ public class HomeFragment extends Fragment implements FilterDialogInterface { @BindView(R.id.home_tab) TabLayout tabLayout; @BindView(R.id.home_container) FrameLayout frameLayout; @BindView(R.id.home_toolbar_spinner_show_option) Spinner spinnerOption; @BindView(R.id.home_items_nested_scroll) NestedScrollView nestedScrollView; @BindView(R.id.home_refresh_layout) SwipeRefreshLayout swipeRefreshLayout; @BindView(R.id.layout_home_view) View viewSelectLayout; @BindView(R.id.layout_home_selected_filter) TextView txtSelectedFilter; @BindView(R.id.layout_home_btn_recommend) Button btnReoommend; @BindView(R.id.layout_home_btn_set_filter) Button btnSetFilter; private View fragView; private PopularClothesFragment popularClothesFragment = null; private PopularMallFragment popularMallFragment = null; private int flag_refresh_clothing, flag_refresh_mall; private int flag_detecting_scroll_twice = 0; private int filter_gender = 0, filter_weather = 0, option_sort = 1; /* Each fragment has unique page num Filter/sort information is referenced from this home fragment */ public HomeFragment() { // Required empty public constructor } @Override public void onOkClicked(int gender, int weather) { txtSelectedFilter.setText(Constants.GENDER[gender] + ", " + Constants.CLOTHING_WEATHER[weather]); filter_gender = gender; filter_weather = weather; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment if (fragView == null) { fragView = inflater.inflate(R.layout.fragment_home, container, false); ButterKnife.bind(this, fragView); flag_refresh_clothing = flag_refresh_mall = 0; nestedScrollView.setOnScrollChangeListener(new View.OnScrollChangeListener() { @Override public void onScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) { flag_detecting_scroll_twice++; //avoid detecting bottom detection twice if (flag_detecting_scroll_twice % 2 != 0) { if (scrollY == (nestedScrollView.getChildAt(0).getMeasuredHeight() - nestedScrollView.getMeasuredHeight())) { Toast.makeText(getActivity(), "bottom detected", Toast.LENGTH_LONG).show(); swipeRefreshLayout.setRefreshing(true); if (tabLayout.getSelectedTabPosition() == 0 && flag_refresh_clothing == 0) { popularClothesFragment.loadNextClothings(); } else if (tabLayout.getSelectedTabPosition() == 1 && flag_refresh_mall == 0) { popularMallFragment.loadNextItems(); } } } } }); swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { if (tabLayout.getSelectedTabPosition() == 0 && flag_refresh_clothing == 0) { popularClothesFragment.refreshAll(); } else if (tabLayout.getSelectedTabPosition() == 1 && flag_refresh_mall == 0) { popularMallFragment.refreshAll(); } } }); } return fragView; } @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (popularMallFragment == null || popularClothesFragment == null) { init(); } } private void initSpinner() { ArrayList<String> optionArray = new ArrayList<>(); Collections.addAll(optionArray, Constants.HomeShowOptions); ArrayAdapter<String> optionAdapter = new ArrayAdapter<>(getActivity(), android.R.layout.simple_spinner_dropdown_item, optionArray); spinnerOption.setAdapter(optionAdapter); spinnerOption.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { option_sort = position + 1; } @Override public void onNothingSelected(AdapterView<?> parent) { } }); // spinnerOption.getSelectedItem().toString(); } private void initFrag() { popularClothesFragment = new PopularClothesFragment(); popularMallFragment = new PopularMallFragment(); tabLayout.addOnTabSelectedListener(tabSelectedListener); getChildFragmentManager().beginTransaction().replace(R.id.home_container, popularClothesFragment).commit(); getChildFragmentManager().beginTransaction().addToBackStack(null); } private void init() { initFrag(); initSpinner(); } private TabLayout.OnTabSelectedListener tabSelectedListener = new TabLayout.OnTabSelectedListener() { @Override public void onTabSelected(TabLayout.Tab tab) { int pos = tab.getPosition(); Fragment selectedFragment = popularMallFragment; if (pos == 0) { selectedFragment = popularClothesFragment; txtSelectedFilter.setVisibility(View.VISIBLE); btnSetFilter.setVisibility(View.VISIBLE); btnReoommend.setVisibility(View.GONE); // viewSelectLayout.setVisibility(View.VISIBLE); // popularClothesFragment.notifyFrag(); } else if (pos == 1) { selectedFragment = popularMallFragment; txtSelectedFilter.setVisibility(View.GONE); btnSetFilter.setVisibility(View.GONE); btnReoommend.setVisibility(View.VISIBLE); // viewSelectLayout.setVisibility(View.GONE); // popularMallFragment.notifyFrag(); } getChildFragmentManager().beginTransaction().replace(R.id.home_container, selectedFragment).commit(); getChildFragmentManager().beginTransaction().addToBackStack(null); } @Override public void onTabUnselected(TabLayout.Tab tab) { } @Override public void onTabReselected(TabLayout.Tab tab) { } }; @OnClick(R.id.layout_home_btn_recommend) void onRecommendClicked(){ popularMallFragment.initMallListWithRecommendation(); } @OnClick(R.id.layout_home_btn_set_filter) void onSetFilterClicked(){ SetFilterDialog setFilterDialog = new SetFilterDialog(getActivity(), this); setFilterDialog.show(); } @OnClick(R.id.home_fab) void onFabAddClicked(){ Intent intent = new Intent(getActivity(), UploadClothingActivity.class); startActivity(intent); } public void searchKeyWords(String keywords){ //if clothing is selected if (tabLayout.getSelectedTabPosition() == 0){ popularClothesFragment.searchClothesKeyWords(keywords); } //if styling is selected else{ popularMallFragment.searchPostKeyWords(keywords); } } //called by fragments public void clothingStartRefreshing() { flag_refresh_clothing = 1; refreshLayoutUpdate(); } public void clothingEndRefreshing() { flag_refresh_clothing = 0; refreshLayoutUpdate(); } public void postStartRefreshing() { flag_refresh_mall = 1; refreshLayoutUpdate(); } public void postEndRefreshing() { flag_refresh_mall = 0; refreshLayoutUpdate(); } public int getOptionSort(){ return (option_sort); } public int getFilterGedner(){ return (filter_gender); } public int getFilterWeather(){ return (filter_weather); } private void refreshLayoutUpdate() { if (flag_refresh_clothing == 1 || flag_refresh_mall == 1) swipeRefreshLayout.setRefreshing(true); else if (flag_refresh_mall == 0 && flag_refresh_clothing == 0) swipeRefreshLayout.setRefreshing(false); } public void homeFragSelected() { // if (tabLayout.getSelectedTabPosition() == 0) popularClothesFragment.notifyFrag(); // else popularMallFragment.notifyFrag(); } }
9,935
0.647308
0.643382
274
35.259125
28.521641
139
false
false
0
0
0
0
0
0
0.540146
false
false
13
4db5c8b15681a8f6cba44b1fab92398012052e0b
7,902,739,858,478
e5906d17d3430608b05d0d9b5a1f9979dbf60e40
/src/main/java/com/erwin/meterapp/rest/api.java
e0a116f564a9f1d4bec6e8ad1abfaf507704f01a
[]
no_license
EDOUNA/MeterApp
https://github.com/EDOUNA/MeterApp
e9ecc7aef8f82ef92f57c10968f128da90f1d1da
48c0cb712452509e9fe2179e1aed2052a46221f9
refs/heads/master
2023-05-03T10:43:53.826000
2023-04-14T19:57:28
2023-04-14T19:57:28
240,009,729
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.erwin.meterapp.rest; import com.erwin.meterapp.controller.DeviceMeasurementsStats; import com.erwin.meterapp.dto.devicemeasurements.budget.BudgetDto; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/api/") public class api { private static final Logger log = LoggerFactory.getLogger(api.class); @Autowired private DeviceMeasurementsStats deviceMeasurementsStats; @GetMapping("getCurrentConsumption") public ResponseEntity<?> getCurrentConsumption() { BudgetDto budget = deviceMeasurementsStats.getBudget(); return new ResponseEntity<>(budget, HttpStatus.OK); } }
UTF-8
Java
1,000
java
api.java
Java
[]
null
[]
package com.erwin.meterapp.rest; import com.erwin.meterapp.controller.DeviceMeasurementsStats; import com.erwin.meterapp.dto.devicemeasurements.budget.BudgetDto; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/api/") public class api { private static final Logger log = LoggerFactory.getLogger(api.class); @Autowired private DeviceMeasurementsStats deviceMeasurementsStats; @GetMapping("getCurrentConsumption") public ResponseEntity<?> getCurrentConsumption() { BudgetDto budget = deviceMeasurementsStats.getBudget(); return new ResponseEntity<>(budget, HttpStatus.OK); } }
1,000
0.807
0.805
27
36.074074
24.868433
73
false
false
0
0
0
0
0
0
0.592593
false
false
13
aeb671813b13be5e1ab1a741be45e9d54dc4750d
15,977,278,410,080
4a191136984ed43b7f5768641a2390e9403c22c7
/src/UnitTests/UserSettingsTest.java
2143f5972e8b037dbf3826f072e3e18e70b8d95f
[]
no_license
CarloErnestoSarli/SoftSynthJava
https://github.com/CarloErnestoSarli/SoftSynthJava
5f77f0fbf9a84fd70a90896d4fc839042385e5b4
b3c7ea4420a8a73160771396a322356a4ad6f467
refs/heads/master
2020-05-28T06:09:16.108000
2017-05-07T15:55:03
2017-05-07T15:55:03
82,583,999
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package UnitTests; import static org.junit.Assert.*; import org.junit.Test; public class UserSettingsTest { @Test public final void testUserSettings() { fail("Not yet implemented"); // TODO } @Test public final void testSaveSettings() { fail("Not yet implemented"); // TODO } @Test public final void testLoadSettings() { fail("Not yet implemented"); // TODO } }
UTF-8
Java
408
java
UserSettingsTest.java
Java
[]
null
[]
package UnitTests; import static org.junit.Assert.*; import org.junit.Test; public class UserSettingsTest { @Test public final void testUserSettings() { fail("Not yet implemented"); // TODO } @Test public final void testSaveSettings() { fail("Not yet implemented"); // TODO } @Test public final void testLoadSettings() { fail("Not yet implemented"); // TODO } }
408
0.654412
0.654412
24
15
16.424068
39
false
false
0
0
0
0
0
0
0.875
false
false
13
e92be1c383953a1f0c4eba586f0491ba8d06a264
9,517,647,575,485
ce3eb64bf344cfb2c7384a95493fc09b5af5f296
/source/weka/classifiers/meta/ClassificationViaClustering.java
ae59ce85ad20cc7a0c53abbf21c42695839fd0ae
[ "MIT" ]
permissive
ngphloc/zebra
https://github.com/ngphloc/zebra
d8da06eb4578bac5af69c381c1b7462a08bf37af
2d99addaaec70d29bb9ed9ffcef95425ffb88bd0
refs/heads/master
2022-05-25T06:22:32.342000
2022-05-03T02:49:06
2022-05-03T02:49:06
41,139,150
2
2
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* * ClassificationViaClustering.java * Copyright (C) 2007 University of Waikato, Hamilton, New Zealand */ package weka.classifiers.meta; import weka.classifiers.Classifier; import weka.classifiers.rules.ZeroR; import weka.clusterers.ClusterEvaluation; import weka.clusterers.Clusterer; import weka.clusterers.SimpleKMeans; import weka.core.Capabilities; import weka.core.Instance; import weka.core.Instances; import weka.core.Option; import weka.core.OptionHandler; import weka.core.Utils; import weka.core.Capabilities.Capability; import java.util.Enumeration; import java.util.Vector; /** <!-- globalinfo-start --> * A simple meta-classifier that uses a clusterer for classification. For cluster algorithms that use a fixed number of clusterers, like SimpleKMeans, the user has to make sure that the number of clusters to generate are the same as the number of class labels in the dataset in order to obtain a useful model.<br/> * <br/> * Note: at prediction time, a missing value is returned if no cluster is found for the instance.<br/> * <br/> * The code is based on the 'clusters to classes' functionality of the weka.clusterers.ClusterEvaluation class by Mark Hall. * <p/> <!-- globalinfo-end --> * <!-- options-start --> * Valid options are: <p/> * * <pre> -D * If set, classifier is run in debug mode and * may output additional info to the console</pre> * * <pre> -W * Full name of clusterer. * (default: weka.clusterers.SimpleKMeans)</pre> * * <pre> * Options specific to clusterer weka.clusterers.SimpleKMeans: * </pre> * * <pre> -N &lt;num&gt; * number of clusters. * (default 2).</pre> * * <pre> -S &lt;num&gt; * Random number seed. * (default 10)</pre> * <!-- options-end --> * * @author fracpete (fracpete at waikato dot ac dot nz) * @version $Revision: 1.2 $ */ public class ClassificationViaClustering extends Classifier { /** for serialization */ private static final long serialVersionUID = -5687069451420259135L; /** the cluster algorithm used (template) */ protected Clusterer m_Clusterer; /** the actual cluster algorithm being used */ protected Clusterer m_ActualClusterer; /** the original training data header */ protected Instances m_OriginalHeader; /** the modified training data header */ protected Instances m_ClusteringHeader; /** the mapping between clusters and classes */ protected double[] m_ClustersToClasses; /** the default model */ protected Classifier m_ZeroR; /** * default constructor */ public ClassificationViaClustering() { super(); m_Clusterer = new SimpleKMeans(); } /** * Returns a string describing classifier * * @return a description suitable for displaying in the * explorer/experimenter gui */ public String globalInfo() { return "A simple meta-classifier that uses a clusterer for classification. " + "For cluster algorithms that use a fixed number of clusterers, like " + "SimpleKMeans, the user has to make sure that the number of clusters " + "to generate are the same as the number of class labels in the dataset " + "in order to obtain a useful model.\n" + "\n" + "Note: at prediction time, a missing value is returned if no cluster " + "is found for the instance.\n" + "\n" + "The code is based on the 'clusters to classes' functionality of the " + "weka.clusterers.ClusterEvaluation class by Mark Hall."; } /** * Gets an enumeration describing the available options. * * @return an enumeration of all the available options. */ public Enumeration listOptions(){ Vector result; Enumeration enm; result = new Vector(); enm = super.listOptions(); while (enm.hasMoreElements()) result.addElement(enm.nextElement()); result.addElement(new Option( "\tFull name of clusterer.\n" + "\t(default: " + defaultClustererString() +")", "W", 1, "-W")); result.addElement(new Option( "", "", 0, "\nOptions specific to clusterer " + m_Clusterer.getClass().getName() + ":")); enm = ((OptionHandler) m_Clusterer).listOptions(); while (enm.hasMoreElements()) result.addElement(enm.nextElement()); return result.elements(); } /** * returns the options of the current setup * * @return the current options */ public String[] getOptions(){ int i; Vector<String> result; String[] options; result = new Vector<String>(); result.add("-W"); result.add("" + getClusterer().getClass().getName()); options = super.getOptions(); for (i = 0; i < options.length; i++) result.add(options[i]); if (getClusterer() instanceof OptionHandler) { result.add("--"); options = ((OptionHandler) getClusterer()).getOptions(); for (i = 0; i < options.length; i++) result.add(options[i]); } return result.toArray(new String[result.size()]); } /** * Parses the options for this object. <p/> * <!-- options-start --> * Valid options are: <p/> * * <pre> -D * If set, classifier is run in debug mode and * may output additional info to the console</pre> * * <pre> -W * Full name of clusterer. * (default: weka.clusterers.SimpleKMeans)</pre> * * <pre> * Options specific to clusterer weka.clusterers.SimpleKMeans: * </pre> * * <pre> -N &lt;num&gt; * number of clusters. * (default 2).</pre> * * <pre> -S &lt;num&gt; * Random number seed. * (default 10)</pre> * <!-- options-end --> * * @param options the options to use * @throws Exception if setting of options fails */ public void setOptions(String[] options) throws Exception { String tmpStr; super.setOptions(options); tmpStr = Utils.getOption('W', options); if (tmpStr.length() > 0) { // This is just to set the classifier in case the option // parsing fails. setClusterer(Clusterer.forName(tmpStr, null)); setClusterer(Clusterer.forName(tmpStr, Utils.partitionOptions(options))); } else { // This is just to set the classifier in case the option // parsing fails. setClusterer(Clusterer.forName(defaultClustererString(), null)); setClusterer(Clusterer.forName(defaultClustererString(), Utils.partitionOptions(options))); } } /** * String describing default clusterer. * * @return the classname */ protected String defaultClustererString() { return SimpleKMeans.class.getName(); } /** * Returns the tip text for this property * * @return tip text for this property suitable for * displaying in the explorer/experimenter gui */ public String clustererTipText() { return "The clusterer to be used."; } /** * Set the base clusterer. * * @param value the clusterer to use. */ public void setClusterer(Clusterer value) { m_Clusterer = value; } /** * Get the clusterer used as the base learner. * * @return the current clusterer */ public Clusterer getClusterer() { return m_Clusterer; } /** * Classifies the given test instance. * * @param instance the instance to be classified * @return the predicted most likely class for the instance or * Instance.missingValue() if no prediction is made * @throws Exception if an error occurred during the prediction */ public double classifyInstance(Instance instance) throws Exception { double result; double[] values; Instance newInst; int i; int n; if (m_ZeroR != null) { result = m_ZeroR.classifyInstance(instance); } else { if (m_ActualClusterer != null) { // build new instance values = new double[m_ClusteringHeader.numAttributes()]; n = 0; for (i = 0; i < instance.numAttributes(); i++) { if (i == instance.classIndex()) continue; values[n] = instance.value(i); n++; } newInst = new Instance(instance.weight(), values); newInst.setDataset(m_ClusteringHeader); // determine cluster/class result = m_ClustersToClasses[m_ActualClusterer.clusterInstance(newInst)]; if (result == -1) result = Instance.missingValue(); } else { result = Instance.missingValue(); } } return result; } /** * Returns default capabilities of the classifier. * * @return the capabilities of this classifier */ public Capabilities getCapabilities() { Capabilities result; result = m_Clusterer.getCapabilities(); // class result.disableAllClasses(); result.disable(Capability.NO_CLASS); result.enable(Capability.NOMINAL_CLASS); return result; } /** * builds the classifier * * @param data the training instances * @throws Exception if something goes wrong */ public void buildClassifier(Instances data) throws Exception { Instances clusterData; ClusterEvaluation eval; int i; Instance instance; int[][] counts; int[] clusterTotals; double[] best; double[] current; double[] clusterAssignments; // can classifier handle the data? getCapabilities().testWithFail(data); // remove instances with missing class data = new Instances(data); data.deleteWithMissingClass(); // save original header (needed for clusters to classes output) m_OriginalHeader = new Instances(data, 0); // remove class attribute for clusterer clusterData = new Instances(data); clusterData.setClassIndex(-1); clusterData.deleteAttributeAt(m_OriginalHeader.classIndex()); m_ClusteringHeader = new Instances(clusterData, 0); if (m_ClusteringHeader.numAttributes() == 0) { System.err.println("Data contains only class attribute, defaulting to ZeroR model."); m_ZeroR = new ZeroR(); m_ZeroR.buildClassifier(data); } else { m_ZeroR = null; // build clusterer m_ActualClusterer = Clusterer.makeCopy(m_Clusterer); m_ActualClusterer.buildClusterer(clusterData); // evaluate clusterer on training set eval = new ClusterEvaluation(); eval.setClusterer(m_ActualClusterer); eval.evaluateClusterer(clusterData); clusterAssignments = eval.getClusterAssignments(); // determine classes-to-clusters mapping counts = new int [eval.getNumClusters()][m_OriginalHeader.numClasses()]; clusterTotals = new int[eval.getNumClusters()]; best = new double[eval.getNumClusters()+1]; current = new double[eval.getNumClusters()+1]; for (i = 0; i < data.numInstances(); i++) { instance = data.instance(i); counts[(int) clusterAssignments[i]][(int) instance.classValue()]++; clusterTotals[(int) clusterAssignments[i]]++; i++; } best[eval.getNumClusters()] = Double.MAX_VALUE; ClusterEvaluation.mapClasses(eval.getNumClusters(), 0, counts, clusterTotals, current, best, 0); m_ClustersToClasses = new double[best.length]; System.arraycopy(best, 0, m_ClustersToClasses, 0, best.length); } } /** * Returns a string representation of the classifier. * * @return a string representation of the classifier. */ public String toString() { StringBuffer result; int i; int n; boolean found; result = new StringBuffer(); // title result.append(this.getClass().getName().replaceAll(".*\\.", "") + "\n"); result.append(this.getClass().getName().replaceAll(".*\\.", "").replaceAll(".", "=") + "\n"); // model if (m_ActualClusterer != null) { // output clusterer result.append(m_ActualClusterer + "\n"); // clusters to classes result.append("Clusters to classes mapping:\n"); for (i = 0; i < m_ClustersToClasses.length - 1; i++) { result.append(" " + (i+1) + ". Cluster: "); if (m_ClustersToClasses[i] < 0) result.append("no class"); else result.append( m_OriginalHeader.classAttribute().value((int) m_ClustersToClasses[i]) + " (" + ((int) m_ClustersToClasses[i] + 1) + ")"); result.append("\n"); } result.append("\n"); // classes to clusters result.append("Classes to clusters mapping:\n"); for (i = 0; i < m_OriginalHeader.numClasses(); i++) { result.append( " " + (i+1) + ". Class (" + m_OriginalHeader.classAttribute().value(i) + "): "); found = false; for (n = 0; n < m_ClustersToClasses.length - 1; n++) { if (((int) m_ClustersToClasses[n]) == i) { found = true; result.append((n+1) + ". Cluster"); break; } } if (!found) result.append("no cluster"); result.append("\n"); } result.append("\n"); } else { result.append("no model built yet\n"); } return result.toString(); } /** * Runs the classifier with the given options * * @param args the commandline options */ public static void main(String[] args) { runClassifier(new ClassificationViaClustering(), args); } }
UTF-8
Java
13,909
java
ClassificationViaClustering.java
Java
[ { "context": "10)</pre>\n * \n <!-- options-end -->\n *\n * @author fracpete (fracpete at waikato dot ac dot nz)\n * @version $", "end": 2509, "score": 0.9994720816612244, "start": 2501, "tag": "USERNAME", "value": "fracpete" }, { "context": " + \"weka.clusterers.ClusterEvaluation class by Mark Hall.\";\n }\n\n /**\n * Gets an enumeration describing", "end": 4245, "score": 0.9953535795211792, "start": 4236, "tag": "NAME", "value": "Mark Hall" } ]
null
[]
/* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* * ClassificationViaClustering.java * Copyright (C) 2007 University of Waikato, Hamilton, New Zealand */ package weka.classifiers.meta; import weka.classifiers.Classifier; import weka.classifiers.rules.ZeroR; import weka.clusterers.ClusterEvaluation; import weka.clusterers.Clusterer; import weka.clusterers.SimpleKMeans; import weka.core.Capabilities; import weka.core.Instance; import weka.core.Instances; import weka.core.Option; import weka.core.OptionHandler; import weka.core.Utils; import weka.core.Capabilities.Capability; import java.util.Enumeration; import java.util.Vector; /** <!-- globalinfo-start --> * A simple meta-classifier that uses a clusterer for classification. For cluster algorithms that use a fixed number of clusterers, like SimpleKMeans, the user has to make sure that the number of clusters to generate are the same as the number of class labels in the dataset in order to obtain a useful model.<br/> * <br/> * Note: at prediction time, a missing value is returned if no cluster is found for the instance.<br/> * <br/> * The code is based on the 'clusters to classes' functionality of the weka.clusterers.ClusterEvaluation class by Mark Hall. * <p/> <!-- globalinfo-end --> * <!-- options-start --> * Valid options are: <p/> * * <pre> -D * If set, classifier is run in debug mode and * may output additional info to the console</pre> * * <pre> -W * Full name of clusterer. * (default: weka.clusterers.SimpleKMeans)</pre> * * <pre> * Options specific to clusterer weka.clusterers.SimpleKMeans: * </pre> * * <pre> -N &lt;num&gt; * number of clusters. * (default 2).</pre> * * <pre> -S &lt;num&gt; * Random number seed. * (default 10)</pre> * <!-- options-end --> * * @author fracpete (fracpete at waikato dot ac dot nz) * @version $Revision: 1.2 $ */ public class ClassificationViaClustering extends Classifier { /** for serialization */ private static final long serialVersionUID = -5687069451420259135L; /** the cluster algorithm used (template) */ protected Clusterer m_Clusterer; /** the actual cluster algorithm being used */ protected Clusterer m_ActualClusterer; /** the original training data header */ protected Instances m_OriginalHeader; /** the modified training data header */ protected Instances m_ClusteringHeader; /** the mapping between clusters and classes */ protected double[] m_ClustersToClasses; /** the default model */ protected Classifier m_ZeroR; /** * default constructor */ public ClassificationViaClustering() { super(); m_Clusterer = new SimpleKMeans(); } /** * Returns a string describing classifier * * @return a description suitable for displaying in the * explorer/experimenter gui */ public String globalInfo() { return "A simple meta-classifier that uses a clusterer for classification. " + "For cluster algorithms that use a fixed number of clusterers, like " + "SimpleKMeans, the user has to make sure that the number of clusters " + "to generate are the same as the number of class labels in the dataset " + "in order to obtain a useful model.\n" + "\n" + "Note: at prediction time, a missing value is returned if no cluster " + "is found for the instance.\n" + "\n" + "The code is based on the 'clusters to classes' functionality of the " + "weka.clusterers.ClusterEvaluation class by <NAME>."; } /** * Gets an enumeration describing the available options. * * @return an enumeration of all the available options. */ public Enumeration listOptions(){ Vector result; Enumeration enm; result = new Vector(); enm = super.listOptions(); while (enm.hasMoreElements()) result.addElement(enm.nextElement()); result.addElement(new Option( "\tFull name of clusterer.\n" + "\t(default: " + defaultClustererString() +")", "W", 1, "-W")); result.addElement(new Option( "", "", 0, "\nOptions specific to clusterer " + m_Clusterer.getClass().getName() + ":")); enm = ((OptionHandler) m_Clusterer).listOptions(); while (enm.hasMoreElements()) result.addElement(enm.nextElement()); return result.elements(); } /** * returns the options of the current setup * * @return the current options */ public String[] getOptions(){ int i; Vector<String> result; String[] options; result = new Vector<String>(); result.add("-W"); result.add("" + getClusterer().getClass().getName()); options = super.getOptions(); for (i = 0; i < options.length; i++) result.add(options[i]); if (getClusterer() instanceof OptionHandler) { result.add("--"); options = ((OptionHandler) getClusterer()).getOptions(); for (i = 0; i < options.length; i++) result.add(options[i]); } return result.toArray(new String[result.size()]); } /** * Parses the options for this object. <p/> * <!-- options-start --> * Valid options are: <p/> * * <pre> -D * If set, classifier is run in debug mode and * may output additional info to the console</pre> * * <pre> -W * Full name of clusterer. * (default: weka.clusterers.SimpleKMeans)</pre> * * <pre> * Options specific to clusterer weka.clusterers.SimpleKMeans: * </pre> * * <pre> -N &lt;num&gt; * number of clusters. * (default 2).</pre> * * <pre> -S &lt;num&gt; * Random number seed. * (default 10)</pre> * <!-- options-end --> * * @param options the options to use * @throws Exception if setting of options fails */ public void setOptions(String[] options) throws Exception { String tmpStr; super.setOptions(options); tmpStr = Utils.getOption('W', options); if (tmpStr.length() > 0) { // This is just to set the classifier in case the option // parsing fails. setClusterer(Clusterer.forName(tmpStr, null)); setClusterer(Clusterer.forName(tmpStr, Utils.partitionOptions(options))); } else { // This is just to set the classifier in case the option // parsing fails. setClusterer(Clusterer.forName(defaultClustererString(), null)); setClusterer(Clusterer.forName(defaultClustererString(), Utils.partitionOptions(options))); } } /** * String describing default clusterer. * * @return the classname */ protected String defaultClustererString() { return SimpleKMeans.class.getName(); } /** * Returns the tip text for this property * * @return tip text for this property suitable for * displaying in the explorer/experimenter gui */ public String clustererTipText() { return "The clusterer to be used."; } /** * Set the base clusterer. * * @param value the clusterer to use. */ public void setClusterer(Clusterer value) { m_Clusterer = value; } /** * Get the clusterer used as the base learner. * * @return the current clusterer */ public Clusterer getClusterer() { return m_Clusterer; } /** * Classifies the given test instance. * * @param instance the instance to be classified * @return the predicted most likely class for the instance or * Instance.missingValue() if no prediction is made * @throws Exception if an error occurred during the prediction */ public double classifyInstance(Instance instance) throws Exception { double result; double[] values; Instance newInst; int i; int n; if (m_ZeroR != null) { result = m_ZeroR.classifyInstance(instance); } else { if (m_ActualClusterer != null) { // build new instance values = new double[m_ClusteringHeader.numAttributes()]; n = 0; for (i = 0; i < instance.numAttributes(); i++) { if (i == instance.classIndex()) continue; values[n] = instance.value(i); n++; } newInst = new Instance(instance.weight(), values); newInst.setDataset(m_ClusteringHeader); // determine cluster/class result = m_ClustersToClasses[m_ActualClusterer.clusterInstance(newInst)]; if (result == -1) result = Instance.missingValue(); } else { result = Instance.missingValue(); } } return result; } /** * Returns default capabilities of the classifier. * * @return the capabilities of this classifier */ public Capabilities getCapabilities() { Capabilities result; result = m_Clusterer.getCapabilities(); // class result.disableAllClasses(); result.disable(Capability.NO_CLASS); result.enable(Capability.NOMINAL_CLASS); return result; } /** * builds the classifier * * @param data the training instances * @throws Exception if something goes wrong */ public void buildClassifier(Instances data) throws Exception { Instances clusterData; ClusterEvaluation eval; int i; Instance instance; int[][] counts; int[] clusterTotals; double[] best; double[] current; double[] clusterAssignments; // can classifier handle the data? getCapabilities().testWithFail(data); // remove instances with missing class data = new Instances(data); data.deleteWithMissingClass(); // save original header (needed for clusters to classes output) m_OriginalHeader = new Instances(data, 0); // remove class attribute for clusterer clusterData = new Instances(data); clusterData.setClassIndex(-1); clusterData.deleteAttributeAt(m_OriginalHeader.classIndex()); m_ClusteringHeader = new Instances(clusterData, 0); if (m_ClusteringHeader.numAttributes() == 0) { System.err.println("Data contains only class attribute, defaulting to ZeroR model."); m_ZeroR = new ZeroR(); m_ZeroR.buildClassifier(data); } else { m_ZeroR = null; // build clusterer m_ActualClusterer = Clusterer.makeCopy(m_Clusterer); m_ActualClusterer.buildClusterer(clusterData); // evaluate clusterer on training set eval = new ClusterEvaluation(); eval.setClusterer(m_ActualClusterer); eval.evaluateClusterer(clusterData); clusterAssignments = eval.getClusterAssignments(); // determine classes-to-clusters mapping counts = new int [eval.getNumClusters()][m_OriginalHeader.numClasses()]; clusterTotals = new int[eval.getNumClusters()]; best = new double[eval.getNumClusters()+1]; current = new double[eval.getNumClusters()+1]; for (i = 0; i < data.numInstances(); i++) { instance = data.instance(i); counts[(int) clusterAssignments[i]][(int) instance.classValue()]++; clusterTotals[(int) clusterAssignments[i]]++; i++; } best[eval.getNumClusters()] = Double.MAX_VALUE; ClusterEvaluation.mapClasses(eval.getNumClusters(), 0, counts, clusterTotals, current, best, 0); m_ClustersToClasses = new double[best.length]; System.arraycopy(best, 0, m_ClustersToClasses, 0, best.length); } } /** * Returns a string representation of the classifier. * * @return a string representation of the classifier. */ public String toString() { StringBuffer result; int i; int n; boolean found; result = new StringBuffer(); // title result.append(this.getClass().getName().replaceAll(".*\\.", "") + "\n"); result.append(this.getClass().getName().replaceAll(".*\\.", "").replaceAll(".", "=") + "\n"); // model if (m_ActualClusterer != null) { // output clusterer result.append(m_ActualClusterer + "\n"); // clusters to classes result.append("Clusters to classes mapping:\n"); for (i = 0; i < m_ClustersToClasses.length - 1; i++) { result.append(" " + (i+1) + ". Cluster: "); if (m_ClustersToClasses[i] < 0) result.append("no class"); else result.append( m_OriginalHeader.classAttribute().value((int) m_ClustersToClasses[i]) + " (" + ((int) m_ClustersToClasses[i] + 1) + ")"); result.append("\n"); } result.append("\n"); // classes to clusters result.append("Classes to clusters mapping:\n"); for (i = 0; i < m_OriginalHeader.numClasses(); i++) { result.append( " " + (i+1) + ". Class (" + m_OriginalHeader.classAttribute().value(i) + "): "); found = false; for (n = 0; n < m_ClustersToClasses.length - 1; n++) { if (((int) m_ClustersToClasses[n]) == i) { found = true; result.append((n+1) + ". Cluster"); break; } } if (!found) result.append("no cluster"); result.append("\n"); } result.append("\n"); } else { result.append("no model built yet\n"); } return result.toString(); } /** * Runs the classifier with the given options * * @param args the commandline options */ public static void main(String[] args) { runClassifier(new ClassificationViaClustering(), args); } }
13,906
0.642534
0.637573
487
27.560575
26.621075
314
false
false
0
0
0
0
0
0
0.712526
false
false
13
26952b63128d9fd00aba4ec910626a921183abc6
7,799,660,664,772
e15e5feeae553e50a6143a9585d98bc87cd77e77
/src/dangcat-business/src/main/java/org/dangcat/business/exceptions/BusinessException.java
1ae9dc6375114c26aa2ae81cdc9c27deaadeb319
[]
no_license
BonnieTang/dangcat
https://github.com/BonnieTang/dangcat
fef0c62dc71a5247bc7aa3d0d8b6c80df937e361
0618384f18c40588b7fab5eee19e7e9dcc12479f
refs/heads/master
2021-01-20T22:45:09.045000
2016-06-24T02:04:39
2016-06-24T02:04:39
61,852,194
1
0
null
true
2016-06-24T02:48:25
2016-06-24T02:48:25
2016-06-23T16:15:30
2016-06-24T02:05:05
11,893
0
0
0
null
null
null
package org.dangcat.business.exceptions; import org.dangcat.persistence.validator.exception.DataValidateException; /** * 业务服务异常。 * * @author dangcat */ public class BusinessException extends DataValidateException { /** * 有特殊权限才能修改。 */ public static final Integer ADVANCED_MODIFY = 59; /** * 新增数据失败。 */ public static final Integer CREATE_ERROR = 53; /** * 数据不存在。 */ public static final Integer DATA_NOTEXISTS = 56; /** * 没有找到符合条件的结果。 */ public static final Integer DATA_NOTFOUND = 54; /** * 数据重复。 */ public static final Integer DATA_REPEAT = 55; /** * 数据状态不正确。 */ public static final Integer DATASTATE_INCORRECT = 60; /** * 删除数据错误。 */ public static final Integer DELETE_ERROR = 50; /** * 字段不存在。 */ public static final Integer FIELD_NOTEXISTS = 58; /** * 执行错误,请查看后台日志。 */ public static final Integer INVOKE_ERROR = 60; /** * 加载数据错误。 */ public static final Integer LOAD_ERROR = 51; /** * 没有执行权限。 */ public static final Integer PERMISSION_DENY = 57; /** * 保存数据失败。 */ public static final Integer SAVE_ERROR = 52; private static final long serialVersionUID = 1L; public BusinessException(Class<?> classType, String fieldName, Integer messageId, Object... params) { super(classType, fieldName, messageId, params); } public BusinessException(Integer messageId, Object... params) { super(messageId, params); } }
GB18030
Java
1,835
java
BusinessException.java
Java
[ { "context": "idateException;\r\n\r\n/**\r\n * 业务服务异常。\r\n *\r\n * @author dangcat\r\n */\r\npublic class BusinessException extends Data", "end": 160, "score": 0.9993899464607239, "start": 153, "tag": "USERNAME", "value": "dangcat" } ]
null
[]
package org.dangcat.business.exceptions; import org.dangcat.persistence.validator.exception.DataValidateException; /** * 业务服务异常。 * * @author dangcat */ public class BusinessException extends DataValidateException { /** * 有特殊权限才能修改。 */ public static final Integer ADVANCED_MODIFY = 59; /** * 新增数据失败。 */ public static final Integer CREATE_ERROR = 53; /** * 数据不存在。 */ public static final Integer DATA_NOTEXISTS = 56; /** * 没有找到符合条件的结果。 */ public static final Integer DATA_NOTFOUND = 54; /** * 数据重复。 */ public static final Integer DATA_REPEAT = 55; /** * 数据状态不正确。 */ public static final Integer DATASTATE_INCORRECT = 60; /** * 删除数据错误。 */ public static final Integer DELETE_ERROR = 50; /** * 字段不存在。 */ public static final Integer FIELD_NOTEXISTS = 58; /** * 执行错误,请查看后台日志。 */ public static final Integer INVOKE_ERROR = 60; /** * 加载数据错误。 */ public static final Integer LOAD_ERROR = 51; /** * 没有执行权限。 */ public static final Integer PERMISSION_DENY = 57; /** * 保存数据失败。 */ public static final Integer SAVE_ERROR = 52; private static final long serialVersionUID = 1L; public BusinessException(Class<?> classType, String fieldName, Integer messageId, Object... params) { super(classType, fieldName, messageId, params); } public BusinessException(Integer messageId, Object... params) { super(messageId, params); } }
1,835
0.579399
0.564071
68
21.985294
23.052685
105
false
false
0
0
0
0
0
0
0.367647
false
false
13
797e2a1a8e7a587ba8b91718d7328fecf45edee5
6,897,717,494,440
dd57f34bdc2067d2ce1e039d34cfcf1dbc376909
/src/main/java/com/lateu/projet/lycee/service/ServiceClasseLevel.java
92247cddb3e4e0c55ceaa3437d77fe5226ad1ada
[]
no_license
lateu/SFGL
https://github.com/lateu/SFGL
4eb727fe6c62df4d2941e27d5bf3bb0f571b88e9
5b7222f8112dbbdb04671d5e846e795309864a87
refs/heads/master
2021-01-25T05:22:49.146000
2016-11-19T05:45:24
2016-11-19T05:45:24
24,753,611
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.lateu.projet.lycee.service; import com.lateu.projet.lycee.Enum.Cycle; import com.lateu.projet.lycee.entities.ClasseLevel; import java.util.List; /** * * @author ing-lateu */ public interface ServiceClasseLevel { public void save(ClasseLevel clevel)throws ServiceException; public List<ClasseLevel>findbyCycleId(Cycle c); public List<ClasseLevel>findAll()throws ServiceException; public ClasseLevel findbyId(Long c); }
UTF-8
Java
561
java
ServiceClasseLevel.java
Java
[ { "context": "seLevel;\nimport java.util.List;\n\n/**\n *\n * @author ing-lateu\n */\npublic interface ServiceClasseLevel {\n \n ", "end": 286, "score": 0.9995021820068359, "start": 277, "tag": "USERNAME", "value": "ing-lateu" } ]
null
[]
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.lateu.projet.lycee.service; import com.lateu.projet.lycee.Enum.Cycle; import com.lateu.projet.lycee.entities.ClasseLevel; import java.util.List; /** * * @author ing-lateu */ public interface ServiceClasseLevel { public void save(ClasseLevel clevel)throws ServiceException; public List<ClasseLevel>findbyCycleId(Cycle c); public List<ClasseLevel>findAll()throws ServiceException; public ClasseLevel findbyId(Long c); }
561
0.745098
0.745098
22
24.5
22.524229
64
false
false
0
0
0
0
0
0
0.454545
false
false
13
8bedada0fca582361c8d2d28aec085324eab8527
6,124,623,391,414
989672d0eb4ebec2d4ab2ce954d13c1b80bbb835
/Demokratie2/src/de/haeherfeder/ZerstöreDieDemokratieSpiel/main2.java
75611439f6055751c0674b3f079e0d0ee3a38ec6
[]
no_license
Haeherfeder/DestroyDemokratieGame
https://github.com/Haeherfeder/DestroyDemokratieGame
23c06abd2d68bc012f024c0d3ae971db1a687f8f
53ca967bf3fbeb51a163938c6a99bfab8a3ec6e2
refs/heads/master
2020-04-03T12:15:09.231000
2018-11-21T12:40:23
2018-11-21T12:40:23
155,246,124
0
0
null
false
2018-10-29T21:02:30
2018-10-29T16:38:05
2018-10-29T17:49:55
2018-10-29T21:02:29
9
0
0
0
Java
false
null
/**-------------------------------------------------------ä * */ package de.haeherfeder.ZerstöreDieDemokratieSpiel; import java.io.IOException; public class main2 { public static void main(String[] args) throws IOException { /* JFrame gameTest = new JFrame(); gameTest.setTitle("Game Register"); gameTest.setSize(300, 150); JPanel panel = new JPanel(); JLabel label = new JLabel("Name"); panel.add(label); JTextField tfName = new JTextField("Test",20); // JLabel label2 = new JLabel("Name"); JTextField tfName2 = new JTextField("T3st",20); panel.add(tfName); panel.add(tfName2); JButton buttonOK = new JButton("OK"); panel.add(buttonOK); // buttonOK.addActionListener(); gameTest.add(panel); // gameTest.setDefaultCloseOperation(0); String Name = null; gameTest.setVisible(true); register(Name,panel,tfName,tfName2);*/ new main2(); System.out.println("Ende"); System.exit(0); } /* private void register(String Name, JPanel panel,JTextField tfName,JTextField tfName2) { while(!false) { Name = tfName.getText(); panel.remove(tfName2); tfName2 = new JTextField(Name,10); panel.add(tfName2); } }*/ /*public void Start(String g){ TextField tf1,tf2,tf3 = null; Label l1,l2,l3 = null; Panel p1,p2,p3 = null; Frame f = null; String Text = null; System.out.println(Inhalt.values()); int b,h; b = 800; h = 400; System.out.print("HI "); int hi = 3; System.out.println(hi); tf1 = TextFieldG("Hallo",20); tf2 = TextFieldG("h",1); tf3 = TextFieldG("",1); p1 = PanelG(tf1); p2 = PanelG(tf2); p3 = PanelG(tf3); l1 = LabelG("Inhalt"); l2 = LabelG("J"); f = FrameG("Text Show",h,b,3,p1,l1,p2,l2,p3,l3); // f.remove(p1); // TextField tf2 = new TextField(Text); System.out.println("f"); // f.add(p1); while(true) { System.out.println("Gelesen: " + tf2.getText()); try { TimeUnit.SECONDS.sleep(8); } catch (InterruptedException e) { e.printStackTrace(); } if(tf2.getText().matches("J")) { System.out.println("Ende, J gelesen."); break; } } Text = tf1.getText(); System.out.println("Text: " + Text); String Inhalt2 = Inhalt.Start.getText(); switch(Text) { case "a": case "A": f.removeAll(); String na = Inhalt.Start.getnexta(); Label a = LabelG(Inhalt.Start.getnexta()); Start("ddd"); f.add(a); f.pack(); f.setSize(b, h); f.setVisible(true); break; default: break; } System.out.println(Inhalt2); try { TimeUnit.SECONDS.sleep(8); } catch (InterruptedException e) { e.printStackTrace(); } f.removeAll(); f.setVisible(false); return; }*/ public main2() throws IOException { configFR conf = new configFR(); conf.configFRSt(); System.out.println(conf.getProp("key")); conf.setPr("CurrentPlayer",""); String Gamestart = null; new GameWindow(Gamestart); return; }/* public Panel PanelG(TextField tf) { Panel p = new Panel(); p.add(tf); return p; } public TextField TextFieldG(String text, int len) { TextField tf = new TextField(text,len); return tf; } public Frame FrameG(String Name,int h, int b,int n, Panel p1, Label la1,Panel p2,Label la2,Panel p3, Label la3) { Frame f = new Frame(Name); f.setLayout(new GridLayout()); for(int i = 0;i<n;i++) { System.out.println("for"); switch(i) { case 0: System.out.println("case 0"); case 1: f.add(la1); f.add(p1); System.out.println("case 1"); break; case 2: f.add(la2); f.add(p2); System.out.println("case 2"); break; case 3: f.add(la3); f.add(p3); System.out.println("case 3"); break; default: System.out.println("cas def"); break; } } f.pack(); f.setSize(b, h); f.setVisible(true); return f; }*/ }
UTF-8
Java
3,753
java
main2.java
Java
[ { "context": " 3;\n\t\tSystem.out.println(hi);\n\t\ttf1 = TextFieldG(\"Hallo\",20);\n\t\ttf2 = TextFieldG(\"h\",1);\n\t\ttf3 = TextFiel", "end": 1455, "score": 0.9987703561782837, "start": 1450, "tag": "NAME", "value": "Hallo" } ]
null
[]
/**-------------------------------------------------------ä * */ package de.haeherfeder.ZerstöreDieDemokratieSpiel; import java.io.IOException; public class main2 { public static void main(String[] args) throws IOException { /* JFrame gameTest = new JFrame(); gameTest.setTitle("Game Register"); gameTest.setSize(300, 150); JPanel panel = new JPanel(); JLabel label = new JLabel("Name"); panel.add(label); JTextField tfName = new JTextField("Test",20); // JLabel label2 = new JLabel("Name"); JTextField tfName2 = new JTextField("T3st",20); panel.add(tfName); panel.add(tfName2); JButton buttonOK = new JButton("OK"); panel.add(buttonOK); // buttonOK.addActionListener(); gameTest.add(panel); // gameTest.setDefaultCloseOperation(0); String Name = null; gameTest.setVisible(true); register(Name,panel,tfName,tfName2);*/ new main2(); System.out.println("Ende"); System.exit(0); } /* private void register(String Name, JPanel panel,JTextField tfName,JTextField tfName2) { while(!false) { Name = tfName.getText(); panel.remove(tfName2); tfName2 = new JTextField(Name,10); panel.add(tfName2); } }*/ /*public void Start(String g){ TextField tf1,tf2,tf3 = null; Label l1,l2,l3 = null; Panel p1,p2,p3 = null; Frame f = null; String Text = null; System.out.println(Inhalt.values()); int b,h; b = 800; h = 400; System.out.print("HI "); int hi = 3; System.out.println(hi); tf1 = TextFieldG("Hallo",20); tf2 = TextFieldG("h",1); tf3 = TextFieldG("",1); p1 = PanelG(tf1); p2 = PanelG(tf2); p3 = PanelG(tf3); l1 = LabelG("Inhalt"); l2 = LabelG("J"); f = FrameG("Text Show",h,b,3,p1,l1,p2,l2,p3,l3); // f.remove(p1); // TextField tf2 = new TextField(Text); System.out.println("f"); // f.add(p1); while(true) { System.out.println("Gelesen: " + tf2.getText()); try { TimeUnit.SECONDS.sleep(8); } catch (InterruptedException e) { e.printStackTrace(); } if(tf2.getText().matches("J")) { System.out.println("Ende, J gelesen."); break; } } Text = tf1.getText(); System.out.println("Text: " + Text); String Inhalt2 = Inhalt.Start.getText(); switch(Text) { case "a": case "A": f.removeAll(); String na = Inhalt.Start.getnexta(); Label a = LabelG(Inhalt.Start.getnexta()); Start("ddd"); f.add(a); f.pack(); f.setSize(b, h); f.setVisible(true); break; default: break; } System.out.println(Inhalt2); try { TimeUnit.SECONDS.sleep(8); } catch (InterruptedException e) { e.printStackTrace(); } f.removeAll(); f.setVisible(false); return; }*/ public main2() throws IOException { configFR conf = new configFR(); conf.configFRSt(); System.out.println(conf.getProp("key")); conf.setPr("CurrentPlayer",""); String Gamestart = null; new GameWindow(Gamestart); return; }/* public Panel PanelG(TextField tf) { Panel p = new Panel(); p.add(tf); return p; } public TextField TextFieldG(String text, int len) { TextField tf = new TextField(text,len); return tf; } public Frame FrameG(String Name,int h, int b,int n, Panel p1, Label la1,Panel p2,Label la2,Panel p3, Label la3) { Frame f = new Frame(Name); f.setLayout(new GridLayout()); for(int i = 0;i<n;i++) { System.out.println("for"); switch(i) { case 0: System.out.println("case 0"); case 1: f.add(la1); f.add(p1); System.out.println("case 1"); break; case 2: f.add(la2); f.add(p2); System.out.println("case 2"); break; case 3: f.add(la3); f.add(p3); System.out.println("case 3"); break; default: System.out.println("cas def"); break; } } f.pack(); f.setSize(b, h); f.setVisible(true); return f; }*/ }
3,753
0.621168
0.595841
158
22.746836
16.082438
114
false
false
0
0
0
0
0
0
3.126582
false
false
13
6001f56fe9ba4ed8ffda362f116612023c3a930a
6,124,623,390,593
09f1faa9d2d196e75ac13fd30a62f947bfb9150c
/String2/prefixAgain.java
7daa14344fa49c8e2868c2329c58a79be888acf2
[]
no_license
AndrewLaing/CodingBatJava
https://github.com/AndrewLaing/CodingBatJava
a208dc769a4a7a0316e172986d5e5eb4e2404217
9c4ded83d98a9902bc5b9ec8f0f4477dce90ca9e
refs/heads/master
2020-04-06T07:54:31.789000
2016-08-22T11:13:18
2016-08-22T11:13:18
65,389,992
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public boolean prefixAgain(String str, int n) { int strLen = str.length(); if(strLen<2) return false; String prefixStr = str.substring(0,n); return str.substring(1).indexOf(prefixStr)!=-1; }
UTF-8
Java
213
java
prefixAgain.java
Java
[]
null
[]
public boolean prefixAgain(String str, int n) { int strLen = str.length(); if(strLen<2) return false; String prefixStr = str.substring(0,n); return str.substring(1).indexOf(prefixStr)!=-1; }
213
0.657277
0.638498
8
25.625
19.512417
51
false
false
0
0
0
0
0
0
0.75
false
false
13
6dd6aa1c7a97fb5da96c96c0cffc5f1aa5c28047
17,978,733,165,099
39bef83f3a903f49344b907870feb10a3302e6e4
/Android Studio Projects/bf.io.openshop/src/com/squareup/picasso/UrlConnectionDownloader.java
4f8c6e14e2780c7ccbb439c621ae6acea8d86dbf
[]
no_license
Killaker/Android
https://github.com/Killaker/Android
456acf38bc79030aff7610f5b7f5c1334a49f334
52a1a709a80778ec11b42dfe9dc1a4e755593812
refs/heads/master
2021-08-19T06:20:26.551000
2017-11-24T22:27:19
2017-11-24T22:27:19
111,960,738
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.squareup.picasso; import android.content.*; import android.net.*; import android.os.*; import java.net.*; import android.net.http.*; import java.io.*; public class UrlConnectionDownloader implements Downloader { private static final ThreadLocal<StringBuilder> CACHE_HEADER_BUILDER; private static final String FORCE_CACHE = "only-if-cached,max-age=2147483647"; static final String RESPONSE_SOURCE = "X-Android-Response-Source"; static volatile Object cache; private static final Object lock; private final Context context; static { lock = new Object(); CACHE_HEADER_BUILDER = new ThreadLocal<StringBuilder>() { @Override protected StringBuilder initialValue() { return new StringBuilder(); } }; } public UrlConnectionDownloader(final Context context) { this.context = context.getApplicationContext(); } private static void installCacheIfNeeded(final Context context) { if (UrlConnectionDownloader.cache == null) { try { synchronized (UrlConnectionDownloader.lock) { if (UrlConnectionDownloader.cache == null) { UrlConnectionDownloader.cache = ResponseCacheIcs.install(context); } } } catch (IOException ex) {} } } @Override public Response load(final Uri uri, final int n) throws IOException { if (Build$VERSION.SDK_INT >= 14) { installCacheIfNeeded(this.context); } final HttpURLConnection openConnection = this.openConnection(uri); openConnection.setUseCaches(true); if (n != 0) { String string; if (NetworkPolicy.isOfflineOnly(n)) { string = "only-if-cached,max-age=2147483647"; } else { final StringBuilder sb = UrlConnectionDownloader.CACHE_HEADER_BUILDER.get(); sb.setLength(0); if (!NetworkPolicy.shouldReadFromDiskCache(n)) { sb.append("no-cache"); } if (!NetworkPolicy.shouldWriteToDiskCache(n)) { if (sb.length() > 0) { sb.append(','); } sb.append("no-store"); } string = sb.toString(); } openConnection.setRequestProperty("Cache-Control", string); } final int responseCode = openConnection.getResponseCode(); if (responseCode >= 300) { openConnection.disconnect(); throw new ResponseException(responseCode + " " + openConnection.getResponseMessage(), n, responseCode); } return new Response(openConnection.getInputStream(), Utils.parseResponseSourceHeader(openConnection.getHeaderField("X-Android-Response-Source")), openConnection.getHeaderFieldInt("Content-Length", -1)); } protected HttpURLConnection openConnection(final Uri uri) throws IOException { final HttpURLConnection httpURLConnection = (HttpURLConnection)new URL(uri.toString()).openConnection(); httpURLConnection.setConnectTimeout(15000); httpURLConnection.setReadTimeout(20000); return httpURLConnection; } @Override public void shutdown() { if (Build$VERSION.SDK_INT >= 14 && UrlConnectionDownloader.cache != null) { ResponseCacheIcs.close(UrlConnectionDownloader.cache); } } private static class ResponseCacheIcs { static void close(final Object o) { try { ((HttpResponseCache)o).close(); } catch (IOException ex) {} } static Object install(final Context context) throws IOException { final File defaultCacheDir = Utils.createDefaultCacheDir(context); HttpResponseCache httpResponseCache = HttpResponseCache.getInstalled(); if (httpResponseCache == null) { httpResponseCache = HttpResponseCache.install(defaultCacheDir, Utils.calculateDiskCacheSize(defaultCacheDir)); } return httpResponseCache; } } }
UTF-8
Java
4,303
java
UrlConnectionDownloader.java
Java
[]
null
[]
package com.squareup.picasso; import android.content.*; import android.net.*; import android.os.*; import java.net.*; import android.net.http.*; import java.io.*; public class UrlConnectionDownloader implements Downloader { private static final ThreadLocal<StringBuilder> CACHE_HEADER_BUILDER; private static final String FORCE_CACHE = "only-if-cached,max-age=2147483647"; static final String RESPONSE_SOURCE = "X-Android-Response-Source"; static volatile Object cache; private static final Object lock; private final Context context; static { lock = new Object(); CACHE_HEADER_BUILDER = new ThreadLocal<StringBuilder>() { @Override protected StringBuilder initialValue() { return new StringBuilder(); } }; } public UrlConnectionDownloader(final Context context) { this.context = context.getApplicationContext(); } private static void installCacheIfNeeded(final Context context) { if (UrlConnectionDownloader.cache == null) { try { synchronized (UrlConnectionDownloader.lock) { if (UrlConnectionDownloader.cache == null) { UrlConnectionDownloader.cache = ResponseCacheIcs.install(context); } } } catch (IOException ex) {} } } @Override public Response load(final Uri uri, final int n) throws IOException { if (Build$VERSION.SDK_INT >= 14) { installCacheIfNeeded(this.context); } final HttpURLConnection openConnection = this.openConnection(uri); openConnection.setUseCaches(true); if (n != 0) { String string; if (NetworkPolicy.isOfflineOnly(n)) { string = "only-if-cached,max-age=2147483647"; } else { final StringBuilder sb = UrlConnectionDownloader.CACHE_HEADER_BUILDER.get(); sb.setLength(0); if (!NetworkPolicy.shouldReadFromDiskCache(n)) { sb.append("no-cache"); } if (!NetworkPolicy.shouldWriteToDiskCache(n)) { if (sb.length() > 0) { sb.append(','); } sb.append("no-store"); } string = sb.toString(); } openConnection.setRequestProperty("Cache-Control", string); } final int responseCode = openConnection.getResponseCode(); if (responseCode >= 300) { openConnection.disconnect(); throw new ResponseException(responseCode + " " + openConnection.getResponseMessage(), n, responseCode); } return new Response(openConnection.getInputStream(), Utils.parseResponseSourceHeader(openConnection.getHeaderField("X-Android-Response-Source")), openConnection.getHeaderFieldInt("Content-Length", -1)); } protected HttpURLConnection openConnection(final Uri uri) throws IOException { final HttpURLConnection httpURLConnection = (HttpURLConnection)new URL(uri.toString()).openConnection(); httpURLConnection.setConnectTimeout(15000); httpURLConnection.setReadTimeout(20000); return httpURLConnection; } @Override public void shutdown() { if (Build$VERSION.SDK_INT >= 14 && UrlConnectionDownloader.cache != null) { ResponseCacheIcs.close(UrlConnectionDownloader.cache); } } private static class ResponseCacheIcs { static void close(final Object o) { try { ((HttpResponseCache)o).close(); } catch (IOException ex) {} } static Object install(final Context context) throws IOException { final File defaultCacheDir = Utils.createDefaultCacheDir(context); HttpResponseCache httpResponseCache = HttpResponseCache.getInstalled(); if (httpResponseCache == null) { httpResponseCache = HttpResponseCache.install(defaultCacheDir, Utils.calculateDiskCacheSize(defaultCacheDir)); } return httpResponseCache; } } }
4,303
0.601441
0.591913
114
36.745613
32.589905
210
false
false
0
0
0
0
0
0
0.482456
false
false
13
114ddcacc0a0bf49bacf3979b932e081c974417a
11,493,332,507,809
606bbebbcac8a114266d9105ec15fbc5ad636609
/My-Projects-master/Konvertilo/app/src/main/java/ak/com/konvertilo/mass.java
1f1fb80849b605e878391133f9fee12d08a6510c
[]
no_license
BhagyashriT/UndergradProjects
https://github.com/BhagyashriT/UndergradProjects
cd92ebdd6634377dcdf5eacde6e772665cd904e1
f7509a3c5d29299d2a70b285858b8b7eeb8a5bad
refs/heads/master
2020-08-28T06:26:54.081000
2019-10-25T22:09:11
2019-10-25T22:09:11
217,621,201
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ak.com.konvertilo; public class mass { double x,y; public object ouncepound(object ob) { x = ob.getA(); y = (x / 16 ); ob.setA(x); ob.setB(y); return ob; } public object poundounce(object ob) { x = ob.getA(); y = (x * 16); ob.setA(x); ob.setB(y); return ob; } public object ouncegram(object ob) { x = ob.getA(); y = (x * 28.3495 ); ob.setA(x); ob.setB(y); return ob; } public object gramounce(object ob) { x = ob.getA(); y = (x * 0.035274 ); ob.setA(x); ob.setB(y); return ob; } public object ouncekg(object ob) { x = ob.getA(); y = (x * 0.0283495 ); ob.setA(x); ob.setB(y); return ob; } public object kgounce(object ob) { x = ob.getA(); y = (x * 35.274 ); ob.setA(x); ob.setB(y); return ob; } public object poundgram(object ob) { x = ob.getA(); y = (x * 453.592); ob.setA(x); ob.setB(y); return ob; } public object grampound(object ob) { x = ob.getA(); y = (x * 0.00220462 ); ob.setA(x); ob.setB(y); return ob; } public object poundkg(object ob) { x = ob.getA(); y = (x * 0.453592 ); ob.setA(x); ob.setB(y); return ob; } public object kgpound(object ob) { x = ob.getA(); y = (x * 2.20462 ); ob.setA(x); ob.setB(y); return ob; } public object gramkg(object ob) { x = ob.getA(); y = (x / 1000); ob.setA(x); ob.setB(y); return ob; } public object kggram(object ob) { x = ob.getA(); y = (x * 1000 ); ob.setA(x); ob.setB(y); return ob; } }
UTF-8
Java
1,978
java
mass.java
Java
[]
null
[]
package ak.com.konvertilo; public class mass { double x,y; public object ouncepound(object ob) { x = ob.getA(); y = (x / 16 ); ob.setA(x); ob.setB(y); return ob; } public object poundounce(object ob) { x = ob.getA(); y = (x * 16); ob.setA(x); ob.setB(y); return ob; } public object ouncegram(object ob) { x = ob.getA(); y = (x * 28.3495 ); ob.setA(x); ob.setB(y); return ob; } public object gramounce(object ob) { x = ob.getA(); y = (x * 0.035274 ); ob.setA(x); ob.setB(y); return ob; } public object ouncekg(object ob) { x = ob.getA(); y = (x * 0.0283495 ); ob.setA(x); ob.setB(y); return ob; } public object kgounce(object ob) { x = ob.getA(); y = (x * 35.274 ); ob.setA(x); ob.setB(y); return ob; } public object poundgram(object ob) { x = ob.getA(); y = (x * 453.592); ob.setA(x); ob.setB(y); return ob; } public object grampound(object ob) { x = ob.getA(); y = (x * 0.00220462 ); ob.setA(x); ob.setB(y); return ob; } public object poundkg(object ob) { x = ob.getA(); y = (x * 0.453592 ); ob.setA(x); ob.setB(y); return ob; } public object kgpound(object ob) { x = ob.getA(); y = (x * 2.20462 ); ob.setA(x); ob.setB(y); return ob; } public object gramkg(object ob) { x = ob.getA(); y = (x / 1000); ob.setA(x); ob.setB(y); return ob; } public object kggram(object ob) { x = ob.getA(); y = (x * 1000 ); ob.setA(x); ob.setB(y); return ob; } }
1,978
0.414055
0.380688
102
18.392157
10.164487
39
false
false
0
0
0
0
0
0
0.617647
false
false
13
5e5220c8fdadb4d9e99e3fa1ca06f96b6c129f9c
21,131,239,097,996
c2172f39c08db14a528eb7a6fc4e7fa8832e3c91
/src/com/adsdk/sdk/mraid/MraidProperty.java
1ec38959bd14b8cf47071d89297ed4f7a69138c4
[ "MIT-0", "BSD-3-Clause" ]
permissive
dungelin/mAdserve-Android-SDK
https://github.com/dungelin/mAdserve-Android-SDK
f38f7d40795757fa03a5388f710e0d42f2073fdd
f464f1ee19ac4c50eeda0d9d56bcf9bdaf4655f1
refs/heads/master
2021-01-22T01:27:55.084000
2014-06-24T08:33:56
2014-06-24T08:33:56
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.adsdk.sdk.mraid; import com.adsdk.sdk.mraid.MraidView.PlacementType; import com.adsdk.sdk.mraid.MraidView.ViewState; abstract class MraidProperty { private String sanitize(String str) { return (str != null) ? str.replaceAll("[^a-zA-Z0-9_,:\\s\\{\\}\\\'\\\"]", "") : ""; } @Override public String toString() { return sanitize(toJsonPair()); } public abstract String toJsonPair(); } class MraidPlacementTypeProperty extends MraidProperty { private final PlacementType mPlacementType; MraidPlacementTypeProperty(PlacementType placementType) { mPlacementType = placementType; } public static MraidPlacementTypeProperty createWithType( PlacementType placementType) { return new MraidPlacementTypeProperty(placementType); } @Override public String toJsonPair() { return "placementType: '" + mPlacementType.toString().toLowerCase() + "'"; } } class MraidScreenSizeProperty extends MraidProperty { private final int mScreenWidth; private final int mScreenHeight; MraidScreenSizeProperty(int width, int height) { mScreenWidth = width; mScreenHeight = height; } public static MraidScreenSizeProperty createWithSize(int width, int height) { return new MraidScreenSizeProperty(width, height); } @Override public String toJsonPair() { return "screenSize: { width: " + mScreenWidth + ", height: " + mScreenHeight + " }"; } } class MraidStateProperty extends MraidProperty { private final ViewState mViewState; MraidStateProperty(ViewState viewState) { mViewState = viewState; } public static MraidStateProperty createWithViewState(ViewState viewState) { return new MraidStateProperty(viewState); } @Override public String toJsonPair() { return "state: '" + mViewState.toString().toLowerCase() + "'"; } } class MraidViewableProperty extends MraidProperty { private final boolean mViewable; MraidViewableProperty(boolean viewable) { mViewable = viewable; } public static MraidViewableProperty createWithViewable(boolean viewable) { return new MraidViewableProperty(viewable); } @Override public String toJsonPair() { return "viewable: " + (mViewable ? "true" : "false"); } }
UTF-8
Java
2,426
java
MraidProperty.java
Java
[]
null
[]
package com.adsdk.sdk.mraid; import com.adsdk.sdk.mraid.MraidView.PlacementType; import com.adsdk.sdk.mraid.MraidView.ViewState; abstract class MraidProperty { private String sanitize(String str) { return (str != null) ? str.replaceAll("[^a-zA-Z0-9_,:\\s\\{\\}\\\'\\\"]", "") : ""; } @Override public String toString() { return sanitize(toJsonPair()); } public abstract String toJsonPair(); } class MraidPlacementTypeProperty extends MraidProperty { private final PlacementType mPlacementType; MraidPlacementTypeProperty(PlacementType placementType) { mPlacementType = placementType; } public static MraidPlacementTypeProperty createWithType( PlacementType placementType) { return new MraidPlacementTypeProperty(placementType); } @Override public String toJsonPair() { return "placementType: '" + mPlacementType.toString().toLowerCase() + "'"; } } class MraidScreenSizeProperty extends MraidProperty { private final int mScreenWidth; private final int mScreenHeight; MraidScreenSizeProperty(int width, int height) { mScreenWidth = width; mScreenHeight = height; } public static MraidScreenSizeProperty createWithSize(int width, int height) { return new MraidScreenSizeProperty(width, height); } @Override public String toJsonPair() { return "screenSize: { width: " + mScreenWidth + ", height: " + mScreenHeight + " }"; } } class MraidStateProperty extends MraidProperty { private final ViewState mViewState; MraidStateProperty(ViewState viewState) { mViewState = viewState; } public static MraidStateProperty createWithViewState(ViewState viewState) { return new MraidStateProperty(viewState); } @Override public String toJsonPair() { return "state: '" + mViewState.toString().toLowerCase() + "'"; } } class MraidViewableProperty extends MraidProperty { private final boolean mViewable; MraidViewableProperty(boolean viewable) { mViewable = viewable; } public static MraidViewableProperty createWithViewable(boolean viewable) { return new MraidViewableProperty(viewable); } @Override public String toJsonPair() { return "viewable: " + (mViewable ? "true" : "false"); } }
2,426
0.667766
0.666941
88
26.579546
25.642082
92
false
false
0
0
0
0
0
0
0.340909
false
false
13
7eebb45d4b25eb2b53bd969201f7d5bb4c5a56ac
28,518,582,866,573
0dd7fa04f71f861a93353d62844928f3a9a4bf66
/app/src/main/java/com/example/glk/wangyinews/main/presenter/MainPresenterImpl.java
7dd9515ab9eae647d9c552af3794be6dfc8593fb
[]
no_license
glk1995/WangyiNews
https://github.com/glk1995/WangyiNews
1bfe5d5b900db237a742a8a64c55c35ef353b075
aa5aeb2fb30aa52f3da38ef03e76155f10a6dd92
refs/heads/master
2020-04-06T04:53:36.975000
2018-03-22T07:42:23
2018-03-22T07:42:23
73,820,278
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.glk.wangyinews.main.presenter; import com.example.glk.wangyinews.R; import com.example.glk.wangyinews.main.view.MainView; /**根据不同的Drawer Item切换到不同的界面 * Created by zgqdg on 2016/11/13. */ public class MainPresenterImpl implements MainPresenter { private MainView mMainView; public MainPresenterImpl(MainView mainView){ this.mMainView = mainView; } @Override public void switchNavigation(int id) { switch (id){ case R.id.navigation_item_news: mMainView.switch2News(); break; case R.id.navigation_item_images: mMainView.switch2Images(); break; case R.id.navigation_item_weather: mMainView.switch2Weather(); break; case R.id.navigation_item_about: mMainView.switch2About(); break; } } }
UTF-8
Java
961
java
MainPresenterImpl.java
Java
[ { "context": "inView;\n\n/**根据不同的Drawer Item切换到不同的界面\n * Created by zgqdg on 2016/11/13.\n */\n\npublic class MainPresenterImp", "end": 191, "score": 0.9996543526649475, "start": 186, "tag": "USERNAME", "value": "zgqdg" } ]
null
[]
package com.example.glk.wangyinews.main.presenter; import com.example.glk.wangyinews.R; import com.example.glk.wangyinews.main.view.MainView; /**根据不同的Drawer Item切换到不同的界面 * Created by zgqdg on 2016/11/13. */ public class MainPresenterImpl implements MainPresenter { private MainView mMainView; public MainPresenterImpl(MainView mainView){ this.mMainView = mainView; } @Override public void switchNavigation(int id) { switch (id){ case R.id.navigation_item_news: mMainView.switch2News(); break; case R.id.navigation_item_images: mMainView.switch2Images(); break; case R.id.navigation_item_weather: mMainView.switch2Weather(); break; case R.id.navigation_item_about: mMainView.switch2About(); break; } } }
961
0.597861
0.585027
35
25.714285
18.706104
57
false
false
0
0
0
0
0
0
0.371429
false
false
13
e9fc16fbd45af6e92b394afefe1e4080dccdc90d
16,234,976,406,745
5a5f971d8ff32659d30f6f88e20310a30eebbeb9
/provider/src/main/java/edu/nju/dao/impl/BackupDaoImpl.java
b1ebc87ce5021f0d11f261f4c62bd3a7ba07bf12
[]
no_license
NjuSoftwareArchitecture15/ChampionAmazon
https://github.com/NjuSoftwareArchitecture15/ChampionAmazon
e795bfa9ac6e3ced6cef769fadb2846040bb3721
2ebe2f1281eb45e785d00aafd0306a12d8b357e1
refs/heads/master
2020-03-07T14:34:43.014000
2018-04-02T02:09:43
2018-04-02T02:09:43
127,529,972
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.nju.dao.impl; import edu.nju.dao.BackupDao; import edu.nju.po.Commodity; import edu.nju.po.Order; import java.util.List; public class BackupDaoImpl implements BackupDao { public boolean backupOrder(List<Order> orders) { return false; } public boolean backupCommodity(List<Commodity> commodities) { return false; } public List<Order> getOrders() { return null; } public List<Commodity> getCommodities() { return null; } public boolean removeOrder(List<Order> orders) { return false; } public boolean removeCommodity(List<Commodity> commodities) { return false; } }
UTF-8
Java
680
java
BackupDaoImpl.java
Java
[]
null
[]
package edu.nju.dao.impl; import edu.nju.dao.BackupDao; import edu.nju.po.Commodity; import edu.nju.po.Order; import java.util.List; public class BackupDaoImpl implements BackupDao { public boolean backupOrder(List<Order> orders) { return false; } public boolean backupCommodity(List<Commodity> commodities) { return false; } public List<Order> getOrders() { return null; } public List<Commodity> getCommodities() { return null; } public boolean removeOrder(List<Order> orders) { return false; } public boolean removeCommodity(List<Commodity> commodities) { return false; } }
680
0.661765
0.661765
33
19.60606
19.78665
65
false
false
0
0
0
0
0
0
0.333333
false
false
13
b1c2657da3cdc6c53e1de08d103be5343fc99c4c
1,434,519,108,510
6283e53dc2d707bd29b6462cf577b1571037c3bf
/testFrameworks/cucumber/cucumberJvmWithSpring/src/test/java/io/mart/Evaluator.java
b50961a3c2ca282095958b3d51866500fccd92d1
[]
no_license
amartyushov/Experiments
https://github.com/amartyushov/Experiments
2d95ebc442ae5707f8435f828a04aacca110dfc1
5af4e006e81c9d401a328c033c1fd9357da60131
refs/heads/master
2023-09-01T17:25:43.409000
2023-09-01T06:59:07
2023-09-01T06:59:07
90,235,236
0
2
null
false
2022-02-10T08:39:12
2017-05-04T07:40:54
2020-11-27T13:22:36
2022-02-10T08:39:11
32,395
0
3
27
Java
false
false
package io.mart; import org.junit.runner.JUnitCore; /** * @author Aleksandr Martiushov */ public class Evaluator { public static void main(String[] args) { // Here I want to check how pure JUnit works with my Listener JUnitCore core = new JUnitCore(); core.addListener(new MyListener()); core.run(DummyJUnitToExperiment.class); // sequence of Listener.testStarted and Listener.testFinished is correct } }
UTF-8
Java
460
java
Evaluator.java
Java
[ { "context": "import org.junit.runner.JUnitCore;\n\n/**\n * @author Aleksandr Martiushov\n */\npublic class Evaluator {\n\n public static v", "end": 89, "score": 0.999850869178772, "start": 69, "tag": "NAME", "value": "Aleksandr Martiushov" } ]
null
[]
package io.mart; import org.junit.runner.JUnitCore; /** * @author <NAME> */ public class Evaluator { public static void main(String[] args) { // Here I want to check how pure JUnit works with my Listener JUnitCore core = new JUnitCore(); core.addListener(new MyListener()); core.run(DummyJUnitToExperiment.class); // sequence of Listener.testStarted and Listener.testFinished is correct } }
446
0.678261
0.678261
19
23.210526
24.701542
80
false
false
0
0
0
0
0
0
0.263158
false
false
13
54251439bf820eda45ae87ca2a73799e94262eb8
2,370,821,972,653
67b275a9079a5198e7055cef873ad200810269ca
/Sysc3303Assignment2/src/ThreadManager.java
6ce7248e6bd5fd485d56f3eaab47f56f04b2a3cc
[]
no_license
cmoihub/Real-Time-Concurrent-Systems
https://github.com/cmoihub/Real-Time-Concurrent-Systems
72e0b94d55cab5748262ae640df876f42735e954
447e062129ef3f46041a8a9981b849e5346609d5
refs/heads/master
2021-05-31T14:30:04.742000
2016-05-04T01:51:13
2016-05-04T01:51:13
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class ThreadManager { public static void main(String[] args) { Table table = new Table(); Thread chefPeanutButter = new Thread(new Chef(table,"peanutbutter", "Lynn")); Thread chefJam = new Thread(new Chef(table,"jam", "Craig")); Thread chefBread = new Thread(new Chef(table,"bread", "Sysc")); Thread agent = new Thread(new Agent(table,"007")); agent.start(); chefJam.start(); chefPeanutButter.start(); chefBread.start(); } }
UTF-8
Java
456
java
ThreadManager.java
Java
[ { "context": "tter = new Thread(new Chef(table,\"peanutbutter\", \"Lynn\"));\n\t\tThread chefJam = new Thread(new Chef(table,", "end": 176, "score": 0.9995977878570557, "start": 172, "tag": "NAME", "value": "Lynn" }, { "context": "hread chefJam = new Thread(new Chef(table,\"jam\", \"Craig\"));\n\t\tThread chefBread = new Thread(new Chef(tabl", "end": 239, "score": 0.9995990991592407, "start": 234, "tag": "NAME", "value": "Craig" }, { "context": "d chefBread = new Thread(new Chef(table,\"bread\", \"Sysc\"));\n\t\tThread agent = new Thread(new Agent(table,\"", "end": 305, "score": 0.9994384050369263, "start": 301, "tag": "NAME", "value": "Sysc" } ]
null
[]
public class ThreadManager { public static void main(String[] args) { Table table = new Table(); Thread chefPeanutButter = new Thread(new Chef(table,"peanutbutter", "Lynn")); Thread chefJam = new Thread(new Chef(table,"jam", "Craig")); Thread chefBread = new Thread(new Chef(table,"bread", "Sysc")); Thread agent = new Thread(new Agent(table,"007")); agent.start(); chefJam.start(); chefPeanutButter.start(); chefBread.start(); } }
456
0.682018
0.675439
15
29.466667
24.229092
79
false
false
0
0
0
0
0
0
2.666667
false
false
13
9cdc5b6904df0d11e90617657970d526edcffa40
16,303,695,882,049
3c0bd69e44c9759076388661715166d21e2f4a67
/Java/tutorials/JavaEE/Design_Patterns/mega/src/main/java/_01_Creational/Builder/Stage_01/PlayListBuilderThrashImpl.java
18d06d37ececa618943bff3e9f5760ac2e9939a9
[]
no_license
megadethov/shildt
https://github.com/megadethov/shildt
959e102da8a0325b01a3d4e246d32b135d410d8d
7c828b964836f6a3ee763e4a25357d217a739752
refs/heads/master
2020-09-17T22:15:31.819000
2018-09-25T19:27:44
2018-09-25T19:27:44
67,035,362
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package _01_Creational.Builder.Stage_01; public class PlayListBuilderThrashImpl implements PlayListBuilder { private PlayList playList = new PlayList(); @Override public void addFirstTrackToPlayList() { playList.addTrackToPlayList("Slayer"); } @Override public void addSecondTrackToPlayList() { playList.addTrackToPlayList("Kreator"); } @Override public void addThirdTrackToPlayList() { playList.addTrackToPlayList("Anthrax"); } @Override public PlayList getPlayList() { return playList; } }
UTF-8
Java
582
java
PlayListBuilderThrashImpl.java
Java
[]
null
[]
package _01_Creational.Builder.Stage_01; public class PlayListBuilderThrashImpl implements PlayListBuilder { private PlayList playList = new PlayList(); @Override public void addFirstTrackToPlayList() { playList.addTrackToPlayList("Slayer"); } @Override public void addSecondTrackToPlayList() { playList.addTrackToPlayList("Kreator"); } @Override public void addThirdTrackToPlayList() { playList.addTrackToPlayList("Anthrax"); } @Override public PlayList getPlayList() { return playList; } }
582
0.682131
0.675258
26
21.384615
20.712458
67
false
false
0
0
0
0
0
0
0.230769
false
false
13
66877d51dfc7edc84714851845b2f77e830b1fd4
29,197,187,708,500
f7dc0767226a91a63a3f62aa20c7cb214cd252aa
/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/ShooterFeeder.java
d783fa3927a7ae4f9d40c4b780d824616b1d7981
[]
no_license
E-lemon-ators5890/UltimateGoal
https://github.com/E-lemon-ators5890/UltimateGoal
8cf9c628bf8e46e671341a7aa90f9d1fb66c2084
923420fc31fc301a60ec6e76ea7b91123a5807a2
refs/heads/master
2023-06-06T06:12:51.779000
2021-06-11T01:07:52
2021-06-11T01:07:52
297,111,560
0
4
null
true
2021-06-10T23:54:59
2020-09-20T15:59:33
2021-06-02T04:01:09
2021-06-10T23:54:58
63,558
0
4
0
Java
false
false
package org.firstinspires.ftc.teamcode.subsystems; import com.acmerobotics.dashboard.config.Config; import com.acmerobotics.dashboard.telemetry.TelemetryPacket; import com.arcrobotics.ftclib.command.SubsystemBase; import com.arcrobotics.ftclib.hardware.ServoEx; import org.firstinspires.ftc.robotcore.external.Telemetry; import org.firstinspires.ftc.teamcode.Util; import java.util.logging.Level; @Config public class ShooterFeeder extends SubsystemBase { public static double SERVO_POSITION_SHOOT = 0.75; public static double SERVO_POSITION_HOME = 0.88; private Telemetry telemetry; private TelemetryPacket packet; private ServoEx feedServo; public ShooterFeeder(ServoEx feedServo, Telemetry tl) { this.feedServo = feedServo; this.telemetry = tl; this.packet = packet; } @Override public void periodic() { Util.logger(this, telemetry, Level.INFO, "Feed Servo Position", feedServo.getPosition()); } public void setFeedServo(double position) { feedServo.setPosition(position); } public void feedShooter() { setFeedServo(SERVO_POSITION_SHOOT); } public void retractFeed() { setFeedServo(SERVO_POSITION_HOME); } }
UTF-8
Java
1,240
java
ShooterFeeder.java
Java
[]
null
[]
package org.firstinspires.ftc.teamcode.subsystems; import com.acmerobotics.dashboard.config.Config; import com.acmerobotics.dashboard.telemetry.TelemetryPacket; import com.arcrobotics.ftclib.command.SubsystemBase; import com.arcrobotics.ftclib.hardware.ServoEx; import org.firstinspires.ftc.robotcore.external.Telemetry; import org.firstinspires.ftc.teamcode.Util; import java.util.logging.Level; @Config public class ShooterFeeder extends SubsystemBase { public static double SERVO_POSITION_SHOOT = 0.75; public static double SERVO_POSITION_HOME = 0.88; private Telemetry telemetry; private TelemetryPacket packet; private ServoEx feedServo; public ShooterFeeder(ServoEx feedServo, Telemetry tl) { this.feedServo = feedServo; this.telemetry = tl; this.packet = packet; } @Override public void periodic() { Util.logger(this, telemetry, Level.INFO, "Feed Servo Position", feedServo.getPosition()); } public void setFeedServo(double position) { feedServo.setPosition(position); } public void feedShooter() { setFeedServo(SERVO_POSITION_SHOOT); } public void retractFeed() { setFeedServo(SERVO_POSITION_HOME); } }
1,240
0.728226
0.723387
43
27.83721
23.399393
97
false
false
0
0
0
0
0
0
0.581395
false
false
13
8d698dd7f6c2ad0f3fe678b83e9d1af58f133bff
26,319,559,645,410
f9c2df3c584afe358eab7f34786394def9a5004d
/src/ca/piggott/ofx/internal/model/Constants.java
ae2728f2b7735984cf62894be7831e04cbf50758
[]
no_license
mrjpiggott/ca.piggott.ofx
https://github.com/mrjpiggott/ca.piggott.ofx
d86315361af45518bc2210823bf00b11454eb69e
b5d7052a2147008601b22e256874ddca3dea8e28
refs/heads/master
2016-08-08T15:53:20.188000
2010-07-18T00:20:43
2010-07-18T00:20:43
781,087
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ca.piggott.ofx.internal.model; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Constants { public static final String DATE_AS_OF = "DTASOF"; public static final String DATE_END = "DTEND"; public static final String DATE_START = "DTSTART"; public static final String BANKMSGSRSV1 = "BANKMSGSRSV1"; // Banking message public static final String OFX = "OFX"; // Root object public static final String STATEMENT_TRANSACTIONS = "STMTRS"; public static final String STATEMENT_TRANSACTION_RESPONSE = "STMTTRNRS"; public static final String LEDGER_BALANCE = "LEDGERBAL"; public static final String BANK_TRANSACTION_LIST = "BANKTRANLIST"; public static final String SIGNONMSGSRSV1 = "SIGNONMSGSRSV1"; public static final String SIGN_ON_RESPONSE = "SONRS"; public static final String STATEMENT_TRANSACTION = "STMTTRN"; public static final String STATUS = "STATUS"; // Message status public static final String BANK_ACCOUT_FROM = "BANKACCTFROM"; public static final String AVAILBLE_BALANCE = "AVAILBAL"; public static final String BALANCE_AMOUNT = "BALAMT"; public static final String BANK_ID = "BANKID"; public static final String ACCOUNT_ID = "ACCTID"; public static final String ACCOUNT_TYPE = "ACCTTYPE"; public static final String DTSERVER = "DTSERVER"; public static final String LANGUAGE = "LANGUAGE"; public static final String DTPROFUP = "DTPROFUP"; public static final String DTACCTUP = "DTACCTUP"; public static final String CODE = "CODE"; public static final String SEVERITY = "SEVERITY"; public static final String MESSAGE = "MESSAGE"; public static final String TRNTYPE = "TRNTYPE"; public static final String DTPOSTED = "DTPOSTED"; public static final String TRANSACTION_AMOUNT = "TRNAMT"; public static final String FINANCIAL_INSTITUTION_TRANSACTION_ID = "FITID"; public static final String NAME = "NAME"; public static final String MEMO = "MEMO"; public static final String CURRENCY = "CURDEF"; public static final String TRANSACTION_UID = "TRNUID"; public static final String USERKEY = "USERKEY"; public static final String CREDITCARDMSGSRSV1 = "CREDITCARDMSGSRSV1"; public static final String CREDIT_CARD_STATEMENT_TRANSACTION_REPONSE = "CCSTMTTRNRS"; public static final String CCACCTFROM = "CCACCTFROM"; public static final String CC_STATEMENT_TRANSACTIONS = "CCSTMTRS"; private static final SimpleDateFormat dateFormatter; private static final SimpleDateFormat dateTimeFormatter; private static final SimpleDateFormat dateTimeTZFormatter; public static final String CCSTMTRS = "CCSTMTRS"; static { dateFormatter = new SimpleDateFormat("yyyyMMdd"); dateTimeFormatter = new SimpleDateFormat("yyyyMMddHHmmss"); dateTimeTZFormatter = new SimpleDateFormat("yyyyMMddHHmmss.SSSzzz"); } static Date parseDateTimeWithTZ(String date) { assert(date.length() == 18); try { return dateTimeTZFormatter.parse(date.substring(0,18) + date.substring(date.indexOf(':'), 3)); } catch (ParseException e) { throw new IllegalArgumentException("Invalid date format: " + date); } } static Date parseDateTime(String date) { try { return dateTimeFormatter.parse(date); } catch (ParseException e) { throw new IllegalArgumentException("Invalid date format: " + date); } } static Date parseDate(String date) { try { return dateFormatter.parse(date); } catch (ParseException e) { throw new IllegalArgumentException("Invalid date format: " + date); } } }
UTF-8
Java
3,674
java
Constants.java
Java
[]
null
[]
package ca.piggott.ofx.internal.model; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Constants { public static final String DATE_AS_OF = "DTASOF"; public static final String DATE_END = "DTEND"; public static final String DATE_START = "DTSTART"; public static final String BANKMSGSRSV1 = "BANKMSGSRSV1"; // Banking message public static final String OFX = "OFX"; // Root object public static final String STATEMENT_TRANSACTIONS = "STMTRS"; public static final String STATEMENT_TRANSACTION_RESPONSE = "STMTTRNRS"; public static final String LEDGER_BALANCE = "LEDGERBAL"; public static final String BANK_TRANSACTION_LIST = "BANKTRANLIST"; public static final String SIGNONMSGSRSV1 = "SIGNONMSGSRSV1"; public static final String SIGN_ON_RESPONSE = "SONRS"; public static final String STATEMENT_TRANSACTION = "STMTTRN"; public static final String STATUS = "STATUS"; // Message status public static final String BANK_ACCOUT_FROM = "BANKACCTFROM"; public static final String AVAILBLE_BALANCE = "AVAILBAL"; public static final String BALANCE_AMOUNT = "BALAMT"; public static final String BANK_ID = "BANKID"; public static final String ACCOUNT_ID = "ACCTID"; public static final String ACCOUNT_TYPE = "ACCTTYPE"; public static final String DTSERVER = "DTSERVER"; public static final String LANGUAGE = "LANGUAGE"; public static final String DTPROFUP = "DTPROFUP"; public static final String DTACCTUP = "DTACCTUP"; public static final String CODE = "CODE"; public static final String SEVERITY = "SEVERITY"; public static final String MESSAGE = "MESSAGE"; public static final String TRNTYPE = "TRNTYPE"; public static final String DTPOSTED = "DTPOSTED"; public static final String TRANSACTION_AMOUNT = "TRNAMT"; public static final String FINANCIAL_INSTITUTION_TRANSACTION_ID = "FITID"; public static final String NAME = "NAME"; public static final String MEMO = "MEMO"; public static final String CURRENCY = "CURDEF"; public static final String TRANSACTION_UID = "TRNUID"; public static final String USERKEY = "USERKEY"; public static final String CREDITCARDMSGSRSV1 = "CREDITCARDMSGSRSV1"; public static final String CREDIT_CARD_STATEMENT_TRANSACTION_REPONSE = "CCSTMTTRNRS"; public static final String CCACCTFROM = "CCACCTFROM"; public static final String CC_STATEMENT_TRANSACTIONS = "CCSTMTRS"; private static final SimpleDateFormat dateFormatter; private static final SimpleDateFormat dateTimeFormatter; private static final SimpleDateFormat dateTimeTZFormatter; public static final String CCSTMTRS = "CCSTMTRS"; static { dateFormatter = new SimpleDateFormat("yyyyMMdd"); dateTimeFormatter = new SimpleDateFormat("yyyyMMddHHmmss"); dateTimeTZFormatter = new SimpleDateFormat("yyyyMMddHHmmss.SSSzzz"); } static Date parseDateTimeWithTZ(String date) { assert(date.length() == 18); try { return dateTimeTZFormatter.parse(date.substring(0,18) + date.substring(date.indexOf(':'), 3)); } catch (ParseException e) { throw new IllegalArgumentException("Invalid date format: " + date); } } static Date parseDateTime(String date) { try { return dateTimeFormatter.parse(date); } catch (ParseException e) { throw new IllegalArgumentException("Invalid date format: " + date); } } static Date parseDate(String date) { try { return dateFormatter.parse(date); } catch (ParseException e) { throw new IllegalArgumentException("Invalid date format: " + date); } } }
3,674
0.725367
0.722101
123
27.869919
27.906918
97
false
false
0
0
0
0
0
0
1.325203
false
false
13
48cbd7110e695293b0a97d355f458b4c36937d56
3,332,894,651,128
be3118372b8d7cfdce3ad74efbaed6b914700218
/src/main/java/com/joyyir/bithumb_miner/domain/OrderBook.java
6befb3159da2425209c1f20850d955bf01a5809b
[]
no_license
joyyir/bithumb_miner
https://github.com/joyyir/bithumb_miner
9a695615caac386f13188e3429490ce037eae018
6c7be60ef71e746e700d62eebf71308a373af3b7
refs/heads/master
2023-06-03T15:22:13.069000
2021-06-23T15:11:38
2021-06-23T15:11:38
359,918,612
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.joyyir.bithumb_miner.domain; import lombok.AllArgsConstructor; import lombok.Getter; import java.math.BigDecimal; import java.util.List; @AllArgsConstructor @Getter public class OrderBook { private List<OrderBook.OrderBookItem> bids; // 매수. 비싼게 리스트 앞에 있음 private List<OrderBook.OrderBookItem> asks; // 매도. 싼게 리스트 앞에 있음 @AllArgsConstructor @Getter public static class OrderBookItem { private BigDecimal quantity; private BigDecimal price; } }
UTF-8
Java
544
java
OrderBook.java
Java
[]
null
[]
package com.joyyir.bithumb_miner.domain; import lombok.AllArgsConstructor; import lombok.Getter; import java.math.BigDecimal; import java.util.List; @AllArgsConstructor @Getter public class OrderBook { private List<OrderBook.OrderBookItem> bids; // 매수. 비싼게 리스트 앞에 있음 private List<OrderBook.OrderBookItem> asks; // 매도. 싼게 리스트 앞에 있음 @AllArgsConstructor @Getter public static class OrderBookItem { private BigDecimal quantity; private BigDecimal price; } }
544
0.73494
0.73494
21
22.714285
19.813759
68
false
false
0
0
0
0
0
0
0.428571
false
false
13
0d67ce4f3793d8d92dc1ad5a3978ca8d80c4bb93
29,240,137,407,880
4f707b4609bbaa053ff6fb7dc9e26e57315b1e71
/src/mdata/cn/com/infostrategy/ui/mdata/hmui/I_ComboBoxRenderer.java
28c78e3198460b42057675fee010beb4ff7aa9cd
[]
no_license
wnsalary/weblight
https://github.com/wnsalary/weblight
16f14e446b3aa44d66a9efef50d236e1c132b289
8b9a1700728c003862f55506ab7b600ef7006be2
refs/heads/master
2022-12-17T11:42:43.373000
2020-09-23T07:28:19
2020-09-23T07:28:19
263,282,545
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.com.infostrategy.ui.mdata.hmui; import java.awt.Component; import java.awt.Graphics; import java.awt.Graphics2D; import javax.swing.BorderFactory; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.plaf.basic.BasicComboBoxRenderer; /** * Copyright Pushine * @ClassName: cn.com.infostrategy.ui.mdata.hmui.I_ComboBoxRenderer * @Description: 内容 * @author haoming * @date Mar 19, 2013 4:44:18 PM * */ public class I_ComboBoxRenderer extends BasicComboBoxRenderer { private I_ComboBoxUI ui; private boolean selected = false; public I_ComboBoxRenderer(I_ComboBoxUI _ui) { ui = _ui; setOpaque(false); //必须设置透明 setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); } public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JLabel compent = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); // if (I_LookAndFeel.windows_word_antialias) { compent.setFont(I_LookAndFeel.font_word_yh); //设置雅黑 } compent.setBorder(BorderFactory.createEmptyBorder(1, 3, 3, 3)); selected = isSelected; if (index >= 0) { if (value == null || value.toString() == null || value.toString().trim().equals("")) {//如果将当前登陆人员的主岗位改变了,在切换风格按钮点击时这里报错【李春娟/2014-04-18】 list.setToolTipText(null); // } else { list.setToolTipText(value.toString()); } } return compent; } public void paintComponent(Graphics g) { if (ui.isPopupVisible(null) && selected) { LAFUtil.fillTextureRoundRec((Graphics2D) g, getBackground(), 0, 0, getWidth(), getHeight(), 5, 20); }//背景绘制完毕 super.paintComponent(g); //调用父类绘制 } public static class UIResource extends I_ComboBoxRenderer implements javax.swing.plaf.UIResource { public UIResource(I_ComboBoxUI ui) { super(ui); } } }
GB18030
Java
1,959
java
I_ComboBoxRenderer.java
Java
[ { "context": "sic.BasicComboBoxRenderer;\n\n/** \n * Copyright Pushine\n * @ClassName: cn.com.infostrategy.ui.mdata.hmui.", "end": 292, "score": 0.7212480306625366, "start": 289, "tag": "USERNAME", "value": "ine" }, { "context": "I_ComboBoxRenderer \n * @Description: 内容\n * @author haoming\n * @date Mar 19, 2013 4:44:18 PM\n * \n*/\npublic c", "end": 400, "score": 0.9996943473815918, "start": 393, "tag": "USERNAME", "value": "haoming" } ]
null
[]
package cn.com.infostrategy.ui.mdata.hmui; import java.awt.Component; import java.awt.Graphics; import java.awt.Graphics2D; import javax.swing.BorderFactory; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.plaf.basic.BasicComboBoxRenderer; /** * Copyright Pushine * @ClassName: cn.com.infostrategy.ui.mdata.hmui.I_ComboBoxRenderer * @Description: 内容 * @author haoming * @date Mar 19, 2013 4:44:18 PM * */ public class I_ComboBoxRenderer extends BasicComboBoxRenderer { private I_ComboBoxUI ui; private boolean selected = false; public I_ComboBoxRenderer(I_ComboBoxUI _ui) { ui = _ui; setOpaque(false); //必须设置透明 setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); } public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JLabel compent = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); // if (I_LookAndFeel.windows_word_antialias) { compent.setFont(I_LookAndFeel.font_word_yh); //设置雅黑 } compent.setBorder(BorderFactory.createEmptyBorder(1, 3, 3, 3)); selected = isSelected; if (index >= 0) { if (value == null || value.toString() == null || value.toString().trim().equals("")) {//如果将当前登陆人员的主岗位改变了,在切换风格按钮点击时这里报错【李春娟/2014-04-18】 list.setToolTipText(null); // } else { list.setToolTipText(value.toString()); } } return compent; } public void paintComponent(Graphics g) { if (ui.isPopupVisible(null) && selected) { LAFUtil.fillTextureRoundRec((Graphics2D) g, getBackground(), 0, 0, getWidth(), getHeight(), 5, 20); }//背景绘制完毕 super.paintComponent(g); //调用父类绘制 } public static class UIResource extends I_ComboBoxRenderer implements javax.swing.plaf.UIResource { public UIResource(I_ComboBoxUI ui) { super(ui); } } }
1,959
0.726482
0.70745
61
29.163935
32.319706
138
false
false
0
0
0
0
0
0
1.918033
false
false
13
8c08d7de4c10982cd332a45fe2987d9ee6e07c0d
4,398,046,576,056
c3648862740da9c00f0bba4f713fd361baf8f8ed
/SWEA/2020.02/Solution_3752_가능한시험점수.java
25f23440bde0f58daa6b0330b1f114b19aac3ee1
[]
no_license
SURAMCHOI/algorithm
https://github.com/SURAMCHOI/algorithm
de560f21eab2b2af027daa8a6f97b7250618d209
62effb824e4d4f1db7d749414d666b345855cd4d
refs/heads/master
2021-07-09T15:42:42.304000
2020-08-31T15:52:06
2020-08-31T15:52:06
181,139,185
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Arrays; import java.util.Scanner; public class Solution_3752_가능한시험점수{ static int scores[]; static boolean check[]; static int N; public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc=new Scanner(System.in); int T=sc.nextInt(); for(int testcase=1;testcase<=T;testcase++){ N=sc.nextInt(); scores=new int [N]; int max=0; int answer=0; for(int i=0;i<N;i++){ scores[i]=sc.nextInt(); max+=scores[i]; } check=new boolean [max+1]; check[0]=true; for(int i=0;i<N;i++){ int num=scores[i]; for(int j=max;j>=0;j--){ if(check[j]){ check[j+num]=true; } } } for(int i=0;i<max+1;i++){ if(check[i]){ answer++; } } System.out.println("#"+testcase+" "+answer); } } }
UTF-8
Java
825
java
Solution_3752_가능한시험점수.java
Java
[]
null
[]
import java.util.Arrays; import java.util.Scanner; public class Solution_3752_가능한시험점수{ static int scores[]; static boolean check[]; static int N; public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc=new Scanner(System.in); int T=sc.nextInt(); for(int testcase=1;testcase<=T;testcase++){ N=sc.nextInt(); scores=new int [N]; int max=0; int answer=0; for(int i=0;i<N;i++){ scores[i]=sc.nextInt(); max+=scores[i]; } check=new boolean [max+1]; check[0]=true; for(int i=0;i<N;i++){ int num=scores[i]; for(int j=max;j>=0;j--){ if(check[j]){ check[j+num]=true; } } } for(int i=0;i<max+1;i++){ if(check[i]){ answer++; } } System.out.println("#"+testcase+" "+answer); } } }
825
0.573366
0.556104
40
19.225
12.566796
47
false
false
0
0
0
0
0
0
3.45
false
false
13
09959adfa42241361c599afbd9fed96e81e595d1
24,129,126,315,052
c03f2d4fdc92d6f9bc8c9df022d15f1c438d9dd4
/src/main/java/cn/rainfly/mapper/WebOfficeMapper.java
bfbd41aff9b12cc5e545539ab96d006761cc9fe8
[]
no_license
Rain-Fly/OfficeWeb
https://github.com/Rain-Fly/OfficeWeb
777c1a6c5972980f5500a4231ad7c34cfe971569
03269ac2c91e3e191d67b61c8ca8a060eab7e599
refs/heads/master
2022-12-26T01:49:56.774000
2019-12-25T00:10:44
2019-12-25T00:10:44
228,773,969
0
0
null
false
2022-12-16T05:01:45
2019-12-18T06:32:40
2019-12-25T08:10:54
2022-12-16T05:01:42
30
1
0
7
Java
false
false
package cn.rainfly.mapper; public interface WebOfficeMapper { }
UTF-8
Java
80
java
WebOfficeMapper.java
Java
[]
null
[]
package cn.rainfly.mapper; public interface WebOfficeMapper { }
80
0.65
0.65
7
9.714286
13.14441
34
false
false
0
0
0
0
0
0
0.142857
false
false
13
34723b514733ee3c84b360a8501c1cef8a3042bd
17,781,164,653,492
c37076ae3ed292263a23637157f122aeb78f0fb6
/diy_page/src/com/zol/mobile/MobileParser.java
fac7355513247adf62507835204d8d15c20c3344
[]
no_license
mo3athBaioud/bluestome
https://github.com/mo3athBaioud/bluestome
ad1b992775dcebcfc5ed81cfb49e7d29ef9e12fb
7de9ab0ad517f0e1da2a147e9079103824a99af3
refs/heads/master
2021-01-10T06:06:43.903000
2012-11-28T09:36:48
2012-11-28T09:36:48
43,675,743
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.zol.mobile; import java.io.File; import java.util.HashMap; import java.util.Iterator; import java.util.List; import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.htmlparser.Node; import org.htmlparser.NodeFilter; import org.htmlparser.Parser; import org.htmlparser.filters.TagNameFilter; import org.htmlparser.filters.HasAttributeFilter; import org.htmlparser.filters.NodeClassFilter; import org.htmlparser.nodes.TextNode; import org.htmlparser.tags.CompositeTag; import org.htmlparser.tags.Div; import org.htmlparser.tags.ImageTag; import org.htmlparser.tags.LinkTag; import org.htmlparser.tags.TableColumn; import org.htmlparser.tags.TableRow; import org.htmlparser.tags.TableTag; import org.htmlparser.util.NodeList; import com.chinamilitary.bean.LinkBean; import com.chinamilitary.bean.MobileBrandTemp; import com.chinamilitary.bean.ResultBean; import com.chinamilitary.dao.IMobileBrandTempDAO; import com.chinamilitary.factory.DAOFactory; import com.chinamilitary.memcache.MemcacheClient; import com.chinamilitary.util.HttpClientUtils; import com.chinamilitary.util.IOUtil; /** * 中关村手机频道解析类 * * @author bluestome * */ public class MobileParser { static Log log = LogFactory.getLog(MobileParser.class); static String ZOL_URL_PREFIX = "http://detail.zol.com.cn"; final static String ZOL_MOBILE_URL = "http://mobile.zol.com.cn/manu_list.html"; final static Integer D_PARENT_ID = 1634; static IMobileBrandTempDAO mobileBrandTempDAO = DAOFactory.getInstance().getMobileBrandTempDAO(); static HashMap<String,MobileBrandTemp> BRAND_MAP = new HashMap<String,MobileBrandTemp>(); static HashMap<String,LinkTag> BRAND_MAP2 = new HashMap<String,LinkTag>(); static String FILE_SAVE_PATH = "D:/zol/mobile/"; static int count = 0; static MemcacheClient client = MemcacheClient.getInstance(); static StringBuffer CONTENT_BUILDER = new StringBuffer(); public static void main(String args[]){ /** loopFile(FILE_SAVE_PATH); IOUtil.createFile(CONTENT_BUILDER.toString(),"终端属性","txt"); if(null != CONTENT_BUILDER){ CONTENT_BUILDER = null; } log.info(" >> 终端总数:"+count); count = 0; **/ // readTerminalInfo("E:\\Workspaces\\5.CMP\\diy_page\\终端属性.txt"); // readTerminalInfo("终端属性.txt"); sql(); } static void method1(){ brandList(); Iterator it = BRAND_MAP2.keySet().iterator(); while(it.hasNext()){ String key = (String)it.next(); try { LinkTag lt = BRAND_MAP2.get(key); ResultBean result = hasPaging(key,"class","pagebar"); if (result.isBool()) { Iterator it2 = result.getMap().keySet().iterator(); int pageNum = 1; while (it2.hasNext()) { String key2 = (String) it2.next(); LinkBean link = result.getMap().get(key2); // items(link.getLink()); boolean b = savePage(lt.getLinkText(), link.getLink(), pageNum); log.info(link.getLink()+",保存:"+b); pageNum++; Thread.sleep(1000); } } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } BRAND_MAP2.clear(); } static void list(){ try{ List<MobileBrandTemp> list= mobileBrandTempDAO.findByWebId(D_PARENT_ID); for(MobileBrandTemp brand:list){ String url = getPriceList(brand.getUrl()); log.info(" >> brand["+brand.getName()+"].list:"+url); } brandList(); }catch(Exception e){ e.printStackTrace(); } } static String getPriceList(String url) throws Exception { String target = null; Parser parser = null; Parser p2 = null; try{ parser = new Parser(); parser.setURL(url); parser.setEncoding("GB2312"); NodeList list = parser.extractAllNodesThatMatch(new TagNameFilter("ul")) .extractAllNodesThatMatch( new HasAttributeFilter("class", "brand_nav white clearfix")); if (null != list && list.size() > 0) { String content = list.toHtml(); p2 = new Parser(); p2.setInputHTML(content); p2.setEncoding("GB2312"); NodeFilter fileter = new NodeClassFilter(LinkTag.class); NodeList list2 = p2.extractAllNodesThatMatch(fileter); if(null != list2 && list2.size() > 0){ LinkTag link = (LinkTag)list2.elementAt(0); target = link.getLink(); } } }catch(Exception e){ e.printStackTrace(); }finally{ if(null != parser) parser = null; if(null != p2) p2 = null; } return target; } static void add(){ BRAND_MAP.clear(); brandWithIcon(); brandWithoutIcon(); log.info(" >> 品牌数量:"+BRAND_MAP.size()); Iterator it = BRAND_MAP.keySet().iterator(); while(it.hasNext()){ String key = (String)it.next(); MobileBrandTemp brand = (MobileBrandTemp)BRAND_MAP.get(key); if(null != brand){ brand.setWebid(D_PARENT_ID); log.info(" >>name:"+brand.getName()); log.info(" >>url:"+brand.getUrl()); if(null != brand.getIcon()){ log.info(" >>icon:"+brand.getIcon()); } try{ int result = mobileBrandTempDAO.add(brand); log.info(" >> result:"+result); }catch(Exception e){ e.printStackTrace(); } } } } /** * 有图表的品牌 * */ static void brandWithIcon() { Parser parser = null; MobileBrandTemp brand = null; try { parser = new Parser(); parser.setURL(ZOL_MOBILE_URL); parser.setEncoding("GB2312"); NodeFilter fileter = new NodeClassFilter(Div.class); NodeList list = parser.extractAllNodesThatMatch(fileter) .extractAllNodesThatMatch( new HasAttributeFilter("class", "blI")); if (null != list && list.size() > 0) { for (int i = 0; i < list.size(); i++) { Div div = (Div) list.elementAt(i); int childCount = div.getChildCount(); if (childCount == 5) { if (div.getChild(1) instanceof LinkTag) { brand = new MobileBrandTemp(); LinkTag link = (LinkTag) div.getChild(1); brand.setUrl(link.getLink()); if(link.getChild(0) instanceof ImageTag){ ImageTag image = (ImageTag)link.getChild(0); brand.setIcon(image.getImageURL()); brand.setName(image.getAttribute("alt")); BRAND_MAP.put(link.getLink(), brand); } } } } } } catch (Exception e) { e.printStackTrace(); } finally { if (null != parser) parser = null; } } /** * 有图表的品牌 * */ static void brandWithoutIcon() { Parser parser = null; MobileBrandTemp brand = null; try { parser = new Parser(); parser.setURL(ZOL_MOBILE_URL); parser.setEncoding("GB2312"); NodeFilter fileter = new NodeClassFilter(Div.class); NodeList list = parser.extractAllNodesThatMatch(fileter) .extractAllNodesThatMatch( new HasAttributeFilter("class", "blCon2")); if (null != list && list.size() > 0) { for (int i = 0; i < list.size(); i++) { Div div = (Div) list.elementAt(i); if (div.getChild(0) instanceof LinkTag) { brand = new MobileBrandTemp(); LinkTag link = (LinkTag) div.getChild(0); brand.setName(link.getLinkText()); brand.setUrl(link.getLink()); if(!BRAND_MAP.containsKey(link.getLink())){ BRAND_MAP.put(link.getLink(), brand); } } } } } catch (Exception e) { e.printStackTrace(); } finally { if (null != parser) parser = null; } } static void brandList(){ Parser parser = null; Parser p2 = null; try { parser = new Parser(); parser.setURL("http://detail.zol.com.cn/category/57.html"); parser.setEncoding("GB2312"); NodeFilter fileter = new NodeClassFilter(Div.class); NodeList list = parser.extractAllNodesThatMatch(fileter) .extractAllNodesThatMatch( new HasAttributeFilter("id", "manulist")); if (null != list && list.size() > 0) { Div div = (Div)list.elementAt(0); p2 = new Parser(); p2.setInputHTML(div.toHtml()); p2.setEncoding("GB2312"); NodeFilter fileter2 = new NodeClassFilter(LinkTag.class); NodeList list2 = p2.extractAllNodesThatMatch(fileter2); for(int i=0;i<list2.size();i++){ LinkTag link = (LinkTag)list2.elementAt(i); if(null != link.getLinkText() && !"".equals(link.getLinkText())){ log.info(" >> "+ZOL_URL_PREFIX+link.getLink()+"|"+link.getLinkText()); BRAND_MAP2.put(ZOL_URL_PREFIX+link.getLink(), link); } } } } catch (Exception e) { e.printStackTrace(); } finally { if (null != parser) parser = null; } } /** * 获取分类下的分页信息 * * @param url * @param attribute * @param value * @return * @throws Exception */ static ResultBean hasPaging(String url, String cls, String value) throws Exception { boolean b = false; ResultBean result = new ResultBean(); Parser parser = new Parser(); parser.setURL(url); int len = 1; // 获取指定ID的DIV内容 NodeFilter filter = new NodeClassFilter(Div.class); NodeList list = parser.extractAllNodesThatMatch(filter) .extractAllNodesThatMatch(new HasAttributeFilter(cls, value)); if (list != null && list.size() > 0) { Parser p2 = new Parser(); p2.setInputHTML(list.toHtml()); NodeFilter filter2 = new NodeClassFilter(LinkTag.class); NodeList list2 = p2.extractAllNodesThatMatch(filter2); if (null != list && list2.size() > 0) { String tmp = null; LinkBean l1 = null; if(list2.size() == 6){ LinkTag tl = (LinkTag)list2.elementAt(4); // log.info(" >> 获取分页数量:"+tl.toPlainTextString()+"|"+tl.getLink()); try{ len = Integer.parseInt(tl.toPlainTextString()); }catch(NumberFormatException e){ e.printStackTrace(); } for(int i=1;i<len+1;i++){ String tu = url.replace("1.", i+"."); if (!url.startsWith("http://")) { tmp = ZOL_URL_PREFIX + tu; } else { tmp = tu; } if(null != tmp && !"".equals(tmp)){ l1 = new LinkBean(); l1.setLink(tmp); l1.setTitle(i+""); result.put(tmp, l1); } } }else{ for (int i = 0; i < list2.size(); i++) { l1 = new LinkBean(); LinkTag link2 = (LinkTag) list2.elementAt(i); if (!link2.getLink().startsWith("http://")) { tmp = ZOL_URL_PREFIX + link2.getLink(); } else { tmp = link2.getLink(); } tmp = tmp.replace("&amp;", "&"); l1.setLink(tmp); l1.setTitle(link2.toPlainTextString()); result.put(tmp, l1); } } }else{ LinkBean l1 = new LinkBean();; l1.setLink(url); l1.setTitle(url); result.put(url, l1); result.setBool(true); } if (null != p2) p2 = null; } LinkBean l1 = new LinkBean();; l1.setLink(url); l1.setTitle(url); result.put(url, l1); result.setBool(true); return result; } static void items(String url){ Parser p1 = null; Parser p2 = null; try{ p1 = new Parser(); p1.setURL(url); p1.setEncoding("GB2312"); NodeFilter fileter = new NodeClassFilter(Div.class); NodeList list = p1.extractAllNodesThatMatch(fileter) .extractAllNodesThatMatch( new HasAttributeFilter("class", "item")); if(null != list && list.size() > 0){ count += list.size(); log.info(" >> 终端数量:"+list.size()); } }catch(Exception e){ }finally{ if(null != p1){ p1 = null; } if(null != p2){ p2 = null; } } } static void items(String brand,String content){ Parser p1 = null; Parser p2 = null; try{ p1 = new Parser(); p1.setInputHTML(content); p1.setEncoding("GB2312"); NodeFilter fileter = new NodeClassFilter(Div.class); NodeList list = p1.extractAllNodesThatMatch(fileter) .extractAllNodesThatMatch( new HasAttributeFilter("class", "item")); if(null != list && list.size() > 0){ // log.info(" >> 品牌【"+brand+"】.终端数量:"+list.size()); for(int i=0;i<list.size();i++){ Div div = (Div)list.elementAt(i); // log.info(" >> "+div.toHtml()); String hstype = getHstype(div.toHtml()); // log.info(" \t\t>> 机型:"+hstype); String paramUrl = getParameterPage(div.toHtml()); // log.info(" \t\t>> 参数URL:"+paramUrl); if(null != paramUrl){ int[] paramset = parameterSet(paramUrl); log.info(" >> 品牌["+brand+"],机型["+hstype.replace(brand.replace("手机", ""), "")+"],终端属性:(GPRS["+(paramset[0] == 1?"支持":"不支持")+"],WAP["+(paramset[1] == 1?"支持":"不支持")+"],智能手机["+(paramset[2] == 1?"支持":"不支持")+"],操作系统["+(paramset[3] == 1?"支持":"不支持")+"],WIFI["+(paramset[4] == 1?"支持":"不支持")+"])"); CONTENT_BUILDER.append(brand).append(",").append(hstype.replace(brand, "")).append(",").append(paramset[0]).append(",").append(paramset[1]).append(",").append(paramset[2]).append(",").append(paramset[3]).append(",").append(paramset[4]).append("\r\n"); count++; } } } }catch(Exception e){ log.error(e); }finally{ if(null != p1){ p1 = null; } if(null != p2){ p2 = null; } } } static String getHstype(String content){ String type = null; Parser p1 = null; Parser p2 = null; try{ p1 = new Parser(); p1.setInputHTML(content); p1.setEncoding("GB2312"); NodeFilter fileter = new NodeClassFilter(Div.class); NodeList list = p1.extractAllNodesThatMatch(fileter) .extractAllNodesThatMatch( new HasAttributeFilter("class", "intro")); if(null != list && list.size() > 0){ p2 = new Parser(); p2.setInputHTML(list.toHtml()); p2.setEncoding("GB2312"); NodeFilter fileter2 = new NodeClassFilter(LinkTag.class); list = p2.extractAllNodesThatMatch(fileter2); if(null != list && list.size() > 0){ LinkTag link = (LinkTag)list.elementAt(0); if(null != link.getLinkText() && !"".equals(link.getLinkText())){ type = link.getLinkText(); } } } }catch(Exception e){ log.error(e); }finally{ if(null != p1) p1 = null; if(null != p2) p2 = null; } return type; } static String getParameterPage(String content){ String type = null; Parser p1 = null; Parser p2 = null; try{ p1 = new Parser(); p1.setInputHTML(content); p1.setEncoding("GB2312"); NodeFilter fileter = new NodeClassFilter(Div.class); NodeList list = p1.extractAllNodesThatMatch(fileter) .extractAllNodesThatMatch( new HasAttributeFilter("class", "intro")); if(null != list && list.size() > 0){ p2 = new Parser(); p2.setInputHTML(list.toHtml()); p2.setEncoding("GB2312"); NodeFilter fileter2 = new NodeClassFilter(LinkTag.class); list = p2.extractAllNodesThatMatch(fileter2); if(null != list && list.size() > 0){ for(int i=0;i<list.size();i++){ LinkTag link = (LinkTag)list.elementAt(i); if(null != link.getLinkText() && !"".equals(link.getLinkText()) && "更多参数>>".equals(link.getLinkText())){ if(link.getLink().startsWith("http://")){ type = link.getLink(); }else{ type = ZOL_URL_PREFIX+link.getLink(); } break; } } } } }catch(Exception e){ log.error(e); }finally{ if(null != p1) p1 = null; if(null != p2) p2 = null; } return type; } /** * 保存文件 * @param type 品牌名称 * @param url 地址 * @param pageNum 页数 * @return */ public static boolean savePage(String type,String url,int pageNum){ String filePath = FILE_SAVE_PATH+type+"\\"+type+"_"+pageNum+".html"; try{ File file = new File(filePath); if(file.exists()){ return false; } String content = HttpClientUtils.getResponseBody(url,"GB2312"); if(file.length() == content.length()){ return false; } if(content.length() == 11033){ return false; } if(null != content && !"".equals(content)){ if(!file.exists()){ file.getParentFile().mkdir(); } IOUtil.createFile(content, file.getParentFile().getAbsolutePath(),file.getName()); } return true; }catch(Exception e){ return false; } } static void loopFile(String path){ File file = null; try{ file = new File(path); File[] flist = file.listFiles(); for(File s:flist){ if(s.isDirectory()){ loopFile(s.getAbsolutePath()); }else{ String type = s.getParentFile().getName(); String content = IOUtil.readFile(s.getAbsolutePath(), "GBK", "html"); items(type,content); } } }catch(Exception e){ e.printStackTrace(); } } /** * * @param url * @return 1:GPRS 2: 3: 4: 5: * 1.GPRS 数据业务: 查找是否有GPRS字眼 * 2.WAP WAP浏览器:查找是否有WAP字眼 * 3.智能手机 手机类型: 查找是否存在智能手机字眼. * 4.操作系统 操作系统: 查找操作系统名称. * 5.WIFI WLAN功能:查找是否有WIFI. */ static int[] parameterSet(String url){ int[] params = {0,0,0,0,0}; Parser p1 = null; Parser p2 = null; try{ p1 = new Parser(); p1.setURL(url); p1.setEncoding("GB2312"); NodeFilter fileter = new NodeClassFilter(TableTag.class); NodeList list = p1.extractAllNodesThatMatch(fileter) .extractAllNodesThatMatch( new HasAttributeFilter("id", "param-tb")); if(null != list && list.size() > 0){ p2 = new Parser(); p2.setInputHTML(list.toHtml()); p2.setEncoding("GB2312"); NodeFilter fileter2 = new NodeClassFilter(TableRow.class); list = p2.extractAllNodesThatMatch(fileter2); if(null != list && list.size() > 0){ for(int i=0;i<list.size();i++){ TableRow ct = (TableRow)list.elementAt(i); TableColumn[] tcs = ct.getColumns(); int len = tcs.length; String content = null; if(len == 2){ TableColumn tc = tcs[0]; if(tc.toPlainTextString().equals("数据业务")){ content = tcs[1].toPlainTextString().replace("纠错", ""); if(content.contains("GPRS")){ // log.info(" >> 数据业务:"+content); params[0] = 1; } } if(tc.toPlainTextString().equals("WAP浏览器")){ content = tcs[1].toPlainTextString().replace("纠错", ""); if(content.contains("WAP")){ // log.info(" >> WAP浏览器:"+content); params[1] = 1; } } if(tc.toPlainTextString().equals("手机类型")){ content = tcs[1].toPlainTextString().replace("纠错", ""); if(content.contains("智能手机")){ // log.info(" >> 手机类型:"+content); params[2] = 1; } } if(tc.toPlainTextString().equals("操作系统")){ content = tcs[1].toPlainTextString().replace("纠错", ""); // log.info(" >> 操作系统:"+tcs[1].toPlainTextString()); params[3] = 1; } if(tc.toPlainTextString().equals("WLAN功能")){ content = tcs[1].toPlainTextString().replace("纠错", ""); if(content.contains("WIFI")){ // log.info(" >> WLAN功能:"+content); params[4] = 1; } } } } } } }catch(Exception e){ log.error(e); }finally{ if(null != p1) p1 = null; if(null != p2) p2 = null; } return params; } static void readTerminalInfo(String name){ File file = null; int id = 1; StringBuffer sb = new StringBuffer(); try{ file = new File(System.getProperty("user.dir")+File.separator+name); String content = IOUtil.readFile(file.getAbsolutePath(), "GBK", "txt"); String[] rows = content.split("\r\n"); sb.append("INSERT INTO `tbl_terminal_property` (`d_id`, `d_hsman`, `d_hstype`, `d_gprs`, `d_wap`, `d_smartphone`, `d_os`, `d_wifi`) values "); for(String row:rows){ String[] contents = row.split(","); // log.info(">> 厂商:"+contents[0]); // log.info(">> 机型:"+contents[1]); // log.info(">> GPRS:"+contents[2]); // log.info(">> WAP:"+contents[3]); // log.info(">> 是否智能手机:"+contents[4]); // log.info(">> 操作系统:"+contents[5]); // log.info(">> WIFI:"+contents[6]); // log.info(""); sb.append("(").append(id).append(",'").append(contents[0].replace("'", "")).append("','").append(contents[1].replace("'", "")).append("',").append(contents[2]).append(",").append(contents[3]).append(","); sb.append(contents[4]).append(",").append(contents[5]).append(",").append(contents[6]).append(")"); if(id<rows.length){ sb.append(",\r\n"); } id++; } sb.append(";"); }catch(Exception e){ e.printStackTrace(); }finally{ if(null != file){ file = null; } log.info(sb.toString()); IOUtil.createFile(sb.toString(), "terminal_property", ".sql"); } } static void sql(){ StringBuffer sb = new StringBuffer(); sb.append("\t").append("create table tbl_bussiness_{id}(\r\n"); sb.append("\t\t").append("d_id int(4) not null AUTO_INCREMENT,\r\n"); sb.append("\t\t").append("d_phonenum varchar(11) not null,\r\n"); sb.append("\t\t").append("d_hsman varchar(32),\r\n"); sb.append("\t\t").append("d_hstype varchar(32),\r\n"); sb.append("\t\t").append("d_imei varchar(16),\r\n"); sb.append("\t\t").append("d_support int(4) default 0,\r\n"); sb.append("\t\t").append("d_support_type int(4) default 0,\r\n"); sb.append("\t\t").append("PRIMARY KEY (d_id)\r\n"); sb.append("\t").append(");"); for(int i=1;i<17;i++){ String sql = sb.toString().replace("{id}", i+""); log.info(sql); log.info("\r\n"); } } } /** * 品牌BEAN * @author bluestome * */ class Brand{ String name; String url; String icon; public String getIcon() { return icon; } public void setIcon(String icon) { this.icon = icon; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } }
UTF-8
Java
22,575
java
MobileParser.java
Java
[ { "context": "til.IOUtil;\r\n\r\n/**\r\n * 中关村手机频道解析类\r\n * \r\n * @author bluestome\r\n * \r\n */\r\npublic class MobileParser {\r\n\t\r\n\tstati", "end": 1256, "score": 0.9995884299278259, "start": 1247, "tag": "USERNAME", "value": "bluestome" }, { "context": "\"\\r\\n\");\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * 品牌BEAN\r\n * @author bluestome\r\n *\r\n */\r\nclass Brand{\r\n\tString name;\r\n\tString ur", "end": 21621, "score": 0.9996450543403625, "start": 21612, "tag": "USERNAME", "value": "bluestome" } ]
null
[]
package com.zol.mobile; import java.io.File; import java.util.HashMap; import java.util.Iterator; import java.util.List; import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.htmlparser.Node; import org.htmlparser.NodeFilter; import org.htmlparser.Parser; import org.htmlparser.filters.TagNameFilter; import org.htmlparser.filters.HasAttributeFilter; import org.htmlparser.filters.NodeClassFilter; import org.htmlparser.nodes.TextNode; import org.htmlparser.tags.CompositeTag; import org.htmlparser.tags.Div; import org.htmlparser.tags.ImageTag; import org.htmlparser.tags.LinkTag; import org.htmlparser.tags.TableColumn; import org.htmlparser.tags.TableRow; import org.htmlparser.tags.TableTag; import org.htmlparser.util.NodeList; import com.chinamilitary.bean.LinkBean; import com.chinamilitary.bean.MobileBrandTemp; import com.chinamilitary.bean.ResultBean; import com.chinamilitary.dao.IMobileBrandTempDAO; import com.chinamilitary.factory.DAOFactory; import com.chinamilitary.memcache.MemcacheClient; import com.chinamilitary.util.HttpClientUtils; import com.chinamilitary.util.IOUtil; /** * 中关村手机频道解析类 * * @author bluestome * */ public class MobileParser { static Log log = LogFactory.getLog(MobileParser.class); static String ZOL_URL_PREFIX = "http://detail.zol.com.cn"; final static String ZOL_MOBILE_URL = "http://mobile.zol.com.cn/manu_list.html"; final static Integer D_PARENT_ID = 1634; static IMobileBrandTempDAO mobileBrandTempDAO = DAOFactory.getInstance().getMobileBrandTempDAO(); static HashMap<String,MobileBrandTemp> BRAND_MAP = new HashMap<String,MobileBrandTemp>(); static HashMap<String,LinkTag> BRAND_MAP2 = new HashMap<String,LinkTag>(); static String FILE_SAVE_PATH = "D:/zol/mobile/"; static int count = 0; static MemcacheClient client = MemcacheClient.getInstance(); static StringBuffer CONTENT_BUILDER = new StringBuffer(); public static void main(String args[]){ /** loopFile(FILE_SAVE_PATH); IOUtil.createFile(CONTENT_BUILDER.toString(),"终端属性","txt"); if(null != CONTENT_BUILDER){ CONTENT_BUILDER = null; } log.info(" >> 终端总数:"+count); count = 0; **/ // readTerminalInfo("E:\\Workspaces\\5.CMP\\diy_page\\终端属性.txt"); // readTerminalInfo("终端属性.txt"); sql(); } static void method1(){ brandList(); Iterator it = BRAND_MAP2.keySet().iterator(); while(it.hasNext()){ String key = (String)it.next(); try { LinkTag lt = BRAND_MAP2.get(key); ResultBean result = hasPaging(key,"class","pagebar"); if (result.isBool()) { Iterator it2 = result.getMap().keySet().iterator(); int pageNum = 1; while (it2.hasNext()) { String key2 = (String) it2.next(); LinkBean link = result.getMap().get(key2); // items(link.getLink()); boolean b = savePage(lt.getLinkText(), link.getLink(), pageNum); log.info(link.getLink()+",保存:"+b); pageNum++; Thread.sleep(1000); } } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } BRAND_MAP2.clear(); } static void list(){ try{ List<MobileBrandTemp> list= mobileBrandTempDAO.findByWebId(D_PARENT_ID); for(MobileBrandTemp brand:list){ String url = getPriceList(brand.getUrl()); log.info(" >> brand["+brand.getName()+"].list:"+url); } brandList(); }catch(Exception e){ e.printStackTrace(); } } static String getPriceList(String url) throws Exception { String target = null; Parser parser = null; Parser p2 = null; try{ parser = new Parser(); parser.setURL(url); parser.setEncoding("GB2312"); NodeList list = parser.extractAllNodesThatMatch(new TagNameFilter("ul")) .extractAllNodesThatMatch( new HasAttributeFilter("class", "brand_nav white clearfix")); if (null != list && list.size() > 0) { String content = list.toHtml(); p2 = new Parser(); p2.setInputHTML(content); p2.setEncoding("GB2312"); NodeFilter fileter = new NodeClassFilter(LinkTag.class); NodeList list2 = p2.extractAllNodesThatMatch(fileter); if(null != list2 && list2.size() > 0){ LinkTag link = (LinkTag)list2.elementAt(0); target = link.getLink(); } } }catch(Exception e){ e.printStackTrace(); }finally{ if(null != parser) parser = null; if(null != p2) p2 = null; } return target; } static void add(){ BRAND_MAP.clear(); brandWithIcon(); brandWithoutIcon(); log.info(" >> 品牌数量:"+BRAND_MAP.size()); Iterator it = BRAND_MAP.keySet().iterator(); while(it.hasNext()){ String key = (String)it.next(); MobileBrandTemp brand = (MobileBrandTemp)BRAND_MAP.get(key); if(null != brand){ brand.setWebid(D_PARENT_ID); log.info(" >>name:"+brand.getName()); log.info(" >>url:"+brand.getUrl()); if(null != brand.getIcon()){ log.info(" >>icon:"+brand.getIcon()); } try{ int result = mobileBrandTempDAO.add(brand); log.info(" >> result:"+result); }catch(Exception e){ e.printStackTrace(); } } } } /** * 有图表的品牌 * */ static void brandWithIcon() { Parser parser = null; MobileBrandTemp brand = null; try { parser = new Parser(); parser.setURL(ZOL_MOBILE_URL); parser.setEncoding("GB2312"); NodeFilter fileter = new NodeClassFilter(Div.class); NodeList list = parser.extractAllNodesThatMatch(fileter) .extractAllNodesThatMatch( new HasAttributeFilter("class", "blI")); if (null != list && list.size() > 0) { for (int i = 0; i < list.size(); i++) { Div div = (Div) list.elementAt(i); int childCount = div.getChildCount(); if (childCount == 5) { if (div.getChild(1) instanceof LinkTag) { brand = new MobileBrandTemp(); LinkTag link = (LinkTag) div.getChild(1); brand.setUrl(link.getLink()); if(link.getChild(0) instanceof ImageTag){ ImageTag image = (ImageTag)link.getChild(0); brand.setIcon(image.getImageURL()); brand.setName(image.getAttribute("alt")); BRAND_MAP.put(link.getLink(), brand); } } } } } } catch (Exception e) { e.printStackTrace(); } finally { if (null != parser) parser = null; } } /** * 有图表的品牌 * */ static void brandWithoutIcon() { Parser parser = null; MobileBrandTemp brand = null; try { parser = new Parser(); parser.setURL(ZOL_MOBILE_URL); parser.setEncoding("GB2312"); NodeFilter fileter = new NodeClassFilter(Div.class); NodeList list = parser.extractAllNodesThatMatch(fileter) .extractAllNodesThatMatch( new HasAttributeFilter("class", "blCon2")); if (null != list && list.size() > 0) { for (int i = 0; i < list.size(); i++) { Div div = (Div) list.elementAt(i); if (div.getChild(0) instanceof LinkTag) { brand = new MobileBrandTemp(); LinkTag link = (LinkTag) div.getChild(0); brand.setName(link.getLinkText()); brand.setUrl(link.getLink()); if(!BRAND_MAP.containsKey(link.getLink())){ BRAND_MAP.put(link.getLink(), brand); } } } } } catch (Exception e) { e.printStackTrace(); } finally { if (null != parser) parser = null; } } static void brandList(){ Parser parser = null; Parser p2 = null; try { parser = new Parser(); parser.setURL("http://detail.zol.com.cn/category/57.html"); parser.setEncoding("GB2312"); NodeFilter fileter = new NodeClassFilter(Div.class); NodeList list = parser.extractAllNodesThatMatch(fileter) .extractAllNodesThatMatch( new HasAttributeFilter("id", "manulist")); if (null != list && list.size() > 0) { Div div = (Div)list.elementAt(0); p2 = new Parser(); p2.setInputHTML(div.toHtml()); p2.setEncoding("GB2312"); NodeFilter fileter2 = new NodeClassFilter(LinkTag.class); NodeList list2 = p2.extractAllNodesThatMatch(fileter2); for(int i=0;i<list2.size();i++){ LinkTag link = (LinkTag)list2.elementAt(i); if(null != link.getLinkText() && !"".equals(link.getLinkText())){ log.info(" >> "+ZOL_URL_PREFIX+link.getLink()+"|"+link.getLinkText()); BRAND_MAP2.put(ZOL_URL_PREFIX+link.getLink(), link); } } } } catch (Exception e) { e.printStackTrace(); } finally { if (null != parser) parser = null; } } /** * 获取分类下的分页信息 * * @param url * @param attribute * @param value * @return * @throws Exception */ static ResultBean hasPaging(String url, String cls, String value) throws Exception { boolean b = false; ResultBean result = new ResultBean(); Parser parser = new Parser(); parser.setURL(url); int len = 1; // 获取指定ID的DIV内容 NodeFilter filter = new NodeClassFilter(Div.class); NodeList list = parser.extractAllNodesThatMatch(filter) .extractAllNodesThatMatch(new HasAttributeFilter(cls, value)); if (list != null && list.size() > 0) { Parser p2 = new Parser(); p2.setInputHTML(list.toHtml()); NodeFilter filter2 = new NodeClassFilter(LinkTag.class); NodeList list2 = p2.extractAllNodesThatMatch(filter2); if (null != list && list2.size() > 0) { String tmp = null; LinkBean l1 = null; if(list2.size() == 6){ LinkTag tl = (LinkTag)list2.elementAt(4); // log.info(" >> 获取分页数量:"+tl.toPlainTextString()+"|"+tl.getLink()); try{ len = Integer.parseInt(tl.toPlainTextString()); }catch(NumberFormatException e){ e.printStackTrace(); } for(int i=1;i<len+1;i++){ String tu = url.replace("1.", i+"."); if (!url.startsWith("http://")) { tmp = ZOL_URL_PREFIX + tu; } else { tmp = tu; } if(null != tmp && !"".equals(tmp)){ l1 = new LinkBean(); l1.setLink(tmp); l1.setTitle(i+""); result.put(tmp, l1); } } }else{ for (int i = 0; i < list2.size(); i++) { l1 = new LinkBean(); LinkTag link2 = (LinkTag) list2.elementAt(i); if (!link2.getLink().startsWith("http://")) { tmp = ZOL_URL_PREFIX + link2.getLink(); } else { tmp = link2.getLink(); } tmp = tmp.replace("&amp;", "&"); l1.setLink(tmp); l1.setTitle(link2.toPlainTextString()); result.put(tmp, l1); } } }else{ LinkBean l1 = new LinkBean();; l1.setLink(url); l1.setTitle(url); result.put(url, l1); result.setBool(true); } if (null != p2) p2 = null; } LinkBean l1 = new LinkBean();; l1.setLink(url); l1.setTitle(url); result.put(url, l1); result.setBool(true); return result; } static void items(String url){ Parser p1 = null; Parser p2 = null; try{ p1 = new Parser(); p1.setURL(url); p1.setEncoding("GB2312"); NodeFilter fileter = new NodeClassFilter(Div.class); NodeList list = p1.extractAllNodesThatMatch(fileter) .extractAllNodesThatMatch( new HasAttributeFilter("class", "item")); if(null != list && list.size() > 0){ count += list.size(); log.info(" >> 终端数量:"+list.size()); } }catch(Exception e){ }finally{ if(null != p1){ p1 = null; } if(null != p2){ p2 = null; } } } static void items(String brand,String content){ Parser p1 = null; Parser p2 = null; try{ p1 = new Parser(); p1.setInputHTML(content); p1.setEncoding("GB2312"); NodeFilter fileter = new NodeClassFilter(Div.class); NodeList list = p1.extractAllNodesThatMatch(fileter) .extractAllNodesThatMatch( new HasAttributeFilter("class", "item")); if(null != list && list.size() > 0){ // log.info(" >> 品牌【"+brand+"】.终端数量:"+list.size()); for(int i=0;i<list.size();i++){ Div div = (Div)list.elementAt(i); // log.info(" >> "+div.toHtml()); String hstype = getHstype(div.toHtml()); // log.info(" \t\t>> 机型:"+hstype); String paramUrl = getParameterPage(div.toHtml()); // log.info(" \t\t>> 参数URL:"+paramUrl); if(null != paramUrl){ int[] paramset = parameterSet(paramUrl); log.info(" >> 品牌["+brand+"],机型["+hstype.replace(brand.replace("手机", ""), "")+"],终端属性:(GPRS["+(paramset[0] == 1?"支持":"不支持")+"],WAP["+(paramset[1] == 1?"支持":"不支持")+"],智能手机["+(paramset[2] == 1?"支持":"不支持")+"],操作系统["+(paramset[3] == 1?"支持":"不支持")+"],WIFI["+(paramset[4] == 1?"支持":"不支持")+"])"); CONTENT_BUILDER.append(brand).append(",").append(hstype.replace(brand, "")).append(",").append(paramset[0]).append(",").append(paramset[1]).append(",").append(paramset[2]).append(",").append(paramset[3]).append(",").append(paramset[4]).append("\r\n"); count++; } } } }catch(Exception e){ log.error(e); }finally{ if(null != p1){ p1 = null; } if(null != p2){ p2 = null; } } } static String getHstype(String content){ String type = null; Parser p1 = null; Parser p2 = null; try{ p1 = new Parser(); p1.setInputHTML(content); p1.setEncoding("GB2312"); NodeFilter fileter = new NodeClassFilter(Div.class); NodeList list = p1.extractAllNodesThatMatch(fileter) .extractAllNodesThatMatch( new HasAttributeFilter("class", "intro")); if(null != list && list.size() > 0){ p2 = new Parser(); p2.setInputHTML(list.toHtml()); p2.setEncoding("GB2312"); NodeFilter fileter2 = new NodeClassFilter(LinkTag.class); list = p2.extractAllNodesThatMatch(fileter2); if(null != list && list.size() > 0){ LinkTag link = (LinkTag)list.elementAt(0); if(null != link.getLinkText() && !"".equals(link.getLinkText())){ type = link.getLinkText(); } } } }catch(Exception e){ log.error(e); }finally{ if(null != p1) p1 = null; if(null != p2) p2 = null; } return type; } static String getParameterPage(String content){ String type = null; Parser p1 = null; Parser p2 = null; try{ p1 = new Parser(); p1.setInputHTML(content); p1.setEncoding("GB2312"); NodeFilter fileter = new NodeClassFilter(Div.class); NodeList list = p1.extractAllNodesThatMatch(fileter) .extractAllNodesThatMatch( new HasAttributeFilter("class", "intro")); if(null != list && list.size() > 0){ p2 = new Parser(); p2.setInputHTML(list.toHtml()); p2.setEncoding("GB2312"); NodeFilter fileter2 = new NodeClassFilter(LinkTag.class); list = p2.extractAllNodesThatMatch(fileter2); if(null != list && list.size() > 0){ for(int i=0;i<list.size();i++){ LinkTag link = (LinkTag)list.elementAt(i); if(null != link.getLinkText() && !"".equals(link.getLinkText()) && "更多参数>>".equals(link.getLinkText())){ if(link.getLink().startsWith("http://")){ type = link.getLink(); }else{ type = ZOL_URL_PREFIX+link.getLink(); } break; } } } } }catch(Exception e){ log.error(e); }finally{ if(null != p1) p1 = null; if(null != p2) p2 = null; } return type; } /** * 保存文件 * @param type 品牌名称 * @param url 地址 * @param pageNum 页数 * @return */ public static boolean savePage(String type,String url,int pageNum){ String filePath = FILE_SAVE_PATH+type+"\\"+type+"_"+pageNum+".html"; try{ File file = new File(filePath); if(file.exists()){ return false; } String content = HttpClientUtils.getResponseBody(url,"GB2312"); if(file.length() == content.length()){ return false; } if(content.length() == 11033){ return false; } if(null != content && !"".equals(content)){ if(!file.exists()){ file.getParentFile().mkdir(); } IOUtil.createFile(content, file.getParentFile().getAbsolutePath(),file.getName()); } return true; }catch(Exception e){ return false; } } static void loopFile(String path){ File file = null; try{ file = new File(path); File[] flist = file.listFiles(); for(File s:flist){ if(s.isDirectory()){ loopFile(s.getAbsolutePath()); }else{ String type = s.getParentFile().getName(); String content = IOUtil.readFile(s.getAbsolutePath(), "GBK", "html"); items(type,content); } } }catch(Exception e){ e.printStackTrace(); } } /** * * @param url * @return 1:GPRS 2: 3: 4: 5: * 1.GPRS 数据业务: 查找是否有GPRS字眼 * 2.WAP WAP浏览器:查找是否有WAP字眼 * 3.智能手机 手机类型: 查找是否存在智能手机字眼. * 4.操作系统 操作系统: 查找操作系统名称. * 5.WIFI WLAN功能:查找是否有WIFI. */ static int[] parameterSet(String url){ int[] params = {0,0,0,0,0}; Parser p1 = null; Parser p2 = null; try{ p1 = new Parser(); p1.setURL(url); p1.setEncoding("GB2312"); NodeFilter fileter = new NodeClassFilter(TableTag.class); NodeList list = p1.extractAllNodesThatMatch(fileter) .extractAllNodesThatMatch( new HasAttributeFilter("id", "param-tb")); if(null != list && list.size() > 0){ p2 = new Parser(); p2.setInputHTML(list.toHtml()); p2.setEncoding("GB2312"); NodeFilter fileter2 = new NodeClassFilter(TableRow.class); list = p2.extractAllNodesThatMatch(fileter2); if(null != list && list.size() > 0){ for(int i=0;i<list.size();i++){ TableRow ct = (TableRow)list.elementAt(i); TableColumn[] tcs = ct.getColumns(); int len = tcs.length; String content = null; if(len == 2){ TableColumn tc = tcs[0]; if(tc.toPlainTextString().equals("数据业务")){ content = tcs[1].toPlainTextString().replace("纠错", ""); if(content.contains("GPRS")){ // log.info(" >> 数据业务:"+content); params[0] = 1; } } if(tc.toPlainTextString().equals("WAP浏览器")){ content = tcs[1].toPlainTextString().replace("纠错", ""); if(content.contains("WAP")){ // log.info(" >> WAP浏览器:"+content); params[1] = 1; } } if(tc.toPlainTextString().equals("手机类型")){ content = tcs[1].toPlainTextString().replace("纠错", ""); if(content.contains("智能手机")){ // log.info(" >> 手机类型:"+content); params[2] = 1; } } if(tc.toPlainTextString().equals("操作系统")){ content = tcs[1].toPlainTextString().replace("纠错", ""); // log.info(" >> 操作系统:"+tcs[1].toPlainTextString()); params[3] = 1; } if(tc.toPlainTextString().equals("WLAN功能")){ content = tcs[1].toPlainTextString().replace("纠错", ""); if(content.contains("WIFI")){ // log.info(" >> WLAN功能:"+content); params[4] = 1; } } } } } } }catch(Exception e){ log.error(e); }finally{ if(null != p1) p1 = null; if(null != p2) p2 = null; } return params; } static void readTerminalInfo(String name){ File file = null; int id = 1; StringBuffer sb = new StringBuffer(); try{ file = new File(System.getProperty("user.dir")+File.separator+name); String content = IOUtil.readFile(file.getAbsolutePath(), "GBK", "txt"); String[] rows = content.split("\r\n"); sb.append("INSERT INTO `tbl_terminal_property` (`d_id`, `d_hsman`, `d_hstype`, `d_gprs`, `d_wap`, `d_smartphone`, `d_os`, `d_wifi`) values "); for(String row:rows){ String[] contents = row.split(","); // log.info(">> 厂商:"+contents[0]); // log.info(">> 机型:"+contents[1]); // log.info(">> GPRS:"+contents[2]); // log.info(">> WAP:"+contents[3]); // log.info(">> 是否智能手机:"+contents[4]); // log.info(">> 操作系统:"+contents[5]); // log.info(">> WIFI:"+contents[6]); // log.info(""); sb.append("(").append(id).append(",'").append(contents[0].replace("'", "")).append("','").append(contents[1].replace("'", "")).append("',").append(contents[2]).append(",").append(contents[3]).append(","); sb.append(contents[4]).append(",").append(contents[5]).append(",").append(contents[6]).append(")"); if(id<rows.length){ sb.append(",\r\n"); } id++; } sb.append(";"); }catch(Exception e){ e.printStackTrace(); }finally{ if(null != file){ file = null; } log.info(sb.toString()); IOUtil.createFile(sb.toString(), "terminal_property", ".sql"); } } static void sql(){ StringBuffer sb = new StringBuffer(); sb.append("\t").append("create table tbl_bussiness_{id}(\r\n"); sb.append("\t\t").append("d_id int(4) not null AUTO_INCREMENT,\r\n"); sb.append("\t\t").append("d_phonenum varchar(11) not null,\r\n"); sb.append("\t\t").append("d_hsman varchar(32),\r\n"); sb.append("\t\t").append("d_hstype varchar(32),\r\n"); sb.append("\t\t").append("d_imei varchar(16),\r\n"); sb.append("\t\t").append("d_support int(4) default 0,\r\n"); sb.append("\t\t").append("d_support_type int(4) default 0,\r\n"); sb.append("\t\t").append("PRIMARY KEY (d_id)\r\n"); sb.append("\t").append(");"); for(int i=1;i<17;i++){ String sql = sb.toString().replace("{id}", i+""); log.info(sql); log.info("\r\n"); } } } /** * 品牌BEAN * @author bluestome * */ class Brand{ String name; String url; String icon; public String getIcon() { return icon; } public void setIcon(String icon) { this.icon = icon; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } }
22,575
0.58843
0.573355
756
27.130953
24.70739
294
false
false
0
0
0
0
0
0
3.839947
false
false
13
f06fc86e7159fa0249be052de111205055d7e9e7
26,714,696,618,835
4259da63dca1b157e7d6c9a553e6bc66faeec0ac
/Folder/bunk/src/banking/Account.java
b147b6f73faf8a70d339296d1316de90fe63b386
[ "MIT" ]
permissive
Nuskusame/LazyPeople
https://github.com/Nuskusame/LazyPeople
71921706e82db1df9ca9f422b71e340268678e47
47e9a812fab50b556cbebecbafda8ebcafb7b218
refs/heads/main
2023-07-29T00:30:29.027000
2021-09-21T00:22:22
2021-09-21T00:22:22
402,936,057
1
2
MIT
false
2021-09-19T20:34:46
2021-09-04T01:24:14
2021-09-08T17:36:40
2021-09-19T20:34:45
520
1
2
0
HTML
false
false
package banking; import java.util.ArrayList; /** * * @author Nick */ public class Account implements IAccount { protected int accountNumber; protected double balance; protected String owner; protected static int counter; public Account() { counter++; } public double deposit(double d) { return 0.0; } public void displayAllTransactions() { } public ArrayList<Transaction> getTransactions() { return null; } // getters public int getaccountNumber() { return this.accountNumber; } public double getbalance() { return this.balance; } public String getowner() { return this.owner; } public static int getcounter() { return Account.counter; } // setters public void setaccountNumber(int accountNumber) { this.accountNumber = accountNumber; } public void setbalance(double balance) { this.balance = balance; } public void setowner(String owner) { this.owner = owner; } public double withdrawal(double w) { return 0.0; } }
UTF-8
Java
1,216
java
Account.java
Java
[ { "context": "import java.util.ArrayList;\r\n\r\n/**\r\n *\r\n * @author Nick\r\n */\r\npublic class Account implements IAccount {\r", "end": 77, "score": 0.9993785619735718, "start": 73, "tag": "NAME", "value": "Nick" } ]
null
[]
package banking; import java.util.ArrayList; /** * * @author Nick */ public class Account implements IAccount { protected int accountNumber; protected double balance; protected String owner; protected static int counter; public Account() { counter++; } public double deposit(double d) { return 0.0; } public void displayAllTransactions() { } public ArrayList<Transaction> getTransactions() { return null; } // getters public int getaccountNumber() { return this.accountNumber; } public double getbalance() { return this.balance; } public String getowner() { return this.owner; } public static int getcounter() { return Account.counter; } // setters public void setaccountNumber(int accountNumber) { this.accountNumber = accountNumber; } public void setbalance(double balance) { this.balance = balance; } public void setowner(String owner) { this.owner = owner; } public double withdrawal(double w) { return 0.0; } }
1,216
0.572368
0.569079
68
15.852942
16.115635
53
false
false
0
0
0
0
0
0
0.25
false
false
13
8b0269b1e8f094ed25afb44fcd30a121ce4fdd81
29,592,324,706,649
257d13d5410bcc3567fffa0119deeed7f3130b68
/app/src/main/java/app/quantumfinality/com/soulremedy/data/ArticleContract.java
ee1af89a939fc7a4ac5aa1a86f41e987f7a98a43
[]
no_license
AutomEng/SoulRemedy_newer
https://github.com/AutomEng/SoulRemedy_newer
41e1311497bb62940132b1088236117ef1ddbe33
90863006363dc870fae4d55c5ecb085b9835964f
refs/heads/master
2016-09-09T12:43:12.967000
2015-04-19T19:55:31
2015-04-19T19:55:31
34,219,060
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package app.quantumfinality.com.soulremedy.data; import android.content.ContentResolver; import android.content.ContentUris; import android.net.Uri; import android.provider.BaseColumns; import android.util.Log; /** * Created by dimitrisk on 4/10/15. */ public class ArticleContract { public static final String CONTENT_AUTHORITY = "app.quantumfinality.com.soulremedy"; public static final Uri BASE_CONTENT_URI = Uri.parse("content://" + CONTENT_AUTHORITY); //Defined path for table public static final String PATH_TABLE = "articles"; //Inner class defining the table public static final class ArticlesEntry implements BaseColumns { public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon().appendPath(PATH_TABLE).build(); public static final String CONTENT_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_TABLE; public static final String CONTENT_ITEM_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_TABLE; //Table name public static final String TABLE_NAME = "articles"; //Column containing the category id public static final String COLUMN_CATEGORY = "category"; //Column containing the article title public static final String COLUMN_TITLE = "title"; //Column containing the article author public static final String COLUMN_AUTHOR = "author"; //Column containing the image URL public static final String COLUMN_URL = "url"; public static Uri buildArticleUri(long id) { return ContentUris.withAppendedId(CONTENT_URI, id); } public static Uri buildArticleWithID(int id) { return CONTENT_URI.buildUpon(). appendQueryParameter(ArticlesEntry._ID, Integer.toString(id)).build(); } public static Uri buildArticleList() { Log.v("buildArticleList", "building table path"); return CONTENT_URI.buildUpon().appendPath(PATH_TABLE).build(); } } }
UTF-8
Java
2,118
java
ArticleContract.java
Java
[ { "context": "lumns;\nimport android.util.Log;\n\n/**\n * Created by dimitrisk on 4/10/15.\n */\npublic class ArticleContract {\n\n ", "end": 240, "score": 0.9996902346611023, "start": 231, "tag": "USERNAME", "value": "dimitrisk" } ]
null
[]
package app.quantumfinality.com.soulremedy.data; import android.content.ContentResolver; import android.content.ContentUris; import android.net.Uri; import android.provider.BaseColumns; import android.util.Log; /** * Created by dimitrisk on 4/10/15. */ public class ArticleContract { public static final String CONTENT_AUTHORITY = "app.quantumfinality.com.soulremedy"; public static final Uri BASE_CONTENT_URI = Uri.parse("content://" + CONTENT_AUTHORITY); //Defined path for table public static final String PATH_TABLE = "articles"; //Inner class defining the table public static final class ArticlesEntry implements BaseColumns { public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon().appendPath(PATH_TABLE).build(); public static final String CONTENT_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_TABLE; public static final String CONTENT_ITEM_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_TABLE; //Table name public static final String TABLE_NAME = "articles"; //Column containing the category id public static final String COLUMN_CATEGORY = "category"; //Column containing the article title public static final String COLUMN_TITLE = "title"; //Column containing the article author public static final String COLUMN_AUTHOR = "author"; //Column containing the image URL public static final String COLUMN_URL = "url"; public static Uri buildArticleUri(long id) { return ContentUris.withAppendedId(CONTENT_URI, id); } public static Uri buildArticleWithID(int id) { return CONTENT_URI.buildUpon(). appendQueryParameter(ArticlesEntry._ID, Integer.toString(id)).build(); } public static Uri buildArticleList() { Log.v("buildArticleList", "building table path"); return CONTENT_URI.buildUpon().appendPath(PATH_TABLE).build(); } } }
2,118
0.667611
0.66525
63
32.603176
31.113483
106
false
false
0
0
0
0
0
0
0.380952
false
false
13
2b9dea926ce8a54257456a73c2d4e74c8266d9c7
8,796,093,034,345
3b964f0688c57ee25998853080b590170142505f
/src/SystemInfo.java
7d84f795aaf1e68805424aa7b5a902bae9de21e1
[]
no_license
joeledwards/x-performance
https://github.com/joeledwards/x-performance
9d77fff4e5dbe568379b15383c79bc85643f53fc
06a8338ea30df74b29f8221348328adc65a1bd37
refs/heads/master
2016-09-05T14:00:59.396000
2015-01-23T20:50:05
2015-01-23T20:50:05
6,606,297
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.net.InetAddress; public class SystemInfo { public static void main(String[] args) throws Exception { System.out.println("localhost: " + InetAddress.getLocalHost()); System.out.println("loopback address: " + InetAddress.getLoopbackAddress()); System.out.println("temp directory: " + System.getenv("java.io.tmpdir")); } }
UTF-8
Java
342
java
SystemInfo.java
Java
[]
null
[]
import java.net.InetAddress; public class SystemInfo { public static void main(String[] args) throws Exception { System.out.println("localhost: " + InetAddress.getLocalHost()); System.out.println("loopback address: " + InetAddress.getLoopbackAddress()); System.out.println("temp directory: " + System.getenv("java.io.tmpdir")); } }
342
0.733918
0.733918
11
30.09091
30.796856
78
false
false
0
0
0
0
0
0
1.181818
false
false
13
3920cddbc94a7fe3a311cd1f9e04b9da68196d23
33,337,536,218,894
49566b65639f65edcd7b7a59e90ac053794da2b5
/Impulse-Daemon/src/main/java/net/impulse/daemon/ImpulseDaemon.java
838a56acdc25c361aa69bc5dcf4623510b7b3101
[]
no_license
pyreneyt/Impulse-Software
https://github.com/pyreneyt/Impulse-Software
1ff4b180b357fabf875b1b1f31a1f9a4a7f9a1be
f027fea1f49c32f22a6259b21438c3e416583cb7
refs/heads/master
2022-06-22T17:08:01.377000
2018-12-19T19:46:49
2018-12-19T19:46:49
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.impulse.daemon; import lombok.Getter; import net.impulse.daemon.commands.CommandClear; import net.impulse.daemon.commands.CommandHelp; import net.impulse.daemon.commands.CommandStop; import net.impulse.daemon.handler.TemplateHandler; import net.impulse.daemon.packets.PacketHandshake; import net.impulse.daemon.screen.ScreenHandler; import net.impulse.daemon.setup.ConfigService; import net.impulse.lib.ImpulseCloud; import net.impulse.lib.Version; import net.impulse.lib.command.CommandProvider; import net.impulse.lib.database.MongoConnection; import net.impulse.lib.logging.LoggingProvider; import net.impulse.lib.network.protocoll.ConnectableAdress; import net.impulse.lib.network.protocoll.ProtocollServer; import net.impulse.lib.network.protocoll.registry.PacketRegistry; import org.apache.log4j.Level; import java.io.IOException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; /** * @author Mike */ public class ImpulseDaemon implements ImpulseCloud{ /** * Instance of {@link LoggingProvider} */ @Getter private LoggingProvider loggingProvider; /** * Instance of {@link ImpulseCloud} */ public static ImpulseDaemon instance; /** * Create a new public {@link ExecutorService} instance */ @Getter private final ExecutorService executorService = Executors.newCachedThreadPool(); /** * Instance of {@link CommandProvider} */ @Getter private final CommandProvider commandProvider = new CommandProvider(); /** * Instance of {@link ScreenHandler} */ @Getter private final ScreenHandler screenHandler = new ScreenHandler(); /** * Instance of {@link ConfigService} */ @Getter private final ConfigService configService = new ConfigService(); /** * Instance of {@link Version} * TODO: Automatic version controller */ @Getter private final Version version = new Version( "0.1" ); /** * Instance of {@link MongoConnection} */ @Getter private final MongoConnection mongoConnection = new MongoConnection(); /** * Instance of {@link TemplateHandler} */ @Getter private final TemplateHandler templateHandler = new TemplateHandler(); /** * Instance of {@link net.impulse.lib.network.protocoll.IProtocollServer} */ private ProtocollServer protocollServer; /** * Service start logic */ public void start(){ instance = this; this.loggingProvider = new LoggingProvider(); this.loggingProvider.setPrority( Level.INFO ); this.loggingProvider.log( "_____ _______ _____ _ _ _______ _______ _______ _____ _ _ ______ " ); this.loggingProvider.log( " | | | | |_____] | | | |______ |______ | | | | | | | \\" ); this.loggingProvider.log( "__|__ | | | | |_____| |_____ ______| |______ |_____ |_____ |_____| |_____| |_____/" ); this.loggingProvider.log( String.format( " Version %s by ByteExceptionYT ", getVersion().getVersion() ) ); this.configService.createDefaultConfig(); registerCommands(); this.commandProvider.runTask( executorService ); try{ this.mongoConnection.connect( configService.getMongoDBHost(), configService.getMongoDBPort(), "cloud" ); } catch (IOException e){ e.printStackTrace(); } try{ this.protocollServer = new ProtocollServer( new ConnectableAdress( configService.getPort(), configService.getHost() ) ); } catch (Exception ex){ ex.printStackTrace(); } registerPackets(); this.templateHandler.loadTemplates(); this.protocollServer.bind( this.executorService, () -> { }, channel -> { } ); } /** * Register all packets for the server protocoll */ private void registerPackets(){ PacketRegistry.PacketDirection.OUT.addPacket( 0, PacketHandshake.class ); PacketRegistry.PacketDirection.IN.addPacket( 0, PacketHandshake.class ); } /** * Implements a new {@link net.impulse.lib.command.CommandExecutor} in the command system */ private void registerCommands(){ this.commandProvider.registerCommand( new CommandStop() ); this.commandProvider.registerCommand( new CommandHelp() ); this.commandProvider.registerCommand( new CommandClear() ); } /** * Service stop logic */ public void stop(){ loggingProvider.log( "Starting shutdown sequence" ); ImpulseDaemon.instance.getExecutorService().shutdownNow(); loggingProvider.log( "Stopped Impulse Daemon" ); System.exit( 0 ); } /** * Disable and load the methods again */ public void reload(){ ImpulseDaemon.instance.getExecutorService().shutdownNow(); start(); } }
UTF-8
Java
5,042
java
ImpulseDaemon.java
Java
[ { "context": "rt java.util.concurrent.Executors;\n\n/**\n * @author Mike\n */\npublic class ImpulseDaemon implements Impulse", "end": 955, "score": 0.9966336488723755, "start": 951, "tag": "NAME", "value": "Mike" } ]
null
[]
package net.impulse.daemon; import lombok.Getter; import net.impulse.daemon.commands.CommandClear; import net.impulse.daemon.commands.CommandHelp; import net.impulse.daemon.commands.CommandStop; import net.impulse.daemon.handler.TemplateHandler; import net.impulse.daemon.packets.PacketHandshake; import net.impulse.daemon.screen.ScreenHandler; import net.impulse.daemon.setup.ConfigService; import net.impulse.lib.ImpulseCloud; import net.impulse.lib.Version; import net.impulse.lib.command.CommandProvider; import net.impulse.lib.database.MongoConnection; import net.impulse.lib.logging.LoggingProvider; import net.impulse.lib.network.protocoll.ConnectableAdress; import net.impulse.lib.network.protocoll.ProtocollServer; import net.impulse.lib.network.protocoll.registry.PacketRegistry; import org.apache.log4j.Level; import java.io.IOException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; /** * @author Mike */ public class ImpulseDaemon implements ImpulseCloud{ /** * Instance of {@link LoggingProvider} */ @Getter private LoggingProvider loggingProvider; /** * Instance of {@link ImpulseCloud} */ public static ImpulseDaemon instance; /** * Create a new public {@link ExecutorService} instance */ @Getter private final ExecutorService executorService = Executors.newCachedThreadPool(); /** * Instance of {@link CommandProvider} */ @Getter private final CommandProvider commandProvider = new CommandProvider(); /** * Instance of {@link ScreenHandler} */ @Getter private final ScreenHandler screenHandler = new ScreenHandler(); /** * Instance of {@link ConfigService} */ @Getter private final ConfigService configService = new ConfigService(); /** * Instance of {@link Version} * TODO: Automatic version controller */ @Getter private final Version version = new Version( "0.1" ); /** * Instance of {@link MongoConnection} */ @Getter private final MongoConnection mongoConnection = new MongoConnection(); /** * Instance of {@link TemplateHandler} */ @Getter private final TemplateHandler templateHandler = new TemplateHandler(); /** * Instance of {@link net.impulse.lib.network.protocoll.IProtocollServer} */ private ProtocollServer protocollServer; /** * Service start logic */ public void start(){ instance = this; this.loggingProvider = new LoggingProvider(); this.loggingProvider.setPrority( Level.INFO ); this.loggingProvider.log( "_____ _______ _____ _ _ _______ _______ _______ _____ _ _ ______ " ); this.loggingProvider.log( " | | | | |_____] | | | |______ |______ | | | | | | | \\" ); this.loggingProvider.log( "__|__ | | | | |_____| |_____ ______| |______ |_____ |_____ |_____| |_____| |_____/" ); this.loggingProvider.log( String.format( " Version %s by ByteExceptionYT ", getVersion().getVersion() ) ); this.configService.createDefaultConfig(); registerCommands(); this.commandProvider.runTask( executorService ); try{ this.mongoConnection.connect( configService.getMongoDBHost(), configService.getMongoDBPort(), "cloud" ); } catch (IOException e){ e.printStackTrace(); } try{ this.protocollServer = new ProtocollServer( new ConnectableAdress( configService.getPort(), configService.getHost() ) ); } catch (Exception ex){ ex.printStackTrace(); } registerPackets(); this.templateHandler.loadTemplates(); this.protocollServer.bind( this.executorService, () -> { }, channel -> { } ); } /** * Register all packets for the server protocoll */ private void registerPackets(){ PacketRegistry.PacketDirection.OUT.addPacket( 0, PacketHandshake.class ); PacketRegistry.PacketDirection.IN.addPacket( 0, PacketHandshake.class ); } /** * Implements a new {@link net.impulse.lib.command.CommandExecutor} in the command system */ private void registerCommands(){ this.commandProvider.registerCommand( new CommandStop() ); this.commandProvider.registerCommand( new CommandHelp() ); this.commandProvider.registerCommand( new CommandClear() ); } /** * Service stop logic */ public void stop(){ loggingProvider.log( "Starting shutdown sequence" ); ImpulseDaemon.instance.getExecutorService().shutdownNow(); loggingProvider.log( "Stopped Impulse Daemon" ); System.exit( 0 ); } /** * Disable and load the methods again */ public void reload(){ ImpulseDaemon.instance.getExecutorService().shutdownNow(); start(); } }
5,042
0.626537
0.625347
172
28.313953
31.435154
165
false
false
0
0
0
0
0
0
0.587209
false
false
13
77262c7173064c73190e759189ee1a610cb307f7
8,615,704,397,971
8d72205e55758dfd85f694c5c9238098d0dfba65
/ViewDebugHelper/app/src/main/java/com/zanlabs/viewdebughelper/util/ClipManagerUtil.java
29ca964cb5391786f86533c9a8b61ddb2562a064
[]
no_license
waylife/DemoCollections
https://github.com/waylife/DemoCollections
2bc1c848f4b5885653eae938e2110175ddc75ced
13b59ccfebec48c4fe697508b2fc2926bd58e249
refs/heads/master
2021-01-10T02:14:44.190000
2017-12-16T12:26:23
2017-12-16T12:26:23
44,178,936
117
30
null
false
2015-10-28T15:53:28
2015-10-13T13:41:44
2015-10-25T04:37:20
2015-10-28T15:53:28
1,098
58
15
1
Java
null
null
package com.zanlabs.viewdebughelper.util; import android.content.Context; import android.text.ClipboardManager; /** * 剪切板类<br/> * * @author rxread */ public class ClipManagerUtil { /** * copy plain text to clip board<br/> * 复制文本到剪切板<br/> */ public static void copyToClipBoard(Context context, CharSequence text) { ClipboardManager clipboardManager = (ClipboardManager) context .getSystemService(Context.CLIPBOARD_SERVICE); clipboardManager.setText(text); } }
UTF-8
Java
507
java
ClipManagerUtil.java
Java
[ { "context": "ClipboardManager;\n\n/**\n * 剪切板类<br/>\n * \n * @author rxread\n */\npublic class ClipManagerUtil {\n\t/**\n\t * copy ", "end": 152, "score": 0.999573290348053, "start": 146, "tag": "USERNAME", "value": "rxread" } ]
null
[]
package com.zanlabs.viewdebughelper.util; import android.content.Context; import android.text.ClipboardManager; /** * 剪切板类<br/> * * @author rxread */ public class ClipManagerUtil { /** * copy plain text to clip board<br/> * 复制文本到剪切板<br/> */ public static void copyToClipBoard(Context context, CharSequence text) { ClipboardManager clipboardManager = (ClipboardManager) context .getSystemService(Context.CLIPBOARD_SERVICE); clipboardManager.setText(text); } }
507
0.741201
0.741201
21
22
21.703632
73
false
false
0
0
0
0
0
0
0.952381
false
false
13
3204ece030dfad40fcdb6def7ddae0a2ec11a53c
549,755,877,931
7d3563f52a7c1c98460c38a0e9390a350970c34f
/src/glazedlists/TrackTableFormat.java
913d298e964c1e551e2bfdad0eafbe13becbcaa6
[]
no_license
swanzai/ColourPlayer
https://github.com/swanzai/ColourPlayer
80655d2329a0c93828161bd060eec87f07c05010
a7411f3ec2f710764d467dba12e5f4e000c78295
refs/heads/master
2020-04-17T07:36:14.247000
2011-03-17T00:54:24
2011-03-17T00:54:24
1,489,722
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* Copyright (C) 2006 Michael Voong This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package glazedlists; import glazedlists.comparators.ColourComparator; import glazedlists.comparators.IntegerComparator; import glazedlists.comparators.StringComparator; import helpers.StringUtilities; import java.util.Comparator; import models.Track; import ca.odell.glazedlists.gui.AdvancedTableFormat; public class TrackTableFormat implements AdvancedTableFormat { public Class getColumnClass(int col) { if (col == 0) { return BlankStringColour.class; } if (col == 2) return Integer.class; else return Object.class; } public Comparator getColumnComparator(int col) { if (col == 2) return new IntegerComparator(); else if (col == 0) return new ColourComparator(); return new StringComparator(); } String[] cols = { "", "Name", "Track #", "Artist", "Album", "Duration", "Location" }; public int getColumnCount() { return cols.length; } public String getColumnName(int arg0) { return cols[arg0]; } public Object getColumnValue(Object obj, int col) { Track track = (Track) obj; switch (col) { case 0: return new BlankStringColour(track.getColour()); case 1: return track.getTitle(); case 2: return new Integer(track.getTrackNo()); case 3: return track.getArtist(); case 4: return track.getAlbum(); case 5: return StringUtilities.msToString(track.getDuration()); case 6: return track.getPath(); } return ""; } }
UTF-8
Java
2,401
java
TrackTableFormat.java
Java
[ { "context": "/* Copyright (C) 2006 Michael Voong\n\n This program is free software; you can redistri", "end": 35, "score": 0.9997733235359192, "start": 22, "tag": "NAME", "value": "Michael Voong" } ]
null
[]
/* Copyright (C) 2006 <NAME> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package glazedlists; import glazedlists.comparators.ColourComparator; import glazedlists.comparators.IntegerComparator; import glazedlists.comparators.StringComparator; import helpers.StringUtilities; import java.util.Comparator; import models.Track; import ca.odell.glazedlists.gui.AdvancedTableFormat; public class TrackTableFormat implements AdvancedTableFormat { public Class getColumnClass(int col) { if (col == 0) { return BlankStringColour.class; } if (col == 2) return Integer.class; else return Object.class; } public Comparator getColumnComparator(int col) { if (col == 2) return new IntegerComparator(); else if (col == 0) return new ColourComparator(); return new StringComparator(); } String[] cols = { "", "Name", "Track #", "Artist", "Album", "Duration", "Location" }; public int getColumnCount() { return cols.length; } public String getColumnName(int arg0) { return cols[arg0]; } public Object getColumnValue(Object obj, int col) { Track track = (Track) obj; switch (col) { case 0: return new BlankStringColour(track.getColour()); case 1: return track.getTitle(); case 2: return new Integer(track.getTrackNo()); case 3: return track.getArtist(); case 4: return track.getAlbum(); case 5: return StringUtilities.msToString(track.getDuration()); case 6: return track.getPath(); } return ""; } }
2,394
0.653061
0.640983
80
29.025
23.414192
89
false
false
0
0
0
0
0
0
0.575
false
false
13
b39773596154cb2d05e9ebb49f996e1c955d8584
549,755,880,361
cce30f0635f2a128e081c5ed629f50c27dbb1af0
/extendo-brain/src/test/java/net/fortytwo/extendo/brain/BrainGraphTest.java
31aebe3813d60501f76b512b3c1acedc2f3997be
[ "MIT" ]
permissive
XixiLuo/extendo
https://github.com/XixiLuo/extendo
69ffcaa42a686d66aaf6214012e634b26685c988
40c67ab5bcb06bcd1280e1d0d775eb6e668b9c9d
refs/heads/master
2020-12-25T23:36:12.601000
2015-05-28T18:11:37
2015-05-28T18:11:37
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.fortytwo.extendo.brain; import com.tinkerpop.blueprints.impls.neo4j.Neo4jGraph; import junit.framework.TestCase; import org.junit.After; import org.junit.Before; import org.junit.Test; import java.io.File; import java.util.Collection; /** * @author Joshua Shinavier (http://fortytwo.net) */ public class BrainGraphTest extends TestCase { private Neo4jGraph g; private BrainGraph bg; @Before public void setUp() throws Exception { File dir = File.createTempFile("extendo", "test"); dir.delete(); dir.mkdir(); dir.deleteOnExit(); g = new Neo4jGraph(dir.getPath()); bg = new BrainGraph(g); } @After public void tearDown() throws Exception { g.shutdown(); } @Test public void testGetAtoms() throws Exception { Filter f = new Filter(); Atom chaos = bg.createAtom(f, null); chaos.setValue("Chaos"); Atom tartarus = bg.createAtom(f, null); tartarus.setValue("Tartarus"); Atom gaia = bg.createAtom(f, null); gaia.setValue("Gaia"); Atom eros = bg.createAtom(f, null); eros.setValue("Eros"); Atom nyx = bg.createAtom(f, null); nyx.setValue("Nyx"); Atom erebus = bg.createAtom(f, null); erebus.setValue("Erebus"); AtomList children = bg.createAtomList(tartarus, gaia, eros, nyx, erebus); chaos.setNotes(children); // getAtoms returns a list of only atom vertices, excluding list vertices int count = 0; Iterable<Atom> atoms = bg.getAtoms(); for (Atom a : atoms) { count++; System.out.println(a.getValue()); } assertEquals(6, count); } @Test public void testFulltextSearch() throws Exception { Filter f = new Filter(); Atom a = bg.createAtom(f, null); a.setValue("Arthur Dent"); bg.indexForSearch(a, a.getValue()); //a.setValue("Arthur"); Collection<Atom> result; // Partial searches don't work result = bg.getAtomsByFulltextQuery("Arthur", f); assertEquals(0, result.size()); // Currently no ability to search on multiple keywords result = bg.getAtomsByFulltextQuery("Arthur Dent", f); assertEquals(0, result.size()); // Wildcards are supported result = bg.getAtomsByFulltextQuery("Arthur*", f); assertEquals(1, result.size()); assertEquals(a.asVertex().getId(), result.iterator().next().asVertex().getId()); // Search is case-insensitive result = bg.getAtomsByFulltextQuery("arthur*", f); assertEquals(1, result.size()); // Exact matches in quotes result = bg.getAtomsByFulltextQuery("\"Arthur Dent\"", f); assertEquals(1, result.size()); assertEquals(a.asVertex().getId(), result.iterator().next().asVertex().getId()); } @Test public void testAcronymSearch() throws Exception { Filter f = new Filter(); Atom a = bg.createAtom(f, null); a.setValue("Arthur\tP. Dent "); Atom t = bg.createAtom(f, null); t.setValue("Arthur's moth-eaten towel"); Atom l = bg.createAtom(f, null); l.setValue("ooooooooo0ooooooooo1ooooooooo2ooooooooo3ooooooooo4ooooooooo5ooooooooo6ooooooooo7" + "ooooooooo8ooooooooo9oooooooooAoooooooooBoooooooooCoooooooooDoooooooooEoooooooooF"); bg.indexForSearch(a, a.getValue()); bg.indexForSearch(t, t.getValue()); bg.indexForSearch(l, l.getValue()); Collection<Atom> result; // oops. This is not a full-text query. result = bg.getAtomsByAcronymQuery("Arthur*", f); assertEquals(0, result.size()); // l has not been indexed because its value is too long result = bg.getAtomsByAcronymQuery("o", f); assertEquals(0, result.size()); // exact acronym match // capitalization, punctuation, and idiosyncrasies of white space are ignored result = bg.getAtomsByAcronymQuery("apd", f); assertEquals(1, result.size()); assertEquals(a.asVertex().getId(), result.iterator().next().asVertex().getId()); // hyphens and underscores are treated as white space, while apostrophes and other punctuation are ignored result = bg.getAtomsByAcronymQuery("amet", f); assertEquals(1, result.size()); assertEquals(t.asVertex().getId(), result.iterator().next().asVertex().getId()); // acronym prefix match result = bg.getAtomsByAcronymQuery("ap*", f); assertEquals(1, result.size()); assertEquals(a.asVertex().getId(), result.iterator().next().asVertex().getId()); // acronym search is also case insensitive result = bg.getAtomsByAcronymQuery("AP*", f); assertEquals(1, result.size()); assertEquals(a.asVertex().getId(), result.iterator().next().asVertex().getId()); } }
UTF-8
Java
4,982
java
BrainGraphTest.java
Java
[ { "context": "File;\nimport java.util.Collection;\n\n/**\n * @author Joshua Shinavier (http://fortytwo.net)\n */\npublic class BrainGraph", "end": 281, "score": 0.9998621940612793, "start": 265, "tag": "NAME", "value": "Joshua Shinavier" }, { "context": "m a = bg.createAtom(f, null);\n a.setValue(\"Arthur Dent\");\n bg.indexForSearch(a, a.getValue());\n ", "end": 1913, "score": 0.9991607666015625, "start": 1902, "tag": "NAME", "value": "Arthur Dent" }, { "context": "ForSearch(a, a.getValue());\n //a.setValue(\"Arthur\");\n\n Collection<Atom> result;\n\n // ", "end": 1989, "score": 0.9970254302024841, "start": 1983, "tag": "NAME", "value": "Arthur" }, { "context": "work\n result = bg.getAtomsByFulltextQuery(\"Arthur\", f);\n assertEquals(0, result.size());\n\n ", "end": 2118, "score": 0.9782902598381042, "start": 2112, "tag": "NAME", "value": "Arthur" }, { "context": "ords\n result = bg.getAtomsByFulltextQuery(\"Arthur Dent\", f);\n assertEquals(0, result.size());\n\n ", "end": 2285, "score": 0.9986530542373657, "start": 2274, "tag": "NAME", "value": "Arthur Dent" }, { "context": "rted\n result = bg.getAtomsByFulltextQuery(\"Arthur*\", f);\n assertEquals(1, result.size());\n ", "end": 2419, "score": 0.8035432696342468, "start": 2413, "tag": "NAME", "value": "Arthur" }, { "context": "es\n result = bg.getAtomsByFulltextQuery(\"\\\"Arthur Dent\\\"\", f);\n assertEquals(1, result.size());\n ", "end": 2788, "score": 0.9964892268180847, "start": 2777, "tag": "NAME", "value": "Arthur Dent" }, { "context": "m a = bg.createAtom(f, null);\n a.setValue(\"Arthur\\tP. Dent \");\n Atom t = bg.createAtom(f, n", "end": 3099, "score": 0.9919072985649109, "start": 3093, "tag": "NAME", "value": "Arthur" }, { "context": ".createAtom(f, null);\n a.setValue(\"Arthur\\tP. Dent \");\n Atom t = bg.createAtom(f, null", "end": 3102, "score": 0.5063808560371399, "start": 3101, "tag": "NAME", "value": "P" }, { "context": "eateAtom(f, null);\n a.setValue(\"Arthur\\tP. Dent \");\n Atom t = bg.createAtom(f, null);\n ", "end": 3109, "score": 0.9788869619369507, "start": 3105, "tag": "NAME", "value": "Dent" }, { "context": "m t = bg.createAtom(f, null);\n t.setValue(\"Arthur's moth-eaten towel\");\n Atom l = bg.createAto", "end": 3183, "score": 0.9518839120864868, "start": 3175, "tag": "NAME", "value": "Arthur's" }, { "context": " null);\n t.setValue(\"Arthur's moth-eaten towel\");\n Atom l = bg.createAtom(f, null);\n ", "end": 3200, "score": 0.6881933212280273, "start": 3197, "tag": "NAME", "value": "wel" } ]
null
[]
package net.fortytwo.extendo.brain; import com.tinkerpop.blueprints.impls.neo4j.Neo4jGraph; import junit.framework.TestCase; import org.junit.After; import org.junit.Before; import org.junit.Test; import java.io.File; import java.util.Collection; /** * @author <NAME> (http://fortytwo.net) */ public class BrainGraphTest extends TestCase { private Neo4jGraph g; private BrainGraph bg; @Before public void setUp() throws Exception { File dir = File.createTempFile("extendo", "test"); dir.delete(); dir.mkdir(); dir.deleteOnExit(); g = new Neo4jGraph(dir.getPath()); bg = new BrainGraph(g); } @After public void tearDown() throws Exception { g.shutdown(); } @Test public void testGetAtoms() throws Exception { Filter f = new Filter(); Atom chaos = bg.createAtom(f, null); chaos.setValue("Chaos"); Atom tartarus = bg.createAtom(f, null); tartarus.setValue("Tartarus"); Atom gaia = bg.createAtom(f, null); gaia.setValue("Gaia"); Atom eros = bg.createAtom(f, null); eros.setValue("Eros"); Atom nyx = bg.createAtom(f, null); nyx.setValue("Nyx"); Atom erebus = bg.createAtom(f, null); erebus.setValue("Erebus"); AtomList children = bg.createAtomList(tartarus, gaia, eros, nyx, erebus); chaos.setNotes(children); // getAtoms returns a list of only atom vertices, excluding list vertices int count = 0; Iterable<Atom> atoms = bg.getAtoms(); for (Atom a : atoms) { count++; System.out.println(a.getValue()); } assertEquals(6, count); } @Test public void testFulltextSearch() throws Exception { Filter f = new Filter(); Atom a = bg.createAtom(f, null); a.setValue("<NAME>"); bg.indexForSearch(a, a.getValue()); //a.setValue("Arthur"); Collection<Atom> result; // Partial searches don't work result = bg.getAtomsByFulltextQuery("Arthur", f); assertEquals(0, result.size()); // Currently no ability to search on multiple keywords result = bg.getAtomsByFulltextQuery("<NAME>", f); assertEquals(0, result.size()); // Wildcards are supported result = bg.getAtomsByFulltextQuery("Arthur*", f); assertEquals(1, result.size()); assertEquals(a.asVertex().getId(), result.iterator().next().asVertex().getId()); // Search is case-insensitive result = bg.getAtomsByFulltextQuery("arthur*", f); assertEquals(1, result.size()); // Exact matches in quotes result = bg.getAtomsByFulltextQuery("\"<NAME>\"", f); assertEquals(1, result.size()); assertEquals(a.asVertex().getId(), result.iterator().next().asVertex().getId()); } @Test public void testAcronymSearch() throws Exception { Filter f = new Filter(); Atom a = bg.createAtom(f, null); a.setValue("Arthur\tP. Dent "); Atom t = bg.createAtom(f, null); t.setValue("Arthur's moth-eaten towel"); Atom l = bg.createAtom(f, null); l.setValue("ooooooooo0ooooooooo1ooooooooo2ooooooooo3ooooooooo4ooooooooo5ooooooooo6ooooooooo7" + "ooooooooo8ooooooooo9oooooooooAoooooooooBoooooooooCoooooooooDoooooooooEoooooooooF"); bg.indexForSearch(a, a.getValue()); bg.indexForSearch(t, t.getValue()); bg.indexForSearch(l, l.getValue()); Collection<Atom> result; // oops. This is not a full-text query. result = bg.getAtomsByAcronymQuery("Arthur*", f); assertEquals(0, result.size()); // l has not been indexed because its value is too long result = bg.getAtomsByAcronymQuery("o", f); assertEquals(0, result.size()); // exact acronym match // capitalization, punctuation, and idiosyncrasies of white space are ignored result = bg.getAtomsByAcronymQuery("apd", f); assertEquals(1, result.size()); assertEquals(a.asVertex().getId(), result.iterator().next().asVertex().getId()); // hyphens and underscores are treated as white space, while apostrophes and other punctuation are ignored result = bg.getAtomsByAcronymQuery("amet", f); assertEquals(1, result.size()); assertEquals(t.asVertex().getId(), result.iterator().next().asVertex().getId()); // acronym prefix match result = bg.getAtomsByAcronymQuery("ap*", f); assertEquals(1, result.size()); assertEquals(a.asVertex().getId(), result.iterator().next().asVertex().getId()); // acronym search is also case insensitive result = bg.getAtomsByAcronymQuery("AP*", f); assertEquals(1, result.size()); assertEquals(a.asVertex().getId(), result.iterator().next().asVertex().getId()); } }
4,957
0.620434
0.615014
147
32.891155
25.878084
114
false
false
0
0
0
0
80
0.032116
0.911565
false
false
13
8ddc1e25e139be400753b4c6ae2b597f1333ab51
32,968,168,990,358
d1184296bf1ceda5f669de12511eb325a4d1f0a7
/src/main/java/com/fb/springbootdemo/test/factorybean/FruitFactoryBean.java
d2155b5e993ac3647dfd75ead7d514712f30ee0a
[]
no_license
dalong03/spring-boot-demo
https://github.com/dalong03/spring-boot-demo
9a6a48cc95f87cbdbe377ebd2db2d778add0ec12
41671eea64f5e2f805187dcc00ee58ebe7898181
refs/heads/master
2022-02-16T00:41:36.742000
2022-02-10T06:58:17
2022-02-10T06:58:17
242,263,916
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.fb.springbootdemo.test.factorybean; import org.springframework.beans.factory.FactoryBean; import org.springframework.stereotype.Component; @Component public class FruitFactoryBean implements FactoryBean<Fruit> { @Override public Fruit getObject() throws Exception { Fruit fruit = new Fruit(); fruit.setColor("red"); fruit.setName("apple"); return fruit; } @Override public Class<?> getObjectType() { return Fruit.class; } @Override public boolean isSingleton() { return true; } }
UTF-8
Java
544
java
FruitFactoryBean.java
Java
[]
null
[]
package com.fb.springbootdemo.test.factorybean; import org.springframework.beans.factory.FactoryBean; import org.springframework.stereotype.Component; @Component public class FruitFactoryBean implements FactoryBean<Fruit> { @Override public Fruit getObject() throws Exception { Fruit fruit = new Fruit(); fruit.setColor("red"); fruit.setName("apple"); return fruit; } @Override public Class<?> getObjectType() { return Fruit.class; } @Override public boolean isSingleton() { return true; } }
544
0.713235
0.713235
26
18.923077
18.652538
61
false
false
0
0
0
0
0
0
1.153846
false
false
13
ac10f242b881cf5588fff70f3bb2ea904515b209
15,925,738,760,428
7801a71aae1f0426983b030105570b480b21a2f0
/Box/app/src/main/java/com/box/util/OnDataCallback.java
18314003c3e9af3ca9d1bc63da8f01a04cd924a5
[]
no_license
JoinQ/MyBox
https://github.com/JoinQ/MyBox
4fc97765318caccbfd84454b2141014c646fa90f
32b1ea5ebac2781709778208637256570089a327
refs/heads/master
2021-01-10T21:23:06.589000
2015-06-07T03:00:53
2015-06-07T03:00:53
34,741,444
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.box.util; public interface OnDataCallback<T> { void callback(T... list); void error(String info); }
UTF-8
Java
121
java
OnDataCallback.java
Java
[]
null
[]
package com.box.util; public interface OnDataCallback<T> { void callback(T... list); void error(String info); }
121
0.68595
0.68595
6
19.166666
13.897442
36
false
false
0
0
0
0
0
0
0.5
false
false
13
0f07077f2dabaa2bed7ac7a0240bf010ccf52b91
15,367,393,004,293
b3b27fb977adf2603c05580105bda039e4700d5c
/src/main/java/io/configrd/core/source/FileConfigSource.java
aae36ac3dfe6c69aa5e185c895c68136130f5cd3
[ "Apache-2.0" ]
permissive
configrd/configrd-core
https://github.com/configrd/configrd-core
e8258d96b88bad203e74457c7cfbc76e273f37d1
ea5f39dfb4b757964b9ef5db16776dab59ec9586
refs/heads/master
2022-06-21T09:51:31.376000
2022-06-08T02:57:14
2022-06-08T02:57:14
152,803,913
0
0
NOASSERTION
false
2019-02-13T06:00:55
2018-10-12T20:24:04
2019-01-23T06:40:44
2019-02-13T06:00:55
152
0
0
0
Java
false
null
package io.configrd.core.source; import java.util.Optional; public interface FileConfigSource { /** * Get file per path * * @param path * @return */ public Optional<StreamPacket> getFile(String path); }
UTF-8
Java
227
java
FileConfigSource.java
Java
[]
null
[]
package io.configrd.core.source; import java.util.Optional; public interface FileConfigSource { /** * Get file per path * * @param path * @return */ public Optional<StreamPacket> getFile(String path); }
227
0.669604
0.669604
15
14.133333
15.700814
53
false
false
0
0
0
0
0
0
0.2
false
false
13
e67fc82304f275b4de115793cbc88640d62fa775
5,196,910,455,962
1b8f4772a750049be6d7d282e783622673293f65
/inheritance/inheridemo3.java
d2ff884983be361a4327dbad57b33449ec7991ff
[]
no_license
dnjsgud0625/javastudy
https://github.com/dnjsgud0625/javastudy
e934ae0491bf444933e76059f5c38a70fc6e9cb6
4558795c973fac4b10253c1c7417d0bf042ca5a8
refs/heads/main
2023-04-08T17:42:53.072000
2021-04-02T13:02:32
2021-04-02T13:02:32
337,727,612
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package inheritance; class DivCal extends MultiCal { public void division() { System.out.println(this.left/this.right); } } public class inheridemo3 { public static void main(String[] args) { DivCal c1 = new DivCal(); c1.setop(20, 10); c1.sum(); c1.avg(); c1.multiple(); c1.division(); } }
UTF-8
Java
310
java
inheridemo3.java
Java
[]
null
[]
package inheritance; class DivCal extends MultiCal { public void division() { System.out.println(this.left/this.right); } } public class inheridemo3 { public static void main(String[] args) { DivCal c1 = new DivCal(); c1.setop(20, 10); c1.sum(); c1.avg(); c1.multiple(); c1.division(); } }
310
0.66129
0.625806
18
16.222221
13.558743
43
false
false
0
0
0
0
0
0
1.5
false
false
13
e57f9162e4a7f2afcee336373d90fa50cf5ca9c0
17,008,070,524,548
5f99f3e089a0f908f96b1dbf4facadc5aa592232
/src/br/com/gam/selecionaromaneio/dao/TerminalDao.java
8c2c5e5b01fcd1a49f075df795f2e36fa5171054
[ "Apache-2.0" ]
permissive
paulocesarml/SelecionaRomaneio
https://github.com/paulocesarml/SelecionaRomaneio
7c2c30fa01053423482a24bcd10b2ab934484aeb
66f307b350650265da7067edba10ecfac776c607
refs/heads/master
2021-01-22T10:32:08.251000
2017-02-21T03:34:46
2017-02-21T03:34:46
82,007,444
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.gam.selecionaromaneio.dao; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; import java.util.List; import br.com.gam.selecionaromaneio.entity.Empresa; import br.com.gam.selecionaromaneio.entity.Terminal; public class TerminalDao { private static TerminalDao terminalDao; private TerminalDao(){} public static TerminalDao getInstance(){ if (terminalDao == null){ terminalDao = new TerminalDao(); } return terminalDao; } public List<Terminal> buscarListaTerminal(Connection conn, Empresa empresa) throws Exception{ PreparedStatement ps = null; ResultSet rs = null; List<Terminal> listaTerminal = new ArrayList<Terminal>(); StringBuilder sql = new StringBuilder(); sql.append("select "); sql.append(" cd_rom_terminal cdRomTerminal, "); sql.append(" nr_caixa_fila_separacao nrCaixaFilaSeparacao "); sql.append("from "); sql.append(" paulocesar.dc_rom_terminal "); sql.append("where "); sql.append(" cd_empresa = ? "); try{ ps=conn.prepareStatement(sql.toString()); ps.setInt(1, empresa.getCodigo()); rs=ps.executeQuery(); while (rs.next()){ Terminal terminal = new Terminal(); terminal.setCodigo(rs.getInt("cdRomTerminal")); terminal.setQantidadeMaxBuffer(rs.getInt("nrCaixaFilaSeparacao")); listaTerminal.add(terminal); } return listaTerminal; }catch(Exception e){ throw new Exception(e); } } }
UTF-8
Java
1,492
java
TerminalDao.java
Java
[]
null
[]
package br.com.gam.selecionaromaneio.dao; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; import java.util.List; import br.com.gam.selecionaromaneio.entity.Empresa; import br.com.gam.selecionaromaneio.entity.Terminal; public class TerminalDao { private static TerminalDao terminalDao; private TerminalDao(){} public static TerminalDao getInstance(){ if (terminalDao == null){ terminalDao = new TerminalDao(); } return terminalDao; } public List<Terminal> buscarListaTerminal(Connection conn, Empresa empresa) throws Exception{ PreparedStatement ps = null; ResultSet rs = null; List<Terminal> listaTerminal = new ArrayList<Terminal>(); StringBuilder sql = new StringBuilder(); sql.append("select "); sql.append(" cd_rom_terminal cdRomTerminal, "); sql.append(" nr_caixa_fila_separacao nrCaixaFilaSeparacao "); sql.append("from "); sql.append(" paulocesar.dc_rom_terminal "); sql.append("where "); sql.append(" cd_empresa = ? "); try{ ps=conn.prepareStatement(sql.toString()); ps.setInt(1, empresa.getCodigo()); rs=ps.executeQuery(); while (rs.next()){ Terminal terminal = new Terminal(); terminal.setCodigo(rs.getInt("cdRomTerminal")); terminal.setQantidadeMaxBuffer(rs.getInt("nrCaixaFilaSeparacao")); listaTerminal.add(terminal); } return listaTerminal; }catch(Exception e){ throw new Exception(e); } } }
1,492
0.713807
0.713137
55
26.127274
19.730967
76
false
false
0
0
0
0
0
0
2.345454
false
false
13
1f49c961eba2b54743dc5afc4a29aa4e4e2af18e
19,937,238,212,069
6b187d41b7d877fb7c3b63642253ae8e5a33dda5
/src/main/java/com/itdom/publish/subscribe/fanout/Send.java
de0fe4bc73b5f61aa45d1c0e0e0b36620d8690b1
[]
no_license
chenanddom/RabbitmqLearning
https://github.com/chenanddom/RabbitmqLearning
13972bee02e4c3d12c21bb942b446fb0f859facc
cfbbc1a50f0bc062ca9ffa72f07083df2cb70fcc
refs/heads/master
2023-05-08T14:36:12.233000
2021-06-02T08:16:29
2021-06-02T08:16:29
372,433,788
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.itdom.publish.subscribe.fanout; import com.itdom.utils.ConnectionUtil; import com.rabbitmq.client.BuiltinExchangeType; import com.rabbitmq.client.Channel; import com.rabbitmq.client.Connection; import java.io.IOException; import java.util.concurrent.TimeoutException; /** * 一个消费者将消息首先发生到交换器,交换器绑定到多个队列, * 然后被监听该队列的消费者锁接收并消费 * * 如果使用fanout模式发送消息,如果发送一条消息,那么多个监听绑定该交换器的队列的消费者将获取到同样的消息 * 如果没有队列绑定交换机,则消息将会丢失,因为交换机没有能力当存储器,消息只能存储在队列当中。 */ public class Send { private static final String EXCHANGE_NAME="MqName.exchange_fanout".toString(); public static void main(String[] args) throws IOException, TimeoutException { //创建连接 Connection connection = ConnectionUtil.getConnection(); //创建通道 Channel channel = connection.createChannel(); //声明交换器 channel.exchangeDeclare(EXCHANGE_NAME, BuiltinExchangeType.FANOUT); //发送消息 String msg = "hello exchange"; System.out.println("[mq] send: "+msg); channel.basicPublish(EXCHANGE_NAME,"",null,msg.getBytes()); channel.close(); connection.close(); } }
UTF-8
Java
1,426
java
Send.java
Java
[]
null
[]
package com.itdom.publish.subscribe.fanout; import com.itdom.utils.ConnectionUtil; import com.rabbitmq.client.BuiltinExchangeType; import com.rabbitmq.client.Channel; import com.rabbitmq.client.Connection; import java.io.IOException; import java.util.concurrent.TimeoutException; /** * 一个消费者将消息首先发生到交换器,交换器绑定到多个队列, * 然后被监听该队列的消费者锁接收并消费 * * 如果使用fanout模式发送消息,如果发送一条消息,那么多个监听绑定该交换器的队列的消费者将获取到同样的消息 * 如果没有队列绑定交换机,则消息将会丢失,因为交换机没有能力当存储器,消息只能存储在队列当中。 */ public class Send { private static final String EXCHANGE_NAME="MqName.exchange_fanout".toString(); public static void main(String[] args) throws IOException, TimeoutException { //创建连接 Connection connection = ConnectionUtil.getConnection(); //创建通道 Channel channel = connection.createChannel(); //声明交换器 channel.exchangeDeclare(EXCHANGE_NAME, BuiltinExchangeType.FANOUT); //发送消息 String msg = "hello exchange"; System.out.println("[mq] send: "+msg); channel.basicPublish(EXCHANGE_NAME,"",null,msg.getBytes()); channel.close(); connection.close(); } }
1,426
0.717626
0.717626
35
30.771429
24.553249
82
false
false
0
0
0
0
0
0
0.6
false
false
13
02bcaffa7e3a4cff1a45c79a69d63bcc32fb5588
19,937,238,211,535
749f7af12cf43f916af9469b36a87c959652e14d
/src/es/upm/dit/gsi/LoginServlet.java
9dc34d9cb535723c0e2f952fb79ab1447b929952
[]
no_license
Lorena25/prueba-01
https://github.com/Lorena25/prueba-01
3ad6fcb239de43c911f1d2709cd2825dbb48df07
bd3c5d2e2c0b3628ea693779f0ca62bf035cc265
refs/heads/master
2021-01-10T16:58:09.930000
2015-12-30T22:41:47
2015-12-30T22:41:47
48,821,675
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package es.upm.dit.gsi; import java.awt.List; import java.io.IOException; import java.util.ArrayList; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; //import es.upm.dit.gsi.vo.VOLogin; /** * Servlet implementation class LoginServlet */ // con esto se definde un servlet pero //vamos a definirlo en web.xml @WebServlet("/LoginServlet") public class LoginServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * Default constructor. */ public LoginServlet() { // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub //response.getWriter().append("Served at: ").append(request.getContextPath()); doPost(request,response); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub //doGet(request, response); String usuario = request.getParameter("usuario"); String password = request.getParameter("password"); System.out.println("Usuario:" +usuario); System.out.println("Password:" +password); if((usuario.equals("Lorena")) && (password.equals("Sancho"))){ System.out.println("welcome..."); //VOLogin vo = new VOLogin(); //vo.setUsuario(usuario); //vo.setPassword(password); //vo.setEdad(21); //vo.setNombre("Lorena Sancho"); //HttpSession session = request.getSession(true); //List<VOLogin> lista= new ArrayList<VOLogin>(); request.setAttribute("usuariologueado", usuario+ " " +password); //session.setAttribute("listaUsuario", lista); request.getRequestDispatcher("Welcome.jsp").forward(request, response); }else{ System.out.println("error de credenciales de acceso..."); response.sendRedirect(""); } } }
UTF-8
Java
2,298
java
LoginServlet.java
Java
[ { "context": "(\"Password:\" +password);\n\t\t\n\t\tif((usuario.equals(\"Lorena\")) && (password.equals(\"Sancho\"))){\n\t\t\t\tSystem.ou", "end": 1651, "score": 0.9973068833351135, "start": 1645, "tag": "USERNAME", "value": "Lorena" }, { "context": "f((usuario.equals(\"Lorena\")) && (password.equals(\"Sancho\"))){\n\t\t\t\tSystem.out.println(\"welcome...\");\n\t\t\t\t//", "end": 1682, "score": 0.9939996600151062, "start": 1676, "tag": "PASSWORD", "value": "Sancho" }, { "context": "\t\t\t//vo.setUsuario(usuario);\n\t\t\t\t//vo.setPassword(password);\n\t\t\t\t//vo.setEdad(21);\n\t\t\t\t//vo.setNombre(\"Loren", "end": 1819, "score": 0.9774851202964783, "start": 1811, "tag": "PASSWORD", "value": "password" }, { "context": "word);\n\t\t\t\t//vo.setEdad(21);\n\t\t\t\t//vo.setNombre(\"Lorena Sancho\");\n\t\t\t\t//HttpSession session = request.get", "end": 1870, "score": 0.6676149368286133, "start": 1865, "tag": "NAME", "value": "orena" }, { "context": "\t\t//vo.setEdad(21);\n\t\t\t\t//vo.setNombre(\"Lorena Sancho\");\n\t\t\t\t//HttpSession session = request.getSession", "end": 1877, "score": 0.723743200302124, "start": 1874, "tag": "NAME", "value": "cho" }, { "context": "List<VOLogin>();\n\t\t\t\trequest.setAttribute(\"usuariologueado\", usuario+ \" \" +password);\n\t\t\t\t//session.setAttri", "end": 2029, "score": 0.7316961288452148, "start": 2021, "tag": "USERNAME", "value": "logueado" } ]
null
[]
package es.upm.dit.gsi; import java.awt.List; import java.io.IOException; import java.util.ArrayList; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; //import es.upm.dit.gsi.vo.VOLogin; /** * Servlet implementation class LoginServlet */ // con esto se definde un servlet pero //vamos a definirlo en web.xml @WebServlet("/LoginServlet") public class LoginServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * Default constructor. */ public LoginServlet() { // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub //response.getWriter().append("Served at: ").append(request.getContextPath()); doPost(request,response); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub //doGet(request, response); String usuario = request.getParameter("usuario"); String password = request.getParameter("password"); System.out.println("Usuario:" +usuario); System.out.println("Password:" +password); if((usuario.equals("Lorena")) && (password.equals("<PASSWORD>"))){ System.out.println("welcome..."); //VOLogin vo = new VOLogin(); //vo.setUsuario(usuario); //vo.setPassword(<PASSWORD>); //vo.setEdad(21); //vo.setNombre("Lorena Sancho"); //HttpSession session = request.getSession(true); //List<VOLogin> lista= new ArrayList<VOLogin>(); request.setAttribute("usuariologueado", usuario+ " " +password); //session.setAttribute("listaUsuario", lista); request.getRequestDispatcher("Welcome.jsp").forward(request, response); }else{ System.out.println("error de credenciales de acceso..."); response.sendRedirect(""); } } }
2,304
0.72846
0.727154
70
31.799999
27.671337
119
false
false
0
0
0
0
0
0
1.914286
false
false
13
fa936f9f6e4570d8d96a44330927963bc9c1a21e
9,947,144,290,122
d207f1c4cd2640ae6d5586d966a1414e04054462
/app/src/main/java/com/example/emran/MyViewHolder.java
aa38333d0fbdc121fa3df7760dd68404983ed297
[]
no_license
aisjac/SandhaniBMCollege-Blood-Donor-Club
https://github.com/aisjac/SandhaniBMCollege-Blood-Donor-Club
3edf874af5718fe06cf077dd1085b76e4e6c2a7a
a36c363ea544bb90ee2f0601bf6c8606e75cc723
refs/heads/master
2023-03-18T01:00:16.975000
2021-03-19T16:11:32
2021-03-19T16:11:32
349,482,098
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.emran; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.cardview.widget.CardView; import androidx.recyclerview.widget.RecyclerView; import de.hdodenhof.circleimageview.CircleImageView; public class MyViewHolder extends RecyclerView.ViewHolder { ImageView imageView; TextView session,name,phone,dept,desig,desigType,msN,blood,lastDonate; CardView cardView; public MyViewHolder(@NonNull View itemView) { super(itemView); cardView = itemView.findViewById(R.id.cardViewId); imageView = itemView.findViewById(R.id.imageViewId); session = itemView.findViewById(R.id.sessionTextViewId); name = itemView.findViewById(R.id.nameTextViewId); phone = itemView.findViewById(R.id.phoneTextViewId); dept = itemView.findViewById(R.id.departmentTextViewId); desig = itemView.findViewById(R.id.desigTextViewId); desigType = itemView.findViewById(R.id.desigTypeTextViewId); msN = itemView.findViewById(R.id.msNumberTextViewId); blood = itemView.findViewById(R.id.bloodgroupTextViewId); lastDonate = itemView.findViewById(R.id.lastDonationTextViewId); } }
UTF-8
Java
1,306
java
MyViewHolder.java
Java
[]
null
[]
package com.example.emran; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.cardview.widget.CardView; import androidx.recyclerview.widget.RecyclerView; import de.hdodenhof.circleimageview.CircleImageView; public class MyViewHolder extends RecyclerView.ViewHolder { ImageView imageView; TextView session,name,phone,dept,desig,desigType,msN,blood,lastDonate; CardView cardView; public MyViewHolder(@NonNull View itemView) { super(itemView); cardView = itemView.findViewById(R.id.cardViewId); imageView = itemView.findViewById(R.id.imageViewId); session = itemView.findViewById(R.id.sessionTextViewId); name = itemView.findViewById(R.id.nameTextViewId); phone = itemView.findViewById(R.id.phoneTextViewId); dept = itemView.findViewById(R.id.departmentTextViewId); desig = itemView.findViewById(R.id.desigTextViewId); desigType = itemView.findViewById(R.id.desigTypeTextViewId); msN = itemView.findViewById(R.id.msNumberTextViewId); blood = itemView.findViewById(R.id.bloodgroupTextViewId); lastDonate = itemView.findViewById(R.id.lastDonationTextViewId); } }
1,306
0.750383
0.750383
38
33.36842
26.318316
74
false
false
0
0
0
0
0
0
0.842105
false
false
13
7d4722e4c3d58196636741cdc5661290b79d1c1d
9,947,144,287,822
4ed13753f5bc20ec143dc25039280f80c3edddd8
/gosu-core-api/src/main/java/gw/lang/reflect/IShadowingType.java
a5448dd8d61855953171c0d4864fbc997dc139ff
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "BSD-3-Clause" ]
permissive
hmsck/gosu-lang
https://github.com/hmsck/gosu-lang
180a96aab69ff0184700e70876bb0cf10c8a938f
78c5f6c839597a81ac5ec75a46259cbb6ad40545
refs/heads/master
2021-02-13T06:53:30.208000
2019-10-31T23:15:13
2019-10-31T23:15:13
244,672,021
0
0
Apache-2.0
true
2020-03-03T15:27:47
2020-03-03T15:27:46
2020-02-22T21:52:06
2020-02-27T16:27:28
17,481
0
0
0
null
false
false
/* * Copyright 2014 Guidewire Software, Inc. */ package gw.lang.reflect; import java.util.List; public interface IShadowingType { List<IType> getShadowedTypes(); }
UTF-8
Java
173
java
IShadowingType.java
Java
[ { "context": "/*\n * Copyright 2014 Guidewire Software, Inc.\n */\n\npackage gw.lang.reflect;\n\nimport java.", "end": 39, "score": 0.8887035846710205, "start": 21, "tag": "NAME", "value": "Guidewire Software" } ]
null
[]
/* * Copyright 2014 <NAME>, Inc. */ package gw.lang.reflect; import java.util.List; public interface IShadowingType { List<IType> getShadowedTypes(); }
161
0.722543
0.699422
13
12.307693
15.309045
42
false
false
0
0
0
0
0
0
0.307692
false
false
13
65296f15bb8675c0705591c8c3ed4cf39fa3fa21
695,784,736,707
671a5011859c157dd71007ab3031fa4837e5cb02
/app/src/main/java/com/ezerka/pingo/issues/IIssues.java
8b5d1bb86377b96a02158a65047d5d1cd4cf20c8
[]
no_license
Ezerka/Pingo
https://github.com/Ezerka/Pingo
0d69dd40e7630c5bdf2dc949fe621be06c971313
ca0aa9c15dc52a6da8ba4e08bb39b883c0c6c020
refs/heads/master
2018-09-30T14:58:45.217000
2018-06-26T16:56:28
2018-06-26T16:56:28
136,327,269
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ezerka.pingo.issues; import com.ezerka.pingo.model.Issue; import com.ezerka.pingo.model.Project; import java.util.ArrayList; /** * Created by User on 4/16/2018. */ public interface IIssues { void showProgressBar(); void hideProgressBar(); void buildSnackbar(String message); void getProjects(); void deleteIssuesFromProject(ArrayList<Issue> issues, Project project); }
UTF-8
Java
403
java
IIssues.java
Java
[]
null
[]
package com.ezerka.pingo.issues; import com.ezerka.pingo.model.Issue; import com.ezerka.pingo.model.Project; import java.util.ArrayList; /** * Created by User on 4/16/2018. */ public interface IIssues { void showProgressBar(); void hideProgressBar(); void buildSnackbar(String message); void getProjects(); void deleteIssuesFromProject(ArrayList<Issue> issues, Project project); }
403
0.744417
0.727047
24
15.791667
18.94725
73
false
false
0
0
0
0
0
0
0.416667
false
false
13
f7fbdc37a655536db174d8068d67291c69036c8e
28,003,186,798,104
d3fc16c80c87a0437774adc77388c642f291861b
/src/main/java/com/stackroute/pe2/EvenCheck.java
76e35e747aa2fae7af63e035f597dde1eb29a7eb
[]
no_license
ShankarPushkar/pe2-testcases
https://github.com/ShankarPushkar/pe2-testcases
735a7b1712efefba2928366391815a8b40c4eab5
3e0e2136d91972c6476152b63a3fe70302a5631c
refs/heads/master
2020-06-20T12:31:26.470000
2019-07-17T04:03:27
2019-07-17T04:03:27
197,123,151
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.stackroute.pe2; public class EvenCheck { public static boolean isEven(int number) { if(number%2==0){ return true;//if the number is even it returns true } else{ return false;//if the number is odd it returns false } } }
UTF-8
Java
305
java
EvenCheck.java
Java
[]
null
[]
package com.stackroute.pe2; public class EvenCheck { public static boolean isEven(int number) { if(number%2==0){ return true;//if the number is even it returns true } else{ return false;//if the number is odd it returns false } } }
305
0.563934
0.554098
14
20.642857
21.509491
64
false
false
0
0
0
0
0
0
0.214286
false
false
13
273766fdf847a021d2fbdc6e389a2bb3b15c0ef1
2,499,670,977,957
985cbe27bc8ab537091b5f582ca52aa368ba9bf5
/app/src/main/java/com/example/aplikasimoviecatalogue4/Adapter/FavoriteMovieAdapter.java
d590ce4d3add79914f66e1efce533f6ae271fcb1
[]
no_license
ariefadi/Submission4MADE
https://github.com/ariefadi/Submission4MADE
08cff7a028759c1610f9aca428bb8d8854a7a951
05f45346fb5763a6206290c7cc5ff75772a38943
refs/heads/master
2021-01-01T00:04:52.198000
2020-02-13T18:58:01
2020-02-13T18:58:01
239,088,984
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.aplikasimoviecatalogue4.Adapter; import android.content.Context; import android.content.Intent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.bumptech.glide.Glide; import com.example.aplikasimoviecatalogue4.CustomOnItemClickListener; import com.example.aplikasimoviecatalogue4.Database.QueryHelper; import com.example.aplikasimoviecatalogue4.DetailFavoriteMovieActivity; import com.example.aplikasimoviecatalogue4.DetailMoviesActivity; import com.example.aplikasimoviecatalogue4.Model.MoviesItems; import com.example.aplikasimoviecatalogue4.R; import java.util.ArrayList; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; public class FavoriteMovieAdapter extends RecyclerView.Adapter<FavoriteMovieAdapter.CardViewViewHolder> { private ArrayList<MoviesItems> listMovies = new ArrayList<>(); private Context context; public FavoriteMovieAdapter(Context context){ this.context = context; } public ArrayList<MoviesItems>getListMovies(){ return listMovies; } public void setListMovies(ArrayList<MoviesItems> listMovies){ if (listMovies.size() > 0) { this.listMovies.clear(); } this.listMovies.addAll(listMovies); notifyDataSetChanged(); } public void addItem(MoviesItems moviesItems) { this.listMovies.add(moviesItems); notifyItemInserted(listMovies.size() - 1); } public void removeItem(int position) { this.listMovies.remove(position); notifyItemRemoved(position); notifyItemRangeChanged(position,listMovies.size()); } @NonNull @Override public FavoriteMovieAdapter.CardViewViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.favorite_movie_item, parent, false); FavoriteMovieAdapter.CardViewViewHolder viewHolder = new FavoriteMovieAdapter.CardViewViewHolder(view); return viewHolder; } @Override public void onBindViewHolder(@NonNull final FavoriteMovieAdapter.CardViewViewHolder holder, int position) { final MoviesItems moviesItems = getListMovies().get(position); Glide.with(context) .load("https://image.tmdb.org/t/p/w300/"+moviesItems.getPoster_path()) .override(350, 350) .into(holder.imgMovies); holder.tvTitle.setText(moviesItems.getTitle()); holder.tvOverview.setText(moviesItems.getOverview()); holder.tvReleaseDate.setText(moviesItems.getRelease_date()); holder.btnDetail.setOnClickListener(new CustomOnItemClickListener(position, new CustomOnItemClickListener.OnItemClickCallback() { @Override public void onItemClicked(View view, int position) { MoviesItems movies = new MoviesItems(); movies.setId(getListMovies().get(position).getId()); movies.setTitle(getListMovies().get(position).getTitle()); movies.setOverview(getListMovies().get(position).getOverview()); movies.setRelease_date(getListMovies().get(position).getRelease_date()); movies.setPopularity(getListMovies().get(position).getPopularity()); movies.setVote_average(getListMovies().get(position).getVote_average()); movies.setVote_count(getListMovies().get(position).getVote_count()); movies.setPoster(getListMovies().get(position).getPoster()); movies.setOriginal_language(getListMovies().get(position).getOriginal_language()); movies.setOriginal_title(getListMovies().get(position).getOriginal_title()); movies.setPoster_path(getListMovies().get(position).getPoster_path()); Intent intent = new Intent(context, DetailFavoriteMovieActivity.class); intent.putExtra(DetailFavoriteMovieActivity.EXTRA_MOVIES, movies); context.startActivity(intent); } })); holder.btnDelete.setOnClickListener(new CustomOnItemClickListener(position, new CustomOnItemClickListener.OnItemClickCallback() { @Override public void onItemClicked(View view, int position) { holder.queryHelper.deleteById(moviesItems.getId()); Toast.makeText(context, R.string.data_berhasil_dihapus, Toast.LENGTH_SHORT).show(); removeItem(position); } })); } @Override public int getItemCount() { if (listMovies == null) return 0; return getListMovies().size(); } class CardViewViewHolder extends RecyclerView.ViewHolder{ ImageView imgMovies; TextView tvTitle, tvOverview, tvReleaseDate; Button btnDetail,btnDelete; QueryHelper queryHelper; CardViewViewHolder(View itemView){ super(itemView); imgMovies = (ImageView)itemView.findViewById(R.id.img_movies); tvTitle = (TextView)itemView.findViewById(R.id.tv_title); tvOverview = (TextView)itemView.findViewById(R.id.tv_overview); tvReleaseDate = (TextView)itemView.findViewById(R.id.tv_release_date); btnDetail = (Button)itemView.findViewById(R.id.btn_set_detail); btnDelete = (Button)itemView.findViewById(R.id.btn_set_hapus); queryHelper = QueryHelper.getInstance(context); queryHelper.open(); } } }
UTF-8
Java
5,701
java
FavoriteMovieAdapter.java
Java
[]
null
[]
package com.example.aplikasimoviecatalogue4.Adapter; import android.content.Context; import android.content.Intent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.bumptech.glide.Glide; import com.example.aplikasimoviecatalogue4.CustomOnItemClickListener; import com.example.aplikasimoviecatalogue4.Database.QueryHelper; import com.example.aplikasimoviecatalogue4.DetailFavoriteMovieActivity; import com.example.aplikasimoviecatalogue4.DetailMoviesActivity; import com.example.aplikasimoviecatalogue4.Model.MoviesItems; import com.example.aplikasimoviecatalogue4.R; import java.util.ArrayList; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; public class FavoriteMovieAdapter extends RecyclerView.Adapter<FavoriteMovieAdapter.CardViewViewHolder> { private ArrayList<MoviesItems> listMovies = new ArrayList<>(); private Context context; public FavoriteMovieAdapter(Context context){ this.context = context; } public ArrayList<MoviesItems>getListMovies(){ return listMovies; } public void setListMovies(ArrayList<MoviesItems> listMovies){ if (listMovies.size() > 0) { this.listMovies.clear(); } this.listMovies.addAll(listMovies); notifyDataSetChanged(); } public void addItem(MoviesItems moviesItems) { this.listMovies.add(moviesItems); notifyItemInserted(listMovies.size() - 1); } public void removeItem(int position) { this.listMovies.remove(position); notifyItemRemoved(position); notifyItemRangeChanged(position,listMovies.size()); } @NonNull @Override public FavoriteMovieAdapter.CardViewViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.favorite_movie_item, parent, false); FavoriteMovieAdapter.CardViewViewHolder viewHolder = new FavoriteMovieAdapter.CardViewViewHolder(view); return viewHolder; } @Override public void onBindViewHolder(@NonNull final FavoriteMovieAdapter.CardViewViewHolder holder, int position) { final MoviesItems moviesItems = getListMovies().get(position); Glide.with(context) .load("https://image.tmdb.org/t/p/w300/"+moviesItems.getPoster_path()) .override(350, 350) .into(holder.imgMovies); holder.tvTitle.setText(moviesItems.getTitle()); holder.tvOverview.setText(moviesItems.getOverview()); holder.tvReleaseDate.setText(moviesItems.getRelease_date()); holder.btnDetail.setOnClickListener(new CustomOnItemClickListener(position, new CustomOnItemClickListener.OnItemClickCallback() { @Override public void onItemClicked(View view, int position) { MoviesItems movies = new MoviesItems(); movies.setId(getListMovies().get(position).getId()); movies.setTitle(getListMovies().get(position).getTitle()); movies.setOverview(getListMovies().get(position).getOverview()); movies.setRelease_date(getListMovies().get(position).getRelease_date()); movies.setPopularity(getListMovies().get(position).getPopularity()); movies.setVote_average(getListMovies().get(position).getVote_average()); movies.setVote_count(getListMovies().get(position).getVote_count()); movies.setPoster(getListMovies().get(position).getPoster()); movies.setOriginal_language(getListMovies().get(position).getOriginal_language()); movies.setOriginal_title(getListMovies().get(position).getOriginal_title()); movies.setPoster_path(getListMovies().get(position).getPoster_path()); Intent intent = new Intent(context, DetailFavoriteMovieActivity.class); intent.putExtra(DetailFavoriteMovieActivity.EXTRA_MOVIES, movies); context.startActivity(intent); } })); holder.btnDelete.setOnClickListener(new CustomOnItemClickListener(position, new CustomOnItemClickListener.OnItemClickCallback() { @Override public void onItemClicked(View view, int position) { holder.queryHelper.deleteById(moviesItems.getId()); Toast.makeText(context, R.string.data_berhasil_dihapus, Toast.LENGTH_SHORT).show(); removeItem(position); } })); } @Override public int getItemCount() { if (listMovies == null) return 0; return getListMovies().size(); } class CardViewViewHolder extends RecyclerView.ViewHolder{ ImageView imgMovies; TextView tvTitle, tvOverview, tvReleaseDate; Button btnDetail,btnDelete; QueryHelper queryHelper; CardViewViewHolder(View itemView){ super(itemView); imgMovies = (ImageView)itemView.findViewById(R.id.img_movies); tvTitle = (TextView)itemView.findViewById(R.id.tv_title); tvOverview = (TextView)itemView.findViewById(R.id.tv_overview); tvReleaseDate = (TextView)itemView.findViewById(R.id.tv_release_date); btnDetail = (Button)itemView.findViewById(R.id.btn_set_detail); btnDelete = (Button)itemView.findViewById(R.id.btn_set_hapus); queryHelper = QueryHelper.getInstance(context); queryHelper.open(); } } }
5,701
0.691984
0.688651
134
41.544777
33.335388
137
false
false
0
0
0
0
0
0
0.686567
false
false
13
f64c099767eced6268a14d3443f1c6dbdb67f9e2
2,250,562,895,887
c2248f23389ba41814bccaf55f4201faa247abc3
/src/yxy/tom/yang/CustomizedLinkedList.java
39dedf0c295d665b62cc1e2ec9cf4ea2a91dd565
[]
no_license
TomYang1993/java-master-lessons
https://github.com/TomYang1993/java-master-lessons
10ed851ba7a68789893262ddd06356cc78eb0e51
89bd7e754105a2229b3ac71cc23e511c85e1bd5c
refs/heads/master
2023-06-05T14:53:06.976000
2021-06-24T00:33:54
2021-06-24T00:33:54
379,762,006
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package yxy.tom.yang; public class CustomizedLinkedList { }
UTF-8
Java
62
java
CustomizedLinkedList.java
Java
[]
null
[]
package yxy.tom.yang; public class CustomizedLinkedList { }
62
0.774194
0.774194
5
11.4
14.26324
35
false
false
0
0
0
0
0
0
0.2
false
false
13
2b83f78971db6056d3317c9e69145cbd400cca48
8,203,387,583,875
4bf814d9a1a57d94d0fa255eedc6272a9411ef96
/src/main/java/net/ehicks/advent/year2015/Day08Matchsticks.java
0394763cf5dc2803c236663d976f32d551897915
[]
no_license
ehicks05-kata/adventofcode
https://github.com/ehicks05-kata/adventofcode
26775430216ebe7884779d1422d011519204493b
b41a0ffc8bb7900215d358302e56c8ab3e5c900b
refs/heads/master
2022-12-23T15:59:09.586000
2022-12-12T22:58:57
2022-12-12T22:58:57
92,616,371
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.ehicks.advent.year2015; import java.nio.file.Files; import java.nio.file.Paths; import java.util.*; public class Day08Matchsticks { public static void main(String[] args) throws Exception { int totalCodeLength = 0; int totalInMemoryLength = 0; List<String> instructions = Files.readAllLines(Paths.get("src/main/resources/year2015/advent08.txt")); for (String instruction : instructions) { totalCodeLength += instruction.length(); String raw = instruction.substring(1, instruction.length() - 1); outer: while (raw.contains("\\\\") || raw.contains("\\\"") || raw.contains("\\x")) { if (raw.contains("\\\\")) { int index = raw.indexOf("\\\\"); raw = raw.substring(0, index) + "\\" + raw.substring(index + 2); } if (raw.contains("\\\"")) { int index = raw.indexOf("\\\""); raw = raw.substring(0, index) + "\"" + raw.substring(index + 2); } int fromIndex = 0; int count = 0; while (raw.contains("\\x")) { int index = raw.indexOf("\\x", fromIndex); if (index + 4 <= raw.length()) { String code = raw.substring(index + 2, index + 4); Integer myInt = null; try { myInt = Integer.parseInt(code, 16); } catch (Exception e) { } if (myInt != null) { String newChar = Character.toString((char) myInt.intValue()); raw = raw.substring(0, index) + newChar + raw.substring(index + 4); } else { fromIndex = index + 1; } } if (count > 5) break outer; count++; } } System.out.println(/*instruction.raw + " -> " +*/ raw + " (" + raw.length() + ")"); totalInMemoryLength += raw.length(); } System.out.println("code length: " + totalCodeLength); System.out.println("in memory length: " + totalInMemoryLength); System.out.println("code length - in memory length " + (totalCodeLength - totalInMemoryLength)); } }
UTF-8
Java
2,737
java
Day08Matchsticks.java
Java
[]
null
[]
package net.ehicks.advent.year2015; import java.nio.file.Files; import java.nio.file.Paths; import java.util.*; public class Day08Matchsticks { public static void main(String[] args) throws Exception { int totalCodeLength = 0; int totalInMemoryLength = 0; List<String> instructions = Files.readAllLines(Paths.get("src/main/resources/year2015/advent08.txt")); for (String instruction : instructions) { totalCodeLength += instruction.length(); String raw = instruction.substring(1, instruction.length() - 1); outer: while (raw.contains("\\\\") || raw.contains("\\\"") || raw.contains("\\x")) { if (raw.contains("\\\\")) { int index = raw.indexOf("\\\\"); raw = raw.substring(0, index) + "\\" + raw.substring(index + 2); } if (raw.contains("\\\"")) { int index = raw.indexOf("\\\""); raw = raw.substring(0, index) + "\"" + raw.substring(index + 2); } int fromIndex = 0; int count = 0; while (raw.contains("\\x")) { int index = raw.indexOf("\\x", fromIndex); if (index + 4 <= raw.length()) { String code = raw.substring(index + 2, index + 4); Integer myInt = null; try { myInt = Integer.parseInt(code, 16); } catch (Exception e) { } if (myInt != null) { String newChar = Character.toString((char) myInt.intValue()); raw = raw.substring(0, index) + newChar + raw.substring(index + 4); } else { fromIndex = index + 1; } } if (count > 5) break outer; count++; } } System.out.println(/*instruction.raw + " -> " +*/ raw + " (" + raw.length() + ")"); totalInMemoryLength += raw.length(); } System.out.println("code length: " + totalCodeLength); System.out.println("in memory length: " + totalInMemoryLength); System.out.println("code length - in memory length " + (totalCodeLength - totalInMemoryLength)); } }
2,737
0.415784
0.404457
76
35.013157
27.816359
110
false
false
0
0
0
0
0
0
0.526316
false
false
13
be96572692000fff1740aeccec1afc32ccad6a90
28,132,035,799,382
ce33cfbf0bcaae8047b3338564b3240467cc75a0
/approvaltests-util/src/main/java/com/spun/util/logger/SimpleLogger.java
888482741c9484ffc72c1e1113639f491d4ab04e
[ "Apache-2.0" ]
permissive
rzabini/ApprovalTests.Java
https://github.com/rzabini/ApprovalTests.Java
714c3d23387b8c20ee41d74b0e37d4bad35ce922
32aa5a150bd34d78d0bca935442f729af418c39c
refs/heads/master
2021-12-02T09:22:06.134000
2021-09-11T13:35:45
2021-09-11T13:35:45
177,326,806
0
0
Apache-2.0
true
2021-08-14T17:41:48
2019-03-23T18:38:17
2021-08-14T17:41:28
2021-08-14T17:41:47
20,313
0
0
2
Java
false
false
package com.spun.util.logger; public class SimpleLogger { private static final SimpleLoggerInstance log = new SimpleLoggerInstance(1); public static void toggleAll(boolean t) { log.toggleAll(t); } public static void setHourGlassWrap(int numberOfDots) { log.setHourGlassWrap(numberOfDots); } public static void hourGlass() { log.hourGlass(); } @Deprecated //use useMarkers public static void markerIn(String statement) { log.markerIn(statement); } @Deprecated //use useMarkers public synchronized static void markerOut(String text) { log.markerOut(text); } public synchronized static void query(String sqlQuery) { log.query(sqlQuery); } /** * Prints to screen any variable information to be viewed. **/ public synchronized static void query(String queryName, Object sqlQuery) { log.query(queryName, sqlQuery); } public static void variableFormated(String string, Object... parameters) { log.variableFormated(string, parameters); } public synchronized static void variable(String statement) { log.variable(statement); } /** * Prints to screen any variable information to be viewed. **/ public synchronized static void variable(String name, Object value) { log.variable(name, value); } public synchronized static void variable(String name, Object array[]) { log.variable(name, array); } public synchronized static <T> void variable(T array[]) { log.variable(array); } public synchronized static void message(String Statement) { log.message(Statement); } public static void event(String Statement) { log.event(Statement); } public synchronized static void warning(String statement) { log.warning(statement); } public synchronized static void warning(Throwable throwable) { log.warning(throwable); } public synchronized static void warning(String statement, Throwable throwable) { log.warning(statement, throwable); } /** * Logs the current memory status [total, used, free]. * This forces garbage collection to run first. **/ public static void logMemoryStatus() { log.logMemoryStatus(); } /** * {@code * try (Markers m = SimpleLogger.useMarkers();) * { * } * } */ public static Markers useMarkers() { return log.useMarkers(); } public static StringBuffer logToString() { return log.logToString(); } public static Appendable logToNothing() { return logTo(new NullLogger()); } public static void useOutputFile(String file, boolean addDateStamp) { log.useOutputFile(file, addDateStamp); } public static Appendable logTo(Appendable writer) { log.logTo(writer); return writer; } public static Appendable getLogTo() { return log.getLogTo(); } public static SimpleLoggerInstance get() { return log; } }
UTF-8
Java
2,906
java
SimpleLogger.java
Java
[]
null
[]
package com.spun.util.logger; public class SimpleLogger { private static final SimpleLoggerInstance log = new SimpleLoggerInstance(1); public static void toggleAll(boolean t) { log.toggleAll(t); } public static void setHourGlassWrap(int numberOfDots) { log.setHourGlassWrap(numberOfDots); } public static void hourGlass() { log.hourGlass(); } @Deprecated //use useMarkers public static void markerIn(String statement) { log.markerIn(statement); } @Deprecated //use useMarkers public synchronized static void markerOut(String text) { log.markerOut(text); } public synchronized static void query(String sqlQuery) { log.query(sqlQuery); } /** * Prints to screen any variable information to be viewed. **/ public synchronized static void query(String queryName, Object sqlQuery) { log.query(queryName, sqlQuery); } public static void variableFormated(String string, Object... parameters) { log.variableFormated(string, parameters); } public synchronized static void variable(String statement) { log.variable(statement); } /** * Prints to screen any variable information to be viewed. **/ public synchronized static void variable(String name, Object value) { log.variable(name, value); } public synchronized static void variable(String name, Object array[]) { log.variable(name, array); } public synchronized static <T> void variable(T array[]) { log.variable(array); } public synchronized static void message(String Statement) { log.message(Statement); } public static void event(String Statement) { log.event(Statement); } public synchronized static void warning(String statement) { log.warning(statement); } public synchronized static void warning(Throwable throwable) { log.warning(throwable); } public synchronized static void warning(String statement, Throwable throwable) { log.warning(statement, throwable); } /** * Logs the current memory status [total, used, free]. * This forces garbage collection to run first. **/ public static void logMemoryStatus() { log.logMemoryStatus(); } /** * {@code * try (Markers m = SimpleLogger.useMarkers();) * { * } * } */ public static Markers useMarkers() { return log.useMarkers(); } public static StringBuffer logToString() { return log.logToString(); } public static Appendable logToNothing() { return logTo(new NullLogger()); } public static void useOutputFile(String file, boolean addDateStamp) { log.useOutputFile(file, addDateStamp); } public static Appendable logTo(Appendable writer) { log.logTo(writer); return writer; } public static Appendable getLogTo() { return log.getLogTo(); } public static SimpleLoggerInstance get() { return log; } }
2,906
0.686167
0.685822
128
21.703125
22.359756
80
false
false
0
0
0
0
0
0
0.335938
false
false
13
513549169051ffc8bc7b42f709bd30ed5b3a64b4
32,298,154,076,780
215b964a840a0098d1fd144cc47e8f745dac07d4
/src/com/src/service/LoginController.java
924332deb72ec288f927bb3737024be9e1011bce
[]
no_license
sumit16c9409/Hotel_Management_System
https://github.com/sumit16c9409/Hotel_Management_System
5317e9ee36d297f8765f7fdba1af60bc77a1e614
d45aa7a3413c73d1b43af4ed946649d50fcde1a6
refs/heads/master
2022-06-24T17:55:44.242000
2019-08-03T10:52:45
2019-08-03T10:52:45
200,363,814
0
0
null
false
2022-06-21T01:35:48
2019-08-03T10:44:04
2019-08-03T10:52:48
2022-06-21T01:35:44
1,014
0
0
3
Java
false
false
package com.src.service; import java.io.IOException; import java.util.ArrayList; import java.util.Map; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.src.dao.GenericDao; import com.src.bean.*; /** * Servlet implementation class myServlet */ public class LoginController extends HttpServlet { private static final long serialVersionUID = 1L; GenericDao gDao = new GenericDao(); /** * @see HttpServlet#HttpServlet() */ public LoginController() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub String locationParam=""; if(request.getParameter("destination")!=null && request.getParameter("destination")!="") { try { GenericDao gDao = new GenericDao(); consumeService service = new consumeService(); String destination = request.getParameter("destination"); Map<String, ArrayList<String>> hotelDetails = gDao.getHotelDetails(destination); // Enable code for Bhavya shukla Map<String, ArrayList<String>> foody = service.getFoody(destination); request.setAttribute("foody", foody); request.setAttribute("message", hotelDetails); request.getRequestDispatcher("/hotel_listing.jsp").forward(request, response); } catch (Exception e) { e.printStackTrace(); } } else if (request.getParameter("bookNow")!=null && request.getParameter("bookNow")!="") { locationParam = request.getParameter("bookNow"); System.out.println("locationParam -"+locationParam); request.setAttribute("tableEntry", "notConfirmed"); request.getRequestDispatcher("/hotel_book.jsp").forward(request, response); } else if (request.getParameter("locationParam")!=null && request.getParameter("locationParam")!="") { locationParam = request.getParameter("locationParam"); System.out.println("locationParam -"+locationParam); String words[] = locationParam.split(","); request.setAttribute("latitude", words[0]); request.setAttribute("longitude", words[1]); request.getRequestDispatcher("/view_location.jsp").forward(request, response); } else if (request.getParameter("saveBooking")!=null && request.getParameter("saveBooking")!="") { BookingDetails bean = new BookingDetails(); GenericDao gDao = new GenericDao(); bean.setFirstName(request.getParameter("firstName")); bean.setLastName(request.getParameter("lastName")); bean.setEmail(request.getParameter("email")); bean.setPhoneNumber(request.getParameter("phoneNumber")); bean.setMode_of_commute(request.getParameter("mode_of_commute")); bean.setFromDate(request.getParameter("fromDate")); bean.setToDate(request.getParameter("toDate")); bean.setReasonForVisit(request.getParameter("reasonForVisit")); if(gDao.saveEntry(bean)) { // send email request.setAttribute("tableEntry", "confirmed"); request.getRequestDispatcher("/hotel_book.jsp").forward(request, response); System.out.println("Got confirmation"); } else { request.setAttribute("tableEntry", "notConfirmed"); request.getRequestDispatcher("/hotel_book.jsp").forward(request, response); System.out.println("Redirected"); } } else { System.out.println("Please check the parameters you are passing from jsp"); System.out.println("locationParam -"+locationParam); } } }
UTF-8
Java
3,921
java
LoginController.java
Java
[]
null
[]
package com.src.service; import java.io.IOException; import java.util.ArrayList; import java.util.Map; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.src.dao.GenericDao; import com.src.bean.*; /** * Servlet implementation class myServlet */ public class LoginController extends HttpServlet { private static final long serialVersionUID = 1L; GenericDao gDao = new GenericDao(); /** * @see HttpServlet#HttpServlet() */ public LoginController() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub String locationParam=""; if(request.getParameter("destination")!=null && request.getParameter("destination")!="") { try { GenericDao gDao = new GenericDao(); consumeService service = new consumeService(); String destination = request.getParameter("destination"); Map<String, ArrayList<String>> hotelDetails = gDao.getHotelDetails(destination); // Enable code for Bhavya shukla Map<String, ArrayList<String>> foody = service.getFoody(destination); request.setAttribute("foody", foody); request.setAttribute("message", hotelDetails); request.getRequestDispatcher("/hotel_listing.jsp").forward(request, response); } catch (Exception e) { e.printStackTrace(); } } else if (request.getParameter("bookNow")!=null && request.getParameter("bookNow")!="") { locationParam = request.getParameter("bookNow"); System.out.println("locationParam -"+locationParam); request.setAttribute("tableEntry", "notConfirmed"); request.getRequestDispatcher("/hotel_book.jsp").forward(request, response); } else if (request.getParameter("locationParam")!=null && request.getParameter("locationParam")!="") { locationParam = request.getParameter("locationParam"); System.out.println("locationParam -"+locationParam); String words[] = locationParam.split(","); request.setAttribute("latitude", words[0]); request.setAttribute("longitude", words[1]); request.getRequestDispatcher("/view_location.jsp").forward(request, response); } else if (request.getParameter("saveBooking")!=null && request.getParameter("saveBooking")!="") { BookingDetails bean = new BookingDetails(); GenericDao gDao = new GenericDao(); bean.setFirstName(request.getParameter("firstName")); bean.setLastName(request.getParameter("lastName")); bean.setEmail(request.getParameter("email")); bean.setPhoneNumber(request.getParameter("phoneNumber")); bean.setMode_of_commute(request.getParameter("mode_of_commute")); bean.setFromDate(request.getParameter("fromDate")); bean.setToDate(request.getParameter("toDate")); bean.setReasonForVisit(request.getParameter("reasonForVisit")); if(gDao.saveEntry(bean)) { // send email request.setAttribute("tableEntry", "confirmed"); request.getRequestDispatcher("/hotel_book.jsp").forward(request, response); System.out.println("Got confirmation"); } else { request.setAttribute("tableEntry", "notConfirmed"); request.getRequestDispatcher("/hotel_book.jsp").forward(request, response); System.out.println("Redirected"); } } else { System.out.println("Please check the parameters you are passing from jsp"); System.out.println("locationParam -"+locationParam); } } }
3,921
0.728641
0.727876
96
39.84375
30.017122
119
false
false
0
0
0
0
0
0
2.59375
false
false
13
77acf16151dff0c0da2c83d477387cf5bd7215cb
32,641,751,469,392
12ec68d1e39864360788eba9ef5e1392c729b6ae
/dagger-core-web/src/main/java/com/springdagger/core/web/interceptor/SecureInterceptor.java
636226623c150e643a5d61f9481ea3a1398dca25
[]
no_license
qiaomu1102/dagger-tool
https://github.com/qiaomu1102/dagger-tool
60cb22ce41291004b38d16756422a2d92f567a83
07edc1861d67e92d68f9f85a59c46b7c8f869411
refs/heads/master
2023-03-11T13:17:16.019000
2021-02-26T08:47:38
2021-02-26T08:47:38
307,282,058
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.springdagger.core.web.interceptor; import com.springdagger.core.tool.api.ResultCode; import com.springdagger.core.tool.utils.ClassUtil; import com.springdagger.core.tool.utils.StringUtil; import com.springdagger.core.web.annotation.IgnoreUserToken; import com.springdagger.core.web.exception.SecureException; import com.springdagger.core.web.jwt.UserAuthUtil; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.web.method.HandlerMethod; import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.util.WebUtils; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * @package: com.qiaomu.common.aop * @author: kexiong * @date: 2020/4/10 18:37 * @Description: 鉴权 */ @Slf4j @Component public class SecureInterceptor implements HandlerInterceptor { private static final String SECURE_KEY = "token"; @Autowired private UserAuthUtil userAuthUtil; @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler){ if (handler instanceof HandlerMethod) { HandlerMethod handlerMethod = (HandlerMethod) handler; IgnoreUserToken annotation = ClassUtil.getAnnotation(handlerMethod, IgnoreUserToken.class); if (annotation != null) { return true; } } log.info("请求URI为{},验证token begin ============", request.getRequestURI()); String token = request.getHeader(SECURE_KEY); if (StringUtil.isBlank(token)) { Cookie cookie = WebUtils.getCookie(request, SECURE_KEY); if (cookie != null) { token = cookie.getValue(); } } if (StringUtil.isBlank(token)) { throw new SecureException(ResultCode.TOKEN_MISSING); } userAuthUtil.checkToken(token); return true; } @Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { } }
UTF-8
Java
2,309
java
SecureInterceptor.java
Java
[ { "context": "/**\n * @package: com.qiaomu.common.aop\n * @author: kexiong\n * @date: 2020/4/10 18:37\n * @Description: 鉴权\n */", "end": 918, "score": 0.9996960163116455, "start": 911, "tag": "USERNAME", "value": "kexiong" } ]
null
[]
package com.springdagger.core.web.interceptor; import com.springdagger.core.tool.api.ResultCode; import com.springdagger.core.tool.utils.ClassUtil; import com.springdagger.core.tool.utils.StringUtil; import com.springdagger.core.web.annotation.IgnoreUserToken; import com.springdagger.core.web.exception.SecureException; import com.springdagger.core.web.jwt.UserAuthUtil; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.web.method.HandlerMethod; import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.util.WebUtils; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * @package: com.qiaomu.common.aop * @author: kexiong * @date: 2020/4/10 18:37 * @Description: 鉴权 */ @Slf4j @Component public class SecureInterceptor implements HandlerInterceptor { private static final String SECURE_KEY = "token"; @Autowired private UserAuthUtil userAuthUtil; @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler){ if (handler instanceof HandlerMethod) { HandlerMethod handlerMethod = (HandlerMethod) handler; IgnoreUserToken annotation = ClassUtil.getAnnotation(handlerMethod, IgnoreUserToken.class); if (annotation != null) { return true; } } log.info("请求URI为{},验证token begin ============", request.getRequestURI()); String token = request.getHeader(SECURE_KEY); if (StringUtil.isBlank(token)) { Cookie cookie = WebUtils.getCookie(request, SECURE_KEY); if (cookie != null) { token = cookie.getValue(); } } if (StringUtil.isBlank(token)) { throw new SecureException(ResultCode.TOKEN_MISSING); } userAuthUtil.checkToken(token); return true; } @Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { } }
2,309
0.718273
0.712167
68
32.720589
29.4298
146
false
false
0
0
0
0
0
0
0.544118
false
false
13
b6d1f90dbc4bc105605a4df60f0e4094a525ec58
29,068,338,714,585
7c63ac57441e88640e9a519acc89a9937ad832af
/src/main/java/com/onestop/orderservice/controller/OrderController.java
ddab4593e86c43ca83cf9b9f01864accfa2e246b
[]
no_license
jaybhatta/Onestop
https://github.com/jaybhatta/Onestop
b31bae39c6f109e63373f9221817e11031525608
427d033e3c5a0f5777c2151a5653afd087c32c40
refs/heads/master
2023-08-07T01:47:42.191000
2021-09-13T16:48:32
2021-09-13T16:48:32
406,054,181
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.onestop.orderservice.controller; import org.springframework.beans.factory.annotation.Autowired; 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.RequestBody; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.onestop.orderservice.model.Order; import com.onestop.orderservice.service.OrderServiceService; @RestController public class OrderController { private OrderServiceService orderServiceService; @Autowired public OrderController(OrderServiceService orderServiceService) { this.orderServiceService = orderServiceService; } @GetMapping("/{id}") public Order getOrder(@PathVariable int id) { return orderServiceService.getOrderById(id); } @PostMapping("/order") public void saveOrder(@RequestBody Order order) { orderServiceService.saveOrder(order); } }
UTF-8
Java
1,096
java
OrderController.java
Java
[]
null
[]
package com.onestop.orderservice.controller; import org.springframework.beans.factory.annotation.Autowired; 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.RequestBody; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.onestop.orderservice.model.Order; import com.onestop.orderservice.service.OrderServiceService; @RestController public class OrderController { private OrderServiceService orderServiceService; @Autowired public OrderController(OrderServiceService orderServiceService) { this.orderServiceService = orderServiceService; } @GetMapping("/{id}") public Order getOrder(@PathVariable int id) { return orderServiceService.getOrderById(id); } @PostMapping("/order") public void saveOrder(@RequestBody Order order) { orderServiceService.saveOrder(order); } }
1,096
0.796533
0.796533
40
26.4
25.440912
70
false
false
0
0
0
0
0
0
0.9
false
false
13
8caeab47f56d561fdb9d0418011b65d539185fa7
317,827,615,946
3ca29abd863bfac8f7473866182714688afbeae2
/src/SavedJobs.java
1f256750c88b7b9dc64f1b46ad54af63d3eeeac5
[]
no_license
garriual/object-calisthenics
https://github.com/garriual/object-calisthenics
a28b9caf76f597254c0fe739620f51960ceb8f0d
3ab39bdef03923cb03e26c8041a18307e951391a
refs/heads/master
2021-01-15T17:56:06.587000
2013-02-06T14:25:10
2013-02-06T14:25:10
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.ArrayList; public class SavedJobs { private ArrayList<Job> savedJobs; public SavedJobs(){ this.savedJobs = new ArrayList<Job>(); } public void addJob(Job job){ this.savedJobs.add(job); } public String toString(){ StringBuilder sb = new StringBuilder(); for(Job job: savedJobs){ sb.append(job); sb.append("\n"); } return sb.toString(); } }
UTF-8
Java
414
java
SavedJobs.java
Java
[]
null
[]
import java.util.ArrayList; public class SavedJobs { private ArrayList<Job> savedJobs; public SavedJobs(){ this.savedJobs = new ArrayList<Job>(); } public void addJob(Job job){ this.savedJobs.add(job); } public String toString(){ StringBuilder sb = new StringBuilder(); for(Job job: savedJobs){ sb.append(job); sb.append("\n"); } return sb.toString(); } }
414
0.628019
0.628019
23
17
14.224901
43
false
false
0
0
0
0
0
0
0.347826
false
false
13
85afe3417e4239750460bbea0e1818fec8b4ed62
7,791,070,687,756
2d89e946432dcc89d427382245eb5471b87cabd0
/src/main/java/util/SeleniumHelper.java
fc793c4a1f791c49e8dfd1f673e26af0352ca7ed
[]
no_license
amitsgvu/CuucmberSelenium
https://github.com/amitsgvu/CuucmberSelenium
94531a8bcb9a9c827f9ca5e7998089538db9129d
bf90aa88bdf6aa701d3901c8a13e5bb884b389fa
refs/heads/master
2020-03-29T18:45:07.238000
2018-09-26T04:19:23
2018-09-26T04:19:23
150,229,613
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package util; import java.io.IOException; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.util.PDFTextStripper; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.Select; import org.openqa.selenium.support.ui.WebDriverWait; public class SeleniumHelper { public static boolean isElementPresent(WebElement webElement) { try { boolean isPresent = webElement.isDisplayed(); return isPresent; } catch (NoSuchElementException e) { return false; } } public static void scrollBottom() { JavascriptExecutor js = ((JavascriptExecutor) SeleniumDriver.getDriver()); js.executeScript("window.scrollTo(0, document.body.scrollHeight)"); } public static void scrollDown() { JavascriptExecutor js = ((JavascriptExecutor) SeleniumDriver.getDriver()); js.executeScript("window.scrollBy(0,500)", ""); } public static void selectValue(WebElement ele, String value) {/// WebElement dropdown=ele; Select select = new Select(ele); select.selectByVisibleText(value); } public static WebElement waitForElement(WebElement element) { WebElement ele = element; WebDriverWait wait = new WebDriverWait(SeleniumDriver.getDriver(), 10); ele=wait.until(ExpectedConditions.elementToBeClickable(ele)); return ele; } public static void hooverProduct(WebElement element) { Actions action = new Actions(SeleniumDriver.getDriver()); action.moveToElement(element).build().perform(); ; } public static void highLightElement(WebElement element) { JavascriptExecutor js=(JavascriptExecutor)SeleniumDriver.getDriver(); js.executeScript("arguments[0].setAttribute('style', 'background: yellow; border: 2px solid red;');", element); try { Thread.sleep(500); } catch (InterruptedException e) { System.out.println(e.getMessage()); } js.executeScript("arguments[0].setAttribute('style','border: solid 2px white');", element); } public static void ReadPdfText () { try { //load the pdf document PDDocument pdDocument=PDDocument.load("C:\\Users\\amisharm25\\Downloads\\test.pdf"); //count total pages int totalPages= pdDocument.getNumberOfPages(); //print out total page numbers System.out.println("Total pages: " +totalPages); //define a PDF file stripper object PDFTextStripper stripper = new PDFTextStripper(); //set start page to 1 stripper.setStartPage( 1 ); //set end page to total pages stripper.setEndPage( totalPages ); String extractedText= stripper.getText(pdDocument); // System.out.println(extractedText); String stringArr[] = extractedText.split("\\r?\\n"); for(String str:stringArr) { //System.out.println("==========pdf text is"+str); if(str.contains("BSMPOODAE")||str.contains("$28.00")) { System.out.println("=============MATCHING=========="); } } } catch (IOException e) { e.printStackTrace(); } } }
UTF-8
Java
3,219
java
SeleniumHelper.java
Java
[ { "context": "PDDocument pdDocument=PDDocument.load(\"C:\\\\Users\\\\amisharm25\\\\Downloads\\\\test.pdf\");\n //count total pag", "end": 2267, "score": 0.9997154474258423, "start": 2257, "tag": "USERNAME", "value": "amisharm25" } ]
null
[]
package util; import java.io.IOException; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.util.PDFTextStripper; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.Select; import org.openqa.selenium.support.ui.WebDriverWait; public class SeleniumHelper { public static boolean isElementPresent(WebElement webElement) { try { boolean isPresent = webElement.isDisplayed(); return isPresent; } catch (NoSuchElementException e) { return false; } } public static void scrollBottom() { JavascriptExecutor js = ((JavascriptExecutor) SeleniumDriver.getDriver()); js.executeScript("window.scrollTo(0, document.body.scrollHeight)"); } public static void scrollDown() { JavascriptExecutor js = ((JavascriptExecutor) SeleniumDriver.getDriver()); js.executeScript("window.scrollBy(0,500)", ""); } public static void selectValue(WebElement ele, String value) {/// WebElement dropdown=ele; Select select = new Select(ele); select.selectByVisibleText(value); } public static WebElement waitForElement(WebElement element) { WebElement ele = element; WebDriverWait wait = new WebDriverWait(SeleniumDriver.getDriver(), 10); ele=wait.until(ExpectedConditions.elementToBeClickable(ele)); return ele; } public static void hooverProduct(WebElement element) { Actions action = new Actions(SeleniumDriver.getDriver()); action.moveToElement(element).build().perform(); ; } public static void highLightElement(WebElement element) { JavascriptExecutor js=(JavascriptExecutor)SeleniumDriver.getDriver(); js.executeScript("arguments[0].setAttribute('style', 'background: yellow; border: 2px solid red;');", element); try { Thread.sleep(500); } catch (InterruptedException e) { System.out.println(e.getMessage()); } js.executeScript("arguments[0].setAttribute('style','border: solid 2px white');", element); } public static void ReadPdfText () { try { //load the pdf document PDDocument pdDocument=PDDocument.load("C:\\Users\\amisharm25\\Downloads\\test.pdf"); //count total pages int totalPages= pdDocument.getNumberOfPages(); //print out total page numbers System.out.println("Total pages: " +totalPages); //define a PDF file stripper object PDFTextStripper stripper = new PDFTextStripper(); //set start page to 1 stripper.setStartPage( 1 ); //set end page to total pages stripper.setEndPage( totalPages ); String extractedText= stripper.getText(pdDocument); // System.out.println(extractedText); String stringArr[] = extractedText.split("\\r?\\n"); for(String str:stringArr) { //System.out.println("==========pdf text is"+str); if(str.contains("BSMPOODAE")||str.contains("$28.00")) { System.out.println("=============MATCHING=========="); } } } catch (IOException e) { e.printStackTrace(); } } }
3,219
0.700839
0.694004
104
29.942308
27.296741
112
false
false
0
0
0
0
0
0
1.317308
false
false
13
cefc0e6abe94d0621fea29ae26f7974fec7db223
2,095,944,101,072
dc6f35e4fe0e69dc0b4230cfd51ac15cab464eec
/src/Stuff.java
d882e34226009bbf2f42760fbe5a71c9b7033d86
[]
no_license
Joemen/OOP_Final
https://github.com/Joemen/OOP_Final
b9deaddb124b7022bae488a18ed81d8608233575
9d4f0c7d3e65cb15ec104cccfd10d85c311c6f8f
refs/heads/master
2021-01-10T16:38:06.979000
2016-01-24T03:32:40
2016-01-24T03:32:40
47,734,522
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class Stuff{ public int price; public String name; public boolean remain; public int buyer; public int point; public Stuff(int price, String name, int point){ this.name = new String(name); this.price = price; this.point = point; } // about get public boolean isRemain(){ return this.remain; } public String getName(){ return this.name; } public int getPrice(){ return this.price; } public int getPoint(){ return this.point; } // about set public void setPrice(int number){ price = number; } public void setName(String string){ this.name = string; } }
UTF-8
Java
604
java
Stuff.java
Java
[]
null
[]
public class Stuff{ public int price; public String name; public boolean remain; public int buyer; public int point; public Stuff(int price, String name, int point){ this.name = new String(name); this.price = price; this.point = point; } // about get public boolean isRemain(){ return this.remain; } public String getName(){ return this.name; } public int getPrice(){ return this.price; } public int getPoint(){ return this.point; } // about set public void setPrice(int number){ price = number; } public void setName(String string){ this.name = string; } }
604
0.678808
0.678808
39
14.51282
12.25346
49
false
false
0
0
0
0
0
0
1.435897
false
false
13
5468e80935eb26f2f714978d71253d23577a9487
25,872,883,035,256
cfef1a4bc4a49f4822df7910ffe2dcc8fcaddfc7
/src/main/java/ar/com/poker/engine/states/WinnerState.java
1c762a91cf752863b21a6648882e27b454923c20
[]
no_license
marelas/poker
https://github.com/marelas/poker
2f3c1c28a83b25e6e781e824c14d13621f2afaa6
0bf002344340058bf472033d6872ddff009ac428
refs/heads/master
2021-01-02T09:46:23.927000
2017-08-16T21:21:08
2017-08-16T21:21:08
99,297,028
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ar.com.poker.engine.states; import java.util.List; import ar.com.poker.api.game.TexasHoldEmUtil.PlayerState; import ar.com.poker.engine.model.ModelContext; import ar.com.poker.engine.model.PlayerEntity; import ar.com.util.statemachine.IState; /* * el metodo execute emple streams * Los streams vienen con una funcionalidad muy interesante, * admiten filtros, colectores, agrupadores, mapeo de tipo a otro, saltos de elementos, ejecutar acciones en medio, * ordenar elementos, eliminar duplicados, reducir el flujo, etc... */ public class WinnerState implements IState<ModelContext>{ public static final String NAME ="Winner"; @Override public String getName() { return NAME; } @Override public boolean execute(ModelContext context) { List<PlayerEntity> players = context.getPlayers(); players.stream() .filter(p -> p.isActive() || p.getState() == PlayerState.ALL_IN) .findFirst() .get() .addChips(players.stream() .mapToLong(p-> p.getBet()).sum()); return true; } }
UTF-8
Java
1,028
java
WinnerState.java
Java
[]
null
[]
package ar.com.poker.engine.states; import java.util.List; import ar.com.poker.api.game.TexasHoldEmUtil.PlayerState; import ar.com.poker.engine.model.ModelContext; import ar.com.poker.engine.model.PlayerEntity; import ar.com.util.statemachine.IState; /* * el metodo execute emple streams * Los streams vienen con una funcionalidad muy interesante, * admiten filtros, colectores, agrupadores, mapeo de tipo a otro, saltos de elementos, ejecutar acciones en medio, * ordenar elementos, eliminar duplicados, reducir el flujo, etc... */ public class WinnerState implements IState<ModelContext>{ public static final String NAME ="Winner"; @Override public String getName() { return NAME; } @Override public boolean execute(ModelContext context) { List<PlayerEntity> players = context.getPlayers(); players.stream() .filter(p -> p.isActive() || p.getState() == PlayerState.ALL_IN) .findFirst() .get() .addChips(players.stream() .mapToLong(p-> p.getBet()).sum()); return true; } }
1,028
0.728599
0.728599
38
26.052631
26.778769
116
false
false
0
0
0
0
0
0
1.631579
false
false
13
3322b0377067ddbbedf32921be7becd876d06622
31,275,951,892,803
7a16bf6c12dda9aa3dc99add5ea95efafa4e504f
/src/cesare/operationUtil/graphicUtil/SketchShapeUtil.java
01488f69b9b096224bfb17db8912440742c04917
[]
no_license
Cesareans/Sketch
https://github.com/Cesareans/Sketch
ea8555813fcce0db1167b437c28776a6cefa72e7
ee8c2cf23258b31c46b261166a6987cc27f46cc5
refs/heads/master
2020-03-18T01:35:00.564000
2018-05-25T12:30:50
2018-05-25T12:30:50
134,148,958
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cesare.operationUtil.graphicUtil; import cesare.operationUtil.OperationUtil; import java.awt.*; public abstract class SketchShapeUtil extends OperationUtil { protected Color color = Color.black; protected boolean isFilled = false; protected int lineWidth = 1; protected int dashedLength = 0; protected boolean isGradient = false; protected Color secondColor = null; public SketchShapeUtil setColor(Color color) { this.color = color; return this; } public SketchShapeUtil setFilled(boolean filled){ isFilled = filled; return this; } public SketchShapeUtil setGradient(boolean gradient){ isGradient = gradient; return this; } public SketchShapeUtil setSecondColor(Color color){ secondColor = color; return this; } public SketchShapeUtil setLineWidth(int lineWidth){ this.lineWidth = lineWidth; return this; } public SketchShapeUtil setDashedLength(int dashedLength){ this.dashedLength = dashedLength; return this; } }
UTF-8
Java
1,098
java
SketchShapeUtil.java
Java
[]
null
[]
package cesare.operationUtil.graphicUtil; import cesare.operationUtil.OperationUtil; import java.awt.*; public abstract class SketchShapeUtil extends OperationUtil { protected Color color = Color.black; protected boolean isFilled = false; protected int lineWidth = 1; protected int dashedLength = 0; protected boolean isGradient = false; protected Color secondColor = null; public SketchShapeUtil setColor(Color color) { this.color = color; return this; } public SketchShapeUtil setFilled(boolean filled){ isFilled = filled; return this; } public SketchShapeUtil setGradient(boolean gradient){ isGradient = gradient; return this; } public SketchShapeUtil setSecondColor(Color color){ secondColor = color; return this; } public SketchShapeUtil setLineWidth(int lineWidth){ this.lineWidth = lineWidth; return this; } public SketchShapeUtil setDashedLength(int dashedLength){ this.dashedLength = dashedLength; return this; } }
1,098
0.682149
0.680328
41
25.780487
19.560429
61
false
false
0
0
0
0
0
0
0.512195
false
false
13
5f54e14138932be9b7ebe02cf402b7aa5fc4c773
9,388,798,558,141
f932cd600e0debb45ec06a6522969dfc564c7c02
/src/main/java/com/examples/java8/JavaEight.java
906b1bab7c1dd6272379f5efd00f1d4d1abc39a2
[]
no_license
prakash-gangadharan/Bookservice
https://github.com/prakash-gangadharan/Bookservice
0b962daffcdae42bdbcf3d9a30841ee2ac8caaf4
788d0f5af9e4ea4004432237cec4b1e4525a0680
refs/heads/master
2023-01-03T11:05:41.021000
2020-11-03T09:39:48
2020-11-03T09:39:48
276,060,489
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.examples.java8; import java.util.ArrayList; import java.util.Arrays; public class JavaEight { public static void main(String[] args) { ArrayList num = new ArrayList(); for (int i=0;i<10;i++) { int val = i*((int) Math.random()); num.add(new Integer(val)); } } }
UTF-8
Java
356
java
JavaEight.java
Java
[]
null
[]
package com.examples.java8; import java.util.ArrayList; import java.util.Arrays; public class JavaEight { public static void main(String[] args) { ArrayList num = new ArrayList(); for (int i=0;i<10;i++) { int val = i*((int) Math.random()); num.add(new Integer(val)); } } }
356
0.536517
0.525281
19
17.68421
16.537207
46
false
false
0
0
0
0
0
0
0.421053
false
false
13
33cbb79a9c0bd169e0e86ed25fab335d2b8b5d84
9,388,798,557,396
9e190b52f2c0ea6edd9137abe38bcefe4c5f5a3b
/Userc0/src/pojo/RhkswjfinfoPythonController.java
9fcc8981eb32c38bf679b4bf8dad0a82fac7766d
[]
no_license
ijh1025/2chaproject
https://github.com/ijh1025/2chaproject
a2796acd569c029db7cf3cf9ff7605d1e1054b67
61fca5ffab8bb5d8edba1bc219a5baa214840384
refs/heads/master
2020-07-11T17:47:45.649000
2019-08-28T01:39:50
2019-08-28T01:39:50
204,608,008
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pojo; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Scanner; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class RhkswjfinfoPythonController implements Controller{ public String requestHandle(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // String savePath=request.getRealPath("/python"); // System.out.println(savePath); // System.out.println("a"); // ProcessBuilder builder = new ProcessBuilder("python",savePath+"/관절염_질병정보_1.py");//관절 // ProcessBuilder builder1 = new ProcessBuilder("python",savePath+"/관절염_질병정보_2.py"); // ProcessBuilder builder2 = new ProcessBuilder("python",savePath+"/관절염_질병정보_3.py"); // ProcessBuilder builder3 = new ProcessBuilder("python",savePath+"/관절염_질병정보_4.py"); // ProcessBuilder builder4 = new ProcessBuilder("python",savePath+"/관절염_질병정보_5.py"); // ProcessBuilder builder5 = new ProcessBuilder("python",savePath+"/관절염_질병정보_6.py"); // ProcessBuilder builder6 = new ProcessBuilder("python",savePath+"/관절염_질병정보_7.py"); // ProcessBuilder builder7 = new ProcessBuilder("python",savePath+"/관절염_질병정보_8.py"); // //C:\\Users\\smhrd1_24\\Desktop\\WebWork\\.metadata\\.plugins\\org.eclipse.wst.server.core\\tmp0\\wtpwebapps\\Userc0\\python // System.out.println("b"); // Process process = builder.start(); // Process process1 = builder1.start(); // Process process2 = builder2.start(); // Process process3 = builder3.start(); // Process process4 = builder4.start(); // Process process5 = builder5.start(); // Process process6 = builder6.start(); // Process process7 = builder7.start(); // // System.out.println("c"); // Scanner errorScanner = new Scanner(process.getErrorStream()); // Scanner errorScanner1 = new Scanner(process1.getErrorStream()); // Scanner errorScanner2 = new Scanner(process2.getErrorStream()); // Scanner errorScanner3 = new Scanner(process3.getErrorStream()); // Scanner errorScanner4 = new Scanner(process4.getErrorStream()); // Scanner errorScanner5 = new Scanner(process5.getErrorStream()); // Scanner errorScanner6 = new Scanner(process6.getErrorStream()); // Scanner errorScanner7 = new Scanner(process7.getErrorStream()); // // // // //파이썬 에러를 보기위해서 쓰임 // Scanner outputScanner = new Scanner(process.getInputStream()); // Scanner outputScanner1 = new Scanner(process1.getInputStream()); // Scanner outputScanner2 = new Scanner(process2.getInputStream()); // Scanner outputScanner3 = new Scanner(process3.getInputStream()); // Scanner outputScanner4 = new Scanner(process4.getInputStream()); // Scanner outputScanner5 = new Scanner(process5.getInputStream()); // Scanner outputScanner6 = new Scanner(process6.getInputStream()); // Scanner outputScanner7 = new Scanner(process7.getInputStream()); // // // // // ArrayList<String> rhwlimg=new ArrayList<String>(); // ArrayList<String> rhwlrk=new ArrayList<String>(); // ArrayList<String> rhwlname=new ArrayList<String>(); // ArrayList<String> out3=new ArrayList<String>(); // ArrayList<String> out4=new ArrayList<String>(); // ArrayList<String> out5=new ArrayList<String>(); // ArrayList<String> out6=new ArrayList<String>(); // ArrayList<String> out7=new ArrayList<String>(); // // // // // try { // process.waitFor(); //파이썬 응답 프로그램이 올때까지 기다려야됨 // } catch (InterruptedException e) { // // TODO Auto-generated catch block // System.out.println("f"); // e.printStackTrace(); // System.out.println("e"); // } // // //파이썬 응용프로그램이 실행뒤 실행됨 // System.out.println("d"); // // 에러 스트림 from 파이썬파일 // while(errorScanner.hasNext()) { // System.out.println(errorScanner.nextLine()); // } // errorScanner.close(); // // // 입력 스트립 from 파이썬파일 // // // // // // // // while(outputScanner.hasNext()) { // rhwlimg.add(outputScanner.nextLine()); // // request.getSession().setAttribute("out1", rhwlimg); // // System.out.println(rhwlimg.size()); // //System.out.println(outputScanner.nextLine()); // } // while(outputScanner1.hasNext()) { // rhwlrk.add(outputScanner1.nextLine()); // // request.getSession().setAttribute("out2", rhwlrk); // // } // while(outputScanner2.hasNext()) { // rhwlname.add(outputScanner2.nextLine()); // // request.getSession().setAttribute("out3", rhwlname); // // } // while(outputScanner3.hasNext()) { // out3.add(outputScanner3.nextLine()); // // request.getSession().setAttribute("out4", out3); // // } // while(outputScanner4.hasNext()) { // out4.add(outputScanner4.nextLine()); // // request.getSession().setAttribute("out5", out4); // // } // while(outputScanner5.hasNext()) { // out5.add(outputScanner5.nextLine()); // // request.getSession().setAttribute("out6", out5); // // } // while(outputScanner6.hasNext()) { // out6.add(outputScanner6.nextLine()); // // request.getSession().setAttribute("out7", out6); // // } // while(outputScanner7.hasNext()) { // out7.add(outputScanner7.nextLine()); // // request.getSession().setAttribute("out8", out7); // // } // outputScanner.close(); // outputScanner1.close(); // outputScanner2.close(); // outputScanner3.close(); // outputScanner4.close(); // outputScanner5.close(); // outputScanner6.close(); // outputScanner7.close(); String nextView="/WEB-INF/views/rhkswjfinfo.jsp"; return nextView; } }
UTF-8
Java
6,011
java
RhkswjfinfoPythonController.java
Java
[ { "context": "on\",savePath+\"/관절염_질병정보_8.py\");\r\n//\t\t//C:\\\\Users\\\\smhrd1_24\\\\Desktop\\\\WebWork\\\\.metadata\\\\.plugins\\\\org.eclip", "end": 1402, "score": 0.9990969896316528, "start": 1393, "tag": "USERNAME", "value": "smhrd1_24" } ]
null
[]
package pojo; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Scanner; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class RhkswjfinfoPythonController implements Controller{ public String requestHandle(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // String savePath=request.getRealPath("/python"); // System.out.println(savePath); // System.out.println("a"); // ProcessBuilder builder = new ProcessBuilder("python",savePath+"/관절염_질병정보_1.py");//관절 // ProcessBuilder builder1 = new ProcessBuilder("python",savePath+"/관절염_질병정보_2.py"); // ProcessBuilder builder2 = new ProcessBuilder("python",savePath+"/관절염_질병정보_3.py"); // ProcessBuilder builder3 = new ProcessBuilder("python",savePath+"/관절염_질병정보_4.py"); // ProcessBuilder builder4 = new ProcessBuilder("python",savePath+"/관절염_질병정보_5.py"); // ProcessBuilder builder5 = new ProcessBuilder("python",savePath+"/관절염_질병정보_6.py"); // ProcessBuilder builder6 = new ProcessBuilder("python",savePath+"/관절염_질병정보_7.py"); // ProcessBuilder builder7 = new ProcessBuilder("python",savePath+"/관절염_질병정보_8.py"); // //C:\\Users\\smhrd1_24\\Desktop\\WebWork\\.metadata\\.plugins\\org.eclipse.wst.server.core\\tmp0\\wtpwebapps\\Userc0\\python // System.out.println("b"); // Process process = builder.start(); // Process process1 = builder1.start(); // Process process2 = builder2.start(); // Process process3 = builder3.start(); // Process process4 = builder4.start(); // Process process5 = builder5.start(); // Process process6 = builder6.start(); // Process process7 = builder7.start(); // // System.out.println("c"); // Scanner errorScanner = new Scanner(process.getErrorStream()); // Scanner errorScanner1 = new Scanner(process1.getErrorStream()); // Scanner errorScanner2 = new Scanner(process2.getErrorStream()); // Scanner errorScanner3 = new Scanner(process3.getErrorStream()); // Scanner errorScanner4 = new Scanner(process4.getErrorStream()); // Scanner errorScanner5 = new Scanner(process5.getErrorStream()); // Scanner errorScanner6 = new Scanner(process6.getErrorStream()); // Scanner errorScanner7 = new Scanner(process7.getErrorStream()); // // // // //파이썬 에러를 보기위해서 쓰임 // Scanner outputScanner = new Scanner(process.getInputStream()); // Scanner outputScanner1 = new Scanner(process1.getInputStream()); // Scanner outputScanner2 = new Scanner(process2.getInputStream()); // Scanner outputScanner3 = new Scanner(process3.getInputStream()); // Scanner outputScanner4 = new Scanner(process4.getInputStream()); // Scanner outputScanner5 = new Scanner(process5.getInputStream()); // Scanner outputScanner6 = new Scanner(process6.getInputStream()); // Scanner outputScanner7 = new Scanner(process7.getInputStream()); // // // // // ArrayList<String> rhwlimg=new ArrayList<String>(); // ArrayList<String> rhwlrk=new ArrayList<String>(); // ArrayList<String> rhwlname=new ArrayList<String>(); // ArrayList<String> out3=new ArrayList<String>(); // ArrayList<String> out4=new ArrayList<String>(); // ArrayList<String> out5=new ArrayList<String>(); // ArrayList<String> out6=new ArrayList<String>(); // ArrayList<String> out7=new ArrayList<String>(); // // // // // try { // process.waitFor(); //파이썬 응답 프로그램이 올때까지 기다려야됨 // } catch (InterruptedException e) { // // TODO Auto-generated catch block // System.out.println("f"); // e.printStackTrace(); // System.out.println("e"); // } // // //파이썬 응용프로그램이 실행뒤 실행됨 // System.out.println("d"); // // 에러 스트림 from 파이썬파일 // while(errorScanner.hasNext()) { // System.out.println(errorScanner.nextLine()); // } // errorScanner.close(); // // // 입력 스트립 from 파이썬파일 // // // // // // // // while(outputScanner.hasNext()) { // rhwlimg.add(outputScanner.nextLine()); // // request.getSession().setAttribute("out1", rhwlimg); // // System.out.println(rhwlimg.size()); // //System.out.println(outputScanner.nextLine()); // } // while(outputScanner1.hasNext()) { // rhwlrk.add(outputScanner1.nextLine()); // // request.getSession().setAttribute("out2", rhwlrk); // // } // while(outputScanner2.hasNext()) { // rhwlname.add(outputScanner2.nextLine()); // // request.getSession().setAttribute("out3", rhwlname); // // } // while(outputScanner3.hasNext()) { // out3.add(outputScanner3.nextLine()); // // request.getSession().setAttribute("out4", out3); // // } // while(outputScanner4.hasNext()) { // out4.add(outputScanner4.nextLine()); // // request.getSession().setAttribute("out5", out4); // // } // while(outputScanner5.hasNext()) { // out5.add(outputScanner5.nextLine()); // // request.getSession().setAttribute("out6", out5); // // } // while(outputScanner6.hasNext()) { // out6.add(outputScanner6.nextLine()); // // request.getSession().setAttribute("out7", out6); // // } // while(outputScanner7.hasNext()) { // out7.add(outputScanner7.nextLine()); // // request.getSession().setAttribute("out8", out7); // // } // outputScanner.close(); // outputScanner1.close(); // outputScanner2.close(); // outputScanner3.close(); // outputScanner4.close(); // outputScanner5.close(); // outputScanner6.close(); // outputScanner7.close(); String nextView="/WEB-INF/views/rhkswjfinfo.jsp"; return nextView; } }
6,011
0.666435
0.648029
168
32.279762
26.164982
128
false
false
0
0
0
0
0
0
2.672619
false
false
13
1d93a1bd3cd233d4498d6c2806a6653ed96aeb9b
1,872,605,788,935
082e26b011e30dc62a62fae95f375e4f87d9e99c
/docs/weixin_7.0.4_source/反编译源码/反混淆后/src/main/java/com/tencent/tencentmap/mapsdk/p666a/C36474dw.java
3d35fde381ccfa0e615b840bfcdea9da4108fb0b
[]
no_license
xsren/AndroidReverseNotes
https://github.com/xsren/AndroidReverseNotes
9631a5aabc031006e795a112b7ac756a8edd4385
9202c276fe9f04a978e4e08b08e42645d97ca94b
refs/heads/master
2021-04-07T22:50:51.072000
2019-07-16T02:24:43
2019-07-16T02:24:43
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.tencent.tencentmap.mapsdk.p666a; import java.io.IOException; /* renamed from: com.tencent.tencentmap.mapsdk.a.dw */ public class C36474dw extends IOException { public C36474dw(String str) { super(str); } }
UTF-8
Java
236
java
C36474dw.java
Java
[]
null
[]
package com.tencent.tencentmap.mapsdk.p666a; import java.io.IOException; /* renamed from: com.tencent.tencentmap.mapsdk.a.dw */ public class C36474dw extends IOException { public C36474dw(String str) { super(str); } }
236
0.716102
0.661017
10
22.6
19.489485
54
false
false
0
0
0
0
0
0
0.3
false
false
13
0b176e1656752f5e42be2470eb0975908cf1be80
29,265,907,202,401
213c73080819cc18c376c32ac63d14feba3b413f
/src/by/bsuir/textparser/composite/CompositeType.java
55c97176b00829a18ad4539e0c3bd6864b103a9c
[]
no_license
LogvinovIvan/epamJavaParser
https://github.com/LogvinovIvan/epamJavaParser
955ec504605aec551707472204fff4aa1d749155
bb43e372caf10be7571280a61c705a10fd83dbd2
refs/heads/master
2021-01-22T17:34:31.822000
2016-06-13T08:18:19
2016-06-13T08:18:19
61,020,509
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package by.bsuir.textparser.composite; /** * Created by Иван on 13.03.2016. */ public enum CompositeType { CLASS, METHOD, FIELD, OPERATORS, CONSTRUCTOR, LISTING, SIGNATURE, NAME, BLOCK }
UTF-8
Java
198
java
CompositeType.java
Java
[ { "context": " by.bsuir.textparser.composite;\n\n/**\n * Created by Иван on 13.03.2016.\n */\npublic enum CompositeType {\n ", "end": 62, "score": 0.9997784495353699, "start": 58, "tag": "NAME", "value": "Иван" } ]
null
[]
package by.bsuir.textparser.composite; /** * Created by Иван on 13.03.2016. */ public enum CompositeType { CLASS, METHOD, FIELD, OPERATORS, CONSTRUCTOR, LISTING, SIGNATURE, NAME, BLOCK }
198
0.721649
0.680412
8
23.25
26.261902
81
false
false
0
0
0
0
0
0
1.125
false
false
13
4abe9b0db5736c61e56d9ea5f3b10561f465a8e8
4,483,945,905,426
63524db1339dbd51ed7e7a3c18c1a4f6b2012624
/basic-code/day06-code/src/cn/itcast/day06/demo02/Phone.java
442dd60cab86223bc3c3ee9aa45774f74e055853
[]
no_license
jane528/all
https://github.com/jane528/all
2a039056791b39f8ded3e79a66979bae2b05140f
97f7534e7db45d6877e7fd3bafb09ae32c6a4050
refs/heads/master
2022-12-25T12:50:46.153000
2019-11-05T03:20:37
2019-11-05T03:20:37
219,648,279
0
0
null
false
2022-12-16T10:01:44
2019-11-05T03:18:58
2019-11-05T03:23:24
2022-12-16T10:01:40
47,478
0
0
40
HTML
false
false
package cn.itcast.day06.demo02; public class Phone { //att String brand; double price; String color; //act public void call(){ System.out.println("打电话"); } public void sendMessage(){ System.out.println("发短信"); } }
UTF-8
Java
282
java
Phone.java
Java
[]
null
[]
package cn.itcast.day06.demo02; public class Phone { //att String brand; double price; String color; //act public void call(){ System.out.println("打电话"); } public void sendMessage(){ System.out.println("发短信"); } }
282
0.57037
0.555556
18
14
12.142671
34
false
false
0
0
0
0
0
0
0.333333
false
false
13
015603fa42b8095207c666ef67eaff3d9748db69
2,963,527,490,884
84381f1c7d0cd4b479081e5ab7be7aae97eec147
/src/test/java/by/itacademy/finalproject/menus/operable/review/reviewable/birthdays/ResentBirthdayReviewerTest.java
2253c77dfee2b89d4615b1ea8f668740c965f70f
[]
no_license
ApollinManenok/Java-FinalProject
https://github.com/ApollinManenok/Java-FinalProject
f2a6c44b807bb3c41021f0197102d638468b2821
49613662beec4646d43d68801d733801ddacc666
refs/heads/master
2020-03-23T01:48:22.003000
2018-07-23T16:56:56
2018-07-23T16:56:56
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package by.itacademy.finalproject.menus.operable.review.reviewable.birthdays; import by.itacademy.finalproject.domain.School; import by.itacademy.finalproject.menus.operable.review.reviewable.Reviewable; import by.itacademy.finalproject.menus.operable.review.reviewable.birthdays.info.BirthdayInfo; import by.itacademy.finalproject.menus.serialize.serialization.json.ReadLocalGsonTest; import by.itacademy.finalproject.menus.serializing.serialization.json.ReadLocalGson; import org.junit.Test; import java.io.File; import java.time.LocalDate; import java.util.List; import static org.junit.Assert.assertTrue; public class ResentBirthdayReviewerTest { private Reviewable<BirthdayInfo> reviewer = new ResentBirthdayReviewer(); private School school = new School(); private String fileName = "TestSchool.json"; private ReadLocalGson reader = new ReadLocalGson(school, new File(ReadLocalGsonTest.class .getClassLoader().getResource(fileName).getFile())); @Test public void checkBirthdayInfoAreInRightTimeBounds() { reader.serialize(); List<BirthdayInfo> infos = reviewer.review(school.getGroups()); for (BirthdayInfo info : infos) { int dateDayOfYear = info.getDate().getDayOfYear(); int earliestBound = LocalDate.now().withDayOfMonth(1).getDayOfYear(); int latestBound = LocalDate.now().withDayOfMonth(1).plusMonths(2).getDayOfYear(); assertTrue(dateDayOfYear >= earliestBound && dateDayOfYear < latestBound); } } }
UTF-8
Java
1,538
java
ResentBirthdayReviewerTest.java
Java
[]
null
[]
package by.itacademy.finalproject.menus.operable.review.reviewable.birthdays; import by.itacademy.finalproject.domain.School; import by.itacademy.finalproject.menus.operable.review.reviewable.Reviewable; import by.itacademy.finalproject.menus.operable.review.reviewable.birthdays.info.BirthdayInfo; import by.itacademy.finalproject.menus.serialize.serialization.json.ReadLocalGsonTest; import by.itacademy.finalproject.menus.serializing.serialization.json.ReadLocalGson; import org.junit.Test; import java.io.File; import java.time.LocalDate; import java.util.List; import static org.junit.Assert.assertTrue; public class ResentBirthdayReviewerTest { private Reviewable<BirthdayInfo> reviewer = new ResentBirthdayReviewer(); private School school = new School(); private String fileName = "TestSchool.json"; private ReadLocalGson reader = new ReadLocalGson(school, new File(ReadLocalGsonTest.class .getClassLoader().getResource(fileName).getFile())); @Test public void checkBirthdayInfoAreInRightTimeBounds() { reader.serialize(); List<BirthdayInfo> infos = reviewer.review(school.getGroups()); for (BirthdayInfo info : infos) { int dateDayOfYear = info.getDate().getDayOfYear(); int earliestBound = LocalDate.now().withDayOfMonth(1).getDayOfYear(); int latestBound = LocalDate.now().withDayOfMonth(1).plusMonths(2).getDayOfYear(); assertTrue(dateDayOfYear >= earliestBound && dateDayOfYear < latestBound); } } }
1,538
0.754226
0.752276
34
44.235294
32.703712
94
false
false
0
0
0
0
0
0
0.647059
false
false
13
d5097f11f18a8cef020f862d02a5e0bf4deb160c
11,879,879,573,417
96fcd2f3ff620ff80974cfa34f0718c53ccd522f
/HomeWork3/src/Entities/Campaign.java
b5faacfdd65fccf1c7a92657b4030300b08d1a5e
[]
no_license
furkanbilalakyuz/HomeWork3
https://github.com/furkanbilalakyuz/HomeWork3
b75a166430195c3f816cd776ff7823962e4d0215
0f4203c65039fbe11a2a743e5db41f17b2b34a91
refs/heads/master
2023-04-22T10:15:59.434000
2021-05-04T22:25:50
2021-05-04T22:25:50
364,070,542
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Entities; import Abstract.IEntity; public class Campaign implements IEntity { private int indirimOranı; private double birimFiyatı; public Campaign(int indirimOranı, double birimFiyatı) { super(); this.indirimOranı = indirimOranı; this.birimFiyatı = birimFiyatı; } public int getIndirimOranı() { return indirimOranı; } public void setIndirimOranı(int indirimOranı) { this.indirimOranı = indirimOranı; } public double getBirimFiyatı() { return birimFiyatı; } public void setBirimFiyatı(double birimFiyatı) { this.birimFiyatı = birimFiyatı; } }
ISO-8859-9
Java
629
java
Campaign.java
Java
[]
null
[]
package Entities; import Abstract.IEntity; public class Campaign implements IEntity { private int indirimOranı; private double birimFiyatı; public Campaign(int indirimOranı, double birimFiyatı) { super(); this.indirimOranı = indirimOranı; this.birimFiyatı = birimFiyatı; } public int getIndirimOranı() { return indirimOranı; } public void setIndirimOranı(int indirimOranı) { this.indirimOranı = indirimOranı; } public double getBirimFiyatı() { return birimFiyatı; } public void setBirimFiyatı(double birimFiyatı) { this.birimFiyatı = birimFiyatı; } }
629
0.727422
0.727422
27
20.555555
17.476616
56
false
false
0
0
0
0
0
0
1.444444
false
false
13
a843689b8083efe5cfacc22b52f16cdee5a30bf7
27,015,344,305,284
547ab4eb0dcba51d4670bc4c92a38d7965e47a8d
/myapp-backend/src/main/java/com/truonghan/backend/daos/RoleDao.java
a7e34e5734041006802e9e794a561944c76db366
[]
no_license
truonghan0812/Sring_web_blog_mvc
https://github.com/truonghan0812/Sring_web_blog_mvc
d4cf6c91db01dd208be230fbe677474cd65677b2
515fce90c9788ed782d9917571d88f165b1800c2
refs/heads/master
2016-09-05T13:25:51.966000
2015-02-20T14:14:22
2015-02-20T14:14:22
30,479,019
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.truonghan.backend.daos; import com.truonghan.backend.domain.Role; public interface RoleDao extends BaseDao<Role, Long>{ }
UTF-8
Java
146
java
RoleDao.java
Java
[]
null
[]
package com.truonghan.backend.daos; import com.truonghan.backend.domain.Role; public interface RoleDao extends BaseDao<Role, Long>{ }
146
0.746575
0.746575
7
18.857143
22.177393
55
false
false
0
0
0
0
0
0
0.428571
false
false
13
8203d62635576eefe1676e7a6a30a245532b2cf5
31,190,052,530,392
694af613f3d2c33649cfc8cf2701361c699d7aa5
/client-test/src/main/java/t/jmeter/Publisher.java
69027edd92e659c730d4f0ae7a2afeffaf34a302
[]
no_license
lulugyf/idmm4
https://github.com/lulugyf/idmm4
cc72237115fb63364817e16891a0ed84595eb968
8f2b022456613e2ca019bd6a69dc3665793f58ba
refs/heads/master
2020-12-30T16:28:25.274000
2017-11-02T09:58:38
2017-11-02T09:58:38
90,992,561
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package t.jmeter; import com.sitech.crmpd.idmm.client.MessageContext; import com.sitech.crmpd.idmm.client.api.Message; import com.sitech.crmpd.idmm.client.api.PropertyOption; import com.sitech.crmpd.idmm.client.pool.PooledMessageContextFactory; import java.util.Random; import org.apache.commons.pool2.KeyedObjectPool; import org.apache.commons.pool2.impl.GenericKeyedObjectPool; import org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig; import org.apache.jmeter.config.Arguments; import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient; import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext; import org.apache.jmeter.samplers.SampleResult; public class Publisher extends AbstractJavaSamplerClient { // private SampleResult results; private String brokeAddr; private String timeOut; private String clientID; private String topic; private String password; private String message; private KeyedObjectPool<String, MessageContext> pool; private Random random = new Random(System.currentTimeMillis()); private MessageContext context = null; private int poolsize = 50; public void setupTest(JavaSamplerContext jsc) { // results = new SampleResult(); brokeAddr = jsc.getParameter("brokeAddr", ""); timeOut = jsc.getParameter("timeOut", "60000"); clientID = jsc.getParameter("clientID", ""); topic = jsc.getParameter("topic", ""); password = jsc.getParameter("password", ""); message = jsc.getParameter("message", ""); poolsize = jsc.getIntParameter("poolsize", 50); GenericKeyedObjectPoolConfig config = new GenericKeyedObjectPoolConfig(); config.setMaxTotal(poolsize); config.setMaxTotalPerKey(poolsize); config.setMaxIdlePerKey(poolsize); pool = new GenericKeyedObjectPool( new PooledMessageContextFactory(this.brokeAddr, Integer.parseInt(this.timeOut))); } public SampleResult runTest(JavaSamplerContext arg0) { boolean flag = true; String err_msg = ""; SampleResult results = new SampleResult(); results.sampleStart(); MessageContext context = null; try { context = (MessageContext)pool.borrowObject(clientID); Message message = Message.create(this.message); message.setProperty(PropertyOption.GROUP, String.valueOf(Math.abs(this.random.nextInt()))); // message.setProperty(PropertyOption.VISIT_PASSWORD, this.password); String id = context.send(this.topic, message); context.commit(new String[] { id }); } catch (Exception e) { e.printStackTrace(); err_msg = e.getMessage(); flag = false; }finally{ if(context != null) { try { pool.returnObject(clientID, context); } catch (Exception e) { e.printStackTrace(); } } } results.sampleEnd(); results.setDataEncoding("UTF-8"); results.setSuccessful(flag); results.setResponseMessage(err_msg); return results; } public void teardownTest(JavaSamplerContext arg0) { } }
UTF-8
Java
3,309
java
Publisher.java
Java
[ { "context": "message.setProperty(PropertyOption.VISIT_PASSWORD, this.password);\n\n String id = context.send(this.topi", "end": 2548, "score": 0.9079238772392273, "start": 2535, "tag": "PASSWORD", "value": "this.password" } ]
null
[]
package t.jmeter; import com.sitech.crmpd.idmm.client.MessageContext; import com.sitech.crmpd.idmm.client.api.Message; import com.sitech.crmpd.idmm.client.api.PropertyOption; import com.sitech.crmpd.idmm.client.pool.PooledMessageContextFactory; import java.util.Random; import org.apache.commons.pool2.KeyedObjectPool; import org.apache.commons.pool2.impl.GenericKeyedObjectPool; import org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig; import org.apache.jmeter.config.Arguments; import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient; import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext; import org.apache.jmeter.samplers.SampleResult; public class Publisher extends AbstractJavaSamplerClient { // private SampleResult results; private String brokeAddr; private String timeOut; private String clientID; private String topic; private String password; private String message; private KeyedObjectPool<String, MessageContext> pool; private Random random = new Random(System.currentTimeMillis()); private MessageContext context = null; private int poolsize = 50; public void setupTest(JavaSamplerContext jsc) { // results = new SampleResult(); brokeAddr = jsc.getParameter("brokeAddr", ""); timeOut = jsc.getParameter("timeOut", "60000"); clientID = jsc.getParameter("clientID", ""); topic = jsc.getParameter("topic", ""); password = jsc.getParameter("password", ""); message = jsc.getParameter("message", ""); poolsize = jsc.getIntParameter("poolsize", 50); GenericKeyedObjectPoolConfig config = new GenericKeyedObjectPoolConfig(); config.setMaxTotal(poolsize); config.setMaxTotalPerKey(poolsize); config.setMaxIdlePerKey(poolsize); pool = new GenericKeyedObjectPool( new PooledMessageContextFactory(this.brokeAddr, Integer.parseInt(this.timeOut))); } public SampleResult runTest(JavaSamplerContext arg0) { boolean flag = true; String err_msg = ""; SampleResult results = new SampleResult(); results.sampleStart(); MessageContext context = null; try { context = (MessageContext)pool.borrowObject(clientID); Message message = Message.create(this.message); message.setProperty(PropertyOption.GROUP, String.valueOf(Math.abs(this.random.nextInt()))); // message.setProperty(PropertyOption.VISIT_PASSWORD, <PASSWORD>); String id = context.send(this.topic, message); context.commit(new String[] { id }); } catch (Exception e) { e.printStackTrace(); err_msg = e.getMessage(); flag = false; }finally{ if(context != null) { try { pool.returnObject(clientID, context); } catch (Exception e) { e.printStackTrace(); } } } results.sampleEnd(); results.setDataEncoding("UTF-8"); results.setSuccessful(flag); results.setResponseMessage(err_msg); return results; } public void teardownTest(JavaSamplerContext arg0) { } }
3,306
0.659414
0.654881
98
32.7551
24.605484
103
false
false
0
0
0
0
0
0
0.72449
false
false
13
d6498694c7701300eabb60872f71bc85e91b1ddf
3,865,470,617,676
b7bc25f62494107989c003be57d543633b410625
/src/main/Main.java
fc378dcf2a0e3b1fe3479b2b1180b336530ccf42
[]
no_license
highlandervova/Project16_3_2
https://github.com/highlandervova/Project16_3_2
bdf2d7eab19cdc66b84132e993cb0a55befc4d9d
7797f57bbaf71e145efa4f5e4b0e02cf93e35283
refs/heads/master
2023-01-29T00:43:16.843000
2020-11-30T19:33:02
2020-11-30T19:33:02
317,320,231
0
0
null
false
2020-12-07T11:45:53
2020-11-30T19:08:21
2020-11-30T19:33:20
2020-12-02T19:30:04
377
0
0
1
Java
false
false
package main; import java.io.*; public class Main { public static void main(String[] args) throws IOException { File f = new File("aaa.txt"); if (!f.exists()) { f.createNewFile(); } try (BufferedReader r = new BufferedReader(new FileReader("aaa.txt")); BufferedWriter w = new BufferedWriter(new FileWriter("c:\\install\\bbb.txt"))) { String s; while ((s = r.readLine()) != null) { w.write(s); w.newLine(); } } File f2 = new File("ccc.dll"); try (InputStream is = new BufferedInputStream(new FileInputStream(f2)); OutputStream os = new BufferedOutputStream(new FileOutputStream(new File("c:\\install\\ddd.txt")))) { int i; while ((i = is.read()) != -1) { os.write(i); } } } }
UTF-8
Java
908
java
Main.java
Java
[]
null
[]
package main; import java.io.*; public class Main { public static void main(String[] args) throws IOException { File f = new File("aaa.txt"); if (!f.exists()) { f.createNewFile(); } try (BufferedReader r = new BufferedReader(new FileReader("aaa.txt")); BufferedWriter w = new BufferedWriter(new FileWriter("c:\\install\\bbb.txt"))) { String s; while ((s = r.readLine()) != null) { w.write(s); w.newLine(); } } File f2 = new File("ccc.dll"); try (InputStream is = new BufferedInputStream(new FileInputStream(f2)); OutputStream os = new BufferedOutputStream(new FileOutputStream(new File("c:\\install\\ddd.txt")))) { int i; while ((i = is.read()) != -1) { os.write(i); } } } }
908
0.505507
0.502203
29
30.310345
28.962643
114
false
false
0
0
0
0
0
0
0.413793
false
false
13
8d338f71b10b91f6aaf963727c36e966b3323931
28,432,683,559,998
9898faa41af35a93dd8ac007188bb47074dbc7a1
/src/main/java/fr/uga/miashs/sempic/dao/GroupFacade.java
21214615c0e2197dc008093f91b9e8e33102aa05
[]
no_license
BettinaGr/JavaEE-AnnotationPhotos
https://github.com/BettinaGr/JavaEE-AnnotationPhotos
8fa5b956a4eef18ae8453ac9116ad977385c6490
3c0ca1feb678025a1a61e89c4ca572d4644ec202
refs/heads/master
2020-12-04T15:53:34.322000
2020-01-17T09:03:24
2020-01-17T09:03:24
231,824,844
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * 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 fr.uga.miashs.sempic.dao; import fr.uga.miashs.sempic.entities.SempicGroup; import javax.ejb.Stateless; import javax.persistence.Query; /** * * @author Jerome David <jerome.david@univ-grenoble-alpes.fr> */ // Exécution de requêtes dans la base de données SempicGroup @Stateless public class GroupFacade extends AbstractJpaFacade<Long,SempicGroup>{ public GroupFacade() { super(SempicGroup.class); } /** * Lie un membre avec un groupe dans la base de données SEMPICGROUP_SEMPICUSER * * @param groupId = id du groupe * @param userId = id de l'utilisateur (du membre) */ public void addMember(long groupId, long userId) { Query q = getEntityManager().createNativeQuery("INSERT INTO SEMPICGROUP_SEMPICUSER(MEMBERS_ID,MEMBEROF_ID) VALUES (?1,?2)"); q.setParameter(1,userId); q.setParameter(2,groupId); q.executeUpdate(); } /** * Supprime un membre d'un groupe dans la base de données SEMPICGROUP_SEMPICUSER * * @param groupId = id du groupe * @param userId = id de l'utilisateur (du membre) */ public void deleteMember(long groupId, long userId) { Query q = getEntityManager().createNativeQuery("DELETE FROM SEMPICGROUP_SEMPICUSER WHERE MEMBERS_ID=?1 AND MEMBEROF_ID=?2"); q.setParameter(1,userId); q.setParameter(2,groupId); q.executeUpdate(); } }
UTF-8
Java
1,611
java
GroupFacade.java
Java
[ { "context": "import javax.persistence.Query;\n\n/**\n *\n * @author Jerome David <jerome.david@univ-grenoble-alpes.fr>\n */\n// Exéc", "end": 361, "score": 0.9998605847358704, "start": 349, "tag": "NAME", "value": "Jerome David" }, { "context": "rsistence.Query;\n\n/**\n *\n * @author Jerome David <jerome.david@univ-grenoble-alpes.fr>\n */\n// Exécution de requêtes dans la base de don", "end": 398, "score": 0.9999261498451233, "start": 363, "tag": "EMAIL", "value": "jerome.david@univ-grenoble-alpes.fr" } ]
null
[]
/* * 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 fr.uga.miashs.sempic.dao; import fr.uga.miashs.sempic.entities.SempicGroup; import javax.ejb.Stateless; import javax.persistence.Query; /** * * @author <NAME> <<EMAIL>> */ // Exécution de requêtes dans la base de données SempicGroup @Stateless public class GroupFacade extends AbstractJpaFacade<Long,SempicGroup>{ public GroupFacade() { super(SempicGroup.class); } /** * Lie un membre avec un groupe dans la base de données SEMPICGROUP_SEMPICUSER * * @param groupId = id du groupe * @param userId = id de l'utilisateur (du membre) */ public void addMember(long groupId, long userId) { Query q = getEntityManager().createNativeQuery("INSERT INTO SEMPICGROUP_SEMPICUSER(MEMBERS_ID,MEMBEROF_ID) VALUES (?1,?2)"); q.setParameter(1,userId); q.setParameter(2,groupId); q.executeUpdate(); } /** * Supprime un membre d'un groupe dans la base de données SEMPICGROUP_SEMPICUSER * * @param groupId = id du groupe * @param userId = id de l'utilisateur (du membre) */ public void deleteMember(long groupId, long userId) { Query q = getEntityManager().createNativeQuery("DELETE FROM SEMPICGROUP_SEMPICUSER WHERE MEMBERS_ID=?1 AND MEMBEROF_ID=?2"); q.setParameter(1,userId); q.setParameter(2,groupId); q.executeUpdate(); } }
1,577
0.679328
0.674346
48
32.458332
31.962841
132
false
false
0
0
0
0
0
0
0.520833
false
false
13
c1d62403d81556a0f7bc5657cde4741f69ccdee0
30,949,534,385,654
58395fb2cd205230a705ba77dec81942d336268f
/src/semashibaev/ifmo/struct/csv/CSVDeserializer.java
af4c0850d4f72a100e54040eb9613926afb93012
[]
no_license
ShibaevSema/First_grade_Java_Laba5
https://github.com/ShibaevSema/First_grade_Java_Laba5
eb9d7f064921d84d5a59853c29ddf31d64ddc443
0fe0e505e170b28deb02a21e29b1011694410908
refs/heads/master
2022-07-22T20:00:22.298000
2020-05-18T11:25:53
2020-05-18T11:25:53
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package semashibaev.ifmo.struct.csv; import semashibaev.ifmo.struct.Movie; import semashibaev.ifmo.struct.Struct; import java.util.Arrays; import java.util.List; public class CSVDeserializer { public static Struct deserialize(String rawData) throws Exception { Struct struct = new Struct(); List<String> objects = Arrays.asList(rawData.split("\n")); if (objects.size() == 0) return struct; String header = objects.get(0); if (!CSVSerializer.header.equals(header)) { throw new Exception("Invalid CSV format"); } for (String line : objects) { if (line.equals("") || header.equals(line)) continue; List<String> params = Arrays.asList(line.split(";", -1)); if (params.size() != CSVSerializer.header.split(";").length) throw new Exception("Invalid CSV format"); String name = params.get(0); String coordX = params.get(1); String coordY = params.get(2); String creationDate = params.get(3); String oscarsCount = params.get(4); String goldenPalmCount = params.get(5); String totalBoxOffice = params.get(6); String mpaaRating = params.get(7); String screenwriter = params.get(8); Movie m = new Movie( name, oscarsCount, goldenPalmCount, totalBoxOffice, coordX, coordY ); m.setCreationDate(creationDate); m.setMpaaRating(mpaaRating); m.setPerson(screenwriter); struct.addFirst(m); } return struct; } }
UTF-8
Java
1,697
java
CSVDeserializer.java
Java
[]
null
[]
package semashibaev.ifmo.struct.csv; import semashibaev.ifmo.struct.Movie; import semashibaev.ifmo.struct.Struct; import java.util.Arrays; import java.util.List; public class CSVDeserializer { public static Struct deserialize(String rawData) throws Exception { Struct struct = new Struct(); List<String> objects = Arrays.asList(rawData.split("\n")); if (objects.size() == 0) return struct; String header = objects.get(0); if (!CSVSerializer.header.equals(header)) { throw new Exception("Invalid CSV format"); } for (String line : objects) { if (line.equals("") || header.equals(line)) continue; List<String> params = Arrays.asList(line.split(";", -1)); if (params.size() != CSVSerializer.header.split(";").length) throw new Exception("Invalid CSV format"); String name = params.get(0); String coordX = params.get(1); String coordY = params.get(2); String creationDate = params.get(3); String oscarsCount = params.get(4); String goldenPalmCount = params.get(5); String totalBoxOffice = params.get(6); String mpaaRating = params.get(7); String screenwriter = params.get(8); Movie m = new Movie( name, oscarsCount, goldenPalmCount, totalBoxOffice, coordX, coordY ); m.setCreationDate(creationDate); m.setMpaaRating(mpaaRating); m.setPerson(screenwriter); struct.addFirst(m); } return struct; } }
1,697
0.571008
0.563936
51
31.274509
24.415583
103
false
false
0
0
0
0
0
0
0.745098
false
false
13
cd3fe181d0f6ac4c8c23c46503758d43117677b0
13,451,837,604,950
e901c58668f3589e567ad1008ec58ca0bde95532
/app/src/main/java/color/kidpaint/com/kidpaintcolor/widget/AspectImageView.java
9203f5356d453ef2bfefe59d213f86d08f69fc49
[]
no_license
nguyenvantung/KidPain
https://github.com/nguyenvantung/KidPain
aa04030d2df37931447fcd050db8a761e3c3b434
3c5c6b9cadcbe899fba2f53cf401064b578409c1
refs/heads/master
2021-01-13T15:49:09.068000
2017-01-06T09:46:41
2017-01-06T09:46:42
76,868,682
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package color.kidpaint.com.kidpaintcolor.widget; import android.content.Context; import android.util.AttributeSet; import android.widget.ImageView; /** * Created by Tung Nguyen on 12/28/2016. */ public class AspectImageView extends ImageView { public AspectImageView(Context context) { super(context); } public AspectImageView(Context context, AttributeSet attrs) { super(context, attrs); } public AspectImageView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { if (widthMeasureSpec > heightMeasureSpec) { setMeasuredDimension(heightMeasureSpec, heightMeasureSpec); } else { setMeasuredDimension(widthMeasureSpec, widthMeasureSpec); } } }
UTF-8
Java
862
java
AspectImageView.java
Java
[ { "context": "mport android.widget.ImageView;\n\n/**\n * Created by Tung Nguyen on 12/28/2016.\n */\npublic class AspectImageView e", "end": 179, "score": 0.9998077154159546, "start": 168, "tag": "NAME", "value": "Tung Nguyen" } ]
null
[]
package color.kidpaint.com.kidpaintcolor.widget; import android.content.Context; import android.util.AttributeSet; import android.widget.ImageView; /** * Created by <NAME> on 12/28/2016. */ public class AspectImageView extends ImageView { public AspectImageView(Context context) { super(context); } public AspectImageView(Context context, AttributeSet attrs) { super(context, attrs); } public AspectImageView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { if (widthMeasureSpec > heightMeasureSpec) { setMeasuredDimension(heightMeasureSpec, heightMeasureSpec); } else { setMeasuredDimension(widthMeasureSpec, widthMeasureSpec); } } }
857
0.704176
0.694896
30
27.733334
25.956287
79
false
false
0
0
0
0
0
0
0.6
false
false
13
7fd83f030f0fdabf814c40fb460efb977483d1ed
25,082,609,055,883
5b38f1739bac2c1374517ba7dbed7272e49c39b5
/src/main/java/cn/hokii/ontheroad/service/UserService.java
e7f288f9718ec945ca1de1aa7f03317156f5b0bc
[]
no_license
Hokiii/ontheroad
https://github.com/Hokiii/ontheroad
3ad129ad40d58d7243dcd4a6392096fda95453d4
cd1a8bad01976b2e800885764e9015c035f001a5
refs/heads/master
2022-06-16T17:23:12.311000
2020-05-06T08:16:04
2020-05-06T08:16:04
261,694,317
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.hokii.ontheroad.service; import cn.hokii.ontheroad.model.Result; import cn.hokii.ontheroad.model.User; import java.util.List; public interface UserService { List<User> getAll(); Result login(User user); User getUserByUserId(int userId); User getUserByPhone(String phone); Result register(User user); Boolean completeInformation(User user); int getUserIdByPhone(String phone); int changePassword(int userId, String newPassword); }
UTF-8
Java
486
java
UserService.java
Java
[]
null
[]
package cn.hokii.ontheroad.service; import cn.hokii.ontheroad.model.Result; import cn.hokii.ontheroad.model.User; import java.util.List; public interface UserService { List<User> getAll(); Result login(User user); User getUserByUserId(int userId); User getUserByPhone(String phone); Result register(User user); Boolean completeInformation(User user); int getUserIdByPhone(String phone); int changePassword(int userId, String newPassword); }
486
0.734568
0.734568
27
17
18.485229
55
false
false
0
0
0
0
0
0
0.481481
false
false
13
5d00fe60088ef236d9ac7a00107cf05b5b479a60
25,082,609,055,221
fb03dac83c6533521ff419340df87df43459f558
/src/main/java/com/codurance/bcn/walking_skeleton/ApplicationConfiguration.java
0a5c4b8accc9796bb4144fbba7e633fab0282caa
[]
no_license
dgraciac/walking-skeleton
https://github.com/dgraciac/walking-skeleton
313de6bcc6143c31058cafcac6e1e589eaad8231
99eaa0e58c39e0b2503057834b2c4c457012a429
refs/heads/master
2020-04-05T09:07:22.121000
2018-11-13T19:11:51
2018-11-13T19:11:51
156,743,663
0
0
null
false
2018-11-13T19:11:52
2018-11-08T17:26:56
2018-11-13T18:36:44
2018-11-13T19:11:51
287
0
1
0
Java
false
null
package com.codurance.bcn.walking_skeleton; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class ApplicationConfiguration { @Bean public ProductRepository dynamoDBProductRepository() { return new DynamoDBProductRepository(); } @Bean public ShoppingBasketService shoppingBasketService() { return new ShoppingBasketService(dynamoDBProductRepository()); } }
UTF-8
Java
486
java
ApplicationConfiguration.java
Java
[]
null
[]
package com.codurance.bcn.walking_skeleton; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class ApplicationConfiguration { @Bean public ProductRepository dynamoDBProductRepository() { return new DynamoDBProductRepository(); } @Bean public ShoppingBasketService shoppingBasketService() { return new ShoppingBasketService(dynamoDBProductRepository()); } }
486
0.77572
0.77572
17
27.588236
25.296032
70
false
false
0
0
0
0
0
0
0.294118
false
false
13
3666c5722c7aec2a3a7ae05111c2e18981685136
558,345,803,819
2717431a1ad8350073d17b5671862c0308df926e
/java/SatoshiDoge/src/satoshidoge/entities/GameDAO.java
ffe8e19e11f0d015d49daef12beaef4acf7c8196
[]
no_license
DevinWiley/Portfolio
https://github.com/DevinWiley/Portfolio
64682fcfa4aeba63f00b372b11e4bd11b051c01e
3ed52d86316dc6b0446045861d9c457bb667c35d
refs/heads/master
2021-01-06T20:37:14.822000
2014-02-06T18:47:42
2014-02-06T18:47:42
16,566,049
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package satoshidoge.entities; import java.math.BigDecimal; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.HashMap; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author Devin */ public class GameDAO extends DAO { public GameDAO(){ super(); } /** * Retrieves the addresses for every game in the Database. * @return Array List containing all the addresses for all of our games. */ public ArrayList<String> retrieveAddresses(){ ArrayList<String> addresses = new ArrayList<>(); try{ String query = "SELECT address FROM game"; PreparedStatement statement = con.prepareStatement(query); ResultSet result = statement.executeQuery(); while (result.next()){ addresses.add(result.getString("address")); } } catch (Exception ex){ System.err.println("Caught Exception: " + ex.getMessage()); } addresses.trimToSize(); return addresses; } public HashMap<String, Game> retrieveGames(){ HashMap<String, Game> games = new HashMap<>(); try { String query = "SELECT * FROM game"; ResultSet result = con.createStatement().executeQuery(query); while (result.next()){ String address = result.getString("address"); BigDecimal minBet = result.getBigDecimal("minBet"); BigDecimal maxBet = result.getBigDecimal("maxBet"); int gameName = result.getInt("gameName"); BigDecimal multiplier = result.getBigDecimal("multiplier"); int id = result.getInt("id"); Game game = new Game(address, minBet, maxBet, gameName, multiplier, id); games.put(address, game); } } catch (SQLException ex) { Logger.getLogger(GameDAO.class.getName()).log(Level.SEVERE, null, ex); } return games; } }
UTF-8
Java
2,095
java
GameDAO.java
Java
[ { "context": "mport java.util.logging.Logger;\n\n/**\n *\n * @author Devin\n */\npublic class GameDAO extends DAO {\n public", "end": 295, "score": 0.9961850643157959, "start": 290, "tag": "NAME", "value": "Devin" } ]
null
[]
package satoshidoge.entities; import java.math.BigDecimal; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.HashMap; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author Devin */ public class GameDAO extends DAO { public GameDAO(){ super(); } /** * Retrieves the addresses for every game in the Database. * @return Array List containing all the addresses for all of our games. */ public ArrayList<String> retrieveAddresses(){ ArrayList<String> addresses = new ArrayList<>(); try{ String query = "SELECT address FROM game"; PreparedStatement statement = con.prepareStatement(query); ResultSet result = statement.executeQuery(); while (result.next()){ addresses.add(result.getString("address")); } } catch (Exception ex){ System.err.println("Caught Exception: " + ex.getMessage()); } addresses.trimToSize(); return addresses; } public HashMap<String, Game> retrieveGames(){ HashMap<String, Game> games = new HashMap<>(); try { String query = "SELECT * FROM game"; ResultSet result = con.createStatement().executeQuery(query); while (result.next()){ String address = result.getString("address"); BigDecimal minBet = result.getBigDecimal("minBet"); BigDecimal maxBet = result.getBigDecimal("maxBet"); int gameName = result.getInt("gameName"); BigDecimal multiplier = result.getBigDecimal("multiplier"); int id = result.getInt("id"); Game game = new Game(address, minBet, maxBet, gameName, multiplier, id); games.put(address, game); } } catch (SQLException ex) { Logger.getLogger(GameDAO.class.getName()).log(Level.SEVERE, null, ex); } return games; } }
2,095
0.598568
0.598568
61
33.344261
24.567661
88
false
false
0
0
0
0
0
0
0.672131
false
false
13
ead2efc193128e69a5eec449f6ff46915a54fed0
20,959,440,453,168
1008511e91d2406a3832c6e41b2fd1b834f642de
/aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/ModifyEbsDefaultKmsKeyIdRequest.java
e51294e5616833bdc75aad8c7a0841340789e043
[ "Apache-2.0" ]
permissive
andrewwiik/aws-sdk-java
https://github.com/andrewwiik/aws-sdk-java
cbb0bad97450bc1a696a1adfa458de28cc1ec298
1c2e57606f5706a26c86c2c9a24c16b490aef9c2
refs/heads/master
2020-06-01T04:32:50.208000
2019-06-05T21:44:29
2019-06-05T21:44:29
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright 2014-2019 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. */ package com.amazonaws.services.ec2.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.AmazonWebServiceRequest; import com.amazonaws.Request; import com.amazonaws.services.ec2.model.transform.ModifyEbsDefaultKmsKeyIdRequestMarshaller; /** * */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class ModifyEbsDefaultKmsKeyIdRequest extends AmazonWebServiceRequest implements Serializable, Cloneable, DryRunSupportedRequest<ModifyEbsDefaultKmsKeyIdRequest> { /** * <p> * An identifier for the AWS Key Management Service (AWS KMS) customer master key (CMK) to use to encrypt the * volume. This parameter is only required if you want to use a customer-managed CMK; if this parameter is not * specified, your AWS-managed CMK for the account is used. If a <code>KmsKeyId</code> is specified, the * <code>Encrypted</code> flag must also be set. * </p> * <p> * The CMK identifier may be provided in any of the following formats: * </p> * <ul> * <li> * <p> * Key ID: For example, key/1234abcd-12ab-34cd-56ef-1234567890ab. * </p> * </li> * <li> * <p> * Key alias: For example, alias/ExampleAlias. * </p> * </li> * <li> * <p> * Key ARN: The key ARN contains the <code>arn:aws:kms</code> namespace, followed by the Region of the CMK, the AWS * account ID of the CMK owner, the <code>key</code> namespace, and then the CMK ID. For example, * arn:aws:kms:<i>us-east-1</i>:<i>012345678910</i>:key/<i>abcd1234-a123-456a-a12b-a123b4cd56ef</i>. * </p> * </li> * <li> * <p> * Alias ARN: The alias ARN contains the <code>arn:aws:kms</code> namespace, followed by the Region of the CMK, the * AWS account ID of the CMK owner, the <code>alias</code> namespace, and then the CMK alias. For example, * arn:aws:kms:<i>us-east-1</i>:<i>012345678910</i>:alias/<i>ExampleAlias</i>. * </p> * </li> * </ul> * <p> * AWS authenticates <code>KmsKeyId</code> asynchronously, meaning that the action you call may appear to complete * even though you provided an invalid identifier. The action will eventually fail. * </p> */ private String kmsKeyId; /** * <p> * An identifier for the AWS Key Management Service (AWS KMS) customer master key (CMK) to use to encrypt the * volume. This parameter is only required if you want to use a customer-managed CMK; if this parameter is not * specified, your AWS-managed CMK for the account is used. If a <code>KmsKeyId</code> is specified, the * <code>Encrypted</code> flag must also be set. * </p> * <p> * The CMK identifier may be provided in any of the following formats: * </p> * <ul> * <li> * <p> * Key ID: For example, key/1234abcd-12ab-34cd-56ef-1234567890ab. * </p> * </li> * <li> * <p> * Key alias: For example, alias/ExampleAlias. * </p> * </li> * <li> * <p> * Key ARN: The key ARN contains the <code>arn:aws:kms</code> namespace, followed by the Region of the CMK, the AWS * account ID of the CMK owner, the <code>key</code> namespace, and then the CMK ID. For example, * arn:aws:kms:<i>us-east-1</i>:<i>012345678910</i>:key/<i>abcd1234-a123-456a-a12b-a123b4cd56ef</i>. * </p> * </li> * <li> * <p> * Alias ARN: The alias ARN contains the <code>arn:aws:kms</code> namespace, followed by the Region of the CMK, the * AWS account ID of the CMK owner, the <code>alias</code> namespace, and then the CMK alias. For example, * arn:aws:kms:<i>us-east-1</i>:<i>012345678910</i>:alias/<i>ExampleAlias</i>. * </p> * </li> * </ul> * <p> * AWS authenticates <code>KmsKeyId</code> asynchronously, meaning that the action you call may appear to complete * even though you provided an invalid identifier. The action will eventually fail. * </p> * * @param kmsKeyId * An identifier for the AWS Key Management Service (AWS KMS) customer master key (CMK) to use to encrypt the * volume. This parameter is only required if you want to use a customer-managed CMK; if this parameter is * not specified, your AWS-managed CMK for the account is used. If a <code>KmsKeyId</code> is specified, the * <code>Encrypted</code> flag must also be set. </p> * <p> * The CMK identifier may be provided in any of the following formats: * </p> * <ul> * <li> * <p> * Key ID: For example, key/1234abcd-12ab-34cd-56ef-1234567890ab. * </p> * </li> * <li> * <p> * Key alias: For example, alias/ExampleAlias. * </p> * </li> * <li> * <p> * Key ARN: The key ARN contains the <code>arn:aws:kms</code> namespace, followed by the Region of the CMK, * the AWS account ID of the CMK owner, the <code>key</code> namespace, and then the CMK ID. For example, * arn:aws:kms:<i>us-east-1</i>:<i>012345678910</i>:key/<i>abcd1234-a123-456a-a12b-a123b4cd56ef</i>. * </p> * </li> * <li> * <p> * Alias ARN: The alias ARN contains the <code>arn:aws:kms</code> namespace, followed by the Region of the * CMK, the AWS account ID of the CMK owner, the <code>alias</code> namespace, and then the CMK alias. For * example, arn:aws:kms:<i>us-east-1</i>:<i>012345678910</i>:alias/<i>ExampleAlias</i>. * </p> * </li> * </ul> * <p> * AWS authenticates <code>KmsKeyId</code> asynchronously, meaning that the action you call may appear to * complete even though you provided an invalid identifier. The action will eventually fail. */ public void setKmsKeyId(String kmsKeyId) { this.kmsKeyId = kmsKeyId; } /** * <p> * An identifier for the AWS Key Management Service (AWS KMS) customer master key (CMK) to use to encrypt the * volume. This parameter is only required if you want to use a customer-managed CMK; if this parameter is not * specified, your AWS-managed CMK for the account is used. If a <code>KmsKeyId</code> is specified, the * <code>Encrypted</code> flag must also be set. * </p> * <p> * The CMK identifier may be provided in any of the following formats: * </p> * <ul> * <li> * <p> * Key ID: For example, key/1234abcd-12ab-34cd-56ef-1234567890ab. * </p> * </li> * <li> * <p> * Key alias: For example, alias/ExampleAlias. * </p> * </li> * <li> * <p> * Key ARN: The key ARN contains the <code>arn:aws:kms</code> namespace, followed by the Region of the CMK, the AWS * account ID of the CMK owner, the <code>key</code> namespace, and then the CMK ID. For example, * arn:aws:kms:<i>us-east-1</i>:<i>012345678910</i>:key/<i>abcd1234-a123-456a-a12b-a123b4cd56ef</i>. * </p> * </li> * <li> * <p> * Alias ARN: The alias ARN contains the <code>arn:aws:kms</code> namespace, followed by the Region of the CMK, the * AWS account ID of the CMK owner, the <code>alias</code> namespace, and then the CMK alias. For example, * arn:aws:kms:<i>us-east-1</i>:<i>012345678910</i>:alias/<i>ExampleAlias</i>. * </p> * </li> * </ul> * <p> * AWS authenticates <code>KmsKeyId</code> asynchronously, meaning that the action you call may appear to complete * even though you provided an invalid identifier. The action will eventually fail. * </p> * * @return An identifier for the AWS Key Management Service (AWS KMS) customer master key (CMK) to use to encrypt * the volume. This parameter is only required if you want to use a customer-managed CMK; if this parameter * is not specified, your AWS-managed CMK for the account is used. If a <code>KmsKeyId</code> is specified, * the <code>Encrypted</code> flag must also be set. </p> * <p> * The CMK identifier may be provided in any of the following formats: * </p> * <ul> * <li> * <p> * Key ID: For example, key/1234abcd-12ab-34cd-56ef-1234567890ab. * </p> * </li> * <li> * <p> * Key alias: For example, alias/ExampleAlias. * </p> * </li> * <li> * <p> * Key ARN: The key ARN contains the <code>arn:aws:kms</code> namespace, followed by the Region of the CMK, * the AWS account ID of the CMK owner, the <code>key</code> namespace, and then the CMK ID. For example, * arn:aws:kms:<i>us-east-1</i>:<i>012345678910</i>:key/<i>abcd1234-a123-456a-a12b-a123b4cd56ef</i>. * </p> * </li> * <li> * <p> * Alias ARN: The alias ARN contains the <code>arn:aws:kms</code> namespace, followed by the Region of the * CMK, the AWS account ID of the CMK owner, the <code>alias</code> namespace, and then the CMK alias. For * example, arn:aws:kms:<i>us-east-1</i>:<i>012345678910</i>:alias/<i>ExampleAlias</i>. * </p> * </li> * </ul> * <p> * AWS authenticates <code>KmsKeyId</code> asynchronously, meaning that the action you call may appear to * complete even though you provided an invalid identifier. The action will eventually fail. */ public String getKmsKeyId() { return this.kmsKeyId; } /** * <p> * An identifier for the AWS Key Management Service (AWS KMS) customer master key (CMK) to use to encrypt the * volume. This parameter is only required if you want to use a customer-managed CMK; if this parameter is not * specified, your AWS-managed CMK for the account is used. If a <code>KmsKeyId</code> is specified, the * <code>Encrypted</code> flag must also be set. * </p> * <p> * The CMK identifier may be provided in any of the following formats: * </p> * <ul> * <li> * <p> * Key ID: For example, key/1234abcd-12ab-34cd-56ef-1234567890ab. * </p> * </li> * <li> * <p> * Key alias: For example, alias/ExampleAlias. * </p> * </li> * <li> * <p> * Key ARN: The key ARN contains the <code>arn:aws:kms</code> namespace, followed by the Region of the CMK, the AWS * account ID of the CMK owner, the <code>key</code> namespace, and then the CMK ID. For example, * arn:aws:kms:<i>us-east-1</i>:<i>012345678910</i>:key/<i>abcd1234-a123-456a-a12b-a123b4cd56ef</i>. * </p> * </li> * <li> * <p> * Alias ARN: The alias ARN contains the <code>arn:aws:kms</code> namespace, followed by the Region of the CMK, the * AWS account ID of the CMK owner, the <code>alias</code> namespace, and then the CMK alias. For example, * arn:aws:kms:<i>us-east-1</i>:<i>012345678910</i>:alias/<i>ExampleAlias</i>. * </p> * </li> * </ul> * <p> * AWS authenticates <code>KmsKeyId</code> asynchronously, meaning that the action you call may appear to complete * even though you provided an invalid identifier. The action will eventually fail. * </p> * * @param kmsKeyId * An identifier for the AWS Key Management Service (AWS KMS) customer master key (CMK) to use to encrypt the * volume. This parameter is only required if you want to use a customer-managed CMK; if this parameter is * not specified, your AWS-managed CMK for the account is used. If a <code>KmsKeyId</code> is specified, the * <code>Encrypted</code> flag must also be set. </p> * <p> * The CMK identifier may be provided in any of the following formats: * </p> * <ul> * <li> * <p> * Key ID: For example, key/1234abcd-12ab-34cd-56ef-1234567890ab. * </p> * </li> * <li> * <p> * Key alias: For example, alias/ExampleAlias. * </p> * </li> * <li> * <p> * Key ARN: The key ARN contains the <code>arn:aws:kms</code> namespace, followed by the Region of the CMK, * the AWS account ID of the CMK owner, the <code>key</code> namespace, and then the CMK ID. For example, * arn:aws:kms:<i>us-east-1</i>:<i>012345678910</i>:key/<i>abcd1234-a123-456a-a12b-a123b4cd56ef</i>. * </p> * </li> * <li> * <p> * Alias ARN: The alias ARN contains the <code>arn:aws:kms</code> namespace, followed by the Region of the * CMK, the AWS account ID of the CMK owner, the <code>alias</code> namespace, and then the CMK alias. For * example, arn:aws:kms:<i>us-east-1</i>:<i>012345678910</i>:alias/<i>ExampleAlias</i>. * </p> * </li> * </ul> * <p> * AWS authenticates <code>KmsKeyId</code> asynchronously, meaning that the action you call may appear to * complete even though you provided an invalid identifier. The action will eventually fail. * @return Returns a reference to this object so that method calls can be chained together. */ public ModifyEbsDefaultKmsKeyIdRequest withKmsKeyId(String kmsKeyId) { setKmsKeyId(kmsKeyId); return this; } /** * This method is intended for internal use only. Returns the marshaled request configured with additional * parameters to enable operation dry-run. */ @Override public Request<ModifyEbsDefaultKmsKeyIdRequest> getDryRunRequest() { Request<ModifyEbsDefaultKmsKeyIdRequest> request = new ModifyEbsDefaultKmsKeyIdRequestMarshaller().marshall(this); request.addParameter("DryRun", Boolean.toString(true)); return request; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getKmsKeyId() != null) sb.append("KmsKeyId: ").append(getKmsKeyId()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ModifyEbsDefaultKmsKeyIdRequest == false) return false; ModifyEbsDefaultKmsKeyIdRequest other = (ModifyEbsDefaultKmsKeyIdRequest) obj; if (other.getKmsKeyId() == null ^ this.getKmsKeyId() == null) return false; if (other.getKmsKeyId() != null && other.getKmsKeyId().equals(this.getKmsKeyId()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getKmsKeyId() == null) ? 0 : getKmsKeyId().hashCode()); return hashCode; } @Override public ModifyEbsDefaultKmsKeyIdRequest clone() { return (ModifyEbsDefaultKmsKeyIdRequest) super.clone(); } }
UTF-8
Java
16,422
java
ModifyEbsDefaultKmsKeyIdRequest.java
Java
[ { "context": " * <li>\n * <p>\n * Key ID: For example, key/1234abcd-12ab-34cd-56ef-1234567890ab.\n * </p>\n * </li>\n * <li>\n * <p>\n", "end": 1730, "score": 0.9885668754577637, "start": 1690, "tag": "KEY", "value": "key/1234abcd-12ab-34cd-56ef-1234567890ab" }, { "context": "s:kms:<i>us-east-1</i>:<i>012345678910</i>:key/<i>abcd1234-a123-456a-a12b-a123b4cd56ef</i>.\n * </p>\n * </li>\n * <li>\n * ", "end": 2200, "score": 0.9924921989440918, "start": 2164, "tag": "KEY", "value": "abcd1234-a123-456a-a12b-a123b4cd56ef" }, { "context": " * <li>\n * <p>\n * Key ID: For example, key/1234abcd-12ab-34cd-56ef-1234567890ab.\n * </p>", "end": 3460, "score": 0.9467528462409973, "start": 3457, "tag": "KEY", "value": "key" }, { "context": " * <li>\n * <p>\n * Key ID: For example, key/1234abcd-12ab-34cd-56ef-1234567890ab.\n * </p>\n", "end": 3460, "score": 0.5379045605659485, "start": 3460, "tag": "KEY", "value": "" }, { "context": "* <li>\n * <p>\n * Key ID: For example, key/1234abcd-12ab-34cd-56ef-1234567890ab.\n * </p>\n * </li>\n * <li>\n * <p>\n", "end": 3497, "score": 0.999245285987854, "start": 3461, "tag": "KEY", "value": "1234abcd-12ab-34cd-56ef-1234567890ab" }, { "context": "s:kms:<i>us-east-1</i>:<i>012345678910</i>:key/<i>abcd1234-a123-456a-a12b-a123b4cd56ef</i>.\n * </p>\n * </li>\n * <li>\n * ", "end": 3967, "score": 0.9971243143081665, "start": 3931, "tag": "KEY", "value": "abcd1234-a123-456a-a12b-a123b4cd56ef" }, { "context": " * <p>\n * Key ID: For example, key/1234abcd-12ab-34cd-56ef-1234567890ab.\n * ", "end": 5271, "score": 0.751003623008728, "start": 5268, "tag": "KEY", "value": "key" }, { "context": " <p>\n * Key ID: For example, key/1234abcd-12ab-34cd-56ef-1234567890ab.\n * ", "end": 5271, "score": 0.6188616752624512, "start": 5271, "tag": "KEY", "value": "" }, { "context": " <p>\n * Key ID: For example, key/1234abcd-12ab-34cd-56ef-1234567890ab.\n * </p>\n * </li>\n * ", "end": 5308, "score": 0.9949504733085632, "start": 5272, "tag": "KEY", "value": "1234abcd-12ab-34cd-56ef-1234567890ab" }, { "context": "s:kms:<i>us-east-1</i>:<i>012345678910</i>:key/<i>abcd1234-a123-456a-a12b-a123b4cd56ef</i>.\n * </p>\n * </li>\n ", "end": 5862, "score": 0.9985420107841492, "start": 5826, "tag": "KEY", "value": "abcd1234-a123-456a-a12b-a123b4cd56ef" }, { "context": " * <li>\n * <p>\n * Key ID: For example, key/1234abcd-12ab-34cd-56ef-1234567890ab.\n * </p>", "end": 7260, "score": 0.9741045832633972, "start": 7257, "tag": "KEY", "value": "key" }, { "context": " * <li>\n * <p>\n * Key ID: For example, key/1234abcd-12ab-34cd-56ef-1234567890ab.\n * </p>\n * </li>\n * <li>\n * <p>\n", "end": 7297, "score": 0.9852367639541626, "start": 7261, "tag": "KEY", "value": "1234abcd-12ab-34cd-56ef-1234567890ab" }, { "context": "s:kms:<i>us-east-1</i>:<i>012345678910</i>:key/<i>abcd1234-a123-456a-a12b-a123b4cd56ef</i>.\n * </p>\n * </li>\n * <li>\n * ", "end": 7767, "score": 0.9981945753097534, "start": 7731, "tag": "KEY", "value": "abcd1234-a123-456a-a12b-a123b4cd56ef" }, { "context": " * <p>\n * Key ID: For example, key/1234abcd-12ab-34cd-56ef-1234567890ab.\n * ", "end": 9059, "score": 0.9883683323860168, "start": 9056, "tag": "KEY", "value": "key" }, { "context": " <p>\n * Key ID: For example, key/1234abcd-12ab-34cd-56ef-1234567890ab.\n * </p>\n * </li>\n * ", "end": 9096, "score": 0.9835587739944458, "start": 9060, "tag": "KEY", "value": "1234abcd-12ab-34cd-56ef-1234567890ab" }, { "context": "s:kms:<i>us-east-1</i>:<i>012345678910</i>:key/<i>abcd1234-a123-456a-a12b-a123b4cd56ef</i>.\n * </p>\n * ", "end": 9648, "score": 0.9966151714324951, "start": 9626, "tag": "KEY", "value": "abcd1234-a123-456a-a12" }, { "context": "* <li>\n * <p>\n * Key ID: For example, key/1234abcd-12ab-34cd-56ef-1234567890ab.\n * </p>\n * </li>\n * <li>\n * <p>\n", "end": 11093, "score": 0.998694658279419, "start": 11057, "tag": "KEY", "value": "1234abcd-12ab-34cd-56ef-1234567890ab" }, { "context": "s:kms:<i>us-east-1</i>:<i>012345678910</i>:key/<i>abcd1234-a123-456a-a12b-a123b4cd56ef</i>.\n * </p>\n ", "end": 11535, "score": 0.8659673929214478, "start": 11527, "tag": "KEY", "value": "abcd1234" }, { "context": "us-east-1</i>:<i>012345678910</i>:key/<i>abcd1234-a123-456a-a12b-a123b4cd56ef</i>.\n * </p>\n * </", "end": 11540, "score": 0.8046743273735046, "start": 11536, "tag": "KEY", "value": "a123" }, { "context": "st-1</i>:<i>012345678910</i>:key/<i>abcd1234-a123-456a-a12b-a123b4cd56ef</i>.\n * </p>\n * </li>\n ", "end": 11545, "score": 0.8057123422622681, "start": 11541, "tag": "KEY", "value": "456a" }, { "context": "/i>:<i>012345678910</i>:key/<i>abcd1234-a123-456a-a12b-a123b4cd56ef</i>.\n * </p>\n * </li>\n *", "end": 11550, "score": 0.6757835149765015, "start": 11546, "tag": "KEY", "value": "a12b" }, { "context": "i>012345678910</i>:key/<i>abcd1234-a123-456a-a12b-a123b4cd56ef</i>.\n * </p>\n * </li>\n * <", "end": 11552, "score": 0.5329664945602417, "start": 11551, "tag": "KEY", "value": "a" }, { "context": "012345678910</i>:key/<i>abcd1234-a123-456a-a12b-a123b4cd56ef</i>.\n * </p>\n * </li>\n * <li>\n * ", "end": 11563, "score": 0.5802069902420044, "start": 11553, "tag": "KEY", "value": "23b4cd56ef" }, { "context": " * <p>\n * Key ID: For example, key/1234abcd-12ab-34cd-56ef-1234567890ab.\n * ", "end": 12867, "score": 0.9815100431442261, "start": 12864, "tag": "KEY", "value": "key" }, { "context": " <p>\n * Key ID: For example, key/1234abcd-12ab-34cd-56ef-1234567890ab.\n * </p>\n * </li>\n *", "end": 12901, "score": 0.9798021912574768, "start": 12868, "tag": "KEY", "value": "1234abcd-12ab-34cd-56ef-123456789" }, { "context": "s:kms:<i>us-east-1</i>:<i>012345678910</i>:key/<i>abcd1234-a123-456a-a12b-a123b4cd56ef</i>.\n * </p>\n * </li>\n ", "end": 13458, "score": 0.9104535579681396, "start": 13422, "tag": "KEY", "value": "abcd1234-a123-456a-a12b-a123b4cd56ef" } ]
null
[]
/* * Copyright 2014-2019 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. */ package com.amazonaws.services.ec2.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.AmazonWebServiceRequest; import com.amazonaws.Request; import com.amazonaws.services.ec2.model.transform.ModifyEbsDefaultKmsKeyIdRequestMarshaller; /** * */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class ModifyEbsDefaultKmsKeyIdRequest extends AmazonWebServiceRequest implements Serializable, Cloneable, DryRunSupportedRequest<ModifyEbsDefaultKmsKeyIdRequest> { /** * <p> * An identifier for the AWS Key Management Service (AWS KMS) customer master key (CMK) to use to encrypt the * volume. This parameter is only required if you want to use a customer-managed CMK; if this parameter is not * specified, your AWS-managed CMK for the account is used. If a <code>KmsKeyId</code> is specified, the * <code>Encrypted</code> flag must also be set. * </p> * <p> * The CMK identifier may be provided in any of the following formats: * </p> * <ul> * <li> * <p> * Key ID: For example, key/1234abcd-12ab-34cd-56ef-1234567890ab. * </p> * </li> * <li> * <p> * Key alias: For example, alias/ExampleAlias. * </p> * </li> * <li> * <p> * Key ARN: The key ARN contains the <code>arn:aws:kms</code> namespace, followed by the Region of the CMK, the AWS * account ID of the CMK owner, the <code>key</code> namespace, and then the CMK ID. For example, * arn:aws:kms:<i>us-east-1</i>:<i>012345678910</i>:key/<i><KEY></i>. * </p> * </li> * <li> * <p> * Alias ARN: The alias ARN contains the <code>arn:aws:kms</code> namespace, followed by the Region of the CMK, the * AWS account ID of the CMK owner, the <code>alias</code> namespace, and then the CMK alias. For example, * arn:aws:kms:<i>us-east-1</i>:<i>012345678910</i>:alias/<i>ExampleAlias</i>. * </p> * </li> * </ul> * <p> * AWS authenticates <code>KmsKeyId</code> asynchronously, meaning that the action you call may appear to complete * even though you provided an invalid identifier. The action will eventually fail. * </p> */ private String kmsKeyId; /** * <p> * An identifier for the AWS Key Management Service (AWS KMS) customer master key (CMK) to use to encrypt the * volume. This parameter is only required if you want to use a customer-managed CMK; if this parameter is not * specified, your AWS-managed CMK for the account is used. If a <code>KmsKeyId</code> is specified, the * <code>Encrypted</code> flag must also be set. * </p> * <p> * The CMK identifier may be provided in any of the following formats: * </p> * <ul> * <li> * <p> * Key ID: For example, key/<KEY>. * </p> * </li> * <li> * <p> * Key alias: For example, alias/ExampleAlias. * </p> * </li> * <li> * <p> * Key ARN: The key ARN contains the <code>arn:aws:kms</code> namespace, followed by the Region of the CMK, the AWS * account ID of the CMK owner, the <code>key</code> namespace, and then the CMK ID. For example, * arn:aws:kms:<i>us-east-1</i>:<i>012345678910</i>:key/<i><KEY></i>. * </p> * </li> * <li> * <p> * Alias ARN: The alias ARN contains the <code>arn:aws:kms</code> namespace, followed by the Region of the CMK, the * AWS account ID of the CMK owner, the <code>alias</code> namespace, and then the CMK alias. For example, * arn:aws:kms:<i>us-east-1</i>:<i>012345678910</i>:alias/<i>ExampleAlias</i>. * </p> * </li> * </ul> * <p> * AWS authenticates <code>KmsKeyId</code> asynchronously, meaning that the action you call may appear to complete * even though you provided an invalid identifier. The action will eventually fail. * </p> * * @param kmsKeyId * An identifier for the AWS Key Management Service (AWS KMS) customer master key (CMK) to use to encrypt the * volume. This parameter is only required if you want to use a customer-managed CMK; if this parameter is * not specified, your AWS-managed CMK for the account is used. If a <code>KmsKeyId</code> is specified, the * <code>Encrypted</code> flag must also be set. </p> * <p> * The CMK identifier may be provided in any of the following formats: * </p> * <ul> * <li> * <p> * Key ID: For example, key/<KEY>. * </p> * </li> * <li> * <p> * Key alias: For example, alias/ExampleAlias. * </p> * </li> * <li> * <p> * Key ARN: The key ARN contains the <code>arn:aws:kms</code> namespace, followed by the Region of the CMK, * the AWS account ID of the CMK owner, the <code>key</code> namespace, and then the CMK ID. For example, * arn:aws:kms:<i>us-east-1</i>:<i>012345678910</i>:key/<i><KEY></i>. * </p> * </li> * <li> * <p> * Alias ARN: The alias ARN contains the <code>arn:aws:kms</code> namespace, followed by the Region of the * CMK, the AWS account ID of the CMK owner, the <code>alias</code> namespace, and then the CMK alias. For * example, arn:aws:kms:<i>us-east-1</i>:<i>012345678910</i>:alias/<i>ExampleAlias</i>. * </p> * </li> * </ul> * <p> * AWS authenticates <code>KmsKeyId</code> asynchronously, meaning that the action you call may appear to * complete even though you provided an invalid identifier. The action will eventually fail. */ public void setKmsKeyId(String kmsKeyId) { this.kmsKeyId = kmsKeyId; } /** * <p> * An identifier for the AWS Key Management Service (AWS KMS) customer master key (CMK) to use to encrypt the * volume. This parameter is only required if you want to use a customer-managed CMK; if this parameter is not * specified, your AWS-managed CMK for the account is used. If a <code>KmsKeyId</code> is specified, the * <code>Encrypted</code> flag must also be set. * </p> * <p> * The CMK identifier may be provided in any of the following formats: * </p> * <ul> * <li> * <p> * Key ID: For example, key/<KEY>. * </p> * </li> * <li> * <p> * Key alias: For example, alias/ExampleAlias. * </p> * </li> * <li> * <p> * Key ARN: The key ARN contains the <code>arn:aws:kms</code> namespace, followed by the Region of the CMK, the AWS * account ID of the CMK owner, the <code>key</code> namespace, and then the CMK ID. For example, * arn:aws:kms:<i>us-east-1</i>:<i>012345678910</i>:key/<i><KEY></i>. * </p> * </li> * <li> * <p> * Alias ARN: The alias ARN contains the <code>arn:aws:kms</code> namespace, followed by the Region of the CMK, the * AWS account ID of the CMK owner, the <code>alias</code> namespace, and then the CMK alias. For example, * arn:aws:kms:<i>us-east-1</i>:<i>012345678910</i>:alias/<i>ExampleAlias</i>. * </p> * </li> * </ul> * <p> * AWS authenticates <code>KmsKeyId</code> asynchronously, meaning that the action you call may appear to complete * even though you provided an invalid identifier. The action will eventually fail. * </p> * * @return An identifier for the AWS Key Management Service (AWS KMS) customer master key (CMK) to use to encrypt * the volume. This parameter is only required if you want to use a customer-managed CMK; if this parameter * is not specified, your AWS-managed CMK for the account is used. If a <code>KmsKeyId</code> is specified, * the <code>Encrypted</code> flag must also be set. </p> * <p> * The CMK identifier may be provided in any of the following formats: * </p> * <ul> * <li> * <p> * Key ID: For example, key/<KEY>. * </p> * </li> * <li> * <p> * Key alias: For example, alias/ExampleAlias. * </p> * </li> * <li> * <p> * Key ARN: The key ARN contains the <code>arn:aws:kms</code> namespace, followed by the Region of the CMK, * the AWS account ID of the CMK owner, the <code>key</code> namespace, and then the CMK ID. For example, * arn:aws:kms:<i>us-east-1</i>:<i>012345678910</i>:key/<i><KEY>b-a123b4cd56ef</i>. * </p> * </li> * <li> * <p> * Alias ARN: The alias ARN contains the <code>arn:aws:kms</code> namespace, followed by the Region of the * CMK, the AWS account ID of the CMK owner, the <code>alias</code> namespace, and then the CMK alias. For * example, arn:aws:kms:<i>us-east-1</i>:<i>012345678910</i>:alias/<i>ExampleAlias</i>. * </p> * </li> * </ul> * <p> * AWS authenticates <code>KmsKeyId</code> asynchronously, meaning that the action you call may appear to * complete even though you provided an invalid identifier. The action will eventually fail. */ public String getKmsKeyId() { return this.kmsKeyId; } /** * <p> * An identifier for the AWS Key Management Service (AWS KMS) customer master key (CMK) to use to encrypt the * volume. This parameter is only required if you want to use a customer-managed CMK; if this parameter is not * specified, your AWS-managed CMK for the account is used. If a <code>KmsKeyId</code> is specified, the * <code>Encrypted</code> flag must also be set. * </p> * <p> * The CMK identifier may be provided in any of the following formats: * </p> * <ul> * <li> * <p> * Key ID: For example, key/<KEY>. * </p> * </li> * <li> * <p> * Key alias: For example, alias/ExampleAlias. * </p> * </li> * <li> * <p> * Key ARN: The key ARN contains the <code>arn:aws:kms</code> namespace, followed by the Region of the CMK, the AWS * account ID of the CMK owner, the <code>key</code> namespace, and then the CMK ID. For example, * arn:aws:kms:<i>us-east-1</i>:<i>012345678910</i>:key/<i>abcd1234-a123-456a-a12b-a1<KEY></i>. * </p> * </li> * <li> * <p> * Alias ARN: The alias ARN contains the <code>arn:aws:kms</code> namespace, followed by the Region of the CMK, the * AWS account ID of the CMK owner, the <code>alias</code> namespace, and then the CMK alias. For example, * arn:aws:kms:<i>us-east-1</i>:<i>012345678910</i>:alias/<i>ExampleAlias</i>. * </p> * </li> * </ul> * <p> * AWS authenticates <code>KmsKeyId</code> asynchronously, meaning that the action you call may appear to complete * even though you provided an invalid identifier. The action will eventually fail. * </p> * * @param kmsKeyId * An identifier for the AWS Key Management Service (AWS KMS) customer master key (CMK) to use to encrypt the * volume. This parameter is only required if you want to use a customer-managed CMK; if this parameter is * not specified, your AWS-managed CMK for the account is used. If a <code>KmsKeyId</code> is specified, the * <code>Encrypted</code> flag must also be set. </p> * <p> * The CMK identifier may be provided in any of the following formats: * </p> * <ul> * <li> * <p> * Key ID: For example, key/<KEY>0ab. * </p> * </li> * <li> * <p> * Key alias: For example, alias/ExampleAlias. * </p> * </li> * <li> * <p> * Key ARN: The key ARN contains the <code>arn:aws:kms</code> namespace, followed by the Region of the CMK, * the AWS account ID of the CMK owner, the <code>key</code> namespace, and then the CMK ID. For example, * arn:aws:kms:<i>us-east-1</i>:<i>012345678910</i>:key/<i><KEY></i>. * </p> * </li> * <li> * <p> * Alias ARN: The alias ARN contains the <code>arn:aws:kms</code> namespace, followed by the Region of the * CMK, the AWS account ID of the CMK owner, the <code>alias</code> namespace, and then the CMK alias. For * example, arn:aws:kms:<i>us-east-1</i>:<i>012345678910</i>:alias/<i>ExampleAlias</i>. * </p> * </li> * </ul> * <p> * AWS authenticates <code>KmsKeyId</code> asynchronously, meaning that the action you call may appear to * complete even though you provided an invalid identifier. The action will eventually fail. * @return Returns a reference to this object so that method calls can be chained together. */ public ModifyEbsDefaultKmsKeyIdRequest withKmsKeyId(String kmsKeyId) { setKmsKeyId(kmsKeyId); return this; } /** * This method is intended for internal use only. Returns the marshaled request configured with additional * parameters to enable operation dry-run. */ @Override public Request<ModifyEbsDefaultKmsKeyIdRequest> getDryRunRequest() { Request<ModifyEbsDefaultKmsKeyIdRequest> request = new ModifyEbsDefaultKmsKeyIdRequestMarshaller().marshall(this); request.addParameter("DryRun", Boolean.toString(true)); return request; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getKmsKeyId() != null) sb.append("KmsKeyId: ").append(getKmsKeyId()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ModifyEbsDefaultKmsKeyIdRequest == false) return false; ModifyEbsDefaultKmsKeyIdRequest other = (ModifyEbsDefaultKmsKeyIdRequest) obj; if (other.getKmsKeyId() == null ^ this.getKmsKeyId() == null) return false; if (other.getKmsKeyId() != null && other.getKmsKeyId().equals(this.getKmsKeyId()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getKmsKeyId() == null) ? 0 : getKmsKeyId().hashCode()); return hashCode; } @Override public ModifyEbsDefaultKmsKeyIdRequest clone() { return (ModifyEbsDefaultKmsKeyIdRequest) super.clone(); } }
16,062
0.597065
0.568688
384
41.765625
41.383839
122
false
false
0
0
0
0
0
0
0.390625
false
false
13