blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 7
332
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
50
| license_type
stringclasses 2
values | repo_name
stringlengths 7
115
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 557
values | visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
684M
⌀ | star_events_count
int64 0
77.7k
| fork_events_count
int64 0
48k
| gha_license_id
stringclasses 17
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 82
values | src_encoding
stringclasses 28
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 7
5.41M
| extension
stringclasses 11
values | content
stringlengths 7
5.41M
| authors
listlengths 1
1
| author
stringlengths 0
161
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3dd48d1b8885a18fcbc096638efa431f41c92f21
|
a4129fe7a72b4ca5d3b3efd9d041cd8bfc524c85
|
/furnitures/src/main/java/com/musichub/furnitures/model/Check.java
|
938ce112192b4ee44391dcfc79175859d038fe7b
|
[] |
no_license
|
SukeshKappuram/DigitalTransformation
|
d6131173fa904a8abbcb8e480dc55225a90ea843
|
65b8ec2ed8a474586ac869cb9c9801fb7de4567e
|
refs/heads/master
| 2021-05-31T10:54:11.129283
| 2016-05-31T07:31:40
| 2016-05-31T07:31:40
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 270
|
java
|
package com.musichub.furnitures.model;
import javax.persistence.Entity;
import javax.persistence.Id;
@Entity
public class Check {
@Id
private int id;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
}
|
[
"iamsukeshk@gmail.com"
] |
iamsukeshk@gmail.com
|
0ca93567ca03f7918e9ef3ecef316e1213c67085
|
d69b596ae5c2d98d8c5752eb8b86fc24bbf5a14a
|
/JavaApplication4/src/javaapplication4/temp.java
|
90935d28202a0a32efb313874bfd04a12b362dce
|
[] |
no_license
|
akashgoel1197/JAVA-MOVIE-BOOKING-SYSTEM
|
bb72616bb5252f48397e2f135b407fce3bb6b343
|
2ac7bcbed2c5f598177a32659b10c775369aa880
|
refs/heads/master
| 2020-05-21T03:46:58.602986
| 2017-03-10T14:39:06
| 2017-03-10T14:39:06
| 84,567,554
| 0
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 7,640
|
java
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package javaapplication4;
/**
*
* @author Akash
*/
public class temp {
public void paint(Graphics g)
{
//ArrayList<Integer> list = new ArrayList<Integer>(array);
super.paint(g); // Clears the frame when method is called
int width = 32; // State width of each Rectangle
int height = 32; // State height of each Rectangle
int leftBlockSeatsCol = 6; // State number of Rows in the Left Block
int leftBlockSeatsRow = 6; // State number of Columns in the Left Block
int centerBlockSeatsRow = 5; // State number of Rows in the Center Block
int centerBlockSeatsCol = 8; // State number of Columns in the Center Block
int rightBlockSeatsRow = 6; // State number of Rows in the Right Block
int rightBlockSeatsCol = 6; // State number of Columns in the Right Block
int leftBlockPosX = 15; // Sets Left Block X-axis Position (in Pixels)
int leftBlockPosY = 225; // Sets Left Block Y-axis Position (in Pixels)
int centerBlockPosX = (leftBlockPosX+(leftBlockSeatsCol*width)) +50; // Sets Center Block X-axis Position (in Pixels)
int centerBlockPosY = 225; // Sets Center Block Y-axis Position (in Pixels)
int rightBlockPosX = (centerBlockPosX +(centerBlockSeatsCol*width)) +50; // Sets Right Block X-axis Position (in Pixels)
int rightBlockPosY = 225; // Sets Right Block Y-axis Position (in Pixels)
g.setColor(Color.black); // Set Default Draw Color to black
g.drawString("Left Block", (leftBlockPosX+(32*(leftBlockSeatsCol/2)-25)), (leftBlockPosY - 10)); // Title for Each Block
g.drawString("Center Block", (centerBlockPosX+(32*(centerBlockSeatsCol/2)-30)), (centerBlockPosY - 10));
g.drawString("Right Block", (rightBlockPosX+(32*(rightBlockSeatsCol/2)-25)), (rightBlockPosY - 10));
Color custom_grey = new Color(175,175,175);
//DRAW LEFT BLOCK OF SEATS
for(int i=0; i<leftBlockSeatsCol;i++) // Loop while there are Columns..
{
String colString = new Integer (i+101).toString(); // Creates an Integer of relative Seat Number and converts it to a String
g.drawString(colString, leftBlockPosX+5+(i*width), leftBlockPosY+20); // String is affixed to drawSring method and co-ordinates tweaked to center the text in each box.
g.drawRect(leftBlockPosX+(i*width), leftBlockPosY, width, height); // Draw a rectangle at the stated X and Y- Pos. The next rect = X-Pos + (width of rectangle * horizontal psotion) [hence in a sequence]
if (seatArrayList.contains((i+101)) != true) // If The Array of available seats does not contain i+101 (Seat 1 of leftBlock is 101, Seat 2 is 102, etc)...
{
g.setColor(Color.red); // Then change Draw Color to red
g.fillRect(leftBlockPosX+(i*width), leftBlockPosY, width, height); // Fill in the currently iterated rectangle
g.setColor(Color.black); // Change color back to default
g.drawRect(leftBlockPosX+(i*width), leftBlockPosY, width, height); // Redraw the Rectangle
g.drawString(colString, leftBlockPosX+5+(i*width),leftBlockPosY+20); // Redraw the number
}
for(int x=0; x<leftBlockSeatsRow; x++) // For each column, loop while there are Rows..
{
String rowString = new Integer((i+(leftBlockSeatsCol*x))+101).toString(); // [As above]
g.drawString (rowString, leftBlockPosX+5+(i*width), leftBlockPosY+(x*height)+20);
g.drawRect(leftBlockPosX+(i*width),leftBlockPosY+(x*height), width, height); // Draw A rectangle exactly like before but with Y-Pos + (height * vertical postition)
if (seatArrayList.contains((i+(leftBlockSeatsCol*x))+101) != true) // If the Array of available seats does not contain the relevent seat number...
{
g.setColor(Color.red); // Change Draw Color ot red
g.fillRect(leftBlockPosX+(i*width), leftBlockPosY+(x*height), width, height); // Fill in the currently iterated rectangle
g.setColor(Color.black); // Change draw color back to default
g.drawRect(leftBlockPosX+(i*width), leftBlockPosY+(x*height), width, height); // Redraw outline of rectangle
g.setColor(custom_grey); // Set Color to Custom
g.drawString (rowString, leftBlockPosX+5+(i*width), leftBlockPosY+(x*height)+20); // Redraw number
g.setColor(Color.black); // Change color back to default
}
}
}
// DRAW CENTER BLOCK OF SEATS
for(int i=0; i<centerBlockSeatsCol;i++) // [Refer to Left Block Code comments]
{
String colString = new Integer (i+201).toString();
g.drawString (colString, centerBlockPosX+5+(i*width), centerBlockPosY+20);
g.drawRect(centerBlockPosX+(i*width), centerBlockPosY, width, height);
if (seatArrayList.contains((i+201)) != true)
{
g.setColor(Color.red);
g.fillRect(centerBlockPosX+(i*width), centerBlockPosY, width, height);
g.setColor(Color.black);
g.drawRect(centerBlockPosX+(i*width), centerBlockPosY, width, height);
g.drawString(colString, centerBlockPosX+5+(i*width), centerBlockPosY+20);
}
for (int x=0; x<centerBlockSeatsRow; x++)
{
String rowString = new Integer ((i+(centerBlockSeatsCol*x))+201).toString();
g.drawString(rowString, centerBlockPosX+5+(i*width), centerBlockPosY+(x*height)+20);
g.drawRect(centerBlockPosX+(i*width), centerBlockPosY+(x*height), width, height);
if (seatArrayList.contains((i+(centerBlockSeatsCol*x))+201) != true)
{
g.setColor(Color.red);
g.fillRect(centerBlockPosX+(i*width), centerBlockPosY+(x*height), width, height);
g.setColor(Color.black);
g.drawRect(centerBlockPosX+(i*width), centerBlockPosY+(x*height), width, height);
g.setColor(custom_grey);
g.drawString (rowString, centerBlockPosX+5+(i*width), centerBlockPosY+(x*height)+20);
g.setColor(Color.black);
}
}
}
//DRAW RIGHT BLOCK OF SEATS
for (int i=0; i<rightBlockSeatsCol;i++) // [Refer to Left Block Code comments]
{
String colString = new Integer (i+301).toString();
g.drawString(colString, rightBlockPosX+5+(i*width), rightBlockPosY+20);
g.drawRect(rightBlockPosX+(i*width), rightBlockPosY, width, height);
if (seatArrayList.contains((i+301)) != true)
{
g.setColor(Color.red);
g.fillRect(rightBlockPosX+(i*width),rightBlockPosY,width,height);
g.setColor(Color.black);
g.drawRect(rightBlockPosX+(i*width), rightBlockPosY, width, height);
g.drawString (colString, rightBlockPosX+5+(i*width), rightBlockPosY+20);
}
for(int x=0; x<rightBlockSeatsRow; x++)
{
String rowString = new Integer ((i+(rightBlockSeatsCol*x))+301).toString();
g.drawString (rowString, rightBlockPosX+5+(i*width), rightBlockPosY+(x*height)+20);
g.drawRect(rightBlockPosX+(i*width), rightBlockPosY+(x*height), width, height);
if (seatArrayList.contains((i+(rightBlockSeatsCol*x))+301) != true)
{
g.setColor(Color.red);
g.fillRect(rightBlockPosX+(i*width), rightBlockPosY+(x*height), width, height);
g.setColor(Color.black);
g.drawRect(rightBlockPosX+(i*width), rightBlockPosY+(x*height), width, height);
g.setColor(custom_grey);
g.drawString (rowString, rightBlockPosX+5+(i*width), rightBlockPosY+(x*height)+20);
g.setColor(Color.black);
}
}
}
}
|
[
"noreply@github.com"
] |
noreply@github.com
|
e5c8922baa042111a13d8ea75c57848aee015039
|
7001af561d681bc94d8fa3c45a8996119eda2bf1
|
/experian-single-signer/rest/target/generated-sources/swagger/gen/br/com/experian/single/signer/rest/api/DebtssummariesApi.java
|
70d1460acac0b08bfd5173603ecbcd55abad02a3
|
[] |
no_license
|
biroska/Single-Signer
|
bdcb1ba4746e370533974697642bd0756a4a5032
|
e3266d18b7d79396436bc445e6ba4b11a0866b6c
|
refs/heads/master
| 2020-03-29T11:53:30.941536
| 2018-09-22T13:12:07
| 2018-09-22T13:12:07
| 149,875,657
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,122
|
java
|
package br.com.experian.single.signer.rest.api;
import br.com.experian.single.signer.rest.model.*;
import io.swagger.annotations.ApiParam;
//import io.swagger.jaxrs.*;
import br.com.experian.single.signer.rest.model.Resumo;
import java.util.List;
import java.io.InputStream;
import com.sun.jersey.core.header.FormDataContentDisposition;
import com.sun.jersey.multipart.FormDataParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext;
import javax.ws.rs.*;
@Path("/debtssummaries")
public interface DebtssummariesApi {
@GET
@Path("/{companyId}")
@Produces({ "application/json" })
public Response retrieveDebtsSummaries(@ApiParam(value = "Content-Type field is to describe the data contained in the body." ,required=true, defaultValue="application/json")@HeaderParam("Content-Type") String contentType, @ApiParam(value = "The client sends the access token preceded by Bearer." ,required=true)@HeaderParam("Authorization") String authorization, @ApiParam(value = "Company ID",required=true) @PathParam("companyId") Long companyId);
}
|
[
"biroska@gmail.com"
] |
biroska@gmail.com
|
ca6fc2c6f8523e875e48aabd87766212c9031122
|
4abc2e1264d5f2b0b22f288d9bc2c647d102c674
|
/src/main/java/ion/project1/consults/ConsultEntity.java
|
d644138187a608b5e1307c3afa6e92208d5e1572
|
[] |
no_license
|
ionbivol/project
|
9d8cc7f671749ccd2b274732bff14b1c3de225ef
|
b63dd4389ea45f3e52ed5b87b50b841c7abd7d83
|
refs/heads/main
| 2023-03-18T00:54:05.380690
| 2021-03-20T13:57:47
| 2021-03-20T13:57:47
| 349,738,531
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,211
|
java
|
package ion.project1.consults;
import ion.project1.doctor.DoctorEntity;
import ion.project1.patient.PatientEntity;
import javax.persistence.*;
import java.time.LocalDate;
@Entity
@Table(name = "consults")
public class ConsultEntity {
@Id
@Column(name="consult_id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer consultId;
private LocalDate date;
private Double price;
private String diagnostic;
@ManyToOne
@JoinColumn(name = "patient_id")
private PatientEntity patient;
@ManyToOne
@JoinColumn(name = "doctor_id")
private DoctorEntity doctor;
public ConsultEntity() {
}
public ConsultEntity(LocalDate date, PatientEntity patient, DoctorEntity doctor) {
this.date = date;
this.patient = patient;
this.doctor = doctor;
}
public Integer getConsultId() {
return consultId;
}
public LocalDate getDate() {
return date;
}
public void setDate(LocalDate date) {
this.date = date;
}
public Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
public String getDiagnostic() {
return diagnostic;
}
public void setDiagnostic(String diagnostic) {
this.diagnostic = diagnostic;
}
public PatientEntity getPatient() {
return patient;
}
public void setPatient(PatientEntity patient) {
this.patient = patient;
}
public DoctorEntity getDoctor() {
return doctor;
}
public void setDoctor(DoctorEntity doctor) {
this.doctor = doctor;
}
@Override
public String toString() {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("consultId: ").append(consultId).append("\n ");
stringBuilder.append("date: ").append(date).append("\n");
stringBuilder.append(doctor).append("\n ");
stringBuilder.append(patient).append(" \n");
stringBuilder.append("diagnostic : ").append(diagnostic).append(" ");
stringBuilder.append("price").append(price).append(" ");
return stringBuilder.toString();
}
}
|
[
"vaniniabivol@gmail.com"
] |
vaniniabivol@gmail.com
|
05099e348565a5e0714bcacae125d6f45ee52854
|
0c8a91efcc0de6fad200971d1c5918453f7fa556
|
/src/com/database/Utils/JsonDateValueProcessor.java
|
e39912267393c86dfdb866b5b66859c702e010f0
|
[] |
no_license
|
qizhengshi12/NTJTCW
|
2d18b45f4f3d117e2b1334d013db462139c4ede6
|
72bed3c8f01fe38db81dec952cc39f8e461f9750
|
refs/heads/master
| 2020-03-15T09:22:56.881077
| 2018-05-04T05:52:31
| 2018-05-04T05:52:31
| 132,073,213
| 0
| 0
| null | null | null | null |
GB18030
|
Java
| false
| false
| 976
|
java
|
package com.database.Utils;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import net.sf.json.JsonConfig;
import net.sf.json.processors.JsonValueProcessor;
/**
* 当使用JSONObject jsonObject = JSONObject.fromObject(bean)转换为json时,
* jsp页面接收到的born日期类型为[object object],无法获取具体日期!
* 添加自定义的日期格式转化类
* @author hr
*/
public class JsonDateValueProcessor implements JsonValueProcessor {
private String format = "yyyy-MM-dd";
public Object processArrayValue(Object value, JsonConfig config) {
return process(value);
}
public Object processObjectValue(String key, Object value, JsonConfig config) {
return process(value);
}
private Object process(Object value) {
if (value instanceof Date) {
SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.UK);
return sdf.format(value);
}
return value == null ? "" : value.toString();
}
}
|
[
"526920861@qq.com"
] |
526920861@qq.com
|
e0a167cdb03c1e11805dd6dc44415aba7e4d4cee
|
24834c6af093e9ee4631ea2bdf36c9e1361fd4d9
|
/src/main/java/ch/hsr/whitespace/javapilot/akka/messages/TrackPartEnteredMessage.java
|
d96c97d9b216464b499cb6132d8afa23d3217a6c
|
[
"Apache-2.0"
] |
permissive
|
HSR-ChallP1-Whitespace/autopilot
|
fdfc7702b50955b62338755a55601dbff07596d4
|
25d70508aeec05b4f3b99f856ec6f063e5fa04a5
|
refs/heads/master
| 2020-04-24T14:56:25.974400
| 2016-01-10T22:58:52
| 2016-01-10T23:11:12
| 42,879,962
| 2
| 1
| null | 2015-12-04T18:18:33
| 2015-09-21T16:49:50
|
JavaScript
|
UTF-8
|
Java
| false
| false
| 1,089
|
java
|
package ch.hsr.whitespace.javapilot.akka.messages;
import ch.hsr.whitespace.javapilot.model.track.Direction;
public class TrackPartEnteredMessage {
private long timestamp;
private Direction trackPartDirection;
private boolean isPositionCorrectionMessage = false;
public TrackPartEnteredMessage(long timestamp, Direction trackPartDirection) {
super();
this.timestamp = timestamp;
this.trackPartDirection = trackPartDirection;
}
public TrackPartEnteredMessage(long timestamp, Direction trackPartDirection, boolean isPositionCorrectionMessage) {
this(timestamp, trackPartDirection);
this.isPositionCorrectionMessage = isPositionCorrectionMessage;
}
public long getTimestamp() {
return timestamp;
}
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
public Direction getTrackPartDirection() {
return trackPartDirection;
}
public void setTrackPartDirection(Direction trackPartDirection) {
this.trackPartDirection = trackPartDirection;
}
public boolean isPositionCorrectionMessage() {
return isPositionCorrectionMessage;
}
}
|
[
"stefan@kapferer.ch"
] |
stefan@kapferer.ch
|
6c179af3a98e689700abef05e5acce333a8181fc
|
e4966d587e8c2ad7968c8972bddc1c115e0c0943
|
/Geoz2/app/src/main/java/io/strstr/geoz/Question.java
|
a7f86d361d1a57410e889c3676c4fe7bd8d32c0d
|
[] |
no_license
|
goingeast/AndroidLearning
|
1a3543d3acd1db609023174495c645097ef468c1
|
aa9755895142b588be4100b5d9c977170df10f0c
|
refs/heads/master
| 2021-01-09T06:41:55.917862
| 2017-02-17T07:04:11
| 2017-02-17T07:04:11
| 81,053,771
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 596
|
java
|
package io.strstr.geoz;
/**
* Created by hzhao1 on 2/10/17.
*/
public class Question {
private int mTextResId;
private boolean mAnswerTrue;
public Question(int textResId, boolean answerTrue) {
mTextResId = textResId;
mAnswerTrue = answerTrue;
}
public int getTextResId() {
return mTextResId;
}
public void setTextResId(int textResId) {
mTextResId = textResId;
}
public boolean isAnswerTrue() {
return mAnswerTrue;
}
public void setAnswerTrue(boolean answerTrue) {
mAnswerTrue = answerTrue;
}
}
|
[
"haoru.zhao@gmail.com"
] |
haoru.zhao@gmail.com
|
9cb2e5ad518b81edb48e2e4b350a04208ad3b47f
|
f4361553a55c3ef5b5dd26642b9aa135284626cf
|
/src/main/java/EventHub/WifiScan.java
|
6b85c70a7360e3c341fba8baafa72f7c10525c9f
|
[] |
no_license
|
scando1993/ConsumerLokaCore
|
53662f2a9c17cafbf943ea5867e910f9e3a20fd3
|
9646b22dd9076388536ff279c93ead0c93087e20
|
refs/heads/master
| 2020-04-24T00:32:30.418777
| 2019-02-24T16:49:05
| 2019-02-24T16:49:05
| 171,569,567
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,127
|
java
|
package EventHub;
public class WifiScan {
private String MAC;
private int rssi;
public WifiScan(String hex, int _rssi)
{
this.MAC = TransformMACNumbertoMACAdress(TransformHexStringToLong(hex)).toLowerCase();
this.rssi = _rssi;
}
private long TransformHexStringToLong(String hexStr)
{
long hex = 0;
hex = Integer.parseInt(hexStr, 16);
return hex;
}
private String TransformMACNumbertoMACAdress(long macNumber)
{
// byte[] macBytes = BitConverter.GetBytes(macNumber);
// macBytes = macBytes.Reverse().Skip(2).ToArray();
// return BitConverter.ToString(macBytes).Replace("-", ":");
return null;
}
public String ByteArrayToString(byte[] bytes)
{
// return BitConverter.ToString(bytes.Reverse().ToArray()).Replace("-","");
return null;
}
public String getMAC() {
return MAC;
}
public void setMAC(String MAC) {
this.MAC = MAC;
}
public int getRssi() {
return rssi;
}
public void setRssi(int rssi) {
this.rssi = rssi;
}
}
|
[
"scando@fiec.espol.edu.ec"
] |
scando@fiec.espol.edu.ec
|
9325b96a148316b3c90350f51aaf2c50b4e2d5bb
|
2391431915d24ab8452640911997fcc6a406b3fe
|
/src/main/java/com/ecity/java/web/ls/Content/BookingOrder/alitripOrderInfoClassXXX.java
|
fffaff4882463587317ceed400decde59c10b8c3
|
[] |
no_license
|
lixuan388/LSWebApp
|
12cd4b1c63d1b3470bbf318bc44caff69f42f243
|
cdd8772c3ef3e93543bb90adc5506335f7ad3c74
|
refs/heads/master
| 2022-11-24T07:18:38.809639
| 2019-09-10T14:23:26
| 2019-10-08T15:42:20
| 139,610,736
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 11,774
|
java
|
package com.ecity.java.web.ls.Content.BookingOrder;
import java.sql.SQLException;
import java.text.DecimalFormat;
import java.util.Date;
import org.bson.Document;
import com.ecity.java.json.JSONArray;
import com.ecity.java.json.JSONObject;
import com.ecity.java.mvc.dao.uilts.SQLUilts;
import com.ecity.java.mvc.model.visa.ota.BookingOrderNameListPO;
import com.ecity.java.mvc.service.taobao.ota.TaoBaoOTAService;
import com.ecity.java.sql.table.MySQLTable;
import com.java.sql.MongoCon;
import com.java.sql.MongoConnect;
import com.java.sql.SQLCon;
import com.mongodb.client.FindIterable;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoCursor;
import com.mongodb.client.MongoDatabase;
import com.mongodb.client.model.Filters;
public class alitripOrderInfoClassXXX {
public String ID;
public alitripOrderInfoClassXXX(String ID) {
this.ID = ID;
}
public JSONObject OpenTable() {
JSONObject ReturnJson = new JSONObject();
// java.text.SimpleDateFormat format = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
DecimalFormat df = new DecimalFormat("0.00");
try {
MongoDatabase database = MongoCon.GetConnect();
MongoCollection<Document> collection = database.getCollection("alitripTravelTrade");
FindIterable<Document> findIterable = collection
.find(Filters.eq("alitrip_travel_trade_query_response.first_result.order_id_string", ID));
MongoCursor<Document> mongoCursor = findIterable.iterator();
if (mongoCursor.hasNext()) {
// System.out.println("mongoCursor.hasNext()");
Document document = mongoCursor.next();
// System.out.println(document.toJson());
JSONObject alitrip_travel_trade_query_response = new JSONObject(document.toJson());
// System.out.println("MsgID:"+alitrip_travel_trade_query_response.getString("MsgID"));
if (alitrip_travel_trade_query_response.getString("MsgID").equals("1")) {
ReturnJson.put("MsgID", "-11");
ReturnJson.put("MsgText", "已生成订单!");
return ReturnJson;
}
JSONObject first_result = alitrip_travel_trade_query_response
.getJSONObject("alitrip_travel_trade_query_response").getJSONObject("first_result");
String out_sku_id = first_result.getJSONObject("sub_orders").getJSONArray("sub_order_info").getJSONObject(0)
.getJSONObject("buy_item_info").getString("out_sku_id");
if (out_sku_id.equals("")) {
// System.out.println("out_sku_id=''");
ReturnJson.put("MsgID", "-1");
ReturnJson.put("MsgText", "未对照产品ID!");
return ReturnJson;
}
// DataJson.put("ebo_id", OrderTable.getString("ebo_id"));
JSONObject DataJson = new JSONObject();
String ebo_id = "-1";
try {
ebo_id = SQLUilts.GetMaxID(SQLCon.GetConnect(), "5");
} catch (SQLException e) {
e.printStackTrace();
}
DataJson.put("ebo_id", ebo_id);
DataJson.put("ebo_SourceName", "飞猪");
DataJson.put("ebo_SourceOrderNo", ID);
DataJson.put("ebo_StatusType", "未认领");
DataJson.put("ebo_SaleName", "");
// System.out.println("购买人信息");
// 购买人信息
JSONObject buyer_info = first_result.getJSONObject("buyer_info");
DataJson.put("ebo_SourceGuest", buyer_info.getString("buyer_nick"));
DataJson.put("ebo_Remark", buyer_info.getString("buyer_message"));
JSONObject sub_orders = first_result.getJSONObject("sub_orders");
JSONArray sub_order_info = sub_orders.getJSONArray("sub_order_info");
JSONObject contactor = sub_order_info.getJSONObject(0).getJSONObject("contactor");
DataJson.put("ebo_LinkMan", contactor.getString("name"));
DataJson.put("ebo_Phone", contactor.getString("phone"));
DataJson.put("ebo_EMail", "");
DataJson.put("ebo_WeiXin", "");
DataJson.put("ebo_QQ", "");
String post_address = contactor.getString("post_address");
post_address = post_address.replaceAll("\\(|\\)", "");
DataJson.put("ebo_Addr", post_address);
// 付款信息
// System.out.println("付款信息");
JSONObject pay_info = first_result.getJSONObject("pay_info");
DataJson.put("ebo_AccountDate", pay_info.getString("pay_time"));
DataJson.put("ebo_PayDate", pay_info.getString("pay_time"));
DataJson.put("ebo_PayMoney", df.format(sub_order_info.getJSONObject(0).getInt("payment") / 100));
DataJson.put("ebo_AccountMoney", df.format(pay_info.getInt("received_payment") / 100));
DataJson.put("ebo_PackageVisa", "");
String PackageID = sub_order_info.getJSONObject(0).getString("sub_order_id_string");
// System.out.println("sub_order_id_string:"+PackageID);
JSONObject PackageJson = GetPackage(ebo_id, sub_order_info);
if (!PackageJson.getString("MsgID").equals("1")) {
ReturnJson.put("MsgID", "-1");
ReturnJson.put("MsgText", PackageJson.getString("MsgText"));
return ReturnJson;
}
DataJson.put("ebo_PackageName", PackageJson.getString("ebo_PackageName"));
ReturnJson.put("OrderInfo", DataJson);
ReturnJson.put("PackageInfo", PackageJson.getJSONArray("PackageInfo"));
ReturnJson.put("NameList", PackageJson.getJSONArray("NameList"));
ReturnJson.put("MsgID", "1");
ReturnJson.put("MsgText", "Success");
// System.out.println(ReturnJson.toString());
return ReturnJson;
} else {
ReturnJson.put("MsgID", "-1");
ReturnJson.put("MsgText", "无对应订单记录!");
return ReturnJson;
}
} finally {
return ReturnJson;
}
}
public JSONObject GetPackage(String eboID, JSONArray sub_order_info) {
JSONObject ReturnArrayJson = new JSONObject();
JSONArray PackageArrayJson = new JSONArray();
JSONArray NameArrayJson = new JSONArray();
// System.out.println("GetPackage");
JSONObject buy_item_info = sub_order_info.getJSONObject(0).getJSONObject("buy_item_info");
// System.out.println("buy_item_info");
JSONArray traveller_info = null;
if (sub_order_info.getJSONObject(0).getJSONObject("travellers").has("traveller_info")) {
traveller_info = sub_order_info.getJSONObject(0).getJSONObject("travellers").getJSONArray("traveller_info");
}
// JSONArray
// traveller_info=sub_order_info.getJSONObject(0).getJSONObject("travellers").getJSONArray("traveller_info");
// System.out.println("traveller_info");
JSONObject contactor = sub_order_info.getJSONObject(0).getJSONObject("contactor");
// System.out.println("contactor");
String out_sku_id = buy_item_info.getString("out_sku_id");
int Num = buy_item_info.getInt("num");
int discount_fee = sub_order_info.getJSONObject(0).getInt("discount_fee") / 100 / Num;
// System.out.println("out_sku_id:"+out_sku_id);
DecimalFormat df = new DecimalFormat("0.00");
String Sql = "select * from Epi_Product_Info where epi_status<>'D' and epi_code='" + out_sku_id + "'";
MySQLTable PackageTable = new MySQLTable(Sql);
try {
PackageTable.Open();
if (PackageTable.next()) {
for (int i = 0; i < Num; i++) {
JSONObject NameJson = new JSONObject();
String Ebon_id = "-1";
try {
Ebon_id = SQLUilts.GetMaxID(SQLCon.GetConnect(), "5");
} catch (SQLException e) {
e.printStackTrace();
}
BookingOrderNameListPO NameList = new BookingOrderNameListPO();
NameList.set_id(Integer.parseInt(Ebon_id));
NameList.set_status("I");
NameList.set_id_Ebo(Integer.parseInt(eboID));
NameList.set_StatusType("未处理");
NameList.set_Name(contactor.getString("name"));
NameList.set_id_avg(-1);
NameList.set_id_ava(-1);
NameList.set_User_Ins("接口");
NameList.set_Date_Ins(new Date());
if ((traveller_info != null) && (traveller_info.length() >= Num)) {
NameList.set_PassPort(traveller_info.getJSONObject(i).getString("credential_no"));
NameList.set_passPortNo(traveller_info.getJSONObject(i).getString("credential_no"));
NameList.set_mobile(traveller_info.getJSONObject(i).getString("phone"));
JSONObject extend_attributes_json = new JSONObject(
traveller_info.getJSONObject(i).getString("extend_attributes_json"));
String applyId = extend_attributes_json.getString("applyId");
String surnamePinyin = extend_attributes_json.getString("surnamePinyin");
String givenNamePinyin = extend_attributes_json.getString("givenNamePinyin");
String currentApplyStatus = extend_attributes_json.getString("currentApplyStatus");
NameList.set_ApplyId(applyId);
if (!currentApplyStatus.equals("")) {
NameList.set_StatusType(new TaoBaoOTAService().GetVisaStateName(Integer.parseInt(currentApplyStatus)));
}
if (!surnamePinyin.equals("")) {
NameList.set_Name(surnamePinyin + " " + givenNamePinyin);
NameList.set_firstname_c(givenNamePinyin);
NameList.set_firstname_e(givenNamePinyin);
NameList.set_lastname_c(surnamePinyin);
NameList.set_lastname_e(surnamePinyin);
}
}
NameJson = NameList.toJson("Ebon");
NameArrayJson.put(NameJson);
JSONObject DataJson = new JSONObject();
String ebop_id = "-1";
try {
ebop_id = SQLUilts.GetMaxID(SQLCon.GetConnect(), "5");
} catch (SQLException e) {
e.printStackTrace();
}
DataJson.put("ebop_id", ebop_id);
DataJson.put("ebop_status", "I");
DataJson.put("ebop_id_ebo", eboID);
DataJson.put("ebop_id_epi", PackageTable.getString("epi_id"));
DataJson.put("ebop_StatusType", "未完成");
DataJson.put("ebop_ProductCode", PackageTable.getString("Epi_code"));
DataJson.put("ebop_id_ept", PackageTable.getString("epi_type"));
DataJson.put("ebop_id_act", PackageTable.getString("Epi_id_act"));
DataJson.put("ebop_ProductName", PackageTable.getString("Epi_Name"));
DataJson.put("ebop_day", PackageTable.getString("epi_day"));
DataJson.put("ebop_Money", df.format(buy_item_info.getInt("price") / 100));
DataJson.put("ebop_AddMoney", 0 - discount_fee);
DataJson.put("ebop_SaleMoney", df.format(buy_item_info.getInt("price") / 100 - discount_fee));
DataJson.put("ebop_id_esi", PackageTable.getString("epi_id_esi"));
DataJson.put("ebop_DateStart", "");
DataJson.put("ebop_DateBack", "");
DataJson.put("ebop_id_ebon", Ebon_id);
PackageArrayJson.put(DataJson);
ReturnArrayJson.put("ebo_PackageName", PackageTable.getString("Epi_Name"));
}
ReturnArrayJson.put("MsgID", "1");
ReturnArrayJson.put("MsgText", "Success");
} else {
ReturnArrayJson.put("MsgID", "-1");
ReturnArrayJson.put("MsgText", "无内部产品信息!");
}
} finally {
PackageTable.Close();
ReturnArrayJson.put("PackageInfo", PackageArrayJson);
ReturnArrayJson.put("NameList", NameArrayJson);
return ReturnArrayJson;
}
}
}
|
[
"Administrator@WIN-20190119TTE"
] |
Administrator@WIN-20190119TTE
|
e7ad201975a8d4f6b9d7a5cb8535f8b4c3cdc5e2
|
f0640262512be3a6c0d81c76ddb7cc5063cab34c
|
/Zadanie_cwiczymy_petle/src/main/java/zadanie_2/RandomNumbers.java
|
5d1dd7a55bfb4f8f22ac3168e040b32947a65e0e
|
[] |
no_license
|
mnpositiveengineer/michal_nowak-kodilla_tester
|
9bfd1b57045339345e31d4999ccab1e44103ab32
|
521fd7b4f000656a248d8b8f22d78479634de363
|
refs/heads/master
| 2020-12-23T04:56:30.392495
| 2020-07-04T19:52:49
| 2020-07-04T19:52:49
| 234,520,225
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,383
|
java
|
package zadanie_2;
//import biblioteki liczb pseudolosowych
import java.util.ArrayList;
import java.util.Random;
public class RandomNumbers {
//stworzenie obiektu na podstawie klasy Random (z biblioteki)
Random random = new Random();
//stworzenie metody losującej liczby losowe. Liczby losowe są automatycznie dodawane do tablicy
public Integer[] createRandomNumbers(int max) {
int total = 0;
int temp;
ArrayList<Integer> randomNumbers = new ArrayList<>();
while (total <= max) {
temp = random.nextInt(31);
total = total + temp;
randomNumbers.add(temp);
}
return randomNumbers.toArray(new Integer[0]);
}
public int getMin(Integer[] totalResult) {
int min = totalResult[0];
for (int i = 1; i < totalResult.length; i++) {
if (totalResult[i] < min) {
min = totalResult[i];
}
}
return min;
}
public int getMax(Integer[] totalResult) {
int max = totalResult[0];
for (int i = 1; i < totalResult.length; i++) {
if (totalResult[i] > max) {
max = totalResult[i];
}
}
return max;
}
}
|
[
"mnpositiveengineer@gmail.com"
] |
mnpositiveengineer@gmail.com
|
3d7231da4042c5f24e8e6af2680fafc7b32639bb
|
29980b09a34bba2f53cfbe2101cfd1c67bca9a89
|
/src/main/java/com/yt/app/api/v1/controller/CustomertransferresourcesController.java
|
f232bf223bc778ffd346da8aba3f22b2545a4224
|
[] |
no_license
|
mzjzhaojun/dfgj
|
0abd60d026467a02d942de46f0bbf257d8af7991
|
74fa9632cfddcd2ed6af43a5f16cb1e2b5d59be9
|
refs/heads/master
| 2021-01-19T23:22:14.397805
| 2017-05-27T07:33:21
| 2017-05-27T07:33:21
| 88,966,753
| 0
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,985
|
java
|
package com.yt.app.api.v1.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;
import com.yt.app.frame.m.IPage;
import io.swagger.annotations.ApiOperation;
import com.yt.app.common.base.impl.BaseControllerImpl;
import com.yt.app.api.v1.resource.CustomertransferresourcesResourceAssembler;
import com.yt.app.api.v1.service.CustomertransferresourcesService;
import com.yt.app.api.v1.entity.Customertransferresources;
/**
* @author zj default test
*
* @version v1
* @createdate 2017-04-27 19:22:19
*/
@RestController
@RequestMapping("/rest/v1/customertransferresources")
public class CustomertransferresourcesController extends BaseControllerImpl<Customertransferresources, Long> {
protected Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private CustomertransferresourcesService service;
@Override
@ApiOperation(value = "列表分页", response = Customertransferresources.class)
@RequestMapping(value = "/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> list(RequestEntity<Object> requestEntity, HttpServletRequest request, HttpServletResponse response) {
IPage<Customertransferresources> pagebean = service.list(requestEntity);
return new ResponseEntity<Object>(new CustomertransferresourcesResourceAssembler().toResources(pagebean.getPageList()),
pagebean.getHeaders(), HttpStatus.OK);
}
}
|
[
"mzjzhaojun@163.com"
] |
mzjzhaojun@163.com
|
76c288c0da5958b393b0ced42e754d578e380a8f
|
c8c4922839f8d22376759201f6cf440c3409f0f5
|
/portfolio-manager/src/main/java/org/ozsoft/portfoliomanager/domain/StockPerformance.java
|
65837123bcbc14076e879158e898733096a2b3b6
|
[] |
no_license
|
weimingtom/testproject3
|
faa20520b2f60a178209bd6746d6e317cdf59162
|
3464e826b452c64dd970b7ace087deb97a32447e
|
refs/heads/master
| 2021-01-10T23:40:00.254448
| 2016-08-12T13:43:15
| 2016-08-12T13:43:15
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,659
|
java
|
// This file is part of the 'portfolio-manager' (Portfolio Manager)
// project, an open source stock portfolio manager application
// written in Java.
//
// Copyright 2015 Oscar Stigter
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package org.ozsoft.portfoliomanager.domain;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
/**
* Stock performance during a specific time range.
*
* @author Oscar Stigter
*/
public class StockPerformance {
private final List<ClosingPrice> prices;
private final int duration;
private double startPrice;
private double endPrice;
private double lowPrice;
private double highPrice;
private double change;
private double changePerc;
private double volatility;
public StockPerformance(List<ClosingPrice> prices, TimeRange dateFilter) {
this.prices = new ArrayList<ClosingPrice>();
this.duration = dateFilter.getDuration();
Date fromDate = dateFilter.getFromDate();
for (ClosingPrice price : prices) {
if (price.getDate().after(fromDate)) {
this.prices.add(price);
}
}
Collections.sort(this.prices);
int count = this.prices.size();
startPrice = this.prices.get(0).getValue();
endPrice = this.prices.get(count - 1).getValue();
lowPrice = Double.MAX_VALUE;
highPrice = Double.MIN_VALUE;
change = endPrice - startPrice;
changePerc = (change / startPrice) * 100.0;
double slope = change / count;
for (int i = 0; i < count; i++) {
double p = this.prices.get(i).getValue();
if (p < lowPrice) {
lowPrice = p;
}
if (p > highPrice) {
highPrice = p;
}
double avg = startPrice + (i * slope);
volatility += Math.abs(p - avg) / p * 100.0;
}
volatility /= count;
}
public List<ClosingPrice> getPrices() {
return Collections.unmodifiableList(prices);
}
public double getStartPrice() {
return startPrice;
}
public double getEndPrice() {
return endPrice;
}
public double getLowPrice() {
return lowPrice;
}
public double getHighPrice() {
return highPrice;
}
public double getChange() {
return change;
}
public double getChangePerc() {
return changePerc;
}
public double getVolatility() {
return volatility;
}
public double getCagr() {
if (duration < 1) {
return changePerc;
} else {
return (Math.pow(endPrice / startPrice, 1.0 / duration) - 1.0) * 100.0;
}
}
public double getDiscount() {
double discount = ((highPrice - endPrice) / (highPrice - lowPrice)) * 100.0;
if (discount < 0.0) {
return 0.0;
} else {
return discount;
}
}
}
|
[
"oscar.stigter@gmail.com"
] |
oscar.stigter@gmail.com
|
0bcb5b8f1050575918d74c80e748392a7494ad08
|
bcf1704bc6fde659d05fda0de2f93b7aa7289ef2
|
/jcocktail-data/src/main/java/de/atomspace/webapp/component/unit/service/UnitServiceImpl.java
|
cdcd695f6ed2295d88e870a1d13c0ba4d74144bb
|
[] |
no_license
|
eddi888/jcocktail
|
9cbb7367b7d36fabcabb76f68103886ae4b2d7b6
|
82bd76e20c44bb57286bbe874af859941fdf86aa
|
refs/heads/master
| 2021-01-09T05:59:18.384563
| 2012-04-24T04:37:56
| 2012-04-24T04:37:56
| 34,845,521
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,118
|
java
|
package de.atomspace.webapp.component.unit.service;
import org.bson.types.ObjectId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import de.atomspace.webapp.component.unit.Unit;
@Service
@Transactional
public class UnitServiceImpl implements UnitService {
@Autowired
UnitRepository repository;
@Override
public Unit findOneByName(String name){
return repository.findOneByName(name);
}
@Override
public Unit findOne(ObjectId id){
return repository.findOne(id);
}
@Override
public Page<Unit> findAll(Pageable pageable){
return repository.findByDetached(pageable, false);
}
@Override
public Unit save(Unit entity){
return repository.save(entity);
}
@Override
public Unit delete(Unit entity){
entity.setDetached(true);
return repository.save(entity);
}
}
|
[
"edgar.wentzlaff@gmail.com@5f684650-4105-11d2-728d-d28a35b64ad0"
] |
edgar.wentzlaff@gmail.com@5f684650-4105-11d2-728d-d28a35b64ad0
|
c1cdb8961f167cd70492c5adb8f62f139dbadbe9
|
8a319066ab0bfcc0c02cf719a13a5bf4dd75bfc9
|
/spring-struts-app/src/main/java/com/techlabs/repository/StudentRepository.java
|
8769c50bc4fca58e3173021cd4b4f9e6edbab446
|
[] |
no_license
|
GayatriHushe/Swabhav-Gradle
|
581295a54516b80dc78b4178f1441fa2a5696b84
|
aa23587beaa7515b84b0d3281aff627e8f53fd4f
|
refs/heads/master
| 2023-06-30T10:54:47.997305
| 2021-08-07T14:01:15
| 2021-08-07T14:01:15
| 393,698,694
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 536
|
java
|
package com.techlabs.repository;
import java.util.ArrayList;
import java.util.List;
import org.springframework.stereotype.Repository;
import com.techlabs.model.Student;
@Repository
public class StudentRepository {
private List<Student> students=new ArrayList<Student>();
public StudentRepository() {
System.out.println("Repository created");
students.add(new Student(1,"abc"));
students.add(new Student(2,"def"));
students.add(new Student(3,"ghi"));
}
public List<Student> getStudents() {
return students;
}
}
|
[
"gayatrihushe@gmail.com"
] |
gayatrihushe@gmail.com
|
0873bf3bd370ab906c1736c6a3e87f917a8ffc70
|
db7eca6cd7a41063f2fcdf90bcd20ba91a6b5efc
|
/aw/autumn_window/src/main/java/cn/com/cslc/aw/core/common/datatables/DataTablesRequestParamsArgumentResolver.java
|
9cc8dc9e3fed3a67d7bd21fbc5832477cef80efb
|
[] |
no_license
|
lisansx2/aw
|
eda7d33c086fb4d6e1688cb99fc3e754837088d7
|
d76f0f5426b1c07137d3442f01247fb4226e4cdc
|
refs/heads/master
| 2020-04-07T19:03:07.829696
| 2018-11-16T10:15:20
| 2018-11-16T10:15:20
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,730
|
java
|
package cn.com.cslc.aw.core.common.datatables;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import org.springframework.core.MethodParameter;
import org.springframework.web.bind.support.WebDataBinderFactory;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.method.support.ModelAndViewContainer;
public class DataTablesRequestParamsArgumentResolver implements HandlerMethodArgumentResolver {
@Override
public boolean supportsParameter(final MethodParameter parameter) {
return parameter.getParameterAnnotation(DataTablesRequestParams.class) != null;
}
@Override
public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception {
HttpServletRequest httpRequest = (HttpServletRequest) webRequest.getNativeRequest();
DataTablesRequest tablesRequest = new DataTablesRequest();
tablesRequest.setDraw(Integer.valueOf(httpRequest.getParameter("draw")));
tablesRequest.setStart(Integer.valueOf(httpRequest.getParameter("start")));
tablesRequest.setLength(Integer.valueOf(httpRequest.getParameter("length")));
Set<Entry<String, String[]>> paramsEntrySet = httpRequest.getParameterMap().entrySet();
Iterator<Entry<String, String[]>> paramsEntrySetIter = paramsEntrySet.iterator();
while(paramsEntrySetIter.hasNext()){
Entry<String, String[]> paramEntry = paramsEntrySetIter.next();
String paramKey = paramEntry.getKey();
if(paramKey.indexOf("order[") != -1 ){
Integer orderIndex = Integer.parseInt(paramKey.substring(paramKey.indexOf("[")+1, paramKey.indexOf("]")));
if(tablesRequest.getOrderMap().get(orderIndex) == null){
Map<String,String> orderMap = new HashMap<String,String>();
tablesRequest.getOrderMap().put(orderIndex, orderMap);
}
if(paramKey.indexOf("[column]") != -1 ){
String orderColumIndex = httpRequest.getParameter(paramKey);
String orderColumn = httpRequest.getParameter("columns[" + orderColumIndex + "][data]");
tablesRequest.getOrderMap().get(orderIndex).put("orderColumn", orderColumn);
};
if(paramKey.indexOf("[dir]") != -1 ){
String orderDir = httpRequest.getParameter(paramKey);
tablesRequest.getOrderMap().get(orderIndex).put("orderDirection", orderDir);
};
}
}
return tablesRequest;
}
}
|
[
"1028229722@qq.com"
] |
1028229722@qq.com
|
766116a3efa74dd6aace3c68e43a2ae0340afb85
|
8e35360c270000815f878d9ef2e682f6af479e9f
|
/geeklesson-work/shopizer/sm-core-model/src/main/java/com/salesmanager/core/model/customer/connection/UserConnectionPK.java
|
76f0576ef2cadaf0b24cd803499e4b09ff338c6b
|
[
"Apache-2.0"
] |
permissive
|
LLNF/geeklesson-work
|
3b67eda3c5d1918835c5a5074b30aff9ef06237a
|
4a90086d4d7fc008cc82d792869144435b6af083
|
refs/heads/master
| 2023-06-20T16:01:06.577288
| 2021-07-12T06:39:32
| 2021-07-12T06:39:32
| 383,650,764
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,385
|
java
|
package com.salesmanager.core.model.customer.connection;
import java.io.Serializable;
import javax.persistence.Embeddable;
/**
* Identity key for storing spring social objects
* @author carlsamson
*
*/
@Deprecated
@Embeddable
public class UserConnectionPK implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private String userId;
private String providerId;
private String providerUserId;
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getProviderId() {
return providerId;
}
public void setProviderId(String providerId) {
this.providerId = providerId;
}
public String getProviderUserId() {
return providerUserId;
}
public void setProviderUserId(String providerUserId) {
this.providerUserId = providerUserId;
}
public boolean equals(Object o) {
if (o instanceof UserConnectionPK) {
UserConnectionPK other = (UserConnectionPK) o;
return other.getProviderId().equals(getProviderId())
&& other.getProviderUserId().equals(getProviderUserId())
&& other.getUserId().equals(getUserId());
} else {
return false;
}
}
public int hashCode() {
return getUserId().hashCode() + getProviderId().hashCode()
+ getProviderUserId().hashCode();
}
}
|
[
"759037069@qq.com"
] |
759037069@qq.com
|
396ec90588d5dde84c1091b5af24d245b9022c35
|
b308232b5f9a1acd400fe15b45780e348048fccd
|
/Entity/src/main/java/com/param/entity/model/pharmacy/BatchAllocation.java
|
65d1dc07090b971bfb3d7e74cc8d64a5f95330e6
|
[] |
no_license
|
PravatKumarPradhan/his
|
2aae12f730b7d652b9590ef976b12443fc2c2afb
|
afb2b3df65c0bc1b1864afc1f958ca36a2562e3f
|
refs/heads/master
| 2022-12-22T20:43:44.895342
| 2018-07-31T17:04:26
| 2018-07-31T17:04:26
| 143,041,254
| 1
| 0
| null | 2022-12-16T03:59:53
| 2018-07-31T16:43:36
|
HTML
|
UTF-8
|
Java
| false
| false
| 2,003
|
java
|
package com.param.entity.model.pharmacy;
import java.io.Serializable;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import com.param.entity.model.base.BaseEntity;
import com.param.entity.model.inventory.Batch;
import com.param.entity.model.master.Store;
@Entity(name="BatchAllocation")
@Table(name="t_batch_allocation", schema="pharmacy")
public class BatchAllocation extends BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Integer id;
@ManyToOne(cascade = CascadeType.ALL)
@JoinColumn(name="batch_id")
private Batch batch;
private Integer quantity;
@ManyToOne(cascade = CascadeType.ALL)
@JoinColumn(name="store_id")
private Store store;
@Column(name="temp_bill_id")
private Long tempBillId;
public BatchAllocation() {
}
public BatchAllocation(Long tempBillId, Store store, Batch batch, Integer quantity) {
super();
this.batch = batch;
this.quantity = quantity;
this.store = store;
this.tempBillId = tempBillId;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Batch getBatch() {
return batch;
}
public void setBatch(Batch batch) {
this.batch = batch;
}
public Integer getQuantity() {
return quantity;
}
public void setQuantity(Integer quantity) {
this.quantity = quantity;
}
public Store getStore() {
return store;
}
public void setStore(Store store) {
this.store = store;
}
public Long getTempBillId() {
return tempBillId;
}
public void setTempBillId(Long tempBillId) {
this.tempBillId = tempBillId;
}
}
|
[
"pkp751989@gmail.com"
] |
pkp751989@gmail.com
|
837c00f7ed680334414e6fcb65c141366230cf32
|
6eb78c6c4b59e5224a460bc8e30946c42a48d4e5
|
/src/main/java/com/tibco/psg/beunit/Assert.java
|
fb61a4c3644f326e6155eda0e3b2769113a18806
|
[] |
no_license
|
yxuco/beassert
|
aaa0e9bb2b1c563e86e763994320db7d6768ce03
|
fe930bed932243c58dbfc61dfea022a9162932e8
|
refs/heads/master
| 2016-08-05T09:34:55.242011
| 2015-07-29T03:37:00
| 2015-07-29T03:37:00
| 38,145,296
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 7,627
|
java
|
package com.tibco.psg.beunit;
import static com.tibco.be.model.functions.FunctionDomain.ACTION;
@com.tibco.be.model.functions.BEPackage(
catalog = "BEUnit",
category = "Assert",
synopsis = "BEUnit functions for JUnit assertion.")
public class Assert {
@com.tibco.be.model.functions.BEFunction(
name = "fail",
description = "Throws AssersionError with a specified message.",
signature = "void fail(String reason)",
params = {
@com.tibco.be.model.functions.FunctionParamDescriptor(name = "reason", type = "String", desc = "reason of the test failure")
},
freturn = @com.tibco.be.model.functions.FunctionParamDescriptor(name = "", type = "void", desc = ""),
version = "1.0", see = "", mapper = @com.tibco.be.model.functions.BEMapper(),
cautions = "none", fndomain = { ACTION }, example = "")
public static void fail(String reason) {
if (reason == null) {
throw new AssertionError();
}
throw new AssertionError(reason);
}
@com.tibco.be.model.functions.BEFunction(
name = "assertTrue",
description = "Throws AssersionError if condition is not true.",
signature = "void assertTrue(String reason, boolean condition)",
params = {
@com.tibco.be.model.functions.FunctionParamDescriptor(name = "reason", type = "String", desc = "reason of the test failure"),
@com.tibco.be.model.functions.FunctionParamDescriptor(name = "condition", type = "boolean", desc = "condition to be checked")
},
freturn = @com.tibco.be.model.functions.FunctionParamDescriptor(name = "", type = "void", desc = ""),
version = "1.0", see = "", mapper = @com.tibco.be.model.functions.BEMapper(),
cautions = "none", fndomain = { ACTION }, example = "")
public static void assertTrue(String reason, boolean condition) {
if (!condition) {
fail(reason);
}
}
@com.tibco.be.model.functions.BEFunction(
name = "assertFalse",
description = "Throws AssersionError if condition is not false.",
signature = "void assertFalse(String reason, boolean condition)",
params = {
@com.tibco.be.model.functions.FunctionParamDescriptor(name = "reason", type = "String", desc = "reason of the test failure"),
@com.tibco.be.model.functions.FunctionParamDescriptor(name = "condition", type = "boolean", desc = "condition to be checked")
},
freturn = @com.tibco.be.model.functions.FunctionParamDescriptor(name = "", type = "void", desc = ""),
version = "1.0", see = "", mapper = @com.tibco.be.model.functions.BEMapper(),
cautions = "none", fndomain = { ACTION }, example = "")
public static void assertFalse(String reason, boolean condition) {
assertTrue(reason, !condition);
}
@com.tibco.be.model.functions.BEFunction(
name = "assertEquals",
description = "Throws AssersionError if 2 objects are not equal.",
signature = "void assertEquals(String reason, Object expected, Object actual)",
params = {
@com.tibco.be.model.functions.FunctionParamDescriptor(name = "reason", type = "String", desc = "reason of the test failure"),
@com.tibco.be.model.functions.FunctionParamDescriptor(name = "expected", type = "Object", desc = "expected value"),
@com.tibco.be.model.functions.FunctionParamDescriptor(name = "actual", type = "Object", desc = "actual value")
},
freturn = @com.tibco.be.model.functions.FunctionParamDescriptor(name = "", type = "void", desc = ""),
version = "1.0", see = "", mapper = @com.tibco.be.model.functions.BEMapper(),
cautions = "none", fndomain = { ACTION }, example = "")
public static void assertEquals(String reason, Object expected, Object actual) {
if (null == expected) {
assertTrue(reason, null == actual);
} else {
assertTrue(reason, expected.equals(actual));
}
}
@com.tibco.be.model.functions.BEFunction(
name = "assertNotEquals",
description = "Throws AssersionError if 2 objects are equal.",
signature = "void assertNotEquals(String reason, Object unexpected, Object actual)",
params = {
@com.tibco.be.model.functions.FunctionParamDescriptor(name = "reason", type = "String", desc = "reason of the test failure"),
@com.tibco.be.model.functions.FunctionParamDescriptor(name = "unexpected", type = "Object", desc = "expected value"),
@com.tibco.be.model.functions.FunctionParamDescriptor(name = "actual", type = "Object", desc = "actual value")
},
freturn = @com.tibco.be.model.functions.FunctionParamDescriptor(name = "", type = "void", desc = ""),
version = "1.0", see = "", mapper = @com.tibco.be.model.functions.BEMapper(),
cautions = "none", fndomain = { ACTION }, example = "")
public static void assertNotEquals(String reason, Object unexpected, Object actual) {
if (null == unexpected) {
assertTrue(reason, null != actual);
} else {
assertTrue(reason, !unexpected.equals(actual));
}
}
@com.tibco.be.model.functions.BEFunction(
name = "assertWithinRange",
description = "Throws AssersionError if difference between 2 doubles is greater than a delta.",
signature = "void assertNotEquals(String reason, double expected, double actual, double delta)",
params = {
@com.tibco.be.model.functions.FunctionParamDescriptor(name = "reason", type = "String", desc = "reason of the test failure"),
@com.tibco.be.model.functions.FunctionParamDescriptor(name = "expected", type = "double", desc = "expected value"),
@com.tibco.be.model.functions.FunctionParamDescriptor(name = "actual", type = "double", desc = "actual value"),
@com.tibco.be.model.functions.FunctionParamDescriptor(name = "delta", type = "double", desc = "maximum difference between the 2 numbers"),
},
freturn = @com.tibco.be.model.functions.FunctionParamDescriptor(name = "", type = "void", desc = ""),
version = "1.0", see = "", mapper = @com.tibco.be.model.functions.BEMapper(),
cautions = "none", fndomain = { ACTION }, example = "")
public static void assertWithinRange(String reason, double expected, double actual, double delta) {
assertTrue(reason, Math.abs(expected - actual) <= delta);
}
@com.tibco.be.model.functions.BEFunction(
name = "assertNull",
description = "Throws AssersionError if an object is not null.",
signature = "void assertNull(String reason, Object actual)",
params = {
@com.tibco.be.model.functions.FunctionParamDescriptor(name = "reason", type = "String", desc = "reason of the test failure"),
@com.tibco.be.model.functions.FunctionParamDescriptor(name = "actual", type = "Object", desc = "actual value to check")
}, freturn = @com.tibco.be.model.functions.FunctionParamDescriptor(name = "", type = "void", desc = ""),
version = "1.0", see = "", mapper = @com.tibco.be.model.functions.BEMapper(),
cautions = "none", fndomain = { ACTION }, example = "")
public static void assertNull(String reason, Object actual) {
assertTrue(reason, null == actual);
}
@com.tibco.be.model.functions.BEFunction(
name = "assertNotNull",
description = "Throws AssersionError if an object is null.",
signature = "void assertNotNull(String reason, Object actual)",
params = {
@com.tibco.be.model.functions.FunctionParamDescriptor(name = "reason", type = "String", desc = "reason of the test failure"),
@com.tibco.be.model.functions.FunctionParamDescriptor(name = "actual", type = "Object", desc = "actual value to check")
},
freturn = @com.tibco.be.model.functions.FunctionParamDescriptor(name = "", type = "void", desc = ""),
version = "1.0", see = "", mapper = @com.tibco.be.model.functions.BEMapper(),
cautions = "none", fndomain = { ACTION }, example = "")
public static void assertNotNull(String reason, Object actual) {
assertTrue(reason, null != actual);
}
}
|
[
"yxucolo@gmail.com"
] |
yxucolo@gmail.com
|
d0ad60d63cfc028dd4f400ebbd942301c09c7703
|
378ea3bd3c155d2ab7f525d5d3bcc7ccbfe4b11a
|
/sb_1909demo/src/main/java/com/hqyj/demo/modules/account/entity/Role.java
|
7111a264ba4e2d5de74cb6b055db06c2a0fb6434
|
[] |
no_license
|
llixiang/hqyj
|
959dd86917c7092a7ac09d9da03f94ce7cdb5b7d
|
8acceec80fe1711f99975fc21ffe9dca704afb5e
|
refs/heads/master
| 2020-08-28T18:49:19.863426
| 2019-11-28T12:14:31
| 2019-11-28T12:14:31
| 217,790,253
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,176
|
java
|
package com.hqyj.demo.modules.account.entity;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
/**
* 角色类
* @author: HymanHu
* @date: 2019年11月28日
*/
@Entity
@Table(name = "m_role")
public class Role {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int roleId;
private String roleName;
@Transient
private List<User> users;
@Transient
private List<Resource> resources;
public int getRoleId() {
return roleId;
}
public void setRoleId(int roleId) {
this.roleId = roleId;
}
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
public List<User> getUsers() {
return users;
}
public void setUsers(List<User> users) {
this.users = users;
}
public List<Resource> getResources() {
return resources;
}
public void setResources(List<Resource> resources) {
this.resources = resources;
}
}
|
[
"Li Xiang@DESKTOP-RK3EH9N"
] |
Li Xiang@DESKTOP-RK3EH9N
|
1edcf0c23cf3c1a7d9cad0ffd52138cafc4e1fe3
|
cf34900f9a3097bb69de01ff271d4dfa6dc9c426
|
/Client_4_2/app/src/main/java/com/example/abc/client_4_2/MainActivity.java
|
339ad54b77d874d75ab50e57a4eec0474df4a60d
|
[] |
no_license
|
novikkk/Mafia
|
66f1899ea5840a4fe5e68f804f39e9f964836d91
|
09848de9a092b50f08336ca1c9fb9d80ca077f33
|
refs/heads/master
| 2020-12-24T18:41:47.945246
| 2016-06-03T13:54:13
| 2016-06-03T13:54:13
| 58,411,935
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 10,911
|
java
|
package com.example.abc.client_4_2;
import android.app.Activity;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import org.json.*;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Enumeration;
final public class MainActivity extends Activity {
static ArrayList<Player> mas_socket = new ArrayList<Player>();
TextView info, infoip, msg;
String message = "";
static ServerSocket serverSocket;
public void asdfg(View a) throws IOException {
/*SocketServerStringThread socketServerString = new SocketServerStringThread(
mas_socket.get(0).socket_player,"Rol:Civilian;");x
socketServerString.run();*/
Reader_all_Thread readerall = new Reader_all_Thread();
readerall.run();
Intent config_windows = new Intent(this,Config_Windows.class);
startActivity(config_windows);
/*
if(mas_socket.get(0).socket_player!=null){
MyWriterServerTask ms = new MyWriterServerTask(mas_socket.get(0),"Rol:Cuvilian;");
ms.execute();
}*/
}
/*public class MyWriterServerTask extends AsyncTask<Void, Void, Void> {
Player player;
DataOutputStream outputStream;
String mesage;
MyWriterServerTask(Player a, String mes){
player = a;
mesage = mes;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
}
@Override
protected Void doInBackground(Void... arg0) {
try {
outputStream = new DataOutputStream(player.socket_player.getOutputStream());
outputStream.writeUTF(message);
//outputStream.write(0);
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
}
return null;
}
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
}
}*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
info = (TextView) findViewById(R.id.info);
infoip = (TextView) findViewById(R.id.infoip);
msg = (TextView) findViewById(R.id.msg);
infoip.setText(getIpAddress());
Thread socketServerThread = new Thread(new SocketServerThread());
socketServerThread.start();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (serverSocket != null) {
/*try {
//serverSocket.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}*/
}
}
private class Reader_socket_one extends AsyncTask<Void, Void, Void> {
Player players;
InputStream inputStream;
String response = "";
public Reader_socket_one(Player a){
players = a;
}
/**
* Override this method to perform a computation on a background thread. The
* specified parameters are the parameters passed to {@link #execute}
* by the caller of this task.
* <p/>
* This method can call {@link #publishProgress} to publish updates
* on the UI thread.
*
* @param params The parameters of the task.
* @return A result, defined by the subclass of this task.
* @see #onPreExecute()
* @see #onPostExecute
* @see #publishProgress
*/
@Override
protected Void doInBackground(Void... params) {
if(players!=null)
try {
inputStream = players.socket_player.getInputStream();
ByteArrayOutputStream byteArrayOutputStream =
new ByteArrayOutputStream(1024);
byte[] buffer = new byte[1024];
int bytesRead;
while ((bytesRead = inputStream.read(buffer)) != -1) {
if (buffer[bytesRead] == ';') {
byteArrayOutputStream.write(buffer, 0, bytesRead);
response += byteArrayOutputStream.toString("UTF-8");
parser(response, players);
byteArrayOutputStream.reset();
}
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
static void parser(String a,Player player){
String mas_str[] = a.split(":");
switch (mas_str[0]){
case "Nik":{
player.setNikname(mas_str[1]);
}
break;
}
}
private class Reader_all_Thread extends Thread{
@Override
public void run() {
for(int i=0;i<mas_socket.size();i++){
Reader_socket_one a = new Reader_socket_one(mas_socket.get(i));
a.execute();
}
}
}
public class SocketServerThread extends Thread {
Socket socket;
static final int SocketServerPORT = 6660;
int count = 0;
String [] inetaddr = new String[10] ;
@Override
public void run() {
try {
serverSocket = new ServerSocket(SocketServerPORT);
MainActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
info.setText("Чекаю на підплючення: "
+ serverSocket.getLocalPort());
}
});
while (true) {
socket = serverSocket.accept();
//Додаю нового клієнта
mas_socket.add(new Player(socket));
//Отримую адресу
String temp = socket.getInetAddress().toString() ;
//Відкидаю порт
String []temp1 = temp.split(":");
//Перевыряю чи вже э подыбне підключення
Boolean f = false;
for(int i=0;i<count;i++){
if(inetaddr[i]!=null){
if(inetaddr[i].equals(temp)){
f=true;
}
}
}
//Якщо нема то запамятовую його
if(!f){
inetaddr[count] = temp1[0];
count++;
message += "#" + count + " Від " + socket.getInetAddress()
+ ":" + socket.getPort() + "\n";
MainActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
msg.setText(message);
}
});
SocketServerReplyThread socketServerReplyThread = new SocketServerReplyThread(
socket, count);
socketServerReplyThread.run();
}
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
private class SocketServerReplyThread extends Thread {
private Socket hostThreadSocket;
int cnt;
SocketServerReplyThread(Socket socket, int c) {
hostThreadSocket = socket;
cnt = c;
}
@Override
public void run() {
OutputStream outputStream;
String msgReply = "Привіт, ви #" + cnt+";";
try {
outputStream = hostThreadSocket.getOutputStream();
PrintStream printStream = new PrintStream(outputStream);
printStream.print(msgReply);
//
//printStream.close();
message += "Гравець №" + cnt + " підключений\n\n";
MainActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
msg.setText(message);
}
});
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
message += "Виникла помилка! " + e.toString() + "\n";
}
MainActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
msg.setText(message);
}
});
}
}
private String getIpAddress() {
String ip = "";
try {
Enumeration<NetworkInterface> enumNetworkInterfaces = NetworkInterface
.getNetworkInterfaces();
while (enumNetworkInterfaces.hasMoreElements()) {
NetworkInterface networkInterface = enumNetworkInterfaces
.nextElement();
Enumeration<InetAddress> enumInetAddress = networkInterface
.getInetAddresses();
while (enumInetAddress.hasMoreElements()) {
InetAddress inetAddress = enumInetAddress.nextElement();
if (inetAddress.isSiteLocalAddress()) {
ip += "SiteLocalAddress: "
+ inetAddress.getHostAddress() + "\n";
}
}
}
} catch (SocketException e) {
// TODO Auto-generated catch block
e.printStackTrace();
ip += "Something Wrong! " + e.toString() + "\n";
}
return ip;
}
}
|
[
"bogdan.novosad.novik@gmail.com"
] |
bogdan.novosad.novik@gmail.com
|
b3f3fed2c36266c4e6522924e2d9d921270953f6
|
f194a68667602c90e8a38dc61ba3200c07606852
|
/app/src/main/java/com/example/javademo/typeinfo/typeinfo/InnerImplementation.java
|
9cd1d658131955a9eb32fdd960bee2ed93d4c2c6
|
[] |
no_license
|
cxydxpx/JavaSpace
|
f30e1495f9a54b6ab743adf1622fa10eeed6420b
|
e4c73fca478d126c5e28f025f561a80d025405ca
|
refs/heads/master
| 2022-06-19T07:07:18.091118
| 2020-05-09T06:06:00
| 2020-05-09T06:06:00
| 262,501,402
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,185
|
java
|
package com.example.javademo.typeinfo.typeinfo;//: typeinfo/InnerImplementation.java
// Private inner classes can't hide from reflection.
import com.example.javademo.typeinfo.typeinfo.interfacea.A;
import com.example.javademo.typeinfo.typeinfo.pets.*;
import static net.mindview.util.Print.print;
class InnerA {
private static class C implements A {
public void f() { print("public C.f()"); }
public void g() { print("public C.g()"); }
void u() { print("package C.u()"); }
protected void v() { print("protected C.v()"); }
private void w() { print("private C.w()"); }
}
public static A makeA() { return new C(); }
}
public class InnerImplementation {
public static void main(String[] args) throws Exception {
A a = InnerA.makeA();
a.f();
System.out.println(a.getClass().getName());
// Reflection still gets into the private class:
HiddenImplementation.callHiddenMethod(a, "g");
HiddenImplementation.callHiddenMethod(a, "u");
HiddenImplementation.callHiddenMethod(a, "v");
HiddenImplementation.callHiddenMethod(a, "w");
}
} /* Output:
public C.f()
InnerA$C
public C.g()
package C.u()
protected C.v()
private C.w()
*///:~
|
[
"cxydxpx@163.com"
] |
cxydxpx@163.com
|
72b0b3820fc6ff419f37dd14af68993f77b009de
|
6ed6ef753bd9e8d090bdd34762522d9e40291a87
|
/server/src/main/java/com/google/floody/filter/UserServicesFactoryInjectionFilter.java
|
ec5b2324b65c306d56510065e6a0cf0eebdcfc79
|
[
"Apache-2.0"
] |
permissive
|
isabella232/floody
|
42d0d26c1aafe0f159af24d4c5002cf4ef532d47
|
ab7adccc1e450ae816ba17b91388f6bc4ea6b5bc
|
refs/heads/main
| 2023-07-09T23:20:04.889666
| 2021-08-25T06:32:01
| 2021-08-25T06:32:01
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,902
|
java
|
/*
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.floody.filter;
import static org.apache.commons.lang3.StringUtils.isBlank;
import com.google.auth.http.AuthHttpConstants;
import com.google.floody.auth.AccessTokenCredentialService;
import com.google.floody.model.FloodyProperties;
import com.google.floody.service.ServicesFactory;
import java.io.IOException;
import java.util.Optional;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;
@Component
public final class UserServicesFactoryInjectionFilter extends OncePerRequestFilter {
@Autowired private FloodyProperties floodyProperties;
/** Adds a services Factory bean if user credentials are present. */
@Override
public void doFilterInternal(
HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
throws IOException, ServletException {
extractBearerToken(request)
.ifPresent(
accessToken ->
request.setAttribute(
"userServicesFactory",
new ServicesFactory(
new AccessTokenCredentialService(accessToken), floodyProperties)));
filterChain.doFilter(request, response);
}
private static Optional<String> extractBearerToken(HttpServletRequest request) {
var bearerAuth = request.getHeader(AuthHttpConstants.AUTHORIZATION);
if (!isBlank(bearerAuth) && bearerAuth.startsWith(AuthHttpConstants.BEARER)) {
return Optional.of(bearerAuth.split(" ")[1]);
}
return Optional.empty();
}
@Bean
public FilterRegistrationBean<UserServicesFactoryInjectionFilter>
userServicesFactoryInjectionFilterBean() {
var registrationBean = new FilterRegistrationBean<UserServicesFactoryInjectionFilter>();
registrationBean.setFilter(this);
registrationBean.addUrlPatterns(
"/admin/*", "/floody/*", "/gtmrequest/*", "/user/*", "/crontasks/*");
return registrationBean;
}
}
|
[
"anant.damle@gmail.com"
] |
anant.damle@gmail.com
|
a8ea8f32fb01ecf0cf6fb87aeb4783a721fae40b
|
fa91450deb625cda070e82d5c31770be5ca1dec6
|
/Diff-Raw-Data/8/8_ef30faa5e0f2935ecbdabefb99dbfabc71bb57c9/ObjectMapNamingStrategy/8_ef30faa5e0f2935ecbdabefb99dbfabc71bb57c9_ObjectMapNamingStrategy_t.java
|
3ed1dfb67ea3a2ff0e0980cf8ebf7b98446d4f53
|
[] |
no_license
|
zhongxingyu/Seer
|
48e7e5197624d7afa94d23f849f8ea2075bcaec0
|
c11a3109fdfca9be337e509ecb2c085b60076213
|
refs/heads/master
| 2023-07-06T12:48:55.516692
| 2023-06-22T07:55:56
| 2023-06-22T07:55:56
| 259,613,157
| 6
| 2
| null | 2023-06-22T07:55:57
| 2020-04-28T11:07:49
| null |
UTF-8
|
Java
| false
| false
| 25,406
|
java
|
/*******************************************************************************
*
* Copyright (C) 2010 Jalian Systems Private Ltd.
* Copyright (C) 2010 Contributors to Marathon OSS Project
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Project website: http://www.marathontesting.com
* Help: Marathon help forum @ http://groups.google.com/group/marathon-testing
*
*******************************************************************************/
package net.sourceforge.marathon.objectmap;
import java.awt.AWTEvent;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dialog;
import java.awt.Frame;
import java.awt.GridLayout;
import java.awt.LayoutManager;
import java.awt.Point;
import java.awt.Toolkit;
import java.awt.Window;
import java.awt.event.AWTEventListener;
import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;
import java.util.logging.Logger;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JViewport;
import net.sourceforge.marathon.component.ComponentException;
import net.sourceforge.marathon.component.ComponentFinder;
import net.sourceforge.marathon.component.ComponentNotFoundException;
import net.sourceforge.marathon.component.INamingStrategy;
import net.sourceforge.marathon.component.PropertyWrapper;
import net.sourceforge.marathon.recorder.IRecordingArtifact;
import net.sourceforge.marathon.recorder.WindowMonitor;
import net.sourceforge.marathon.util.Retry;
public class ObjectMapNamingStrategy implements INamingStrategy, AWTEventListener {
private static final List<String> LAST_RESORT_NAMING_PROPERTIES = new ArrayList<String>();
private static final List<String> LAST_RESORT_RECOGNITION_PROPERTIES = new ArrayList<String>();
private static final Logger logger = Logger.getLogger(ObjectMapNamingStrategy.class.getName());
static {
LAST_RESORT_NAMING_PROPERTIES.add("type");
LAST_RESORT_NAMING_PROPERTIES.add("indexInContainer");
LAST_RESORT_RECOGNITION_PROPERTIES.add("type");
LAST_RESORT_RECOGNITION_PROPERTIES.add("indexInContainer");
}
private Map<PropertyWrapper, String> componentNameMap = new HashMap<PropertyWrapper, String>();
private ObjectMapConfiguration configuration;
private Component container;
private int indexInContainer;
private boolean needUpdate = true;
private ObjectMap objectMap;
private WindowMonitor windowMonitor;
public ObjectMapNamingStrategy() {
configuration = new ObjectMapConfiguration();
try {
configuration.load();
} catch (IOException e) {
JOptionPane.showMessageDialog(null, "Error in creating naming strategy", "Error in NamingStrategy",
JOptionPane.ERROR_MESSAGE);
e.printStackTrace();
System.exit(1);
}
objectMap = new ObjectMap();
Toolkit.getDefaultToolkit().addAWTEventListener(this, AWTEvent.COMPONENT_EVENT_MASK);
}
public void eventDispatched(AWTEvent event) {
needUpdate = true;
}
public Map<String, Component> getAllComponents() {
HashMap<String, Component> componentMap = new HashMap<String, Component>();
Set<Entry<PropertyWrapper, String>> set = componentNameMap.entrySet();
for (Entry<PropertyWrapper, String> entry : set) {
componentMap.put(entry.getValue(), entry.getKey().getComponent());
}
return componentMap;
}
public Component getComponent(final String name, int retryCount, boolean isContainer) {
if (isContainer)
return getContainer(name, retryCount, "Could not find container (InternalFrame) for: " + name);
else
return getComponent(name, retryCount);
}
private Component getComponent(final String name, int retryCount) {
final OMapComponent omapComponent = objectMap.findComponentByName(name);
if (omapComponent == null) {
return getContainer(name, retryCount, "Could not find component/container (InternalFrame) for: " + name);
}
String message = "More than one component matched for: " + name + " with properties: " + omapComponent;
final ComponentNotFoundException err = new ComponentNotFoundException(message, null, null);
final Object[] found = new Object[1];
new Retry(err, ComponentFinder.RETRY_INTERVAL_MS, retryCount, new Retry.Attempt() {
public void perform() {
List<Component> matchedComponents = findComponent(omapComponent);
if (matchedComponents.size() != 1) {
if (matchedComponents.size() == 0)
err.setMessage("No components matched for: " + name + " with properties: " + omapComponent);
else
err.setMessage("More than one component matched for: " + name + " with properties: " + omapComponent);
setTopLevelComponent(container);
retry();
} else
found[0] = matchedComponents;
}
});
@SuppressWarnings("unchecked")
List<Component> matchedComponents = (List<Component>) found[0];
return matchedComponents.get(0);
}
private Component getContainer(final String name, int retryCount, String message) {
final ComponentNotFoundException err = new ComponentNotFoundException(message, null, null);
final Object[] found = new Object[1];
new Retry(err, ComponentFinder.RETRY_INTERVAL_MS, retryCount, new Retry.Attempt() {
public void perform() {
Component c = findContainerForName(name);
if (c == null) {
setTopLevelComponent(container);
retry();
} else
found[0] = c;
}
private Component findContainerForName(String name) {
Set<Entry<PropertyWrapper, String>> entrySet = componentNameMap.entrySet();
for (Entry<PropertyWrapper, String> entry : entrySet) {
if (name.equals(entry.getValue()))
return entry.getKey().getComponent();
}
return null;
}
});
Component c = (Component) found[0];
if (c instanceof JInternalFrame)
return c ;
return null;
}
public String getName(Component component) {
if (component instanceof Window || component instanceof JInternalFrame)
return getWindowName(component);
PropertyWrapper current = findPropertyWrapper(component);
if (current == null)
return null;
OMapComponent omapComponent;
try {
omapComponent = objectMap.findComponentByProperties(current);
} catch (ObjectMapException e) {
throw new ComponentNotFoundException(e.getMessage(), null, null);
}
if (omapComponent == null) {
List<String> rprops = findUniqueRecognitionProperties(current);
List<List<String>> rproperties = configuration.findRecognitionProperties(current.getComponent());
List<List<String>> nproperties = configuration.findNamingProperties(current.getComponent());
List<String> gproperties = configuration.getGeneralProperties();
omapComponent = objectMap.insertNameForComponent(current.getMComponentName(), current, rprops, rproperties,
nproperties, gproperties);
}
return omapComponent.getName();
}
public String getVisibleComponentNames() {
if (container == null)
return "";
setTopLevelComponent(container);
StringBuilder sb = new StringBuilder();
createVisibleStructure(container, sb, "");
return sb.toString();
}
public void saveIfNeeded() {
objectMap.save();
}
public void setTopLevelComponent(Component pcontainer) {
if (container == pcontainer && !needUpdate)
return;
logger.info("Updating object map: " + (needUpdate ? "Toplevel container changed" : "Container contents changed"));
container = pcontainer;
PropertyWrapper wrapper = new PropertyWrapper(pcontainer, getWindowMonitor());
try {
objectMap.setTopLevelComponent(wrapper, configuration.findContainerRecognitionProperties(pcontainer),
configuration.findContainerNamingProperties(pcontainer), configuration.getGeneralProperties(),
getTitle(pcontainer));
componentNameMap.clear();
indexInContainer = 0;
createNames(null, wrapper, 0);
needUpdate = false;
} catch (ObjectMapException e) {
throw new ComponentException(e.getMessage(), null, null);
}
}
private boolean componentCanUse(PropertyWrapper current, List<String> rprops) {
for (String rprop : rprops) {
if (current.getProperty(rprop) == null)
return false;
}
return true;
}
private boolean componentMatches(PropertyWrapper current, PropertyWrapper wrapper, List<String> rprops) {
for (String rprop : rprops) {
if (wrapper.getProperty(rprop) == null)
return false;
if (!wrapper.getProperty(rprop).equals(current.getProperty(rprop)))
return false;
}
return true;
}
private String createName(PropertyWrapper w) {
Component component = w.getComponent();
if (component instanceof Window || component instanceof JInternalFrame)
return getWindowName(component);
List<List<String>> propertyList = configuration.findNamingProperties(w.getComponent());
for (List<String> properties : propertyList) {
String name = createName(w, properties);
if (name != null && !"".equals(name) && !componentNameMap.containsValue(name)) {
return name;
} else if (name != null && componentNameMap.containsValue(name)) {
PropertyWrapper wrapper = findPropertyWrapper(name);
logger.info("Name already used name = " + name + " for " + wrapper.getComponent().getClass());
}
}
return createName(w, LAST_RESORT_NAMING_PROPERTIES);
}
private PropertyWrapper findPropertyWrapper(String name) {
Set<Entry<PropertyWrapper,String>> entrySet = componentNameMap.entrySet();
for (Entry<PropertyWrapper, String> entry : entrySet) {
if (entry.getValue().equals(name))
return entry.getKey();
}
return null;
}
private String createName(PropertyWrapper w, List<String> properties) {
StringBuilder sb = new StringBuilder();
for (String property : properties) {
String v = w.getProperty(property);
if (v == null)
return null;
sb.append(v).append('_');
}
sb.setLength(sb.length() - 1);
return sb.toString();
}
private void createNames(PropertyWrapper parent, PropertyWrapper current, int indexInParent) throws ObjectMapException {
Component c = current.getComponent();
if (!c.isVisible() || c instanceof IRecordingArtifact)
return;
String name;
current.setIndexInParent(indexInParent);
current.setParentName(componentNameMap.get(parent));
current.setIndexInContainer(indexInContainer);
if (parent != null && parent.getComponent() instanceof Container) {
LayoutManager layout = ((Container) parent.getComponent()).getLayout();
if (layout != null) {
setLayoutData(current, layout);
setPrecedingLabel(current, parent);
}
}
if (parent != null)
setFieldName(current, parent.getComponent());
OMapComponent omapComponent = objectMap.findComponentByProperties(current);
if (omapComponent == null)
name = createName(current);
else
name = omapComponent.getName();
indexInContainer++;
current.setMComponentName(name);
componentNameMap.put(current, name);
if (!(c instanceof Container))
return;
logger.info("Adding components for: " + current);
Component[] components = ((Container) c).getComponents();
int i;
for (i = 0; i < components.length; i++) {
PropertyWrapper wrapper = new PropertyWrapper(components[i], getWindowMonitor());
createNames(current, wrapper, i);
}
if (c instanceof Window) {
Window[] ownedWindows = ((Window) c).getOwnedWindows();
for (int j = 0; j < ownedWindows.length; j++) {
PropertyWrapper wrapper = new PropertyWrapper(ownedWindows[j], getWindowMonitor());
createNames(current, wrapper, i + j);
}
}
}
private void setFieldName(PropertyWrapper currentWrapper, Component container) {
Component current = currentWrapper.getComponent();
while (container != null) {
String name = findField(current, container);
if (name != null) {
currentWrapper.setFieldName(name);
return;
}
container = container.getParent();
}
}
private String findField(Component current, Component container) {
Field[] declaredFields = container.getClass().getDeclaredFields();
for (Field field : declaredFields) {
boolean accessible = field.isAccessible();
try {
field.setAccessible(true);
Object o = field.get(container);
if (o == current)
return field.getName();
} catch (Throwable t) {
} finally {
field.setAccessible(accessible);
}
}
return null;
}
private void setPrecedingLabel(PropertyWrapper current, PropertyWrapper parent) {
Component component = current.getComponent();
if (component instanceof JLabel || component instanceof JScrollPane || component instanceof JViewport ||
component instanceof JPanel)
return;
String labelText = findLabel(component, (Container) parent.getComponent());
if (labelText != null && labelText.endsWith(":")) {
labelText = labelText.substring(0, labelText.length() - 1).trim();
}
current.setPrecedingLabel(labelText);
}
private String findLabel(Component component, Container container) {
if (component == null || container == null)
return null;
Component[] allComponents = container.getComponents();
// Find labels in the same row (LTR)
// In the same row: labelx < componentx, labely >= componenty
for (Component label : allComponents) {
if (label instanceof JLabel) {
if (label.getX() < component.getX() && label.getY() >= component.getY()
&& label.getY() <= component.getY() + component.getHeight()) {
String text = ((JLabel) label).getText();
if (text == null)
return null ;
return text.trim();
}
}
}
// Find labels in the same column
// In the same row: labelx < componentx, labely >= componenty
for (Component label : allComponents) {
if (label instanceof JLabel) {
if (label.getY() < component.getY() && label.getX() >= component.getX()
&& label.getX() <= component.getX() + component.getWidth()) {
String text = ((JLabel) label).getText();
if (text == null)
return null;
return text.trim();
}
}
}
return null;
}
private void createVisibleStructure(Component c, StringBuilder sb, String indent) {
if (!c.isVisible() || c instanceof IRecordingArtifact)
return;
PropertyWrapper wrapper = findPropertyWrapper(c);
sb.append(indent).append(c.getClass().getName() + "[" + wrapper.getMComponentName() + "]\n");
if (c instanceof Container) {
for (Component component : ((Container) c).getComponents())
createVisibleStructure(component, sb, " " + indent);
}
}
private String createWindowName(PropertyWrapper w, List<String> properties) {
StringBuilder sb = new StringBuilder();
for (String property : properties) {
String v = w.getProperty(property);
if (v == null)
return null;
sb.append(v).append(':');
}
sb.setLength(sb.length() - 1);
return sb.toString();
}
private List<Component> findComponent(OMapComponent omapComponent) {
List<Component> matchedComponents = new ArrayList<Component>();
Set<PropertyWrapper> set = componentNameMap.keySet();
for (PropertyWrapper propertyWrapper : set) {
if (omapComponent.isMatched(propertyWrapper)) {
matchedComponents.add(propertyWrapper.getComponent());
break;
}
}
return matchedComponents;
}
private PropertyWrapper findPropertyWrapper(Component component) {
Set<PropertyWrapper> wrappers = componentNameMap.keySet();
for (PropertyWrapper propertyWrapper : wrappers) {
if (propertyWrapper.getComponent() == component)
return propertyWrapper;
}
logger.warning("ObjectMapNamingStrategy.getName(): Unexpected failure for findPropertyWrapper for component: " + component
+ " Trying again...");
needUpdate = true;
setTopLevelComponent(container);
wrappers = componentNameMap.keySet();
for (PropertyWrapper propertyWrapper : wrappers) {
if (propertyWrapper.getComponent() == component)
return propertyWrapper;
}
logger.warning("ObjectMapNamingStrategy.getName(): Unexpected failure for findPropertyWrapper for component: " + component);
return null;
}
private List<String> findUniqueRecognitionProperties(PropertyWrapper current) {
logger.info("Finding unique properties for: " + current.getMComponentName());
List<List<String>> rproperties = configuration.findRecognitionProperties(current.getComponent());
Set<PropertyWrapper> wrappers = componentNameMap.keySet();
for (List<String> rprops : rproperties) {
if (!componentCanUse(current, rprops)) {
logger.info("Skipping " + rprops + ": Can not use");
continue;
}
boolean matched = false;
for (PropertyWrapper wrapper : wrappers) {
if (wrapper == current)
continue;
if ((matched = componentMatches(current, wrapper, rprops))) {
logger.info("Skipping matched with " + wrapper.getMComponentName());
break;
}
}
if (!matched)
return rprops;
}
return LAST_RESORT_RECOGNITION_PROPERTIES;
}
private String getTitle(Component window) {
String title = null;
if (window instanceof Frame) {
title = ((Frame) window).getTitle();
} else if (window instanceof Dialog) {
title = ((Dialog) window).getTitle();
} else if (window instanceof JInternalFrame) {
title = ((JInternalFrame) window).getTitle();
}
return title == null ? "<NoTitle>" : title;
}
private WindowMonitor getWindowMonitor() {
if (windowMonitor == null)
windowMonitor = WindowMonitor.getInstance();
return windowMonitor;
}
private String getWindowName(Component c) {
PropertyWrapper wrapper = new PropertyWrapper(c, windowMonitor);
List<List<String>> windowNamingProperties = configuration.findContainerNamingProperties(c);
String title = null;
for (List<String> list : windowNamingProperties) {
title = createWindowName(wrapper, list);
if (title != null)
break;
}
if (title == null) {
// Last resort generation of window name
title = getTitle(c);
}
if (c instanceof Window) {
int index = 0;
List<Window> windows = getWindowMonitor().getWindows();
for (ListIterator<Window> iterator = windows.listIterator(); iterator.hasNext();) {
Window w = (Window) iterator.next();
if (w.equals(c))
break;
if (getTitle(w).equals(title))
index++;
}
if (index > 0)
title = title + "(" + index + ")";
}
return title;
}
private void setLayoutData(PropertyWrapper current, LayoutManager layout) {
try {
Method method = layout.getClass().getMethod("getConstraints", Component.class);
Object layoutData = method.invoke(layout, current.getComponent());
current.setLayoutData(layoutData);
return;
} catch (Exception e) {
}
if (layout instanceof GridLayout) {
int columns = ((GridLayout) layout).getColumns();
int indexInParent = current.getIndexInParent();
current.setLayoutData(new Point(indexInParent / columns, indexInParent % columns));
}
}
public void markUnused(Component c) {
PropertyWrapper propertyWrapper = findPropertyWrapper(c);
if (propertyWrapper == null)
return;
String name = componentNameMap.get(propertyWrapper);
if (name == null)
return;
objectMap.removeBinding(name);
}
public Component getComponent(final Properties nameProps, int retryCount, boolean isContainer) {
String message = "More than one component matched for: " + nameProps;
final ComponentNotFoundException err = new ComponentNotFoundException(message, null, null);
final Object[] found = new Object[1];
new Retry(err, ComponentFinder.RETRY_INTERVAL_MS, retryCount, new Retry.Attempt() {
public void perform() {
List<Component> matchedComponents = findMatchedComponents(nameProps);
if (matchedComponents.size() != 1) {
if (matchedComponents.size() == 0)
err.setMessage("No components matched for: " + nameProps);
else
err.setMessage("More than one component matched for: " + nameProps);
setTopLevelComponent(container);
retry();
} else
found[0] = matchedComponents;
}
});
@SuppressWarnings("unchecked")
List<Component> matchedComponents = (List<Component>) found[0];
return matchedComponents.get(0);
}
private List<Component> findMatchedComponents(final Properties nameProps) {
List<Component> l = new ArrayList<Component>();
Set<Entry<PropertyWrapper,String>> entrySet = componentNameMap.entrySet();
for (Entry<PropertyWrapper, String> entry : entrySet) {
if (entry.getKey().matched(nameProps)) {
l.add(entry.getKey().getComponent());
}
}
return l ;
}
}
|
[
"yuzhongxing88@gmail.com"
] |
yuzhongxing88@gmail.com
|
112af64f8ac4a2f3639d87b2263b66def4c21eae
|
864ce0a6581ebb866c82db25f30c6ac3a976405e
|
/src/main/java/com/carx/service/ProfileService.java
|
12598b2e036ce15081f3a7b664cd6eb1b7a9ad6d
|
[] |
no_license
|
zotovkem/test-task-carx
|
8f012cb6f17d072d5f24e63200570570b3b44f26
|
833c4aad0b5257d56a09b30700111e4d0384a7ce
|
refs/heads/master
| 2023-08-28T05:31:59.068366
| 2020-04-08T04:49:43
| 2020-04-08T04:49:43
| 409,951,058
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,799
|
java
|
package com.carx.service;
import com.carx.domain.dto.CountryCountProjection;
import com.carx.domain.entity.Profile;
import org.springframework.lang.NonNull;
import java.time.ZonedDateTime;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
/**
* @author Created by ZotovES on 06.04.2020
* Сервис управления профилем пользователя
*/
public interface ProfileService {
/**
* Создает новый профиль пользователя.
*
* @param profile профиль пользователя
*/
Profile createOrUpdateProfile(@NonNull Profile profile);
/**
* Получить профиль по уникальному идентификатору
*
* @param uuid уникальный идентификатор
* @return профиль пользователь
*/
Optional<Profile> findByUUID(@NonNull UUID uuid);
/**
* Получить кл-во пользователей по странам зарегистрированных за период
*
* @param beginDate начальная дата периода
* @param endDate конеяная дата периода
* @return список профилей пользователя
*/
List<CountryCountProjection> countProfilesBetweenCreateDate(@NonNull ZonedDateTime beginDate, @NonNull ZonedDateTime endDate);
/**
* Получить список профилей пользователей самых богатых в стране
*
* @param limit кол-во богачей в стране
* @return список профилей
*/
public Collection<Profile> limitProfilesRich(@NonNull Integer limit);
}
|
[
"zotoves@it2g.ru"
] |
zotoves@it2g.ru
|
d492e4445b42c6fecbac625e6e1075af54808059
|
92e9b8467703a831a56e193cf4cac331c0058062
|
/android/app/src/main/java/com/androidpropertyfinder/NativeActivity.java
|
9125740c1c3c7ac6e159d36a5e8822a2368243d2
|
[] |
no_license
|
amite/AndroidPropertyFinder
|
a1b394415fcefa5f0147df3809a7c569d075ff7c
|
af86269e1066ad4c1b5f81b708b08a7c2859070a
|
refs/heads/master
| 2021-05-09T03:10:28.963189
| 2018-01-28T06:17:50
| 2018-01-28T06:17:50
| 119,233,299
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 883
|
java
|
package com.androidpropertyfinder;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import com.facebook.react.ReactActivity;
import com.facebook.react.ReactActivityDelegate;
import java.util.ArrayList;
import java.util.Arrays;
public class NativeActivity extends ReactActivity {
Button btnGoTo;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_native);
btnGoTo=(Button) findViewById(R.id.button);
btnGoTo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(NativeActivity.this, MainActivity.class));
}
});
}
}
|
[
"amit.erandole@gmail.com"
] |
amit.erandole@gmail.com
|
a6c27f19da41a067187c9d3cbfda05fd0593429f
|
176ff23723df0bbf555a4cfc3dec5264f60b82f1
|
/src/main/java/com/company/inheritance/doubleDispatch/MyFriends.java
|
29b44ac4e52fc449657354ec33d28c68686338d6
|
[] |
no_license
|
doyoung0205/live-study
|
6c8df1c2989793f72f6466eb195ca5517932a37d
|
d8f8a8eba4d30636152ee8491ecab7a9bf3910e1
|
refs/heads/main
| 2023-03-26T23:30:14.853907
| 2021-03-14T06:51:51
| 2021-03-14T06:51:51
| 323,946,499
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 971
|
java
|
package com.company.inheritance.doubleDispatch;
import java.util.Arrays;
import java.util.List;
public class MyFriends {
public static void main(String[] args) {
// 모든 친구들
List<Friend> univFriends = getFiends();
List<SNS> snsGroup = getSnsGroup();
for (Friend friend : univFriends) {
for (SNS sns : snsGroup) {
friend.writeLetter(sns);
}
}
}
private static List<SNS> getSnsGroup() {
return Arrays.asList(
new Facebook(),
new Twitter()
);
}
private static List<Friend> getFiends() {
return Arrays.asList(
new CompFriend("ILL", "010-1111-1111", "computer"),
new CompFriend("LEE", "010-2222-2222", "Electronics"),
new UnivFriend("SAM", "010-3333-3333", "computer"),
new UnivFriend("SA", "010-4444-4444", "Electronics")
);
}
}
|
[
"doyoung0205@naver.com"
] |
doyoung0205@naver.com
|
983fdb3127a94e059d9c137141e42ec71e477039
|
0b49bd89b25984ebb79fa6004003175af174616b
|
/src/main/java/com/example/tutorialthymeleaf/service/post/PersonalAdminService.java
|
28ccc80d5231a45c33ebc932572498edeecf40c0
|
[] |
no_license
|
Iegor-Funtusov/tutorial-thymeleaf
|
f654b6aff9877ca9cb2bb0d3739a10585e0c96c3
|
f6c2cb9a2ccaf49b3546df302f97c9c13919ebbb
|
refs/heads/master
| 2023-06-29T23:23:15.845096
| 2021-08-06T16:54:27
| 2021-08-06T16:54:27
| 327,091,632
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 390
|
java
|
package com.example.tutorialthymeleaf.service.post;
import com.example.tutorialthymeleaf.persistence.entity.user.Personal;
import com.example.tutorialthymeleaf.service.CrudService;
/**
* @author Iehor Funtusov, created 03/01/2021 - 8:30 AM
*/
public interface PersonalAdminService extends CrudService<Personal> {
void lockAccount(Integer id);
void unlockAccount(Integer id);
}
|
[
"funtushan@gmail.com"
] |
funtushan@gmail.com
|
96066f330bf88378c55bcb92891ca1cce6f03344
|
f4df335918d73a2d793c662a78a9f78c4da51983
|
/src/main/java/com/krenog/myf/exceptions/NotFoundException.java
|
f0857cc0394744785cf6e2ff6eeef01c13c08a44
|
[] |
no_license
|
krenog/muf
|
746b05c7c822879e55e3e2289c007ead164486ed
|
c8aabeca38900711abd8e5b954db5eccfbbd7050
|
refs/heads/master
| 2023-01-28T07:26:37.233376
| 2020-12-05T21:42:43
| 2020-12-05T21:42:43
| 299,385,760
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 172
|
java
|
package com.krenog.myf.exceptions;
public class NotFoundException extends RuntimeException {
public NotFoundException(String message) {
super(message);
}
}
|
[
"kgboris@sksbank.ru"
] |
kgboris@sksbank.ru
|
464d2ba4b1797d098bde075e80414819009951a8
|
4d18fee33388e008ec0e2731954ac51429775c1b
|
/gmall-product/src/main/java/com/xzj/gmall/gmallproduct/service/impl/SkuSaleAttrValueServiceImpl.java
|
9d3ead903735ac85336add2ed391b46cfca74078
|
[] |
no_license
|
xzjGitHub-work/gmall
|
baf6767a14fc76a8e1f320a0a500d9a6c14d7974
|
1ff3960001497f59662290142a7ab006e44102a6
|
refs/heads/master
| 2023-07-15T22:39:16.997412
| 2021-09-03T02:07:28
| 2021-09-03T02:07:28
| 394,581,298
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,071
|
java
|
package com.xzj.gmall.gmallproduct.service.impl;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xzj.common.utils.PageUtils;
import com.xzj.common.utils.Query;
import com.xzj.gmall.gmallproduct.dao.SkuSaleAttrValueDao;
import com.xzj.gmall.gmallproduct.entity.SkuSaleAttrValueEntity;
import com.xzj.gmall.gmallproduct.service.SkuSaleAttrValueService;
@Service("skuSaleAttrValueService")
public class SkuSaleAttrValueServiceImpl extends ServiceImpl<SkuSaleAttrValueDao, SkuSaleAttrValueEntity> implements SkuSaleAttrValueService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<SkuSaleAttrValueEntity> page = this.page(
new Query<SkuSaleAttrValueEntity>().getPage(params),
new QueryWrapper<SkuSaleAttrValueEntity>()
);
return new PageUtils(page);
}
}
|
[
"15265855235@139.com"
] |
15265855235@139.com
|
56bb4b3a0d2dcc3ebf49e829a6b92a239c7a14f3
|
3e528b66a33036dfb4819f3d80bcfcba3894945d
|
/src/outros/Aresta.java
|
05ecfda16a6d14ada9cd8f2b8d714eab5d5be8a4
|
[
"MIT"
] |
permissive
|
thiagola92/Algoritmos-para-Grafos
|
227c154451ce27c2b7f3fd8a0451aa88732ebb0b
|
203c3728ad08a2b61f99353cfaa0a19d5a389338
|
refs/heads/master
| 2023-02-04T12:16:51.059830
| 2023-02-02T02:35:37
| 2023-02-02T02:35:37
| 73,217,323
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 858
|
java
|
package outros;
public class Aresta {
private Vertice vertice_inicial;
private int tamanho;
private Vertice vertice_final;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public Aresta(Vertice v_i, int t, Vertice v_f) {
vertice_inicial = v_i;
tamanho = t;
vertice_final = v_f;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public Vertice getVertice_inicial() {
return vertice_inicial;
}
public int getTamanho() {
return tamanho;
}
public Vertice getVertice_final() {
return vertice_final;
}
}
|
[
"thiagola92@gmail.com"
] |
thiagola92@gmail.com
|
d3067db455c0d6e3b56f21f045169eae9096a7f6
|
912d1522502f7c1ef0885825700c9e29a4c38bfd
|
/elcomUtil/src/com/elcom/util/security/MD5Converter.java
|
541dec5e8a210e9be95768f05e08fee33e5f24f7
|
[] |
no_license
|
came2q31/VideoInterview
|
df55fda264e6ee075855b120f4995ba8b9b3cf01
|
79dfff2c82023eede1b81cbab36a39d06c7ac985
|
refs/heads/master
| 2022-04-14T06:51:35.165826
| 2020-04-10T02:35:06
| 2020-04-10T02:35:06
| 254,525,541
| 0
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,781
|
java
|
package com.elcom.util.security;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
public class MD5Converter
{
private static final String ALGORITHM = "md5";
private static final String DIGEST_STRING = "HG58YZ3CR9";
private static final String CHARSET_UTF_8 = "utf-8";
private static final String SECRET_KEY_ALGORITHM = "DESede";
private static final String TRANSFORMATION_PADDING = "DESede/CBC/PKCS5Padding";
/* Encryption Method */
public static String encrypt(String message) throws Exception
{
try {
MessageDigest md;
md = MessageDigest.getInstance(ALGORITHM);
final byte[] digestOfPassword = md.digest(DIGEST_STRING.getBytes(CHARSET_UTF_8));
final byte[] keyBytes = Arrays.copyOf(digestOfPassword, 24);
for (int j = 0, k = 16; j < 8;) {
keyBytes[k++] = keyBytes[j++];
}
final SecretKey key = new SecretKeySpec(keyBytes, SECRET_KEY_ALGORITHM);
final IvParameterSpec iv = new IvParameterSpec(new byte[8]);
final Cipher cipher = Cipher.getInstance(TRANSFORMATION_PADDING);
cipher.init(Cipher.ENCRYPT_MODE, key, iv);
final byte[] plainTextBytes = message.getBytes(CHARSET_UTF_8);
final byte[] cipherText = cipher.doFinal(plainTextBytes);
return Base64Converter.encode(new String(cipherText));
} catch (Exception e) {
throw new Exception(e.getMessage());
}
}
/* Decryption Method */
public static String decrypt(String message) throws Exception {
try {
message = Base64Converter.decode(message);
final MessageDigest md = MessageDigest.getInstance(ALGORITHM);
final byte[] digestOfPassword = md.digest(DIGEST_STRING.getBytes(CHARSET_UTF_8));
final byte[] keyBytes = Arrays.copyOf(digestOfPassword, 24);
for (int j = 0, k = 16; j < 8;) {
keyBytes[k++] = keyBytes[j++];
}
final SecretKey key = new SecretKeySpec(keyBytes, SECRET_KEY_ALGORITHM);
final IvParameterSpec iv = new IvParameterSpec(new byte[8]);
final Cipher decipher = Cipher.getInstance(TRANSFORMATION_PADDING);
decipher.init(Cipher.DECRYPT_MODE, key, iv);
final byte[] plainText = decipher.doFinal(message.getBytes());
return new String(plainText, CHARSET_UTF_8);
} catch (Exception e) {
throw new Exception(e.getMessage());
}
}
public static String getMD5(String input) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] messageDigest = md.digest(input.getBytes());
return convertByteToHex(messageDigest);
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
}
public static String convertByteToHex(byte[] data) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < data.length; i++) {
sb.append(Integer.toString((data[i] & 0xff) + 0x100, 16).substring(1));
}
return sb.toString();
}
public static void main(String[] args) throws Exception {
String text = "hello";
String codedtext = MD5Converter.encrypt(text);
System.out.println(codedtext); // this is a byte array, you'll just see a reference to an array
String codedtext2 = MD5Converter.getMD5(text);
System.out.println(codedtext2); // this is a byte array, you'll just see a reference to an array
//String decodedtext = MD5Converter.decrypt(codedtext);
//System.out.println(decodedtext); // This correctly shows "TEST STRING TO ENCRYPT"
}
}
|
[
"Administrator@192.168.14.101"
] |
Administrator@192.168.14.101
|
7ee54f36faf9d0f3ecddfe2b9038eee029d8eeea
|
8c0eb2e8cc07c21e6bdef13a5ee757153885b3ed
|
/src/com/startjava/Lesson2_3/app/Person.java
|
0ac1af1922bcce9aa4b4ab8bd7be1b3080c90526
|
[] |
no_license
|
sergeinov/StartJava
|
69136656c7c1eba223210fce41ffe469efbc8565
|
928a34e4d73ebec5a18d1bffa1041acf9a6b0724
|
refs/heads/main
| 2023-06-26T15:26:37.009234
| 2021-08-02T11:33:31
| 2021-08-02T11:33:31
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 358
|
java
|
package com.startjava.Lesson2_3.app;
public class Person {
String name = "Иван";
String secondName = "Петров";
String sex = "Мужской";
int age = "29";
double growth = 1.75;
int weight = 73;
public void walk() {
}
public void speakEnglish() {
}
public void learnJava() {
}
public void jump() {
}
public void run() {
}
}
|
[
"noreply@github.com"
] |
noreply@github.com
|
783f9109fb45354467809a5a8d2dcd561f9b4860
|
b52926e5e1a45596b13988c0bd9d04de901c1b7c
|
/src/test/java/FrameWork/Excel.java
|
8612a97787d45650270d0a80fadcb8ffe14a4f68
|
[] |
no_license
|
anjalipatil19/Automation-Testing-of-Ease-My-Trip
|
f3e495c0a1ae25fac0ecc3e837c3dae8990eeea9
|
4fa06bb5264e7cfb70496dc21877a45be1b53e52
|
refs/heads/master
| 2023-08-04T22:56:06.442834
| 2021-10-04T15:31:05
| 2021-10-04T15:31:05
| 413,480,680
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,284
|
java
|
package FrameWork;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.io.FileInputStream;
public class Excel {
Workbook wb;
public Excel(String pathWithFileName) throws Exception{
try{
if (pathWithFileName.endsWith(".xls")){
wb = new HSSFWorkbook (new FileInputStream(pathWithFileName));
}else if (pathWithFileName.endsWith(".xlsx"))
{ wb = new XSSFWorkbook (new FileInputStream(pathWithFileName));}
}catch(Exception E){
System.out.println("Error with File Connection with Message" + E.getMessage());
}
}
public String getData(String sheetName, int row, int col){
String data= wb.getSheet(sheetName).getRow(row).getCell(col).toString();
return data;
}
public long getNumericData(String sheetName, int row, int col){
long data= (long)wb.getSheet(sheetName).getRow(row).getCell(col).getNumericCellValue();
return data;
}
public int getRowNum(String sheetName){
int row=wb.getSheet(sheetName).getLastRowNum()+1;
return row;
}
public int getColNum(String sheetName){
int row=wb.getSheet(sheetName).getRow(0).getLastCellNum();
return row;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}
|
[
"anjalipatil7757@gmail.com"
] |
anjalipatil7757@gmail.com
|
6339ca4967192745aa098fb9de762b2326f3020b
|
a9aba92fe07c92725bd96b3da5b54f1231fc7ec8
|
/src/gui_frame/Circle.java
|
5596428645cf0f9c1e7de2325ffe30bb3e0ff5b0
|
[] |
no_license
|
CunjunWang/algorithm-visualization
|
73f1eca0e37fade2c240151ef053d9399843bf8c
|
f9562c1d5189da5e291fae7959dd94b5de05fb0c
|
refs/heads/master
| 2020-11-24T15:05:57.840393
| 2019-12-27T17:40:57
| 2019-12-27T17:40:57
| 228,203,490
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,114
|
java
|
package gui_frame;
import java.awt.*;
/**
* Created by CunjunWang on 2019-12-15.
*/
public class Circle {
public int x, y;
private int r;
public int vx, vy;
public boolean isFilled = false;
public Circle(int x, int y, int r, int vx, int vy) {
this.x = x;
this.y = y;
this.r = r;
this.vx = vx;
this.vy = vy;
}
public int getR() {
return r;
}
public void move(int minx, int miny, int maxx, int maxy) {
x += vx;
y += vy;
checkCollision(minx, miny, maxx, maxy);
}
private void checkCollision(int minx, int miny, int maxx, int maxy) {
if (x - r < minx) {
x = r;
vx = -vx;
}
if (x + r >= maxx) {
x = maxx - r;
vx = -vx;
}
if (y - r < miny) {
y = r;
vy = -vy;
}
if (y + r >= maxy) {
y = maxy - r;
vy = -vy;
}
}
public boolean contain(Point p) {
return (x - p.x) * (x - p.x) + (y - p.y) * (y - p.y) <= r * r;
}
}
|
[
"duckwcj@gmail.com"
] |
duckwcj@gmail.com
|
919cf0f0ca1b92e9d5299f989882d29f83f95095
|
7ce98b05788a5297f7e2ec8c4d06b5f3f2b11e96
|
/cshop-rest/src/main/java/com/cshop/rest/pojo/CatResult.java
|
2d93f2dd5e2322319d35163beef5c1de3de4135a
|
[] |
no_license
|
XIRALIP/C-Shop
|
7c9be4ffcca382ec02999b89aae91fb90d143cbb
|
7c5a135a88ac78868d2bba5ee79bd1a9d92d2bcf
|
refs/heads/master
| 2020-03-18T01:24:59.812186
| 2018-06-09T02:33:32
| 2018-06-09T02:33:32
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 214
|
java
|
package com.cshop.rest.pojo;
import java.util.List;
public class CatResult {
private List<?> data;
public List<?> getData() {
return data;
}
public void setData(List<?> data) {
this.data = data;
}
}
|
[
"498046828@qq.com"
] |
498046828@qq.com
|
e4518833d0732bdb64c19d258e260185356e73ed
|
0737bebf0e895a3cda6e3c5bc358c3456aaea735
|
/assignments/DaysOld.java
|
f15eeee8e90400e3db7e71a6130f59c51391077e
|
[] |
no_license
|
noobandy/cattle-drive-assignments
|
00c358d822da346715cfddd3f5e94d3f572160c1
|
17669c30dba8eed933a4c902bafa3c31bd65dcce
|
refs/heads/master
| 2021-01-22T02:57:44.660477
| 2017-02-10T11:57:21
| 2017-02-10T11:57:21
| 81,081,059
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 552
|
java
|
package assignments;
import java.util.*;
import com.javaranch.common.*;
public class DaysOld {
public static void main(String[] args){
if(args.length == 0) {
System.out.println("argument missing");
System.exit(1);
}
GDate dob = new GDate(args[0]);
GDate today = new GDate(new Date());
System.out.format("You were born on %s%n", dob.getLongFormat());
System.out.format("Today is %s%n", today.getLongFormat());
System.out.format("You are now %d days old%n", new JDate(today).get() - new JDate(dob).get());
System.exit(0);
}
}
|
[
"noobandy1364@gmail.com"
] |
noobandy1364@gmail.com
|
a4d70280b7a47fd1a4fbd13428328153e25338a0
|
428efde48c20200cf8a37bce835633d3e70da614
|
/DP_08_Command/src/main/java/com/yankovets/hfdp/command/command/CeilingFanHighCommand.java
|
d4d4cb1a9c48893436a98bc76c644d6722766b34
|
[] |
no_license
|
smart-cn/DesignPatterns-1
|
734cf3b7636e7cea24b2984b3e211878d3ef8849
|
29e38560b1e86d62aebb5bc0d54dde7ecf7e4304
|
refs/heads/master
| 2020-03-28T13:54:26.621008
| 2016-07-04T06:26:57
| 2016-07-04T06:26:57
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 777
|
java
|
package com.yankovets.hfdp.command.command;
import com.yankovets.hfdp.command.receivers.CeilingFan;
public class CeilingFanHighCommand implements Command {
CeilingFan ceilingFan;
int prevSpeed;
public CeilingFanHighCommand(CeilingFan ceilingFan) {
this.ceilingFan = ceilingFan;
}
public void execute() {
prevSpeed = ceilingFan.getSpeed();
ceilingFan.high();
}
public void undo() {
if (prevSpeed == CeilingFan.HIGH) {
ceilingFan.high();
} else if (prevSpeed == CeilingFan.MEDIUN) {
ceilingFan.medium();
} else if (prevSpeed == CeilingFan.LOW) {
ceilingFan.low();
} else if (prevSpeed == CeilingFan.OFF) {
ceilingFan.off();
}
}
}
|
[
"artemyankovets@gmail.com"
] |
artemyankovets@gmail.com
|
629a965c937ea1b80f0c2cafd1ec5328fb2f1e03
|
6c5a7a2c958939f4bbfa05ac2bb2d5c1a00af4d4
|
/src/com/cmos/ipa/protocol/knx/knxnetip/servicetype/ConnectRequest.java
|
194a53eaa51a53835482704dc0240dafd3ebe2fb
|
[] |
no_license
|
android36524/IPA
|
a7c9c26ad0add9d459e993753e405520d8c750e4
|
0bff9c67344092bebdb42595f445de25f9e92c7e
|
refs/heads/master
| 2021-01-12T05:11:27.093674
| 2016-09-01T01:25:57
| 2016-09-01T01:25:57
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 5,733
|
java
|
/*
Calimero 2 - A library for KNX network access
Copyright (c) 2006, 2011 B. Malinowsky
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under terms
of your choice, provided that you also meet, for each linked independent
module, the terms and conditions of the license of that module. An
independent module is a module which is not derived from or based on
this library. If you modify this library, you may extend this exception
to your version of the library, but you are not obligated to do so. If
you do not wish to do so, delete this exception statement from your
version.
*/
package com.cmos.ipa.protocol.knx.knxnetip.servicetype;
import java.io.ByteArrayOutputStream;
import java.net.InetAddress;
import com.cmos.ipa.protocol.knx.exception.KNXFormatException;
import com.cmos.ipa.protocol.knx.knxnetip.util.CRI;
import com.cmos.ipa.protocol.knx.knxnetip.util.HPAI;
/**
* Represents a KNXnet/IP connect request message.
* <p>
* Such request is used to open a logical connection to a server. The request is sent to
* the control endpoint of the server. <br>
* The connection request is answered with a connect response.
* <p>
* Objects of this type are immutable.
*
* @author B. Malinowsky
* @see com.cmos.ipa.protocol.knx.knxnetip.servicetype.ConnectResponse
*/
public class ConnectRequest extends ServiceType
{
private final CRI cri;
private final HPAI ctrlPt;
private final HPAI dataPt;
/**
* Creates a connect request out of a byte array.
* <p>
*
* @param data byte array containing a connect request structure
* @param offset start offset of request in <code>data</code>
* @throws KNXFormatException if no connect request was found or invalid structure
*/
public ConnectRequest(final byte[] data, final int offset) throws KNXFormatException
{
super(KNXnetIPHeader.CONNECT_REQ);
ctrlPt = new HPAI(data, offset);
final int i = offset + ctrlPt.getStructLength();
dataPt = new HPAI(data, i);
cri = CRI.createRequest(data, i + dataPt.getStructLength());
}
/**
* Creates a connect request with the specific information of the CRI, and the
* endpoint information of the client.
* <p>
* The control and data endpoint specified are allowed to be equal, i.e all
* communication is handled through the same endpoint at the client.
*
* @param requestInfo connection specific options, depending on connection type
* @param ctrlEndpoint return address information of the client's control endpoint
* @param dataEndpoint address information of the client's data endpoint for the
* requested connection
*/
public ConnectRequest(final CRI requestInfo, final HPAI ctrlEndpoint, final HPAI dataEndpoint)
{
super(KNXnetIPHeader.CONNECT_REQ);
cri = requestInfo;
ctrlPt = ctrlEndpoint;
dataPt = dataEndpoint;
}
/**
* Creates a connect request for UDP communication, done on the specified local port
* and the system default local host.
* <p>
*
* @param requestInfo connection specific options, depending on connection type
* @param localPort local port of client used for connection, 0 <= port <=
* 0xFFFF
* @see CRI
*/
public ConnectRequest(final CRI requestInfo, final int localPort)
{
super(KNXnetIPHeader.CONNECT_REQ);
cri = requestInfo;
ctrlPt = new HPAI((InetAddress) null, localPort);
dataPt = ctrlPt;
}
/**
* Returns the connect request information used in the request.
* <p>
*
* @return connection specific CRI
*/
public final CRI getCRI()
{
return cri;
}
/**
* Returns the local control endpoint used for the connection.
* <p>
*
* @return control endpoint in a HPAI
*/
public final HPAI getControlEndpoint()
{
return ctrlPt;
}
/**
* Returns the local data endpoint used for the connection.
* <p>
*
* @return data endpoint in a HPAI
*/
public final HPAI getDataEndpoint()
{
return dataPt;
}
/* (non-Javadoc)
* @see tuwien.auto.calimero.knxnetip.servicetype.ServiceType#getStructLength()
*/
int getStructLength()
{
return ctrlPt.getStructLength() + dataPt.getStructLength() + cri.getStructLength();
}
/* (non-Javadoc)
* @see tuwien.auto.calimero.knxnetip.servicetype.ServiceType#toByteArray
* (java.io.ByteArrayOutputStream)
*/
byte[] toByteArray(final ByteArrayOutputStream os)
{
byte[] buf = ctrlPt.toByteArray();
os.write(buf, 0, buf.length);
buf = dataPt.toByteArray();
os.write(buf, 0, buf.length);
buf = cri.toByteArray();
os.write(buf, 0, buf.length);
return os.toByteArray();
}
}
|
[
"ouyangqiao@iot.chinamobile.com"
] |
ouyangqiao@iot.chinamobile.com
|
f3f67694a542764f7143553cf98e3edf6188dd7f
|
71f4fd8b09d2cc58d1fcd951144c32b1227217e7
|
/PhpTravels.java
|
7f55297703433e92ed18e3509f636b0d747e9bda
|
[] |
no_license
|
marijamaslesa/ITBootcamp
|
dbec387161a3e9b77cedb98c74c305807aee97f1
|
b833e22f24a0ff4f2349a99187b89b902b55cd54
|
refs/heads/master
| 2020-05-02T14:05:41.142755
| 2019-04-11T09:32:48
| 2019-04-11T09:32:48
| 178,001,094
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,164
|
java
|
import java.awt.List;
import java.util.ArrayList;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class PhpTravels {
public static void main(String[] args) {
// TODO Auto-generated method stub
WebDriver driver=new ChromeDriver();
String url ="https://www.phptravels.net/public/expedia/";
driver.get(url);
WebElement SearchBar=driver.findElement(By.xpath("//input[@id='citiesInput']"));
SearchBar.sendKeys("Sardinia Island, Italy");
WebElement CheckIn=driver.findElement(By.xpath("//input[@placeholder='Check in']"));
CheckIn.sendKeys("03/28/2019");
WebElement CheckOut=driver.findElement(By.xpath("//input[@placeholder='Check out']"));
CheckOut.sendKeys("04/04/2019");
WebElement searchButton=driver.findElement(By.xpath("//button[contains(text(),'Search')]"));
searchButton.click();
driver.navigate().to("https://www.phptravels.net/public/expedia/properties/hotel/1771577/AC11000A-D653-1791-69B2-B0DE3BC909CA?adults=2&checkin=03/28/2019&checkout=04/04/2019");
WebElement Book=driver.findElement(By.xpath("//form[1]//div[1]//div[3]//div[2]//span[1]"));
Book.click();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
//Thread.sleep(5000);
WebElement asGuest = driver.findElement(By.xpath("/html[1]/body[1]/div[5]/div[6]/section[1]/div[5]/div[1]/div[1]/div[2]/div[1]/div[2]/form[1]/button[1]"));
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
// Thread.sleep(5000);
asGuest.click();
WebElement Name=driver.findElement(By.xpath("//input[@placeholder='First Name']"));
Name.sendKeys("Marija");
WebElement Surname=driver.findElement(By.xpath("//input[@id='card-holder-lastname']"));
Surname.sendKeys("Ma");
WebElement Email=driver.findElement(By.xpath("//input[@id='card-holder-email']"));
Email.sendKeys("Ma@gmail.com");
WebElement Number=driver.findElement(By.xpath("//input[@id='card-holder-phone']"));
Number.sendKeys("Ma");
}
}
|
[
"noreply@github.com"
] |
noreply@github.com
|
f3d169b1bac13ca49186985f1230f402fad1ffde
|
ead375933c6b52b624e7bc296765cc1e5f0ecccd
|
/Reserveable.java
|
0d5bca47163a3b68d31a6345984b695444613b12
|
[] |
no_license
|
lbogotano/LibraryLab
|
9ba5dec38aaf9376845e2d4146faecc2302a2717
|
2c0bcffd43780c2e1bab806aea0dcaab583651fe
|
refs/heads/master
| 2022-08-10T07:38:18.079288
| 2020-05-22T11:59:57
| 2020-05-22T11:59:57
| 265,836,136
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 55
|
java
|
interface Reserveable {
boolean isReserveable();
}
|
[
"lgonzalez.us1@gmail.com"
] |
lgonzalez.us1@gmail.com
|
17d2f3e5e314715abd64406b6226176367fb165e
|
8dd1eb647d96a5f19a0f4fdb20fc742de3b3f796
|
/GraphAdjMatrix.java
|
44599ff684a3df6e0870aba00bbd982eaadf0c1e
|
[] |
no_license
|
dvysardana/GraphAlgorithms
|
e6cc3a8648150d89fba8b9a6eefa3ffbdebd5bd3
|
cf4fa73f5e9cb2671ece3c63fc1ba22fc6882861
|
refs/heads/master
| 2020-06-19T15:36:16.840186
| 2016-12-29T23:25:00
| 2016-12-29T23:25:00
| 74,849,564
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,274
|
java
|
import java.util.List;
import java.util.LinkedList;
import java.util.Set;
import java.util.HashSet;
import java.util.ArrayList;
class GraphAdjMatrix extends Graph{
boolean [][] adjMatrix;
public GraphAdjMatrix(int V, GraphType type){
super(type);
adjMatrix = new boolean[V][V];
this.V = V;
}
public void implement_add_vertex(int v){
//Create a new matrix, and copy all the vertices over from
//old matrix
}
public void implement_add_edge(int u, int v){
adjMatrix[u][v] = true;
if(type == GraphType.UNDIR){
adjMatrix[v][u] = true;
}
}
public List<Integer> implement_get_neighbors(int v){
List<Integer> ll = new LinkedList<Integer>();
for(int i=0; i<V; i++){
if(adjMatrix[v][i] != false){
ll.add(i);
}
}
return ll;
}
public Set<Integer> implement_get_vertices(){
Set<Integer> s = new HashSet<Integer>();
for(int i=0; i<V; i++){
s.add(i);
}
return s;
}
public static void main(String[] args){
/***********************************************/
/*********Undirected Graph************************/
/***********************************************/
int V = 8;
GraphAdjMatrix gu = new GraphAdjMatrix(V, GraphType.UNDIR);
gu.add_edge(0,1);
gu.add_edge(0,2);
gu.add_edge(2,3);
gu.add_edge(0,3);
gu.add_edge(1,4);
gu.add_edge(4,5);
gu.add_edge(6,7);
Set<Integer> visited = new HashSet<Integer>();
//gu.dfs_rec(0, visited);
//gu.dfs_st(0, visited);
//gu.bfs_qu(0, visited);
//gu.bidirectional_search(0, 5, visited);
/************************/
//Find shortest path between two vertices using BFS
/************************/
//int[] prev = new int[V];
//int source = 0;
//int dest = 5;
//gu.find_shortest_path_bfs(source , dest, visited, prev);
//int id = dest;
//System.out.println("Shortest path between:" + source + " and " + dest + " (Backwards) = ");
//while(id != -1){
// System.out.println(id);
// id = prev[id];
//}
/*******Find connected components in a graph******/
//gu.print_connected_components();
/***********************/
//Check cycle in undirected graph
/***********************/
int parent = -1;
boolean cycle = false;
//cycle = gu.check_cycle_undir(0, visited, parent);
//System.out.println("Is there a cycle in the undirected graph(Yes/No)?: " + cycle);
/***********************************************/
/*********Directed Graph************************/
/***********************************************/
Graph gd = new GraphAdjMatrix(3, GraphType.DIR);
gd.add_edge(0, 1);
gd.add_edge(1, 2);
gd.add_edge(0,2);
/**********Check for cycles********************/
//The above directed graph has no cycles.
//Add the fol. edges one by one as diff. examples of cycle
//gd.add_edge(0,0);
gd.add_edge(1,0);
//visited = new HashSet<Integer>();
//gd.dfs_rec(1, visited);
visited = new HashSet<Integer>();
Set<Integer> recactive = new HashSet<Integer>();
//cycle = gd.check_cycle_dir(0, visited, recactive);
//System.out.println("Graph has a cycle? (True/False)" + cycle);
/********Find all paths in DAG*************/
visited = new HashSet<Integer>();
int[] path = new int[gd.V];
int path_index = 0;
gd.find_all_paths(0,2,visited, path, path_index);
}
}
|
[
"dvy.sardana@gmail.com"
] |
dvy.sardana@gmail.com
|
28d37bbef8842abd43dcb3a34ba2abdfd7540241
|
2d2da961eab00f4d470aa5c015b004de197665fe
|
/Project_xiangshu/src/test/java/com/project/xiangshu/XiangshuApplicationTests.java
|
41b72ea6f7c4c549e43e9379f0267096504f1852
|
[] |
no_license
|
stitch55/Xiangshu
|
1be4cecd9f6ba0a2185ae2bf44a7dc755987a3a3
|
cedcc142176f416ab20fbfceb6b61f7d41ed2ef3
|
refs/heads/master
| 2020-05-24T14:36:35.487469
| 2019-05-18T04:40:05
| 2019-05-18T04:40:05
| 187,312,789
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 339
|
java
|
package com.project.xiangshu;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class XiangshuApplicationTests {
@Test
public void contextLoads() {
}
}
|
[
"stitch-@qq.com"
] |
stitch-@qq.com
|
9b4e0812f830b46ba8ab3be86414c3e693c75e62
|
f9c647e3f710b6cc6db31a85ac528cc898cdd679
|
/Result.java
|
311b0307f5852f84e10a7c7969b1114402a911df
|
[] |
no_license
|
profchiso/java-programs
|
91f8cd1a2aafc329853ac51bd495e4eac771701d
|
44feb534a261bc191b15f2176d8ba37d4caa473f
|
refs/heads/master
| 2022-09-19T11:31:41.485009
| 2020-05-15T10:20:30
| 2020-05-15T10:20:30
| 264,163,598
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,220
|
java
|
import java.util.Scanner;
public class Result{
public static void main(String[] args){
Scanner r = new Scanner(System.in);
float score;
String Grade;
System.out.println("Eneter your score to know your Grade ");
score = r.nextInt();
if(score >= 75){
Grade="A";
System.out.println("congrate you have made" +" "+ Grade);
}
if(score >= 70 && score <=74){
Grade="AB";
System.out.println("congrate you have made" +" "+ Grade);
}
if(score >= 65 && score <=69){
Grade="B";
System.out.println("congrate you have made" +" "+ Grade);
}
if(score >= 60 && score <=64){
Grade="CB";
System.out.println("congrate you have made" +" "+ Grade);
}
if(score >= 55 && score <=59){
Grade="C";
System.out.println("congrate you have made" +" "+ Grade);
}
if(score >= 50 && score <=54){
Grade="CD";
System.out.println("congrate you have made" +" "+ Grade);
}
if(score >= 45 && score <=49){
Grade="D";
System.out.println("congrate you have made" +" "+ Grade);
}
if(score >= 40 && score <=44){
Grade="E";
System.out.println("congrate you have made" +" "+ Grade);
}
if(score>=0 && score<=39){
Grade="F";
System.out.println("congrate you have made" + " "+ Grade);
}
}
}
|
[
"okoriechinedusunday@gmail.com"
] |
okoriechinedusunday@gmail.com
|
3fcc18da8feeec7830e0a4c89db5b8ec088eec77
|
9bd62ab1a1a0bb1d3e02f6111fd7a9cb556a0f6e
|
/src/main/java/com/CryptoApp/config/SecurityConfiguration.java
|
11257eca857bf6a2827d1450122da43157c8034f
|
[] |
no_license
|
bestemy/CryptoApp2
|
cefb25af179ea8976e98a5e09f33dba7d3762b0c
|
3fbfeb571bbc358798c9b4a2079c93e56aed48fa
|
refs/heads/master
| 2023-03-09T07:50:08.510589
| 2021-02-25T18:16:32
| 2021-02-25T18:16:32
| 342,337,651
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 5,865
|
java
|
package com.CryptoApp.config;
import com.CryptoApp.security.CustomUserDetailsService;
import com.CryptoApp.security.JwtAuthenticationEntryPoint;
import com.CryptoApp.security.JWTAuthenticationFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.BeanIds;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(
securedEnabled = true,
jsr250Enabled = true,
prePostEnabled = true
)
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Autowired
CustomUserDetailsService customUserDetailsService;
@Autowired
private JwtAuthenticationEntryPoint unauthorizedHandler;
@Bean
public JWTAuthenticationFilter jwtAuthenticationFilter() {
return new JWTAuthenticationFilter();
}
@Override
public void configure(AuthenticationManagerBuilder authenticationManagerBuilder) throws Exception {
authenticationManagerBuilder
.userDetailsService(customUserDetailsService)
.passwordEncoder(passwordEncoder());
}
@Bean(BeanIds.AUTHENTICATION_MANAGER)
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.cors()
.and()
.csrf()
.disable()
.exceptionHandling()
.authenticationEntryPoint(unauthorizedHandler)
.and()
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
.authorizeRequests()
.antMatchers("/",
"/favicon.ico",
"/**/*.png",
"/**/*.gif",
"/**/*.svg",
"/**/*.jpg",
"/**/*.html",
"/**/*.css",
"/**/*.js")
.permitAll()
.antMatchers("/api/auth/**")
.permitAll()
.antMatchers("/api/user/checkUsernameAvailability", "/api/user/checkEmailAvailability")
.permitAll()
.antMatchers(HttpMethod.GET, "/api/polls/**", "/api/users/**")
.permitAll()
.anyRequest()
.authenticated();
// Add our custom JWT security filter
http.addFilterBefore(jwtAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class);
}
}
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
//import org.springframework.security.config.annotation.web.builders.HttpSecurity;
//import org.springframework.security.config.annotation.web.builders.WebSecurity;
//import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
//import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
//import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
//
//import javax.sql.DataSource;
//
//@EnableWebSecurity
//public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
//
// @Autowired
// private BCryptPasswordEncoder bCryptPasswordEncoder;
//
// @Autowired
// DataSource dataSource;
//
// @Override
// protected void configure(AuthenticationManagerBuilder auth) throws Exception {
// auth.jdbcAuthentication()
// .dataSource(dataSource)
// .usersByUsernameQuery("select username,password,enabled "
// + "from users "
// + "where username = ?")
// .authoritiesByUsernameQuery("select username,authority "
// + "from authorities "
// + "where username = ?")
// .passwordEncoder(bCryptPasswordEncoder);
// }
//
// @Override
// protected void configure(HttpSecurity http) throws Exception {
// http.authorizeRequests()
// .antMatchers("/admin").hasRole("ADMIN")
// .antMatchers("/user").hasAnyRole("ADMIN", "USER")
// .antMatchers("/").permitAll()
// .and().formLogin();
// }
//
// /// Aici nu-s sigur..
// @Override
// public void configure(WebSecurity web) throws Exception {
//
// web.ignoring()
// .antMatchers("/resources/**", "/static/**", "/css/**", "/js/**", "/images/**", "/console/**");
// }
//
//
//}
|
[
"bestemy96@yahoo.com"
] |
bestemy96@yahoo.com
|
408c5e766430a0ab01125823b9ee6f87444fd80e
|
412e9ff40ca444c2cb0c8b368426d825b8f3df3c
|
/src/main/java/com/ian/miaosha/utils/DBUtil.java
|
2eb712a1ea525f41280bb42eff24738c93ae3610
|
[] |
no_license
|
ianzhengnan/miaosha
|
77f69ce8c6949228df4b36792f07a4c7aedb676b
|
977e674d2f6d27bd8bb4025328ec83aee06c06d9
|
refs/heads/master
| 2020-03-20T05:34:09.053326
| 2018-07-11T06:12:29
| 2018-07-11T06:12:29
| 137,218,713
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 934
|
java
|
package com.ian.miaosha.utils;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.util.Properties;
public class DBUtil {
private static Properties properties;
static {
try {
InputStream inputStream = DBUtil.class.getClassLoader().getResourceAsStream("application.properties");
properties = new Properties();
properties.load(inputStream);
inputStream.close();
}catch (Exception e) {
e.printStackTrace();
}
}
public static Connection getConnection() throws Exception{
String url = properties.getProperty("spring.datasource.url");
String username = properties.getProperty("spring.datasource.username");
String password = properties.getProperty("spring.datasource.password");
String driver = properties.getProperty("spring.datasource.driver-class-name");
Class.forName(driver);
return DriverManager.getConnection(url, username, password);
}
}
|
[
"ian.zheng@sap.com"
] |
ian.zheng@sap.com
|
94e66226a7d93597f3602594ff469600979ef19e
|
adbcb89671cf84526cf7aa15b49002d9317788b6
|
/src/com/boringtalks/objects/Utils.java
|
c95d1857fbaa85853f5dae2e0fe0a382c0578d9f
|
[] |
no_license
|
lduruo10/boringtalks
|
35bf70aa4305b4efe3eea766e71a8a5c93616e06
|
e4d535631b6fa77c8b6aeb3ead564e5071885511
|
refs/heads/master
| 2020-06-08T10:36:39.335986
| 2012-12-12T08:07:16
| 2012-12-12T08:07:16
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 8,961
|
java
|
package com.boringtalks.objects;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Environment;
import android.view.Display;
import android.view.View;
/**
* Represent the Utils factory that holds all the customized static methods
* which frequently used by app
*
* @author dli
* @version 0.1
*/
public class Utils
{
/**
* Overwrite the default constructor
*/
public Utils(){}
/**
* Customized showNotification method
*
* @param notificationManager - the reference of NotificationManager that the source activity is using
* @param sourceActivity - the activity which want to show notification
* @param targetActivity - the target activity which should launch after user click notification
* @param intentFlags - Set special flags controlling how this intent is handled.
* @param notificationIcon - the drawable icon of the notification
* @param flowText - the text that shows when the notification starts
* @param contentTitle - the title text of the notification
* @param contentText - the content text of the notification
* @param isShowOngoing - if the notification should show in the Notifications section
*/
public static void showNotification(NotificationManager notificationManager, Context sourceActivity, Context targetActivity, int intentFlags,
int notificationId,
int notificationIcon,
CharSequence flowText,
CharSequence contentTitle,
CharSequence contentText,
boolean isShowNotifications)
{
// Initial an instance of Notification object, and
// set the icon, scrolling text and timestamp
Notification notification = new Notification(notificationIcon, flowText,
System.currentTimeMillis());
// Initial an instance of Intent object, use intent to identify which
// activity will be launched after user click the notification
Intent intent = new Intent(sourceActivity, targetActivity.getClass());
// Set the mode of how the intent launch target activity
intent.setFlags(intentFlags);
// The PendingIntent to launch our activity if the user selects this notification
PendingIntent contentIntent = PendingIntent.getActivity(sourceActivity, 0,
intent, 0);
// Set the info for the views that show in the notification panel.
notification.setLatestEventInfo(sourceActivity, contentTitle,
contentText, contentIntent);
// if isShowNotifications is true, then do not show the notification in the Ongoing section
if(isShowNotifications)
{
notification.flags |= Notification.FLAG_ONGOING_EVENT;
}
// Send the notification.
notificationManager.notify(notificationId, notification);
}
/**
* get the current date in the format yyyy-MM-dd HH:mm:ss
* @return date - the string of date yyyy-MM-dd HH:mm:ss
*/
public static String getNowDate()
{
// Initial SimpleDateFormat object for date
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return df.format(new Date());
}
/**
* If external storage writable
* @return true - if the external storage is mounted and writable, otherwise false.
*/
public static boolean isExternalStorageWritable()
{
// Get states of MEDIA_MOUNTED and MEDIA_MOUNTED_READ_ONLY, return true only
// external storage state is equals MEDIA_MOUNTED and not equals MEDIA_MOUNTED_READ_ONLY
return Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED)
&& !Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED_READ_ONLY);
}
/**
* Check is directory or files exist
*
* @param directoryPath - the absolute path of a directory
* @param fileNames - the list of all the file names that want to check,
* if this set as null, then the method only check if
* the given directory exist.
* @return - true - if directory exist or files exist, otherwise false.
*/
public static boolean isExistFiles(String directoryPath, List<String> fileNames)
{
boolean result = false;
// Initial an instance of File object to represent the
// directory
File directory = new File(directoryPath);
// Check if the directory exist and must be a directory
if(directory.exists() && directory.isDirectory())
{
if(fileNames != null)
{
// after check, we will list all the name of files, and compare
// those names with parameter of fileNames array
String[] fileList = directory.list();
if(fileList.length >= fileNames.size())
{
for(int i=0; i<fileNames.size(); i++)
{
for(int j=0; j<fileList.length; j++)
{
if(fileList[j].equals(fileNames.get(i)))
{
fileNames.remove(i);
// jump to the outter loop
break;
}
}
}
// if no items left in fileNames List, then we can tell that
// all the files exist
if(fileNames.isEmpty())
{
result = true;
}
}
}
else
{
result = true;
}
}
return result;
}
/**
*
* @param context
* @param assetFolder
* @param targetFolder
* @param fileNamesNeedCopy
* @return
* @throws IOException
*/
public static boolean copyFromAsset(Context context, String assetFolder, String targetFolder, List<String> fileNamesNeedCopy) throws IOException
{
boolean result = false;
// First check if the external storage is available
if(isExternalStorageWritable())
{
// after check the external storage, then we will check if directory and
// files are already exist
if(!isExistFiles(targetFolder, null))
{
// if the directory is not exist then we make a directory
File directory = new File(targetFolder);
directory.mkdir();
}
if(!isExistFiles(targetFolder, fileNamesNeedCopy))
{
// if files are not exist then we will copy
// from asset to the external storage
// Get the AssetManager of the application
AssetManager assetManager = context.getResources().getAssets();
// string array to hold the file names
String[] files = null;
// Get all the file names from the indicate sub-folder in the
// asset
files = assetManager.list(assetFolder);
// Start to copy
for(String filename : files)
{
InputStream in = null;
OutputStream out = null;
in = assetManager.open(assetFolder+ File.separator +filename);
out = new FileOutputStream(targetFolder + File.separator + filename);
copyStream(in, out);
in.close();
in = null;
out.flush();
out.close();
out = null;
}
result = true;
}
}
return result;
}
/**
* Copy a stream from inputStream to outputStream
* @param in - InputStream
* @param out - OutputStream
* @throws IOException
*/
private static void copyStream(InputStream in, OutputStream out) throws IOException
{
byte[] buffer = new byte[1024];
int read;
while((read = in.read(buffer)) != -1)
{
out.write(buffer, 0, read);
}
}
/**
* Create an instance of Intent obejct so that we can use it for share action
* @param isMimeType - ture if we share image, false if share plaint text
* @param subject - subject of the share information
* @param shareMessage - share message
* @param mimeStream - the reference of the Uri, which point to the image
* @return Intent - an initialed Intent object
*/
public static Intent createShareIntent(boolean isMimeType, String subject, String shareMessage, Uri mimeStream)
{
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
if(isMimeType && mimeStream != null)
{
shareIntent.setType("image/*");
shareIntent.putExtra(android.content.Intent.EXTRA_STREAM, mimeStream);
}
else
{
shareIntent.setType("text/plain");
}
//add a subject
shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
//add the message
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareMessage);
return shareIntent;
}
}
|
[
"lduruo10@georgefox.edu"
] |
lduruo10@georgefox.edu
|
dc614bf1540e2d2e1318a215d887776e978a46c3
|
f7e3936c1ee6252c184831b8ada8b91d63e45d53
|
/app/src/main/java/com/example/shayanmoradi/xplayer/ViewPagerFragments/SongsFragment.java
|
cd100866832c7946c27738b70d0c130554b5c55b
|
[] |
no_license
|
shayanxm/Xplayer
|
0826effacc3952c4f1f07f982752873577272c82
|
fba435a064c1a66fd728dfcc034f8012aef76752
|
refs/heads/master
| 2020-04-18T23:42:04.933227
| 2019-02-04T19:23:18
| 2019-02-04T19:23:18
| 167,827,618
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 7,465
|
java
|
package com.example.shayanmoradi.xplayer.ViewPagerFragments;
import android.content.ContentUris;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.media.MediaMetadataRetriever;
import android.net.Uri;
import android.os.Bundle;
import android.os.ParcelFileDescriptor;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.shayanmoradi.xplayer.Models.CustomPlayer;
import com.example.shayanmoradi.xplayer.Models.Song;
import com.example.shayanmoradi.xplayer.Models.SongLab;
import com.example.shayanmoradi.xplayer.R;
import java.io.FileDescriptor;
import java.util.List;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
/**
* A simple {@link Fragment} subclass.
*/
public class SongsFragment extends Fragment {
public static Context mContext;
private RecyclerView recyclerView;
MyRecyclerViewAdapter adapter;
private CallBacks mCallBacks;
public static Context contextofMain;
public interface CallBacks {
public void setSong(Song song);
public void setImage(Song song);
void setTitle(String title);
void trueStart(boolean state);
void setViewOnrotate(Song song);
}
public static SongsFragment newInstance() {
Bundle args = new Bundle();
SongsFragment fragment = new SongsFragment();
fragment.setArguments(args);
return fragment;
}
public SongsFragment() {
// Required empty public constructor
}
@Override
public void onAttach(@NonNull Context context) {
super.onAttach(context);
contextofMain=context;
mCallBacks = (CallBacks) context;
}
@Override
public void onDetach() {
super.onDetach();
mCallBacks = null;
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_songs, container, false);
mContext = getActivity();
recyclerView = view.findViewById(R.id.rec_id);
List<Song> song = SongLab.getInstance(getActivity()).getAllSongs();
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
adapter = new MyRecyclerViewAdapter(getActivity(), song);
recyclerView.setAdapter(adapter);
return view;
}
public class MyRecyclerViewAdapter extends RecyclerView.Adapter<MyRecyclerViewAdapter.ViewHolder> {
private List<Song> mData;
private LayoutInflater mInflater;
// data is passed into the constructor
MyRecyclerViewAdapter(Context context, List<Song> data) {
this.mInflater = LayoutInflater.from(context);
this.mData = data;
}
// inflates the row layout from xml when needed
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = mInflater.inflate(R.layout.material_card_view, parent, false);
return new ViewHolder(view);
}
// binds the data to the TextView in each row
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
Song song = mData.get(position);
holder.myTextView.setText(song.getmSongName());
holder.artisName.setText(song.getmArtistName());
String songPath = song.getmSongPath();
Bitmap songArtWork = getsongArtWork(songPath);
holder.songArtWork.setImageBitmap(songArtWork);
holder.song = song;
CustomPlayer.getInstance(getActivity()).setCurrentSongPointer(position);
}
// total number of rows
@Override
public int getItemCount() {
return mData.size();
}
// stores and recycles views as they are scrolled off screen
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
TextView myTextView;
TextView artisName;
ImageView songArtWork;
Song song;
ViewHolder(View itemView) {
super(itemView);
myTextView = itemView.findViewById(R.id.song_titile);
artisName = itemView.findViewById(R.id.song_artist);
songArtWork = itemView.findViewById(R.id.song_artWork);
itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
CustomPlayer.getInstance(getActivity()).resetListBackToSongs();
CustomPlayer.setCurrentSongPointer(0);
song.setZeroSongOneAlbum(0);
mCallBacks.setSong(song);
mCallBacks.setTitle(song.getmSongName());
mCallBacks.trueStart(false);
mCallBacks.setViewOnrotate(song);
// mCallBacks.setImage(song);
//
// // Intent intent = ControllMuaicActivity.newIntent(getActivity(),song.getSongId());
// Intent intent1 = new Intent(getActivity(), MainActivity.class);
// intent1.putExtra("songId", song.getSongId());
// // startActivity(intent);
}
});
}
@Override
public void onClick(View v) {
}
// convenience method for getting data at click position
// allows clicks events to be caught
// parent activity will implement this method to respond to click events
}
}
private Bitmap getsongArtWork(String path) {
MediaMetadataRetriever mmr = new MediaMetadataRetriever();
mmr.setDataSource(path);
byte[] data = mmr.getEmbeddedPicture();
if (data != null) return BitmapFactory.decodeByteArray(data, 0, data.length);
return null;
}
public Bitmap getAlbumart(Context context, Long album_id) {
Bitmap albumArtBitMap = null;
BitmapFactory.Options options = new BitmapFactory.Options();
try {
final Uri sArtworkUri = Uri
.parse("content://media/external/audio/albumart");
Uri uri = ContentUris.withAppendedId(sArtworkUri, album_id);
ParcelFileDescriptor pfd = context.getContentResolver()
.openFileDescriptor(uri, "r");
if (pfd != null) {
FileDescriptor fd = pfd.getFileDescriptor();
albumArtBitMap = BitmapFactory.decodeFileDescriptor(fd, null,
options);
pfd = null;
fd = null;
}
} catch (Error ee) {
} catch (Exception e) {
}
if (null != albumArtBitMap) {
return albumArtBitMap;
}
return null;
}
}
|
[
"shayan.mwp@gmail.com"
] |
shayan.mwp@gmail.com
|
e6b8cf6b82a10eb46c4ac92f613ad7e732afe8bf
|
9c60238ca997ab375a586ecba277efeb52a296d2
|
/src/environment/Room.java
|
fd8fc24faa599a98d7b1b76a18fc4c7106d9e82e
|
[] |
no_license
|
stevenbyrd/mud
|
57c58946acadc989dc3f9b6fb166ab75fba0a9d8
|
1cd6f8fc547ae0bcb8c80919c899695d9aca89c2
|
refs/heads/master
| 2020-04-10T14:19:58.051266
| 2012-03-12T21:26:28
| 2012-03-12T21:26:28
| 3,700,151
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,737
|
java
|
package environment;
import java.util.LinkedList;
import driver.ANSI;
import actor.*;
public class Room extends RoomFlags
{
private String roomID;
private String name;
private String[] description;
private LinkedList<Exit> exitList;
private LinkedList<Exit> hiddenExits;
private LinkedList<Player> players;
private LinkedList<NPC> NPCs;
private LinkedList<NPC> spawnableNPCs;
private int updateRate;
public Room()
{
description = new String[5];
exitList = new LinkedList<Exit>();
hiddenExits = new LinkedList<Exit>();
players = new LinkedList<Player>();
NPCs = new LinkedList<NPC>();
spawnableNPCs = new LinkedList<NPC>();
updateRate = 1000;
new RoomUpdater(this, updateRate);
}
public synchronized void addPlayer(Player player)
{
if (players.contains(player) == false)
{
players.add(player);
player.setRoomID(roomID);
for(Player other : players)
{
if (other != player)
{
other.getConnection().send(player.getName() + " has arrived.");
}
}
}
}
public synchronized void removePlayer(Player player)
{
if (players.contains(player))
{
players.removeFirstOccurrence(player);
}
}
public String getRoomID()
{
return roomID;
}
public void setRoomID(String roomID)
{
this.roomID = roomID;
}
public String[] getDescription()
{
return description;
}
public LinkedList<Exit> getExitList()
{
return exitList;
}
public LinkedList<Exit> getHiddenExits()
{
return hiddenExits;
}
public LinkedList<Player> getPlayers()
{
return players;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
@SuppressWarnings("unchecked")
public LinkedList<NPC> getNPCs()
{
return (LinkedList<NPC>)NPCs.clone();
}
public void addNPC(NPC npc)
{
NPCs.add(npc);
for(Player p : players)
{
p.getConnection().send(ANSI.WHITE + "A " + npc.getName() + " has just arrived." + ANSI.SANE);
}
}
public void removeNPC(NPC npc)
{
NPCs.remove(npc);
for(Player p : players)
{
p.getConnection().send(ANSI.WHITE + "The " + npc.getName() + " has wandered off." + ANSI.SANE);
}
}
public LinkedList<NPC> getSpawnableNPCs()
{
return spawnableNPCs;
}
public void addSpawnableNPC(NPC npc, double spawnRate, double wanderRate, int minimumWait, double fleeRate)
{
npc.setSpawnRate(spawnRate);
npc.setWanderRate(wanderRate);
npc.setMinimumWait(minimumWait);
npc.setFleeRate(fleeRate);
spawnableNPCs.add(npc);
}
public void setUpdateRate(int rate)
{
updateRate = rate;
}
public boolean hasPlayers()
{
return !players.isEmpty();
}
public boolean hasNPC()
{
return !NPCs.isEmpty();
}
}
|
[
"play@mbp.gateway.2wire.net"
] |
play@mbp.gateway.2wire.net
|
071bc87f76c09ba454f64f6d55028d219cbbbb58
|
2a7e5223770933e90af51e903aad7ac7bd450ba3
|
/app/src/main/java/com/firat/noiseapp/ScreenDetectBReciever.java
|
11ed66baf5074cb3700c61096ec77438646724bf
|
[] |
no_license
|
alex-bretet/noiseapp
|
dfa304a2475a51acd9a5f827a6a6be6181b76cb7
|
c735a0a5a076fd9e161f2f7b57c939273ad03073
|
refs/heads/master
| 2021-06-11T12:03:29.681473
| 2017-02-18T22:58:46
| 2017-02-18T22:58:46
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 8,193
|
java
|
package com.firat.noiseapp;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.media.AudioFormat;
import android.media.AudioRecord;
import android.media.MediaRecorder;
import android.os.Environment;
import android.util.Log;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
/**
* Created by FIRAT on 04.12.2016.
*/
public class ScreenDetectBReciever extends BroadcastReceiver {
public static final String TAG = "ScreenDetectBtReceiver";
private AudioRecord audioRecord =null;
private int bufferSize = 0;
private boolean isRecording = false;
private Thread recordingThread = null;
public static final String AUDIO_RECORDER_FOLDER = "AudioRecorder";
public static final String AUDIO_RECORDER_TEMP_FILE = "record_temp.raw";
public static final String AUDIO_RECORDER_FILE_EXT_WAV=".wav";
public static final int RECORDER_BPP = 16;
@Override
public void onReceive(Context context, Intent intent) {
try
{
bufferSize = AudioRecord.getMinBufferSize(8000
, AudioFormat.CHANNEL_IN_STEREO
, AudioFormat.ENCODING_PCM_16BIT);
if (intent.getAction().equals(Intent.ACTION_USER_PRESENT))
{
Log.d(TAG, "screen unlocked");
startRecording(context);
Thread.sleep(10000);
stopRecording(context);
}
}
catch (Exception e)
{
Log.e(TAG,e.getMessage(),e.fillInStackTrace());
}
}
private void startRecording(final Context context)
{
Log.d(TAG, "start recording");
audioRecord = new AudioRecord(MediaRecorder.AudioSource.MIC
,44100
,AudioFormat.CHANNEL_IN_STEREO
,AudioFormat.ENCODING_PCM_16BIT
,bufferSize);
int recorderState = audioRecord.getState();
if (recorderState == 1)
audioRecord.startRecording();
isRecording = true;
recordingThread = new Thread(new Runnable() {
@Override
public void run() {
writeAudioDataToFile(context);
}
},"Recording Thread");
recordingThread.start();
}
private void stopRecording(Context context)
{
Log.d(TAG, "stop recording");
if ( audioRecord!=null)
{
isRecording = false;
}
if (audioRecord.getState() == 1)
{
audioRecord.stop();
audioRecord.release();
}
audioRecord = null;
recordingThread = null;
copyWavFile(getTempFilename(context), getFilename(context));
deleteTempFile(context);
}
private void deleteTempFile(Context context)
{
File file = new File(getTempFilename(context));
file.delete();
}
private void copyWavFile(String inFileName, String outFileName)
{
try
{
FileInputStream fin = null;
FileOutputStream fos = null;
long totalAudioLen = 0;
long totalDataLen = totalAudioLen + 36;
long longSampleRate = 44100;
int channels = 2;
long byteRate = RECORDER_BPP * 44100 * channels / 8;
byte[] data = new byte[bufferSize];
fin = new FileInputStream(inFileName);
fos = new FileOutputStream(outFileName);
totalAudioLen = fin.getChannel().size();
totalDataLen = totalAudioLen + 36;
Log.i(TAG,"File size= "+totalDataLen);
writeWavFileHeader(fos,totalAudioLen,totalDataLen,longSampleRate,channels,byteRate);
while (fin.read(data) != -1)
{
fos.write(data);
}
fin.close();
fos.close();
}
catch (Exception e)
{
Log.e(TAG,e.getMessage(),e.fillInStackTrace());
}
}
private void writeWavFileHeader(FileOutputStream fos, long totalAudioLen, long totalDataLen, long longSampleRate, int channels, long byteRate) throws IOException {
byte[] header = new byte[44];
header[0] = 'R'; // RIFF/WAVE header
header[1] = 'I';
header[2] = 'F';
header[3] = 'F';
header[4] = (byte) (totalDataLen & 0xff);
header[5] = (byte) ((totalDataLen >> 8) & 0xff);
header[6] = (byte) ((totalDataLen >> 16) & 0xff);
header[7] = (byte) ((totalDataLen >> 24) & 0xff);
header[8] = 'W';
header[9] = 'A';
header[10] = 'V';
header[11] = 'E';
header[12] = 'f'; // 'fmt ' chunk
header[13] = 'm';
header[14] = 't';
header[15] = ' ';
header[16] = 16; // 4 bytes: size of 'fmt ' chunk
header[17] = 0;
header[18] = 0;
header[19] = 0;
header[20] = 1; // format = 1
header[21] = 0;
header[22] = (byte) channels;
header[23] = 0;
header[24] = (byte) (longSampleRate & 0xff);
header[25] = (byte) ((longSampleRate >> 8) & 0xff);
header[26] = (byte) ((longSampleRate >> 16) & 0xff);
header[27] = (byte) ((longSampleRate >> 24) & 0xff);
header[28] = (byte) (byteRate & 0xff);
header[29] = (byte) ((byteRate >> 8) & 0xff);
header[30] = (byte) ((byteRate >> 16) & 0xff);
header[31] = (byte) ((byteRate >> 24) & 0xff);
header[32] = (byte) (2 * 16 / 8); // block align
header[33] = 0;
header[34] = RECORDER_BPP; // bits per sample
header[35] = 0;
header[36] = 'd';
header[37] = 'a';
header[38] = 't';
header[39] = 'a';
header[40] = (byte) (totalAudioLen & 0xff);
header[41] = (byte) ((totalAudioLen >> 8) & 0xff);
header[42] = (byte) ((totalAudioLen >> 16) & 0xff);
header[43] = (byte) ((totalAudioLen >> 24) & 0xff);
fos.write(header,0,44);
}
private void writeAudioDataToFile(Context context)
{
byte data[] = new byte[bufferSize];
String fileName = getTempFilename(context);
FileOutputStream fos = null;
try {
fos = new FileOutputStream(fileName);
}
catch (FileNotFoundException e)
{
Log.e(TAG,e.getMessage(),e.fillInStackTrace());
}
int read = 0;
if (null != fos)
{
while (isRecording)
{
read = audioRecord.read(data,0,bufferSize);
if (AudioRecord.ERROR_INVALID_OPERATION != read)
{
try {
fos.write(data);
}
catch (IOException e)
{
Log.e(TAG,e.getMessage(),e.fillInStackTrace());
}
}
}
}
}
private String getTempFilename(Context context)
{
String filepath = Environment.getExternalStorageDirectory().getPath();
// String filepath = context.getFilesDir().getPath();
File file = new File(filepath,AUDIO_RECORDER_FOLDER);
if(!file.exists())
{
file.mkdirs();
}
File tempFile = new File(filepath,AUDIO_RECORDER_TEMP_FILE);
if (tempFile.exists())
{
tempFile.delete();
}
return (file.getAbsolutePath()+"/"+AUDIO_RECORDER_TEMP_FILE);
}
private String getFilename(Context context)
{
String filepath = Environment.getExternalStorageDirectory().getPath();
// String filepath = context.getFilesDir().getPath();
File file = new File(filepath,AUDIO_RECORDER_FOLDER);
Log.d(TAG,"File location = "+context.getCacheDir()+"/"+AUDIO_RECORDER_FOLDER);
if (!file.exists())
file.mkdirs();
return (file.getAbsolutePath()+"/"+System.currentTimeMillis()+AUDIO_RECORDER_FILE_EXT_WAV);
}
}
|
[
"yfpayalan@gmail.com"
] |
yfpayalan@gmail.com
|
ce218e6a7c8053e3c92485b5db5eab1a61803967
|
de58d94250d4e5b471e575087528d0d5be3b8caf
|
/src/br/edu/fjn/jpa/model/produto/Cor.java
|
41f0a1a0534013c76a5eaa7fc5287fee8b55b2e3
|
[] |
no_license
|
sousajoaoneto/projeto-loja
|
a0d857c204e468b10288f5b42125c6da02d63f17
|
2a7ace7676093d0092a5b666fee02ae329983309
|
refs/heads/master
| 2016-09-12T15:24:08.537895
| 2016-06-05T18:37:39
| 2016-06-05T18:37:39
| 59,308,464
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,856
|
java
|
package br.edu.fjn.jpa.model.produto;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
@Entity(name = "tb_cor")
public class Cor {
@Id
@Column(nullable= false)
@GeneratedValue(strategy = GenerationType.SEQUENCE , generator = "genCor")
@SequenceGenerator(name = "genCor", sequenceName="seqCor", initialValue= 1,
allocationSize=1)
private Integer id_cor;
@Column(nullable= false)
private String descricao;
public Cor(){
}
public Cor(String descricao) {
super();
this.descricao = descricao;
}
public void setId_cor(Integer id_cor) {
this.id_cor = id_cor;
}
public Integer getId_cor() {
return id_cor;
}
public String getDescricao() {
return descricao;
}
public void setDescricao(String descricao) {
this.descricao = descricao;
}
@Override
public String toString() {
return "Cor [getId_cor()=" + getId_cor() + ", getDescricao()=" + getDescricao() + ", hashCode()=" + hashCode()
+ "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((descricao == null) ? 0 : descricao.hashCode());
result = prime * result + ((id_cor == null) ? 0 : id_cor.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Cor other = (Cor) obj;
if (descricao == null) {
if (other.descricao != null)
return false;
} else if (!descricao.equals(other.descricao))
return false;
if (id_cor == null) {
if (other.id_cor != null)
return false;
} else if (!id_cor.equals(other.id_cor))
return false;
return true;
}
}
|
[
"sousa.joao.neto@gmail.com"
] |
sousa.joao.neto@gmail.com
|
1c9a5ad3547ff0f323d924f855daf3192d845cf7
|
18ae40878a07d83e1d7597e03fc1951df9d0e0a7
|
/spring-boot-rest-impl/src/main/java/edu/kytsmen/java/entity/Task.java
|
5d55e9daa62731c2e487d62bf0870da71e8d999c
|
[] |
no_license
|
Kietzmann/spring-lab-rest
|
faf7fdc4f10df274e01dd09c4b04c39af02a81cd
|
273086b82c4d143dde4771f0b389a7183fe2a1a6
|
refs/heads/master
| 2021-01-21T11:08:22.314934
| 2017-05-18T18:49:38
| 2017-05-18T18:49:38
| 91,727,235
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,116
|
java
|
package edu.kytsmen.java.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "task")
public class Task {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Long id;
@Column(name = "description")
private String description;
@Column(name = "completed")
private boolean completed;
public Task(Long id, String description, boolean completed) {
this.id = id;
this.description = description;
this.completed = completed;
}
public Task() {
}
public Long getId() {
return id;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public boolean isCompleted() {
return completed;
}
public void setCompleted(boolean completed) {
this.completed = completed;
}
}
|
[
"dmitrokytsmen@gmail.com"
] |
dmitrokytsmen@gmail.com
|
4efe9ee734823c2fa0c2584659dcee34d364a1f6
|
c2c31c61a341767a0d86c6ce9f9483bea3d60b5c
|
/JavaFullThrottle/JavaFullThrottle_IntelliJ_NetBeans_Projects/04_Java15_text_blocks/src/TextBlocksDemo.java
|
30b20c64cfeb84731702cb34514fed8396892213
|
[
"LicenseRef-scancode-warranty-disclaimer"
] |
no_license
|
cyberravn/JavaFullThrottle
|
882832d01d5f65c265724e9beb70cb65e8d47c19
|
1f001cab4e6ae0f7906c75b661f547091861cafc
|
refs/heads/master
| 2023-08-11T17:38:04.942977
| 2021-10-05T22:15:02
| 2021-10-05T22:15:02
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,249
|
java
|
// compile: javac -source 15 --enable-preview *.java
// run: java --enable-preview TextBlockDemo
public class TextBlocksDemo {
public static void main(String[] args) {
/*
1. Opening """ must be followed by only whitespace and a line break.
2. Compiler ignores whitespace to the left of the block.
3. Great for embedding lengthy HTML/XML/SQL strings in code.
4. If you need \n at end of last line, move closing """ to next line.
*/
String text_block = """
This is\na multiline
text block.""";
System.out.println("*******************");
System.out.println(text_block);
System.out.println("*******************\n");
String old_query =
"INSERT INTO Addresses " +
"(FirstName, LastName, Email, PhoneNumber) " +
"VALUES (?, ?, ?, ?)";
String new_query = """
INSERT INTO Addresses
(FirstName, LastName, Email, PhoneNumber)
VALUES (?, ?, ?, ?)""";
System.out.printf("old:%n%s%n%n", old_query);
System.out.printf("new:%n%s%n", new_query);
}
}
|
[
"paul@deitel.com"
] |
paul@deitel.com
|
04ce6b17f6900a6235bb940999edfa7ae8c11acf
|
106db0e74dee1f656f5b80a36c9767dc311a11be
|
/app/src/main/java/scorer/BeloteRound.java
|
59ff3603e67fc03bff6f4200c8db359cb013f3bf
|
[] |
no_license
|
chedlyrdissi/Belote
|
004abca8467c3c8e3d68050a4ea78bfa45e35175
|
0449d1b800bea71b3ac045efdcc2d2f992bd9420
|
refs/heads/master
| 2022-05-28T19:25:41.513787
| 2020-05-05T18:21:52
| 2020-05-05T18:21:52
| 256,819,808
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,071
|
java
|
package scorer;
import java.time.LocalDateTime;
public class BeloteRound {
private int score1 = 0;
private int score2 = 0;
private String start;
private String finish;
public BeloteRound(){}
public int getScore1() {
return score1;
}
public void setScore1(int score1) {
this.score1 = score1;
}
public int getScore2() {
return score2;
}
public void setScore2(int score2) {
this.score2 = score2;
}
public String getFinish() {
return finish;
}
public void setFinish(String finish) {
this.finish = finish;
}
public String getStart() {
return start;
}
public void setStart(String start) {
this.start = start;
}
public BeloteRound start() {
start = LocalDateTime.now().toString();
return this;
}
public BeloteRound finish( int score1, int score2){
finish = LocalDateTime.now().toString();
this.score1 = score1;
this.score2 = score2;
return this;
}
}
|
[
"chedlyrd2000@gmail.com"
] |
chedlyrd2000@gmail.com
|
244ed9c6c98410dc02e20e51e4a24b4bc47a3007
|
9b0e767548232d5870fd9acf6ebd62ec9579c9e8
|
/day09-IO/src/io/basic/KeyboardInput2.java
|
3dce45e02f75c2a65eaaca2648d3b97586803596
|
[] |
no_license
|
kayh45/academy_java_basic
|
770c6a7b2d0601b01a95c72b6f0ee0ec39db8959
|
0dc8928c3ee04ccf7ba66b79f27489e2cfc7cc41
|
refs/heads/master
| 2020-03-22T06:39:57.082601
| 2018-07-20T06:55:45
| 2018-07-20T06:55:45
| 139,649,365
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,390
|
java
|
package io.basic;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
/**
* 표준 입력인 키보드 입력을 받아서
* 표준 출력인 모니터로 출력하는 클래스
*
* 1. node stream (키보드 = System.in : InputStream)
*
* 2. filter stream (stream --> reader : InputStreamReader)
* 1바이트 인풋스트림을 2바이트 문자로 변경
* (키보드는 사실 문자 입력이브로)
*
* 3. filter stream (reader --> reader : BufferedReader)
* 2바이트 문자 1개를 1줄 단위로 읽어서 String으로 만들 수 있는
* 편리한 메소드를 사용한다.
*
* 4. 3에서 만들어진 filter stream 객체를 사용하여
* read() 작업 진행
*
* 5. 읽은 내용을 표준 출력 (모니터 = System.out)
*
* 6. 마지막 filter stream 닫기 (자원 해제)
* @author PC38219
*
*/
public class KeyboardInput2 {
public static void main(String[] args) {
// 1. 입력 노드 스트림 (표준 입력:키보드)
// InputStream in = System.in;
// 2. 노드 스트림을 포장할 필터스트림
// InputStreamReader ir = new InputStreamReader(System.in);
// 3. 2의 필터스트림을 편리한 사용을 위해서
// 한 번 더 포장할 필터스트림
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("값을 입력하세요... (ctrl + z 입력 시 중단)");
// 4. 3의 필터스트림의 메소드를 사용하여
// 키보드 입력을 읽어들인다.
String readData = null;
try {
while ((readData = br.readLine()) != null) {
// 5. null 이 아니면 읽은 데이터가 있으므로 출력
System.out.println("읽은 데이터 : " + readData);
}
} catch (IOException e) {
e.printStackTrace();
} finally {
// 6. 자원 해제 : 예외 발생 여부와 관계없이
// 항상 안정적으로 해제가 이루어져야하므로
// 자원 해제 관련 구문은 finally에서 진행
try {
if (br != null) {
br.close();
}
} catch (IOException e) {
System.err.println("자원 반납 실패! " + e.getMessage());
e.printStackTrace();
}
}
}
}
|
[
"kayh4545@gmail.com"
] |
kayh4545@gmail.com
|
6637d624d1d0b428a07cca0fc6e8b9260551cebe
|
788d93e10bff3b56317276667ad6af87bba85b65
|
/singtel_test/src/problems/section1/Bird.java
|
7095a976df8ed78d01158f11e95ebca8ef03596e
|
[] |
no_license
|
Kuldeep-Rana/coding_problems
|
7b71848e1b5facb04addc6d33f62e55534db8f5f
|
6d2ad0721979d6e97822a82b37c922ce95f4a812
|
refs/heads/main
| 2023-07-18T14:31:48.551231
| 2021-09-03T12:23:31
| 2021-09-03T12:23:31
| 402,666,127
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 206
|
java
|
package problems.section1;
import problems.Animal;
import problems.intfc.Fly;
import problems.intfc.Sing;
import problems.intfc.Walk;
public class Bird extends Animal implements Fly, Walk, Sing {
}
|
[
"kuldeep.rana@puresoftware.com"
] |
kuldeep.rana@puresoftware.com
|
473ba76fbfcaec8807dc6c0647ce82d91d9cc3d5
|
77c1ea73c64e6cdf5538dc8b248954077655ca45
|
/jengine/common/j2se-common2/src/main/java/com/jengine/common/javacommon/webSpider/WebSpider.java
|
a6e68b6b7122025b9491514c0a86a845655454f8
|
[] |
no_license
|
1261972163/silkworm
|
8ccbbd0aa1183d44d1cb905b7af49782d3e598a3
|
855b32d3f4a20d09a3614d88a8cc4b55742feb8f
|
refs/heads/master
| 2021-01-25T14:04:30.858814
| 2018-03-04T01:47:35
| 2018-03-04T01:47:35
| 123,650,262
| 0
| 0
| null | 2018-03-03T01:59:38
| 2018-03-03T01:59:38
| null |
UTF-8
|
Java
| false
| false
| 1,152
|
java
|
package com.jengine.common.javacommon.webSpider;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
/**
* content
*
* @author nouuid
* @date 6/6/2017
* @since 0.1.0
*/
public class WebSpider {
/**
* 抓取网页内容
*/
public static StringBuffer readByURL(String urlName) {
StringBuffer result = new StringBuffer();
try {
URL url = new URL(urlName);//由网址创建URL对象
URLConnection tc = url.openConnection();//获得URLConnection对象
tc.connect();//设置网络连接
InputStreamReader in = new InputStreamReader(tc.getInputStream());
BufferedReader dis = new BufferedReader(in);//采用缓冲式输入
String inline;
while ((inline = dis.readLine()) != null) {
result.append(inline + "\n");
}
dis.close();//网上资源使用结束后,数据流及时关闭
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e2) {
e2.printStackTrace();
}
return result;
}
}
|
[
"jerryweimail@gmail.com"
] |
jerryweimail@gmail.com
|
610f4f9db247a5d1e8b96782b7314ad784a0b71d
|
96e9a7e819fd9bb9b6e68d026050c47e6e6935bb
|
/Android/obj/Debug/android/src/xamarin/forms/platform/android/CellRenderer_RendererHolder.java
|
c1998b28f278a018d110f2eea2cd19897d80cd39
|
[
"MIT"
] |
permissive
|
chrispellett/Xamarin-Forms-SegmentedControl
|
d07cc9aa5f458f0d099a46dbeb5a267f8fbbc490
|
8dea57eb0d7bfa5bd9f66c663cf77ef21e31e411
|
refs/heads/master
| 2020-05-26T18:57:55.559342
| 2015-04-05T13:43:08
| 2015-04-05T13:43:08
| 28,877,767
| 44
| 26
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,098
|
java
|
package xamarin.forms.platform.android;
public class CellRenderer_RendererHolder
extends java.lang.Object
implements
mono.android.IGCUserPeer
{
static final String __md_methods;
static {
__md_methods =
"";
mono.android.Runtime.register ("Xamarin.Forms.Platform.Android.CellRenderer/RendererHolder, Xamarin.Forms.Platform.Android, Version=1.3.0.0, Culture=neutral, PublicKeyToken=null", CellRenderer_RendererHolder.class, __md_methods);
}
public CellRenderer_RendererHolder () throws java.lang.Throwable
{
super ();
if (getClass () == CellRenderer_RendererHolder.class)
mono.android.TypeManager.Activate ("Xamarin.Forms.Platform.Android.CellRenderer/RendererHolder, Xamarin.Forms.Platform.Android, Version=1.3.0.0, Culture=neutral, PublicKeyToken=null", "", this, new java.lang.Object[] { });
}
java.util.ArrayList refList;
public void monodroidAddReference (java.lang.Object obj)
{
if (refList == null)
refList = new java.util.ArrayList ();
refList.add (obj);
}
public void monodroidClearReferences ()
{
if (refList != null)
refList.clear ();
}
}
|
[
"chris.pellett@gmail.com"
] |
chris.pellett@gmail.com
|
278dc94afc18ecaffd960d040269d3b7b3265c7c
|
8ae7f2a3de5934a8177cfbd345af4245d0152f33
|
/auth-server/src/main/java/com/gedk/cloud/authserver/domain/MyUser.java
|
b15e693f07becfdcfd2bea06e22bc4acd7e90e74
|
[] |
no_license
|
gedk/gedk-spring-cloud
|
29a89823b75d8b8e71d2647392742a089702117b
|
f6a0a2b8800ea479002aaaf3e1d50c72724ef371
|
refs/heads/master
| 2022-12-01T00:44:11.259264
| 2020-05-05T07:58:43
| 2020-05-05T07:58:43
| 254,092,787
| 0
| 0
| null | 2022-11-24T03:56:56
| 2020-04-08T13:17:16
|
Java
|
UTF-8
|
Java
| false
| false
| 535
|
java
|
package com.gedk.cloud.authserver.domain;
import lombok.Getter;
import lombok.Setter;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;
import java.util.Collection;
/**
* Desc
*
* @author gedekun Email:527552959@qq.com
* @since 2020/4/8 15:14
*/
@Getter
@Setter
public class MyUser extends User {
public MyUser(String username, String password, Collection<? extends GrantedAuthority> authorities) {
super(username, password, authorities);
}
}
|
[
"527552959@qq.com"
] |
527552959@qq.com
|
9240b88666934abd28c48ca5f933dac6fff3a176
|
1f0c211b92caf7d6c887f6301ce75f295c98bb34
|
/volunteerhoursrecorder/src/main/java/com/packt/volunteerhoursrecorder/domain/AccountCredentials.java
|
8fc3c64216cfe42dc8b990880a4732e663e7b37c
|
[] |
no_license
|
danyuanwang/volunteer_hours_record_project
|
61700a624b40212a6da6633a9c07aa516da30a9c
|
9e05559817a465d71ee44c260ce304179ad81561
|
refs/heads/master
| 2020-07-07T18:39:18.148910
| 2019-10-08T04:31:41
| 2019-10-08T04:31:41
| 203,441,406
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 394
|
java
|
package com.packt.volunteerhoursrecorder.domain;
public class AccountCredentials {
private String password;
private String username;
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
}
|
[
"danyuanwang@hotmail.com"
] |
danyuanwang@hotmail.com
|
0bab055c6594865e598cb1ce543603b8559395db
|
162ff1a385170acd1bb07988d561db3efaec837e
|
/src/main/java/ru/ifmo/diplom/kirilchuk/trash/statistic/table/util/CommonUtils.java
|
d70bb269b6deedd563436ef5e23bd396d398eb19
|
[] |
no_license
|
atsikouras/jawelet
|
cde8af515e58102d33e84faa09f1981c95f6df56
|
ab2b5ab17121b652c387fda9980960a0de29f9b6
|
refs/heads/master
| 2020-05-07T09:29:54.331017
| 2015-03-15T18:18:51
| 2015-03-15T18:19:11
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 4,326
|
java
|
package ru.ifmo.diplom.kirilchuk.trash.statistic.table.util;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.DecimalFormat;
import java.util.zip.Deflater;
import java.util.zip.GZIPOutputStream;
import ru.ifmo.diplom.kirilchuk.coders.Encoder;
import ru.ifmo.diplom.kirilchuk.coders.impl.arithmetic.AdaptiveUnigramModel;
import ru.ifmo.diplom.kirilchuk.coders.impl.arithmetic.ArithEncoder;
import ru.ifmo.diplom.kirilchuk.coders.impl.fusion.FusionCodeOutputStream;
import ru.ifmo.diplom.kirilchuk.coders.impl.fusion.FusionEncoder;
import ru.ifmo.diplom.kirilchuk.coders.impl.monotone.elias.Elias3PartEncoder;
import ru.ifmo.diplom.kirilchuk.coders.io.impl.CountingBitOutput;
public class CommonUtils {
public static int countArithmeticEncodedBytes(int[][] data) throws IOException {
CountingBitOutput out1 = new CountingBitOutput();
FusionCodeOutputStream out = createFusionCoder(out1);
for (int i = 0; i < data.length; ++i) {
int[] row = data[i];
for (int k = 0; k < data[0].length; ++k) {
out.write(row[k]);
}
}
out.close();
return (out1.getBits() / 8);
}
public static FusionCodeOutputStream createFusionCoder(CountingBitOutput outBits) {
ArithEncoder arithCoder = new ArithEncoder(new AdaptiveUnigramModel());
Encoder monoCoder = new Elias3PartEncoder();
FusionEncoder encoder = new FusionEncoder(arithCoder, monoCoder);
encoder.setArithmeticCodeThreshold(127);
FusionCodeOutputStream out = new FusionCodeOutputStream(encoder, outBits, outBits);
return out;
}
public static GZIPOutputStream createGZIP(ByteArrayOutputStream stream) throws IOException {
return new GZIPOutputStream(stream) {
{
def.setLevel(Deflater.BEST_COMPRESSION);
}
};
}
public static int countBytesFromBOS(ByteArrayOutputStream stream) {
byte[] bytes = stream.toByteArray();
return bytes.length;
}
public static String formatDouble(double num) {
DecimalFormat df = new DecimalFormat("#.###");
return df.format(num);
}
public static void prettyPrint(int[][] data) {
StringBuilder sb = new StringBuilder();
for (int k = 0; k < data.length; ++k) {
int[] row = data[k];
for (int t = 0; t < data.length; ++t) {
sb.append(prettyInt(3, row[t]));
sb.append(" ");
}
sb.append("\n");
}
System.out.println(sb.toString());
}
public static void prettyPrint(int[][] data, String filePath) throws IOException {
File file = new File(filePath);
if (!file.exists()) {
file.createNewFile();
}
PrintWriter writer = new PrintWriter(file);
StringBuilder sb = new StringBuilder();
for (int k = 0; k < data.length; ++k) {
int[] row = data[k];
for (int t = 0; t < data.length; ++t) {
sb.append(prettyInt(3, row[t]));
sb.append(" ");
}
sb.append("\n");
}
writer.append(sb);
writer.close();
}
public static void prettyPrint(double[][] data, String filePath) throws IOException {
File file = new File(filePath);
if (!file.exists()) {
file.createNewFile();
}
PrintWriter writer = new PrintWriter(file);
StringBuilder sb = new StringBuilder();
for (int k = 0; k < data.length; ++k) {
double[] row = data[k];
for (int t = 0; t < data.length; ++t) {
sb.append(row[t]);
sb.append('\t');
}
sb.append("\n");
}
writer.append(sb);
writer.close();
}
private static String prettyInt(int needLen, int value) {
String res = String.valueOf(value);
StringBuilder sb = new StringBuilder(needLen);
int len = res.length();
if (len < needLen) {
for (int i = 0; i < (needLen - len); ++i) {
sb.append(' ');
}
}
sb.append(res);
return sb.toString();
}
}
|
[
"vadim.kirilchuk@macys.com"
] |
vadim.kirilchuk@macys.com
|
2183e220fa763f19cc9c8bc26b0a0d47eec0d2bd
|
c33f3e7928d3b228e367da5b48d8a63f9c82e6e5
|
/org.jbehave.eclipse/src/org/jbehave/eclipse/editor/story/completion/StepTemplateProposal.java
|
19904e68f84ca6b962bce43f187c7484ab48ad1b
|
[] |
no_license
|
jbehave/jbehave-eclipse
|
c9a1c068d6184f8fa98124fc9706984da14a4c08
|
eda3a28524a033d08700dcd366ae5a28f9aec10a
|
refs/heads/master
| 2021-07-06T21:20:31.120797
| 2018-12-12T15:08:49
| 2021-01-29T17:04:41
| 5,203,003
| 10
| 9
| null | 2021-06-07T16:42:24
| 2012-07-27T09:53:12
|
Java
|
UTF-8
|
Java
| false
| false
| 2,476
|
java
|
package org.jbehave.eclipse.editor.story.completion;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.contentassist.ICompletionProposalExtension4;
import org.eclipse.jface.text.contentassist.ICompletionProposalExtension5;
import org.eclipse.jface.text.contentassist.ICompletionProposalExtension6;
import org.eclipse.jface.text.templates.Template;
import org.eclipse.jface.text.templates.TemplateContext;
import org.eclipse.jface.text.templates.TemplateProposal;
import org.eclipse.jface.viewers.StyledString;
import org.eclipse.swt.graphics.Image;
import org.jbehave.eclipse.editor.step.LocalizedStepSupport;
import org.jbehave.eclipse.editor.step.WeightedStep;
public class StepTemplateProposal extends TemplateProposal implements
ICompletionProposalExtension4, ICompletionProposalExtension5,
ICompletionProposalExtension6, StepCompletionProposalMixin.Trait {
private final LocalizedStepSupport jbehaveProject;
private final String complete;
private final String label;
private final WeightedStep weightedStep;
public StepTemplateProposal(
LocalizedStepSupport jbehaveProject, //
Template template, TemplateContext context, IRegion region,
String complete, String label, WeightedStep weightedStep) {
super(template, context, region, null, 0);
this.jbehaveProject = jbehaveProject;
this.complete = complete;
this.label = label;
this.weightedStep = weightedStep;
}
public LocalizedStepSupport getLocalizedStepSupport() {
return jbehaveProject;
}
public boolean isAutoInsertable() {
return false;
}
public String getDisplayString() {
// by default it is <name> - <description>
return getStyledDisplayString().getString();
}
public WeightedStep getWeightedStep() {
return weightedStep;
}
public String getComplete() {
return complete;
}
public String getLabel() {
return label;
}
public StyledString getStyledDisplayString() {
return StepCompletionProposalMixin.createStyledString(this);
}
public Image getImage() {
return StepCompletionProposalMixin.getImage(this);
}
public Object getAdditionalProposalInfo(IProgressMonitor monitor) {
return StepCompletionProposalMixin.getAdditionalHTML(this);
}
}
|
[
"mauro.talevi@aquilonia.org"
] |
mauro.talevi@aquilonia.org
|
40b578262d3d977c79b96aab81752fc9a69ca7e6
|
4a25bc8c13c57a21051cadcbbb6c172f91c76758
|
/src/main/java/ru/filimonov/hotelbusinessdatagenerator/generator/DataGenerator.java
|
5cd340a362be08f7320f58b14a0313c7f02bd7a2
|
[] |
no_license
|
BigArtemka/HotelBusinessDataGenerator
|
302badac61a9b9df832b2e8f0687208a892af46b
|
7c3114b597016ae2d8c1da6dcf9392cabd8fc4b2
|
refs/heads/master
| 2023-08-14T15:13:59.313429
| 2021-09-15T01:03:00
| 2021-09-15T01:03:00
| 404,397,703
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,717
|
java
|
package ru.filimonov.hotelbusinessdatagenerator.generator;
import org.springframework.core.io.ClassPathResource;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.sql.Time;
import java.util.List;
import java.util.Random;
public class DataGenerator {
private static final Random r = new Random();
private static final int millisInDay = 24 * 60 * 60 * 1000;
public static String generateText() {
int length = r.nextInt(200);
String s = r.ints(48, 122)
.filter(i -> (i < 57 || i > 65) && (i < 90 || i > 97))
.mapToObj(i -> (char) i)
.limit(length)
.collect(StringBuilder::new, StringBuilder::append, StringBuilder::append)
.toString();
return s;
}
public static String generatePhone() {
return String.format("+7(9%d%d)%d%d%d-%d%d-%d%d", r.nextInt(10),
r.nextInt(10), r.nextInt(10), r.nextInt(10),
r.nextInt(10), r.nextInt(10), r.nextInt(10),
r.nextInt(10), r.nextInt(10));
}
public static Integer generatePrice() {
return 1000 + r.nextInt(10) * r.nextInt(10) * 1000;
}
public static String generateImageUrl() throws IOException {
File resource = new ClassPathResource("room.txt").getFile();
final List<String> urlsList = Files.readAllLines(resource.toPath());
return urlsList.get(r.nextInt(urlsList.size()));
}
public static Time[] generateTimeInterval() {
Time start = new Time(r.nextInt(millisInDay));
Time end = new Time(start.getTime() + r.nextInt(1000 * 60 * 60));
return new Time[]{start, end};
}
}
|
[
"dak.112008@gmail.com"
] |
dak.112008@gmail.com
|
72f409304250120ffa2563a831e60620e028cd11
|
937ac2cf70b59da8f5eb77511224fcdcc2f01d77
|
/micro-iot-service/src/main/java/com/solitardj9/microiot/serviceInterface/thing/thingManagerInterface/model/request/RequestCreateThing.java
|
c810ee4c7c65f6c08e66cd87f93bdcb9e79988dd
|
[
"Apache-2.0"
] |
permissive
|
solitardj9/micro-iot-service
|
f6daa40176c01569ccdd80d1698f3c496baeb2d9
|
ddf590b0efbf0c2997620c18be39f0f8921ae508
|
refs/heads/master
| 2023-01-08T02:33:03.270103
| 2020-10-30T02:31:50
| 2020-10-30T02:31:50
| 287,705,501
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 558
|
java
|
package com.solitardj9.microiot.serviceInterface.thing.thingManagerInterface.model.request;
import com.solitardj9.microiot.serviceInterface.thing.thingManagerInterface.model.common.AttributePayload;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper=false)
public class RequestCreateThing extends RequestDefault {
private AttributePayload attributePayload;
private String thingTypeName;
}
|
[
"HoYoung.Rhee@DESKTOP-AR0O3VE"
] |
HoYoung.Rhee@DESKTOP-AR0O3VE
|
0053a5eb255a8a8cf7a7fb321e4ae8a5267b8d7e
|
45f1148eff52ca72a108e419856272503ea50d86
|
/core/src/test/java/cosmos/results/integration/GroupByIntegrationTest.java
|
df5e8fa778e4499a41f093d3ccdb4d1ec82a7c77
|
[
"Apache-2.0",
"CC-BY-SA-3.0"
] |
permissive
|
joshelser/cosmos
|
77a44b1e6bd06dd9590c048dd888ba555b68d06b
|
6b5cf3db5cbdf01a753d0d039a476fe002efeafa
|
refs/heads/master
| 2023-08-14T14:39:08.580918
| 2013-10-14T04:05:26
| 2013-10-14T04:05:26
| 11,857,228
| 3
| 1
|
Apache-2.0
| 2023-06-27T04:59:45
| 2013-08-03T03:29:01
|
Java
|
UTF-8
|
Java
| false
| false
| 7,659
|
java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with this
* work for additional information regarding copyright ownership. The ASF
* licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*
* Copyright 2013 Josh Elser
*
*/
package cosmos.results.integration;
import java.io.File;
import java.util.Map;
import java.util.Map.Entry;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.ZooKeeperInstance;
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.security.ColumnVisibility;
import org.apache.accumulo.minicluster.MiniAccumuloCluster;
import org.apache.accumulo.minicluster.MiniAccumuloConfig;
import org.apache.curator.test.TestingServer;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
import com.google.common.collect.Sets;
import com.google.common.io.Files;
import cosmos.Cosmos;
import cosmos.IntegrationTests;
import cosmos.impl.CosmosImpl;
import cosmos.options.Defaults;
import cosmos.options.Index;
import cosmos.records.Record;
import cosmos.records.impl.MultimapRecord;
import cosmos.records.values.RecordValue;
import cosmos.results.CloseableIterable;
import cosmos.results.Column;
import cosmos.store.Store;
/**
*
*/
@Category(IntegrationTests.class)
public class GroupByIntegrationTest {
public static MiniAccumuloConfig conf;
public static MiniAccumuloCluster mac;
protected Cosmos sorts;
protected ZooKeeperInstance inst;
protected Connector con;
protected static TestingServer zk;
@BeforeClass
public static void setupMAC() throws Exception {
File tmp = Files.createTempDir();
tmp.deleteOnExit();
conf = new MiniAccumuloConfig(tmp, "foo");
conf.setNumTservers(2);
mac = new MiniAccumuloCluster(conf);
mac.start();
ZooKeeperInstance zkInst = new ZooKeeperInstance(mac.getInstanceName(), mac.getZooKeepers());
Connector con = zkInst.getConnector("root", new PasswordToken("foo"));
con.tableOperations().create(Defaults.DATA_TABLE);
con.tableOperations().create(Defaults.METADATA_TABLE);
zk = new TestingServer();
}
@AfterClass
public static void stopMAC() throws Exception {
mac.stop();
}
@Before
public void setupSorts() throws Exception {
sorts = new CosmosImpl(zk.getConnectString());
inst = new ZooKeeperInstance(mac.getInstanceName(), mac.getZooKeepers());
con = inst.getConnector("root", new PasswordToken("foo"));
}
@After
public void closeSorts() throws Exception {
sorts.close();
}
@Test
public void simpleNonSparseRecordTest() throws Exception {
Store id = Store.create(con, new Authorizations(), Sets.newHashSet(Index.define("NAME"),
Index.define("AGE"), Index.define("STATE"), Index.define("COLOR")));
// Register the ID with the implementation
sorts.register(id);
final ColumnVisibility cv = new ColumnVisibility("");
Multimap<Column,RecordValue<?>> data = HashMultimap.create();
data.put(Column.create("NAME"), RecordValue.create("Josh", cv));
data.put(Column.create("AGE"), RecordValue.create("24", cv));
data.put(Column.create("STATE"), RecordValue.create("MD", cv));
data.put(Column.create("COLOR"), RecordValue.create("Blue", cv));
MultimapRecord mqr1 = new MultimapRecord(data, "1", cv);
data = HashMultimap.create();
data.put(Column.create("NAME"), RecordValue.create("Wilhelm", cv));
data.put(Column.create("AGE"), RecordValue.create("25", cv));
data.put(Column.create("STATE"), RecordValue.create("MD", cv));
data.put(Column.create("COLOR"), RecordValue.create("Pink", cv));
MultimapRecord mqr2 = new MultimapRecord(data, "2", cv);
data = HashMultimap.create();
data.put(Column.create("NAME"), RecordValue.create("Marky", cv));
data.put(Column.create("AGE"), RecordValue.create("29", cv));
data.put(Column.create("STATE"), RecordValue.create("MD", cv));
data.put(Column.create("COLOR"), RecordValue.create("Blue", cv));
MultimapRecord mqr3 = new MultimapRecord(data, "3", cv);
// Add our data
sorts.addResults(id, Lists.<Record<?>> newArrayList(mqr3, mqr2, mqr1));
// Testing NAME
Map<RecordValue<?>,Long> expects = ImmutableMap.<RecordValue<?>,Long> of(
RecordValue.create("Josh", cv), 1l,
RecordValue.create("Wilhelm", cv), 1l,
RecordValue.create("Marky", cv), 1l);
CloseableIterable<Entry<RecordValue<?>,Long>> countedResults = sorts.groupResults(id, Column.create("NAME"));
int resultCount = 0;
for (Entry<RecordValue<?>,Long> entry : countedResults) {
resultCount++;
Assert.assertTrue(expects.containsKey(entry.getKey()));
Assert.assertEquals(expects.get(entry.getKey()), entry.getValue());
}
countedResults.close();
Assert.assertEquals(expects.size(), resultCount);
// TEesting AGE
expects = ImmutableMap.<RecordValue<?>,Long> of(
RecordValue.create("24", cv), 1l,
RecordValue.create("25", cv), 1l,
RecordValue.create("29", cv), 1l);
countedResults = sorts.groupResults(id, Column.create("AGE"));
resultCount = 0;
for (Entry<RecordValue<?>,Long> entry : countedResults) {
resultCount++;
Assert.assertTrue(expects.containsKey(entry.getKey()));
Assert.assertEquals(expects.get(entry.getKey()), entry.getValue());
}
countedResults.close();
Assert.assertEquals(expects.size(), resultCount);
// Testing STATE
expects = ImmutableMap.<RecordValue<?>,Long> of(RecordValue.create("MD", cv), 3l);
countedResults = sorts.groupResults(id, Column.create("STATE"));
resultCount = 0;
for (Entry<RecordValue<?>,Long> entry : countedResults) {
resultCount++;
Assert.assertTrue(expects.containsKey(entry.getKey()));
Assert.assertEquals(expects.get(entry.getKey()), entry.getValue());
}
countedResults.close();
Assert.assertEquals(expects.size(), resultCount);
// Testing COLOR
expects = ImmutableMap.<RecordValue<?>,Long> of(
RecordValue.create("Blue", cv), 2l,
RecordValue.create("Pink", cv), 1l);
countedResults = sorts.groupResults(id, Column.create("COLOR"));
resultCount = 0;
for (Entry<RecordValue<?>,Long> entry : countedResults) {
resultCount++;
Assert.assertTrue(expects.containsKey(entry.getKey()));
Assert.assertEquals(expects.get(entry.getKey()), entry.getValue());
}
countedResults.close();
Assert.assertEquals(expects.size(), resultCount);
}
}
|
[
"josh.elser@gmail.com"
] |
josh.elser@gmail.com
|
18331faa1e1db626695a4c0ecc77415e62c702c7
|
70b6f60eeb5b99a77e863fedc036b0469e9e3142
|
/AndroidTerminal/app/src/main/java/com/example/raducazacu/speedsensormonitor/Preferences.java
|
634352c6c4f9568051fc4b8aad1006f4d109f7ed
|
[] |
no_license
|
raducaz/Speedometer
|
7d17c40610f3a81e9bd7fc55bd3d90e73ae794af
|
c7184e5f3cc082357a0ce2361d1a7975362c439b
|
refs/heads/master
| 2021-09-08T16:33:18.609929
| 2021-09-07T20:25:52
| 2021-09-07T20:25:52
| 77,468,567
| 0
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 4,423
|
java
|
package com.example.raducazacu.speedsensormonitor;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.EditTextPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
public class Preferences extends PreferenceActivity implements SharedPreferences.OnSharedPreferenceChangeListener {
private static final String TAG = "Preferences";
private static final String DEF_VALUE = "Not Set";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
}
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
CharSequence value = DEF_VALUE;
Preference pref = findPreference(key);
updatePrefSummary(key, pref);
}
@Override
protected void onResume() {
super.onResume();
// Setup the initial values
setAllSummaries();
// Set up a listener whenever a key changes
PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(this);
}
@Override
protected void onPause() {
super.onPause();
// Unregister the listener whenever a key changes
PreferenceManager.getDefaultSharedPreferences(this).unregisterOnSharedPreferenceChangeListener(this);
}
private void setAllSummaries() {
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
Map<String, ?> map = sharedPreferences.getAll();
Set<String> keySet = map.keySet();
Iterator<String> it = keySet.iterator();
while (it.hasNext()) {
String key = it.next();
Preference pref = findPreference(key);
if (pref != null) {
updatePrefSummary(key, pref);
}
}
}
private void updatePrefSummary(String key, Preference p){
CharSequence value = DEF_VALUE;
CharSequence summary = getSummaryForKey(key);
if (p instanceof ListPreference) {
ListPreference listPref = (ListPreference) p;
value = listPref.getEntry();
} else if (p instanceof CheckBoxPreference) {
value = null;
} else if (p instanceof EditTextPreference) {
EditTextPreference editTextPref = (EditTextPreference) p;
value = editTextPref.getText();
}
// Do not show value if it is NULL
if (value == null) {
p.setSummary(summary);
} else {
p.setSummary(summary + ": " + value);
}
}
private String getSummaryForKey(String key) {
String summary = null;
if (getString(R.string.pref_wheel_size).equals(key)) {
summary = getString(R.string.pref_wheel_size);
}
// else if ( getString(R.string.pref_display_orientation_key).equals(key)) {
// summary = getString(R.string.pref_display_orientation_summary);
//
// } else if ( getString(R.string.pref_keyboard_type_key).equals(key)) {
// summary = getString(R.string.pref_keyboard_type_summary);
//
// } else if ( getString(R.string.pref_show_keyboard_key).equals(key)) {
// summary = getString(R.string.pref_show_keyboard_summary);
//
// } else if (getString(R.string.pref_local_echo_key).equals(key)) {
// summary = getString(R.string.pref_local_echo_summary);
//
// } else if ( getString(R.string.pref_clear_action_key).equals(key)) {
// summary = getString(R.string.pref_clear_action_summary);
//
// } else if ( getString(R.string.pref_display_colors_key).equals(key)) {
// summary = getString(R.string.pref_display_colors_summary);
//
// } else if ( getString(R.string.pref_font_size_key).equals(key)) {
// summary = getString(R.string.pref_font_size_summary);
//
// } else if ( getString(R.string.pref_font_typeface_key).equals(key)) {
// summary = getString(R.string.pref_font_typeface_summary);
//
// }
return summary;
}
}
|
[
"raducaz@gmail.com"
] |
raducaz@gmail.com
|
43183635ada60c75dc151a385b36686625fd94e6
|
ec3dcc9915916eb6b9369469f73ce33afd20f5a9
|
/Java_Basics_2/src/LogicalOperators/OROperator.java
|
aef25318d4b53fe6334859f6086b18ab6f670439
|
[] |
no_license
|
sagarsomaiah98/SEP-WEEKEND-BATCH
|
af5ef672bfbd2c2be3c7a335c7fe6792c9a02583
|
a2525c073187dff54d5681909035b0469d7c33c9
|
refs/heads/main
| 2023-08-24T11:44:41.004397
| 2021-11-04T02:02:36
| 2021-11-04T02:02:36
| 403,043,398
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 295
|
java
|
package LogicalOperators;
public class OROperator {
public static void main(String[] args) {
// TODO Auto-generated method stub
int a=900;int b=500 ;
if(a>b || a==b)
System.out.println("a is bigger or a is equal to b");
else
System.out.println("a is not bigger");
}
}
|
[
"somaiah1988@gmail.com"
] |
somaiah1988@gmail.com
|
6ebbc9fc81f79e12e994b871030d3a57f2874190
|
0ed457cbdf0e2ff705fbad65e492471d251e4cbc
|
/daut-re/src/main/java/pl/edu/amu/wmi/daut/re/BinaryRegexpOperatorFactory.java
|
1edc168feb8349b9d826e3826ed818104c0f9edb
|
[] |
no_license
|
kasia1404/amu_automata_2011
|
24c80d7cca91377c185932d8b83f378d42cb0310
|
b0a3d72d83e3bf58ad08f3f3db1d575c0b4bfb94
|
refs/heads/master
| 2020-12-25T00:09:24.334684
| 2012-04-03T13:51:36
| 2012-04-03T13:51:36
| 2,910,310
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 224
|
java
|
package pl.edu.amu.wmi.daut.re;
/**
* Fabryka operatorów binarnych.
*/
public abstract class BinaryRegexpOperatorFactory extends RegexpOperatorFactory {
@Override
public int arity() {
return 2;
}
}
|
[
"turboelo.2.0@gmail.com"
] |
turboelo.2.0@gmail.com
|
e83b0b24c388057f6c8585156438a3a884475cb2
|
e949f53bfb5392902af9299c67858aa83b071779
|
/Testing.java
|
d227e8d6e575da0ebd9bed8a31635f14bdc902bb
|
[] |
no_license
|
RavindraKesapure/JavaBasicPrograms
|
d9d697f27c593cbf8f2ba7ab6ed291dad4ee1a2e
|
48e23668d4411f7780ad5f9362602f8d4fe0c5df
|
refs/heads/main
| 2023-02-21T08:34:31.642988
| 2021-01-27T15:13:49
| 2021-01-27T15:13:49
| 333,059,031
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 485
|
java
|
package com.ravi.basicPrograms;
public class Testing {
public static void main(String[] args) {
int count=0,p=0,row=5;
for(int i=0; i<row; i++)
{
count=1;
p=0;
for(int j=row; j>i; j--)
{
if(j>=row- i)
{
System.out.print(count+" ");
count=count*(i-p)/(p+1);
p++;
}
else
{
System.out.print(" ");
}
}
System.out.println();
}
}
}
|
[
"noreply@github.com"
] |
noreply@github.com
|
8aaf393193b7ab387652b716bff5e6453b13e144
|
c6ea0f73f66741b07fe05b89f239e4fdf734be91
|
/src/main/java/io/vertx/lang/php/PhpVerticleFactory.java
|
1d9e56554f7831c1bb50f846267b61ac50551fa8
|
[
"MIT"
] |
permissive
|
alwinmark/vertx-php
|
cf4ecb61478245a393375574ffddb5fe38c73e7f
|
6021d8dc07d0488fa64f69accd6eef2d70354a5e
|
refs/heads/master
| 2020-05-18T07:24:20.305549
| 2013-08-23T19:13:07
| 2013-08-23T19:13:07
| 12,294,736
| 3
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 6,821
|
java
|
/*
* Copyright 2013 the original author or authors.
*
* Licensed under the MIT License (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://opensource.org/licenses/MIT
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.vertx.lang.php;
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import org.vertx.java.core.VertxException;
import org.vertx.java.core.logging.Logger;
import org.vertx.java.platform.Verticle;
import org.vertx.java.platform.VerticleFactory;
import com.caucho.quercus.Location;
import com.caucho.quercus.QuercusContext;
import com.caucho.quercus.QuercusDieException;
import com.caucho.quercus.QuercusEngine;
import com.caucho.quercus.QuercusException;
import com.caucho.quercus.QuercusExitException;
import com.caucho.quercus.env.Env;
/**
* A PHP verticle factory.
*
* The PHP implementation is run on the Java-based Quercus PHP engine.
*
* @author Jordan Halterman
*/
public class PhpVerticleFactory implements VerticleFactory {
private ClassLoader cl;
public static org.vertx.java.core.Vertx vertx;
public static org.vertx.java.platform.Container container;
/**
* Initializes the factory.
*/
@Override
public void init(org.vertx.java.core.Vertx vertx, org.vertx.java.platform.Container container, ClassLoader cl) {
this.cl = cl;
PhpVerticleFactory.vertx = vertx;
PhpVerticleFactory.container = container;
}
/**
* Creates a verticle instance.
*/
@Override
public Verticle createVerticle(String main) throws Exception {
return new PhpVerticle(findScript(main));
}
/**
* Finds the full path to a PHP script.
*/
private String findScript(String script) {
try {
File scriptFile = new File(cl.getResource(script).toURI());
if (scriptFile.exists()) {
return scriptFile.toPath().toString();
}
}
catch (URISyntaxException ignored) {}
return null;
}
/**
* Reports an exception in the verticle.
*/
@Override
public void reportException(Logger logger, Throwable t) {
// A Quercus language exception.
if (t instanceof QuercusException) {
Env env = Env.getCurrent();
Location location = env.getLocation();
logger.error("\nAn exception occured in a PHP verticle.");
// TODO: This stack trace should show only PHP related called, not
// Java calls. Currently it only shows the trace of Java code execution.
// logger.error(env.getStackTraceAsString(t, env.getLocation()) + "\n");
String className = location.getClassName();
String funcName = location.getFunctionName();
if (funcName != null && funcName != "NULL" && !funcName.startsWith("__quercus_")) {
if (className != "NULL" && funcName != "NULL" && !funcName.startsWith("__quercus_")) {
logger.error(String.format("%s in %s on line %d in %s::%s()", t.getMessage(), location.getFileName(),
location.getLineNumber(), className, funcName));
}
else {
logger.error(String.format("%s in %s on line %d in %s()", t.getMessage(), location.getFileName(),
location.getLineNumber(), funcName));
}
}
else {
logger.error(String.format("%s in %s on line %d", t.getMessage(), location.getFileName(),
location.getLineNumber()));
}
}
else {
t.printStackTrace();
}
}
/**
* Closes the verticle.
*/
@Override
public void close() {
}
/**
* A PHP Verticle that runs PHP scripts via Quercus.
*/
private class PhpVerticle extends Verticle {
/**
* The path to the verticle PHP script.
*/
private final String script;
/**
* A Quercus script engine instance.
*/
QuercusEngine engine;
PhpVerticle(String script) {
this.script = script;
}
/**
* Starts the verticle.
*/
@Override
public void start() {
engine = new QuercusEngine();
QuercusContext context = engine.getQuercus();
// Setting PHP's error_reporting to 0 makes Quercus give us more
// interesting exception messages and thus better error reporting.
context.setIni("error_reporting", "0");
// Make vertx-php classes available in the PHP code context.
// Note that for now we only make available classes which should
// be instantiated outside the context of the internal Vert.x
// library. However, once default constructors have been supplied
// for the various wrapper classes, we should expose as many classes
// as possible for extensibility's sake.
context.addJavaClass("Vertx", io.vertx.lang.php.Vertx.class);
context.addJavaClass("Vertx\\Http\\HttpServer", io.vertx.lang.php.http.HttpServer.class);
context.addJavaClass("Vertx\\Http\\HttpClient", io.vertx.lang.php.http.HttpClient.class);
context.addJavaClass("Vertx\\Http\\RouteMatcher", io.vertx.lang.php.http.RouteMatcher.class);
context.addJavaClass("Vertx\\Net\\NetServer", io.vertx.lang.php.net.NetServer.class);
context.addJavaClass("Vertx\\Net\\NetClient", io.vertx.lang.php.net.NetClient.class);
context.addJavaClass("Vertx\\Net\\NetSocket", io.vertx.lang.php.net.NetSocket.class);
context.addJavaClass("Vertx\\Buffer", io.vertx.lang.php.buffer.Buffer.class);
context.addJavaClass("Vertx\\Logger", org.vertx.java.core.logging.Logger.class);
context.addJavaClass("Vertx\\Pump", io.vertx.lang.php.streams.Pump.class);
context.addJavaClass("Vertx\\ParseTools\\RecordParser", io.vertx.lang.php.parsetools.RecordParser.class);
// Add PHP test helpers.
context.addJavaClass("Vertx\\Test\\TestRunner", io.vertx.lang.php.testtools.PhpTestRunner.class);
context.addJavaClass("Vertx\\Test\\PhpTestCase", io.vertx.lang.php.testtools.PhpTestCase.class);
// Evaluate a single line script which includes the verticle
// script. This ensures that exceptions can be accurately logged
// because Quercus will record actual file names rather than a
// generic "eval" name.
try {
engine.execute(String.format("<?php require '%s'; ?>", script));
}
catch (QuercusDieException e) {
// The interpreter died, do nothing.
}
catch (QuercusExitException e) {
// The interpreter exiting cleanly, do nothing.
}
catch (IOException e) {
throw new VertxException(e);
}
}
}
}
|
[
"jordan.halterman@gmail.com"
] |
jordan.halterman@gmail.com
|
58edbbc1924c3f0af410b4447d91f6741d12bb59
|
ed18e873a252a7a928fa46d58042d05bce88d08e
|
/src/HW2/MergeSort.java
|
5dc47b9c8d421eeec016ce4fa47f6ca82ef686d5
|
[] |
no_license
|
connormorrison1/Sorting
|
d770178721965ddba176a568a033d93380393451
|
ed3baf36f24b292f3dc92ae5b69a04f41ae0c3ee
|
refs/heads/master
| 2022-04-08T04:06:59.034093
| 2020-02-17T21:09:04
| 2020-02-17T21:09:04
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,987
|
java
|
package HW2;
/*This code had been influenced by code from Rajat Mishra
from https://www.geeksforgeeks.org/merge-sort/
*/
public class MergeSort implements SortBehavior {
@Override
public int[] mathSort(int [] array) {
System.out.println("Merge sort");
int mid = array.length/2;
array = mathSort(array, 0, mid);
array = mathSort(array, mid+1, array.length-1);
array = merge(array,0,mid,array.length-1);
return array;
}
private int[] mathSort(int[] array, int front, int back){
if(front < back){
int mid = (front + back)/2;
array = mathSort(array,front, mid);
array = mathSort(array, mid+1,back);
array = merge(array, front, mid, back);
}
return array;
}
private int[] merge(int[] array, int front, int mid, int back){
int firstHalf = mid-front+1;
int secondHalf = back-mid;
int firstArr[] = new int[firstHalf];
int secondArr[] = new int[secondHalf];
System.arraycopy(array,front,firstArr,0,firstHalf);
System.arraycopy(array,mid+1,secondArr,0,secondHalf);
int inital1 =0;
int intital2 =0;
int inital3 =front;
while(inital1<firstHalf&&intital2<secondHalf){
if(firstArr[inital1]<=secondArr[intital2]){
array[inital3] = firstArr[inital1];
inital1++;
}else {
array[inital3] = secondArr[intital2];
intital2++;
}
inital3++;
}
while (inital1 < firstHalf){
array[inital3] = firstArr[inital1];
inital1++;
inital3++;
}
while (intital2<secondHalf){
array[inital3] = secondArr[intital2];
intital2++;
inital3++;
}
return array;
}
}
/*This code had been influenced by code from Rajat Mishra
from https://www.geeksforgeeks.org/merge-sort/
*/
|
[
"connormorrison@montana.edu"
] |
connormorrison@montana.edu
|
043d93c0ca2b3e4e0abab4545310cf5e48a7d0c7
|
d07afe443ae012093c993abf7e31f26745faa90e
|
/source/src/main/java/spoon/experimental/modelobs/EmptyModelChangeListener.java
|
e2440ba839904fd326927ec25bf9dd804586b859
|
[] |
no_license
|
pvojtechovsky/sonarqube-repair
|
3041d843ab6c74c4621a588cd27a9294dcfbdcc6
|
59a6119be0171ab97839ddff36a4fa2ab589a5e5
|
refs/heads/master
| 2020-03-20T22:20:31.230897
| 2018-06-18T18:51:24
| 2018-06-18T18:51:24
| 137,793,391
| 0
| 0
| null | 2018-06-18T18:52:38
| 2018-06-18T18:52:38
| null |
UTF-8
|
Java
| false
| false
| 3,399
|
java
|
/**
* Copyright (C) 2006-2018 INRIA and contributors
* Spoon - http://spoon.gforge.inria.fr/
*
* This software is governed by the CeCILL-C License under French law and
* abiding by the rules of distribution of free software. You can use, modify
* and/or redistribute the software under the terms of the CeCILL-C license as
* circulated by CEA, CNRS and INRIA at http://www.cecill.info.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the CeCILL-C License for more details.
*
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL-C license and that you accept its terms.
*/
package spoon.experimental.modelobs;
import spoon.reflect.declaration.CtElement;
import spoon.reflect.declaration.ModifierKind;
import spoon.reflect.path.CtRole;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* is the listener that creates the action on the model. This default listener does nothing.
*/
public class EmptyModelChangeListener implements FineModelChangeListener {
@Override
public void onObjectUpdate(CtElement currentElement, CtRole role,
CtElement newValue, CtElement oldValue) {
}
@Override
public void onObjectUpdate(CtElement currentElement, CtRole role,
Object newValue, Object oldValue) {
}
@Override
public void onObjectDelete(CtElement currentElement, CtRole role,
CtElement oldValue) {
}
@Override
public void onListAdd(CtElement currentElement, CtRole role, List field,
CtElement newValue) {
}
@Override
public void onListAdd(CtElement currentElement, CtRole role, List field,
int index, CtElement newValue) {
}
@Override
public void onListDelete(CtElement currentElement, CtRole role, List field,
Collection<? extends CtElement> oldValue) {
for (CtElement ctElement : oldValue) {
onListDelete(currentElement, role, field, field.indexOf(ctElement), ctElement);
}
}
@Override
public void onListDelete(CtElement currentElement, CtRole role, List field,
int index, CtElement oldValue) {
}
@Override
public void onListDeleteAll(CtElement currentElement, CtRole role,
List field, List oldValue) {
}
@Override
public <K, V> void onMapAdd(CtElement currentElement, CtRole role,
Map<K, V> field, K key, CtElement newValue) {
}
@Override
public <K, V> void onMapDeleteAll(CtElement currentElement, CtRole role,
Map<K, V> field, Map<K, V> oldValue) {
}
@Override
public void onSetAdd(CtElement currentElement, CtRole role, Set field,
CtElement newValue) {
}
@Override
public <T extends Enum> void onSetAdd(CtElement currentElement, CtRole role, Set field,
T newValue) {
}
@Override
public void onSetDelete(CtElement currentElement, CtRole role, Set field,
CtElement oldValue) {
}
@Override
public void onSetDelete(CtElement currentElement, CtRole role, Set field, Collection<ModifierKind> oldValue) {
for (ModifierKind modifierKind : oldValue) {
onSetDelete(currentElement, role, field, modifierKind);
}
}
@Override
public void onSetDelete(CtElement currentElement, CtRole role, Set field,
ModifierKind oldValue) {
}
@Override
public void onSetDeleteAll(CtElement currentElement, CtRole role, Set field,
Set oldValue) {
}
}
|
[
"ashutosh1598@yahoo.com.au"
] |
ashutosh1598@yahoo.com.au
|
b2a55d501f30670dd1a9033bc0a943a913466e97
|
0bff2461c2aad72050b4a356778c558db5c3ac3b
|
/AIDL/AIDL Demo/src/main/java/jp/sinya/test/aidldemo/Book.java
|
df7b9714b0d957a05fb9ab6686160b6fa9b663c0
|
[
"Apache-2.0"
] |
permissive
|
KoizumiSinya/DemoProject
|
e189de2a80b2fde7702c51fa715d072053fe3169
|
01aae447bdc02b38b73b2af085e3e28e662764be
|
refs/heads/master
| 2021-06-08T05:03:22.975363
| 2021-06-01T09:39:08
| 2021-06-01T09:39:08
| 168,299,197
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 921
|
java
|
package jp.sinya.test.aidldemo;
import android.os.Parcel;
import android.os.Parcelable;
/**
* @author KoizumiSinya
* @date 2016/12/05. 13:52
* @editor
* @date
*/
public class Book implements Parcelable {
public int bookId;
public String bookName;
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel parcel, int i) {
parcel.writeInt(bookId);
parcel.writeString(bookName);
}
public static final Parcelable.Creator<Book> CREATOR = new Creator<Book>() {
@Override
public Book createFromParcel(Parcel parcel) {
return new Book(parcel);
}
@Override
public Book[] newArray(int i) {
return new Book[i];
}
};
private Book(Parcel in) {
bookId = in.readInt();
bookName = in.readString();
}
Parcelable Book;
}
|
[
"haoqqjy@163.com"
] |
haoqqjy@163.com
|
a2c49194781be03e692c798884d8bffc6457cc79
|
82b794d54736ee56715cd8e9b483cea59300e2ee
|
/src/main/java/com/openobj/kr/model/BoardVo.java
|
ab060cccf65ec788f96da497a086b5008b15a118
|
[] |
no_license
|
annieJeong/SimpleSpringProject
|
48f4077e273ef6ae29ccd0c3d977e7e528d6d0d3
|
cf2dd7a58c49acf26aa45dc2ffd96c648173e407
|
refs/heads/master
| 2020-09-06T04:17:40.012997
| 2017-06-26T07:59:24
| 2017-06-26T07:59:24
| 94,399,964
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,084
|
java
|
package com.openobj.kr.model;
public class BoardVo {
private int BOARD_IDX;
private String BOARD_TITLE;
private String BOARD_STR;
private String BOARD_SETDATE;
private String BOARD_UPDATE;
private String BOARD_USRNAME;
public BoardVo() {
super();
}
@Override
public String toString() {
return "BoardVo [BOARD_IDX=" + BOARD_IDX + ", BOARD_TITLE=" + BOARD_TITLE + ", BOARD_STR=" + BOARD_STR
+ ", BOARD_SETDATE=" + BOARD_SETDATE + ", BOARD_UPDATE=" + BOARD_UPDATE + ", BOARD_USRNAME="
+ BOARD_USRNAME + "]";
}
public BoardVo(int bOARD_IDX, String bOARD_TITLE, String bOARD_STR, String bOARD_SETDATE, String bOARD_UPDATE,
String bOARD_USRNAME) {
super();
BOARD_IDX = bOARD_IDX;
BOARD_TITLE = bOARD_TITLE;
BOARD_STR = bOARD_STR;
BOARD_SETDATE = bOARD_SETDATE;
BOARD_UPDATE = bOARD_UPDATE;
BOARD_USRNAME = bOARD_USRNAME;
}
public BoardVo(String bOARD_TITLE, String bOARD_STR, String bOARD_SETDATE, String bOARD_UPDATE,
String bOARD_USRNAME) {
super();
BOARD_TITLE = bOARD_TITLE;
BOARD_STR = bOARD_STR;
BOARD_SETDATE = bOARD_SETDATE;
BOARD_UPDATE = bOARD_UPDATE;
BOARD_USRNAME = bOARD_USRNAME;
}
public int getBOARD_IDX() {
return BOARD_IDX;
}
public void setBOARD_IDX(int bOARD_IDX) {
BOARD_IDX = bOARD_IDX;
}
public String getBOARD_TITLE() {
return BOARD_TITLE;
}
public void setBOARD_TITLE(String bOARD_TITLE) {
BOARD_TITLE = bOARD_TITLE;
}
public String getBOARD_STR() {
return BOARD_STR;
}
public void setBOARD_STR(String bOARD_STR) {
BOARD_STR = bOARD_STR;
}
public String getBOARD_SETDATE() {
return BOARD_SETDATE;
}
public void setBOARD_SETDATE(String bOARD_SETDATE) {
BOARD_SETDATE = bOARD_SETDATE;
}
public String getBOARD_UPDATE() {
return BOARD_UPDATE;
}
public void setBOARD_UPDATE(String bOARD_UPDATE) {
BOARD_UPDATE = bOARD_UPDATE;
}
public String getBOARD_USRNAME() {
return BOARD_USRNAME;
}
public void setBOARD_USRNAME(String bOARD_USRNAME) {
BOARD_USRNAME = bOARD_USRNAME;
}
}
|
[
"open@DESKTOP-JF78AF9"
] |
open@DESKTOP-JF78AF9
|
f0586219c6b75f5375a1c58f2db6c7ce35ec7af8
|
2f416f38f7d1569f7e54718a452345b9dc874824
|
/forcastio/src/main/java/ch/rasc/forcastio/model/FioDataBlock.java
|
3e42283960061cffdbd4f425673f404a0df2dc7f
|
[] |
no_license
|
takuya152005/playground
|
975908c98c4c30f257fbf618b096b9f98607f6ce
|
1593ad6cce47566f41cd774b88ec0e40ccc0dff5
|
refs/heads/master
| 2021-01-18T09:27:17.226578
| 2015-01-18T14:01:31
| 2015-01-18T14:01:31
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,799
|
java
|
package ch.rasc.forcastio.model;
import java.util.List;
import ch.rasc.forcastio.converter.FioIconDeserializer;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
/**
* A data block object represents the various weather phenomena occurring over a period of
* time.
*
* Ideally, the minutely data block will contain data for the next hour, the hourly data
* block for the next two days, and the daily data block for the next week; however, if we
* are lacking data for a given time period, the data point sequence may contain gaps or
* terminate early. Furthermore, if no data points for a time period are known, then the
* data block will be omitted from the response in its entirety.
*/
@SuppressWarnings("unused")
@JsonIgnoreProperties(ignoreUnknown = true)
public class FioDataBlock {
private String summary;
@JsonDeserialize(using = FioIconDeserializer.class)
private FioIcon icon;
private List<FioDataPoint> data;
/**
* A human-readable text summary of this data block.
*/
public String getSummary() {
return summary;
}
/**
* A machine-readable text summary of this data block
*/
public FioIcon getIcon() {
return icon;
}
/**
* An array of data point objects, ordered by time, which together describe the
* weather conditions at the requested location over time.
*/
public List<FioDataPoint> getData() {
return data;
}
private void setSummary(String summary) {
this.summary = summary;
}
private void setIcon(FioIcon icon) {
this.icon = icon;
}
private void setData(List<FioDataPoint> data) {
this.data = data;
}
@Override
public String toString() {
return "FioDataBlock [summary=" + summary + ", icon=" + icon + ", data=" + data
+ "]";
}
}
|
[
"ralphschaer@gmail.com"
] |
ralphschaer@gmail.com
|
b384983feb7d35cbc2df335b25523ea686e81681
|
0b318a1049e839a1779e76a10aa41ad34e5a50af
|
/app/src/main/java/cn/ucai/dbtext/MainActivity.java
|
2d7300e191bd37b6e2f1f886b36f50d45aa21507
|
[] |
no_license
|
a123456w/SQLite
|
957152529617558535b3cfb07958b202a0330433
|
07f8ca6dafcc71379909b40ff715a83b488bab74
|
refs/heads/master
| 2021-01-25T01:21:49.470055
| 2017-06-19T07:51:16
| 2017-06-19T07:51:16
| 94,750,602
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,439
|
java
|
package cn.ucai.dbtext;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.EditText;
import android.widget.Toast;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class MainActivity extends AppCompatActivity {
private Dao dao;
@BindView(R.id.et_Save)
EditText etSave;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
dao=new Dao();
}
@OnClick(R.id.btn_save)
public void onViewClicked() {
String s = etSave.getText().toString();
String id = PreferenceManager.getInstance(this).getId();
int i=0;
if(id!=null){
i = Integer.parseInt(id);
Map<Integer, Value> value = dao.getValue();
if(value.get(i).equals(s)){
dao.saveValue(s);
Map<Integer, Value> value1 = dao.getValue();
Set<Integer> keySet = value1.keySet();
Iterator<Integer> iterator = keySet.iterator();
while (iterator.hasNext()){
Integer next = iterator.next();
Value value2 = value1.get(next);
if(value2.getValue().equals(s)){
int id1 = value2.getId();
PreferenceManager.getInstance(this).setID(String.valueOf(id1));
}
}
}
id = PreferenceManager.getInstance(this).getId();
if(id!=null){
i = Integer.parseInt(id);
Map<Integer, Value> v = dao.getValue();
Value ve= value.get(i);
Toast.makeText(this, "ve.id="+ve.getId()+",ve.getValue:"+ve.getValue(), Toast.LENGTH_SHORT).show();
}
}else {
dao.saveValue(s);
Map<Integer, Value> value = dao.getValue();
Set<Integer> keySet = value.keySet();
Iterator<Integer> key = keySet.iterator();
Integer ids = key.next();
PreferenceManager.getInstance(this).setID(String.valueOf(ids));
Toast.makeText(this, "存储到PreferenceManager中", Toast.LENGTH_SHORT).show();
return;
}
}
}
|
[
"761241917@qq.com"
] |
761241917@qq.com
|
3429cdfca24a66e4b0d7205459e313c727839a10
|
3c31692ca5b964f24702d1afca64c4cb5904b074
|
/Application/src/pojo/LoanApplication.java
|
89982cf1fcb1ab41c041b819f4516c9698aeb0e4
|
[] |
no_license
|
ankit5827/Spring_workspace2
|
40dac23950ebc74f7f153dff0b31aaefb79e949f
|
f7fe9a3c6365c5e2ce7fc468ac8aa0e0b2a7a4c9
|
refs/heads/master
| 2021-04-28T08:58:05.574771
| 2018-04-04T04:27:57
| 2018-04-04T04:27:57
| 122,027,561
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,547
|
java
|
package pojo;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
@Entity
@Table(name="loanapplication")
public class LoanApplication {
@Id
@Column(name="loanapplicationid")
@GeneratedValue
private int loanapplicationid;
private float loanamount;
private float duration;
private float annualincome;
private int customerid;
private int loanid;
public int getLoanapplicationid() {
return loanapplicationid;
}
public float getLoanamount() {
return loanamount;
}
public float getDuration() {
return duration;
}
public float getAnnualincome() {
return annualincome;
}
@ManyToOne
@JoinColumn (name = "customer_id")
public int getCustomerid() {
return customerid;
}
@ManyToOne
@JoinColumn (name = "loanid")
public int getLoanid() {
return loanid;
}
public void setLoanapplicationid(int loanapplicationid) {
this.loanapplicationid = loanapplicationid;
}
public void setLoanamount(float loanamount) {
this.loanamount = loanamount;
}
public void setDuration(float duration) {
this.duration = duration;
}
public void setAnnualincome(float annualincome) {
this.annualincome = annualincome;
}
public void setCustomerid(int customerid) {
this.customerid = customerid;
}
public void setLoanid(int loanid) {
this.loanid = loanid;
}
}
|
[
"ankit.bhatnagar1994@gmail.com"
] |
ankit.bhatnagar1994@gmail.com
|
6ae608d344728d2fb9311a8f519ba591db5c8ec7
|
4b0cdc84fe1330eb1ad602669c2735ce995139d3
|
/webfx-stack-orm-expression/src/main/java/dev/webfx/stack/orm/expression/terms/function/java/StringAgg.java
|
ab972e613dfafea3cfbea92904a0feb0420d769d
|
[
"LicenseRef-scancode-free-unknown",
"Apache-2.0"
] |
permissive
|
webfx-project/webfx-stack
|
8f991a1552336dcad4a05883429ebe2c38aca2d1
|
0deeffe2509dcc6b24b776cbf2635f8605643f6c
|
refs/heads/main
| 2023-08-17T00:13:43.321212
| 2023-08-14T16:33:40
| 2023-08-14T16:33:40
| 513,490,539
| 0
| 2
|
Apache-2.0
| 2023-08-31T10:13:59
| 2022-07-13T11:15:37
|
Java
|
UTF-8
|
Java
| false
| false
| 1,533
|
java
|
package dev.webfx.stack.orm.expression.terms.function.java;
import dev.webfx.stack.orm.expression.Expression;
import dev.webfx.stack.orm.expression.lci.DomainReader;
import dev.webfx.stack.orm.expression.terms.ExpressionArray;
import dev.webfx.extras.type.PrimType;
import dev.webfx.platform.util.Strings;
import dev.webfx.stack.orm.expression.terms.function.SqlAggregateFunction;
/**
* @author Bruno Salmon
*/
public final class StringAgg<T> extends SqlAggregateFunction<T> {
public StringAgg() {
super("string_agg", null, null, PrimType.STRING, true);
}
@Override
public Object evaluateOnAggregates(T referrer, Object[] aggregates, Expression<T> operand, DomainReader<T> domainReader) {
String delimiter = ",";
Expression<T> stringOperand = operand;
if (operand instanceof ExpressionArray) {
ExpressionArray<T> array = (ExpressionArray<T>) operand;
stringOperand = array.getExpressions()[0];
Expression<T> delimiterOperand = array.getExpressions()[1];
delimiter = Strings.toSafeString(delimiterOperand.evaluate(referrer, domainReader));
}
StringBuilder sb = new StringBuilder();
for (Object aggregate : aggregates) {
Object value = stringOperand.evaluate((T) aggregate, domainReader);
if (value != null) {
if (sb.length() > 0)
sb.append(delimiter);
sb.append(value);
}
}
return sb.toString();
}
}
|
[
"dev.salmonb@gmail.com"
] |
dev.salmonb@gmail.com
|
cf644f03917efec95c5d43dc35601a6f291deb62
|
2a2f5408fa5a272e1da2983042f35a927b3c0061
|
/app/src/main/java/com/mightted/blogsns/domain/entity/SearchItems.java
|
3a45d6b817f37599074594ddfe82668da2c6ccf6
|
[
"Apache-2.0"
] |
permissive
|
Mightted/BlogSNS
|
8f50d74e790c11e01e4c0ffbdf4a18631f3a21fa
|
73acc6799c8ab8e2151663f00fafa09508c203e1
|
refs/heads/master
| 2021-01-19T17:36:41.581292
| 2017-05-06T13:36:04
| 2017-05-06T13:36:04
| 88,336,040
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 118
|
java
|
package com.mightted.blogsns.domain.entity;
/**
* Created by 晓深 on 2017/4/27.
*/
public class SearchItems {
}
|
[
"sosowolf0125@gmail.com"
] |
sosowolf0125@gmail.com
|
9b9c0a9162589d3f361e366a7d56cd90bfd88060
|
de60dae9839ac402113671c0c4372918dd994bb2
|
/app/src/main/java/alexgochi/jogathon/Runner.java
|
30d2f0322a5a27460115f323d4f451bc1f2385de
|
[] |
no_license
|
danyhp/JogAThon
|
76fcf4a3d6a96e55970def1e30c3133f63b811fc
|
9f44ffdb8b3ebf84844be9242297a5273ea123e1
|
refs/heads/master
| 2021-04-26T22:31:23.961141
| 2018-03-07T07:47:41
| 2018-03-07T07:47:41
| 124,106,554
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,116
|
java
|
package alexgochi.jogathon;
import android.os.Parcel;
import android.os.Parcelable;
/**
* Created by ASUS on 06-Mar-18.
*/
public class Runner implements Parcelable {
// Attribute
int runnerID;
int lapDonation;
int lapCount = 0;
// Constructor
public Runner(int runnerID, int lapDonation) {
this.runnerID = runnerID;
this.lapDonation = lapDonation;
}
private Runner(Parcel in) {
runnerID = in.readInt();
lapDonation = in.readInt();
lapCount = in.readInt();
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel parcel, int i) {
parcel.writeInt(runnerID);
parcel.writeInt(lapDonation);
parcel.writeInt(lapCount);
}
public static final Parcelable.Creator<Runner> CREATOR = new Parcelable.Creator<Runner>() {
public Runner createFromParcel(Parcel in) {
return new Runner(in);
}
@Override
public Runner[] newArray(int size) {
return new Runner[size];
}
};
}
|
[
"dany.panggabean@gmail.com"
] |
dany.panggabean@gmail.com
|
b8136e64eba2db4a055ff1da8010ed6b54a1b9e8
|
cd3fce007e6d07d77994910981cdbd0cd561b364
|
/app/src/main/java/com/yxld/yxchuangxin/ui/activity/xiongmai/lib/sdk/struct/H264_DVR_TIME.java
|
183d34c653cf28cc238a711283cf8ce57b95508a
|
[] |
no_license
|
sahujaunpuri/xinshequ
|
5d5d66f9b5c19ca106c285a2156d65fe2ceef397
|
6f8e7ab427786ed2ba7b1326320a8ac02918aac7
|
refs/heads/master
| 2020-04-10T07:19:46.124461
| 2018-12-04T09:34:51
| 2018-12-04T09:34:51
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 658
|
java
|
package com.yxld.yxchuangxin.ui.activity.xiongmai.lib.sdk.struct;
import java.io.Serializable;
public class H264_DVR_TIME implements Serializable{
public int st_0_dwYear; // 年
public int st_1_dwMonth; // 月
public int st_2_dwDay; // 日
public int st_3_dwHour; // 时
public int st_4_dwMinute; // 分
public int st_5_dwSecond; // 秒
@Override
public String toString() {
return "H264_DVR_TIME [st_0_dwYear=" + st_0_dwYear + ", st_1_dwMonth="
+ st_1_dwMonth + ", st_2_dwDay=" + st_2_dwDay
+ ", st_3_dwHour=" + st_3_dwHour + ", st_4_dwMinute="
+ st_4_dwMinute + ", st_5_dwSecond=" + st_5_dwSecond + "]";
}
}
|
[
"afjzwed@163.com"
] |
afjzwed@163.com
|
5d39c3e6c3c5743ada33edb40aa9e34dfc8ed61b
|
7e237940eb35d62a2c114281ad186f059fc187c5
|
/EvoMaster/e2e-tests/spring-examples/src/test/java/org/evomaster/e2etests/spring/examples/blackbox/BlackBoxConstantEMTest.java
|
06b74ea59324cf26eef82ddb6063bc4dbbd23e23
|
[
"LGPL-3.0-only",
"LGPL-2.0-or-later",
"MIT"
] |
permissive
|
mitchellolsthoorn/ASE-Technical-2021-api-linkage-replication
|
6dabaf35b3f0c65d1082695ec6aaaa34efa43fd8
|
50e9fb327fe918cc64c6b5e30d0daa2d9d5d923f
|
refs/heads/main
| 2023-04-10T04:14:24.185151
| 2021-08-19T18:37:00
| 2021-08-19T18:37:00
| 364,836,402
| 0
| 1
|
MIT
| 2021-07-15T12:44:14
| 2021-05-06T08:20:38
|
Java
|
UTF-8
|
Java
| false
| false
| 2,111
|
java
|
package org.evomaster.e2etests.spring.examples.blackbox;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.foo.rest.examples.spring.constant.ConstantController;
import com.foo.rest.examples.spring.constant.ConstantResponseDto;
import org.evomaster.client.java.instrumentation.shared.ClassName;
import org.evomaster.core.problem.rest.RestCallResult;
import org.evomaster.core.problem.rest.RestIndividual;
import org.evomaster.core.search.Solution;
import org.evomaster.e2etests.spring.examples.SpringTestBase;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import java.io.IOException;
import java.util.List;
import java.util.stream.Collectors;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class BlackBoxConstantEMTest extends SpringTestBase {
@BeforeAll
public static void initClass() throws Exception {
SpringTestBase.initClass(new ConstantController());
}
@ParameterizedTest
@ValueSource(booleans = {true, false})
public void testRunEM(boolean bbExperiments) throws Throwable {
String outputFolder = "BlackBoxConstant";
List<String> args = getArgsWithCompilation(
10,
outputFolder,
ClassName.get("org.foo.BlackBoxConstant"),
true);
args.add("--blackBox");
args.add("true");
args.add("--bbTargetUrl");
args.add(baseUrlOfSut);
args.add("--bbSwaggerUrl");
args.add(baseUrlOfSut+"/v2/api-docs");
args.add("--bbExperiments");
args.add("" + bbExperiments);
/*
Note: here we do not care of actual results.
We just check that at least one test is generated,
and that it can be compiled
*/
Solution<RestIndividual> solution = initAndRun(args);
assertTrue(solution.getIndividuals().size() >= 1);
compile(outputFolder);
}
}
|
[
"mitchell.olsthoorn@outlook.com"
] |
mitchell.olsthoorn@outlook.com
|
293df3c4701c9f66da718018b3d08ea85d39a5d4
|
1e8f24e0c676f41a2c3b707cee460bd09f66e9e8
|
/app/src/main/java/com/android/woonga/response/AddVideoPointsResponse.java
|
9c3119e038cb7b077ac22333687ab9f72bd158ad
|
[] |
no_license
|
akhajuria92/WoongaDemo
|
4521c9a1939054edf83f507d7dbef7409481acd6
|
569dd58e550fdfc021374d852071ffbe36c5f59e
|
refs/heads/master
| 2023-06-18T14:00:42.835910
| 2021-07-16T08:42:41
| 2021-07-16T08:42:41
| 386,561,318
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 645
|
java
|
package com.android.woonga.response;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class AddVideoPointsResponse {
@SerializedName("success")
@Expose
private Integer success;
@SerializedName("message")
@Expose
private String message;
public Integer getSuccess() {
return success;
}
public void setSuccess(Integer success) {
this.success = success;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
|
[
"akshay@techglock.com"
] |
akshay@techglock.com
|
803c7c4ba098d4ec39bbbd0b7abad3d19b55ef55
|
a00326c0e2fc8944112589cd2ad638b278f058b9
|
/src/main/java/000/124/777/CWE129_Improper_Validation_of_Array_Index__connect_tcp_array_read_check_min_54c.java
|
3c3725c1f795c7aa26cd599856d00c3907ad38ef
|
[] |
no_license
|
Lanhbao/Static-Testing-for-Juliet-Test-Suite
|
6fd3f62713be7a084260eafa9ab221b1b9833be6
|
b095b11c7cb6d4a5bb2b76181e35d6ee00e96e68
|
refs/heads/master
| 2020-08-24T13:34:04.004149
| 2019-10-25T09:26:00
| 2019-10-25T09:26:00
| 216,822,684
| 0
| 1
| null | 2019-11-08T09:51:54
| 2019-10-22T13:37:13
|
Java
|
UTF-8
|
Java
| false
| false
| 1,636
|
java
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE129_Improper_Validation_of_Array_Index__connect_tcp_array_read_check_min_54c.java
Label Definition File: CWE129_Improper_Validation_of_Array_Index.label.xml
Template File: sources-sinks-54c.tmpl.java
*/
/*
* @description
* CWE: 129 Improper Validation of Array Index
* BadSource: connect_tcp Read data using an outbound tcp connection
* GoodSource: A hardcoded non-zero, non-min, non-max, even number
* Sinks: array_read_check_min
* GoodSink: Read from array after verifying that data is at least 0 and less than array.length
* BadSink : Read from array after verifying that data is at least 0 (but not verifying that data less than array.length)
* Flow Variant: 54 Data flow: data passed as an argument from one method through three others to a fifth; all five functions are in different classes in the same package
*
* */
public class CWE129_Improper_Validation_of_Array_Index__connect_tcp_array_read_check_min_54c
{
public void badSink(int data ) throws Throwable
{
(new CWE129_Improper_Validation_of_Array_Index__connect_tcp_array_read_check_min_54d()).badSink(data );
}
/* goodG2B() - use goodsource and badsink */
public void goodG2BSink(int data ) throws Throwable
{
(new CWE129_Improper_Validation_of_Array_Index__connect_tcp_array_read_check_min_54d()).goodG2BSink(data );
}
/* goodB2G() - use badsource and goodsink */
public void goodB2GSink(int data ) throws Throwable
{
(new CWE129_Improper_Validation_of_Array_Index__connect_tcp_array_read_check_min_54d()).goodB2GSink(data );
}
}
|
[
"anhtluet12@gmail.com"
] |
anhtluet12@gmail.com
|
eaec536925601f1c90a8a998c61b98cabcdfba1a
|
78ed22ec76d5049dd9b32b19793b92c2a9e04491
|
/user-service/src/main/java/com/medley/users/repository/UserRepository.java
|
0e3664978425fac4bc84ab67f46f3f00f38affbc
|
[] |
no_license
|
yasinesmail/medical-users
|
e344c5547cffca450eca9c9a22a0eec12956735a
|
21ad08bb4ca514057887a4434c69301ceb3f973b
|
refs/heads/master
| 2021-08-17T17:55:04.938482
| 2018-02-11T07:41:34
| 2018-02-11T07:41:34
| 96,071,352
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 274
|
java
|
package com.medley.users.repository;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import com.medley.users.model.User;
@Repository
public interface UserRepository extends CrudRepository<User, Integer> {
}
|
[
"yesmail@momentfeed.com"
] |
yesmail@momentfeed.com
|
f5e7dcc0f87e983404965ab7c7eb5b165036975d
|
ef6f957fd13bfb7fce538d83472f4221f552a8ca
|
/src/model/Square.java
|
c95579605053514d3c4d4df895a9b3d1c925599d
|
[] |
no_license
|
Gal14190/AFEKA_OOP_FINAL_PROJECT
|
af766a7346078e432a5cce3083b93a92275581b4
|
bca8f9223e3975acaa31d5444cf1cf2327ebf3cc
|
refs/heads/master
| 2023-08-06T05:30:35.956703
| 2021-10-09T11:11:44
| 2021-10-09T11:11:44
| 410,545,948
| 2
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 992
|
java
|
//Gal Ashkenazi 315566752 - Final Test
package model;
import javafx.event.EventHandler;
import javafx.scene.input.MouseEvent;
import javafx.scene.paint.Color;
/**
* Tool game
* @author GalAs
*
*/
public class Square {
private Color color;
private boolean smallSize;
private EventHandler<MouseEvent> event;
/**
* c'tor
* @param colorNumber
* @param _smallSize
* @param _event
*/
public Square(Color _color, boolean _smallSize, EventHandler<MouseEvent> _event) {
this.color = _color;
this.smallSize = _smallSize;
this.event = _event;
}
// getters and setters
public Color getColor() {
return this.color;
}
public void setColor(Color color) {
this.color = color;
}
public boolean isSmallSize() {
return smallSize;
}
public void setSmallSize(boolean smallSize) {
this.smallSize = smallSize;
}
public EventHandler<MouseEvent> getEvent() {
return event;
}
public void setEvent(EventHandler<MouseEvent> event) {
this.event = event;
}
}
|
[
"gal14190@gmail.com"
] |
gal14190@gmail.com
|
34be00a09bdb287df65f765ec3b1ab963333d865
|
2763e9ade80aaea8880cdd8059c03664ed33b4d3
|
/app/src/main/java/com/edavtyan/materialplayer/lib/transition/TransitionData.java
|
fa6dd91a4f2f246cef008b14b3dd0f2fd1d16b30
|
[] |
no_license
|
edgardavtyan/material-player
|
b14e19f2b770cc156ced19b4c95caeb8a4e1a9d1
|
c1149471128eda57f1cd6ab0bc448b2228fdf364
|
refs/heads/master
| 2021-06-17T07:15:54.659811
| 2021-03-29T14:22:44
| 2021-03-29T14:22:44
| 43,719,083
| 4
| 2
| null | 2018-01-24T09:10:14
| 2015-10-05T23:10:48
|
Java
|
UTF-8
|
Java
| false
| false
| 398
|
java
|
package com.edavtyan.materialplayer.lib.transition;
import android.view.View;
import lombok.Data;
@Data
public class TransitionData {
private int duration;
private int delay;
private float startXDelta;
private float startYDelta;
private float startScaleX;
private float startScaleY;
private float endXDelta;
private float endYDelta;
private View sharedView;
private View normalView;
}
|
[
"edgar.davtyan@outlook.com"
] |
edgar.davtyan@outlook.com
|
c23bd96ab982dc2d389029317dfb7b0c22f79392
|
deb423f6b82dbf1b405ad4b151e8def8f3d6e178
|
/aditya/src/practices/complex.java
|
268ab4b67e40229b810a57feaaf8d117ad5392a1
|
[] |
no_license
|
Techiefrogs-Champs/Champs-01
|
1dbc7b905fea1eb14d9b522b128f26d4d319db86
|
4873353c58a026425b38f97d9874de0eca0dc940
|
refs/heads/master
| 2023-02-28T13:16:48.730593
| 2021-02-08T05:09:36
| 2021-02-08T05:09:36
| 287,759,441
| 0
| 2
| null | 2020-11-24T05:50:16
| 2020-08-15T14:11:59
|
Java
|
UTF-8
|
Java
| false
| false
| 557
|
java
|
package practices;
class complex {
public int method1(int a,int b){
int addition;
return addition=a+b;
}
public int method2(int x,int y){
int product;
return product=x*y;
}
public int method3(int k,int M){
int subtraction;
return subtraction=k-M;
}
public static void main(String []args){
complex add =new complex();
System.out.println(add.method1(2,5));
System.out.println(add.method2(3,9));
System.out.println(add.method3(6,4));
}
}
|
[
"adityabottu97@gmail.com"
] |
adityabottu97@gmail.com
|
2ee6c17f3195f018eb80c636a4d6654de75efb4a
|
8be226f8f1b66c71dad9bc683683d8d31f052bc0
|
/POO/TRABALHOS/Trabalho3/test/game/gui/PausePanel.java
|
b8108854dbbf69707aeaae35760e1c58abb80d8a
|
[] |
no_license
|
rjcanto/semestre4
|
ac9aa49961e4697369edade9e5c5a5781e169137
|
af2e16d790ccb32b4299d2bdc2f79e1261c164ff
|
refs/heads/master
| 2021-01-01T19:30:09.439889
| 2010-09-13T15:38:02
| 2010-09-13T15:38:02
| 32,681,148
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,320
|
java
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package test.game.gui;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Toolkit;
import javax.swing.JLabel;
import javax.swing.JPanel;
/**
*
* @author nac
*/
public class PausePanel extends JPanel{
private final int width = 200;
private final int height = 100;
private boolean ispaused=false;
private JLabel pause;
private Color shown=new Color(0, 0, 0, 0);
private Color notshown=new Color(125, 125, 125, 125);
public PausePanel(){
ispaused = false;
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
setLayout(new BorderLayout());
setOpaque(true);
setSize(width,height);
setName("Game Panel");
setBackground(shown);
setLocation((screenSize.width - width)/2, (screenSize.height - height)/2);
setFocusable(true);
Container center = new Container();
center.setLayout(new BorderLayout());
pause = new JLabel("Game is Paused!");
add(center);
center.add(pause);
}
public void paintShape(Graphics g) {
setBackground(shown);
}
}
|
[
"ng.sousa@gmail.com@4dcf1070-26bf-11df-a94c-d58e26249b9a"
] |
ng.sousa@gmail.com@4dcf1070-26bf-11df-a94c-d58e26249b9a
|
05f631cfa27f3d2573d8c5ab4da8f48e24f8a201
|
8597e3289010877d7aa8f0d33a45b513c8a79625
|
/CalDining/gen/com/caldining/R.java
|
741071de626848272ca0602c906c5d91d8723f2b
|
[] |
no_license
|
mukundc/CalDiningMenu
|
43fe9236b537887284572c609b509a75ee100e0e
|
0fcf292ff0e3be202c38d8fd8f16dbadfd57a531
|
refs/heads/master
| 2021-01-13T01:40:21.922295
| 2013-11-27T02:48:37
| 2013-11-27T02:48:37
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,136
|
java
|
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.caldining;
public final class R {
public static final class array {
public static final int Meals=0x7f050000;
}
public static final class attr {
}
public static final class dimen {
/** Default screen margins, per the Android Design guidelines.
Customize dimensions originally defined in res/values/dimens.xml (such as
screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
*/
public static final int activity_horizontal_margin=0x7f040000;
public static final int activity_vertical_margin=0x7f040001;
}
public static final class drawable {
public static final int ic_launcher=0x7f020000;
}
public static final class id {
public static final int ListView=0x7f090000;
public static final int action_settings=0x7f090006;
public static final int expandableListView1=0x7f090001;
public static final int label=0x7f090004;
public static final int progress=0x7f090005;
public static final int textViewChild=0x7f090002;
public static final int textViewGroupName=0x7f090003;
}
public static final class layout {
public static final int activity_main=0x7f030000;
public static final int dininglocationsview=0x7f030001;
public static final int dropdown_item=0x7f030002;
public static final int list_group=0x7f030003;
public static final int meal=0x7f030004;
public static final int progressbar=0x7f030005;
}
public static final class menu {
public static final int main=0x7f080000;
}
public static final class string {
public static final int action_settings=0x7f060001;
public static final int app_name=0x7f060000;
public static final int hello_world=0x7f060002;
}
public static final class style {
/**
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
API 11 theme customizations can go here.
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
API 14 theme customizations can go here.
*/
public static final int AppBaseTheme=0x7f070000;
/** Application theme.
All customizations that are NOT specific to a particular API-level can go here.
*/
public static final int AppTheme=0x7f070001;
}
}
|
[
"mchillakanti@gmail.com"
] |
mchillakanti@gmail.com
|
12cdc11ee54346294798aadb0b75246a25ae6920
|
df134b422960de6fb179f36ca97ab574b0f1d69f
|
/net/minecraft/server/v1_16_R2/DataConverterSchemaV2100.java
|
fcc5cb4d4ca883327f5ee04fbb605914f2e088e0
|
[] |
no_license
|
TheShermanTanker/NMS-1.16.3
|
bbbdb9417009be4987872717e761fb064468bbb2
|
d3e64b4493d3e45970ec5ec66e1b9714a71856cc
|
refs/heads/master
| 2022-12-29T15:32:24.411347
| 2020-10-08T11:56:16
| 2020-10-08T11:56:16
| 302,324,687
| 0
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,893
|
java
|
/* */ package net.minecraft.server.v1_16_R2;
/* */
/* */ import com.mojang.datafixers.DSL;
/* */ import com.mojang.datafixers.schemas.Schema;
/* */ import com.mojang.datafixers.types.templates.TypeTemplate;
/* */ import java.util.Map;
/* */ import java.util.function.Supplier;
/* */
/* */
/* */
/* */
/* */ public class DataConverterSchemaV2100
/* */ extends DataConverterSchemaNamed
/* */ {
/* */ public DataConverterSchemaV2100(int var0, Schema var1) {
/* 16 */ super(var0, var1);
/* */ }
/* */
/* */ protected static void a(Schema var0, Map<String, Supplier<TypeTemplate>> var1, String var2) {
/* 20 */ var0.register(var1, var2, () -> DataConverterSchemaV100.a(var0));
/* */ }
/* */
/* */
/* */ public Map<String, Supplier<TypeTemplate>> registerEntities(Schema var0) {
/* 25 */ Map<String, Supplier<TypeTemplate>> var1 = super.registerEntities(var0);
/* 26 */ a(var0, var1, "minecraft:bee");
/* 27 */ a(var0, var1, "minecraft:bee_stinger");
/* 28 */ return var1;
/* */ }
/* */
/* */
/* */ public Map<String, Supplier<TypeTemplate>> registerBlockEntities(Schema var0) {
/* 33 */ Map<String, Supplier<TypeTemplate>> var1 = super.registerBlockEntities(var0);
/* */
/* 35 */ var0.register(var1, "minecraft:beehive", () -> DSL.optionalFields("Items", DSL.list(DataConverterTypes.ITEM_STACK.in(var0)), "Bees", DSL.list(DSL.optionalFields("EntityData", DataConverterTypes.ENTITY_TREE.in(var0)))));
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* 43 */ return var1;
/* */ }
/* */ }
/* Location: C:\Users\Josep\Downloads\Decompile Minecraft\tuinity-1.16.3.jar!\net\minecraft\server\v1_16_R2\DataConverterSchemaV2100.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/
|
[
"tanksherman27@gmail.com"
] |
tanksherman27@gmail.com
|
3aba5a3f3f928557d9f1141927b8588b85ad4863
|
817d1594aa77c95d2a66a061ca3daae27c50c60a
|
/第十章/例六/DirList.java
|
2ae379d29bd903362cc54e022471adee6cf9fdc6
|
[] |
no_license
|
yang-zhiying/MyJava
|
fc2ede7b13da0188e8196632bf9a57ddf539c67e
|
94fb417c0ad7deda9eeeb323b622b4ff515c7053
|
refs/heads/master
| 2021-09-01T01:33:45.656654
| 2017-12-24T05:42:07
| 2017-12-24T05:42:07
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,139
|
java
|
package 第十章.例六;
import java.io.File;
import java.util.Date;
public class DirList {
public DirList() {
//当前目录,目录文件都用FIle定义,为什么
File dir = new File(".");
int count_dirs = 0, count_files = 0;
long byte_files = 0;
// \r\n为什么放在""中 回车换行
System.out.println(dir.getAbsolutePath()+"目录\r\n");
//返回文件数组 返回当前目录中所有文件
File [] files = dir.listFiles();
for(int i=0; i<files.length; i++) {
System.out.print(files[i].getName()+"\t");//显示文件名
if(files[i].isFile()) { //判断指定File对象是否是文件
System.out.print(files[i].length()+"B\t");//显示文件长度
count_files++;
byte_files += files[i].length();
}
else {
System.out.print("<DIR>\t");
count_dirs++;
}
System.out.println(new Date(files[i].lastModified()));
}
System.out.println("\r\n共有"+count_files+"个文件,总字节数为"+byte_files);
System.out.println("共有"+count_dirs+"个目录");
}
public static void main(String[] args) {
// TODO Auto-generated method stub
new DirList();
}
}
|
[
"764000395@qq.com"
] |
764000395@qq.com
|
a4917abf708c52a9c21a78a236d788be191b6ce9
|
999930340d5cb8f5015a8be3b7d62a49a88634e4
|
/app/src/main/java/com/amisrs/gavin/stratdex/model/TypeContainerContainer.java
|
331c652806d80f04753b1c19726b30d6191ae6be
|
[] |
no_license
|
amisrs/StratDex
|
bf3043a5e172a0613cac0e26d1abbc95a9c121ce
|
0dcfe40ff0b7795b18b3958c407814cf0705060a
|
refs/heads/master
| 2021-01-16T21:26:24.761737
| 2016-10-04T02:32:04
| 2016-10-04T02:32:04
| 68,459,548
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 349
|
java
|
package com.amisrs.gavin.stratdex.model;
/**
* Created by Gavin on 18/09/2016.
*/
public class TypeContainerContainer {
public TypeContainer[] types;
public TypeContainerContainer(TypeContainer[] typeContainers) {
this.types = typeContainers;
}
public TypeContainer[] getTypeContainers() {
return types;
}
}
|
[
"gvn.cim@gmail.com"
] |
gvn.cim@gmail.com
|
48da1e97689ef8d35824739de000d506094a2367
|
6ba87305349b92e6ec79a7ff1dbbeadd55ce3132
|
/src/JSON/json/simple/parser/ParseException.java
|
4d5ce3d75d6109dd42efcef9c8a3fc905c47968d
|
[] |
no_license
|
dillongrimes/VisionTraking18
|
6f00695a0411f02e928e62147044a307ed8202f3
|
6768d6794835c25a3289fc7afbf83f862525a242
|
refs/heads/master
| 2020-04-06T21:08:22.017571
| 2018-11-16T02:25:18
| 2018-11-16T02:25:18
| 157,793,750
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,481
|
java
|
package JSON.json.simple.parser;
/**
* ParseException explains why and where the error occurs in source JSON text.
*
* @author FangYidong<fangyidong@yahoo.com.cn>
*
*/
public class ParseException extends Exception {
private static final long serialVersionUID = -7880698968187728547L;
public static final int ERROR_UNEXPECTED_CHAR = 0;
public static final int ERROR_UNEXPECTED_TOKEN = 1;
public static final int ERROR_UNEXPECTED_EXCEPTION = 2;
private int errorType;
private Object unexpectedObject;
private int position;
public ParseException(int errorType){
this(-1, errorType, null);
}
public ParseException(int errorType, Object unexpectedObject){
this(-1, errorType, unexpectedObject);
}
public ParseException(int position, int errorType, Object unexpectedObject){
this.position = position;
this.errorType = errorType;
this.unexpectedObject = unexpectedObject;
}
public int getErrorType() {
return errorType;
}
public void setErrorType(int errorType) {
this.errorType = errorType;
}
/**
* @see org.json.simple.parser.JSONParser#getPosition()
*
* @return The character position (starting with 0) of the input where the error occurs.
*/
public int getPosition() {
return position;
}
public void setPosition(int position) {
this.position = position;
}
/**
* @see org.json.simple.parser.Yytoken
*
* @return One of the following base on the value of errorType:
* ERROR_UNEXPECTED_CHAR java.lang.Character
* ERROR_UNEXPECTED_TOKEN org.json.simple.parser.Yytoken
* ERROR_UNEXPECTED_EXCEPTION java.lang.Exception
*/
public Object getUnexpectedObject() {
return unexpectedObject;
}
public void setUnexpectedObject(Object unexpectedObject) {
this.unexpectedObject = unexpectedObject;
}
public String getMessage() {
StringBuffer sb = new StringBuffer();
switch(errorType){
case ERROR_UNEXPECTED_CHAR:
sb.append("Unexpected character (").append(unexpectedObject).append(") at position ").append(position).append(".");
break;
case ERROR_UNEXPECTED_TOKEN:
sb.append("Unexpected token ").append(unexpectedObject).append(" at position ").append(position).append(".");
break;
case ERROR_UNEXPECTED_EXCEPTION:
sb.append("Unexpected exception at position ").append(position).append(": ").append(unexpectedObject);
break;
default:
sb.append("Unkown error at position ").append(position).append(".");
break;
}
return sb.toString();
}
}
|
[
"rawoodwi@gmail.com"
] |
rawoodwi@gmail.com
|
30e02e76c4150f28644ec313c4a91a951a354dbf
|
33e02991e2066d55bc78d23d20e1a1b31dd851ac
|
/doctor-patient/src/main/java/com/cg/healthassist/doctorpatient/controller/DoctorController.java
|
0c03db2e133623a8600ca3d5abcb840d3c9d9ddf
|
[] |
no_license
|
vperumallu/patient-doctor
|
1bf715ded7db3ca1e465e216a412ca402fb3a402
|
1c4d84f18d75e798b66ed83e006b8c86c4f928bd
|
refs/heads/master
| 2023-01-24T18:22:56.518872
| 2020-12-02T05:22:18
| 2020-12-02T05:22:18
| 314,237,301
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,613
|
java
|
package com.cg.healthassist.doctorpatient.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.cg.healthassist.doctorpatient.exceptions.PatientNotFoundException;
import com.cg.healthassist.doctorpatient.model.Patient;
import com.cg.healthassist.doctorpatient.service.DoctorServiceImpl;
/**
* This DoctorController class provides GET and PUT
*
* @author perumallu
*
*
*/
@RestController
@RequestMapping("/api/v1")
public class DoctorController {
@Autowired
private DoctorServiceImpl doctorService;
/**
* GET method is to view patient
*/
@GetMapping("/patient/{patientId}")
public @ResponseBody Patient getPatientById(@PathVariable("patientId") Integer patientId)
throws PatientNotFoundException {
Patient patient = doctorService.findPatientById(patientId);
return patient;
}
/**
* PUT method is to update patient by adding prescription
*/
@PutMapping("patient/{patientId:.+}/addPrescription/{prescription}")
public Patient addPrescriptionsById(@PathVariable Integer patientId, @PathVariable String prescription)
throws PatientNotFoundException {
return doctorService.addPrescriptionsById(patientId, prescription);
}
}
|
[
"HP@DESKTOP-6L4PCFU"
] |
HP@DESKTOP-6L4PCFU
|
1a382ca995e643cfc94302deb448bf6782860407
|
ed566b9eb3f859c54e7e4d67da781aabbb3da184
|
/src/dao/SuperDDAO.java
|
37226b9e8cf88c5c91a208dc38ea9b0607c37609
|
[] |
no_license
|
ishanka995/LMS
|
a9ed3758c1fde97d4f3aa4a794daff1bf8d72605
|
114f9fa0455a5c9bc940e0775d40deef19d00f7a
|
refs/heads/master
| 2020-07-09T21:16:46.567175
| 2019-08-23T23:58:41
| 2019-08-23T23:58:41
| 204,085,635
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 556
|
java
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package dao;
import java.util.ArrayList;
/**
*
* @author Max point galgamuwa
*/
public interface SuperDDAO<T, ID> {
public boolean add(T t) throws Exception;
public boolean update(T t) throws Exception;
public boolean delete(ID id) throws Exception;
public T search(ID id) throws Exception;
public ArrayList<T> getAll() throws Exception;
}
|
[
"ishankaabeysingha@gmail.com"
] |
ishankaabeysingha@gmail.com
|
a189c555881eec43072e5dd3ba633f4df4c80ba3
|
7caecbdf94a6de498a653b4c9dc047e69a6aeb0b
|
/2. File IO/4. AddNumbersFromFileSentinel/AddNumbersFromFileSentinel.java
|
02f2cd9234c804ff72d0218a33e777efbb4c8aa7
|
[] |
no_license
|
devayanmandal/Java_Programming
|
7ceba8319517f50c2423a7ae80df1f62a27c2bf8
|
b4c3c1bd602125cb5405c95180d94947c8cf4c26
|
refs/heads/master
| 2020-03-26T23:32:23.300517
| 2018-08-21T11:16:21
| 2018-08-21T11:16:21
| 145,550,026
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,162
|
java
|
/*
* Example AddNumbersFromFileSentinel: read in a sequence of numbers
* from a file, adding them up, until the sentinel value of 0 is read.
*/
import java.io.File;
import java.io.IOException;
import java.util.Scanner;
public class AddNumbersFromFileSentinel {
public static void main(String[] args) throws IOException {
// construct a Scanner that will read from a file
// instead of the keyboard.
Scanner fromFile = new Scanner(new File("numbers"));
// set up our running total for the sum of the numbers
int sum = 0;
// variable for the next number to add
int number = 0;
// loop to read in numbers until 0 is encountered
do {
// once we get here, there is no difference in how we use the Scanner
// compared to what we did with keyboard Scanners.
number = fromFile.nextInt();
sum += number;
} while (number != 0);
// unlike the keyboard Scanners, we should close file Scanners
fromFile.close();
System.out.println("Sum of numbers: " + sum);
}
}
|
[
"noreply@github.com"
] |
noreply@github.com
|
b0d11bbf88cb937fb0fddb2014ee69224e36d089
|
ba83bc8ba577455b7107097308ec2633e26866db
|
/api/src/main/java/org/openmrs/module/dataquality/api/dao/ClinicalDaoHelper.java
|
e805853977090f796ffa19591355bbe3db1e7db1
|
[] |
no_license
|
Ebuka-John/openmrs-module-aggregatereports
|
42c8f82488d68fb2f6895d01628f24f649f9ea8d
|
a4cccd3c42bd12f52256caa79fc5cf45fd3ed05b
|
refs/heads/main
| 2023-08-15T01:15:07.924877
| 2021-09-23T10:21:45
| 2021-09-23T10:21:45
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 66,507
|
java
|
package org.openmrs.module.dataquality.api.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import jdk.nashorn.internal.runtime.Context;
import org.openmrs.module.dataquality.api.dao.Database;
/*
* 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 lordmaul
*/
public class ClinicalDaoHelper {
public List<Map<String,String>> getActivePtsWithoutWithEducationalStatus(String startDate, String endDate) {
System.out.println(startDate);
System.out.println(endDate);
PreparedStatement stmt = null;
ResultSet rs = null;
Connection con = null;
List<Map<String, String>> allPatients = new ArrayList<>();
try {
con = Database.connectionPool.getConnection();
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
StringBuilder queryString = new StringBuilder(
" select IFNULL(hivE.encounter_id, 0) AS encounter_id, dqr_meta.patient_id, person_name.given_name, person_name.family_name, patient_identifier.identifier FROM dqr_meta "
+ " LEFT JOIN encounter hivE ON hivE.patient_id=dqr_meta.patient_id AND hivE.form_id=23 "
+ " JOIN person_name ON person_name.person_id=dqr_meta.patient_id "
+ " LEFT JOIN patient_identifier ON patient_identifier.patient_id=dqr_meta.patient_id AND patient_identifier.identifier_type=4 "
+ " JOIN dqr_pharmacy ON dqr_pharmacy.patient_id=dqr_meta.patient_id "
+ " WHERE "
+ " DATE_ADD(dqr_pharmacy.pickupdate, INTERVAL (dqr_pharmacy.days_refill+28) DAY) >= ? "
+ " AND dqr_pharmacy.pickupdate= ( "
+ " SELECT MAX(pickupdate) FROM dqr_pharmacy lastpickup "
+ " WHERE lastpickup.patient_id=dqr_pharmacy.patient_id "
+ " HAVING MAX(pickupdate) <=? ) "
+ " AND (dqr_meta.termination_status IS NULL OR dqr_meta.termination_status!=1066 ) ");
queryString.append(" AND (dqr_meta.education_status ='' OR dqr_meta.education_status IS NULL) GROUP BY dqr_meta.patient_id ");
int i = 1;
stmt = con.prepareStatement(queryString.toString());
//stmt.setString(i++, startDate);
stmt.setString(i++, endDate);
stmt.setString(i++, endDate);
rs = stmt.executeQuery();
while (rs.next()) {
String patientId = rs.getString("patient_id");
int encounterId = rs.getInt("encounter_id");
String patientIdentifier = rs.getString("identifier");
String firstName = rs.getString("given_name");
String lastName = rs.getString("family_name");
Map<String, String> tempData = new HashMap<>();
tempData.put("patientId", patientId);
tempData.put("encounterId", encounterId+"");
tempData.put("patientIdentifier", patientIdentifier);
tempData.put("firstName", firstName);
tempData.put("lastName", lastName);
if(encounterId == 0)
{
tempData.put("link", "/coreapps/clinicianfacing/patient.page?patientId="+patientId);
}
else{
tempData.put("link", "/htmlformentryui/htmlform/editHtmlFormWithStandardUi.page?patientId="+patientId+"&encounterId="+encounterId+"");
}
allPatients.add(tempData);
}
return allPatients;
}
catch (SQLException ex) {
ex.printStackTrace();
Database.handleException(ex);
return null;
}
finally {
Database.cleanUp(rs, stmt, con);
}
}
public List<Map<String,String>> getActiveAYPLHIV(String startDate, String endDate) {
System.out.println(startDate);
System.out.println(endDate);
PreparedStatement stmt = null;
ResultSet rs = null;
Connection con = null;
List<Map<String, String>> allPatients = new ArrayList<>();
try {
con = Database.connectionPool.getConnection();
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
StringBuilder queryString = new StringBuilder(
" select IFNULL(hivE.encounter_id, 0) AS encounter_id, dqr_meta.patient_id, dqr_meta.dob, person_name.given_name, person_name.family_name, patient_identifier.identifier FROM dqr_meta \n" +
" LEFT JOIN encounter hivE ON hivE.patient_id=dqr_meta.patient_id AND hivE.form_id=23 \n" +
" JOIN person_name ON person_name.person_id=dqr_meta.patient_id \n" +
" LEFT JOIN patient_identifier ON patient_identifier.patient_id=dqr_meta.patient_id AND patient_identifier.identifier_type=4 \n" +
" JOIN dqr_pharmacy lastpickup ON lastpickup.patient_id=dqr_meta.patient_id \n" +
" AND lastpickup.pickupdate=(\n" +
" SELECT pickupdate FROM dqr_pharmacy WHERE lastpickup.patient_id=dqr_pharmacy.patient_id\n" +
" AND pickupdate <=?\n" +
" ORDER BY pickupdate DESC LIMIT 0,1\n" +
" )\n" +
" WHERE \n" +
" DATE_ADD(lastpickup.pickupdate, INTERVAL (lastpickup.days_refill+28) DAY) >= ? \n" +
" \n" +
" AND (dqr_meta.termination_status IS NULL OR dqr_meta.termination_status!=1066 ) \n" +
"\n" +
" AND (TIMESTAMPDIFF(YEAR,dqr_meta.dob,CURDATE()) > 0 AND TIMESTAMPDIFF(YEAR,dqr_meta.dob,CURDATE()) <=24)\n" +
" GROUP BY dqr_meta.patient_id ");
int i = 1;
stmt = con.prepareStatement(queryString.toString());
//stmt.setString(i++, startDate);
stmt.setString(i++, endDate);
stmt.setString(i++, endDate);
rs = stmt.executeQuery();
while (rs.next()) {
String patientId = rs.getString("patient_id");
int encounterId = rs.getInt("encounter_id");
String patientIdentifier = rs.getString("identifier");
String firstName = rs.getString("given_name");
String lastName = rs.getString("family_name");
Map<String, String> tempData = new HashMap<>();
tempData.put("patientId", patientId);
tempData.put("encounterId", encounterId+"");
tempData.put("patientIdentifier", patientIdentifier);
tempData.put("firstName", firstName);
tempData.put("lastName", lastName);
allPatients.add(tempData);
}
return allPatients;
}
catch (SQLException ex) {
ex.printStackTrace();
Database.handleException(ex);
return null;
}
finally {
Database.cleanUp(rs, stmt, con);
}
}
public List<Map<String,String>> getActivePtsWithoutMaritalStatus(String startDate, String endDate) {
System.out.println(startDate);
System.out.println(endDate);
PreparedStatement stmt = null;
ResultSet rs = null;
Connection con = null;
List<Map<String, String>> allPatients = new ArrayList<>();
try {
con = Database.connectionPool.getConnection();
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
StringBuilder queryString = new StringBuilder(
" select IFNULL(hivE.encounter_id, 0) AS encounter_id, dqr_meta.patient_id, person_name.given_name, person_name.family_name, patient_identifier.identifier FROM dqr_meta "
+ " LEFT JOIN encounter hivE ON hivE.patient_id=dqr_meta.patient_id AND hivE.form_id=23 "
+ " JOIN person_name ON person_name.person_id=dqr_meta.patient_id "
+ " LEFT JOIN patient_identifier ON patient_identifier.patient_id=dqr_meta.patient_id AND patient_identifier.identifier_type=4 "
+ " JOIN dqr_pharmacy ON dqr_pharmacy.patient_id=dqr_meta.patient_id "
+ " WHERE "
+ " DATE_ADD(dqr_pharmacy.pickupdate, INTERVAL (dqr_pharmacy.days_refill+28) DAY) >= ? "
+ " AND dqr_pharmacy.pickupdate= ( "
+ " SELECT MAX(pickupdate) FROM dqr_pharmacy lastpickup "
+ " WHERE lastpickup.patient_id=dqr_pharmacy.patient_id "
+ " HAVING MAX(pickupdate) <=? ) "
+ " AND (dqr_meta.termination_status IS NULL OR dqr_meta.termination_status!=1066 ) ");
queryString.append(" AND dqr_meta.marital_status ='' GROUP BY dqr_meta.patient_id ");
int i = 1;
stmt = con.prepareStatement(queryString.toString());
//stmt.setString(i++, startDate);
stmt.setString(i++, endDate);
stmt.setString(i++, endDate);
rs = stmt.executeQuery();
while (rs.next()) {
String patientId = rs.getString("patient_id");
int encounterId = rs.getInt("encounter_id");
String patientIdentifier = rs.getString("identifier");
String firstName = rs.getString("given_name");
String lastName = rs.getString("family_name");
Map<String, String> tempData = new HashMap<>();
tempData.put("patientId", patientId);
tempData.put("encounterId", encounterId+"");
tempData.put("patientIdentifier", patientIdentifier);
tempData.put("firstName", firstName);
tempData.put("lastName", lastName);
if(encounterId == 0)
{
tempData.put("link", "/coreapps/clinicianfacing/patient.page?patientId="+patientId);
}
else{
tempData.put("link", "/htmlformentryui/htmlform/editHtmlFormWithStandardUi.page?patientId="+patientId+"&encounterId="+encounterId+"");
}
allPatients.add(tempData);
}
return allPatients;
}
catch (SQLException ex) {
ex.printStackTrace();
Database.handleException(ex);
return null;
}
finally {
Database.cleanUp(rs, stmt, con);
}
}
public List<Map<String,String>> getActivePtsWithoutOccupationStatus(String startDate, String endDate) {
System.out.println(startDate);
System.out.println(endDate);
PreparedStatement stmt = null;
ResultSet rs = null;
Connection con = null;
List<Map<String, String>> allPatients = new ArrayList<>();
try {
con = Database.connectionPool.getConnection();
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
StringBuilder queryString = new StringBuilder(
" select IFNULL(hivE.encounter_id, 0) AS encounter_id, dqr_meta.patient_id, person_name.given_name, person_name.family_name, patient_identifier.identifier FROM dqr_meta "
+ " LEFT JOIN encounter hivE ON hivE.patient_id=dqr_meta.patient_id AND hivE.form_id=23 "
+ " JOIN person_name ON person_name.person_id=dqr_meta.patient_id "
+ " LEFT JOIN patient_identifier ON patient_identifier.patient_id=dqr_meta.patient_id AND patient_identifier.identifier_type=4 "
+ " JOIN dqr_pharmacy ON dqr_pharmacy.patient_id=dqr_meta.patient_id "
+ " WHERE "
+ " DATE_ADD(dqr_pharmacy.pickupdate, INTERVAL (dqr_pharmacy.days_refill+28) DAY) >= ? "
+ " AND dqr_pharmacy.pickupdate= ( "
+ " SELECT MAX(pickupdate) FROM dqr_pharmacy lastpickup "
+ " WHERE lastpickup.patient_id=dqr_pharmacy.patient_id "
+ " HAVING MAX(pickupdate) <=? ) "
+ " AND (dqr_meta.termination_status IS NULL OR dqr_meta.termination_status!=1066 ) ");
queryString.append(" AND dqr_meta.occupation ='' GROUP BY dqr_meta.patient_id ");
int i = 1;
stmt = con.prepareStatement(queryString.toString());
//stmt.setString(i++, startDate);
stmt.setString(i++, endDate);
stmt.setString(i++, endDate);
rs = stmt.executeQuery();
while (rs.next()) {
String patientId = rs.getString("patient_id");
int encounterId = rs.getInt("encounter_id");
String patientIdentifier = rs.getString("identifier");
String firstName = rs.getString("given_name");
String lastName = rs.getString("family_name");
Map<String, String> tempData = new HashMap<>();
tempData.put("patientId", patientId);
tempData.put("encounterId", encounterId+"");
tempData.put("patientIdentifier", patientIdentifier);
tempData.put("firstName", firstName);
tempData.put("lastName", lastName);
if(encounterId == 0)
{
tempData.put("link", "/coreapps/clinicianfacing/patient.page?patientId="+patientId);
}
else{
tempData.put("link", "/htmlformentryui/htmlform/editHtmlFormWithStandardUi.page?patientId="+patientId+"&encounterId="+encounterId+"");
}
allPatients.add(tempData);
}
return allPatients;
}
catch (SQLException ex) {
ex.printStackTrace();
Database.handleException(ex);
return null;
}
finally {
Database.cleanUp(rs, stmt, con);
}
}
public List<Map<String,String>> getPtsStartedOnARTWithoutDocDob(String startDate, String endDate) {
PreparedStatement stmt = null;
ResultSet rs = null;
Connection con = null;
List<Map<String, String>> allPatients = new ArrayList<>();
try {
con = Database.connectionPool.getConnection();
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
StringBuilder queryString = new StringBuilder(
" select dqr_meta.patient_id, patient_identifier.identifier, person_name.given_name, person_name.family_name FROM dqr_meta "
+ " JOIN person_name ON person_name.person_id=dqr_meta.patient_id "
+ " LEFT JOIN patient_identifier ON patient_identifier.patient_id=dqr_meta.patient_id AND patient_identifier.identifier_type=4 "
+ " WHERE art_start_date >=? AND art_start_date <=? ");
queryString.append(" AND dqr_meta.dob ='' OR dqr_meta.dob IS NULL GROUP BY dqr_meta.patient_id ");
int i = 1;
stmt = con.prepareStatement(queryString.toString());
stmt.setString(i++, startDate);
stmt.setString(i++, endDate);
rs = stmt.executeQuery();
while (rs.next()) {
String patientId = rs.getString("patient_id");
String patientIdentifier = rs.getString("identifier");
String firstName = rs.getString("given_name");
String lastName = rs.getString("family_name");
Map<String, String> tempData = new HashMap<>();
tempData.put("patientId", patientId);
tempData.put("patientIdentifier", patientIdentifier);
tempData.put("firstName", firstName);
tempData.put("lastName", lastName);
tempData.put("link", "/registrationapp/editSection.page?patientId="+patientId+"§ionId=demographics&appId=referenceapplication.registrationapp.registerPatient");
allPatients.add(tempData);
}
return allPatients;
}
catch (SQLException ex) {
Database.handleException(ex);
return null;
}
finally {
Database.cleanUp(rs, stmt, con);
}
}
public List<Map<String,String>> getPtsStartedOnARTWithoutDocGender(String startDate, String endDate) {
PreparedStatement stmt = null;
ResultSet rs = null;
Connection con = null;
List<Map<String, String>> allPatients = new ArrayList<>();
try {
con = Database.connectionPool.getConnection();
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
StringBuilder queryString = new StringBuilder(
" select dqr_meta.patient_id, patient_identifier.identifier, person_name.given_name, person_name.family_name FROM dqr_meta "
+ " JOIN person_name ON person_name.person_id=dqr_meta.patient_id "
+ " LEFT JOIN patient_identifier ON patient_identifier.patient_id=dqr_meta.patient_id AND patient_identifier.identifier_type=4 "
+ " WHERE art_start_date >=? AND art_start_date <=? ");
queryString.append(" AND dqr_meta.gender ='' OR dqr_meta.gender IS NULL GROUP BY dqr_meta.patient_id ");
int i = 1;
stmt = con.prepareStatement(queryString.toString());
stmt.setString(i++, startDate);
stmt.setString(i++, endDate);
rs = stmt.executeQuery();
while (rs.next()) {
String patientId = rs.getString("patient_id");
String patientIdentifier = rs.getString("identifier");
String firstName = rs.getString("given_name");
String lastName = rs.getString("family_name");
Map<String, String> tempData = new HashMap<>();
tempData.put("patientId", patientId);
tempData.put("patientIdentifier", patientIdentifier);
tempData.put("firstName", firstName);
tempData.put("lastName", lastName);
tempData.put("link", "/registrationapp/editSection.page?patientId="+patientId+"§ionId=demographics&appId=referenceapplication.registrationapp.registerPatient");
allPatients.add(tempData);
}
return allPatients;
}
catch (SQLException ex) {
Database.handleException(ex);
return null;
}
finally {
Database.cleanUp(rs, stmt, con);
}
}
public List<Map<String,String>> getPtsStartedOnARTWithoutDocAddress(String startDate, String endDate) {
PreparedStatement stmt = null;
ResultSet rs = null;
Connection con = null;
List<Map<String, String>> allPatients = new ArrayList<>();
try {
con = Database.connectionPool.getConnection();
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
StringBuilder queryString = new StringBuilder(
" select dqr_meta.patient_id, patient_identifier.identifier, person_name.given_name, person_name.family_name FROM dqr_meta "
+ " JOIN person_name ON person_name.person_id=dqr_meta.patient_id "
+ " LEFT JOIN patient_identifier ON patient_identifier.patient_id=dqr_meta.patient_id AND patient_identifier.identifier_type=4 "
+ " WHERE art_start_date >=? AND art_start_date <=? ");
queryString.append(" AND dqr_meta.address ='' OR dqr_meta.address IS NULL GROUP BY dqr_meta.patient_id ");
int i = 1;
stmt = con.prepareStatement(queryString.toString());
stmt.setString(i++, startDate);
stmt.setString(i++, endDate);
rs = stmt.executeQuery();
while (rs.next()) {
String patientId = rs.getString("patient_id");
String patientIdentifier = rs.getString("identifier");
String firstName = rs.getString("given_name");
String lastName = rs.getString("family_name");
Map<String, String> tempData = new HashMap<>();
tempData.put("patientId", patientId);
tempData.put("patientIdentifier", patientIdentifier);
tempData.put("firstName", firstName);
tempData.put("lastName", lastName);
tempData.put("link", "/registrationapp/editSection.page?patientId="+patientId+"§ionId=demographics&appId=referenceapplication.registrationapp.registerPatient");
allPatients.add(tempData);
}
return allPatients;
}
catch (SQLException ex) {
Database.handleException(ex);
return null;
}
finally {
Database.cleanUp(rs, stmt, con);
}
}
public List<Map<String,String>> getPtsStartedOnARTWithoutDocHIVDiagnosisDate(String startDate, String endDate) {
PreparedStatement stmt = null;
ResultSet rs = null;
Connection con = null;
List<Map<String, String>> allPatients = new ArrayList<>();
try {
con = Database.connectionPool.getConnection();
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
StringBuilder queryString = new StringBuilder(
" SELECT IFNULL(hivE.encounter_id, 0) AS encounter_id, dqr_meta.patient_id, person_name.given_name, person_name.family_name, patient_identifier.identifier FROM dqr_meta "
+ " LEFT JOIN encounter hivE ON hivE.patient_id=dqr_meta.patient_id AND hivE.form_id=23 "
+ " JOIN person_name ON person_name.person_id=dqr_meta.patient_id "
+ " LEFT JOIN patient_identifier ON patient_identifier.patient_id=dqr_meta.patient_id AND patient_identifier.identifier_type=4 "
+ " WHERE art_start_date >=? AND art_start_date <=? ");
queryString.append(" AND (dqr_meta.hiv_diagnosis_date ='' OR dqr_meta.hiv_diagnosis_date IS NULL ) GROUP BY dqr_meta.patient_id");
int i = 1;
stmt = con.prepareStatement(queryString.toString());
stmt.setString(i++, startDate);
stmt.setString(i++, endDate);
rs = stmt.executeQuery();
while (rs.next()) {
String patientId = rs.getString("patient_id");
String patientIdentifier = rs.getString("identifier");
String firstName = rs.getString("given_name");
String lastName = rs.getString("family_name");
int encounterId = rs.getInt("encounter_id");
Map<String, String> tempData = new HashMap<>();
tempData.put("patientId", patientId);
tempData.put("patientIdentifier", patientIdentifier);
tempData.put("firstName", firstName);
tempData.put("lastName", lastName);
if(encounterId == 0)
{
tempData.put("link", "/coreapps/clinicianfacing/patient.page?patientId="+patientId);
}
else{
tempData.put("link", "/htmlformentryui/htmlform/editHtmlFormWithStandardUi.page?patientId="+patientId+"&encounterId="+encounterId+"");
}
allPatients.add(tempData);
}
return allPatients;
}
catch (SQLException ex) {
Database.handleException(ex);
return null;
}
finally {
Database.cleanUp(rs, stmt, con);
}
}
public List<Map<String,String>> getPtsStartedOnARTWithoutDocHIVEnrollmentDate(String startDate, String endDate) {
PreparedStatement stmt = null;
ResultSet rs = null;
Connection con = null;
List<Map<String, String>> allPatients = new ArrayList<>();
try {
con = Database.connectionPool.getConnection();
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
StringBuilder queryString = new StringBuilder(
" SELECT IFNULL(hivE.encounter_id, 0) AS encounter_id, dqr_meta.patient_id, person_name.given_name, person_name.family_name, patient_identifier.identifier FROM dqr_meta "
+ " LEFT JOIN encounter hivE ON hivE.patient_id=dqr_meta.patient_id AND hivE.form_id=23 "
+ " JOIN person_name ON person_name.person_id=dqr_meta.patient_id "
+ " LEFT JOIN patient_identifier ON patient_identifier.patient_id=dqr_meta.patient_id AND patient_identifier.identifier_type=4 "
+ " WHERE art_start_date >=? AND art_start_date <=? ");
queryString.append(" AND (dqr_meta.hiv_enrollment_date ='' OR dqr_meta.hiv_enrollment_date IS NULL ) GROUP BY dqr_meta.patient_id ");
int i = 1;
stmt = con.prepareStatement(queryString.toString());
stmt.setString(i++, startDate);
stmt.setString(i++, endDate);
rs = stmt.executeQuery();
while (rs.next()) {
String patientId = rs.getString("patient_id");
String patientIdentifier = rs.getString("identifier");
String firstName = rs.getString("given_name");
String lastName = rs.getString("family_name");
int encounterId = rs.getInt("encounter_id");
Map<String, String> tempData = new HashMap<>();
tempData.put("patientId", patientId);
tempData.put("patientIdentifier", patientIdentifier);
tempData.put("firstName", firstName);
tempData.put("lastName", lastName);
if(encounterId == 0)
{
tempData.put("link", "/coreapps/clinicianfacing/patient.page?patientId="+patientId);
}
else{
tempData.put("link", "/htmlformentryui/htmlform/editHtmlFormWithStandardUi.page?patientId="+patientId+"&encounterId="+encounterId+"");
}
allPatients.add(tempData);
}
return allPatients;
}
catch (SQLException ex) {
Database.handleException(ex);
return null;
}
finally {
Database.cleanUp(rs, stmt, con);
}
}
public List<Map<String,String>> getPtsStartedOnARTWithDocDrugPickup(String startDate, String endDate) {
PreparedStatement stmt = null;
ResultSet rs = null;
Connection con = null;
try {
con = Database.connectionPool.getConnection();
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
StringBuilder queryString = new StringBuilder(
" select dqr_meta.patient_id, person_name.given_name, person_name.family_name, patient_identifier.identifier FROM dqr_meta "
+ " JOIN person_name ON person_name.person_id=dqr_meta.patient_id "
+ " LEFT JOIN patient_identifier ON patient_identifier.patient_id=dqr_meta.patient_id AND patient_identifier.identifier_type=4 "
+ " WHERE art_start_date >=? AND art_start_date <=? ");
queryString.append(" AND dqr_meta.patient_id NOT IN (SELECT patient_id FROM dqr_pharmacy) GROUP BY dqr_meta.patient_id ");
int i = 1;
stmt = con.prepareStatement(queryString.toString());
stmt.setString(i++, startDate);
stmt.setString(i++, endDate);
rs = stmt.executeQuery();
List<Map<String, String>> allPatients = new ArrayList<>();
while (rs.next()) {
String patientId = rs.getString("patient_id");
String patientIdentifier = rs.getString("identifier");
String firstName = rs.getString("given_name");
String lastName = rs.getString("family_name");
Map<String, String> tempData = new HashMap<>();
tempData.put("patientId", patientId);
tempData.put("patientIdentifier", patientIdentifier);
tempData.put("firstName", firstName);
tempData.put("lastName", lastName);
tempData.put("link", "/coreapps/clinicianfacing/patient.page?patientId="+patientId);
allPatients.add(tempData);
}
return allPatients;
}
catch (SQLException ex) {
Database.handleException(ex);
return null;
}
finally {
Database.cleanUp(rs, stmt, con);
}
}
public List<Map<String,String>> getPtsStartedOnARTWithDocCd4(String startDate, String endDate) {
PreparedStatement stmt = null;
ResultSet rs = null;
Connection con = null;
List<Map<String, String>> allPatients = new ArrayList<>();
try {
con = Database.connectionPool.getConnection();
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
StringBuilder queryString = new StringBuilder(
" select dqr_meta.patient_id, person_name.given_name, person_name.family_name, patient_identifier.identifier FROM dqr_meta "
+ " JOIN person_name ON person_name.person_id=dqr_meta.patient_id "
+ " LEFT JOIN patient_identifier ON patient_identifier.patient_id=dqr_meta.patient_id AND patient_identifier.identifier_type=4 "
+ " WHERE (art_start_date BETWEEN ? AND ?) ");
queryString.append(" AND dqr_meta.patient_id NOT IN (SELECT person_id FROM obs WHERE concept_id=5497 AND (value_numeric IS NOT NULL OR value_numeric >0) AND obs.voided=0) GROUP BY dqr_meta.patient_id ");
int i = 1;
stmt = con.prepareStatement(queryString.toString());
stmt.setString(i++, startDate);
stmt.setString(i++, endDate);
rs = stmt.executeQuery();
while (rs.next()) {
String patientId = rs.getString("patient_id");
String patientIdentifier = rs.getString("identifier");
String firstName = rs.getString("given_name");
String lastName = rs.getString("family_name");
Map<String, String> tempData = new HashMap<>();
tempData.put("patientId", patientId);
tempData.put("patientIdentifier", patientIdentifier);
tempData.put("firstName", firstName);
tempData.put("lastName", lastName);
tempData.put("link", "/coreapps/clinicianfacing/patient.page?patientId="+patientId);
allPatients.add(tempData);
}
return allPatients;
}
catch (SQLException ex) {
Database.handleException(ex);
return null;
}
finally {
Database.cleanUp(rs, stmt, con);
}
}
public List<Map<String,String>> getPtsWithClinicVisitWithoutDocWeight(String startDate, String endDate) {
PreparedStatement stmt = null;
ResultSet rs = null;
Connection con = null;
List<Map<String, String>> allPatients = new ArrayList<>();
try {
con = Database.connectionPool.getConnection();
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
StringBuilder queryString = new StringBuilder( " SELECT IFNULL(encounter.encounter_id, 0) AS encounter_id, encounter.encounter_datetime, dqr_meta.patient_id, person_name.given_name, person_name.family_name, patient_identifier.identifier FROM dqr_meta " +
" LEFT JOIN encounter ON encounter.patient_id=dqr_meta.patient_id AND encounter.form_id IN (22, 14, 20)" +
" JOIN person_name ON person_name.person_id=dqr_meta.patient_id " +
" LEFT JOIN patient_identifier ON patient_identifier.patient_id=dqr_meta.patient_id AND patient_identifier.identifier_type=4 " +
" WHERE dqr_meta.patient_id IN (SELECT dqr_clinicals.patient_id FROM dqr_clinicals " +
" JOIN encounter ON encounter.encounter_id=dqr_clinicals.encounter_id " +
" WHERE (dqr_clinicals.weight IS NULL ) " +
" AND encounter.encounter_datetime=(SELECT MAX(encounter_datetime) FROM encounter carecard " +
" WHERE carecard.patient_id=encounter.patient_id AND carecard.encounter_datetime BETWEEN ? AND ? )" +
" )" +
" AND encounter.encounter_datetime BETWEEN ? AND ? " +
" GROUP BY dqr_meta.patient_id " );
int i = 1;
stmt = con.prepareStatement(queryString.toString());
stmt.setString(i++, startDate);
stmt.setString(i++, endDate);
stmt.setString(i++, startDate);
stmt.setString(i++, endDate);
rs = stmt.executeQuery();
while (rs.next()) {
int encounterId = rs.getInt("encounter_id");
String patientId = rs.getString("patient_id");
String patientIdentifier = rs.getString("identifier");
String firstName = rs.getString("given_name");
String lastName = rs.getString("family_name");
Map<String, String> tempData = new HashMap<>();
tempData.put("patientId", patientId);
tempData.put("patientIdentifier", patientIdentifier);
tempData.put("firstName", firstName);
tempData.put("lastName", lastName);
if(encounterId == 0)
{
tempData.put("link", "/coreapps/clinicianfacing/patient.page?patientId="+patientId);
}
else{
tempData.put("link", "/htmlformentryui/htmlform/editHtmlFormWithStandardUi.page?patientId="+patientId+"&encounterId="+encounterId+"");
}
allPatients.add(tempData);
}
return allPatients;
}
catch (SQLException ex) {
Database.handleException(ex);
return null;
}
finally {
Database.cleanUp(rs, stmt, con);
}
}
public List<Map<String,String>> getPtsWithClinicVisitWithoutDocMuac(String startDate, String endDate) {
PreparedStatement stmt = null;
ResultSet rs = null;
Connection con = null;
List<Map<String, String>> allPatients = new ArrayList<>();
try {
con = Database.connectionPool.getConnection();
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
StringBuilder queryString = new StringBuilder( " select IFNULL(encounter.encounter_id, 0) AS encounter_id, encounter.encounter_datetime, dqr_meta.patient_id, person_name.given_name, person_name.family_name, patient_identifier.identifier FROM dqr_meta " +
" LEFT JOIN encounter ON encounter.patient_id=dqr_meta.patient_id AND encounter.form_id IN (22, 14, 20)" +
" JOIN person_name ON person_name.person_id=dqr_meta.patient_id " +
" LEFT JOIN patient_identifier ON patient_identifier.patient_id=dqr_meta.patient_id AND patient_identifier.identifier_type=4 " +
" WHERE dqr_meta.patient_id IN (SELECT dqr_clinicals.patient_id FROM dqr_clinicals " +
" JOIN encounter ON encounter.encounter_id=dqr_clinicals.encounter_id " +
" WHERE dqr_clinicals.muac IS NULL OR dqr_clinicals.muac='' " +
" AND encounter.encounter_datetime=(SELECT MAX(encounter_datetime) FROM encounter carecard " +
" WHERE carecard.patient_id=encounter.patient_id AND carecard.encounter_datetime BETWEEN ? AND ? )" +
" )" +
" AND encounter.encounter_datetime BETWEEN ? AND ? AND TIMESTAMPDIFF(YEAR,dqr_meta.dob, ?) <15 " +
" GROUP BY dqr_meta.patient_id " );
int i = 1;
stmt = con.prepareStatement(queryString.toString());
stmt.setString(i++, startDate);
stmt.setString(i++, endDate);
stmt.setString(i++, startDate);
stmt.setString(i++, endDate);
stmt.setString(i++, endDate);
rs = stmt.executeQuery();
while (rs.next()) {
int encounterId = rs.getInt("encounter_id");
String patientId = rs.getString("patient_id");
String patientIdentifier = rs.getString("identifier");
String firstName = rs.getString("given_name");
String lastName = rs.getString("family_name");
Map<String, String> tempData = new HashMap<>();
tempData.put("patientId", patientId);
tempData.put("patientIdentifier", patientIdentifier);
tempData.put("firstName", firstName);
tempData.put("lastName", lastName);
if(encounterId == 0)
{
tempData.put("link", "/coreapps/clinicianfacing/patient.page?patientId="+patientId);
}
else{
tempData.put("link", "/htmlformentryui/htmlform/editHtmlFormWithStandardUi.page?patientId="+patientId+"&encounterId="+encounterId+"");
}
allPatients.add(tempData);
}
return allPatients;
}
catch (SQLException ex) {
Database.handleException(ex);
return null;
}
finally {
Database.cleanUp(rs, stmt, con);
}
}
public List<Map<String,String>> getPtsWithClinicVisitWithoutDocStaging(String startDate, String endDate) {
PreparedStatement stmt = null;
ResultSet rs = null;
Connection con = null;
List<Map<String, String>> allPatients = new ArrayList<>();
try {
con = Database.connectionPool.getConnection();
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
StringBuilder queryString = new StringBuilder( " select IFNULL(encounter.encounter_id, 0) AS encounter_id, encounter.encounter_datetime, dqr_meta.patient_id, person_name.given_name, person_name.family_name, patient_identifier.identifier FROM dqr_meta " +
" LEFT JOIN encounter ON encounter.patient_id=dqr_meta.patient_id AND encounter.form_id IN (22, 14, 20)" +
" JOIN person_name ON person_name.person_id=dqr_meta.patient_id " +
" LEFT JOIN patient_identifier ON patient_identifier.patient_id=dqr_meta.patient_id AND patient_identifier.identifier_type=4 " +
" WHERE dqr_meta.patient_id IN (SELECT dqr_clinicals.patient_id FROM dqr_clinicals " +
" JOIN encounter ON encounter.encounter_id=dqr_clinicals.encounter_id " +
" WHERE dqr_clinicals.who_stage IS NULL OR dqr_clinicals.who_stage='' " +
" AND encounter.encounter_datetime=(SELECT MAX(encounter_datetime) FROM encounter carecard " +
" WHERE carecard.patient_id=encounter.patient_id AND carecard.encounter_datetime BETWEEN ? AND ? )" +
" )" +
" AND encounter.encounter_datetime BETWEEN ? AND ? " +
" GROUP BY dqr_meta.patient_id " );
int i = 1;
stmt = con.prepareStatement(queryString.toString());
stmt.setString(i++, startDate);
stmt.setString(i++, endDate);
stmt.setString(i++, startDate);
stmt.setString(i++, endDate);
//stmt.setString(i++, endDate);
rs = stmt.executeQuery();
while (rs.next()) {
int encounterId = rs.getInt("encounter_id");
String patientId = rs.getString("patient_id");
String patientIdentifier = rs.getString("identifier");
String firstName = rs.getString("given_name");
String lastName = rs.getString("family_name");
Map<String, String> tempData = new HashMap<>();
tempData.put("patientId", patientId);
tempData.put("patientIdentifier", patientIdentifier);
tempData.put("firstName", firstName);
tempData.put("lastName", lastName);
if(encounterId == 0)
{
tempData.put("link", "/coreapps/clinicianfacing/patient.page?patientId="+patientId);
}
else{
tempData.put("link", "/htmlformentryui/htmlform/editHtmlFormWithStandardUi.page?patientId="+patientId+"&encounterId="+encounterId+"");
}
allPatients.add(tempData);
}
return allPatients;
}
catch (SQLException ex) {
Database.handleException(ex);
return null;
}
finally {
Database.cleanUp(rs, stmt, con);
}
}
public List<Map<String,String>> getPtsWithClinicVisitWithoutDocTBStatus(String startDate, String endDate) {
PreparedStatement stmt = null;
ResultSet rs = null;
Connection con = null;
List<Map<String, String>> allPatients = new ArrayList<>();
try {
con = Database.connectionPool.getConnection();
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
StringBuilder queryString = new StringBuilder( " select IFNULL(encounter.encounter_id, 0) AS encounter_id, encounter.encounter_datetime, dqr_meta.patient_id, person_name.given_name, person_name.family_name, patient_identifier.identifier FROM dqr_meta " +
" LEFT JOIN encounter ON encounter.patient_id=dqr_meta.patient_id AND encounter.form_id IN (22, 14, 20)" +
" JOIN person_name ON person_name.person_id=dqr_meta.patient_id " +
" LEFT JOIN patient_identifier ON patient_identifier.patient_id=dqr_meta.patient_id AND patient_identifier.identifier_type=4 " +
" WHERE dqr_meta.patient_id IN (SELECT dqr_clinicals.patient_id FROM dqr_clinicals " +
" JOIN encounter ON encounter.encounter_id=dqr_clinicals.encounter_id " +
" WHERE dqr_clinicals.tb_status IS NULL OR dqr_clinicals.tb_status='' " +
" AND encounter.encounter_datetime=(SELECT MAX(encounter_datetime) FROM encounter carecard " +
" WHERE carecard.patient_id=encounter.patient_id AND carecard.encounter_datetime BETWEEN ? AND ? )" +
" )" +
" AND encounter.encounter_datetime BETWEEN ? AND ? " +
" GROUP BY dqr_meta.patient_id " );
int i = 1;
stmt = con.prepareStatement(queryString.toString());
stmt.setString(i++, startDate);
stmt.setString(i++, endDate);
stmt.setString(i++, startDate);
stmt.setString(i++, endDate);
// stmt.setString(i++, endDate);
rs = stmt.executeQuery();
while (rs.next()) {
int encounterId = rs.getInt("encounter_id");
String patientId = rs.getString("patient_id");
String patientIdentifier = rs.getString("identifier");
String firstName = rs.getString("given_name");
String lastName = rs.getString("family_name");
Map<String, String> tempData = new HashMap<>();
tempData.put("patientId", patientId);
tempData.put("patientIdentifier", patientIdentifier);
tempData.put("firstName", firstName);
tempData.put("lastName", lastName);
if(encounterId == 0)
{
tempData.put("link", "/coreapps/clinicianfacing/patient.page?patientId="+patientId);
}
else{
tempData.put("link", "/htmlformentryui/htmlform/editHtmlFormWithStandardUi.page?patientId="+patientId+"&encounterId="+encounterId+"");
}
allPatients.add(tempData);
}
return allPatients;
}
catch (SQLException ex) {
Database.handleException(ex);
return null;
}
finally {
Database.cleanUp(rs, stmt, con);
}
}
public List<Map<String,String>> getPtsWithClinicVisitWithoutDocFunctionalStatus(String startDate, String endDate) {
PreparedStatement stmt = null;
ResultSet rs = null;
Connection con = null;
List<Map<String, String>> allPatients = new ArrayList<>();
try {
con = Database.connectionPool.getConnection();
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
StringBuilder queryString = new StringBuilder( " select IFNULL(encounter.encounter_id, 0) AS encounter_id, encounter.encounter_datetime, dqr_meta.patient_id, person_name.given_name, person_name.family_name, patient_identifier.identifier FROM dqr_meta " +
" LEFT JOIN encounter ON encounter.patient_id=dqr_meta.patient_id AND encounter.form_id IN (22, 14, 20)" +
" JOIN person_name ON person_name.person_id=dqr_meta.patient_id " +
" LEFT JOIN patient_identifier ON patient_identifier.patient_id=dqr_meta.patient_id AND patient_identifier.identifier_type=4 " +
" WHERE dqr_meta.patient_id IN (SELECT dqr_clinicals.patient_id FROM dqr_clinicals " +
" JOIN encounter ON encounter.encounter_id=dqr_clinicals.encounter_id " +
" WHERE dqr_clinicals.functional_status IS NULL OR dqr_clinicals.functional_status='' " +
" AND encounter.encounter_datetime=(SELECT MAX(encounter_datetime) FROM encounter carecard " +
" WHERE carecard.patient_id=encounter.patient_id AND carecard.encounter_datetime BETWEEN ? AND ? )" +
" )" +
" AND encounter.encounter_datetime BETWEEN ? AND ? " +
" GROUP BY dqr_meta.patient_id " );
int i = 1;
stmt = con.prepareStatement(queryString.toString());
stmt.setString(i++, startDate);
stmt.setString(i++, endDate);
stmt.setString(i++, startDate);
stmt.setString(i++, endDate);
//stmt.setString(i++, endDate);
rs = stmt.executeQuery();
while (rs.next()) {
int encounterId = rs.getInt("encounter_id");
String patientId = rs.getString("patient_id");
String patientIdentifier = rs.getString("identifier");
String firstName = rs.getString("given_name");
String lastName = rs.getString("family_name");
Map<String, String> tempData = new HashMap<>();
tempData.put("patientId", patientId);
tempData.put("patientIdentifier", patientIdentifier);
tempData.put("firstName", firstName);
tempData.put("lastName", lastName);
if(encounterId == 0)
{
tempData.put("link", "/coreapps/clinicianfacing/patient.page?patientId="+patientId);
}
else{
tempData.put("link", "/htmlformentryui/htmlform/editHtmlFormWithStandardUi.page?patientId="+patientId+"&encounterId="+encounterId+"");
}
allPatients.add(tempData);
}
return allPatients;
}
catch (SQLException ex) {
Database.handleException(ex);
return null;
}
finally {
Database.cleanUp(rs, stmt, con);
}
}
public List<Map<String,String>> getPtsStartedOnARTWithoutInitialRegimen(String startDate, String endDate) {
PreparedStatement stmt = null;
ResultSet rs = null;
Connection con = null;
List<Map<String, String>> allPatients = new ArrayList<>();
try {
con = Database.connectionPool.getConnection();
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
StringBuilder queryString = new StringBuilder(
" select dqr_meta.patient_id, person_name.given_name, person_name.family_name, patient_identifier.identifier FROM dqr_meta "+
" JOIN person_name ON person_name.person_id=dqr_meta.patient_id " +
" LEFT JOIN patient_identifier ON patient_identifier.patient_id=dqr_meta.patient_id AND patient_identifier.identifier_type=4 "
+ " WHERE art_start_date >=? AND art_start_date <=? ");
queryString.append(" AND dqr_meta.dob !='' AND dqr_meta.dob IS NOT NULL "
+ " AND dqr_meta.patient_id IN (SELECT patient_id FROM dqr_pharmacy WHERE regimen_line IS NULL)");
int i = 1;
stmt = con.prepareStatement(queryString.toString());
stmt.setString(i++, startDate);
stmt.setString(i++, endDate);
//stmt.setString(i++, endDate);
rs = stmt.executeQuery();
while (rs.next()) {
int encounterId = 0;//rs.getInt("encounter_id");
String patientId = rs.getString("patient_id");
String patientIdentifier = rs.getString("identifier");
String firstName = rs.getString("given_name");
String lastName = rs.getString("family_name");
Map<String, String> tempData = new HashMap<>();
tempData.put("patientId", patientId);
tempData.put("patientIdentifier", patientIdentifier);
tempData.put("firstName", firstName);
tempData.put("lastName", lastName);
if(encounterId == 0)
{
tempData.put("link", "/coreapps/clinicianfacing/patient.page?patientId="+patientId);
}
else{
tempData.put("link", "/htmlformentryui/htmlform/editHtmlFormWithStandardUi.page?patientId="+patientId+"&encounterId="+encounterId+"");
}
allPatients.add(tempData);
}
return allPatients;
}
catch (SQLException ex) {
Database.handleException(ex);
return null;
}
finally {
Database.cleanUp(rs, stmt, con);
}
}
public List<Map<String,String>> getPtsWithClinicVisitDocNextAppDate(String startDate, String endDate) {
PreparedStatement stmt = null;
ResultSet rs = null;
Connection con = null;
List<Map<String, String>> allPatients = new ArrayList<>();
try {
con = Database.connectionPool.getConnection();
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
StringBuilder queryString = new StringBuilder( " select IFNULL(encounter.encounter_id, 0) AS encounter_id, encounter.encounter_datetime, dqr_meta.patient_id, person_name.given_name, person_name.family_name, patient_identifier.identifier FROM dqr_meta " +
" LEFT JOIN encounter ON encounter.patient_id=dqr_meta.patient_id AND encounter.form_id IN (22, 14, 20)" +
" JOIN person_name ON person_name.person_id=dqr_meta.patient_id " +
" LEFT JOIN patient_identifier ON patient_identifier.patient_id=dqr_meta.patient_id AND patient_identifier.identifier_type=4 " +
" WHERE dqr_meta.patient_id IN (SELECT dqr_clinicals.patient_id FROM dqr_clinicals " +
" JOIN encounter ON encounter.encounter_id=dqr_clinicals.encounter_id " +
" WHERE (dqr_clinicals.nextapp_date IS NULL OR dqr_clinicals.nextapp_date='') " +
" AND encounter.encounter_datetime=(SELECT MAX(encounter_datetime) FROM encounter carecard " +
" WHERE carecard.patient_id=encounter.patient_id AND carecard.encounter_datetime BETWEEN ? AND ? )" +
" )" +
" AND encounter.encounter_datetime BETWEEN ? AND ? " +
" GROUP BY dqr_meta.patient_id " );
int i = 1;
stmt = con.prepareStatement(queryString.toString());
stmt.setString(i++, startDate);
stmt.setString(i++, endDate);
stmt.setString(i++, startDate);
stmt.setString(i++, endDate);
//stmt.setString(i++, endDate);
rs = stmt.executeQuery();
while (rs.next()) {
int encounterId = rs.getInt("encounter_id");
String patientId = rs.getString("patient_id");
String patientIdentifier = rs.getString("identifier");
String firstName = rs.getString("given_name");
String lastName = rs.getString("family_name");
Map<String, String> tempData = new HashMap<>();
tempData.put("patientId", patientId);
tempData.put("patientIdentifier", patientIdentifier);
tempData.put("firstName", firstName);
tempData.put("lastName", lastName);
if(encounterId == 0)
{
tempData.put("link", "/coreapps/clinicianfacing/patient.page?patientId="+patientId);
}
else{
tempData.put("link", "/htmlformentryui/htmlform/editHtmlFormWithStandardUi.page?patientId="+patientId+"&encounterId="+encounterId+"");
}
allPatients.add(tempData);
}
return allPatients;
}
catch (SQLException ex) {
Database.handleException(ex);
return null;
}
finally {
Database.cleanUp(rs, stmt, con);
}
}
public List<Map<String,String>> getInactiveActivePtsWithDocReason(String startDate, String endDate) {
PreparedStatement stmt = null;
ResultSet rs = null;
Connection con = null;
List<Map<String, String>> allPatients = new ArrayList<>();
try {
con = Database.connectionPool.getConnection();
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
StringBuilder queryString = new StringBuilder(
" SELECT dqr_meta.patient_id, person_name.given_name, person_name.family_name, patient_identifier.identifier FROM dqr_meta "+
" JOIN person_name ON person_name.person_id=dqr_meta.patient_id " +
" LEFT JOIN patient_identifier ON patient_identifier.patient_id=dqr_meta.patient_id AND patient_identifier.identifier_type=4 "
+ " JOIN dqr_pharmacy ON dqr_pharmacy.patient_id=dqr_meta.patient_id " + " WHERE "
+ " DATE_ADD(dqr_pharmacy.pickupdate, INTERVAL (dqr_pharmacy.days_refill+28) DAY) < ? "
+ " AND (dqr_meta.termination_status IS NULL ) "
+ " AND dqr_pharmacy.pickupdate= ( SELECT MAX(pickupdate) FROM dqr_pharmacy lastpickup "
+ " WHERE lastpickup.patient_id=dqr_pharmacy.patient_id "
+ " HAVING MAX(pickupdate) <=? ) " );
int i = 1;
stmt = con.prepareStatement(queryString.toString());
stmt.setString(i++, endDate);
stmt.setString(i++, endDate);
rs = stmt.executeQuery();
while (rs.next()) {
int encounterId = 0;//rs.getInt("encounter_id");
String patientId = rs.getString("patient_id");
String patientIdentifier = rs.getString("identifier");
String firstName = rs.getString("given_name");
String lastName = rs.getString("family_name");
Map<String, String> tempData = new HashMap<>();
tempData.put("patientId", patientId);
tempData.put("patientIdentifier", patientIdentifier);
tempData.put("firstName", firstName);
tempData.put("lastName", lastName);
if(encounterId == 0)
{
tempData.put("link", "/coreapps/clinicianfacing/patient.page?patientId="+patientId);
}
else{
tempData.put("link", "/htmlformentryui/htmlform/editHtmlFormWithStandardUi.page?patientId="+patientId+"&encounterId="+encounterId+"");
}
allPatients.add(tempData);
}
return allPatients;
}
catch (SQLException ex) {
Database.handleException(ex);
return new ArrayList<>();
}
finally {
Database.cleanUp(rs, stmt, con);
}
}
/*public List<Map<String,String>> getPtsStartedOnARTWithoutDocGender(String startDate, String endDate) {
PreparedStatement stmt = null;
ResultSet rs = null;
Connection con = null;
try {
con = Database.connectionPool.getConnection();
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
//stmt = Database.conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
StringBuilder queryString = new StringBuilder(
" select COUNT(distinct dqr_meta.patient_id) AS count FROM dqr_meta "
+ " WHERE art_start_date >=? AND art_start_date <=? ");
queryString.append(" AND dqr_meta.gender ='' OR dqr_meta.gender IS NULL ");
int i = 1;
stmt = con.prepareStatement(queryString.toString());
stmt.setString(i++, startDate);
stmt.setString(i++, endDate);
rs = stmt.executeQuery();
rs.next();
int totalCount = rs.getInt("count");
return totalCount;
}
catch (SQLException ex) {
Database.handleException(ex);
return 0;
}
finally {
Database.cleanUp(rs, stmt, con);
}
}*/
}
|
[
"cherubimpathway@gmail.com"
] |
cherubimpathway@gmail.com
|
140ea2b7d8c616956b8d0432ee813dc41b5a20c8
|
dc3d71af7d88486e37d5ce9bcd46a5a772df0084
|
/frame/spring_lian_ioc/src/main/java/code02/Main02.java
|
3dafc362ebdc0c96b075117d10d95fbaf24ce308
|
[] |
no_license
|
ArrayListBiubiu/frame
|
3f67bbd7d0cb101f129d4d391ca38cc63d6a5f76
|
33c71a23c308a34632725cfef8b2ebc6046acd26
|
refs/heads/master
| 2023-02-23T10:09:28.715175
| 2021-02-04T06:43:20
| 2021-02-04T06:43:20
| 297,197,583
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,434
|
java
|
package code02;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
* 在多例模式下每一次都需要创建新的bean对象,因为一个类中可能存在多个构造方法,所以需要根据 "配置文件中的参数" 或 "传入的参数" 来确定最终需要调用的构造方法,
* spring容器通过解析,将确定好的构造函数缓存到 BeanDefinition 中的 resolvedConstructorOrFactoryMethod 属性中,在下次需要相同的构造方法时,直接从缓存中获取。
*
* 例如在本案例中,需要创建2个Person对象,第一次getBean()的时候,在createBeanInstance()方法中有如下代码:
* if (mbd.resolvedConstructorOrFactoryMethod != null) {
* resolved = true;
* autowireNecessary = mbd.constructorArgumentsResolved;
* }
* resolvedConstructorOrFactoryMethod 一定是null,但是第二次 getBean() 的时候,resolvedConstructorOrFactoryMethod就不是null了
*
* 构造器的排序,(1)权限,public优先 (2)参数个数,多的优先
*/
public class Main02 {
public static void main(String[] args) {
ApplicationContext ac = new ClassPathXmlApplicationContext("code02.xml");
Person person = ac.getBean(Person.class);
Person person2 = ac.getBean(Person.class);
System.out.println(person==person2);
}
}
|
[
"1010015306@qq.com"
] |
1010015306@qq.com
|
57846b0daf4e99f1fe1f271db8314f277af13e87
|
262539df79b5670ee635d4919ad6682015655898
|
/src/application/Program.java
|
2475de1e5c7325796bc6e8721345e5284d46b276
|
[] |
no_license
|
EliseuMacedo/Contrato
|
ba458686d88deb92927af8d8a324f0bce0433dc7
|
b67d3383d7337230139d0bd426dbdba6b824039d
|
refs/heads/master
| 2020-05-15T19:55:36.551121
| 2019-04-21T03:30:04
| 2019-04-21T03:30:04
| 182,469,167
| 0
| 0
| null | null | null | null |
ISO-8859-1
|
Java
| false
| false
| 2,248
|
java
|
package application;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.Scanner;
import entidades.ContratoHora;
import entidades.Departamento;
import entidades.Funcionario;
import entidades.enums.NivelDeTrabalho;
public class Program {
public static void main(String[] args) throws ParseException {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
Locale.setDefault(Locale.US);
// novo objeto de data
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
System.out.print("Nome do departamento: ");
String dep = sc.nextLine();
Departamento departamento = new Departamento(dep);
System.out.println("Dados do trabalhador:");
System.out.print("Nome: ");
String nome = sc.nextLine();
System.out.print("Nivel - JUNIOR/PLENO/SENIOR: ");
String nivel = sc.nextLine();
System.out.print("Salario base: ");
double salarioBase = sc.nextDouble();
//instanciar o objeto
Funcionario funcionario = new Funcionario(nome, NivelDeTrabalho.valueOf(nivel), salarioBase, departamento);
System.out.print("Quantos contratos você quer adicionar:? ");
int n = sc.nextInt();
for (int i = 1; i <= n; i++) {
System.out.println("Entre com os dados do " + i + "º contrato:");
System.out.print("Data (DD/MM/YYYY): ");
// Inserir uma string de data
Date data = sdf.parse(sc.next());
System.out.print("Valor por hora: ");
double valorPorHora = sc.nextDouble();
System.out.print("Duração em horas: ");
int horas = sc.nextInt();
//novo objeto e adicionar a lista
ContratoHora contrato = new ContratoHora(data, valorPorHora, horas);
funcionario.addContratoHora(contrato);
}
System.out.print("\nEntre com o mês e o ano para ver os ganhos (MM/YYYY): ");
String mesAno = sc.next();
int mes = Integer.parseInt(mesAno.substring(0,2));
int ano = Integer.parseInt(mesAno.substring(3));
double result = funcionario.ganhos(ano, mes);
System.out.println("Nome: " + funcionario.getNome());
System.out.println("Departamento: " + funcionario.departamento.getNome());
System.out.println("Ganhos para " + mesAno + ": " + String.format("%.2f", result));
sc.close();
}
}
|
[
"eliseumcd@gmail.com"
] |
eliseumcd@gmail.com
|
9db2ce31b3eb43d7dcbceaee5cd33744649b4a09
|
e462e411986330d24e5f88d627d7258bc56dc5bb
|
/sourcecode/bms/src/main/java/com/example/systemParam/controller/SystemParamController.java
|
588b3678e616ac6638dc4c7d8e1a235d4ce0494c
|
[] |
no_license
|
hieunh1801/book-manager
|
b7230999f424faa7790b83b513aef448b576c094
|
2afeb771216af57c24b69d777cf4de1bd115ef2f
|
refs/heads/master
| 2023-01-09T14:31:00.373843
| 2020-06-04T14:30:27
| 2020-06-04T14:30:27
| 232,077,553
| 0
| 0
| null | 2023-01-01T15:18:06
| 2020-01-06T10:29:57
|
CSS
|
UTF-8
|
Java
| false
| false
| 3,288
|
java
|
package com.example.systemParam.controller;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import com.example.borrow.form.BorrowInfoForm;
import com.example.common.CommonUtil;
import com.example.common.Constants;
import com.example.common.Response;
import com.example.systemParam.bo.SystemParamBO;
import com.example.systemParam.form.SystemParamForm;
import com.example.systemParam.service.SystemParamService;
@Controller
@RequestMapping("/system-param")
public class SystemParamController {
@Autowired
private SystemParamService systemParamService;
@PostMapping(path = "")
@ResponseStatus(HttpStatus.CREATED)
public @ResponseBody Response saveOrUpdate(HttpServletRequest req, @RequestBody BorrowInfoForm form) throws Exception {
if(!CommonUtil.isNullOrEmpty(form.getLstParam())) {
List<Long> lstId = new ArrayList<>();
// phai sua lai
systemParamService.deleteAll();
for (SystemParamForm systemParamForm : form.getLstParam()) {
Long id = CommonUtil.NVL(systemParamForm.getId());
SystemParamBO bo = new SystemParamBO();
// if (id > 0L) {
// bo = systemParamService.findById(id);
// if (bo == null) {
// return Response.warning(Constants.RESPONSE_CODE.RECORD_DELETED);
// }
// } else {
// bo = new SystemParamBO();
// }
bo.setCode(systemParamForm.getCode());
bo.setName(systemParamForm.getName());
bo.setSvalue(systemParamForm.getSvalue());
systemParamService.saveOrUpdate(bo);
lstId.add(bo.getId());
}
//xóa bản ghi
// systemParamService.deleteAfterSave(lstId);
}
return Response.success(Constants.RESPONSE_CODE.SUCCESS).withData(null);
}
@GetMapping(path = "/find-all")
public @ResponseBody Response findAll(HttpServletRequest req){
return Response.success().withData(systemParamService.findAll());
}
@GetMapping(path = "/get-param")
public @ResponseBody Response getParam(HttpServletRequest req){
List<SystemParamBO> lst = systemParamService.findAll();
Map<String, String> map = new HashMap<String, String>();
if(!CommonUtil.isNullOrEmpty(lst)) {
for (SystemParamBO systemParamBO : lst) {
map.put(systemParamBO.getCode(), systemParamBO.getSvalue());
}
}
return Response.success().withData(map);
}
}
|
[
"xuansonkrt@gmail.com"
] |
xuansonkrt@gmail.com
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.