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
8f404faa1aa8a5b38954e25e50b83f82319ceebd
30,030,411,350,090
0439d15708df124532f83ae8ef3fab8f508c6258
/src/com/controller/TrainController.java
35a53322b39453ec43c2844575427484f53247a4
[]
no_license
ansavchenco/TrainTickets
https://github.com/ansavchenco/TrainTickets
390a6b25feac5e20c83cbafaa1dc5313e6598a42
d4ded903ef78405fe3084b551a9bce070162b601
refs/heads/master
2021-08-31T08:18:33.450000
2017-12-20T18:55:50
2017-12-20T18:55:50
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.controller; import com.dao.daoImpl.GenericDaoImpl; import com.domain.Train; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.Parent; import javafx.scene.control.*; import javafx.scene.control.cell.PropertyValueFactory; import java.util.Optional; public class TrainController { private ObservableList<Train> trainList = FXCollections.observableArrayList(); @FXML protected TableView<Train> trainTable; @FXML protected TableColumn<Train, String> trainNumberColumn; @FXML protected TableColumn<Train, String> departureColumn; @FXML protected TableColumn<Train, String> destinationColumn; @FXML protected TextField trainNumberField; @FXML protected TextField departureField; @FXML protected TextField destinationField; @FXML public Parent carEditor; @FXML private CarController carEditorController; @FXML private void initialize() { initData(); trainNumberColumn.setCellValueFactory(new PropertyValueFactory<Train, String>("number")); departureColumn.setCellValueFactory(new PropertyValueFactory<Train, String>("departure")); destinationColumn.setCellValueFactory(new PropertyValueFactory<Train, String>("destination")); trainTable.setItems(trainList); } private void initData() { GenericDaoImpl<Train, Integer> trainDao = new GenericDaoImpl<Train, Integer>(Train.class); trainList.addAll(trainDao.list()); setTrainRowFactory(); } private void setTrainRowFactory() { trainTable.setRowFactory(tv -> { TableRow<Train> row = new TableRow<>(); row.setOnMouseClicked(event -> { if (event.getClickCount() == 2 && (!row.isEmpty())) { trainNumberField.setText(row.getItem().getNumber()); departureField.setText(row.getItem().getDeparture()); destinationField.setText(row.getItem().getDestination()); selectedTrain = row.getItem(); } else { trainNumberField.setText(""); departureField.setText(""); destinationField.setText(""); } if (event.getClickCount() == 1 && (!row.isEmpty())) { selectedTrain = row.getItem(); carEditorController.getCarList().setAll(selectedTrain.getCarsById()); } }); return row; }); } private Train selectedTrain; @FXML public void addTrain(ActionEvent actionEvent) { if ((trainNumberField.getText() == null || trainNumberField.getText().trim().isEmpty()) || (departureField.getText() == null || departureField.getText().trim().isEmpty()) || (destinationField.getText() == null || destinationField.getText().trim().isEmpty())) { Alert error = new Alert(Alert.AlertType.ERROR); error.setHeaderText("Данные не добавлены"); error.setContentText("Все поля должны быть заполнены!"); error.showAndWait(); } else { Train train = new Train( trainNumberField.getText(), departureField.getText(), destinationField.getText() ); GenericDaoImpl<Train, Integer> trainDao = new GenericDaoImpl<Train, Integer>(Train.class); train.setId(trainDao.save(train)); trainList.add(trainDao.get(train.getId())); trainNumberField.setText(""); departureField.setText(""); destinationField.setText(""); } } @FXML public void deleteTrain(ActionEvent actionEvent) { Train train = trainTable.getSelectionModel().getSelectedItem(); if (train != null) { Alert alert = new Alert(Alert.AlertType.CONFIRMATION); alert.setTitle("Подтверждение"); alert.setHeaderText(null); alert.setContentText("Вы действительно хотите удалить этот поезд?"); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == ButtonType.OK) { GenericDaoImpl<Train, Integer> trainDao = new GenericDaoImpl<Train, Integer>(Train.class); trainDao.delete(train); trainList.remove(train); } else { alert.close(); } } else { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setHeaderText("Поезд не выбран"); alert.setContentText("Пожалуйста, выберите поезд"); alert.showAndWait(); } } @FXML public void updateTrain(ActionEvent actionEvent) { try { GenericDaoImpl<Train, Integer> trainDao = new GenericDaoImpl<Train, Integer>(Train.class); selectedTrain.setNumber(trainNumberField.getText()); selectedTrain.setDeparture(departureField.getText()); selectedTrain.setDestination(destinationField.getText()); trainDao.update(selectedTrain); trainTable.refresh(); } catch (NullPointerException e) { Alert error = new Alert(Alert.AlertType.ERROR); error.setHeaderText("Нечего обновлять"); error.setContentText("Пожалуйста, выберите поезд"); error.showAndWait(); } } protected Train getSelectedTrain() { return selectedTrain; } }
UTF-8
Java
5,805
java
TrainController.java
Java
[]
null
[]
package com.controller; import com.dao.daoImpl.GenericDaoImpl; import com.domain.Train; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.Parent; import javafx.scene.control.*; import javafx.scene.control.cell.PropertyValueFactory; import java.util.Optional; public class TrainController { private ObservableList<Train> trainList = FXCollections.observableArrayList(); @FXML protected TableView<Train> trainTable; @FXML protected TableColumn<Train, String> trainNumberColumn; @FXML protected TableColumn<Train, String> departureColumn; @FXML protected TableColumn<Train, String> destinationColumn; @FXML protected TextField trainNumberField; @FXML protected TextField departureField; @FXML protected TextField destinationField; @FXML public Parent carEditor; @FXML private CarController carEditorController; @FXML private void initialize() { initData(); trainNumberColumn.setCellValueFactory(new PropertyValueFactory<Train, String>("number")); departureColumn.setCellValueFactory(new PropertyValueFactory<Train, String>("departure")); destinationColumn.setCellValueFactory(new PropertyValueFactory<Train, String>("destination")); trainTable.setItems(trainList); } private void initData() { GenericDaoImpl<Train, Integer> trainDao = new GenericDaoImpl<Train, Integer>(Train.class); trainList.addAll(trainDao.list()); setTrainRowFactory(); } private void setTrainRowFactory() { trainTable.setRowFactory(tv -> { TableRow<Train> row = new TableRow<>(); row.setOnMouseClicked(event -> { if (event.getClickCount() == 2 && (!row.isEmpty())) { trainNumberField.setText(row.getItem().getNumber()); departureField.setText(row.getItem().getDeparture()); destinationField.setText(row.getItem().getDestination()); selectedTrain = row.getItem(); } else { trainNumberField.setText(""); departureField.setText(""); destinationField.setText(""); } if (event.getClickCount() == 1 && (!row.isEmpty())) { selectedTrain = row.getItem(); carEditorController.getCarList().setAll(selectedTrain.getCarsById()); } }); return row; }); } private Train selectedTrain; @FXML public void addTrain(ActionEvent actionEvent) { if ((trainNumberField.getText() == null || trainNumberField.getText().trim().isEmpty()) || (departureField.getText() == null || departureField.getText().trim().isEmpty()) || (destinationField.getText() == null || destinationField.getText().trim().isEmpty())) { Alert error = new Alert(Alert.AlertType.ERROR); error.setHeaderText("Данные не добавлены"); error.setContentText("Все поля должны быть заполнены!"); error.showAndWait(); } else { Train train = new Train( trainNumberField.getText(), departureField.getText(), destinationField.getText() ); GenericDaoImpl<Train, Integer> trainDao = new GenericDaoImpl<Train, Integer>(Train.class); train.setId(trainDao.save(train)); trainList.add(trainDao.get(train.getId())); trainNumberField.setText(""); departureField.setText(""); destinationField.setText(""); } } @FXML public void deleteTrain(ActionEvent actionEvent) { Train train = trainTable.getSelectionModel().getSelectedItem(); if (train != null) { Alert alert = new Alert(Alert.AlertType.CONFIRMATION); alert.setTitle("Подтверждение"); alert.setHeaderText(null); alert.setContentText("Вы действительно хотите удалить этот поезд?"); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == ButtonType.OK) { GenericDaoImpl<Train, Integer> trainDao = new GenericDaoImpl<Train, Integer>(Train.class); trainDao.delete(train); trainList.remove(train); } else { alert.close(); } } else { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setHeaderText("Поезд не выбран"); alert.setContentText("Пожалуйста, выберите поезд"); alert.showAndWait(); } } @FXML public void updateTrain(ActionEvent actionEvent) { try { GenericDaoImpl<Train, Integer> trainDao = new GenericDaoImpl<Train, Integer>(Train.class); selectedTrain.setNumber(trainNumberField.getText()); selectedTrain.setDeparture(departureField.getText()); selectedTrain.setDestination(destinationField.getText()); trainDao.update(selectedTrain); trainTable.refresh(); } catch (NullPointerException e) { Alert error = new Alert(Alert.AlertType.ERROR); error.setHeaderText("Нечего обновлять"); error.setContentText("Пожалуйста, выберите поезд"); error.showAndWait(); } } protected Train getSelectedTrain() { return selectedTrain; } }
5,805
0.612096
0.611742
173
31.589596
28.926043
106
false
false
0
0
0
0
0
0
0.618497
false
false
0
b1311fcfd78aa929d33fa37441a300225b72e37a
6,846,177,878,819
44622de1ca4db2ae9992320735c6e55c38a1283b
/src/main/java/dong/example/amsfirst/service/impl/CSPRequestServiceImpl.java
d6110a44d36d9a1fe9f95f97533622758a9a2e71
[]
no_license
51627434/amsfirst
https://github.com/51627434/amsfirst
077e1a1b9838ea12847b3ffe7fe6e9f09e1bb273
65b502ec55774425315e3d73a1c017344a1855d7
refs/heads/master
2021-02-24T09:52:40.393000
2020-03-07T10:27:45
2020-03-07T10:27:45
245,428,078
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package dong.example.amsfirst.service.impl; import dong.example.amsfirst.dao.CsprequestserviceMapper; import dong.example.amsfirst.pojo.CsprequestservicePo; import dong.example.amsfirst.pojo.ExecCmdReqPo; import dong.example.amsfirst.pojo.ExecCmdResPo; import dong.example.amsfirst.service.ICSPRequestService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service("cspRequestService") public class CSPRequestServiceImpl implements ICSPRequestService { @Autowired private CsprequestserviceMapper csprequestserviceMapper; @Override public ExecCmdResPo reciveCSPRequestService(ExecCmdReqPo execCmdReqPo) { CsprequestservicePo csprequestservicePo = new CsprequestservicePo(); csprequestservicePo.setCspId(execCmdReqPo.getCspId()); csprequestservicePo.setLspId(execCmdReqPo.getLspId()); csprequestservicePo.setCorrelateId(execCmdReqPo.getCorrelateId()); csprequestservicePo.setCmdFileUrl(execCmdReqPo.getCmdFileUrl()); csprequestserviceMapper.insert(csprequestservicePo); ExecCmdResPo execCmdResPo = new ExecCmdResPo(); execCmdResPo.setResult(0); execCmdResPo.setErrorDescription("成功"+execCmdReqPo.getCorrelateId()); System.out.println("service-----CSPRequestServiceImpl----reciveCSPRequestService"+"成功"+execCmdReqPo.getCorrelateId()); return execCmdResPo; } }
UTF-8
Java
1,451
java
CSPRequestServiceImpl.java
Java
[]
null
[]
package dong.example.amsfirst.service.impl; import dong.example.amsfirst.dao.CsprequestserviceMapper; import dong.example.amsfirst.pojo.CsprequestservicePo; import dong.example.amsfirst.pojo.ExecCmdReqPo; import dong.example.amsfirst.pojo.ExecCmdResPo; import dong.example.amsfirst.service.ICSPRequestService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service("cspRequestService") public class CSPRequestServiceImpl implements ICSPRequestService { @Autowired private CsprequestserviceMapper csprequestserviceMapper; @Override public ExecCmdResPo reciveCSPRequestService(ExecCmdReqPo execCmdReqPo) { CsprequestservicePo csprequestservicePo = new CsprequestservicePo(); csprequestservicePo.setCspId(execCmdReqPo.getCspId()); csprequestservicePo.setLspId(execCmdReqPo.getLspId()); csprequestservicePo.setCorrelateId(execCmdReqPo.getCorrelateId()); csprequestservicePo.setCmdFileUrl(execCmdReqPo.getCmdFileUrl()); csprequestserviceMapper.insert(csprequestservicePo); ExecCmdResPo execCmdResPo = new ExecCmdResPo(); execCmdResPo.setResult(0); execCmdResPo.setErrorDescription("成功"+execCmdReqPo.getCorrelateId()); System.out.println("service-----CSPRequestServiceImpl----reciveCSPRequestService"+"成功"+execCmdReqPo.getCorrelateId()); return execCmdResPo; } }
1,451
0.785863
0.78517
39
36
32.307022
126
false
false
0
0
0
0
0
0
0.512821
false
false
0
c57d9766c4bfaab7da20be2b4852711b370695e0
22,832,046,151,365
1524195abbf1d475cdb1483e1e9b1877d868ab8a
/Proyect/src/main/java/DAOS/PagoDAO.java
ba9dafe550814b8390cdea185282466db7d43980
[]
no_license
Demafia2326/ProyectHibernate
https://github.com/Demafia2326/ProyectHibernate
6df92c897c8f72b5f3c0f86e617517ec5bfd5535
b8cbc811394cdae93950e1cb296ea3edb7b4995f
refs/heads/master
2022-03-09T15:58:07.196000
2019-12-11T21:39:51
2019-12-11T21:39:51
227,464,321
0
0
null
false
2022-01-21T23:35:07
2019-12-11T21:32:17
2019-12-11T21:39:54
2022-01-21T23:35:05
24
0
0
2
Java
false
false
/* * 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 DAOS; import Model.Colaborador; import Model.Conexion; import Model.Pago; import java.sql.Date; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.logging.Level; import java.util.logging.Logger; import org.h2.engine.Session; /** * * @author Daniel Pérez Ramírez */ public class PagoDAO { public static Conexion miConexion = Conexion.getInstance(); public static ResultSet mostrar(int cod) throws SQLException { //Que pida un nombre y lo busque int nFilas = 0; String lineaSQL = "Select * from pago WHERE codigo LIKE '%"+ cod +"%';" ; ResultSet resultado = Conexion.getInstance().execute_Select(lineaSQL); return resultado; } public static boolean crear(int num,String conc,int cant,String fp,String nif) throws SQLException, ParseException { boolean insertados = true; int i; Pago cob; //Cadena donde irán las sentencias sql de creación de tablas String lineaSQL; //Objeto de tipo Statement Statement sentencia = null; Date fechai=(Date) new SimpleDateFormat("dd/MM/yyyy").parse(fp); //comando sql generico para la inserción lineaSQL = "INSERT INTO pago (id, numero, concepto,cantidad,fecha_pago,nif_colaborador) values (NULL, ?, ?,?,?,?)"; //conectamos el objeto preparedStmt a la base de datos PreparedStatement preparedStmt = miConexion.getConexion().prepareStatement(lineaSQL); //creamos un nuevo socio cob = new Pago(num, conc,cant,fechai); preparedStmt.setInt(1, cob.getNumero()); preparedStmt.setString(2, cob.getConcepto()); preparedStmt.setInt(3, cob.getCantidad()); preparedStmt.setDate(4, cob.getFechaPago()); preparedStmt.setString(5, nif); // la ejecutamos preparedStmt.execute(); // habría que cerrar la conexion return insertados; } public static ResultSet mostrarTodos() throws SQLException { int nFilas = 0; String lineaSQL = "Select * from pago;" ; ResultSet resultado = Conexion.getInstance().execute_Select(lineaSQL); return resultado; } public static void modificar(int id,String name) throws SQLException{ String lineaSQL="UPDATE pago SET concepto='"+name+"' WHERE codigo="+id+";"; Conexion.getInstance().execute_All(lineaSQL); } public static void borrar(int id) throws SQLException { String lineaSQL = "DELETE FROM pago WHERE codigo LIKE '"+id+"';" ; Conexion.getInstance().execute_All(lineaSQL); } }
UTF-8
Java
3,621
java
PagoDAO.java
Java
[ { "context": "port org.h2.engine.Session;\r\n\r\n/**\r\n *\r\n * @author Daniel Pérez Ramírez\r\n */\r\npublic class PagoDAO {\r\n public static C", "end": 634, "score": 0.9998631477355957, "start": 614, "tag": "NAME", "value": "Daniel Pérez Ramírez" } ]
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 DAOS; import Model.Colaborador; import Model.Conexion; import Model.Pago; import java.sql.Date; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.logging.Level; import java.util.logging.Logger; import org.h2.engine.Session; /** * * @author <NAME> */ public class PagoDAO { public static Conexion miConexion = Conexion.getInstance(); public static ResultSet mostrar(int cod) throws SQLException { //Que pida un nombre y lo busque int nFilas = 0; String lineaSQL = "Select * from pago WHERE codigo LIKE '%"+ cod +"%';" ; ResultSet resultado = Conexion.getInstance().execute_Select(lineaSQL); return resultado; } public static boolean crear(int num,String conc,int cant,String fp,String nif) throws SQLException, ParseException { boolean insertados = true; int i; Pago cob; //Cadena donde irán las sentencias sql de creación de tablas String lineaSQL; //Objeto de tipo Statement Statement sentencia = null; Date fechai=(Date) new SimpleDateFormat("dd/MM/yyyy").parse(fp); //comando sql generico para la inserción lineaSQL = "INSERT INTO pago (id, numero, concepto,cantidad,fecha_pago,nif_colaborador) values (NULL, ?, ?,?,?,?)"; //conectamos el objeto preparedStmt a la base de datos PreparedStatement preparedStmt = miConexion.getConexion().prepareStatement(lineaSQL); //creamos un nuevo socio cob = new Pago(num, conc,cant,fechai); preparedStmt.setInt(1, cob.getNumero()); preparedStmt.setString(2, cob.getConcepto()); preparedStmt.setInt(3, cob.getCantidad()); preparedStmt.setDate(4, cob.getFechaPago()); preparedStmt.setString(5, nif); // la ejecutamos preparedStmt.execute(); // habría que cerrar la conexion return insertados; } public static ResultSet mostrarTodos() throws SQLException { int nFilas = 0; String lineaSQL = "Select * from pago;" ; ResultSet resultado = Conexion.getInstance().execute_Select(lineaSQL); return resultado; } public static void modificar(int id,String name) throws SQLException{ String lineaSQL="UPDATE pago SET concepto='"+name+"' WHERE codigo="+id+";"; Conexion.getInstance().execute_All(lineaSQL); } public static void borrar(int id) throws SQLException { String lineaSQL = "DELETE FROM pago WHERE codigo LIKE '"+id+"';" ; Conexion.getInstance().execute_All(lineaSQL); } }
3,605
0.546888
0.544675
112
30.276785
28.508837
130
false
false
0
0
0
0
0
0
0.660714
false
false
0
29aa0dc9208cd79ac215612634340b54c446dd3d
21,526,376,092,718
a828119846088bba601a2aae274aa71ace65d9a4
/Tool/dex2jar/out/com/google/android/gms/analytics/internal/e.java
d1888149b666ffd554878108c49beeb2ebc5115e
[]
no_license
PhuongThao09/ZingMP3
https://github.com/PhuongThao09/ZingMP3
19112d400dc2c30719f03272c0de3b8101bfe3b9
a060ee305894c2d89e8636bd2700b16ecde6c421
refs/heads/master
2020-06-11T20:11:33.371000
2019-06-27T11:37:16
2019-06-27T11:37:16
194,065,503
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
// // Decompiled by Procyon v0.5.30 // package com.google.android.gms.analytics.internal; public class e { private final long a; private final int b; private double c; private long d; private final Object e; private final String f; public e(final int b, final long a, final String f) { this.e = new Object(); this.b = b; this.c = this.b; this.a = a; this.f = f; } public e(final String s) { this(60, 2000L, s); } public boolean a() { synchronized (this.e) { final long currentTimeMillis = System.currentTimeMillis(); if (this.c < this.b) { final double n = (currentTimeMillis - this.d) / this.a; if (n > 0.0) { this.c = Math.min(this.b, n + this.c); } } this.d = currentTimeMillis; if (this.c >= 1.0) { --this.c; return true; } com.google.android.gms.analytics.internal.f.a("Excessive " + this.f + " detected; call ignored."); return false; } } }
UTF-8
Java
1,174
java
e.java
Java
[]
null
[]
// // Decompiled by Procyon v0.5.30 // package com.google.android.gms.analytics.internal; public class e { private final long a; private final int b; private double c; private long d; private final Object e; private final String f; public e(final int b, final long a, final String f) { this.e = new Object(); this.b = b; this.c = this.b; this.a = a; this.f = f; } public e(final String s) { this(60, 2000L, s); } public boolean a() { synchronized (this.e) { final long currentTimeMillis = System.currentTimeMillis(); if (this.c < this.b) { final double n = (currentTimeMillis - this.d) / this.a; if (n > 0.0) { this.c = Math.min(this.b, n + this.c); } } this.d = currentTimeMillis; if (this.c >= 1.0) { --this.c; return true; } com.google.android.gms.analytics.internal.f.a("Excessive " + this.f + " detected; call ignored."); return false; } } }
1,174
0.488927
0.477002
46
24.52174
21.561579
110
false
false
0
0
0
0
0
0
0.586957
false
false
0
482b89ab5140569895608111cead86b9ca2c6cf7
14,405,320,378,501
5c90ab45ca306593c5c4c3af4ab3f3c71c2ef86b
/app/src/main/java/uz/iutlab/jiznstudenta/requestManager/CacheManager.java
6b9a07cf56c789b50bcd05d10985326853314783
[]
no_license
islomov/android-school-life
https://github.com/islomov/android-school-life
2cc2cf5c1641a17445f2ebec946079e359a46fa7
ecd722497cc833b8f6bfa43810d1718d03f8cd81
refs/heads/master
2020-04-01T12:56:09.996000
2018-10-16T06:00:36
2018-10-16T06:00:36
153,230,177
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package uz.iutlab.jiznstudenta.requestManager; import android.content.Context; import java.util.List; import uz.iutlab.jiznstudenta.model.pojo.ProfList; import uz.iutlab.jiznstudenta.model.response.Assignment; import uz.iutlab.jiznstudenta.model.response.Lesson; import uz.iutlab.jiznstudenta.model.response.Professor; import uz.iutlab.jiznstudenta.model.response.Subject; import uz.iutlab.jiznstudenta.model.response.SubjectDetail; import uz.iutlab.jiznstudenta.model.response.TimeTable; import uz.iutlab.jiznstudenta.model.response.complaints.Complaint; import uz.iutlab.jiznstudenta.model.response.complaints.Data; import uz.iutlab.jiznstudenta.model.response.statistics.Rating; /** * Created by sardor on 6/24/17. */ public class CacheManager { Context mContext; public CacheManager(Context context) { mContext = context; } /* Prof list*/ public void setProfList(ProfList profList) { deleteProfList(); if (profList != null) { List<Professor> professorList = profList.getProfessorList(); for (Professor professor : professorList) { professor.save(); } } } public ProfList getProfList() { ProfList profList = new ProfList(); profList.setProfessorList(Professor.getProfessor()); return profList; } private void deleteProfList() { List<Professor> professorList = Professor.getProfessor(); for (Professor professor : professorList) { professor.delete(); } } /* Rating */ public void setRating(List<Rating> ratings) { } public List<Rating> getRatingList() { return null; } private void deleteRating() { } /* Complaint */ public void setComplaints(Complaint complaint) { if (complaint != null) { deleteComplaint(); List<Data> datas = complaint.getDataList(); for (Data data : datas) { data.save(); } } } public Complaint getComplaints() { List<Data> datas = Data.getData(); Complaint complaint = new Complaint(); complaint.setDataList(datas); return complaint; } private void deleteComplaint() { List<Data> datas = Data.getData(); if (datas != null) { for (Data data : datas) { data.delete(); } } } /*Time Table*/ public TimeTable getTimeTable() { TimeTable timeTable = new TimeTable(); timeTable.setDay1(Lesson.getLessons(1)); timeTable.setDay2(Lesson.getLessons(2)); timeTable.setDay3(Lesson.getLessons(3)); timeTable.setDay4(Lesson.getLessons(4)); timeTable.setDay5(Lesson.getLessons(5)); timeTable.setDay6(Lesson.getLessons(6)); return timeTable; } public void setTimeTable(TimeTable timeTable) { deleteTimeTable(); if (timeTable.getDay1() != null) { for (Lesson lesson : timeTable.getDay1()) { Assignment assignment = lesson.getAssignment(); Subject subject = lesson.getSubject(); Professor professor = lesson.getProfessor(); if (assignment != null) assignment.save(); subject.save(); professor.save(); lesson.setDay(1); lesson.save(); } } if (timeTable.getDay2() != null) { for (Lesson lesson : timeTable.getDay2()) { Assignment assignment = lesson.getAssignment(); Subject subject = lesson.getSubject(); Professor professor = lesson.getProfessor(); if (assignment != null) assignment.save(); subject.save(); professor.save(); lesson.setDay(2); lesson.save(); } } if (timeTable.getDay3() != null) { for (Lesson lesson : timeTable.getDay3()) { Assignment assignment = lesson.getAssignment(); Subject subject = lesson.getSubject(); Professor professor = lesson.getProfessor(); if (assignment != null) assignment.save(); subject.save(); professor.save(); lesson.setDay(3); lesson.save(); } } if (timeTable.getDay4() != null) { for (Lesson lesson : timeTable.getDay4()) { Assignment assignment = lesson.getAssignment(); Subject subject = lesson.getSubject(); Professor professor = lesson.getProfessor(); if (assignment != null) assignment.save(); subject.save(); professor.save(); lesson.setDay(4); lesson.save(); } } if (timeTable.getDay5() != null) { for (Lesson lesson : timeTable.getDay5()) { Assignment assignment = lesson.getAssignment(); Subject subject = lesson.getSubject(); Professor professor = lesson.getProfessor(); if (assignment != null) assignment.save(); subject.save(); professor.save(); lesson.setDay(5); lesson.save(); } } if (timeTable.getDay6() != null) { for (Lesson lesson : timeTable.getDay6()) { Assignment assignment = lesson.getAssignment(); Subject subject = lesson.getSubject(); Professor professor = lesson.getProfessor(); if (assignment != null) assignment.save(); subject.save(); professor.save(); lesson.setDay(6); lesson.save(); } } } private void deleteTimeTable() { List<Lesson> lesson1 = Lesson.getLessons(1); if (lesson1 != null) { for (Lesson lesson : lesson1) { lesson.delete(); } } List<Lesson> lesson2 = Lesson.getLessons(2); if (lesson2 != null) { for (Lesson lesson : lesson2) { lesson.delete(); } } List<Lesson> lesson3 = Lesson.getLessons(3); if (lesson3 != null) { for (Lesson lesson : lesson3) { lesson.delete(); } } List<Lesson> lesson4 = Lesson.getLessons(4); if (lesson4 != null) { for (Lesson lesson : lesson4) { lesson.delete(); } } List<Lesson> lesson5 = Lesson.getLessons(5); if (lesson5 != null) { for (Lesson lesson : lesson5) { lesson.delete(); } } List<Lesson> lesson6 = Lesson.getLessons(6); if (lesson6 != null) { for (Lesson lesson : lesson6) { lesson.delete(); } } } }
UTF-8
Java
7,200
java
CacheManager.java
Java
[ { "context": "del.response.statistics.Rating;\n\n/**\n * Created by sardor on 6/24/17.\n */\n\npublic class CacheManager {\n\n ", "end": 710, "score": 0.998604953289032, "start": 704, "tag": "USERNAME", "value": "sardor" } ]
null
[]
package uz.iutlab.jiznstudenta.requestManager; import android.content.Context; import java.util.List; import uz.iutlab.jiznstudenta.model.pojo.ProfList; import uz.iutlab.jiznstudenta.model.response.Assignment; import uz.iutlab.jiznstudenta.model.response.Lesson; import uz.iutlab.jiznstudenta.model.response.Professor; import uz.iutlab.jiznstudenta.model.response.Subject; import uz.iutlab.jiznstudenta.model.response.SubjectDetail; import uz.iutlab.jiznstudenta.model.response.TimeTable; import uz.iutlab.jiznstudenta.model.response.complaints.Complaint; import uz.iutlab.jiznstudenta.model.response.complaints.Data; import uz.iutlab.jiznstudenta.model.response.statistics.Rating; /** * Created by sardor on 6/24/17. */ public class CacheManager { Context mContext; public CacheManager(Context context) { mContext = context; } /* Prof list*/ public void setProfList(ProfList profList) { deleteProfList(); if (profList != null) { List<Professor> professorList = profList.getProfessorList(); for (Professor professor : professorList) { professor.save(); } } } public ProfList getProfList() { ProfList profList = new ProfList(); profList.setProfessorList(Professor.getProfessor()); return profList; } private void deleteProfList() { List<Professor> professorList = Professor.getProfessor(); for (Professor professor : professorList) { professor.delete(); } } /* Rating */ public void setRating(List<Rating> ratings) { } public List<Rating> getRatingList() { return null; } private void deleteRating() { } /* Complaint */ public void setComplaints(Complaint complaint) { if (complaint != null) { deleteComplaint(); List<Data> datas = complaint.getDataList(); for (Data data : datas) { data.save(); } } } public Complaint getComplaints() { List<Data> datas = Data.getData(); Complaint complaint = new Complaint(); complaint.setDataList(datas); return complaint; } private void deleteComplaint() { List<Data> datas = Data.getData(); if (datas != null) { for (Data data : datas) { data.delete(); } } } /*Time Table*/ public TimeTable getTimeTable() { TimeTable timeTable = new TimeTable(); timeTable.setDay1(Lesson.getLessons(1)); timeTable.setDay2(Lesson.getLessons(2)); timeTable.setDay3(Lesson.getLessons(3)); timeTable.setDay4(Lesson.getLessons(4)); timeTable.setDay5(Lesson.getLessons(5)); timeTable.setDay6(Lesson.getLessons(6)); return timeTable; } public void setTimeTable(TimeTable timeTable) { deleteTimeTable(); if (timeTable.getDay1() != null) { for (Lesson lesson : timeTable.getDay1()) { Assignment assignment = lesson.getAssignment(); Subject subject = lesson.getSubject(); Professor professor = lesson.getProfessor(); if (assignment != null) assignment.save(); subject.save(); professor.save(); lesson.setDay(1); lesson.save(); } } if (timeTable.getDay2() != null) { for (Lesson lesson : timeTable.getDay2()) { Assignment assignment = lesson.getAssignment(); Subject subject = lesson.getSubject(); Professor professor = lesson.getProfessor(); if (assignment != null) assignment.save(); subject.save(); professor.save(); lesson.setDay(2); lesson.save(); } } if (timeTable.getDay3() != null) { for (Lesson lesson : timeTable.getDay3()) { Assignment assignment = lesson.getAssignment(); Subject subject = lesson.getSubject(); Professor professor = lesson.getProfessor(); if (assignment != null) assignment.save(); subject.save(); professor.save(); lesson.setDay(3); lesson.save(); } } if (timeTable.getDay4() != null) { for (Lesson lesson : timeTable.getDay4()) { Assignment assignment = lesson.getAssignment(); Subject subject = lesson.getSubject(); Professor professor = lesson.getProfessor(); if (assignment != null) assignment.save(); subject.save(); professor.save(); lesson.setDay(4); lesson.save(); } } if (timeTable.getDay5() != null) { for (Lesson lesson : timeTable.getDay5()) { Assignment assignment = lesson.getAssignment(); Subject subject = lesson.getSubject(); Professor professor = lesson.getProfessor(); if (assignment != null) assignment.save(); subject.save(); professor.save(); lesson.setDay(5); lesson.save(); } } if (timeTable.getDay6() != null) { for (Lesson lesson : timeTable.getDay6()) { Assignment assignment = lesson.getAssignment(); Subject subject = lesson.getSubject(); Professor professor = lesson.getProfessor(); if (assignment != null) assignment.save(); subject.save(); professor.save(); lesson.setDay(6); lesson.save(); } } } private void deleteTimeTable() { List<Lesson> lesson1 = Lesson.getLessons(1); if (lesson1 != null) { for (Lesson lesson : lesson1) { lesson.delete(); } } List<Lesson> lesson2 = Lesson.getLessons(2); if (lesson2 != null) { for (Lesson lesson : lesson2) { lesson.delete(); } } List<Lesson> lesson3 = Lesson.getLessons(3); if (lesson3 != null) { for (Lesson lesson : lesson3) { lesson.delete(); } } List<Lesson> lesson4 = Lesson.getLessons(4); if (lesson4 != null) { for (Lesson lesson : lesson4) { lesson.delete(); } } List<Lesson> lesson5 = Lesson.getLessons(5); if (lesson5 != null) { for (Lesson lesson : lesson5) { lesson.delete(); } } List<Lesson> lesson6 = Lesson.getLessons(6); if (lesson6 != null) { for (Lesson lesson : lesson6) { lesson.delete(); } } } }
7,200
0.5275
0.519306
235
29.638298
19.923071
72
false
false
0
0
0
0
0
0
0.434043
false
false
0
38b061cd59999edc2ad29b40b96d51ecdda5958e
14,405,320,378,230
8d4461fae4b3d4108a322e69a226329648778597
/src/test/java/Lab05_v2/steps/serenity/VVSSEndUserSteps.java
709db4e861c760921d8b0c731a84ac83698977d9
[]
no_license
denisagherghel/gdir_serenity
https://github.com/denisagherghel/gdir_serenity
7e39a2356d19faa89c9e214e29393e74deb9a27e
17feae5287e7e23160dd1f2c05b8d9b5583be22e
refs/heads/master
2020-03-17T14:24:48.202000
2018-05-16T13:39:13
2018-05-16T13:39:13
133,671,074
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package lab05.steps.serenity; import lab05.pages.VVSSPage; import net.thucydides.core.annotations.Step; import java.util.concurrent.TimeUnit; import static junit.framework.TestCase.assertTrue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.hasItem; public class VVSSEndUserSteps { VVSSPage vvssPage; @Step public void enters(String enunt, String varianta1, String varianta2, String varianta3, String variantaCorecta, String domeniu) { vvssPage.enter_enunt(enunt); vvssPage.enter_varianta1(varianta1); vvssPage.enter_varianta2(varianta2); vvssPage.enter_varianta3(varianta3); vvssPage.enter_variantaCorecta(variantaCorecta); vvssPage.enter_domeniu(domeniu); } @Step public void starts_add() { vvssPage.add_question(); } @Step public void should_see_error(String error) { assertTrue(vvssPage.getErrorMessage().contains(error)); } @Step public void should_see_succes() { assertTrue(vvssPage.getSuccessMessage().contains("S-a adaugat intrebarea!")); } @Step public void is_the_home_page() { vvssPage.open(); } @Step public void adds(String enunt, String varianta1, String varianta2, String varianta3, String variantaCorecta, String domeniu) { vvssPage.setImplicitTimeout(30, TimeUnit.SECONDS); enters(enunt, varianta1, varianta2, varianta3, variantaCorecta, domeniu); starts_add(); } }
UTF-8
Java
1,609
java
VVSSEndUserSteps.java
Java
[]
null
[]
package lab05.steps.serenity; import lab05.pages.VVSSPage; import net.thucydides.core.annotations.Step; import java.util.concurrent.TimeUnit; import static junit.framework.TestCase.assertTrue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.hasItem; public class VVSSEndUserSteps { VVSSPage vvssPage; @Step public void enters(String enunt, String varianta1, String varianta2, String varianta3, String variantaCorecta, String domeniu) { vvssPage.enter_enunt(enunt); vvssPage.enter_varianta1(varianta1); vvssPage.enter_varianta2(varianta2); vvssPage.enter_varianta3(varianta3); vvssPage.enter_variantaCorecta(variantaCorecta); vvssPage.enter_domeniu(domeniu); } @Step public void starts_add() { vvssPage.add_question(); } @Step public void should_see_error(String error) { assertTrue(vvssPage.getErrorMessage().contains(error)); } @Step public void should_see_succes() { assertTrue(vvssPage.getSuccessMessage().contains("S-a adaugat intrebarea!")); } @Step public void is_the_home_page() { vvssPage.open(); } @Step public void adds(String enunt, String varianta1, String varianta2, String varianta3, String variantaCorecta, String domeniu) { vvssPage.setImplicitTimeout(30, TimeUnit.SECONDS); enters(enunt, varianta1, varianta2, varianta3, variantaCorecta, domeniu); starts_add(); } }
1,609
0.688626
0.675575
53
29.35849
25.752153
85
false
false
0
0
0
0
0
0
0.716981
false
false
0
5dd8ef0ab35e318d593f7f58c549bed323c8a48b
1,846,835,954,902
a61b788092aa0f32eb6f57199e3109b0fb75a8ea
/src/main/java/com/agent/za/Launcher.java
73fe627d42003fa7182bf01d5ff310d26b17588d
[]
no_license
cloudskys/treasury
https://github.com/cloudskys/treasury
bfaa608e26bf0fa9a5fdc76481a11c54244d7101
1950da49f04d84c1651e8351a57ed22db631de20
refs/heads/master
2022-12-22T18:05:27.324000
2020-08-09T07:21:03
2020-08-09T07:21:03
193,447,527
3
0
null
false
2022-12-10T05:42:16
2019-06-24T06:31:38
2021-12-17T18:30:21
2022-12-10T05:42:15
73
5
0
2
Java
false
false
package com.agent.za; public class Launcher { public static void main(String[] args) throws Exception { if(args != null && args.length > 0 && "LoadAgent".equals(args[0])) { new AgentLoader().run(); }else{ new MyApplication().run(); } } }
UTF-8
Java
295
java
Launcher.java
Java
[]
null
[]
package com.agent.za; public class Launcher { public static void main(String[] args) throws Exception { if(args != null && args.length > 0 && "LoadAgent".equals(args[0])) { new AgentLoader().run(); }else{ new MyApplication().run(); } } }
295
0.549153
0.542373
11
25.818182
23.698172
76
false
false
0
0
0
0
0
0
0.272727
false
false
0
895d66a4212acbcd121d78fefc1afdec045d8d02
25,881,472,937,280
5ebe85692307df3c4a99149933cb0da7223ec53c
/user/src/main/java/com/epam/esm/service/CertificateService.java
c5fc97256cc5440b9e1e9b514b8339a2a189bc9b
[]
no_license
artempvn/lab_module7
https://github.com/artempvn/lab_module7
86564f8a38dcc6333bfb5c637ae6498054895454
cac1e16f63ec24dfdce8d18739e9b0b26baca335
refs/heads/main
2023-03-21T01:43:46.791000
2021-03-12T18:23:48
2021-03-12T18:23:48
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.epam.esm.service; import com.epam.esm.dto.CertificateWithTagsDto; /** The interface Certificate service. */ public interface CertificateService { /** * Persist certificate with tags. * * @param certificate the certificate * @return saved certificate with tags */ CertificateWithTagsDto create(CertificateWithTagsDto certificate); }
UTF-8
Java
366
java
CertificateService.java
Java
[]
null
[]
package com.epam.esm.service; import com.epam.esm.dto.CertificateWithTagsDto; /** The interface Certificate service. */ public interface CertificateService { /** * Persist certificate with tags. * * @param certificate the certificate * @return saved certificate with tags */ CertificateWithTagsDto create(CertificateWithTagsDto certificate); }
366
0.751366
0.751366
15
23.4
21.484259
68
false
false
0
0
0
0
0
0
0.2
false
false
0
f328b08a4619347534a219efd42348ad5183da25
6,949,257,093,520
9e63662e97ca6b1b854773ecf4a035dc47c25571
/src/main/java/com/ismek/entity/TravelSatisfactionInformation.java
75ec26700acc097500520b0e68e519726787191a
[]
no_license
dilaraencku/HeyTaksi
https://github.com/dilaraencku/HeyTaksi
555c35de92070247c181591e2876df70af9f2cb0
cce7675d931fb744f68729a2ea1866e16071010b
refs/heads/master
2021-08-19T07:35:59.009000
2017-11-25T07:06:08
2017-11-25T07:06:08
112,061,907
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ismek.entity; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table (name="TBL_TRAVEL_SATISFACTION_INFORMATION") public class TravelSatisfactionInformation { @Id @Column(name="id") @GeneratedValue(strategy= GenerationType.AUTO) private long id; @Column (name="taxi_driver_id") private long taxiDriverId; @Column (name="customer_Id") private long customerId; @Column (name="travel_Comment") private String travelComment; @Column (name="travel_rate") private Date travelDate; @Column(name="star_rating") private String starRating; public TravelSatisfactionInformation(long id,long taxiDriverId,long customerId,String travelComment,Date travelDate,String starRating) { this.id=id; this.taxiDriverId=taxiDriverId; this.customerId=customerId; this.travelComment=travelComment; this.travelDate=travelDate; this.starRating=starRating; } public double getId() { return id; } public long getTaxiDriverId() { return taxiDriverId; } public void setTaxiDriverId(long taxiDriverId) { this.taxiDriverId = taxiDriverId; } public long getCustomerId() { return customerId; } public void setCustomerId(long customerId) { this.customerId = customerId; } public void setId(long id) { this.id=id; } public String getTravelComment() { return travelComment; } public void setTravelComment(String travelComment) { this.travelComment = travelComment; } public Date getTravelDate() { return travelDate; } public void setTravelDate(Date travelDate) { this.travelDate = travelDate; } public String getStarRating() { return starRating; } public void setStarRating(String starRating) { this.starRating = starRating; } }
UTF-8
Java
1,892
java
TravelSatisfactionInformation.java
Java
[]
null
[]
package com.ismek.entity; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table (name="TBL_TRAVEL_SATISFACTION_INFORMATION") public class TravelSatisfactionInformation { @Id @Column(name="id") @GeneratedValue(strategy= GenerationType.AUTO) private long id; @Column (name="taxi_driver_id") private long taxiDriverId; @Column (name="customer_Id") private long customerId; @Column (name="travel_Comment") private String travelComment; @Column (name="travel_rate") private Date travelDate; @Column(name="star_rating") private String starRating; public TravelSatisfactionInformation(long id,long taxiDriverId,long customerId,String travelComment,Date travelDate,String starRating) { this.id=id; this.taxiDriverId=taxiDriverId; this.customerId=customerId; this.travelComment=travelComment; this.travelDate=travelDate; this.starRating=starRating; } public double getId() { return id; } public long getTaxiDriverId() { return taxiDriverId; } public void setTaxiDriverId(long taxiDriverId) { this.taxiDriverId = taxiDriverId; } public long getCustomerId() { return customerId; } public void setCustomerId(long customerId) { this.customerId = customerId; } public void setId(long id) { this.id=id; } public String getTravelComment() { return travelComment; } public void setTravelComment(String travelComment) { this.travelComment = travelComment; } public Date getTravelDate() { return travelDate; } public void setTravelDate(Date travelDate) { this.travelDate = travelDate; } public String getStarRating() { return starRating; } public void setStarRating(String starRating) { this.starRating = starRating; } }
1,892
0.761628
0.761628
85
21.258823
20.227037
137
false
false
0
0
0
0
0
0
1.388235
false
false
0
06b5649d2e6b7d40e7982134185b51802a7bed0a
31,241,592,144,259
7e509072b32fb8bca6c3b2b616db04c3f40ed978
/src/solution_1959/Main.java
e9c392f74e99446fb91b4ca2069f3f44bd4794c2
[]
no_license
hasibul-islam-niaj/URI-OJ.Java
https://github.com/hasibul-islam-niaj/URI-OJ.Java
0b029e2aed5dfc16bd75b6f955795358dfd2196a
ef7a4b0ffa2f356308ed77612ccdf97fced73d9f
refs/heads/master
2021-11-27T13:20:04.034000
2021-09-17T14:49:57
2021-09-17T14:49:57
108,442,282
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package solution_1959; import java.util.Scanner; class RegularSimplePolygons{ long n; int l; long Polygons(){ return l*n; } } public class Main { public static void main(String [] args){ Scanner sc = new Scanner(System.in); RegularSimplePolygons rsp = new RegularSimplePolygons(); rsp.n = sc.nextLong(); rsp.l = sc.nextInt(); System.out.println(rsp.Polygons()); } }
UTF-8
Java
390
java
Main.java
Java
[]
null
[]
package solution_1959; import java.util.Scanner; class RegularSimplePolygons{ long n; int l; long Polygons(){ return l*n; } } public class Main { public static void main(String [] args){ Scanner sc = new Scanner(System.in); RegularSimplePolygons rsp = new RegularSimplePolygons(); rsp.n = sc.nextLong(); rsp.l = sc.nextInt(); System.out.println(rsp.Polygons()); } }
390
0.689744
0.679487
22
16.727272
16.02039
58
false
false
0
0
0
0
0
0
1.363636
false
false
0
e34ec6b1520b7b0e3c501f7dedabecead08b8e1c
4,252,017,688,169
264580bc4c488788afc3af6bccc3de55feab7da2
/src/main/java/com/conferenceengineer/server/servlets/secure/DashboardBase.java
327635702a77ae7fdd75aa4a4062adf72efa356c
[]
no_license
alsutton/iosched-web-admin
https://github.com/alsutton/iosched-web-admin
4098bbf6e43fc0e812f7b28bac54bfb3d98425d7
e3dd738b3bb5730dea0cd77861d31729ec8abc46
refs/heads/master
2020-04-20T21:00:52.199000
2019-03-06T15:42:40
2019-03-06T15:42:40
169,094,811
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.conferenceengineer.server.servlets.secure; import com.conferenceengineer.server.datamodel.Conference; import com.conferenceengineer.server.utils.ConferenceUtils; import com.conferenceengineer.server.utils.EntityManagerWrapperBridge; import com.conferenceengineer.server.utils.ServletUtils; import javax.persistence.EntityManager; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; public abstract class DashboardBase extends HttpServlet { private static final String DEFAULT_PAGE_FOR_EXPIRED_SESSIONS = "/login.jsp"; @Override public void doGet(final HttpServletRequest request, final HttpServletResponse response) throws IOException, ServletException { response.setCharacterEncoding("UTF-8"); EntityManager em = EntityManagerWrapperBridge.getEntityManager(request); try { populateRequest(request, em); request.getRequestDispatcher("/secure/" + getNextPage()).forward(request, response); } catch(SessionExpiredException e) { request.getSession(true).setAttribute("error", "Your session timed out. Please log in again"); ServletUtils.redirectTo(request, response, DEFAULT_PAGE_FOR_EXPIRED_SESSIONS); } finally { em.close(); } } /** * Method to add attributes to the request object to provide commonly used information. */ protected void populateRequest(final HttpServletRequest request, final EntityManager em) { Conference conference = ConferenceUtils.getCurrentConference(request, em); if(conference == null) { throw new SessionExpiredException(); } request.setAttribute( "conference", conference ); } protected abstract String getNextPage(); private static class SessionExpiredException extends RuntimeException {} }
UTF-8
Java
1,996
java
DashboardBase.java
Java
[]
null
[]
package com.conferenceengineer.server.servlets.secure; import com.conferenceengineer.server.datamodel.Conference; import com.conferenceengineer.server.utils.ConferenceUtils; import com.conferenceengineer.server.utils.EntityManagerWrapperBridge; import com.conferenceengineer.server.utils.ServletUtils; import javax.persistence.EntityManager; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; public abstract class DashboardBase extends HttpServlet { private static final String DEFAULT_PAGE_FOR_EXPIRED_SESSIONS = "/login.jsp"; @Override public void doGet(final HttpServletRequest request, final HttpServletResponse response) throws IOException, ServletException { response.setCharacterEncoding("UTF-8"); EntityManager em = EntityManagerWrapperBridge.getEntityManager(request); try { populateRequest(request, em); request.getRequestDispatcher("/secure/" + getNextPage()).forward(request, response); } catch(SessionExpiredException e) { request.getSession(true).setAttribute("error", "Your session timed out. Please log in again"); ServletUtils.redirectTo(request, response, DEFAULT_PAGE_FOR_EXPIRED_SESSIONS); } finally { em.close(); } } /** * Method to add attributes to the request object to provide commonly used information. */ protected void populateRequest(final HttpServletRequest request, final EntityManager em) { Conference conference = ConferenceUtils.getCurrentConference(request, em); if(conference == null) { throw new SessionExpiredException(); } request.setAttribute( "conference", conference ); } protected abstract String getNextPage(); private static class SessionExpiredException extends RuntimeException {} }
1,996
0.736473
0.735972
52
37.384617
32.538235
106
false
false
0
0
0
0
0
0
0.634615
false
false
0
9595f6854406cc53488470151af1f79fc542df5b
22,144,851,429,443
5a5902c028bb98adcef312985546f3612b7eafa3
/java/Chapter 11/Question11_3/Practice01.java
a1e6cad2eba3f1763402346b05827efa10aa6530
[]
no_license
SiyuanZeng/ccJava
https://github.com/SiyuanZeng/ccJava
00691414194dd3c369d2e1c839d5773167129a0f
78fab5ae72bc3c08d92f4896edf8599a4dce5d12
refs/heads/master
2020-12-24T06:58:33.744000
2016-09-15T02:41:49
2016-09-15T02:41:49
58,237,544
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Question11_3; /** * Created by SiyuanZeng's on 10/12/2014. */ public class Practice01 { public static int findElement(int[] arr, int start, int end, int element) { int middle = start + (end - start)/2; int index = -1; if (element > arr[middle]) { index = findElement(arr, middle, end, element); // How to make sure the middle is included? } else if (element < arr[middle]) { index = findElement(arr, start, middle, element); } else { index = middle; } return index; } } // It has been some time that I forget what are the different scenarios.
UTF-8
Java
655
java
Practice01.java
Java
[ { "context": "package Question11_3;\n\n/**\n * Created by SiyuanZeng's on 10/12/2014.\n */\npublic class Practice01 {\n ", "end": 53, "score": 0.9997093677520752, "start": 41, "tag": "NAME", "value": "SiyuanZeng's" } ]
null
[]
package Question11_3; /** * Created by SiyuanZeng's on 10/12/2014. */ public class Practice01 { public static int findElement(int[] arr, int start, int end, int element) { int middle = start + (end - start)/2; int index = -1; if (element > arr[middle]) { index = findElement(arr, middle, end, element); // How to make sure the middle is included? } else if (element < arr[middle]) { index = findElement(arr, start, middle, element); } else { index = middle; } return index; } } // It has been some time that I forget what are the different scenarios.
655
0.584733
0.561832
21
30.190475
28.124924
103
false
false
0
0
0
0
0
0
0.761905
false
false
0
722dc5f07178380ed7b1c7e5948553532a4bd745
32,134,945,376,967
8977f8b41a4b2ac1e773249a51d260c76da57292
/src/main/java/com/hyva/restopos/rest/pojo/CreatePagePojo.java
964b5af7f7be8b57e5f584b958ae193f19128caa
[]
no_license
ksourav796/Antheysthi
https://github.com/ksourav796/Antheysthi
012983f41e40737e501de14cb71288f41d39850f
0b38f04f7824c5f8b2e0a82be6595081e9b86edb
refs/heads/master
2022-07-09T19:21:07.822000
2020-03-22T15:20:15
2020-03-22T15:20:15
249,203,916
0
0
null
false
2022-07-07T23:17:56
2020-03-22T14:43:53
2020-03-22T15:21:56
2022-07-07T23:17:56
21,971
0
0
8
JavaScript
false
false
package com.hyva.restopos.rest.pojo; import lombok.Data; @Data public class CreatePagePojo { private Long id; private String moduleName; private String submoduleName; private String pageName; private String columns; private String details; private String tableName; public String getTableName() { return tableName; } public void setTableName(String tableName) { this.tableName = tableName; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getModuleName() { return moduleName; } public void setModuleName(String moduleName) { this.moduleName = moduleName; } public String getSubmoduleName() { return submoduleName; } public void setSubmoduleName(String submoduleName) { this.submoduleName = submoduleName; } public String getPageName() { return pageName; } public void setPageName(String pageName) { this.pageName = pageName; } public String getColumns() { return columns; } public void setColumns(String columns) { this.columns = columns; } public String getDetails() { return details; } public void setDetails(String details) { this.details = details; } }
UTF-8
Java
1,183
java
CreatePagePojo.java
Java
[]
null
[]
package com.hyva.restopos.rest.pojo; import lombok.Data; @Data public class CreatePagePojo { private Long id; private String moduleName; private String submoduleName; private String pageName; private String columns; private String details; private String tableName; public String getTableName() { return tableName; } public void setTableName(String tableName) { this.tableName = tableName; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getModuleName() { return moduleName; } public void setModuleName(String moduleName) { this.moduleName = moduleName; } public String getSubmoduleName() { return submoduleName; } public void setSubmoduleName(String submoduleName) { this.submoduleName = submoduleName; } public String getPageName() { return pageName; } public void setPageName(String pageName) { this.pageName = pageName; } public String getColumns() { return columns; } public void setColumns(String columns) { this.columns = columns; } public String getDetails() { return details; } public void setDetails(String details) { this.details = details; } }
1,183
0.726965
0.726965
70
15.9
15.27664
53
false
false
0
0
0
0
0
0
0.328571
false
false
0
c28a6bc99080d6727f3831b03ef68dad8901ba1c
29,695,403,885,677
84011a38c50e95b3c8507c7a0fa737bd4ba28da5
/src/java/dao/kisi_malzemeDAO.java
bdf23e570bac9fe811d1224b6d6537f12423e0d6
[]
no_license
CahideSara/malzemeTakipSistemi
https://github.com/CahideSara/malzemeTakipSistemi
902ef8daf3d309bf4ce814695687bfcb5cab8752
062e56cfa6d33373ea72f2d1841175b5d965938e
refs/heads/master
2020-06-14T01:36:34.987000
2019-07-02T12:12:24
2019-07-02T12:12:24
194,841,690
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 dao; // //import Utility.DatabaseConnection; //import com.oracle.webservices.internal.api.message.MessageContext; //import com.sun.xml.internal.ws.api.message.Messages; //import entity.kisi; //import entity.kisinin_malzemeleri; //import entity.malzeme; //import java.sql.Connection; //import java.sql.ResultSet; //import java.sql.SQLException; //import java.sql.Statement; //import java.util.ArrayList; //import java.util.logging.Level; //import java.util.logging.Logger; //import javax.swing.JOptionPane; //import org.apache.tomcat.util.descriptor.web.MessageDestination; // ///** // * // * @author asus // */ //public class kisi_malzemeDAO { // // // // // // // //// public static void main(String arg[]){ //// kisi_malzemeDAO md=new kisi_malzemeDAO(); //// md.findAll(122l); //// //// //// } ////// ////// // // //}
UTF-8
Java
1,092
java
kisi_malzemeDAO.java
Java
[ { "context": "web.MessageDestination;\n//\n///**\n// *\n// * @author asus\n// */\n//public class kisi_malzemeDAO {\n//\n// ", "end": 809, "score": 0.9928644895553589, "start": 805, "tag": "USERNAME", "value": "asus" } ]
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 dao; // //import Utility.DatabaseConnection; //import com.oracle.webservices.internal.api.message.MessageContext; //import com.sun.xml.internal.ws.api.message.Messages; //import entity.kisi; //import entity.kisinin_malzemeleri; //import entity.malzeme; //import java.sql.Connection; //import java.sql.ResultSet; //import java.sql.SQLException; //import java.sql.Statement; //import java.util.ArrayList; //import java.util.logging.Level; //import java.util.logging.Logger; //import javax.swing.JOptionPane; //import org.apache.tomcat.util.descriptor.web.MessageDestination; // ///** // * // * @author asus // */ //public class kisi_malzemeDAO { // // // // // // // //// public static void main(String arg[]){ //// kisi_malzemeDAO md=new kisi_malzemeDAO(); //// md.findAll(122l); //// //// //// } ////// ////// // // //}
1,092
0.645604
0.642857
46
22.73913
20.270384
81
false
false
0
0
0
0
0
0
0.456522
false
false
0
a16b39e7caca60578c97ffa23dd5afc826bcc27d
4,750,233,833,577
4a399a43133e888c7804be301f7266eab1e1bcfc
/src/main/java/com/quanttech/quandis/types/EnumTypes.java
5ef7b8e29a69c13e048984306a8587fa29ecdef0
[ "Apache-2.0" ]
permissive
njucslqq/Quandis
https://github.com/njucslqq/Quandis
7a9f49e3abb0ecbe7453eba630364413784070ad
1d533b17c63b5a54d6aa243e2a303cef86651324
refs/heads/master
2015-09-25T09:13:06.290000
2015-09-16T07:01:19
2015-09-16T07:01:19
39,992,544
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.quanttech.quandis.types; public class EnumTypes { public enum BusinessType { FUNDAMENTAL, INSTRUMENT, FACTOR, QUOTATION } public enum TimeFrame { TICK, MIN_1, MIN_5, DAY } public enum QueryKeyWords { BUSINESSTYPE, SECUTYPE, SECUCODE, TIMEFRAME, STARTTIME, ENDTIME, DATATYPE, TABLETYPE, TABLENAME, TODAY, ALLMKT, NULL } public enum ConfKeyWords { QUOTATION, OTHER, SQL, SQL_ALLMKT, DBSPACE, DBTABLE } }
UTF-8
Java
434
java
EnumTypes.java
Java
[]
null
[]
package com.quanttech.quandis.types; public class EnumTypes { public enum BusinessType { FUNDAMENTAL, INSTRUMENT, FACTOR, QUOTATION } public enum TimeFrame { TICK, MIN_1, MIN_5, DAY } public enum QueryKeyWords { BUSINESSTYPE, SECUTYPE, SECUCODE, TIMEFRAME, STARTTIME, ENDTIME, DATATYPE, TABLETYPE, TABLENAME, TODAY, ALLMKT, NULL } public enum ConfKeyWords { QUOTATION, OTHER, SQL, SQL_ALLMKT, DBSPACE, DBTABLE } }
434
0.741935
0.737327
19
21.842106
28.038063
118
false
false
0
0
0
0
0
0
2.052632
false
false
0
982b0a4d43935f45260a164c44b0ec8c2b50a9d1
27,547,920,303,444
060d51155ad2e82d2f554cfd7dd9ce1e2ff93ed7
/Informatik 1/src/lab/ex56/kaleidoscope.java
3d4900c7f3ec1a972a15945b18b3b4177010c0d7
[]
no_license
LukasFilms/Informatik1-WiSe-2020
https://github.com/LukasFilms/Informatik1-WiSe-2020
77823f64e5313c98fd8bdd5f53dc84fe73badb30
40742f34196abe1cb29ed805a38760d883935941
refs/heads/master
2023-08-15T22:36:11.986000
2021-10-17T17:40:37
2021-10-17T17:40:37
418,207,558
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package lab.ex56; import processing.core.PApplet; public class kaleidoscope extends PApplet { public static void main(String args[]) { PApplet.main(new String[] { kaleidoscope.class.getName() }); } public void settings() { size(800, 800); } public void setup() { background(255); } public void draw() { if (mousePressed) { int x = mouseX - (width / 2); int y = mouseY - (height / 2); int px = pmouseX - (width / 2); int py = pmouseY - (height / 2); translate((width / 2), (height / 2)); pushMatrix(); final int STEPS = 20; for (int step = 0; step < STEPS; step++) { line(x, y, px, py); rotate(TWO_PI / STEPS); } popMatrix(); } } }
UTF-8
Java
746
java
kaleidoscope.java
Java
[]
null
[]
package lab.ex56; import processing.core.PApplet; public class kaleidoscope extends PApplet { public static void main(String args[]) { PApplet.main(new String[] { kaleidoscope.class.getName() }); } public void settings() { size(800, 800); } public void setup() { background(255); } public void draw() { if (mousePressed) { int x = mouseX - (width / 2); int y = mouseY - (height / 2); int px = pmouseX - (width / 2); int py = pmouseY - (height / 2); translate((width / 2), (height / 2)); pushMatrix(); final int STEPS = 20; for (int step = 0; step < STEPS; step++) { line(x, y, px, py); rotate(TWO_PI / STEPS); } popMatrix(); } } }
746
0.552279
0.525469
44
14.954545
16.420546
62
false
false
0
0
0
0
0
0
1.772727
false
false
0
429eae97656ea33e218519366b161a431700b1bc
27,547,920,301,948
4df2b227825b9d3db60ac4fc1648704560b073c9
/examples/ExampleStaticCoScoreboard.java
ed74b5171d5b4f6c486dfa17197ead5a93ee5f71
[]
no_license
Project-Coalesce/Core
https://github.com/Project-Coalesce/Core
ed59f38030c03f49e112b904e49b7544d2bb9364
2711f3fea21e1cb0e9af0851b05133cb6080c20c
refs/heads/master
2021-01-19T08:10:22.524000
2017-12-22T22:35:59
2017-12-22T22:35:59
87,608,470
20
2
null
false
2017-07-06T20:12:58
2017-04-08T04:41:41
2017-05-14T16:52:36
2017-07-06T20:12:58
297
7
0
0
Java
null
null
package examples; import com.coalesce.plugin.CoPlugin; import com.coalesce.scoreboard.StaticScoreboard; import org.bukkit.Bukkit; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.scheduler.BukkitRunnable; public class ExampleStaticCoScoreboard implements Listener { final StaticScoreboard scoreboard; public ExampleStaticCoScoreboard(CoPlugin coPlugin) { // Create scoreboard scoreboard = new StaticScoreboard.Builder().build(); // Add all players that are currently on the server Bukkit.getOnlinePlayers().forEach(scoreboard::send); // Create a bukkit runnable to update scoreboards new BukkitRunnable() { @Override public void run() { // Clear all the entries scoreboard.clearEntries(); // Re-add the entries scoreboard.addEntry("§bIP:"); scoreboard.addEntry("§7server.craft.com"); scoreboard.addEntry(""); scoreboard.addEntry("§bWebsite:"); scoreboard.addEntry("§7www.craft.com"); scoreboard.addEntry(""); scoreboard.addEntry("§bPlayers Online:"); scoreboard.addEntry("§7" + Bukkit.getOnlinePlayers().size()); scoreboard.addEntry("§m§e------------------"); // Update the scoreboard scoreboard.update(); } }.runTaskTimer(coPlugin, 0L, 3L); // Set timer } @EventHandler public void onPlayerJoin(PlayerJoinEvent event) { scoreboard.send(event.getPlayer()); } }
UTF-8
Java
1,775
java
ExampleStaticCoScoreboard.java
Java
[]
null
[]
package examples; import com.coalesce.plugin.CoPlugin; import com.coalesce.scoreboard.StaticScoreboard; import org.bukkit.Bukkit; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.scheduler.BukkitRunnable; public class ExampleStaticCoScoreboard implements Listener { final StaticScoreboard scoreboard; public ExampleStaticCoScoreboard(CoPlugin coPlugin) { // Create scoreboard scoreboard = new StaticScoreboard.Builder().build(); // Add all players that are currently on the server Bukkit.getOnlinePlayers().forEach(scoreboard::send); // Create a bukkit runnable to update scoreboards new BukkitRunnable() { @Override public void run() { // Clear all the entries scoreboard.clearEntries(); // Re-add the entries scoreboard.addEntry("§bIP:"); scoreboard.addEntry("§7server.craft.com"); scoreboard.addEntry(""); scoreboard.addEntry("§bWebsite:"); scoreboard.addEntry("§7www.craft.com"); scoreboard.addEntry(""); scoreboard.addEntry("§bPlayers Online:"); scoreboard.addEntry("§7" + Bukkit.getOnlinePlayers().size()); scoreboard.addEntry("§m§e------------------"); // Update the scoreboard scoreboard.update(); } }.runTaskTimer(coPlugin, 0L, 3L); // Set timer } @EventHandler public void onPlayerJoin(PlayerJoinEvent event) { scoreboard.send(event.getPlayer()); } }
1,775
0.591964
0.589134
50
34.34
20.451513
77
false
false
0
0
0
0
0
0
0.52
false
false
0
3110f809592a5ffa821e20e0b70c62314e6e31e9
21,689,584,902,839
e105629850c23ae19c34e6bfe4310643740e8c64
/vanilla-core/src/main/java/ph/codeia/arch/LogLevel.java
dce1aea08958954ff6bf4aecb9272f8d8a5e6fa3
[ "MIT" ]
permissive
monzee/vanilla
https://github.com/monzee/vanilla
85f01a8051a8898dafa28ad460b50792a20fcb0e
a30b2ca180a8ee339988288fbe900f5251e1cfa4
refs/heads/master
2021-01-12T16:51:23.053000
2017-11-05T06:49:49
2017-11-05T06:49:49
71,449,648
0
0
null
false
2017-04-20T13:36:15
2016-10-20T09:57:54
2016-10-20T09:58:50
2017-04-20T13:36:15
359
0
0
0
Java
null
null
package ph.codeia.arch; /** * This file is a part of the vanilla project. */ public enum LogLevel { D, I, E; public void to(Logger logger, String message, Object... fmtArgs) { if (logger.active(this)) { logger.log(this, String.format(message, fmtArgs)); } } public void to(Logger logger, Throwable error) { if (logger.active(this)) { logger.log(this, error); } } public void to(Logger logger, Throwable error, String message, Object... fmtArgs) { to(logger, message, fmtArgs); to(logger, error); } }
UTF-8
Java
607
java
LogLevel.java
Java
[]
null
[]
package ph.codeia.arch; /** * This file is a part of the vanilla project. */ public enum LogLevel { D, I, E; public void to(Logger logger, String message, Object... fmtArgs) { if (logger.active(this)) { logger.log(this, String.format(message, fmtArgs)); } } public void to(Logger logger, Throwable error) { if (logger.active(this)) { logger.log(this, error); } } public void to(Logger logger, Throwable error, String message, Object... fmtArgs) { to(logger, message, fmtArgs); to(logger, error); } }
607
0.583196
0.583196
26
22.346153
24.191452
87
false
false
0
0
0
0
0
0
0.769231
false
false
0
262087f14c4bbe4800c7429771a1d546e616c82f
24,644,522,350,335
215ecaa954b089740ac7186fe5e510022153291f
/src/main/java/com/demo/spider/ProxyManager.java
c075be9e3f82e147b368b14a85f4751a808a03cf
[]
no_license
sirlic/IpProxy
https://github.com/sirlic/IpProxy
3e113fa809f48eb7ba4ec7e8d43c5d18eedfc5af
ec1996e2de1eac8624cc447312c3a0d790d04fe9
refs/heads/master
2022-12-29T13:31:05.670000
2021-04-22T15:27:12
2021-04-22T15:27:12
132,351,653
0
0
null
false
2022-12-16T10:31:46
2018-05-06T15:29:59
2021-04-22T15:27:15
2022-12-16T10:31:43
50
0
0
9
Java
false
false
package com.demo.spider; import com.demo.spider.crawl.Proxy_66ip; import com.demo.spider.crawl.Proxy_89ip; import com.demo.spider.crawl.Proxy_ihuan; import com.demo.spider.crawl.Proxy_kuaidaili; import com.demo.spider.crawl.xicidaili.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import us.codecraft.webmagic.Page; import us.codecraft.webmagic.Site; import us.codecraft.webmagic.Spider; import us.codecraft.webmagic.processor.PageProcessor; import java.util.ArrayList; import java.util.List; import java.util.Random; @Component public class ProxyManager implements PageProcessor { @Autowired private ProxyPipeline proxyPipeline; private List<IPageProcessor> mList = new ArrayList<>(); // ''' // USER_AGENTS 随机头信息 //''' private String[] USER_AGENTS = { "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; AcooBrowser; .NET CLR 1.1.4322; .NET CLR 2.0.50727)", "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Acoo Browser; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506)", "Mozilla/4.0 (compatible; MSIE 7.0; AOL 9.5; AOLBuild 4337.35; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)", "Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US)", "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET CLR 2.0.50727; Media Center PC 6.0)", "Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET CLR 1.0.3705; .NET CLR 1.1.4322)", "Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.2; .NET CLR 3.0.04506.30)", "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN) AppleWebKit/523.15 (KHTML, like Gecko, Safari/419.3) Arora/0.3 (Change: 287 c9dfb30)", "Mozilla/5.0 (X11; U; Linux; en-US) AppleWebKit/527+ (KHTML, like Gecko, Safari/419.3) Arora/0.6", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.2pre) Gecko/20070215 K-Ninja/2.1.1", "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9) Gecko/20080705 Firefox/3.0 Kapiko/3.0", "Mozilla/5.0 (X11; Linux i686; U;) Gecko/20070322 Kazehakase/0.4.5", "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.8) Gecko Fedora/1.9.0.8-1.fc10 Kazehakase/0.5.6", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.20 (KHTML, like Gecko) Chrome/19.0.1036.7 Safari/535.20", "Opera/9.80 (Macintosh; Intel Mac OS X 10.6.8; U; fr) Presto/2.9.168 Version/11.52", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.11 TaoBrowser/2.0 Safari/536.11", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.71 Safari/537.1 LBBROWSER", "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; LBBROWSER)", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; QQDownload 732; .NET4.0C; .NET4.0E; LBBROWSER)", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.84 Safari/535.11 LBBROWSER", "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)", "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; QQBrowser/7.0.3698.400)", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; QQDownload 732; .NET4.0C; .NET4.0E)", "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; SV1; QQDownload 732; .NET4.0C; .NET4.0E; 360SE)", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; QQDownload 732; .NET4.0C; .NET4.0E)", "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)", "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1", "Mozilla/5.0 (iPad; U; CPU OS 4_2_1 like Mac OS X; zh-cn) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5", "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:2.0b13pre) Gecko/20110307 Firefox/4.0b13pre", "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:16.0) Gecko/20100101 Firefox/16.0", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11", "Mozilla/5.0 (X11; U; Linux x86_64; zh-CN; rv:1.9.2.10) Gecko/20100922 Ubuntu/10.10 (maverick) Firefox/3.6.10" }; private Site site = Site.me().setRetryTimes(3).setSleepTime(1000).setTimeOut(10000) .setUserAgent(USER_AGENTS[9]); private Spider spider; public ProxyManager() { mList.add(new Proxy_66ip()); mList.add(new Proxy_kuaidaili()); mList.add(new Proxy_xicidaili_nn()); mList.add(new Proxy_xicidaili_nt()); mList.add(new Proxy_xicidaili_wn()); mList.add(new Proxy_xicidaili_wt()); mList.add(new Proxy_xicidaili_qq()); mList.add(new Proxy_89ip()); mList.add(new Proxy_ihuan()); } @Override public void process(Page page) { for (IPageProcessor pageProcessor : mList) { if (pageProcessor.isMatch(page)) { pageProcessor.process(page); } } } @Override public Site getSite() { return site; } public void start() { if (spider == null) { spider = Spider.create(this) .setDownloader(new MyHttpClientDownloader()) .addPipeline(proxyPipeline).thread(10); for (IPageProcessor pageProcessor : mList) { spider.addUrl(pageProcessor.getStartUrl()); } } spider.run(); } public void stop() { if (spider != null) { spider.stop(); } } }
UTF-8
Java
6,762
java
ProxyManager.java
Java
[]
null
[]
package com.demo.spider; import com.demo.spider.crawl.Proxy_66ip; import com.demo.spider.crawl.Proxy_89ip; import com.demo.spider.crawl.Proxy_ihuan; import com.demo.spider.crawl.Proxy_kuaidaili; import com.demo.spider.crawl.xicidaili.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import us.codecraft.webmagic.Page; import us.codecraft.webmagic.Site; import us.codecraft.webmagic.Spider; import us.codecraft.webmagic.processor.PageProcessor; import java.util.ArrayList; import java.util.List; import java.util.Random; @Component public class ProxyManager implements PageProcessor { @Autowired private ProxyPipeline proxyPipeline; private List<IPageProcessor> mList = new ArrayList<>(); // ''' // USER_AGENTS 随机头信息 //''' private String[] USER_AGENTS = { "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; AcooBrowser; .NET CLR 1.1.4322; .NET CLR 2.0.50727)", "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Acoo Browser; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506)", "Mozilla/4.0 (compatible; MSIE 7.0; AOL 9.5; AOLBuild 4337.35; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)", "Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US)", "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET CLR 2.0.50727; Media Center PC 6.0)", "Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET CLR 1.0.3705; .NET CLR 1.1.4322)", "Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.2; .NET CLR 3.0.04506.30)", "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN) AppleWebKit/523.15 (KHTML, like Gecko, Safari/419.3) Arora/0.3 (Change: 287 c9dfb30)", "Mozilla/5.0 (X11; U; Linux; en-US) AppleWebKit/527+ (KHTML, like Gecko, Safari/419.3) Arora/0.6", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.2pre) Gecko/20070215 K-Ninja/2.1.1", "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9) Gecko/20080705 Firefox/3.0 Kapiko/3.0", "Mozilla/5.0 (X11; Linux i686; U;) Gecko/20070322 Kazehakase/0.4.5", "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.8) Gecko Fedora/1.9.0.8-1.fc10 Kazehakase/0.5.6", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.20 (KHTML, like Gecko) Chrome/19.0.1036.7 Safari/535.20", "Opera/9.80 (Macintosh; Intel Mac OS X 10.6.8; U; fr) Presto/2.9.168 Version/11.52", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.11 TaoBrowser/2.0 Safari/536.11", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.71 Safari/537.1 LBBROWSER", "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; LBBROWSER)", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; QQDownload 732; .NET4.0C; .NET4.0E; LBBROWSER)", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.84 Safari/535.11 LBBROWSER", "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)", "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; QQBrowser/7.0.3698.400)", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; QQDownload 732; .NET4.0C; .NET4.0E)", "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; SV1; QQDownload 732; .NET4.0C; .NET4.0E; 360SE)", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; QQDownload 732; .NET4.0C; .NET4.0E)", "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)", "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1", "Mozilla/5.0 (iPad; U; CPU OS 4_2_1 like Mac OS X; zh-cn) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5", "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:2.0b13pre) Gecko/20110307 Firefox/4.0b13pre", "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:16.0) Gecko/20100101 Firefox/16.0", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11", "Mozilla/5.0 (X11; U; Linux x86_64; zh-CN; rv:1.9.2.10) Gecko/20100922 Ubuntu/10.10 (maverick) Firefox/3.6.10" }; private Site site = Site.me().setRetryTimes(3).setSleepTime(1000).setTimeOut(10000) .setUserAgent(USER_AGENTS[9]); private Spider spider; public ProxyManager() { mList.add(new Proxy_66ip()); mList.add(new Proxy_kuaidaili()); mList.add(new Proxy_xicidaili_nn()); mList.add(new Proxy_xicidaili_nt()); mList.add(new Proxy_xicidaili_wn()); mList.add(new Proxy_xicidaili_wt()); mList.add(new Proxy_xicidaili_qq()); mList.add(new Proxy_89ip()); mList.add(new Proxy_ihuan()); } @Override public void process(Page page) { for (IPageProcessor pageProcessor : mList) { if (pageProcessor.isMatch(page)) { pageProcessor.process(page); } } } @Override public Site getSite() { return site; } public void start() { if (spider == null) { spider = Spider.create(this) .setDownloader(new MyHttpClientDownloader()) .addPipeline(proxyPipeline).thread(10); for (IPageProcessor pageProcessor : mList) { spider.addUrl(pageProcessor.getStartUrl()); } } spider.run(); } public void stop() { if (spider != null) { spider.stop(); } } }
6,762
0.625889
0.500592
118
56.220341
54.641689
217
false
false
0
0
0
0
0
0
2.09322
false
false
0
b7f3b3d504b15733be51d1a09f3c3fb77be77d78
32,590,211,847,154
b7ea598d7a04cf5bc460647ebc7910c429cc193b
/src/main/java/cn/bestlang/algs/leetcode/MergeTrees.java
39609134967953760f6934e2aaf4067de8592127
[ "MIT" ]
permissive
ligenhw/algs
https://github.com/ligenhw/algs
b9bf9c2209e94df7f3d3331ff54c50e80efc25c1
097802acfa8adba9685a21cd4729feaa1c7018e1
refs/heads/main
2023-08-31T10:40:27.166000
2021-10-20T02:53:04
2021-10-20T02:53:04
379,483,664
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.bestlang.algs.leetcode; import cn.bestlang.algs.common.TreeNode; public class MergeTrees { public TreeNode mergeTrees(TreeNode root1, TreeNode root2) { TreeNode root = merge(root1, null); TreeNode mergeTree = merge(root2, root); return mergeTree; } private TreeNode merge(TreeNode tree, TreeNode node) { if (tree == null) { return node; } if (node == null) { node = new TreeNode(0); } node.val += tree.val; node.left = merge(tree.left, node.left); node.right = merge(tree.right, node.right); return node; } }
UTF-8
Java
654
java
MergeTrees.java
Java
[]
null
[]
package cn.bestlang.algs.leetcode; import cn.bestlang.algs.common.TreeNode; public class MergeTrees { public TreeNode mergeTrees(TreeNode root1, TreeNode root2) { TreeNode root = merge(root1, null); TreeNode mergeTree = merge(root2, root); return mergeTree; } private TreeNode merge(TreeNode tree, TreeNode node) { if (tree == null) { return node; } if (node == null) { node = new TreeNode(0); } node.val += tree.val; node.left = merge(tree.left, node.left); node.right = merge(tree.right, node.right); return node; } }
654
0.582569
0.574924
27
23.222221
19.885475
64
false
false
0
0
0
0
0
0
0.62963
false
false
0
2c918963136e4011060dbb09aa5e7e7fa26de7f3
32,590,211,844,565
01bfe98a9c43cf599dfe1910f4d2af1406873383
/software/AdvancedQuery/src/java/edu/wustl/common/query/queryobject/impl/QueryExportDataHandler.java
c55750e70b4951739cc8359f2dccca55a17b4dd4
[]
no_license
darpanpatil/SG-AQ
https://github.com/darpanpatil/SG-AQ
0e70e03f9936d6a883ad4fe2e1feb284d57ea7e4
3aa1a8bc4ce475b811c15a695a92447deaad83b6
refs/heads/master
2020-02-05T16:45:17.650000
2013-09-30T05:22:28
2013-09-30T05:22:28
13,142,501
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.wustl.common.query.queryobject.impl; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; import edu.common.dynamicextensions.domaininterface.AbstractAttributeInterface; import edu.common.dynamicextensions.domaininterface.AssociationInterface; import edu.common.dynamicextensions.domaininterface.AttributeInterface; import edu.common.dynamicextensions.domaininterface.BaseAbstractAttributeInterface; import edu.common.dynamicextensions.domaininterface.EntityInterface; import edu.wustl.common.query.queryobject.impl.metadata.QueryOutputTreeAttributeMetadata; import edu.wustl.common.query.queryobject.impl.metadata.SelectedColumnsMetadata; import edu.wustl.common.querysuite.metadata.associations.IIntraModelAssociation; import edu.wustl.common.querysuite.queryobject.IConstraints; import edu.wustl.common.querysuite.queryobject.IExpression; import edu.wustl.common.querysuite.queryobject.impl.JoinGraph; /** * This class is responsible for exporting the query results * (i.e. displaying results in spreadsheet in denormalized form) * @author pooja_tavase * */ public class QueryExportDataHandler { protected Map<QueryHeaderData, Integer> entityVsMaxCount = new HashMap<QueryHeaderData, Integer>(); private final EntityInterface rootEntity; private final IConstraints constraints; private Map<IExpression,BaseAbstractAttributeInterface> expVsAssoc = new HashMap<IExpression, BaseAbstractAttributeInterface>(); private Map<IExpression,BaseAbstractAttributeInterface> tgtExpVsAssoc = new HashMap<IExpression, BaseAbstractAttributeInterface>(); public QueryExportDataHandler(IExpression rootExp, IConstraints constraints) { if(rootExp == null) { rootEntity = null; } else { rootEntity = rootExp.getQueryEntity().getDynamicExtensionsEntity(); } this.constraints = constraints; } public EntityInterface getRootExp() { return rootEntity; } /** * @param entityVsAssoc the entityVsAssoc to set */ public void setExpVsAssoc(Map<IExpression,BaseAbstractAttributeInterface> expVsAssoc) { this.expVsAssoc = expVsAssoc; } /** * @return the entityVsAssoc */ public Map<IExpression,BaseAbstractAttributeInterface> getExpVsAssoc() { return expVsAssoc; } public void setTgtExpVsAssoc( Map<IExpression, BaseAbstractAttributeInterface> tgtExpVsAssoc) { this.tgtExpVsAssoc = tgtExpVsAssoc; } /** * @return the tgtEntityVsAssoc */ public Map<IExpression, BaseAbstractAttributeInterface> getTgtExpVsAssoc() { return tgtExpVsAssoc; } /** * Gets the list of associations & attributes for the passed entity. * @param expression entity * @return finalList finalList */ private Collection<AbstractAttributeInterface> getAbstractAttributeCollection( IExpression expression) { Collection<AbstractAttributeInterface> finalList = new ArrayList<AbstractAttributeInterface>(); Collection<AttributeInterface> attributeList = expression.getQueryEntity().getDynamicExtensionsEntity().getAllAttributes(); Collection<AbstractAttributeInterface> associationList = getActualAssociations(expression); finalList.addAll(attributeList); finalList.addAll(associationList); for(IExpression exp : expVsAssoc.keySet()) { if(exp.equals(expression)) { AbstractAttributeInterface assocInterface = (AbstractAttributeInterface)expVsAssoc.get(exp); if(assocInterface != null && !finalList.contains(assocInterface)) { finalList.add(assocInterface); } } } return finalList; } /** * Gets only those associations that are present in the formed query. * @param expression expression * @return finalList */ private List<AbstractAttributeInterface> getActualAssociations( IExpression expression) { List<AbstractAttributeInterface> assocList = new ArrayList<AbstractAttributeInterface>(); JoinGraph joinGraph = (JoinGraph)constraints.getJoinGraph(); IIntraModelAssociation association; for(IExpression exp : constraints) { if(joinGraph.containsAssociation(expression, exp)) { association = (IIntraModelAssociation)joinGraph.getAssociation(expression, exp); if(!assocList.contains(association.getDynamicExtensionsAssociation())) { assocList.add(association.getDynamicExtensionsAssociation()); } } } return assocList; } /** * Returns a list which contains data related only to the entity passed * (This is possible when the query contains an association twice & so there is list of data * for more than one entity corresponding to same association). * @param tempList tempList * @param expression entity * @param selectedColumnsMetadata * @return newList */ public List updateTempList(List tempList, IExpression expression, SelectedColumnsMetadata selectedColumnsMetadata) { List newList = new ArrayList(); Map<OutputAssociationColumn, Object> newMap; Collection<AbstractAttributeInterface> attributeList = getAbstractAttributeCollection(expression); for(int cnt=0;cnt<tempList.size();cnt++) { newMap = new HashMap<OutputAssociationColumn, Object>(); Map<OutputAssociationColumn, Object> obj = (Map<OutputAssociationColumn, Object>) tempList.get(cnt); for(OutputAssociationColumn attribute : obj.keySet()) { if(attributeList.contains(attribute.getAbstractAttr())) { newMap.put(attribute, obj.get(attribute)); } } // this is needed id node is added in view mode & there is no record for it to display then empty record needs to be added in tree. if(obj.isEmpty()) { newMap = getEmptyRecordMap(expression,selectedColumnsMetadata); } if(!newMap.isEmpty()) { newList.add(newMap); } } return newList; } private Map<OutputAssociationColumn, Object> getEmptyRecordMap(IExpression expression, SelectedColumnsMetadata selectedColumnsMetadata) { Map<OutputAssociationColumn, Object> record = new HashMap<OutputAssociationColumn, Object>(); Collection<AttributeInterface> attributeList = expression.getQueryEntity() .getDynamicExtensionsEntity().getAttributeCollection(); for (AttributeInterface attribute : attributeList) { OutputAttributeColumn opAttrCol = null; String value; int columnIndex = -1; for (QueryOutputTreeAttributeMetadata outputTreeAttributeMetadata : selectedColumnsMetadata .getSelectedAttributeMetaDataList()) { columnIndex++; BaseAbstractAttributeInterface presentAttribute = outputTreeAttributeMetadata .getAttribute(); if (presentAttribute.equals(attribute) && outputTreeAttributeMetadata.getTreeDataNode().getExpressionId() == expression .getExpressionId()) { value = " "; opAttrCol = new OutputAttributeColumn(value, columnIndex, attribute, expression, null); break; } } if (opAttrCol != null) { OutputAssociationColumn opAssocCol = new OutputAssociationColumn(attribute, expression, null); record.put(opAssocCol, opAttrCol); } } return record; } /** * Add all the associations (of parents) and then * filter the list to contain only the required attributes and associations. * @param queryHeaderData queryHeaderData * @return attributeList */ public List<AbstractAttributeInterface> getFinalAttributeList( EntityInterface entity) { List<AbstractAttributeInterface> attributeList = (List<AbstractAttributeInterface>) entity.getAllAbstractAttributes(); List<AbstractAttributeInterface> newAttributeList = new ArrayList<AbstractAttributeInterface>(); for(AbstractAttributeInterface attribute : attributeList) { populateNewAttributeList(entity, newAttributeList, attribute); } for(IExpression exp : expVsAssoc.keySet()) { populateNewAttrList(entity, newAttributeList, exp); } return newAttributeList; } /** * Populate the final attribute list by adding all the associations (of parents) and then * filter the list to contain only the required attributes and associations. * @param entity entity * @param newAttributeList newAttributeList * @param exp expression */ private void populateNewAttrList(EntityInterface entity, List<AbstractAttributeInterface> newAttributeList, IExpression exp) { if(exp.getQueryEntity().getDynamicExtensionsEntity().equals(entity)) { AbstractAttributeInterface assocInterface = (AbstractAttributeInterface)expVsAssoc.get(exp); if(assocInterface != null && !newAttributeList.contains(assocInterface)) { newAttributeList.add(assocInterface); } } } /** * Populate new attribute list. * @param entity entity * @param newAttributeList newAttributeList * @param attribute attribute */ private void populateNewAttributeList(EntityInterface entity, List<AbstractAttributeInterface> newAttributeList, AbstractAttributeInterface attribute) { if(attribute instanceof AssociationInterface) { if(!((AssociationInterface)attribute).getTargetEntity().getName(). equals(entity.getName())) { newAttributeList.add(attribute); } } else { newAttributeList.add(attribute); } } /** * Get maximum record count for a particular QueryHeaderData object. * @param queryHeaderData queryHeaderData * @return maxCount */ public Integer getMaxRecordCountForQueryHeader( QueryHeaderData queryHeaderData) { Integer maxCount = entityVsMaxCount.get(queryHeaderData); if (maxCount == null) { maxCount = 0; } return maxCount; } }
UTF-8
Java
9,793
java
QueryExportDataHandler.java
Java
[ { "context": "s in spreadsheet in denormalized form)\r\n * @author pooja_tavase\r\n *\r\n */\r\npublic class QueryExportDataHandler\r\n{\r", "end": 1171, "score": 0.9991630911827087, "start": 1159, "tag": "USERNAME", "value": "pooja_tavase" } ]
null
[]
package edu.wustl.common.query.queryobject.impl; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; import edu.common.dynamicextensions.domaininterface.AbstractAttributeInterface; import edu.common.dynamicextensions.domaininterface.AssociationInterface; import edu.common.dynamicextensions.domaininterface.AttributeInterface; import edu.common.dynamicextensions.domaininterface.BaseAbstractAttributeInterface; import edu.common.dynamicextensions.domaininterface.EntityInterface; import edu.wustl.common.query.queryobject.impl.metadata.QueryOutputTreeAttributeMetadata; import edu.wustl.common.query.queryobject.impl.metadata.SelectedColumnsMetadata; import edu.wustl.common.querysuite.metadata.associations.IIntraModelAssociation; import edu.wustl.common.querysuite.queryobject.IConstraints; import edu.wustl.common.querysuite.queryobject.IExpression; import edu.wustl.common.querysuite.queryobject.impl.JoinGraph; /** * This class is responsible for exporting the query results * (i.e. displaying results in spreadsheet in denormalized form) * @author pooja_tavase * */ public class QueryExportDataHandler { protected Map<QueryHeaderData, Integer> entityVsMaxCount = new HashMap<QueryHeaderData, Integer>(); private final EntityInterface rootEntity; private final IConstraints constraints; private Map<IExpression,BaseAbstractAttributeInterface> expVsAssoc = new HashMap<IExpression, BaseAbstractAttributeInterface>(); private Map<IExpression,BaseAbstractAttributeInterface> tgtExpVsAssoc = new HashMap<IExpression, BaseAbstractAttributeInterface>(); public QueryExportDataHandler(IExpression rootExp, IConstraints constraints) { if(rootExp == null) { rootEntity = null; } else { rootEntity = rootExp.getQueryEntity().getDynamicExtensionsEntity(); } this.constraints = constraints; } public EntityInterface getRootExp() { return rootEntity; } /** * @param entityVsAssoc the entityVsAssoc to set */ public void setExpVsAssoc(Map<IExpression,BaseAbstractAttributeInterface> expVsAssoc) { this.expVsAssoc = expVsAssoc; } /** * @return the entityVsAssoc */ public Map<IExpression,BaseAbstractAttributeInterface> getExpVsAssoc() { return expVsAssoc; } public void setTgtExpVsAssoc( Map<IExpression, BaseAbstractAttributeInterface> tgtExpVsAssoc) { this.tgtExpVsAssoc = tgtExpVsAssoc; } /** * @return the tgtEntityVsAssoc */ public Map<IExpression, BaseAbstractAttributeInterface> getTgtExpVsAssoc() { return tgtExpVsAssoc; } /** * Gets the list of associations & attributes for the passed entity. * @param expression entity * @return finalList finalList */ private Collection<AbstractAttributeInterface> getAbstractAttributeCollection( IExpression expression) { Collection<AbstractAttributeInterface> finalList = new ArrayList<AbstractAttributeInterface>(); Collection<AttributeInterface> attributeList = expression.getQueryEntity().getDynamicExtensionsEntity().getAllAttributes(); Collection<AbstractAttributeInterface> associationList = getActualAssociations(expression); finalList.addAll(attributeList); finalList.addAll(associationList); for(IExpression exp : expVsAssoc.keySet()) { if(exp.equals(expression)) { AbstractAttributeInterface assocInterface = (AbstractAttributeInterface)expVsAssoc.get(exp); if(assocInterface != null && !finalList.contains(assocInterface)) { finalList.add(assocInterface); } } } return finalList; } /** * Gets only those associations that are present in the formed query. * @param expression expression * @return finalList */ private List<AbstractAttributeInterface> getActualAssociations( IExpression expression) { List<AbstractAttributeInterface> assocList = new ArrayList<AbstractAttributeInterface>(); JoinGraph joinGraph = (JoinGraph)constraints.getJoinGraph(); IIntraModelAssociation association; for(IExpression exp : constraints) { if(joinGraph.containsAssociation(expression, exp)) { association = (IIntraModelAssociation)joinGraph.getAssociation(expression, exp); if(!assocList.contains(association.getDynamicExtensionsAssociation())) { assocList.add(association.getDynamicExtensionsAssociation()); } } } return assocList; } /** * Returns a list which contains data related only to the entity passed * (This is possible when the query contains an association twice & so there is list of data * for more than one entity corresponding to same association). * @param tempList tempList * @param expression entity * @param selectedColumnsMetadata * @return newList */ public List updateTempList(List tempList, IExpression expression, SelectedColumnsMetadata selectedColumnsMetadata) { List newList = new ArrayList(); Map<OutputAssociationColumn, Object> newMap; Collection<AbstractAttributeInterface> attributeList = getAbstractAttributeCollection(expression); for(int cnt=0;cnt<tempList.size();cnt++) { newMap = new HashMap<OutputAssociationColumn, Object>(); Map<OutputAssociationColumn, Object> obj = (Map<OutputAssociationColumn, Object>) tempList.get(cnt); for(OutputAssociationColumn attribute : obj.keySet()) { if(attributeList.contains(attribute.getAbstractAttr())) { newMap.put(attribute, obj.get(attribute)); } } // this is needed id node is added in view mode & there is no record for it to display then empty record needs to be added in tree. if(obj.isEmpty()) { newMap = getEmptyRecordMap(expression,selectedColumnsMetadata); } if(!newMap.isEmpty()) { newList.add(newMap); } } return newList; } private Map<OutputAssociationColumn, Object> getEmptyRecordMap(IExpression expression, SelectedColumnsMetadata selectedColumnsMetadata) { Map<OutputAssociationColumn, Object> record = new HashMap<OutputAssociationColumn, Object>(); Collection<AttributeInterface> attributeList = expression.getQueryEntity() .getDynamicExtensionsEntity().getAttributeCollection(); for (AttributeInterface attribute : attributeList) { OutputAttributeColumn opAttrCol = null; String value; int columnIndex = -1; for (QueryOutputTreeAttributeMetadata outputTreeAttributeMetadata : selectedColumnsMetadata .getSelectedAttributeMetaDataList()) { columnIndex++; BaseAbstractAttributeInterface presentAttribute = outputTreeAttributeMetadata .getAttribute(); if (presentAttribute.equals(attribute) && outputTreeAttributeMetadata.getTreeDataNode().getExpressionId() == expression .getExpressionId()) { value = " "; opAttrCol = new OutputAttributeColumn(value, columnIndex, attribute, expression, null); break; } } if (opAttrCol != null) { OutputAssociationColumn opAssocCol = new OutputAssociationColumn(attribute, expression, null); record.put(opAssocCol, opAttrCol); } } return record; } /** * Add all the associations (of parents) and then * filter the list to contain only the required attributes and associations. * @param queryHeaderData queryHeaderData * @return attributeList */ public List<AbstractAttributeInterface> getFinalAttributeList( EntityInterface entity) { List<AbstractAttributeInterface> attributeList = (List<AbstractAttributeInterface>) entity.getAllAbstractAttributes(); List<AbstractAttributeInterface> newAttributeList = new ArrayList<AbstractAttributeInterface>(); for(AbstractAttributeInterface attribute : attributeList) { populateNewAttributeList(entity, newAttributeList, attribute); } for(IExpression exp : expVsAssoc.keySet()) { populateNewAttrList(entity, newAttributeList, exp); } return newAttributeList; } /** * Populate the final attribute list by adding all the associations (of parents) and then * filter the list to contain only the required attributes and associations. * @param entity entity * @param newAttributeList newAttributeList * @param exp expression */ private void populateNewAttrList(EntityInterface entity, List<AbstractAttributeInterface> newAttributeList, IExpression exp) { if(exp.getQueryEntity().getDynamicExtensionsEntity().equals(entity)) { AbstractAttributeInterface assocInterface = (AbstractAttributeInterface)expVsAssoc.get(exp); if(assocInterface != null && !newAttributeList.contains(assocInterface)) { newAttributeList.add(assocInterface); } } } /** * Populate new attribute list. * @param entity entity * @param newAttributeList newAttributeList * @param attribute attribute */ private void populateNewAttributeList(EntityInterface entity, List<AbstractAttributeInterface> newAttributeList, AbstractAttributeInterface attribute) { if(attribute instanceof AssociationInterface) { if(!((AssociationInterface)attribute).getTargetEntity().getName(). equals(entity.getName())) { newAttributeList.add(attribute); } } else { newAttributeList.add(attribute); } } /** * Get maximum record count for a particular QueryHeaderData object. * @param queryHeaderData queryHeaderData * @return maxCount */ public Integer getMaxRecordCountForQueryHeader( QueryHeaderData queryHeaderData) { Integer maxCount = entityVsMaxCount.get(queryHeaderData); if (maxCount == null) { maxCount = 0; } return maxCount; } }
9,793
0.741244
0.740937
305
30.108196
30.04649
134
false
false
0
0
0
0
0
0
2.226229
false
false
0
4c7a5f19935f5030633fba1c13368a665b798b68
27,599,459,869,332
c6bb8c1c1929e854a9f2e5ae0607fcee4f6d221d
/modules/global/src/com/company/rabbitmqsendconsume/constant/MqValues.java
4a4ba1f03751a85c123e4e1160ee1ad5db3b3d6a
[]
no_license
ThomasItMe/RabbitMQ-With-Cuba
https://github.com/ThomasItMe/RabbitMQ-With-Cuba
7b28dad41b02ed76f110ae0c0606d3ef87cac0d4
4a91bff4ba2525fb0e39dbacf1e4aa843d5d9831
refs/heads/master
2022-12-30T08:10:55.094000
2020-10-20T18:58:07
2020-10-20T18:58:07
305,805,002
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.company.rabbitmqsendconsume.constant; import com.haulmont.chile.core.annotations.MetaClass; import com.haulmont.cuba.core.entity.BaseUuidEntity; @MetaClass(name = "rabbitmqsendconsume_NewEntity") public class MqValues extends BaseUuidEntity { private static final long serialVersionUID = -4025724754485348767L; public static final String QUEUE = "queue"; public static final String EXCHANGE = "exchange"; public static final String ROUTINGKEY = "routingkey"; }
UTF-8
Java
491
java
MqValues.java
Java
[]
null
[]
package com.company.rabbitmqsendconsume.constant; import com.haulmont.chile.core.annotations.MetaClass; import com.haulmont.cuba.core.entity.BaseUuidEntity; @MetaClass(name = "rabbitmqsendconsume_NewEntity") public class MqValues extends BaseUuidEntity { private static final long serialVersionUID = -4025724754485348767L; public static final String QUEUE = "queue"; public static final String EXCHANGE = "exchange"; public static final String ROUTINGKEY = "routingkey"; }
491
0.792261
0.753564
13
36.846153
25.099329
71
false
false
0
0
0
0
0
0
0.538462
false
false
0
0df71cc73efea00122c3a1690175e3bc624b86e1
10,651,518,926,874
58dca11908cbdba234461fb220584f3888c95ab6
/fhGUI/imageFinder.java
277aa04def9eb61beaab915f35657ca808fc6063
[]
no_license
holiday1994/FHRPG
https://github.com/holiday1994/FHRPG
d58a7a0b90d8ca59523fc40422e3b2a05e837009
06e4362708858e1b22abf4a774be967b4badcd0a
refs/heads/master
2020-03-13T02:21:49.736000
2018-04-24T23:05:57
2018-04-24T23:05:57
130,923,166
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 fhGUI; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import javafx.application.Application; import javafx.embed.swing.SwingFXUtils; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.VBox; import javafx.stage.FileChooser; import javafx.stage.Stage; import javax.imageio.ImageIO; public class imageFinder { void image(ImageView myImageView){ FileChooser fileChooser = new FileChooser(); //Set extension filter FileChooser.ExtensionFilter extFilterJPG = new FileChooser.ExtensionFilter("JPG files (*.jpg)", "*.JPG"); FileChooser.ExtensionFilter extFilterPNG = new FileChooser.ExtensionFilter("PNG files (*.png)", "*.PNG"); fileChooser.getExtensionFilters().addAll(extFilterJPG, extFilterPNG); //Show open file dialog File file = fileChooser.showOpenDialog(null); try { BufferedImage bufferedImage = ImageIO.read(file); Image image = SwingFXUtils.toFXImage(bufferedImage, null); myImageView.setImage(image); } catch (IOException ex) { Logger.getLogger(imageFinder.class.getName()).log(Level.SEVERE, null, ex); } } }
UTF-8
Java
1,756
java
imageFinder.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 fhGUI; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import javafx.application.Application; import javafx.embed.swing.SwingFXUtils; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.VBox; import javafx.stage.FileChooser; import javafx.stage.Stage; import javax.imageio.ImageIO; public class imageFinder { void image(ImageView myImageView){ FileChooser fileChooser = new FileChooser(); //Set extension filter FileChooser.ExtensionFilter extFilterJPG = new FileChooser.ExtensionFilter("JPG files (*.jpg)", "*.JPG"); FileChooser.ExtensionFilter extFilterPNG = new FileChooser.ExtensionFilter("PNG files (*.png)", "*.PNG"); fileChooser.getExtensionFilters().addAll(extFilterJPG, extFilterPNG); //Show open file dialog File file = fileChooser.showOpenDialog(null); try { BufferedImage bufferedImage = ImageIO.read(file); Image image = SwingFXUtils.toFXImage(bufferedImage, null); myImageView.setImage(image); } catch (IOException ex) { Logger.getLogger(imageFinder.class.getName()).log(Level.SEVERE, null, ex); } } }
1,756
0.67369
0.67369
53
32.132076
27.973059
117
false
false
0
0
0
0
0
0
0.679245
false
false
0
5bd5f9992532f30d35d269653a8c0280b409d100
13,855,564,547,974
c5e03d650219ca996397e7528f700a9fc4452fb4
/src/main/java/net/sourceforge/fenixedu/domain/student/StudentNumber.java
e516044b840d963a341c2da4ee5fb16f6f831b31
[]
no_license
bertvh/fenix
https://github.com/bertvh/fenix
d8f61b7b7a1d73001cfa0dd9d42d059cce403fc6
1c8cadcfeb77d37b8a6d13cbdfcf1901f9da4cde
refs/heads/master
2021-01-16T13:36:05.327000
2013-07-30T17:39:55
2013-07-30T17:39:55
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.sourceforge.fenixedu.domain.student; import net.sourceforge.fenixedu.domain.RootDomainObject; import net.sourceforge.fenixedu.domain.exceptions.DomainException; public class StudentNumber extends StudentNumber_Base { public StudentNumber(final Student student) { super(); String[] args = {}; if (student == null) { throw new DomainException("error.StudentNumber.invalid.student", args); } setRootDomainObject(RootDomainObject.getInstance()); setStudent(student); setNumber(student.getNumber()); } public void delete() { removeRootDomainObject(); removeStudent(); super.deleteDomainObject(); } }
UTF-8
Java
719
java
StudentNumber.java
Java
[]
null
[]
package net.sourceforge.fenixedu.domain.student; import net.sourceforge.fenixedu.domain.RootDomainObject; import net.sourceforge.fenixedu.domain.exceptions.DomainException; public class StudentNumber extends StudentNumber_Base { public StudentNumber(final Student student) { super(); String[] args = {}; if (student == null) { throw new DomainException("error.StudentNumber.invalid.student", args); } setRootDomainObject(RootDomainObject.getInstance()); setStudent(student); setNumber(student.getNumber()); } public void delete() { removeRootDomainObject(); removeStudent(); super.deleteDomainObject(); } }
719
0.675939
0.675939
24
28.958334
23.693317
83
false
false
0
0
0
0
0
0
0.541667
false
false
0
c5fd170a9c8ed7b5a50bb76aa549a2419ff1e163
2,585,570,372,196
52142f91929474d3998130d8ffc75365da8d4e43
/flamingo-agent-nn/src/main/java/org/exem/flamingo/agent/nn/hdfs/HdfsBlockInfo.java
bbd799e32aaf5173320e89c0eb6983a1247c8102
[ "Apache-2.0" ]
permissive
shm7255/flamingo
https://github.com/shm7255/flamingo
736fb789c243c4680726651ddfcf1d88e146af8e
44772b6768c9e190fc9467324e9ac961d0aba329
refs/heads/master
2021-06-11T23:32:16.374000
2017-02-06T07:07:22
2017-02-06T07:07:22
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.exem.flamingo.agent.nn.hdfs; import java.util.List; /** * HDFS Block의 메타 정보 * * @author Kyeong Sik, Kim * @since 0.1 */ public class HdfsBlockInfo { private long blockSize; private int liveReplicas; private List<String> replicationNodeList; private long blockId; private String blockName; private String blockPoolId; private long generationStamp; public long getBlockSize() { return blockSize; } public void setBlockSize(long blockSize) { this.blockSize = blockSize; } public int getLiveReplicas() { return liveReplicas; } public void setLiveReplicas(int liveReplicas) { this.liveReplicas = liveReplicas; } public List<String> getReplicationNodeList() { return replicationNodeList; } public void setReplicationNodeList(List<String> replicationNodeList) { this.replicationNodeList = replicationNodeList; } public long getBlockId() { return blockId; } public void setBlockId(long blockId) { this.blockId = blockId; } public String getBlockName() { return blockName; } public void setBlockName(String blockName) { this.blockName = blockName; } public String getBlockPoolId() { return blockPoolId; } public void setBlockPoolId(String blockPoolId) { this.blockPoolId = blockPoolId; } public long getGenerationStamp() { return generationStamp; } public void setGenerationStamp(long generationStamp) { this.generationStamp = generationStamp; } @Override public String toString() { return "HdfsBlockInfo{" + "blockSize=" + blockSize + ", liveReplicas=" + liveReplicas + ", replicationNodeList=" + replicationNodeList + ", blockId=" + blockId + ", blockName=" + blockName + ", blockPoolId=" + blockPoolId + ", generationStamp=" + generationStamp + '}'; } }
UTF-8
Java
2,098
java
HdfsBlockInfo.java
Java
[ { "context": "util.List;\n\n/**\n * HDFS Block의 메타 정보\n *\n * @author Kyeong Sik, Kim\n * @since 0.1\n */\npublic class HdfsBlockInfo ", "end": 115, "score": 0.9776559472084045, "start": 105, "tag": "NAME", "value": "Kyeong Sik" }, { "context": "/**\n * HDFS Block의 메타 정보\n *\n * @aut...
null
[]
package org.exem.flamingo.agent.nn.hdfs; import java.util.List; /** * HDFS Block의 메타 정보 * * @author <NAME>, Kim * @since 0.1 */ public class HdfsBlockInfo { private long blockSize; private int liveReplicas; private List<String> replicationNodeList; private long blockId; private String blockName; private String blockPoolId; private long generationStamp; public long getBlockSize() { return blockSize; } public void setBlockSize(long blockSize) { this.blockSize = blockSize; } public int getLiveReplicas() { return liveReplicas; } public void setLiveReplicas(int liveReplicas) { this.liveReplicas = liveReplicas; } public List<String> getReplicationNodeList() { return replicationNodeList; } public void setReplicationNodeList(List<String> replicationNodeList) { this.replicationNodeList = replicationNodeList; } public long getBlockId() { return blockId; } public void setBlockId(long blockId) { this.blockId = blockId; } public String getBlockName() { return blockName; } public void setBlockName(String blockName) { this.blockName = blockName; } public String getBlockPoolId() { return blockPoolId; } public void setBlockPoolId(String blockPoolId) { this.blockPoolId = blockPoolId; } public long getGenerationStamp() { return generationStamp; } public void setGenerationStamp(long generationStamp) { this.generationStamp = generationStamp; } @Override public String toString() { return "HdfsBlockInfo{" + "blockSize=" + blockSize + ", liveReplicas=" + liveReplicas + ", replicationNodeList=" + replicationNodeList + ", blockId=" + blockId + ", blockName=" + blockName + ", blockPoolId=" + blockPoolId + ", generationStamp=" + generationStamp + '}'; } }
2,094
0.614464
0.613506
94
21.212767
19.664133
74
false
false
0
0
0
0
0
0
0.329787
false
false
0
542e86cf4a96943a93bdce0d75773a5c3b519084
5,574,867,607,954
7822eb2f86317aebf6e689da2a6708e9cc4ee1ea
/Rachio_apk/sources/com/fasterxml/jackson/databind/util/ClassUtil.java
59e824846ba348f9b311460b4074073d76ce7380
[ "BSD-2-Clause" ]
permissive
UCLA-ECE209AS-2018W/Haoming-Liang
https://github.com/UCLA-ECE209AS-2018W/Haoming-Liang
9abffa33df9fc7be84c993873dac39159b05ef04
f567ae0adc327b669259c94cc49f9b29f50d1038
refs/heads/master
2021-04-06T20:29:41.296000
2018-03-21T05:39:43
2018-03-21T05:39:43
125,328,864
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.fasterxml.jackson.databind.util; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonGenerator.Feature; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; import com.fasterxml.jackson.databind.annotation.NoClass; import java.io.Closeable; import java.io.IOException; import java.lang.annotation.Annotation; import java.lang.reflect.AccessibleObject; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Member; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.EnumMap; import java.util.EnumSet; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.NoSuchElementException; public final class ClassUtil { private static final Class<?> CLS_OBJECT = Object.class; private static final EmptyIterator<?> EMPTY_ITERATOR = new EmptyIterator(); private static final Annotation[] NO_ANNOTATIONS = new Annotation[0]; private static final Ctor[] NO_CTORS = new Ctor[0]; public static final class Ctor { private Annotation[] _annotations; public final Constructor<?> _ctor; private Annotation[][] _paramAnnotations; private int _paramCount = -1; public Ctor(Constructor<?> ctor) { this._ctor = ctor; } public final Constructor<?> getConstructor() { return this._ctor; } public final int getParamCount() { int c = this._paramCount; if (c >= 0) { return c; } c = this._ctor.getParameterTypes().length; this._paramCount = c; return c; } public final Class<?> getDeclaringClass() { return this._ctor.getDeclaringClass(); } public final Annotation[] getDeclaredAnnotations() { Annotation[] result = this._annotations; if (result != null) { return result; } result = this._ctor.getDeclaredAnnotations(); this._annotations = result; return result; } public final Annotation[][] getParameterAnnotations() { Annotation[][] result = this._paramAnnotations; if (result != null) { return result; } result = this._ctor.getParameterAnnotations(); this._paramAnnotations = result; return result; } } private static final class EmptyIterator<T> implements Iterator<T> { private EmptyIterator() { } public final boolean hasNext() { return false; } public final T next() { throw new NoSuchElementException(); } public final void remove() { throw new UnsupportedOperationException(); } } private static class EnumTypeLocator { static final EnumTypeLocator instance = new EnumTypeLocator(); private final Field enumMapTypeField = locateField(EnumMap.class, "elementType", Class.class); private final Field enumSetTypeField = locateField(EnumSet.class, "elementType", Class.class); private EnumTypeLocator() { } public Class<? extends Enum<?>> enumTypeFor(EnumSet<?> set) { if (this.enumSetTypeField != null) { return (Class) get(set, this.enumSetTypeField); } throw new IllegalStateException("Can not figure out type for EnumSet (odd JDK platform?)"); } public Class<? extends Enum<?>> enumTypeFor(EnumMap<?, ?> set) { if (this.enumMapTypeField != null) { return (Class) get(set, this.enumMapTypeField); } throw new IllegalStateException("Can not figure out type for EnumMap (odd JDK platform?)"); } private Object get(Object bean, Field field) { try { return field.get(bean); } catch (Exception e) { throw new IllegalArgumentException(e); } } private static Field locateField(Class<?> fromClass, String expectedName, Class<?> type) { int i$; Field found = null; Field[] fields = ClassUtil.getDeclaredFields(fromClass); Field[] arr$ = fields; int len$ = fields.length; for (i$ = 0; i$ < len$; i$++) { Field f = arr$[i$]; if (expectedName.equals(f.getName()) && f.getType() == type) { found = f; break; } } if (found == null) { arr$ = fields; len$ = fields.length; for (i$ = 0; i$ < len$; i$++) { f = arr$[i$]; if (f.getType() == type) { if (found != null) { return null; } found = f; } } } if (found != null) { try { found.setAccessible(true); } catch (Throwable th) { } } return found; } } public static <T> Iterator<T> emptyIterator() { return EMPTY_ITERATOR; } public static List<JavaType> findSuperTypes(JavaType type, Class<?> endBefore, boolean addClassItself) { if (type == null || type.hasRawClass(endBefore) || type.hasRawClass(Object.class)) { return Collections.emptyList(); } List<JavaType> result = new ArrayList(8); _addSuperTypes(type, endBefore, result, addClassItself); return result; } public static List<Class<?>> findRawSuperTypes(Class<?> cls, Class<?> endBefore, boolean addClassItself) { if (cls == null || cls == endBefore || cls == Object.class) { return Collections.emptyList(); } List<Class<?>> result = new ArrayList(8); _addRawSuperTypes(cls, endBefore, result, addClassItself); return result; } public static List<Class<?>> findSuperClasses(Class<?> cls, Class<?> endBefore, boolean addClassItself) { List<Class<?>> result = new LinkedList(); if (cls != null && cls != endBefore) { if (addClassItself) { result.add(cls); } while (true) { cls = cls.getSuperclass(); if (cls == null || cls == endBefore) { break; } result.add(cls); } } return result; } @Deprecated public static List<Class<?>> findSuperTypes(Class<?> cls, Class<?> endBefore) { return findSuperTypes((Class) cls, (Class) endBefore, new ArrayList(8)); } @Deprecated public static List<Class<?>> findSuperTypes(Class<?> cls, Class<?> endBefore, List<Class<?>> result) { _addRawSuperTypes(cls, endBefore, result, false); return result; } private static void _addSuperTypes(JavaType type, Class<?> endBefore, Collection<JavaType> result, boolean addClassItself) { while (type != null) { Class<?> cls = type.getRawClass(); if (cls != endBefore && cls != Object.class) { if (addClassItself) { if (!result.contains(type)) { result.add(type); } else { return; } } for (JavaType intCls : type.getInterfaces()) { _addSuperTypes(intCls, endBefore, result, true); } type = type.getSuperClass(); addClassItself = true; } else { return; } } } private static void _addRawSuperTypes(Class<?> cls, Class<?> endBefore, Collection<Class<?>> result, boolean addClassItself) { while (cls != endBefore && cls != null && cls != Object.class) { if (addClassItself) { if (!result.contains(cls)) { result.add(cls); } else { return; } } for (Class<?> intCls : _interfaces(cls)) { _addRawSuperTypes(intCls, endBefore, result, true); } cls = cls.getSuperclass(); addClassItself = true; } } public static String canBeABeanType(Class<?> type) { if (type.isAnnotation()) { return "annotation"; } if (type.isArray()) { return "array"; } if (type.isEnum()) { return "enum"; } if (type.isPrimitive()) { return "primitive"; } return null; } public static String isLocalType(Class<?> type, boolean allowNonStatic) { try { if (hasEnclosingMethod(type)) { return "local/anonymous"; } if (!(allowNonStatic || Modifier.isStatic(type.getModifiers()) || getEnclosingClass(type) == null)) { return "non-static member class"; } return null; } catch (SecurityException e) { } catch (NullPointerException e2) { } } public static Class<?> getOuterClass(Class<?> type) { Class<?> cls = null; try { if (!(hasEnclosingMethod(type) || Modifier.isStatic(type.getModifiers()))) { cls = getEnclosingClass(type); } } catch (SecurityException e) { } return cls; } public static boolean isProxyType(Class<?> type) { String name = type.getName(); if (name.startsWith("net.sf.cglib.proxy.") || name.startsWith("org.hibernate.proxy.")) { return true; } return false; } public static boolean isConcrete(Class<?> type) { return (type.getModifiers() & 1536) == 0; } public static boolean isConcrete(Member member) { return (member.getModifiers() & 1536) == 0; } public static boolean isCollectionMapOrArray(Class<?> type) { if (type.isArray() || Collection.class.isAssignableFrom(type) || Map.class.isAssignableFrom(type)) { return true; } return false; } public static String getClassDescription(Object classOrInstance) { if (classOrInstance == null) { return "unknown"; } return (classOrInstance instanceof Class ? (Class) classOrInstance : classOrInstance.getClass()).getName(); } @Deprecated public static Class<?> findClass(String className) throws ClassNotFoundException { if (className.indexOf(46) < 0) { if ("int".equals(className)) { return Integer.TYPE; } if ("long".equals(className)) { return Long.TYPE; } if ("float".equals(className)) { return Float.TYPE; } if ("double".equals(className)) { return Double.TYPE; } if ("boolean".equals(className)) { return Boolean.TYPE; } if ("byte".equals(className)) { return Byte.TYPE; } if ("char".equals(className)) { return Character.TYPE; } if ("short".equals(className)) { return Short.TYPE; } if ("void".equals(className)) { return Void.TYPE; } } Throwable prob = null; ClassLoader loader = Thread.currentThread().getContextClassLoader(); if (loader != null) { try { return Class.forName(className, true, loader); } catch (Exception e) { prob = getRootCause(e); } } try { return Class.forName(className); } catch (Exception e2) { if (prob == null) { prob = getRootCause(e2); } if (prob instanceof RuntimeException) { throw ((RuntimeException) prob); } throw new ClassNotFoundException(prob.getMessage(), prob); } } @Deprecated public static boolean hasGetterSignature(Method m) { if (Modifier.isStatic(m.getModifiers())) { return false; } Class<?>[] pts = m.getParameterTypes(); if ((pts == null || pts.length == 0) && Void.TYPE != m.getReturnType()) { return true; } return false; } public static Throwable getRootCause(Throwable t) { while (t.getCause() != null) { t = t.getCause(); } return t; } public static void throwRootCause(Throwable t) throws Exception { t = getRootCause(t); if (t instanceof Exception) { throw ((Exception) t); } throw ((Error) t); } public static Throwable throwRootCauseIfIOE(Throwable t) throws IOException { t = getRootCause(t); if (!(t instanceof IOException)) { return t; } throw ((IOException) t); } public static void throwAsIAE(Throwable t) { throwAsIAE(t, t.getMessage()); } public static void throwAsIAE(Throwable t, String msg) { if (t instanceof RuntimeException) { throw ((RuntimeException) t); } else if (t instanceof Error) { throw ((Error) t); } else { throw new IllegalArgumentException(msg, t); } } public static void unwrapAndThrowAsIAE(Throwable t) { throwAsIAE(getRootCause(t)); } public static void unwrapAndThrowAsIAE(Throwable t, String msg) { throwAsIAE(getRootCause(t), msg); } public static void closeOnFailAndThrowAsIAE(JsonGenerator g, Exception fail) throws IOException { g.disable(Feature.AUTO_CLOSE_JSON_CONTENT); try { g.close(); } catch (Exception e) { fail.addSuppressed(e); } if (fail instanceof IOException) { throw ((IOException) fail); } else if (fail instanceof RuntimeException) { throw ((RuntimeException) fail); } else { throw new RuntimeException(fail); } } public static void closeOnFailAndThrowAsIAE(JsonGenerator g, Closeable toClose, Exception fail) throws IOException { if (g != null) { g.disable(Feature.AUTO_CLOSE_JSON_CONTENT); try { g.close(); } catch (Exception e) { fail.addSuppressed(e); } } if (toClose != null) { try { toClose.close(); } catch (Exception e2) { fail.addSuppressed(e2); } } if (fail instanceof IOException) { throw ((IOException) fail); } else if (fail instanceof RuntimeException) { throw ((RuntimeException) fail); } else { throw new RuntimeException(fail); } } public static <T> T createInstance(Class<T> cls, boolean canFixAccess) throws IllegalArgumentException { Constructor<T> ctor = findConstructor(cls, canFixAccess); if (ctor == null) { throw new IllegalArgumentException("Class " + cls.getName() + " has no default (no arg) constructor"); } try { return ctor.newInstance(new Object[0]); } catch (Exception e) { unwrapAndThrowAsIAE(e, "Failed to instantiate class " + cls.getName() + ", problem: " + e.getMessage()); return null; } } public static <T> Constructor<T> findConstructor(Class<T> cls, boolean canFixAccess) throws IllegalArgumentException { try { Constructor<T> ctor = cls.getDeclaredConstructor(new Class[0]); if (canFixAccess) { checkAndFixAccess(ctor); return ctor; } else if (Modifier.isPublic(ctor.getModifiers())) { return ctor; } else { throw new IllegalArgumentException("Default constructor for " + cls.getName() + " is not accessible (non-public?): not allowed to try modify access via Reflection: can not instantiate type"); } } catch (NoSuchMethodException e) { return null; } catch (Exception e2) { unwrapAndThrowAsIAE(e2, "Failed to find default constructor of class " + cls.getName() + ", problem: " + e2.getMessage()); return null; } } public static Object defaultValue(Class<?> cls) { if (cls == Integer.TYPE) { return Integer.valueOf(0); } if (cls == Long.TYPE) { return Long.valueOf(0); } if (cls == Boolean.TYPE) { return Boolean.FALSE; } if (cls == Double.TYPE) { return Double.valueOf(0.0d); } if (cls == Float.TYPE) { return Float.valueOf(0.0f); } if (cls == Byte.TYPE) { return Byte.valueOf((byte) 0); } if (cls == Short.TYPE) { return Short.valueOf((short) 0); } if (cls == Character.TYPE) { return Character.valueOf('\u0000'); } throw new IllegalArgumentException("Class " + cls.getName() + " is not a primitive type"); } public static Class<?> wrapperType(Class<?> primitiveType) { if (primitiveType == Integer.TYPE) { return Integer.class; } if (primitiveType == Long.TYPE) { return Long.class; } if (primitiveType == Boolean.TYPE) { return Boolean.class; } if (primitiveType == Double.TYPE) { return Double.class; } if (primitiveType == Float.TYPE) { return Float.class; } if (primitiveType == Byte.TYPE) { return Byte.class; } if (primitiveType == Short.TYPE) { return Short.class; } if (primitiveType == Character.TYPE) { return Character.class; } throw new IllegalArgumentException("Class " + primitiveType.getName() + " is not a primitive type"); } public static Class<?> primitiveType(Class<?> type) { if (type.isPrimitive()) { return type; } if (type == Integer.class) { return Integer.TYPE; } if (type == Long.class) { return Long.TYPE; } if (type == Boolean.class) { return Boolean.TYPE; } if (type == Double.class) { return Double.TYPE; } if (type == Float.class) { return Float.TYPE; } if (type == Byte.class) { return Byte.TYPE; } if (type == Short.class) { return Short.TYPE; } if (type == Character.class) { return Character.TYPE; } return null; } @Deprecated public static void checkAndFixAccess(Member member) { checkAndFixAccess(member, false); } public static void checkAndFixAccess(Member member, boolean force) { AccessibleObject ao = (AccessibleObject) member; if (!force) { try { if (Modifier.isPublic(member.getModifiers()) && Modifier.isPublic(member.getDeclaringClass().getModifiers())) { return; } } catch (SecurityException se) { if (!ao.isAccessible()) { throw new IllegalArgumentException("Can not access " + member + " (from class " + member.getDeclaringClass().getName() + "; failed to set access: " + se.getMessage()); } return; } } ao.setAccessible(true); } public static Class<? extends Enum<?>> findEnumType(EnumSet<?> s) { if (s.isEmpty()) { return EnumTypeLocator.instance.enumTypeFor((EnumSet) s); } return findEnumType((Enum) s.iterator().next()); } public static Class<? extends Enum<?>> findEnumType(EnumMap<?, ?> m) { if (m.isEmpty()) { return EnumTypeLocator.instance.enumTypeFor((EnumMap) m); } return findEnumType((Enum) m.keySet().iterator().next()); } public static Class<? extends Enum<?>> findEnumType(Enum<?> en) { Class<?> ec = en.getClass(); if (ec.getSuperclass() != Enum.class) { return ec.getSuperclass(); } return ec; } public static Class<? extends Enum<?>> findEnumType(Class<?> cls) { if (cls.getSuperclass() != Enum.class) { return cls.getSuperclass(); } return cls; } public static <T extends Annotation> Enum<?> findFirstAnnotatedEnumValue(Class<Enum<?>> enumClass, Class<T> annotationClass) { Field[] fields = getDeclaredFields(enumClass); Field[] fieldArr = fields; int len$ = fields.length; for (int i = 0; i < len$; i++) { Field field = fieldArr[i]; if (field.isEnumConstant() && field.getAnnotation(annotationClass) != null) { String name = field.getName(); for (Enum<?> enumValue : (Enum[]) enumClass.getEnumConstants()) { if (name.equals(enumValue.name())) { return enumValue; } } continue; } } return null; } public static boolean isJacksonStdImpl(Object impl) { return impl != null && isJacksonStdImpl(impl.getClass()); } public static boolean isJacksonStdImpl(Class<?> implClass) { return implClass.getAnnotation(JacksonStdImpl.class) != null; } public static boolean isBogusClass(Class<?> cls) { return cls == Void.class || cls == Void.TYPE || cls == NoClass.class; } public static boolean isNonStaticInnerClass(Class<?> cls) { return (Modifier.isStatic(cls.getModifiers()) || getEnclosingClass(cls) == null) ? false : true; } public static boolean isObjectOrPrimitive(Class<?> cls) { return cls == CLS_OBJECT || cls.isPrimitive(); } public static String getPackageName(Class<?> cls) { Package pkg = cls.getPackage(); return pkg == null ? null : pkg.getName(); } public static boolean hasEnclosingMethod(Class<?> cls) { return (isObjectOrPrimitive(cls) || cls.getEnclosingMethod() == null) ? false : true; } public static Field[] getDeclaredFields(Class<?> cls) { return cls.getDeclaredFields(); } public static Method[] getDeclaredMethods(Class<?> cls) { return cls.getDeclaredMethods(); } public static Annotation[] findClassAnnotations(Class<?> cls) { if (isObjectOrPrimitive(cls)) { return NO_ANNOTATIONS; } return cls.getDeclaredAnnotations(); } public static Ctor[] getConstructors(Class<?> cls) { if (cls.isInterface() || isObjectOrPrimitive(cls)) { return NO_CTORS; } Constructor<?>[] rawCtors = cls.getDeclaredConstructors(); int len = rawCtors.length; Ctor[] result = new Ctor[len]; for (int i = 0; i < len; i++) { result[i] = new Ctor(rawCtors[i]); } return result; } public static Class<?> getDeclaringClass(Class<?> cls) { return isObjectOrPrimitive(cls) ? null : cls.getDeclaringClass(); } public static Type getGenericSuperclass(Class<?> cls) { return cls.getGenericSuperclass(); } public static Type[] getGenericInterfaces(Class<?> cls) { return cls.getGenericInterfaces(); } public static Class<?> getEnclosingClass(Class<?> cls) { return isObjectOrPrimitive(cls) ? null : cls.getEnclosingClass(); } private static Class<?>[] _interfaces(Class<?> cls) { return cls.getInterfaces(); } }
UTF-8
Java
24,602
java
ClassUtil.java
Java
[]
null
[]
package com.fasterxml.jackson.databind.util; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonGenerator.Feature; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; import com.fasterxml.jackson.databind.annotation.NoClass; import java.io.Closeable; import java.io.IOException; import java.lang.annotation.Annotation; import java.lang.reflect.AccessibleObject; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Member; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.EnumMap; import java.util.EnumSet; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.NoSuchElementException; public final class ClassUtil { private static final Class<?> CLS_OBJECT = Object.class; private static final EmptyIterator<?> EMPTY_ITERATOR = new EmptyIterator(); private static final Annotation[] NO_ANNOTATIONS = new Annotation[0]; private static final Ctor[] NO_CTORS = new Ctor[0]; public static final class Ctor { private Annotation[] _annotations; public final Constructor<?> _ctor; private Annotation[][] _paramAnnotations; private int _paramCount = -1; public Ctor(Constructor<?> ctor) { this._ctor = ctor; } public final Constructor<?> getConstructor() { return this._ctor; } public final int getParamCount() { int c = this._paramCount; if (c >= 0) { return c; } c = this._ctor.getParameterTypes().length; this._paramCount = c; return c; } public final Class<?> getDeclaringClass() { return this._ctor.getDeclaringClass(); } public final Annotation[] getDeclaredAnnotations() { Annotation[] result = this._annotations; if (result != null) { return result; } result = this._ctor.getDeclaredAnnotations(); this._annotations = result; return result; } public final Annotation[][] getParameterAnnotations() { Annotation[][] result = this._paramAnnotations; if (result != null) { return result; } result = this._ctor.getParameterAnnotations(); this._paramAnnotations = result; return result; } } private static final class EmptyIterator<T> implements Iterator<T> { private EmptyIterator() { } public final boolean hasNext() { return false; } public final T next() { throw new NoSuchElementException(); } public final void remove() { throw new UnsupportedOperationException(); } } private static class EnumTypeLocator { static final EnumTypeLocator instance = new EnumTypeLocator(); private final Field enumMapTypeField = locateField(EnumMap.class, "elementType", Class.class); private final Field enumSetTypeField = locateField(EnumSet.class, "elementType", Class.class); private EnumTypeLocator() { } public Class<? extends Enum<?>> enumTypeFor(EnumSet<?> set) { if (this.enumSetTypeField != null) { return (Class) get(set, this.enumSetTypeField); } throw new IllegalStateException("Can not figure out type for EnumSet (odd JDK platform?)"); } public Class<? extends Enum<?>> enumTypeFor(EnumMap<?, ?> set) { if (this.enumMapTypeField != null) { return (Class) get(set, this.enumMapTypeField); } throw new IllegalStateException("Can not figure out type for EnumMap (odd JDK platform?)"); } private Object get(Object bean, Field field) { try { return field.get(bean); } catch (Exception e) { throw new IllegalArgumentException(e); } } private static Field locateField(Class<?> fromClass, String expectedName, Class<?> type) { int i$; Field found = null; Field[] fields = ClassUtil.getDeclaredFields(fromClass); Field[] arr$ = fields; int len$ = fields.length; for (i$ = 0; i$ < len$; i$++) { Field f = arr$[i$]; if (expectedName.equals(f.getName()) && f.getType() == type) { found = f; break; } } if (found == null) { arr$ = fields; len$ = fields.length; for (i$ = 0; i$ < len$; i$++) { f = arr$[i$]; if (f.getType() == type) { if (found != null) { return null; } found = f; } } } if (found != null) { try { found.setAccessible(true); } catch (Throwable th) { } } return found; } } public static <T> Iterator<T> emptyIterator() { return EMPTY_ITERATOR; } public static List<JavaType> findSuperTypes(JavaType type, Class<?> endBefore, boolean addClassItself) { if (type == null || type.hasRawClass(endBefore) || type.hasRawClass(Object.class)) { return Collections.emptyList(); } List<JavaType> result = new ArrayList(8); _addSuperTypes(type, endBefore, result, addClassItself); return result; } public static List<Class<?>> findRawSuperTypes(Class<?> cls, Class<?> endBefore, boolean addClassItself) { if (cls == null || cls == endBefore || cls == Object.class) { return Collections.emptyList(); } List<Class<?>> result = new ArrayList(8); _addRawSuperTypes(cls, endBefore, result, addClassItself); return result; } public static List<Class<?>> findSuperClasses(Class<?> cls, Class<?> endBefore, boolean addClassItself) { List<Class<?>> result = new LinkedList(); if (cls != null && cls != endBefore) { if (addClassItself) { result.add(cls); } while (true) { cls = cls.getSuperclass(); if (cls == null || cls == endBefore) { break; } result.add(cls); } } return result; } @Deprecated public static List<Class<?>> findSuperTypes(Class<?> cls, Class<?> endBefore) { return findSuperTypes((Class) cls, (Class) endBefore, new ArrayList(8)); } @Deprecated public static List<Class<?>> findSuperTypes(Class<?> cls, Class<?> endBefore, List<Class<?>> result) { _addRawSuperTypes(cls, endBefore, result, false); return result; } private static void _addSuperTypes(JavaType type, Class<?> endBefore, Collection<JavaType> result, boolean addClassItself) { while (type != null) { Class<?> cls = type.getRawClass(); if (cls != endBefore && cls != Object.class) { if (addClassItself) { if (!result.contains(type)) { result.add(type); } else { return; } } for (JavaType intCls : type.getInterfaces()) { _addSuperTypes(intCls, endBefore, result, true); } type = type.getSuperClass(); addClassItself = true; } else { return; } } } private static void _addRawSuperTypes(Class<?> cls, Class<?> endBefore, Collection<Class<?>> result, boolean addClassItself) { while (cls != endBefore && cls != null && cls != Object.class) { if (addClassItself) { if (!result.contains(cls)) { result.add(cls); } else { return; } } for (Class<?> intCls : _interfaces(cls)) { _addRawSuperTypes(intCls, endBefore, result, true); } cls = cls.getSuperclass(); addClassItself = true; } } public static String canBeABeanType(Class<?> type) { if (type.isAnnotation()) { return "annotation"; } if (type.isArray()) { return "array"; } if (type.isEnum()) { return "enum"; } if (type.isPrimitive()) { return "primitive"; } return null; } public static String isLocalType(Class<?> type, boolean allowNonStatic) { try { if (hasEnclosingMethod(type)) { return "local/anonymous"; } if (!(allowNonStatic || Modifier.isStatic(type.getModifiers()) || getEnclosingClass(type) == null)) { return "non-static member class"; } return null; } catch (SecurityException e) { } catch (NullPointerException e2) { } } public static Class<?> getOuterClass(Class<?> type) { Class<?> cls = null; try { if (!(hasEnclosingMethod(type) || Modifier.isStatic(type.getModifiers()))) { cls = getEnclosingClass(type); } } catch (SecurityException e) { } return cls; } public static boolean isProxyType(Class<?> type) { String name = type.getName(); if (name.startsWith("net.sf.cglib.proxy.") || name.startsWith("org.hibernate.proxy.")) { return true; } return false; } public static boolean isConcrete(Class<?> type) { return (type.getModifiers() & 1536) == 0; } public static boolean isConcrete(Member member) { return (member.getModifiers() & 1536) == 0; } public static boolean isCollectionMapOrArray(Class<?> type) { if (type.isArray() || Collection.class.isAssignableFrom(type) || Map.class.isAssignableFrom(type)) { return true; } return false; } public static String getClassDescription(Object classOrInstance) { if (classOrInstance == null) { return "unknown"; } return (classOrInstance instanceof Class ? (Class) classOrInstance : classOrInstance.getClass()).getName(); } @Deprecated public static Class<?> findClass(String className) throws ClassNotFoundException { if (className.indexOf(46) < 0) { if ("int".equals(className)) { return Integer.TYPE; } if ("long".equals(className)) { return Long.TYPE; } if ("float".equals(className)) { return Float.TYPE; } if ("double".equals(className)) { return Double.TYPE; } if ("boolean".equals(className)) { return Boolean.TYPE; } if ("byte".equals(className)) { return Byte.TYPE; } if ("char".equals(className)) { return Character.TYPE; } if ("short".equals(className)) { return Short.TYPE; } if ("void".equals(className)) { return Void.TYPE; } } Throwable prob = null; ClassLoader loader = Thread.currentThread().getContextClassLoader(); if (loader != null) { try { return Class.forName(className, true, loader); } catch (Exception e) { prob = getRootCause(e); } } try { return Class.forName(className); } catch (Exception e2) { if (prob == null) { prob = getRootCause(e2); } if (prob instanceof RuntimeException) { throw ((RuntimeException) prob); } throw new ClassNotFoundException(prob.getMessage(), prob); } } @Deprecated public static boolean hasGetterSignature(Method m) { if (Modifier.isStatic(m.getModifiers())) { return false; } Class<?>[] pts = m.getParameterTypes(); if ((pts == null || pts.length == 0) && Void.TYPE != m.getReturnType()) { return true; } return false; } public static Throwable getRootCause(Throwable t) { while (t.getCause() != null) { t = t.getCause(); } return t; } public static void throwRootCause(Throwable t) throws Exception { t = getRootCause(t); if (t instanceof Exception) { throw ((Exception) t); } throw ((Error) t); } public static Throwable throwRootCauseIfIOE(Throwable t) throws IOException { t = getRootCause(t); if (!(t instanceof IOException)) { return t; } throw ((IOException) t); } public static void throwAsIAE(Throwable t) { throwAsIAE(t, t.getMessage()); } public static void throwAsIAE(Throwable t, String msg) { if (t instanceof RuntimeException) { throw ((RuntimeException) t); } else if (t instanceof Error) { throw ((Error) t); } else { throw new IllegalArgumentException(msg, t); } } public static void unwrapAndThrowAsIAE(Throwable t) { throwAsIAE(getRootCause(t)); } public static void unwrapAndThrowAsIAE(Throwable t, String msg) { throwAsIAE(getRootCause(t), msg); } public static void closeOnFailAndThrowAsIAE(JsonGenerator g, Exception fail) throws IOException { g.disable(Feature.AUTO_CLOSE_JSON_CONTENT); try { g.close(); } catch (Exception e) { fail.addSuppressed(e); } if (fail instanceof IOException) { throw ((IOException) fail); } else if (fail instanceof RuntimeException) { throw ((RuntimeException) fail); } else { throw new RuntimeException(fail); } } public static void closeOnFailAndThrowAsIAE(JsonGenerator g, Closeable toClose, Exception fail) throws IOException { if (g != null) { g.disable(Feature.AUTO_CLOSE_JSON_CONTENT); try { g.close(); } catch (Exception e) { fail.addSuppressed(e); } } if (toClose != null) { try { toClose.close(); } catch (Exception e2) { fail.addSuppressed(e2); } } if (fail instanceof IOException) { throw ((IOException) fail); } else if (fail instanceof RuntimeException) { throw ((RuntimeException) fail); } else { throw new RuntimeException(fail); } } public static <T> T createInstance(Class<T> cls, boolean canFixAccess) throws IllegalArgumentException { Constructor<T> ctor = findConstructor(cls, canFixAccess); if (ctor == null) { throw new IllegalArgumentException("Class " + cls.getName() + " has no default (no arg) constructor"); } try { return ctor.newInstance(new Object[0]); } catch (Exception e) { unwrapAndThrowAsIAE(e, "Failed to instantiate class " + cls.getName() + ", problem: " + e.getMessage()); return null; } } public static <T> Constructor<T> findConstructor(Class<T> cls, boolean canFixAccess) throws IllegalArgumentException { try { Constructor<T> ctor = cls.getDeclaredConstructor(new Class[0]); if (canFixAccess) { checkAndFixAccess(ctor); return ctor; } else if (Modifier.isPublic(ctor.getModifiers())) { return ctor; } else { throw new IllegalArgumentException("Default constructor for " + cls.getName() + " is not accessible (non-public?): not allowed to try modify access via Reflection: can not instantiate type"); } } catch (NoSuchMethodException e) { return null; } catch (Exception e2) { unwrapAndThrowAsIAE(e2, "Failed to find default constructor of class " + cls.getName() + ", problem: " + e2.getMessage()); return null; } } public static Object defaultValue(Class<?> cls) { if (cls == Integer.TYPE) { return Integer.valueOf(0); } if (cls == Long.TYPE) { return Long.valueOf(0); } if (cls == Boolean.TYPE) { return Boolean.FALSE; } if (cls == Double.TYPE) { return Double.valueOf(0.0d); } if (cls == Float.TYPE) { return Float.valueOf(0.0f); } if (cls == Byte.TYPE) { return Byte.valueOf((byte) 0); } if (cls == Short.TYPE) { return Short.valueOf((short) 0); } if (cls == Character.TYPE) { return Character.valueOf('\u0000'); } throw new IllegalArgumentException("Class " + cls.getName() + " is not a primitive type"); } public static Class<?> wrapperType(Class<?> primitiveType) { if (primitiveType == Integer.TYPE) { return Integer.class; } if (primitiveType == Long.TYPE) { return Long.class; } if (primitiveType == Boolean.TYPE) { return Boolean.class; } if (primitiveType == Double.TYPE) { return Double.class; } if (primitiveType == Float.TYPE) { return Float.class; } if (primitiveType == Byte.TYPE) { return Byte.class; } if (primitiveType == Short.TYPE) { return Short.class; } if (primitiveType == Character.TYPE) { return Character.class; } throw new IllegalArgumentException("Class " + primitiveType.getName() + " is not a primitive type"); } public static Class<?> primitiveType(Class<?> type) { if (type.isPrimitive()) { return type; } if (type == Integer.class) { return Integer.TYPE; } if (type == Long.class) { return Long.TYPE; } if (type == Boolean.class) { return Boolean.TYPE; } if (type == Double.class) { return Double.TYPE; } if (type == Float.class) { return Float.TYPE; } if (type == Byte.class) { return Byte.TYPE; } if (type == Short.class) { return Short.TYPE; } if (type == Character.class) { return Character.TYPE; } return null; } @Deprecated public static void checkAndFixAccess(Member member) { checkAndFixAccess(member, false); } public static void checkAndFixAccess(Member member, boolean force) { AccessibleObject ao = (AccessibleObject) member; if (!force) { try { if (Modifier.isPublic(member.getModifiers()) && Modifier.isPublic(member.getDeclaringClass().getModifiers())) { return; } } catch (SecurityException se) { if (!ao.isAccessible()) { throw new IllegalArgumentException("Can not access " + member + " (from class " + member.getDeclaringClass().getName() + "; failed to set access: " + se.getMessage()); } return; } } ao.setAccessible(true); } public static Class<? extends Enum<?>> findEnumType(EnumSet<?> s) { if (s.isEmpty()) { return EnumTypeLocator.instance.enumTypeFor((EnumSet) s); } return findEnumType((Enum) s.iterator().next()); } public static Class<? extends Enum<?>> findEnumType(EnumMap<?, ?> m) { if (m.isEmpty()) { return EnumTypeLocator.instance.enumTypeFor((EnumMap) m); } return findEnumType((Enum) m.keySet().iterator().next()); } public static Class<? extends Enum<?>> findEnumType(Enum<?> en) { Class<?> ec = en.getClass(); if (ec.getSuperclass() != Enum.class) { return ec.getSuperclass(); } return ec; } public static Class<? extends Enum<?>> findEnumType(Class<?> cls) { if (cls.getSuperclass() != Enum.class) { return cls.getSuperclass(); } return cls; } public static <T extends Annotation> Enum<?> findFirstAnnotatedEnumValue(Class<Enum<?>> enumClass, Class<T> annotationClass) { Field[] fields = getDeclaredFields(enumClass); Field[] fieldArr = fields; int len$ = fields.length; for (int i = 0; i < len$; i++) { Field field = fieldArr[i]; if (field.isEnumConstant() && field.getAnnotation(annotationClass) != null) { String name = field.getName(); for (Enum<?> enumValue : (Enum[]) enumClass.getEnumConstants()) { if (name.equals(enumValue.name())) { return enumValue; } } continue; } } return null; } public static boolean isJacksonStdImpl(Object impl) { return impl != null && isJacksonStdImpl(impl.getClass()); } public static boolean isJacksonStdImpl(Class<?> implClass) { return implClass.getAnnotation(JacksonStdImpl.class) != null; } public static boolean isBogusClass(Class<?> cls) { return cls == Void.class || cls == Void.TYPE || cls == NoClass.class; } public static boolean isNonStaticInnerClass(Class<?> cls) { return (Modifier.isStatic(cls.getModifiers()) || getEnclosingClass(cls) == null) ? false : true; } public static boolean isObjectOrPrimitive(Class<?> cls) { return cls == CLS_OBJECT || cls.isPrimitive(); } public static String getPackageName(Class<?> cls) { Package pkg = cls.getPackage(); return pkg == null ? null : pkg.getName(); } public static boolean hasEnclosingMethod(Class<?> cls) { return (isObjectOrPrimitive(cls) || cls.getEnclosingMethod() == null) ? false : true; } public static Field[] getDeclaredFields(Class<?> cls) { return cls.getDeclaredFields(); } public static Method[] getDeclaredMethods(Class<?> cls) { return cls.getDeclaredMethods(); } public static Annotation[] findClassAnnotations(Class<?> cls) { if (isObjectOrPrimitive(cls)) { return NO_ANNOTATIONS; } return cls.getDeclaredAnnotations(); } public static Ctor[] getConstructors(Class<?> cls) { if (cls.isInterface() || isObjectOrPrimitive(cls)) { return NO_CTORS; } Constructor<?>[] rawCtors = cls.getDeclaredConstructors(); int len = rawCtors.length; Ctor[] result = new Ctor[len]; for (int i = 0; i < len; i++) { result[i] = new Ctor(rawCtors[i]); } return result; } public static Class<?> getDeclaringClass(Class<?> cls) { return isObjectOrPrimitive(cls) ? null : cls.getDeclaringClass(); } public static Type getGenericSuperclass(Class<?> cls) { return cls.getGenericSuperclass(); } public static Type[] getGenericInterfaces(Class<?> cls) { return cls.getGenericInterfaces(); } public static Class<?> getEnclosingClass(Class<?> cls) { return isObjectOrPrimitive(cls) ? null : cls.getEnclosingClass(); } private static Class<?>[] _interfaces(Class<?> cls) { return cls.getInterfaces(); } }
24,602
0.540119
0.538208
743
32.11171
27.489279
207
false
false
0
0
0
0
0
0
0.504711
false
false
0
dbb909d08770ff70156509e61ee9eb0ba60285db
16,896,401,405,017
a20b71a6c5f445a1e651e2f50ef392bf1c553d21
/app/src/main/java/com/example/exercicio/MainActivity.java
76f1cfaf6a25637fd7d0c5b55611ec45861a3104
[]
no_license
janeth535/Exercicio5-TIC
https://github.com/janeth535/Exercicio5-TIC
36748bf0d0678eec27e406f0094e6c49fef9b61c
915cc3fd5c23b5d359753fea8749251c8364c267
refs/heads/master
2023-04-20T07:13:30.772000
2021-05-12T16:59:39
2021-05-12T16:59:39
366,791,317
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.exercicio; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends AppCompatActivity { EditText txt_salario; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void onClick(View view){ txt_salario = findViewById(R.id.txt_salario); double salario = Double.parseDouble(txt_salario.getText().toString()); double salario1 = salario + ((salario*5)/100); double salario2 = salario1 - ((salario1*7)/100); Toast.makeText(MainActivity.this, "O salário a receber é de : " + salario2 + "Kzs", Toast.LENGTH_SHORT).show(); } }
UTF-8
Java
859
java
MainActivity.java
Java
[]
null
[]
package com.example.exercicio; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends AppCompatActivity { EditText txt_salario; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void onClick(View view){ txt_salario = findViewById(R.id.txt_salario); double salario = Double.parseDouble(txt_salario.getText().toString()); double salario1 = salario + ((salario*5)/100); double salario2 = salario1 - ((salario1*7)/100); Toast.makeText(MainActivity.this, "O salário a receber é de : " + salario2 + "Kzs", Toast.LENGTH_SHORT).show(); } }
859
0.704784
0.689615
28
29.642857
28.519686
119
false
false
0
0
0
0
0
0
0.571429
false
false
0
841aa695ece2288cc9b22b0ffe7c2a16209469bf
6,021,544,178,033
d9fa28092c03cb3cba2921c13ff60579d84ab36e
/Calculation of the circumference and area of shapes - OOP/src/hu/ak_academy/calculationofthecircumferenceandareaofshapesoop/shape/RightTriangle.java
9d111414a2f541bb504c073ee920073db9672c95
[]
no_license
Mohrezakhorasany/Exercises
https://github.com/Mohrezakhorasany/Exercises
ebfad4c3490c9435d99927e605713f9b5e2b00ef
dc5abc4940abbffe1a124dafd478f81e663b5c87
refs/heads/master
2021-03-18T07:44:37.469000
2021-01-31T10:33:08
2021-01-31T10:33:08
247,058,066
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package hu.ak_academy.calculationofthecircumferenceandareaofshapesoop.shape; public class RightTriangle implements Shape { private double firstLeg; private double secondLeg; public RightTriangle(double firstLeg, double secondLeg) { this.firstLeg = firstLeg; this.secondLeg = secondLeg; } @Override public double calculateCircumference() { return calculateMissingLeg() + firstLeg + secondLeg; } @Override public double calculateArea() { return firstLeg * secondLeg / 2; } private double calculateMissingLeg() { return Math.sqrt(Math.pow(firstLeg, 2) + Math.pow(secondLeg, 2)); } @Override public void print() { System.out.println("The circumference of the right triangle is: " + calculateCircumference()); System.out.println("The area of the right triangle is: " + calculateArea()); } }
UTF-8
Java
852
java
RightTriangle.java
Java
[]
null
[]
package hu.ak_academy.calculationofthecircumferenceandareaofshapesoop.shape; public class RightTriangle implements Shape { private double firstLeg; private double secondLeg; public RightTriangle(double firstLeg, double secondLeg) { this.firstLeg = firstLeg; this.secondLeg = secondLeg; } @Override public double calculateCircumference() { return calculateMissingLeg() + firstLeg + secondLeg; } @Override public double calculateArea() { return firstLeg * secondLeg / 2; } private double calculateMissingLeg() { return Math.sqrt(Math.pow(firstLeg, 2) + Math.pow(secondLeg, 2)); } @Override public void print() { System.out.println("The circumference of the right triangle is: " + calculateCircumference()); System.out.println("The area of the right triangle is: " + calculateArea()); } }
852
0.721831
0.71831
32
24.6875
27.056004
96
false
false
0
0
0
0
0
0
1.3125
false
false
0
a453851ecb56ba7d968dbd79932180aaa92af831
13,314,398,681,132
4e8b791d3cc2376c06e9e2de41a0e41a5490c4be
/src/main/java/Chen/Abstracts/Power.java
f325a4cddf6ab4bb85c0e625293d1f4863b70f9f
[]
no_license
Alchyr/Chen
https://github.com/Alchyr/Chen
e117516c61f34e87893b98537f3e33c9d1a006a8
b0a4389cfe09f6e4be9e452b476d5f690930f19a
refs/heads/master
2023-08-09T03:34:47.372000
2023-01-01T22:28:04
2023-01-01T22:28:04
169,192,733
1
2
null
false
2019-07-30T09:19:38
2019-02-05T04:59:47
2019-07-30T09:17:56
2019-07-30T09:19:37
10,071
0
1
0
Java
false
false
package Chen.Abstracts; import Chen.ChenMod; import Chen.Patches.HiDefPowerPatch; import Chen.Util.TextureLoader; import com.badlogic.gdx.graphics.Texture; import com.megacrit.cardcrawl.core.AbstractCreature; import com.megacrit.cardcrawl.core.CardCrawlGame; import com.megacrit.cardcrawl.localization.PowerStrings; import com.megacrit.cardcrawl.powers.AbstractPower; public class Power extends AbstractPower { protected PowerStrings powerStrings() { return CardCrawlGame.languagePack.getPowerStrings(ID); } protected String[] descriptions; protected AbstractCreature source; public Power(String name, PowerType powerType, boolean isTurnBased, AbstractCreature owner, AbstractCreature source, int amount) { this.ID = ChenMod.makeID(name); this.isTurnBased = isTurnBased; PowerStrings powerStrings = powerStrings(); this.name = powerStrings.NAME; this.descriptions = powerStrings.DESCRIPTIONS; this.owner = owner; this.source = source; this.amount = amount; this.type = powerType; this.img = TextureLoader.getPowerTexture(name); Texture HiDefImage = TextureLoader.getHiDefPowerTexture(name); if (HiDefImage != null) HiDefPowerPatch.HiDefImage.img84.set(this, HiDefImage); this.updateDescription(); } }
UTF-8
Java
1,367
java
Power.java
Java
[]
null
[]
package Chen.Abstracts; import Chen.ChenMod; import Chen.Patches.HiDefPowerPatch; import Chen.Util.TextureLoader; import com.badlogic.gdx.graphics.Texture; import com.megacrit.cardcrawl.core.AbstractCreature; import com.megacrit.cardcrawl.core.CardCrawlGame; import com.megacrit.cardcrawl.localization.PowerStrings; import com.megacrit.cardcrawl.powers.AbstractPower; public class Power extends AbstractPower { protected PowerStrings powerStrings() { return CardCrawlGame.languagePack.getPowerStrings(ID); } protected String[] descriptions; protected AbstractCreature source; public Power(String name, PowerType powerType, boolean isTurnBased, AbstractCreature owner, AbstractCreature source, int amount) { this.ID = ChenMod.makeID(name); this.isTurnBased = isTurnBased; PowerStrings powerStrings = powerStrings(); this.name = powerStrings.NAME; this.descriptions = powerStrings.DESCRIPTIONS; this.owner = owner; this.source = source; this.amount = amount; this.type = powerType; this.img = TextureLoader.getPowerTexture(name); Texture HiDefImage = TextureLoader.getHiDefPowerTexture(name); if (HiDefImage != null) HiDefPowerPatch.HiDefImage.img84.set(this, HiDefImage); this.updateDescription(); } }
1,367
0.722751
0.721287
44
30.068182
26.654692
132
false
false
0
0
0
0
0
0
0.704545
false
false
0
cf500bd48c89a2d37ba8991fd765475b7f1a665c
2,585,570,381,765
e5839779fd162fd03ce8b2f57b67d6d990b8e116
/src/proj/meditrac/web/controllers/AdminController.java
eab01e70348cb3766a5fb40ea551cd56cf5fcd94
[]
no_license
Kumargaurav0225/meditrac
https://github.com/Kumargaurav0225/meditrac
6ef7cf80da25edc6138d975f577c5ef08e48e234
4f19d61d216ca2d4c6975e606bdbeb79fb4f44b5
refs/heads/master
2021-06-29T04:48:13.023000
2017-09-23T21:26:43
2017-09-23T21:28:46
104,599,303
0
0
null
false
2017-09-23T21:49:47
2017-09-23T21:10:17
2017-09-23T21:30:54
2017-09-23T21:47:14
0
0
0
0
Java
null
null
package proj.meditrac.web.controllers; import java.io.IOException; import java.util.Date; import java.util.Iterator; import java.util.List; 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 org.hibernate.Criteria; import org.hibernate.HibernateException; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.Transaction; import org.hibernate.criterion.Criterion; import org.hibernate.criterion.Restrictions; import proj.meditrac.core.exceptions.ConnectException; import proj.meditrac.core.exceptions.SchemaException; import proj.meditrac.db.Persistence; import proj.meditrac.entities.Hospital; import proj.meditrac.entities.Member; import proj.meditrac.util.Utility; /** * Servlet implementation class AdminController */ @WebServlet("/AdminController") public class AdminController extends HttpServlet { private static final long serialVersionUID = 1L; private String state,hosName,hosCode,city,district,date,telephone,email,specialities;/*[]=new String[100];*/ private String zip; //private Date date=new Date(); /** * @see HttpServlet#HttpServlet() */ public AdminController() { super(); // 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 String action=request.getParameter("action").trim(); if(action.equals("add")){ try { addHospital( request, response); } catch (HibernateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ConnectException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SchemaException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else if(action.equals("verify")){ try { verify(request); } catch (HibernateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ConnectException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SchemaException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else if(action.equals("delete")) { try { delete(request); } catch (HibernateException | ConnectException | SchemaException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else if(action.equals("blacklist")) { try { blacklist(request); } catch (HibernateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ConnectException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SchemaException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else if(action.equals("unBlacklist")) { try { unBlacklist(request); } catch (HibernateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ConnectException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SchemaException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else if(action.equals("search")) { String searchBy=request.getParameter("searchType"); try { switch(searchBy) { case "hosName": searchByName(request,response); break; case "specialities": searchBySpecialities(request,response); break; case "hosCode":searchByLicence(request,response); break; case "telephone":searchByTelephone(request,response); break; case "state":searchByState(request,response); break; case "city":searchByCity(request,response); break; case "zip":searchByZip(request,response); break; case "email":searchByEmail(request,response); break; case "district":searchByDistrict(request,response); break; default:response.getWriter().println("Keyword you have given does not match."); break; } } catch(Exception e) { e.printStackTrace(); } } } /** * @throws SchemaException * @throws ConnectException * @throws HibernateException * @throws IOException * @throws ServletException * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void searchByName(HttpServletRequest request,HttpServletResponse response) throws HibernateException, ConnectException, SchemaException, ServletException, IOException { String hql="from Hospital h where lower(h.hosName) like ('%"+request.getParameter("query").toLowerCase()+"%')"; Session sess=Persistence.getSessionFactory().openSession(); Query q=sess.createQuery(hql); List<Hospital> list=q.list(); request.setAttribute("list", list); request.getRequestDispatcher("/WEB-INF/jsp/partials/_adminSearchHospital.jsp").forward(request, response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } /* * */ private void searchByLicence(HttpServletRequest request,HttpServletResponse response) throws HibernateException, ConnectException, SchemaException, ServletException, IOException { String hql="from Hospital h where lower(h.hosCode) like ('%"+request.getParameter("query").toLowerCase()+"%')"; Session sess=Persistence.getSessionFactory().openSession(); Query q=sess.createQuery(hql); List<Hospital> list=q.list(); request.setAttribute("list", list); request.getRequestDispatcher("/WEB-INF/jsp/partials/_adminSearchHospital.jsp").forward(request, response); } private void searchByTelephone(HttpServletRequest request,HttpServletResponse response) throws HibernateException, ConnectException, SchemaException, ServletException, IOException { String hql="from Hospital h where (h.telephone) like ('%"+request.getParameter("query").toLowerCase()+"%')"; Session sess=Persistence.getSessionFactory().openSession(); Query q=sess.createQuery(hql); List<Hospital> list=q.list(); request.setAttribute("list", list); request.getRequestDispatcher("/WEB-INF/jsp/partials/_adminSearchHospital.jsp").forward(request, response); } private void searchByState(HttpServletRequest request,HttpServletResponse response) throws HibernateException, ConnectException, SchemaException, ServletException, IOException { String hql="from Hospital h where lower(h.state) like ('%"+request.getParameter("query").toLowerCase()+"%')"; Session sess=Persistence.getSessionFactory().openSession(); Query q=sess.createQuery(hql); List<Hospital> list=q.list(); request.setAttribute("list", list); request.getRequestDispatcher("/WEB-INF/jsp/partials/_adminSearchHospital.jsp").forward(request, response); } private void searchByCity(HttpServletRequest request,HttpServletResponse response) throws HibernateException, ConnectException, SchemaException, ServletException, IOException { String hql="from Hospital h where lower(h.city) like ('%"+request.getParameter("query").toLowerCase()+"%')"; Session sess=Persistence.getSessionFactory().openSession(); Query q=sess.createQuery(hql); List<Hospital> list=q.list(); request.setAttribute("list", list); request.getRequestDispatcher("/WEB-INF/jsp/partials/_adminSearchHospital.jsp").forward(request, response); } private void searchByZip(HttpServletRequest request,HttpServletResponse response) throws HibernateException, ConnectException, SchemaException, ServletException, IOException { String hql="from Hospital h where lower(h.zip) like ('%"+request.getParameter("query").toLowerCase()+"%')"; Session sess=Persistence.getSessionFactory().openSession(); Query q=sess.createQuery(hql); List<Hospital> list=q.list(); request.setAttribute("list", list); request.getRequestDispatcher("/WEB-INF/jsp/partials/_adminSearchHospital.jsp").forward(request, response); } private void searchByEmail(HttpServletRequest request,HttpServletResponse response) throws HibernateException, ConnectException, SchemaException, ServletException, IOException { String hql="from Hospital h where lower(h.email) like ('%"+request.getParameter("query").toLowerCase()+"%')"; Session sess=Persistence.getSessionFactory().openSession(); Query q=sess.createQuery(hql); List<Hospital> list=q.list(); request.setAttribute("list", list); request.getRequestDispatcher("/WEB-INF/jsp/partials/_adminSearchHospital.jsp").forward(request, response); } private void searchBySpecialities(HttpServletRequest request,HttpServletResponse response) throws HibernateException, ConnectException, SchemaException, ServletException, IOException { String hql="from Hospital h where lower(h.specialities) like ('%"+request.getParameter("query").toLowerCase()+"%')"; Session sess=Persistence.getSessionFactory().openSession(); Query q=sess.createQuery(hql); List<Hospital> list=q.list(); request.setAttribute("list", list); request.getRequestDispatcher("/WEB-INF/jsp/partials/_adminSearchHospital.jsp").forward(request, response); } private void searchByDistrict(HttpServletRequest request,HttpServletResponse response) throws HibernateException, ConnectException, SchemaException, ServletException, IOException { String hql="from Hospital h where lower(h.district) like ('%"+request.getParameter("query").toLowerCase()+"%')"; Session sess=Persistence.getSessionFactory().openSession(); Query q=sess.createQuery(hql); List<Hospital> list=q.list(); request.setAttribute("list", list); request.getRequestDispatcher("/WEB-INF/jsp/partials/_adminSearchHospital.jsp").forward(request, response); } private void addHospital(HttpServletRequest request, HttpServletResponse response) throws HibernateException, ConnectException, SchemaException { Session sess=Persistence.getSessionFactory().openSession(); Transaction tx=sess.beginTransaction(); hosName=Utility.escapeUserData(request.getParameter("hosName")); hosCode=Utility.escapeUserData(request.getParameter("hosCode")); //specialities[]=Utility.escapeUserData(request.getParameter("specialities").split(",")); specialities=Utility.escapeUserData(request.getParameter("specialities")); district=Utility.escapeUserData(request.getParameter("district")); state=Utility.escapeUserData(request.getParameter("state")); zip=Utility.escapeUserData(request.getParameter("zip")); date=Utility.escapeUserData(request.getParameter("doe")); telephone=Utility.escapeUserData("telephone"); city=Utility.escapeUserData(request.getParameter("city")); email=Utility.escapeUserData("email"); Hospital h=new Hospital(); h.setInsertionId("106"); h.setCity(city); h.setDate(date); h.setDistrict(district); h.setEmail(email); h.setHosCode(hosCode); h.setHosName(hosName); h.setSpecialities(specialities); h.setState(state); h.setTelephone(telephone); h.setBlacklisted(Hospital.Blacklisted.FALSE); h.setVerified(Hospital.Verified.FALSE); h.setZip(zip); sess.save(h); tx.commit(); } private void verify(HttpServletRequest req) throws HibernateException, ConnectException, SchemaException{ String hosId = Utility.escapeUserData(req.getParameter("hosId")); Session sess=Persistence.getSessionFactory().openSession(); Transaction tx=sess.beginTransaction(); String password=Utility.randomAlphanumeric(6); Member m=new Member(); m.setId(Long.parseLong(hosId)); m.setPassword(password); m.setGroup(Member.Group.HOSPITAL); m.setCreatedAt(new Date()); m.setActive(Member.Active.ACTIVE); sess.save(m); String hqlQuery = "update Hospital h set h.verified='TRUE' where insertionId='"+hosId+"'"; if(sess.createQuery(hqlQuery).executeUpdate() > 0) { System.out.println("UPDATED"); } tx.commit(); } private void delete(HttpServletRequest request) throws HibernateException, ConnectException, SchemaException { String hosId=Utility.escapeUserData(request.getParameter("hosId")); Session sess=Persistence.getSessionFactory().openSession(); Transaction tx=sess.beginTransaction(); //Member member = (Member) sess.get(Member.class, hosId); Hospital hospital=(Hospital)sess.get(Hospital.class, hosId); //sess.delete(member); sess.delete(hospital); tx.commit(); } private void blacklist(HttpServletRequest request) throws HibernateException, ConnectException, SchemaException { String hosId=Utility.escapeUserData(request.getParameter("hosId")); Session sess=Persistence.getSessionFactory().openSession(); Transaction tx=sess.beginTransaction(); String hql="update Member m set m.active='NOT_ACTIVE' where id='"+hosId+"'"; String hqlh="update Hospital h set h.blacklisted='TRUE' where id='"+hosId+"'"; if(sess.createQuery(hql).executeUpdate() > 0) { System.out.println("BlackListed"); } if(sess.createQuery(hqlh).executeUpdate() > 0) { System.out.println("BlackListed"); } tx.commit(); } private void unBlacklist(HttpServletRequest request) throws HibernateException, ConnectException, SchemaException { String hosId=Utility.escapeUserData(request.getParameter("hosId")); Session sess=Persistence.getSessionFactory().openSession(); Transaction tx=sess.beginTransaction(); String hql="update Member m set m.active='ACTIVE' where id='"+hosId+"'"; String hqlh="update Hospital h set h.blacklisted='FALSE' where id='"+hosId+"'"; if(sess.createQuery(hql).executeUpdate() > 0) { System.out.println("UnBlackListed"); } if(sess.createQuery(hqlh).executeUpdate() > 0) { System.out.println("UnBlackListed"); } tx.commit(); } }
UTF-8
Java
13,842
java
AdminController.java
Java
[ { "context": "\t\tm.setId(Long.parseLong(hosId));\n\t\tm.setPassword(password);\n\t\tm.setGroup(Member.Group.HOSPITAL);\n\t\tm.setCre", "end": 11707, "score": 0.9990600347518921, "start": 11699, "tag": "PASSWORD", "value": "password" } ]
null
[]
package proj.meditrac.web.controllers; import java.io.IOException; import java.util.Date; import java.util.Iterator; import java.util.List; 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 org.hibernate.Criteria; import org.hibernate.HibernateException; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.Transaction; import org.hibernate.criterion.Criterion; import org.hibernate.criterion.Restrictions; import proj.meditrac.core.exceptions.ConnectException; import proj.meditrac.core.exceptions.SchemaException; import proj.meditrac.db.Persistence; import proj.meditrac.entities.Hospital; import proj.meditrac.entities.Member; import proj.meditrac.util.Utility; /** * Servlet implementation class AdminController */ @WebServlet("/AdminController") public class AdminController extends HttpServlet { private static final long serialVersionUID = 1L; private String state,hosName,hosCode,city,district,date,telephone,email,specialities;/*[]=new String[100];*/ private String zip; //private Date date=new Date(); /** * @see HttpServlet#HttpServlet() */ public AdminController() { super(); // 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 String action=request.getParameter("action").trim(); if(action.equals("add")){ try { addHospital( request, response); } catch (HibernateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ConnectException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SchemaException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else if(action.equals("verify")){ try { verify(request); } catch (HibernateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ConnectException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SchemaException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else if(action.equals("delete")) { try { delete(request); } catch (HibernateException | ConnectException | SchemaException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else if(action.equals("blacklist")) { try { blacklist(request); } catch (HibernateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ConnectException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SchemaException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else if(action.equals("unBlacklist")) { try { unBlacklist(request); } catch (HibernateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ConnectException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SchemaException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else if(action.equals("search")) { String searchBy=request.getParameter("searchType"); try { switch(searchBy) { case "hosName": searchByName(request,response); break; case "specialities": searchBySpecialities(request,response); break; case "hosCode":searchByLicence(request,response); break; case "telephone":searchByTelephone(request,response); break; case "state":searchByState(request,response); break; case "city":searchByCity(request,response); break; case "zip":searchByZip(request,response); break; case "email":searchByEmail(request,response); break; case "district":searchByDistrict(request,response); break; default:response.getWriter().println("Keyword you have given does not match."); break; } } catch(Exception e) { e.printStackTrace(); } } } /** * @throws SchemaException * @throws ConnectException * @throws HibernateException * @throws IOException * @throws ServletException * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void searchByName(HttpServletRequest request,HttpServletResponse response) throws HibernateException, ConnectException, SchemaException, ServletException, IOException { String hql="from Hospital h where lower(h.hosName) like ('%"+request.getParameter("query").toLowerCase()+"%')"; Session sess=Persistence.getSessionFactory().openSession(); Query q=sess.createQuery(hql); List<Hospital> list=q.list(); request.setAttribute("list", list); request.getRequestDispatcher("/WEB-INF/jsp/partials/_adminSearchHospital.jsp").forward(request, response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } /* * */ private void searchByLicence(HttpServletRequest request,HttpServletResponse response) throws HibernateException, ConnectException, SchemaException, ServletException, IOException { String hql="from Hospital h where lower(h.hosCode) like ('%"+request.getParameter("query").toLowerCase()+"%')"; Session sess=Persistence.getSessionFactory().openSession(); Query q=sess.createQuery(hql); List<Hospital> list=q.list(); request.setAttribute("list", list); request.getRequestDispatcher("/WEB-INF/jsp/partials/_adminSearchHospital.jsp").forward(request, response); } private void searchByTelephone(HttpServletRequest request,HttpServletResponse response) throws HibernateException, ConnectException, SchemaException, ServletException, IOException { String hql="from Hospital h where (h.telephone) like ('%"+request.getParameter("query").toLowerCase()+"%')"; Session sess=Persistence.getSessionFactory().openSession(); Query q=sess.createQuery(hql); List<Hospital> list=q.list(); request.setAttribute("list", list); request.getRequestDispatcher("/WEB-INF/jsp/partials/_adminSearchHospital.jsp").forward(request, response); } private void searchByState(HttpServletRequest request,HttpServletResponse response) throws HibernateException, ConnectException, SchemaException, ServletException, IOException { String hql="from Hospital h where lower(h.state) like ('%"+request.getParameter("query").toLowerCase()+"%')"; Session sess=Persistence.getSessionFactory().openSession(); Query q=sess.createQuery(hql); List<Hospital> list=q.list(); request.setAttribute("list", list); request.getRequestDispatcher("/WEB-INF/jsp/partials/_adminSearchHospital.jsp").forward(request, response); } private void searchByCity(HttpServletRequest request,HttpServletResponse response) throws HibernateException, ConnectException, SchemaException, ServletException, IOException { String hql="from Hospital h where lower(h.city) like ('%"+request.getParameter("query").toLowerCase()+"%')"; Session sess=Persistence.getSessionFactory().openSession(); Query q=sess.createQuery(hql); List<Hospital> list=q.list(); request.setAttribute("list", list); request.getRequestDispatcher("/WEB-INF/jsp/partials/_adminSearchHospital.jsp").forward(request, response); } private void searchByZip(HttpServletRequest request,HttpServletResponse response) throws HibernateException, ConnectException, SchemaException, ServletException, IOException { String hql="from Hospital h where lower(h.zip) like ('%"+request.getParameter("query").toLowerCase()+"%')"; Session sess=Persistence.getSessionFactory().openSession(); Query q=sess.createQuery(hql); List<Hospital> list=q.list(); request.setAttribute("list", list); request.getRequestDispatcher("/WEB-INF/jsp/partials/_adminSearchHospital.jsp").forward(request, response); } private void searchByEmail(HttpServletRequest request,HttpServletResponse response) throws HibernateException, ConnectException, SchemaException, ServletException, IOException { String hql="from Hospital h where lower(h.email) like ('%"+request.getParameter("query").toLowerCase()+"%')"; Session sess=Persistence.getSessionFactory().openSession(); Query q=sess.createQuery(hql); List<Hospital> list=q.list(); request.setAttribute("list", list); request.getRequestDispatcher("/WEB-INF/jsp/partials/_adminSearchHospital.jsp").forward(request, response); } private void searchBySpecialities(HttpServletRequest request,HttpServletResponse response) throws HibernateException, ConnectException, SchemaException, ServletException, IOException { String hql="from Hospital h where lower(h.specialities) like ('%"+request.getParameter("query").toLowerCase()+"%')"; Session sess=Persistence.getSessionFactory().openSession(); Query q=sess.createQuery(hql); List<Hospital> list=q.list(); request.setAttribute("list", list); request.getRequestDispatcher("/WEB-INF/jsp/partials/_adminSearchHospital.jsp").forward(request, response); } private void searchByDistrict(HttpServletRequest request,HttpServletResponse response) throws HibernateException, ConnectException, SchemaException, ServletException, IOException { String hql="from Hospital h where lower(h.district) like ('%"+request.getParameter("query").toLowerCase()+"%')"; Session sess=Persistence.getSessionFactory().openSession(); Query q=sess.createQuery(hql); List<Hospital> list=q.list(); request.setAttribute("list", list); request.getRequestDispatcher("/WEB-INF/jsp/partials/_adminSearchHospital.jsp").forward(request, response); } private void addHospital(HttpServletRequest request, HttpServletResponse response) throws HibernateException, ConnectException, SchemaException { Session sess=Persistence.getSessionFactory().openSession(); Transaction tx=sess.beginTransaction(); hosName=Utility.escapeUserData(request.getParameter("hosName")); hosCode=Utility.escapeUserData(request.getParameter("hosCode")); //specialities[]=Utility.escapeUserData(request.getParameter("specialities").split(",")); specialities=Utility.escapeUserData(request.getParameter("specialities")); district=Utility.escapeUserData(request.getParameter("district")); state=Utility.escapeUserData(request.getParameter("state")); zip=Utility.escapeUserData(request.getParameter("zip")); date=Utility.escapeUserData(request.getParameter("doe")); telephone=Utility.escapeUserData("telephone"); city=Utility.escapeUserData(request.getParameter("city")); email=Utility.escapeUserData("email"); Hospital h=new Hospital(); h.setInsertionId("106"); h.setCity(city); h.setDate(date); h.setDistrict(district); h.setEmail(email); h.setHosCode(hosCode); h.setHosName(hosName); h.setSpecialities(specialities); h.setState(state); h.setTelephone(telephone); h.setBlacklisted(Hospital.Blacklisted.FALSE); h.setVerified(Hospital.Verified.FALSE); h.setZip(zip); sess.save(h); tx.commit(); } private void verify(HttpServletRequest req) throws HibernateException, ConnectException, SchemaException{ String hosId = Utility.escapeUserData(req.getParameter("hosId")); Session sess=Persistence.getSessionFactory().openSession(); Transaction tx=sess.beginTransaction(); String password=Utility.randomAlphanumeric(6); Member m=new Member(); m.setId(Long.parseLong(hosId)); m.setPassword(<PASSWORD>); m.setGroup(Member.Group.HOSPITAL); m.setCreatedAt(new Date()); m.setActive(Member.Active.ACTIVE); sess.save(m); String hqlQuery = "update Hospital h set h.verified='TRUE' where insertionId='"+hosId+"'"; if(sess.createQuery(hqlQuery).executeUpdate() > 0) { System.out.println("UPDATED"); } tx.commit(); } private void delete(HttpServletRequest request) throws HibernateException, ConnectException, SchemaException { String hosId=Utility.escapeUserData(request.getParameter("hosId")); Session sess=Persistence.getSessionFactory().openSession(); Transaction tx=sess.beginTransaction(); //Member member = (Member) sess.get(Member.class, hosId); Hospital hospital=(Hospital)sess.get(Hospital.class, hosId); //sess.delete(member); sess.delete(hospital); tx.commit(); } private void blacklist(HttpServletRequest request) throws HibernateException, ConnectException, SchemaException { String hosId=Utility.escapeUserData(request.getParameter("hosId")); Session sess=Persistence.getSessionFactory().openSession(); Transaction tx=sess.beginTransaction(); String hql="update Member m set m.active='NOT_ACTIVE' where id='"+hosId+"'"; String hqlh="update Hospital h set h.blacklisted='TRUE' where id='"+hosId+"'"; if(sess.createQuery(hql).executeUpdate() > 0) { System.out.println("BlackListed"); } if(sess.createQuery(hqlh).executeUpdate() > 0) { System.out.println("BlackListed"); } tx.commit(); } private void unBlacklist(HttpServletRequest request) throws HibernateException, ConnectException, SchemaException { String hosId=Utility.escapeUserData(request.getParameter("hosId")); Session sess=Persistence.getSessionFactory().openSession(); Transaction tx=sess.beginTransaction(); String hql="update Member m set m.active='ACTIVE' where id='"+hosId+"'"; String hqlh="update Hospital h set h.blacklisted='FALSE' where id='"+hosId+"'"; if(sess.createQuery(hql).executeUpdate() > 0) { System.out.println("UnBlackListed"); } if(sess.createQuery(hqlh).executeUpdate() > 0) { System.out.println("UnBlackListed"); } tx.commit(); } }
13,844
0.746063
0.745124
375
35.911999
37.41893
183
false
false
0
0
0
0
0
0
2.653333
false
false
0
a474b7a7bf561413edcce79163125422fdf299e9
35,562,329,225,327
94000d447528bd85d2c2abe4a787c370b00f7229
/projects/oberon/src/ru/msu/cmc/sp/oberon/BuiltInType.java
e4cbd8b63c317a4ef83d99033affc86e41e6f41f
[]
no_license
elrinor/chaos-devices
https://github.com/elrinor/chaos-devices
72ea8c55a2a8a77300d3dba402b316e0801d8338
40d30e059c8b9a2d80f28048e39634934c1d1f0b
refs/heads/master
2023-08-05T01:39:38.908000
2021-09-17T18:33:16
2021-09-17T18:33:16
33,127,293
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ru.msu.cmc.sp.oberon; //What to Store as Value? //Array - ArrayList<TypedValue> //Procedure - CodeBlock //Module - ? public enum BuiltInType { VOID (false, false, false, 0), STRING (false, false, false, 0), BOOLEAN (true, false, false, 0), CHAR (true, false, false, 0), SHORTINT (true, true, true, 1), INTEGER (true, true, true, 2), LONGINT (true, true, true, 3), REAL (true, true, false, 4), LONGREAL (true, true, false, 5), ARRAY (false, false, false, 0), PROCEDURE(false, false, false, 0); private boolean isNumeric; private boolean isSimple; private boolean isInt; private int typeWidth; public boolean isSimple() { return isSimple; } public boolean isNumeric() { return isNumeric; } public boolean isInt() { return isInt; } public boolean isFloat() { return isNumeric && !isInt; } public int typeWidth() { return typeWidth; } public boolean canBeConst() { // can it be a const in an expression? return isSimple || this == STRING; } private BuiltInType(boolean isSimple, boolean isNumeric, boolean isInt, int typeWidth) { this.isSimple = isSimple; this.isNumeric = isNumeric; this.isInt = isInt; this.typeWidth = typeWidth; } }
UTF-8
Java
1,279
java
BuiltInType.java
Java
[]
null
[]
package ru.msu.cmc.sp.oberon; //What to Store as Value? //Array - ArrayList<TypedValue> //Procedure - CodeBlock //Module - ? public enum BuiltInType { VOID (false, false, false, 0), STRING (false, false, false, 0), BOOLEAN (true, false, false, 0), CHAR (true, false, false, 0), SHORTINT (true, true, true, 1), INTEGER (true, true, true, 2), LONGINT (true, true, true, 3), REAL (true, true, false, 4), LONGREAL (true, true, false, 5), ARRAY (false, false, false, 0), PROCEDURE(false, false, false, 0); private boolean isNumeric; private boolean isSimple; private boolean isInt; private int typeWidth; public boolean isSimple() { return isSimple; } public boolean isNumeric() { return isNumeric; } public boolean isInt() { return isInt; } public boolean isFloat() { return isNumeric && !isInt; } public int typeWidth() { return typeWidth; } public boolean canBeConst() { // can it be a const in an expression? return isSimple || this == STRING; } private BuiltInType(boolean isSimple, boolean isNumeric, boolean isInt, int typeWidth) { this.isSimple = isSimple; this.isNumeric = isNumeric; this.isInt = isInt; this.typeWidth = typeWidth; } }
1,279
0.64269
0.634089
49
24.061224
16.824919
89
false
false
0
0
0
0
0
0
2.326531
false
false
0
ef167f81541b767b4f8e0b1d03a17506be8dc12a
34,024,730,943,786
3ff5aa29949126cb6174be37d8454de4bcc73a8e
/POA_ManageSystem/src/org/cischina/framework/hibernate3/HibernateDaoInterface.java
5880285c45cb2ccbfd710f1568e97e9564c8619c
[]
no_license
huanghaoming/209
https://github.com/huanghaoming/209
b917972fd40cdcccc8b9122d618637efa47f87d6
4765113bf36624ba15b3fc7df1182b0be6c6bcc6
refs/heads/master
2021-01-10T10:12:07.988000
2016-02-27T03:59:24
2016-02-27T03:59:24
52,649,046
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * */ package org.cischina.framework.hibernate3; import java.util.List; import java.util.Map; /** * @author Ran Xu * @data 2014-5-7 下午3:51:37 * @company 浙江传媒学院-互联网与社会研究中心 CIS * @address 中国杭州下沙高教园区学源街998号 * @tel 0571-86879294 * @home www.cischina.org * @comment 用于定义dao接口的部分常用方法 * */ public interface HibernateDaoInterface { /** * 根据主键获取 * @param <T> * @param id * @return */ public <T> T get(Integer id); /** * 保存或更新数据 * @param entity */ public <T> void saveOrUpdate(T entity); /** * 删除 * @param entity */ public <T> void del(T entity); /** * 根据主键删除 * @param id */ public void del(Integer id); /** * 根据检索条件和翻页参数获取 * @param params * @param firstResult * @param maxResults * @return */ public List<?> getEntitiesByParamsAndPages(Map<String, Object> params, int firstResult, int maxResults); /** * 根据检索条件获取结果总数 * @param params * @return */ public List<Integer> getCountByParamsAndPages(Map<String, Object> params); }
UTF-8
Java
1,185
java
HibernateDaoInterface.java
Java
[ { "context": "a.util.List;\nimport java.util.Map;\n\n/**\n * @author Ran Xu\n * @data 2014-5-7 下午3:51:37 \n * @company 浙江传媒学院-互", "end": 123, "score": 0.9998016357421875, "start": 117, "tag": "NAME", "value": "Ran Xu" } ]
null
[]
/** * */ package org.cischina.framework.hibernate3; import java.util.List; import java.util.Map; /** * @author <NAME> * @data 2014-5-7 下午3:51:37 * @company 浙江传媒学院-互联网与社会研究中心 CIS * @address 中国杭州下沙高教园区学源街998号 * @tel 0571-86879294 * @home www.cischina.org * @comment 用于定义dao接口的部分常用方法 * */ public interface HibernateDaoInterface { /** * 根据主键获取 * @param <T> * @param id * @return */ public <T> T get(Integer id); /** * 保存或更新数据 * @param entity */ public <T> void saveOrUpdate(T entity); /** * 删除 * @param entity */ public <T> void del(T entity); /** * 根据主键删除 * @param id */ public void del(Integer id); /** * 根据检索条件和翻页参数获取 * @param params * @param firstResult * @param maxResults * @return */ public List<?> getEntitiesByParamsAndPages(Map<String, Object> params, int firstResult, int maxResults); /** * 根据检索条件获取结果总数 * @param params * @return */ public List<Integer> getCountByParamsAndPages(Map<String, Object> params); }
1,185
0.639083
0.612163
61
15.442623
17.989546
105
false
false
0
0
0
0
0
0
0.885246
false
false
0
62020f1db47cb0007b62923fca541fc77a8994fd
2,886,218,089,515
1c550ff015bc2f4647925e58526b53d62d9c8a28
/src/test/java/com/tsolakp/samplespringmvcrest/api/user/UserServiceTest.java
230c4b7c5ab0ee9b572eb35eb578087bf36ced61
[]
no_license
tsolakp/sample-springmvc-rest
https://github.com/tsolakp/sample-springmvc-rest
ab6e046c01ebdfe3e749584a22a9005f5211aabb
83e7fd47ebcca5db128ced25350f869f50954d41
refs/heads/master
2020-03-13T03:51:18.597000
2018-04-25T04:55:05
2018-04-25T04:55:05
130,951,820
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright 2018, Charter Communications, All rights reserved. */ package com.tsolakp.samplespringmvcrest.api.user; import java.util.List; import java.util.Arrays; import java.util.Date; import org.junit.Test; import org.junit.Before; import org.junit.runner.RunWith; import static org.junit.Assert.*; import org.mockito.Mock; import static org.mockito.Mockito.*; import org.powermock.reflect.Whitebox; import org.springframework.data.domain.Sort; import org.powermock.modules.junit4.PowerMockRunner; @RunWith(PowerMockRunner.class) public class UserServiceTest { @Mock private UserRepository userRepository = null; private UserService userService = null; @Before public void before(){ userService = new UserService(); Whitebox.setInternalState(userService, "userRepository", userRepository); } @Test public void testGetUsers(){ List<User> users = Arrays.asList( createUser( "user1", "user@eq.com", new Date() ) ); when( userRepository.findAll( new Sort(Sort.Direction.ASC, "userName") ) ).thenReturn(users); List<User> result = userService.getUsers(); assertSame(users, result); } @Test public void testSaveUser(){ User user1 = createUser( "user1", "user@eq.com", new Date() ); when( userRepository.save(user1) ).thenReturn(user1); User result = userService.saveUser(user1); assertSame(user1, result); } @Test public void testDeleteUser(){ userService.deleteUser("user1"); verify( userRepository ).deleteByUserName("user1"); } private User createUser(String userName, String email, Date registrationDate){ User result = new User(); result.setUserName(userName); result.setEmail(email); result.setRegistrationDate(registrationDate); return result; } }
UTF-8
Java
2,064
java
UserServiceTest.java
Java
[ { "context": "/*\r\n * Copyright 2018, Charter Communications, All rights reserved.\r\n */\r\npackag", "end": 30, "score": 0.730088472366333, "start": 23, "tag": "NAME", "value": "Charter" }, { "context": " List<User> users = Arrays.asList( createUser( \"user1\", \"user@eq.com\", n...
null
[]
/* * Copyright 2018, Charter Communications, All rights reserved. */ package com.tsolakp.samplespringmvcrest.api.user; import java.util.List; import java.util.Arrays; import java.util.Date; import org.junit.Test; import org.junit.Before; import org.junit.runner.RunWith; import static org.junit.Assert.*; import org.mockito.Mock; import static org.mockito.Mockito.*; import org.powermock.reflect.Whitebox; import org.springframework.data.domain.Sort; import org.powermock.modules.junit4.PowerMockRunner; @RunWith(PowerMockRunner.class) public class UserServiceTest { @Mock private UserRepository userRepository = null; private UserService userService = null; @Before public void before(){ userService = new UserService(); Whitebox.setInternalState(userService, "userRepository", userRepository); } @Test public void testGetUsers(){ List<User> users = Arrays.asList( createUser( "user1", "<EMAIL>", new Date() ) ); when( userRepository.findAll( new Sort(Sort.Direction.ASC, "userName") ) ).thenReturn(users); List<User> result = userService.getUsers(); assertSame(users, result); } @Test public void testSaveUser(){ User user1 = createUser( "user1", "<EMAIL>", new Date() ); when( userRepository.save(user1) ).thenReturn(user1); User result = userService.saveUser(user1); assertSame(user1, result); } @Test public void testDeleteUser(){ userService.deleteUser("user1"); verify( userRepository ).deleteByUserName("user1"); } private User createUser(String userName, String email, Date registrationDate){ User result = new User(); result.setUserName(userName); result.setEmail(email); result.setRegistrationDate(registrationDate); return result; } }
2,056
0.625484
0.618702
71
27.070423
25.191841
102
false
false
0
0
0
0
0
0
0.633803
false
false
0
efdd5e60b8c0e8b7d7b7e0b643f13adc9b893650
12,086,038,013,213
6ac1b7f6ef1542be7b5cc66fd4a5b62a90c1e071
/src/eu/anastasis/tulliniHelpGest/modules/HelpGestModule.java
c39e3627ecdd7835a6d8074d8de8575d389d89bd
[]
no_license
andreafrascari/contabilis
https://github.com/andreafrascari/contabilis
0ed9b8d8ea38ea31c90a07817728b16da3bf1722
d642688eef73584602d78411b424c3052311b025
refs/heads/master
2020-12-24T12:06:34.856000
2018-12-21T15:21:11
2018-12-21T15:21:11
73,070,548
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package eu.anastasis.tulliniHelpGest.modules; import eu.anastasis.serena.application.core.modules.DefaultModule; import eu.anastasis.tulliniHelpGest.utils.ClientChartGraphicsMethod; import eu.anastasis.tulliniHelpGest.utils.ClientChartReportMethod; import eu.anastasis.tulliniHelpGest.utils.ClienteFromSysUserFunction; import eu.anastasis.tulliniHelpGest.utils.Export2BPFunction; import eu.anastasis.tulliniHelpGest.utils.NextFatturaFunction; import eu.anastasis.tulliniHelpGest.utils.NextProFormaFunction; import eu.anastasis.tulliniHelpGest.utils.OperatoreCorrenteFunction; public class HelpGestModule extends DefaultModule { public static final String DEFAULT_MODULE_NAME= "helpgest"; @Override public String getDefaultName() { // TODO Auto-generated method stub return DEFAULT_MODULE_NAME; } @Override protected void setUpMethods() { addMethod(new MetapraticaAjaxMethod(this,getDefaultParameters())); addMethod(new NextNumberAjaxMethod(this,getDefaultParameters())); addMethod(new Listino2PraticheMethod(this,getDefaultParameters())); addMethod(new GeneraProformaMethod(this,getDefaultParameters())); addMethod(new ActivityCacheAjaxMethod(this,getDefaultParameters())); addMethod(new ResetOperatorsCacheMethod(this,getDefaultParameters())); addMethod(new ResetIndicizzazioneCacheMethod(this,getDefaultParameters())); addMethod(new Proforma2FatturaMethod(this,getDefaultParameters())); addMethod(new RefreshInvoicingCalendarMethod(this,getDefaultParameters())); addMethod(new BirtReport2DocumentoMethod(this,getDefaultParameters())); addMethod(new BirtReportProforma2DocumentoMethod(this,getDefaultParameters())); addMethod(new Listino2PreventivoMethod(this,getDefaultParameters())); addMethod(new Proforma2SollecitoMethod(this,getDefaultParameters())); addMethod(new SendSollecitoMethod(this,getDefaultParameters())); addMethod(new UploadAndSendProfiledMethod(this,getDefaultParameters())); addMethod(new DeleteVoceFatturaMethod(this,getDefaultParameters())); addMethod(new ResetInvoicingCalendarMethod4Client(this,getDefaultParameters())); addMethod(new AdjustInvoiceNumerationAjaxMethod(this,getDefaultParameters())); addMethod(new CacheCleanAjaxMethod(this,getDefaultParameters())); addMethod(new SendAndRegisterSmsMethod(this,getDefaultParameters())); addMethod(new SmsNotificationMethod(this,getDefaultParameters())); addMethod(new ActivityNotificationAjaxMethod(this,getDefaultParameters())); addMethod(new DeleteAccountClienteAjaxMethod(this,getDefaultParameters())); addMethod(new ProcessMetascadenzaMethod(this,getDefaultParameters())); addMethod(new RegisterClientProfileMethod(this,getDefaultParameters())); addMethod(new ExecClientProfileMethod(this,getDefaultParameters())); addMethod(new Pratica2ListinoMethod(this,getDefaultParameters())); addMethod(new MigraPratichePendentiMethod(this,getDefaultParameters())); addMethod(new InsertPraticaMethod(this,getDefaultParameters())); addMethod(new Merge2SinglePdfMethod(this,getDefaultParameters())); addMethod(new ClientChartReportMethod(this,getDefaultParameters())); addMethod(new ClientChartGraphicsMethod(this,getDefaultParameters())); addFunctionToPostparse(new NextFatturaFunction()); addFunctionToPostparse(new NextProFormaFunction()); addFunctionToPostparse(new Export2BPFunction()); addFunctionToPostparse(new ClienteFromSysUserFunction()); addFunctionToPreparse(new OperatoreCorrenteFunction()); } }
UTF-8
Java
3,480
java
HelpGestModule.java
Java
[]
null
[]
package eu.anastasis.tulliniHelpGest.modules; import eu.anastasis.serena.application.core.modules.DefaultModule; import eu.anastasis.tulliniHelpGest.utils.ClientChartGraphicsMethod; import eu.anastasis.tulliniHelpGest.utils.ClientChartReportMethod; import eu.anastasis.tulliniHelpGest.utils.ClienteFromSysUserFunction; import eu.anastasis.tulliniHelpGest.utils.Export2BPFunction; import eu.anastasis.tulliniHelpGest.utils.NextFatturaFunction; import eu.anastasis.tulliniHelpGest.utils.NextProFormaFunction; import eu.anastasis.tulliniHelpGest.utils.OperatoreCorrenteFunction; public class HelpGestModule extends DefaultModule { public static final String DEFAULT_MODULE_NAME= "helpgest"; @Override public String getDefaultName() { // TODO Auto-generated method stub return DEFAULT_MODULE_NAME; } @Override protected void setUpMethods() { addMethod(new MetapraticaAjaxMethod(this,getDefaultParameters())); addMethod(new NextNumberAjaxMethod(this,getDefaultParameters())); addMethod(new Listino2PraticheMethod(this,getDefaultParameters())); addMethod(new GeneraProformaMethod(this,getDefaultParameters())); addMethod(new ActivityCacheAjaxMethod(this,getDefaultParameters())); addMethod(new ResetOperatorsCacheMethod(this,getDefaultParameters())); addMethod(new ResetIndicizzazioneCacheMethod(this,getDefaultParameters())); addMethod(new Proforma2FatturaMethod(this,getDefaultParameters())); addMethod(new RefreshInvoicingCalendarMethod(this,getDefaultParameters())); addMethod(new BirtReport2DocumentoMethod(this,getDefaultParameters())); addMethod(new BirtReportProforma2DocumentoMethod(this,getDefaultParameters())); addMethod(new Listino2PreventivoMethod(this,getDefaultParameters())); addMethod(new Proforma2SollecitoMethod(this,getDefaultParameters())); addMethod(new SendSollecitoMethod(this,getDefaultParameters())); addMethod(new UploadAndSendProfiledMethod(this,getDefaultParameters())); addMethod(new DeleteVoceFatturaMethod(this,getDefaultParameters())); addMethod(new ResetInvoicingCalendarMethod4Client(this,getDefaultParameters())); addMethod(new AdjustInvoiceNumerationAjaxMethod(this,getDefaultParameters())); addMethod(new CacheCleanAjaxMethod(this,getDefaultParameters())); addMethod(new SendAndRegisterSmsMethod(this,getDefaultParameters())); addMethod(new SmsNotificationMethod(this,getDefaultParameters())); addMethod(new ActivityNotificationAjaxMethod(this,getDefaultParameters())); addMethod(new DeleteAccountClienteAjaxMethod(this,getDefaultParameters())); addMethod(new ProcessMetascadenzaMethod(this,getDefaultParameters())); addMethod(new RegisterClientProfileMethod(this,getDefaultParameters())); addMethod(new ExecClientProfileMethod(this,getDefaultParameters())); addMethod(new Pratica2ListinoMethod(this,getDefaultParameters())); addMethod(new MigraPratichePendentiMethod(this,getDefaultParameters())); addMethod(new InsertPraticaMethod(this,getDefaultParameters())); addMethod(new Merge2SinglePdfMethod(this,getDefaultParameters())); addMethod(new ClientChartReportMethod(this,getDefaultParameters())); addMethod(new ClientChartGraphicsMethod(this,getDefaultParameters())); addFunctionToPostparse(new NextFatturaFunction()); addFunctionToPostparse(new NextProFormaFunction()); addFunctionToPostparse(new Export2BPFunction()); addFunctionToPostparse(new ClienteFromSysUserFunction()); addFunctionToPreparse(new OperatoreCorrenteFunction()); } }
3,480
0.833046
0.829885
68
50.176472
28.711004
82
false
false
0
0
0
0
0
0
2.602941
false
false
0
4c87eae9046ea2a1b59c7f32c5116f03c924746e
11,493,332,532,418
ca6f6e28e99454d83ffa23fdabb8c92826a606b4
/src/cn/tzy/app/swordoffer2/ReverseNodeList.java
fc797ed31897c8d166c93f7a4630b11b26b9a27b
[]
no_license
zhenyutu/algorithm
https://github.com/zhenyutu/algorithm
2a07e792e7405d57e2a2251cf390d60683c0b48d
190534a395403a6f2e019f7e86055d33feec7762
refs/heads/master
2020-05-25T04:45:02.744000
2018-04-14T13:55:49
2018-04-14T13:55:53
84,911,480
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.tzy.app.swordoffer2; import java.util.LinkedList; /** * Created by tuzhenyu on 17-12-10. * @author tuzhenyu */ public class ReverseNodeList { public ListNode ReverseList(ListNode head) { if (head==null) return null; ListNode pre = null; ListNode cur = head; ListNode next; while (cur!=null){ next = cur.next; cur.next = pre; pre = cur; cur = next; } return pre; } public ListNode ReverseList2(ListNode head) { ListNode current = head; LinkedList<ListNode> list = new LinkedList<>(); if (head == null) return null; while (current!=null){ list.push(current); current = current.next; } ListNode head2 = list.pop(); head2.next = null; ListNode current2 = head2; while (!list.isEmpty()){ ListNode node = list.pop(); node.next = null; current2.next = node; current2 = current2.next; } return head2; } public static void main(String[] args) { ListNode node = new ListNode(0); ListNode node1 = new ListNode(1); ListNode node2 = new ListNode(2); ListNode node3 = new ListNode(3); ListNode node4 = new ListNode(4); node.next = node1; node1.next = node2; node2.next = node3; node3.next = node4; node4.next = null; ReverseNodeList r = new ReverseNodeList(); ListNode l = r.ReverseList(node); while (l!=null){ System.out.print(l.val+" "); l = l.next; } } }
UTF-8
Java
1,714
java
ReverseNodeList.java
Java
[ { "context": ";\n\nimport java.util.LinkedList;\n\n/**\n * Created by tuzhenyu on 17-12-10.\n * @author tuzhenyu\n */\npublic class", "end": 89, "score": 0.989552915096283, "start": 81, "tag": "USERNAME", "value": "tuzhenyu" }, { "context": "/**\n * Created by tuzhenyu on 17-12-10.\n...
null
[]
package cn.tzy.app.swordoffer2; import java.util.LinkedList; /** * Created by tuzhenyu on 17-12-10. * @author tuzhenyu */ public class ReverseNodeList { public ListNode ReverseList(ListNode head) { if (head==null) return null; ListNode pre = null; ListNode cur = head; ListNode next; while (cur!=null){ next = cur.next; cur.next = pre; pre = cur; cur = next; } return pre; } public ListNode ReverseList2(ListNode head) { ListNode current = head; LinkedList<ListNode> list = new LinkedList<>(); if (head == null) return null; while (current!=null){ list.push(current); current = current.next; } ListNode head2 = list.pop(); head2.next = null; ListNode current2 = head2; while (!list.isEmpty()){ ListNode node = list.pop(); node.next = null; current2.next = node; current2 = current2.next; } return head2; } public static void main(String[] args) { ListNode node = new ListNode(0); ListNode node1 = new ListNode(1); ListNode node2 = new ListNode(2); ListNode node3 = new ListNode(3); ListNode node4 = new ListNode(4); node.next = node1; node1.next = node2; node2.next = node3; node3.next = node4; node4.next = null; ReverseNodeList r = new ReverseNodeList(); ListNode l = r.ReverseList(node); while (l!=null){ System.out.print(l.val+" "); l = l.next; } } }
1,714
0.521003
0.50175
68
24.205883
14.685486
55
false
false
0
0
0
0
0
0
0.558824
false
false
0
0a01404c2badcfb99c5178d55f3593d2d3a69d59
7,619,272,049,434
7ee574f32e13aae0a1298834449e19d28d5ed26e
/src/com/leet/problems/PairOfSongs.java
159a8da71a4df2d739c22bc7d801e7169a3660cc
[]
no_license
prabhujkmrs/sample
https://github.com/prabhujkmrs/sample
d77480d3d22232c5a5013ff37a8c24b1afd97741
7ff1026145d61fa810bba324dc3371c0d127536b
refs/heads/master
2022-05-24T13:15:19.097000
2022-03-22T17:13:20
2022-03-22T17:13:20
158,525,686
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.leet.problems; public class PairOfSongs { public int numPairsDivisibleBy60(int[] time) { /* // Brute force solution O(n^2) int count=0; for(int l=0; l < time.length; l++){ for(int r = time.length -1; r > l ; r--){ if((time[l] + time[r]) % 60 == 0 ){ count++; } } } return count; */ // Optimal solution O(n) // Dont understand this solution int count = 0; int[] remToCount = new int[60]; for(int i=0; i < time.length; i++){ int x = time[i]; int rem = x % 60; if(rem == 0) count+= remToCount[0]; else count += remToCount[60-rem]; remToCount[rem]++; } return count; } public static void main(String[] args){ System.out.println(new PairOfSongs().numPairsDivisibleBy60(new int[]{30,20,150,100,40})); //System.out.println(new PairOfSongs().numPairsDivisibleBy60(new int[]{60,60,60,60})); } }
UTF-8
Java
1,104
java
PairOfSongs.java
Java
[]
null
[]
package com.leet.problems; public class PairOfSongs { public int numPairsDivisibleBy60(int[] time) { /* // Brute force solution O(n^2) int count=0; for(int l=0; l < time.length; l++){ for(int r = time.length -1; r > l ; r--){ if((time[l] + time[r]) % 60 == 0 ){ count++; } } } return count; */ // Optimal solution O(n) // Dont understand this solution int count = 0; int[] remToCount = new int[60]; for(int i=0; i < time.length; i++){ int x = time[i]; int rem = x % 60; if(rem == 0) count+= remToCount[0]; else count += remToCount[60-rem]; remToCount[rem]++; } return count; } public static void main(String[] args){ System.out.println(new PairOfSongs().numPairsDivisibleBy60(new int[]{30,20,150,100,40})); //System.out.println(new PairOfSongs().numPairsDivisibleBy60(new int[]{60,60,60,60})); } }
1,104
0.478261
0.439312
41
25.926828
22.397072
97
false
false
0
0
0
0
0
0
0.658537
false
false
0
d51968a9401794c4631c35cd27921a82eee056fe
30,794,915,546,674
3396fb304f4b3c577bd3b413beb4a63bab2fb2c6
/Parttime.java
117ce15c5c9476a6fa725713b07d17a64f8d3192
[]
no_license
recaicakiroglu/Payroll-Management-System
https://github.com/recaicakiroglu/Payroll-Management-System
3388c2e78a3ae577a8b78003bf6a6563eab9edeb
b74649927437b2908bfbaba466347e603569e09c
refs/heads/master
2021-01-21T08:02:08.536000
2017-02-27T16:09:51
2017-02-27T16:09:51
83,329,557
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class Parttime extends Employee{ /** * * @param name Parttime's Name * @param reg Parttime's registration number * @param job Person's Job * @param year year of start * @param fweek first week salary * @param sweek second week salary * @param tweek third week salary * @param lweek last week salary * @param salary total salary * @param severancepay severance pay */ public Parttime(String name, String reg, String job, int year, int fweek, int sweek, int tweek, int lweek, double salary, double severancepay) { super(name, reg, job, year, fweek, sweek, tweek, lweek, salary, severancepay); // TODO Auto-generated constructor stub } public double getSalary(){ if (getFweek() < 10) { setFweek(0); } if (getSweek() < 10) { setSweek(0); } if (getTweek() < 10) { setTweek(0); } if (getLweek() < 10) { setLweek(0); } if (getFweek() > 20) { setFweek(20); } if (getSweek() > 20) { setSweek(20); } if (getTweek() > 20) { setTweek(20); } if (getLweek() > 20) { setLweek(20); } int hour = getFweek()+getSweek()+getTweek()+getLweek(); double salary = 12*hour; return salary; } }
UTF-8
Java
1,210
java
Parttime.java
Java
[ { "context": "me extends Employee{\r\n\r\n\t/**\r\n\t * \r\n * @param name Parttime's Name\r\n * @param reg Parttime's registration nu", "end": 80, "score": 0.7383530139923096, "start": 72, "tag": "NAME", "value": "Parttime" } ]
null
[]
public class Parttime extends Employee{ /** * * @param name Parttime's Name * @param reg Parttime's registration number * @param job Person's Job * @param year year of start * @param fweek first week salary * @param sweek second week salary * @param tweek third week salary * @param lweek last week salary * @param salary total salary * @param severancepay severance pay */ public Parttime(String name, String reg, String job, int year, int fweek, int sweek, int tweek, int lweek, double salary, double severancepay) { super(name, reg, job, year, fweek, sweek, tweek, lweek, salary, severancepay); // TODO Auto-generated constructor stub } public double getSalary(){ if (getFweek() < 10) { setFweek(0); } if (getSweek() < 10) { setSweek(0); } if (getTweek() < 10) { setTweek(0); } if (getLweek() < 10) { setLweek(0); } if (getFweek() > 20) { setFweek(20); } if (getSweek() > 20) { setSweek(20); } if (getTweek() > 20) { setTweek(20); } if (getLweek() > 20) { setLweek(20); } int hour = getFweek()+getSweek()+getTweek()+getLweek(); double salary = 12*hour; return salary; } }
1,210
0.613223
0.58843
54
20.370371
20.30991
106
false
false
0
0
0
0
0
0
1.462963
false
false
0
1f09be0f2d6ee31e59c3a8192f7ded6302b03187
35,768,487,653,833
40f0ef1c1e680402f1cc19aba4bdc9138b8a8b21
/src/Tests.java
8dcf98d9740b2c93d1c2e70d09de83c89158d91b
[]
no_license
surajbabar5719/TcsCaseStudy12Jun
https://github.com/surajbabar5719/TcsCaseStudy12Jun
aef0a6e15eee1da70e8251c391b18ce7d1065e4d
9a124fb8527d708277a68eb663d2491cf86a99fc
refs/heads/master
2022-11-07T01:47:27.385000
2020-06-17T11:10:55
2020-06-17T11:10:55
271,493,840
0
1
null
false
2020-06-17T11:10:57
2020-06-11T08:32:58
2020-06-16T08:57:23
2020-06-17T11:10:56
80
0
1
0
Java
false
false
import com.tcs.casestudy.util.ConnectionManager; import com.tcs.casestudy.userDAO.UserDAO; public class Tests { public Tests() { // TODO Auto-generated constructor stub } public static void main(String[] args) { // TODO Auto-generated method stub UserDAO.bankEmployeeLogin("Cashidr", "Cashier@12"); } }
UTF-8
Java
328
java
Tests.java
Java
[ { "context": "generated method stub\r\nUserDAO.bankEmployeeLogin(\"Cashidr\", \"Cashier@12\");\r\n\t}\r\n\r\n}\r\n", "end": 300, "score": 0.9991672039031982, "start": 293, "tag": "USERNAME", "value": "Cashidr" }, { "context": "ethod stub\r\nUserDAO.bankEmployeeLogin(\"Cashidr\", \"Ca...
null
[]
import com.tcs.casestudy.util.ConnectionManager; import com.tcs.casestudy.userDAO.UserDAO; public class Tests { public Tests() { // TODO Auto-generated constructor stub } public static void main(String[] args) { // TODO Auto-generated method stub UserDAO.bankEmployeeLogin("Cashidr", "Cashier@12"); } }
328
0.710366
0.704268
14
21.428572
19.844807
51
false
false
0
0
0
0
0
0
0.857143
false
false
0
d42e10798fc6fa645f2454ee23f40739978643af
34,308,198,789,465
99b197008de673623f0b0fd6b280082a7b09ad01
/src/main/java/A.java
0ac2af4682a1e3e7001e694964141e47d5415316
[]
no_license
shmuel-buchnik/scope-issue
https://github.com/shmuel-buchnik/scope-issue
f3a3124bd6fb42de78fb5aa4308346c0443deb56
44a23f4d102d1eb866eb77bef1ce36b084be91d2
refs/heads/master
2016-09-13T20:45:42.920000
2016-04-17T13:32:39
2016-04-17T13:32:39
56,437,656
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Created by Shmuel.Buchnik on 4/17/2016. */ public class A { private Action action; public void setAction(Action action) { this.action = action; } public void action(){ action.doAction(); } }
UTF-8
Java
237
java
A.java
Java
[ { "context": "/**\n * Created by Shmuel.Buchnik on 4/17/2016.\n */\npublic class A {\n private Ac", "end": 32, "score": 0.9998765587806702, "start": 18, "tag": "NAME", "value": "Shmuel.Buchnik" } ]
null
[]
/** * Created by Shmuel.Buchnik on 4/17/2016. */ public class A { private Action action; public void setAction(Action action) { this.action = action; } public void action(){ action.doAction(); } }
237
0.586498
0.556962
14
15.928572
14.925838
42
false
false
0
0
0
0
0
0
0.214286
false
false
0
b81046276b4bdf6549dd24dd976d8b636c13ad18
36,928,128,815,899
b7d9f66c5b80acb34543849338a951e13bda13ed
/Class_Project2/Part 2/spacecraft.java
6418aba30aebf60001928c96a932a512f0e57f2a
[]
no_license
AndresCR2/CSCI_JavaPrograms
https://github.com/AndresCR2/CSCI_JavaPrograms
aa5ac0b75c24fc637f30a8607cb5f7e03f164eb8
1c5f87d5cb2499d9e86a444fdefce50fcd549009
refs/heads/main
2023-01-21T10:26:51.637000
2020-11-22T05:52:47
2020-11-22T05:52:47
314,964,066
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * spacecraft.java * Description: This programs draws and colors the polygons, alos holds all operations for movement. *Author: Roy Andres Corrales Ramirez *Creation Date:4/22/2019 */ import java.awt.*; import java.awt.event.*; import javax.swing.*; public class spacecraft extends JPanel{ int currentx=0, currenty=0, currentxt1=500, currentyt1=500, currentxt2=0, currentyt2=0, counter=0; //Instantiates all the values uesed int speed = 2; int speed2 = 4; Polygon landingG; boolean landing = true; public spacecraft(){ PolygonPanel listener = new PolygonPanel(); addMouseListener(listener); addMouseMotionListener(listener); setBackground(Color.black); setPreferredSize(new Dimension(1920,1080));} //Sets resolution public void paintComponent(Graphics panel){ super.paintComponent(panel); panel.setColor(Color.yellow); //Holds all coordinates to draw the polygon int[] xloc_Tie1 = {currentxt1+331,currentxt1+331,currentxt1+462,currentxt1+479,currentxt1+445,currentxt1+315, currentxt1+304,currentxt1+292,currentxt1+276,currentxt1+243,currentxt1+233,currentxt1+227, currentxt1+206,currentxt1+193,currentxt1+183,currentxt1+154,currentxt1+157,currentxt1+128, currentxt1+116,currentxt1+22,currentxt1+0,currentxt1+28,currentxt1+142,currentxt1+149,currentxt1+178, currentxt1+187,currentxt1+197,currentxt1+207,currentxt1+222,currentxt1+235,currentxt1+247,currentxt1+264,currentxt1+275, currentxt1+280,currentxt1+288,currentxt1+300,currentxt1+295,currentxt1+330}; int[] yloc_Tie1 = {currentyt1+545,currentyt1+545,currentyt1+493,currentyt1+244,currentyt1+47,currentyt1+123, currentyt1+259,currentyt1+251,currentyt1+232,currentyt1+215,currentyt1+215,currentyt1+216, currentyt1+222,currentyt1+231,currentyt1+246,currentyt1+244,currentyt1+206,currentyt1+1, currentyt1+0,currentyt1+87,currentyt1+320,currentyt1+526,currentyt1+464,currentyt1+303,currentyt1+320, currentyt1+332,currentyt1+342,currentyt1+349,currentyt1+350,currentyt1+352,currentyt1+352,currentyt1+348, currentyt1+341,currentyt1+330,currentyt1+319,currentyt1+322,currentyt1+347,currentyt1+546}; panel.fillPolygon(xloc_Tie1,yloc_Tie1, xloc_Tie1.length); //Fills in the coordinates to become a solid panel.setColor(Color.black); int[] xloc_Circle1 = {currentxt1+226,currentxt1+225,currentxt1+221,currentxt1+220,currentxt1+219,currentxt1+219, currentxt1+219,currentxt1+221,currentxt1+224,currentxt1+226,currentxt1+229,currentxt1+232, currentxt1+237,currentxt1+242,currentxt1+249,currentxt1+255,currentxt1+262,currentxt1+272, currentxt1+279,currentxt1+283,currentxt1+289,currentxt1+295,currentxt1+297,currentxt1+297, currentxt1+297,currentxt1+297,currentxt1+296,currentxt1+294,currentxt1+291,currentxt1+285, currentxt1+283,currentxt1+279,currentxt1+276,currentxt1+272,currentxt1+267,currentxt1+260, currentxt1+250,currentxt1+249,currentxt1+245,currentxt1+240,currentxt1+240,currentxt1+239, currentxt1+238,currentxt1+228,currentxt1+228,currentxt1+226,currentxt1+225,currentxt1+223, currentxt1+222}; int[] yloc_Circle1 = {currentyt1+246,currentyt1+251,currentyt1+257,currentyt1+265,currentyt1+272,currentyt1+277,currentyt1+282, currentyt1+288,currentyt1+294,currentyt1+299,currentyt1+302,currentyt1+306,currentyt1+309,currentyt1+311, currentyt1+312,currentyt1+315,currentyt1+315,currentyt1+315,currentyt1+312,currentyt1+310,currentyt1+302, currentyt1+294,currentyt1+287,currentyt1+278,currentyt1+270,currentyt1+262,currentyt1+257,currentyt1+251, currentyt1+248,currentyt1+244,currentyt1+242,currentyt1+240,currentyt1+239,currentyt1+239,currentyt1+237, currentyt1+235,currentyt1+234,currentyt1+234,currentyt1+234,currentyt1+235,currentyt1+235,currentyt1+237, currentyt1+237,currentyt1+241,currentyt1+241,currentyt1+244,currentyt1+244,currentyt1+246,currentyt1+251}; panel.fillPolygon(xloc_Circle1,yloc_Circle1, xloc_Circle1.length); if(currentxt1 > 1920) //Allows the polygon to stay within the window frame { currentxt1 = 0; } if(currentyt1 > 1080) { currentyt1 = 0; } currentxt1 = currentxt1+speed;//Increases the speed using a random number, which gives it a random starting point as well currentyt1 = currentyt1+speed; panel.setColor(Color.red); int[] xloc_Tie2 = {currentxt2+331,currentxt2+331,currentxt2+462,currentxt2+479,currentxt2+445,currentxt2+315, currentxt2+304,currentxt2+292,currentxt2+276,currentxt2+243,currentxt2+233,currentxt2+227, currentxt2+206,currentxt2+193,currentxt2+183,currentxt2+154,currentxt2+157,currentxt2+128, currentxt2+116,currentxt2+22,currentxt2+0,currentxt2+28,currentxt2+142,currentxt2+149,currentxt2+178, currentxt2+187,currentxt2+197,currentxt2+207,currentxt2+222,currentxt2+235,currentxt2+247,currentxt2+264,currentxt2+275, currentxt2+280,currentxt2+288,currentxt2+300,currentxt2+295,currentxt2+330}; int[] yloc_Tie2 = {currentyt2+545,currentyt2+545,currentyt2+493,currentyt2+244,currentyt2+47,currentyt2+123, currentyt2+259,currentyt2+251,currentyt2+232,currentyt2+215,currentyt2+215,currentyt2+216, currentyt2+222,currentyt2+231,currentyt2+246,currentyt2+244,currentyt2+206,currentyt2+1, currentyt2+0,currentyt2+87,currentyt2+320,currentyt2+526,currentyt2+464,currentyt2+303,currentyt2+320, currentyt2+332,currentyt2+342,currentyt2+349,currentyt2+350,currentyt2+352,currentyt2+352,currentyt2+348, currentyt2+341,currentyt2+330,currentyt2+319,currentyt2+322,currentyt2+347,currentyt2+546}; panel.fillPolygon(xloc_Tie2,yloc_Tie2, xloc_Tie2.length); panel.setColor(Color.black); int[] xloc_Circle2 = {currentxt2+226,currentxt2+225,currentxt2+221,currentxt2+220,currentxt2+219,currentxt2+219, currentxt2+219,currentxt2+221,currentxt2+224,currentxt2+226,currentxt2+229,currentxt2+232, currentxt2+237,currentxt2+242,currentxt2+249,currentxt2+255,currentxt2+262,currentxt2+272, currentxt2+279,currentxt2+283,currentxt2+289,currentxt2+295,currentxt2+297,currentxt2+297, currentxt2+297,currentxt2+297,currentxt2+296,currentxt2+294,currentxt2+291,currentxt2+285, currentxt2+283,currentxt2+279,currentxt2+276,currentxt2+272,currentxt2+267,currentxt2+260, currentxt2+250,currentxt2+249,currentxt2+245,currentxt2+240,currentxt2+240,currentxt2+239, currentxt2+238,currentxt2+228,currentxt2+228,currentxt2+226,currentxt2+225,currentxt2+223, currentxt2+222}; int[] yloc_Circle2 = {currentyt2+246,currentyt2+251,currentyt2+257,currentyt2+265,currentyt2+272,currentyt2+277,currentyt2+282, currentyt2+288,currentyt2+294,currentyt2+299,currentyt2+302,currentyt2+306,currentyt2+309,currentyt2+311, currentyt2+312,currentyt2+315,currentyt2+315,currentyt2+315,currentyt2+312,currentyt2+310,currentyt2+302, currentyt2+294,currentyt2+287,currentyt2+278,currentyt2+270,currentyt2+262,currentyt2+257,currentyt2+251, currentyt2+248,currentyt2+244,currentyt2+242,currentyt2+240,currentyt2+239,currentyt2+239,currentyt2+237, currentyt2+235,currentyt2+234,currentyt2+234,currentyt2+234,currentyt2+235,currentyt2+235,currentyt2+237, currentyt2+237,currentyt2+241,currentyt2+241,currentyt2+244,currentyt2+244,currentyt2+246,currentyt2+251}; panel.fillPolygon(xloc_Circle2,yloc_Circle2, xloc_Circle2.length); if(currentxt2 > 1920) { currentxt2 = 0; } if(currentyt2 > 1080) { currentyt2 = 0; } currentxt2 = currentxt2+speed2; currentyt2 = currentyt2+speed2; panel.setColor(Color.gray); int[] xloc_Falcon = {currentx+364,currentx+364,currentx+230,currentx+226,currentx+214,currentx+210, currentx+174,currentx+171,currentx+168,currentx+165,currentx+154,currentx+151, currentx+138,currentx+136,currentx+126,currentx+119,currentx+93,currentx+89, currentx+66,currentx+34,currentx+36,currentx+31,currentx+40,currentx+84,currentx+118, currentx+146,currentx+168,currentx+215,currentx+237,currentx+243,currentx+275, currentx+304,currentx+331,currentx+469,currentx+449,currentx+353,currentx+341, currentx+363,currentx+338,currentx+376,currentx+392,currentx+389,currentx+383, currentx+367,currentx+359}; int[] yloc_Falcon = {currenty+311,currenty+311,currenty+271,currenty+280,currenty+279,currenty+264, currenty+259,currenty+263,currenty+266,currenty+270,currenty+271,currenty+269, currenty+264,currenty+264,currenty+265,currenty+258,currenty+236,currenty+229, currenty+221,currenty+170,currenty+135,currenty+130,currenty+115,currenty+94, currenty+87,currenty+82,currenty+80,currenty+74,currenty+79,currenty+86,currenty+85, currenty+85,currenty+103,currenty+251,currenty+267,currenty+216,currenty+219,currenty+233, currenty+248,currenty+273,currenty+290,currenty+299,currenty+304,currenty+312,currenty+310}; panel.fillPolygon(xloc_Falcon,yloc_Falcon,xloc_Falcon.length); panel.setColor(Color.white); int[] xloc_Bridge = {currentx+158,currentx+158,currentx+155,currentx+147,currentx+142,currentx+136, currentx+131,currentx+127,currentx+122,currentx+120,currentx+110,currentx+93, currentx+91,currentx+91,currentx+94,currentx+95,currentx+98,currentx+100, currentx+103,currentx+106,currentx+107,currentx+172,currentx+190,currentx+196, currentx+152,currentx+158,currentx+160,currentx+161,currentx+163,currentx+165, currentx+168,currentx+171,currentx+174,currentx+174,currentx+174,currentx+173, currentx+173,currentx+170,currentx+170,currentx+163,currentx+163,currentx+161, currentx+159,currentx+156}; int[] yloc_Bridge = {currenty+271,currenty+271,currenty+269,currenty+268,currenty+267,currenty+265, currenty+264,currenty+264,currenty+262,currenty+258,currenty+252,currenty+236, currenty+231,currenty+226,currenty+219,currenty+212,currenty+208,currenty+208, currenty+205,currenty+202,currenty+200,currenty+146,currenty+149,currenty+160, currenty+216,currenty+223,currenty+228,currenty+236,currenty+240,currenty+242, currenty+244,currenty+246,currenty+252,currenty+253,currenty+258,currenty+264, currenty+264,currenty+268,currenty+268,currenty+270,currenty+270,currenty+270, currenty+270,currenty+269}; panel.fillPolygon(xloc_Bridge,yloc_Bridge, xloc_Bridge.length); panel.setColor(Color.white); int[] xloc_LandingGear1 = {currentx+77,currentx+76,currentx+76,currentx+76,currentx+93,currentx+91}; int[] yloc_LandingGear1 = {currenty+224,currenty+225,currenty+244,currenty+260,currenty+261,currenty+231}; landingG = new Polygon(xloc_LandingGear1, yloc_LandingGear1, xloc_LandingGear1.length); if(landing) { panel.setColor(Color.white); panel.fillPolygon(landingG); } if(!landing) { panel.setColor(Color.black); panel.fillPolygon(landingG); } repaint(); } private class PolygonPanel implements MouseListener, MouseMotionListener{//Holds all listeners, even if they are not being used //A boolean statament which makes the landing gear appear and re-apprear public void mousePressed(MouseEvent event){} public void mouseDragged(MouseEvent event){} public void mouseReleased(MouseEvent event){} public void mouseEntered(MouseEvent event){} public void mouseExited(MouseEvent event){} public void mouseClicked(MouseEvent event) { if (event.getButton() == MouseEvent.BUTTON1) { if(!landing) { landing = true; } if(landing) { landing = false; } repaint(); } } public void mouseMoved(MouseEvent event){ //Makes the Falcon follow the mouse currentx = event.getPoint().x - 500; currenty = event.getPoint().y - 400; repaint(); } } }
UTF-8
Java
13,732
java
spacecraft.java
Java
[ { "context": "los holds all operations for movement. \r\n*Author: Roy Andres Corrales Ramirez\r\n*Creation Date:4/22/2019\r\n*/\r\nimport java.awt.*;", "end": 162, "score": 0.9998408555984497, "start": 135, "tag": "NAME", "value": "Roy Andres Corrales Ramirez" } ]
null
[]
/* * spacecraft.java * Description: This programs draws and colors the polygons, alos holds all operations for movement. *Author: <NAME> *Creation Date:4/22/2019 */ import java.awt.*; import java.awt.event.*; import javax.swing.*; public class spacecraft extends JPanel{ int currentx=0, currenty=0, currentxt1=500, currentyt1=500, currentxt2=0, currentyt2=0, counter=0; //Instantiates all the values uesed int speed = 2; int speed2 = 4; Polygon landingG; boolean landing = true; public spacecraft(){ PolygonPanel listener = new PolygonPanel(); addMouseListener(listener); addMouseMotionListener(listener); setBackground(Color.black); setPreferredSize(new Dimension(1920,1080));} //Sets resolution public void paintComponent(Graphics panel){ super.paintComponent(panel); panel.setColor(Color.yellow); //Holds all coordinates to draw the polygon int[] xloc_Tie1 = {currentxt1+331,currentxt1+331,currentxt1+462,currentxt1+479,currentxt1+445,currentxt1+315, currentxt1+304,currentxt1+292,currentxt1+276,currentxt1+243,currentxt1+233,currentxt1+227, currentxt1+206,currentxt1+193,currentxt1+183,currentxt1+154,currentxt1+157,currentxt1+128, currentxt1+116,currentxt1+22,currentxt1+0,currentxt1+28,currentxt1+142,currentxt1+149,currentxt1+178, currentxt1+187,currentxt1+197,currentxt1+207,currentxt1+222,currentxt1+235,currentxt1+247,currentxt1+264,currentxt1+275, currentxt1+280,currentxt1+288,currentxt1+300,currentxt1+295,currentxt1+330}; int[] yloc_Tie1 = {currentyt1+545,currentyt1+545,currentyt1+493,currentyt1+244,currentyt1+47,currentyt1+123, currentyt1+259,currentyt1+251,currentyt1+232,currentyt1+215,currentyt1+215,currentyt1+216, currentyt1+222,currentyt1+231,currentyt1+246,currentyt1+244,currentyt1+206,currentyt1+1, currentyt1+0,currentyt1+87,currentyt1+320,currentyt1+526,currentyt1+464,currentyt1+303,currentyt1+320, currentyt1+332,currentyt1+342,currentyt1+349,currentyt1+350,currentyt1+352,currentyt1+352,currentyt1+348, currentyt1+341,currentyt1+330,currentyt1+319,currentyt1+322,currentyt1+347,currentyt1+546}; panel.fillPolygon(xloc_Tie1,yloc_Tie1, xloc_Tie1.length); //Fills in the coordinates to become a solid panel.setColor(Color.black); int[] xloc_Circle1 = {currentxt1+226,currentxt1+225,currentxt1+221,currentxt1+220,currentxt1+219,currentxt1+219, currentxt1+219,currentxt1+221,currentxt1+224,currentxt1+226,currentxt1+229,currentxt1+232, currentxt1+237,currentxt1+242,currentxt1+249,currentxt1+255,currentxt1+262,currentxt1+272, currentxt1+279,currentxt1+283,currentxt1+289,currentxt1+295,currentxt1+297,currentxt1+297, currentxt1+297,currentxt1+297,currentxt1+296,currentxt1+294,currentxt1+291,currentxt1+285, currentxt1+283,currentxt1+279,currentxt1+276,currentxt1+272,currentxt1+267,currentxt1+260, currentxt1+250,currentxt1+249,currentxt1+245,currentxt1+240,currentxt1+240,currentxt1+239, currentxt1+238,currentxt1+228,currentxt1+228,currentxt1+226,currentxt1+225,currentxt1+223, currentxt1+222}; int[] yloc_Circle1 = {currentyt1+246,currentyt1+251,currentyt1+257,currentyt1+265,currentyt1+272,currentyt1+277,currentyt1+282, currentyt1+288,currentyt1+294,currentyt1+299,currentyt1+302,currentyt1+306,currentyt1+309,currentyt1+311, currentyt1+312,currentyt1+315,currentyt1+315,currentyt1+315,currentyt1+312,currentyt1+310,currentyt1+302, currentyt1+294,currentyt1+287,currentyt1+278,currentyt1+270,currentyt1+262,currentyt1+257,currentyt1+251, currentyt1+248,currentyt1+244,currentyt1+242,currentyt1+240,currentyt1+239,currentyt1+239,currentyt1+237, currentyt1+235,currentyt1+234,currentyt1+234,currentyt1+234,currentyt1+235,currentyt1+235,currentyt1+237, currentyt1+237,currentyt1+241,currentyt1+241,currentyt1+244,currentyt1+244,currentyt1+246,currentyt1+251}; panel.fillPolygon(xloc_Circle1,yloc_Circle1, xloc_Circle1.length); if(currentxt1 > 1920) //Allows the polygon to stay within the window frame { currentxt1 = 0; } if(currentyt1 > 1080) { currentyt1 = 0; } currentxt1 = currentxt1+speed;//Increases the speed using a random number, which gives it a random starting point as well currentyt1 = currentyt1+speed; panel.setColor(Color.red); int[] xloc_Tie2 = {currentxt2+331,currentxt2+331,currentxt2+462,currentxt2+479,currentxt2+445,currentxt2+315, currentxt2+304,currentxt2+292,currentxt2+276,currentxt2+243,currentxt2+233,currentxt2+227, currentxt2+206,currentxt2+193,currentxt2+183,currentxt2+154,currentxt2+157,currentxt2+128, currentxt2+116,currentxt2+22,currentxt2+0,currentxt2+28,currentxt2+142,currentxt2+149,currentxt2+178, currentxt2+187,currentxt2+197,currentxt2+207,currentxt2+222,currentxt2+235,currentxt2+247,currentxt2+264,currentxt2+275, currentxt2+280,currentxt2+288,currentxt2+300,currentxt2+295,currentxt2+330}; int[] yloc_Tie2 = {currentyt2+545,currentyt2+545,currentyt2+493,currentyt2+244,currentyt2+47,currentyt2+123, currentyt2+259,currentyt2+251,currentyt2+232,currentyt2+215,currentyt2+215,currentyt2+216, currentyt2+222,currentyt2+231,currentyt2+246,currentyt2+244,currentyt2+206,currentyt2+1, currentyt2+0,currentyt2+87,currentyt2+320,currentyt2+526,currentyt2+464,currentyt2+303,currentyt2+320, currentyt2+332,currentyt2+342,currentyt2+349,currentyt2+350,currentyt2+352,currentyt2+352,currentyt2+348, currentyt2+341,currentyt2+330,currentyt2+319,currentyt2+322,currentyt2+347,currentyt2+546}; panel.fillPolygon(xloc_Tie2,yloc_Tie2, xloc_Tie2.length); panel.setColor(Color.black); int[] xloc_Circle2 = {currentxt2+226,currentxt2+225,currentxt2+221,currentxt2+220,currentxt2+219,currentxt2+219, currentxt2+219,currentxt2+221,currentxt2+224,currentxt2+226,currentxt2+229,currentxt2+232, currentxt2+237,currentxt2+242,currentxt2+249,currentxt2+255,currentxt2+262,currentxt2+272, currentxt2+279,currentxt2+283,currentxt2+289,currentxt2+295,currentxt2+297,currentxt2+297, currentxt2+297,currentxt2+297,currentxt2+296,currentxt2+294,currentxt2+291,currentxt2+285, currentxt2+283,currentxt2+279,currentxt2+276,currentxt2+272,currentxt2+267,currentxt2+260, currentxt2+250,currentxt2+249,currentxt2+245,currentxt2+240,currentxt2+240,currentxt2+239, currentxt2+238,currentxt2+228,currentxt2+228,currentxt2+226,currentxt2+225,currentxt2+223, currentxt2+222}; int[] yloc_Circle2 = {currentyt2+246,currentyt2+251,currentyt2+257,currentyt2+265,currentyt2+272,currentyt2+277,currentyt2+282, currentyt2+288,currentyt2+294,currentyt2+299,currentyt2+302,currentyt2+306,currentyt2+309,currentyt2+311, currentyt2+312,currentyt2+315,currentyt2+315,currentyt2+315,currentyt2+312,currentyt2+310,currentyt2+302, currentyt2+294,currentyt2+287,currentyt2+278,currentyt2+270,currentyt2+262,currentyt2+257,currentyt2+251, currentyt2+248,currentyt2+244,currentyt2+242,currentyt2+240,currentyt2+239,currentyt2+239,currentyt2+237, currentyt2+235,currentyt2+234,currentyt2+234,currentyt2+234,currentyt2+235,currentyt2+235,currentyt2+237, currentyt2+237,currentyt2+241,currentyt2+241,currentyt2+244,currentyt2+244,currentyt2+246,currentyt2+251}; panel.fillPolygon(xloc_Circle2,yloc_Circle2, xloc_Circle2.length); if(currentxt2 > 1920) { currentxt2 = 0; } if(currentyt2 > 1080) { currentyt2 = 0; } currentxt2 = currentxt2+speed2; currentyt2 = currentyt2+speed2; panel.setColor(Color.gray); int[] xloc_Falcon = {currentx+364,currentx+364,currentx+230,currentx+226,currentx+214,currentx+210, currentx+174,currentx+171,currentx+168,currentx+165,currentx+154,currentx+151, currentx+138,currentx+136,currentx+126,currentx+119,currentx+93,currentx+89, currentx+66,currentx+34,currentx+36,currentx+31,currentx+40,currentx+84,currentx+118, currentx+146,currentx+168,currentx+215,currentx+237,currentx+243,currentx+275, currentx+304,currentx+331,currentx+469,currentx+449,currentx+353,currentx+341, currentx+363,currentx+338,currentx+376,currentx+392,currentx+389,currentx+383, currentx+367,currentx+359}; int[] yloc_Falcon = {currenty+311,currenty+311,currenty+271,currenty+280,currenty+279,currenty+264, currenty+259,currenty+263,currenty+266,currenty+270,currenty+271,currenty+269, currenty+264,currenty+264,currenty+265,currenty+258,currenty+236,currenty+229, currenty+221,currenty+170,currenty+135,currenty+130,currenty+115,currenty+94, currenty+87,currenty+82,currenty+80,currenty+74,currenty+79,currenty+86,currenty+85, currenty+85,currenty+103,currenty+251,currenty+267,currenty+216,currenty+219,currenty+233, currenty+248,currenty+273,currenty+290,currenty+299,currenty+304,currenty+312,currenty+310}; panel.fillPolygon(xloc_Falcon,yloc_Falcon,xloc_Falcon.length); panel.setColor(Color.white); int[] xloc_Bridge = {currentx+158,currentx+158,currentx+155,currentx+147,currentx+142,currentx+136, currentx+131,currentx+127,currentx+122,currentx+120,currentx+110,currentx+93, currentx+91,currentx+91,currentx+94,currentx+95,currentx+98,currentx+100, currentx+103,currentx+106,currentx+107,currentx+172,currentx+190,currentx+196, currentx+152,currentx+158,currentx+160,currentx+161,currentx+163,currentx+165, currentx+168,currentx+171,currentx+174,currentx+174,currentx+174,currentx+173, currentx+173,currentx+170,currentx+170,currentx+163,currentx+163,currentx+161, currentx+159,currentx+156}; int[] yloc_Bridge = {currenty+271,currenty+271,currenty+269,currenty+268,currenty+267,currenty+265, currenty+264,currenty+264,currenty+262,currenty+258,currenty+252,currenty+236, currenty+231,currenty+226,currenty+219,currenty+212,currenty+208,currenty+208, currenty+205,currenty+202,currenty+200,currenty+146,currenty+149,currenty+160, currenty+216,currenty+223,currenty+228,currenty+236,currenty+240,currenty+242, currenty+244,currenty+246,currenty+252,currenty+253,currenty+258,currenty+264, currenty+264,currenty+268,currenty+268,currenty+270,currenty+270,currenty+270, currenty+270,currenty+269}; panel.fillPolygon(xloc_Bridge,yloc_Bridge, xloc_Bridge.length); panel.setColor(Color.white); int[] xloc_LandingGear1 = {currentx+77,currentx+76,currentx+76,currentx+76,currentx+93,currentx+91}; int[] yloc_LandingGear1 = {currenty+224,currenty+225,currenty+244,currenty+260,currenty+261,currenty+231}; landingG = new Polygon(xloc_LandingGear1, yloc_LandingGear1, xloc_LandingGear1.length); if(landing) { panel.setColor(Color.white); panel.fillPolygon(landingG); } if(!landing) { panel.setColor(Color.black); panel.fillPolygon(landingG); } repaint(); } private class PolygonPanel implements MouseListener, MouseMotionListener{//Holds all listeners, even if they are not being used //A boolean statament which makes the landing gear appear and re-apprear public void mousePressed(MouseEvent event){} public void mouseDragged(MouseEvent event){} public void mouseReleased(MouseEvent event){} public void mouseEntered(MouseEvent event){} public void mouseExited(MouseEvent event){} public void mouseClicked(MouseEvent event) { if (event.getButton() == MouseEvent.BUTTON1) { if(!landing) { landing = true; } if(landing) { landing = false; } repaint(); } } public void mouseMoved(MouseEvent event){ //Makes the Falcon follow the mouse currentx = event.getPoint().x - 500; currenty = event.getPoint().y - 400; repaint(); } } }
13,711
0.656714
0.509904
203
65.596062
44.857677
139
false
false
0
0
0
0
0
0
3.004926
false
false
0
2c80e768e57f337f88ad056279f118f1d228c51b
31,533,649,888,019
898c8b5033ead331e7dc61922ae50251541dcdf4
/png-java/src/com/dezzmeister/png/filters/functions/NoneFilter.java
6c3024f3eac1fe84325ef9a314f336bde3d32594
[]
no_license
Dezzmeister/png-java
https://github.com/Dezzmeister/png-java
c82ffcb3b6ea1160035821332745d9cc9a8fbb75
50b87afa37ea7b5633ff48263a4d59440eb4dfd0
refs/heads/master
2022-12-09T20:54:00.426000
2020-09-13T03:08:04
2020-09-13T03:08:04
287,437,587
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.dezzmeister.png.filters.functions; import com.dezzmeister.png.filters.FilterFunction; /** * This filter function doesn't modify the data in any way; it's only included because * every {@link com.dezzmeister.png.filters.Filter Filter} instance needs to have a filter function. * * @author Joe Desmond */ public class NoneFilter implements FilterFunction { @Override public byte[] applyFilter(final byte[] prevLine, final byte[] thisLine, final int bytesPerPixel) { return thisLine; } @Override public byte[] removeFilter(final byte[] prevLine, final byte[] thisLine, final int bytesPerPixel) { return thisLine; } }
UTF-8
Java
678
java
NoneFilter.java
Java
[ { "context": " needs to have a filter function.\r\n * \r\n * @author Joe Desmond\r\n */\r\npublic class NoneFilter implements FilterFu", "end": 326, "score": 0.9998337030410767, "start": 315, "tag": "NAME", "value": "Joe Desmond" } ]
null
[]
package com.dezzmeister.png.filters.functions; import com.dezzmeister.png.filters.FilterFunction; /** * This filter function doesn't modify the data in any way; it's only included because * every {@link com.dezzmeister.png.filters.Filter Filter} instance needs to have a filter function. * * @author <NAME> */ public class NoneFilter implements FilterFunction { @Override public byte[] applyFilter(final byte[] prevLine, final byte[] thisLine, final int bytesPerPixel) { return thisLine; } @Override public byte[] removeFilter(final byte[] prevLine, final byte[] thisLine, final int bytesPerPixel) { return thisLine; } }
673
0.719764
0.719764
25
25.120001
34.649467
100
false
false
0
0
0
0
0
0
0.92
false
false
0
78854161d856879d20865b8a63311453d232a7fa
14,809,047,267,544
e12c4eb0dca47fdc429958905c3762d307dee809
/src/test/java/tests/api/AbstractApiTest.java
cb6b16fef3341efc66404467583b7eb0ea8d6910
[]
no_license
taras-git/WebAppTester
https://github.com/taras-git/WebAppTester
e71e154224d93544283c98d7795bbc1d1aadc9ff
ddaa646eb3c2a8fc674a5aa6711f408672aa77d9
refs/heads/master
2020-04-26T10:49:27.511000
2019-03-02T20:47:48
2019-03-02T20:47:48
173,497,375
0
0
null
false
2019-03-03T11:45:09
2019-03-02T20:48:45
2019-03-02T20:55:48
2019-03-03T11:44:30
31,241
0
0
1
Java
false
null
package tests.api; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import io.restassured.http.ContentType; import io.restassured.http.Header; import io.restassured.http.Headers; import io.restassured.response.Response; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.HashMap; import java.util.Map; import java.util.Set; import static io.restassured.RestAssured.given; public abstract class AbstractApiTest { private static final Logger LOG = LoggerFactory.getLogger(AbstractApiTest.class); protected final RestApiTestHelper testHelper = new RestApiTestHelper(); protected void removeEndpointFromJsonObject(JsonObject jsonObject) { jsonObject.remove("endpoint"); } protected String getStormSession(Response response) { return response.path("stormSession"); } protected String getUserId(Response response) { return response.path("userId"); } protected String getEmail(Response response) { return response.path("email"); } protected String getBookingId(Response response) { return response.path("bookingId"); } protected String getId(Response response) { return response.path("id"); } protected Map<String, Object> getPostBodyAsMap(JsonObject jsonObject) { // create a POST body Map<String, Object> jsonBody = new HashMap<>(); Set<Map.Entry<String, JsonElement>> entrySet = jsonObject.entrySet(); for(Map.Entry<String,JsonElement> entry : entrySet){ jsonBody.put(entry.getKey(), jsonObject.get(entry.getKey())); LOG.info("API CALL POST BODY: " +entry.getKey()+ " : " + jsonObject.get(entry.getKey())); } return jsonBody; } protected Response getResponse(String endpoint) { return given() .when() .get(endpoint) .then() .contentType(ContentType.JSON) .extract() .response(); } protected Response getResponse(String endpoint, JsonObject jsonBody) { return given() .contentType(ContentType.JSON) .body(jsonBody) .when() .post(endpoint) .then() .extract() .response(); } protected Response getResponse(String endpoint, JsonObject jsonBody, Header header) { return given() .contentType(ContentType.JSON) .body(jsonBody) .header(header) .when() .post(endpoint) .then() .extract() .response(); } protected Response getJsonSuccessResponse(String endpoint) { return given() .when() .get(endpoint) .then() .statusCode(200) .and() .contentType(ContentType.JSON) .extract() .response(); } protected Response getJsonSuccessResponse(String endpoint, Map<String, Object> jsonBody) { return given() .contentType(ContentType.JSON) .body(jsonBody) .when() .post(endpoint) .then() .statusCode(200) .extract() .response(); } protected Response getJsonSuccessResponse(String endpoint, JsonObject jsonBody) { return given() .contentType(ContentType.JSON) .body(jsonBody) .when() .post(endpoint) .then() .statusCode(200) .extract() .response(); } protected Response getJsonSuccessResponse(String endpoint, Headers headers) { return given() .when() .headers(headers) .get(endpoint) .then() .statusCode(200) .and() .contentType(ContentType.JSON) .extract() .response(); } protected Response getJsonSuccessResponse(String endpoint, Header header) { return given() .when() .header(header) .get(endpoint) .then() .statusCode(200) .and() .contentType(ContentType.JSON) .extract() .response(); } protected Response getJsonSuccessResponse(String endpoint, JsonObject jsonBody, Header header) { return given() .when() .body(jsonBody) .header(header) .get(endpoint) .then() .statusCode(200) .and() .contentType(ContentType.JSON) .extract() .response(); } }
UTF-8
Java
4,993
java
AbstractApiTest.java
Java
[]
null
[]
package tests.api; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import io.restassured.http.ContentType; import io.restassured.http.Header; import io.restassured.http.Headers; import io.restassured.response.Response; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.HashMap; import java.util.Map; import java.util.Set; import static io.restassured.RestAssured.given; public abstract class AbstractApiTest { private static final Logger LOG = LoggerFactory.getLogger(AbstractApiTest.class); protected final RestApiTestHelper testHelper = new RestApiTestHelper(); protected void removeEndpointFromJsonObject(JsonObject jsonObject) { jsonObject.remove("endpoint"); } protected String getStormSession(Response response) { return response.path("stormSession"); } protected String getUserId(Response response) { return response.path("userId"); } protected String getEmail(Response response) { return response.path("email"); } protected String getBookingId(Response response) { return response.path("bookingId"); } protected String getId(Response response) { return response.path("id"); } protected Map<String, Object> getPostBodyAsMap(JsonObject jsonObject) { // create a POST body Map<String, Object> jsonBody = new HashMap<>(); Set<Map.Entry<String, JsonElement>> entrySet = jsonObject.entrySet(); for(Map.Entry<String,JsonElement> entry : entrySet){ jsonBody.put(entry.getKey(), jsonObject.get(entry.getKey())); LOG.info("API CALL POST BODY: " +entry.getKey()+ " : " + jsonObject.get(entry.getKey())); } return jsonBody; } protected Response getResponse(String endpoint) { return given() .when() .get(endpoint) .then() .contentType(ContentType.JSON) .extract() .response(); } protected Response getResponse(String endpoint, JsonObject jsonBody) { return given() .contentType(ContentType.JSON) .body(jsonBody) .when() .post(endpoint) .then() .extract() .response(); } protected Response getResponse(String endpoint, JsonObject jsonBody, Header header) { return given() .contentType(ContentType.JSON) .body(jsonBody) .header(header) .when() .post(endpoint) .then() .extract() .response(); } protected Response getJsonSuccessResponse(String endpoint) { return given() .when() .get(endpoint) .then() .statusCode(200) .and() .contentType(ContentType.JSON) .extract() .response(); } protected Response getJsonSuccessResponse(String endpoint, Map<String, Object> jsonBody) { return given() .contentType(ContentType.JSON) .body(jsonBody) .when() .post(endpoint) .then() .statusCode(200) .extract() .response(); } protected Response getJsonSuccessResponse(String endpoint, JsonObject jsonBody) { return given() .contentType(ContentType.JSON) .body(jsonBody) .when() .post(endpoint) .then() .statusCode(200) .extract() .response(); } protected Response getJsonSuccessResponse(String endpoint, Headers headers) { return given() .when() .headers(headers) .get(endpoint) .then() .statusCode(200) .and() .contentType(ContentType.JSON) .extract() .response(); } protected Response getJsonSuccessResponse(String endpoint, Header header) { return given() .when() .header(header) .get(endpoint) .then() .statusCode(200) .and() .contentType(ContentType.JSON) .extract() .response(); } protected Response getJsonSuccessResponse(String endpoint, JsonObject jsonBody, Header header) { return given() .when() .body(jsonBody) .header(header) .get(endpoint) .then() .statusCode(200) .and() .contentType(ContentType.JSON) .extract() .response(); } }
4,993
0.53555
0.531544
172
28.02907
22.46714
101
false
false
0
0
0
0
0
0
0.290698
false
false
0
441a16d6c2f015c9f751fcc9c56533ee01869842
35,055,523,073,322
4d593b6dd55576e7d2301dfc91980442c872f882
/src/main/java/me/qyh/helper/html/AttributeValueValidator.java
ac3d5b887c04dd536907ceb73c880e23133012cf
[]
no_license
lixinwei1230/blog
https://github.com/lixinwei1230/blog
8ef2df69920cb10fcb1a7cc6b1436837327fd1bb
82e0cea0a180a09e95bb69ba7706bb13a0a7e2b0
refs/heads/master
2021-01-20T10:28:50.008000
2016-03-26T11:36:11
2016-03-26T11:36:11
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package me.qyh.helper.html; /** * 判断某个属性是否允许 * * @author mhlx * */ public interface AttributeValueValidator { /** * 是否允许 * * @param value * 属性值 * @return */ boolean allow(String value); }
UTF-8
Java
257
java
AttributeValueValidator.java
Java
[ { "context": "qyh.helper.html;\n\n/**\n * 判断某个属性是否允许\n * \n * @author mhlx\n *\n */\npublic interface AttributeValueValidator {", "end": 66, "score": 0.9996036887168884, "start": 62, "tag": "USERNAME", "value": "mhlx" } ]
null
[]
package me.qyh.helper.html; /** * 判断某个属性是否允许 * * @author mhlx * */ public interface AttributeValueValidator { /** * 是否允许 * * @param value * 属性值 * @return */ boolean allow(String value); }
257
0.565022
0.565022
20
10.15
11.208367
42
false
false
0
0
0
0
0
0
0.5
false
false
0
13b99588c7dea5cd6a86fc7387d8af402dd164c8
2,233,383,037,341
c807cd90511573e65807e4f3b7d83d0c9e1db45f
/src/tron/Draw.java
08acfcb4baa35a0dbe3a626998b187663f5f9df0
[]
no_license
RobertsBoys/Tron
https://github.com/RobertsBoys/Tron
5ef18a14949011919c65ab124f8117a0fe45e936
030b739674224f92aee1704ccc9a5fbd05a1b781
refs/heads/master
2021-01-10T19:26:52.498000
2014-10-14T21:34:03
2014-10-14T21:34:03
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package tron; import java.awt.*; import java.util.ArrayList; /** * * @author Isaac */ public class Draw { enum Type { Line, Oval, SolidOval, Rect, SolidRect, String //Solid just means the shape is filled in, instead of traced } Type type; int x;//Pixel Location int y; String text="";//Only if type is String int param3; int param4; /* Param3 & param4 are used differently by type: Line : p3=x2, p4 = y2 Oval,SolidOval, Rect, SolidRect : p3=width, p4=height String : p3=font, p4 isnt used. (Font is always Arial) */ Color color; int duration;//allows you to have a shape linger on screen for X updates public Draw(Type t, int setx, int sety, int p3, int p4, Color c, int dur) { //Standard shape constructor. type = t; color = c; duration = dur; x = setx; y = sety; param3 = p3; param4 = p4; } public Draw(Type t, int setx, int sety, int p3, int p4, Color c) { //Duration defaults to one type = t; color = c; x = setx; y = sety; param3 = p3; param4 = p4; duration = 1; } public Draw(String txt, int setx, int sety, int p3, Color c, int dur) { //String constructor type = Type.String; text = txt; x = setx; y = sety; color = c; param3 = p3; //will be size duration = dur; } public Draw(Square from, Square to, Color c, int dur) { //Draws a line from one square to the other type= Type.Line; color=c; duration=dur; x=from.px()+Square.SQUARE_SIZE/2; y=from.py()+Square.SQUARE_SIZE/2; param3=to.px()+Square.SQUARE_SIZE/2; param4=to.py()+Square.SQUARE_SIZE/2; } public Draw(Square fill,Color c,int dur) { //Draws a solid box over the square type=Type.SolidRect; color=c; duration=dur; x=fill.px()+1; y=fill.py()+1; param3=param4=Square.SQUARE_SIZE-2; } /* -------------------------------------------------------- -----------Static--------------------------------------- -------------------------------------------------------- */ public static void draw(Draw add) { /* Get your Draw objects drawn here ex: Draw.draw(new Draw(Draw.Type.Line,50,70,90,100,Color.Green,3) will render a green line from (50,70) to (90,100) for 3 game steps yes its a lot of typing and i dont care */ if (add==null) { System.out.println("Adding null to drawList"); } else drawList.add(add); } private static ArrayList<Draw> drawList;//Not for you public static void onStart() {//Not for you drawList=new ArrayList<Draw>(); } public static void drawList(Graphics2D g,boolean update) //Not for you { for (int n=0;n<drawList.size();n++) { if (drawList.get(n)==null) { System.out.println("drawList element is null"); drawList.remove(n); } else { g.setColor(drawList.get(n).color); switch (drawList.get(n).type) { case Line: g.drawLine(drawList.get(n).x,drawList.get(n).y,drawList.get(n).param3,drawList.get(n).param4); break; case Oval: g.drawOval(drawList.get(n).x,drawList.get(n).y,drawList.get(n).param3,drawList.get(n).param4); break; case SolidOval: g.fillOval(drawList.get(n).x,drawList.get(n).y,drawList.get(n).param3,drawList.get(n).param4); break; case Rect: g.drawRect(drawList.get(n).x,drawList.get(n).y,drawList.get(n).param3,drawList.get(n).param4); break; case SolidRect: g.fillRect(drawList.get(n).x,drawList.get(n).y,drawList.get(n).param3,drawList.get(n).param4); break; case String: g.setFont(new Font("Arial",Font.PLAIN,drawList.get(n).param3)); g.drawString(drawList.get(n).text,drawList.get(n).x,drawList.get(n).y); break; } if (update) { drawList.get(n).duration--; if (drawList.get(n).duration<=0) { drawList.remove(n); n--; } } } } } public static void reset() {//Not for you drawList.clear(); } }
UTF-8
Java
4,877
java
Draw.java
Java
[ { "context": ".*;\nimport java.util.ArrayList;\n\n/**\n *\n * @author Isaac\n */\npublic class Draw {\n\n \n\n enum Type {\n\n ", "end": 87, "score": 0.9997029900550842, "start": 82, "tag": "NAME", "value": "Isaac" } ]
null
[]
package tron; import java.awt.*; import java.util.ArrayList; /** * * @author Isaac */ public class Draw { enum Type { Line, Oval, SolidOval, Rect, SolidRect, String //Solid just means the shape is filled in, instead of traced } Type type; int x;//Pixel Location int y; String text="";//Only if type is String int param3; int param4; /* Param3 & param4 are used differently by type: Line : p3=x2, p4 = y2 Oval,SolidOval, Rect, SolidRect : p3=width, p4=height String : p3=font, p4 isnt used. (Font is always Arial) */ Color color; int duration;//allows you to have a shape linger on screen for X updates public Draw(Type t, int setx, int sety, int p3, int p4, Color c, int dur) { //Standard shape constructor. type = t; color = c; duration = dur; x = setx; y = sety; param3 = p3; param4 = p4; } public Draw(Type t, int setx, int sety, int p3, int p4, Color c) { //Duration defaults to one type = t; color = c; x = setx; y = sety; param3 = p3; param4 = p4; duration = 1; } public Draw(String txt, int setx, int sety, int p3, Color c, int dur) { //String constructor type = Type.String; text = txt; x = setx; y = sety; color = c; param3 = p3; //will be size duration = dur; } public Draw(Square from, Square to, Color c, int dur) { //Draws a line from one square to the other type= Type.Line; color=c; duration=dur; x=from.px()+Square.SQUARE_SIZE/2; y=from.py()+Square.SQUARE_SIZE/2; param3=to.px()+Square.SQUARE_SIZE/2; param4=to.py()+Square.SQUARE_SIZE/2; } public Draw(Square fill,Color c,int dur) { //Draws a solid box over the square type=Type.SolidRect; color=c; duration=dur; x=fill.px()+1; y=fill.py()+1; param3=param4=Square.SQUARE_SIZE-2; } /* -------------------------------------------------------- -----------Static--------------------------------------- -------------------------------------------------------- */ public static void draw(Draw add) { /* Get your Draw objects drawn here ex: Draw.draw(new Draw(Draw.Type.Line,50,70,90,100,Color.Green,3) will render a green line from (50,70) to (90,100) for 3 game steps yes its a lot of typing and i dont care */ if (add==null) { System.out.println("Adding null to drawList"); } else drawList.add(add); } private static ArrayList<Draw> drawList;//Not for you public static void onStart() {//Not for you drawList=new ArrayList<Draw>(); } public static void drawList(Graphics2D g,boolean update) //Not for you { for (int n=0;n<drawList.size();n++) { if (drawList.get(n)==null) { System.out.println("drawList element is null"); drawList.remove(n); } else { g.setColor(drawList.get(n).color); switch (drawList.get(n).type) { case Line: g.drawLine(drawList.get(n).x,drawList.get(n).y,drawList.get(n).param3,drawList.get(n).param4); break; case Oval: g.drawOval(drawList.get(n).x,drawList.get(n).y,drawList.get(n).param3,drawList.get(n).param4); break; case SolidOval: g.fillOval(drawList.get(n).x,drawList.get(n).y,drawList.get(n).param3,drawList.get(n).param4); break; case Rect: g.drawRect(drawList.get(n).x,drawList.get(n).y,drawList.get(n).param3,drawList.get(n).param4); break; case SolidRect: g.fillRect(drawList.get(n).x,drawList.get(n).y,drawList.get(n).param3,drawList.get(n).param4); break; case String: g.setFont(new Font("Arial",Font.PLAIN,drawList.get(n).param3)); g.drawString(drawList.get(n).text,drawList.get(n).x,drawList.get(n).y); break; } if (update) { drawList.get(n).duration--; if (drawList.get(n).duration<=0) { drawList.remove(n); n--; } } } } } public static void reset() {//Not for you drawList.clear(); } }
4,877
0.481649
0.46668
167
28.197605
24.743532
114
false
false
0
0
0
0
0
0
0.790419
false
false
0
c4280dcfac86d271bec31247939b91c971debca2
9,869,834,865,987
42fba5d40ee7e9d78bfae6b53f76fc0872d02791
/BadStoreTest/src/util/BadStoreTestUtil.java
a193b37cbee90e4808c37c87ca622564699b4b8d
[]
no_license
swapniljoshi15/BadStoreTestAutomation
https://github.com/swapniljoshi15/BadStoreTestAutomation
12ce6af920ea44f97612ae6d78bfa72bbba7064b
7969af90e0f594c2073be9beafbeadd058e14b8f
refs/heads/master
2021-01-06T20:38:15.117000
2015-05-14T15:48:53
2015-05-14T15:48:53
33,456,406
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package util; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import badstore.TestClass1; public class BadStoreTestUtil { public static int threadTimeForSleeping = 1000; public static void highlightElementById(WebDriver driver, String elementID, String borderColor, String textColor) { WebElement element = driver.findElement(By.id(elementID)); BadStoreTestUtil.highlightHtmlElement(driver, element, borderColor, textColor); } public static void highlightElementByName(WebDriver driver, String elementName, String borderColor, String textColor) { WebElement element = driver.findElement(By.name(elementName)); BadStoreTestUtil.highlightHtmlElement(driver, element, borderColor, textColor); } public static void highlightElementByLinkText(WebDriver driver, String linkText, String borderColor, String textColor) { WebElement element = driver.findElement(By.linkText(linkText)); BadStoreTestUtil.highlightHtmlElement(driver, element, borderColor, textColor); } public static void highlightElementByXPath(WebDriver driver, String xPath, String borderColor, String textColor) { WebElement element = driver.findElement(By.xpath(xPath)); BadStoreTestUtil.highlightHtmlElement(driver, element, borderColor, textColor); } private static void highlightHtmlElement(WebDriver driver, WebElement element, String borderColor, String textColor){ JavascriptExecutor jsExecutor = (JavascriptExecutor) driver; jsExecutor.executeScript("arguments[0].setAttribute('style', arguments[1]);", element, "color:"+ textColor +"; border: 5px solid "+borderColor+";"); //driver.findElement(By.id(elementID)).clear(); //driver.findElement(By.id(elementID)).sendKeys(""); } public static String getElementValue(WebDriver driver,String elementID){ return driver.findElement(By.id(elementID)).getText(); } /*public static void injectHtmlElement(WebDriver driver, String elementInfo, String message){ WebElement element = driver.findElement(By.tagName(elementInfo)); JavascriptExecutor jsExecutor = (JavascriptExecutor) driver; String pageSource = driver.getPageSource(); pageSource = pageSource.substring(pageSource.indexOf("<body")+1); pageSource = pageSource.substring(pageSource.indexOf(">")+1,pageSource.indexOf("</body>")); String newElement = "<div id=\"commentText\" style=\"background-color:black; color:white; padding:5px; width:750px;\"><h2>"+message+"</h2></div>"; String modifiedHtml = pageSource+newElement; modifiedHtml = modifiedHtml.replaceAll("\\s\\s*", " "); System.out.println(modifiedHtml); System.out.println("==========================================="); modifiedHtml = modifiedHtml.replaceAll("&", "&amp;"); System.out.println(modifiedHtml); System.out.println("==========================================="); modifiedHtml = modifiedHtml.replaceAll("'", "\""); //modifiedHtml = modifiedHtml.replaceAll("'", "&#39;"); System.out.println(modifiedHtml); System.out.println("==========================================="); jsExecutor.executeScript("arguments[0].innerHTML='" + modifiedHtml + "'", element); }*/ public static void injectHtmlElement(WebDriver driver, String elementInfo, String message){ WebElement element = driver.findElement(By.tagName(elementInfo)); JavascriptExecutor jsExecutor = (JavascriptExecutor) driver; String pageSource = driver.getPageSource(); pageSource = pageSource.substring(pageSource.indexOf("<body")+1); pageSource = pageSource.substring(pageSource.indexOf(">")+1,pageSource.lastIndexOf("</body>")); String newElement = "<div id=\"commentText\" style=\"background-color:black; font-family: ‘Lucida Console’, Monaco, monospace; color:white; padding:5px; width:" + ((TestClass1.width/2)-10) + ";\"><h3>"+message+"</h3></div>"; String modifiedHtml = pageSource+newElement; modifiedHtml = modifiedHtml.replaceAll("\\s\\s*", " "); modifiedHtml = modifiedHtml.replaceAll("&", "&amp;"); modifiedHtml = modifiedHtml.replaceAll("'", "\""); //modifiedHtml = modifiedHtml.replaceAll("'", "&#39;"); jsExecutor.executeScript("arguments[0].innerHTML='" + modifiedHtml + "'", element); } public static void injectHtmlElementAttackBlock(WebDriver driver, String elementInfo, String message){ WebElement element = driver.findElement(By.tagName(elementInfo)); JavascriptExecutor jsExecutor = (JavascriptExecutor) driver; String pageSource = driver.getPageSource(); //pageSource = pageSource.substring(pageSource.indexOf("<div")+1); //pageSource = pageSource.substring(pageSource.indexOf(">")+1,pageSource.lastIndexOf("</div>")); String newElement = "<div id=\"commentText\" style=\"background-color:black; font-family: ‘Lucida Console’, Monaco, monospace; color:white; padding:5px; width:" + ((TestClass1.width/2)-10) + ";\"><h3>"+message+"</h3></div>"; String modifiedHtml = "<body>" + pageSource + newElement + "</body>"; modifiedHtml = modifiedHtml.replaceAll("\\s\\s*", " "); modifiedHtml = modifiedHtml.replaceAll("&", "&amp;"); modifiedHtml = modifiedHtml.replaceAll("'", "\""); //modifiedHtml = modifiedHtml.replaceAll("'", "&#39;"); jsExecutor.executeScript("arguments[0].innerHTML='" + modifiedHtml + "'", element); } public static void zoomOutIn(WebDriver driver, String zoomOption, int zoomLevel){ WebElement html = driver.findElement(By.tagName("html")); if("zoomout".equalsIgnoreCase(zoomOption)){ for(int i=0; i<zoomLevel; i++){ html.sendKeys(Keys.chord(Keys.CONTROL, Keys.ADD)); } }else{ if("zoomin".equalsIgnoreCase(zoomOption)){ html.sendKeys(Keys.chord(Keys.CONTROL, Keys.SUBTRACT)); } } } public static void disableMouseRightClick() throws Exception{ try { //String[] cmd = {"/home/swap/java_program/d.sh"}; String[] cmd = {"/badstore/disable_right_click.sh"}; Process pb = Runtime.getRuntime().exec(cmd); String line; BufferedReader input = new BufferedReader(new InputStreamReader(pb.getInputStream())); while ((line = input.readLine()) != null) { System.out.println(line); } input.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static void disableInputDevice(String id) throws Exception{ try { //String[] cmd = {"/home/swap/java_program/s.sh",id}; String[] cmd = {"/badstore/disable_input_device.sh",id}; Process pb = Runtime.getRuntime().exec(cmd); String line; BufferedReader input = new BufferedReader(new InputStreamReader(pb.getInputStream())); while ((line = input.readLine()) != null) { System.out.println(line); } input.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static void enableInputDevice(String id) throws Exception{ try { //String[] cmd = {"/home/swap/java_program/d.sh"}; String[] cmd = {"/badstore/enable_input_device.sh",id}; Process pb = Runtime.getRuntime().exec(cmd); String line; BufferedReader input = new BufferedReader(new InputStreamReader(pb.getInputStream())); while ((line = input.readLine()) != null) { System.out.println(line); } input.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static void enableInputDevices() throws Exception{ String output = executeCommand("xinput list"); int[] device_ids = extractInputDeviceIds(output); for(int id : device_ids){ enableInputDevice(Integer.toString(id)); } } public static void disableInputDevices() throws Exception{ String output = executeCommand("xinput list"); int[] device_ids = extractInputDeviceIds(output); for(int id : device_ids){ disableInputDevice(Integer.toString(id)); } } private static String executeCommand(String command){ StringBuffer output = new StringBuffer(); Process process; try{ process = Runtime.getRuntime().exec(command); process.waitFor(); BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); String line = ""; while ((line = reader.readLine())!= null) { output.append(line + "\n"); } }catch(Exception e){ e.printStackTrace(); } return output.toString(); } private static int[] extractInputDeviceIds(String output) throws Exception{ String[] lines = output.split("\n"); int[] ids = new int[lines.length-1]; Pattern pattern = Pattern.compile("(.*)id=(\\d+)(.*)"); for(int i=0; i<lines.length-1; i++){ if(lines[i] != null && !lines[i].isEmpty()){ Matcher matcher = pattern.matcher(lines[i]); if(matcher.find() && matcher.group(2) != null && !matcher.group(2).isEmpty()){ ids[i] = Integer.parseInt(matcher.group(2)); } } } return ids; } }
WINDOWS-1250
Java
9,037
java
BadStoreTestUtil.java
Java
[]
null
[]
package util; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import badstore.TestClass1; public class BadStoreTestUtil { public static int threadTimeForSleeping = 1000; public static void highlightElementById(WebDriver driver, String elementID, String borderColor, String textColor) { WebElement element = driver.findElement(By.id(elementID)); BadStoreTestUtil.highlightHtmlElement(driver, element, borderColor, textColor); } public static void highlightElementByName(WebDriver driver, String elementName, String borderColor, String textColor) { WebElement element = driver.findElement(By.name(elementName)); BadStoreTestUtil.highlightHtmlElement(driver, element, borderColor, textColor); } public static void highlightElementByLinkText(WebDriver driver, String linkText, String borderColor, String textColor) { WebElement element = driver.findElement(By.linkText(linkText)); BadStoreTestUtil.highlightHtmlElement(driver, element, borderColor, textColor); } public static void highlightElementByXPath(WebDriver driver, String xPath, String borderColor, String textColor) { WebElement element = driver.findElement(By.xpath(xPath)); BadStoreTestUtil.highlightHtmlElement(driver, element, borderColor, textColor); } private static void highlightHtmlElement(WebDriver driver, WebElement element, String borderColor, String textColor){ JavascriptExecutor jsExecutor = (JavascriptExecutor) driver; jsExecutor.executeScript("arguments[0].setAttribute('style', arguments[1]);", element, "color:"+ textColor +"; border: 5px solid "+borderColor+";"); //driver.findElement(By.id(elementID)).clear(); //driver.findElement(By.id(elementID)).sendKeys(""); } public static String getElementValue(WebDriver driver,String elementID){ return driver.findElement(By.id(elementID)).getText(); } /*public static void injectHtmlElement(WebDriver driver, String elementInfo, String message){ WebElement element = driver.findElement(By.tagName(elementInfo)); JavascriptExecutor jsExecutor = (JavascriptExecutor) driver; String pageSource = driver.getPageSource(); pageSource = pageSource.substring(pageSource.indexOf("<body")+1); pageSource = pageSource.substring(pageSource.indexOf(">")+1,pageSource.indexOf("</body>")); String newElement = "<div id=\"commentText\" style=\"background-color:black; color:white; padding:5px; width:750px;\"><h2>"+message+"</h2></div>"; String modifiedHtml = pageSource+newElement; modifiedHtml = modifiedHtml.replaceAll("\\s\\s*", " "); System.out.println(modifiedHtml); System.out.println("==========================================="); modifiedHtml = modifiedHtml.replaceAll("&", "&amp;"); System.out.println(modifiedHtml); System.out.println("==========================================="); modifiedHtml = modifiedHtml.replaceAll("'", "\""); //modifiedHtml = modifiedHtml.replaceAll("'", "&#39;"); System.out.println(modifiedHtml); System.out.println("==========================================="); jsExecutor.executeScript("arguments[0].innerHTML='" + modifiedHtml + "'", element); }*/ public static void injectHtmlElement(WebDriver driver, String elementInfo, String message){ WebElement element = driver.findElement(By.tagName(elementInfo)); JavascriptExecutor jsExecutor = (JavascriptExecutor) driver; String pageSource = driver.getPageSource(); pageSource = pageSource.substring(pageSource.indexOf("<body")+1); pageSource = pageSource.substring(pageSource.indexOf(">")+1,pageSource.lastIndexOf("</body>")); String newElement = "<div id=\"commentText\" style=\"background-color:black; font-family: ‘Lucida Console’, Monaco, monospace; color:white; padding:5px; width:" + ((TestClass1.width/2)-10) + ";\"><h3>"+message+"</h3></div>"; String modifiedHtml = pageSource+newElement; modifiedHtml = modifiedHtml.replaceAll("\\s\\s*", " "); modifiedHtml = modifiedHtml.replaceAll("&", "&amp;"); modifiedHtml = modifiedHtml.replaceAll("'", "\""); //modifiedHtml = modifiedHtml.replaceAll("'", "&#39;"); jsExecutor.executeScript("arguments[0].innerHTML='" + modifiedHtml + "'", element); } public static void injectHtmlElementAttackBlock(WebDriver driver, String elementInfo, String message){ WebElement element = driver.findElement(By.tagName(elementInfo)); JavascriptExecutor jsExecutor = (JavascriptExecutor) driver; String pageSource = driver.getPageSource(); //pageSource = pageSource.substring(pageSource.indexOf("<div")+1); //pageSource = pageSource.substring(pageSource.indexOf(">")+1,pageSource.lastIndexOf("</div>")); String newElement = "<div id=\"commentText\" style=\"background-color:black; font-family: ‘Lucida Console’, Monaco, monospace; color:white; padding:5px; width:" + ((TestClass1.width/2)-10) + ";\"><h3>"+message+"</h3></div>"; String modifiedHtml = "<body>" + pageSource + newElement + "</body>"; modifiedHtml = modifiedHtml.replaceAll("\\s\\s*", " "); modifiedHtml = modifiedHtml.replaceAll("&", "&amp;"); modifiedHtml = modifiedHtml.replaceAll("'", "\""); //modifiedHtml = modifiedHtml.replaceAll("'", "&#39;"); jsExecutor.executeScript("arguments[0].innerHTML='" + modifiedHtml + "'", element); } public static void zoomOutIn(WebDriver driver, String zoomOption, int zoomLevel){ WebElement html = driver.findElement(By.tagName("html")); if("zoomout".equalsIgnoreCase(zoomOption)){ for(int i=0; i<zoomLevel; i++){ html.sendKeys(Keys.chord(Keys.CONTROL, Keys.ADD)); } }else{ if("zoomin".equalsIgnoreCase(zoomOption)){ html.sendKeys(Keys.chord(Keys.CONTROL, Keys.SUBTRACT)); } } } public static void disableMouseRightClick() throws Exception{ try { //String[] cmd = {"/home/swap/java_program/d.sh"}; String[] cmd = {"/badstore/disable_right_click.sh"}; Process pb = Runtime.getRuntime().exec(cmd); String line; BufferedReader input = new BufferedReader(new InputStreamReader(pb.getInputStream())); while ((line = input.readLine()) != null) { System.out.println(line); } input.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static void disableInputDevice(String id) throws Exception{ try { //String[] cmd = {"/home/swap/java_program/s.sh",id}; String[] cmd = {"/badstore/disable_input_device.sh",id}; Process pb = Runtime.getRuntime().exec(cmd); String line; BufferedReader input = new BufferedReader(new InputStreamReader(pb.getInputStream())); while ((line = input.readLine()) != null) { System.out.println(line); } input.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static void enableInputDevice(String id) throws Exception{ try { //String[] cmd = {"/home/swap/java_program/d.sh"}; String[] cmd = {"/badstore/enable_input_device.sh",id}; Process pb = Runtime.getRuntime().exec(cmd); String line; BufferedReader input = new BufferedReader(new InputStreamReader(pb.getInputStream())); while ((line = input.readLine()) != null) { System.out.println(line); } input.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static void enableInputDevices() throws Exception{ String output = executeCommand("xinput list"); int[] device_ids = extractInputDeviceIds(output); for(int id : device_ids){ enableInputDevice(Integer.toString(id)); } } public static void disableInputDevices() throws Exception{ String output = executeCommand("xinput list"); int[] device_ids = extractInputDeviceIds(output); for(int id : device_ids){ disableInputDevice(Integer.toString(id)); } } private static String executeCommand(String command){ StringBuffer output = new StringBuffer(); Process process; try{ process = Runtime.getRuntime().exec(command); process.waitFor(); BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); String line = ""; while ((line = reader.readLine())!= null) { output.append(line + "\n"); } }catch(Exception e){ e.printStackTrace(); } return output.toString(); } private static int[] extractInputDeviceIds(String output) throws Exception{ String[] lines = output.split("\n"); int[] ids = new int[lines.length-1]; Pattern pattern = Pattern.compile("(.*)id=(\\d+)(.*)"); for(int i=0; i<lines.length-1; i++){ if(lines[i] != null && !lines[i].isEmpty()){ Matcher matcher = pattern.matcher(lines[i]); if(matcher.find() && matcher.group(2) != null && !matcher.group(2).isEmpty()){ ids[i] = Integer.parseInt(matcher.group(2)); } } } return ids; } }
9,037
0.704286
0.698748
218
40.417431
36.114433
226
false
false
0
0
0
0
0
0
2.830275
false
false
0
e8e2637fb7f56a7d19fbd4e2caac3c0d3b7131da
10,230,612,121,942
2f9de59c85e358ed6e4a9055e4891b348b677dcc
/app/src/main/java/com/wangzijie/nutrition_user/ui/act/nutritionist/ActSchemeCompose.java
6b92e515618b21ef52531df0f59cacd907c5d60c
[]
no_license
singingchildren/Android
https://github.com/singingchildren/Android
ccb9fe1b57eb825fe86767bd9a6bf3084729508b
166885f2a8d10e1929119d79972d2227347c6217
refs/heads/master
2020-05-26T07:31:15.191000
2019-05-23T02:57:38
2019-05-23T02:57:38
188,150,864
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.wangzijie.nutrition_user.ui.act.nutritionist; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.FrameLayout; import android.widget.LinearLayout; import android.widget.RadioButton; import android.widget.TextView; import android.widget.Toast; import com.wangzijie.nutrition_user.R; import com.wangzijie.nutrition_user.base.BaseActivity; import com.wangzijie.nutrition_user.base.BaseFragment; import com.wangzijie.nutrition_user.base.contract.BasePresenter; import com.wangzijie.nutrition_user.model.bean.DieticianWriteBean; import com.wangzijie.nutrition_user.presenter.DieticianWriteElsePresenter; import com.wangzijie.nutrition_user.ui.healthycompose.SchemeComposeFoodFragment; import com.wangzijie.nutrition_user.ui.healthycompose.SchemeComposeSleepFragment; import com.wangzijie.nutrition_user.ui.healthycompose.SchemeComposeStopFragment; import com.wangzijie.nutrition_user.ui.healthycompose.SchemeComposeloveFragment; import com.wangzijie.nutrition_user.utils.DisplayUtils; import com.wangzijie.nutrition_user.utils.SharedPreferenceUtil; import java.util.ArrayList; import butterknife.BindView; import butterknife.OnClick; /** * @author fanjiangpeng * 健康指导方案 */ public class ActSchemeCompose extends BaseActivity<DieticianWriteElsePresenter> implements DieticianWriteElsePresenter.DieticianWriteElseView { @BindView(R.id.scheme_food) RadioButton schemeFood; @BindView(R.id.scheme_sleep) RadioButton schemeSleep; @BindView(R.id.scheme_stop) RadioButton schemeStop; @BindView(R.id.scheme_love) RadioButton schemeLove; @BindView(R.id.frame_layout) FrameLayout frameLayout; @BindView(R.id.release) TextView release; @BindView(R.id.start_time) LinearLayout start_time; @BindView(R.id.end_time) LinearLayout end_time; @BindView(R.id.starttime) TextView starttime; @BindView(R.id.endtime) TextView endtime; private SchemeComposeFoodFragment schemeComposeFoodFragment; private SchemeComposeSleepFragment schemeComposeSleepFragment; private SchemeComposeStopFragment schemeComposeStopFragment; private SchemeComposeloveFragment schemeComposeloveFragment; @Override protected int getLayoutId() { return R.layout.activity_my_scheme2; } @Override protected void initView() { fragmentList = new ArrayList<>(); schemeComposeFoodFragment = new SchemeComposeFoodFragment(); schemeComposeSleepFragment = new SchemeComposeSleepFragment(); schemeComposeStopFragment = new SchemeComposeStopFragment(); schemeComposeloveFragment = new SchemeComposeloveFragment(); fragmentList.add(schemeComposeFoodFragment); fragmentList.add(schemeComposeSleepFragment); fragmentList.add(schemeComposeStopFragment); fragmentList.add(schemeComposeloveFragment); } @Override protected void initData() { selectFragment(0); start_time.setOnClickListener(v -> DisplayUtils.showFutureCalendarDialog(activity, starttime, null)); end_time.setOnClickListener(v -> DisplayUtils.showFutureCalendarDialog(activity, endtime,null)); release.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { DieticianWriteBean.FoodData diet = schemeComposeFoodFragment.getType(); String sleep = schemeComposeSleepFragment.getData(); String sport = schemeComposeStopFragment.getData(); String psychology = schemeComposeloveFragment.getData(); String userId = (String) SharedPreferenceUtil.get(ActSchemeCompose.this, "userId", ""); DieticianWriteBean dieticianWriteBean = new DieticianWriteBean(); dieticianWriteBean.start_time = starttime.getText().toString(); dieticianWriteBean.end_time = endtime.getText().toString(); dieticianWriteBean.diet = diet; dieticianWriteBean.sleep = sleep; dieticianWriteBean.sport = sport; dieticianWriteBean.cmId = userId; dieticianWriteBean.psychology = psychology; if (!"年/月/日".equals(starttime.getText().toString())&&!"年/月/日".equals(endtime.getText().toString())&&(!"".equals(sleep)||!"".equals(sport)||!"".equals(psychology)||diet!=null)){ mPresenter.getDieticianWriteElse(dieticianWriteBean); }else{ Toast.makeText(activity,"请选择时间,并添加内容!",Toast.LENGTH_LONG).show(); } } }); } @Override protected DieticianWriteElsePresenter createPresenter() { return new DieticianWriteElsePresenter(); } @OnClick({R.id.scheme_food, R.id.scheme_sleep, R.id.scheme_stop, R.id.scheme_love,R.id.back}) public void onViewClicked(View view) { switch (view.getId()) { case R.id.scheme_food: selectFragment(0); break; case R.id.scheme_sleep: selectFragment(1); break; case R.id.scheme_stop: selectFragment(2); break; case R.id.scheme_love: selectFragment(3); break; case R.id.back: finish(); break; default: break; } } @Override public void onDieticianWriteElse(String msg) { finish(); Toast.makeText(activity,msg,Toast.LENGTH_LONG).show(); } @Override public void err(String message) { Toast.makeText(activity,message,Toast.LENGTH_LONG).show(); } }
UTF-8
Java
5,820
java
ActSchemeCompose.java
Java
[ { "context": "dView;\nimport butterknife.OnClick;\n\n/**\n * @author fanjiangpeng\n * 健康指导方案\n */\npublic class ActSchemeCompose exten", "end": 1231, "score": 0.9603504538536072, "start": 1219, "tag": "USERNAME", "value": "fanjiangpeng" } ]
null
[]
package com.wangzijie.nutrition_user.ui.act.nutritionist; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.FrameLayout; import android.widget.LinearLayout; import android.widget.RadioButton; import android.widget.TextView; import android.widget.Toast; import com.wangzijie.nutrition_user.R; import com.wangzijie.nutrition_user.base.BaseActivity; import com.wangzijie.nutrition_user.base.BaseFragment; import com.wangzijie.nutrition_user.base.contract.BasePresenter; import com.wangzijie.nutrition_user.model.bean.DieticianWriteBean; import com.wangzijie.nutrition_user.presenter.DieticianWriteElsePresenter; import com.wangzijie.nutrition_user.ui.healthycompose.SchemeComposeFoodFragment; import com.wangzijie.nutrition_user.ui.healthycompose.SchemeComposeSleepFragment; import com.wangzijie.nutrition_user.ui.healthycompose.SchemeComposeStopFragment; import com.wangzijie.nutrition_user.ui.healthycompose.SchemeComposeloveFragment; import com.wangzijie.nutrition_user.utils.DisplayUtils; import com.wangzijie.nutrition_user.utils.SharedPreferenceUtil; import java.util.ArrayList; import butterknife.BindView; import butterknife.OnClick; /** * @author fanjiangpeng * 健康指导方案 */ public class ActSchemeCompose extends BaseActivity<DieticianWriteElsePresenter> implements DieticianWriteElsePresenter.DieticianWriteElseView { @BindView(R.id.scheme_food) RadioButton schemeFood; @BindView(R.id.scheme_sleep) RadioButton schemeSleep; @BindView(R.id.scheme_stop) RadioButton schemeStop; @BindView(R.id.scheme_love) RadioButton schemeLove; @BindView(R.id.frame_layout) FrameLayout frameLayout; @BindView(R.id.release) TextView release; @BindView(R.id.start_time) LinearLayout start_time; @BindView(R.id.end_time) LinearLayout end_time; @BindView(R.id.starttime) TextView starttime; @BindView(R.id.endtime) TextView endtime; private SchemeComposeFoodFragment schemeComposeFoodFragment; private SchemeComposeSleepFragment schemeComposeSleepFragment; private SchemeComposeStopFragment schemeComposeStopFragment; private SchemeComposeloveFragment schemeComposeloveFragment; @Override protected int getLayoutId() { return R.layout.activity_my_scheme2; } @Override protected void initView() { fragmentList = new ArrayList<>(); schemeComposeFoodFragment = new SchemeComposeFoodFragment(); schemeComposeSleepFragment = new SchemeComposeSleepFragment(); schemeComposeStopFragment = new SchemeComposeStopFragment(); schemeComposeloveFragment = new SchemeComposeloveFragment(); fragmentList.add(schemeComposeFoodFragment); fragmentList.add(schemeComposeSleepFragment); fragmentList.add(schemeComposeStopFragment); fragmentList.add(schemeComposeloveFragment); } @Override protected void initData() { selectFragment(0); start_time.setOnClickListener(v -> DisplayUtils.showFutureCalendarDialog(activity, starttime, null)); end_time.setOnClickListener(v -> DisplayUtils.showFutureCalendarDialog(activity, endtime,null)); release.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { DieticianWriteBean.FoodData diet = schemeComposeFoodFragment.getType(); String sleep = schemeComposeSleepFragment.getData(); String sport = schemeComposeStopFragment.getData(); String psychology = schemeComposeloveFragment.getData(); String userId = (String) SharedPreferenceUtil.get(ActSchemeCompose.this, "userId", ""); DieticianWriteBean dieticianWriteBean = new DieticianWriteBean(); dieticianWriteBean.start_time = starttime.getText().toString(); dieticianWriteBean.end_time = endtime.getText().toString(); dieticianWriteBean.diet = diet; dieticianWriteBean.sleep = sleep; dieticianWriteBean.sport = sport; dieticianWriteBean.cmId = userId; dieticianWriteBean.psychology = psychology; if (!"年/月/日".equals(starttime.getText().toString())&&!"年/月/日".equals(endtime.getText().toString())&&(!"".equals(sleep)||!"".equals(sport)||!"".equals(psychology)||diet!=null)){ mPresenter.getDieticianWriteElse(dieticianWriteBean); }else{ Toast.makeText(activity,"请选择时间,并添加内容!",Toast.LENGTH_LONG).show(); } } }); } @Override protected DieticianWriteElsePresenter createPresenter() { return new DieticianWriteElsePresenter(); } @OnClick({R.id.scheme_food, R.id.scheme_sleep, R.id.scheme_stop, R.id.scheme_love,R.id.back}) public void onViewClicked(View view) { switch (view.getId()) { case R.id.scheme_food: selectFragment(0); break; case R.id.scheme_sleep: selectFragment(1); break; case R.id.scheme_stop: selectFragment(2); break; case R.id.scheme_love: selectFragment(3); break; case R.id.back: finish(); break; default: break; } } @Override public void onDieticianWriteElse(String msg) { finish(); Toast.makeText(activity,msg,Toast.LENGTH_LONG).show(); } @Override public void err(String message) { Toast.makeText(activity,message,Toast.LENGTH_LONG).show(); } }
5,820
0.682889
0.68185
169
33.16568
30.812216
192
false
false
0
0
0
0
0
0
0.621302
false
false
0
19a3e1bd885abe9a4743c1e31311c339cd84c847
8,504,035,300,740
0edecb97630006dd2aea783eec6426e53205b75d
/src/com/tencent/lucasshi/P48_RotateImage.java
132bfb51673eb37471872a0a7e3184b71267cf6c
[]
no_license
lucasshi/leetcode
https://github.com/lucasshi/leetcode
bdf858e373193b5ea9380364b5fee6322d575bee
bf3170d32f6c4e9439d8fc7f4f652ce747154dc0
refs/heads/master
2021-09-01T09:58:54.122000
2021-08-17T02:35:10
2021-08-17T02:35:10
67,920,295
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.tencent.lucasshi; /** * Created by fzy on 17/9/17. */ public class P48_RotateImage { public void rotate(int[][] matrix) { int round = matrix.length / 2; for (int i = 0; i <= round; i++) { rotateRound(matrix, i); } return; } public void rotateRound(int[][] matrix, int roundId) { int end = matrix.length - 1 - roundId; // int length = matrix.length; /* for (int i = roundId; i < end; i++) { int first = matrix[roundId][i]; int second = matrix[i][end]; int third = matrix[end][length - i - 1]; int fourth = matrix[length - i - 1][roundId]; // swap matrix[i][end] = first; matrix[end][length - i - 1] = second; matrix[length - i - 1][roundId] = third; matrix[roundId][i] = fourth; } */ for (int i = 0; i < end - roundId; i++) { int first = matrix[roundId][roundId + i]; int second = matrix[roundId + i][end]; int third = matrix[end][end - i]; int fourth = matrix[end - i][roundId]; // swap matrix[roundId][roundId + i] = fourth; matrix[roundId + i][end] = first; matrix[end][end - i] = second; matrix[end - i][roundId] = third; printMatrix(matrix); } } public void printMatrix(int[][] matrix) { for (int i = 0; i < matrix.length; i++) { for (int j = 0; j < matrix.length; j++) { System.out.print(matrix[i][j] + ","); } System.out.println(); } System.out.println(); } public static void main(String[] args) { int[][] matrix = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; int[][] matrix2 = {{5, 1, 9, 11}, {2, 4, 8, 10}, {13, 3, 6, 7}, {15, 14, 12, 16}}; P48_RotateImage p = new P48_RotateImage(); p.printMatrix(matrix2); System.out.println("start"); //p.FaceBook_RotateMin(matrix); p.rotate(matrix2); } }
UTF-8
Java
2,120
java
P48_RotateImage.java
Java
[ { "context": "package com.tencent.lucasshi;\n\n/**\n * Created by fzy on 17/9/17.\n */\npublic class P48_RotateImage {\n ", "end": 52, "score": 0.9995290040969849, "start": 49, "tag": "USERNAME", "value": "fzy" } ]
null
[]
package com.tencent.lucasshi; /** * Created by fzy on 17/9/17. */ public class P48_RotateImage { public void rotate(int[][] matrix) { int round = matrix.length / 2; for (int i = 0; i <= round; i++) { rotateRound(matrix, i); } return; } public void rotateRound(int[][] matrix, int roundId) { int end = matrix.length - 1 - roundId; // int length = matrix.length; /* for (int i = roundId; i < end; i++) { int first = matrix[roundId][i]; int second = matrix[i][end]; int third = matrix[end][length - i - 1]; int fourth = matrix[length - i - 1][roundId]; // swap matrix[i][end] = first; matrix[end][length - i - 1] = second; matrix[length - i - 1][roundId] = third; matrix[roundId][i] = fourth; } */ for (int i = 0; i < end - roundId; i++) { int first = matrix[roundId][roundId + i]; int second = matrix[roundId + i][end]; int third = matrix[end][end - i]; int fourth = matrix[end - i][roundId]; // swap matrix[roundId][roundId + i] = fourth; matrix[roundId + i][end] = first; matrix[end][end - i] = second; matrix[end - i][roundId] = third; printMatrix(matrix); } } public void printMatrix(int[][] matrix) { for (int i = 0; i < matrix.length; i++) { for (int j = 0; j < matrix.length; j++) { System.out.print(matrix[i][j] + ","); } System.out.println(); } System.out.println(); } public static void main(String[] args) { int[][] matrix = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; int[][] matrix2 = {{5, 1, 9, 11}, {2, 4, 8, 10}, {13, 3, 6, 7}, {15, 14, 12, 16}}; P48_RotateImage p = new P48_RotateImage(); p.printMatrix(matrix2); System.out.println("start"); //p.FaceBook_RotateMin(matrix); p.rotate(matrix2); } }
2,120
0.469811
0.443396
75
27.266666
21.5755
90
false
false
0
0
0
0
0
0
0.92
false
false
0
2c5cceec0ebd1b185817519666ba0fad5f66af80
1,795,296,377,908
a26604c5100021c43bc1f3abf5b4afa1b00479df
/Materno-war/src/java/materno/auth/Autenticacion.java
e0283a709461e4499fad12436392b6c0224adad8
[]
no_license
joseaortegatoro/Materno
https://github.com/joseaortegatoro/Materno
6b7f62ee28132efdde0fd9cb70b078336677d15d
07ef144b7ba4d924762587172ec09d8fd9dd68a4
refs/heads/master
2015-08-11T08:59:56.375000
2014-06-29T23:15:28
2014-06-29T23:15:28
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package materno.auth; import java.io.Serializable; import javax.ejb.EJB; import javax.enterprise.context.SessionScoped; import javax.faces.context.FacesContext; import javax.inject.Inject; import javax.inject.Named; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import materno.controller.LoginController; import materno.entidades.Administrador; import materno.entidades.Administrativo; import materno.entidades.Medico; import materno.entidades.Paciente; import materno.entidades.Usuario; import materno.negocio.CuentaLocal; @Named("auth") @SessionScoped public class Autenticacion implements Serializable { private Usuario usuario; @Inject private LoginController login; @Inject private Autenticacion auth; @EJB private CuentaLocal cuenta; // Log con cookies public boolean logCookie() { if(usuario == null) { Cookie[] cookies = ((HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest()).getCookies(); if (cookies != null) { for (Cookie c : cookies) { if (c.getName().equals("appSession")) { login.logCookie(c.getValue()); if(auth.getUsuario() != null) return true; } } } } return false; } public String redirect() { return "index.xhtml"; } public void setUsuario(Usuario usuario) { this.usuario = usuario; } public Usuario getUsuario() { if(usuario == null) return null; usuario = cuenta.refrescarUsuario(usuario); return this.usuario; } public boolean isPaciente() { Usuario user = getUsuario(); return user != null && user instanceof Paciente; } public boolean isMedico() { Usuario user = getUsuario(); return user != null && user instanceof Medico; } public boolean isAdministrativo() { Usuario user = getUsuario(); return user != null && user instanceof Administrativo; } public boolean isAdministrador() { Usuario user = getUsuario(); return user != null && user instanceof Administrador; } public String logout() { if(usuario != null) { if(usuario.getCookie() != null) { usuario.setCookie(null); cuenta.modificar(usuario); auth.usuario = null; } FacesContext ctx = FacesContext.getCurrentInstance(); ctx.getExternalContext().invalidateSession(); Cookie c = new Cookie("appSession", ""); c.setMaxAge(0); c.setPath("/Materno-war"); c.setHttpOnly(true); ((HttpServletResponse) ctx.getExternalContext().getResponse()).addCookie(c); usuario = null; } return "index.xhtml"; } }
UTF-8
Java
3,003
java
Autenticacion.java
Java
[]
null
[]
package materno.auth; import java.io.Serializable; import javax.ejb.EJB; import javax.enterprise.context.SessionScoped; import javax.faces.context.FacesContext; import javax.inject.Inject; import javax.inject.Named; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import materno.controller.LoginController; import materno.entidades.Administrador; import materno.entidades.Administrativo; import materno.entidades.Medico; import materno.entidades.Paciente; import materno.entidades.Usuario; import materno.negocio.CuentaLocal; @Named("auth") @SessionScoped public class Autenticacion implements Serializable { private Usuario usuario; @Inject private LoginController login; @Inject private Autenticacion auth; @EJB private CuentaLocal cuenta; // Log con cookies public boolean logCookie() { if(usuario == null) { Cookie[] cookies = ((HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest()).getCookies(); if (cookies != null) { for (Cookie c : cookies) { if (c.getName().equals("appSession")) { login.logCookie(c.getValue()); if(auth.getUsuario() != null) return true; } } } } return false; } public String redirect() { return "index.xhtml"; } public void setUsuario(Usuario usuario) { this.usuario = usuario; } public Usuario getUsuario() { if(usuario == null) return null; usuario = cuenta.refrescarUsuario(usuario); return this.usuario; } public boolean isPaciente() { Usuario user = getUsuario(); return user != null && user instanceof Paciente; } public boolean isMedico() { Usuario user = getUsuario(); return user != null && user instanceof Medico; } public boolean isAdministrativo() { Usuario user = getUsuario(); return user != null && user instanceof Administrativo; } public boolean isAdministrador() { Usuario user = getUsuario(); return user != null && user instanceof Administrador; } public String logout() { if(usuario != null) { if(usuario.getCookie() != null) { usuario.setCookie(null); cuenta.modificar(usuario); auth.usuario = null; } FacesContext ctx = FacesContext.getCurrentInstance(); ctx.getExternalContext().invalidateSession(); Cookie c = new Cookie("appSession", ""); c.setMaxAge(0); c.setPath("/Materno-war"); c.setHttpOnly(true); ((HttpServletResponse) ctx.getExternalContext().getResponse()).addCookie(c); usuario = null; } return "index.xhtml"; } }
3,003
0.612388
0.612055
102
28.441177
21.700083
135
false
false
0
0
0
0
0
0
0.5
false
false
0
5658ccdcec2c0a75e882e38016e01d92991bee04
22,471,268,946,273
c2d1e1931a2dbe61c1197ad9908a21ffeb5c9b4d
/app/src/main/java/vergecurrency/vergewallet/Constants.java
65c07c98ac99169e7f9417155ec66f3520cfb14f
[ "MIT" ]
permissive
MonetChain-Project/MonetBlockchain_Android
https://github.com/MonetChain-Project/MonetBlockchain_Android
07c95dd23efc3a8f93b5507d72049cd4dfa995ed
6a43ca5b3aae95b71d474d19ba295b538c9e1d87
refs/heads/master
2021-06-26T09:51:13.521000
2019-03-22T06:27:22
2019-03-22T06:27:22
133,648,164
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package vergecurrency.vergewallet; import java.util.ArrayList; import java.util.List; public final class Constants { //Wallet constants public final static Double FETCH_WALLET_TIMEOUT = 30d; public final static Double FETCH_PRICE_TIMEOUT = 150d; public final static Double SATOSHIS_DIVIDER = 1000000d; public final static Double MINIMUM_FEE = 0.1d; public final static int NEEDED_CONFIRMATIONS = 1; //Service Urls public final static String VERGE_WEBSITE = "https://vergecurrency.com"; public final static String VDROID_REPO = "https://github.com/vergecurrency/vDroid"; public final static String BLOCKCHAIN_EXPLORER = "https://verge-blockchain.info"; public final static String VWS_ENDPOINT = "https://vws2.swenvanzanten.com/vws/api/"; //Secondary Service Urls public final static String PRICE_DATA_ENDPOINT = "https://vws2.swenvanzanten.com/price/api/v1/price/"; public final static String CHART_DATA_ENDPOINT = "https://graphs2.coinmarketcap.com/currencies/verge/"; public final static String IP_DATA_ENDPOINT = "http://api.ipstack.com/%s?access_key=7ad464757507e0b58ce0beee4810c1ab"; public final static String IP_RETRIEVAL_ENDPOINT = "https://api.ipify.org?format=json"; public final static int SEED_SIZE = 12; public final static int WORDLIST_SIZE = 2048; public static List<String> seed; //Resource directories public final static String CURRENCIES_FILE_PATH = "currencies.json"; public final static String MOCK_TRANSACTIONS_FILE_PATH = "transactions.json"; //public final static String CMC_API_KEY = "530a3244-7c12-4b13-88f2-3eed4127e2d7"; }
UTF-8
Java
1,644
java
Constants.java
Java
[ { "context": "l static String VDROID_REPO = \"https://github.com/vergecurrency/vDroid\";\n public final static String BLOCKCHAI", "end": 600, "score": 0.9941710829734802, "start": 587, "tag": "USERNAME", "value": "vergecurrency" }, { "context": "_ENDPOINT = \"http://api.ipstack.co...
null
[]
package vergecurrency.vergewallet; import java.util.ArrayList; import java.util.List; public final class Constants { //Wallet constants public final static Double FETCH_WALLET_TIMEOUT = 30d; public final static Double FETCH_PRICE_TIMEOUT = 150d; public final static Double SATOSHIS_DIVIDER = 1000000d; public final static Double MINIMUM_FEE = 0.1d; public final static int NEEDED_CONFIRMATIONS = 1; //Service Urls public final static String VERGE_WEBSITE = "https://vergecurrency.com"; public final static String VDROID_REPO = "https://github.com/vergecurrency/vDroid"; public final static String BLOCKCHAIN_EXPLORER = "https://verge-blockchain.info"; public final static String VWS_ENDPOINT = "https://vws2.swenvanzanten.com/vws/api/"; //Secondary Service Urls public final static String PRICE_DATA_ENDPOINT = "https://vws2.swenvanzanten.com/price/api/v1/price/"; public final static String CHART_DATA_ENDPOINT = "https://graphs2.coinmarketcap.com/currencies/verge/"; public final static String IP_DATA_ENDPOINT = "http://api.ipstack.com/%s?access_key=7ad464757507e0b58ce0beee4810c1ab"; public final static String IP_RETRIEVAL_ENDPOINT = "https://api.ipify.org?format=json"; public final static int SEED_SIZE = 12; public final static int WORDLIST_SIZE = 2048; public static List<String> seed; //Resource directories public final static String CURRENCIES_FILE_PATH = "currencies.json"; public final static String MOCK_TRANSACTIONS_FILE_PATH = "transactions.json"; //public final static String CMC_API_KEY = "<KEY>2d7"; }
1,616
0.745134
0.70438
38
42.263157
36.523018
122
false
false
0
0
0
0
0
0
0.657895
false
false
0
60cef7cc30ce6a5d3bf6243b6e6b287c1d88c199
39,118,562,162,752
7bfb6fe0e6a7ee74c1dbd81ba105ba5c38531d3a
/6x/aplicacao/aghu_jee/aghu/aghu-prescricaomedica/src/main/java/br/gov/mec/aghu/prescricaomedica/business/ListaPacientesInternadosON.java
1c4722c0e3210acf83180e561cb2dd1583d835b8
[]
no_license
carlosmanoel/aghu-sistema
https://github.com/carlosmanoel/aghu-sistema
80651214dcb16cdc6f07f39a416e1657eb415c4d
cb43b387181670e5f74299a0df4662ea26adc2ab
refs/heads/master
2021-06-18T16:59:28.666000
2017-06-14T18:16:09
2017-06-14T18:16:09
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.gov.mec.aghu.prescricaomedica.business; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.HashSet; import java.util.List; import javax.ejb.EJB; import javax.ejb.Stateless; import javax.inject.Inject; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import br.gov.mec.aghu.aghparametros.business.IParametroFacade; import br.gov.mec.aghu.aghparametros.util.AghuParametrosEnum; import br.gov.mec.aghu.ambulatorio.dao.MamEvolucoesDAO; import br.gov.mec.aghu.ambulatorio.dao.MamItemEvolucoesDAO; import br.gov.mec.aghu.ambulatorio.dao.MamTipoItemEvolucaoDAO; import br.gov.mec.aghu.blococirurgico.business.IBlocoCirurgicoFacade; import br.gov.mec.aghu.business.IAghuFacade; import br.gov.mec.aghu.casca.business.ICascaFacade; import br.gov.mec.aghu.certificacaodigital.business.ICertificacaoDigitalFacade; import br.gov.mec.aghu.constante.ConstanteAghCaractUnidFuncionais; import br.gov.mec.aghu.controleinfeccao.dao.MciNotificacaoGmrDAO; import br.gov.mec.aghu.core.business.BaseBusiness; import br.gov.mec.aghu.core.exception.ApplicationBusinessException; import br.gov.mec.aghu.core.exception.BaseException; import br.gov.mec.aghu.core.exception.BusinessExceptionCode; import br.gov.mec.aghu.core.utils.DateUtil; import br.gov.mec.aghu.dominio.DominioControleSumarioAltaPendente; import br.gov.mec.aghu.dominio.DominioIndPendenteAmbulatorio; import br.gov.mec.aghu.dominio.DominioOrigemAtendimento; import br.gov.mec.aghu.dominio.DominioPacAtendimento; import br.gov.mec.aghu.dominio.DominioSimNao; import br.gov.mec.aghu.exames.dao.AelItemSolicitacaoExameDAO; import br.gov.mec.aghu.exames.dao.AelProjetoPacientesDAO; import br.gov.mec.aghu.model.AghAtendimentos; import br.gov.mec.aghu.model.AghParametros; import br.gov.mec.aghu.model.AghUnidadesFuncionais; import br.gov.mec.aghu.model.AinLeitos; import br.gov.mec.aghu.model.AinQuartos; import br.gov.mec.aghu.model.CseCategoriaProfissional; import br.gov.mec.aghu.model.MamEvolucoes; import br.gov.mec.aghu.model.MamTipoItemEvolucao; import br.gov.mec.aghu.model.MpmAltaSumario; import br.gov.mec.aghu.model.MpmAnamneses; import br.gov.mec.aghu.model.MpmSumarioAlta; import br.gov.mec.aghu.model.RapServidores; import br.gov.mec.aghu.prescricaomedica.dao.MpmAltaSumarioDAO; import br.gov.mec.aghu.prescricaomedica.dao.MpmAnamnesesDAO; import br.gov.mec.aghu.prescricaomedica.dao.MpmEvolucoesDAO; import br.gov.mec.aghu.prescricaomedica.dao.MpmLaudoDAO; import br.gov.mec.aghu.prescricaomedica.dao.MpmListaPacCpaDAO; import br.gov.mec.aghu.prescricaomedica.dao.MpmListaServEquipeDAO; import br.gov.mec.aghu.prescricaomedica.dao.MpmListaServResponsavelDAO; import br.gov.mec.aghu.prescricaomedica.dao.MpmPrescricaoMedicaDAO; import br.gov.mec.aghu.prescricaomedica.dao.VMpmListaPacInternadosDAO; import br.gov.mec.aghu.prescricaomedica.vo.PacienteListaProfissionalVO; import br.gov.mec.aghu.prescricaomedica.vo.PacienteListaProfissionalVO.StatusAltaObito; import br.gov.mec.aghu.prescricaomedica.vo.PacienteListaProfissionalVO.StatusAnamneseEvolucao; import br.gov.mec.aghu.prescricaomedica.vo.PacienteListaProfissionalVO.StatusCertificaoDigital; import br.gov.mec.aghu.prescricaomedica.vo.PacienteListaProfissionalVO.StatusEvolucao; import br.gov.mec.aghu.prescricaomedica.vo.PacienteListaProfissionalVO.StatusExamesNaoVistos; import br.gov.mec.aghu.prescricaomedica.vo.PacienteListaProfissionalVO.StatusPacientePesquisa; import br.gov.mec.aghu.prescricaomedica.vo.PacienteListaProfissionalVO.StatusPendenciaDocumento; import br.gov.mec.aghu.prescricaomedica.vo.PacienteListaProfissionalVO.StatusPrescricao; import br.gov.mec.aghu.prescricaomedica.vo.PacienteListaProfissionalVO.StatusSumarioAlta; import br.gov.mec.aghu.registrocolaborador.business.IRegistroColaboradorFacade; import br.gov.mec.aghu.registrocolaborador.business.IServidorLogadoFacade; @SuppressWarnings("PMD.AghuTooManyMethods") @Stateless public class ListaPacientesInternadosON extends BaseBusiness { private static final String ARGUMENTO_INVALIDO = "Argumento inválido"; private static final Log LOG = LogFactory.getLog(ListaPacientesInternadosON.class); @Override @Deprecated protected Log getLogger() { return LOG; } @EJB private IServidorLogadoFacade servidorLogadoFacade; @Inject private MpmAltaSumarioDAO mpmAltaSumarioDAO; @Inject private MamEvolucoesDAO mamEvolucoesDAO; @EJB private ICascaFacade cascaFacade; @Inject private MpmListaServResponsavelDAO mpmListaServResponsavelDAO; @Inject private MpmListaServEquipeDAO mpmListaServEquipeDAO; @Inject private AelItemSolicitacaoExameDAO aelItemSolicitacaoExameDAO; @Inject private AelProjetoPacientesDAO aelProjetoPacientesDAO; @EJB private IRegistroColaboradorFacade registroColaboradorFacade; @EJB private IParametroFacade parametroFacade; @EJB private IAghuFacade aghuFacade; @Inject private MpmLaudoDAO mpmLaudoDAO; @Inject private MpmPrescricaoMedicaDAO mpmPrescricaoMedicaDAO; @EJB private IBlocoCirurgicoFacade blocoCirurgicoFacade; @Inject private MpmListaPacCpaDAO mpmListaPacCpaDAO; @Inject private MamTipoItemEvolucaoDAO mamTipoItemEvolucaoDAO; @Inject private MamItemEvolucoesDAO mamItemEvolucoesDAO; @Inject private VMpmListaPacInternadosDAO vMpmListaPacInternadosDAO; @EJB private ICertificacaoDigitalFacade certificacaoDigitalFacade; @Inject private MciNotificacaoGmrDAO mciNotificacaoGmrDAO; @Inject private MpmAnamnesesDAO mpmAnamnesesDAO; @Inject private MpmEvolucoesDAO mpmEvolucoesDAO; private static final long serialVersionUID = 4177536088062626713L; public enum ListaPacientesInternadosONExceptionCode implements BusinessExceptionCode { ERRO_INTERNACAO_COM_PROCEDIMENTO_CIRURGICO_SUS, ERRO_PERMISSAO_SUMARIO_ALTA, ERRO_PERMISSAO_SUMARIO_OBITO, ERRO_SEXO_PACIENTE_NAO_INFORMADO, ERRO_PERMISSAO_DIAGNOSTICOS; } /** * Retorna a lista de pacientes internados do profissional fornecido, sem as * flags de status, habilita/desabilita botões, etc.<br /> * * @param servidor * @return */ public List<PacienteListaProfissionalVO> pesquisarListaPacientesResumo(RapServidores servidor) { List<PacienteListaProfissionalVO> result = new ArrayList<PacienteListaProfissionalVO>(); List<AghAtendimentos> atendimentosEquipe = this.pesquisarAtendimentosEquipe(servidor); for (AghAtendimentos atendimento : atendimentosEquipe) { PacienteListaProfissionalVO vo = new PacienteListaProfissionalVO(atendimento); vo.setLocal(this.getDescricaoLocalizacao(atendimento)); // se necessário mais dados no VO, verificar método // pesquisarListaPacientes result.add(vo); } return result; } /** * Retorna a lista de pacientes internados do profissional fornecido. * * @param servidor * @return * @throws BaseException */ public List<PacienteListaProfissionalVO> pesquisarListaPacientes(RapServidores servidor) throws BaseException { if (servidor == null) { throw new IllegalArgumentException("Argumento inválido."); } List<PacienteListaProfissionalVO> result = new ArrayList<PacienteListaProfissionalVO>(); if (isUsarBusca(AghuParametrosEnum.PME_LISTA_PACIENTES_USAR_BUSCA_OTIMIZADA)) { List<PacienteListaProfissionalVO> listaOtimizada = vMpmListaPacInternadosDAO.buscaListaPacientesInternados(servidor); result.addAll(listaOtimizada); } else { final String SIGLA_TIPO_ITEM_EVOLUCAO = "C"; List<Integer> listaPacientesProjetoPesquisa = new ArrayList<Integer>(); List<Integer> listaPacientesComPendencia = new ArrayList<Integer>(); List<Short> listaUnidadesPrescricaoEletronica = new ArrayList<Short>(); List<AghAtendimentos> listaPaciente = pesquisarAtendimentosEquipe(servidor); obterCodigosComPendenciasComProjetoPesquisa(listaPaciente, listaPacientesComPendencia, listaPacientesProjetoPesquisa, listaUnidadesPrescricaoEletronica); Boolean categoria = validarCategoriaProfissional(); List<MamTipoItemEvolucao> itensEvolucao = getMamTipoItemEvolucaoDAO().pesquisarListaTipoItemEvoulucaoPelaSigla( SIGLA_TIPO_ITEM_EVOLUCAO); Boolean bloqueiaPacEmergencia = DominioSimNao.S.toString().equals( this.getParametroFacade().buscarValorTexto(AghuParametrosEnum.P_BLOQUEIA_PAC_EMERG)); for (AghAtendimentos atendimento : listaPaciente) { PacienteListaProfissionalVO vo = new PacienteListaProfissionalVO(atendimento); vo.setPossuiPlanoAltas(verificarPossuiPlanoAlta(atendimento)); vo.setLocal(this.getDescricaoLocalizacao(atendimento)); vo.setStatusPrescricao(obterIconePrescricao(atendimento, listaUnidadesPrescricaoEletronica)); vo.setStatusSumarioAlta(obterIconeSumarioAlta(atendimento)); vo.setStatusExamesNaoVistos(obterIconeResultadoExames(atendimento.getSeq(), servidor)); vo.setStatusPendenciaDocumento(obterIconePendenciaDocumento(atendimento)); vo.setStatusPacientePesquisa(obterIconePacientePesquisa(atendimento, listaPacientesProjetoPesquisa)); vo.setStatusEvolucao(obterIconeEvolucao(atendimento, categoria, itensEvolucao)); if (listaPacientesComPendencia.contains(atendimento.getPaciente().getCodigo())) { vo.setStatusCertificacaoDigital(StatusCertificaoDigital.PENDENTE); } else { vo.setStatusCertificacaoDigital(null); } // habilita/desabilita 'Alta/Obito/Antecipar Sumário' da lista vo.setDisableButtonAltaObito(this.disableFuncionalidadeLista(atendimento, bloqueiaPacEmergencia)); // habilita/desabilita 'Prescrever' da lista vo.setDisableButtonPrescrever(this.disablePrescrever(atendimento, listaUnidadesPrescricaoEletronica)); if (this.sumarioAltaObito(atendimento)) { vo.setLabelAlta(StatusAltaObito.SUMARIO_ALTA); vo.setLabelObito(StatusAltaObito.SUMARIO_OBITO); } else { vo.setLabelAlta(StatusAltaObito.ALTA); vo.setLabelObito(StatusAltaObito.OBITO); } vo.setEnableButtonAnamneseEvolucao(this.habilitarBotaoAnamneseEvolucao(vo.getAtdSeq(), vo.isDisableButtonPrescrever(), vo.isDisableButtonAltaObito())); vo.setStatusAnamneseEvolucao(this.obterIconeAnamneseEvolucao(vo.getAtdSeq(), vo.isEnableButtonAnamneseEvolucao())); vo.setIndGmr(mciNotificacaoGmrDAO.verificarNotificacaoGmrPorCodigo(atendimento.getPaciente().getCodigo())); // adiciona na coleção result.add(vo); } } return result; } /* * Verifica a existencia de parametro de sistema para buscar pela View.<br/> * * Caso nao exista o parametro definido ou o valor seja diferente de 'S', entao<br/> * Executa a busca usando a regras implementadas no codigo java. Fazendo varios acessos a banco. */ private boolean isUsarBusca(AghuParametrosEnum enumParametro) { if (parametroFacade.verificarExisteAghParametro(enumParametro)) { AghParametros param = parametroFacade.getAghParametro(enumParametro); String strUsarView = "N"; if (param != null) { strUsarView = param.getVlrTexto(); } return ("S".equalsIgnoreCase(strUsarView)); } return false; } private Boolean validarCategoriaProfissional() throws ApplicationBusinessException { // busca qual é a categoria profissional enfermagem final Integer catefProfEnf = getParametroFacade().buscarValorInteiro(AghuParametrosEnum.P_CATEG_PROF_ENF); // busca qual é a categoria profissional médico final Integer catefProfMed = getParametroFacade().buscarValorInteiro(AghuParametrosEnum.P_CATEG_PROF_MEDICO); // categoria outros profissionais final Integer cateOutros = getParametroFacade().buscarValorInteiro(AghuParametrosEnum.P_CATEG_PROF_OUTROS); final List<CseCategoriaProfissional> categorias = getCascaFacade().pesquisarCategoriaProfissional(this.getServidorLogadoFacade().obterServidorLogado()); if(!categorias.isEmpty()){ CseCategoriaProfissional categoria = categorias.get(0); if(catefProfMed == categoria.getSeq() || cateOutros == categoria.getSeq()){ return false; } else if (catefProfEnf == categoria.getSeq()){ return true; } } return null; } public void obterCodigosComPendenciasComProjetoPesquisa(List<AghAtendimentos> listaPaciente, List<Integer> listaPacientesComPendencia, List<Integer> listaPacientesEmProjetoPesquisa, List<Short> listaUnidadesPrescricaoEletronica){ List<Object[]> listaPacientesPendencias = null; List<Object[]> listaPacientesPesquisa = null; List<Integer> listaPacCodigo = new ArrayList<Integer>(); HashSet<Short> HasUnidades = new HashSet<Short>(); for (AghAtendimentos atendimento: listaPaciente){ listaPacCodigo.add(atendimento.getPaciente().getCodigo()); HasUnidades.add(atendimento.getUnidadeFuncional().getSeq()); } if (!listaPaciente.isEmpty()){ listaPacientesPendencias = this.getCertificacaoDigitalFacade().countVersaoPacientes(listaPacCodigo); for (Object[] vetorObject: listaPacientesPendencias){ listaPacientesComPendencia.add((Integer)vetorObject[0]); } listaPacientesPesquisa = this.getAelProjetoPacientesDAO().verificaPacienteEmProjetoPesquisa(listaPacCodigo); for (Object[] vetorObject: listaPacientesPesquisa){ listaPacientesEmProjetoPesquisa.add((Integer)vetorObject[0]); } for(Short unidade : new ArrayList<Short>(HasUnidades)) { if(aghuFacade.possuiCaracteristicaPorUnidadeEConstante(unidade, ConstanteAghCaractUnidFuncionais.PME_INFORMATIZADA)) { listaUnidadesPrescricaoEletronica.add(unidade); } } } } private StatusExamesNaoVistos obterIconeResultadoExames( Integer atdSeq, RapServidores servidor) { if(getAelItemSolicitacaoExameDAO().pesquisarExamesResultadoNaoVisualizado(atdSeq)){ return StatusExamesNaoVistos.RESULTADOS_NAO_VISUALIZADOS; } else if (getAelItemSolicitacaoExameDAO().pesquisarExamesResultadoVisualizadoOutroMedico(atdSeq, servidor)){ return StatusExamesNaoVistos.RESULTADOS_VISUALIZADOS_OUTRO_MEDICO; } else { return null; } } /*** * Método realiza pesquisa sobre as entidades AghAtendimentos e * MpmControlPrevAltas, para verifica se existe alguma previsão de alta * marcada para as proximas 48 hrs * * @param seq * @return */ public boolean verificarPossuiPlanoAlta(AghAtendimentos atendimento) { if (atendimento == null) { return false; } else { if (DominioOrigemAtendimento.I.equals(atendimento.getOrigem())) { return verificarPossuiPlanoAltaAtendimento(atendimento.getSeq()); } else if (DominioOrigemAtendimento.N.equals(atendimento.getOrigem())) { if (atendimento.getAtendimentoMae() == null) { return false; } if (DominioOrigemAtendimento.I.equals(atendimento.getAtendimentoMae().getOrigem())) { return verificarPossuiPlanoAltaAtendimento(atendimento.getAtendimentoMae().getSeq()); } else if (DominioOrigemAtendimento.N.equals(atendimento.getOrigem())) { return false; } } } return false; } private boolean verificarPossuiPlanoAltaAtendimento(Integer seq) { Object[] prescricaoMedicaVO = mpmPrescricaoMedicaDAO.verificarPossuiPlanoAlta(seq); if (prescricaoMedicaVO != null && prescricaoMedicaVO[0] != null && DominioSimNao.S.toString().equals(prescricaoMedicaVO[1])) { Integer diferencaDias = DateUtil.diffInDaysInteger((Date) prescricaoMedicaVO[0], new Date()); if (diferencaDias >= 0 && diferencaDias <= 2) { return true; } } return false; } public void obterCodigosComPendenciasComProjetoPesquisa(List<AghAtendimentos> listaPaciente, List<Integer> listaPacientesComPendencia, List<Integer> listaPacientesEmProjetoPesquisa) { List<Object[]> listaPacientesPendencias = null; List<Object[]> listaPacientesPesquisa = null; List<Integer> listaPacCodigo = new ArrayList<Integer>(); for (AghAtendimentos atendimento : listaPaciente) { listaPacCodigo.add(atendimento.getPaciente().getCodigo()); } if (!listaPaciente.isEmpty()) { listaPacientesPendencias = this.getCertificacaoDigitalFacade().countVersaoPacientes(listaPacCodigo); for (Object[] vetorObject : listaPacientesPendencias) { listaPacientesComPendencia.add((Integer) vetorObject[0]); } listaPacientesPesquisa = this.getAelProjetoPacientesDAO().verificaPacienteEmProjetoPesquisa(listaPacCodigo); for (Object[] vetorObject : listaPacientesPesquisa) { listaPacientesEmProjetoPesquisa.add((Integer) vetorObject[0]); } } } /** * Retorna os atendimentos do servidor fornecido.<br /> * Atendimentos na equipe, atendimentos pelo responsável da equipe e * atendimentos em acompanhamento pelo servidor fornecido. * * @param servidor * @return */ private List<AghAtendimentos> pesquisarAtendimentosEquipe(RapServidores servidor) { // servidor = // this.getRegistroColaboradorFacade().buscaServidor(servidor.getId()); // 3. pacientes em atendimento na equipe final List<RapServidores> pacAtdEqpResp = this.getMpmListaServEquipeDAO() .listaProfissionaisRespEquipe(servidor); // 3.1. pacientes em atendimento pelo responsável pacAtdEqpResp.addAll(this.getMpmListaServResponsavelDAO().listaProfissionaisResponsaveis(servidor)); // 4. pacientes em acompanhamento pelo profissional boolean mostrarPacientesCpa = getMpmListaPacCpaDAO().mostrarPacientesCpas(servidor); List<AghAtendimentos> listaPaciente = getAghuFacade().listarPaciente(servidor, pacAtdEqpResp, mostrarPacientesCpa); return listaPaciente; } private StatusAnamneseEvolucao obterIconeAnamneseEvolucao(Integer atdSeq, boolean enableButtonAnamneseEvolucao) { if(enableButtonAnamneseEvolucao) { MpmAnamneses anamnese = this.getMpmAnamnesesDAO().obterAnamneseAtendimento(atdSeq); if(anamnese == null || (anamnese != null && anamnese.getPendente() == DominioIndPendenteAmbulatorio.R)) { return StatusAnamneseEvolucao.ANAMNESE_NAO_REALIZADA; } if(anamnese != null && anamnese.getPendente() == DominioIndPendenteAmbulatorio.P) { return StatusAnamneseEvolucao.ANAMNESE_PENDENTE; } if(anamnese != null && anamnese.getPendente() == DominioIndPendenteAmbulatorio.V) { //Data Atual Zerada Date dataReferencia = DateUtils.truncate(new Date(), Calendar.DAY_OF_MONTH); if(!this.getMpmEvolucoesDAO().verificarEvolucaoRealizadaPorSituacao(anamnese.getSeq(), DominioIndPendenteAmbulatorio.R, dataReferencia, false)) { return StatusAnamneseEvolucao.EVOLUCAO_DO_DIA_NAO_REALIZADA; } if(this.getMpmEvolucoesDAO().verificarEvolucaoRealizadaPorSituacao(anamnese.getSeq(), DominioIndPendenteAmbulatorio.P, dataReferencia, true)) { return StatusAnamneseEvolucao.EVOLUCAO_DO_DIA_PENDENTE; } if(!this.getMpmEvolucoesDAO().verificarEvolucaoSeguinteRealizadaPorSituacao(anamnese.getSeq(), DominioIndPendenteAmbulatorio.V, dataReferencia)) { return StatusAnamneseEvolucao.EVOLUCAO_VENCE_NO_DIA_SEGUINTE; } } } return null; } private boolean habilitarBotaoAnamneseEvolucao(Integer atdSeq, boolean disableButtonPrescrever, boolean disableButtonAltaObito) { if (atdSeq != null) { AghAtendimentos atendimento = this.getAghuFacade().obterAtendimentoEmAndamento(atdSeq); if(atendimento != null && !disableButtonPrescrever && !disableButtonAltaObito){ if(this.getAghuFacade().verificarCaracteristicaUnidadeFuncional(atendimento.getUnidadeFuncional().getSeq(), ConstanteAghCaractUnidFuncionais.ANAMNESE_EVOLUCAO_ELETRONICA)) { return true; } } } return false; } /** * Regra para habilitar/desabilitar o botão 'Prescrever' * * @param atendimento * @return */ private boolean disablePrescrever(AghAtendimentos atendimento, List<Short> listaUnidadesPrescricaoEletronica) { if (atendimento == null) { throw new IllegalArgumentException(ARGUMENTO_INVALIDO); } if (listaUnidadesPrescricaoEletronica.contains(atendimento.getUnidadeFuncional().getSeq()) && DominioPacAtendimento.S.equals(atendimento.getIndPacAtendimento())) { return false; } else { return true; } } /** * Retorna a descrição para a localização atual do atendimento fornecido. * * @param atendimento * @return */ public String getDescricaoLocalizacao(AghAtendimentos atendimento) { if (atendimento == null) { throw new IllegalArgumentException(ARGUMENTO_INVALIDO); } return this.getDescricaoLocalizacao(atendimento.getLeito(), atendimento.getQuarto(), atendimento.getUnidadeFuncional()); } /** * Retornar informação referente ao Sumário de Alta * * @param atendimento */ public StatusSumarioAlta obterIconeSumarioAlta(AghAtendimentos atendimento) { if (atendimento == null) { throw new IllegalArgumentException(ARGUMENTO_INVALIDO); } if (atendimento.getIndPacAtendimento() == DominioPacAtendimento.N) { if (DominioControleSumarioAltaPendente.E.equals(atendimento.getCtrlSumrAltaPendente())) { return StatusSumarioAlta.SUMARIO_ALTA_NAO_ENTREGUE_SAMIS; } else { return StatusSumarioAlta.SUMARIO_ALTA_NAO_REALIZADO; } } return null; } /** * Retornar informação referente a Pendência de Documentos * * @param atendimento * @return */ public StatusPendenciaDocumento obterIconePendenciaDocumento(AghAtendimentos atendimento) { if (atendimento == null) { throw new IllegalArgumentException(ARGUMENTO_INVALIDO); } if (this.getMpmLaudoDAO().existePendenciaLaudo(atendimento)) { return StatusPendenciaDocumento.PENDENCIA_LAUDO_UTI; } return null; } public StatusPacientePesquisa obterIconePacientePesquisa(AghAtendimentos atendimento, List<Integer> listaPacientesEmProjetoPesquisa) { if (atendimento == null) { throw new IllegalArgumentException(ARGUMENTO_INVALIDO); } if (listaPacientesEmProjetoPesquisa.contains(atendimento.getPaciente().getCodigo())) { return StatusPacientePesquisa.PACIENTE_PESQUISA; } return null; } public StatusEvolucao obterIconeEvolucao(AghAtendimentos atendimento, Boolean categoria, List<MamTipoItemEvolucao> itens) throws ApplicationBusinessException { if (atendimento == null) { throw new IllegalArgumentException(ARGUMENTO_INVALIDO); } boolean origemInternacao = atendimento.getOrigem() != null ? atendimento.getOrigem().equals( DominioOrigemAtendimento.I) : false; if (origemInternacao) { List<MamEvolucoes> mamEvolucoes = this.getMamEvolucoesDAO().pesquisarEvolucoesPorAtendimento( atendimento.getSeq()); for (MamEvolucoes evolucoes : mamEvolucoes) { if (validarDataEvolucao(evolucoes)) { return validarCategoriaEnfMedOutros(evolucoes, categoria, itens); } } } return null; } /** * Retornar informação refere a situação da prescrição do paciente * * @param atendimento */ public StatusPrescricao obterIconePrescricao(AghAtendimentos atendimento, List<Short> listaUnidadesPrescricaoEletronica) { if (atendimento == null) { throw new IllegalArgumentException(ARGUMENTO_INVALIDO); } // Não buscar o ícone quando o botão 'Prescrever' estiver desabilitado. if (this.disablePrescrever(atendimento,listaUnidadesPrescricaoEletronica)) { return null; } MpmPrescricaoMedicaDAO mpmDao = this.getMpmPrescricaoMedicaDAO(); if (!mpmDao.existePrescricaoEmDia(atendimento)) { return StatusPrescricao.PRESCRICAO_NAO_REALIZADA; } else { if (!mpmDao.existePrescricaoFutura(atendimento)) { return StatusPrescricao.PRESCRICAO_VENCE_NO_DIA; } else { return StatusPrescricao.PRESCRICAO_VENCE_NO_DIA_SEGUINTE; } } } protected ICertificacaoDigitalFacade getCertificacaoDigitalFacade() { return certificacaoDigitalFacade; } /** * Retorna descrição para a localização.<br> * Retorna uma descrição de acordo com os argumentos fornecidos. * * @param leito * @param quarto * @param unidade * @return */ public String getDescricaoLocalizacao(AinLeitos leito, AinQuartos quarto, AghUnidadesFuncionais unidade) { if (leito == null && quarto == null && unidade == null) { throw new IllegalArgumentException("Pelo menos um dos argumentos deve ser fornecido."); } if (leito != null) { return String.format("L:%s", leito.getLeitoID()); } if (quarto != null) { return String.format("Q:%s", quarto.getDescricao()); } String string = String.format("U:%s %s - %s", unidade.getAndar(), unidade.getIndAla(), unidade.getDescricao()); return StringUtils.substring(string, 0, 8); } /** * Regra que habilita/desabilita os botões 'Alta', 'Óbito' e 'Antecipar * Sumário' * * @param atendimento * @return * @throws BaseException */ public boolean disableFuncionalidadeLista(AghAtendimentos atendimento, Boolean bloqueiaPacEmergencia) throws BaseException { boolean disableAltaObito = false; if (atendimento == null) { throw new IllegalArgumentException(ARGUMENTO_INVALIDO); } if (existeSumarioAltaComAltaMedica(atendimento) || existeAltaSumarioConcluido(atendimento)) { disableAltaObito = true; } if (pacienteUnidadeEmergencia(atendimento, bloqueiaPacEmergencia)) { disableAltaObito = true; } return disableAltaObito; } /** * Regra para determinar se o LABEL será 'Alta/Óbito' ou 'Sumário * Alta/Óbito' * * @param atendimento * @return * @throws BaseException */ public boolean sumarioAltaObito(AghAtendimentos atendimento) throws BaseException { boolean sumarioAltaObito = false; if (atendimento == null) { throw new IllegalArgumentException(ARGUMENTO_INVALIDO); } if (atendimento.getIndPacAtendimento() == DominioPacAtendimento.N && !DominioControleSumarioAltaPendente.E.equals(atendimento.getCtrlSumrAltaPendente())) { sumarioAltaObito = true; } return sumarioAltaObito; } /** * Retorna true se o motivo de alta for óbito. * * @param atendimento * @return retorna false se não for óbito ou não encontrou sumário de alta * ativo para o atendimento. */ public boolean isMotivoAltaObito(Integer atdSeq) throws ApplicationBusinessException { if (atdSeq == null) { throw new IllegalArgumentException(ARGUMENTO_INVALIDO); } AghAtendimentos atendimento = getAghuFacade().obterAtendimentoPeloSeq(atdSeq); if (atendimento == null) { return false; } MpmAltaSumario sumario = this.getMpmAltaSumarioDAO().obterAltaSumarios(atendimento.getSeq()); if (sumario == null || sumario.getAltaMotivos() == null) { return false; } return sumario.getAltaMotivos().getMotivoAltaMedicas().getIndObito(); } /** * Verificar se o atendimento do paciente está sendo realizado em uma * unidade de emergência * * @param atendimento * @return * @throws BaseException */ protected boolean pacienteUnidadeEmergencia(AghAtendimentos atendimento, Boolean bloqueiaPacEmergencia) throws ApplicationBusinessException { if (atendimento == null) { throw new IllegalArgumentException(ARGUMENTO_INVALIDO); } if (!bloqueiaPacEmergencia) { return false; } if (aghuFacade.possuiCaracteristicaPorUnidadeEConstante(atendimento.getUnidadeFuncional().getSeq(), ConstanteAghCaractUnidFuncionais.ATEND_EMERG_TERREO)) { return true; } return false; } /** * Verificar se existe sumário de alta cujo o motivo da alta médica tenha * sido informado * * @param atendimento * @return */ protected boolean existeSumarioAltaComAltaMedica(AghAtendimentos atendimento) { List<MpmSumarioAlta> list = new ArrayList<MpmSumarioAlta>(atendimento.getSumariosAlta()); for (MpmSumarioAlta sumarioAltas : list) { if (sumarioAltas.getMotivoAltaMedica() != null) { return true; } } return false; } /** * * Verificar se existe alta de sumários que já esteja concluído * * @param atendimento * @return */ protected boolean existeAltaSumarioConcluido(AghAtendimentos atendimento) { return getMpmAltaSumarioDAO().verificarAltaSumariosConcluido(atendimento.getSeq()); } /** * ORADB: Procedure MPMC_VER_PERM_ALTA * * @param atendimento * @throws BaseException */ private void verificarTempoPermanecia(Integer atdSeq) throws ApplicationBusinessException { if (atdSeq == null) { throw new IllegalArgumentException(ARGUMENTO_INVALIDO); } AghAtendimentos atendimento = getAghuFacade().obterAtendimentoPeloSeq(atdSeq); if (atendimento == null) { return; } Date dataAtual = DateUtil.obterDataComHoraInical(null); if (atendimento.getDthrInicio().equals(dataAtual) && atendimento.getIndPacAtendimento() == DominioPacAtendimento.S && this.verificarConvenioSus(atendimento) && getBlocoCirurgicoFacade().procedimentoCirurgicoExigeInternacao(atendimento)) { throw new ApplicationBusinessException( ListaPacientesInternadosONExceptionCode.ERRO_INTERNACAO_COM_PROCEDIMENTO_CIRURGICO_SUS); } } /** * Realizar consistências antes da chamada do sumário de alta * * @param atdSeq * @throws ApplicationBusinessException */ public void realizarConsistenciasSumarioAlta(Integer atdSeq) throws ApplicationBusinessException { RapServidores servidorLogado = getServidorLogadoFacade().obterServidorLogado(); if (!getICascaFacade().usuarioTemPermissao(servidorLogado.getUsuario(), "pesquisarListaPacientesInternados", "acessarSumarioAlta")) { throw new ApplicationBusinessException(ListaPacientesInternadosONExceptionCode.ERRO_PERMISSAO_SUMARIO_ALTA); } if (atdSeq != null) { this.verificarTempoPermanecia(atdSeq); } } /** * Realizar consistências antes da chamada do sumário de óbito * * @param atdSeq * @throws ApplicationBusinessException */ public void realizarConsistenciasSumarioObito(Integer atdSeq) throws ApplicationBusinessException { RapServidores servidorLogado = getServidorLogadoFacade().obterServidorLogado(); if (!getICascaFacade().usuarioTemPermissao(servidorLogado.getUsuario(), "pesquisarListaPacientesInternados", "acessarSumarioObito")) { throw new ApplicationBusinessException(ListaPacientesInternadosONExceptionCode.ERRO_PERMISSAO_SUMARIO_OBITO); } if (atdSeq != null) { this.verificarSexoCadastrado(atdSeq); } } /** * Verificar se o paciente possui sexo cadastrado no sistema * * @param atdSeq * @throws ApplicationBusinessException */ private void verificarSexoCadastrado(Integer atdSeq) throws ApplicationBusinessException { if (atdSeq == null) { throw new IllegalArgumentException(ARGUMENTO_INVALIDO); } AghAtendimentos atendimento = getAghuFacade().obterAtendimentoPeloSeq(atdSeq); if (atendimento != null && atendimento.getPaciente() != null && atendimento.getPaciente().getSexo() == null) { throw new ApplicationBusinessException( ListaPacientesInternadosONExceptionCode.ERRO_SEXO_PACIENTE_NAO_INFORMADO); } } /** * Icone da evolucao pode ser visto apenas quando ela feita no dia * * @param mamEvolucoes */ private boolean validarDataEvolucao(MamEvolucoes mamEvolucoes) { Calendar dataHoje = Calendar.getInstance(); Calendar dataValida = Calendar.getInstance(); dataHoje.setTime(new Date()); boolean hoje = false; boolean dataHoraMovimentacao = false; dataValida.setTime(mamEvolucoes.getDthrValida()); hoje = dataHoje.get(Calendar.YEAR) == dataValida.get(Calendar.YEAR) && dataHoje.get(Calendar.DAY_OF_YEAR) == dataValida.get(Calendar.DAY_OF_YEAR); dataHoraMovimentacao = mamEvolucoes.getDthrValidaMvto() == null ? true : false; return hoje && dataHoraMovimentacao; } /** * Apenas os profissionais dos parametros abaixo definidos podem ver o icone * evolucao * * @param mamEvolucoes * @throws ApplicationBusinessException */ private StatusEvolucao validarCategoriaEnfMedOutros(MamEvolucoes mamEvolucoes, Boolean categoria, List<MamTipoItemEvolucao> itens) throws ApplicationBusinessException { if (Boolean.FALSE.equals(categoria)) { return StatusEvolucao.EVOLUCAO; } else if (Boolean.TRUE.equals(categoria)) { for (MamTipoItemEvolucao mamTipoItemEvolucao : itens) { if (this.getMamItemEvolucoesDAO().pesquisarExisteItemEvolucaoPorEvolucaoTipoItem(mamEvolucoes.getSeq(), mamTipoItemEvolucao.getSeq())) { return StatusEvolucao.EVOLUCAO; } } } return null; } /** * Realizar consistências antes da chamada de Diagnósticos * * @param atdSeq * @throws ApplicationBusinessException */ public void realizarConsistenciasDiagnosticos() throws ApplicationBusinessException { RapServidores servidorLogado = getServidorLogadoFacade().obterServidorLogado(); if (!getICascaFacade().usuarioTemPermissao(servidorLogado.getUsuario(), "pesquisarListaPacientesInternados", "acessarDiagnosticos")) { throw new ApplicationBusinessException(ListaPacientesInternadosONExceptionCode.ERRO_PERMISSAO_DIAGNOSTICOS); } } /** * Verificar se o convênio do atendimento é SUS * * @param atendimento * @return * @throws BaseException */ public boolean verificarConvenioSus(AghAtendimentos atendimento) throws ApplicationBusinessException { boolean isConvenioSus = false; if (atendimento == null || atendimento.getInternacao() == null || atendimento.getInternacao().getConvenioSaude() == null || atendimento.getInternacao().getConvenioSaude().getPagador() == null || atendimento.getInternacao().getConvenioSaude().getPagador().getSeq() == null) { return isConvenioSus; } AghParametros convenioSus = getParametroFacade().buscarAghParametro(AghuParametrosEnum.P_CONVENIO_SUS); if (atendimento.getInternacao().getConvenioSaude().getPagador().getSeq() == convenioSus.getVlrNumerico() .shortValue()) { isConvenioSus = true; } return isConvenioSus; } public Integer recuperarAtendimentoPaciente(Integer altanAtdSeq) throws ApplicationBusinessException { return this.getAghuFacade().recuperarAtendimentoPaciente(altanAtdSeq); } protected IAghuFacade getAghuFacade() { return aghuFacade; } protected ICascaFacade getCascaFacade() { return cascaFacade; } protected MpmPrescricaoMedicaDAO getMpmPrescricaoMedicaDAO() { return mpmPrescricaoMedicaDAO; } protected IParametroFacade getParametroFacade() { return parametroFacade; } protected IBlocoCirurgicoFacade getBlocoCirurgicoFacade() { return blocoCirurgicoFacade; } protected IRegistroColaboradorFacade getRegistroColaboradorFacade() { return this.registroColaboradorFacade; } protected MpmLaudoDAO getMpmLaudoDAO() { return mpmLaudoDAO; } protected MpmAltaSumarioDAO getMpmAltaSumarioDAO() { return mpmAltaSumarioDAO; } protected ICascaFacade getICascaFacade() { return this.cascaFacade; } protected MpmListaServEquipeDAO getMpmListaServEquipeDAO() { return mpmListaServEquipeDAO; } protected MpmListaServResponsavelDAO getMpmListaServResponsavelDAO() { return mpmListaServResponsavelDAO; } protected MpmListaPacCpaDAO getMpmListaPacCpaDAO() { return mpmListaPacCpaDAO; } protected IServidorLogadoFacade getServidorLogadoFacade() { return this.servidorLogadoFacade; } protected AelItemSolicitacaoExameDAO getAelItemSolicitacaoExameDAO() { return aelItemSolicitacaoExameDAO; } protected AelProjetoPacientesDAO getAelProjetoPacientesDAO() { return aelProjetoPacientesDAO; } protected MamEvolucoesDAO getMamEvolucoesDAO() { return mamEvolucoesDAO; } protected MamTipoItemEvolucaoDAO getMamTipoItemEvolucaoDAO() { return mamTipoItemEvolucaoDAO; } protected MamItemEvolucoesDAO getMamItemEvolucoesDAO() { return mamItemEvolucoesDAO; } public MpmAnamnesesDAO getMpmAnamnesesDAO() { return mpmAnamnesesDAO; } public void setMpmAnamnesesDAO(MpmAnamnesesDAO mpmAnamnesesDAO) { this.mpmAnamnesesDAO = mpmAnamnesesDAO; } public void setMamEvolucoesDAO(MamEvolucoesDAO mamEvolucoesDAO) { this.mamEvolucoesDAO = mamEvolucoesDAO; } public MpmEvolucoesDAO getMpmEvolucoesDAO() { return mpmEvolucoesDAO; } public void setMpmEvolucoesDAO(MpmEvolucoesDAO mpmEvolucoesDAO) { this.mpmEvolucoesDAO = mpmEvolucoesDAO; } }
UTF-8
Java
37,184
java
ListaPacientesInternadosON.java
Java
[]
null
[]
package br.gov.mec.aghu.prescricaomedica.business; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.HashSet; import java.util.List; import javax.ejb.EJB; import javax.ejb.Stateless; import javax.inject.Inject; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import br.gov.mec.aghu.aghparametros.business.IParametroFacade; import br.gov.mec.aghu.aghparametros.util.AghuParametrosEnum; import br.gov.mec.aghu.ambulatorio.dao.MamEvolucoesDAO; import br.gov.mec.aghu.ambulatorio.dao.MamItemEvolucoesDAO; import br.gov.mec.aghu.ambulatorio.dao.MamTipoItemEvolucaoDAO; import br.gov.mec.aghu.blococirurgico.business.IBlocoCirurgicoFacade; import br.gov.mec.aghu.business.IAghuFacade; import br.gov.mec.aghu.casca.business.ICascaFacade; import br.gov.mec.aghu.certificacaodigital.business.ICertificacaoDigitalFacade; import br.gov.mec.aghu.constante.ConstanteAghCaractUnidFuncionais; import br.gov.mec.aghu.controleinfeccao.dao.MciNotificacaoGmrDAO; import br.gov.mec.aghu.core.business.BaseBusiness; import br.gov.mec.aghu.core.exception.ApplicationBusinessException; import br.gov.mec.aghu.core.exception.BaseException; import br.gov.mec.aghu.core.exception.BusinessExceptionCode; import br.gov.mec.aghu.core.utils.DateUtil; import br.gov.mec.aghu.dominio.DominioControleSumarioAltaPendente; import br.gov.mec.aghu.dominio.DominioIndPendenteAmbulatorio; import br.gov.mec.aghu.dominio.DominioOrigemAtendimento; import br.gov.mec.aghu.dominio.DominioPacAtendimento; import br.gov.mec.aghu.dominio.DominioSimNao; import br.gov.mec.aghu.exames.dao.AelItemSolicitacaoExameDAO; import br.gov.mec.aghu.exames.dao.AelProjetoPacientesDAO; import br.gov.mec.aghu.model.AghAtendimentos; import br.gov.mec.aghu.model.AghParametros; import br.gov.mec.aghu.model.AghUnidadesFuncionais; import br.gov.mec.aghu.model.AinLeitos; import br.gov.mec.aghu.model.AinQuartos; import br.gov.mec.aghu.model.CseCategoriaProfissional; import br.gov.mec.aghu.model.MamEvolucoes; import br.gov.mec.aghu.model.MamTipoItemEvolucao; import br.gov.mec.aghu.model.MpmAltaSumario; import br.gov.mec.aghu.model.MpmAnamneses; import br.gov.mec.aghu.model.MpmSumarioAlta; import br.gov.mec.aghu.model.RapServidores; import br.gov.mec.aghu.prescricaomedica.dao.MpmAltaSumarioDAO; import br.gov.mec.aghu.prescricaomedica.dao.MpmAnamnesesDAO; import br.gov.mec.aghu.prescricaomedica.dao.MpmEvolucoesDAO; import br.gov.mec.aghu.prescricaomedica.dao.MpmLaudoDAO; import br.gov.mec.aghu.prescricaomedica.dao.MpmListaPacCpaDAO; import br.gov.mec.aghu.prescricaomedica.dao.MpmListaServEquipeDAO; import br.gov.mec.aghu.prescricaomedica.dao.MpmListaServResponsavelDAO; import br.gov.mec.aghu.prescricaomedica.dao.MpmPrescricaoMedicaDAO; import br.gov.mec.aghu.prescricaomedica.dao.VMpmListaPacInternadosDAO; import br.gov.mec.aghu.prescricaomedica.vo.PacienteListaProfissionalVO; import br.gov.mec.aghu.prescricaomedica.vo.PacienteListaProfissionalVO.StatusAltaObito; import br.gov.mec.aghu.prescricaomedica.vo.PacienteListaProfissionalVO.StatusAnamneseEvolucao; import br.gov.mec.aghu.prescricaomedica.vo.PacienteListaProfissionalVO.StatusCertificaoDigital; import br.gov.mec.aghu.prescricaomedica.vo.PacienteListaProfissionalVO.StatusEvolucao; import br.gov.mec.aghu.prescricaomedica.vo.PacienteListaProfissionalVO.StatusExamesNaoVistos; import br.gov.mec.aghu.prescricaomedica.vo.PacienteListaProfissionalVO.StatusPacientePesquisa; import br.gov.mec.aghu.prescricaomedica.vo.PacienteListaProfissionalVO.StatusPendenciaDocumento; import br.gov.mec.aghu.prescricaomedica.vo.PacienteListaProfissionalVO.StatusPrescricao; import br.gov.mec.aghu.prescricaomedica.vo.PacienteListaProfissionalVO.StatusSumarioAlta; import br.gov.mec.aghu.registrocolaborador.business.IRegistroColaboradorFacade; import br.gov.mec.aghu.registrocolaborador.business.IServidorLogadoFacade; @SuppressWarnings("PMD.AghuTooManyMethods") @Stateless public class ListaPacientesInternadosON extends BaseBusiness { private static final String ARGUMENTO_INVALIDO = "Argumento inválido"; private static final Log LOG = LogFactory.getLog(ListaPacientesInternadosON.class); @Override @Deprecated protected Log getLogger() { return LOG; } @EJB private IServidorLogadoFacade servidorLogadoFacade; @Inject private MpmAltaSumarioDAO mpmAltaSumarioDAO; @Inject private MamEvolucoesDAO mamEvolucoesDAO; @EJB private ICascaFacade cascaFacade; @Inject private MpmListaServResponsavelDAO mpmListaServResponsavelDAO; @Inject private MpmListaServEquipeDAO mpmListaServEquipeDAO; @Inject private AelItemSolicitacaoExameDAO aelItemSolicitacaoExameDAO; @Inject private AelProjetoPacientesDAO aelProjetoPacientesDAO; @EJB private IRegistroColaboradorFacade registroColaboradorFacade; @EJB private IParametroFacade parametroFacade; @EJB private IAghuFacade aghuFacade; @Inject private MpmLaudoDAO mpmLaudoDAO; @Inject private MpmPrescricaoMedicaDAO mpmPrescricaoMedicaDAO; @EJB private IBlocoCirurgicoFacade blocoCirurgicoFacade; @Inject private MpmListaPacCpaDAO mpmListaPacCpaDAO; @Inject private MamTipoItemEvolucaoDAO mamTipoItemEvolucaoDAO; @Inject private MamItemEvolucoesDAO mamItemEvolucoesDAO; @Inject private VMpmListaPacInternadosDAO vMpmListaPacInternadosDAO; @EJB private ICertificacaoDigitalFacade certificacaoDigitalFacade; @Inject private MciNotificacaoGmrDAO mciNotificacaoGmrDAO; @Inject private MpmAnamnesesDAO mpmAnamnesesDAO; @Inject private MpmEvolucoesDAO mpmEvolucoesDAO; private static final long serialVersionUID = 4177536088062626713L; public enum ListaPacientesInternadosONExceptionCode implements BusinessExceptionCode { ERRO_INTERNACAO_COM_PROCEDIMENTO_CIRURGICO_SUS, ERRO_PERMISSAO_SUMARIO_ALTA, ERRO_PERMISSAO_SUMARIO_OBITO, ERRO_SEXO_PACIENTE_NAO_INFORMADO, ERRO_PERMISSAO_DIAGNOSTICOS; } /** * Retorna a lista de pacientes internados do profissional fornecido, sem as * flags de status, habilita/desabilita botões, etc.<br /> * * @param servidor * @return */ public List<PacienteListaProfissionalVO> pesquisarListaPacientesResumo(RapServidores servidor) { List<PacienteListaProfissionalVO> result = new ArrayList<PacienteListaProfissionalVO>(); List<AghAtendimentos> atendimentosEquipe = this.pesquisarAtendimentosEquipe(servidor); for (AghAtendimentos atendimento : atendimentosEquipe) { PacienteListaProfissionalVO vo = new PacienteListaProfissionalVO(atendimento); vo.setLocal(this.getDescricaoLocalizacao(atendimento)); // se necessário mais dados no VO, verificar método // pesquisarListaPacientes result.add(vo); } return result; } /** * Retorna a lista de pacientes internados do profissional fornecido. * * @param servidor * @return * @throws BaseException */ public List<PacienteListaProfissionalVO> pesquisarListaPacientes(RapServidores servidor) throws BaseException { if (servidor == null) { throw new IllegalArgumentException("Argumento inválido."); } List<PacienteListaProfissionalVO> result = new ArrayList<PacienteListaProfissionalVO>(); if (isUsarBusca(AghuParametrosEnum.PME_LISTA_PACIENTES_USAR_BUSCA_OTIMIZADA)) { List<PacienteListaProfissionalVO> listaOtimizada = vMpmListaPacInternadosDAO.buscaListaPacientesInternados(servidor); result.addAll(listaOtimizada); } else { final String SIGLA_TIPO_ITEM_EVOLUCAO = "C"; List<Integer> listaPacientesProjetoPesquisa = new ArrayList<Integer>(); List<Integer> listaPacientesComPendencia = new ArrayList<Integer>(); List<Short> listaUnidadesPrescricaoEletronica = new ArrayList<Short>(); List<AghAtendimentos> listaPaciente = pesquisarAtendimentosEquipe(servidor); obterCodigosComPendenciasComProjetoPesquisa(listaPaciente, listaPacientesComPendencia, listaPacientesProjetoPesquisa, listaUnidadesPrescricaoEletronica); Boolean categoria = validarCategoriaProfissional(); List<MamTipoItemEvolucao> itensEvolucao = getMamTipoItemEvolucaoDAO().pesquisarListaTipoItemEvoulucaoPelaSigla( SIGLA_TIPO_ITEM_EVOLUCAO); Boolean bloqueiaPacEmergencia = DominioSimNao.S.toString().equals( this.getParametroFacade().buscarValorTexto(AghuParametrosEnum.P_BLOQUEIA_PAC_EMERG)); for (AghAtendimentos atendimento : listaPaciente) { PacienteListaProfissionalVO vo = new PacienteListaProfissionalVO(atendimento); vo.setPossuiPlanoAltas(verificarPossuiPlanoAlta(atendimento)); vo.setLocal(this.getDescricaoLocalizacao(atendimento)); vo.setStatusPrescricao(obterIconePrescricao(atendimento, listaUnidadesPrescricaoEletronica)); vo.setStatusSumarioAlta(obterIconeSumarioAlta(atendimento)); vo.setStatusExamesNaoVistos(obterIconeResultadoExames(atendimento.getSeq(), servidor)); vo.setStatusPendenciaDocumento(obterIconePendenciaDocumento(atendimento)); vo.setStatusPacientePesquisa(obterIconePacientePesquisa(atendimento, listaPacientesProjetoPesquisa)); vo.setStatusEvolucao(obterIconeEvolucao(atendimento, categoria, itensEvolucao)); if (listaPacientesComPendencia.contains(atendimento.getPaciente().getCodigo())) { vo.setStatusCertificacaoDigital(StatusCertificaoDigital.PENDENTE); } else { vo.setStatusCertificacaoDigital(null); } // habilita/desabilita 'Alta/Obito/Antecipar Sumário' da lista vo.setDisableButtonAltaObito(this.disableFuncionalidadeLista(atendimento, bloqueiaPacEmergencia)); // habilita/desabilita 'Prescrever' da lista vo.setDisableButtonPrescrever(this.disablePrescrever(atendimento, listaUnidadesPrescricaoEletronica)); if (this.sumarioAltaObito(atendimento)) { vo.setLabelAlta(StatusAltaObito.SUMARIO_ALTA); vo.setLabelObito(StatusAltaObito.SUMARIO_OBITO); } else { vo.setLabelAlta(StatusAltaObito.ALTA); vo.setLabelObito(StatusAltaObito.OBITO); } vo.setEnableButtonAnamneseEvolucao(this.habilitarBotaoAnamneseEvolucao(vo.getAtdSeq(), vo.isDisableButtonPrescrever(), vo.isDisableButtonAltaObito())); vo.setStatusAnamneseEvolucao(this.obterIconeAnamneseEvolucao(vo.getAtdSeq(), vo.isEnableButtonAnamneseEvolucao())); vo.setIndGmr(mciNotificacaoGmrDAO.verificarNotificacaoGmrPorCodigo(atendimento.getPaciente().getCodigo())); // adiciona na coleção result.add(vo); } } return result; } /* * Verifica a existencia de parametro de sistema para buscar pela View.<br/> * * Caso nao exista o parametro definido ou o valor seja diferente de 'S', entao<br/> * Executa a busca usando a regras implementadas no codigo java. Fazendo varios acessos a banco. */ private boolean isUsarBusca(AghuParametrosEnum enumParametro) { if (parametroFacade.verificarExisteAghParametro(enumParametro)) { AghParametros param = parametroFacade.getAghParametro(enumParametro); String strUsarView = "N"; if (param != null) { strUsarView = param.getVlrTexto(); } return ("S".equalsIgnoreCase(strUsarView)); } return false; } private Boolean validarCategoriaProfissional() throws ApplicationBusinessException { // busca qual é a categoria profissional enfermagem final Integer catefProfEnf = getParametroFacade().buscarValorInteiro(AghuParametrosEnum.P_CATEG_PROF_ENF); // busca qual é a categoria profissional médico final Integer catefProfMed = getParametroFacade().buscarValorInteiro(AghuParametrosEnum.P_CATEG_PROF_MEDICO); // categoria outros profissionais final Integer cateOutros = getParametroFacade().buscarValorInteiro(AghuParametrosEnum.P_CATEG_PROF_OUTROS); final List<CseCategoriaProfissional> categorias = getCascaFacade().pesquisarCategoriaProfissional(this.getServidorLogadoFacade().obterServidorLogado()); if(!categorias.isEmpty()){ CseCategoriaProfissional categoria = categorias.get(0); if(catefProfMed == categoria.getSeq() || cateOutros == categoria.getSeq()){ return false; } else if (catefProfEnf == categoria.getSeq()){ return true; } } return null; } public void obterCodigosComPendenciasComProjetoPesquisa(List<AghAtendimentos> listaPaciente, List<Integer> listaPacientesComPendencia, List<Integer> listaPacientesEmProjetoPesquisa, List<Short> listaUnidadesPrescricaoEletronica){ List<Object[]> listaPacientesPendencias = null; List<Object[]> listaPacientesPesquisa = null; List<Integer> listaPacCodigo = new ArrayList<Integer>(); HashSet<Short> HasUnidades = new HashSet<Short>(); for (AghAtendimentos atendimento: listaPaciente){ listaPacCodigo.add(atendimento.getPaciente().getCodigo()); HasUnidades.add(atendimento.getUnidadeFuncional().getSeq()); } if (!listaPaciente.isEmpty()){ listaPacientesPendencias = this.getCertificacaoDigitalFacade().countVersaoPacientes(listaPacCodigo); for (Object[] vetorObject: listaPacientesPendencias){ listaPacientesComPendencia.add((Integer)vetorObject[0]); } listaPacientesPesquisa = this.getAelProjetoPacientesDAO().verificaPacienteEmProjetoPesquisa(listaPacCodigo); for (Object[] vetorObject: listaPacientesPesquisa){ listaPacientesEmProjetoPesquisa.add((Integer)vetorObject[0]); } for(Short unidade : new ArrayList<Short>(HasUnidades)) { if(aghuFacade.possuiCaracteristicaPorUnidadeEConstante(unidade, ConstanteAghCaractUnidFuncionais.PME_INFORMATIZADA)) { listaUnidadesPrescricaoEletronica.add(unidade); } } } } private StatusExamesNaoVistos obterIconeResultadoExames( Integer atdSeq, RapServidores servidor) { if(getAelItemSolicitacaoExameDAO().pesquisarExamesResultadoNaoVisualizado(atdSeq)){ return StatusExamesNaoVistos.RESULTADOS_NAO_VISUALIZADOS; } else if (getAelItemSolicitacaoExameDAO().pesquisarExamesResultadoVisualizadoOutroMedico(atdSeq, servidor)){ return StatusExamesNaoVistos.RESULTADOS_VISUALIZADOS_OUTRO_MEDICO; } else { return null; } } /*** * Método realiza pesquisa sobre as entidades AghAtendimentos e * MpmControlPrevAltas, para verifica se existe alguma previsão de alta * marcada para as proximas 48 hrs * * @param seq * @return */ public boolean verificarPossuiPlanoAlta(AghAtendimentos atendimento) { if (atendimento == null) { return false; } else { if (DominioOrigemAtendimento.I.equals(atendimento.getOrigem())) { return verificarPossuiPlanoAltaAtendimento(atendimento.getSeq()); } else if (DominioOrigemAtendimento.N.equals(atendimento.getOrigem())) { if (atendimento.getAtendimentoMae() == null) { return false; } if (DominioOrigemAtendimento.I.equals(atendimento.getAtendimentoMae().getOrigem())) { return verificarPossuiPlanoAltaAtendimento(atendimento.getAtendimentoMae().getSeq()); } else if (DominioOrigemAtendimento.N.equals(atendimento.getOrigem())) { return false; } } } return false; } private boolean verificarPossuiPlanoAltaAtendimento(Integer seq) { Object[] prescricaoMedicaVO = mpmPrescricaoMedicaDAO.verificarPossuiPlanoAlta(seq); if (prescricaoMedicaVO != null && prescricaoMedicaVO[0] != null && DominioSimNao.S.toString().equals(prescricaoMedicaVO[1])) { Integer diferencaDias = DateUtil.diffInDaysInteger((Date) prescricaoMedicaVO[0], new Date()); if (diferencaDias >= 0 && diferencaDias <= 2) { return true; } } return false; } public void obterCodigosComPendenciasComProjetoPesquisa(List<AghAtendimentos> listaPaciente, List<Integer> listaPacientesComPendencia, List<Integer> listaPacientesEmProjetoPesquisa) { List<Object[]> listaPacientesPendencias = null; List<Object[]> listaPacientesPesquisa = null; List<Integer> listaPacCodigo = new ArrayList<Integer>(); for (AghAtendimentos atendimento : listaPaciente) { listaPacCodigo.add(atendimento.getPaciente().getCodigo()); } if (!listaPaciente.isEmpty()) { listaPacientesPendencias = this.getCertificacaoDigitalFacade().countVersaoPacientes(listaPacCodigo); for (Object[] vetorObject : listaPacientesPendencias) { listaPacientesComPendencia.add((Integer) vetorObject[0]); } listaPacientesPesquisa = this.getAelProjetoPacientesDAO().verificaPacienteEmProjetoPesquisa(listaPacCodigo); for (Object[] vetorObject : listaPacientesPesquisa) { listaPacientesEmProjetoPesquisa.add((Integer) vetorObject[0]); } } } /** * Retorna os atendimentos do servidor fornecido.<br /> * Atendimentos na equipe, atendimentos pelo responsável da equipe e * atendimentos em acompanhamento pelo servidor fornecido. * * @param servidor * @return */ private List<AghAtendimentos> pesquisarAtendimentosEquipe(RapServidores servidor) { // servidor = // this.getRegistroColaboradorFacade().buscaServidor(servidor.getId()); // 3. pacientes em atendimento na equipe final List<RapServidores> pacAtdEqpResp = this.getMpmListaServEquipeDAO() .listaProfissionaisRespEquipe(servidor); // 3.1. pacientes em atendimento pelo responsável pacAtdEqpResp.addAll(this.getMpmListaServResponsavelDAO().listaProfissionaisResponsaveis(servidor)); // 4. pacientes em acompanhamento pelo profissional boolean mostrarPacientesCpa = getMpmListaPacCpaDAO().mostrarPacientesCpas(servidor); List<AghAtendimentos> listaPaciente = getAghuFacade().listarPaciente(servidor, pacAtdEqpResp, mostrarPacientesCpa); return listaPaciente; } private StatusAnamneseEvolucao obterIconeAnamneseEvolucao(Integer atdSeq, boolean enableButtonAnamneseEvolucao) { if(enableButtonAnamneseEvolucao) { MpmAnamneses anamnese = this.getMpmAnamnesesDAO().obterAnamneseAtendimento(atdSeq); if(anamnese == null || (anamnese != null && anamnese.getPendente() == DominioIndPendenteAmbulatorio.R)) { return StatusAnamneseEvolucao.ANAMNESE_NAO_REALIZADA; } if(anamnese != null && anamnese.getPendente() == DominioIndPendenteAmbulatorio.P) { return StatusAnamneseEvolucao.ANAMNESE_PENDENTE; } if(anamnese != null && anamnese.getPendente() == DominioIndPendenteAmbulatorio.V) { //Data Atual Zerada Date dataReferencia = DateUtils.truncate(new Date(), Calendar.DAY_OF_MONTH); if(!this.getMpmEvolucoesDAO().verificarEvolucaoRealizadaPorSituacao(anamnese.getSeq(), DominioIndPendenteAmbulatorio.R, dataReferencia, false)) { return StatusAnamneseEvolucao.EVOLUCAO_DO_DIA_NAO_REALIZADA; } if(this.getMpmEvolucoesDAO().verificarEvolucaoRealizadaPorSituacao(anamnese.getSeq(), DominioIndPendenteAmbulatorio.P, dataReferencia, true)) { return StatusAnamneseEvolucao.EVOLUCAO_DO_DIA_PENDENTE; } if(!this.getMpmEvolucoesDAO().verificarEvolucaoSeguinteRealizadaPorSituacao(anamnese.getSeq(), DominioIndPendenteAmbulatorio.V, dataReferencia)) { return StatusAnamneseEvolucao.EVOLUCAO_VENCE_NO_DIA_SEGUINTE; } } } return null; } private boolean habilitarBotaoAnamneseEvolucao(Integer atdSeq, boolean disableButtonPrescrever, boolean disableButtonAltaObito) { if (atdSeq != null) { AghAtendimentos atendimento = this.getAghuFacade().obterAtendimentoEmAndamento(atdSeq); if(atendimento != null && !disableButtonPrescrever && !disableButtonAltaObito){ if(this.getAghuFacade().verificarCaracteristicaUnidadeFuncional(atendimento.getUnidadeFuncional().getSeq(), ConstanteAghCaractUnidFuncionais.ANAMNESE_EVOLUCAO_ELETRONICA)) { return true; } } } return false; } /** * Regra para habilitar/desabilitar o botão 'Prescrever' * * @param atendimento * @return */ private boolean disablePrescrever(AghAtendimentos atendimento, List<Short> listaUnidadesPrescricaoEletronica) { if (atendimento == null) { throw new IllegalArgumentException(ARGUMENTO_INVALIDO); } if (listaUnidadesPrescricaoEletronica.contains(atendimento.getUnidadeFuncional().getSeq()) && DominioPacAtendimento.S.equals(atendimento.getIndPacAtendimento())) { return false; } else { return true; } } /** * Retorna a descrição para a localização atual do atendimento fornecido. * * @param atendimento * @return */ public String getDescricaoLocalizacao(AghAtendimentos atendimento) { if (atendimento == null) { throw new IllegalArgumentException(ARGUMENTO_INVALIDO); } return this.getDescricaoLocalizacao(atendimento.getLeito(), atendimento.getQuarto(), atendimento.getUnidadeFuncional()); } /** * Retornar informação referente ao Sumário de Alta * * @param atendimento */ public StatusSumarioAlta obterIconeSumarioAlta(AghAtendimentos atendimento) { if (atendimento == null) { throw new IllegalArgumentException(ARGUMENTO_INVALIDO); } if (atendimento.getIndPacAtendimento() == DominioPacAtendimento.N) { if (DominioControleSumarioAltaPendente.E.equals(atendimento.getCtrlSumrAltaPendente())) { return StatusSumarioAlta.SUMARIO_ALTA_NAO_ENTREGUE_SAMIS; } else { return StatusSumarioAlta.SUMARIO_ALTA_NAO_REALIZADO; } } return null; } /** * Retornar informação referente a Pendência de Documentos * * @param atendimento * @return */ public StatusPendenciaDocumento obterIconePendenciaDocumento(AghAtendimentos atendimento) { if (atendimento == null) { throw new IllegalArgumentException(ARGUMENTO_INVALIDO); } if (this.getMpmLaudoDAO().existePendenciaLaudo(atendimento)) { return StatusPendenciaDocumento.PENDENCIA_LAUDO_UTI; } return null; } public StatusPacientePesquisa obterIconePacientePesquisa(AghAtendimentos atendimento, List<Integer> listaPacientesEmProjetoPesquisa) { if (atendimento == null) { throw new IllegalArgumentException(ARGUMENTO_INVALIDO); } if (listaPacientesEmProjetoPesquisa.contains(atendimento.getPaciente().getCodigo())) { return StatusPacientePesquisa.PACIENTE_PESQUISA; } return null; } public StatusEvolucao obterIconeEvolucao(AghAtendimentos atendimento, Boolean categoria, List<MamTipoItemEvolucao> itens) throws ApplicationBusinessException { if (atendimento == null) { throw new IllegalArgumentException(ARGUMENTO_INVALIDO); } boolean origemInternacao = atendimento.getOrigem() != null ? atendimento.getOrigem().equals( DominioOrigemAtendimento.I) : false; if (origemInternacao) { List<MamEvolucoes> mamEvolucoes = this.getMamEvolucoesDAO().pesquisarEvolucoesPorAtendimento( atendimento.getSeq()); for (MamEvolucoes evolucoes : mamEvolucoes) { if (validarDataEvolucao(evolucoes)) { return validarCategoriaEnfMedOutros(evolucoes, categoria, itens); } } } return null; } /** * Retornar informação refere a situação da prescrição do paciente * * @param atendimento */ public StatusPrescricao obterIconePrescricao(AghAtendimentos atendimento, List<Short> listaUnidadesPrescricaoEletronica) { if (atendimento == null) { throw new IllegalArgumentException(ARGUMENTO_INVALIDO); } // Não buscar o ícone quando o botão 'Prescrever' estiver desabilitado. if (this.disablePrescrever(atendimento,listaUnidadesPrescricaoEletronica)) { return null; } MpmPrescricaoMedicaDAO mpmDao = this.getMpmPrescricaoMedicaDAO(); if (!mpmDao.existePrescricaoEmDia(atendimento)) { return StatusPrescricao.PRESCRICAO_NAO_REALIZADA; } else { if (!mpmDao.existePrescricaoFutura(atendimento)) { return StatusPrescricao.PRESCRICAO_VENCE_NO_DIA; } else { return StatusPrescricao.PRESCRICAO_VENCE_NO_DIA_SEGUINTE; } } } protected ICertificacaoDigitalFacade getCertificacaoDigitalFacade() { return certificacaoDigitalFacade; } /** * Retorna descrição para a localização.<br> * Retorna uma descrição de acordo com os argumentos fornecidos. * * @param leito * @param quarto * @param unidade * @return */ public String getDescricaoLocalizacao(AinLeitos leito, AinQuartos quarto, AghUnidadesFuncionais unidade) { if (leito == null && quarto == null && unidade == null) { throw new IllegalArgumentException("Pelo menos um dos argumentos deve ser fornecido."); } if (leito != null) { return String.format("L:%s", leito.getLeitoID()); } if (quarto != null) { return String.format("Q:%s", quarto.getDescricao()); } String string = String.format("U:%s %s - %s", unidade.getAndar(), unidade.getIndAla(), unidade.getDescricao()); return StringUtils.substring(string, 0, 8); } /** * Regra que habilita/desabilita os botões 'Alta', 'Óbito' e 'Antecipar * Sumário' * * @param atendimento * @return * @throws BaseException */ public boolean disableFuncionalidadeLista(AghAtendimentos atendimento, Boolean bloqueiaPacEmergencia) throws BaseException { boolean disableAltaObito = false; if (atendimento == null) { throw new IllegalArgumentException(ARGUMENTO_INVALIDO); } if (existeSumarioAltaComAltaMedica(atendimento) || existeAltaSumarioConcluido(atendimento)) { disableAltaObito = true; } if (pacienteUnidadeEmergencia(atendimento, bloqueiaPacEmergencia)) { disableAltaObito = true; } return disableAltaObito; } /** * Regra para determinar se o LABEL será 'Alta/Óbito' ou 'Sumário * Alta/Óbito' * * @param atendimento * @return * @throws BaseException */ public boolean sumarioAltaObito(AghAtendimentos atendimento) throws BaseException { boolean sumarioAltaObito = false; if (atendimento == null) { throw new IllegalArgumentException(ARGUMENTO_INVALIDO); } if (atendimento.getIndPacAtendimento() == DominioPacAtendimento.N && !DominioControleSumarioAltaPendente.E.equals(atendimento.getCtrlSumrAltaPendente())) { sumarioAltaObito = true; } return sumarioAltaObito; } /** * Retorna true se o motivo de alta for óbito. * * @param atendimento * @return retorna false se não for óbito ou não encontrou sumário de alta * ativo para o atendimento. */ public boolean isMotivoAltaObito(Integer atdSeq) throws ApplicationBusinessException { if (atdSeq == null) { throw new IllegalArgumentException(ARGUMENTO_INVALIDO); } AghAtendimentos atendimento = getAghuFacade().obterAtendimentoPeloSeq(atdSeq); if (atendimento == null) { return false; } MpmAltaSumario sumario = this.getMpmAltaSumarioDAO().obterAltaSumarios(atendimento.getSeq()); if (sumario == null || sumario.getAltaMotivos() == null) { return false; } return sumario.getAltaMotivos().getMotivoAltaMedicas().getIndObito(); } /** * Verificar se o atendimento do paciente está sendo realizado em uma * unidade de emergência * * @param atendimento * @return * @throws BaseException */ protected boolean pacienteUnidadeEmergencia(AghAtendimentos atendimento, Boolean bloqueiaPacEmergencia) throws ApplicationBusinessException { if (atendimento == null) { throw new IllegalArgumentException(ARGUMENTO_INVALIDO); } if (!bloqueiaPacEmergencia) { return false; } if (aghuFacade.possuiCaracteristicaPorUnidadeEConstante(atendimento.getUnidadeFuncional().getSeq(), ConstanteAghCaractUnidFuncionais.ATEND_EMERG_TERREO)) { return true; } return false; } /** * Verificar se existe sumário de alta cujo o motivo da alta médica tenha * sido informado * * @param atendimento * @return */ protected boolean existeSumarioAltaComAltaMedica(AghAtendimentos atendimento) { List<MpmSumarioAlta> list = new ArrayList<MpmSumarioAlta>(atendimento.getSumariosAlta()); for (MpmSumarioAlta sumarioAltas : list) { if (sumarioAltas.getMotivoAltaMedica() != null) { return true; } } return false; } /** * * Verificar se existe alta de sumários que já esteja concluído * * @param atendimento * @return */ protected boolean existeAltaSumarioConcluido(AghAtendimentos atendimento) { return getMpmAltaSumarioDAO().verificarAltaSumariosConcluido(atendimento.getSeq()); } /** * ORADB: Procedure MPMC_VER_PERM_ALTA * * @param atendimento * @throws BaseException */ private void verificarTempoPermanecia(Integer atdSeq) throws ApplicationBusinessException { if (atdSeq == null) { throw new IllegalArgumentException(ARGUMENTO_INVALIDO); } AghAtendimentos atendimento = getAghuFacade().obterAtendimentoPeloSeq(atdSeq); if (atendimento == null) { return; } Date dataAtual = DateUtil.obterDataComHoraInical(null); if (atendimento.getDthrInicio().equals(dataAtual) && atendimento.getIndPacAtendimento() == DominioPacAtendimento.S && this.verificarConvenioSus(atendimento) && getBlocoCirurgicoFacade().procedimentoCirurgicoExigeInternacao(atendimento)) { throw new ApplicationBusinessException( ListaPacientesInternadosONExceptionCode.ERRO_INTERNACAO_COM_PROCEDIMENTO_CIRURGICO_SUS); } } /** * Realizar consistências antes da chamada do sumário de alta * * @param atdSeq * @throws ApplicationBusinessException */ public void realizarConsistenciasSumarioAlta(Integer atdSeq) throws ApplicationBusinessException { RapServidores servidorLogado = getServidorLogadoFacade().obterServidorLogado(); if (!getICascaFacade().usuarioTemPermissao(servidorLogado.getUsuario(), "pesquisarListaPacientesInternados", "acessarSumarioAlta")) { throw new ApplicationBusinessException(ListaPacientesInternadosONExceptionCode.ERRO_PERMISSAO_SUMARIO_ALTA); } if (atdSeq != null) { this.verificarTempoPermanecia(atdSeq); } } /** * Realizar consistências antes da chamada do sumário de óbito * * @param atdSeq * @throws ApplicationBusinessException */ public void realizarConsistenciasSumarioObito(Integer atdSeq) throws ApplicationBusinessException { RapServidores servidorLogado = getServidorLogadoFacade().obterServidorLogado(); if (!getICascaFacade().usuarioTemPermissao(servidorLogado.getUsuario(), "pesquisarListaPacientesInternados", "acessarSumarioObito")) { throw new ApplicationBusinessException(ListaPacientesInternadosONExceptionCode.ERRO_PERMISSAO_SUMARIO_OBITO); } if (atdSeq != null) { this.verificarSexoCadastrado(atdSeq); } } /** * Verificar se o paciente possui sexo cadastrado no sistema * * @param atdSeq * @throws ApplicationBusinessException */ private void verificarSexoCadastrado(Integer atdSeq) throws ApplicationBusinessException { if (atdSeq == null) { throw new IllegalArgumentException(ARGUMENTO_INVALIDO); } AghAtendimentos atendimento = getAghuFacade().obterAtendimentoPeloSeq(atdSeq); if (atendimento != null && atendimento.getPaciente() != null && atendimento.getPaciente().getSexo() == null) { throw new ApplicationBusinessException( ListaPacientesInternadosONExceptionCode.ERRO_SEXO_PACIENTE_NAO_INFORMADO); } } /** * Icone da evolucao pode ser visto apenas quando ela feita no dia * * @param mamEvolucoes */ private boolean validarDataEvolucao(MamEvolucoes mamEvolucoes) { Calendar dataHoje = Calendar.getInstance(); Calendar dataValida = Calendar.getInstance(); dataHoje.setTime(new Date()); boolean hoje = false; boolean dataHoraMovimentacao = false; dataValida.setTime(mamEvolucoes.getDthrValida()); hoje = dataHoje.get(Calendar.YEAR) == dataValida.get(Calendar.YEAR) && dataHoje.get(Calendar.DAY_OF_YEAR) == dataValida.get(Calendar.DAY_OF_YEAR); dataHoraMovimentacao = mamEvolucoes.getDthrValidaMvto() == null ? true : false; return hoje && dataHoraMovimentacao; } /** * Apenas os profissionais dos parametros abaixo definidos podem ver o icone * evolucao * * @param mamEvolucoes * @throws ApplicationBusinessException */ private StatusEvolucao validarCategoriaEnfMedOutros(MamEvolucoes mamEvolucoes, Boolean categoria, List<MamTipoItemEvolucao> itens) throws ApplicationBusinessException { if (Boolean.FALSE.equals(categoria)) { return StatusEvolucao.EVOLUCAO; } else if (Boolean.TRUE.equals(categoria)) { for (MamTipoItemEvolucao mamTipoItemEvolucao : itens) { if (this.getMamItemEvolucoesDAO().pesquisarExisteItemEvolucaoPorEvolucaoTipoItem(mamEvolucoes.getSeq(), mamTipoItemEvolucao.getSeq())) { return StatusEvolucao.EVOLUCAO; } } } return null; } /** * Realizar consistências antes da chamada de Diagnósticos * * @param atdSeq * @throws ApplicationBusinessException */ public void realizarConsistenciasDiagnosticos() throws ApplicationBusinessException { RapServidores servidorLogado = getServidorLogadoFacade().obterServidorLogado(); if (!getICascaFacade().usuarioTemPermissao(servidorLogado.getUsuario(), "pesquisarListaPacientesInternados", "acessarDiagnosticos")) { throw new ApplicationBusinessException(ListaPacientesInternadosONExceptionCode.ERRO_PERMISSAO_DIAGNOSTICOS); } } /** * Verificar se o convênio do atendimento é SUS * * @param atendimento * @return * @throws BaseException */ public boolean verificarConvenioSus(AghAtendimentos atendimento) throws ApplicationBusinessException { boolean isConvenioSus = false; if (atendimento == null || atendimento.getInternacao() == null || atendimento.getInternacao().getConvenioSaude() == null || atendimento.getInternacao().getConvenioSaude().getPagador() == null || atendimento.getInternacao().getConvenioSaude().getPagador().getSeq() == null) { return isConvenioSus; } AghParametros convenioSus = getParametroFacade().buscarAghParametro(AghuParametrosEnum.P_CONVENIO_SUS); if (atendimento.getInternacao().getConvenioSaude().getPagador().getSeq() == convenioSus.getVlrNumerico() .shortValue()) { isConvenioSus = true; } return isConvenioSus; } public Integer recuperarAtendimentoPaciente(Integer altanAtdSeq) throws ApplicationBusinessException { return this.getAghuFacade().recuperarAtendimentoPaciente(altanAtdSeq); } protected IAghuFacade getAghuFacade() { return aghuFacade; } protected ICascaFacade getCascaFacade() { return cascaFacade; } protected MpmPrescricaoMedicaDAO getMpmPrescricaoMedicaDAO() { return mpmPrescricaoMedicaDAO; } protected IParametroFacade getParametroFacade() { return parametroFacade; } protected IBlocoCirurgicoFacade getBlocoCirurgicoFacade() { return blocoCirurgicoFacade; } protected IRegistroColaboradorFacade getRegistroColaboradorFacade() { return this.registroColaboradorFacade; } protected MpmLaudoDAO getMpmLaudoDAO() { return mpmLaudoDAO; } protected MpmAltaSumarioDAO getMpmAltaSumarioDAO() { return mpmAltaSumarioDAO; } protected ICascaFacade getICascaFacade() { return this.cascaFacade; } protected MpmListaServEquipeDAO getMpmListaServEquipeDAO() { return mpmListaServEquipeDAO; } protected MpmListaServResponsavelDAO getMpmListaServResponsavelDAO() { return mpmListaServResponsavelDAO; } protected MpmListaPacCpaDAO getMpmListaPacCpaDAO() { return mpmListaPacCpaDAO; } protected IServidorLogadoFacade getServidorLogadoFacade() { return this.servidorLogadoFacade; } protected AelItemSolicitacaoExameDAO getAelItemSolicitacaoExameDAO() { return aelItemSolicitacaoExameDAO; } protected AelProjetoPacientesDAO getAelProjetoPacientesDAO() { return aelProjetoPacientesDAO; } protected MamEvolucoesDAO getMamEvolucoesDAO() { return mamEvolucoesDAO; } protected MamTipoItemEvolucaoDAO getMamTipoItemEvolucaoDAO() { return mamTipoItemEvolucaoDAO; } protected MamItemEvolucoesDAO getMamItemEvolucoesDAO() { return mamItemEvolucoesDAO; } public MpmAnamnesesDAO getMpmAnamnesesDAO() { return mpmAnamnesesDAO; } public void setMpmAnamnesesDAO(MpmAnamnesesDAO mpmAnamnesesDAO) { this.mpmAnamnesesDAO = mpmAnamnesesDAO; } public void setMamEvolucoesDAO(MamEvolucoesDAO mamEvolucoesDAO) { this.mamEvolucoesDAO = mamEvolucoesDAO; } public MpmEvolucoesDAO getMpmEvolucoesDAO() { return mpmEvolucoesDAO; } public void setMpmEvolucoesDAO(MpmEvolucoesDAO mpmEvolucoesDAO) { this.mpmEvolucoesDAO = mpmEvolucoesDAO; } }
37,184
0.750882
0.749832
1,060
33.014153
34.508034
230
false
false
0
0
0
0
0
0
1.890566
false
false
0
a7f26b230812f961149c38a51c4b5757e4b63700
34,763,465,341,920
c273469db3388fae800bdfcf57fe7e64aec6bc37
/FlyingSqure/src/model/Square.java
8ae28bd5456676cf94c6caeee243d767ca34cbd0
[]
no_license
eva-ng-1789/FlyingSquare
https://github.com/eva-ng-1789/FlyingSquare
ef8e5a8ec9a40f88839bf5f090db1a1ef728dd81
3adbf773c01eb3259f5fe92533e13e770693103f
refs/heads/master
2020-04-02T07:46:33.630000
2016-06-29T11:27:27
2016-06-29T11:27:27
62,218,284
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package model; import javax.imageio.ImageIO; import java.awt.*; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; /** * Created by l3ee on 2016-03-28. */ public class Square extends Sprite{ public static final int DY = 2; public static final int upDY = DY*8; protected static final int SIZE_X = 30; protected static final int SIZE_Y = 30; protected static final int SQUARE_X = SIGame.WIDTH /4; protected static final int SQUARE_Y = SIGame.HEIGHT/2; private static final Color COLOR = Color.blue; private static int counter = 0; private BufferedImage image1 ; private BufferedImage image2 ; private BufferedImage image3 ; public Square () { super(SQUARE_X, SQUARE_Y, SIZE_X, SIZE_Y); try { image1 = ImageIO.read(new File("./res/Images/Square1.PNG")); image2 = ImageIO.read(new File("./res/Images/Square2.PNG")); image3 = ImageIO.read(new File("./res/Images/Square3.PNG")); } catch (IOException ex) { image1 = null; image2 = null; image3 = null; } } @Override public void move() { if (counter > DY) { y = y - DY * 2; counter = counter - 2; } else if (counter > 0) { y = y + DY; counter = counter - 2; if (counter < 0) { counter = 0; } } else if (counter == 0){ y = y + DY*2; } super.move(); } public void moveUp() { counter = upDY*2; } @Override public void draw(Graphics g) { if (counter > DY) { if (image2 != null) { g.drawImage(image2, x-SIZE_X/2, y-SIZE_Y/2, null); return; } } else if (counter > 0) { if (image3 != null) { g.drawImage(image3, x-SIZE_X/2, y-SIZE_Y/2, null); return; } } else { if (image1 != null) { g.drawImage(image1, x-SIZE_X/2, y-SIZE_Y/2, null); return; } } Color savedCol = g.getColor(); g.setColor(COLOR); g.fillRect(getX() - SIZE_X / 2, getY() - SIZE_Y / 2, SIZE_X, SIZE_Y); g.setColor(savedCol); } }
UTF-8
Java
2,440
java
Square.java
Java
[ { "context": "\nimport java.io.IOException;\r\n\r\n/**\r\n * Created by l3ee on 2016-03-28.\r\n */\r\npublic class Square extends ", "end": 183, "score": 0.9996766448020935, "start": 179, "tag": "USERNAME", "value": "l3ee" } ]
null
[]
package model; import javax.imageio.ImageIO; import java.awt.*; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; /** * Created by l3ee on 2016-03-28. */ public class Square extends Sprite{ public static final int DY = 2; public static final int upDY = DY*8; protected static final int SIZE_X = 30; protected static final int SIZE_Y = 30; protected static final int SQUARE_X = SIGame.WIDTH /4; protected static final int SQUARE_Y = SIGame.HEIGHT/2; private static final Color COLOR = Color.blue; private static int counter = 0; private BufferedImage image1 ; private BufferedImage image2 ; private BufferedImage image3 ; public Square () { super(SQUARE_X, SQUARE_Y, SIZE_X, SIZE_Y); try { image1 = ImageIO.read(new File("./res/Images/Square1.PNG")); image2 = ImageIO.read(new File("./res/Images/Square2.PNG")); image3 = ImageIO.read(new File("./res/Images/Square3.PNG")); } catch (IOException ex) { image1 = null; image2 = null; image3 = null; } } @Override public void move() { if (counter > DY) { y = y - DY * 2; counter = counter - 2; } else if (counter > 0) { y = y + DY; counter = counter - 2; if (counter < 0) { counter = 0; } } else if (counter == 0){ y = y + DY*2; } super.move(); } public void moveUp() { counter = upDY*2; } @Override public void draw(Graphics g) { if (counter > DY) { if (image2 != null) { g.drawImage(image2, x-SIZE_X/2, y-SIZE_Y/2, null); return; } } else if (counter > 0) { if (image3 != null) { g.drawImage(image3, x-SIZE_X/2, y-SIZE_Y/2, null); return; } } else { if (image1 != null) { g.drawImage(image1, x-SIZE_X/2, y-SIZE_Y/2, null); return; } } Color savedCol = g.getColor(); g.setColor(COLOR); g.fillRect(getX() - SIZE_X / 2, getY() - SIZE_Y / 2, SIZE_X, SIZE_Y); g.setColor(savedCol); } }
2,440
0.490164
0.468033
88
25.727272
19.288908
77
false
false
0
0
0
0
0
0
0.647727
false
false
0
9d75e8119ebf5e3f17e7ebbf85395c6b6e426ee2
39,144,331,964,973
873846b332216eeeeb4b4fb94d581e53c15e0fa2
/system/src/main/Browser.java
a8140ea43a230d4b00f1d215813b0b4b86d0c63e
[]
no_license
maxbilbow/MBXJava2007
https://github.com/maxbilbow/MBXJava2007
2b8d1198ad867165d59651602d735dd259f015fd
2069ba6772c714adc7c4d9e34331ae23e79d79b2
refs/heads/master
2020-07-04T05:24:55.107000
2015-02-18T23:06:18
2015-02-18T23:06:18
30,991,939
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package main; import java.awt.Dimension; import java.sql.Connection; import java.sql.SQLException; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JMenuBar; import javax.swing.JScrollPane; import javax.swing.RepaintManager; import Database.DBGui; import diary.Diary; @SuppressWarnings("serial") public class Browser extends JFrame implements Constants{ JMenuBar menu; MyMenu file, edit, tools, help; BrowserScreen browser; //RepaintManager repaint; private static final int GUI_WIDTH = 700; private static final int GUI_HEIGHT = 600; private static final boolean password = false; LeftTree leftTree; Alerts alerts; Header header; Footer footer; Main main; LoginScreen login; Diary diary; Finance finance; Connection database; public Browser(Connection database) throws SQLException{ this.database = database; leftTree = new LeftTree(this); alerts = new Alerts(this); header = new Header(this); login = new LoginScreen(this); footer = new Footer(this); finance = new Finance(this); //Main parts main = new Main(this); diary = new Diary(this); //repaint = new RepaintManager(); init(); RepaintManager.currentManager(this); addMouseListener(Notify.NO_FUNCTION_RIGHT_CLICK); new DBGui(); } private void initA(){ browser.setMainComponent(login); } public void initB(){ createMenuBar(); setJMenuBar(menu); //footer = new Footer(this); browser.setMainComponent(new JScrollPane(main.getGui())); browser.setTopComponent(header.getGui()); browser.setBottomComponent(footer.getGui()); browser.setLeftComponent(new JScrollPane(leftTree.getGui())); browser.setRightComponent(new JScrollPane(alerts.getGui())); repaint(); browser.repaint(); } private void init(){ browser = new BrowserScreen(); add(browser); setSize(GUI_WIDTH, GUI_HEIGHT); if (password) initA(); else initB (); setVisible(true); } public void setMainComponent(){ browser.setMainComponent(new JScrollPane(new JLabel("bum"))); browser.repaint(); } public void setMainComponent(int i) throws SQLException{ switch (i){ case Settings.MAIN: browser.setMainComponent(main.getGui()); break; case Settings.DIARY: browser.setMainComponent(diary.getGui()); break; case Settings.FINANCE: browser.setMainComponent(finance.getGui()); break; case Settings.CONTACTS: Notify.defaultMessage("Access Address Book"); break; case Settings.FIVE: //Notify.defaultMessage(null); header.toggleButton(); break; } setVisible(true); } private void createMenuBar() { menu = new JMenuBar(); file = new MyMenu(this, MyMenu.FILE); tools = new MyMenu(this, MyMenu.TOOLS); help = new MyMenu(this, MyMenu.HELP); menu.add(file); menu.add(tools); menu.add(help); } public Connection getDatabase(){ return database; } public void clearData() { // TODO Auto-generated method stub } }
UTF-8
Java
3,184
java
Browser.java
Java
[]
null
[]
package main; import java.awt.Dimension; import java.sql.Connection; import java.sql.SQLException; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JMenuBar; import javax.swing.JScrollPane; import javax.swing.RepaintManager; import Database.DBGui; import diary.Diary; @SuppressWarnings("serial") public class Browser extends JFrame implements Constants{ JMenuBar menu; MyMenu file, edit, tools, help; BrowserScreen browser; //RepaintManager repaint; private static final int GUI_WIDTH = 700; private static final int GUI_HEIGHT = 600; private static final boolean password = false; LeftTree leftTree; Alerts alerts; Header header; Footer footer; Main main; LoginScreen login; Diary diary; Finance finance; Connection database; public Browser(Connection database) throws SQLException{ this.database = database; leftTree = new LeftTree(this); alerts = new Alerts(this); header = new Header(this); login = new LoginScreen(this); footer = new Footer(this); finance = new Finance(this); //Main parts main = new Main(this); diary = new Diary(this); //repaint = new RepaintManager(); init(); RepaintManager.currentManager(this); addMouseListener(Notify.NO_FUNCTION_RIGHT_CLICK); new DBGui(); } private void initA(){ browser.setMainComponent(login); } public void initB(){ createMenuBar(); setJMenuBar(menu); //footer = new Footer(this); browser.setMainComponent(new JScrollPane(main.getGui())); browser.setTopComponent(header.getGui()); browser.setBottomComponent(footer.getGui()); browser.setLeftComponent(new JScrollPane(leftTree.getGui())); browser.setRightComponent(new JScrollPane(alerts.getGui())); repaint(); browser.repaint(); } private void init(){ browser = new BrowserScreen(); add(browser); setSize(GUI_WIDTH, GUI_HEIGHT); if (password) initA(); else initB (); setVisible(true); } public void setMainComponent(){ browser.setMainComponent(new JScrollPane(new JLabel("bum"))); browser.repaint(); } public void setMainComponent(int i) throws SQLException{ switch (i){ case Settings.MAIN: browser.setMainComponent(main.getGui()); break; case Settings.DIARY: browser.setMainComponent(diary.getGui()); break; case Settings.FINANCE: browser.setMainComponent(finance.getGui()); break; case Settings.CONTACTS: Notify.defaultMessage("Access Address Book"); break; case Settings.FIVE: //Notify.defaultMessage(null); header.toggleButton(); break; } setVisible(true); } private void createMenuBar() { menu = new JMenuBar(); file = new MyMenu(this, MyMenu.FILE); tools = new MyMenu(this, MyMenu.TOOLS); help = new MyMenu(this, MyMenu.HELP); menu.add(file); menu.add(tools); menu.add(help); } public Connection getDatabase(){ return database; } public void clearData() { // TODO Auto-generated method stub } }
3,184
0.661432
0.659548
143
20.265734
16.771168
66
false
false
0
0
0
0
0
0
1.86014
false
false
0
45aa1ede8c480a7f89791be5f58bb2bd299ef6fb
35,150,012,396,326
d86f1213fd67342261b5849bdcb7fb9431164607
/src/main/java/com/architecture/example/common/Logging.java
affd24f0bd631b9ba5f839a4793930774cdeaada
[]
no_license
KarloFab/architecture-example
https://github.com/KarloFab/architecture-example
2c263024c1676cabb8cb48133b15a8c251a5948d
2b97606c0e2f0c441cf134dee743e866de4cc656
refs/heads/main
2023-08-16T06:03:00.582000
2021-10-11T07:49:52
2021-10-11T07:49:52
415,706,568
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.architecture.example.common; public class Logging { }
UTF-8
Java
67
java
Logging.java
Java
[]
null
[]
package com.architecture.example.common; public class Logging { }
67
0.791045
0.791045
4
15.75
16.528385
40
false
false
0
0
0
0
0
0
0.25
false
false
0
c4f8510c1d3e3dfc3a17aefc30940d0f91cc8fd9
35,862,976,965,229
49d0495ca756a8a2781b12d66056ee6c43207456
/Ipro/src/main/java/ozPack/Controllers/ProcessController.java
0cd2238f47c172a0ca9ed8d0bdc0a9bb1a5622e9
[]
no_license
OzGhost/Spring-Base
https://github.com/OzGhost/Spring-Base
bc9656f9af16c957395b9b3de41089158329e92f
efcc6ca48e25e103c80e5cc6cf81d1fadb4b7099
refs/heads/master
2021-01-15T22:08:48.600000
2018-07-13T15:42:58
2018-07-13T15:42:58
99,887,012
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ozPack.Controllers; import java.io.OutputStream; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import ozPack.DTOs.ProcessDto; import ozPack.DTOs.ProcessLiteDto; import ozPack.DTOs.TaskTemplateDto; import ozPack.Services.ProcessService; @RestController @RequestMapping("/process") public class ProcessController { @Autowired private ProcessService processSrv; @GetMapping public List<ProcessLiteDto> getProcesses() { return processSrv.getProcesses(); } @PostMapping public Object newProcess(@RequestBody ProcessDto dto) { dto.setId(null); processSrv.newProcess(dto); return dto; } @RequestMapping(method=RequestMethod.DELETE, value="/{id}") public String removeProcess(@PathVariable("id") Integer id) { processSrv.removeProcess(id); return ""; } @RequestMapping(method=RequestMethod.PUT) public String renameProcess(@RequestBody ProcessDto dto) { processSrv.renameProcess(dto); return ""; } @RequestMapping(value="/{id}/task", method=RequestMethod.GET) public List<TaskTemplateDto> getTasks(@PathVariable("id") Integer id) { return processSrv.getTasks(id); } @RequestMapping(value="/{id}/task", method=RequestMethod.POST) public String newTask( @RequestBody TaskTemplateDto dto, @PathVariable("id") Integer id) { processSrv.newTask(dto, id); return ""; } @RequestMapping(value="/{pid}/task/{tid}", method=RequestMethod.DELETE) public String removeTask( @PathVariable("pid") Integer pid, @PathVariable("tid") Long tid) { processSrv.removeTask(tid); return ""; } @RequestMapping(value="/{pid}/export", method=RequestMethod.POST) public String exportTask( OutputStream response, @PathVariable("pid") Integer pid ) throws Exception { processSrv.exportTask(pid).write(response); return ""; } }
UTF-8
Java
1,965
java
ProcessController.java
Java
[]
null
[]
package ozPack.Controllers; import java.io.OutputStream; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import ozPack.DTOs.ProcessDto; import ozPack.DTOs.ProcessLiteDto; import ozPack.DTOs.TaskTemplateDto; import ozPack.Services.ProcessService; @RestController @RequestMapping("/process") public class ProcessController { @Autowired private ProcessService processSrv; @GetMapping public List<ProcessLiteDto> getProcesses() { return processSrv.getProcesses(); } @PostMapping public Object newProcess(@RequestBody ProcessDto dto) { dto.setId(null); processSrv.newProcess(dto); return dto; } @RequestMapping(method=RequestMethod.DELETE, value="/{id}") public String removeProcess(@PathVariable("id") Integer id) { processSrv.removeProcess(id); return ""; } @RequestMapping(method=RequestMethod.PUT) public String renameProcess(@RequestBody ProcessDto dto) { processSrv.renameProcess(dto); return ""; } @RequestMapping(value="/{id}/task", method=RequestMethod.GET) public List<TaskTemplateDto> getTasks(@PathVariable("id") Integer id) { return processSrv.getTasks(id); } @RequestMapping(value="/{id}/task", method=RequestMethod.POST) public String newTask( @RequestBody TaskTemplateDto dto, @PathVariable("id") Integer id) { processSrv.newTask(dto, id); return ""; } @RequestMapping(value="/{pid}/task/{tid}", method=RequestMethod.DELETE) public String removeTask( @PathVariable("pid") Integer pid, @PathVariable("tid") Long tid) { processSrv.removeTask(tid); return ""; } @RequestMapping(value="/{pid}/export", method=RequestMethod.POST) public String exportTask( OutputStream response, @PathVariable("pid") Integer pid ) throws Exception { processSrv.exportTask(pid).write(response); return ""; } }
1,965
0.715522
0.715522
74
25.540541
21.392843
73
false
false
0
0
0
0
0
0
0.459459
false
false
0
bd22d7110793c2a7f71e56bdee7868d885b9032d
36,129,264,929,180
74d7b57187422ec87c97b1e6580e26c59f0015bd
/playground/src/main/java/be/nevies/game/playground/one/PlayGroundOneLauncher.java
e1c67f8c89e2311d978104b781799e6dbc3fea5d
[]
no_license
Punkiebe/NeviesGameEngine
https://github.com/Punkiebe/NeviesGameEngine
0582ee316f2521bb60bc75dacdda10ed55635d2e
19720b2f34fb6953753969cef9bd66ef8191364d
refs/heads/master
2020-05-19T07:48:03.733000
2014-09-12T09:51:39
2014-09-12T09:51:39
null
0
0
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 be.nevies.game.playground.one; import be.nevies.game.engine.core.general.GameController; import javafx.application.Application; import javafx.stage.Stage; /** * * @author drs */ public class PlayGroundOneLauncher extends Application { private GameController playGroundOne; @Override public void init() throws Exception { super.init(); playGroundOne = new PlayGroundOne(60, 30, "Play ground one."); playGroundOne.initialise(); } @Override public void start(Stage stage) throws Exception { playGroundOne.createGameScene(600, 600, stage); playGroundOne.startGameUpdateTimeline(); // ScenicView.show(stage.getScene()); stage.show(); } public static void main(String[] args) { // Set so we see debug info also System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "error"); launch(args); } @Override public void stop() throws Exception { super.stop(); System.out.println("Stop application"); playGroundOne.stop(); } }
UTF-8
Java
1,255
java
PlayGroundOneLauncher.java
Java
[ { "context": "\nimport javafx.stage.Stage;\r\n\r\n/**\r\n *\r\n * @author drs\r\n */\r\npublic class PlayGroundOneLauncher extends ", "end": 298, "score": 0.9994692206382751, "start": 295, "tag": "USERNAME", "value": "drs" } ]
null
[]
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package be.nevies.game.playground.one; import be.nevies.game.engine.core.general.GameController; import javafx.application.Application; import javafx.stage.Stage; /** * * @author drs */ public class PlayGroundOneLauncher extends Application { private GameController playGroundOne; @Override public void init() throws Exception { super.init(); playGroundOne = new PlayGroundOne(60, 30, "Play ground one."); playGroundOne.initialise(); } @Override public void start(Stage stage) throws Exception { playGroundOne.createGameScene(600, 600, stage); playGroundOne.startGameUpdateTimeline(); // ScenicView.show(stage.getScene()); stage.show(); } public static void main(String[] args) { // Set so we see debug info also System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "error"); launch(args); } @Override public void stop() throws Exception { super.stop(); System.out.println("Stop application"); playGroundOne.stop(); } }
1,255
0.627092
0.618327
46
25.282608
21.551418
78
false
false
0
0
0
0
0
0
0.521739
false
false
0
8172d4faa14c8956fc7704714f47a2f45d08ff36
36,069,135,386,177
aae833b88cfcab139bbe7f2c993aa37960545a10
/src/main/java/principal/Main.java
fef1184898b5dbad6cc107a978f7dc8027c4c49c
[]
no_license
fabriciojose/player-app
https://github.com/fabriciojose/player-app
1a8e34e75b37b8ac9cbfa0a09fe78a8866c08821
81f63fb0dde1cf85ef8449d5011171fa25031947
refs/heads/master
2020-05-24T12:53:29.483000
2019-05-24T21:38:55
2019-05-24T21:38:55
187,277,792
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package principal; import java.util.ArrayList; import java.util.List; import controladores.ControladorPlayer; import entidades.Album; import entidades.Artista; import entidades.Musica; import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Node; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.ScrollPane; import javafx.scene.layout.Pane; import javafx.scene.media.Media; import javafx.scene.media.MediaPlayer; import javafx.scene.media.MediaView; import javafx.scene.text.TextAlignment; import javafx.stage.Stage; public class Main extends Application { public static void main(String[] args) { launch(args); } Double[][] prefSizeWHeLayXY; ArrayList <Node> listComponentes; Pane p; Double dblTranslacao; Translacao translacao; @Override public void start(Stage stage) throws Exception { Label lbl_Inicio = new Label("InÝcio"); lbl_Inicio.setTextAlignment(TextAlignment.CENTER); ScrollPane sp_Albuns = new ScrollPane(); sp_Albuns.setStyle("-fx-background-color: red"); Pane pPlayer = new Pane(); Label lbl_Autor_Musica = new Label("Risquei seu nome - Bia Socek"); lbl_Autor_Musica.setTextAlignment(TextAlignment.CENTER); Button btn_Player = new Button("Play"); Pane pInferior = new Pane(); Button btn_1 = new Button("1"); Button btn_2 = new Button("2"); Button btn_3 = new Button("3"); Button btn_4 = new Button("4"); Button btn_5 = new Button("5"); prefSizeWHeLayXY = new Double[][] { {200.0,20.0,130.0,5.0}, {300.0,395.0,0.0,25.0}, {300.0,40.0,0.0,420.0}, {200.0,20.0,26.0,10.0}, {45.0,25.0,236.0,6.0}, {300.0,40.0,0.0,460.0}, {25.0,25.0,64.0,8.0}, {25.0,25.0,101.0,8.0}, {25.0,25.0,138.0,8.0}, {25.0,25.0,175.0,8.0}, {25.0,25.0,211.0,8.0}, }; listComponentes = new ArrayList<>(); listComponentes.add(lbl_Inicio); listComponentes.add(sp_Albuns); listComponentes.add(pPlayer); listComponentes.add(lbl_Autor_Musica); listComponentes.add(btn_Player); listComponentes.add(pInferior); listComponentes.add(btn_1); listComponentes.add(btn_2); listComponentes.add(btn_3); listComponentes.add(btn_4); listComponentes.add(btn_5); Componentes com = new Componentes(); com.posicionarComponentes(listComponentes, prefSizeWHeLayXY); pPlayer.getChildren().addAll(lbl_Autor_Musica, btn_Player); pInferior.getChildren().addAll(btn_1, btn_2, btn_3, btn_4, btn_5); Pane raiz = new Pane(); raiz.setPrefSize(300, 500); raiz.getChildren().addAll( lbl_Inicio, sp_Albuns, pPlayer, pInferior ); btn_Player.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { // \fxml\Player.fxml if (p == null) { p = new Pane(); translacao = new Translacao(p); translacao.subirDescerNode(800.0, 0.0); //p.setTranslateY(880.0); LeitorFXML leitorFXML = new LeitorFXML(raiz, p , new ControladorPlayer(), "/fxml/Player.fxml"); leitorFXML.abrirFXML(); } } }); Scene cena = new Scene(raiz, 300, 500); stage.setTitle("┴udio Player"); stage.setScene(cena); stage.show(); } } /* Artista artista; Album album; Musica musica; List<Musica> listPinkFloyd = new ArrayList<>(); musica = new Musica("Hey You", "/audio/pink_floyd/pink_floyd_hey_you.mp3"); listPinkFloyd.add(musica); musica = new Musica("Hey You", "/audio/pink_floyd/The_Wall.mp3"); listPinkFloyd.add(musica); musica = new Musica("Hey You", "/audio/pink_floyd/UsAndThem.mp3"); listPinkFloyd.add(musica); artista = new Artista("Pink Floyd", "Rock Progressivo"); album = new Album("The Wall" , artista, listPinkFloyd); Media media = new Media(getClass().getResource( album.getAlbListMusicas().get(0).getMusLocal()).toString()); MediaPlayer mediaPlayer = new MediaPlayer(media); MediaView mediaView = new MediaView(mediaPlayer); mediaPlayer.play(); */
IBM852
Java
4,480
java
Main.java
Java
[ { "context": "l lbl_Autor_Musica = new Label(\"Risquei seu nome - Bia Socek\");\r\n\t\tlbl_Autor_Musica.setTextAlignment(TextAlign", "end": 1314, "score": 0.9998558759689331, "start": 1305, "tag": "NAME", "value": "Bia Socek" } ]
null
[]
package principal; import java.util.ArrayList; import java.util.List; import controladores.ControladorPlayer; import entidades.Album; import entidades.Artista; import entidades.Musica; import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Node; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.ScrollPane; import javafx.scene.layout.Pane; import javafx.scene.media.Media; import javafx.scene.media.MediaPlayer; import javafx.scene.media.MediaView; import javafx.scene.text.TextAlignment; import javafx.stage.Stage; public class Main extends Application { public static void main(String[] args) { launch(args); } Double[][] prefSizeWHeLayXY; ArrayList <Node> listComponentes; Pane p; Double dblTranslacao; Translacao translacao; @Override public void start(Stage stage) throws Exception { Label lbl_Inicio = new Label("InÝcio"); lbl_Inicio.setTextAlignment(TextAlignment.CENTER); ScrollPane sp_Albuns = new ScrollPane(); sp_Albuns.setStyle("-fx-background-color: red"); Pane pPlayer = new Pane(); Label lbl_Autor_Musica = new Label("Risquei seu nome - <NAME>"); lbl_Autor_Musica.setTextAlignment(TextAlignment.CENTER); Button btn_Player = new Button("Play"); Pane pInferior = new Pane(); Button btn_1 = new Button("1"); Button btn_2 = new Button("2"); Button btn_3 = new Button("3"); Button btn_4 = new Button("4"); Button btn_5 = new Button("5"); prefSizeWHeLayXY = new Double[][] { {200.0,20.0,130.0,5.0}, {300.0,395.0,0.0,25.0}, {300.0,40.0,0.0,420.0}, {200.0,20.0,26.0,10.0}, {45.0,25.0,236.0,6.0}, {300.0,40.0,0.0,460.0}, {25.0,25.0,64.0,8.0}, {25.0,25.0,101.0,8.0}, {25.0,25.0,138.0,8.0}, {25.0,25.0,175.0,8.0}, {25.0,25.0,211.0,8.0}, }; listComponentes = new ArrayList<>(); listComponentes.add(lbl_Inicio); listComponentes.add(sp_Albuns); listComponentes.add(pPlayer); listComponentes.add(lbl_Autor_Musica); listComponentes.add(btn_Player); listComponentes.add(pInferior); listComponentes.add(btn_1); listComponentes.add(btn_2); listComponentes.add(btn_3); listComponentes.add(btn_4); listComponentes.add(btn_5); Componentes com = new Componentes(); com.posicionarComponentes(listComponentes, prefSizeWHeLayXY); pPlayer.getChildren().addAll(lbl_Autor_Musica, btn_Player); pInferior.getChildren().addAll(btn_1, btn_2, btn_3, btn_4, btn_5); Pane raiz = new Pane(); raiz.setPrefSize(300, 500); raiz.getChildren().addAll( lbl_Inicio, sp_Albuns, pPlayer, pInferior ); btn_Player.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { // \fxml\Player.fxml if (p == null) { p = new Pane(); translacao = new Translacao(p); translacao.subirDescerNode(800.0, 0.0); //p.setTranslateY(880.0); LeitorFXML leitorFXML = new LeitorFXML(raiz, p , new ControladorPlayer(), "/fxml/Player.fxml"); leitorFXML.abrirFXML(); } } }); Scene cena = new Scene(raiz, 300, 500); stage.setTitle("┴udio Player"); stage.setScene(cena); stage.show(); } } /* Artista artista; Album album; Musica musica; List<Musica> listPinkFloyd = new ArrayList<>(); musica = new Musica("Hey You", "/audio/pink_floyd/pink_floyd_hey_you.mp3"); listPinkFloyd.add(musica); musica = new Musica("Hey You", "/audio/pink_floyd/The_Wall.mp3"); listPinkFloyd.add(musica); musica = new Musica("Hey You", "/audio/pink_floyd/UsAndThem.mp3"); listPinkFloyd.add(musica); artista = new Artista("Pink Floyd", "Rock Progressivo"); album = new Album("The Wall" , artista, listPinkFloyd); Media media = new Media(getClass().getResource( album.getAlbListMusicas().get(0).getMusLocal()).toString()); MediaPlayer mediaPlayer = new MediaPlayer(media); MediaView mediaView = new MediaView(mediaPlayer); mediaPlayer.play(); */
4,477
0.625419
0.584767
191
21.439791
20.260225
106
false
false
0
0
0
0
0
0
2.167539
false
false
0
903124f15a1e4c07d504df09eab05027eb92e416
8,675,833,959,927
9db7d7baa4fbc8da72870190a7c851ae46701528
/app/src/main/java/aia/test/android/com/aiatest/util/CommonUtils.java
3449ce8fcd28787b32ccd6745b7ae277779ee1ed
[]
no_license
AnilaAloysius/aia-test
https://github.com/AnilaAloysius/aia-test
bb941c7039ffadc41eb69bb64224e5be40db33ce
270fe5037140041f766da4219cd67bd4e00abc92
refs/heads/master
2020-03-26T21:01:30.510000
2018-08-20T04:49:17
2018-08-20T04:49:17
145,361,580
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package aia.test.android.com.aiatest.util; import android.app.Activity; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.res.Resources; import android.text.format.DateFormat; import android.util.TypedValue; import android.view.WindowManager; import android.view.inputmethod.InputMethodManager; import android.widget.EditText; import java.util.ArrayList; import java.util.Calendar; import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.Locale; import aia.test.android.com.aiatest.constants.StringConstants; import aia.test.android.com.aiatest.model.Datum; public class CommonUtils { private volatile static CommonUtils instance = null; private boolean isLoading = false; private boolean isLastPage = false; private List<Datum> imgurData = new ArrayList<>(); public static CommonUtils getInstance() { if (instance == null) { instance = new CommonUtils(); } return instance; } public String getDate(long milliSeconds) { Calendar cal = Calendar.getInstance(Locale.ENGLISH); cal.setTimeInMillis(milliSeconds * 1000L); String date = DateFormat.format(StringConstants.DateTimeFormat, cal).toString(); return date; } /** * Converting dp to pixel */ public int dpToPx(Context context, int dp) { Resources r = context.getResources(); return Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, r.getDisplayMetrics())); } /** * Hides the soft keyboard while app launches */ public void hideKeyboard(Activity context) { context.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); } public void hideKeyboardFromEditText(Context context, EditText editText) { InputMethodManager imm = (InputMethodManager) context.getSystemService( Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(editText.getWindowToken(), 0); } public void showAlertDialogs(final Context context, String alertMessage, String header) { new AlertDialog.Builder(context) .setTitle(header) .setMessage(alertMessage) .setPositiveButton("Settings", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { Intent intent = new Intent(Intent.ACTION_MAIN); intent.setClassName("com.android.phone", "com.android.phone.NetworkSetting"); context.startActivity(intent); } }) .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }) .show(); } public boolean isLoading() { return isLoading; } public void setLoading(boolean loading) { isLoading = loading; } public void setLastPage(boolean lastPage) { isLastPage = lastPage; } public boolean isLastPage() { return isLastPage; } public void setImgurData(List<Datum> imgurData) { Collections.sort(imgurData, new Comparator<Datum>() { public int compare(Datum dateTimeID1, Datum dateTimeID2) { return dateTimeID1.getDatetime().compareTo(dateTimeID2.getDatetime()); } }); Collections.reverse(imgurData); this.imgurData.addAll(imgurData); } public List<Datum> getImgurData() { return imgurData; } public boolean isEvenOrNot(Integer score, Integer points, Integer topicId) { boolean evenStatus = false; if ((score + points + topicId) % 2 == 0) { evenStatus = true; return evenStatus; } return evenStatus; } }
UTF-8
Java
4,158
java
CommonUtils.java
Java
[]
null
[]
package aia.test.android.com.aiatest.util; import android.app.Activity; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.res.Resources; import android.text.format.DateFormat; import android.util.TypedValue; import android.view.WindowManager; import android.view.inputmethod.InputMethodManager; import android.widget.EditText; import java.util.ArrayList; import java.util.Calendar; import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.Locale; import aia.test.android.com.aiatest.constants.StringConstants; import aia.test.android.com.aiatest.model.Datum; public class CommonUtils { private volatile static CommonUtils instance = null; private boolean isLoading = false; private boolean isLastPage = false; private List<Datum> imgurData = new ArrayList<>(); public static CommonUtils getInstance() { if (instance == null) { instance = new CommonUtils(); } return instance; } public String getDate(long milliSeconds) { Calendar cal = Calendar.getInstance(Locale.ENGLISH); cal.setTimeInMillis(milliSeconds * 1000L); String date = DateFormat.format(StringConstants.DateTimeFormat, cal).toString(); return date; } /** * Converting dp to pixel */ public int dpToPx(Context context, int dp) { Resources r = context.getResources(); return Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, r.getDisplayMetrics())); } /** * Hides the soft keyboard while app launches */ public void hideKeyboard(Activity context) { context.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); } public void hideKeyboardFromEditText(Context context, EditText editText) { InputMethodManager imm = (InputMethodManager) context.getSystemService( Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(editText.getWindowToken(), 0); } public void showAlertDialogs(final Context context, String alertMessage, String header) { new AlertDialog.Builder(context) .setTitle(header) .setMessage(alertMessage) .setPositiveButton("Settings", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { Intent intent = new Intent(Intent.ACTION_MAIN); intent.setClassName("com.android.phone", "com.android.phone.NetworkSetting"); context.startActivity(intent); } }) .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }) .show(); } public boolean isLoading() { return isLoading; } public void setLoading(boolean loading) { isLoading = loading; } public void setLastPage(boolean lastPage) { isLastPage = lastPage; } public boolean isLastPage() { return isLastPage; } public void setImgurData(List<Datum> imgurData) { Collections.sort(imgurData, new Comparator<Datum>() { public int compare(Datum dateTimeID1, Datum dateTimeID2) { return dateTimeID1.getDatetime().compareTo(dateTimeID2.getDatetime()); } }); Collections.reverse(imgurData); this.imgurData.addAll(imgurData); } public List<Datum> getImgurData() { return imgurData; } public boolean isEvenOrNot(Integer score, Integer points, Integer topicId) { boolean evenStatus = false; if ((score + points + topicId) % 2 == 0) { evenStatus = true; return evenStatus; } return evenStatus; } }
4,158
0.642136
0.63949
129
31.232557
26.641319
109
false
false
0
0
0
0
0
0
0.542636
false
false
0
b08c554bed2e7f09705d33b2ad3bd97ea3b62566
17,334,488,033,431
ee7e3691542fbe023c7289f1ff03e03281fa329c
/restful/src/main/java/com/jpark/restful/util/HSecurity.java
78e048ff71a2be7c5d4f682428a14d0f8bbc5915
[]
no_license
sheldon-j/rest-service
https://github.com/sheldon-j/rest-service
e7a4a72fb165e7c958412437b3bf338f2c83c10f
e2c24430da507472076b0744a88b088b727a6be4
refs/heads/master
2016-08-09T07:38:50.731000
2015-11-16T02:55:51
2015-11-16T02:55:51
46,248,006
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jpark.restful.util; public class HSecurity { private static HSecurity security; private final char HIGH = '헿'; private final char LOW = '헤'; private final String DELIMITER = "ㅋ"; public static HSecurity getInstance(){ if(security == null) security = new HSecurity(); return security; } public String encryptSimplex(String text, int length){ String cipher = ""; try{ char[] bytes = text.toCharArray(); if(length > 0){ for(int i=0; i<bytes.length; i++){ String binaryText = Integer.toBinaryString(bytes[i]); cipher += toCipher(binaryText); } }else{ throw new NumberFormatException(); } }catch(Exception e){ System.out.print("HSecurity encryptSimplex Exception :: >> "); e.printStackTrace(); } return cipher.length() > length ? cipher.substring(length) : cipher; } public String encrypt(String text){ String cipher = ""; try{ char[] bytes = text.toCharArray(); for(int i=0; i<bytes.length; i++){ String binaryText = Integer.toBinaryString(bytes[i]); cipher += toCipher(binaryText); } }catch(Exception e){ System.out.print("HSecurity encrypt Exception :: >> "); e.printStackTrace(); } return cipher; } public String decrypt(String code){ String text = ""; try{ String[] codes = code.split(DELIMITER); for(int i=0; i<codes.length; i++){ char originText = (char) (Integer.valueOf(toText(codes[i]), 2) + '0' - '0'); text += originText; } }catch(Exception e){ System.out.print("HSecurity decrypt Exception :: >> "); e.printStackTrace(); } return text; } private String toCipher(String code){ String result = ""; for(int i=0; i<code.length(); i++){ switch ( code.charAt(i) ){ case '1' : result += HIGH; break; case '0' : result += LOW; break; } } result += DELIMITER; return result; } private String toText(String cipher){ String result = ""; for(int i=0; i<cipher.length(); i++){ switch ( cipher.charAt(i) ){ case HIGH : result += '1'; break; case LOW : result += '0'; break; } } return result; } }
UTF-8
Java
2,289
java
HSecurity.java
Java
[]
null
[]
package com.jpark.restful.util; public class HSecurity { private static HSecurity security; private final char HIGH = '헿'; private final char LOW = '헤'; private final String DELIMITER = "ㅋ"; public static HSecurity getInstance(){ if(security == null) security = new HSecurity(); return security; } public String encryptSimplex(String text, int length){ String cipher = ""; try{ char[] bytes = text.toCharArray(); if(length > 0){ for(int i=0; i<bytes.length; i++){ String binaryText = Integer.toBinaryString(bytes[i]); cipher += toCipher(binaryText); } }else{ throw new NumberFormatException(); } }catch(Exception e){ System.out.print("HSecurity encryptSimplex Exception :: >> "); e.printStackTrace(); } return cipher.length() > length ? cipher.substring(length) : cipher; } public String encrypt(String text){ String cipher = ""; try{ char[] bytes = text.toCharArray(); for(int i=0; i<bytes.length; i++){ String binaryText = Integer.toBinaryString(bytes[i]); cipher += toCipher(binaryText); } }catch(Exception e){ System.out.print("HSecurity encrypt Exception :: >> "); e.printStackTrace(); } return cipher; } public String decrypt(String code){ String text = ""; try{ String[] codes = code.split(DELIMITER); for(int i=0; i<codes.length; i++){ char originText = (char) (Integer.valueOf(toText(codes[i]), 2) + '0' - '0'); text += originText; } }catch(Exception e){ System.out.print("HSecurity decrypt Exception :: >> "); e.printStackTrace(); } return text; } private String toCipher(String code){ String result = ""; for(int i=0; i<code.length(); i++){ switch ( code.charAt(i) ){ case '1' : result += HIGH; break; case '0' : result += LOW; break; } } result += DELIMITER; return result; } private String toText(String cipher){ String result = ""; for(int i=0; i<cipher.length(); i++){ switch ( cipher.charAt(i) ){ case HIGH : result += '1'; break; case LOW : result += '0'; break; } } return result; } }
2,289
0.577749
0.572054
105
19.742857
18.267342
80
false
false
0
0
0
0
0
0
2.895238
false
false
0
85bd39256043d9e1b8ab871ca48e345c4964bdfe
7,198,365,214,479
29b1ce707fa51f2c70f284292b81ec93969e2732
/src/main/java/Ejercicio4/Controlador/CuentaAtrasControlador.java
762fa4d34817a05dd40622306ff803ea63d4d849
[]
no_license
AMiguelNavarro/RespasoPSP_Threads
https://github.com/AMiguelNavarro/RespasoPSP_Threads
24ec55ebb3eb9d10d47de274488869fb4869feb4
fbb31c8aaad2bb2e5d561f4de0f0e4ac76851bff
refs/heads/master
2023-02-24T23:43:58.742000
2021-01-22T10:38:38
2021-01-22T10:38:38
331,394,298
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Ejercicio4.Controlador; import Ejercicio4.Task.CuentaAtrasTask; import javafx.concurrent.Worker; import javafx.event.Event; import javafx.fxml.FXML; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.TextField; public class CuentaAtrasControlador { public Label lbNumero; public TextField tfNumero; public Button btIniciar; @FXML public void iniciar(Event event) { int numero = Integer.parseInt(tfNumero.getText()); CuentaAtrasTask hilo = new CuentaAtrasTask(numero); hilo.messageProperty().addListener((observableValue, viejo, nuevo) -> { lbNumero.setText(nuevo); }); new Thread(hilo).start(); } }
UTF-8
Java
740
java
CuentaAtrasControlador.java
Java
[]
null
[]
package Ejercicio4.Controlador; import Ejercicio4.Task.CuentaAtrasTask; import javafx.concurrent.Worker; import javafx.event.Event; import javafx.fxml.FXML; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.TextField; public class CuentaAtrasControlador { public Label lbNumero; public TextField tfNumero; public Button btIniciar; @FXML public void iniciar(Event event) { int numero = Integer.parseInt(tfNumero.getText()); CuentaAtrasTask hilo = new CuentaAtrasTask(numero); hilo.messageProperty().addListener((observableValue, viejo, nuevo) -> { lbNumero.setText(nuevo); }); new Thread(hilo).start(); } }
740
0.712162
0.709459
31
22.870968
20.665916
79
false
false
0
0
0
0
0
0
0.580645
false
false
0
c8d78578254f6073d2653236686f0e0cfd082070
5,085,241,310,594
0c9a71d80ae3d16f9372b615e07c93e6b0849f98
/Library/src/com/just/bean/BookType.java
eafbf2ff991677d081f59c9c1fa7738ddb88a258
[]
no_license
cfjtt/Library
https://github.com/cfjtt/Library
1cf6f25e5d9fc7fe9a2572225bb0493ce765acbc
d6149cc5d74ed586f43eec40f2937084b2b25f67
refs/heads/master
2021-01-19T06:36:24.205000
2016-06-22T06:12:00
2016-06-22T06:12:00
61,693,434
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.just.bean; /** * 图书类型(一级菜单) * * @author Administrator * */ public class BookType { private Integer id; private String bookClassId; // 图书类别ID private String bookClass; // 图书类型类别 public BookType() { super(); } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getBookClassId() { return bookClassId; } public void setBookClassId(String bookClassId) { this.bookClassId = bookClassId; } public String getBookClass() { return bookClass; } public void setBookClass(String bookClass) { this.bookClass = bookClass; } @Override public String toString() { return "BookType [id=" + id + ", bookClassId=" + bookClassId + ", bookClass=" + bookClass + "]"; } }
UTF-8
Java
802
java
BookType.java
Java
[ { "context": "e com.just.bean;\n\n/**\n * 图书类型(一级菜单)\n * \n * @author Administrator\n * \n */\npublic class BookType {\n\tprivate Integer ", "end": 70, "score": 0.8823568820953369, "start": 57, "tag": "NAME", "value": "Administrator" } ]
null
[]
package com.just.bean; /** * 图书类型(一级菜单) * * @author Administrator * */ public class BookType { private Integer id; private String bookClassId; // 图书类别ID private String bookClass; // 图书类型类别 public BookType() { super(); } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getBookClassId() { return bookClassId; } public void setBookClassId(String bookClassId) { this.bookClassId = bookClassId; } public String getBookClass() { return bookClass; } public void setBookClass(String bookClass) { this.bookClass = bookClass; } @Override public String toString() { return "BookType [id=" + id + ", bookClassId=" + bookClassId + ", bookClass=" + bookClass + "]"; } }
802
0.664491
0.664491
48
14.958333
15.95953
62
false
false
0
0
0
0
0
0
1.125
false
false
0
2515bd7e54292683320cce0a062684cb5d538797
22,926,535,450,406
447165f161ff0f3f67719c22b35cbc5922df95c2
/Laboratorio 02/Resoluciones/Práctica 06/Practica06.java
f63e8559f7951d83dcf843a285b668aad818b2ab
[]
no_license
marifabi/Diplo_NT_Intro_Programacion
https://github.com/marifabi/Diplo_NT_Intro_Programacion
0824620d01138800abe5bf538876698cb136147b
a40a3dfaccd21120c1b99bc37f9b358122bcd78e
refs/heads/master
2022-11-30T00:12:25.735000
2020-08-08T03:30:02
2020-08-08T03:30:02
286,343,758
2
0
null
true
2020-08-10T00:55:07
2020-08-10T00:55:06
2020-08-10T00:55:02
2020-08-09T23:55:08
1,384
0
0
0
null
false
false
import java.util.Scanner; /* * 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. */ /** * * @author MARTIN */ public class Practica06 { /** * @param args the command line arguments */ public static void main(String[] args) { double lado1, lado2, lado3, sp, area; Scanner input = new Scanner(System.in); //Entradas: System.out.println("Ingrese lado1 del triángulo:"); lado1 = input.nextDouble(); System.out.println("Ingrese lado2 del triángulo:"); lado2 = input.nextDouble(); System.out.println("Ingrese lado3 del triángulo:"); lado3 = input.nextDouble(); //Proceso: sp = (lado1 + lado2 + lado3) / 2; area = Math.sqrt(sp * (sp - lado1) * (sp - lado2) * (sp - lado3)); //Salida: System.out.println("'El área del triángulo de lado: " + lado1 + ", " + lado2 + ", " + lado3 + " es: " + area); } }
UTF-8
Java
1,097
java
Practica06.java
Java
[ { "context": "the template in the editor.\n */\n\n/**\n *\n * @author MARTIN\n */\npublic class Practica06 {\n\n /**\n * @pa", "end": 238, "score": 0.9990451335906982, "start": 232, "tag": "NAME", "value": "MARTIN" } ]
null
[]
import java.util.Scanner; /* * 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. */ /** * * @author MARTIN */ public class Practica06 { /** * @param args the command line arguments */ public static void main(String[] args) { double lado1, lado2, lado3, sp, area; Scanner input = new Scanner(System.in); //Entradas: System.out.println("Ingrese lado1 del triángulo:"); lado1 = input.nextDouble(); System.out.println("Ingrese lado2 del triángulo:"); lado2 = input.nextDouble(); System.out.println("Ingrese lado3 del triángulo:"); lado3 = input.nextDouble(); //Proceso: sp = (lado1 + lado2 + lado3) / 2; area = Math.sqrt(sp * (sp - lado1) * (sp - lado2) * (sp - lado3)); //Salida: System.out.println("'El área del triángulo de lado: " + lado1 + ", " + lado2 + ", " + lado3 + " es: " + area); } }
1,097
0.572344
0.553114
38
27.710526
27.196079
118
false
false
0
0
0
0
0
0
0.552632
false
false
0
0610ce2ca73007953d3bde8333d4c76a8006a0a2
3,934,190,071,634
7074b64fec24da731b0ba2cc51e683ca14ea465f
/src/test/java/com/epam/CleanCode/SimpTest.java
203c080bfd4d7581120349cec6f256239b44d65c
[]
no_license
harikamariyala/CleanCode
https://github.com/harikamariyala/CleanCode
f1bc650a3eb83751a9c942e8d08a993c9d5f7c3b
56d455fc43896f8b84a9e965e3cf8e5e717592e7
refs/heads/master
2022-12-27T08:47:51.365000
2020-07-25T13:26:29
2020-07-25T13:26:29
282,448,830
0
0
null
false
2020-10-13T23:54:58
2020-07-25T13:25:04
2020-07-25T13:27:25
2020-10-13T23:54:57
11
0
0
1
Java
false
false
package com.epam.CleanCode; import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.Test; public class SimpTest { SimpleAndompound i=new SimpleAndompound(); @Test public void check_simple_interests() { assertEquals(115000.0,i.simple_interest(100000,5,23),0.0); assertEquals(38400.0,i.simple_interest(20000,6,32),0.0); assertEquals(90000.0,i.simple_interest(50000,9,20),0.0); } @Test public void check_compound_interest() { assertEquals(20281.977629563662,i.compound_interest(32000,2.2,25),0.0); assertEquals(74970.0,i.compound_interest(68000,2,45),0.0); assertEquals(571368.7350000001,i.compound_interest(545000,3,27),0.0); } }
UTF-8
Java
687
java
SimpTest.java
Java
[]
null
[]
package com.epam.CleanCode; import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.Test; public class SimpTest { SimpleAndompound i=new SimpleAndompound(); @Test public void check_simple_interests() { assertEquals(115000.0,i.simple_interest(100000,5,23),0.0); assertEquals(38400.0,i.simple_interest(20000,6,32),0.0); assertEquals(90000.0,i.simple_interest(50000,9,20),0.0); } @Test public void check_compound_interest() { assertEquals(20281.977629563662,i.compound_interest(32000,2.2,25),0.0); assertEquals(74970.0,i.compound_interest(68000,2,45),0.0); assertEquals(571368.7350000001,i.compound_interest(545000,3,27),0.0); } }
687
0.745269
0.569141
25
26.48
25.122293
73
false
false
0
0
0
0
0
0
2.36
false
false
0
3f4326cf149c41650cd5e93b9eed2d5b6fa806c9
26,139,171,016,745
2022dbca3c56def67db46783bca035b1b2930765
/DragonFly/streamer/dash/DashStreamer.java
71b4a2a05f55b594c55f3b2be1aaef5f6bea0b5b
[]
no_license
baoyihu/DragonFly
https://github.com/baoyihu/DragonFly
dd70da2d59cdaeb61db3c66aa9a292650d415a7c
b7a95ee0e65dc889cc2f725531658a7eb6191f21
refs/heads/master
2020-06-09T07:51:42.578000
2019-06-24T07:38:34
2019-06-24T07:38:34
193,404,954
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.baoyihu.dragonfly.streamer.dash; import java.io.IOException; import java.net.ConnectException; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import com.baoyihu.common.util.DebugLog; import com.baoyihu.common.util.Pair; import com.baoyihu.dragonfly.constant.ErrorCode; import com.baoyihu.dragonfly.controller.DownloadTask; import com.baoyihu.dragonfly.node.dash.DashRepresentation; import com.baoyihu.dragonfly.streamer.StreamInterface; import com.baoyihu.dragonfly.streamer.StreamResult; import com.baoyihu.dragonfly.streamer.StreamType; import com.baoyihu.dragonfly.streamer.VideoBuffer; import com.baoyihu.dragonfly.util.NetWork; public class DashStreamer implements StreamInterface { private static final String TAG = "DashStreamer"; private LinkedList<Runnable> taskList = new LinkedList<Runnable>(); private boolean needWork = false; private StreamType type = null; public DashStreamer(StreamType type) { this.type = type; needWork = true; // System.setProperty("java.net.preferIPv4Stack", "true"); // System.setProperty("java.net.preferIPv6Addresses", "false"); new Thread(new Runnable() { @Override public void run() { runLoop(); } }).start(); } public void runLoop() { while (needWork) { Runnable task = taskList.poll(); if (task != null) { task.run(); } else { try { Thread.sleep(10); } catch (InterruptedException e) { DebugLog.trace(TAG, e); } } } } public void release() { needWork = false; } @Override public void downloadIndex(final DownloadTask task) { taskList.add(new Runnable() { @Override public void run() { DebugLog.info(TAG, "downloadIndex"); byte[] temp; try { temp = NetWork.downloadToByteArray(task.url); if (callback != null) { StreamResult result = new StreamResult(type, StreamResult.STREAM_RETURN_INDEX); result.setBytePools(new byte[][] {temp}); DebugLog.debug(TAG, "downloadIndex finish"); callback.onFinishTask(task, result, ErrorCode.MEDIA_ERROR_OK); } } catch (IOException e) { callback.onFinishTask(task, null, getNetError(e)); } //Logger.info(TAG, "dashNode:" + dashNode); } }); } private ErrorCode getNetError(IOException exectption) { if (exectption instanceof ConnectException) { String detail = exectption.getMessage(); if (detail.contains("ENETUNREACH")) { return ErrorCode.MEDIA_ERROR_NET_UNREACHABLE; } else if (detail.contains("ECONNREFUSED")) { return ErrorCode.MEDIA_ERROR_NET_CONNREFUSED; } else { return ErrorCode.MEDIA_ERROR_UNKNOWN; } } else { DebugLog.error(TAG, "getNetError not Defined:" + exectption.toString()); return ErrorCode.MEDIA_ERROR_NET_UNREACHABLE; } } @Override public void downloadVideoHead(final DownloadTask task) { taskList.add(new Runnable() { @Override public void run() { DebugLog.info(TAG, "downloadVideoHead"); byte[] ddd = null; String directory = task.representation.getRootUrl(); if (directory != null) { String dest = directory + task.representation.getBaseUrl(); try { ddd = NetWork.downloadMp4(dest, task.properties); List<Pair<String, String>> properties = new ArrayList<Pair<String, String>>(); String rangeString = task.representation.getSegment().getIndexRange(); properties.add(new Pair<String, String>("Range", "bytes=" + rangeString)); byte[] segmentIndexBuffer = NetWork.downloadMp4(dest, properties); if (callback != null) { StreamResult result = new StreamResult(type, StreamResult.STREAM_RETURN_VIDEO_HEAD); result.setBytePools(new byte[][] {ddd, segmentIndexBuffer}); DebugLog.debug(TAG, "downloadVideoHead finish"); callback.onFinishTask(task, result, ErrorCode.MEDIA_ERROR_OK); } } catch (IOException e) { callback.onFinishTask(task, null, getNetError(e)); } } else { DebugLog.error(TAG, "url is wrong:" + directory); } } }); } @Override public void downloadVideoSegment(final DownloadTask task) { taskList.add(new Runnable() { @Override public void run() { DebugLog.info(TAG, "downloadVideoSegment"); DashRepresentation represent = task.representation; String directory = represent.getRootUrl(); if (directory != null) { String dest = directory + represent.getBaseUrl(); final StreamResult result = new StreamResult(type, StreamResult.STREAM_RETURN_VIDEO_SEGMENT); int byteCount = task.getRangeSize(); VideoBuffer videoBuffer = new VideoBuffer(byteCount); videoBuffer.setRawBufferFrom(task.getRangeFrom()); videoBuffer.setCallBack(task, result, callback); result.setVideoBuffer(videoBuffer); result.setSegmentindex(task.indexOfSegment); try { NetWork.downloadMp4MultiThread(dest, result, task.properties); } catch (IOException e) { callback.onFinishTask(task, null, getNetError(e)); } } else { DebugLog.error(TAG, "url is wrong:" + directory); } } }); } @Override public void downloadAudioHead(final DownloadTask task) { taskList.add(new Runnable() { @Override public void run() { DebugLog.debug(TAG, "downloadAudioHead "); byte[] ddd = null; String directory = task.representation.getRootUrl(); if (directory != null) { String dest = directory + task.representation.getBaseUrl(); try { ddd = NetWork.downloadMp4(dest, task.properties); List<Pair<String, String>> properties = new ArrayList<Pair<String, String>>(); String rangeString = task.representation.getSegment().getIndexRange(); properties.add(new Pair<String, String>("Range", "bytes=" + rangeString)); byte[] segmentIndexBuffer = NetWork.downloadMp4(dest, properties); if (callback != null) { StreamResult result = new StreamResult(type, StreamResult.STREAM_RETURN_AUDIO_HEAD); result.setBytePools(new byte[][] {ddd, segmentIndexBuffer}); DebugLog.debug(TAG, "downloadAudioHead finish"); callback.onFinishTask(task, result, ErrorCode.MEDIA_ERROR_OK); } } catch (IOException e) { callback.onFinishTask(task, null, getNetError(e)); } } else { DebugLog.error(TAG, "url is wrong:" + directory); } } }); } @Override public void downloadAudioSegment(final DownloadTask task) { taskList.add(new Runnable() { @Override public void run() { DebugLog.debug(TAG, "downloadAudioSegment"); DashRepresentation represent = task.representation; String directory = represent.getRootUrl(); if (directory != null) { String dest = directory + represent.getBaseUrl(); byte[] tempSegmentBuffer; try { tempSegmentBuffer = NetWork.downloadMp4(dest, task.properties); if (callback != null) { StreamResult result = new StreamResult(type, StreamResult.STREAM_RETURN_AUDIO_SEGMENT); result.setBytePools(new byte[][] {tempSegmentBuffer}); result.setSegmentindex(task.indexOfSegment); DebugLog.debug(TAG, "downloadAudioSegment finish"); callback.onFinishTask(task, result, ErrorCode.MEDIA_ERROR_OK); } } catch (IOException e) { callback.onFinishTask(task, null, ErrorCode.MEDIA_ERROR_NET_UNREACHABLE); DebugLog.trace(TAG, e); } } else { DebugLog.error(TAG, "url is wrong:" + directory); } } }); } StreamCallBack callback = null; @Override public void setCallBack(StreamCallBack callback) { this.callback = callback; } }
UTF-8
Java
11,337
java
DashStreamer.java
Java
[]
null
[]
package com.baoyihu.dragonfly.streamer.dash; import java.io.IOException; import java.net.ConnectException; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import com.baoyihu.common.util.DebugLog; import com.baoyihu.common.util.Pair; import com.baoyihu.dragonfly.constant.ErrorCode; import com.baoyihu.dragonfly.controller.DownloadTask; import com.baoyihu.dragonfly.node.dash.DashRepresentation; import com.baoyihu.dragonfly.streamer.StreamInterface; import com.baoyihu.dragonfly.streamer.StreamResult; import com.baoyihu.dragonfly.streamer.StreamType; import com.baoyihu.dragonfly.streamer.VideoBuffer; import com.baoyihu.dragonfly.util.NetWork; public class DashStreamer implements StreamInterface { private static final String TAG = "DashStreamer"; private LinkedList<Runnable> taskList = new LinkedList<Runnable>(); private boolean needWork = false; private StreamType type = null; public DashStreamer(StreamType type) { this.type = type; needWork = true; // System.setProperty("java.net.preferIPv4Stack", "true"); // System.setProperty("java.net.preferIPv6Addresses", "false"); new Thread(new Runnable() { @Override public void run() { runLoop(); } }).start(); } public void runLoop() { while (needWork) { Runnable task = taskList.poll(); if (task != null) { task.run(); } else { try { Thread.sleep(10); } catch (InterruptedException e) { DebugLog.trace(TAG, e); } } } } public void release() { needWork = false; } @Override public void downloadIndex(final DownloadTask task) { taskList.add(new Runnable() { @Override public void run() { DebugLog.info(TAG, "downloadIndex"); byte[] temp; try { temp = NetWork.downloadToByteArray(task.url); if (callback != null) { StreamResult result = new StreamResult(type, StreamResult.STREAM_RETURN_INDEX); result.setBytePools(new byte[][] {temp}); DebugLog.debug(TAG, "downloadIndex finish"); callback.onFinishTask(task, result, ErrorCode.MEDIA_ERROR_OK); } } catch (IOException e) { callback.onFinishTask(task, null, getNetError(e)); } //Logger.info(TAG, "dashNode:" + dashNode); } }); } private ErrorCode getNetError(IOException exectption) { if (exectption instanceof ConnectException) { String detail = exectption.getMessage(); if (detail.contains("ENETUNREACH")) { return ErrorCode.MEDIA_ERROR_NET_UNREACHABLE; } else if (detail.contains("ECONNREFUSED")) { return ErrorCode.MEDIA_ERROR_NET_CONNREFUSED; } else { return ErrorCode.MEDIA_ERROR_UNKNOWN; } } else { DebugLog.error(TAG, "getNetError not Defined:" + exectption.toString()); return ErrorCode.MEDIA_ERROR_NET_UNREACHABLE; } } @Override public void downloadVideoHead(final DownloadTask task) { taskList.add(new Runnable() { @Override public void run() { DebugLog.info(TAG, "downloadVideoHead"); byte[] ddd = null; String directory = task.representation.getRootUrl(); if (directory != null) { String dest = directory + task.representation.getBaseUrl(); try { ddd = NetWork.downloadMp4(dest, task.properties); List<Pair<String, String>> properties = new ArrayList<Pair<String, String>>(); String rangeString = task.representation.getSegment().getIndexRange(); properties.add(new Pair<String, String>("Range", "bytes=" + rangeString)); byte[] segmentIndexBuffer = NetWork.downloadMp4(dest, properties); if (callback != null) { StreamResult result = new StreamResult(type, StreamResult.STREAM_RETURN_VIDEO_HEAD); result.setBytePools(new byte[][] {ddd, segmentIndexBuffer}); DebugLog.debug(TAG, "downloadVideoHead finish"); callback.onFinishTask(task, result, ErrorCode.MEDIA_ERROR_OK); } } catch (IOException e) { callback.onFinishTask(task, null, getNetError(e)); } } else { DebugLog.error(TAG, "url is wrong:" + directory); } } }); } @Override public void downloadVideoSegment(final DownloadTask task) { taskList.add(new Runnable() { @Override public void run() { DebugLog.info(TAG, "downloadVideoSegment"); DashRepresentation represent = task.representation; String directory = represent.getRootUrl(); if (directory != null) { String dest = directory + represent.getBaseUrl(); final StreamResult result = new StreamResult(type, StreamResult.STREAM_RETURN_VIDEO_SEGMENT); int byteCount = task.getRangeSize(); VideoBuffer videoBuffer = new VideoBuffer(byteCount); videoBuffer.setRawBufferFrom(task.getRangeFrom()); videoBuffer.setCallBack(task, result, callback); result.setVideoBuffer(videoBuffer); result.setSegmentindex(task.indexOfSegment); try { NetWork.downloadMp4MultiThread(dest, result, task.properties); } catch (IOException e) { callback.onFinishTask(task, null, getNetError(e)); } } else { DebugLog.error(TAG, "url is wrong:" + directory); } } }); } @Override public void downloadAudioHead(final DownloadTask task) { taskList.add(new Runnable() { @Override public void run() { DebugLog.debug(TAG, "downloadAudioHead "); byte[] ddd = null; String directory = task.representation.getRootUrl(); if (directory != null) { String dest = directory + task.representation.getBaseUrl(); try { ddd = NetWork.downloadMp4(dest, task.properties); List<Pair<String, String>> properties = new ArrayList<Pair<String, String>>(); String rangeString = task.representation.getSegment().getIndexRange(); properties.add(new Pair<String, String>("Range", "bytes=" + rangeString)); byte[] segmentIndexBuffer = NetWork.downloadMp4(dest, properties); if (callback != null) { StreamResult result = new StreamResult(type, StreamResult.STREAM_RETURN_AUDIO_HEAD); result.setBytePools(new byte[][] {ddd, segmentIndexBuffer}); DebugLog.debug(TAG, "downloadAudioHead finish"); callback.onFinishTask(task, result, ErrorCode.MEDIA_ERROR_OK); } } catch (IOException e) { callback.onFinishTask(task, null, getNetError(e)); } } else { DebugLog.error(TAG, "url is wrong:" + directory); } } }); } @Override public void downloadAudioSegment(final DownloadTask task) { taskList.add(new Runnable() { @Override public void run() { DebugLog.debug(TAG, "downloadAudioSegment"); DashRepresentation represent = task.representation; String directory = represent.getRootUrl(); if (directory != null) { String dest = directory + represent.getBaseUrl(); byte[] tempSegmentBuffer; try { tempSegmentBuffer = NetWork.downloadMp4(dest, task.properties); if (callback != null) { StreamResult result = new StreamResult(type, StreamResult.STREAM_RETURN_AUDIO_SEGMENT); result.setBytePools(new byte[][] {tempSegmentBuffer}); result.setSegmentindex(task.indexOfSegment); DebugLog.debug(TAG, "downloadAudioSegment finish"); callback.onFinishTask(task, result, ErrorCode.MEDIA_ERROR_OK); } } catch (IOException e) { callback.onFinishTask(task, null, ErrorCode.MEDIA_ERROR_NET_UNREACHABLE); DebugLog.trace(TAG, e); } } else { DebugLog.error(TAG, "url is wrong:" + directory); } } }); } StreamCallBack callback = null; @Override public void setCallBack(StreamCallBack callback) { this.callback = callback; } }
11,337
0.458146
0.457264
315
33.990475
27.196463
115
false
false
0
0
0
0
0
0
0.546032
false
false
0
ccdfd91512cfc3eba5212cbd23e71b92e6353b95
7,876,970,027,259
4b4150bff2db04d84c67ea97e32f37a61f163679
/src/IfPackage/Market.java
ad86176be0ef760018102e9d3deb6a4902f44f64
[]
no_license
m3rv3s/zerotohero
https://github.com/m3rv3s/zerotohero
3c03d6b2a07f79c27173d5977518c42e89db078d
391035ca7762c57ff9b5e89b2ce94d97eb19693e
refs/heads/master
2020-11-24T15:42:35.479000
2019-12-15T17:25:22
2019-12-15T17:25:22
228,222,218
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package IfPackage; import java.util.Scanner; public class Market { //shopping //everything total will be 60$ //but you only have 50$ //the rest money if you can give all you can buy everything if not cnt buy //total //amountPaid //askforrest public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.println("Please enter the total amount you have"); double amountPaid=input.nextDouble(); if(amountPaid>=60) { System.out.println("you can buy the products"); }else if(amountPaid<60) { double leftover = 60 - amountPaid; System.out.println("Please enter rest of the money " + leftover); double restMoney = input.nextDouble(); if(restMoney>=leftover){ System.out.println("you can buy the products"); }else{ System.out.println("you will not be able to purchase"); } } } }
UTF-8
Java
1,041
java
Market.java
Java
[]
null
[]
package IfPackage; import java.util.Scanner; public class Market { //shopping //everything total will be 60$ //but you only have 50$ //the rest money if you can give all you can buy everything if not cnt buy //total //amountPaid //askforrest public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.println("Please enter the total amount you have"); double amountPaid=input.nextDouble(); if(amountPaid>=60) { System.out.println("you can buy the products"); }else if(amountPaid<60) { double leftover = 60 - amountPaid; System.out.println("Please enter rest of the money " + leftover); double restMoney = input.nextDouble(); if(restMoney>=leftover){ System.out.println("you can buy the products"); }else{ System.out.println("you will not be able to purchase"); } } } }
1,041
0.572526
0.56292
39
25.641026
24.446159
78
false
false
0
0
0
0
0
0
0.282051
false
false
0
f99f93378033ce74f1a2d9241422069c964e8162
22,196,391,042,321
5fec0432635020601a42672f6de2bdc687f496ee
/src/com/company/sw/swExpert1249.java
8ac1f2d7aa38a685dd3d9a2a7bb5258fa1fedebc
[]
no_license
WonYong-Jang/algorithm
https://github.com/WonYong-Jang/algorithm
bb7389ce225766e339c3aba9926aa61c7c102797
d7b7c6b4174b7d42e1c87cbfa87c6a3f77479c07
refs/heads/master
2023-01-10T15:38:05.973000
2020-11-14T14:40:01
2020-11-14T14:40:01
133,470,808
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.company.sw; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.LinkedList; import java.util.Queue; import java.util.StringTokenizer; /** * 보급로 */ public class swExpert1249 { static int N; static int[][] map = new int[105][105]; static int[][] visit = new int[105][105]; static int[] dxArr = {0, 0, 1, -1}, dyArr = {1, -1, 0, 0}; static Queue<Node> que = new LinkedList<>(); public static void main(String[] args) throws IOException { // TODO Auto-generated method stub BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); StringTokenizer st = new StringTokenizer(br.readLine()); int testCase = Integer.parseInt(st.nextToken()); for(int k=1; k<= testCase ; k++) { st = new StringTokenizer(br.readLine()); N = Integer.parseInt(st.nextToken()); for(int i=1; i<= N; i++) { String str = br.readLine(); for(int j=1; j<= N; j++) { visit[i][j] = -1; map[i][j] = str.charAt(j-1) - '0'; } } solve(); //debug(); bw.write("#"+k+" "+visit[N][N]+"\n"); } bw.flush(); } public static void solve() { que.clear(); que.add(new Node(1,1)); visit[1][1] = 0; while(!que.isEmpty()) { Node n = que.poll(); for(int i=0; i<4; i++) { int nx = n.dx + dxArr[i]; int ny = n.dy + dyArr[i]; if(!isRange(nx, ny)) continue; if(visit[nx][ny] == -1 || visit[nx][ny] > visit[n.dx][n.dy] + map[nx][ny]) { visit[nx][ny] = map[nx][ny] + visit[n.dx][n.dy]; que.add(new Node(nx, ny)); } } } } public static void debug() { for(int i=1; i<= N; i++) { for(int j=1; j<= N; j++) { System.out.print(visit[i][j] + " "); } System.out.println(); } } public static boolean isRange(int dx, int dy) { return dx>=1 && dy>=1 && dx<= N && dy<= N; } public static int min(int a, int b) { return a > b ? b : a; } static class Node{ int dx, dy; Node(int a, int b) { dx = a; dy = b; } } }
UTF-8
Java
2,178
java
swExpert1249.java
Java
[]
null
[]
package com.company.sw; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.LinkedList; import java.util.Queue; import java.util.StringTokenizer; /** * 보급로 */ public class swExpert1249 { static int N; static int[][] map = new int[105][105]; static int[][] visit = new int[105][105]; static int[] dxArr = {0, 0, 1, -1}, dyArr = {1, -1, 0, 0}; static Queue<Node> que = new LinkedList<>(); public static void main(String[] args) throws IOException { // TODO Auto-generated method stub BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); StringTokenizer st = new StringTokenizer(br.readLine()); int testCase = Integer.parseInt(st.nextToken()); for(int k=1; k<= testCase ; k++) { st = new StringTokenizer(br.readLine()); N = Integer.parseInt(st.nextToken()); for(int i=1; i<= N; i++) { String str = br.readLine(); for(int j=1; j<= N; j++) { visit[i][j] = -1; map[i][j] = str.charAt(j-1) - '0'; } } solve(); //debug(); bw.write("#"+k+" "+visit[N][N]+"\n"); } bw.flush(); } public static void solve() { que.clear(); que.add(new Node(1,1)); visit[1][1] = 0; while(!que.isEmpty()) { Node n = que.poll(); for(int i=0; i<4; i++) { int nx = n.dx + dxArr[i]; int ny = n.dy + dyArr[i]; if(!isRange(nx, ny)) continue; if(visit[nx][ny] == -1 || visit[nx][ny] > visit[n.dx][n.dy] + map[nx][ny]) { visit[nx][ny] = map[nx][ny] + visit[n.dx][n.dy]; que.add(new Node(nx, ny)); } } } } public static void debug() { for(int i=1; i<= N; i++) { for(int j=1; j<= N; j++) { System.out.print(visit[i][j] + " "); } System.out.println(); } } public static boolean isRange(int dx, int dy) { return dx>=1 && dy>=1 && dx<= N && dy<= N; } public static int min(int a, int b) { return a > b ? b : a; } static class Node{ int dx, dy; Node(int a, int b) { dx = a; dy = b; } } }
2,178
0.577808
0.558471
98
21.163265
18.97834
78
false
false
0
0
0
0
0
0
2.734694
false
false
0
e16b4f6383d4abacb7cb85c37e3d79434a435ffb
23,304,492,603,730
ff8d62dbc6baaf2aa26bbaafd9a4b6ffd64ed3f6
/src/main/java/com/universal/k2api/service/MemberBenefitSummaryDAOService.java
7bb1519645e24655e6b689bee3b1f98a25546d28
[]
no_license
UniversalHealthcareGS/k2-api
https://github.com/UniversalHealthcareGS/k2-api
2c238b008be05ed07d68aeb58c98eb003aa0e75e
0fb6993daa69ab28c3524ad67f8b92782e4875aa
refs/heads/master
2020-03-30T10:15:30.366000
2019-08-28T10:44:31
2019-08-28T10:44:31
151,112,680
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.universal.k2api.service; import com.universal.k2api.entity.MemberBenefit; import com.universal.k2api.entity.MemberBenefitSummary; import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.List; @Component public class MemberBenefitSummaryDAOService { DataHelper<MemberBenefitSummary> dh = new DataHelper<>(); String baseQuery = "SELECT LI_MEMBERNUMBER \n" + " ,LI_PLAN \n" + " ,SCO_DESCRIPTION AS planName \n" + " ,LI_YEAR \n" + " ,LI_CATEGORY \n" + " ,LI_CEILINGSAMOUNT + LI_EXGRATIAAMOUNT - LI_BENEFITAMOUNT AS Available \n" + " ,CO_GROUPCOY \n" + "FROM UH_LI_LIMITS \n" + "LEFT OUTER JOIN UH_ME_MEMBERS ON ME_MEMBERNUMBER = LI_MEMBERNUMBER \n" + "LEFT OUTER JOIN UH_CO_COMPANIES ON CO_COMPANYCODE = ME_COMPANYCODE \n" + "LEFT OUTER JOIN UH_SCO_OPTIONS ON SCO_MEDICALAIDCODE = LI_MEDICALAIDCODE \n" + " AND SCO_PLANCODE = LI_PLAN \n"; public MemberBenefitSummary findByMemberNumberYear(int schemeCode, String memberNumber, int benefitYear) { String memNum = String.format("%1$" + 13 + "s", memberNumber); String query = baseQuery + "WHERE LI_MEMBERNUMBER = '" + memNum + "' \n" + "AND LI_YEAR = " + benefitYear + " \n" + "AND LI_DEPENDANTCODE = 99 \n" + "AND LI_CATEGORY IN ( \n" + " 411, 43, 136, \n" + //Annual Flexi Benefit " 40, 45, 47, \n" + //Annual Overall Benefit " 42, \n" + //Annual Routine Care Benefit " 410, 888 \n" + //Savings " \n" + //Accumulated Savings " ) \n"; MemberBenefitSummary memberBenefitSummary = new MemberBenefitSummary(); List<MemberBenefitSummary> memberBenefitSummaries = new ArrayList<>(); if (schemeCode == 827 || schemeCode == 830 || schemeCode == 831){ // These schemes have Options that does not have any of these Benefit Categories and should not through an exception. memberBenefitSummaries = dh.getListFromUSQL(memberBenefitSummary, schemeCode, query, false); } else { memberBenefitSummaries = dh.getListFromUSQL(memberBenefitSummary, schemeCode, query); } memberBenefitSummary = memberBenefitSummaries.get(0); String accumSavQuery = "SELECT ME_MEMBERNUMBER, \n" + " '' AS Plan, \n" + " '' AS PlanName, \n" + " SA_YEAR, \n" + " 'AccumSav' AS Category, \n" + " SA_ACUMBALAMOUNT - SA_ACUMUSEAMOUNT + SA_MSACCUM AS AccumSav, \n" + " '' AS Staff \n" + "FROM UH_ME_MEMBERS \n" + "INNER JOIN UH_SA_SAVINGS ON SA_MEDICALAIDCODE = ME_MEDICALAIDCODE \n" + " AND SA_MEMBERNO = ME_MEMBERNUMBER \n" + " AND SA_YEAR = " + benefitYear + " \n" + "AND ME_MEMBERNUMBER = '" + memNum + "' "; MemberBenefitSummary accumSavBenefitSummary = new MemberBenefitSummary(); List<MemberBenefitSummary> accumSavBenefitSummaries = new ArrayList<>(); accumSavBenefitSummaries = dh.getListFromUSQL(accumSavBenefitSummary, schemeCode, accumSavQuery, false); accumSavBenefitSummary = accumSavBenefitSummaries.get(0); memberBenefitSummary.setAvailableAccumulatedSavings(accumSavBenefitSummary.getAvailableAccumulatedSavings()); return memberBenefitSummary; } }
UTF-8
Java
4,990
java
MemberBenefitSummaryDAOService.java
Java
[]
null
[]
package com.universal.k2api.service; import com.universal.k2api.entity.MemberBenefit; import com.universal.k2api.entity.MemberBenefitSummary; import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.List; @Component public class MemberBenefitSummaryDAOService { DataHelper<MemberBenefitSummary> dh = new DataHelper<>(); String baseQuery = "SELECT LI_MEMBERNUMBER \n" + " ,LI_PLAN \n" + " ,SCO_DESCRIPTION AS planName \n" + " ,LI_YEAR \n" + " ,LI_CATEGORY \n" + " ,LI_CEILINGSAMOUNT + LI_EXGRATIAAMOUNT - LI_BENEFITAMOUNT AS Available \n" + " ,CO_GROUPCOY \n" + "FROM UH_LI_LIMITS \n" + "LEFT OUTER JOIN UH_ME_MEMBERS ON ME_MEMBERNUMBER = LI_MEMBERNUMBER \n" + "LEFT OUTER JOIN UH_CO_COMPANIES ON CO_COMPANYCODE = ME_COMPANYCODE \n" + "LEFT OUTER JOIN UH_SCO_OPTIONS ON SCO_MEDICALAIDCODE = LI_MEDICALAIDCODE \n" + " AND SCO_PLANCODE = LI_PLAN \n"; public MemberBenefitSummary findByMemberNumberYear(int schemeCode, String memberNumber, int benefitYear) { String memNum = String.format("%1$" + 13 + "s", memberNumber); String query = baseQuery + "WHERE LI_MEMBERNUMBER = '" + memNum + "' \n" + "AND LI_YEAR = " + benefitYear + " \n" + "AND LI_DEPENDANTCODE = 99 \n" + "AND LI_CATEGORY IN ( \n" + " 411, 43, 136, \n" + //Annual Flexi Benefit " 40, 45, 47, \n" + //Annual Overall Benefit " 42, \n" + //Annual Routine Care Benefit " 410, 888 \n" + //Savings " \n" + //Accumulated Savings " ) \n"; MemberBenefitSummary memberBenefitSummary = new MemberBenefitSummary(); List<MemberBenefitSummary> memberBenefitSummaries = new ArrayList<>(); if (schemeCode == 827 || schemeCode == 830 || schemeCode == 831){ // These schemes have Options that does not have any of these Benefit Categories and should not through an exception. memberBenefitSummaries = dh.getListFromUSQL(memberBenefitSummary, schemeCode, query, false); } else { memberBenefitSummaries = dh.getListFromUSQL(memberBenefitSummary, schemeCode, query); } memberBenefitSummary = memberBenefitSummaries.get(0); String accumSavQuery = "SELECT ME_MEMBERNUMBER, \n" + " '' AS Plan, \n" + " '' AS PlanName, \n" + " SA_YEAR, \n" + " 'AccumSav' AS Category, \n" + " SA_ACUMBALAMOUNT - SA_ACUMUSEAMOUNT + SA_MSACCUM AS AccumSav, \n" + " '' AS Staff \n" + "FROM UH_ME_MEMBERS \n" + "INNER JOIN UH_SA_SAVINGS ON SA_MEDICALAIDCODE = ME_MEDICALAIDCODE \n" + " AND SA_MEMBERNO = ME_MEMBERNUMBER \n" + " AND SA_YEAR = " + benefitYear + " \n" + "AND ME_MEMBERNUMBER = '" + memNum + "' "; MemberBenefitSummary accumSavBenefitSummary = new MemberBenefitSummary(); List<MemberBenefitSummary> accumSavBenefitSummaries = new ArrayList<>(); accumSavBenefitSummaries = dh.getListFromUSQL(accumSavBenefitSummary, schemeCode, accumSavQuery, false); accumSavBenefitSummary = accumSavBenefitSummaries.get(0); memberBenefitSummary.setAvailableAccumulatedSavings(accumSavBenefitSummary.getAvailableAccumulatedSavings()); return memberBenefitSummary; } }
4,990
0.431864
0.423647
76
64.657898
42.493206
194
false
false
0
0
0
0
0
0
0.763158
false
false
0
72e90b976d2197e13bfbd22c342e613c4f8ad2e6
23,304,492,601,681
8fad917eaf4191bd785bf34cabf2f7c3bd24f9d6
/Lista4Puc/Lista4Att6.java
2482028fc7ad9b246100fa5ed75c87c7341ce478
[]
no_license
dellfinn/Lista4ExercicioJava
https://github.com/dellfinn/Lista4ExercicioJava
a0d61a3060ac2c91c7c8c90d0686f4d03f4debd6
dbbd671ea39a07944fc533681d015a0086a15cee
refs/heads/main
2023-05-02T10:33:50.378000
2021-05-16T22:38:43
2021-05-16T22:38:43
367,998,875
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Lista4Puc; import java.util.Scanner; public class Lista4Att6 { public static void main(String[] args) { int ano; Scanner ler = new Scanner(System.in); System.out.println("Descubra se o ano é bissexto"); System.out.print("Insira o ano para verificar se é bissexto"); ano = ler.nextInt(); if (((ano % 4 == 0) && (ano % 100 != 0)) || ano % 400 == 0) System.out.println("o ano é um ano bissexto"); else System.out.println("o ano não é um ano bissexto"); } }
UTF-8
Java
576
java
Lista4Att6.java
Java
[]
null
[]
package Lista4Puc; import java.util.Scanner; public class Lista4Att6 { public static void main(String[] args) { int ano; Scanner ler = new Scanner(System.in); System.out.println("Descubra se o ano é bissexto"); System.out.print("Insira o ano para verificar se é bissexto"); ano = ler.nextInt(); if (((ano % 4 == 0) && (ano % 100 != 0)) || ano % 400 == 0) System.out.println("o ano é um ano bissexto"); else System.out.println("o ano não é um ano bissexto"); } }
576
0.556918
0.534151
18
29.722221
24.632421
70
false
false
0
0
0
0
0
0
0.611111
false
false
0
0131beddeaaa4a55a4c76226ed4a61d61da55fc0
23,493,471,165,758
f643b91f752a38aa517049f2cf4d03fcf06e9852
/Quize/src/Wellcome.java
35bf882c91fbf96db18cf561e4e32fc3038ee1aa
[]
no_license
ARSpinder/QuizeCompidition
https://github.com/ARSpinder/QuizeCompidition
a1a82a7591dccde047894bef3f0fd4ced22ca7fd
657da6e6507ec1fd2f217002b2672ca3d0a8ee08
refs/heads/master
2020-06-18T20:28:29.024000
2019-07-11T17:17:36
2019-07-11T17:17:36
196,436,563
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.awt.BorderLayout; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.JLabel; import java.awt.Font; import java.awt.Color; import javax.swing.JButton; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class Wellcome extends JFrame { private JPanel contentPane; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { Wellcome frame = new Wellcome(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public Wellcome() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 623, 457); contentPane = new JPanel(); contentPane.setBackground(Color.LIGHT_GRAY); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JLabel lblNewLabel = new JLabel("WELLCOME TO QUIZE COMPETITION"); lblNewLabel.setForeground(new Color(0, 51, 153)); lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 30)); lblNewLabel.setBounds(10, 22, 587, 55); contentPane.add(lblNewLabel); JLabel lblNewLabel_2 = new JLabel("RULES OF QUIZ COMPETITION"); lblNewLabel_2.setForeground(Color.RED); lblNewLabel_2.setFont(new Font("Tahoma", Font.BOLD, 18)); lblNewLabel_2.setBounds(29, 108, 465, 37); contentPane.add(lblNewLabel_2); JLabel lblNewLabel_1 = new JLabel("There are 10 Question Based on different subjects. You have 4 Options to choose select the "); lblNewLabel_1.setFont(new Font("Tahoma", Font.BOLD, 11)); lblNewLabel_1.setBounds(29, 170, 563, 31); contentPane.add(lblNewLabel_1); JLabel lblNewLabel_3 = new JLabel("correct answer. Best of Luck"); lblNewLabel_3.setFont(new Font("Tahoma", Font.BOLD, 11)); lblNewLabel_3.setBounds(39, 212, 504, 14); contentPane.add(lblNewLabel_3); JLabel lblNewLabel_4 = new JLabel("NOTE"); lblNewLabel_4.setFont(new Font("Tahoma", Font.BOLD, 15)); lblNewLabel_4.setForeground(Color.RED); lblNewLabel_4.setBounds(25, 259, 60, 14); contentPane.add(lblNewLabel_4); JLabel lblNewLabel_5 = new JLabel("\u2022 Don\u2019t use Internet"); lblNewLabel_5.setForeground(Color.RED); lblNewLabel_5.setBounds(23, 299, 135, 14); contentPane.add(lblNewLabel_5); JLabel lblYouHave = new JLabel("\u2022 You have only 10 mints to solve the Quize"); lblYouHave.setForeground(Color.RED); lblYouHave.setBounds(33, 324, 255, 14); contentPane.add(lblYouHave); JButton btstart = new JButton("Click Here To Start"); btstart.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Qno1 obj = new Qno1(); obj.setVisible(true); } }); btstart.setFont(new Font("Tahoma", Font.BOLD, 14)); btstart.setForeground(Color.RED); btstart.setBounds(208, 370, 186, 23); contentPane.add(btstart); } }
UTF-8
Java
3,178
java
Wellcome.java
Java
[]
null
[]
import java.awt.BorderLayout; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.JLabel; import java.awt.Font; import java.awt.Color; import javax.swing.JButton; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class Wellcome extends JFrame { private JPanel contentPane; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { Wellcome frame = new Wellcome(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public Wellcome() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 623, 457); contentPane = new JPanel(); contentPane.setBackground(Color.LIGHT_GRAY); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JLabel lblNewLabel = new JLabel("WELLCOME TO QUIZE COMPETITION"); lblNewLabel.setForeground(new Color(0, 51, 153)); lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 30)); lblNewLabel.setBounds(10, 22, 587, 55); contentPane.add(lblNewLabel); JLabel lblNewLabel_2 = new JLabel("RULES OF QUIZ COMPETITION"); lblNewLabel_2.setForeground(Color.RED); lblNewLabel_2.setFont(new Font("Tahoma", Font.BOLD, 18)); lblNewLabel_2.setBounds(29, 108, 465, 37); contentPane.add(lblNewLabel_2); JLabel lblNewLabel_1 = new JLabel("There are 10 Question Based on different subjects. You have 4 Options to choose select the "); lblNewLabel_1.setFont(new Font("Tahoma", Font.BOLD, 11)); lblNewLabel_1.setBounds(29, 170, 563, 31); contentPane.add(lblNewLabel_1); JLabel lblNewLabel_3 = new JLabel("correct answer. Best of Luck"); lblNewLabel_3.setFont(new Font("Tahoma", Font.BOLD, 11)); lblNewLabel_3.setBounds(39, 212, 504, 14); contentPane.add(lblNewLabel_3); JLabel lblNewLabel_4 = new JLabel("NOTE"); lblNewLabel_4.setFont(new Font("Tahoma", Font.BOLD, 15)); lblNewLabel_4.setForeground(Color.RED); lblNewLabel_4.setBounds(25, 259, 60, 14); contentPane.add(lblNewLabel_4); JLabel lblNewLabel_5 = new JLabel("\u2022 Don\u2019t use Internet"); lblNewLabel_5.setForeground(Color.RED); lblNewLabel_5.setBounds(23, 299, 135, 14); contentPane.add(lblNewLabel_5); JLabel lblYouHave = new JLabel("\u2022 You have only 10 mints to solve the Quize"); lblYouHave.setForeground(Color.RED); lblYouHave.setBounds(33, 324, 255, 14); contentPane.add(lblYouHave); JButton btstart = new JButton("Click Here To Start"); btstart.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Qno1 obj = new Qno1(); obj.setVisible(true); } }); btstart.setFont(new Font("Tahoma", Font.BOLD, 14)); btstart.setForeground(Color.RED); btstart.setBounds(208, 370, 186, 23); contentPane.add(btstart); } }
3,178
0.678729
0.630271
105
28.266666
22.861181
131
false
false
0
0
0
0
0
0
2.942857
false
false
0
109966e9655793426a130835d34ccfbb30c2f421
22,359,599,790,174
0fee5f45487f3003f6a664c3b662245ac9fd274b
/src/diff/ShowSourceInfoWindow2.java
0bb36efb66f2eba719dd6b81f621b28fbc7aea87
[]
no_license
boycy815/java-diff
https://github.com/boycy815/java-diff
c41385069f0e2fd4bef0bf71acc530fe3860115c
734455e9dea45f9b5191066d54b2ee77dd7e41d6
refs/heads/master
2020-04-13T07:17:51.200000
2015-08-09T11:26:40
2015-08-09T11:26:40
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package diff; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Container; import java.awt.Dimension; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Insets; import java.awt.Point; import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.List; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JRootPane; import javax.swing.JScrollPane; import javax.swing.JSplitPane; import javax.swing.JTextPane; import javax.swing.JToolBar; import javax.swing.JViewport; import javax.swing.ScrollPaneConstants; import javax.swing.event.CaretEvent; import javax.swing.event.CaretListener; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.text.BadLocationException; import javax.swing.text.DefaultHighlighter; import javax.swing.text.Highlighter; import javax.swing.text.JTextComponent; import javax.swing.text.SimpleAttributeSet; import javax.swing.text.StyleConstants; import javax.swing.text.StyledDocument; import javax.swing.text.TabSet; import javax.swing.text.TabStop; public class ShowSourceInfoWindow2 implements ActionListener { private static final long serialVersionUID = 1L; String back = "/img/backward.gif"; String backPress = "/img/backwardPressed.jpg"; String backDisable = "/img/backwardDisabled.gif"; String forward = "/img/forward.gif"; String forwardPress = "/img/forwardPressed.jpg"; String forwardDisable = "/img/forwardDisabled.gif"; String close = "/img/notification-close.gif"; int i = 1; int first = 1; Container container; JToolBar toolBar = new JToolBar(); JSplitPane splitPane = new JSplitPane (); JScrollPane jsp1; JTextPane jtp1; StyledDocument doc1; JScrollPane jsp2; JTextPane jtp2; StyledDocument doc2; DefaultHighlighter.DefaultHighlightPainter grayPainter = new DefaultHighlighter.DefaultHighlightPainter(new Color(216,216,216)); DefaultHighlighter.DefaultHighlightPainter whitePainter = new DefaultHighlighter.DefaultHighlightPainter(new Color(255,255,255)); DefaultHighlighter.DefaultHighlightPainter greenPainter = new DefaultHighlighter.DefaultHighlightPainter(new Color(0,255,255)); Highlighter hilite1; Highlighter hilite2; Object lstTag1; int lstStart1; int lstEnd1; Object lstTag2; int lstStart2; int lstEnd2; int startOffset; List<Integer> leftOffsets = new ArrayList<Integer>(); List<Integer> rightOffsets = new ArrayList<Integer>(); int flg = 0; boolean enable; int lineNum1 = 0; int lineNum2 = 0; String separator = System.getProperty("line.separator"); JTextPane lines1 = new JTextPane(){ private static final long serialVersionUID = 1L; public boolean getScrollableTracksViewportWidth(){ return false; } }; JTextPane lines2 = new JTextPane(){ private static final long serialVersionUID = 1L; public boolean getScrollableTracksViewportWidth(){ return false; } }; StyledDocument docLn1; StyledDocument docLn2; JTextPane paths1 = new JTextPane(){ private static final long serialVersionUID = 1L; public boolean getScrollableTracksViewportWidth(){ return false; } }; JTextPane paths2 = new JTextPane(){ private static final long serialVersionUID = 1L; public boolean getScrollableTracksViewportWidth(){ return false; } }; StyledDocument docPh1; StyledDocument docPh2; String path1 = ""; String path2 = ""; Font font = new Font("Courier New",0,11); String filename; ShowSourceInfoWindow2(String filename,boolean enable) { this.filename = filename; this.enable = enable; Container container = new JRootPane(); container.setLayout(new BorderLayout()); hilite1 = new MyHighlighter(); hilite2 = new MyHighlighter(); Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); this.jtp1 = new JTextPane(){ private static final long serialVersionUID = 1L; public boolean getScrollableTracksViewportWidth(){ return false; } public void setSize(Dimension d){ if(d.width < getParent().getSize().width){ d.width = getParent().getSize().width; } d.width += 100; super.setSize(d); } }; // cut off the auto wrap and set the JTextpane's viewWidth //jtp1.setSelectionColor(new Color(1.0f, 1.0f, 1.0f, 0.0f)); jtp1.addCaretListener(new CaretListener() { @Override public void caretUpdate(CaretEvent e) { int currentLine = getLineFromOffset(jtp1,e); startOffset = getLineStartOffsetForLine(jtp1, currentLine); flg = 0; jtp1.getCaret().setVisible(true); jtp2.getCaret().setVisible(false); } }); jtp1.setEditable(false); jtp1.setHighlighter(hilite1); jtp1.setFont(font); this.doc1 = jtp1.getStyledDocument(); this.setTabs(jtp1,doc1,4); // tab stop value is 4,the same as UE this.jsp1 = new JScrollPane(jtp1, ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); //lines1.setAlignmentX(RIGHT_ALIGNMENT); docLn1 = lines1.getStyledDocument(); setTabs(lines1,docLn1,4); lines1.setFont(font); lines1.setBackground(new Color(238,236,225)); lines1.setEditable(false); jsp1.setRowHeaderView(lines1); docPh1 = paths1.getStyledDocument(); paths1.setFont(font); paths1.setBackground(new Color(238,236,225)); paths1.setEditable(false); jsp1.setColumnHeaderView(paths1); this.jtp2 = new JTextPane(){ private static final long serialVersionUID = 1L; public boolean getScrollableTracksViewportWidth(){ return false; } public void setSize(Dimension d){ if(d.width < getParent().getSize().width){ d.width = getParent().getSize().width; } d.width += 100; super.setSize(d); } }; // cut off the auto wrap and set the JTextpane's viewWidth jtp2.addCaretListener(new CaretListener() { @Override public void caretUpdate(CaretEvent e) { int currentLine = getLineFromOffset(jtp2,e); startOffset = getLineStartOffsetForLine(jtp2, currentLine); flg = 1; jtp1.getCaret().setVisible(false); jtp2.getCaret().setVisible(true); } }); jtp2.setEditable(false); jtp2.setHighlighter(hilite2); jtp2.setFont(font); this.doc2 = jtp2.getStyledDocument(); this.setTabs(jtp2,doc2,4); // tab stop value is 4,the same as UE this.jsp2 = new JScrollPane(jtp2, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); docLn2 = lines2.getStyledDocument(); setTabs(lines2,docLn2,4); lines2.setFont(font); lines2.setBackground(new Color(238,236,225)); lines2.setEditable(false); jsp2.setRowHeaderView(lines2); docPh2 = paths2.getStyledDocument(); paths2.setFont(font); paths2.setBackground(new Color(238,236,225)); paths2.setEditable(false); jsp2.setColumnHeaderView(paths2); SimpleAttributeSet setLn = new SimpleAttributeSet(); StyleConstants.setAlignment(setLn, StyleConstants.ALIGN_RIGHT); docLn1.setParagraphAttributes(0, docLn1.getLength(), setLn, true); docLn2.setParagraphAttributes(0, docLn2.getLength(), setLn, true); ChangeListener cl = new ChangeListener() { public void stateChanged(ChangeEvent e) { JViewport src = null; JViewport tgt = null; if (e.getSource() == jsp1.getViewport()) { src = jsp1.getViewport(); tgt = jsp2.getViewport(); } else if (e.getSource() == jsp2.getViewport()) { src = jsp2.getViewport(); tgt = jsp1.getViewport(); } Point pnt1 = src.getViewPosition(); tgt.setViewPosition(pnt1); } }; jsp1.getViewport().addChangeListener(cl); jsp2.getViewport().addChangeListener(cl); this.splitPane.setOneTouchExpandable (true); this.splitPane.setContinuousLayout (true); this.splitPane.setPreferredSize (d); this.splitPane.setOrientation (JSplitPane.HORIZONTAL_SPLIT); this.splitPane.setLeftComponent (jsp1); this.splitPane.setRightComponent (jsp2); this.splitPane.setDividerSize (5); this.splitPane.setDividerLocation(0.5056); this.splitPane.setResizeWeight(0.5056); JButton jb1 = null; if(enable){ jb1 = new JButton(new ImageIcon(this.getClass().getResource(back))); jb1.setPressedIcon(new ImageIcon(this.getClass().getResource(backPress))); jb1.setActionCommand("back"); jb1.addActionListener(this); }else{ jb1 = new JButton(new ImageIcon(this.getClass().getResource(backDisable))); } jb1.setBorder(null); jb1.setContentAreaFilled(false); JButton jb2 = null; if(enable){ jb2 = new JButton(new ImageIcon(this.getClass().getResource(forward))); jb2.setPressedIcon(new ImageIcon(this.getClass().getResource(forwardPress))); jb2.setActionCommand("forward"); jb2.addActionListener(this); }else{ jb2 = new JButton(new ImageIcon(this.getClass().getResource(forwardDisable))); } jb2.setBorder(null); jb2.setContentAreaFilled(false); toolBar.add(jb1); toolBar.add(jb2); container.add(toolBar,BorderLayout.NORTH); container.add(splitPane,BorderLayout.CENTER); setTab(container); //set focus MainWindow.rjtp.setSelectedComponent(container); } public void setTab(final Container container) { MainWindow.rjtp.addTab(null, container); JLabel tabLabel = new JLabel(filename); tabLabel.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { if (e.getClickCount() == 2) { int closeTabNumber = MainWindow.rjtp .indexOfComponent(container); MainWindow.rjtp.removeTabAt(closeTabNumber); } else if (e.getClickCount() == 1) { MainWindow.rjtp.setSelectedComponent(container); } } }); MainWindow.rjtp.setTabComponentAt(MainWindow.rjtp.getTabCount() - 1, tabLabel); } public int getLineFromOffset(JTextComponent component, CaretEvent e) { return component.getDocument().getDefaultRootElement().getElementIndex(e.getDot()); } public int getLineStartOffsetForLine(JTextComponent component, int line) { return component.getDocument().getDefaultRootElement().getElement(line).getStartOffset(); } public void setTabs(JTextPane jtp,StyledDocument doc,int charactersPerTab){ FontMetrics fm = jtp.getFontMetrics(jtp.getFont()); int charWidth = fm.charWidth('W'); int tabWidth = charWidth*charactersPerTab; TabStop[] tabs = new TabStop[10]; for(int i = 1;i <= tabs.length;i ++){ tabs[i - 1] = new TabStop(i*tabWidth); } TabSet tabSet = new TabSet(tabs); SimpleAttributeSet set = new SimpleAttributeSet(); StyleConstants.setTabSet(set, tabSet); doc.setParagraphAttributes(0, doc.getLength(), set, true); } public void showDiffInfo(String oldLine,String newLine,int type) { if(first == 1 && oldLine.matches("^(oldPath:).*") && newLine.matches("^(newPath:).*")){ try { docPh1.insertString(docPh1.getLength(),oldLine, null); docPh2.insertString(docPh2.getLength(),newLine, null); } catch (BadLocationException e) { e.printStackTrace(); } first ++; return; } Color foreColor = null; SimpleAttributeSet set1 = new SimpleAttributeSet(); SimpleAttributeSet set2 = new SimpleAttributeSet(); switch (type) { case 1: foreColor = Color.BLACK; StyleConstants.setForeground(set1, foreColor); StyleConstants.setForeground(set2, foreColor); try { docLn1.insertString(docLn1.getLength()," " + ++lineNum1 + separator, null); docLn2.insertString(docLn2.getLength()," " + ++lineNum2 + separator, null); } catch (BadLocationException e1) { e1.printStackTrace(); } break; case 2: foreColor = new Color(0,176,80) ; // green StyleConstants.setForeground(set1, foreColor); StyleConstants.setForeground(set2, foreColor); try { docLn1.insertString(docLn1.getLength()," " + "" + separator, null); docLn2.insertString(docLn2.getLength()," " + ++lineNum2 + separator, null); } catch (BadLocationException e1) { e1.printStackTrace(); } break; case 3: foreColor = Color.RED; StyleConstants.setForeground(set1, foreColor); StyleConstants.setForeground(set2, foreColor); try { docLn1.insertString(docLn1.getLength()," " + ++lineNum1 + separator, null); docLn2.insertString(docLn2.getLength()," " + "" + separator, null); } catch (BadLocationException e1) { e1.printStackTrace(); } break; case 4: foreColor = Color.BLUE; StyleConstants.setForeground(set1, foreColor); foreColor = new Color(228,109,10); StyleConstants.setForeground(set2, foreColor); try { docLn1.insertString(docLn1.getLength(), " " + ++lineNum1 + separator, null); docLn2.insertString(docLn2.getLength(), " " + ++lineNum2 + separator, null); } catch (BadLocationException e1) { e1.printStackTrace(); } break; } try { int lastEndOffset1 = doc1.getLength(); int lastEndOffset2 = doc2.getLength(); doc1.insertString(doc1.getLength(), oldLine + separator, set1); doc2.insertString(doc2.getLength(), newLine + separator, set2); int currentEndOffset1 = doc1.getLength(); int currentEndOffset2 = doc2.getLength(); Object currentTag1 = null; Object currentTag2 = null; if(type != 1){ currentTag1 = hilite1.addHighlight(lastEndOffset1, currentEndOffset1, grayPainter); currentTag2 = hilite2.addHighlight(lastEndOffset2, currentEndOffset2, grayPainter); leftOffsets.add(lastEndOffset1); rightOffsets.add(lastEndOffset2); }else{ currentTag1 = hilite1.addHighlight(lastEndOffset1, currentEndOffset1, whitePainter); currentTag2 = hilite2.addHighlight(lastEndOffset2, currentEndOffset2, whitePainter); } if(lstTag1 != null){ hilite1.changeHighlight(lstTag1, lstStart1, lstEnd1); } if(lstTag2 != null){ hilite2.changeHighlight(lstTag2, lstStart2, lstEnd2); } lstTag1 = currentTag1; lstStart1 = lastEndOffset1; lstEnd1 = currentEndOffset1; lstTag2 = currentTag2; lstStart2 = lastEndOffset2; lstEnd2 = currentEndOffset2; } catch (BadLocationException e) { e.printStackTrace(); } } @Override public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if(command.equals("back")){ if(flg == 0){ int idx = leftOffsets.indexOf(startOffset); int size = leftOffsets.size(); if(idx != -1){ if(idx == 0){ idx = size; } jtp2.setCaretPosition(rightOffsets.get(idx - 1)); jtp1.setCaretPosition(leftOffsets.get(idx - 1)); }else{ for(int i = 0;i < size;i ++){ if(i == size - 1){ jtp2.setCaretPosition(rightOffsets.get(i)); jtp1.setCaretPosition(leftOffsets.get(i)); break; } if(leftOffsets.get(i)<startOffset && startOffset<leftOffsets.get(i + 1)){ jtp2.setCaretPosition(rightOffsets.get(i)); jtp1.setCaretPosition(leftOffsets.get(i)); break; } } } }else{ int idx = rightOffsets.indexOf(startOffset); int size = rightOffsets.size(); if(idx != -1){ if(idx == 0){ idx = size; } jtp1.setCaretPosition(leftOffsets.get(idx - 1)); jtp2.setCaretPosition(rightOffsets.get(idx - 1)); }else{ for(int i = 0;i < size;i ++){ if(i == size - 1){ jtp1.setCaretPosition(leftOffsets.get(i)); jtp2.setCaretPosition(rightOffsets.get(i)); break; } if(rightOffsets.get(i)<startOffset && startOffset<rightOffsets.get(i + 1)){ jtp1.setCaretPosition(leftOffsets.get(i)); jtp2.setCaretPosition(rightOffsets.get(i)); break; } } } } }else{ if(flg == 0){ int idx = leftOffsets.indexOf(startOffset); int size = leftOffsets.size(); if(idx != -1){ if(idx == size - 1){ idx = -1; } jtp2.setCaretPosition(rightOffsets.get(idx + 1)); jtp1.setCaretPosition(leftOffsets.get(idx + 1)); }else{ for(int i = 0;i < size;i ++){ if(i == size - 1){ jtp2.setCaretPosition(rightOffsets.get(0)); jtp1.setCaretPosition(leftOffsets.get(0)); break; } if(leftOffsets.get(i)<startOffset && startOffset<leftOffsets.get(i + 1)){ jtp2.setCaretPosition(rightOffsets.get(i + 1)); jtp1.setCaretPosition(leftOffsets.get(i + 1)); break; } } } }else{ int idx = rightOffsets.indexOf(startOffset); int size = rightOffsets.size(); if(idx != -1){ if(idx == size - 1){ idx = -1; } jtp1.setCaretPosition(leftOffsets.get(idx + 1)); jtp2.setCaretPosition(rightOffsets.get(idx + 1)); }else{ for(int i = 0;i < size;i ++){ if(i == size - 1){ jtp1.setCaretPosition(leftOffsets.get(0)); jtp2.setCaretPosition(rightOffsets.get(0)); break; } if(rightOffsets.get(i)<startOffset && startOffset<rightOffsets.get(i + 1)){ jtp1.setCaretPosition(leftOffsets.get(i + 1)); jtp2.setCaretPosition(rightOffsets.get(i + 1)); break; } } } } } } } class MyHighlighter extends DefaultHighlighter{ private JTextComponent component; /** * @see javax.swing.text.DefaultHighlighter#install(javax.swing.text.JTextComponent) */ @Override public final void install(final JTextComponent c) { super.install(c); this.component = c; } /** * @see javax.swing.text.DefaultHighlighter#deinstall(javax.swing.text.JTextComponent) */ @Override public final void deinstall(final JTextComponent c) { super.deinstall(c); this.component = null; } /** * Same algo, except width is not modified with the insets. * * @see javax.swing.text.DefaultHighlighter#paint(java.awt.Graphics) */ @Override public final void paint(final Graphics g){ final Highlighter.Highlight[] highlights = getHighlights(); final int len = highlights.length; for (int i = 0; i < len; i++){ Highlighter.Highlight info = highlights[i]; if (info.getClass().getName().indexOf("LayeredHighlightInfo") > -1){ // Avoid allocing unless we need it. final Rectangle a = this.component.getBounds(); final Insets insets = this.component.getInsets(); a.x = insets.left; a.y = insets.top; //a.width -= insets.left + insets.right + 100; a.height -= insets.top + insets.bottom; for (; i < len; i++){ info = highlights[i]; if (info.getClass().getName().indexOf("LayeredHighlightInfo") > -1){ final Highlighter.HighlightPainter p = info.getPainter(); p.paint(g, info.getStartOffset(), info.getEndOffset(), a, this.component); } } } } } }
UTF-8
Java
19,065
java
ShowSourceInfoWindow2.java
Java
[]
null
[]
package diff; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Container; import java.awt.Dimension; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Insets; import java.awt.Point; import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.List; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JRootPane; import javax.swing.JScrollPane; import javax.swing.JSplitPane; import javax.swing.JTextPane; import javax.swing.JToolBar; import javax.swing.JViewport; import javax.swing.ScrollPaneConstants; import javax.swing.event.CaretEvent; import javax.swing.event.CaretListener; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.text.BadLocationException; import javax.swing.text.DefaultHighlighter; import javax.swing.text.Highlighter; import javax.swing.text.JTextComponent; import javax.swing.text.SimpleAttributeSet; import javax.swing.text.StyleConstants; import javax.swing.text.StyledDocument; import javax.swing.text.TabSet; import javax.swing.text.TabStop; public class ShowSourceInfoWindow2 implements ActionListener { private static final long serialVersionUID = 1L; String back = "/img/backward.gif"; String backPress = "/img/backwardPressed.jpg"; String backDisable = "/img/backwardDisabled.gif"; String forward = "/img/forward.gif"; String forwardPress = "/img/forwardPressed.jpg"; String forwardDisable = "/img/forwardDisabled.gif"; String close = "/img/notification-close.gif"; int i = 1; int first = 1; Container container; JToolBar toolBar = new JToolBar(); JSplitPane splitPane = new JSplitPane (); JScrollPane jsp1; JTextPane jtp1; StyledDocument doc1; JScrollPane jsp2; JTextPane jtp2; StyledDocument doc2; DefaultHighlighter.DefaultHighlightPainter grayPainter = new DefaultHighlighter.DefaultHighlightPainter(new Color(216,216,216)); DefaultHighlighter.DefaultHighlightPainter whitePainter = new DefaultHighlighter.DefaultHighlightPainter(new Color(255,255,255)); DefaultHighlighter.DefaultHighlightPainter greenPainter = new DefaultHighlighter.DefaultHighlightPainter(new Color(0,255,255)); Highlighter hilite1; Highlighter hilite2; Object lstTag1; int lstStart1; int lstEnd1; Object lstTag2; int lstStart2; int lstEnd2; int startOffset; List<Integer> leftOffsets = new ArrayList<Integer>(); List<Integer> rightOffsets = new ArrayList<Integer>(); int flg = 0; boolean enable; int lineNum1 = 0; int lineNum2 = 0; String separator = System.getProperty("line.separator"); JTextPane lines1 = new JTextPane(){ private static final long serialVersionUID = 1L; public boolean getScrollableTracksViewportWidth(){ return false; } }; JTextPane lines2 = new JTextPane(){ private static final long serialVersionUID = 1L; public boolean getScrollableTracksViewportWidth(){ return false; } }; StyledDocument docLn1; StyledDocument docLn2; JTextPane paths1 = new JTextPane(){ private static final long serialVersionUID = 1L; public boolean getScrollableTracksViewportWidth(){ return false; } }; JTextPane paths2 = new JTextPane(){ private static final long serialVersionUID = 1L; public boolean getScrollableTracksViewportWidth(){ return false; } }; StyledDocument docPh1; StyledDocument docPh2; String path1 = ""; String path2 = ""; Font font = new Font("Courier New",0,11); String filename; ShowSourceInfoWindow2(String filename,boolean enable) { this.filename = filename; this.enable = enable; Container container = new JRootPane(); container.setLayout(new BorderLayout()); hilite1 = new MyHighlighter(); hilite2 = new MyHighlighter(); Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); this.jtp1 = new JTextPane(){ private static final long serialVersionUID = 1L; public boolean getScrollableTracksViewportWidth(){ return false; } public void setSize(Dimension d){ if(d.width < getParent().getSize().width){ d.width = getParent().getSize().width; } d.width += 100; super.setSize(d); } }; // cut off the auto wrap and set the JTextpane's viewWidth //jtp1.setSelectionColor(new Color(1.0f, 1.0f, 1.0f, 0.0f)); jtp1.addCaretListener(new CaretListener() { @Override public void caretUpdate(CaretEvent e) { int currentLine = getLineFromOffset(jtp1,e); startOffset = getLineStartOffsetForLine(jtp1, currentLine); flg = 0; jtp1.getCaret().setVisible(true); jtp2.getCaret().setVisible(false); } }); jtp1.setEditable(false); jtp1.setHighlighter(hilite1); jtp1.setFont(font); this.doc1 = jtp1.getStyledDocument(); this.setTabs(jtp1,doc1,4); // tab stop value is 4,the same as UE this.jsp1 = new JScrollPane(jtp1, ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); //lines1.setAlignmentX(RIGHT_ALIGNMENT); docLn1 = lines1.getStyledDocument(); setTabs(lines1,docLn1,4); lines1.setFont(font); lines1.setBackground(new Color(238,236,225)); lines1.setEditable(false); jsp1.setRowHeaderView(lines1); docPh1 = paths1.getStyledDocument(); paths1.setFont(font); paths1.setBackground(new Color(238,236,225)); paths1.setEditable(false); jsp1.setColumnHeaderView(paths1); this.jtp2 = new JTextPane(){ private static final long serialVersionUID = 1L; public boolean getScrollableTracksViewportWidth(){ return false; } public void setSize(Dimension d){ if(d.width < getParent().getSize().width){ d.width = getParent().getSize().width; } d.width += 100; super.setSize(d); } }; // cut off the auto wrap and set the JTextpane's viewWidth jtp2.addCaretListener(new CaretListener() { @Override public void caretUpdate(CaretEvent e) { int currentLine = getLineFromOffset(jtp2,e); startOffset = getLineStartOffsetForLine(jtp2, currentLine); flg = 1; jtp1.getCaret().setVisible(false); jtp2.getCaret().setVisible(true); } }); jtp2.setEditable(false); jtp2.setHighlighter(hilite2); jtp2.setFont(font); this.doc2 = jtp2.getStyledDocument(); this.setTabs(jtp2,doc2,4); // tab stop value is 4,the same as UE this.jsp2 = new JScrollPane(jtp2, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); docLn2 = lines2.getStyledDocument(); setTabs(lines2,docLn2,4); lines2.setFont(font); lines2.setBackground(new Color(238,236,225)); lines2.setEditable(false); jsp2.setRowHeaderView(lines2); docPh2 = paths2.getStyledDocument(); paths2.setFont(font); paths2.setBackground(new Color(238,236,225)); paths2.setEditable(false); jsp2.setColumnHeaderView(paths2); SimpleAttributeSet setLn = new SimpleAttributeSet(); StyleConstants.setAlignment(setLn, StyleConstants.ALIGN_RIGHT); docLn1.setParagraphAttributes(0, docLn1.getLength(), setLn, true); docLn2.setParagraphAttributes(0, docLn2.getLength(), setLn, true); ChangeListener cl = new ChangeListener() { public void stateChanged(ChangeEvent e) { JViewport src = null; JViewport tgt = null; if (e.getSource() == jsp1.getViewport()) { src = jsp1.getViewport(); tgt = jsp2.getViewport(); } else if (e.getSource() == jsp2.getViewport()) { src = jsp2.getViewport(); tgt = jsp1.getViewport(); } Point pnt1 = src.getViewPosition(); tgt.setViewPosition(pnt1); } }; jsp1.getViewport().addChangeListener(cl); jsp2.getViewport().addChangeListener(cl); this.splitPane.setOneTouchExpandable (true); this.splitPane.setContinuousLayout (true); this.splitPane.setPreferredSize (d); this.splitPane.setOrientation (JSplitPane.HORIZONTAL_SPLIT); this.splitPane.setLeftComponent (jsp1); this.splitPane.setRightComponent (jsp2); this.splitPane.setDividerSize (5); this.splitPane.setDividerLocation(0.5056); this.splitPane.setResizeWeight(0.5056); JButton jb1 = null; if(enable){ jb1 = new JButton(new ImageIcon(this.getClass().getResource(back))); jb1.setPressedIcon(new ImageIcon(this.getClass().getResource(backPress))); jb1.setActionCommand("back"); jb1.addActionListener(this); }else{ jb1 = new JButton(new ImageIcon(this.getClass().getResource(backDisable))); } jb1.setBorder(null); jb1.setContentAreaFilled(false); JButton jb2 = null; if(enable){ jb2 = new JButton(new ImageIcon(this.getClass().getResource(forward))); jb2.setPressedIcon(new ImageIcon(this.getClass().getResource(forwardPress))); jb2.setActionCommand("forward"); jb2.addActionListener(this); }else{ jb2 = new JButton(new ImageIcon(this.getClass().getResource(forwardDisable))); } jb2.setBorder(null); jb2.setContentAreaFilled(false); toolBar.add(jb1); toolBar.add(jb2); container.add(toolBar,BorderLayout.NORTH); container.add(splitPane,BorderLayout.CENTER); setTab(container); //set focus MainWindow.rjtp.setSelectedComponent(container); } public void setTab(final Container container) { MainWindow.rjtp.addTab(null, container); JLabel tabLabel = new JLabel(filename); tabLabel.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { if (e.getClickCount() == 2) { int closeTabNumber = MainWindow.rjtp .indexOfComponent(container); MainWindow.rjtp.removeTabAt(closeTabNumber); } else if (e.getClickCount() == 1) { MainWindow.rjtp.setSelectedComponent(container); } } }); MainWindow.rjtp.setTabComponentAt(MainWindow.rjtp.getTabCount() - 1, tabLabel); } public int getLineFromOffset(JTextComponent component, CaretEvent e) { return component.getDocument().getDefaultRootElement().getElementIndex(e.getDot()); } public int getLineStartOffsetForLine(JTextComponent component, int line) { return component.getDocument().getDefaultRootElement().getElement(line).getStartOffset(); } public void setTabs(JTextPane jtp,StyledDocument doc,int charactersPerTab){ FontMetrics fm = jtp.getFontMetrics(jtp.getFont()); int charWidth = fm.charWidth('W'); int tabWidth = charWidth*charactersPerTab; TabStop[] tabs = new TabStop[10]; for(int i = 1;i <= tabs.length;i ++){ tabs[i - 1] = new TabStop(i*tabWidth); } TabSet tabSet = new TabSet(tabs); SimpleAttributeSet set = new SimpleAttributeSet(); StyleConstants.setTabSet(set, tabSet); doc.setParagraphAttributes(0, doc.getLength(), set, true); } public void showDiffInfo(String oldLine,String newLine,int type) { if(first == 1 && oldLine.matches("^(oldPath:).*") && newLine.matches("^(newPath:).*")){ try { docPh1.insertString(docPh1.getLength(),oldLine, null); docPh2.insertString(docPh2.getLength(),newLine, null); } catch (BadLocationException e) { e.printStackTrace(); } first ++; return; } Color foreColor = null; SimpleAttributeSet set1 = new SimpleAttributeSet(); SimpleAttributeSet set2 = new SimpleAttributeSet(); switch (type) { case 1: foreColor = Color.BLACK; StyleConstants.setForeground(set1, foreColor); StyleConstants.setForeground(set2, foreColor); try { docLn1.insertString(docLn1.getLength()," " + ++lineNum1 + separator, null); docLn2.insertString(docLn2.getLength()," " + ++lineNum2 + separator, null); } catch (BadLocationException e1) { e1.printStackTrace(); } break; case 2: foreColor = new Color(0,176,80) ; // green StyleConstants.setForeground(set1, foreColor); StyleConstants.setForeground(set2, foreColor); try { docLn1.insertString(docLn1.getLength()," " + "" + separator, null); docLn2.insertString(docLn2.getLength()," " + ++lineNum2 + separator, null); } catch (BadLocationException e1) { e1.printStackTrace(); } break; case 3: foreColor = Color.RED; StyleConstants.setForeground(set1, foreColor); StyleConstants.setForeground(set2, foreColor); try { docLn1.insertString(docLn1.getLength()," " + ++lineNum1 + separator, null); docLn2.insertString(docLn2.getLength()," " + "" + separator, null); } catch (BadLocationException e1) { e1.printStackTrace(); } break; case 4: foreColor = Color.BLUE; StyleConstants.setForeground(set1, foreColor); foreColor = new Color(228,109,10); StyleConstants.setForeground(set2, foreColor); try { docLn1.insertString(docLn1.getLength(), " " + ++lineNum1 + separator, null); docLn2.insertString(docLn2.getLength(), " " + ++lineNum2 + separator, null); } catch (BadLocationException e1) { e1.printStackTrace(); } break; } try { int lastEndOffset1 = doc1.getLength(); int lastEndOffset2 = doc2.getLength(); doc1.insertString(doc1.getLength(), oldLine + separator, set1); doc2.insertString(doc2.getLength(), newLine + separator, set2); int currentEndOffset1 = doc1.getLength(); int currentEndOffset2 = doc2.getLength(); Object currentTag1 = null; Object currentTag2 = null; if(type != 1){ currentTag1 = hilite1.addHighlight(lastEndOffset1, currentEndOffset1, grayPainter); currentTag2 = hilite2.addHighlight(lastEndOffset2, currentEndOffset2, grayPainter); leftOffsets.add(lastEndOffset1); rightOffsets.add(lastEndOffset2); }else{ currentTag1 = hilite1.addHighlight(lastEndOffset1, currentEndOffset1, whitePainter); currentTag2 = hilite2.addHighlight(lastEndOffset2, currentEndOffset2, whitePainter); } if(lstTag1 != null){ hilite1.changeHighlight(lstTag1, lstStart1, lstEnd1); } if(lstTag2 != null){ hilite2.changeHighlight(lstTag2, lstStart2, lstEnd2); } lstTag1 = currentTag1; lstStart1 = lastEndOffset1; lstEnd1 = currentEndOffset1; lstTag2 = currentTag2; lstStart2 = lastEndOffset2; lstEnd2 = currentEndOffset2; } catch (BadLocationException e) { e.printStackTrace(); } } @Override public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if(command.equals("back")){ if(flg == 0){ int idx = leftOffsets.indexOf(startOffset); int size = leftOffsets.size(); if(idx != -1){ if(idx == 0){ idx = size; } jtp2.setCaretPosition(rightOffsets.get(idx - 1)); jtp1.setCaretPosition(leftOffsets.get(idx - 1)); }else{ for(int i = 0;i < size;i ++){ if(i == size - 1){ jtp2.setCaretPosition(rightOffsets.get(i)); jtp1.setCaretPosition(leftOffsets.get(i)); break; } if(leftOffsets.get(i)<startOffset && startOffset<leftOffsets.get(i + 1)){ jtp2.setCaretPosition(rightOffsets.get(i)); jtp1.setCaretPosition(leftOffsets.get(i)); break; } } } }else{ int idx = rightOffsets.indexOf(startOffset); int size = rightOffsets.size(); if(idx != -1){ if(idx == 0){ idx = size; } jtp1.setCaretPosition(leftOffsets.get(idx - 1)); jtp2.setCaretPosition(rightOffsets.get(idx - 1)); }else{ for(int i = 0;i < size;i ++){ if(i == size - 1){ jtp1.setCaretPosition(leftOffsets.get(i)); jtp2.setCaretPosition(rightOffsets.get(i)); break; } if(rightOffsets.get(i)<startOffset && startOffset<rightOffsets.get(i + 1)){ jtp1.setCaretPosition(leftOffsets.get(i)); jtp2.setCaretPosition(rightOffsets.get(i)); break; } } } } }else{ if(flg == 0){ int idx = leftOffsets.indexOf(startOffset); int size = leftOffsets.size(); if(idx != -1){ if(idx == size - 1){ idx = -1; } jtp2.setCaretPosition(rightOffsets.get(idx + 1)); jtp1.setCaretPosition(leftOffsets.get(idx + 1)); }else{ for(int i = 0;i < size;i ++){ if(i == size - 1){ jtp2.setCaretPosition(rightOffsets.get(0)); jtp1.setCaretPosition(leftOffsets.get(0)); break; } if(leftOffsets.get(i)<startOffset && startOffset<leftOffsets.get(i + 1)){ jtp2.setCaretPosition(rightOffsets.get(i + 1)); jtp1.setCaretPosition(leftOffsets.get(i + 1)); break; } } } }else{ int idx = rightOffsets.indexOf(startOffset); int size = rightOffsets.size(); if(idx != -1){ if(idx == size - 1){ idx = -1; } jtp1.setCaretPosition(leftOffsets.get(idx + 1)); jtp2.setCaretPosition(rightOffsets.get(idx + 1)); }else{ for(int i = 0;i < size;i ++){ if(i == size - 1){ jtp1.setCaretPosition(leftOffsets.get(0)); jtp2.setCaretPosition(rightOffsets.get(0)); break; } if(rightOffsets.get(i)<startOffset && startOffset<rightOffsets.get(i + 1)){ jtp1.setCaretPosition(leftOffsets.get(i + 1)); jtp2.setCaretPosition(rightOffsets.get(i + 1)); break; } } } } } } } class MyHighlighter extends DefaultHighlighter{ private JTextComponent component; /** * @see javax.swing.text.DefaultHighlighter#install(javax.swing.text.JTextComponent) */ @Override public final void install(final JTextComponent c) { super.install(c); this.component = c; } /** * @see javax.swing.text.DefaultHighlighter#deinstall(javax.swing.text.JTextComponent) */ @Override public final void deinstall(final JTextComponent c) { super.deinstall(c); this.component = null; } /** * Same algo, except width is not modified with the insets. * * @see javax.swing.text.DefaultHighlighter#paint(java.awt.Graphics) */ @Override public final void paint(final Graphics g){ final Highlighter.Highlight[] highlights = getHighlights(); final int len = highlights.length; for (int i = 0; i < len; i++){ Highlighter.Highlight info = highlights[i]; if (info.getClass().getName().indexOf("LayeredHighlightInfo") > -1){ // Avoid allocing unless we need it. final Rectangle a = this.component.getBounds(); final Insets insets = this.component.getInsets(); a.x = insets.left; a.y = insets.top; //a.width -= insets.left + insets.right + 100; a.height -= insets.top + insets.bottom; for (; i < len; i++){ info = highlights[i]; if (info.getClass().getName().indexOf("LayeredHighlightInfo") > -1){ final Highlighter.HighlightPainter p = info.getPainter(); p.paint(g, info.getStartOffset(), info.getEndOffset(), a, this.component); } } } } } }
19,065
0.680829
0.657802
582
31.759451
23.28644
130
false
false
0
0
0
0
0
0
3.264605
false
false
0
4c13ac900d98573c3b75fa8abc48d074dbec1850
807,453,919,379
6b9812c4d0abe3506d2edfd170989996f5b5089c
/src/com/pragma/hibernate/DummyQueryInvocationHandler.java
98beac13c3c6fc69e585bdef8a2a3365f8a2f1b0
[]
no_license
zorzal2/zorzal-tomcat
https://github.com/zorzal2/zorzal-tomcat
e570acd9826f8313fff6fc68f61ae2d39c20b402
4009879d14c6fe1b97fa8cf66a447067aeef7e2e
refs/heads/master
2022-12-24T19:53:56.790000
2019-07-28T20:56:25
2019-07-28T20:56:25
195,703,062
0
0
null
false
2022-12-15T23:23:46
2019-07-07T22:32:10
2019-07-28T20:56:36
2022-12-15T23:23:44
2,644
0
0
4
Java
false
false
package com.pragma.hibernate; import org.hibernate.Query; import org.hibernate.Session; public class DummyQueryInvocationHandler extends AbstractQueryInvocationHandler { public DummyQueryInvocationHandler(){ super(""); } public DummyQueryInvocationHandler(String filterName) { super(filterName); } public Query adapt(Query namedQuery, Session session) { return namedQuery; } }
UTF-8
Java
399
java
DummyQueryInvocationHandler.java
Java
[]
null
[]
package com.pragma.hibernate; import org.hibernate.Query; import org.hibernate.Session; public class DummyQueryInvocationHandler extends AbstractQueryInvocationHandler { public DummyQueryInvocationHandler(){ super(""); } public DummyQueryInvocationHandler(String filterName) { super(filterName); } public Query adapt(Query namedQuery, Session session) { return namedQuery; } }
399
0.779449
0.779449
21
18
22.893126
82
false
false
0
0
0
0
0
0
1
false
false
0
dbf8d7f30a4634b50bb8e5b83903221955afc743
5,660,766,956,420
634dd85aa12e9b11b60d9964434976586061a531
/sdk/webcontent/selenium/src/main/java/com/att/html5sdk/SpeechApp1positive.java
360b31d1deed8829b45e3b3a9d84cbee97edd66f
[]
no_license
thelegend6420/att-html5-sdk
https://github.com/thelegend6420/att-html5-sdk
ccd0c10965558b69aaa05ee22c7c921a62aed55b
5a014bb30c1e1051af06fece546c7d6357e5ab13
refs/heads/master
2020-12-03T07:57:31.226000
2014-06-26T00:05:07
2014-06-26T00:05:07
23,754,597
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.att.html5sdk; import java.io.IOException; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; /** * @class SpeechApp1positive run a simple positive test case for speech to text * App1 */ public class SpeechApp1positive { /** * @method Execute run a simple positive test case for speech to text App1 * * @param submit * The DOM id of the HTML element that submits the sample request * * @param done * The DOM id of the HTML element that dismisses the sample * result * * @returns TestResult */ public TestResult Execute(String submit, String done, String logFile) throws InterruptedException, IOException { // Logger log = Log.getLogger(); Global global = new Global(); String url = global.serverPrefix + global.Speech1Ruby; TestResult testResult = new TestResult("Speech App1 Positive", url, logFile); // start and connect to the Chrome browser System.setProperty("webdriver.chrome.driver", global.webDriverDir); WebDriver driver = new ChromeDriver(); try { WebDriverWait wait = new WebDriverWait(driver, 10); WebDriverWait waitLonger = new WebDriverWait(driver, 30); // navigate to the sample page driver.get(url); try { // Submit speech request testResult.setAction("Click " + submit); wait.until( ExpectedConditions.elementToBeClickable(By.id(submit))) .click(); testResult.setAction("Visibility of success"); wait.until(ExpectedConditions.visibilityOfElementLocated(By .className("success"))); testResult.setAction("Find success text"); String result = driver.findElement(By.className("success")) .getText(); testResult.info(result); testResult.setAction("Wait for Done"); waitLonger.until( ExpectedConditions.elementToBeClickable(By.id(done))) .click(); testResult.complete(result.contains("Success: true")); } catch (Exception e) { testResult.error(e.getMessage()); } } finally { driver.quit(); } return testResult; } }
UTF-8
Java
2,689
java
SpeechApp1positive.java
Java
[]
null
[]
package com.att.html5sdk; import java.io.IOException; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; /** * @class SpeechApp1positive run a simple positive test case for speech to text * App1 */ public class SpeechApp1positive { /** * @method Execute run a simple positive test case for speech to text App1 * * @param submit * The DOM id of the HTML element that submits the sample request * * @param done * The DOM id of the HTML element that dismisses the sample * result * * @returns TestResult */ public TestResult Execute(String submit, String done, String logFile) throws InterruptedException, IOException { // Logger log = Log.getLogger(); Global global = new Global(); String url = global.serverPrefix + global.Speech1Ruby; TestResult testResult = new TestResult("Speech App1 Positive", url, logFile); // start and connect to the Chrome browser System.setProperty("webdriver.chrome.driver", global.webDriverDir); WebDriver driver = new ChromeDriver(); try { WebDriverWait wait = new WebDriverWait(driver, 10); WebDriverWait waitLonger = new WebDriverWait(driver, 30); // navigate to the sample page driver.get(url); try { // Submit speech request testResult.setAction("Click " + submit); wait.until( ExpectedConditions.elementToBeClickable(By.id(submit))) .click(); testResult.setAction("Visibility of success"); wait.until(ExpectedConditions.visibilityOfElementLocated(By .className("success"))); testResult.setAction("Find success text"); String result = driver.findElement(By.className("success")) .getText(); testResult.info(result); testResult.setAction("Wait for Done"); waitLonger.until( ExpectedConditions.elementToBeClickable(By.id(done))) .click(); testResult.complete(result.contains("Success: true")); } catch (Exception e) { testResult.error(e.getMessage()); } } finally { driver.quit(); } return testResult; } }
2,689
0.581257
0.577166
80
32.612499
26.369724
80
false
false
0
0
0
0
0
0
0.4625
false
false
0
cf240e737952c741de3249019835e05575442cc2
28,071,906,297,272
0a32a6a0ff5aabde66badd5c390979d3e06cdad2
/src/edu/nust/behavioral/visitorpattern/Visitor.java
f39194477eda8e90da39f5277c82f07fbcab8c31
[]
no_license
zack624/MyDesignPattern
https://github.com/zack624/MyDesignPattern
c32df446df74c71b84300675f0f8c41d209cf80e
ae96f5c4c8c9fdc6e94935dd5f093d535d2f748c
refs/heads/master
2021-01-14T10:47:33.142000
2016-09-02T13:57:37
2016-09-02T13:57:37
63,217,971
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.nust.behavioral.visitorpattern; public class Visitor { public void visitMenu(Item item){ System.out.println("visit " + item.getName()); } }
UTF-8
Java
157
java
Visitor.java
Java
[]
null
[]
package edu.nust.behavioral.visitorpattern; public class Visitor { public void visitMenu(Item item){ System.out.println("visit " + item.getName()); } }
157
0.732484
0.732484
7
21.428572
19.212029
48
false
false
0
0
0
0
0
0
0.857143
false
false
0
8491edcc529bc3d1865cf0806d1e093bcf895482
8,349,416,487,579
34ca77f38039feaf07d17e166a3387660042da4c
/HashTableArray/src/com/rakesh/hashtable/SimpleHashTable.java
25a2b66a94592569d1aa0a3160ea5a1356a745b3
[]
no_license
raklane/DataStructureAndAlgorithm
https://github.com/raklane/DataStructureAndAlgorithm
ea972fd2b3fc5d441a524f80cf39b28e20b34090
1058c7ed0094a69854a70425e02f8ddcce4526d2
refs/heads/master
2020-07-06T13:38:28.836000
2019-09-05T23:35:08
2019-09-05T23:35:08
203,034,581
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.rakesh.hashtable; public class SimpleHashTable { private StoredEmployee[] employees; public SimpleHashTable(){ employees = new StoredEmployee[10]; } private int hashKey(String key){ return key.length() % employees.length; } public void put(String key, Employee employee){ int hashKey = hashKey(key); if(occupied(hashKey)){ int stopIndex = hashKey; if(hashKey == employees.length-1){ hashKey = 0; }else{ hashKey++; } while (occupied(hashKey) && hashKey != stopIndex){ hashKey = (hashKey+1) % employees.length; } } if(employees[hashKey] != null){ System.out.println("Sorry there is already an employee at position: " + hashKey); }else{ employees[hashKey] = new StoredEmployee(key, employee); } } public boolean occupied(int hashKey){ return employees[hashKey] != null; } public Employee get(String key){ int hashKey = findKey(key); if(hashKey == -1) return null; return employees[hashKey].employee; } public int findKey(String key){ int hashKey = hashKey(key); if(employees[hashKey] != null && employees[hashKey].employee.equals(key)){ return hashKey; } int stopIndex = hashKey; if(hashKey == employees.length) hashKey = 0; else hashKey++; while(hashKey!=stopIndex && !employees[hashKey].key.equals(key)){ hashKey = (hashKey+1) % employees.length; } if(hashKey == stopIndex) return -1; return hashKey; } public void printHashTable(){ for(int i=0; i<employees.length; i++) if(employees[i] == null) System.out.println(i + ":" + "empty"); else System.out.println(i + ":" + employees[i].employee); } public Employee remove(String key){ int hashKey = hashKey(key); StoredEmployee employeeRemoved = employees[hashKey]; employees[hashKey] = null; StoredEmployee[] oldEmployees = employees; employees = new StoredEmployee[oldEmployees.length]; for(int i=0; i<oldEmployees.length; i++){ if(oldEmployees[i] != null) put(oldEmployees[i].key, oldEmployees[i].employee); } return employeeRemoved.employee; } }
UTF-8
Java
2,537
java
SimpleHashTable.java
Java
[]
null
[]
package com.rakesh.hashtable; public class SimpleHashTable { private StoredEmployee[] employees; public SimpleHashTable(){ employees = new StoredEmployee[10]; } private int hashKey(String key){ return key.length() % employees.length; } public void put(String key, Employee employee){ int hashKey = hashKey(key); if(occupied(hashKey)){ int stopIndex = hashKey; if(hashKey == employees.length-1){ hashKey = 0; }else{ hashKey++; } while (occupied(hashKey) && hashKey != stopIndex){ hashKey = (hashKey+1) % employees.length; } } if(employees[hashKey] != null){ System.out.println("Sorry there is already an employee at position: " + hashKey); }else{ employees[hashKey] = new StoredEmployee(key, employee); } } public boolean occupied(int hashKey){ return employees[hashKey] != null; } public Employee get(String key){ int hashKey = findKey(key); if(hashKey == -1) return null; return employees[hashKey].employee; } public int findKey(String key){ int hashKey = hashKey(key); if(employees[hashKey] != null && employees[hashKey].employee.equals(key)){ return hashKey; } int stopIndex = hashKey; if(hashKey == employees.length) hashKey = 0; else hashKey++; while(hashKey!=stopIndex && !employees[hashKey].key.equals(key)){ hashKey = (hashKey+1) % employees.length; } if(hashKey == stopIndex) return -1; return hashKey; } public void printHashTable(){ for(int i=0; i<employees.length; i++) if(employees[i] == null) System.out.println(i + ":" + "empty"); else System.out.println(i + ":" + employees[i].employee); } public Employee remove(String key){ int hashKey = hashKey(key); StoredEmployee employeeRemoved = employees[hashKey]; employees[hashKey] = null; StoredEmployee[] oldEmployees = employees; employees = new StoredEmployee[oldEmployees.length]; for(int i=0; i<oldEmployees.length; i++){ if(oldEmployees[i] != null) put(oldEmployees[i].key, oldEmployees[i].employee); } return employeeRemoved.employee; } }
2,537
0.552621
0.548285
88
27.829546
22.0481
93
false
false
0
0
0
0
0
0
0.443182
false
false
0
3ed7d8e59504669bd7c28510584062ee20dfb849
23,545,010,771,243
0f4b79bd4d3a657ef61826bd717cc8b5278c9f02
/Java Circuit Nodal Analysis Application/Line1.java
8b1dcacafc7c6a49b919495d2295482a1d5b91ed
[]
no_license
computeVisonWebAndroid/JavaApplication
https://github.com/computeVisonWebAndroid/JavaApplication
401569389863bb4fb8f11832b127ab015e5e75bc
797cd0a47b7636ae7988b8c9085e4dd79db86858
refs/heads/master
2021-01-10T13:14:52.674000
2015-10-27T06:53:43
2015-10-27T06:53:43
45,018,035
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import javax.swing.*; import java.awt.*; class Line1 { public Point begin,end; public int x_b,y_b,x_e,y_e; Line1(){}; Line1(Point b, Point e) { begin = b; end = e; x_b = b.x; y_b = b.y; x_e = e.x; y_e = e.y; } Line1(int x1,int y1,int x2, int y2) { begin = new Point(x1,y1); end = new Point(x2,y2); } public void setLine(Point b, Point e) { begin = b; end = e; } public void setLineb(Point b) { begin = b; } public void setLinee(Point e) { end = e; } public void clear() { begin = null; end = null; } public void setLine(int x1,int y1,int x2, int y2) { x_b = x1; y_b = y1; x_e = x2; y_e = y2; } public String toString() // should put public befor String toSting(),otherwise the error will happen { return("begin= "+begin+"\nend= "+end+"\nx_b= "+x_b+"\ty_b= "+y_b+"\tx_e= "+x_e+"\ty_e="+y_e); } public static void main(String[] args) { // Line1 l = new Line1(); // l.setLineb(new Point(3,4)); // l.setLinee(new Point(5,6)); Line1 l = new Line1(1,2,3,4); System.out.println(l); } }
UTF-8
Java
1,079
java
Line1.java
Java
[]
null
[]
import javax.swing.*; import java.awt.*; class Line1 { public Point begin,end; public int x_b,y_b,x_e,y_e; Line1(){}; Line1(Point b, Point e) { begin = b; end = e; x_b = b.x; y_b = b.y; x_e = e.x; y_e = e.y; } Line1(int x1,int y1,int x2, int y2) { begin = new Point(x1,y1); end = new Point(x2,y2); } public void setLine(Point b, Point e) { begin = b; end = e; } public void setLineb(Point b) { begin = b; } public void setLinee(Point e) { end = e; } public void clear() { begin = null; end = null; } public void setLine(int x1,int y1,int x2, int y2) { x_b = x1; y_b = y1; x_e = x2; y_e = y2; } public String toString() // should put public befor String toSting(),otherwise the error will happen { return("begin= "+begin+"\nend= "+end+"\nx_b= "+x_b+"\ty_b= "+y_b+"\tx_e= "+x_e+"\ty_e="+y_e); } public static void main(String[] args) { // Line1 l = new Line1(); // l.setLineb(new Point(3,4)); // l.setLinee(new Point(5,6)); Line1 l = new Line1(1,2,3,4); System.out.println(l); } }
1,079
0.556997
0.52734
75
13.386666
18.502535
101
false
false
0
0
0
0
0
0
1.72
false
false
0
457dbc01048e031320a9c28370e4b19b24b608d4
15,221,364,141,353
43cc49dcdb301af13ec5c389810f5abdf523bc25
/app/src/main/java/com/suguiming/myandroid/tab0/SlidingMenuActivity.java
cc9d74111aae6cd732d1da581b4704b1035c1d1d
[]
no_license
AndyFightting/MyAndroid
https://github.com/AndyFightting/MyAndroid
19e7055693618a25a26892f08fd9cb215d330dd3
aecdca4c72da13b154b8aae630de5e7cbfce9848
refs/heads/master
2020-04-06T07:01:26.739000
2016-09-07T08:54:06
2016-09-07T08:54:06
46,400,256
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.suguiming.myandroid.tab0; import android.os.Bundle; import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu; import com.suguiming.myandroid.R; import com.suguiming.myandroid.base.BaseActivity; import com.suguiming.myandroid.tool.slidingMenu.SlidingMenuLeftView; import com.suguiming.myandroid.tool.slidingMenu.SlidingMenuMainView; import com.suguiming.myandroid.tool.slidingMenu.SlidingMenuRightView; /** * slidingMenu 框架使用方法, * * 1.从官网(https://github.com/jfeinstein10/SlidingMenu)下载源码 * 2.在项目中建一个与app文件夹同级的libraries文件夹,在libraries文件夹里再建一个 SlidingMenu 文件夹 * 3.把下载下来的框架里的library文件夹复制黏贴到 SlidingMenu 文件夹里 * 4.在setting.gradle文件里添加 include ':libraries:SlidingMenu/library' * 5.在项目的build.gradle 文件里 添加 compile project(':libraries:SlidingMenu/library') 就可以用啦 * * 注意:编译会报错,要把源码里的FloatMath.sin() 替换成 Math.sin()。 * (像这样把SlidingMenu当做一个View来使用更灵活) * */ public class SlidingMenuActivity extends BaseActivity { private SlidingMenu slidingMenu; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //透明状态栏, 不是继承 BaseActivity 就加这行 // getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); setContentView(R.layout.activity_sliding_menu); slidingMenu = (SlidingMenu) findViewById(R.id.sliding_layout); slidingMenu.setMode(SlidingMenu.LEFT_RIGHT);//设置左右菜单,有右菜单一定就要有右菜单布局 secondaryMenu slidingMenu.setContent(new SlidingMenuMainView(this,slidingMenu));//设置主页面 slidingMenu.setMenu(new SlidingMenuLeftView(this,slidingMenu));//设置菜单 必须 slidingMenu.setSecondaryMenu(new SlidingMenuRightView(this,slidingMenu));//设置菜单 必须 slidingMenu.setBehindOffsetRes(R.dimen.sliding_left_offset);//越大滑动距离越小。必须 slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);////设置要使菜单滑动,触碰屏幕的范围 slidingMenu.setBehindScrollScale(0.5f);//差异滑动 0 -- 1 //设置边界阴影,和暗淡渐变效果,可以不设置 // slidingMenu.setShadowWidthRes(R.dimen.sliding_shadow_width); // slidingMenu.setShadowDrawable(R.drawable.sliding_frame_shadow); // slidingMenu.setSecondaryShadowDrawable(R.drawable.sliding_frame_shadow); slidingMenu.setFadeDegree(0.7f); //监听开关(开始开关,完成开关) slidingMenu.setOnOpenListener(new SlidingMenu.OnOpenListener() { @Override public void onOpen() { } }); slidingMenu.setOnOpenedListener(new SlidingMenu.OnOpenedListener() { @Override public void onOpened() { } }); slidingMenu.setOnCloseListener(new SlidingMenu.OnCloseListener() { @Override public void onClose() { } }); slidingMenu.setOnClosedListener(new SlidingMenu.OnClosedListener() { @Override public void onClosed() { } }); } }
UTF-8
Java
3,365
java
SlidingMenuActivity.java
Java
[ { "context": "droid.tab0;\n\nimport android.os.Bundle;\nimport com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;\nimport com.suguiming", "end": 91, "score": 0.9933719635009766, "start": 76, "tag": "USERNAME", "value": "jeremyfeinstein" }, { "context": "lidingMenu 框架使用方法,\n *\n * 1.从官网...
null
[]
package com.suguiming.myandroid.tab0; import android.os.Bundle; import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu; import com.suguiming.myandroid.R; import com.suguiming.myandroid.base.BaseActivity; import com.suguiming.myandroid.tool.slidingMenu.SlidingMenuLeftView; import com.suguiming.myandroid.tool.slidingMenu.SlidingMenuMainView; import com.suguiming.myandroid.tool.slidingMenu.SlidingMenuRightView; /** * slidingMenu 框架使用方法, * * 1.从官网(https://github.com/jfeinstein10/SlidingMenu)下载源码 * 2.在项目中建一个与app文件夹同级的libraries文件夹,在libraries文件夹里再建一个 SlidingMenu 文件夹 * 3.把下载下来的框架里的library文件夹复制黏贴到 SlidingMenu 文件夹里 * 4.在setting.gradle文件里添加 include ':libraries:SlidingMenu/library' * 5.在项目的build.gradle 文件里 添加 compile project(':libraries:SlidingMenu/library') 就可以用啦 * * 注意:编译会报错,要把源码里的FloatMath.sin() 替换成 Math.sin()。 * (像这样把SlidingMenu当做一个View来使用更灵活) * */ public class SlidingMenuActivity extends BaseActivity { private SlidingMenu slidingMenu; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //透明状态栏, 不是继承 BaseActivity 就加这行 // getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); setContentView(R.layout.activity_sliding_menu); slidingMenu = (SlidingMenu) findViewById(R.id.sliding_layout); slidingMenu.setMode(SlidingMenu.LEFT_RIGHT);//设置左右菜单,有右菜单一定就要有右菜单布局 secondaryMenu slidingMenu.setContent(new SlidingMenuMainView(this,slidingMenu));//设置主页面 slidingMenu.setMenu(new SlidingMenuLeftView(this,slidingMenu));//设置菜单 必须 slidingMenu.setSecondaryMenu(new SlidingMenuRightView(this,slidingMenu));//设置菜单 必须 slidingMenu.setBehindOffsetRes(R.dimen.sliding_left_offset);//越大滑动距离越小。必须 slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);////设置要使菜单滑动,触碰屏幕的范围 slidingMenu.setBehindScrollScale(0.5f);//差异滑动 0 -- 1 //设置边界阴影,和暗淡渐变效果,可以不设置 // slidingMenu.setShadowWidthRes(R.dimen.sliding_shadow_width); // slidingMenu.setShadowDrawable(R.drawable.sliding_frame_shadow); // slidingMenu.setSecondaryShadowDrawable(R.drawable.sliding_frame_shadow); slidingMenu.setFadeDegree(0.7f); //监听开关(开始开关,完成开关) slidingMenu.setOnOpenListener(new SlidingMenu.OnOpenListener() { @Override public void onOpen() { } }); slidingMenu.setOnOpenedListener(new SlidingMenu.OnOpenedListener() { @Override public void onOpened() { } }); slidingMenu.setOnCloseListener(new SlidingMenu.OnCloseListener() { @Override public void onClose() { } }); slidingMenu.setOnClosedListener(new SlidingMenu.OnClosedListener() { @Override public void onClosed() { } }); } }
3,365
0.708059
0.703217
80
35.137501
30.129198
90
false
false
0
0
0
0
0
0
0.3875
false
false
0
642f2350cade73fb0b046b095dca436c77b1c460
8,632,884,309,517
66efa0be683e7e93a8c53a545b752c7ecd8095c0
/src/kpa.java
f394413273c7587a9633bb87e996a5d3fe8d48c3
[]
no_license
EvaZaf/evaptnpv
https://github.com/EvaZaf/evaptnpv
ccf93fec42d1cebbeebf668c6371fb9c3445257b
c2d74d812117d45a45c8655553891801251e752f
refs/heads/master
2021-07-06T01:18:06.813000
2017-09-29T05:59:14
2017-09-29T05:59:14
105,234,829
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. */ /** * * @author cgntuser */ import javax.swing.JOptionPane; import java.util.ArrayList; public class kpa extends javax.swing.JFrame { /** * Creates new form kpa */ //--------------Δημιουργία λίστας για τα jTextField & jLabel--------------// ArrayList<javax.swing.JTextField> list = new ArrayList<javax.swing.JTextField>(); ArrayList<javax.swing.JLabel> LabelList= new ArrayList<javax.swing.JLabel>(); public kpa() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { jPanel1 = new javax.swing.JPanel(); jButton1 = new javax.swing.JButton(); label1 = new java.awt.Label(); jSeparator1 = new javax.swing.JSeparator(); jSeparator3 = new javax.swing.JSeparator(); result = new java.awt.TextField(); arxkostos = new java.awt.TextField(); label4 = new java.awt.Label(); jSeparator4 = new javax.swing.JSeparator(); jComboBox1 = new javax.swing.JComboBox<>(); jPanel2 = new javax.swing.JPanel(); epitokio = new javax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); jSeparator2 = new javax.swing.JSeparator(); jLabel17 = new javax.swing.JLabel(); jPanel3 = new javax.swing.JPanel(); jLabel2 = new javax.swing.JLabel(); kerdos = new javax.swing.JTextField(); jTextField3 = new javax.swing.JTextField(); jTextField4 = new javax.swing.JTextField(); jTextField5 = new javax.swing.JTextField(); jTextField6 = new javax.swing.JTextField(); jTextField7 = new javax.swing.JTextField(); jTextField8 = new javax.swing.JTextField(); jTextField9 = new javax.swing.JTextField(); jTextField10 = new javax.swing.JTextField(); jTextField11 = new javax.swing.JTextField(); jTextField12 = new javax.swing.JTextField(); jTextField13 = new javax.swing.JTextField(); jTextField14 = new javax.swing.JTextField(); jTextField15 = new javax.swing.JTextField(); jTextField16 = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel(); jLabel12 = new javax.swing.JLabel(); jLabel13 = new javax.swing.JLabel(); jLabel14 = new javax.swing.JLabel(); jLabel15 = new javax.swing.JLabel(); jLabel16 = new javax.swing.JLabel(); jSeparator6 = new javax.swing.JSeparator(); jSeparator7 = new javax.swing.JSeparator(); jLabel1 = new javax.swing.JLabel(); jSeparator5 = new javax.swing.JSeparator(); //--------------------------CUSTOM CODE--------------------------// //unvisible τα jTextFields & jLabels για να εμφανίζονται ανάλογα με την επιλογή του χρήστη //--------------------------jTextFields----------------------------// jTextField3.setVisible(false); jTextField4.setVisible(false); jTextField5.setVisible(false); jTextField6.setVisible(false); jTextField7.setVisible(false); jTextField8.setVisible(false); jTextField9.setVisible(false); jTextField10.setVisible(false); jTextField11.setVisible(false); jTextField12.setVisible(false); jTextField13.setVisible(false); jTextField14.setVisible(false); jTextField15.setVisible(false); jTextField16.setVisible(false); //----------------------------jLabels------------------------------// jLabel3.setVisible(false); jLabel4.setVisible(false); jLabel5.setVisible(false); jLabel6.setVisible(false); jLabel7.setVisible(false); jLabel8.setVisible(false); jLabel9.setVisible(false); jLabel10.setVisible(false); jLabel11.setVisible(false); jLabel12.setVisible(false); jLabel13.setVisible(false); jLabel14.setVisible(false); jLabel15.setVisible(false); jLabel16.setVisible(false); //-----------------------jSeparators unvisible------------------// jSeparator6.setVisible(false); jSeparator7.setVisible(false); //--------------------------------------------------------------// //------add jTextFields on list & jLabels on LabelList----------// //------------------------jTextFields---------------------------// list.add(jTextField3); list.add(jTextField4); list.add(jTextField5); list.add(jTextField6); list.add(jTextField7); list.add(jTextField8); list.add(jTextField9); list.add(jTextField10); list.add(jTextField11); list.add(jTextField12); list.add(jTextField13); list.add(jTextField14); list.add(jTextField15); list.add(jTextField16); //-------------------------jLabel-------------------------------// LabelList.add(jLabel3); LabelList.add(jLabel4); LabelList.add(jLabel5); LabelList.add(jLabel6); LabelList.add(jLabel7); LabelList.add(jLabel8); LabelList.add(jLabel9); LabelList.add(jLabel10); LabelList.add(jLabel11); LabelList.add(jLabel12); LabelList.add(jLabel13); LabelList.add(jLabel14); LabelList.add(jLabel15); LabelList.add(jLabel16); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jPanel1.setBackground(new java.awt.Color(37, 34, 34)); jPanel1.setFont(new java.awt.Font("Book Antiqua", 0, 11)); // NOI18N jButton1.setBackground(new java.awt.Color(34, 34, 37)); jButton1.setFont(new java.awt.Font("Book Antiqua", 1, 11)); // NOI18N jButton1.setForeground(new java.awt.Color(255, 255, 255)); jButton1.setText("Υπολόγισε"); jButton1.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); jButton1.setBorderPainted(false); jButton1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));//W_RESIZE_CURSOR jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); label1.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N label1.setForeground(new java.awt.Color(255, 255, 255)); label1.setText("Χρόνος:"); result.setBackground(new java.awt.Color(37, 34, 34)); result.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N result.setForeground(new java.awt.Color(255, 255, 255)); arxkostos.setBackground(new java.awt.Color(37, 34, 34)); arxkostos.setFont(new java.awt.Font("Book Antiqua", 0, 12)); // NOI18N arxkostos.setForeground(new java.awt.Color(255, 255, 255)); arxkostos.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { arxkostosActionPerformed(evt); } }); label4.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N label4.setForeground(new java.awt.Color(255, 255, 255)); label4.setText("Αρχικό Κόστος:"); jComboBox1.setBackground(new java.awt.Color(37, 34, 34)); jComboBox1.setFont(new java.awt.Font("Book Antiqua", 0, 11)); // NOI18N jComboBox1.setForeground(new java.awt.Color(255, 255, 255)); jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15" })); jComboBox1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));//SE_RESIZE_CURSOR jComboBox1.addAncestorListener(new javax.swing.event.AncestorListener() { public void ancestorMoved(javax.swing.event.AncestorEvent evt) { } public void ancestorAdded(javax.swing.event.AncestorEvent evt) { jComboBox1AncestorAdded(evt); } public void ancestorRemoved(javax.swing.event.AncestorEvent evt) { } }); jComboBox1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jComboBox1ActionPerformed(evt); } }); jPanel2.setBackground(new java.awt.Color(37, 34, 34)); epitokio.setBackground(new java.awt.Color(37, 34, 34)); epitokio.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N epitokio.setForeground(new java.awt.Color(255, 255, 255)); epitokio.setText("Επιτόκιο:"); jTextField1.setBackground(new java.awt.Color(37, 34, 34)); jTextField1.setFont(new java.awt.Font("Book Antiqua", 0, 11)); // NOI18N jTextField1.setForeground(new java.awt.Color(255, 255, 255)); jLabel17.setBackground(new java.awt.Color(37, 34, 34)); jLabel17.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N jLabel17.setForeground(new java.awt.Color(255, 255, 255)); jLabel17.setText("Εκτιμώμενο Κέρδος:"); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(36, 36, 36) .addComponent(epitokio, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(34, 34, 34) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jLabel17) .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(154, Short.MAX_VALUE)) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(epitokio)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel17) .addGap(0, 0, Short.MAX_VALUE)) ); jPanel3.setBackground(new java.awt.Color(37, 34, 34)); jPanel3.setFont(new java.awt.Font("Book Antiqua", 0, 11)); // NOI18N jLabel2.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N jLabel2.setForeground(new java.awt.Color(255, 255, 255)); jLabel2.setText("1ο έτος:"); kerdos.setBackground(new java.awt.Color(37, 34, 34)); kerdos.setForeground(new java.awt.Color(255, 255, 255)); jTextField3.setBackground(new java.awt.Color(37, 34, 34)); jTextField3.setFont(new java.awt.Font("Book Antiqua", 0, 11)); // NOI18N jTextField3.setForeground(new java.awt.Color(255, 255, 255)); jTextField3.setToolTipText(""); jTextField4.setBackground(new java.awt.Color(37, 34, 34)); jTextField4.setFont(new java.awt.Font("Book Antiqua", 0, 11)); // NOI18N jTextField4.setForeground(new java.awt.Color(255, 255, 255)); jTextField4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField4ActionPerformed(evt); } }); jTextField5.setBackground(new java.awt.Color(37, 34, 34)); jTextField5.setFont(new java.awt.Font("Book Antiqua", 0, 11)); // NOI18N jTextField5.setForeground(new java.awt.Color(255, 255, 255)); jTextField6.setBackground(new java.awt.Color(37, 34, 34)); jTextField6.setFont(new java.awt.Font("Book Antiqua", 0, 11)); // NOI18N jTextField6.setForeground(new java.awt.Color(255, 255, 255)); jTextField7.setBackground(new java.awt.Color(37, 34, 34)); jTextField7.setFont(new java.awt.Font("Book Antiqua", 0, 11)); // NOI18N jTextField7.setForeground(new java.awt.Color(255, 255, 255)); jTextField8.setBackground(new java.awt.Color(37, 34, 34)); jTextField8.setFont(new java.awt.Font("Book Antiqua", 0, 11)); // NOI18N jTextField8.setForeground(new java.awt.Color(255, 255, 255)); jTextField9.setBackground(new java.awt.Color(37, 34, 34)); jTextField9.setFont(new java.awt.Font("Book Antiqua", 0, 11)); // NOI18N jTextField9.setForeground(new java.awt.Color(255, 255, 255)); jTextField10.setBackground(new java.awt.Color(37, 34, 34)); jTextField10.setFont(new java.awt.Font("Book Antiqua", 0, 11)); // NOI18N jTextField10.setForeground(new java.awt.Color(255, 255, 255)); jTextField11.setBackground(new java.awt.Color(37, 34, 34)); jTextField11.setFont(new java.awt.Font("Book Antiqua", 0, 11)); // NOI18N jTextField11.setForeground(new java.awt.Color(255, 255, 255)); jTextField12.setBackground(new java.awt.Color(37, 34, 34)); jTextField12.setFont(new java.awt.Font("Book Antiqua", 0, 11)); // NOI18N jTextField12.setForeground(new java.awt.Color(255, 255, 255)); jTextField13.setBackground(new java.awt.Color(37, 34, 34)); jTextField13.setFont(new java.awt.Font("Book Antiqua", 0, 11)); // NOI18N jTextField13.setForeground(new java.awt.Color(255, 255, 255)); jTextField14.setBackground(new java.awt.Color(37, 34, 34)); jTextField14.setFont(new java.awt.Font("Book Antiqua", 0, 11)); // NOI18N jTextField14.setForeground(new java.awt.Color(255, 255, 255)); jTextField15.setBackground(new java.awt.Color(37, 34, 34)); jTextField15.setFont(new java.awt.Font("Book Antiqua", 0, 11)); // NOI18N jTextField15.setForeground(new java.awt.Color(255, 255, 255)); jTextField16.setBackground(new java.awt.Color(37, 34, 34)); jTextField16.setFont(new java.awt.Font("Book Antiqua", 0, 11)); // NOI18N jTextField16.setForeground(new java.awt.Color(255, 255, 255)); jLabel3.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N jLabel3.setForeground(new java.awt.Color(255, 255, 255)); jLabel3.setText("2ο έτος:"); jLabel4.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N jLabel4.setForeground(new java.awt.Color(255, 255, 255)); jLabel4.setText("3ο έτος:"); jLabel5.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N jLabel5.setForeground(new java.awt.Color(255, 255, 255)); jLabel5.setText("4ο έτος:"); jLabel6.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N jLabel6.setForeground(new java.awt.Color(255, 255, 255)); jLabel6.setText("5ο έτος:"); jLabel7.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N jLabel7.setForeground(new java.awt.Color(255, 255, 255)); jLabel7.setText("6ο έτος:"); jLabel8.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N jLabel8.setForeground(new java.awt.Color(255, 255, 255)); jLabel8.setText("7ο έτος:"); jLabel9.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N jLabel9.setForeground(new java.awt.Color(255, 255, 255)); jLabel9.setText("8ο έτος:"); jLabel10.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N jLabel10.setForeground(new java.awt.Color(255, 255, 255)); jLabel10.setText("9ο έτος:"); jLabel11.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N jLabel11.setForeground(new java.awt.Color(255, 255, 255)); jLabel11.setText("10ο έτος:"); jLabel12.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N jLabel12.setForeground(new java.awt.Color(255, 255, 255)); jLabel12.setText("11ο έτος:"); jLabel13.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N jLabel13.setForeground(new java.awt.Color(255, 255, 255)); jLabel13.setText("12ο έτος:"); jLabel14.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N jLabel14.setForeground(new java.awt.Color(255, 255, 255)); jLabel14.setText("13ο έτος:"); jLabel15.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N jLabel15.setForeground(new java.awt.Color(255, 255, 255)); jLabel15.setText("14ο έτος:"); jLabel16.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N jLabel16.setForeground(new java.awt.Color(255, 255, 255)); jLabel16.setText("15ο έτος:"); jSeparator6.setOrientation(javax.swing.SwingConstants.VERTICAL); jSeparator7.setOrientation(javax.swing.SwingConstants.VERTICAL); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup(jPanel3Layout.createSequentialGroup() .addComponent(jLabel6) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel3Layout.createSequentialGroup() .addComponent(jLabel5) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel3Layout.createSequentialGroup() .addComponent(jLabel4) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel3Layout.createSequentialGroup() .addComponent(jLabel3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel3Layout.createSequentialGroup() .addComponent(jLabel2) .addGap(27, 27, 27) .addComponent(kerdos, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jSeparator7, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel8, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel7, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel9, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel10, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel11, javax.swing.GroupLayout.Alignment.TRAILING)) .addGap(34, 34, 34) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTextField8, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField7, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField9, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField10, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField11, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jSeparator6, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel16, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel14, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel15, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel12, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel13, javax.swing.GroupLayout.Alignment.TRAILING)) .addGap(42, 42, 42) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTextField13, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField14, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField15, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField16, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField12, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap()) ); jPanel3Layout.setVerticalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jSeparator6) .addComponent(jSeparator7, javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel3Layout.createSequentialGroup() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(kerdos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel7) .addComponent(jLabel12)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3) .addComponent(jLabel8) .addComponent(jLabel13)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4) .addComponent(jLabel9) .addComponent(jLabel14)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel5) .addComponent(jLabel15) .addComponent(jTextField10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel10)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel6) .addComponent(jLabel11) .addComponent(jLabel16)))) .addContainerGap()) ); jLabel1.setFont(new java.awt.Font("Book Antiqua", 1, 24)); // NOI18N jLabel1.setForeground(new java.awt.Color(255, 255, 255)); jLabel1.setText("Υπολογισμός Καθαρής Παρούσας Αξίας"); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(25, 25, 25) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(jSeparator3, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(label4, javax.swing.GroupLayout.DEFAULT_SIZE, 103, Short.MAX_VALUE) .addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(label1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jSeparator4, javax.swing.GroupLayout.Alignment.LEADING)) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(34, 34, 34) .addComponent(result, javax.swing.GroupLayout.PREFERRED_SIZE, 380, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(18, 18, 18) .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))))) .addContainerGap()) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 455, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() .addGap(146, 146, 146) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jSeparator5) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(arxkostos, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE))))) .addGap(151, 151, 151)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(1, 1, 1) .addComponent(jSeparator5, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(arxkostos, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(label4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jSeparator4, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(label1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(20, 20, 20) .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 10, Short.MAX_VALUE) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(result, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(27, 27, 27)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); pack(); }// </editor-fold> private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed try{ String uarxep = arxkostos.getText(); String uepitokio=jTextField1.getText(); String uposo=kerdos.getText(); double athroisma=0;//Δήλωση μεταβλητής & αρχικοποίηση double result1 = (Double.parseDouble(uepitokio)/100);//---Μετατροπή της τιμής που δίνει ο χρήστης για επιτόκιο σε %---// double epitokio1=0; // athroisma+= Double.parseDouble(uposo)/Math.pow(result1,i); int k = Integer.parseInt(jComboBox1.getSelectedItem().toString()); athroisma += (Double.parseDouble(kerdos.getText())/Math.pow((1+result1),1)); System.out.println(Math.pow((1+result1),0)); for(int i=0;i<k-1;i++){ athroisma+=Double.parseDouble(list.get(i).getText())/Math.pow((1+result1),i+2); System.out.println(Math.pow((1+result1),i+2)); } result.setText(String.valueOf(athroisma-Double.parseDouble(uarxep))); //--------Εμφάνιση μηνύματος ανάλογα με το αποτέλεσμα--------// if(Double.parseDouble(result.getText())> 0){ JOptionPane.showMessageDialog(null, "Succesful"); } else if(Double.parseDouble(result.getText()) == 0) JOptionPane.showMessageDialog(null, "So and So"); else JOptionPane.showMessageDialog(null, "Don't do it"); } catch(Exception e){ System.out.println(e.getMessage()); } }//GEN-LAST:event_jButton1ActionPerformed private void arxkostosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_arxkostosActionPerformed // TODO add your handling code here: }//GEN-LAST:event_arxkostosActionPerformed private void jComboBox1AncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_jComboBox1AncestorAdded // TODO add your handling code here: }//GEN-LAST:event_jComboBox1AncestorAdded private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed /*jComboBox1.addItemListener(new ItemListenertener() { @Override public void itemStateChanged(ItemEvent e) { if(e.getStateChange() == ItemEvent.SELECTED) { kerdos.setText((String) jComboBox1.getSelectedItem()); } } }*/ System.out.println(jComboBox1.getSelectedItem().toString()); int k = Integer.parseInt(jComboBox1.getSelectedItem().toString()); for(int i=0;i<k-1;i++){ list.get(i).setVisible(true); LabelList.get(i).setVisible(true); //---------------------------------------------------------------// if(Integer.parseInt(jComboBox1.getSelectedItem().toString())>5) jSeparator7.setVisible(true); if(Integer.parseInt(jComboBox1.getSelectedItem().toString())>10) jSeparator6.setVisible(true); } for(int i=k-1;i<list.size();i++){ list.get(i).setVisible(false); LabelList.get(i).setVisible(false); //-----------------------------------------------------------// if(Integer.parseInt(jComboBox1.getSelectedItem().toString())<6) jSeparator7.setVisible(false); if(Integer.parseInt(jComboBox1.getSelectedItem().toString())<11) jSeparator6.setVisible(false); } this.validate(); }//GEN-LAST:event_jComboBox1ActionPerformed private void jTextField4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField4ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField4ActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(kpa.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(kpa.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(kpa.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(kpa.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> kpa KPA = new kpa(); KPA.setSize(900,600); KPA.setResizable(false); /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { KPA.setVisible(true);//new kpa().setVisible(true); } }); /*java.awt.EventQueue.invokeLater(() -> { new kpa().setVisible(true); });*/ } // Variables declaration - do not modify//GEN-BEGIN:variables private java.awt.TextField arxkostos; private javax.swing.JLabel epitokio; private javax.swing.JButton jButton1; private javax.swing.JComboBox<String> jComboBox1; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel13; private javax.swing.JLabel jLabel14; private javax.swing.JLabel jLabel15; private javax.swing.JLabel jLabel16; private javax.swing.JLabel jLabel17; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JSeparator jSeparator1; private javax.swing.JSeparator jSeparator2; private javax.swing.JSeparator jSeparator3; private javax.swing.JSeparator jSeparator4; private javax.swing.JSeparator jSeparator5; private javax.swing.JSeparator jSeparator6; private javax.swing.JSeparator jSeparator7; private javax.swing.JTextField jTextField1; private javax.swing.JTextField jTextField10; private javax.swing.JTextField jTextField11; private javax.swing.JTextField jTextField12; private javax.swing.JTextField jTextField13; private javax.swing.JTextField jTextField14; private javax.swing.JTextField jTextField15; private javax.swing.JTextField jTextField16; private javax.swing.JTextField jTextField3; private javax.swing.JTextField jTextField4; private javax.swing.JTextField jTextField5; private javax.swing.JTextField jTextField6; private javax.swing.JTextField jTextField7; private javax.swing.JTextField jTextField8; private javax.swing.JTextField jTextField9; private javax.swing.JTextField kerdos; private java.awt.Label label1; private java.awt.Label label4; private java.awt.TextField result; // End of variables declaration//GEN-END:variables }
UTF-8
Java
45,577
java
kpa.java
Java
[ { "context": "the template in the editor.\n */\n\n/**\n *\n * @author cgntuser\n */\nimport javax.swing.JOptionPane;\nimport java.u", "end": 212, "score": 0.9996183514595032, "start": 204, "tag": "USERNAME", "value": "cgntuser" } ]
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. */ /** * * @author cgntuser */ import javax.swing.JOptionPane; import java.util.ArrayList; public class kpa extends javax.swing.JFrame { /** * Creates new form kpa */ //--------------Δημιουργία λίστας για τα jTextField & jLabel--------------// ArrayList<javax.swing.JTextField> list = new ArrayList<javax.swing.JTextField>(); ArrayList<javax.swing.JLabel> LabelList= new ArrayList<javax.swing.JLabel>(); public kpa() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { jPanel1 = new javax.swing.JPanel(); jButton1 = new javax.swing.JButton(); label1 = new java.awt.Label(); jSeparator1 = new javax.swing.JSeparator(); jSeparator3 = new javax.swing.JSeparator(); result = new java.awt.TextField(); arxkostos = new java.awt.TextField(); label4 = new java.awt.Label(); jSeparator4 = new javax.swing.JSeparator(); jComboBox1 = new javax.swing.JComboBox<>(); jPanel2 = new javax.swing.JPanel(); epitokio = new javax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); jSeparator2 = new javax.swing.JSeparator(); jLabel17 = new javax.swing.JLabel(); jPanel3 = new javax.swing.JPanel(); jLabel2 = new javax.swing.JLabel(); kerdos = new javax.swing.JTextField(); jTextField3 = new javax.swing.JTextField(); jTextField4 = new javax.swing.JTextField(); jTextField5 = new javax.swing.JTextField(); jTextField6 = new javax.swing.JTextField(); jTextField7 = new javax.swing.JTextField(); jTextField8 = new javax.swing.JTextField(); jTextField9 = new javax.swing.JTextField(); jTextField10 = new javax.swing.JTextField(); jTextField11 = new javax.swing.JTextField(); jTextField12 = new javax.swing.JTextField(); jTextField13 = new javax.swing.JTextField(); jTextField14 = new javax.swing.JTextField(); jTextField15 = new javax.swing.JTextField(); jTextField16 = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel(); jLabel12 = new javax.swing.JLabel(); jLabel13 = new javax.swing.JLabel(); jLabel14 = new javax.swing.JLabel(); jLabel15 = new javax.swing.JLabel(); jLabel16 = new javax.swing.JLabel(); jSeparator6 = new javax.swing.JSeparator(); jSeparator7 = new javax.swing.JSeparator(); jLabel1 = new javax.swing.JLabel(); jSeparator5 = new javax.swing.JSeparator(); //--------------------------CUSTOM CODE--------------------------// //unvisible τα jTextFields & jLabels για να εμφανίζονται ανάλογα με την επιλογή του χρήστη //--------------------------jTextFields----------------------------// jTextField3.setVisible(false); jTextField4.setVisible(false); jTextField5.setVisible(false); jTextField6.setVisible(false); jTextField7.setVisible(false); jTextField8.setVisible(false); jTextField9.setVisible(false); jTextField10.setVisible(false); jTextField11.setVisible(false); jTextField12.setVisible(false); jTextField13.setVisible(false); jTextField14.setVisible(false); jTextField15.setVisible(false); jTextField16.setVisible(false); //----------------------------jLabels------------------------------// jLabel3.setVisible(false); jLabel4.setVisible(false); jLabel5.setVisible(false); jLabel6.setVisible(false); jLabel7.setVisible(false); jLabel8.setVisible(false); jLabel9.setVisible(false); jLabel10.setVisible(false); jLabel11.setVisible(false); jLabel12.setVisible(false); jLabel13.setVisible(false); jLabel14.setVisible(false); jLabel15.setVisible(false); jLabel16.setVisible(false); //-----------------------jSeparators unvisible------------------// jSeparator6.setVisible(false); jSeparator7.setVisible(false); //--------------------------------------------------------------// //------add jTextFields on list & jLabels on LabelList----------// //------------------------jTextFields---------------------------// list.add(jTextField3); list.add(jTextField4); list.add(jTextField5); list.add(jTextField6); list.add(jTextField7); list.add(jTextField8); list.add(jTextField9); list.add(jTextField10); list.add(jTextField11); list.add(jTextField12); list.add(jTextField13); list.add(jTextField14); list.add(jTextField15); list.add(jTextField16); //-------------------------jLabel-------------------------------// LabelList.add(jLabel3); LabelList.add(jLabel4); LabelList.add(jLabel5); LabelList.add(jLabel6); LabelList.add(jLabel7); LabelList.add(jLabel8); LabelList.add(jLabel9); LabelList.add(jLabel10); LabelList.add(jLabel11); LabelList.add(jLabel12); LabelList.add(jLabel13); LabelList.add(jLabel14); LabelList.add(jLabel15); LabelList.add(jLabel16); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jPanel1.setBackground(new java.awt.Color(37, 34, 34)); jPanel1.setFont(new java.awt.Font("Book Antiqua", 0, 11)); // NOI18N jButton1.setBackground(new java.awt.Color(34, 34, 37)); jButton1.setFont(new java.awt.Font("Book Antiqua", 1, 11)); // NOI18N jButton1.setForeground(new java.awt.Color(255, 255, 255)); jButton1.setText("Υπολόγισε"); jButton1.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); jButton1.setBorderPainted(false); jButton1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));//W_RESIZE_CURSOR jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); label1.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N label1.setForeground(new java.awt.Color(255, 255, 255)); label1.setText("Χρόνος:"); result.setBackground(new java.awt.Color(37, 34, 34)); result.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N result.setForeground(new java.awt.Color(255, 255, 255)); arxkostos.setBackground(new java.awt.Color(37, 34, 34)); arxkostos.setFont(new java.awt.Font("Book Antiqua", 0, 12)); // NOI18N arxkostos.setForeground(new java.awt.Color(255, 255, 255)); arxkostos.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { arxkostosActionPerformed(evt); } }); label4.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N label4.setForeground(new java.awt.Color(255, 255, 255)); label4.setText("Αρχικό Κόστος:"); jComboBox1.setBackground(new java.awt.Color(37, 34, 34)); jComboBox1.setFont(new java.awt.Font("Book Antiqua", 0, 11)); // NOI18N jComboBox1.setForeground(new java.awt.Color(255, 255, 255)); jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15" })); jComboBox1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));//SE_RESIZE_CURSOR jComboBox1.addAncestorListener(new javax.swing.event.AncestorListener() { public void ancestorMoved(javax.swing.event.AncestorEvent evt) { } public void ancestorAdded(javax.swing.event.AncestorEvent evt) { jComboBox1AncestorAdded(evt); } public void ancestorRemoved(javax.swing.event.AncestorEvent evt) { } }); jComboBox1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jComboBox1ActionPerformed(evt); } }); jPanel2.setBackground(new java.awt.Color(37, 34, 34)); epitokio.setBackground(new java.awt.Color(37, 34, 34)); epitokio.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N epitokio.setForeground(new java.awt.Color(255, 255, 255)); epitokio.setText("Επιτόκιο:"); jTextField1.setBackground(new java.awt.Color(37, 34, 34)); jTextField1.setFont(new java.awt.Font("Book Antiqua", 0, 11)); // NOI18N jTextField1.setForeground(new java.awt.Color(255, 255, 255)); jLabel17.setBackground(new java.awt.Color(37, 34, 34)); jLabel17.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N jLabel17.setForeground(new java.awt.Color(255, 255, 255)); jLabel17.setText("Εκτιμώμενο Κέρδος:"); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(36, 36, 36) .addComponent(epitokio, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(34, 34, 34) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jLabel17) .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(154, Short.MAX_VALUE)) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(epitokio)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel17) .addGap(0, 0, Short.MAX_VALUE)) ); jPanel3.setBackground(new java.awt.Color(37, 34, 34)); jPanel3.setFont(new java.awt.Font("Book Antiqua", 0, 11)); // NOI18N jLabel2.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N jLabel2.setForeground(new java.awt.Color(255, 255, 255)); jLabel2.setText("1ο έτος:"); kerdos.setBackground(new java.awt.Color(37, 34, 34)); kerdos.setForeground(new java.awt.Color(255, 255, 255)); jTextField3.setBackground(new java.awt.Color(37, 34, 34)); jTextField3.setFont(new java.awt.Font("Book Antiqua", 0, 11)); // NOI18N jTextField3.setForeground(new java.awt.Color(255, 255, 255)); jTextField3.setToolTipText(""); jTextField4.setBackground(new java.awt.Color(37, 34, 34)); jTextField4.setFont(new java.awt.Font("Book Antiqua", 0, 11)); // NOI18N jTextField4.setForeground(new java.awt.Color(255, 255, 255)); jTextField4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField4ActionPerformed(evt); } }); jTextField5.setBackground(new java.awt.Color(37, 34, 34)); jTextField5.setFont(new java.awt.Font("Book Antiqua", 0, 11)); // NOI18N jTextField5.setForeground(new java.awt.Color(255, 255, 255)); jTextField6.setBackground(new java.awt.Color(37, 34, 34)); jTextField6.setFont(new java.awt.Font("Book Antiqua", 0, 11)); // NOI18N jTextField6.setForeground(new java.awt.Color(255, 255, 255)); jTextField7.setBackground(new java.awt.Color(37, 34, 34)); jTextField7.setFont(new java.awt.Font("Book Antiqua", 0, 11)); // NOI18N jTextField7.setForeground(new java.awt.Color(255, 255, 255)); jTextField8.setBackground(new java.awt.Color(37, 34, 34)); jTextField8.setFont(new java.awt.Font("Book Antiqua", 0, 11)); // NOI18N jTextField8.setForeground(new java.awt.Color(255, 255, 255)); jTextField9.setBackground(new java.awt.Color(37, 34, 34)); jTextField9.setFont(new java.awt.Font("Book Antiqua", 0, 11)); // NOI18N jTextField9.setForeground(new java.awt.Color(255, 255, 255)); jTextField10.setBackground(new java.awt.Color(37, 34, 34)); jTextField10.setFont(new java.awt.Font("Book Antiqua", 0, 11)); // NOI18N jTextField10.setForeground(new java.awt.Color(255, 255, 255)); jTextField11.setBackground(new java.awt.Color(37, 34, 34)); jTextField11.setFont(new java.awt.Font("Book Antiqua", 0, 11)); // NOI18N jTextField11.setForeground(new java.awt.Color(255, 255, 255)); jTextField12.setBackground(new java.awt.Color(37, 34, 34)); jTextField12.setFont(new java.awt.Font("Book Antiqua", 0, 11)); // NOI18N jTextField12.setForeground(new java.awt.Color(255, 255, 255)); jTextField13.setBackground(new java.awt.Color(37, 34, 34)); jTextField13.setFont(new java.awt.Font("Book Antiqua", 0, 11)); // NOI18N jTextField13.setForeground(new java.awt.Color(255, 255, 255)); jTextField14.setBackground(new java.awt.Color(37, 34, 34)); jTextField14.setFont(new java.awt.Font("Book Antiqua", 0, 11)); // NOI18N jTextField14.setForeground(new java.awt.Color(255, 255, 255)); jTextField15.setBackground(new java.awt.Color(37, 34, 34)); jTextField15.setFont(new java.awt.Font("Book Antiqua", 0, 11)); // NOI18N jTextField15.setForeground(new java.awt.Color(255, 255, 255)); jTextField16.setBackground(new java.awt.Color(37, 34, 34)); jTextField16.setFont(new java.awt.Font("Book Antiqua", 0, 11)); // NOI18N jTextField16.setForeground(new java.awt.Color(255, 255, 255)); jLabel3.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N jLabel3.setForeground(new java.awt.Color(255, 255, 255)); jLabel3.setText("2ο έτος:"); jLabel4.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N jLabel4.setForeground(new java.awt.Color(255, 255, 255)); jLabel4.setText("3ο έτος:"); jLabel5.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N jLabel5.setForeground(new java.awt.Color(255, 255, 255)); jLabel5.setText("4ο έτος:"); jLabel6.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N jLabel6.setForeground(new java.awt.Color(255, 255, 255)); jLabel6.setText("5ο έτος:"); jLabel7.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N jLabel7.setForeground(new java.awt.Color(255, 255, 255)); jLabel7.setText("6ο έτος:"); jLabel8.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N jLabel8.setForeground(new java.awt.Color(255, 255, 255)); jLabel8.setText("7ο έτος:"); jLabel9.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N jLabel9.setForeground(new java.awt.Color(255, 255, 255)); jLabel9.setText("8ο έτος:"); jLabel10.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N jLabel10.setForeground(new java.awt.Color(255, 255, 255)); jLabel10.setText("9ο έτος:"); jLabel11.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N jLabel11.setForeground(new java.awt.Color(255, 255, 255)); jLabel11.setText("10ο έτος:"); jLabel12.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N jLabel12.setForeground(new java.awt.Color(255, 255, 255)); jLabel12.setText("11ο έτος:"); jLabel13.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N jLabel13.setForeground(new java.awt.Color(255, 255, 255)); jLabel13.setText("12ο έτος:"); jLabel14.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N jLabel14.setForeground(new java.awt.Color(255, 255, 255)); jLabel14.setText("13ο έτος:"); jLabel15.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N jLabel15.setForeground(new java.awt.Color(255, 255, 255)); jLabel15.setText("14ο έτος:"); jLabel16.setFont(new java.awt.Font("Book Antiqua", 1, 12)); // NOI18N jLabel16.setForeground(new java.awt.Color(255, 255, 255)); jLabel16.setText("15ο έτος:"); jSeparator6.setOrientation(javax.swing.SwingConstants.VERTICAL); jSeparator7.setOrientation(javax.swing.SwingConstants.VERTICAL); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup(jPanel3Layout.createSequentialGroup() .addComponent(jLabel6) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel3Layout.createSequentialGroup() .addComponent(jLabel5) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel3Layout.createSequentialGroup() .addComponent(jLabel4) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel3Layout.createSequentialGroup() .addComponent(jLabel3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel3Layout.createSequentialGroup() .addComponent(jLabel2) .addGap(27, 27, 27) .addComponent(kerdos, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jSeparator7, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel8, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel7, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel9, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel10, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel11, javax.swing.GroupLayout.Alignment.TRAILING)) .addGap(34, 34, 34) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTextField8, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField7, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField9, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField10, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField11, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jSeparator6, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel16, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel14, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel15, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel12, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel13, javax.swing.GroupLayout.Alignment.TRAILING)) .addGap(42, 42, 42) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTextField13, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField14, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField15, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField16, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField12, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap()) ); jPanel3Layout.setVerticalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jSeparator6) .addComponent(jSeparator7, javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel3Layout.createSequentialGroup() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(kerdos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel7) .addComponent(jLabel12)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3) .addComponent(jLabel8) .addComponent(jLabel13)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4) .addComponent(jLabel9) .addComponent(jLabel14)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel5) .addComponent(jLabel15) .addComponent(jTextField10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel10)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel6) .addComponent(jLabel11) .addComponent(jLabel16)))) .addContainerGap()) ); jLabel1.setFont(new java.awt.Font("Book Antiqua", 1, 24)); // NOI18N jLabel1.setForeground(new java.awt.Color(255, 255, 255)); jLabel1.setText("Υπολογισμός Καθαρής Παρούσας Αξίας"); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(25, 25, 25) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(jSeparator3, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(label4, javax.swing.GroupLayout.DEFAULT_SIZE, 103, Short.MAX_VALUE) .addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(label1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jSeparator4, javax.swing.GroupLayout.Alignment.LEADING)) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(34, 34, 34) .addComponent(result, javax.swing.GroupLayout.PREFERRED_SIZE, 380, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(18, 18, 18) .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))))) .addContainerGap()) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 455, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() .addGap(146, 146, 146) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jSeparator5) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(arxkostos, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE))))) .addGap(151, 151, 151)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(1, 1, 1) .addComponent(jSeparator5, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(arxkostos, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(label4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jSeparator4, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(label1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(20, 20, 20) .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 10, Short.MAX_VALUE) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(result, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(27, 27, 27)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); pack(); }// </editor-fold> private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed try{ String uarxep = arxkostos.getText(); String uepitokio=jTextField1.getText(); String uposo=kerdos.getText(); double athroisma=0;//Δήλωση μεταβλητής & αρχικοποίηση double result1 = (Double.parseDouble(uepitokio)/100);//---Μετατροπή της τιμής που δίνει ο χρήστης για επιτόκιο σε %---// double epitokio1=0; // athroisma+= Double.parseDouble(uposo)/Math.pow(result1,i); int k = Integer.parseInt(jComboBox1.getSelectedItem().toString()); athroisma += (Double.parseDouble(kerdos.getText())/Math.pow((1+result1),1)); System.out.println(Math.pow((1+result1),0)); for(int i=0;i<k-1;i++){ athroisma+=Double.parseDouble(list.get(i).getText())/Math.pow((1+result1),i+2); System.out.println(Math.pow((1+result1),i+2)); } result.setText(String.valueOf(athroisma-Double.parseDouble(uarxep))); //--------Εμφάνιση μηνύματος ανάλογα με το αποτέλεσμα--------// if(Double.parseDouble(result.getText())> 0){ JOptionPane.showMessageDialog(null, "Succesful"); } else if(Double.parseDouble(result.getText()) == 0) JOptionPane.showMessageDialog(null, "So and So"); else JOptionPane.showMessageDialog(null, "Don't do it"); } catch(Exception e){ System.out.println(e.getMessage()); } }//GEN-LAST:event_jButton1ActionPerformed private void arxkostosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_arxkostosActionPerformed // TODO add your handling code here: }//GEN-LAST:event_arxkostosActionPerformed private void jComboBox1AncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_jComboBox1AncestorAdded // TODO add your handling code here: }//GEN-LAST:event_jComboBox1AncestorAdded private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed /*jComboBox1.addItemListener(new ItemListenertener() { @Override public void itemStateChanged(ItemEvent e) { if(e.getStateChange() == ItemEvent.SELECTED) { kerdos.setText((String) jComboBox1.getSelectedItem()); } } }*/ System.out.println(jComboBox1.getSelectedItem().toString()); int k = Integer.parseInt(jComboBox1.getSelectedItem().toString()); for(int i=0;i<k-1;i++){ list.get(i).setVisible(true); LabelList.get(i).setVisible(true); //---------------------------------------------------------------// if(Integer.parseInt(jComboBox1.getSelectedItem().toString())>5) jSeparator7.setVisible(true); if(Integer.parseInt(jComboBox1.getSelectedItem().toString())>10) jSeparator6.setVisible(true); } for(int i=k-1;i<list.size();i++){ list.get(i).setVisible(false); LabelList.get(i).setVisible(false); //-----------------------------------------------------------// if(Integer.parseInt(jComboBox1.getSelectedItem().toString())<6) jSeparator7.setVisible(false); if(Integer.parseInt(jComboBox1.getSelectedItem().toString())<11) jSeparator6.setVisible(false); } this.validate(); }//GEN-LAST:event_jComboBox1ActionPerformed private void jTextField4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField4ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField4ActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(kpa.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(kpa.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(kpa.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(kpa.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> kpa KPA = new kpa(); KPA.setSize(900,600); KPA.setResizable(false); /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { KPA.setVisible(true);//new kpa().setVisible(true); } }); /*java.awt.EventQueue.invokeLater(() -> { new kpa().setVisible(true); });*/ } // Variables declaration - do not modify//GEN-BEGIN:variables private java.awt.TextField arxkostos; private javax.swing.JLabel epitokio; private javax.swing.JButton jButton1; private javax.swing.JComboBox<String> jComboBox1; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel13; private javax.swing.JLabel jLabel14; private javax.swing.JLabel jLabel15; private javax.swing.JLabel jLabel16; private javax.swing.JLabel jLabel17; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JSeparator jSeparator1; private javax.swing.JSeparator jSeparator2; private javax.swing.JSeparator jSeparator3; private javax.swing.JSeparator jSeparator4; private javax.swing.JSeparator jSeparator5; private javax.swing.JSeparator jSeparator6; private javax.swing.JSeparator jSeparator7; private javax.swing.JTextField jTextField1; private javax.swing.JTextField jTextField10; private javax.swing.JTextField jTextField11; private javax.swing.JTextField jTextField12; private javax.swing.JTextField jTextField13; private javax.swing.JTextField jTextField14; private javax.swing.JTextField jTextField15; private javax.swing.JTextField jTextField16; private javax.swing.JTextField jTextField3; private javax.swing.JTextField jTextField4; private javax.swing.JTextField jTextField5; private javax.swing.JTextField jTextField6; private javax.swing.JTextField jTextField7; private javax.swing.JTextField jTextField8; private javax.swing.JTextField jTextField9; private javax.swing.JTextField kerdos; private java.awt.Label label1; private java.awt.Label label4; private java.awt.TextField result; // End of variables declaration//GEN-END:variables }
45,577
0.646994
0.611649
778
57.149101
41.634483
203
false
false
0
0
0
0
0
0
1.208226
false
false
0
3cd68222f6cdde81aa395ca94f8a3ddac11b7fc8
21,354,577,453,220
3d5c4b8e4a9424448a43a4557f7a6cf0179c1720
/src/com/scurab/gwt/rlw/shared/model/LogItemBlobResponse.java
02ffb5eb307eebbe44f414fe8089bc544f1faed2
[]
no_license
jbruchanov/RemoteLog-Android
https://github.com/jbruchanov/RemoteLog-Android
bf9ccd0124a60fd8c8df7bef8427bdbc70af367d
0d521d4654210f69b83a763a44b68d7d0578f3dd
refs/heads/master
2021-01-04T22:31:09.638000
2014-09-28T10:26:42
2014-09-28T10:26:42
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.scurab.gwt.rlw.shared.model; public class LogItemBlobResponse extends Response<LogItemBlobRequest> { public LogItemBlobResponse() { super(); } public LogItemBlobResponse(String msg, LogItemBlobRequest context) { super(msg, context); } public LogItemBlobResponse(Throwable t) { super(t); } public LogItemBlobResponse(LogItemBlobRequest context, int written) { super(context); setCount(written); } }
UTF-8
Java
487
java
LogItemBlobResponse.java
Java
[]
null
[]
package com.scurab.gwt.rlw.shared.model; public class LogItemBlobResponse extends Response<LogItemBlobRequest> { public LogItemBlobResponse() { super(); } public LogItemBlobResponse(String msg, LogItemBlobRequest context) { super(msg, context); } public LogItemBlobResponse(Throwable t) { super(t); } public LogItemBlobResponse(LogItemBlobRequest context, int written) { super(context); setCount(written); } }
487
0.673511
0.673511
21
22.190475
24.5233
73
false
false
0
0
0
0
0
0
0.428571
false
false
0
6290da9949fb4f54cb60a1a517ac153625534f39
20,581,483,340,220
bebfa6d430344ca0a3e589d4f2430ad08cc2b82a
/Parsing of Code/src/com/neu/algo/assignment1/Driver2.java
a6eb883f42beddf674da75d84bde2b0fc28136e1
[]
no_license
arvindv17/Data-Structures-and-Problems
https://github.com/arvindv17/Data-Structures-and-Problems
33b32d3fc52a5917b357f2181d5698c5bab8ad66
75fc453545240fc0e7ce7c701c0adf77f290f6e2
refs/heads/master
2021-01-19T17:56:38.898000
2017-08-22T19:15:10
2017-08-22T19:15:10
101,098,533
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.neu.algo.assignment1; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Driver2 { public static void main(String[] args) throws IOException { /* System.out.println("1. StringTokenizer example 1:"); StringTokenizer st = new StringTokenizer("public // void { some.thing", "{", true); while (st.hasMoreTokens()) { System.out.println(st.nextToken()); } System.out.println("2. StringTokenizer example 2:"); StringTokenizer st2 = new StringTokenizer("public // void { some.thing", "/{ .", false); while (st2.hasMoreTokens()) { System.out.println(st2.nextToken()); }*/ try{ // Pattern pattern = Pattern.compile("<([^<>]+)>"); // Pattern pattern = Pattern.compile("</\\\\1>"); // Pattern pattern = Pattern.compile("<[A-Za-z]>"); //Pattern pattern = Pattern.compile("<[A-Za-z]>(.*?)</[A-Za-z]>"); Pattern pattern = Pattern.compile("[^</>]"); // Pattern pattern = Pattern.compile("[^(<+/>)]"); //Pattern pattern = Pattern.compile("<([^<>]+)></\\1>"); // Pattern pattern = Pattern.compile("[<(\\w+)( +.+)*>((.*))</\\1>]"); System.out.println("3. Reading file example:"); //ArrayList<String> arrOfBraces= new ArrayList(); File file = new File("E:\\Tools\\Eclipse Workspace\\NEU_Algo_Assignment1\\InputExample_xml.xml"); // the file could be .txt .csv or anything else if (file.isFile() && file.exists()) { // DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); // DocumentBuilder db = dbf.newDocumentBuilder(); // Document doc = db.parse(file); // NodeList list = doc.getElementsByTagName("*"); // for (int i=0; i<list.getLength(); i++) { // // Get element // Element element = (Element)list.item(i); // System.out.println(element.getNodeName()); // } InputStreamReader read = new InputStreamReader(new FileInputStream(file)); BufferedReader bufferedReader = new BufferedReader(read); String lineTxt = null; while ((lineTxt = bufferedReader.readLine()) != null) { Matcher mat = pattern.matcher(lineTxt); //StringTokenizer st3 = new StringTokenizer(lineTxt,"<([A-Z][A-Z0-9])\\b[^>]>(.*?)</\\1>",true); //System.out.println(matcher.); // while (st3.hasMoreTokens()) { // System.out.println("token: "+st3.nextToken()); // String tokenWord=st3.nextToken(); // if(tokenWord.equals("{")||tokenWord.equals("}")) { // arrOfBraces.add(tokenWord); // } // } // if (mat.find()) { String word = mat.replaceAll(""); if(!word.equalsIgnoreCase("</>")) System.out.println(word); } //System.out.println(lineTxt); } bufferedReader.close(); }else{ System.out.println("File doesn't exist"); } // for(String s: arrOfBraces) // { // System.out.println(s); // } // System.out.println("Count: " +arrOfBraces.size()); }catch (Exception e) { System.exit(1); } } }
UTF-8
Java
3,239
java
Driver2.java
Java
[]
null
[]
package com.neu.algo.assignment1; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Driver2 { public static void main(String[] args) throws IOException { /* System.out.println("1. StringTokenizer example 1:"); StringTokenizer st = new StringTokenizer("public // void { some.thing", "{", true); while (st.hasMoreTokens()) { System.out.println(st.nextToken()); } System.out.println("2. StringTokenizer example 2:"); StringTokenizer st2 = new StringTokenizer("public // void { some.thing", "/{ .", false); while (st2.hasMoreTokens()) { System.out.println(st2.nextToken()); }*/ try{ // Pattern pattern = Pattern.compile("<([^<>]+)>"); // Pattern pattern = Pattern.compile("</\\\\1>"); // Pattern pattern = Pattern.compile("<[A-Za-z]>"); //Pattern pattern = Pattern.compile("<[A-Za-z]>(.*?)</[A-Za-z]>"); Pattern pattern = Pattern.compile("[^</>]"); // Pattern pattern = Pattern.compile("[^(<+/>)]"); //Pattern pattern = Pattern.compile("<([^<>]+)></\\1>"); // Pattern pattern = Pattern.compile("[<(\\w+)( +.+)*>((.*))</\\1>]"); System.out.println("3. Reading file example:"); //ArrayList<String> arrOfBraces= new ArrayList(); File file = new File("E:\\Tools\\Eclipse Workspace\\NEU_Algo_Assignment1\\InputExample_xml.xml"); // the file could be .txt .csv or anything else if (file.isFile() && file.exists()) { // DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); // DocumentBuilder db = dbf.newDocumentBuilder(); // Document doc = db.parse(file); // NodeList list = doc.getElementsByTagName("*"); // for (int i=0; i<list.getLength(); i++) { // // Get element // Element element = (Element)list.item(i); // System.out.println(element.getNodeName()); // } InputStreamReader read = new InputStreamReader(new FileInputStream(file)); BufferedReader bufferedReader = new BufferedReader(read); String lineTxt = null; while ((lineTxt = bufferedReader.readLine()) != null) { Matcher mat = pattern.matcher(lineTxt); //StringTokenizer st3 = new StringTokenizer(lineTxt,"<([A-Z][A-Z0-9])\\b[^>]>(.*?)</\\1>",true); //System.out.println(matcher.); // while (st3.hasMoreTokens()) { // System.out.println("token: "+st3.nextToken()); // String tokenWord=st3.nextToken(); // if(tokenWord.equals("{")||tokenWord.equals("}")) { // arrOfBraces.add(tokenWord); // } // } // if (mat.find()) { String word = mat.replaceAll(""); if(!word.equalsIgnoreCase("</>")) System.out.println(word); } //System.out.println(lineTxt); } bufferedReader.close(); }else{ System.out.println("File doesn't exist"); } // for(String s: arrOfBraces) // { // System.out.println(s); // } // System.out.println("Count: " +arrOfBraces.size()); }catch (Exception e) { System.exit(1); } } }
3,239
0.601111
0.59401
87
36.229885
26.781664
147
false
false
0
0
0
0
0
0
2.034483
false
false
0
a54da6725d4dd2eb13bcc1fadf733defd27d5792
10,093,173,206,968
981af423353300d65434040353f2a3f7d87aaac5
/src/main/java/pe/gob/mimp/siscap/ws/actividadgpo/cliente/ActividadGPOCall.java
b7a0a12836f236ca6dd03aa2d081b0a0178d25be
[]
no_license
blindsight21/cliente-ms-siscap
https://github.com/blindsight21/cliente-ms-siscap
a826d0718f0b365cac5e11e8cd1e5793ded48f7d
eec177371ff0c22236e5c83303e610ae5f455990
refs/heads/master
2023-01-08T23:11:16.943000
2020-11-07T03:34:13
2020-11-07T03:34:13
305,966,287
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 pe.gob.mimp.siscap.ws.actividadgpo.cliente; import java.util.List; import pe.gob.mimp.bean.FindByParamBean; import pe.gob.mimp.bean.ResponseData; import pe.gob.mimp.bean.ActividadGobPubliObjeBean; import retrofit2.Call; import retrofit2.http.Body; import retrofit2.http.POST; /** * * @author Omar */ public interface ActividadGPOCall { @POST("/actividadgpo/crearActividadGPO") Call<ResponseData<ActividadGobPubliObjeBean>> crearActividadGPO(@Body ActividadGobPubliObjeBean actividadGobPubliObjeBean); @POST("/actividadgpo/editarActividadGPO") Call<ResponseData<ActividadGobPubliObjeBean>> editarActividadGPO(@Body ActividadGobPubliObjeBean actividadGobPubliObjeBean); // @GET("/actividadgpo/obtenerActividadGPOPorId/{nidActividadGPO}") // Call<ResponseData<String>> obtenerActividadGPOPorId(@Path("nidActividadGPO") BigDecimal nidActividadGPO); @POST("/actividadgpo/loadActividadGPOList") Call<ResponseData<List<ActividadGobPubliObjeBean>>> loadActividadGPOList(@Body FindByParamBean findByParamBean); @POST("/actividadgpo/getRecordCount") Call<ResponseData<Integer>> getRecordCount(@Body FindByParamBean findByParamBean); // @GET("/actividadgpo/find/{id}") // Call<ResponseData<ActividadGPOBean>> find(@Path("id") BigDecimal id); }
UTF-8
Java
1,482
java
ActividadGPOCall.java
Java
[ { "context": "dy;\nimport retrofit2.http.POST;\n\n/**\n *\n * @author Omar\n */\npublic interface ActividadGPOCall {\n\n @POS", "end": 493, "score": 0.995270311832428, "start": 489, "tag": "NAME", "value": "Omar" } ]
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 pe.gob.mimp.siscap.ws.actividadgpo.cliente; import java.util.List; import pe.gob.mimp.bean.FindByParamBean; import pe.gob.mimp.bean.ResponseData; import pe.gob.mimp.bean.ActividadGobPubliObjeBean; import retrofit2.Call; import retrofit2.http.Body; import retrofit2.http.POST; /** * * @author Omar */ public interface ActividadGPOCall { @POST("/actividadgpo/crearActividadGPO") Call<ResponseData<ActividadGobPubliObjeBean>> crearActividadGPO(@Body ActividadGobPubliObjeBean actividadGobPubliObjeBean); @POST("/actividadgpo/editarActividadGPO") Call<ResponseData<ActividadGobPubliObjeBean>> editarActividadGPO(@Body ActividadGobPubliObjeBean actividadGobPubliObjeBean); // @GET("/actividadgpo/obtenerActividadGPOPorId/{nidActividadGPO}") // Call<ResponseData<String>> obtenerActividadGPOPorId(@Path("nidActividadGPO") BigDecimal nidActividadGPO); @POST("/actividadgpo/loadActividadGPOList") Call<ResponseData<List<ActividadGobPubliObjeBean>>> loadActividadGPOList(@Body FindByParamBean findByParamBean); @POST("/actividadgpo/getRecordCount") Call<ResponseData<Integer>> getRecordCount(@Body FindByParamBean findByParamBean); // @GET("/actividadgpo/find/{id}") // Call<ResponseData<ActividadGPOBean>> find(@Path("id") BigDecimal id); }
1,482
0.782726
0.780702
40
36.049999
37.563248
128
false
false
0
0
0
0
0
0
0.425
false
false
0
b5105f0b9b00196e205eb9d2e4ef16c300e9440b
30,408,368,485,843
21e64854c5594db095360fd9782dbbacfacc6467
/src/com/example/stpjune/AnonBtnActivity.java
ba687d9c71c155080906c29b5d653d646f6b79a2
[]
no_license
KRattnam/android
https://github.com/KRattnam/android
75f6dede0d920ae5b08f59c95a9cf3cc3d0641b6
4a2f9b392d2b17b5a1b8b718e51806a3e7b4ba20
refs/heads/master
2021-04-28T07:57:57.457000
2018-03-22T19:14:23
2018-03-22T19:14:23
122,238,535
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.stpjune; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.Toast; public class AnonBtnActivity extends Activity { Button b7; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_anon_btn); b7=(Button)findViewById(R.id.b7); b7.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Toast.makeText(getApplicationContext(), "Clicked", 100).show(); } }); } }
UTF-8
Java
769
java
AnonBtnActivity.java
Java
[]
null
[]
package com.example.stpjune; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.Toast; public class AnonBtnActivity extends Activity { Button b7; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_anon_btn); b7=(Button)findViewById(R.id.b7); b7.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Toast.makeText(getApplicationContext(), "Clicked", 100).show(); } }); } }
769
0.725618
0.716515
30
23.633333
18.312988
67
false
false
0
0
0
0
0
0
1.766667
false
false
0
dfde5cb05eb467fba5b3c2bfb925722b44ea5b20
5,600,637,421,619
59e98737ea6adfc60f47924f3db150e38416337c
/src/main/java/com/pet/hpq/mapper/ShoppingCartMapper.java
252ad36b87e3119c22a306735ac54a1dd0e59338
[]
no_license
ZzhangSamA/petAdoptionPlatform
https://github.com/ZzhangSamA/petAdoptionPlatform
448f47b9cfdc56e216164f9b0834c1379e100941
bb527e6eec100036c966fa5a0d7d060d7aec0302
refs/heads/master
2022-12-22T16:50:58.808000
2019-07-08T03:06:53
2019-07-08T03:06:53
180,746,920
1
0
null
false
2022-12-16T11:06:54
2019-04-11T08:19:25
2019-07-08T03:07:03
2022-12-16T11:06:51
10,708
0
0
6
HTML
false
false
package com.pet.hpq.mapper; import com.pet.hpq.dto.ShoppingCarDto; import com.pet.hpq.pojo.ShoppingCart; import com.pet.hpq.vo.AddOrderGoodsVo; import com.pet.hpq.vo.AddOrderVo; import com.pet.hpq.vo.ShoppingCarVo; import java.math.BigDecimal; import java.util.List; public interface ShoppingCartMapper { int deleteByPrimaryKey(Integer cartId); int insert(ShoppingCart record); int insertSelective(ShoppingCart record); ShoppingCart selectByPrimaryKey(Integer cartId); int updateByPrimaryKeySelective(ShoppingCart record); int updateByPrimaryKey(ShoppingCart record); List<ShoppingCarDto> getCart(int customerId); int removeCart(ShoppingCarVo shoppingCarVo); int removeAllCart(int customerId); BigDecimal getPrice(int ParameterId); Integer getAddressId(int customerId); int addOrder(AddOrderVo addOrderVo); int addOrderGoods(AddOrderGoodsVo addOrderGoodsVo); int getOrderId(int OrderNumber); int addShoppingCart(ShoppingCarVo shoppingCarVo); int addOneOrderGoods(ShoppingCarVo shoppingCarVo); int getCartCount(Integer customerId); int updateShoppingCar(ShoppingCarVo shoppingCarVo); BigDecimal getPriceInfo(ShoppingCarVo shoppingCarVo); ShoppingCarDto getOneGoods(ShoppingCarVo shoppingCarVo); }
UTF-8
Java
1,297
java
ShoppingCartMapper.java
Java
[]
null
[]
package com.pet.hpq.mapper; import com.pet.hpq.dto.ShoppingCarDto; import com.pet.hpq.pojo.ShoppingCart; import com.pet.hpq.vo.AddOrderGoodsVo; import com.pet.hpq.vo.AddOrderVo; import com.pet.hpq.vo.ShoppingCarVo; import java.math.BigDecimal; import java.util.List; public interface ShoppingCartMapper { int deleteByPrimaryKey(Integer cartId); int insert(ShoppingCart record); int insertSelective(ShoppingCart record); ShoppingCart selectByPrimaryKey(Integer cartId); int updateByPrimaryKeySelective(ShoppingCart record); int updateByPrimaryKey(ShoppingCart record); List<ShoppingCarDto> getCart(int customerId); int removeCart(ShoppingCarVo shoppingCarVo); int removeAllCart(int customerId); BigDecimal getPrice(int ParameterId); Integer getAddressId(int customerId); int addOrder(AddOrderVo addOrderVo); int addOrderGoods(AddOrderGoodsVo addOrderGoodsVo); int getOrderId(int OrderNumber); int addShoppingCart(ShoppingCarVo shoppingCarVo); int addOneOrderGoods(ShoppingCarVo shoppingCarVo); int getCartCount(Integer customerId); int updateShoppingCar(ShoppingCarVo shoppingCarVo); BigDecimal getPriceInfo(ShoppingCarVo shoppingCarVo); ShoppingCarDto getOneGoods(ShoppingCarVo shoppingCarVo); }
1,297
0.783346
0.783346
52
23.961538
22.485861
60
false
false
0
0
0
0
0
0
0.538462
false
false
0
558bf7f0dce9bcf6e7601ed177cdf5ce1e74b3ca
25,391,846,707,819
d5e5c0cdfa747ac304eed93a52aad42a4bda7923
/src/main/java/com/ckgl/cg/dao/UserRoleMapper.java
a61301e861f2595cb88f17cb7c4dd5c0728b3155
[]
no_license
EGtraveller123/CG
https://github.com/EGtraveller123/CG
c762bef402025a5e7493ee0a678c5567f84a640f
b7e4f467647a97902986b2e56e8a7fca5107199b
refs/heads/master
2022-07-02T07:52:59.629000
2020-12-29T08:38:37
2020-12-29T08:38:37
185,072,234
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ckgl.cg.dao; import com.ckgl.cg.bean.Role; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Select; import java.util.List; @Mapper public interface UserRoleMapper { @Select("select * from role where userId=#{id}") List<Role> getRoleByUser(Long id); }
UTF-8
Java
308
java
UserRoleMapper.java
Java
[]
null
[]
package com.ckgl.cg.dao; import com.ckgl.cg.bean.Role; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Select; import java.util.List; @Mapper public interface UserRoleMapper { @Select("select * from role where userId=#{id}") List<Role> getRoleByUser(Long id); }
308
0.75
0.75
13
22.692308
18.544685
53
false
false
0
0
0
0
0
0
0.461538
false
false
0
374391c39867d897f0e68590c1c8481ea1f8c54d
15,977,278,388,924
21c07d8c10b0f1f4dc8472331a33802488bf34b2
/src/main/java/org/lightvanko/dvdstore/data/Disk.java
884181a921f8a591e14a424163035ce4ce5dd1a6
[]
no_license
akula-matata/dvdstore
https://github.com/akula-matata/dvdstore
5540140a501d8834072780e91159636f33d7d532
3d5ffc9791507c3a4ef91612d75dd6b9e6580da1
refs/heads/master
2021-07-09T00:50:33.479000
2017-10-05T12:29:26
2017-10-05T12:29:26
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.lightvanko.dvdstore.data; import javax.persistence.*; import javax.validation.constraints.NotNull; import java.util.ArrayList; import java.util.List; @Entity @Table(name = "DISKS") public class Disk { @Id @GeneratedValue(strategy = GenerationType.AUTO) private long id; @NotNull private String capture; @ManyToOne @JoinColumn(name="USER_ID") private User user; @OneToMany(mappedBy="disk") List<TakenItem> takenItem = new ArrayList<>(); public long getId() { return id; } public void setId(long id) { this.id = id; } public String getCapture() { return capture; } public void setCapture(String capture) { this.capture = capture; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } public List<TakenItem> getTakenItem() { return takenItem; } public void setTakenItem(List<TakenItem> takenItem) { this.takenItem = takenItem; } public Disk() { } public Disk(String capture, User user) { this.capture = capture; this.user = user; } }
UTF-8
Java
1,199
java
Disk.java
Java
[]
null
[]
package org.lightvanko.dvdstore.data; import javax.persistence.*; import javax.validation.constraints.NotNull; import java.util.ArrayList; import java.util.List; @Entity @Table(name = "DISKS") public class Disk { @Id @GeneratedValue(strategy = GenerationType.AUTO) private long id; @NotNull private String capture; @ManyToOne @JoinColumn(name="USER_ID") private User user; @OneToMany(mappedBy="disk") List<TakenItem> takenItem = new ArrayList<>(); public long getId() { return id; } public void setId(long id) { this.id = id; } public String getCapture() { return capture; } public void setCapture(String capture) { this.capture = capture; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } public List<TakenItem> getTakenItem() { return takenItem; } public void setTakenItem(List<TakenItem> takenItem) { this.takenItem = takenItem; } public Disk() { } public Disk(String capture, User user) { this.capture = capture; this.user = user; } }
1,199
0.613011
0.613011
65
17.446154
15.873569
57
false
false
0
0
0
0
0
0
0.307692
false
false
0
a8d885ab952e519700df92d675ec6183dc1cb8af
35,399,120,472,511
89d911ababb4d9d9ef1db2274f26969e9d572515
/src/main/java/de/canitzp/athmal/tile/TileEmpty.java
a7c02edef624c1d076a3c4cf37c43f66ab2d4f95
[]
no_license
canitzp/Athmal
https://github.com/canitzp/Athmal
51ec814eaa96da44fd2f2f104fb13791f6067849
af8791eb2436d05382e56b4e93e5392c3cae6337
refs/heads/master
2021-05-12T11:22:02.342000
2018-01-13T23:15:13
2018-01-13T23:15:13
117,386,024
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package de.canitzp.athmal.tile; import de.canitzp.athmal.Athmal; import de.canitzp.athmal.IRender; import de.canitzp.athmal.map.Layer; import de.canitzp.athmal.map.Map; import java.awt.*; /** * @author canitzp */ public class TileEmpty extends Tile { @Override public void render(Athmal game, IRender render, Map map, Layer layer, int x, int y) { if(true)return; int size = map.getTileSize() / 2; render.renderRect(x, y, size, size, Color.BLACK); render.renderRect(x + size, y, size, size, Color.MAGENTA); render.renderRect(x, y + size, size, size, Color.MAGENTA); render.renderRect(x + size, y + size, size, size, Color.BLACK); } }
UTF-8
Java
699
java
TileEmpty.java
Java
[ { "context": "thmal.map.Map;\n\nimport java.awt.*;\n\n/**\n * @author canitzp\n */\npublic class TileEmpty extends Tile {\n\n @O", "end": 213, "score": 0.9993378520011902, "start": 206, "tag": "USERNAME", "value": "canitzp" } ]
null
[]
package de.canitzp.athmal.tile; import de.canitzp.athmal.Athmal; import de.canitzp.athmal.IRender; import de.canitzp.athmal.map.Layer; import de.canitzp.athmal.map.Map; import java.awt.*; /** * @author canitzp */ public class TileEmpty extends Tile { @Override public void render(Athmal game, IRender render, Map map, Layer layer, int x, int y) { if(true)return; int size = map.getTileSize() / 2; render.renderRect(x, y, size, size, Color.BLACK); render.renderRect(x + size, y, size, size, Color.MAGENTA); render.renderRect(x, y + size, size, size, Color.MAGENTA); render.renderRect(x + size, y + size, size, size, Color.BLACK); } }
699
0.662375
0.660944
24
28.125
25.630894
89
false
false
0
0
0
0
0
0
1.375
false
false
0
b836c67a3e53a85d6ccaf77fa6e87de524507348
33,861,522,190,768
20fe4b970732e0ac699046eb253cd7a899362685
/TestApp/src/leetcode/Q453.java
83b2a1e6d42046d437a5345b3503aa9aa3f53090
[]
no_license
triandicAnt/AlgorithmsInJava
https://github.com/triandicAnt/AlgorithmsInJava
b939c75fbcd344b36ccb5e1d25a3d9747a06c97f
0d33d63fac14f9c7cd5121e33353a5aaa172aa87
refs/heads/master
2021-10-08T08:46:31.343000
2018-12-10T01:39:21
2018-12-10T01:39:21
52,630,375
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class Q453 { public int minMoves(int[] nums) { if(nums==null || nums.length==0) return 0; int min = Integer.MAX_VALUE; for(int a : nums){ min = Math.min(min,a); } int count = 0; for(int a : nums){ count += a-min; } return count; } }
UTF-8
Java
348
java
Q453.java
Java
[]
null
[]
public class Q453 { public int minMoves(int[] nums) { if(nums==null || nums.length==0) return 0; int min = Integer.MAX_VALUE; for(int a : nums){ min = Math.min(min,a); } int count = 0; for(int a : nums){ count += a-min; } return count; } }
348
0.439655
0.422414
15
22.200001
11.617229
40
false
false
0
0
0
0
0
0
0.6
false
false
0
3d38aeae5234a4b77a18552d306bdaad40f9fc24
17,154,099,390,933
77637bf643d95a541bbc62d5a962861987c27b45
/app/src/main/java/com/xm/study/pattern/proxy/model/SearcherReal.java
cc5b065e5786480b0e3ef2c2fd43b6be56e2887a
[]
no_license
wenwanliuyemei/Study
https://github.com/wenwanliuyemei/Study
952ba49f3026fd2f9830ada90f2e25e643b05dcc
9fc62a13eeb39847c57b251e23ab0e509b1edf20
refs/heads/master
2021-07-02T22:07:13.087000
2019-08-09T10:31:28
2019-08-09T10:31:28
100,911,114
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.xm.study.pattern.proxy.model; /** * @author: xm on 2017/7/31. * @describe: */ public class SearcherReal implements IBaseSearcher { public SearcherReal() { super(); } @Override public String doSearch(String userName, String password, String key) { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append(userName); stringBuffer.append(password); stringBuffer.append(key); // asyncTask(stringBuffer.toString()); return key + "::";//演示 } private void asyncTask(String params) { //网络请求 //TODO } }
UTF-8
Java
640
java
SearcherReal.java
Java
[ { "context": "com.xm.study.pattern.proxy.model;\n\n/**\n * @author: xm on 2017/7/31.\n * @describe:\n */\n\npublic class Sea", "end": 61, "score": 0.9996270537376404, "start": 59, "tag": "USERNAME", "value": "xm" } ]
null
[]
package com.xm.study.pattern.proxy.model; /** * @author: xm on 2017/7/31. * @describe: */ public class SearcherReal implements IBaseSearcher { public SearcherReal() { super(); } @Override public String doSearch(String userName, String password, String key) { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append(userName); stringBuffer.append(password); stringBuffer.append(key); // asyncTask(stringBuffer.toString()); return key + "::";//演示 } private void asyncTask(String params) { //网络请求 //TODO } }
640
0.616987
0.605769
28
21.285715
20.304569
74
false
false
0
0
0
0
0
0
0.357143
false
false
0
78f3ba824d04500e9b90c346a9b23265209bfab3
18,665,927,923,976
4b3c86afe2847122cb1d7c31e31daa407a20c8c9
/src/main/java/com/u8/server/sdk/vivo/VivoSDK.java
49a90847e9e51a8870b585fe81588d58890e89ec
[ "Apache-2.0" ]
permissive
chenmingd/U8Server
https://github.com/chenmingd/U8Server
aa935a03cd5998963a426afd51d77c9fb35e07b3
50b4ecf516e59f70e52e4f406f1fcb40314d85c3
refs/heads/master
2020-04-15T04:11:53.075000
2019-01-21T10:53:17
2019-01-21T10:53:17
164,374,441
0
0
Apache-2.0
true
2019-01-07T03:41:32
2019-01-07T03:41:32
2018-12-19T11:56:18
2018-01-25T21:55:28
58,833
0
0
0
null
false
null
package com.u8.server.sdk.vivo; import com.u8.server.data.UChannel; import com.u8.server.data.UOrder; import com.u8.server.data.UUser; import com.u8.server.log.Log; import com.u8.server.sdk.*; import com.u8.server.utils.EncryptUtils; import com.u8.server.utils.JsonUtils; import com.u8.server.utils.TimeFormater; import net.sf.json.JSONObject; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * VIVO SDK * Created by ant on 2015/4/23. */ public class VivoSDK implements ISDKScript{ @Override public void verify(final UChannel channel, String extension, final ISDKVerifyListener callback) { try{ extension = extension.replace("\n", "%0A");//替换回车符,vivo子帐号登录成功返回的token多了回车,导致解析json出错。@小抛同学发现 JSONObject json = JSONObject.fromObject(extension); final String openid = json.getString("openid"); final String name = json.getString("name"); final String token = json.getString("token"); Map<String, String> params = new HashMap<String, String>(); params.put("access_token", token); UHttpAgent.getInstance().post(channel.getChannelAuthUrl(), params, new UHttpFutureCallback() { @Override public void completed(String content) { Log.e("The auth result is "+content); try{ AuthInfo authInfo = (AuthInfo)JsonUtils.decodeJson(content, AuthInfo.class); if(authInfo != null && authInfo.getUid().equals(openid)){ callback.onSuccess(new SDKVerifyResult(true, openid, name, "")); return; } }catch (Exception e){ e.printStackTrace(); } callback.onFailed(channel.getMaster().getSdkName() + " verify failed. the post result is " + content); } @Override public void failed(String e) { callback.onFailed(channel.getMaster().getSdkName() + " verify failed. " + e); } }); }catch (Exception e){ e.printStackTrace(); callback.onFailed(channel.getMaster().getSdkName() + " verify execute failed. the exception is "+e.getMessage()); } } @Override public void onGetOrderID(UUser user, UOrder order, ISDKOrderListener callback) { if(callback != null){ try{ UChannel channel = order.getChannel(); if(channel == null){ Log.e("The channel is not exists of order "+order.getOrderID()); return; } String orderUrl = channel.getChannelOrderUrl(); Log.d("the order url is "+orderUrl); Log.d("CPID:"+order.getChannel().getCpID()); Log.d("appID:"+order.getChannel().getCpAppID()); Log.d("appKey:"+order.getChannel().getCpAppKey()); String version = "1.0.0"; String signMethod = "MD5"; String signature = ""; String cpId = order.getChannel().getCpID(); String appId = order.getChannel().getCpAppID(); String cpOrderNumber = ""+order.getOrderID(); String notifyUrl = channel.getPayCallbackUrl(); String orderTime = TimeFormater.format_yyyyMMddHHmmss(order.getCreatedTime()); String orderAmount = order.getMoney() + ""; String orderTitle = order.getProductName(); String orderDesc = order.getProductDesc(); String extInfo = order.getOrderID()+""; //空字符串不参与签名 StringBuilder sb = new StringBuilder(); sb.append("appId=").append(appId).append("&") .append("cpId=").append(cpId).append("&") .append("cpOrderNumber=").append(cpOrderNumber).append("&") .append("extInfo=").append(extInfo).append("&") .append("notifyUrl=").append(notifyUrl).append("&") .append("orderAmount=").append(orderAmount).append("&") .append("orderDesc=").append(orderDesc).append("&") .append("orderTime=").append(orderTime).append("&") .append("orderTitle=").append(orderTitle).append("&") .append("version=").append(version).append("&") .append(EncryptUtils.md5(channel.getCpAppKey()).toLowerCase()); signature = EncryptUtils.md5(sb.toString()).toLowerCase(); Map<String,String> params = new HashMap<String, String>(); params.put("version", version); params.put("signMethod", signMethod); params.put("signature", signature); params.put("cpId", cpId); params.put("appId", appId); params.put("cpOrderNumber", cpOrderNumber); params.put("notifyUrl", notifyUrl); params.put("orderTime", orderTime); params.put("orderAmount", orderAmount); params.put("orderTitle", orderTitle); params.put("orderDesc", orderDesc); params.put("extInfo", extInfo); String result = UHttpAgent.getInstance().post(orderUrl, params); Log.e("The vivo order result is "+result); VivoOrderResult orderResult = (VivoOrderResult)JsonUtils.decodeJson(result, VivoOrderResult.class); if(orderResult != null && orderResult.getRespCode() == 200){ JSONObject ext = new JSONObject(); ext.put("transNo", orderResult.getOrderNumber()); ext.put("accessKey", orderResult.getAccessKey()); String extStr = ext.toString(); callback.onSuccess(extStr); }else{ callback.onFailed("the vivo order result is "+result); } }catch (Exception e){ e.printStackTrace(); callback.onFailed(e.getMessage()); } } } }
UTF-8
Java
6,647
java
VivoSDK.java
Java
[ { "context": " java.util.Map;\r\n\r\n/**\r\n * VIVO SDK\r\n * Created by ant on 2015/4/23.\r\n */\r\npublic class VivoSDK implemen", "end": 589, "score": 0.992354691028595, "start": 586, "tag": "USERNAME", "value": "ant" }, { "context": "\"%0A\");//替换回车符,vivo子帐号登录成功返回的token多了回车,导致解析j...
null
[]
package com.u8.server.sdk.vivo; import com.u8.server.data.UChannel; import com.u8.server.data.UOrder; import com.u8.server.data.UUser; import com.u8.server.log.Log; import com.u8.server.sdk.*; import com.u8.server.utils.EncryptUtils; import com.u8.server.utils.JsonUtils; import com.u8.server.utils.TimeFormater; import net.sf.json.JSONObject; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * VIVO SDK * Created by ant on 2015/4/23. */ public class VivoSDK implements ISDKScript{ @Override public void verify(final UChannel channel, String extension, final ISDKVerifyListener callback) { try{ extension = extension.replace("\n", "%0A");//替换回车符,vivo子帐号登录成功返回的token多了回车,导致解析json出错。@小抛同学发现 JSONObject json = JSONObject.fromObject(extension); final String openid = json.getString("openid"); final String name = json.getString("name"); final String token = json.getString("token"); Map<String, String> params = new HashMap<String, String>(); params.put("access_token", token); UHttpAgent.getInstance().post(channel.getChannelAuthUrl(), params, new UHttpFutureCallback() { @Override public void completed(String content) { Log.e("The auth result is "+content); try{ AuthInfo authInfo = (AuthInfo)JsonUtils.decodeJson(content, AuthInfo.class); if(authInfo != null && authInfo.getUid().equals(openid)){ callback.onSuccess(new SDKVerifyResult(true, openid, name, "")); return; } }catch (Exception e){ e.printStackTrace(); } callback.onFailed(channel.getMaster().getSdkName() + " verify failed. the post result is " + content); } @Override public void failed(String e) { callback.onFailed(channel.getMaster().getSdkName() + " verify failed. " + e); } }); }catch (Exception e){ e.printStackTrace(); callback.onFailed(channel.getMaster().getSdkName() + " verify execute failed. the exception is "+e.getMessage()); } } @Override public void onGetOrderID(UUser user, UOrder order, ISDKOrderListener callback) { if(callback != null){ try{ UChannel channel = order.getChannel(); if(channel == null){ Log.e("The channel is not exists of order "+order.getOrderID()); return; } String orderUrl = channel.getChannelOrderUrl(); Log.d("the order url is "+orderUrl); Log.d("CPID:"+order.getChannel().getCpID()); Log.d("appID:"+order.getChannel().getCpAppID()); Log.d("appKey:"+order.getChannel().getCpAppKey()); String version = "1.0.0"; String signMethod = "MD5"; String signature = ""; String cpId = order.getChannel().getCpID(); String appId = order.getChannel().getCpAppID(); String cpOrderNumber = ""+order.getOrderID(); String notifyUrl = channel.getPayCallbackUrl(); String orderTime = TimeFormater.format_yyyyMMddHHmmss(order.getCreatedTime()); String orderAmount = order.getMoney() + ""; String orderTitle = order.getProductName(); String orderDesc = order.getProductDesc(); String extInfo = order.getOrderID()+""; //空字符串不参与签名 StringBuilder sb = new StringBuilder(); sb.append("appId=").append(appId).append("&") .append("cpId=").append(cpId).append("&") .append("cpOrderNumber=").append(cpOrderNumber).append("&") .append("extInfo=").append(extInfo).append("&") .append("notifyUrl=").append(notifyUrl).append("&") .append("orderAmount=").append(orderAmount).append("&") .append("orderDesc=").append(orderDesc).append("&") .append("orderTime=").append(orderTime).append("&") .append("orderTitle=").append(orderTitle).append("&") .append("version=").append(version).append("&") .append(EncryptUtils.md5(channel.getCpAppKey()).toLowerCase()); signature = EncryptUtils.md5(sb.toString()).toLowerCase(); Map<String,String> params = new HashMap<String, String>(); params.put("version", version); params.put("signMethod", signMethod); params.put("signature", signature); params.put("cpId", cpId); params.put("appId", appId); params.put("cpOrderNumber", cpOrderNumber); params.put("notifyUrl", notifyUrl); params.put("orderTime", orderTime); params.put("orderAmount", orderAmount); params.put("orderTitle", orderTitle); params.put("orderDesc", orderDesc); params.put("extInfo", extInfo); String result = UHttpAgent.getInstance().post(orderUrl, params); Log.e("The vivo order result is "+result); VivoOrderResult orderResult = (VivoOrderResult)JsonUtils.decodeJson(result, VivoOrderResult.class); if(orderResult != null && orderResult.getRespCode() == 200){ JSONObject ext = new JSONObject(); ext.put("transNo", orderResult.getOrderNumber()); ext.put("accessKey", orderResult.getAccessKey()); String extStr = ext.toString(); callback.onSuccess(extStr); }else{ callback.onFailed("the vivo order result is "+result); } }catch (Exception e){ e.printStackTrace(); callback.onFailed(e.getMessage()); } } } }
6,647
0.537418
0.533455
164
38.006096
30.936501
125
false
false
0
0
0
0
0
0
0.682927
false
false
0
2181fd6d99af25ddc9b16d542ba08318d61398c1
18,665,927,922,337
5bfdd3e3e61e046a56f5e4714bd13e4bf0bf359d
/algorithm/src/level1/StringToInteger.java
e4bfd62de124020870a0f8d6bf602cdafaa20599
[ "MIT" ]
permissive
Oraindrop/algorithm
https://github.com/Oraindrop/algorithm
e40b0c36a6728bc3f3599b7769d581cc3e59e9d8
7081464a4153c307c5ad6e92523b7d6f74fce332
refs/heads/master
2022-01-18T15:11:13.959000
2021-12-30T14:39:17
2021-12-30T14:39:17
146,498,419
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/*문자열을 정수로 바꾸기 문제 설명 문자열 s를 숫자로 변환한 결과를 반환하는 함수, solution을 완성하세요. 제한 조건 s의 길이는 1 이상 5이하입니다. s의 맨앞에는 부호(+, -)가 올 수 있습니다. s는 부호와 숫자로만 이루어져있습니다. s는 0으로 시작하지 않습니다. 입출력 예 예를들어 str이 1234이면 1234를 반환하고, -1234이면 -1234를 반환하면 됩니다. str은 부호(+,-)와 숫자로만 구성되어 있고, 잘못된 값이 입력되는 경우는 없습니다.*/ package level1; public class StringToInteger { public static void main(String[] args) { // TODO Auto-generated method stub System.out.println(Integer.parseInt("+1234")); // Test } public int solution(String s) { int answer = 0; answer = Integer.parseInt(s); return answer; } }
UTF-8
Java
877
java
StringToInteger.java
Java
[]
null
[]
/*문자열을 정수로 바꾸기 문제 설명 문자열 s를 숫자로 변환한 결과를 반환하는 함수, solution을 완성하세요. 제한 조건 s의 길이는 1 이상 5이하입니다. s의 맨앞에는 부호(+, -)가 올 수 있습니다. s는 부호와 숫자로만 이루어져있습니다. s는 0으로 시작하지 않습니다. 입출력 예 예를들어 str이 1234이면 1234를 반환하고, -1234이면 -1234를 반환하면 됩니다. str은 부호(+,-)와 숫자로만 구성되어 있고, 잘못된 값이 입력되는 경우는 없습니다.*/ package level1; public class StringToInteger { public static void main(String[] args) { // TODO Auto-generated method stub System.out.println(Integer.parseInt("+1234")); // Test } public int solution(String s) { int answer = 0; answer = Integer.parseInt(s); return answer; } }
877
0.681739
0.638261
27
20.333334
17.703316
56
false
false
0
0
0
0
0
0
0.777778
false
false
0
25f5647811f768a8ccb4510d75fbd0a2d86e18f9
12,120,397,748,055
fdc502de3c8442ba1ae062735e65d82e0b757a3f
/nemesis-rules-targeting/src/main/java/io/nemesis/rules/targeting/event/product/ProductAddedToWishlistEvent.java
271629eb4b4e4ecae7545ee3d59bdf3d788a81af
[]
no_license
nemesis-software/nemesis-rule-util
https://github.com/nemesis-software/nemesis-rule-util
afb1fd0252f3a1b37d96c57072f5c86b271911c1
86d031fc782220dbd1396335681dc9b53072459d
refs/heads/master
2021-01-23T13:11:27.602000
2020-04-18T15:22:01
2020-04-18T15:22:01
93,234,206
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * nemesis Platform - NExt-generation Multichannel E-commerce SYStem * * Copyright (c) 2010 - 2017 nemesis * All rights reserved. * * This software is the confidential and proprietary information of nemesis * ("Confidential Information"). You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of the * license agreement you entered into with nemesis. */ package io.nemesis.rules.targeting.event.product; /** * An event that gets raised once a user adds a product to their wishlist. * * @author Petar Tahchiev * @since 1.5 */ public class ProductAddedToWishlistEvent extends AbstractProductEvent { public ProductAddedToWishlistEvent() { } public ProductAddedToWishlistEvent(String sessionId, String username, String productCode) { super(sessionId, username, productCode); } }
UTF-8
Java
871
java
ProductAddedToWishlistEvent.java
Java
[ { "context": "er adds a product to their wishlist.\n *\n * @author Petar Tahchiev\n * @since 1.5\n */\npublic class ProductAddedToWish", "end": 576, "score": 0.9998760223388672, "start": 562, "tag": "NAME", "value": "Petar Tahchiev" } ]
null
[]
/* * nemesis Platform - NExt-generation Multichannel E-commerce SYStem * * Copyright (c) 2010 - 2017 nemesis * All rights reserved. * * This software is the confidential and proprietary information of nemesis * ("Confidential Information"). You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of the * license agreement you entered into with nemesis. */ package io.nemesis.rules.targeting.event.product; /** * An event that gets raised once a user adds a product to their wishlist. * * @author <NAME> * @since 1.5 */ public class ProductAddedToWishlistEvent extends AbstractProductEvent { public ProductAddedToWishlistEvent() { } public ProductAddedToWishlistEvent(String sessionId, String username, String productCode) { super(sessionId, username, productCode); } }
863
0.748565
0.737084
28
30.107143
30.883814
95
false
false
0
0
0
0
0
0
0.214286
false
false
0
7ff57c5e7d438b9dcb0541e68ea0d31e1321511b
34,411,278,006,975
d3c1c37d6f32377b1da62d2da52194811cca909f
/src/model/bo/SubjectBO.java
9c7ed380f67a804ec030a53e018664b87839f914
[]
no_license
lehongphuong/FptMock
https://github.com/lehongphuong/FptMock
c6e0515a738d69b65f159a963ab8e29dab20305b
acebe0093cd32df9e509a8bb1489bc9b891ad11e
refs/heads/master
2021-01-19T01:23:35.836000
2017-03-09T09:49:32
2017-03-09T09:49:32
84,391,615
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package model.bo; import java.util.ArrayList; import model.bean.Subject; import model.dao.SubjectDAO; public class SubjectBO { SubjectDAO dao; /* *get all categories */ public ArrayList<Subject> getAllSubject() { return dao.getAllSubject(); } public void insertSubject(Subject Subject) { insertSubject(Subject); } // update public void updateSubject(Subject Subject) { updateSubject(Subject); } //delete public void deleteSubject(int subId) { deleteSubject(subId); } }
UTF-8
Java
516
java
SubjectBO.java
Java
[]
null
[]
package model.bo; import java.util.ArrayList; import model.bean.Subject; import model.dao.SubjectDAO; public class SubjectBO { SubjectDAO dao; /* *get all categories */ public ArrayList<Subject> getAllSubject() { return dao.getAllSubject(); } public void insertSubject(Subject Subject) { insertSubject(Subject); } // update public void updateSubject(Subject Subject) { updateSubject(Subject); } //delete public void deleteSubject(int subId) { deleteSubject(subId); } }
516
0.705426
0.705426
32
14.1875
14.906873
44
false
false
0
0
0
0
0
0
0.5
false
false
0
096e4ff185d7000b98b48518d633692e116ffc29
35,854,386,991,774
9033b8cffa654614ac7b3b7eea6077755d7bf79f
/core/src/com/cubito/MainGame.java
4f8593e5e5a4e47b51cb01daaac4741459383abe
[]
no_license
Tom743/JuegoCubito
https://github.com/Tom743/JuegoCubito
d46bc3f5a191d33d8e4c00d7de0bb8bf989a3bd3
52a881d21b7c8479d2223bd67922f85bcc466f69
refs/heads/master
2020-04-12T00:20:26.882000
2018-12-19T01:16:41
2018-12-19T01:16:41
161,650,035
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cubito; import com.badlogic.gdx.Game; public class MainGame extends Game { @Override public void create() { MainGameScreen mainGameScreen = new MainGameScreen(this);// Crea la pantalla principal del juego setScreen(mainGameScreen);// Abre la pantalla principal } }
UTF-8
Java
309
java
MainGame.java
Java
[]
null
[]
package com.cubito; import com.badlogic.gdx.Game; public class MainGame extends Game { @Override public void create() { MainGameScreen mainGameScreen = new MainGameScreen(this);// Crea la pantalla principal del juego setScreen(mainGameScreen);// Abre la pantalla principal } }
309
0.711974
0.711974
13
22.76923
29.631464
104
false
false
0
0
0
0
0
0
0.307692
false
false
0
f861e4ffb61af728ebdf98bed9f4a260493bcc42
36,163,624,656,515
88620d154bfe2693e5fc55da65d063505bbe488b
/src/main/java/it/dstech/videoteca/service/RegistaService.java
d0df57d749d13a56452ee0c44a94d8a6b935fa5a
[]
no_license
Sgr57/Videoteca
https://github.com/Sgr57/Videoteca
98565bd2f6a8d018f299a5d165d574d818c9dc67
80be1c07399e675d8be877c81ae514ff6b569729
refs/heads/master
2017-12-22T07:18:29.289000
2016-11-09T14:55:14
2016-11-09T14:55:14
72,856,531
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package it.dstech.videoteca.service; import java.util.List; import it.dstech.videoteca.model.Regista; public interface RegistaService { void saveRegista(Regista regista); List<Regista> findAllRegista(); void deleteRegista(int id); Regista findById(int id); Regista findByNome(String nome); Regista findByCognome(String cognome); void updateRegista(Regista regista); }
UTF-8
Java
383
java
RegistaService.java
Java
[]
null
[]
package it.dstech.videoteca.service; import java.util.List; import it.dstech.videoteca.model.Regista; public interface RegistaService { void saveRegista(Regista regista); List<Regista> findAllRegista(); void deleteRegista(int id); Regista findById(int id); Regista findByNome(String nome); Regista findByCognome(String cognome); void updateRegista(Regista regista); }
383
0.78329
0.78329
21
17.285715
16.852703
41
false
false
0
0
0
0
0
0
0.809524
false
false
0
c482028c02bc69eac4eb1f8768f8e2e102eb390c
35,519,379,564,417
3912cf5041c50f154b9794cfb62b02b661fabaa3
/src/controller/ProcessTest.java
cebdea79864dd143d823720bb832aa0864d7d3f3
[]
no_license
hanzining/a8
https://github.com/hanzining/a8
157b69434eed9dce9a1aa7e3b878c572865e9408
e61a4cbb21e96781e67a69b7821d502aebd00109
refs/heads/master
2020-09-24T12:53:30.598000
2019-12-04T04:35:16
2019-12-04T04:35:16
225,763,220
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package controller; public class ProcessTest { }
UTF-8
Java
51
java
ProcessTest.java
Java
[]
null
[]
package controller; public class ProcessTest { }
51
0.764706
0.764706
5
9.2
11.088733
26
false
false
0
0
0
0
0
0
0.2
false
false
0
277a8fcca0129aa541f6f324922a1db6653f6293
15,908,558,885,011
46d40a42203217c5dcc04202e49eae55817df8ea
/search-algorithms/informed-heuristic-search-algorithms/heuristic-search-algorithm/src/Heuristic/Graph.java
ec94a3edb246623de6e983d103f3f79e2780244e
[]
no_license
AbstractVersion/artificial-inteligence
https://github.com/AbstractVersion/artificial-inteligence
8a4a9e8c4e9666154e5e5e06317bf0d9fbfbcdcb
e5230cd69d9db2282fcdfc8d3978daaaa6775880
refs/heads/master
2021-02-28T01:36:26.584000
2020-03-07T18:19:54
2020-03-07T18:19:54
245,651,304
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Heuristic; import java.util.*; public class Graph { private List<Node> allNodes; private int nodeMaxNo; private double[][] weights; public Graph(int n) { this.allNodes = new ArrayList<>(); this.nodeMaxNo = n; this.weights = new double[this.nodeMaxNo][this.nodeMaxNo]; } public List<Node> getAllNodes() { return allNodes; } public void setAllNodes(List<Node> allNodes) { this.allNodes = allNodes; } public double getWeights(int rowNo, int colNo) { return this.weights[rowNo][colNo]; } public void setWeights(int colNo, int rowNo, double value) { this.weights[colNo - 1] [rowNo -1 ] = value; this.weights[rowNo - 1] [colNo -1 ] = value; } }
UTF-8
Java
725
java
Graph.java
Java
[]
null
[]
package Heuristic; import java.util.*; public class Graph { private List<Node> allNodes; private int nodeMaxNo; private double[][] weights; public Graph(int n) { this.allNodes = new ArrayList<>(); this.nodeMaxNo = n; this.weights = new double[this.nodeMaxNo][this.nodeMaxNo]; } public List<Node> getAllNodes() { return allNodes; } public void setAllNodes(List<Node> allNodes) { this.allNodes = allNodes; } public double getWeights(int rowNo, int colNo) { return this.weights[rowNo][colNo]; } public void setWeights(int colNo, int rowNo, double value) { this.weights[colNo - 1] [rowNo -1 ] = value; this.weights[rowNo - 1] [colNo -1 ] = value; } }
725
0.649655
0.644138
35
18.714285
19.194599
61
false
false
0
0
0
0
0
0
1.4
false
false
0
38998c1864c37b26b00a113b3dadc6536563b3aa
15,908,558,885,321
30ed028e6e682bd1fb0afe67da3f398af24cbcd7
/eclipse.ui/org.eclipse.ui.navigator/src_/org/eclipse/ui/navigator/INavigatorContentExtension.java
0649e41421234054e2494c13cbcb3faeb5e4dd3c
[]
no_license
xiaguangme/eclipse3x_src_study
https://github.com/xiaguangme/eclipse3x_src_study
85eb33a12f7a0f407c2e1595c66b924644346809
0ab251e789f04cbcb69aab831823454ae38f3f9b
refs/heads/master
2016-09-08T01:33:18.511000
2013-11-02T13:15:16
2013-11-02T13:15:16
12,724,827
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/******************************************************************************* * Copyright (c) 2005, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.ui.navigator; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.ITreeContentProvider; /** * The content extension represents the components of a <b>navigatorContent</b> * extension. These handles are managed by a content service * {@link INavigatorContentService}. An extension is formed from the * {@link INavigatorContentDescriptor}. * * <p> * There is a one-to-many correspondence between the {@link INavigatorContentDescriptor} and * {@link INavigatorContentExtension}. An instance of the {@link INavigatorContentExtension} is * created for each {@link INavigatorContentDescriptor} used by a * {@link INavigatorContentService}. * </p> * * @noimplement This interface is not intended to be implemented by clients. * @noextend This interface is not intended to be extended by clients. * @since 3.2 * */ public interface INavigatorContentExtension extends IAdaptable { /** * * @return The id attribute of the navigatorContent extension. */ String getId(); /** * There is one descriptor for all instances of a * INavigatorContentExtension. * * * @return A handle to the descriptor used to manage this extension. */ INavigatorContentDescriptor getDescriptor(); /** * Clients may choose to implement {@link ICommonContentProvider}, but are * only required to supply an implementation of {@link ITreeContentProvider}. * * @return The content provider defined by the <b>navigatorContent</b> * extension. * @see ICommonContentProvider * @see ITreeContentProvider */ ITreeContentProvider getContentProvider(); /** * The real underlying implementation may only support the * {@link ILabelProvider} interface, but a simple delegate is used when this * is the case to ensure that clients may anticpate an * {@link ICommonLabelProvider} interface. * * <p>Since 3.4, the returned label provider may also implement * {@link org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider} * to provide styled text labels. Note that the empty styled string signals * that the label provider does not wish to render the label. * </p> * * @return The content provider defined by the <b>navigatorContent</b> * extension. * @see ICommonLabelProvider * @see ILabelProvider */ ICommonLabelProvider getLabelProvider(); /** * * @return True if any class has been instantiated by this extension. */ boolean isLoaded(); /** * * @return The state model associated with this content extension. * @see IExtensionStateModel */ IExtensionStateModel getStateModel(); }
UTF-8
Java
3,253
java
INavigatorContentExtension.java
Java
[]
null
[]
/******************************************************************************* * Copyright (c) 2005, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.ui.navigator; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.ITreeContentProvider; /** * The content extension represents the components of a <b>navigatorContent</b> * extension. These handles are managed by a content service * {@link INavigatorContentService}. An extension is formed from the * {@link INavigatorContentDescriptor}. * * <p> * There is a one-to-many correspondence between the {@link INavigatorContentDescriptor} and * {@link INavigatorContentExtension}. An instance of the {@link INavigatorContentExtension} is * created for each {@link INavigatorContentDescriptor} used by a * {@link INavigatorContentService}. * </p> * * @noimplement This interface is not intended to be implemented by clients. * @noextend This interface is not intended to be extended by clients. * @since 3.2 * */ public interface INavigatorContentExtension extends IAdaptable { /** * * @return The id attribute of the navigatorContent extension. */ String getId(); /** * There is one descriptor for all instances of a * INavigatorContentExtension. * * * @return A handle to the descriptor used to manage this extension. */ INavigatorContentDescriptor getDescriptor(); /** * Clients may choose to implement {@link ICommonContentProvider}, but are * only required to supply an implementation of {@link ITreeContentProvider}. * * @return The content provider defined by the <b>navigatorContent</b> * extension. * @see ICommonContentProvider * @see ITreeContentProvider */ ITreeContentProvider getContentProvider(); /** * The real underlying implementation may only support the * {@link ILabelProvider} interface, but a simple delegate is used when this * is the case to ensure that clients may anticpate an * {@link ICommonLabelProvider} interface. * * <p>Since 3.4, the returned label provider may also implement * {@link org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider} * to provide styled text labels. Note that the empty styled string signals * that the label provider does not wish to render the label. * </p> * * @return The content provider defined by the <b>navigatorContent</b> * extension. * @see ICommonLabelProvider * @see ILabelProvider */ ICommonLabelProvider getLabelProvider(); /** * * @return True if any class has been instantiated by this extension. */ boolean isLoaded(); /** * * @return The state model associated with this content extension. * @see IExtensionStateModel */ IExtensionStateModel getStateModel(); }
3,253
0.699047
0.694129
95
33.147369
30.031902
96
false
false
0
0
0
0
0
0
0.705263
false
false
0
5b9207550d4972c149c9d15745f6214dfc535940
1,554,778,195,530
bb2c241a49b1542e85e1e94c0d4daab5aab22113
/lao-lu-model/src/main/java/com/ai/ge/platform/dto/user/SysOrgaRoleRelDto.java
ba56751545c2ae8fdbd394406767fd576f6d34d1
[]
no_license
Johnnyhj/lao-lu-parent
https://github.com/Johnnyhj/lao-lu-parent
b6809229e4a229301335b0d5ab2bd1607c8ae631
3473f0348577a9ba01127cf165da75445e938aa1
refs/heads/master
2021-01-01T18:14:18.419000
2017-07-22T02:20:21
2017-07-22T02:20:21
98,282,656
1
0
null
true
2017-07-25T08:22:47
2017-07-25T08:22:47
2017-07-22T02:01:33
2017-07-22T02:20:48
7,954
0
0
0
null
null
null
package com.ai.ge.platform.dto.user; import com.ai.ge.platform.model.user.SysOrgaRoleRel; /** * */ public class SysOrgaRoleRelDto extends SysOrgaRoleRel { private String sysRoleName; private String sysRoleDesc; public String getSysRoleName() { return sysRoleName; } public void setSysRoleName(String sysRoleName) { this.sysRoleName = sysRoleName; } public String getSysRoleDesc() { return sysRoleDesc; } public void setSysRoleDesc(String sysRoleDesc) { this.sysRoleDesc = sysRoleDesc; } }
UTF-8
Java
569
java
SysOrgaRoleRelDto.java
Java
[]
null
[]
package com.ai.ge.platform.dto.user; import com.ai.ge.platform.model.user.SysOrgaRoleRel; /** * */ public class SysOrgaRoleRelDto extends SysOrgaRoleRel { private String sysRoleName; private String sysRoleDesc; public String getSysRoleName() { return sysRoleName; } public void setSysRoleName(String sysRoleName) { this.sysRoleName = sysRoleName; } public String getSysRoleDesc() { return sysRoleDesc; } public void setSysRoleDesc(String sysRoleDesc) { this.sysRoleDesc = sysRoleDesc; } }
569
0.685413
0.685413
28
19.321428
19.732231
53
false
false
0
0
0
0
0
0
0.285714
false
false
0
987cf56488060b97adf64c7e1d0ee17b6eaa6449
12,919,261,675,443
e88fa5b9b8e1914ab9beca9164b8cbdf654a5883
/nature-j2ee/nature-j2ee-core/src/main/java/pers/linhai/nature/j2ee/core/dao/JointQueryHelper.java
56c7aa09a7de587ab84f180acfc8c066e8d0663a
[]
no_license
un-knower/nature
https://github.com/un-knower/nature
22de33bf7b594a384798bce31b87c50ee2a0c21a
efa2f2f53cff91a5f582a9dbaf21f5970b1e4b81
refs/heads/master
2020-03-20T21:56:03.210000
2018-06-18T08:58:17
2018-06-18T08:58:17
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * <p>Copyright : LinHai Technologies Co., Ltd. Copyright 2018, All right reserved.</p> * <p>Description : <pre>TODO(用一句话描述该文件做什么)</pre></p> * <p>FileName : JointQueryProcessorProducer.java</p> * <p>Package : pers.linhai.nature.j2ee.core.dao</p> * @Creator lilinhai 2018年6月5日 下午12:34:55 * @Version V1.0 */ package pers.linhai.nature.j2ee.core.dao; import pers.linhai.nature.j2ee.core.dao.processor.JointQueryRowDataProcessor; import pers.linhai.nature.j2ee.core.model.QueryValidator; /** * 抽象的JointQueryProcessor生产者 * <p>ClassName : JointQueryProcessorProducer</p> * @author lilinhai 2018年6月5日 下午12:34:55 * @version 1.0 */ public abstract class JointQueryHelper { /** * 获取一个结果处理器 * <p>Title : getJointQueryRowDataProcessor lilinhai 2018年6月5日 下午12:36:54</p> * @return * JointQueryRowDataProcessor */ public abstract JointQueryRowDataProcessor getJointQueryRowDataProcessor(); /** * 返回一个查询校验器 * <p>Title : getQueryValidator lilinhai 2018年6月5日 下午3:02:34</p> * @return * QueryValidator */ public abstract QueryValidator getQueryValidator(); }
UTF-8
Java
1,281
java
JointQueryHelper.java
Java
[ { "context": ": pers.linhai.nature.j2ee.core.dao</p>\n * @Creator lilinhai 2018年6月5日 下午12:34:55\n * @Version V1.0 \n */ \n\npa", "end": 282, "score": 0.9995298385620117, "start": 274, "tag": "USERNAME", "value": "lilinhai" }, { "context": " : JointQueryProcessorProducer</p>\n ...
null
[]
/* * <p>Copyright : LinHai Technologies Co., Ltd. Copyright 2018, All right reserved.</p> * <p>Description : <pre>TODO(用一句话描述该文件做什么)</pre></p> * <p>FileName : JointQueryProcessorProducer.java</p> * <p>Package : pers.linhai.nature.j2ee.core.dao</p> * @Creator lilinhai 2018年6月5日 下午12:34:55 * @Version V1.0 */ package pers.linhai.nature.j2ee.core.dao; import pers.linhai.nature.j2ee.core.dao.processor.JointQueryRowDataProcessor; import pers.linhai.nature.j2ee.core.model.QueryValidator; /** * 抽象的JointQueryProcessor生产者 * <p>ClassName : JointQueryProcessorProducer</p> * @author lilinhai 2018年6月5日 下午12:34:55 * @version 1.0 */ public abstract class JointQueryHelper { /** * 获取一个结果处理器 * <p>Title : getJointQueryRowDataProcessor lilinhai 2018年6月5日 下午12:36:54</p> * @return * JointQueryRowDataProcessor */ public abstract JointQueryRowDataProcessor getJointQueryRowDataProcessor(); /** * 返回一个查询校验器 * <p>Title : getQueryValidator lilinhai 2018年6月5日 下午3:02:34</p> * @return * QueryValidator */ public abstract QueryValidator getQueryValidator(); }
1,281
0.68349
0.63302
39
28.97436
27.669744
89
false
false
0
0
0
0
0
0
0.179487
false
false
0
ade98392c3e0d640fbe3feb9858d3b1582a5db21
25,623,774,929,118
85f45b7ccbeb379bc5321d494b5b9641df804f08
/doit/src/main/java/com/airhacks/doit/business/validation/ValidEntity.java
6e8041ab974f429d3b480cd39e5972add13f9ff5
[]
no_license
areyouready/effectivejavaee
https://github.com/areyouready/effectivejavaee
2ceba43b808fc1bc35b8e82e820ac59871a3065e
6a21076a392e5d6ffac958173e8e210f1de302e5
refs/heads/master
2021-01-10T13:56:43.664000
2016-02-15T23:08:19
2016-02-15T23:08:19
45,422,612
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.airhacks.doit.business.validation; /** * Created by sebastianbasner on 15.11.15. */ public interface ValidEntity { boolean isValid(); }
UTF-8
Java
155
java
ValidEntity.java
Java
[ { "context": "hacks.doit.business.validation;\n\n/**\n * Created by sebastianbasner on 15.11.15.\n */\npublic interface ValidEntity {\n\n", "end": 81, "score": 0.9907282590866089, "start": 66, "tag": "USERNAME", "value": "sebastianbasner" } ]
null
[]
package com.airhacks.doit.business.validation; /** * Created by sebastianbasner on 15.11.15. */ public interface ValidEntity { boolean isValid(); }
155
0.722581
0.683871
9
16.222221
17.862299
46
false
false
0
0
0
0
0
0
0.222222
false
false
0
ece248d217d063bc42d5797999ee140bad309d49
25,812,753,491,830
32e8df3065a0a771952ebb7d04f5945493d21841
/eulerproject/9/9_3.java
b1475eba6b81649b990640c076997dae119c0e40
[]
no_license
Todoloki/others
https://github.com/Todoloki/others
eda70ea1e04194775bf7519fb0b9f9a12e0d80a8
58d4e223b9087421dc5254cae0d1261ea9e07d6d
refs/heads/master
2021-06-08T15:19:49.817000
2021-05-11T13:10:04
2021-05-11T13:10:04
88,545,725
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Wanna play splatoon. */ import java.util.*; public class Solution { public static void main(String [] args) { // for a < 1000 / 3 // since 1000 % 3 != 0 // so a <= 1000 / 3 // since 1000 % 2 == 0 // so b < 1000 / 2 && b > a int sum = 1000; for (int i = 1; i <= 1000; i++) { for (int j = i + 1; j < 1000 / 2; j++) { //for (int k = j + 1; k <= 1000; k++) { int k = 1000 - i - j; if (i * i + j * j == k * k) { //System.out.println(i + " " + j + " " + k); System.out.println(i * j * k); } //} } } } }
UTF-8
Java
741
java
9_3.java
Java
[]
null
[]
/** * Wanna play splatoon. */ import java.util.*; public class Solution { public static void main(String [] args) { // for a < 1000 / 3 // since 1000 % 3 != 0 // so a <= 1000 / 3 // since 1000 % 2 == 0 // so b < 1000 / 2 && b > a int sum = 1000; for (int i = 1; i <= 1000; i++) { for (int j = i + 1; j < 1000 / 2; j++) { //for (int k = j + 1; k <= 1000; k++) { int k = 1000 - i - j; if (i * i + j * j == k * k) { //System.out.println(i + " " + j + " " + k); System.out.println(i * j * k); } //} } } } }
741
0.323887
0.255061
29
24.551723
19.290136
68
false
false
0
0
0
0
0
0
0.37931
false
false
0
a12927281c3749260617e30f4e759b7cc5b5396d
13,262,859,053,965
de253e9ebe39b43912c879f71206dfd934318c52
/view/src/main/java/org/xcolab/view/pages/contenteditor/ContentEditorController.java
4e4b1aeb53ff4418a60dac6392ca782cbb478b02
[ "MIT" ]
permissive
carlosbpf/XCoLab
https://github.com/carlosbpf/XCoLab
9d3a8432bf5a94fc24944d38a5c722823cae708c
eb68c86843eedf29e8e0c109b485e04a508b07f2
refs/heads/master
2021-01-19T10:06:33.281000
2017-02-18T17:18:03
2017-02-18T17:18:03
82,162,079
0
0
null
true
2017-02-16T09:16:18
2017-02-16T09:16:18
2016-12-06T17:40:02
2017-02-16T00:58:33
106,691
0
0
0
null
null
null
package org.xcolab.view.pages.contenteditor; import org.json.JSONArray; import org.json.JSONObject; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; import org.xcolab.client.contents.ContentsClient; import org.xcolab.client.contents.exceptions.ContentNotFoundException; import org.xcolab.client.contents.pojo.ContentArticleVersion; import org.xcolab.client.contents.pojo.ContentFolder; import org.xcolab.client.members.PermissionsClient; import org.xcolab.view.auth.MemberAuthUtil; import org.xcolab.view.errors.ErrorText; import java.io.IOException; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @Controller public class ContentEditorController { private static final Integer THRESHOLD_TO_AVOID_NODE_COLLISION = 1000; @GetMapping("/content-editor") public String handleRenderRequest(HttpServletRequest request, HttpServletRequest response, Model model) { long memberId = MemberAuthUtil.getMemberId(request); if (PermissionsClient.canAdminAll(memberId)) { return "contenteditor/editor"; } else { return ErrorText.ACCESS_DENIED.flashAndReturnView(request); } } @GetMapping("/content-editor/contentEditorListFolder") public void contentEditorListFolder(HttpServletRequest request, HttpServletResponse response, @RequestParam(required = false) String node) throws IOException { JSONArray responseArray = new JSONArray(); Long folderId = 1L; if (node != null && !node.isEmpty()) { folderId = Long.parseLong(node); } List<ContentFolder> contentFolders = ContentsClient.getContentFolders(folderId); if (contentFolders != null) { for (ContentFolder cf : contentFolders) { responseArray.put(folderNode(cf.getContentFolderName(), cf.getContentFolderId().toString())); } } List<ContentArticleVersion> contentArticles = ContentsClient.getChildArticleVersions(folderId); if (contentArticles != null) { for (ContentArticleVersion ca : contentArticles) { responseArray.put(articleNode(ca.getTitle(), ca.getContentArticleId())); } } response.getOutputStream().write(responseArray.toString().getBytes()); } @GetMapping("/content-editor/contentEditorGetLatestArticleVersion") public void contentEditorGetLatestArticleVersion(HttpServletRequest request, HttpServletResponse response, @RequestParam(required = false) Long articleId) throws IOException, ContentNotFoundException { JSONObject articleVersion = new JSONObject(); ContentArticleVersion contentArticleVersion = ContentsClient.getLatestContentArticleVersion(articleId); if (contentArticleVersion != null) { articleVersion.put("title", contentArticleVersion.getTitle()); articleVersion.put("folderId", contentArticleVersion.getFolderId()); articleVersion.put("articleId", contentArticleVersion.getContentArticleId()); articleVersion.put("content", contentArticleVersion.getContent()); } response.getOutputStream().write(articleVersion.toString().getBytes()); } @PostMapping("/content-editor/createArticleFolder") public void createArticleFolder(HttpServletRequest request, HttpServletResponse response, @RequestParam(required = false) String folderName, @RequestParam(required = false) Long parentFolderId) throws IOException{ ContentFolder contentFolder = new ContentFolder(); contentFolder.setContentFolderName(folderName); contentFolder.setParentFolderId(parentFolderId); ContentsClient.createContentFolder(contentFolder); defaultOperationReturnMessage(true, "Folder created successfully", response); } @PostMapping("/content-editor/moveArticleVersion") public void moveArticleVersion(HttpServletRequest request, HttpServletResponse response, @RequestParam(required = false) Long articleId, @RequestParam(required = false) Long folderId) throws IOException, ContentNotFoundException { long userId = MemberAuthUtil.getMemberId(request); ContentArticleVersion contentArticleVersion = ContentsClient.getLatestContentArticleVersion(articleId); ContentArticleVersion newContentArticleVersion = new ContentArticleVersion(); newContentArticleVersion.setTitle(contentArticleVersion.getTitle()); newContentArticleVersion.setContent(contentArticleVersion.getContent()); newContentArticleVersion.setContentArticleId(contentArticleVersion.getContentArticleId()); newContentArticleVersion.setAuthorId(userId); newContentArticleVersion.setFolderId(folderId); ContentsClient.createContentArticleVersion(newContentArticleVersion); defaultOperationReturnMessage(true, "Article moved successfully", response); } @PostMapping("/content-editor/saveContentArticleVersion") public void saveContentArticleVersion(HttpServletRequest request, HttpServletResponse response, @RequestParam(required = false) Long articleId, @RequestParam(required = false) String title, @RequestParam(required = false) Long folderId, @RequestParam(required = false) String content ) throws IOException { long userId = MemberAuthUtil.getMemberId(request); ContentArticleVersion contentArticleVersion = new ContentArticleVersion(); contentArticleVersion.setContentArticleId(articleId); contentArticleVersion.setAuthorId(userId); contentArticleVersion.setFolderId((folderId)); contentArticleVersion.setTitle(title); contentArticleVersion.setContent(content); ContentsClient.createContentArticleVersion(contentArticleVersion); defaultOperationReturnMessage(true, "Article version created successfully", response); } private void defaultOperationReturnMessage(boolean success, String message, HttpServletResponse response) throws IOException { JSONObject articleVersion = new JSONObject(); JSONObject folderNode = new JSONObject(); folderNode.put("success", success); folderNode.put("msg", message); response.getOutputStream().write(articleVersion.toString().getBytes()); } private JSONObject treeNode(String label, String id, String kind, boolean loadOnDemand) { JSONObject folderNode = new JSONObject(); folderNode.put("label", label); folderNode.put("id", id); folderNode.put("kind", kind); if (loadOnDemand) { folderNode.put("load_on_demand", loadOnDemand + ""); } return folderNode; } private JSONObject articleNode(String label, Long id) { return treeNode(label, (THRESHOLD_TO_AVOID_NODE_COLLISION +id) + "", "article", false); } private JSONObject folderNode(String label, String id) { return treeNode(label, id, "folder", true); } }
UTF-8
Java
7,647
java
ContentEditorController.java
Java
[]
null
[]
package org.xcolab.view.pages.contenteditor; import org.json.JSONArray; import org.json.JSONObject; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; import org.xcolab.client.contents.ContentsClient; import org.xcolab.client.contents.exceptions.ContentNotFoundException; import org.xcolab.client.contents.pojo.ContentArticleVersion; import org.xcolab.client.contents.pojo.ContentFolder; import org.xcolab.client.members.PermissionsClient; import org.xcolab.view.auth.MemberAuthUtil; import org.xcolab.view.errors.ErrorText; import java.io.IOException; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @Controller public class ContentEditorController { private static final Integer THRESHOLD_TO_AVOID_NODE_COLLISION = 1000; @GetMapping("/content-editor") public String handleRenderRequest(HttpServletRequest request, HttpServletRequest response, Model model) { long memberId = MemberAuthUtil.getMemberId(request); if (PermissionsClient.canAdminAll(memberId)) { return "contenteditor/editor"; } else { return ErrorText.ACCESS_DENIED.flashAndReturnView(request); } } @GetMapping("/content-editor/contentEditorListFolder") public void contentEditorListFolder(HttpServletRequest request, HttpServletResponse response, @RequestParam(required = false) String node) throws IOException { JSONArray responseArray = new JSONArray(); Long folderId = 1L; if (node != null && !node.isEmpty()) { folderId = Long.parseLong(node); } List<ContentFolder> contentFolders = ContentsClient.getContentFolders(folderId); if (contentFolders != null) { for (ContentFolder cf : contentFolders) { responseArray.put(folderNode(cf.getContentFolderName(), cf.getContentFolderId().toString())); } } List<ContentArticleVersion> contentArticles = ContentsClient.getChildArticleVersions(folderId); if (contentArticles != null) { for (ContentArticleVersion ca : contentArticles) { responseArray.put(articleNode(ca.getTitle(), ca.getContentArticleId())); } } response.getOutputStream().write(responseArray.toString().getBytes()); } @GetMapping("/content-editor/contentEditorGetLatestArticleVersion") public void contentEditorGetLatestArticleVersion(HttpServletRequest request, HttpServletResponse response, @RequestParam(required = false) Long articleId) throws IOException, ContentNotFoundException { JSONObject articleVersion = new JSONObject(); ContentArticleVersion contentArticleVersion = ContentsClient.getLatestContentArticleVersion(articleId); if (contentArticleVersion != null) { articleVersion.put("title", contentArticleVersion.getTitle()); articleVersion.put("folderId", contentArticleVersion.getFolderId()); articleVersion.put("articleId", contentArticleVersion.getContentArticleId()); articleVersion.put("content", contentArticleVersion.getContent()); } response.getOutputStream().write(articleVersion.toString().getBytes()); } @PostMapping("/content-editor/createArticleFolder") public void createArticleFolder(HttpServletRequest request, HttpServletResponse response, @RequestParam(required = false) String folderName, @RequestParam(required = false) Long parentFolderId) throws IOException{ ContentFolder contentFolder = new ContentFolder(); contentFolder.setContentFolderName(folderName); contentFolder.setParentFolderId(parentFolderId); ContentsClient.createContentFolder(contentFolder); defaultOperationReturnMessage(true, "Folder created successfully", response); } @PostMapping("/content-editor/moveArticleVersion") public void moveArticleVersion(HttpServletRequest request, HttpServletResponse response, @RequestParam(required = false) Long articleId, @RequestParam(required = false) Long folderId) throws IOException, ContentNotFoundException { long userId = MemberAuthUtil.getMemberId(request); ContentArticleVersion contentArticleVersion = ContentsClient.getLatestContentArticleVersion(articleId); ContentArticleVersion newContentArticleVersion = new ContentArticleVersion(); newContentArticleVersion.setTitle(contentArticleVersion.getTitle()); newContentArticleVersion.setContent(contentArticleVersion.getContent()); newContentArticleVersion.setContentArticleId(contentArticleVersion.getContentArticleId()); newContentArticleVersion.setAuthorId(userId); newContentArticleVersion.setFolderId(folderId); ContentsClient.createContentArticleVersion(newContentArticleVersion); defaultOperationReturnMessage(true, "Article moved successfully", response); } @PostMapping("/content-editor/saveContentArticleVersion") public void saveContentArticleVersion(HttpServletRequest request, HttpServletResponse response, @RequestParam(required = false) Long articleId, @RequestParam(required = false) String title, @RequestParam(required = false) Long folderId, @RequestParam(required = false) String content ) throws IOException { long userId = MemberAuthUtil.getMemberId(request); ContentArticleVersion contentArticleVersion = new ContentArticleVersion(); contentArticleVersion.setContentArticleId(articleId); contentArticleVersion.setAuthorId(userId); contentArticleVersion.setFolderId((folderId)); contentArticleVersion.setTitle(title); contentArticleVersion.setContent(content); ContentsClient.createContentArticleVersion(contentArticleVersion); defaultOperationReturnMessage(true, "Article version created successfully", response); } private void defaultOperationReturnMessage(boolean success, String message, HttpServletResponse response) throws IOException { JSONObject articleVersion = new JSONObject(); JSONObject folderNode = new JSONObject(); folderNode.put("success", success); folderNode.put("msg", message); response.getOutputStream().write(articleVersion.toString().getBytes()); } private JSONObject treeNode(String label, String id, String kind, boolean loadOnDemand) { JSONObject folderNode = new JSONObject(); folderNode.put("label", label); folderNode.put("id", id); folderNode.put("kind", kind); if (loadOnDemand) { folderNode.put("load_on_demand", loadOnDemand + ""); } return folderNode; } private JSONObject articleNode(String label, Long id) { return treeNode(label, (THRESHOLD_TO_AVOID_NODE_COLLISION +id) + "", "article", false); } private JSONObject folderNode(String label, String id) { return treeNode(label, id, "folder", true); } }
7,647
0.698575
0.697921
169
44.24852
34.773617
130
false
false
0
0
0
0
0
0
0.739645
false
false
0