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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cd2c908bb8cd779060dd84a55748852ee87b20c9 | c4e9def1cd4da115bf2d5df5f0794b7f0f5cfd5b | /Main.java | c1578a152e609450b2a03a5b13b4df7821bf30c4 | [] | no_license | mkx201902/uno | d8762ae940a742745d54a3596e752b2bdb456187 | 5b2fe57535e613e297a72a03d3b3346ad3658201 | refs/heads/master | 2020-12-07T14:04:15.072923 | 2020-01-09T06:23:25 | 2020-01-09T06:23:25 | 232,734,291 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,038 | java | package cuentas;
public class Main implements opertiva_cuenta {
private static String nom;
private static String cue;
private static Float cantidad;
public static void main(String[] args) {
CCuenta cuenta1;
double saldoActual;
nom = "Antonio López";
cue = "1000-2365-85-1230456789";
cuenta1 = new CCuenta(nom,cue,2500,0);
saldoActual = cuenta1.estado();
System.out.println("El saldo actual es"+ saldoActual );
try {
cuenta1.retirar(2300);
} catch (Exception e) {
System.out.print("Fallo al retirar");
}
try {
System.out.println("Ingreso en cuenta");
cuenta1.ingresar(695);
} catch (Exception e) {
System.out.print("Fallo al ingresar");
}
}
public static String getCue() {
return cue;
}
public static void setCue(String cue) {
Main.cue = cue;
}
public static String getNom() {
return nom;
}
public static void setNom(String nom) {
Main.nom = nom;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
414ccf56d3d984d503e67629c509c45fd1250c65 | 444f4ce4f2259f65ed374004b3e9e02636918fa1 | /src/server/Server.java | cf2df1fa084885d91b8101565f7cbcd3e2406c3d | [] | no_license | Bogachev-Ilya/AtmTDD | 577d450133d415109a7f3fc7e71e4179086e640b | aac4494b97ef1cb2e75a82337e2b3c04534f9e1e | refs/heads/master | 2018-10-13T12:08:07.875054 | 2018-07-11T19:30:34 | 2018-07-11T19:30:34 | 125,627,931 | 0 | 0 | null | 2018-04-26T19:03:15 | 2018-03-17T12:40:49 | Java | UTF-8 | Java | false | false | 3,535 | java | package server;
import model.Atm;
import model.CreditCard;
import model.DataBase;
import model.User;
import service.CardsDao;
import service.UsersDao;
import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;
public class Server {
public static final int PORT = 8844;
public static void main(String[] args) throws InterruptedException, ClassNotFoundException {
try (ServerSocket serverSocket = new ServerSocket(PORT, 10)) {
/**инициализация базы данных на стороне сервера*/
DataBase dataBase = new DataBase();
dataBase.initDataBase();
Socket client = serverSocket.accept();
System.out.println("Connected...");
//отправить данные пользователю
DataOutputStream out = new DataOutputStream(client.getOutputStream());
ObjectOutputStream obOut = new ObjectOutputStream(client.getOutputStream());
System.out.println("OutputStream created");
//получить данные от пользователя
DataInputStream in = new DataInputStream(client.getInputStream());
ObjectInputStream obIn = new ObjectInputStream(client.getInputStream());
System.out.println("InputStream created");
while (!client.isClosed()) {
/**сначала считываем из базы данных имена пользователей и отправляем их клиенту*/
UsersDao usersDao = new UsersDao();
obOut.writeObject(usersDao.getAllUserNames());
Thread.sleep(3000);
/**получаем имя выбранного пользователя от клиента и создаем юзера, передаем его клиенту*/
String userName = in.readUTF();
System.out.println(userName);
User user = usersDao.getUserByUserName(userName);
obOut.writeObject(user);
obOut.flush();
CardsDao cardsDao = new CardsDao();
/**создать массив карт для отображения в меню выбора*/
Object[] cardsListForUser = new Object[cardsDao.getAllCardsForUser(user.getId()).size()];
for (int i = 0; i < cardsListForUser.length; i++) {
/**записать в массив номера карт пользователя*/
cardsListForUser[i] = cardsDao.getAllCardsForUser(user.getId()).get(i).getCardNumber();
}
/**передать массив клиенту для отображения в меню выбора карт*/
obOut.writeObject(cardsListForUser);
Thread.sleep(3000);
/**получить от клиента номер выбранной карты, создать объект и отправить его клиенту*/
CreditCard creditCard= cardsDao.getSelectedCard((String) obIn.readObject());
Thread.sleep(300);
obOut.writeObject(creditCard);
/**создать ATM и передать клиенту*/
Atm atm = new Atm();
Thread.sleep(200);
obOut.writeObject(atm);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
| [
"bogachev_i_i@mail.ru"
] | bogachev_i_i@mail.ru |
f567e1c3e2fe2158bdeac222acec64762467f76f | b61290110d950eba7a13a8af1dcff50136b57db0 | /app/src/main/java/com/rytass/geeyang/servicedemo/Global/T.java | 04849d0395026b5d1b2c05c87b1740a4ea28792d | [] | no_license | gcobc12677/AndroidServiceDemo | 404620bf23b148ece38f0c7881af5b28778c97ed | cadbb861a3efb2f3d8ff969ad37ec849ece10177 | refs/heads/master | 2020-12-25T14:58:51.541817 | 2016-09-02T09:26:02 | 2016-09-02T09:26:02 | 67,209,285 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,337 | java |
package com.rytass.geeyang.servicedemo.Global;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.text.TextUtils;
import com.rytass.geeyang.servicedemo.Custom.BroadCastData;
import com.rytass.geeyang.servicedemo.Receiver.SDReceiver;
import java.util.ArrayList;
import java.util.Arrays;
public class T {
public static boolean isNullOrEmpty(String str) {
return (str == null || str.trim().equals(C.EMPTY) || str.trim().equals(C.NULL));
}
public static void sendBroadcast(BroadCastData data) {
Intent intentsvr = null;
try {
intentsvr = new Intent(SDReceiver.NAME_FILTER);
intentsvr.putExtra(C.HANDLER_PUT_STRING_KEY, data);
D.c.sendBroadcast(intentsvr);
} catch (Exception e) {
L.e(e);
}
}
public static String listToString(ArrayList<String> values, String separate) {
if (values == null) {
return "";
}
if (T.isNullOrEmpty(separate)) {
return null;
}
String returnValue = "";
returnValue = TextUtils.join(separate, values.toArray());
return returnValue;
}
public static ArrayList<String> stringToList(String string, String splitSign) {
if (T.isNullOrEmpty(string)) {
return null;
}
ArrayList<String> returnValue = new ArrayList<String>();
returnValue = new ArrayList<String>(Arrays.asList(string.split(splitSign)));
return returnValue;
}
public static ConnectivityManager cm = null;
public static NetworkInfo info = null;
public final static boolean isNetworkOK(Context context) {
boolean isNetworkAvalibale = false;
try {
if (context.getSystemService(Context.CONNECTIVITY_SERVICE) != null) {
cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
}
if (cm != null && ((info = cm.getActiveNetworkInfo()) != null)) {
isNetworkAvalibale = info.isConnected() && info.isAvailable() && info.getState() == NetworkInfo.State.CONNECTED;
}
} catch (Exception e) {
L.e(e);
}
return isNetworkAvalibale;
}
}
| [
"gcobc12677@gmail.com"
] | gcobc12677@gmail.com |
bfddadb17ac6e2f91722e937a43f458e3b9e2eb2 | ffc181706566d18e117f294c72a0d2e679aa26a3 | /doclib-service/src/main/java/com/strelnikov/doclib/service/dtomapper/impl/DtoMapperImpl.java | 6099ed8a5cc3647a82e37d6f12275e3dfa9e6abf | [] | no_license | Gusstrik/DocumentLibrary | b59db9394c227f2886eab92e3954aa5929593716 | bb1544e5c9825937deeea69b97720fed2a07b6ab | refs/heads/main | 2023-05-03T07:31:56.146202 | 2021-05-16T20:59:53 | 2021-05-16T20:59:53 | 360,951,209 | 0 | 0 | null | 2021-05-16T20:53:32 | 2021-04-23T16:55:24 | Java | UTF-8 | Java | false | false | 8,663 | java | package com.strelnikov.doclib.service.dtomapper.impl;
import com.strelnikov.doclib.dto.*;
import com.strelnikov.doclib.model.conception.Unit;
import com.strelnikov.doclib.model.conception.UnitType;
import com.strelnikov.doclib.model.documnets.*;
import com.strelnikov.doclib.model.roles.Authority;
import com.strelnikov.doclib.model.roles.Client;
import com.strelnikov.doclib.model.roles.Permission;
import com.strelnikov.doclib.repository.*;
import com.strelnikov.doclib.service.dtomapper.DtoMapper;
import com.strelnikov.doclib.model.catalogs.Catalog;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@Component
public class DtoMapperImpl implements DtoMapper {
private final DocumentDao docDao;
private final DocTypeDao docTypeDao;
private final PermissionDao permissionDao;
private final ClientDao clientDao;
public DtoMapperImpl(@Qualifier("DocumentJpa") DocumentDao docDao, @Qualifier("DocTypeJpa") DocTypeDao docTypeDao,
@Autowired PermissionDao permissionDao, @Autowired ClientDao clientDao){
this.permissionDao=permissionDao;
this.clientDao=clientDao;
this.docTypeDao=docTypeDao;
this.docDao=docDao;
}
@Override
public UnitDto mapUnit(Unit unit) {
if (unit.getId() == 1) {
return new UnitDto(unit.getId(), unit.getName(), unit.getUnitType().toString(), 0);
} else {
return new UnitDto(unit.getId(), unit.getName(), unit.getUnitType().toString(), unit.getCatalogId());
}
}
@Override
public Unit mapUnit(UnitDto unitDto) {
Unit unit;
if (unitDto.getUnitType().equals(UnitType.CATALOG.toString())) {
unit = new Catalog();
} else {
unit = new Document();
}
unit.setName(unitDto.getName());
unit.setId(unitDto.getId());
if (unitDto.getId() != 1) {
unit.setCatalogId(unitDto.getParentId());
} else {
unit.setCatalogId(0);
}
return unit;
}
@Override
public CatalogDto mapCatalog(Catalog catalog) {
List<UnitDto> list = new ArrayList<>();
for (Unit unit : catalog.getContentList()) {
list.add(mapUnit(unit));
}
if (catalog.getId() == 1) {
return new CatalogDto(catalog.getId(), catalog.getName(), 0, list);
} else {
return new CatalogDto(catalog.getId(), catalog.getName(), catalog.getCatalogId(), list);
}
}
@Override
public Catalog mapCatalog(CatalogDto catalogDto) {
Catalog catalog = new Catalog();
catalog.setId(catalogDto.getId());
catalog.setName(catalogDto.getName());
List<Unit> list = new ArrayList<>();
for (UnitDto unitDto : catalogDto.getContentList()) {
list.add(mapUnit(unitDto));
}
if (catalogDto.getParentId() != 0) {
catalog.setCatalogId(catalogDto.getParentId());
}
catalog.setContentList(list);
return catalog;
}
@Override
public DocTypeDto mapDocType(DocumentType documentType) {
return new DocTypeDto(documentType.getId(),documentType.getCurentType());
}
@Override
public DocumentType mapDocType(DocTypeDto docTypeDto) {
DocumentType documentType = new DocumentType();
documentType.setId(docTypeDto.getId());
documentType.setCurentType(docTypeDto.getDocType());
return documentType;
}
@Override
public DocFileDto mapDocFile(DocumentFile docFile) {
return new DocFileDto(docFile.getId(), docFile.getFileName(), docFile.getFilePath());
}
@Override
public DocumentFile mapDocFile(DocFileDto docFileDto) {
DocumentFile docFile = new DocumentFile();
docFile.setId(docFileDto.getId());
docFile.setFileName(docFileDto.getName());
docFile.setFilePath(docFileDto.getPath());
return docFile;
}
@Override
public DocumentVersion mapDocVersion(DocVersionDto docVersionDto) {
DocumentVersion docVersion = new DocumentVersion();
docVersion.setId(docVersionDto.getId());
if (docVersionDto.getDocumentId() != 0)
docVersion.setParentDocument(docDao.loadDocument(docVersionDto.getDocumentId()));
docVersion.setVersion(docVersionDto.getVersion());
docVersion.setImportance(Importance.valueOf(docVersionDto.getImportance()));
docVersion.setModerated(docVersionDto.isModerated());
if (docVersionDto.getDescription() == null) {
docVersion.setDescription("");
} else {
docVersion.setDescription(docVersionDto.getDescription());
}
List<DocumentFile> list = new ArrayList<>();
for (DocFileDto fileDto : docVersionDto.getFileList()) {
list.add(mapDocFile(fileDto));
}
docVersion.setFilesList(list);
return docVersion;
}
@Override
public DocVersionDto mapDocVersion(DocumentVersion documentVersion) {
List<DocFileDto> list = new ArrayList<>();
for (DocumentFile file : documentVersion.getFilesList()) {
list.add(mapDocFile(file));
}
return new DocVersionDto(documentVersion.getId(), documentVersion.getParentDocument().getId(), documentVersion.getVersion(),
documentVersion.getDescription(), documentVersion.getImportance().toString(), documentVersion.isModerated(), list);
}
@Override
public Document mapDocument(DocumentDto documentDto) {
Document document = new Document();
document.setId(documentDto.getId());
document.setDocumentType(docTypeDao.loadType(documentDto.getType()));
document.setName(documentDto.getName());
document.setCatalogId(documentDto.getCatalogId());
document.setActualVersion(documentDto.getActualVersion());
document.setVersionsList(new ArrayList<>());
document.getVersionsList().add(mapDocVersion(documentDto.getVersion()));
return document;
}
@Override
public DocumentDto mapDocument(Document document) {
DocVersionDto docVersionDto = mapDocVersion(document.getDocumentVersion());
return new DocumentDto(document.getId(), document.getName(), document.getDocumentType().getId(),
document.getActualVersion(), document.getCatalogId(), docVersionDto);
}
@Override
public DocumentDto mapDocument(Document document, int version) {
DocVersionDto docVersionDto = mapDocVersion(document.getDocumentVersion(version));
return new DocumentDto(document.getId(), document.getName(), document.getDocumentType().getId(),
document.getActualVersion(), document.getCatalogId(), docVersionDto);
}
@Override
public PermissionDto mapPermission(Permission permission) {
return new PermissionDto(permission.getClient().getLogin(),permission.getSecuredObject().getName(),
permission.getSecuredObject().getClass().getSimpleName(),permission.getPermissionList());
}
@Override
public Permission mapPermission(PermissionDto permissionDto) {
Permission permission = new Permission();
permission.setClient(clientDao.findBylogin(permissionDto.getClientLogin()));
permission.setPermissionList(permissionDto.getPermissionTypeList());
permission.setSecuredObject(permissionDao.getSecuredObjectByObjectName(permissionDto.getObjectName(),permissionDto.getObjectType()));
return permission;
}
@Override
public Client mapClient(ClientDto clientDto) {
Client client = new Client();
client.setLogin(clientDto.getLogin());
client.setPassword(clientDto.getPassword());
client.setId(clientDto.getId());
for (String role:clientDto.getRoles()){
client.getAuthorities().add(new Authority(role));
}
return client;
}
@Override
public ClientDto mapClient(Client client) {
List<PermissionDto> permissionDtoList = new ArrayList<>();
for (Permission permission:permissionDao.getClientPermissions(client)){
permissionDtoList.add(mapPermission(permission));
}
return new ClientDto(client.getId(),client.getLogin(),client.getPassword(),
client.getAuthorities().stream().map(authority -> authority.getName().toString()).toList(),
permissionDtoList);
}
}
| [
"i.strelnikov73@gmail.com"
] | i.strelnikov73@gmail.com |
00055e23d9664bf387d7c06712fe9336428228cd | e4329e9131da9f5f848191da24d63b55e8d732d2 | /src/main/java/com/orangeistehnewblack/models/Todo.java | b106272daeda67e4371f53763af40a5c94e782a4 | [] | no_license | swayam18/spring-todo | 0de64ce21bf7da1ace1954ac7f0828d0c837f62f | 9abe8141ff1b7ae73ab5a1988d245bd10a1c3631 | refs/heads/master | 2021-01-10T03:09:36.767650 | 2016-03-16T09:15:08 | 2016-03-16T09:15:08 | 52,865,914 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,074 | java | package com.orangeistehnewblack.models;
import javax.persistence.*;
@Entity
public class Todo {
@Id
@GeneratedValue(strategy= GenerationType.AUTO)
private long id;
private String task;
private boolean done;
@ManyToOne
@JoinColumn(name = "USER_ID")
private User user;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public Todo(User user, String task) {
this.user = user;
this.task = task;
this.done = false;
}
public Todo(String task) {
this.task = task;
this.done = false;
}
public Todo() {
this("");
}
public String getTask() {
return task;
}
public void setTask(String task) {
this.task = task;
}
public boolean getDone() {
return done;
}
public void setDone(boolean done) {
this.done = done;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
}
| [
"pair+mc+sn@pivotal.io"
] | pair+mc+sn@pivotal.io |
a60ed9d2c85951efd188be6e1cd4ae5f69b72106 | 0b9f8738de5ee16d1a05c3658132708fa3968e85 | /src/MoveState/Up.java | a272d2798484a21ab53e18cc3a6e22024aa7172d | [] | no_license | jackltx/tank | d166a09311e867ac12de91971bb1bd31258b9094 | 3f45dd70113478ed713ebe7da48e336ea557beb0 | refs/heads/master | 2020-04-30T20:47:30.103745 | 2020-02-15T09:29:09 | 2020-02-15T09:32:07 | 177,077,909 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,035 | java | package MoveState;
import Client.TankClient;
import Environment.Missile;
import Environment.MissileInterface;
import Tank.Tank;
import java.awt.*;
public class Up implements State {
private Tank tank;
private Image tankImage;
public Up(Tank tank) {
}
public Up(Tank tank, Image image) {
this.tankImage = image;
this.tank = tank;
}
@Override
public void changePosition() {
tank.y = tank.y - tank.YSPEED;
}
@Override
public void drawSelf(Graphics g) {
g.drawImage(tankImage, tank.x, tank.y, null);
}
@Override
public void drawMissileSelf(Graphics g, MissileInterface missile) {
g.drawImage(missile.getImgs().get("U"), missile.getX(), missile.getY(), null);
}
@Override
public void changeMissilePosition(MissileInterface missile) {
missile.setY(missile.getY() - missile.getYSPEED());
}
public Tank getTank() {
return tank;
}
public Image getTankImage() {
return tankImage;
}
}
| [
"lzhy1996@outlook.com"
] | lzhy1996@outlook.com |
2426e0c309110bc00a692f3d4663e9075fc6ca25 | ae7371dc4c75985387bf9bdbc4065bae5fbf306f | /src/com/models/SearchPlaceForCheckin.java | a945b31f9ad641838411ccc905abb3beb92e8433 | [] | no_license | BassantMorad/FCISquareBackend | 5c2da0f68b2c4458bedcff0d722d3927b5e86696 | 8336da4d4b89d85d52948a6dc46449d7112e6667 | refs/heads/master | 2021-01-25T01:14:57.836951 | 2017-06-19T04:07:23 | 2017-06-19T04:07:23 | 94,735,193 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,840 | java | package com.models;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Time;
import java.util.ArrayList;
import com.mysql.jdbc.Statement;
public class SearchPlaceForCheckin implements Checkin {
private Date date;
private Time time;
private UserModel user;
private PlaceModel place;
private String checkinPost;
int ID;
public SearchPlaceForCheckin() {
super();
}
public SearchPlaceForCheckin(UserModel user) {
super();
this.user= user;
}
public SearchPlaceForCheckin(int iD) {
super();
this.ID = iD;
}
public SearchPlaceForCheckin(UserModel user, PlaceModel place, int iD) {
super();
this.user = user;
this.place = place;
ID = iD;
}
public SearchPlaceForCheckin(UserModel user, PlaceModel place,
String checkinPost) {
super();
this.user = user;
this.place = place;
this.checkinPost = checkinPost;
}
public SearchPlaceForCheckin(Date date, Time time, String checkinPost,
UserModel user, PlaceModel place, int iD) {
super();
this.date = date;
this.time = time;
this.user = user;
this.place = place;
this.checkinPost = checkinPost;
this.ID = iD;
}
@Override
public Checkin add() {
// TODO Auto-generated method stub
try {
Connection conn = DBConnection.getActiveConnection();
String sql = "Insert into checkin (`placeName`,`userEmail`,`post`) VALUES (?,?,?)";
PreparedStatement stmt;
stmt = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
stmt.setString(1, place.getName());
stmt.setString(2, user.getEmail());
stmt.setString(3, checkinPost);
stmt.executeUpdate();
ResultSet rs = stmt.getGeneratedKeys();
sql = "Select * from checkin where ID= ? ";
PreparedStatement stmt2 = conn.prepareStatement(sql);
if (rs.next()) {
stmt2.setInt(1, rs.getInt(1));
ResultSet rs2 = stmt2.executeQuery();
if (rs2.next()) {
Checkin c1 = new SearchPlaceForCheckin(rs2.getDate("date"),
rs2.getTime("date"), rs2.getString("post"),
new UserModel(rs2.getString("userEmail")),
new PlaceModel(rs2.getString("placeName")),
rs2.getInt("ID"));
return c1;
}
}
return null;
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
public Checkin getCheckin(int checkinID){
try{
Connection conn = DBConnection.getActiveConnection();
String sql = "select * from checkin where ID=?";
PreparedStatement stmt;
stmt = conn.prepareStatement(sql);
stmt.setInt(1, checkinID);
ResultSet rs = stmt.executeQuery();
if(rs.next()){
Checkin checkin = new SearchPlaceForCheckin(rs.getDate("date"),
rs.getTime("date"), rs.getString("post"),
new UserModel(rs.getString("userEmail")),
new PlaceModel(rs.getString("placeName")),
rs.getInt("ID"));
return checkin ;
}
return null;
}catch(SQLException e){
e.printStackTrace();
}
return null;
}
public ArrayList<Checkin> getCheckins(){
try{
Connection conn = DBConnection.getActiveConnection();
String sql = "select * from checkin where userEmail = ?";
PreparedStatement stmt;
stmt = conn.prepareStatement(sql);
stmt.setString(1,user.getEmail());
ResultSet rs = stmt.executeQuery();
ArrayList<Checkin> list = new ArrayList<Checkin>();
while(rs.next()){
Checkin checkin = new SearchPlaceForCheckin();
checkin.setDate(rs.getDate("date"));
checkin.setPost(rs.getString("post"));
checkin.setUser(new UserModel(rs.getString("userEmail")));
checkin.setPlace(new PlaceModel(rs.getString("placeName")));
checkin.setID(rs.getInt("ID"));
list.add(checkin);
}
return list;
}catch(SQLException e){
e.printStackTrace();
}
return null;
}
public boolean undoCheckin(){
try{
Connection conn = DBConnection.getActiveConnection();
String sql = " delete from checkin where userEmail= ? and ID= ? and placeName= ?";
PreparedStatement stmt;
stmt = conn.prepareStatement(sql);
stmt.setString(1, user.getEmail());
stmt.setInt(2, ID);
stmt.setString(3,place.getName());
stmt.executeUpdate();
boolean done=true;
Like like=new LikeCheckin(ID);
done&=like.removeCheckinLikes();
Comment comment=new CommentCheckin(ID);
done&=comment.removeCheckinComments();
Notification notification = new Notification(ID);
done&=notification.removeNotification();
return done;
}catch(SQLException e){
e.printStackTrace();
}
return false;
}
@Override
public int getID() {
// TODO Auto-generated method stub
return ID;
}
@Override
public String getPost() {
// TODO Auto-generated method stub
return checkinPost;
}
@Override
public UserModel getUser() {
// TODO Auto-generated method stub
return user;
}
@Override
public PlaceModel getPlace() {
// TODO Auto-generated method stub
return place;
}
@Override
public Date getDate() {
// TODO Auto-generated method stub
return date;
}
@Override
public Time getTime() {
// TODO Auto-generated method stub
return time;
}
@Override
public void setID(int id) {
// TODO Auto-generated method stub
this.ID=id;
}
@Override
public void setPost(String post) {
// TODO Auto-generated method stub
this.checkinPost=post;
}
@Override
public void setUser(UserModel user) {
// TODO Auto-generated method stub
this.user=user;
}
@Override
public void setPlace(PlaceModel place) {
// TODO Auto-generated method stub
this.place=place;
}
@Override
public void setDate(Date date) {
// TODO Auto-generated method stub
this.date=date;
}
@Override
public void setTime(Time time) {
// TODO Auto-generated method stub
this.time=time;
}
}
| [
"Bassant_Morad20@hotmail.com"
] | Bassant_Morad20@hotmail.com |
4917f2b3f73e82b2f93a5cb4287025f99a6f8230 | e576b04d4a3cef45826861af353813ddfc0abb05 | /SupermercatsItteria/src/main/java/com/market/VO/Sessio.java | 94dd2ed4de7f90c8d60a4a982d6291c6542c526a | [] | no_license | gienini/SupermercatItteria | 2e8f76327eaaaef0414bb7b35630873f53d6ea35 | 402f98fcb7f98a16ecc0173d811002e99537163d | refs/heads/master | 2021-01-10T21:10:28.889651 | 2014-02-28T12:45:27 | 2014-02-28T12:45:27 | 17,171,005 | 1 | 1 | null | 2014-02-26T09:01:56 | 2014-02-25T11:38:12 | Java | UTF-8 | Java | false | false | 1,059 | java | package com.market.VO;
import java.util.Map;
public class Sessio {
private String nick;
private Map<Producte, Integer> carrito;
private int idComanda;
public Sessio() {
super();
}
public Sessio(String nick, Map<Producte, Integer> carrito, int idComanda) {
super();
this.nick = nick;
this.carrito = carrito;
this.idComanda = idComanda;
}
public String getNick() {
return nick;
}
public void setNick(String nick) {
this.nick = nick;
}
public Map<Producte, Integer> getCarrito() {
return carrito;
}
public void setCarrito(Map<Producte, Integer> carrito) {
this.carrito = carrito;
}
public int getIdComanda() {
return idComanda;
}
public void setIdComanda(int idComanda) {
this.idComanda = idComanda;
}
// -------------------------------------------------
// get i set
// -------------------------------------------------
}
| [
"Alumno22@SBS-ALUMNO22"
] | Alumno22@SBS-ALUMNO22 |
7dd1c513116cafdb213abd6121cbc409da6f5e00 | c21cfe0e6a4e98ecb63919af3399c1a50ea8fc75 | /androidAPP/app/src/main/java/com/st/pillboxapp/responses/AuthAndRegisterResponse.java | 274660a86cf4adcae5d9a3ff9f82d9f7b0c5ce46 | [
"Apache-2.0"
] | permissive | JuanMVP/repoPastis | 350dc1270380aebfc5a901287bdb8b128fdb63fd | 0a906510020a57fa70903886264f9dd09a75b3e8 | refs/heads/master | 2020-04-15T17:05:49.002633 | 2019-02-20T09:44:25 | 2019-02-20T09:44:25 | 164,860,467 | 5 | 0 | null | null | null | null | UTF-8 | Java | false | false | 794 | java | package com.st.pillboxapp.responses;
import com.st.pillboxapp.models.User;
public class AuthAndRegisterResponse {
private String token;
private User user;
public AuthAndRegisterResponse() {
}
public AuthAndRegisterResponse(String token, User user) {
this.token = token;
this.user = user;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
@Override
public String toString() {
return "AuthAndRegisterResponse{" +
"token='" + token + '\'' +
", user=" + user +
'}';
}
}
| [
"josedavid97.pd@gmail.com"
] | josedavid97.pd@gmail.com |
fa493b798f39aa74397f62461e8b7cf3c6654e2a | 322b3ec3d400566dd228d56b81fff6113a4a7741 | /WyyPay/KingMoneyPay/src/main/java/com/wyy/pay/bean/StatementsDiscountBean.java | dd3d54dc730a8bb558fa589e5b7ef4e4ac7c89ae | [] | no_license | weyangyang/WyyPay | 6343c4a24afbf400755b25363bd7cdc2d23c303b | 87c161ed140026ea2a5cf66d497c5214ffc10180 | refs/heads/master | 2021-01-12T11:09:49.653246 | 2016-12-15T15:04:58 | 2016-12-15T15:04:58 | 72,855,630 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 669 | java | package com.wyy.pay.bean;
import java.io.Serializable;
/**
* Created by liyusheng on 16/12/10.
*/
public class StatementsDiscountBean implements Serializable {
private int type;
private double number;
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public double getNumber() {
return number;
}
public void setNumber(double number) {
this.number = number;
}
@Override
public String toString() {
return "StatementsDiscountBean{" +
"type=" + type +
", number=" + number +
'}';
}
}
| [
"liyusheng@xuetangx.com"
] | liyusheng@xuetangx.com |
1108b7e20dc2de52dfc8fd8149ba947549329c34 | fc58872a1645eb6a080df3f9af49c4fbf3061b3e | /src/Manatee.java | 87c9fe87b148672f607ca8c4b904b046e02467e6 | [] | no_license | mikestrange/Manatee | 29c8efacbd192ed87f2df52fb185f730cd2d4395 | 029a18483167d887e62c3cd4e2454227b2822cbf | refs/heads/master | 2020-03-30T08:10:43.143294 | 2015-01-06T13:59:36 | 2015-01-06T13:59:36 | 28,865,339 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 401 | java |
import sql.SqlServer;
import utils.TimeUtil;
import net.nio.MainServer;
import net.nio.SecurityXMLServer;
public class Manatee {
public static void main(String[] args) throws Exception
{
TimeUtil.start();
MainServer.getInstances().register();
SqlServer.gets();
SecurityXMLServer.gets().start();
while(true){
if(TimeUtil.getTimer()>1000){
break;
}
}
}
//ends
}
| [
"xinyue___ld@sina.cn"
] | xinyue___ld@sina.cn |
c75f77be9d1422cd0140e009749aae6337baba75 | 407a7ee258871effcf05621f4505bad64cf19d41 | /android/src/main/java/com/mulgundkar/opencv/core/CVCore.java | fe2e8ac64189113e8c0369685758b4ae114da7f3 | [
"BSD-3-Clause"
] | permissive | rahul-san/flutter_opencv | bbe0c12a112e964a9062d8ee64e2fc8acf609ff7 | 6ceaeaeb7594e870fe9adf4fc2bdcd4f6426ed47 | refs/heads/master | 2022-11-08T13:16:53.046345 | 2020-04-25T15:20:22 | 2020-04-25T15:20:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 26,302 | java | package com.mulgundkar.opencv.core;
import android.annotation.SuppressLint;
import org.opencv.android.OpenCVLoader;
import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.core.Point;
import org.opencv.core.Scalar;
import org.opencv.core.Size;
import org.opencv.core.MatOfByte;
import org.opencv.core.MatOfInt;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;
import java.util.ArrayList;
import java.util.List;
import androidx.annotation.NonNull;
import io.flutter.Log;
import io.flutter.embedding.engine.plugins.FlutterPlugin;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugin.common.MethodChannel.Result;
import io.flutter.plugin.common.PluginRegistry.Registrar;
/**
* OpenCV4Plugin
*/
public class CVCore {
@SuppressLint("MissingPermission")
public byte[] cvtColor(byte[] byteData, int outputType) {
byte[] byteArray = new byte[0];
try {
Mat dst = new Mat();
// Decode image from input byte array
Mat src = Imgcodecs.imdecode(new MatOfByte(byteData), Imgcodecs.IMREAD_UNCHANGED);
// Convert the image color
Imgproc.cvtColor(src, dst, outputType);
//instantiating an empty MatOfByte class
MatOfByte matOfByte = new MatOfByte();
//Converting the Mat object to MatOfByte
Imgcodecs.imencode(".jpg", dst, matOfByte);
byteArray = matOfByte.toArray();
} catch (Exception e) {
System.out.println("OpenCV Error: " + e.toString());
}
return byteArray;
}
@SuppressLint("MissingPermission")
public byte[] blur(byte[] byteData, ArrayList kernelSize, ArrayList anchorPoint, int borderType) {
byte[] byteArray = new byte[0];
try {
Mat dst = new Mat();
// Decode image from input byte array
Mat src = Imgcodecs.imdecode(new MatOfByte(byteData), Imgcodecs.IMREAD_UNCHANGED);
Size size = new Size((double) kernelSize.get(0), (double) kernelSize.get(1));
Point point = new Point((double) anchorPoint.get(0), (double) anchorPoint.get(1));
// Convert the image to Gray
Imgproc.blur(src, dst, size, point, borderType);
//instantiating an empty MatOfByte class
MatOfByte matOfByte = new MatOfByte();
//Converting the Mat object to MatOfByte
Imgcodecs.imencode(".jpg", dst, matOfByte);
byteArray = matOfByte.toArray();
} catch (Exception e) {
System.out.println("OpenCV Error: " + e.toString());
}
return byteArray;
}
@SuppressLint("MissingPermission")
public byte[] gaussianBlur(byte[] byteData, ArrayList kernelSize, double sigmaX) {
byte[] byteArray = new byte[0];
try {
Mat dst = new Mat();
// Decode image from input byte array
Mat src = Imgcodecs.imdecode(new MatOfByte(byteData), Imgcodecs.IMREAD_UNCHANGED);
Size size = new Size((double) kernelSize.get(0), (double) kernelSize.get(1));
// Convert the image to Gray
Imgproc.GaussianBlur(src, dst, size, sigmaX);
//instantiating an empty MatOfByte class
MatOfByte matOfByte = new MatOfByte();
//Converting the Mat object to MatOfByte
Imgcodecs.imencode(".jpg", dst, matOfByte);
byteArray = matOfByte.toArray();
} catch (Exception e) {
System.out.println("OpenCV Error: " + e.toString());
}
return byteArray;
}
@SuppressLint("MissingPermission")
public byte[] medianBlur(byte[] byteData, int kernelSize) {
byte[] byteArray = new byte[0];
try {
Mat dst = new Mat();
// Decode image from input byte array
Mat src = Imgcodecs.imdecode(new MatOfByte(byteData), Imgcodecs.IMREAD_UNCHANGED);
// Convert the image to Gray
Imgproc.medianBlur(src, dst, kernelSize);
//instantiating an empty MatOfByte class
MatOfByte matOfByte = new MatOfByte();
//Converting the Mat object to MatOfByte
Imgcodecs.imencode(".jpg", dst, matOfByte);
byteArray = matOfByte.toArray();
} catch (Exception e) {
System.out.println("OpenCV Error: " + e.toString());
}
return byteArray;
}
@SuppressLint("MissingPermission")
public byte[] bilateralFilter(byte[] byteData, int diameter, int sigmaColor, int sigmaSpace, int borderType) {
byte[] byteArray = new byte[0];
try {
Mat dst = new Mat();
// Decode image from input byte array
Mat src = Imgcodecs.imdecode(new MatOfByte(byteData), Imgcodecs.IMREAD_UNCHANGED);
// Convert the image to Gray
Imgproc.bilateralFilter(src, dst, diameter, sigmaColor, sigmaSpace, borderType);
//instantiating an empty MatOfByte class
MatOfByte matOfByte = new MatOfByte();
//Converting the Mat object to MatOfByte
Imgcodecs.imencode(".jpg", dst, matOfByte);
byteArray = matOfByte.toArray();
} catch (Exception e) {
System.out.println("OpenCV Error: " + e.toString());
}
return byteArray;
}
@SuppressLint("MissingPermission")
public byte[] boxFilter(byte[] byteData, int outputDepth, ArrayList kernelSize, ArrayList anchorPoint, boolean normalize, int borderType) {
byte[] byteArray = new byte[0];
try {
Mat dst = new Mat();
// Decode image from input byte array
Mat src = Imgcodecs.imdecode(new MatOfByte(byteData), Imgcodecs.IMREAD_UNCHANGED);
Size size = new Size((double) kernelSize.get(0), (double) kernelSize.get(1));
Point point = new Point((double) anchorPoint.get(0), (double) anchorPoint.get(1));
// Convert the image to Gray
Imgproc.boxFilter(src, dst, outputDepth, size, point, normalize, borderType);
//instantiating an empty MatOfByte class
MatOfByte matOfByte = new MatOfByte();
//Converting the Mat object to MatOfByte
Imgcodecs.imencode(".jpg", dst, matOfByte);
byteArray = matOfByte.toArray();
} catch (Exception e) {
System.out.println("OpenCV Error: " + e.toString());
}
return byteArray;
}
@SuppressLint("MissingPermission")
public byte[] sqrBoxFilter(byte[] byteData, int outputDepth, ArrayList kernelSize) {
byte[] byteArray = new byte[0];
try {
Mat dst = new Mat();
// Decode image from input byte array
Mat src = Imgcodecs.imdecode(new MatOfByte(byteData), Imgcodecs.IMREAD_UNCHANGED);
Size size = new Size((double) kernelSize.get(0), (double) kernelSize.get(1));
// Convert the image to Gray
Imgproc.sqrBoxFilter(src, dst, outputDepth, size);
//instantiating an empty MatOfByte class
MatOfByte matOfByte = new MatOfByte();
//Converting the Mat object to MatOfByte
Imgcodecs.imencode(".jpg", dst, matOfByte);
byteArray = matOfByte.toArray();
} catch (Exception e) {
System.out.println("OpenCV Error: " + e.toString());
}
return byteArray;
}
@SuppressLint("MissingPermission")
public byte[] filter2D(byte[] byteData, int outputDepth, ArrayList kernelSize) {
byte[] byteArray = new byte[0];
try {
Mat dst = new Mat();
// Decode image from input byte array
Mat src = Imgcodecs.imdecode(new MatOfByte(byteData), Imgcodecs.IMREAD_UNCHANGED);
// Creating kernel matrix
Mat kernel = Mat.ones((int) kernelSize.get(0), (int) kernelSize.get(1), CvType.CV_32F);
for(int i = 0; i<kernel.rows(); i++) {
for(int j = 0; j<kernel.cols(); j++) {
double[] m = kernel.get(i, j);
for(int k = 1; k<m.length; k++) {
m[k] = m[k]/(2 * 2);
}
kernel.put(i,j, m);
}
}
// Convert the image to Gray
Imgproc.filter2D(src, dst, outputDepth, kernel);
//instantiating an empty MatOfByte class
MatOfByte matOfByte = new MatOfByte();
//Converting the Mat object to MatOfByte
Imgcodecs.imencode(".jpg", dst, matOfByte);
byteArray = matOfByte.toArray();
} catch (Exception e) {
System.out.println("OpenCV Error: " + e.toString());
}
return byteArray;
}
@SuppressLint("MissingPermission")
public byte[] dilate(byte[] byteData, ArrayList kernelSize) {
byte[] byteArray = new byte[0];
try {
Mat dst = new Mat();
// Decode image from input byte array
Mat src = Imgcodecs.imdecode(new MatOfByte(byteData), Imgcodecs.IMREAD_UNCHANGED);
// Preparing the kernel matrix object
Mat kernel = Imgproc.getStructuringElement(Imgproc.MORPH_RECT,
new Size(((int) kernelSize.get(0)*(int) kernelSize.get(1)) + 1, ((int) kernelSize.get(0)*(int) kernelSize.get(1))+1));
// Convert the image to Gray
Imgproc.dilate(src, dst, kernel);
//instantiating an empty MatOfByte class
MatOfByte matOfByte = new MatOfByte();
//Converting the Mat object to MatOfByte
Imgcodecs.imencode(".jpg", dst, matOfByte);
byteArray = matOfByte.toArray();
} catch (Exception e) {
System.out.println("OpenCV Error: " + e.toString());
}
return byteArray;
}
@SuppressLint("MissingPermission")
public byte[] erode(byte[] byteData, ArrayList kernelSize) {
byte[] byteArray = new byte[0];
try {
Mat dst = new Mat();
// Decode image from input byte array
Mat src = Imgcodecs.imdecode(new MatOfByte(byteData), Imgcodecs.IMREAD_UNCHANGED);
// Preparing the kernel matrix object
Mat kernel = Imgproc.getStructuringElement(Imgproc.MORPH_RECT,
new Size(((int) kernelSize.get(0)*(int) kernelSize.get(1)) + 1, ((int) kernelSize.get(0)*(int) kernelSize.get(1))+1));
// Convert the image to Gray
Imgproc.erode(src, dst, kernel);
//instantiating an empty MatOfByte class
MatOfByte matOfByte = new MatOfByte();
//Converting the Mat object to MatOfByte
Imgcodecs.imencode(".jpg", dst, matOfByte);
byteArray = matOfByte.toArray();
} catch (Exception e) {
System.out.println("OpenCV Error: " + e.toString());
}
return byteArray;
}
@SuppressLint("MissingPermission")
public byte[] morphologyEx(byte[] byteData, int operation, ArrayList kernelSize) {
byte[] byteArray = new byte[0];
try {
Mat dst = new Mat();
// Decode image from input byte array
Mat src = Imgcodecs.imdecode(new MatOfByte(byteData), Imgcodecs.IMREAD_UNCHANGED);
// Creating kernel matrix
Mat kernel = Mat.ones((int) kernelSize.get(0),(int) kernelSize.get(0), CvType.CV_32F);
// Morphological operation
Imgproc.morphologyEx(src, dst, operation, kernel);
//instantiating an empty MatOfByte class
MatOfByte matOfByte = new MatOfByte();
//Converting the Mat object to MatOfByte
Imgcodecs.imencode(".jpg", dst, matOfByte);
byteArray = matOfByte.toArray();
} catch (Exception e) {
System.out.println("OpenCV Error: " + e.toString());
}
return byteArray;
}
@SuppressLint("MissingPermission")
public byte[] pyrUp(byte[] byteData, ArrayList kernelSize, int borderType) {
byte[] byteArray = new byte[0];
try {
Mat dst = new Mat();
// Decode image from input byte array
Mat src = Imgcodecs.imdecode(new MatOfByte(byteData), Imgcodecs.IMREAD_UNCHANGED);
// Size of the new image
Size size = new Size((int) kernelSize.get(0), (int) kernelSize.get(1));
// pyrUp operation
Imgproc.pyrUp(src, dst, size, borderType);
//instantiating an empty MatOfByte class
MatOfByte matOfByte = new MatOfByte();
//Converting the Mat object to MatOfByte
Imgcodecs.imencode(".jpg", dst, matOfByte);
byteArray = matOfByte.toArray();
} catch (Exception e) {
System.out.println("OpenCV Error: " + e.toString());
}
return byteArray;
}
@SuppressLint("MissingPermission")
public byte[] pyrDown(byte[] byteData, ArrayList kernelSize, int borderType) {
byte[] byteArray = new byte[0];
try {
Mat dst = new Mat();
// Decode image from input byte array
Mat src = Imgcodecs.imdecode(new MatOfByte(byteData), Imgcodecs.IMREAD_UNCHANGED);
// Size of the new image
Size size = new Size((int) kernelSize.get(0), (int) kernelSize.get(1));
// pyrDown operation
Imgproc.pyrDown(src, dst, size, borderType);
//instantiating an empty MatOfByte class
MatOfByte matOfByte = new MatOfByte();
//Converting the Mat object to MatOfByte
Imgcodecs.imencode(".jpg", dst, matOfByte);
byteArray = matOfByte.toArray();
} catch (Exception e) {
System.out.println("OpenCV Error: " + e.toString());
}
return byteArray;
}
@SuppressLint("MissingPermission")
public byte[] pyrMeanShiftFiltering(byte[] byteData, double spatialWindowRadius, double colorWindowRadius) {
byte[] byteArray = new byte[0];
try {
Mat dst = new Mat();
// Decode image from input byte array
Mat src = Imgcodecs.imdecode(new MatOfByte(byteData), Imgcodecs.IMREAD_UNCHANGED);
// pyrMeanShiftFiltering operation
Imgproc.pyrMeanShiftFiltering(src, dst, spatialWindowRadius, colorWindowRadius);
//instantiating an empty MatOfByte class
MatOfByte matOfByte = new MatOfByte();
//Converting the Mat object to MatOfByte
Imgcodecs.imencode(".jpg", dst, matOfByte);
byteArray = matOfByte.toArray();
} catch (Exception e) {
System.out.println("OpenCV Error: " + e.toString());
}
return byteArray;
}
@SuppressLint("MissingPermission")
public byte[] threshold(byte[] byteData, double thresholdValue, double maxThresholdValue, int thresholdType) {
byte[] byteArray = new byte[0];
try {
Mat srcGray = new Mat();
Mat dst = new Mat();
// Decode image from input byte array
Mat src = Imgcodecs.imdecode(new MatOfByte(byteData), Imgcodecs.IMREAD_UNCHANGED);
// Convert the image to Gray
Imgproc.cvtColor(src, srcGray, Imgproc.COLOR_BGR2GRAY);
// Thresholding
Imgproc.threshold(srcGray, dst, thresholdValue, maxThresholdValue, thresholdType);
//instantiating an empty MatOfByte class
MatOfByte matOfByte = new MatOfByte();
//Converting the Mat object to MatOfByte
Imgcodecs.imencode(".jpg", dst, matOfByte);
byteArray = matOfByte.toArray();
} catch (Exception e) {
System.out.println("OpenCV Error: " + e.toString());
}
return byteArray;
}
@SuppressLint("MissingPermission")
public byte[] adaptiveThreshold(byte[] byteData, double maxValue, int adaptiveMethod, int thresholdType, int blockSize, double constantValue) {
byte[] byteArray = new byte[0];
try {
Mat srcGray = new Mat();
Mat dst = new Mat();
// Decode image from input byte array
Mat src = Imgcodecs.imdecode(new MatOfByte(byteData), Imgcodecs.IMREAD_UNCHANGED);
// Convert the image to Gray
Imgproc.cvtColor(src, srcGray, Imgproc.COLOR_BGR2GRAY);
// Adaptive Thresholding
Imgproc.adaptiveThreshold(srcGray, dst, maxValue, adaptiveMethod, thresholdType, blockSize, constantValue);
//instantiating an empty MatOfByte class
MatOfByte matOfByte = new MatOfByte();
//Converting the Mat object to MatOfByte
Imgcodecs.imencode(".jpg", dst, matOfByte);
byteArray = matOfByte.toArray();
} catch (Exception e) {
System.out.println("OpenCV Error: " + e.toString());
}
return byteArray;
}
@SuppressLint("MissingPermission")
public byte[] copyMakeBorder(byte[] byteData, int top, int bottom, int left, int right, int borderType) {
byte[] byteArray = new byte[0];
try {
Mat dst = new Mat();
// Decode image from input byte array
Mat src = Imgcodecs.imdecode(new MatOfByte(byteData), Imgcodecs.IMREAD_UNCHANGED);
// copyMakeBorder operation
Core.copyMakeBorder(src, dst, top, bottom, left, right, borderType);
//instantiating an empty MatOfByte class
MatOfByte matOfByte = new MatOfByte();
//Converting the Mat object to MatOfByte
Imgcodecs.imencode(".jpg", dst, matOfByte);
byteArray = matOfByte.toArray();
} catch (Exception e) {
System.out.println("OpenCV Error: " + e.toString());
}
return byteArray;
}
@SuppressLint("MissingPermission")
public byte[] sobel(byte[] byteData, int depth, int dx, int dy) {
byte[] byteArray = new byte[0];
try {
Mat dst = new Mat();
// Decode image from input byte array
Mat src = Imgcodecs.imdecode(new MatOfByte(byteData), Imgcodecs.IMREAD_UNCHANGED);
// Sobel operation
Imgproc.Sobel(src, dst, depth, dx, dy);
//instantiating an empty MatOfByte class
MatOfByte matOfByte = new MatOfByte();
//Converting the Mat object to MatOfByte
Imgcodecs.imencode(".jpg", dst, matOfByte);
byteArray = matOfByte.toArray();
} catch (Exception e) {
System.out.println("OpenCV Error: " + e.toString());
}
return byteArray;
}
@SuppressLint("MissingPermission")
public byte[] scharr(byte[] byteData, int depth, int dx, int dy) {
byte[] byteArray = new byte[0];
try {
Mat dst = new Mat();
// Decode image from input byte array
Mat src = Imgcodecs.imdecode(new MatOfByte(byteData), Imgcodecs.IMREAD_UNCHANGED);
// Scharr operation
Imgproc.Scharr(src, dst, depth, dx, dy);
//instantiating an empty MatOfByte class
MatOfByte matOfByte = new MatOfByte();
//Converting the Mat object to MatOfByte
Imgcodecs.imencode(".jpg", dst, matOfByte);
byteArray = matOfByte.toArray();
} catch (Exception e) {
System.out.println("OpenCV Error: " + e.toString());
}
return byteArray;
}
@SuppressLint("MissingPermission")
public byte[] laplacian(byte[] byteData, int depth) {
byte[] byteArray = new byte[0];
try {
Mat dst = new Mat();
// Decode image from input byte array
Mat src = Imgcodecs.imdecode(new MatOfByte(byteData), Imgcodecs.IMREAD_UNCHANGED);
// Laplacian operation
Imgproc.Laplacian(src, dst, depth);
//instantiating an empty MatOfByte class
MatOfByte matOfByte = new MatOfByte();
//Converting the Mat object to MatOfByte
Imgcodecs.imencode(".jpg", dst, matOfByte);
byteArray = matOfByte.toArray();
} catch (Exception e) {
System.out.println("OpenCV Error: " + e.toString());
}
return byteArray;
}
@SuppressLint("MissingPermission")
public byte[] distanceTransform(byte[] byteData, int distanceType, int maskSize) {
byte[] byteArray = new byte[0];
try {
Mat dst = new Mat();
// Decode image from input byte array
Mat src = Imgcodecs.imdecode(new MatOfByte(byteData), Imgcodecs.IMREAD_UNCHANGED);
// distanceTransform operation
Imgproc.distanceTransform(src, dst, distanceType, maskSize);
//instantiating an empty MatOfByte class
MatOfByte matOfByte = new MatOfByte();
//Converting the Mat object to MatOfByte
Imgcodecs.imencode(".jpg", dst, matOfByte);
byteArray = matOfByte.toArray();
} catch (Exception e) {
System.out.println("OpenCV Error: " + e.toString());
}
return byteArray;
}
@SuppressLint("MissingPermission")
public byte[] resize(byte[] byteData, ArrayList outputSize, double fx, double fy, int interpolation) {
byte[] byteArray = new byte[0];
try {
Mat dst = new Mat();
// Decode image from input byte array
Mat src = Imgcodecs.imdecode(new MatOfByte(byteData), Imgcodecs.IMREAD_UNCHANGED);
// Size of the new image
Size size = new Size((int) outputSize.get(0), (int) outputSize.get(1));
// resize operation
Imgproc.resize(src, dst, size, fx, fy, interpolation);
//instantiating an empty MatOfByte class
MatOfByte matOfByte = new MatOfByte();
//Converting the Mat object to MatOfByte
Imgcodecs.imencode(".jpg", dst, matOfByte);
byteArray = matOfByte.toArray();
} catch (Exception e) {
System.out.println("OpenCV Error: " + e.toString());
}
return byteArray;
}
@SuppressLint("MissingPermission")
public byte[] applyColorMap(byte[] byteData, int colorMap) {
byte[] byteArray = new byte[0];
try {
Mat dst = new Mat();
// Decode image from input byte array
Mat src = Imgcodecs.imdecode(new MatOfByte(byteData), Imgcodecs.IMREAD_UNCHANGED);
// resize operation
Imgproc.applyColorMap(src, dst, colorMap);
//instantiating an empty MatOfByte class
MatOfByte matOfByte = new MatOfByte();
//Converting the Mat object to MatOfByte
Imgcodecs.imencode(".jpg", dst, matOfByte);
byteArray = matOfByte.toArray();
} catch (Exception e) {
System.out.println("OpenCV Error: " + e.toString());
}
return byteArray;
}
@SuppressLint("MissingPermission")
public byte[] canny(byte[] byteData, double threshold1, double threshold2) {
byte[] byteArray = new byte[0];
try {
Mat dst = new Mat();
// Decode image from input byte array
Mat src = Imgcodecs.imdecode(new MatOfByte(byteData), Imgcodecs.IMREAD_UNCHANGED);
// resize operation
Imgproc.Canny(src, dst, threshold1, threshold2);
//instantiating an empty MatOfByte class
MatOfByte matOfByte = new MatOfByte();
//Converting the Mat object to MatOfByte
Imgcodecs.imencode(".jpg", dst, matOfByte);
byteArray = matOfByte.toArray();
} catch (Exception e) {
System.out.println("OpenCV Error: " + e.toString());
}
return byteArray;
}
@SuppressLint("MissingPermission")
public byte[] houghCircles(byte[] byteData, int method, double dp, double minDist, double param1, double param2, int minRadius, int maxRadius, int centerWidth, String centerColor, int circleWidth, String circleColor) {
byte[] byteArray = new byte[0];
try {
Mat circles = new Mat();
// Decode image from input byte array
Mat input = Imgcodecs.imdecode(new MatOfByte(byteData), Imgcodecs.IMREAD_UNCHANGED);
//Imgproc.medianBlur(input, input, 5);
// resize operation
Imgproc.HoughCircles(input, circles, method, dp, minDist, param1, param2, minRadius, maxRadius);
if (circles.cols() > 0) {
for (int x=0; x < (circles.cols()); x++ ) {
double circleVec[] = circles.get(0, x);
if (circleVec == null) {
break;
}
Point center = new Point((int) circleVec[0], (int) circleVec[1]);
int radius = (int) circleVec[2];
System.out.println("centerColor: " + centerColor);
System.out.println("circleColor: " + circleColor);
Imgproc.circle(input, center, 3, new Scalar(Integer.valueOf(centerColor.substring( 1, 3 ), 16 ), Integer.valueOf(centerColor.substring( 3, 5 ), 16 ), Integer.valueOf(centerColor.substring( 5, 7 ), 16 )), centerWidth);
Imgproc.circle(input, center, radius, new Scalar(Integer.valueOf(circleColor.substring( 1, 3 ), 16 ), Integer.valueOf(circleColor.substring( 3, 5 ), 16 ), Integer.valueOf(circleColor.substring( 5, 7 ), 16 )), circleWidth);
System.out.println(x+"th circle");
}
}
//instantiating an empty MatOfByte class
MatOfByte matOfByte = new MatOfByte();
//Converting the Mat object to MatOfByte
Imgcodecs.imencode(".jpg", input, matOfByte);
byteArray = matOfByte.toArray();
// System.out.println("OUT: " + dst);
} catch (Exception e) {
System.out.println("OpenCV Error: " + e.toString());
}
return byteArray;
}
}
| [
"adi@svoot.com"
] | adi@svoot.com |
3a508260f1bebc66fd0786f65f072d50daf728e7 | e9b8f034b65eff611f9a97414a6743e045999e1d | /src/main/java/com/vladimirt/myPetBlog/ServingWebContentApplication.java | ebf5ec233a1a4867a40f7466705a9279bca121b4 | [] | no_license | VladimirTikaev/MyPetBlog | a6bcb8b4326ec34064c693b23180094f676a687e | 5ab7c11ff27f74b1ed46553b4fd70cc7b0de0577 | refs/heads/master | 2023-01-07T12:33:55.789533 | 2020-11-04T16:41:59 | 2020-11-04T16:41:59 | 310,052,983 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 349 | java | package com.vladimirt.myPetBlog;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ServingWebContentApplication {
public static void main(String[] args) {
SpringApplication.run(ServingWebContentApplication.class, args);
}
} | [
"vladimirt.215@gmail.com"
] | vladimirt.215@gmail.com |
87ba2397fbb12c183d9f56d1c2dd1ee574ef43aa | 6e45a62fc156a7c323833ed52e7e8fc01c8fb933 | /COMP2613/A01203138Lab9/src/a01203138/ui/CustomerDialog.java | a768b83f415e87adc59610568e58b0789c45694b | [] | no_license | phuonghtruong/java | 12bc50700b8aaadf737ae3643a0aee3be37ba940 | 33fd3ecae1f2d8d84baaee47b5e5dab9d525d725 | refs/heads/master | 2021-06-09T23:55:17.344249 | 2021-04-04T20:23:19 | 2021-04-04T20:23:19 | 153,076,648 | 0 | 0 | null | 2020-11-12T18:24:47 | 2018-10-15T08:13:32 | Java | UTF-8 | Java | false | false | 5,293 | java | package a01203138.ui;
import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.EmptyBorder;
import a01203138.data.customer.Customer;
import a01203138.data.customer.CustomerDao;
import java.awt.event.ActionListener;
import java.sql.SQLException;
import java.util.List;
import java.util.Random;
import java.awt.event.ActionEvent;
import net.miginfocom.swing.MigLayout;
import javax.swing.JLabel;
@SuppressWarnings("serial")
public class CustomerDialog extends JDialog {
private final JPanel contentPanel = new JPanel();
private JTextField firstNameField;
private JTextField lastNameField;
private JTextField streetField;
private JTextField cityField;
private JTextField postalCodeField;
private JTextField phoneField;
private JTextField emailField;
private JTextField joinedDateField;
private CustomerDao customerDao;
private JTextField idField;
/**
* Create the dialog.
*/
public CustomerDialog(CustomerDao customerDao) {
this.customerDao = customerDao;
setBounds(100, 100, 539, 325);
getContentPane().setLayout(new MigLayout("", "[63.00][grow]", "[][][][][][][][][][grow]"));
contentPanel.setLayout(new FlowLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, "cell 0 0,alignx trailing");
{
JLabel lblId = new JLabel("ID");
contentPanel.add(lblId);
idField = new JTextField();
idField.setEnabled(false);
idField.setEditable(false);
getContentPane().add(idField, "cell 1 0,growx");
idField.setColumns(10);
JLabel lblFirstName = new JLabel("First Name");
getContentPane().add(lblFirstName, "cell 0 1,alignx trailing");
firstNameField = new JTextField();
getContentPane().add(firstNameField, "cell 1 1,growx");
firstNameField.setColumns(10);
JLabel lblLastName = new JLabel("Last Name");
getContentPane().add(lblLastName, "cell 0 2,alignx trailing");
lastNameField = new JTextField();
lastNameField.setText("");
getContentPane().add(lastNameField, "cell 1 2,growx");
lastNameField.setColumns(10);
JLabel lblStreet = new JLabel("Street");
getContentPane().add(lblStreet, "cell 0 3,alignx trailing");
streetField = new JTextField();
getContentPane().add(streetField, "cell 1 3,growx");
streetField.setColumns(10);
JLabel lblCity = new JLabel("City");
getContentPane().add(lblCity, "cell 0 4,alignx trailing");
cityField = new JTextField();
getContentPane().add(cityField, "cell 1 4,growx");
cityField.setColumns(10);
JLabel lblPostalCode = new JLabel("Postal Code");
getContentPane().add(lblPostalCode, "cell 0 5,alignx trailing");
postalCodeField = new JTextField();
getContentPane().add(postalCodeField, "cell 1 5,growx");
postalCodeField.setColumns(10);
JLabel lblPhone = new JLabel("Phone");
getContentPane().add(lblPhone, "cell 0 6,alignx trailing");
phoneField = new JTextField();
getContentPane().add(phoneField, "cell 1 6,growx");
phoneField.setColumns(10);
JLabel lblEmail = new JLabel("Email");
getContentPane().add(lblEmail, "cell 0 7,alignx trailing");
emailField = new JTextField();
getContentPane().add(emailField, "cell 1 7,growx");
emailField.setColumns(10);
JLabel lblJoinedDate = new JLabel("Joined Date");
getContentPane().add(lblJoinedDate, "cell 0 8,alignx trailing");
joinedDateField = new JTextField();
getContentPane().add(joinedDateField, "cell 1 8,growx");
joinedDateField.setColumns(10);
}
{
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
getContentPane().add(buttonPane, "cell 1 9,growx,aligny top");
{
JButton okButton = new JButton("OK");
okButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
}
});
okButton.setActionCommand("OK");
buttonPane.add(okButton);
getRootPane().setDefaultButton(okButton);
}
{
JButton cancelButton = new JButton("Cancel");
cancelButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
}
});
cancelButton.setActionCommand("Cancel");
buttonPane.add(cancelButton);
}
}
setData();
}
private void setData() {
Customer customer = getRandomCustomer();
idField.setText(String.valueOf(customer.getId()));
firstNameField.setText(customer.getFirstName());
lastNameField.setText(customer.getLastName());
streetField.setText(customer.getStreet());
cityField.setText(customer.getCity());
postalCodeField.setText(customer.getPostalCode());
phoneField.setText(customer.getPhone());
emailField.setText(customer.getEmailAddress());
joinedDateField.setText(customer.getJoinedDate().toString());
}
private Customer getRandomCustomer() {
Customer customer = null;
List<Long> ids = null;
try {
ids = customerDao .getCustomerIds();
} catch (SQLException e) {
e.printStackTrace();
}
Random rand = new Random();
long randomId = ids.get(rand.nextInt(ids.size()));
try {
customer = customerDao.getCustomer((long) randomId);
} catch (Exception e) {
e.printStackTrace();
}
return customer;
}
}
| [
"phuongtruong.h@gmail.com"
] | phuongtruong.h@gmail.com |
11f89ef15da2681175bec248226f7df8f0fa865c | 703daa72d0aa5381b69adadc1916cde0ee4eaee7 | /src/zx/proxy/test2/Test.java | 5cbd5490a88a4641b26b47b8f2e1e566a56aae88 | [] | no_license | zxiang179/DesignPattern | ee64ca251c45e0a761ae5bf367b92cc7d68f331d | 415db86a05555786495440893797b1e2c4b87eff | refs/heads/master | 2021-01-21T06:39:03.186392 | 2017-05-04T01:17:03 | 2017-05-04T01:17:03 | 82,868,517 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 143 | java | package zx.proxy.test2;
public class Test {
public static void main(String[] args) {
Proxy proxy = new Proxy();
proxy.Request();
}
}
| [
"zxiang248@gmail.com"
] | zxiang248@gmail.com |
01c7efef168a65ece49eaf8b83af72a0f00666ae | 3bad88d7d98767036bcc50fe3291c03028a7bd7f | /ssm01/src/main/java/com/yhh/mybatis/controller/ItemsController.java | 06bcad04ba5d3bb76b42e3dd389f0b101be07a2d | [] | no_license | luo532046043/mybatis-study | bae9301b318244350912b2bdda415ea2444d0f9e | e4a4b2638d79d9f2097cfc0982baa9f99ebece2c | refs/heads/master | 2020-06-13T07:37:28.593861 | 2019-06-30T16:01:26 | 2019-06-30T16:01:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,468 | java | package com.yhh.mybatis.controller;
import com.yhh.mybatis.entity.ItemsCustom;
import com.yhh.mybatis.service.ItemsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import java.util.List;
/**
* @Author: -小野猪-
* @Date: 2019/6/30 19:59
* @Version: 1.0
* @Desc:
*/
@Controller
public class ItemsController {
@Autowired
private ItemsService itemsService;
// 商品查询
@RequestMapping("/queryItems") //暂时没有接受参数
public ModelAndView queryItems() throws Exception {
// 调用service查找 数据库,查询商品列表
List<ItemsCustom> itemsList = itemsService.findItemsList(null);
// 返回ModelAndView
ModelAndView modelAndView = new ModelAndView();
// 相当 于request的setAttribut,在jsp页面中通过itemsList取数据
modelAndView.addObject("itemsList", itemsList);
// 指定视图
// 下边的路径,如果在视图解析器中配置jsp路径的前缀和jsp路径的后缀,修改为
// modelAndView.setViewName("/WEB-INF/jsp/items/itemsList.jsp");
// 上边的路径配置可以不在程序中指定jsp路径的前缀和jsp路径的后缀
modelAndView.setViewName("items/itemsList");
return modelAndView;
}
}
| [
"837430479@qq.com"
] | 837430479@qq.com |
fbe39434085956ac5c4f698523686c9fea921a21 | a201a52f51c5842ce5617bde109d90f9dac65b02 | /CS2/ProgrammingAssignments/PGA3/ListADT.java | 628db07ea64a0825a790166391b4e3c79f6108e9 | [] | no_license | jcooperlo/ComputerScience2 | cfc4673f6fe8d65342d6ce4cc8b272ccfd3b4c59 | 1965dc53c008a83803b9f23c3b6765bf66a18a40 | refs/heads/master | 2021-04-09T13:08:18.051105 | 2019-02-04T21:26:26 | 2019-02-04T21:26:26 | 125,459,238 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,063 | java | /**
* ListADT defines the interface to a general list collection. Specific
* types of lists will extend this interface to complete the
* set of necessary operations.
* @author Dr. Lewis
* @author Dr. Chase
* @version 1.0, 08/13/08
*/
//package jss2;
import java.util.Iterator;
public interface ListADT<T> extends Iterable<T>
{
/**
* Removes and returns the first element from this list.
*
* @return the first element from this list
*/
public T removeFirst ();
/**
* Removes and returns the last element from this list.
*
* @return the last element from this list
*/
public T removeLast ();
/**
* Removes and returns the specified element from this list.
*
* @param element the element to be removed from the list
*/
public T remove (T element);
/**
* Returns a reference to the first element in this list.
*
* @return a reference to the first element in this list
*/
public T first ();
/**
* Returns a reference to the last element in this list.
*
* @return a reference to the last element in this list
*/
public T last ();
/**
* Returns true if this list contains the specified target element.
*
* @param target the target that is being sought in the list
* @return true if the list contains this element
*/
public boolean contains (T target);
/**
* Returns true if this list contains no elements.
*
* @return true if this list contains no elements
*/
public boolean isEmpty();
/**
* Returns the number of elements in this list.
*
* @return the integer representation of number of elements in this list
*/
public int size();
/**
* Returns an iterator for the elements in this list.
*
* @return an iterator over the elements in this list
*/
public Iterator<T> iterator();
/**
* Returns a string representation of this list.
*
* @return a string representation of this list
*/
public String toString();
}
| [
"s760100@cisone.sbuniv.edu"
] | s760100@cisone.sbuniv.edu |
6fd7d80b4ce708a572843bfd9a0108205c1bd487 | 946a35b19b51ccecf1a45223ecb7649f6d712353 | /opentsp-location-core/opentsp-location-da/opentsp-location-da-core/src/main/java/com/navinfo/opentsp/platform/da/core/rmi/impl/district/TerminalStatusServiceImpl.java | d86d2f6da0ec781be616411c403447edfa9128ed | [] | no_license | PinZhang/opentsp-location | 2c7bedaf1abe4d0b0bf154792a2f839ef7a85828 | d33967ccf64094a052c299d38112e177fbacdd84 | refs/heads/master | 2023-03-15T14:35:25.044489 | 2018-01-22T12:13:00 | 2018-01-22T12:13:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,148 | java | package com.navinfo.opentsp.platform.da.core.rmi.impl.district;
import com.navinfo.opentsp.platform.da.core.persistence.redis.service.impl.DASServiceImp;
import com.navinfo.opentsp.platform.location.protocol.common.LCPlatformResponseResult.PlatformResponseResult;
import com.navinfo.opentsp.platform.location.protocol.rmi.statistic.dsa.DASTerminalStatus;
import com.navinfo.opentsp.platform.location.protocol.rmi.statistic.service.TerminalStatusService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* DSA计算任务状态缓存相关服务
* @author jin_s
*
*/
@Service
public class TerminalStatusServiceImpl implements TerminalStatusService {
/**
* 版本号
*/
private static final long serialVersionUID = 1L;
public TerminalStatusServiceImpl() {
super();
}
DASServiceImp dasService=new DASServiceImp();
/**
* DSA计算任务状态缓存查询
*
*/
@Override
public List<DASTerminalStatus> getTerminalStatusData(List<Long> terminalIds) {
long[] terminalIdArray=new long[terminalIds.size()];
for(int i=0;i<terminalIds.size();i++){
terminalIdArray[i]=terminalIds.get(i);
}
return dasService.findTerminalStatus(terminalIdArray);
}
/**
* DSA计算任务状态缓存批量存储
*
*/
@Override
public PlatformResponseResult saveTerminalStatusData(
List<DASTerminalStatus> terminalStatusList) {
return dasService.addTerminalStatus(terminalStatusList);
}
/**
* DSA计算任务状态缓存单笔存储
*
*/
@Override
public PlatformResponseResult saveTerminalStatusData(
DASTerminalStatus status) {
return dasService.addTerminalStatusSimple(status);
}
/**
* DSA计算任务状态缓存单笔删除
*
*/
@Override
public PlatformResponseResult removeTerminalStatusData(
String[] tids) {
return dasService.removeTerminalStatusSimple(tids);
}
public static void main(String[] args) {
DASTerminalStatus dasTerminalStatus = new DASTerminalStatus();
dasTerminalStatus.setTerminalId(123456);
(new TerminalStatusServiceImpl()).saveTerminalStatusData(dasTerminalStatus);
}
@Override
public boolean isConnected() {
return true;
}
}
| [
"295477887@qq.com"
] | 295477887@qq.com |
a989a8c78d95fdf3053ff7829911fc3ceba0eb58 | 9ce55ae0c71a8583500b6568dd97f3996c91a211 | /app/src/main/java/com/example/firstdraft/storage/SharedPrefManager.java | e9924a5badd2d909d58abce56fccbf651a7d45dd | [] | no_license | MeLoveCarbs/Fitness-app | 46b5530bde84f64195b259cc8e2c88b768a387aa | c7dffd739229365f0e81dca764cae6ab1f08628c | refs/heads/master | 2020-12-15T04:51:38.144319 | 2020-01-20T05:13:00 | 2020-01-20T05:13:00 | 234,999,898 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,978 | java | package com.example.firstdraft.storage;
import android.content.Context;
import android.content.SharedPreferences;
import com.example.firstdraft.Responses.User;
public class SharedPrefManager {
private static final String SHARED_PREF_NAME = "my_shared_preff";
private static SharedPrefManager mInstance;
private Context mCtx;
private SharedPrefManager(Context mCtx) {
this.mCtx = mCtx;
}
public static synchronized SharedPrefManager getInstance(Context mCtx) {
if (mInstance == null) {
mInstance = new SharedPrefManager(mCtx);
}
return mInstance;
}
public void saveUser(User user) {
SharedPreferences sharedPreferences = mCtx.getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putInt("id", user.getId());
editor.putString("email", user.getEmail());
editor.putString("name", user.getName());
editor.putString("username", user.getUsername());
editor.apply();
}
public boolean isLoggedIn() {
SharedPreferences sharedPreferences = mCtx.getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE);
return sharedPreferences.getInt("id", -1) != -1;
}
public User getUser() {
SharedPreferences sharedPreferences = mCtx.getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE);
return new User(
sharedPreferences.getInt("id", -1),
sharedPreferences.getString("email", null),
sharedPreferences.getString("name", null),
sharedPreferences.getString("username", null)
);
}
public void clear() {
SharedPreferences sharedPreferences = mCtx.getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.clear();
editor.apply();
}
}
| [
"piadruids@gmail.com"
] | piadruids@gmail.com |
9a0fc3c88bc59e51b4fe55bb2e96e63d1d6c7341 | fea7fb36e37860e2e37ca08c706cc99fb11c5566 | /common/src/main/java/burukeyou/common/serialize/impl/JSONSerializer.java | 575cb69f56de8faf618110add4f7acfa276482ff | [] | no_license | telinx/BoomRpc | 3d34314b70b9dc60e6e55e87ae9a87804826db7c | d0ad2ce56f30674825a98d2e1faa5d3bd02d6088 | refs/heads/master | 2022-11-25T10:27:43.701673 | 2020-07-20T03:49:54 | 2020-07-20T03:49:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 595 | java | package burukeyou.common.serialize.impl;
import burukeyou.common.entity.enums.SerializerAlgorithmEnum;
import burukeyou.common.serialize.Serializer;
import com.alibaba.fastjson.JSON;
public class JSONSerializer implements Serializer {
@Override
public byte getSerializerAlgorithm() {
return SerializerAlgorithmEnum.JSON.getType();
}
@Override
public byte[] serialize(Object object) {
return JSON.toJSONBytes(object);
}
@Override
public <T> T deserialize(Class<T> clazz, byte[] bytes) {
return JSON.parseObject(bytes, clazz);
}
}
| [
"2432139974@qq.com"
] | 2432139974@qq.com |
16430f3c81635c36fc8ab6fde110c4e35d5d1b63 | 56456387c8a2ff1062f34780b471712cc2a49b71 | /android/support/v7/media/MediaRouteProvider$Callback.java | baed27797969107c70063ed7a724039a757d4851 | [] | no_license | nendraharyo/presensimahasiswa-sourcecode | 55d4b8e9f6968eaf71a2ea002e0e7f08d16c5a50 | 890fc86782e9b2b4748bdb9f3db946bfb830b252 | refs/heads/master | 2020-05-21T11:21:55.143420 | 2019-05-10T19:03:56 | 2019-05-10T19:03:56 | 186,022,425 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 453 | java | package android.support.v7.media;
public abstract class MediaRouteProvider$Callback
{
public void onDescriptorChanged(MediaRouteProvider paramMediaRouteProvider, MediaRouteProviderDescriptor paramMediaRouteProviderDescriptor) {}
}
/* Location: C:\Users\haryo\Desktop\enjarify-master\presensi-enjarify.jar!\android\support\v7\media\MediaRouteProvider$Callback.class
* Java compiler version: 5 (49.0)
* JD-Core Version: 0.7.1
*/ | [
"haryo.nendra@gmail.com"
] | haryo.nendra@gmail.com |
33f6ed84306f87fb60533986254b3c2455b935ea | 6216a318b76cce20874d5fb37aafc30c888c7e6b | /EngineersBank/src/enquiryLogin.java | 84fd5c41a35c80ef984349628c9bf82088ef9608 | [] | no_license | ssoumen74/Bank-Management | 7a0ae61668bcd19353f0ddd080d110a77fa4779f | e2fb4b53012ec9be9bd251aa534045882f13a04d | refs/heads/master | 2021-01-20T13:18:07.707402 | 2017-05-06T15:57:16 | 2017-05-06T15:57:16 | 90,471,544 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,088 | java | import java.awt.*;
import java.awt.event.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.imageio.ImageIO;
import javax.swing.*;
public class enquiryLogin extends JFrame implements ActionListener {
JTextField usrbox=new JTextField();
JPasswordField pasbox=new JPasswordField();
JLabel usrtxt= new JLabel("MOBILE NO");
JLabel usrpas= new JLabel("PASSWORD");
//
JButton login = new JButton("LOGIN"); ///
/////
//////// CONSTRUCTOR STARTS HERE /////////////////////////////////////////
enquiryLogin() /////
{ ///
super("LOGIN TO KNOW MORE"); //
setSize(400,200);setLocationRelativeTo(null);setResizable(false);
Font txtfont = new Font("Calibri Light (Headings)",0,15);
////////////////////////////////////////////////////////////////////////
//////// USERNAME FIELD //////////////////////////////////////////////
usrtxt.setFont(txtfont); /////
usrtxt.setForeground(new Color(149,149,225)); /////
usrtxt.setBounds(20,20,300,15); add(usrtxt); /////
usrbox.setBounds(20,40,350,30); add(usrbox); /////
/////
////////////////////////////////////////////////////////////////////////
////// PASSWORD FIELD ///////////////////////////////////////////////
usrpas.setFont(txtfont); /////
usrpas.setForeground(new Color(149,149,225)); /////
usrpas.setBounds(20,85,110,15); add(usrpas); /////
pasbox.setBounds(20,110,240,30); add(pasbox); /////
/////
////////////////////////////////////////////////////////////////////////
///// LOGIN BUTTON ///////////////////////////////////////////////////
login.setFont(new Font("Eras Bold ITC",0,17)); /////
login.setBackground(new Color(126,126,126)); /////
login.setForeground(new Color(255,255,255)); /////
login.setBounds(270, 100, 100, 40); add(login); /////
login.addMouseListener(new checkpassword()); /////
/////
////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////// BACKGROUND IMAGE ///////////////////////////////////////////////////////////////////////////////////////////////////
setLayout(new BorderLayout()); /////
JLabel backapply=new JLabel(new ImageIcon("C://Users//SAM//Desktop//Eclipse Work//EngineersBank//images//login.jpg")); /////
add(backapply); /////
backapply.setLayout(new FlowLayout()); /////
setVisible(true); /////
/////
} /////
//////// CONSTRUCTOR ENDS HERE ////////////////////////////////////////////////////////////////////////////////////////////////
///////// EVENT LISTENER FOR LOGIN BUTTON //////////////////////////////////////////////////////////////////////////////////////
class checkpassword implements MouseListener /////
{ /////
public void mouseEntered(MouseEvent evt){login.setBackground(new Color(0,127,92));} /////
public void mouseExited(MouseEvent evt){login.setBackground(new Color(126,126,126));} /////
public void mouseReleased(MouseEvent evt){} /////
public void mousePressed(MouseEvent evt){} /////
public void mouseClicked(MouseEvent evt) /////
{ /////
{
String contact = usrbox.getText();
String password= pasbox.getText();
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection cn=DriverManager.getConnection("jdbc:mysql://localhost/bank","root","1234");
Statement st= cn.createStatement();
ResultSet rs=st.executeQuery("select * from customers where contact='"+contact+"' and password='"+password+"'");
if(rs.next()==true)
{ JOptionPane.showMessageDialog(getContentPane(), "login successfull");
String bal=rs.getString(8);
String mssg="Your Current Balance is : "+bal;
JOptionPane.showMessageDialog(getContentPane(), mssg);
}
else
{JOptionPane.showMessageDialog(getContentPane(), "incorrect username or password");}
}
catch(Exception ex)
{ System.out.println(ex); }
} /////
} /////
} /////
///////// EVENT LISTENER ENDS ////////////////////////////////////////////////////////////////////////////////////////////////
} | [
"noreply@github.com"
] | noreply@github.com |
6a8bb6aa789a90914b8c5dd5208e9276f58ce633 | 8439c47644705a9b462be56048e7ec89c8f6ea99 | /src/main/java/biweekly/property/ExceptionDates.java | b981d82f40ac03f3feb082b9b085b80c06f8a5e5 | [
"BSD-2-Clause",
"BSD-2-Clause-Views"
] | permissive | nicky-isaacs/biweekly | 0858fedd991fb5df1e8a5a05347203bd3010a3cd | ed15b5fb540ef656b45fd1be05e8d4d210d2fa1f | refs/heads/master | 2021-01-18T18:26:37.247916 | 2016-01-30T22:13:05 | 2016-01-30T22:13:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,493 | java | package biweekly.property;
import java.util.Date;
import java.util.List;
import biweekly.ICalVersion;
import biweekly.Warning;
import biweekly.component.ICalComponent;
import biweekly.util.ICalDate;
/*
Copyright (c) 2013-2015, Michael Angstadt
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* <p>
* Defines a list of exceptions to the dates specified in the
* {@link RecurrenceRule} property.
* </p>
* <p>
* <b>Code sample:</b>
*
* <pre class="brush:java">
* VEvent event = new VEvent();
*
* //dates with time components
* ExceptionDates exdate = new ExceptionDates();
* Date datetime = ...
* exdate.addValue(new ICalDate(datetime, true));
* event.addExceptionDates(exdate);
*
* //dates without time components
* exdate = new ExceptionDates();
* Date date = ...
* exdate.addValue(new ICalDate(date, false));
* event.addExceptionDates(exdate);
* </pre>
*
* </p>
* @author Michael Angstadt
* @see <a href="http://tools.ietf.org/html/rfc5545#page-118">RFC 5545
* p.118-20</a>
* @see <a href="http://tools.ietf.org/html/rfc2445#page-112">RFC 2445
* p.112-4</a>
* @see <a href="http://www.imc.org/pdi/vcal-10.doc">vCal 1.0 p.31</a>
*/
public class ExceptionDates extends ListProperty<ICalDate> {
public ExceptionDates() {
//empty
}
/**
* Copy constructor.
* @param original the property to make a copy of
*/
public ExceptionDates(ExceptionDates original) {
super(original);
getValues().clear();
for (ICalDate date : original.getValues()) {
addValue(new ICalDate(date));
}
}
/**
* Adds a value to this property.
* @param value the value to add
*/
public void addValue(Date value) {
addValue(new ICalDate(value));
}
@Override
protected void validate(List<ICalComponent> components, ICalVersion version, List<Warning> warnings) {
super.validate(components, version, warnings);
List<ICalDate> dates = getValues();
if (dates.isEmpty()) {
return;
}
//can't mix date and date-time values
boolean hasTime = dates.get(0).hasTime();
for (ICalDate date : dates.subList(1, dates.size())) {
if (date.hasTime() != hasTime) {
warnings.add(Warning.validate(50));
break;
}
}
}
@Override
public ExceptionDates copy() {
return new ExceptionDates(this);
}
}
| [
"mike.angstadt@gmail.com"
] | mike.angstadt@gmail.com |
9f2b11056ab34452b239e99bb1072989ef51831d | 5c8379bfb89432e3c1e4654d8468b2f8704a8ad4 | /JavaPrograms/src/binaryTreePrograms/DistBtwNodes.java | 89afc5565d839e3565be4838e81f090bfb9e0f4f | [] | no_license | SunnySinghs/JavaProgram | 7df433d0a69c353e5d9438ee9e1e037ec7856d00 | 9200e7d245c4181030332821ee066b8c9bc8bb68 | refs/heads/master | 2021-05-04T14:44:40.382208 | 2018-07-10T19:27:02 | 2018-07-10T19:27:02 | 120,209,994 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,196 | java | package binaryTreePrograms;
public class DistBtwNodes {
int d1 = -1;
int d2 = -1;
int dist = -1;
public static void main(String[] args) {
// TODO Auto-generated method stub
int dist = new DistBtwNodes().findDistance(new TreeNode().getTree(), 4, 6);
System.out.println("\n\n>>>>>>>dist>>>>>>"+dist);
}
public TreeNode findDistUtil(TreeNode root, int n1, int n2, int lvl) {
if(root==null) {
return root;
}
if(root.data == n1) {
d1 = lvl;
return root;
}
if(root.data == n2) {
d2 = lvl;
return root;
}
TreeNode left = findDistUtil(root.left, n1, n2, lvl+1);
TreeNode right = findDistUtil(root.right, n1, n2, lvl+1);
if(left!=null && right!=null) {
dist = (d1+d2) - 2*lvl;
return root;
}
return (left!=null)?left:right;
}
int findDistance(TreeNode root, int n1, int n2) {
d1 = -1;
d2 = -1;
dist = 0;
TreeNode lca = findDistUtil(root, n1, n2, 1);
if(d1!=-1 && d2!=-1) {
return dist;
}
if(d1!=-1) {
return new FindNodeLevel().findLevel(lca, n2, 0);
}
if(d2!=-1) {
return new FindNodeLevel().findLevel(lca, n1, 0);
}
return -1;
}
}
| [
"sourabh.singh000@gmail.com"
] | sourabh.singh000@gmail.com |
2e1fd7a3e3c9bc14b9e355b58e5896e691ce7625 | 2c07521ca1b036a511da948421308a12d9f603cb | /Lost Child/src/New.java | 6a8c87d58703d935203ceca5a4daf15b3afa1321 | [] | no_license | AishaNair/Lost-Child | 8aba3de99990bb018dfe44ce878687c42ebe5656 | dde13c367d6446a3b7852ad229c72ac2afc51efa | refs/heads/master | 2020-09-15T09:26:32.573883 | 2016-09-05T11:54:50 | 2016-09-05T11:54:50 | 67,416,602 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,867 | java | import java.awt.Canvas;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.imageio.ImageIO;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
class New
extends JFrame
implements ActionListener
{
String[] msg = { "Male", "Female" };
String[] msg1 = { "Pending", "Solved" };
int i;
File f1;
JLabel head = new JLabel("New Missing Case Report Form");
JLabel photo = new JLabel("\t\tPhoto\t");
JLabel l1 = new JLabel("Enter Id");
JLabel l2 = new JLabel("First Name");
JLabel l3 = new JLabel("Last Name");
JLabel l4 = new JLabel("Alias Name");
JLabel l14 = new JLabel("D.O.B");
JLabel l5 = new JLabel("Age");
JLabel l6 = new JLabel("Gender");
JLabel l7 = new JLabel("Address");
JLabel l8 = new JLabel("City");
JLabel l9 = new JLabel("State");
JLabel l10 = new JLabel("Missing Date");
JLabel l11 = new JLabel("Additional Info");
JLabel l13 = new JLabel("Image Path");
JLabel l15= new JLabel("Status of Case");
JTextField t1 = new JTextField(20);
JTextField t2 = new JTextField(20);
JTextField t3 = new JTextField(20);
JTextField t4 = new JTextField(20);
JTextField t5 = new JTextField(20);
JTextField t6 = new JTextField(20);
JTextField t7 = new JTextField(20);
JTextField t8 = new JTextField(20);
JTextField t9 = new JTextField(20);
JTextField t11 = new JTextField(20);
JComboBox c = new JComboBox();
JComboBox status = new JComboBox();
JComboBox da = new JComboBox();
JComboBox mo = new JComboBox();
JComboBox yr = new JComboBox();
JComboBox dd = new JComboBox();
JComboBox mm = new JComboBox();
JComboBox yy = new JComboBox();
JButton b2 = new JButton("Ok");
JButton b3 = new JButton("Exit");
JButton b4 = new JButton(".......");
JButton b5 = new JButton("Clear");
int id = 0;
Connection con;
Statement stmt;
PreparedStatement ps;
private int j;
private int k;
New()
{
super("New Child Record");
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
this.con = DriverManager.getConnection("jdbc:odbc:abc", "", "");
this.stmt = this.con.createStatement();
ResultSet localObject1 = this.stmt.executeQuery("select max(cid) from face");
if (((ResultSet)localObject1).next())
{
String localObject2 = ((ResultSet)localObject1).getString(1);
if (localObject2 != null) {
this.id = Integer.parseInt((String)localObject2);
}
}
this.id += 1;
}
catch (Exception localException)
{
JOptionPane.showMessageDialog(this, localException.getMessage(), "Child Details", 0);
}
Color customColor = new Color(00,192,255);
Color customColor1 = new Color(255,64,00);
Color customColor2 = new Color(255,192,64);
Container localContainer = getContentPane();
localContainer.setLayout(null);
setSize(650, 700);
setResizable(false);
Object localObject1 = Toolkit.getDefaultToolkit().getScreenSize();
Object localObject2 = getBounds();
setLocation((((Dimension)localObject1).width - ((Rectangle)localObject2).width) / 2, (((Dimension)localObject1).height - ((Rectangle)localObject2).height) / 2);
localContainer.setBackground(new Color(0,0,0));
head.setForeground(customColor);
this.head.setFont(new Font("Eras Bold ITC", 0, 25));
this.head.setBounds(140, 10, 400, 30);
localContainer.add(this.head);
this.photo.setFont(new Font("Eras Bold ITC", 0, 20)); //photo=JLabel
this.photo.setBounds(420, 85, 200, 260);
this.photo.setForeground(customColor1);
this.photo.setBorder(BorderFactory.createTitledBorder(""));
localContainer.add(this.photo);
for (int j = 0; j < 2; j++) {
this.c.addItem(this.msg[j]);
}
for (int j = 0; j < 2; j++) {
this.status.addItem(this.msg1[j]);
}
this.da.addItem("NA");
for (j = 1; j <= 31; j++) {
this.da.addItem(j + "");
}
String[] arrayOfString = {"NA", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };
for (int k = 0; k <= 12; k++) {
this.mo.addItem(arrayOfString[k]);
}
this.yr.addItem("NA");
for (k = 1995; k <= 2015; k++) {
this.yr.addItem(k + "");
}
for (j = 1; j <= 31; j++) {
this.dd.addItem(j + "");
}
String[] arrayString1 = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };
for (int k = 0; k < 12; k++) {
this.mm.addItem(arrayString1[k]);
}
for (k = 1995; k <= 2015; k++) {
this.yy.addItem(k + "");
}
this.t1.setText(this.id + ""); //t1=eno
this.t1.setEditable(false);
this.t2.requestFocus();
this.l1.setBounds(20, 50, 100, 30);
this.l1.setForeground(customColor1);
this.l1.setFont(new Font("Eras Bold ITC", 0, 17));
this.t1.setBounds(180, 50, 215, 30);
this.l2.setBounds(20, 90, 100, 30);
this.t2.setBounds(180, 90, 215, 30);
this.l2.setForeground(customColor1);
this.l2.setFont(new Font("Eras Bold ITC", 0, 17));//t2=fname
this.l3.setBounds(20, 130, 100, 30);
this.l3.setForeground(customColor1);
this.l3.setFont(new Font("Eras Bold ITC", 0, 17));
this.t3.setBounds(180, 130, 215, 30); //t3=lname
this.l4.setBounds(20, 170, 100, 30);
this.l4.setForeground(customColor1);
this.l4.setFont(new Font("Eras Bold ITC", 0, 17));
this.t4.setBounds(180, 170, 215, 30); //t4=alias
this.l14.setBounds(20, 210, 100, 30);
this.l14.setForeground(customColor1);
this.l14.setFont(new Font("Eras Bold ITC", 0, 17));
this.da.setBounds(180, 210, 55, 30);
this.mo.setBounds(245, 210, 80, 30);
this.yr.setBounds(335, 210, 60, 30);
this.l5.setBounds(20, 250, 100, 30);
this.l5.setForeground(customColor1);//t5=age
this.l5.setFont(new Font("Eras Bold ITC", 0, 17));
this.t5.setBounds(180, 250, 215, 30);
this.l6.setBounds(20, 290, 100, 30);
this.l6.setForeground(customColor1);//c=gender
this.l6.setFont(new Font("Eras Bold ITC", 0, 17));
this.c.setBounds(180, 290, 215, 30);
this.l7.setBounds(20, 330, 100, 30);
this.l7.setForeground(customColor1); //t7=Address
this.l7.setFont(new Font("Eras Bold ITC", 0, 17));
this.t7.setBounds(180, 330, 215, 30);
this.l8.setBounds(20, 370, 100, 30);
this.l8.setForeground(customColor1);
this.l8.setFont(new Font("Eras Bold ITC", 0, 17));
this.t8.setBounds(180, 370, 215, 30); //t8=city
this.l9.setBounds(20, 410, 100, 30);
this.l9.setForeground(customColor1);
this.l9.setFont(new Font("Eras Bold ITC", 0, 17));
this.t9.setBounds(180, 410, 215, 30); //t9=state
this.l10.setBounds(20, 450, 150, 30);
this.l10.setForeground(customColor1);
this.l10.setFont(new Font("Eras Bold ITC", 0, 17)); //missing date
this.dd.setBounds(180, 450, 55, 30);
this.mm.setBounds(245, 450, 80, 30);
this.yy.setBounds(335, 450, 60, 30);
this.l11.setBounds(20, 490, 200, 30);
this.l11.setForeground(customColor1);
this.l11.setFont(new Font("Eras Bold ITC", 0, 17));
this.t11.setBounds(180, 490, 215, 30); //t11=Additional info
this.l13.setBounds(20, 530, 100, 30);
this.l13.setForeground(customColor1);
this.l13.setFont(new Font("Eras Bold ITC", 0, 17));
this.t6.setBounds(180, 530, 215, 30);//t6=image text
this.b4.setBackground(customColor2);
this.b4.setBounds(405, 530, 80, 30);
this.b4.setForeground(Color.black);
this.b4.setFont(new Font("Eras Bold ITC", 0, 17));
this.t6.setEditable(false);
this.l15.setBounds(20, 570, 150, 30); //l15=status
this.l15.setForeground(customColor1);
this.l15.setFont(new Font("Eras Bold ITC", 0, 17));
this.status.setBounds(180, 570, 215, 30);
localContainer.add(this.l1);localContainer.add(this.t1);
localContainer.add(this.l2);localContainer.add(this.t2);
localContainer.add(this.l3);localContainer.add(this.t3);
localContainer.add(this.l4);localContainer.add(this.t4);
localContainer.add(this.l14);localContainer.add(this.da);
localContainer.add(this.mo);
localContainer.add(this.yr);
localContainer.add(this.dd);
localContainer.add(this.mm);localContainer.add(this.yy);
localContainer.add(this.l5);localContainer.add(this.t5);
localContainer.add(this.l6);localContainer.add(this.c);
localContainer.add(this.l7);localContainer.add(this.t7);
localContainer.add(this.l8);localContainer.add(this.t8);
localContainer.add(this.l9);localContainer.add(this.t9);
localContainer.add(this.l10);
localContainer.add(this.l11);localContainer.add(this.t11);
localContainer.add(this.l13);localContainer.add(this.t6);
localContainer.add(this.b4);
localContainer.add(this.l15);localContainer.add(this.status);
this.b2.setBounds(40, 610, 85, 30);
this.b3.setBounds(200, 610, 85, 30);
this.b5.setBounds(360, 610, 85, 30);
this.b2.setForeground(Color.black);
this.b3.setForeground(Color.black);
this.b5.setForeground(Color.black);
this.b2.setFont(new Font("Eras Bold ITC", 0, 17));
this.b3.setFont(new Font("Eras Bold ITC", 0, 17));
this.b5.setFont(new Font("Eras Bold ITC", 0, 17));
this.b2.setBackground(customColor2);
this.b3.setBackground(customColor2);
this.b5.setBackground(customColor2);
localContainer.add(this.b2);localContainer.add(this.b3);localContainer.add(this.b5);
this.b2.addActionListener(this);
this.b3.addActionListener(this);
this.b4.addActionListener(this);
this.b5.addActionListener(this);
}
public void actionPerformed(ActionEvent paramActionEvent)
{
JButton localJButton = (JButton)paramActionEvent.getSource();
if (localJButton == this.b2) //b2=Ok
{
try
{
int j = Integer.parseInt(this.t1.getText());
String str1 = this.t2.getText(); //str1=fname
String str2 = this.t3.getText(); //str2=lname
String str3 = this.t4.getText(); //str3=alias name
String str4 = this.da.getSelectedItem().toString(); //str4=date
String str5 = this.mo.getSelectedItem().toString(); //str5=month
String str6 = this.yr.getSelectedItem().toString(); //str6=year
String str7 = this.t5.getText(); //str7=age
String str8 = this.c.getSelectedItem().toString(); //str8=gender
String str9 = this.t7.getText(); //str9=address
String str10 = this.t8.getText(); //str10=city
String str11 = this.t9.getText(); //str11=state
String str12 = this.dd.getSelectedItem().toString(); //str12=found date
String str13 = this.mm.getSelectedItem().toString(); //str13=found month
String str14 = this.yy.getSelectedItem().toString(); //str14=found year
String str16 = this.t6.getText(); //str16=photo file
String str15 = this.t11.getText(); //str15=Additional info
String str17 = this.status.getSelectedItem().toString(); //str17=status
int flag=0;
this.stmt=con.createStatement();
ResultSet rs=stmt.executeQuery("select * from face where fname='"+str1+"' or lname='"+str2+"' or aname='"+str3+"'" );
while(rs.next()){
int response = JOptionPane.showConfirmDialog(this,"Similar record found. Wish to view it?", "Record Found",
JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if (response == JOptionPane.NO_OPTION) {
dispose();
}
else if (response == JOptionPane.YES_OPTION) {
newmissfound f= new newmissfound(str1,str2,str3);
flag++;
}
}
if(flag==0){
con.setAutoCommit(false);
FileInputStream fis=new FileInputStream(f1);
this.ps=con.prepareStatement("insert into face values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
ps.setInt(1,j);
ps.setString(2, str1);
ps.setString(3, str2);
ps.setString(4,str3);
ps.setString(5, str4+"-"+str5+"-"+str6);
ps.setString(6, str7);
ps.setString(7,str8);
ps.setString(8, str9);
ps.setString(9, str10);
ps.setString(10,str11);
ps.setString(11,str12+"-"+str13+"-"+str14);
ps.setString(12,str15);
ps.setBinaryStream(13, fis,(int)f1.length());
ps.setString(14,str16);
ps.setString(15,str17);
int m=ps.executeUpdate();
con.commit();
ps.close();
fis.close();
if (m == 1) {
JOptionPane.showMessageDialog(this, "Record Inserted");
}
}
}
catch (Exception localException)
{
localException.printStackTrace();
JOptionPane.showMessageDialog(this, localException.getMessage(), "New Child Record", 0);
}
}
else if (localJButton == this.b5)
{
this.t2.setText("");
this.t3.setText("");
this.t4.setText("");
this.t5.setText("");
this.t6.setText("");
this.t7.setText("");
this.t8.setText("");
this.t9.setText("");
this.t11.setText("");
this.c.setSelectedIndex(0);
this.da.setSelectedIndex(0);
this.mo.setSelectedIndex(0);
this.yr.setSelectedIndex(0);
this.dd.setSelectedIndex(0);
this.mm.setSelectedIndex(0);
this.yy.setSelectedIndex(0);
this.status.setSelectedIndex(0);
}
else if (localJButton == this.b4)
{
JFileChooser chooser = new JFileChooser();
chooser.showOpenDialog(null);
File f = chooser.getSelectedFile();
f1=f;
String filename = f.getAbsolutePath();
t6.setText(filename);
try {
ImageIcon ii=new ImageIcon(scaleImage(200, 260, ImageIO.read(new File(filename))));//get the image from file chooser and scale it to match JLabel size
photo.setIcon(ii);
}
catch (Exception ex) {
ex.printStackTrace();
}
}
else if (localJButton == this.b3)
{
setVisible(false);
dispose();
}
}
public static BufferedImage scaleImage(int w, int h, BufferedImage img) throws Exception {
BufferedImage bi;
bi = new BufferedImage(w, h, BufferedImage.TRANSLUCENT);
Graphics2D g2d = (Graphics2D) bi.createGraphics();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.addRenderingHints(new RenderingHints(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY));
g2d.drawImage(img, 0, 0, w, h, null);
g2d.dispose();
return bi;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
c2b6f69a2709aa87869a390de730e0fbfbd18429 | 913a0a160051421e3f5481e467648684c96147e9 | /src/H01/H1Opdracht3.java | 7e14426d362e4c68fbf404c4459eb7a718c4b416 | [] | no_license | LOGiantBOY/JavaBijSpijkerCurses | 4594b3e956f4a6284866e06b9b44eb9165b22a63 | 3ceada4d134fe78a534a2d2a7b929fa6c3b40d27 | refs/heads/master | 2020-12-05T23:01:11.354511 | 2020-01-14T18:41:19 | 2020-01-14T18:41:19 | 232,269,990 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 365 | java | package H01;
public class H1Opdracht3 {
public static void main(String[] args) {
System.out.println("OPDRACHT 1.3\n");
System.out.println("a\ta^2\ta^3\ta^4");
System.out.println("1\t1\t1\t1");
System.out.println("2\t4\t8\t16");
System.out.println("3\t9\t27\t81");
System.out.println("4\t16\t64\t256");
}
}
| [
"lkogenhop@gmail.com"
] | lkogenhop@gmail.com |
0a242e118b715e06433397fc89cf922557cdff07 | 94cb48658040df60a16a5a13da0976ed07c01ceb | /dunwu-tool/dunwu-tool-core/src/test/java/io/github/dunwu/tool/util/RandomUtilTest.java | 199e6d34c88583ed47909123153e307edd4ba768 | [
"Apache-2.0"
] | permissive | wtopps/dunwu | 569ea2f7aefbebf81efe0057b07b95f7ce00403b | 7c94d56808d76b4cf96aa34141ddc7d3b7fe4414 | refs/heads/master | 2020-12-08T12:58:54.891740 | 2019-12-20T15:42:30 | 2019-12-20T15:42:30 | 232,987,475 | 1 | 0 | Apache-2.0 | 2020-01-10T07:08:20 | 2020-01-10T07:08:19 | null | UTF-8 | Java | false | false | 7,189 | java | package io.github.dunwu.tool.util;
import io.github.dunwu.tool.collection.CollectionUtil;
import io.github.dunwu.tool.date.DatePattern;
import io.github.dunwu.tool.lang.Console;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.RepeatedTest;
import org.junit.jupiter.api.Test;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Set;
import static org.assertj.core.api.Assertions.assertThat;
public class RandomUtilTest {
@Test
public void randomEleSetTest() {
Set<Integer> set = RandomUtil.randomEleSet(CollectionUtil.newArrayList(1, 2, 3, 4, 5, 6), 2);
Assertions.assertEquals(set.size(), 2);
}
@Test
public void randomElesTest() {
List<Integer> result = RandomUtil.randomEles(CollectionUtil.newArrayList(1, 2, 3, 4, 5, 6), 2);
Assertions.assertEquals(result.size(), 2);
}
@Test
public void randomDoubleTest() {
double randomDouble = RandomUtil.randomDouble(0, 1, 0, RoundingMode.HALF_UP);
Assertions.assertTrue(randomDouble <= 1);
}
@Test
@Disabled
public void randomBooleanTest() {
Console.log(RandomUtil.randomBoolean());
}
@RepeatedTest(30)
void anyCBoyFirstName() {
System.out.println("随机中文男孩名:" + RandomUtil.randomChineseBoyFirstName());
}
@RepeatedTest(100)
void anyCBoyName() {
System.out.println("随机中文男孩姓名:" + RandomUtil.randomChineseBoyName());
}
@RepeatedTest(30)
void anyCGirlFirstName() {
System.out.println("随机中文女孩名:" + RandomUtil.randomChineseGirlFirstName());
}
@RepeatedTest(100)
void anyCGirlName() {
System.out.println("随机中文女孩姓名:" + RandomUtil.randomChineseGirlName());
}
@RepeatedTest(10)
void anyCLastName() {
System.out.println("随机中文姓氏:" + RandomUtil.randomChineseLastName());
}
@RepeatedTest(10)
void anyCLetterString() {
int count = RandomUtil.randomInt(10, 100);
System.out.println(
"随机中文字组成的字符串:" + RandomUtil.randomChineseLetterString(10, count));
}
@RepeatedTest(100)
void anyCName() {
System.out.println("随机中文姓名:" + RandomUtil.randomChineseName());
}
@RepeatedTest(10)
void anyDate() {
LocalDateTime min = LocalDateTime.of(2018, 12, 1, 0, 0, 0);
LocalDateTime max = LocalDateTime.of(2018, 12, 6, 23, 59, 59);
String date = RandomUtil.randomDate(min, max, DatePattern.NORM_DATETIME_PATTERN);
System.out.println(
"RandomUtil.randomDate(min, max, DatePattern.NORM_DATETIME_PATTERN) : " + date);
// Assertions.assertTrue(DateUtil.che(date, DATE_PATTERN));
Date date2 = RandomUtil.randomDate(min, max);
System.out.println("RandomUtil.anyDate(min, max): " + date2);
}
@RepeatedTest(10)
void anyDomain() {
String domain = RandomUtil.randomDomain();
System.out.println("random anyDomain: " + domain);
}
@RepeatedTest(10)
void anyEmail() {
String email = RandomUtil.randomEmail();
System.out.println("random anyEmail: " + email);
}
@RepeatedTest(10)
void anyFirstName() {
System.out.println("随机英文女孩名:" + RandomUtil.randomFirstName(true));
System.out.println("随机英文男孩名:" + RandomUtil.randomFirstName());
}
@RepeatedTest(10)
void anyIPv4() {
String ip = RandomUtil.randomIpv4();
System.out.println("RandomUtil.anyIpv4(): " + ip);
Assertions.assertTrue(ValidatorUtil.isIpv4(ip));
}
@RepeatedTest(10)
void anyLastName() {
System.out.println("随机英文姓氏:" + RandomUtil.randomLastName());
}
@RepeatedTest(10)
void anyLetterString() {
int count = RandomUtil.randomInt(10, 100);
System.out
.println("随机英文字母组成的字符串:" + RandomUtil.randomString(10, count));
}
@RepeatedTest(10)
void anyMac() {
System.out.println("RandomUtil.anyMac(): " + RandomUtil.randomMac());
System.out.println(
"RandomUtil.anyMac(\":\"): " + RandomUtil.randomMac(":"));
}
@RepeatedTest(10)
void anyNumString() {
int count = RandomUtil.randomInt(6, 50);
System.out.println("随机数字组成的字符串:" + RandomUtil.randomNumString(5, count));
}
@RepeatedTest(10)
void anySimpleCLetter() {
System.out.println("随机简体中文字组成的字符:" + RandomUtil.randomChineseSimpleLetter());
}
@RepeatedTest(10)
void anySimpleCLetterString() {
int count = RandomUtil.randomInt(11, 100);
System.out.println("随机简体中文字组成的字符串:"
+ RandomUtil.randomChineseSimpleLetterString(10, count));
}
@RepeatedTest(10)
void getRandom() {
System.out.println(RandomUtil.secureRandom().nextInt());
System.out.println(RandomUtil.threadLocalRandom().nextInt());
}
@RepeatedTest(10)
void nextDouble() {
double value = RandomUtil.randomDouble();
assertThat(value).isBetween(0d, Double.MAX_VALUE);
value = RandomUtil.randomDouble();
assertThat(value).isBetween(0d, Double.MAX_VALUE);
value = RandomUtil.randomDouble(0d, 10d);
assertThat(value).isBetween(0d, 10d);
value = RandomUtil.randomDouble(0d, 10d);
assertThat(value).isBetween(0d, 10d);
}
@RepeatedTest(10)
void nextInt() {
int value = RandomUtil.randomInt();
assertThat(value).isBetween(0, Integer.MAX_VALUE);
value = RandomUtil.randomInt();
assertThat(value).isBetween(0, Integer.MAX_VALUE);
value = RandomUtil.randomInt(0, 10);
assertThat(value).isBetween(0, 10);
value = RandomUtil.randomInt(0, 10);
assertThat(value).isBetween(0, 10);
}
@RepeatedTest(10)
void nextLong() {
long value = RandomUtil.randomLong();
assertThat(value).isBetween(0L, Long.MAX_VALUE);
value = RandomUtil.randomLong();
assertThat(value).isBetween(0L, Long.MAX_VALUE);
value = RandomUtil.randomLong(0L, 10L);
assertThat(value).isBetween(0L, 10L);
value = RandomUtil.randomLong(0L, 10L);
assertThat(value).isBetween(0L, 10L);
}
@RepeatedTest(10)
void randomEnum() {
System.out.println(RandomUtil.randomEnum(Color.class).name());
}
@RepeatedTest(10)
void randomString() {
System.out.println(RandomUtil.randomString(5, 10));
System.out.println(
RandomUtil.randomString(5, 10));
}
@RepeatedTest(10)
void randomStringInList() {
String[] charset = new String[] { "A", "B", "C", "D" };
List<String> list = Arrays.asList(charset);
System.out.println("random param: " + RandomUtil.randomInList(list));
}
enum Color {
RED,
YELLOW,
BLUE
}
}
| [
"forbreak@163.com"
] | forbreak@163.com |
c47bc5daf6a082dc800e4f997195374c70c34184 | 41a5724ef5cf75d2d63f97113865f29d5bd71344 | /plugins/com.seekon.mars.logger/src/com/seekon/mars/logger/log4j/BundleLogManager.java | b1d64f5e59f3af1cd098abe69af93d2694808ceb | [] | no_license | undyliu/mars | dcf9e68813c0af19ea71be0a3725029e5ae54575 | 63e6c569ca1e253f10a9fe5fdc758cadad993c71 | refs/heads/master | 2021-01-10T18:31:16.111134 | 2013-08-19T12:55:38 | 2013-08-19T12:55:38 | 10,619,113 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 572 | java | package com.seekon.mars.logger.log4j;
import java.net.URL;
import org.apache.log4j.LogManager;
import org.apache.log4j.helpers.OptionConverter;
import org.osgi.framework.Bundle;
public class BundleLogManager {
private BundleLogManager() {
super();
}
public static void loadBundleLog4jConfigure(Bundle bundle ){
URL url = bundle.getResource("log4j.xml");
if(url == null){
url = bundle.getResource("log4j.properties");
}
if(url != null){
OptionConverter.selectAndConfigure(url, null, LogManager.getLoggerRepository());
}
}
}
| [
"undyliu@126.com"
] | undyliu@126.com |
ec6b233e8b95595592134010b1757715159ee500 | 88bd6ce56e46e1adc61ae6dc2bebc9c2a65a227d | /SpringBootTwo-Thymeleaf/src/main/java/com/wml/entity/Author.java | 92f3b2f3137836e5dafdfdd5e524e7d17dd04710 | [] | no_license | NorwayWang/SpringBoot-LearningSummary | 188892ebe3dc33886f5f0eb4d64999b43294f153 | 02ed82413f43f77fd53aebf843c3c2cacf16659d | refs/heads/master | 2020-12-17T23:50:06.285029 | 2020-01-22T09:36:21 | 2020-01-22T09:36:21 | 235,301,016 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 997 | java | package com.wml.entity;
public class Author {
private String userName;
private int age;
private String email;
private String realName;
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getRealName() {
return realName;
}
public void setRealName(String realName) {
this.realName = realName;
}
@Override
public String toString() {
return "Author{" +
"userName='" + userName + '\'' +
", age=" + age +
", email='" + email + '\'' +
", realName='" + realName + '\'' +
'}';
}
}
| [
"noreply@github.com"
] | noreply@github.com |
4085101d7e26d8b9205fa11ab96991f4ad33cff9 | 50f3519d5687f56695b325235f56572d248ccab6 | /cheapest-flights-within-k-stops.java | 9a637ebeade4c87cef469de0113c347f5b98f675 | [] | no_license | ishansahu/DailyCode | acd7c645c028ab281c30d44730f0b055e0b65c99 | 85e539aab96a385cbb650a76a8792efd99e75d50 | refs/heads/master | 2021-07-02T13:46:09.212888 | 2021-01-06T04:39:59 | 2021-01-06T04:39:59 | 207,443,873 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,254 | java | class Solution {
public int findCheapestPrice(int n, int[][] flights, int src, int dst, int K) {
HashMap<Integer, List<int[]>> graph = new HashMap();
for(int[] flight : flights){
List<int[]> temp = graph.get(flight[0]);
if(temp == null) temp = new ArrayList();
temp.add(new int[]{flight[1], flight[2]});
graph.put(flight[0], temp);
}
int res = Integer.MAX_VALUE;
PriorityQueue<int[]> pq = new PriorityQueue( new Comparator<int[]>(){
@Override
public int compare(int[] a, int[] b){
return a[0] -b[0];
}
});
pq.add(new int[]{0, src, K+1});
while(!pq.isEmpty()){
int[] curr = pq.poll();
int dist = curr[0];
int vertex = curr[1];
int stop = curr[2];
if(vertex == dst) return dist;
if(stop >0){
List<int[]> adjacent = graph.get(vertex);
if (adjacent== null) continue;
for(int i=0; i<adjacent.size(); ++i){
pq.add(new int[]{dist + adjacent.get(i)[1], adjacent.get(i)[0], stop -1 });
}
}
}
return -1;
}
} | [
"noreply@github.com"
] | noreply@github.com |
dd472e8aac531bd6901c8ffdf708f60ca2f7c04e | ca205fb87be718c3458d1aa2a31a6c5cbbf2abc0 | /src/main/java/com/springtest/SpringRest/controller/GameRestController.java | 2446e3b4cd998f7cecb5dedadf9dc829c1669ec8 | [] | no_license | Peszi/SpringRestTest | 0e08dfd13c6cf82041dd62421a8c380479b63f35 | 38367db2db2f078277f1f6d917510af9ec0a419c | refs/heads/master | 2020-03-07T04:52:09.222696 | 2018-04-09T14:15:12 | 2018-04-09T14:15:12 | 127,148,050 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,237 | java | package com.springtest.SpringRest.controller;
import com.springtest.SpringRest.model.Room;
import com.springtest.SpringRest.repository.RoomRepository;
import com.springtest.SpringRest.repository.UserRepository;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.Collection;
import java.util.Optional;
@RestController
@RequestMapping("/rest")
public class GameRestController {
private RoomRepository roomRepository;
private UserRepository repository;
public GameRestController(RoomRepository roomRepository, UserRepository repository) {
this.roomRepository = roomRepository;
this.repository = repository;
}
// Manage
// Getters
@RequestMapping(method = RequestMethod.GET, value = "/game/{gameId}")
Optional<Room> getGame(@PathVariable Long gameId) {
return this.roomRepository.findById(gameId);
}
@RequestMapping(method = RequestMethod.GET, value = "/games")
Collection<Room> getAllGames() {
return this.roomRepository.findAll();
}
}
| [
"mat_mos@wp.pl"
] | mat_mos@wp.pl |
5843aa99af660d8be24122fc5f3390c65b6f0cd3 | 652827016e062a195eff4ae93b7c5b588efaf0d5 | /workspaceCSCI4980carey/plugin-project-1101-zest-ast-type.zip_expanded/simpleZestProject4/src/graph/provider/GLabelProvider.java | 4e7243f96ade5eb3aefd9ec33ff314ecb765dfe9 | [] | no_license | treytencarey/workspaceCSCI4980carey | 2849bcafcf67d9b62d1129daa8c8d0585f0665ad | 5fe839290d15ac896a3501253a2dad6e5134d347 | refs/heads/master | 2020-03-27T04:06:48.572779 | 2018-11-30T01:10:03 | 2018-11-30T01:10:03 | 145,912,587 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,661 | java | /*
* @(#) ZestLabelProvider.java
*
*/
package graph.provider;
import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.IFigure;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Color;
import org.eclipse.zest.core.viewers.EntityConnectionData;
import org.eclipse.zest.core.viewers.IEntityConnectionStyleProvider;
import org.eclipse.zest.core.viewers.IEntityStyleProvider;
import graph.builder.GModelBuilder;
import graph.model.GNode;
import graph.model.node.GClassNode;
import graph.model.node.GPackageNode;
public class GLabelProvider extends LabelProvider implements IEntityStyleProvider, IEntityConnectionStyleProvider {
@Override
public String getText(Object element) {
// Create a label for node.
if (element instanceof GNode) {
GNode myNode = (GNode) element;
return myNode.getName();
}
// Create a label for connection.
if (element instanceof EntityConnectionData) {
EntityConnectionData eCon = (EntityConnectionData) element;
if (eCon.source instanceof GNode) {
return GModelBuilder.instance().getConnectionLabel( //
((GNode) eCon.source).getId(), //
((GNode) eCon.dest).getId());
}
}
return "";
}
@Override
public Color getBackgroundColour(Object o) {
return getNodeColor(o);
}
private Color getNodeColor(Object o) {
if (o instanceof GPackageNode) {
return ColorConstants.lightGreen;
}
if (o instanceof GClassNode) {
return ColorConstants.lightBlue;
}
return ColorConstants.yellow;
}
@Override
public Color getForegroundColour(Object arg0) {
return ColorConstants.black;
}
@Override
public boolean fisheyeNode(Object arg0) {
return false;
}
@Override
public Color getNodeHighlightColor(Object o) {
return null;
}
@Override
public Color getBorderHighlightColor(Object arg0) {
return null;
}
@Override
public Color getBorderColor(Object arg0) {
return null;
}
@Override
public int getBorderWidth(Object arg0) {
return 0;
}
@Override
public IFigure getTooltip(Object arg0) {
return null;
}
@Override
public int getConnectionStyle(Object src, Object dest) {
return 0;
}
@Override
public Color getColor(Object src, Object dest) {
return ColorConstants.black;
}
@Override
public Color getHighlightColor(Object src, Object dest) {
return null;
}
@Override
public int getLineWidth(Object src, Object dest) {
return 0;
}
}
| [
"treytencarey@gmail.com"
] | treytencarey@gmail.com |
251550ac50ad7f9ada1216861bbd03a97c3c0564 | ae1d95b11d775cb1ab105cc7662c237e3482b860 | /tests/integration/harness/src/main/java/io/helidon/tests/integration/harness/HelidonProcessRunner.java | 0e528df86688dc4b1593aed6c7f6741130428e87 | [
"Apache-2.0",
"APSL-1.0",
"LicenseRef-scancode-protobuf",
"GPL-1.0-or-later",
"LGPL-2.1-only",
"LicenseRef-scancode-unknown-license-reference",
"CC-PDDC",
"LicenseRef-scancode-generic-export-compliance",
"LicenseRef-scancode-unicode",
"EPL-1.0",
"LicenseRef-scancode-warranty-disclaimer",
"LGPL-2.1-or-later",
"EPL-2.0",
"Classpath-exception-2.0",
"CDDL-1.0",
"MIT",
"GPL-2.0-only",
"BSD-3-Clause",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"CC0-1.0",
"APSL-2.0",
"GPL-3.0-only",
"LGPL-2.0-or-later",
"LicenseRef-scancode-philippe-de-muyter",
"GCC-exception-3.1"
] | permissive | barchetta/helidon | 7a517cbf36e0a3c908bb269d9a92446a507332ce | e8bf60e64e3510df66569688fe1172981766f729 | refs/heads/main | 2023-09-03T20:19:30.214812 | 2023-08-11T22:39:16 | 2023-08-11T22:39:16 | 165,092,426 | 3 | 0 | Apache-2.0 | 2019-01-10T16:21:59 | 2019-01-10T16:21:58 | null | UTF-8 | Java | false | false | 16,243 | java | /*
* Copyright (c) 2021, 2023 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.helidon.tests.integration.harness;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.System.Logger.Level;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketAddress;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* Process runner to start Helidon application.
* Handles external process life cycle with various execution types.
*/
public class HelidonProcessRunner {
private static final System.Logger LOGGER = System.getLogger(HelidonProcessRunner.class.getName());
/**
* HTTP port of running application. Value is set to {@code -1} before application will be started.
*/
public static int HTTP_PORT = -1;
private final AtomicReference<Process> process = new AtomicReference<>();
private final ExecType execType;
private final Runnable startCommand;
private final Runnable stopCommand;
private final int port;
private HelidonProcessRunner(Builder builder) {
this.execType = builder.execType;
this.port = findFreePort();
if (execType == ExecType.IN_MEMORY) {
this.startCommand = builder.inMemoryStartCommand;
this.stopCommand = builder.inMemoryStopCommand;
System.setProperty("server.port", String.valueOf(port));
} else {
ProcessBuilder pb = new ProcessBuilder();
pb.environment().put("SERVER_PORT", String.valueOf(port));
switch (execType) {
case CLASS_PATH -> addClasspathCommand(builder, pb);
case MODULE_PATH -> addModulePathCommand(builder, pb);
case NATIVE -> addNativeCommand(builder, pb);
case JLINK_CLASS_PATH -> addJlinkCommand(builder, pb);
case JLINK_MODULE_PATH -> addJlinkModuleCommand(builder, pb);
default -> throw new IllegalArgumentException("Unsupported exec type: " + execType);
}
startCommand = () -> {
try {
// configure redirects
Thread stdoutReader = new Thread(() -> logStdout(process));
Thread stderrReader = new Thread(() -> logStderr(process));
process.set(pb.start());
stdoutReader.start();
stderrReader.start();
waitForSocketOpen(process.get(), port);
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new RuntimeException("Failed to start process", e);
}
};
stopCommand = () -> {
Process p = process.get();
if (p == null || !p.isAlive()) {
return;
}
p.destroy();
};
}
}
/**
* Create a new builder.
*
* @return builder
*/
public static Builder builder() {
return new Builder();
}
/**
* Start the application.
* Value of {@code HTTP_PORT} is set to HTTP port of this application.
*
* @return this instance
*/
public HelidonProcessRunner startApplication() {
startCommand.run();
HTTP_PORT = port;
return this;
}
/**
* Return type of execution for the application.
*
* @return type of execution for the application
*/
public ExecType execType() {
return execType;
}
/**
* Stop the application.
* Value of {@code HTTP_PORT} is set to {@code -1}.
*
* @return this instance
*/
public HelidonProcessRunner stopApplication() {
stopCommand.run();
if (process.get() != null) {
process.get().destroy();
}
HTTP_PORT = -1;
return this;
}
private static void waitForSocketOpen(Process process, int port) {
long timeoutSeconds = 20;
long timeout = TimeUnit.SECONDS.toMillis(timeoutSeconds);
long begin = System.currentTimeMillis();
LOGGER.log(Level.TRACE, () -> String.format("Waiting for %d to listen", port));
while (true) {
// check port open
if (portOpen(port)) {
return;
}
// make sure process still alive
if (!process.isAlive()) {
throw new RuntimeException("Process failed to start. Exit code: " + process.exitValue());
}
// sleep
try {
TimeUnit.MILLISECONDS.sleep(150);
} catch (InterruptedException e) {
process.destroyForcibly();
throw new RuntimeException("Cancelling process startup, thread interrupted", e);
}
// timeout
long now = System.currentTimeMillis();
if (now - begin > timeout) {
process.destroyForcibly();
throw new RuntimeException("Process failed to start, time out after " + timeoutSeconds + " seconds");
}
}
}
private static boolean portOpen(int port) {
SocketAddress sa = new InetSocketAddress("localhost", port);
try (Socket socket = new Socket()) {
socket.connect(sa, 1000);
LOGGER.log(Level.TRACE, () -> String.format("Socket localhost:%d is ready", port));
return true;
} catch (IOException ex) {
LOGGER.log(Level.TRACE, () -> String.format("Socket localhost:%d exception: %s", port, ex.getMessage()));
return false;
}
}
private static int findFreePort() {
int port = 7001;
try (ServerSocket socket = new ServerSocket(0)) {
socket.setReuseAddress(true);
port = socket.getLocalPort();
} catch (IOException e) {
LOGGER.log(Level.WARNING, "Could not find available port, using 7001", e);
}
return port;
}
private static void logStdout(AtomicReference<Process> process) {
BufferedReader reader = new BufferedReader(
new InputStreamReader(process.get().getInputStream()));
String line;
try {
line = reader.readLine();
while (line != null) {
System.out.println("* " + line);
line = reader.readLine();
}
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
/**
* Log the process standard error.
*/
private static void logStderr(AtomicReference<Process> process) {
BufferedReader reader = new BufferedReader(
new InputStreamReader(process.get().getErrorStream()));
String line;
try {
line = reader.readLine();
while (line != null) {
System.err.println("* " + line);
line = reader.readLine();
}
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
private static void addModulePathCommand(Builder builder, ProcessBuilder processBuilder) {
addModuleCommand("java",
"target",
builder.finalName,
builder.moduleName,
builder.mainClassModuleName,
builder.mainClass,
builder.args,
processBuilder);
}
private static void addJlinkModuleCommand(Builder builder, ProcessBuilder processBuilder) {
String jriDir = "target/" + builder.finalName + "-jri";
// FIXME instead of java, we should use the jriDir + "/bin/start" command with a switch such as "--modules"
addModuleCommand(jriDir + "/bin/java",
jriDir + "/app",
builder.finalName,
builder.moduleName,
builder.mainClassModuleName,
builder.mainClass,
builder.args,
processBuilder);
}
private static void addModuleCommand(String java,
String location,
String finalName,
String moduleName,
String mainClassModuleName,
String mainClass,
String[] args,
ProcessBuilder processBuilder) {
List<String> command = new ArrayList<>(6);
command.add(java);
command.add("--module-path");
command.add(location + "/" + finalName + ".jar" + File.pathSeparator + "target/libs");
command.add("--module");
command.add(mainClassModuleName + "/" + mainClass);
if (!Objects.equals(moduleName, mainClassModuleName)) {
// we are running main class from another module, need to add current module
command.add("--add-modules");
command.add(moduleName);
}
LOGGER.log(Level.DEBUG, () -> String.format("Command: %s", command));
processBuilder.command(buildCommand(args, command));
}
private static void addJlinkCommand(Builder builder, ProcessBuilder processBuilder) {
String jriDir = "target/" + builder.finalName + "-jri";
// FIXME - instead of java -jar, we should use the jriDir + "/bin/start" command
processBuilder.command(
buildCommand(builder.args,
jriDir + "/bin/java",
"-jar",
jriDir + "/app/" + builder.finalName + ".jar"));
}
private static void addClasspathCommand(Builder builder, ProcessBuilder processBuilder) {
processBuilder.command(
buildCommand(builder.args, "java", "-jar", "target/" + builder.finalName + ".jar"));
}
private static void addNativeCommand(Builder builder, ProcessBuilder processBuilder) {
processBuilder.command(buildCommand(builder.args, "target/" + builder.finalName));
}
private static List<String> buildCommand(String[] args, String... command) {
return buildCommand(args, Arrays.asList(command));
}
private static List<String> buildCommand(String[] args, List<String> command) {
final List<String> commandList = new LinkedList<>(command);
if (args != null) {
commandList.addAll(Arrays.asList(args));
}
return commandList;
}
/**
* Return HTTP port of the application.
*
* @return HTTP port of the application
*/
public int port() {
return port;
}
/**
* Application execution types.
*/
public enum ExecType {
CLASS_PATH("classpath"),
MODULE_PATH("module"),
NATIVE("native"),
IN_MEMORY("memory"),
JLINK_CLASS_PATH("jlink-cp"),
JLINK_MODULE_PATH("jlink-module");
private final String name;
ExecType(String name) {
this.name = name;
}
@Override
public String toString() {
return name;
}
private static final Map<String, ExecType> NAMES = Arrays.stream(ExecType.values())
.collect(Collectors.toMap(ExecType::toString, Function.identity()));
/**
* Get an exec type by name.
*
* @param name name
* @return ExecType
* @throws IllegalArgumentException if no exec type is found
*/
public static ExecType of(String name) {
ExecType execType = NAMES.get(name.toLowerCase());
if (execType != null) {
return execType;
}
throw new IllegalArgumentException("Unknown execType: " + name);
}
}
/**
* Builder for {@link HelidonProcessRunner}.
*/
public static class Builder implements io.helidon.common.Builder<Builder, HelidonProcessRunner> {
private ExecType execType = ExecType.CLASS_PATH;
private String moduleName;
private String mainClassModuleName;
private String mainClass;
private String finalName;
private String[] args;
private Runnable inMemoryStartCommand;
private Runnable inMemoryStopCommand;
/**
* Set the type of execution.
*
* @param execType type of execution
* @return this builder
*/
public Builder execType(ExecType execType) {
this.execType = execType;
return this;
}
/**
* Set the name of the application module (JPMS), used for {@link ExecType#MODULE_PATH}
*
* @param moduleName module name
* @return this builder
*/
public Builder moduleName(String moduleName) {
this.moduleName = moduleName;
return this;
}
/**
* Set the name of the module of the main class (JPMS) - used for {@link ExecType#MODULE_PATH}
*
* @param mainClassModuleName module main class
* @return this builder
*/
public Builder mainClassModuleName(String mainClassModuleName) {
this.mainClassModuleName = mainClassModuleName;
return this;
}
/**
* Set the name of the main class to run, used for {@link ExecType#MODULE_PATH}
*
* @param mainClass main class
* @return this builder
*/
public Builder mainClass(String mainClass) {
this.mainClass = mainClass;
return this;
}
/**
* Set the final name of the artifact.
* This is the expected name of the native image and jar file
*
* @param finalName final name
* @return this builder
*/
public Builder finalName(String finalName) {
this.finalName = finalName;
return this;
}
/**
* Set the arguments passed to main method.
*
* @param args main args
* @return this builder
*/
public Builder args(String[] args) {
this.args = args;
return this;
}
/**
* Set the command to start the server in memory, used for {@link ExecType#IN_MEMORY}
*
* @param inMemoryStartCommand in-memory start command
* @return this builder
*/
public Builder inMemoryStartCommand(Runnable inMemoryStartCommand) {
this.inMemoryStartCommand = inMemoryStartCommand;
return this;
}
/**
* Set the command to stop the server in memory, used for {@link ExecType#IN_MEMORY}
*
* @param inMemoryStopCommand in-memory stop command
* @return this builder
*/
public Builder inMemoryStopCommand(Runnable inMemoryStopCommand) {
this.inMemoryStopCommand = inMemoryStopCommand;
return this;
}
@Override
public HelidonProcessRunner build() {
if (mainClassModuleName == null) {
mainClassModuleName = moduleName;
}
return new HelidonProcessRunner(this);
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
b4a39c7e45adba083d68f1df2a593bffa2a87bab | 5b5defd093d62cc7e05a7a7c798356c7983e7866 | /test/src/test/java/org/zstack/test/storage/backup/TestAllocateBackupStorage4.java | bdab05f57dd28aa701971ccd023bbbfa99e4a14b | [
"Apache-2.0"
] | permissive | tbyes/zstack | 0bddaf6a1be4e46e181dfffacdbd5aaff5ec803b | 7f8ae92fa3d95c1e3ac876a9846f9fe0cbf63d5e | refs/heads/master | 2020-06-30T20:42:07.888244 | 2016-11-21T09:12:13 | 2016-11-21T09:12:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,300 | java | package org.zstack.test.storage.backup;
import junit.framework.Assert;
import org.junit.Before;
import org.junit.Test;
import org.zstack.core.cloudbus.CloudBus;
import org.zstack.core.componentloader.ComponentLoader;
import org.zstack.core.db.DatabaseFacade;
import org.zstack.header.storage.backup.*;
import org.zstack.test.Api;
import org.zstack.test.ApiSenderException;
import org.zstack.test.DBUtil;
import org.zstack.test.WebBeanConstructor;
import org.zstack.test.deployer.Deployer;
import org.zstack.utils.Utils;
import org.zstack.utils.data.SizeUnit;
import org.zstack.utils.logging.CLogger;
import java.util.concurrent.TimeUnit;
/*
* 1. add backup storage with 1G available capacity
* 2. allocate 500M without backup storage uuid
*
* confirm:
* success
*/
public class TestAllocateBackupStorage4 {
CLogger logger = Utils.getLogger(TestAllocateBackupStorage4.class);
Deployer deployer;
Api api;
ComponentLoader loader;
CloudBus bus;
DatabaseFacade dbf;
@Before
public void setUp() throws Exception {
DBUtil.reDeployDB();
WebBeanConstructor con = new WebBeanConstructor();
deployer = new Deployer("deployerXml/backupStorage/TestAllocateBackupStorage.xml", con);
deployer.build();
api = deployer.getApi();
loader = deployer.getComponentLoader();
bus = loader.getComponent(CloudBus.class);
dbf = loader.getComponent(DatabaseFacade.class);
}
@Test
public void test() throws ApiSenderException, InterruptedException {
BackupStorageInventory bsinv = deployer.backupStorages.get("backup1");
long size = SizeUnit.MEGABYTE.toByte(500);
AllocateBackupStorageMsg msg = new AllocateBackupStorageMsg();
msg.setSize(size);
bus.makeTargetServiceIdByResourceUuid(msg, BackupStorageConstant.SERVICE_ID, bsinv.getUuid());
msg.setTimeout(TimeUnit.SECONDS.toMillis(15));
AllocateBackupStorageReply reply = (AllocateBackupStorageReply) bus.call(msg);
BackupStorageInventory bs = reply.getInventory();
Assert.assertEquals(bsinv.getUuid(), bs.getUuid());
BackupStorageVO vo = dbf.findByUuid(bs.getUuid(), BackupStorageVO.class);
Assert.assertEquals(bsinv.getTotalCapacity() - size, vo.getAvailableCapacity());
}
}
| [
"xuexuemiao@yeah.net"
] | xuexuemiao@yeah.net |
455d16c811e81ca144cdbe3cd04325910df4fe7c | d99df429036f09c451312c5c72fff180f378e7bc | /40205163_MAS_Project/src/timetable_ontology/elements/SwapFinal.java | aa368aba0e07b76364edd368f386f4995e29fe91 | [] | no_license | AverageHomosapien/Multi-Agent-Timetable-Allocation | 0d3b43aea332c99f36bd6aa931418dc7a66a76bc | 95c6e839e025b66d11cc1e69a5cf6b70e89ca568 | refs/heads/main | 2023-01-22T18:38:50.656552 | 2020-12-07T11:30:51 | 2020-12-07T11:30:51 | 317,205,228 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 879 | java | package timetable_ontology.elements;
import jade.content.AgentAction;
import jade.content.onto.annotations.Slot;
import jade.core.AID;
public class SwapFinal implements AgentAction{
private SwapInitial swapInitial; // Initial slot on the timetable
private AID agentTo; // Agent requesting tutorial (REQUESTER)
private TutorialGroup tutorialTo;
@Slot (mandatory = true)
public AID getAgentTo() {
return agentTo;
}
public void setAgentTo(AID agentTo) {
this.agentTo = agentTo;
}
@Slot (mandatory = true)
public SwapInitial getInitalSwapRequest() {
return swapInitial;
}
public void setInitalSwapRequest(SwapInitial initalRequest) {
this.swapInitial = initalRequest;
}
@Slot (mandatory = true)
public TutorialGroup getTutorialTo() {
return tutorialTo;
}
public void setTutorialTo(TutorialGroup tutorialTo) {
this.tutorialTo = tutorialTo;
}
}
| [
"hamcalum10@gmail.com"
] | hamcalum10@gmail.com |
0db3a0cc0aa903d48eac933398c011affdc29e52 | fc6c869ee0228497e41bf357e2803713cdaed63e | /weixin6519android1140/src/sourcecode/com/tencent/mm/modelvideo/d.java | eb02c2b62b64e0c17c42a269daf9160aec1b13aa | [] | no_license | hyb1234hi/reverse-wechat | cbd26658a667b0c498d2a26a403f93dbeb270b72 | 75d3fd35a2c8a0469dbb057cd16bca3b26c7e736 | refs/heads/master | 2020-09-26T10:12:47.484174 | 2017-11-16T06:54:20 | 2017-11-16T06:54:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 39,593 | java | package com.tencent.mm.modelvideo;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import com.tencent.gmtrace.GMTrace;
import com.tencent.mm.ad.b.a;
import com.tencent.mm.ad.b.b;
import com.tencent.mm.ad.b.c;
import com.tencent.mm.ad.k.a;
import com.tencent.mm.ad.k.b;
import com.tencent.mm.g.b.ce;
import com.tencent.mm.modelcdntran.f;
import com.tencent.mm.modelcdntran.i.a;
import com.tencent.mm.modelcdntran.keep_ProgressInfo;
import com.tencent.mm.modelcdntran.keep_SceneResult;
import com.tencent.mm.network.q;
import com.tencent.mm.plugin.messenger.foundation.a.a.c.c;
import com.tencent.mm.protocal.c.azp;
import com.tencent.mm.protocal.c.qf;
import com.tencent.mm.protocal.c.qg;
import com.tencent.mm.sdk.platformtools.af;
import com.tencent.mm.sdk.platformtools.aj;
import com.tencent.mm.sdk.platformtools.aj.a;
import com.tencent.mm.sdk.platformtools.bg;
import com.tencent.mm.sdk.platformtools.bh;
import com.tencent.mm.sdk.platformtools.w;
import com.tencent.mm.storage.at;
import com.tencent.mm.storage.au;
import com.tencent.mm.y.bc;
import com.tencent.mm.y.bc.b;
import com.tencent.mm.y.m;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.util.HashSet;
import java.util.Map;
import junit.framework.Assert;
public final class d
extends com.tencent.mm.ad.k
implements com.tencent.mm.network.k
{
public String euR;
private com.tencent.mm.ad.b fUa;
public com.tencent.mm.ad.e fUd;
public String gIp;
public String gIw;
public int gIx;
private i.a gIz;
public int gsL;
private aj gsj;
public boolean haC;
public boolean haD;
public r haE;
public com.tencent.mm.modelcdntran.j haF;
public int haG;
private boolean haH;
public boolean haI;
public long haJ;
private String mediaId;
int retCode;
private int startOffset;
public long startTime;
public d(String paramString)
{
this(paramString, false);
GMTrace.i(363058954240L, 2705);
GMTrace.o(363058954240L, 2705);
}
public d(String paramString, boolean paramBoolean)
{
GMTrace.i(363193171968L, 2706);
this.haE = null;
this.gIp = "";
this.startOffset = 0;
this.startTime = 0L;
this.gsL = 0;
this.retCode = 0;
this.haG = com.tencent.mm.modelcdntran.b.MediaType_VIDEO;
this.haH = false;
this.haI = true;
this.gIw = null;
this.gIx = 0;
this.haJ = 0L;
this.gIz = new i.a()
{
public final int a(String paramAnonymousString, int paramAnonymousInt, keep_ProgressInfo paramAnonymouskeep_ProgressInfo, keep_SceneResult paramAnonymouskeep_SceneResult, boolean paramAnonymousBoolean)
{
GMTrace.i(355408543744L, 2648);
if (paramAnonymousInt == 44530)
{
w.d("MicroMsg.NetSceneDownloadVideo", "%s cdntra ERR_CNDCOM_MEDIA_IS_DOWNLOADING clientid:%s", new Object[] { d.this.MY(), d.this.gIp });
GMTrace.o(355408543744L, 2648);
return 0;
}
if (paramAnonymousInt != 0)
{
t.mp(d.this.euR);
com.tencent.mm.plugin.report.service.g.ork.i(10421, new Object[] { Integer.valueOf(paramAnonymousInt), Integer.valueOf(2), Long.valueOf(d.this.startTime), Long.valueOf(bg.Pv()), Integer.valueOf(com.tencent.mm.modelcdntran.d.bc(com.tencent.mm.sdk.platformtools.ab.getContext())), Integer.valueOf(d.this.haG), Integer.valueOf(d.this.gsL), "" });
com.tencent.mm.plugin.report.service.g.ork.i(13937, new Object[] { Integer.valueOf(paramAnonymousInt), Integer.valueOf(2), Long.valueOf(d.this.startTime), Long.valueOf(bg.Pv()), Integer.valueOf(com.tencent.mm.modelcdntran.d.bc(com.tencent.mm.sdk.platformtools.ab.getContext())), Integer.valueOf(d.this.haG), Integer.valueOf(d.this.gsL), "" });
d.this.fUd.a(3, paramAnonymousInt, "", d.this);
GMTrace.o(355408543744L, 2648);
return 0;
}
d.this.haE = t.mw(d.this.euR);
if ((d.this.haE == null) || (d.this.haE.status == 113))
{
if (d.this.haE == null) {}
for (int i = -1;; i = d.this.haE.status)
{
w.i("MicroMsg.NetSceneDownloadVideo", "%s upload video info is null or has paused, status:%d", new Object[] { d.this.MY(), Integer.valueOf(i) });
d.this.qt();
d.this.fUd.a(3, paramAnonymousInt, "upload video info is null or has paused, status" + i, d.this);
GMTrace.o(355408543744L, 2648);
return 0;
}
}
if (paramAnonymouskeep_ProgressInfo != null)
{
if (paramAnonymouskeep_ProgressInfo.field_finishedLength == d.this.gsL)
{
w.d("MicroMsg.NetSceneDownloadVideo", "cdntra ignore progress 100%");
GMTrace.o(355408543744L, 2648);
return 0;
}
if ((d.this.haE.hcp > paramAnonymouskeep_ProgressInfo.field_finishedLength) && (!d.this.haC))
{
w.e("MicroMsg.NetSceneDownloadVideo", "%s cdnEndProc error oldpos:%d newpos:%d", new Object[] { d.this.MY(), Integer.valueOf(d.this.haE.hcp), Integer.valueOf(paramAnonymouskeep_ProgressInfo.field_finishedLength) });
t.mp(d.this.euR);
d.this.fUd.a(3, paramAnonymousInt, "", d.this);
GMTrace.o(355408543744L, 2648);
return 0;
}
paramAnonymousInt = 1024;
d.this.haE.hct = bg.Pu();
if (d.this.haE.hcp < paramAnonymouskeep_ProgressInfo.field_finishedLength)
{
d.this.haE.hcp = paramAnonymouskeep_ProgressInfo.field_finishedLength;
paramAnonymousInt = 1040;
}
d.this.haE.eQl = paramAnonymousInt;
t.e(d.this.haE);
w.d("MicroMsg.NetSceneDownloadVideo", "%s cdntra progresscallback id:%s finish:%d total:%d", new Object[] { d.this.MY(), d.this.gIp, Integer.valueOf(paramAnonymouskeep_ProgressInfo.field_finishedLength), Integer.valueOf(paramAnonymouskeep_ProgressInfo.field_toltalLength) });
GMTrace.o(355408543744L, 2648);
return 0;
}
if (paramAnonymouskeep_SceneResult != null)
{
w.i("MicroMsg.NetSceneDownloadVideo", "%s cdntra sceneResult.retCode:%d useTime:%d ", new Object[] { d.this.MY(), Integer.valueOf(paramAnonymouskeep_SceneResult.field_retCode), Long.valueOf(bg.Pv() - d.this.haJ) });
d.this.a(d.this.haF, paramAnonymouskeep_SceneResult);
if (paramAnonymouskeep_SceneResult.field_retCode == 0) {
break label1240;
}
t.mp(d.this.euR);
if (d.this.haC) {
com.tencent.mm.plugin.report.service.g.ork.a(354L, 13L, 1L, false);
}
if (d.this.haD) {
com.tencent.mm.plugin.report.service.g.ork.a(354L, 136L, 1L, false);
}
d.this.fUd.a(3, paramAnonymouskeep_SceneResult.field_retCode, "", d.this);
}
for (;;)
{
com.tencent.mm.plugin.report.service.g.ork.i(10421, new Object[] { Integer.valueOf(paramAnonymouskeep_SceneResult.field_retCode), Integer.valueOf(2), Long.valueOf(d.this.startTime), Long.valueOf(bg.Pv()), Integer.valueOf(com.tencent.mm.modelcdntran.d.bc(com.tencent.mm.sdk.platformtools.ab.getContext())), Integer.valueOf(d.this.haG), Integer.valueOf(d.this.gsL), paramAnonymouskeep_SceneResult.field_transInfo, "", "", "", "", "", "", "", paramAnonymouskeep_SceneResult.report_Part2 });
if (paramAnonymouskeep_SceneResult.field_retCode != 0) {
com.tencent.mm.plugin.report.service.g.ork.i(13937, new Object[] { Integer.valueOf(paramAnonymouskeep_SceneResult.field_retCode), Integer.valueOf(2), Long.valueOf(d.this.startTime), Long.valueOf(bg.Pv()), Integer.valueOf(com.tencent.mm.modelcdntran.d.bc(com.tencent.mm.sdk.platformtools.ab.getContext())), Integer.valueOf(d.this.haG), Integer.valueOf(d.this.gsL), paramAnonymouskeep_SceneResult.field_transInfo, "", "", "", "", "", "", "", paramAnonymouskeep_SceneResult.report_Part2 });
}
a.a(d.this.haE, 1);
d.this.haF = null;
GMTrace.o(355408543744L, 2648);
return 0;
label1240:
if (d.this.haC) {
com.tencent.mm.plugin.report.service.g.ork.a(354L, 12L, 1L, false);
}
if (d.this.haD) {
com.tencent.mm.plugin.report.service.g.ork.a(354L, 137L, 1L, false);
}
d.this.ho(paramAnonymouskeep_SceneResult.field_fileLength);
}
}
public final void a(String paramAnonymousString, ByteArrayOutputStream paramAnonymousByteArrayOutputStream)
{
GMTrace.i(355542761472L, 2649);
GMTrace.o(355542761472L, 2649);
}
public final byte[] h(String paramAnonymousString, byte[] paramAnonymousArrayOfByte)
{
GMTrace.i(355676979200L, 2650);
GMTrace.o(355676979200L, 2650);
return null;
}
};
this.gsj = new aj(new aj.a()
{
public final boolean pM()
{
GMTrace.i(350039834624L, 2608);
if (d.this.a(d.this.gtW, d.this.fUd) == -1) {
d.this.fUd.a(3, -1, "doScene failed", d.this);
}
GMTrace.o(350039834624L, 2608);
return false;
}
}, false);
if (paramString != null) {}
for (boolean bool = true;; bool = false)
{
Assert.assertTrue(bool);
this.euR = paramString;
this.haC = paramBoolean;
w.i("MicroMsg.NetSceneDownloadVideo", "%s NetSceneDownloadVideo: file [%s] isCompleteOnlineVideo [%b]", new Object[] { MY(), paramString, Boolean.valueOf(paramBoolean) });
GMTrace.o(363193171968L, 2706);
return;
}
}
private boolean MX()
{
GMTrace.i(363327389696L, 2707);
w.d("MicroMsg.NetSceneDownloadVideo", "%s parseVideoMsgXML content: %s", new Object[] { MY(), this.haE.Nt() });
Object localObject2 = bh.q(this.haE.Nt(), "msg");
if (localObject2 == null)
{
com.tencent.mm.plugin.report.service.g.ork.a(111L, 214L, 1L, false);
w.w("MicroMsg.NetSceneDownloadVideo", "%s cdntra parse video recv xml failed", new Object[] { MY() });
GMTrace.o(363327389696L, 2707);
return false;
}
String str = (String)((Map)localObject2).get(".msg.videomsg.$cdnvideourl");
if (bg.nm(str))
{
com.tencent.mm.plugin.report.service.g.ork.a(111L, 213L, 1L, false);
w.w("MicroMsg.NetSceneDownloadVideo", "%s cdntra parse video recv xml failed", new Object[] { MY() });
GMTrace.o(363327389696L, 2707);
return false;
}
Object localObject1 = (String)((Map)localObject2).get(".msg.videomsg.$aeskey");
this.gsL = Integer.valueOf((String)((Map)localObject2).get(".msg.videomsg.$length")).intValue();
Object localObject4 = (String)((Map)localObject2).get(".msg.videomsg.$fileparam");
this.gIp = com.tencent.mm.modelcdntran.d.a("downvideo", this.haE.hcs, this.haE.Nq(), this.haE.getFileName());
if (bg.nm(this.gIp))
{
w.w("MicroMsg.NetSceneDownloadVideo", "%s cdntra genClientId failed not use cdn file:%s", new Object[] { MY(), this.haE.getFileName() });
GMTrace.o(363327389696L, 2707);
return false;
}
localObject2 = (String)((Map)localObject2).get(".msg.videomsg.$md5");
Object localObject3 = new StringBuilder();
o.Nh();
localObject3 = s.mk(this.euR) + ".tmp";
this.haF = new com.tencent.mm.modelcdntran.j();
this.haF.filename = this.haE.getFileName();
this.haF.gAQ = ((String)localObject2);
this.haF.gAR = this.gsL;
this.haF.gAS = 0;
this.haF.eMI = this.haE.Nr();
this.haF.gAT = this.haE.Nq();
Object localObject5 = this.haF;
int i;
label570:
label676:
label713:
label837:
int k;
if (com.tencent.mm.y.s.eb(this.haE.Nq()))
{
i = m.fk(this.haE.Nq());
((com.tencent.mm.modelcdntran.j)localObject5).eMK = i;
this.haF.field_mediaId = this.gIp;
this.haF.field_fullpath = ((String)localObject3);
this.haF.field_fileType = com.tencent.mm.modelcdntran.b.MediaType_VIDEO;
this.haF.field_totalLen = this.gsL;
this.haF.field_aesKey = ((String)localObject1);
this.haF.field_fileId = str;
this.haF.field_priority = com.tencent.mm.modelcdntran.b.gzd;
this.haF.gAB = this.gIz;
this.haF.field_wxmsgparam = ((String)localObject4);
localObject1 = this.haF;
if (!com.tencent.mm.y.s.eb(this.haE.Nq())) {
break label1545;
}
i = 1;
((com.tencent.mm.modelcdntran.j)localObject1).field_chattype = i;
this.haF.gAU = this.haE.gAU;
localObject4 = ((com.tencent.mm.plugin.messenger.foundation.a.h)com.tencent.mm.kernel.h.h(com.tencent.mm.plugin.messenger.foundation.a.h.class)).aOf().B(this.haE.Nq(), this.haE.eSf);
this.haF.gAW = ((ce)localObject4).field_createTime;
this.haF.eSf = ((ce)localObject4).field_msgSvrId;
localObject1 = bc.gT(((ce)localObject4).fwv);
localObject5 = this.haF;
if (localObject1 == null) {
break label1550;
}
i = ((bc.b)localObject1).god;
((com.tencent.mm.modelcdntran.j)localObject5).gAX = i;
if (this.haE.Nq().equals(((ce)localObject4).field_talker))
{
localObject5 = this.haF;
if (localObject1 != null) {
break label1555;
}
i = 0;
((com.tencent.mm.modelcdntran.j)localObject5).field_limitrate = i;
}
w.d("MicroMsg.NetSceneDownloadVideo", "%s limitrate:%d file:%s", new Object[] { MY(), Integer.valueOf(this.haF.field_limitrate), this.haE.getFileName() });
if (!com.tencent.mm.modelcdntran.g.Gk().gzL.contains("video_" + this.haE.hcw)) {
break label1567;
}
com.tencent.mm.modelcdntran.g.Gk().gzL.remove("video_" + this.haE.hcw);
this.haF.field_autostart = true;
if (3 == this.haE.hcC) {
this.haF.field_smallVideoFlag = 1;
}
if ((bg.nm((String)localObject2)) || (this.haC)) {
break label1598;
}
localObject1 = ((com.tencent.mm.plugin.r.a.a)com.tencent.mm.kernel.h.h(com.tencent.mm.plugin.r.a.a.class)).yR().cN((String)localObject2, this.gsL);
j = com.tencent.mm.a.e.aY((String)localObject1);
k = this.gsL - j;
o.Nh();
localObject5 = s.mk(this.euR);
int m = com.tencent.mm.a.e.aY((String)localObject5);
if (m > 0)
{
w.w("MicroMsg.NetSceneDownloadVideo", "%s already copy dup file, but download again, something error here.", new Object[] { MY() });
bool = com.tencent.mm.loader.stub.b.deleteFile((String)localObject5);
localObject1 = ((com.tencent.mm.plugin.r.a.a)com.tencent.mm.kernel.h.h(com.tencent.mm.plugin.r.a.a.class)).yR();
int n = this.gsL;
i = 0;
if (!bg.nm((String)localObject2)) {
i = ((at)localObject1).fTZ.delete("MediaDuplication", "md5=? AND size=? AND status!=?", new String[] { localObject2, String.valueOf(n), "100" });
}
localObject1 = t.mw(this.euR);
((r)localObject1).hcp = 0;
((r)localObject1).eQl = 16;
t.e((r)localObject1);
w.w("MicroMsg.NetSceneDownloadVideo", "%s don't copy dup file, go to download now. target video len %d, delete file:%b,delete db: %d", new Object[] { MY(), Integer.valueOf(m), Boolean.valueOf(bool), Integer.valueOf(i) });
localObject1 = "";
}
w.i("MicroMsg.NetSceneDownloadVideo", "%s MediaCheckDuplicationStorage: totallen:%s md5:%s dup(len:%d path:%s) diffLen:%d to:%s target video len %d", new Object[] { MY(), Integer.valueOf(this.gsL), localObject2, Integer.valueOf(j), localObject1, Integer.valueOf(k), localObject3, Integer.valueOf(m) });
if (bg.nm((String)localObject1)) {
break label1584;
}
if ((k < 0) || (k > 16)) {
break label1598;
}
w.i("MicroMsg.NetSceneDownloadVideo", "%s MediaCheckDuplicationStorage copy dup file now :%s -> %s", new Object[] { MY(), localObject1, localObject3 });
com.tencent.mm.sdk.platformtools.j.eR((String)localObject1, (String)localObject3);
ho(this.gsL);
((com.tencent.mm.plugin.messenger.foundation.a.h)com.tencent.mm.kernel.h.h(com.tencent.mm.plugin.messenger.foundation.a.h.class)).aOf().a(new c.c(((ce)localObject4).field_talker, "update", (au)localObject4));
localObject1 = com.tencent.mm.plugin.report.service.g.ork;
long l1 = this.haE.eSf;
long l2 = this.haE.hcs;
localObject3 = this.haE.Nq();
if (3 == this.haE.hcC) {
break label1578;
}
i = 43;
label1320:
((com.tencent.mm.plugin.report.service.g)localObject1).i(13267, new Object[] { str, Long.valueOf(l1), localObject2, Long.valueOf(l2), localObject3, Integer.valueOf(i), Integer.valueOf(j) });
i = 1;
label1381:
if (i != 0) {
break label1630;
}
this.mediaId = this.haF.field_mediaId;
this.haJ = bg.Pv();
if (this.haE.videoFormat != 2) {
break label1603;
}
}
label1545:
label1550:
label1555:
label1567:
label1578:
label1584:
label1598:
label1603:
for (boolean bool = true;; bool = false)
{
this.haD = bool;
w.i("MicroMsg.NetSceneDownloadVideo", "%s check use cdn isHadHevcLocalFile[%b] isCompleteOnlineVideo[%b]", new Object[] { MY(), Boolean.valueOf(this.haD), Boolean.valueOf(this.haC) });
if ((!this.haD) && (this.haC)) {
break label1852;
}
if (com.tencent.mm.modelcdntran.g.Gk().b(this.haF, -1)) {
break label1609;
}
com.tencent.mm.plugin.report.service.g.ork.a(111L, 212L, 1L, false);
w.e("MicroMsg.NetSceneDownloadVideo", "%s cdntra addSendTask failed.", new Object[] { MY() });
this.gIp = "";
GMTrace.o(363327389696L, 2707);
return false;
i = 0;
break;
i = 0;
break label570;
i = 0;
break label676;
i = ((bc.b)localObject1).gob / 8;
break label713;
this.haF.field_autostart = false;
break label837;
i = 62;
break label1320;
this.gIw = ((String)localObject2);
this.gIx = this.gsL;
i = 0;
break label1381;
}
label1609:
if (this.haD) {
com.tencent.mm.plugin.report.service.g.ork.a(354L, 135L, 1L, false);
}
label1630:
if (this.haE.hcA != 1)
{
this.haE.hcA = 1;
this.haE.eQl = 524288;
t.e(this.haE);
}
if (3 != this.haE.hcC)
{
localObject1 = this.haE.Nq();
if (!bg.nm((String)localObject1)) {
if (!com.tencent.mm.y.s.eb((String)localObject1)) {
break label1996;
}
}
}
label1852:
label1996:
for (int j = m.fk((String)localObject1);; j = 0) {
for (;;)
{
try
{
localObject2 = ((ConnectivityManager)com.tencent.mm.sdk.platformtools.ab.getContext().getSystemService("connectivity")).getActiveNetworkInfo();
i = ((NetworkInfo)localObject2).getSubtype();
k = ((NetworkInfo)localObject2).getType();
if (k != 1) {
continue;
}
i = 1;
}
catch (Exception localException)
{
w.e("MicroMsg.NetSceneDownloadVideo", "getNetType : %s", new Object[] { bg.f(localException) });
i = 0;
continue;
}
localObject1 = (String)localObject1 + "," + j + "," + str + "," + this.gsL + "," + i;
w.i("MicroMsg.NetSceneDownloadVideo", "%s dk12024 report:%s", new Object[] { MY(), localObject1 });
com.tencent.mm.plugin.report.service.g.ork.A(12024, (String)localObject1);
GMTrace.o(363327389696L, 2707);
return true;
this.haI = false;
localObject1 = this.haF;
o.Nh();
((com.tencent.mm.modelcdntran.j)localObject1).field_fullpath = s.mk(this.euR);
o.Ni().a(this.haF, false);
break;
if ((i == 13) || (i == 15) || (i == 14)) {
i = 4;
} else if ((i == 3) || (i == 4) || (i == 5) || (i == 6) || (i == 12)) {
i = 3;
} else if ((i == 1) || (i == 2)) {
i = 2;
} else {
i = 0;
}
}
}
}
public final boolean DF()
{
GMTrace.i(363998478336L, 2712);
boolean bool = super.DF();
if (bool) {
com.tencent.mm.plugin.report.service.g.ork.a(111L, 210L, 1L, false);
}
GMTrace.o(363998478336L, 2712);
return bool;
}
public final String MY()
{
GMTrace.i(20975949185024L, 156283);
String str = this.euR + "_" + hashCode();
GMTrace.o(20975949185024L, 156283);
return str;
}
public final int a(com.tencent.mm.network.e parame, com.tencent.mm.ad.e parame1)
{
int i = 1;
GMTrace.i(363595825152L, 2709);
this.fUd = parame1;
this.haE = t.mw(this.euR);
if (this.haE == null)
{
w.e("MicroMsg.NetSceneDownloadVideo", "ERR: Get INFO FAILED :" + this.euR);
this.retCode = (0 - com.tencent.mm.compatible.util.g.tA() - 10000);
GMTrace.o(363595825152L, 2709);
return -1;
}
if ((this.haE != null) && (3 == this.haE.hcC)) {
this.haG = com.tencent.mm.modelcdntran.b.MediaType_TinyVideo;
}
if (this.startTime == 0L)
{
this.startTime = bg.Pv();
this.startOffset = this.haE.hcp;
}
if (MX())
{
w.d("MicroMsg.NetSceneDownloadVideo", "cdntra use cdn return -1 for onGYNetEnd clientid:%s", new Object[] { this.euR });
GMTrace.o(363595825152L, 2709);
return 0;
}
if (this.haE.status != 112)
{
w.e("MicroMsg.NetSceneDownloadVideo", "ERR: STATUS: " + this.haE.status + " [" + this.euR + "," + this.haE.eSf + "," + this.haE.Nr() + "," + this.haE.Nq() + "]");
this.retCode = (0 - com.tencent.mm.compatible.util.g.tA() - 10000);
GMTrace.o(363595825152L, 2709);
return -1;
}
w.d("MicroMsg.NetSceneDownloadVideo", "start doScene [" + this.euR + "," + this.haE.eSf + "," + this.haE.Nr() + "," + this.haE.Nq() + "] filesize:" + this.haE.hcp + " file:" + this.haE.gsL + " netTimes:" + this.haE.hcx);
if (!t.mo(this.euR))
{
w.e("MicroMsg.NetSceneDownloadVideo", "ERR: NET TIMES: " + this.haE.hcx + " [" + this.euR + "," + this.haE.eSf + "," + this.haE.Nr() + "," + this.haE.Nq() + "] ");
t.mp(this.euR);
this.retCode = (0 - com.tencent.mm.compatible.util.g.tA() - 10000);
GMTrace.o(363595825152L, 2709);
return -1;
}
if (this.haE.eSf <= 0L)
{
w.e("MicroMsg.NetSceneDownloadVideo", "ERR: MSGSVRID: " + this.haE.eSf + " [" + this.euR + "," + this.haE.eSf + "," + this.haE.Nr() + "," + this.haE.Nq() + "] ");
t.mp(this.euR);
this.retCode = (0 - com.tencent.mm.compatible.util.g.tA() - 10000);
GMTrace.o(363595825152L, 2709);
return -1;
}
if ((this.haE.hcp < 0) || (this.haE.gsL <= this.haE.hcp) || (this.haE.gsL <= 0))
{
w.e("MicroMsg.NetSceneDownloadVideo", "ERR: fileSize:" + this.haE.hcp + " total:" + this.haE.gsL + " [" + this.euR + "," + this.haE.eSf + "," + this.haE.Nr() + "," + this.haE.Nq() + "] ");
t.mp(this.euR);
this.retCode = (0 - com.tencent.mm.compatible.util.g.tA() - 10000);
GMTrace.o(363595825152L, 2709);
return -1;
}
parame1 = new b.a();
parame1.gtF = new qf();
parame1.gtG = new qg();
parame1.uri = "/cgi-bin/micromsg-bin/downloadvideo";
parame1.gtE = 150;
parame1.gtH = 40;
parame1.gtI = 1000000040;
this.fUa = parame1.DA();
parame1 = (qf)this.fUa.gtC.gtK;
parame1.tQd = this.haE.eSf;
parame1.tRD = this.haE.hcp;
parame1.tRC = this.haE.gsL;
if (com.tencent.mm.network.ab.bv(com.tencent.mm.sdk.platformtools.ab.getContext())) {}
for (;;)
{
parame1.ugj = i;
i = a(parame, this.fUa, this);
GMTrace.o(363595825152L, 2709);
return i;
i = 2;
}
}
protected final int a(q paramq)
{
GMTrace.i(363730042880L, 2710);
paramq = (qf)((com.tencent.mm.ad.b)paramq).gtC.gtK;
if ((paramq.tQd <= 0L) || (paramq.tRD < 0) || (paramq.tRC <= 0) || (paramq.tRC <= paramq.tRD))
{
w.e("MicroMsg.NetSceneDownloadVideo", "ERR: SECURITY CHECK FAILED [" + this.euR + "," + this.haE.eSf + "," + this.haE.Nr() + "," + this.haE.Nq() + "] ");
t.mp(this.euR);
i = k.b.gun;
GMTrace.o(363730042880L, 2710);
return i;
}
int i = k.b.gum;
GMTrace.o(363730042880L, 2710);
return i;
}
public final void a(int paramInt1, int paramInt2, int paramInt3, String paramString, q paramq, byte[] paramArrayOfByte)
{
GMTrace.i(364266913792L, 2714);
if (this.haH)
{
w.d("MicroMsg.NetSceneDownloadVideo", "onGYNetEnd Call Stop by Service [" + this.euR + "," + this.haE.eSf + "," + this.haE.Nr() + "," + this.haE.Nq() + "] ");
this.fUd.a(paramInt2, paramInt3, paramString, this);
GMTrace.o(364266913792L, 2714);
return;
}
if ((paramInt2 == 3) && (paramInt3 == -1) && (!bg.nm(this.gIp)))
{
w.w("MicroMsg.NetSceneDownloadVideo", "cdntra using cdn trans, wait cdn service callback! clientid:%s", new Object[] { this.gIp });
GMTrace.o(364266913792L, 2714);
return;
}
paramArrayOfByte = (qg)((com.tencent.mm.ad.b)paramq).gtD.gtK;
paramq = (qf)((com.tencent.mm.ad.b)paramq).gtC.gtK;
this.haE = t.mw(this.euR);
if (this.haE == null)
{
w.e("MicroMsg.NetSceneDownloadVideo", "ERR: onGYNetEnd Get INFO FAILED :" + this.euR);
this.retCode = (0 - com.tencent.mm.compatible.util.g.tA() - 10000);
this.fUd.a(paramInt2, paramInt3, paramString, this);
GMTrace.o(364266913792L, 2714);
return;
}
if (this.haE.status == 113)
{
w.w("MicroMsg.NetSceneDownloadVideo", "onGYNetEnd STATUS PAUSE [" + this.euR + "," + this.haE.eSf + "," + this.haE.Nr() + "," + this.haE.Nq() + "] ");
this.fUd.a(paramInt2, paramInt3, paramString, this);
GMTrace.o(364266913792L, 2714);
return;
}
if (this.haE.status != 112)
{
w.e("MicroMsg.NetSceneDownloadVideo", "ERR: onGYNetEnd STATUS ERR: status:" + this.haE.status + " [" + this.euR + "," + this.haE.eSf + "," + this.haE.Nr() + "," + this.haE.Nq() + "] ");
this.fUd.a(paramInt2, paramInt3, paramString, this);
GMTrace.o(364266913792L, 2714);
return;
}
if ((paramInt2 == 4) && (paramInt3 != 0))
{
com.tencent.mm.plugin.report.service.g.ork.a(111L, 208L, 1L, false);
w.e("MicroMsg.NetSceneDownloadVideo", "ERR: onGYNetEnd SERVER FAILED errtype:" + paramInt2 + " errCode:" + paramInt3 + " [" + this.euR + "," + this.haE.eSf + "," + this.haE.Nr() + "," + this.haE.Nq() + "] ");
t.mp(this.euR);
com.tencent.mm.plugin.report.service.g.ork.i(10420, new Object[] { Integer.valueOf(paramInt3), Integer.valueOf(2), Long.valueOf(this.startTime), Long.valueOf(bg.Pv()), Integer.valueOf(com.tencent.mm.modelcdntran.d.bc(com.tencent.mm.sdk.platformtools.ab.getContext())), Integer.valueOf(this.haG), Integer.valueOf(this.gsL - this.startOffset) });
this.fUd.a(paramInt2, paramInt3, paramString, this);
GMTrace.o(364266913792L, 2714);
return;
}
if ((paramInt2 != 0) || (paramInt3 != 0))
{
com.tencent.mm.plugin.report.service.g.ork.a(111L, 207L, 1L, false);
w.e("MicroMsg.NetSceneDownloadVideo", "ERR: onGYNetEnd SERVER FAILED (SET PAUSE) errtype:" + paramInt2 + " errCode:" + paramInt3 + " [" + this.euR + "," + this.haE.eSf + "," + this.haE.Nr() + "," + this.haE.Nq() + "] ");
this.haE.status = 113;
t.e(this.haE);
this.fUd.a(paramInt2, paramInt3, paramString, this);
GMTrace.o(364266913792L, 2714);
return;
}
if (bg.bq(paramArrayOfByte.ues.uNP.tJp))
{
w.e("MicroMsg.NetSceneDownloadVideo", "ERR: onGYNetEnd Recv BUF ZERO length [" + this.euR + "," + this.haE.eSf + "," + this.haE.Nr() + "," + this.haE.Nq() + "] ");
t.mp(this.euR);
this.fUd.a(paramInt2, paramInt3, paramString, this);
GMTrace.o(364266913792L, 2714);
return;
}
if (paramArrayOfByte.tRD != paramq.tRD)
{
w.e("MicroMsg.NetSceneDownloadVideo", "ERR: onGYNetEnd OFFSET ERROR respStartPos:" + paramArrayOfByte.tRD + " reqStartPos:" + paramq.tRD + " [" + this.euR + "," + this.haE.eSf + "," + this.haE.Nr() + "," + this.haE.Nq() + "] ");
t.mp(this.euR);
this.fUd.a(paramInt2, paramInt3, paramString, this);
GMTrace.o(364266913792L, 2714);
return;
}
if (paramArrayOfByte.tRC != paramq.tRC)
{
w.e("MicroMsg.NetSceneDownloadVideo", "ERR: onGYNetEnd respTotal:" + paramArrayOfByte.tRC + " reqTotal:" + paramq.tRC + " [" + this.euR + "," + this.haE.eSf + "," + this.haE.Nr() + "," + this.haE.Nq() + "] ");
t.mp(this.euR);
this.fUd.a(paramInt2, paramInt3, paramString, this);
GMTrace.o(364266913792L, 2714);
return;
}
if (paramq.tRC < paramArrayOfByte.tRD)
{
w.e("MicroMsg.NetSceneDownloadVideo", "ERR: onGYNetEnd respTotal:" + paramArrayOfByte.tRC + " respStartPos:" + paramq.tRD + " [" + this.euR + "," + this.haE.eSf + "," + this.haE.Nr() + "," + this.haE.Nq() + "] ");
t.mp(this.euR);
this.fUd.a(paramInt2, paramInt3, paramString, this);
GMTrace.o(364266913792L, 2714);
return;
}
if (paramArrayOfByte.tQd != paramq.tQd)
{
w.e("MicroMsg.NetSceneDownloadVideo", "ERR: onGYNetEnd respMsgId:" + paramArrayOfByte.tQd + " reqMsgId:" + paramq.tQd + " [" + this.euR + "," + this.haE.eSf + "," + this.haE.Nr() + "," + this.haE.Nq() + "] ");
t.mp(this.euR);
this.fUd.a(paramInt2, paramInt3, paramString, this);
GMTrace.o(364266913792L, 2714);
return;
}
w.d("MicroMsg.NetSceneDownloadVideo", "onGYNetEnd respBuf:" + paramArrayOfByte.ues.uNN + " reqStartPos:" + paramq.tRD + " totallen:" + paramq.tRC + " [" + this.euR + "," + this.haE.eSf + "," + this.haE.Nr() + "," + this.haE.Nq() + "] ");
o.Nh();
int j = s.a(s.mk(this.euR), paramq.tRD, paramArrayOfByte.ues.uNP.toByteArray());
if (j < 0)
{
w.e("MicroMsg.NetSceneDownloadVideo", "ERR: onGYNetEnd WRITEFILE RET:" + j + " [" + this.euR + "," + this.haE.eSf + "," + this.haE.Nr() + "," + this.haE.Nq() + "] ");
t.mp(this.euR);
this.fUd.a(paramInt2, paramInt3, paramString, this);
GMTrace.o(364266913792L, 2714);
return;
}
if (j > this.haE.gsL)
{
w.e("MicroMsg.NetSceneDownloadVideo", "ERR: onGYNetEnd WRITEFILE newOffset:" + j + " totalLen:" + this.haE.gsL + " [" + this.euR + "," + this.haE.eSf + "," + this.haE.Nr() + "," + this.haE.Nq() + "] ");
t.mp(this.euR);
this.fUd.a(paramInt2, paramInt3, paramString, this);
GMTrace.o(364266913792L, 2714);
return;
}
paramq = this.euR;
paramArrayOfByte = t.mw(paramq);
if (paramArrayOfByte == null)
{
w.e("MicroMsg.VideoLogic", "ERR:" + com.tencent.mm.compatible.util.g.tC() + " getinfo failed: " + paramq);
paramInt1 = 0 - com.tencent.mm.compatible.util.g.tA();
}
while (paramInt1 < 0)
{
w.e("MicroMsg.NetSceneDownloadVideo", "ERR: onGYNetEnd updateAfterRecv Ret:" + paramInt1 + " newOffset :" + j + " [" + this.euR + "," + this.haE.eSf + "," + this.haE.Nr() + "," + this.haE.Nq() + "] ");
this.fUd.a(paramInt2, paramInt3, paramString, this);
GMTrace.o(364266913792L, 2714);
return;
paramArrayOfByte.hcp = j;
paramArrayOfByte.hct = bg.Pu();
paramArrayOfByte.eQl = 1040;
int i = 0;
paramInt1 = i;
if (paramArrayOfByte.gsL > 0)
{
paramInt1 = i;
if (j >= paramArrayOfByte.gsL)
{
t.d(paramArrayOfByte);
paramArrayOfByte.status = 199;
paramArrayOfByte.eQl |= 0x100;
w.i("MicroMsg.VideoLogic", "END!!! updateRecv file:" + paramq + " newsize:" + j + " total:" + paramArrayOfByte.gsL + " status:" + paramArrayOfByte.status + " netTimes:" + paramArrayOfByte.hcx);
paramInt1 = 1;
}
}
w.d("MicroMsg.VideoLogic", "updateRecv " + com.tencent.mm.compatible.util.g.tC() + " file:" + paramq + " newsize:" + j + " total:" + paramArrayOfByte.gsL + " status:" + paramArrayOfByte.status);
if (!t.e(paramArrayOfByte)) {
paramInt1 = 0 - com.tencent.mm.compatible.util.g.tA();
}
}
if (paramInt1 == 1)
{
com.tencent.mm.plugin.report.service.g.ork.i(10420, new Object[] { Integer.valueOf(0), Integer.valueOf(2), Long.valueOf(this.startTime), Long.valueOf(bg.Pv()), Integer.valueOf(com.tencent.mm.modelcdntran.d.bc(com.tencent.mm.sdk.platformtools.ab.getContext())), Integer.valueOf(this.haG), Integer.valueOf(this.gsL - this.startOffset) });
a.a(this.haE, 1);
w.i("MicroMsg.NetSceneDownloadVideo", "!!!FIN [" + this.euR + "," + this.haE.eSf + "," + this.haE.Nr() + "," + this.haE.Nq() + "]");
this.fUd.a(paramInt2, paramInt3, paramString, this);
GMTrace.o(364266913792L, 2714);
return;
}
if (this.haH)
{
this.fUd.a(paramInt2, paramInt3, paramString, this);
GMTrace.o(364266913792L, 2714);
return;
}
this.gsj.z(0L, 0L);
GMTrace.o(364266913792L, 2714);
}
protected final void a(k.a parama)
{
GMTrace.i(364132696064L, 2713);
com.tencent.mm.plugin.report.service.g.ork.a(111L, 211L, 1L, false);
t.mp(this.euR);
GMTrace.o(364132696064L, 2713);
}
public final void a(com.tencent.mm.modelcdntran.j paramj, keep_SceneResult paramkeep_SceneResult)
{
GMTrace.i(16008819507200L, 119275);
if ((paramj == null) || (paramkeep_SceneResult == null))
{
w.w("MicroMsg.NetSceneDownloadVideo", "it had not task info or scene Result, don't report.");
GMTrace.o(16008819507200L, 119275);
return;
}
if (paramj.field_smallVideoFlag == 1)
{
w.i("MicroMsg.NetSceneDownloadVideo", "it download short video, don't report.");
GMTrace.o(16008819507200L, 119275);
return;
}
if ((paramj != null) && (paramkeep_SceneResult != null))
{
w.i("MicroMsg.NetSceneDownloadVideo", "%s sceneResult.field_recvedBytes %d, time [%d, %d]", new Object[] { MY(), Integer.valueOf(paramkeep_SceneResult.field_recvedBytes), Long.valueOf(paramkeep_SceneResult.field_startTime), Long.valueOf(paramkeep_SceneResult.field_endTime) });
o.Ni();
f.a(null, paramkeep_SceneResult, paramj, true);
}
GMTrace.o(16008819507200L, 119275);
}
protected final void cancel()
{
GMTrace.i(20975814967296L, 156282);
qt();
super.cancel();
GMTrace.o(20975814967296L, 156282);
}
public final int getType()
{
GMTrace.i(364401131520L, 2715);
GMTrace.o(364401131520L, 2715);
return 150;
}
public final void ho(final int paramInt)
{
GMTrace.i(363461607424L, 2708);
Object localObject;
if (this.haI)
{
localObject = new StringBuilder();
o.Nh();
localObject = new File(s.mk(this.euR) + ".tmp");
o.Nh();
}
for (final boolean bool = ((File)localObject).renameTo(new File(s.mk(this.euR)));; bool = true)
{
com.tencent.mm.kernel.h.xB().A(new Runnable()
{
public final void run()
{
GMTrace.i(337826021376L, 2517);
Object localObject1 = bh.q(d.this.haE.Nt(), "msg");
Object localObject2;
if (localObject1 != null)
{
localObject2 = o.Nh();
o.Nh();
((s)localObject2).o(s.mk(d.this.euR), (String)((Map)localObject1).get(".msg.videomsg.$cdnvideourl"), (String)((Map)localObject1).get(".msg.videomsg.$aeskey"));
}
boolean bool1 = false;
if (bool)
{
boolean bool2 = t.N(d.this.euR, paramInt);
bool1 = bool2;
if (d.this.haD)
{
localObject1 = t.mw(d.this.euR);
bool1 = bool2;
if (localObject1 != null)
{
((r)localObject1).videoFormat = 1;
((r)localObject1).eQl = 2;
o.Nh().b((r)localObject1);
bool1 = bool2;
}
}
w.i("MicroMsg.NetSceneDownloadVideo", "%s ashutest::cdntra !FIN! file:%s svrid:%d human:%s user:%s updatedbsucc:%b MediaCheckDuplicationStorage MD5:%s SIZE:%d renameFlag %b needRename %b", new Object[] { d.this.MY(), d.this.euR, Long.valueOf(d.this.haE.eSf), d.this.haE.Nr(), d.this.haE.Nq(), Boolean.valueOf(bool1), d.this.gIw, Integer.valueOf(d.this.gIx), Boolean.valueOf(bool), Boolean.valueOf(d.this.haI) });
if ((!bg.nm(d.this.gIw)) && (d.this.gIx > 0))
{
localObject1 = ((com.tencent.mm.plugin.r.a.a)com.tencent.mm.kernel.h.h(com.tencent.mm.plugin.r.a.a.class)).yR();
localObject2 = d.this.gIw;
int i = d.this.gIx;
o.Nh();
((at)localObject1).u((String)localObject2, i, s.mk(d.this.euR));
}
if (d.this.haE.hcC != 3) {
break label575;
}
com.tencent.mm.plugin.report.service.g.ork.a(198L, 38L, d.this.haE.gsL, false);
com.tencent.mm.plugin.report.service.g.ork.a(198L, 40L, d.this.haE.hcv, false);
com.tencent.mm.plugin.report.service.g.ork.a(198L, 41L, 1L, false);
localObject1 = com.tencent.mm.plugin.report.service.g.ork;
if (!com.tencent.mm.y.s.eb(d.this.haE.Nq())) {
break label567;
}
}
label567:
for (long l = 43L;; l = 42L)
{
((com.tencent.mm.plugin.report.service.g)localObject1).a(198L, l, 1L, false);
d.this.fUd.a(0, 0, "", d.this);
GMTrace.o(337826021376L, 2517);
return;
if (d.this.haD)
{
t.mp(d.this.euR);
com.tencent.mm.plugin.report.service.g.ork.a(354L, 138L, 1L, false);
break;
}
bool1 = t.N(d.this.euR, paramInt);
break;
}
label575:
com.tencent.mm.plugin.report.service.g.ork.a(198L, 31L, d.this.haE.gsL, false);
com.tencent.mm.plugin.report.service.g.ork.a(198L, 33L, d.this.haE.hcv, false);
com.tencent.mm.plugin.report.service.g.ork.a(198L, 34L, 1L, false);
localObject1 = com.tencent.mm.plugin.report.service.g.ork;
if (com.tencent.mm.y.s.eb(d.this.haE.Nq())) {}
for (l = 36L;; l = 35L)
{
((com.tencent.mm.plugin.report.service.g)localObject1).a(198L, l, 1L, false);
break;
}
}
});
GMTrace.o(363461607424L, 2708);
return;
localObject = new StringBuilder();
o.Nh();
com.tencent.mm.loader.stub.b.deleteFile(s.mk(this.euR) + ".tmp");
}
}
public final boolean qt()
{
boolean bool = false;
GMTrace.i(362924736512L, 2704);
if (!bg.nm(this.mediaId))
{
if (!this.haC) {
break label77;
}
w.i("MicroMsg.NetSceneDownloadVideo", "%s cancel online video task.", new Object[] { MY() });
o.Ni().b(this.mediaId, null);
}
for (;;)
{
bool = true;
this.haH = true;
GMTrace.o(362924736512L, 2704);
return bool;
label77:
w.i("MicroMsg.NetSceneDownloadVideo", "%s cancel offline video task.", new Object[] { MY() });
com.tencent.mm.modelcdntran.g.Gk().jz(this.mediaId);
}
}
protected final int vB()
{
GMTrace.i(363864260608L, 2711);
GMTrace.o(363864260608L, 2711);
return 2500;
}
}
/* Location: D:\tools\apktool\weixin6519android1140\jar\classes-dex2jar.jar!\com\tencent\mm\modelvideo\d.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"robert0825@gmail.com"
] | robert0825@gmail.com |
8d00f92b62e539edeca892fde535420ed2558d85 | bb4756a487131d2dae9b1719884870f6f11396c1 | /TwitDuke-Server/src/main/java/net/nokok/twitduke/server/handlers/StringUtil.java | 0d39c42bcf7de0d29e995b20a0d62371ed6d395d | [
"MIT"
] | permissive | nanase/TwitDuke | 070a3656d9c980b6d8ef641faff024bdcff6451b | 542d55d1ae64369b1a2a2bcf6d136d90c25fe192 | refs/heads/master | 2021-01-15T19:58:51.225452 | 2014-07-12T14:05:35 | 2014-07-12T14:05:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 544 | java | package net.nokok.twitduke.server.handlers;
import java.util.Random;
import java.util.stream.IntStream;
public class StringUtil {
public static String appendRandomWhitespace(String text) {
return appendRandomString(text, " ");
}
public static String appendRandomString(String text, String append) {
StringBuilder stringBuilder = new StringBuilder(text);
IntStream.range(0, new Random().nextInt(50)).mapToObj(i -> append).forEach(stringBuilder::append);
return stringBuilder.toString();
}
}
| [
"nokok.kz@gmail.com"
] | nokok.kz@gmail.com |
da0b6acef505338e366353f69b0d14706d4aa06c | 1f1590410eb00f04415dee5063e979c134dec08b | /src/com/company/linedrawers/WuLineDrawer.java | 7dfb9661d65406a7a9ddd8e9801056ec10887445 | [] | no_license | WriteWrote/KG2020_G41_Task2 | 997326b0038aa256789ed4ac7bf4200402adabbf | a0c8999ca30e4c95b29c2983ed8acca180244155 | refs/heads/main | 2023-02-10T15:24:03.154602 | 2020-12-26T12:03:39 | 2020-12-26T12:03:39 | 304,576,843 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,936 | java | package com.company.linedrawers;
import com.company.LineDrawer;
import com.company.PixelDrawer;
import java.awt.*;
public class WuLineDrawer implements LineDrawer {
private PixelDrawer pixelDrawer;
public WuLineDrawer(PixelDrawer pixelDrawer) {
this.pixelDrawer = pixelDrawer;
}
@Override
public void drawLine(int x1, int y1, int x2, int y2, Color color) {
boolean isVertical = Math.abs(y2 - y1) > Math.abs(x2 - x1);
if (isVertical) {
int temp = x1;
x1 = y1;
y1 = temp;
temp = x2;
x2 = y2;
y2 = temp;
}
if (x1 > x2) {
int temp = x1;
x1 = x2;
x2 = temp;
temp = y1;
y1 = y2;
y2 = temp;
}
int dx = x2 - x1;
int dy = y2 - y1;
double gr = (double) dy / dx;
double realY = y1;
if (isVertical) {
for (int x = x1; x <= x2; x++) {
setColouredPixel((int) (realY), x, gradient(realY), color);
setColouredPixel((int) (realY) + 1, x, 1 - gradient(realY), color);
realY += gr;
}
} else {
for (int x = x1; x <= x2; x++) {
setColouredPixel(x, (int) (realY) + 1, 1 - gradient(realY), color);
setColouredPixel(x, (int) (realY), gradient(realY), color);
realY += gr;
}
}
}
private double gradient(double f_x) {
int pixel_f_x = (int) f_x;
if (f_x > 0) return f_x - pixel_f_x;
return f_x - pixel_f_x - 1;
}
private void setColouredPixel(int x, int y, double opacity, Color color) {
pixelDrawer.setPixel(x, y, new Color(color.getRed(), color.getGreen(), color.getBlue(),
(int) (255 * (1 - opacity))));
}
}
| [
"noreply@github.com"
] | noreply@github.com |
e2816b6819dc6388e7640972a3414270d0a0f1c6 | a57ae3e7f21278b1e2dc1d084cc4532893adfb7d | /src/com/wix/rt/lang/lexer/RTLexer.java | e271d781c5e0b06a89b2716d3e348f01d035c8d2 | [
"MIT"
] | permissive | bmvpdxl/react-templates-plugin | d2b29961b07c14756dd0cd15a47c3cfcf023f6dd | ea69d9bea0e7d73ca66e3606444e7e435bd9db5d | refs/heads/master | 2020-03-23T14:45:36.358514 | 2017-09-24T13:59:36 | 2017-09-24T13:59:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 455 | java | package com.wix.rt.lang.lexer;
import com.intellij.lang.javascript.JSTokenTypes;
import com.intellij.lexer.FlexAdapter;
import com.intellij.lexer.MergingLexerAdapter;
import com.intellij.psi.tree.TokenSet;
import java.io.Reader;
/**
* @author Dennis.Ushakov
*/
public class RTLexer extends MergingLexerAdapter {
public RTLexer() {
super(new FlexAdapter(new _RTLexer((Reader) null)), TokenSet.create(JSTokenTypes.STRING_LITERAL));
}
}
| [
"idok@wix.com"
] | idok@wix.com |
8444acf37d29e3f71f8e40958b558ef08d87c348 | 99dac8701ea0ee3eefd14fbe52e767c558bd5867 | /src/simuduck/Duck.java | ae98c4187ed5e74e89ed7b01214abbe0a8e294b0 | [] | no_license | kr3y/SimUDuck | 558c4ce5959b6c5bcd8fac83d70dd72f5604c51d | a59fd6704733127378d10c7dfd9138451646040b | refs/heads/master | 2021-01-10T20:44:57.328051 | 2014-09-12T08:16:37 | 2014-09-12T08:16:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 787 | 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 simuduck;
/**
*
* @author Administrator
*/
public abstract class Duck {
protected String name;
public void swim(){
System.out.println(this.name + " Swim!!! ");
}
public void fly(){
System.out.println(this.name + " Fly!!! ");
}
public void quack(){
System.out.println(this.name + " Quack!!! ");
}
public abstract void display();
}
| [
"kr3y@winodowslive.com"
] | kr3y@winodowslive.com |
076d33e206cb8b016d8e2dce9b97178da94186ad | 16a893197d2060e5771e647982f58ac78ceb048b | /app/src/main/java/com/hindmppsc/exam/adapter/Complete_current_affair_Adapter.java | 1c804cba90d14b55471d3f2b8814e75110f82db2 | [] | no_license | BurhanArif2611/HindMPPSC | 974a415da2c736b4311fb1af55b85a6128a5e550 | 95144ed57e6268fef2bfc445479a16fc3a4ea021 | refs/heads/master | 2023-05-09T06:37:26.971853 | 2021-05-29T07:21:10 | 2021-05-29T07:21:10 | 291,201,165 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,654 | java | package com.hindmppsc.exam.adapter;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.cardview.widget.CardView;
import androidx.recyclerview.widget.RecyclerView;
import com.hindmppsc.exam.R;
import com.hindmppsc.exam.activity.PDFViewerActivity;
import com.hindmppsc.exam.activity.Prelims_Video_Course.Prelims_Video_Course_PackegeActivity;
import com.hindmppsc.exam.models.MaterialType_models.Result;
import com.hindmppsc.exam.utility.ErrorMessage;
import java.util.List;
public class Complete_current_affair_Adapter extends RecyclerView.Adapter<Complete_current_affair_Adapter.MyViewHolder> {
View view;
Context activity;
List<Result> arrayList;
public Complete_current_affair_Adapter(Context policyActivity, List<Result> arrayList) {
this.activity = policyActivity;
this.arrayList = arrayList;
}
@NonNull
@Override
public Complete_current_affair_Adapter.MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
view = LayoutInflater.from(parent.getContext()).inflate(R.layout.live_class_subjects_list, parent, false);
return new Complete_current_affair_Adapter.MyViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull final Complete_current_affair_Adapter.MyViewHolder holder, int position) {
final Result listCoupon = arrayList.get(position);
int p = position + 1;
if ((p % 2) == 0) {
holder.first_layout.setVisibility(View.VISIBLE);
holder.second_layout.setVisibility(View.GONE);
} else {
holder.first_layout.setVisibility(View.GONE);
holder.second_layout.setVisibility(View.VISIBLE);
}
holder.subject_name_first_tv.setText(listCoupon.getTitle());
holder.subject_name_second_tv.setText(listCoupon.getTitle());
/* if (listCoupon.getSubscribe().equals("subscribe")) {
holder.join_btn.setVisibility(View.GONE);
holder.join_second_btn.setVisibility(View.GONE);
}*/
holder.join_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listCoupon.getEbook_video().equals("Video")) {
try {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(listCoupon.getUrl()));
activity.startActivity(browserIntent);
} catch (Exception e) {
}
}else if (listCoupon.getEbook_video().equals("Ebook")) {
try {
Bundle bundle = new Bundle();
bundle.putString("image", listCoupon.getUrl());
ErrorMessage.I(activity, PDFViewerActivity.class, bundle);
} catch (Exception e) {
}
}
}
});
holder.join_second_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listCoupon.getEbook_video().equals("Video")) {
try {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(listCoupon.getUrl()));
activity.startActivity(browserIntent);
} catch (Exception e) {
}
}else if (listCoupon.getEbook_video().equals("Ebook")) {
try {
Bundle bundle = new Bundle();
bundle.putString("image", listCoupon.getUrl());
ErrorMessage.I(activity, PDFViewerActivity.class, bundle);
} catch (Exception e) {
}
}
}
});
if (listCoupon.getEbook_video().equals("Video")){
/* holder.subject_name_second_tv.setCompoundDrawablesWithIntrinsicBounds(null, null, null, activity.getResources().getDrawable(R.drawable.ic_ic_video_play));
holder.subject_name_first_tv.setCompoundDrawablesWithIntrinsicBounds(null, null, null, activity.getResources().getDrawable(R.drawable.ic_ic_video_play));
*/ holder.right_subject_img.setImageDrawable(activity.getResources().getDrawable(R.drawable.ic_live_class));
holder.subject_img.setImageDrawable(activity.getResources().getDrawable(R.drawable.ic_live_class));
}else if (listCoupon.getEbook_video().equals("Ebook")){
holder.right_subject_img.setImageDrawable(activity.getResources().getDrawable(R.drawable.ic_ebook));
holder.subject_img.setImageDrawable(activity.getResources().getDrawable(R.drawable.ic_ebook));
}
/*holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listCoupon.getSubscribe().equals("subscribe")) {
Bundle bundle = new Bundle();
bundle.putString("id", listCoupon.getId());
bundle.putString("exam_type", listCoupon.getExamType());
ErrorMessage.I(activity, LiveClassActivity.class, bundle);
}
}
});*/
}
@Override
public int getItemCount() {
return arrayList.size();
}
public class MyViewHolder extends RecyclerView.ViewHolder {
TextView subject_name_second_tv, subject_name_first_tv;
Button join_btn, join_second_btn;
CardView first_layout, second_layout;
ImageView right_subject_img, subject_img;
public MyViewHolder(View itemView) {
super(itemView);
subject_name_second_tv = (TextView) itemView.findViewById(R.id.subject_name_second_tv);
subject_name_first_tv = (TextView) itemView.findViewById(R.id.subject_name_first_tv);
join_btn = itemView.findViewById(R.id.join_btn);
join_second_btn = itemView.findViewById(R.id.join_second_btn);
first_layout = itemView.findViewById(R.id.first_layout);
second_layout = itemView.findViewById(R.id.second_layout);
subject_img = (ImageView) itemView.findViewById(R.id.subject_img);
right_subject_img = (ImageView) itemView.findViewById(R.id.right_subject_img);
}
}
}
| [
"burhan.arif@medfone.in"
] | burhan.arif@medfone.in |
e157f339b4feb445ed7522de7b3f500690c93bea | c6992ce8db7e5aab6fd959c0c448659ab91b16ce | /sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/IngestionStatusQueryOptions.java | cf73f28d432bb89704e74076002ea055562bf8e8 | [
"MIT",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-3-Clause",
"CC0-1.0",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference",
"LGPL-2.1-or-later"
] | permissive | g2vinay/azure-sdk-for-java | ae6d94d583cc2983a5088ec8f6146744ee82cb55 | b88918a2ba0c3b3e88a36c985e6f83fc2bae2af2 | refs/heads/master | 2023-09-01T17:46:08.256214 | 2021-09-23T22:20:20 | 2021-09-23T22:20:20 | 161,234,198 | 3 | 1 | MIT | 2020-01-16T20:22:43 | 2018-12-10T20:44:41 | Java | UTF-8 | Java | false | false | 2,006 | java | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.ai.metricsadvisor.implementation.models;
import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
/** The IngestionStatusQueryOptions model. */
@Fluent
public final class IngestionStatusQueryOptions {
/*
* the start point of time range to query data ingestion status.
*/
@JsonProperty(value = "startTime", required = true)
private OffsetDateTime startTime;
/*
* the end point of time range to query data ingestion status.
*/
@JsonProperty(value = "endTime", required = true)
private OffsetDateTime endTime;
/**
* Get the startTime property: the start point of time range to query data ingestion status.
*
* @return the startTime value.
*/
public OffsetDateTime getStartTime() {
return this.startTime;
}
/**
* Set the startTime property: the start point of time range to query data ingestion status.
*
* @param startTime the startTime value to set.
* @return the IngestionStatusQueryOptions object itself.
*/
public IngestionStatusQueryOptions setStartTime(OffsetDateTime startTime) {
this.startTime = startTime;
return this;
}
/**
* Get the endTime property: the end point of time range to query data ingestion status.
*
* @return the endTime value.
*/
public OffsetDateTime getEndTime() {
return this.endTime;
}
/**
* Set the endTime property: the end point of time range to query data ingestion status.
*
* @param endTime the endTime value to set.
* @return the IngestionStatusQueryOptions object itself.
*/
public IngestionStatusQueryOptions setEndTime(OffsetDateTime endTime) {
this.endTime = endTime;
return this;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
eaa0f022079a663f1376f32f98660c90d9c52114 | ec957dbfdc61ef24eb2ab750822ace49a1aa4ddc | /src/xmu/swordbearer/timebox/alarm/AlarmReceiver.java | df1ba510fa4ad6e4d88ad86175146645f4f606d1 | [] | no_license | SwordBearer/TimeBox | 54080fe34997257a4f3c418ec0c07148447f0939 | 29c875fa251a832a8070c5ff8b677f7dccebee2d | refs/heads/master | 2021-01-19T06:59:07.729533 | 2013-10-05T07:19:17 | 2013-10-05T07:19:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,513 | java | package xmu.swordbearer.timebox.alarm;
import xmu.swordbearer.timebox.R;
import xmu.swordbearer.timebox.data.CommonVar;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Parcel;
public class AlarmReceiver extends BroadcastReceiver {
static String TAG = "AlarmReceiver";
private final static int STALE_WINDOW = 60 * 30 * 1000;
@Override
public void onReceive(Context context, Intent intent) {
if (CommonVar.ALARM_KILLED.equals(intent.getAction())) {
// The alarm has been killed, update the notification
updateNotification(context,
(Alarm) intent
.getParcelableExtra(CommonVar.ALARM_INTENT_EXTRA),
intent.getIntExtra(CommonVar.ALARM_KILLED_TIMEOUT, -1));
return;
} else if (CommonVar.CANCEL_SNOOZE.equals(intent.getAction())) {
AlarmHandler.saveSnoozeAlert(context, -1, -1);
return;
} else if (!CommonVar.ALARM_ALERT_ACTION.equals(intent.getAction())) {
// Unknown intent, bail.
return;
}
Alarm alarm = null;
byte[] data = intent.getByteArrayExtra(CommonVar.ALARM_RAW_DATA);
if (data != null) {
Parcel in = Parcel.obtain();
in.unmarshall(data, 0, data.length);
in.setDataPosition(0);
alarm = Alarm.CREATOR.createFromParcel(in);
}
if (alarm == null) {
AlarmHandler.setNextAlert(context);
return;
}
// Disable the snooze alert if this alarm is the snooze.
AlarmHandler.disableSnoozeAlert(context, alarm.id);
if (!alarm.daysOfWeek.isRepeatSet()) {
AlarmHandler.enableAlarm(context, alarm.id, false);
} else {
// Enable the next alert if there is one. The above call to
// enableAlarm will call setNextAlert so avoid calling it twice.
AlarmHandler.setNextAlert(context);
}
//
long now = System.currentTimeMillis();
// Always verbose to track down time change problems.
if (now > alarm.time + STALE_WINDOW) {
return;
}
// Maintain a cpu wake lock until the AlarmAlert and AlarmKlaxon can
// pick it up.
AlarmAlertWakeLock.acquireCpuWakeLock(context);
// //
// // /* Close dialogs and window shade */
Intent closeDialog = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
context.sendBroadcast(closeDialog);
// Play the alarm alert and vibrate the device.
Intent playAlarm = new Intent(CommonVar.ALARM_ALERT_ACTION);
playAlarm.putExtra(CommonVar.ALARM_INTENT_EXTRA, alarm);
context.startService(playAlarm);
// NEW: Embed the full-screen UI here. The notification manager will
// take care of displaying it if it's OK to do so.
Intent alarmAlert = new Intent(context, AlarmAlertActivity.class);
alarmAlert.putExtra(CommonVar.ALARM_INTENT_EXTRA, alarm);
alarmAlert.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_NO_USER_ACTION);
context.startActivity(alarmAlert);
}
// public static void prepareNextAlarm(Context context, Alarm alarm) {
// // Disable the snooze alert if this alarm is the snooze.
// AlarmHandler.disableSnoozeAlert(context, alarm.id);
// if (!alarm.daysOfWeek.isRepeatSet()) {
// AlarmHandler.enableAlarm(context, alarm.id, false);
// } else {
// // Enable the next alert if there is one. The above call to
// // enableAlarm will call setNextAlert so avoid calling it twice.
// AlarmHandler.setNextAlert(context);
// }
// }
private void updateNotification(Context context, Alarm alarm, int timeout) {
NotificationManager nm = (NotificationManager) context
.getSystemService(Context.NOTIFICATION_SERVICE);
// If the alarm is null, just cancel the notification.
if (alarm == null) {
return;
}
// Launch SetAlarm when clicked.
Intent viewAlarm = new Intent(context, SetAlarm.class);
viewAlarm.putExtra(CommonVar.ALARM_ID, alarm.id);
PendingIntent intent = PendingIntent.getActivity(context, alarm.id,
viewAlarm, 0);
// Update the notification to indicate that the alert has been
// silenced.
String label = "闹钟到了";
Notification n = new Notification(R.drawable.alarm_notify_icon, label,
alarm.time);
n.setLatestEventInfo(
context,
label,
context.getString(R.string.alarm_alert_alert_silenced, timeout),
intent);
n.flags |= Notification.FLAG_AUTO_CANCEL;
// We have to cancel the original notification since it is in the
// ongoing section and we want the "killed" notification to be a plain
// notification.
nm.cancel(alarm.id);
nm.notify(alarm.id, n);
}
}
| [
"tangyuchun@gmail.com"
] | tangyuchun@gmail.com |
0cf74a26ca9521069b0d79e7723d2ee611735d5e | 99748f53a2ef19104533286f6c84394338e690b3 | /server/src/test/java/org/elasticsearch/search/aggregations/InternalAggregationsTests.java | df203046e6c2537c5008f6366712cf246e853df0 | [
"Apache-2.0",
"LicenseRef-scancode-elastic-license-2018",
"LicenseRef-scancode-other-permissive"
] | permissive | sanen/elasticsearch | 6e7af03a87b091a81421fc10afa2be3b8d562d96 | 7280de08424902914e29bbd1213ba32d6546eada | refs/heads/master | 2021-05-15T10:24:32.261903 | 2020-12-31T03:00:05 | 2020-12-31T03:00:05 | 108,098,719 | 0 | 0 | Apache-2.0 | 2020-12-31T03:00:10 | 2017-10-24T08:29:51 | Java | UTF-8 | Java | false | false | 6,849 | java | /*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.search.aggregations;
import org.apache.lucene.util.BytesRef;
import org.elasticsearch.Version;
import org.elasticsearch.common.io.stream.BytesStreamOutput;
import org.elasticsearch.common.io.stream.DelayableWriteable;
import org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.SearchModule;
import org.elasticsearch.search.aggregations.bucket.histogram.InternalDateHistogramTests;
import org.elasticsearch.search.aggregations.bucket.terms.StringTerms;
import org.elasticsearch.search.aggregations.bucket.terms.StringTermsTests;
import org.elasticsearch.search.aggregations.pipeline.InternalSimpleValueTests;
import org.elasticsearch.search.aggregations.pipeline.MaxBucketPipelineAggregationBuilder;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.test.InternalAggregationTestCase;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import static java.util.Collections.emptyMap;
import static java.util.Collections.singletonList;
import static org.hamcrest.Matchers.equalTo;
public class InternalAggregationsTests extends ESTestCase {
private final NamedWriteableRegistry registry = new NamedWriteableRegistry(
new SearchModule(Settings.EMPTY, Collections.emptyList()).getNamedWriteables());
public void testReduceEmptyAggs() {
List<InternalAggregations> aggs = Collections.emptyList();
InternalAggregation.ReduceContextBuilder builder = InternalAggregationTestCase.emptyReduceContextBuilder();
InternalAggregation.ReduceContext reduceContext = randomBoolean() ? builder.forFinalReduction() : builder.forPartialReduction();
assertNull(InternalAggregations.reduce(aggs, reduceContext));
}
public void testNonFinalReduceTopLevelPipelineAggs() {
InternalAggregation terms = new StringTerms("name", BucketOrder.key(true), BucketOrder.key(true),
10, 1, Collections.emptyMap(), DocValueFormat.RAW, 25, false, 10, Collections.emptyList(), 0);
List<InternalAggregations> aggs = singletonList(InternalAggregations.from(Collections.singletonList(terms)));
InternalAggregations reducedAggs = InternalAggregations.topLevelReduce(aggs, maxBucketReduceContext().forPartialReduction());
assertEquals(1, reducedAggs.aggregations.size());
}
public void testFinalReduceTopLevelPipelineAggs() {
InternalAggregation terms = new StringTerms("name", BucketOrder.key(true), BucketOrder.key(true),
10, 1, Collections.emptyMap(), DocValueFormat.RAW, 25, false, 10, Collections.emptyList(), 0);
InternalAggregations aggs = InternalAggregations.from(Collections.singletonList(terms));
InternalAggregations reducedAggs = InternalAggregations.topLevelReduce(Collections.singletonList(aggs),
maxBucketReduceContext().forFinalReduction());
assertEquals(2, reducedAggs.aggregations.size());
}
private InternalAggregation.ReduceContextBuilder maxBucketReduceContext() {
MaxBucketPipelineAggregationBuilder maxBucketPipelineAggregationBuilder = new MaxBucketPipelineAggregationBuilder("test", "test");
PipelineAggregator.PipelineTree tree =
new PipelineAggregator.PipelineTree(emptyMap(), singletonList(maxBucketPipelineAggregationBuilder.create()));
return InternalAggregationTestCase.emptyReduceContextBuilder(tree);
}
public static InternalAggregations createTestInstance() throws Exception {
List<InternalAggregation> aggsList = new ArrayList<>();
if (randomBoolean()) {
StringTermsTests stringTermsTests = new StringTermsTests();
stringTermsTests.init();
stringTermsTests.setUp();
aggsList.add(stringTermsTests.createTestInstance());
}
if (randomBoolean()) {
InternalDateHistogramTests dateHistogramTests = new InternalDateHistogramTests();
dateHistogramTests.setUp();
aggsList.add(dateHistogramTests.createTestInstance());
}
if (randomBoolean()) {
InternalSimpleValueTests simpleValueTests = new InternalSimpleValueTests();
aggsList.add(simpleValueTests.createTestInstance());
}
return InternalAggregations.from(aggsList);
}
public void testSerialization() throws Exception {
InternalAggregations aggregations = createTestInstance();
writeToAndReadFrom(aggregations, Version.CURRENT, 0);
}
public void testSerializedSize() throws Exception {
InternalAggregations aggregations = createTestInstance();
assertThat(DelayableWriteable.getSerializedSize(aggregations),
equalTo((long) serialize(aggregations, Version.CURRENT).length));
}
private void writeToAndReadFrom(InternalAggregations aggregations, Version version, int iteration) throws IOException {
BytesRef serializedAggs = serialize(aggregations, version);
try (StreamInput in = new NamedWriteableAwareStreamInput(StreamInput.wrap(serializedAggs.bytes), registry)) {
in.setVersion(version);
InternalAggregations deserialized = InternalAggregations.readFrom(in);
assertEquals(aggregations.aggregations, deserialized.aggregations);
if (iteration < 2) {
writeToAndReadFrom(deserialized, version, iteration + 1);
}
}
}
private BytesRef serialize(InternalAggregations aggs, Version version) throws IOException {
try (BytesStreamOutput out = new BytesStreamOutput()) {
out.setVersion(version);
aggs.writeTo(out);
return out.bytes().toBytesRef();
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
e507f54859a7087991c5accd9530779f8b6af3f4 | 08a3d8d666ffb174b7fe87b2e625c8d6ffe97b51 | /InterfacesExercises/src/interfacesexercises/Plumber.java | 05d6739d257a594504121c5eaf8e77959736cf96 | [] | no_license | Rriverag98/PO-Rriverag98 | af67c08464b34d37495d638e5167ea2a4611111a | a5740c73048cd5225eab8d23671d6cdc006a82b9 | refs/heads/master | 2021-01-13T16:36:43.123329 | 2017-04-27T03:38:21 | 2017-04-27T03:38:21 | 79,303,517 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 321 | 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 interfacesexercises;
/**
*
* @author Rodrigo
*/
public interface Plumber {
public String unplugDrain();
}
| [
"noreply@github.com"
] | noreply@github.com |
2c888878104ed6c752a1713220746b9e96662504 | dc4d1f2192179ee126be1bcb1346e837f7e9a1ac | /cniaomusic_playmusic/src/main/java/com/cainiao5/cainiaomusic/common/utils/TransitionHelper.java | 0bf2b7a4576d6462c2d57f8d91144e5d1bcb4433 | [] | no_license | justinoool/MusicDemo | 277eff7074f7149789399576142163ce74278343 | a1d9fd6fc398cb7fb7fab51fee07eafb4b4c439b | refs/heads/master | 2021-01-20T06:33:54.762909 | 2017-10-11T01:34:44 | 2017-10-11T01:34:44 | 101,507,606 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,514 | java | /*
* Copyright 2015 Google Inc.
*
* 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 com.cainiao5.cainiaomusic.common.utils;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Intent;
import android.os.Build;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.ActivityOptionsCompat;
import android.support.v4.util.Pair;
import android.view.View;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Helper class for creating content transitions used with {@link android.app.ActivityOptions}.
*/
public class TransitionHelper {
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public static void startSharedElementActivity(Activity activity, Intent intent, Pair<View, String>[] pairs) {
ActivityOptionsCompat transitionActivityOptions = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, pairs);
activity.startActivity(intent, transitionActivityOptions.toBundle());
}
/**
* Create the transition participants required during a activity transition while
* avoiding glitches with the system UI.
*
* @param activity The activity used as start for the transition.
* @param includeStatusBar If false, the status bar will not be added as the transition
* participant.
* @return All transition participants.
*/
public static Pair<View, String>[] createSafeTransitionParticipants(@NonNull Activity activity,
boolean includeStatusBar, @Nullable Pair... otherParticipants) {
// Avoid system UI glitches as described here:
// https://plus.google.com/+AlexLockwood/posts/RPtwZ5nNebb
View decor = activity.getWindow().getDecorView();
View statusBar = null;
if (includeStatusBar) {
statusBar = decor.findViewById(android.R.id.statusBarBackground);
}
View navBar = decor.findViewById(android.R.id.navigationBarBackground);
// Create pair of transition participants.
List<Pair> participants = new ArrayList<>(3);
addNonNullViewToTransitionParticipants(statusBar, participants);
addNonNullViewToTransitionParticipants(navBar, participants);
// only add transition participants if there's at least one none-null element
if (otherParticipants != null && !(otherParticipants.length == 1
&& otherParticipants[0] == null)) {
participants.addAll(Arrays.asList(otherParticipants));
}
return participants.toArray(new Pair[participants.size()]);
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private static void addNonNullViewToTransitionParticipants(View view, List<Pair> participants) {
if (view == null) {
return;
}
participants.add(new Pair<>(view, view.getTransitionName()));
}
}
| [
"275512733@qq.com"
] | 275512733@qq.com |
e20fbd6c888852c4b534d71a831b8bafa8a1a03f | d6271636adc9d447df210427a7cf924b7f0009a8 | /core/common/src/test/java/alluxio/security/authentication/GrpcSecurityTest.java | 801a588098d2bfa39bd142dcc7ecf40a633a90dc | [
"EPL-1.0",
"LicenseRef-scancode-proprietary-license",
"MIT",
"Unlicense",
"Apache-2.0",
"BSD-2-Clause",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-3-Clause",
"CC-PDDC",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-free-unknown"
] | permissive | AminoACID123/alluxio | f88d7ce80f7a7dfc6b01f56c1477fc516ae21bcc | 2bf790f505f054cd23464f89ceff6403ab59ade1 | refs/heads/master | 2020-05-01T17:25:42.887314 | 2019-03-22T23:04:59 | 2019-03-22T23:04:59 | 177,599,144 | 0 | 0 | Apache-2.0 | 2019-03-25T14:08:57 | 2019-03-25T14:08:57 | null | UTF-8 | Java | false | false | 5,913 | java | /*
* The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
* (the "License"). You may not use this work except in compliance with the License, which is
* available at www.apache.org/licenses/LICENSE-2.0
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied, as more fully set forth in the License.
*
* See the NOTICE file distributed with this work for information regarding copyright ownership.
*/
package alluxio.security.authentication;
import alluxio.conf.InstancedConfiguration;
import alluxio.conf.PropertyKey;
import alluxio.exception.status.UnauthenticatedException;
import alluxio.grpc.GrpcChannelBuilder;
import alluxio.grpc.GrpcServer;
import alluxio.grpc.GrpcServerBuilder;
import alluxio.util.ConfigurationUtils;
import alluxio.util.network.NetworkAddressUtils;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import javax.security.sasl.AuthenticationException;
import java.net.InetSocketAddress;
/**
* Unit test for {@link alluxio.grpc.GrpcChannelBuilder} and {@link alluxio.grpc.GrpcServerBuilder}.
*/
public class GrpcSecurityTest {
/**
* The exception expected to be thrown.
*/
@Rule
public ExpectedException mThrown = ExpectedException.none();
private InstancedConfiguration mConfiguration;
@Before
public void before() {
mConfiguration = new InstancedConfiguration(ConfigurationUtils.defaults());
}
@Test
public void testServerUnsupportedAuthentication() {
mThrown.expect(RuntimeException.class);
mThrown.expectMessage("Authentication type not supported:" + AuthType.KERBEROS.name());
createServer(AuthType.KERBEROS);
}
@Test
public void testSimpleAuthentication() throws Exception {
GrpcServer server = createServer(AuthType.SIMPLE);
server.start();
GrpcChannelBuilder channelBuilder =
GrpcChannelBuilder.newBuilder(getServerConnectAddress(server), mConfiguration);
channelBuilder.build();
server.shutdown();
}
@Test
public void testNoSaslAuthentication() throws Exception {
GrpcServer server = createServer(AuthType.NOSASL);
server.start();
GrpcChannelBuilder channelBuilder =
GrpcChannelBuilder.newBuilder(getServerConnectAddress(server), mConfiguration);
channelBuilder.build();
server.shutdown();
}
@Test
public void testCustomAuthentication() throws Exception {
mConfiguration.set(PropertyKey.SECURITY_AUTHENTICATION_TYPE, AuthType.CUSTOM.getAuthName());
mConfiguration.set(PropertyKey.SECURITY_AUTHENTICATION_CUSTOM_PROVIDER_CLASS,
ExactlyMatchAuthenticationProvider.class.getName());
GrpcServer server = createServer(AuthType.CUSTOM);
server.start();
GrpcChannelBuilder channelBuilder =
GrpcChannelBuilder.newBuilder(getServerConnectAddress(server), mConfiguration);
channelBuilder.setCredentials(ExactlyMatchAuthenticationProvider.USERNAME,
ExactlyMatchAuthenticationProvider.PASSWORD, null).build();
server.shutdown();
}
@Test
public void testCustomAuthenticationFails() throws Exception {
mConfiguration.set(PropertyKey.SECURITY_AUTHENTICATION_TYPE, AuthType.CUSTOM.getAuthName());
mConfiguration.set(PropertyKey.SECURITY_AUTHENTICATION_CUSTOM_PROVIDER_CLASS,
ExactlyMatchAuthenticationProvider.class.getName());
GrpcServer server = createServer(AuthType.CUSTOM);
server.start();
GrpcChannelBuilder channelBuilder =
GrpcChannelBuilder.newBuilder(getServerConnectAddress(server), mConfiguration);
mThrown.expect(UnauthenticatedException.class);
channelBuilder.setCredentials("fail", "fail", null).build();
server.shutdown();
}
@Test
public void testDisabledAuthentication() throws Exception {
GrpcServer server = createServer(AuthType.SIMPLE);
server.start();
GrpcChannelBuilder channelBuilder =
GrpcChannelBuilder.newBuilder(getServerConnectAddress(server), mConfiguration);
channelBuilder.disableAuthentication().build();
server.shutdown();
}
@Test
public void testAuthMismatch() throws Exception {
GrpcServer server = createServer(AuthType.NOSASL);
server.start();
mConfiguration.set(PropertyKey.SECURITY_AUTHENTICATION_TYPE, AuthType.SIMPLE);
GrpcChannelBuilder channelBuilder =
GrpcChannelBuilder.newBuilder(getServerConnectAddress(server), mConfiguration);
mThrown.expect(UnauthenticatedException.class);
channelBuilder.build();
server.shutdown();
}
private InetSocketAddress getServerConnectAddress(GrpcServer server) {
return new InetSocketAddress(NetworkAddressUtils
.getLocalHostName((int) mConfiguration
.getMs(PropertyKey.NETWORK_HOST_RESOLUTION_TIMEOUT_MS)), server.getBindPort());
}
private GrpcServer createServer(AuthType authType) {
mConfiguration.set(PropertyKey.SECURITY_AUTHENTICATION_TYPE, authType.name());
GrpcServerBuilder serverBuilder = GrpcServerBuilder
.forAddress(new InetSocketAddress(NetworkAddressUtils
.getLocalHostName((int) mConfiguration
.getMs(PropertyKey.NETWORK_HOST_RESOLUTION_TIMEOUT_MS)), 0), mConfiguration);
return serverBuilder.build();
}
/**
* This customized authentication provider is used in CUSTOM mode. It authenticates the user by
* verifying the specific username:password pair.
*/
public static class ExactlyMatchAuthenticationProvider implements AuthenticationProvider {
static final String USERNAME = "alluxio";
static final String PASSWORD = "correct-password";
@Override
public void authenticate(String user, String password) throws AuthenticationException {
if (!user.equals(USERNAME) || !password.equals(PASSWORD)) {
throw new AuthenticationException("User authentication fails");
}
}
}
}
| [
"jia.calvin@gmail.com"
] | jia.calvin@gmail.com |
120e554e93a1c1eef54645b9f67939a13b3a7b1b | 70e207ac63da49eddd761a6e3a901e693f4ec480 | /net.certware.evidence.saem.edit/src/net/certware/evidence/evidence/provider/IsCreatedAtItemProvider.java | 7e93035707454144687c1f641ebf53a2fc7416fc | [
"Apache-2.0"
] | permissive | arindam7development/CertWare | 43be650539963b1efef4ce4cad164f23185d094b | cbbfdb6012229444d3c0d7e64c08ac2a15081518 | refs/heads/master | 2020-05-29T11:38:08.794116 | 2016-03-29T13:56:37 | 2016-03-29T13:56:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,640 | java | /**
* Copyright (c) 2011 Object Management Group (SAEM metamodel)
* Copyright (c) 2010-2011 United States Government as represented by the Administrator for The National Aeronautics and Space Administration. All Rights Reserved. (generated models)
*/
package net.certware.evidence.evidence.provider;
import java.util.Collection;
import java.util.List;
import net.certware.evidence.evidence.IsCreatedAt;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemColorProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
import org.eclipse.emf.edit.provider.ITableItemColorProvider;
import org.eclipse.emf.edit.provider.ITableItemLabelProvider;
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
/**
* This is the item provider adapter for a {@link net.certware.evidence.evidence.IsCreatedAt} object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public class IsCreatedAtItemProvider
extends EvidenceEventItemProvider
implements
IEditingDomainItemProvider,
IStructuredItemContentProvider,
ITreeItemContentProvider,
IItemLabelProvider,
IItemPropertySource,
ITableItemLabelProvider,
ITableItemColorProvider,
IItemColorProvider {
/**
* This constructs an instance from a factory and a notifier.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public IsCreatedAtItemProvider(AdapterFactory adapterFactory) {
super(adapterFactory);
}
/**
* This returns the property descriptors for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
if (itemPropertyDescriptors == null) {
super.getPropertyDescriptors(object);
}
return itemPropertyDescriptors;
}
/**
* This returns IsCreatedAt.gif.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object getImage(Object object) {
return overlayImage(object, getResourceLocator().getImage("full/obj16/IsCreatedAt")); //$NON-NLS-1$
}
/**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getText(Object object) {
String label = ((IsCreatedAt)object).getId();
return label == null || label.length() == 0 ?
getString("_UI_IsCreatedAt_type") : //$NON-NLS-1$
getString("_UI_IsCreatedAt_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
}
/**
* This handles model notifications by calling {@link #updateChildren} to update any cached
* children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
super.notifyChanged(notification);
}
/**
* This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
* that can be created under this object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
super.collectNewChildDescriptors(newChildDescriptors, object);
}
}
| [
"mrb@softisms.com"
] | mrb@softisms.com |
b0aaf2ee491d5cda7d279d839ae6945c915a2aa8 | 5160cea6579c164ea15b14a63defaa84b8f558d2 | /src/main/java/com/bypro/dealoffer/dao/ProductDaoImpl.java | c7eddfce4123d6dd7a0bfeea79fd6b277f850f92 | [] | no_license | chandarasekaran/DealOffer | 7436fcb937682b406c35db56936d862b57225246 | 94e130c426818158d25fdf24fdc142cc13e561c2 | refs/heads/master | 2021-08-24T06:23:17.881501 | 2017-12-08T11:27:26 | 2017-12-08T11:27:26 | 113,566,559 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 923 | java | package com.bypro.dealoffer.dao;
import java.util.List;
import javax.persistence.Query;
import org.springframework.stereotype.Repository;
import com.bypro.dealoffer.model.CustomProduct;
@Repository("ProductDao")
public class ProductDaoImpl extends AbstractDao implements ProductDao
{
@SuppressWarnings("unchecked")
public List<CustomProduct> getCustomProductsByUserId(Long userId) {
//org.hibernate.Query qry =getSession().createQuery("from User u left join fetch u.customProductList WHERE u.id = :user_id");
//createQuery("from employee e left join fetch e.phonenumbers")
//Criteria criteria = getSession().createCriteria(CustomProduct.class).add(Restrictions.eq(QueryConstants.USER_ID, userId));
org.hibernate.Query qry =getSession().createQuery("from CustomProduct cp WHERE cp.user.id = :user_id");
qry.setParameter("user_id",userId);
List<CustomProduct> list=qry.list();
return list;
}
}
| [
"chandru@localhost.localdomain"
] | chandru@localhost.localdomain |
2816d51d39bd4bbd40174ed33a1c144f10823a0b | afe1c48c29275e1727857dfe3e575278d8502934 | /ppj-lab/src/hr/fer/zemris/ppj/syntax/LRNode.java | 91df7203aef5d430652ac636d733cca16d7ed85b | [] | no_license | n1chre/ppjc-compiler | 9b9c4d3a509c5401f25f66d3a295d49396714c0b | 8f447b6186f8041511e4ce5cfdd02cbb0b8fc96d | refs/heads/master | 2021-06-05T14:04:40.447558 | 2016-06-15T13:37:10 | 2016-06-15T13:37:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,801 | java | package hr.fer.zemris.ppj.syntax;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import hr.fer.zemris.ppj.util.Util;
/**
* Class that represents nodes of the parse tree created by the LR parser.
*
* @author fhrenic
* @author marko1597
*/
public class LRNode {
private LRSymbol symbol;
private List<LRNode> children;
/**
* Create a node with no children and given symbol.
*
* @param symbol symbol
*/
public LRNode(LRSymbol symbol) {
this.symbol = symbol;
children = new LinkedList<>();
}
/**
* Reverses children order, needs to be done to get the correct order
*/
public void reverseChildrenOrder() {
Collections.reverse(children);
}
/**
* Adds a child to this node.
*
* @param child
*/
public void addChild(LRNode child) {
children.add(child);
}
/**
* @return symbol
*/
public LRSymbol getSymbol() {
return symbol;
}
@Override
public String toString() {
return new StringBuilder().append(toString(0)).append('\n').toString();
}
/**
* Creates a tree-like string representation of this node. This node is in
* the first row, and each of it's children is indented in the next row. And
* so on, and so on.
*
* @param level indentation, tree depth
* @return string representation
*/
public String toString(int level) {
StringBuilder sb = new StringBuilder();
String indent = Util.spaces(level);
sb.append(indent);
sb.append(symbol);
for (LRNode child : children) {
sb.append('\n');
sb.append(child.toString(level + 1));
}
return sb.toString();
}
}
| [
"hrenic.filip@gmail.com"
] | hrenic.filip@gmail.com |
f9f9d10a09a314118afd8f0572943210d02f1b26 | b3055fac6f575ec4c7f5d26e17f9a3f3c5a76f98 | /LeetCode Algorithms/src/algorithms/TaskScheduler.java | c6351380be761c4f9d709ab4b39bb143747605e8 | [] | no_license | abhitawar007/LeetCode | 13a6e4ab0dbb07b667abafe63e9087d79833a4fd | 25ef01df15e924576aaacde572d3581e9f834960 | refs/heads/master | 2021-01-25T14:58:51.332664 | 2018-05-19T22:11:46 | 2018-05-19T22:11:46 | 123,742,796 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 803 | java | package algorithms;
import java.util.*;
public class TaskScheduler
{
public int leastInterval(char[] tasks, int n)
{
// Initialization
int t = tasks.length;
int[] store = new int[26];
// Base condition
if(t <= 1 || n==0)
return t;
for(int i=0; i<t; i++)
store[tasks[i] - 'A']++;
Arrays.sort(store);
List<Integer> list = new ArrayList<>();
for(int i=0; i<=n; i++)
list.add(-1);
int count = 0;
boolean flag = false;
while(t > 0)
{
list.remove(0);
flag = false;
for(int i=25; i>=0; i--)
{
if(store[i] == 0 || list.contains(i))
continue;
else
{
list.add(i);
store[i]--;
count--;
t--;
flag = true;
break;
}
}
count++;
if(!flag)
list.add(-1);
}
return count + tasks.length;
}
}
| [
"abhijeet.tawar007@gmail.com"
] | abhijeet.tawar007@gmail.com |
00d101ca36c5a844a303ef7238ca7891c8ee8b6b | 504b3acda5ef8f961a120e13089a81202a965ce1 | /flink-connector-mysql-cdc/src/main/java/com/ververica/cdc/connectors/mysql/source/assigners/state/SnapshotPendingSplitsState.java | 6350322539f7a9c3cb721d4bc203b00be8cfbdb0 | [
"Apache-2.0"
] | permissive | LhotseMon/flink-cdc-connectors | 93a9ed0202b1ae31d41edf9792d5379ed09c9c2d | 5cf940d160b2e6f711236ea97a7c0a76b7593036 | refs/heads/master | 2023-08-30T00:44:22.059773 | 2021-10-28T02:54:27 | 2021-10-28T02:54:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,955 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.ververica.cdc.connectors.mysql.source.assigners.state;
import com.ververica.cdc.connectors.mysql.source.enumerator.MySqlSourceEnumerator;
import com.ververica.cdc.connectors.mysql.source.offset.BinlogOffset;
import com.ververica.cdc.connectors.mysql.source.reader.MySqlSplitReader;
import com.ververica.cdc.connectors.mysql.source.split.MySqlSnapshotSplit;
import io.debezium.relational.TableId;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/** A {@link PendingSplitsState} for pending snapshot splits. */
public class SnapshotPendingSplitsState extends PendingSplitsState {
/**
* The paths that are no longer in the enumerator checkpoint, but have been processed before and
* should this be ignored. Relevant only for sources in continuous monitoring mode.
*/
private final List<TableId> alreadyProcessedTables;
/** The splits in the checkpoint. */
private final List<MySqlSnapshotSplit> remainingSplits;
/**
* The snapshot splits that the {@link MySqlSourceEnumerator} has assigned to {@link
* MySqlSplitReader}s.
*/
private final Map<String, MySqlSnapshotSplit> assignedSplits;
/**
* The offsets of finished (snapshot) splits that the {@link MySqlSourceEnumerator} has received
* from {@link MySqlSplitReader}s.
*/
private final Map<String, BinlogOffset> splitFinishedOffsets;
/**
* Whether the snapshot split assigner is finished, which indicates there is no more splits and
* all records of splits have been completely processed in the pipeline.
*/
private final boolean isAssignerFinished;
public SnapshotPendingSplitsState(
List<TableId> alreadyProcessedTables,
List<MySqlSnapshotSplit> remainingSplits,
Map<String, MySqlSnapshotSplit> assignedSplits,
Map<String, BinlogOffset> splitFinishedOffsets,
boolean isAssignerFinished) {
this.alreadyProcessedTables = alreadyProcessedTables;
this.remainingSplits = remainingSplits;
this.assignedSplits = assignedSplits;
this.splitFinishedOffsets = splitFinishedOffsets;
this.isAssignerFinished = isAssignerFinished;
}
public List<TableId> getAlreadyProcessedTables() {
return alreadyProcessedTables;
}
public List<MySqlSnapshotSplit> getRemainingSplits() {
return remainingSplits;
}
public Map<String, MySqlSnapshotSplit> getAssignedSplits() {
return assignedSplits;
}
public Map<String, BinlogOffset> getSplitFinishedOffsets() {
return splitFinishedOffsets;
}
public boolean isAssignerFinished() {
return isAssignerFinished;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
SnapshotPendingSplitsState that = (SnapshotPendingSplitsState) o;
return isAssignerFinished == that.isAssignerFinished
&& Objects.equals(alreadyProcessedTables, that.alreadyProcessedTables)
&& Objects.equals(remainingSplits, that.remainingSplits)
&& Objects.equals(assignedSplits, that.assignedSplits)
&& Objects.equals(splitFinishedOffsets, that.splitFinishedOffsets);
}
@Override
public int hashCode() {
return Objects.hash(
alreadyProcessedTables,
remainingSplits,
assignedSplits,
splitFinishedOffsets,
isAssignerFinished);
}
@Override
public String toString() {
return "SnapshotPendingSplitsState{"
+ "alreadyProcessedTables="
+ alreadyProcessedTables
+ ", remainingSplits="
+ remainingSplits
+ ", assignedSplits="
+ assignedSplits
+ ", splitFinishedOffsets="
+ splitFinishedOffsets
+ ", isAssignerFinished="
+ isAssignerFinished
+ '}';
}
}
| [
"noreply@github.com"
] | noreply@github.com |
858a19cf5e3c16ef73c4e4bb76a4026bdad71a7d | 19b25fd7f91bfdb63fed46a6546addee989b514e | /ru/tcase/avaj_launcher/Aircraft.java | fe4ea1976170052b3e4dd15a3a127259b3a838c0 | [] | no_license | ermakovis/42_avaj-launcher | d64e9481c96ff2732563a2fd149d07112b0328ec | 64ad294a56123ef890291d0cf5f2b0e5196fd9ab | refs/heads/main | 2023-05-11T20:19:42.992814 | 2021-06-05T18:18:25 | 2021-06-05T18:18:25 | 374,127,155 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 420 | java | package ru.tcase.avaj_launcher;
public abstract class Aircraft {
private static long idCounter = 0;
protected long id;
protected String name;
protected Coordinates coordinates;
public Aircraft(String name, Coordinates coordinates) {
this.name = name;
this.coordinates = coordinates;
this.id = nextId();
}
private long nextId() {
return ++idCounter;
}
}
| [
"ilya.ermakov@sberins.ru"
] | ilya.ermakov@sberins.ru |
4b6c588327a8e2fa88f7285b809a78e4b65f4431 | 918c917c9de8f05c2000a16ae12ac138ec1806af | /src/ihm/ConfigurationClavier.java | aaf96e08c1fbae537272707264c8520ea5564c4e | [] | no_license | benji62f/JAVA_VirtualWar | c978a73ddf903cdc173e8100909f0a3a60a3d66e | a4374780311005b21be50f6d0bc87fd8ba8706c4 | refs/heads/master | 2020-04-02T15:39:04.211450 | 2013-06-23T18:19:19 | 2013-06-23T18:19:19 | 154,576,921 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,536 | java | package ihm;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class ConfigurationClavier extends JFrame {
/**
*
*/
private static final long serialVersionUID = 1L;
private JLabel touches, tirer, pieger;
private JTextField textTirer, textPieger;
private JPanel panelPrincipal;
public ConfigurationClavier(){
touches = new JLabel("Touches");
tirer = new JLabel("Tirer");
pieger = new JLabel("Pieger");
panelPrincipal = new JPanel();
this.buildEnTete();
this.getContentPane().add(panelPrincipal);
this.setBounds(200, 200, 700, 700);
this.setVisible(true);
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
}
public void buildEnTete(){
GridBagLayout repartiteur = new GridBagLayout();
JPanel panel = new JPanel();
panelPrincipal.setLayout(repartiteur);
GridBagConstraints contraintes;
contraintes = new GridBagConstraints();
contraintes.gridx = 3;
contraintes.gridy = 3;
contraintes.gridheight = 5;
contraintes.gridwidth = 5;
contraintes.fill = GridBagConstraints.BOTH;
repartiteur.setConstraints(panel, contraintes);
panelPrincipal.add(panel);
}
public void buildCentre(){
GridBagLayout repartiteur = new GridBagLayout();
JPanel panel = new JPanel();
panelPrincipal.setLayout(repartiteur);
GridBagConstraints contraintes = new GridBagConstraints();
contraintes.gridx = 50;
contraintes.gridy = 0;
contraintes.gridheight = 2;
contraintes.gridwidth = 2;
contraintes.fill = GridBagConstraints.BOTH;
repartiteur.setConstraints(panel, contraintes);
panelPrincipal.add(panel);
}
public JLabel getTouches() {
return touches;
}
public void setTouches(JLabel touches) {
this.touches = touches;
}
public JLabel getTirer() {
return tirer;
}
public void setTirer(JLabel tirer) {
this.tirer = tirer;
}
public JLabel getPieger() {
return pieger;
}
public void setPieger(JLabel pieger) {
this.pieger = pieger;
}
public JTextField getTextTirer() {
return textTirer;
}
public void setTextTirer(JTextField textTirer) {
this.textTirer = textTirer;
}
public JTextField getTextPieger() {
return textPieger;
}
public void setTextPieger(JTextField textPieger) {
this.textPieger = textPieger;
}
public JPanel getPanelPrincipal() {
return panelPrincipal;
}
public void setPanelPrincipal(JPanel panelPrincipal) {
this.panelPrincipal = panelPrincipal;
}
}
| [
"benji62f@hotmail.fr"
] | benji62f@hotmail.fr |
fc90954ee83a3d9339201d8d1553dcf68218043a | 65e9c46d37d05f3166be0a5eaa9de296dd938a75 | /leetcode/src/com/practice/simple/MaxSubArray.java | caf7a9734974853f38d252d1f9e8ea42c05a9cae | [] | no_license | lastlearner/LeetCode | b26db285671032137929f132ee63247a8d62f151 | dbc76764ecb79a3c985813aec1eb4432a90ae7a7 | refs/heads/master | 2021-07-02T18:20:04.857534 | 2020-09-10T02:51:52 | 2020-09-10T02:51:52 | 161,102,932 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 703 | java | package com.practice.simple;
/**
* @Description: NO.53 最大子序列和
* @Auther: liaoyl
* @Date: 2020/1/19 0019 23:43
*/
public class MaxSubArray
{
public static void main(String[] args)
{
int[] nums = {-2, 1, 3, -4, 2, -1, 4, 1, -2};
int result = maxSubArray(nums);
System.out.println(result);
}
private static int maxSubArray(int[] nums)
{
int ret = nums[0];
int sum = 0;
for (int num : nums)
{
if (sum > 0)
{
sum += num;
} else
{
sum = num;
}
ret = sum > ret ? sum : ret;
}
return ret;
}
}
| [
"429825736@qq.com"
] | 429825736@qq.com |
5c442524fc13d9ec2f0ed42ff9aee57b7f543508 | ac9b777878ea203781c4c48628f6c2e1cf486e39 | /src/main/java/com/linlazy/mmorpg/file/service/SceneConfigService.java | c71f1e96ca868ce490066e88a8400b20ef20dd73 | [] | no_license | lcc214321/mmorpg-lintingyang | 5521795fdf197005b556fc1fa7c40e2d4fd2cfc2 | c2ab1d5f8aa6d76d2229085adb76a4c61edf794b | refs/heads/master | 2023-03-17T09:47:00.410368 | 2019-01-29T13:57:28 | 2019-01-29T13:57:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,812 | java | package com.linlazy.mmorpg.file.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.linlazy.mmorpg.file.config.SceneConfig;
import com.linlazy.mmorpg.module.common.reward.Reward;
import com.linlazy.mmorpg.server.common.ConfigFile;
import com.linlazy.mmorpg.server.common.ConfigFileManager;
import com.linlazy.mmorpg.server.common.GlobalConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 游戏场景配置服务类
* @author linlazy
*/
@Component
public class SceneConfigService {
@Autowired
private GlobalConfigService globalConfigService;
private static ConfigFile sceneConfigFile;
static {
sceneConfigFile = ConfigFileManager.use("config_file/scene_config.json");
}
private static Map<Integer,SceneConfig> map = new HashMap<>();
private int initSceneId;
@PostConstruct
public void init(){
JSONArray jsonArray = sceneConfigFile.getJsonArray();
for(int i = 0; i < jsonArray.size(); i++){
JSONObject jsonObject = jsonArray.getJSONObject(i);
Integer sceneId = jsonObject.getInteger("sceneId");
String name = jsonObject.getString("name");
List<Integer> neighborSet = jsonObject.getJSONArray("neighborSet").toJavaList(Integer.class);
SceneConfig sceneConfig = new SceneConfig();
sceneConfig.setSceneId(sceneId);
sceneConfig.setName(name);
sceneConfig.setNeighborSet(neighborSet);
sceneConfig.setOverTimeSeconds(jsonObject.getIntValue("times"));
//初始化奖励
List<Reward> rewardList = sceneConfig.getRewardList();
JSONArray rewards = jsonObject.getJSONArray("rewards");
if(rewards != null){
for(int j= 0; j< rewards.size();j++){
JSONArray reward = rewards.getJSONArray(j);
Reward reward1 = new Reward();
long itemId = reward.getLongValue(0);
int num = reward.getIntValue(1);
reward1.setRewardId(itemId);
reward1.setCount(num);
rewardList.add(reward1);
}
}
map.put(sceneId,sceneConfig);
}
}
/**
* 场景是否存在
* @param targetSceneId 玩家前往场景ID
* @return
*/
public boolean hasScene(int targetSceneId) {
JSONArray jsonArray = sceneConfigFile.getJsonArray();
for(int i = 0; i < jsonArray.size(); i++){
JSONObject jsonObject = jsonArray.getJSONObject(i);
if( jsonObject.getIntValue("sceneId") == targetSceneId){
return true;
}
}
return false;
}
/**
* 能否从当前场景移动到目标场景
* @param currentSceneId 玩家所处场景ID
* @param targetSceneId 玩家移动目标场景ID
* @return
*/
public boolean canMoveToTarget(int currentSceneId, int targetSceneId) {
SceneConfig sceneConfig = map.get(currentSceneId);
return sceneConfig.getNeighborSet().stream()
.anyMatch(sceneId ->sceneId == targetSceneId);
}
public boolean isCopyScene(int sceneId){
return globalConfigService.isCopy(sceneId);
}
/**
* 获取场景配置
* @param sceneId
* @return
*/
public SceneConfig getSceneConfig(int sceneId) {
return map.get(sceneId);
}
public boolean isFightCopyScene(int sceneId) {
return globalConfigService.getFightCopySceneId() == sceneId;
}
}
| [
"linlazy@163.com"
] | linlazy@163.com |
59e1b64b54041911a61bd9e625a41f29532e524e | 0ad2bb4aece650fb7d9d9be30ae45d0618c2165f | /Downloader/src/org/ivan/downloader/worker/DownloadWorker.java | d35d9c57c243b95c54b5b086426d6eb4bbdd81bc | [] | no_license | TanyaGaleyev/Downloader | abe6d18465b8657263ec3ed6b790b04cc2662cd9 | a77e3f8b419aeb21f3d2a9d859360d891ce251fa | refs/heads/master | 2021-01-02T23:07:09.695381 | 2014-07-18T11:48:34 | 2014-07-18T11:48:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,351 | java | package org.ivan.downloader.worker;
import org.ivan.downloader.protocols.ProtocolConnection;
import org.ivan.downloader.storage.DownloadHolder;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Class that performs download process.
* <p>
* Inside this class we use download abstraction at three aspects:
* <ol>
* <li>download peer IO implementation;</li>
* <li>download protocol;</li>
* <li>storage to which download are saved.</li>
* </ol>
* Each aspect is independent and we could create different combination of IO implementations and chosen protocols
* <p>
* Created by ivan on 10.07.2014.
*/
public class DownloadWorker {
public static final int DEFAULT_BUFF_SIZE = 2048;
private final ProtocolConnection connection;
private final DownloadHolder downloadHolder;
private volatile int bytesRead;
private volatile boolean isRangeSupported;
private volatile int size;
public DownloadWorker(ProtocolConnection connection, DownloadHolder downloadHolder) {
this(connection, downloadHolder, 0, 0);
}
public DownloadWorker(ProtocolConnection connection, DownloadHolder downloadHolder, int bytesRead, int size) {
this.connection = connection;
this.downloadHolder = downloadHolder;
this.bytesRead = bytesRead;
this.size = size;
}
public void performDownload() throws IOException {
connection.connect();
connection.requestDownload(bytesRead);
isRangeSupported = connection.isRangeSupported();
if(size <= 0) size = connection.getSize();
downloadHolder.init(bytesRead);
byte[] buffer = new byte[DEFAULT_BUFF_SIZE];
int nRead;
while ((nRead = connection.readDownloadBytes(buffer)) != -1) {
downloadHolder.appendBytes(buffer, 0, nRead);
bytesRead += nRead;
}
}
public void cancel() {
try {
connection.disconnect();
downloadHolder.flush();
} catch (IOException e) {
Logger.getGlobal().log(Level.WARNING, e.getMessage(), e);
}
}
public int getBytesRead() {
return bytesRead;
}
public int getSize() {
return size;
}
public boolean isRangeSupported() {
return isRangeSupported;
}
}
| [
"pav401@mail.ru"
] | pav401@mail.ru |
e22b24257e106f5a5b775b9ed91bfdecb5b6f5f8 | 1be774fec11159972da4a6021b376cd511e8398b | /src/main/java/fr/univtln/bruno/i311/simplers/generic/ws/DAOResource.java | b2528b7f5b31dc761017aa7b55a3af986111885f | [] | no_license | emmanuelbruno/simplers | e98d0cdc2d184841f519da950fc88c310e9b0b03 | ee201e289cc67d34899b036bc62be339fdfed79d | refs/heads/master | 2021-06-22T12:32:28.184952 | 2019-01-29T10:07:27 | 2019-01-29T10:07:27 | 167,588,981 | 0 | 0 | null | 2020-12-18T16:01:53 | 2019-01-25T17:49:24 | Java | UTF-8 | Java | false | false | 987 | java | package fr.univtln.bruno.i311.simplers.generic.ws;
import fr.univtln.bruno.i311.simplers.generic.dao.IdentifiableEntity;
import fr.univtln.bruno.i311.simplers.generic.dao.exception.DAOException;
import javax.validation.Valid;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import java.util.List;
/**
* Created by bruno on 05/12/14.
*/
public interface DAOResource<T extends IdentifiableEntity> {
T find(Long id) throws DAOException;
void delete(Long id) throws DAOException;
Response metadata() throws DAOException;
Response findAll(boolean reverse, int pageNumber, int perPage, int limit, UriInfo uriInfo) throws DAOException;
List<Long> getIds(boolean reverse) throws DAOException;
int create(List<T> list) throws DAOException;
T update(@Valid T t) throws DAOException;
int delete() throws DAOException;
public int getMaxPageSize();
public void setMaxPageSize(int pageSize);
}
| [
"emmanuel.bruno@univ-tln.fr"
] | emmanuel.bruno@univ-tln.fr |
0b222b7d3b72f22813da7efcde279e643e074b4e | 164d341984d995eef0e1f209adcafb2df033f843 | /serviceapi/src/main/java/com/team1/ssm/model/UserDTo.java | c1f9acc442e2ebafe8f96e6ac0a0be04375667fa | [] | no_license | dreamboylw/ssmtest1 | f2bea880d8f4461bcdc42f3e3140862bd5665502 | 32ab157b5aeee115098e59ccb912bbfe8f15a0cb | refs/heads/master | 2021-01-20T08:07:16.312057 | 2017-05-08T04:08:56 | 2017-05-08T04:08:56 | 90,100,081 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,570 | java | package com.team1.ssm.model;
import lombok.Data;
import javax.persistence.*;
import java.util.Date;
@Data
@Table(name = "tb_user")
public class UserDTo {
/**
* 会员id
*/
@Id
@Column(name = "USER_ID")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer userId;
/**
* 会员名
*/
@Column(name = "USER_NAME")
private String userName;
/**
* 会员性别:0代表男,1代表女
*/
@Column(name = "USER_SEX")
private String userSex;
/**
* 登录密码
*/
@Column(name = "PASS_WORD")
private String passWord;
/**
* 手机号码
*/
@Column(name = "USER_PHONE")
private String userPhone;
/**
* 真实名字
*/
@Column(name = "REAL_NAME")
private String realName;
/**
* 邮箱
*/
@Column(name = "EMAIL")
private String email;
/**
* 会员类型:1:游客用户 0:注册会员用户
*/
@Column(name = "USER_TYPE")
private String userType;
/**
* 状态 1:可用状态 0:删除状态 2:锁定状态
*/
@Column(name = "STATE")
private String state;
/**
* 创建人ID
*/
@Column(name = "CREATE_BY")
private Long createBy;
/**
* 创建时间
*/
@Column(name = "CREATE_DATE")
private Date createDate;
/**
* 修改人ID
*/
@Column(name = "UPDATE_BY")
private Long updateBy;
/**
* 修改时间
*/
@Column(name = "UPDATE_DATE")
private Date updateDate;
} | [
"18037794373@163.com"
] | 18037794373@163.com |
99e07ee4626d9f6d4b86ad348b0c63ed1bf71c84 | 6851feb9b4d54811d98df9468672bacf8b89207a | /src/dao/DaoMedication.java | fbfe1cebf309632baef53f93618634246de5005d | [] | no_license | carlrdj/medication-control | b96e832318593a42a4ae9b2b19cfedc80bf8cc64 | af66bba60c7c1cd780537df56df52886d50e8109 | refs/heads/master | 2021-05-06T18:21:51.770257 | 2017-11-26T03:16:31 | 2017-11-26T03:16:31 | 111,976,942 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 869 | 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 dto.Medication;
import java.util.List;
/**
*
* @author SEVEN
*/
public interface DaoMedication {
//Message
public String message();
//Gemerate id
public int medicationGenerateId();
//Insert medication
public Boolean medicationIns(Medication medication);
//Get medication
public Medication medicationGetById(Integer id);
//Update medication
public Boolean medicationUpd(Medication medication);
//Remove medication
public Boolean medicationDel(Integer id);
//List medication
public List<Medication> medicationList();
//index
public int indexList(Integer id);
}
| [
"carl.rdj@gmail.com"
] | carl.rdj@gmail.com |
8a7728eb48fbbea79ae32891b61a4d6373063b2e | ae5d79dde04149da151f5c5ee64130a6cf11992a | /src/main/java/com/qf/service/serviceImpl/ShoppingCarServiceimpl.java | 6c7ce7729733317b460d4981287e736090dd2ebe | [] | no_license | java1903-theseventhgroup/zhishu | 8d3d49fe76a79ec59605fab87183692d7e550f3b | ec3e0680a0c4998289e1d6a28bc4867aa8f06b9f | refs/heads/master | 2022-06-03T01:49:17.882737 | 2019-07-26T10:57:58 | 2019-07-26T10:57:58 | 199,001,065 | 0 | 0 | null | 2022-05-20T21:04:19 | 2019-07-26T10:54:20 | Java | UTF-8 | Java | false | false | 2,633 | java | package com.qf.service.serviceImpl;
import com.qf.dao.ShoppingCarDao;
import com.qf.domain.ShoppingCar;
import com.qf.response.CommonCode;
import com.qf.response.QueryResponseResult;
import com.qf.response.QueryResult;
import com.qf.service.ShoppingCarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class ShoppingCarServiceimpl implements ShoppingCarService {
@Autowired
private ShoppingCarDao shoppingCarDao;
@Override
//通过ID查询出来的课程存入到购物车的数据库中
public int addCourse(ShoppingCar shoppingCar) {
return shoppingCarDao.addCourse(shoppingCar);
}
//根据当前用户登录的Id,查询购物车里对应的所有购买课程的总钱数
@Override
public QueryResponseResult findMoney(int id) {
Double money = shoppingCarDao.findMoney(id);
QueryResult<Double> queryResult = new QueryResult<>();
queryResult.setADouble(money);
return new QueryResponseResult(CommonCode.SUCCESS,queryResult);
}
@Override
//根据当前用户ID查询购物车对应的所有对象
public QueryResponseResult findAllShoppingCar(int id) {
List<ShoppingCar> allShoppingCar = shoppingCarDao.findAllShoppingCar(id);
System.out.println(allShoppingCar);
QueryResult<ShoppingCar> queryResult = new QueryResult<>();
queryResult.setList(allShoppingCar);
return new QueryResponseResult<>(CommonCode.SUCCESS,queryResult);
}
@Override
//根据当前用户ID,删除购物车对应的对象,实现购物车支付成功
public QueryResponseResult uptShoppingCar(int id) {
int i = shoppingCarDao.uptShoppingCar(id);
System.out.println(i);
QueryResult<Integer> queryResult = new QueryResult<>();
queryResult.setAnInt(i);
return new QueryResponseResult(CommonCode.SUCCESS,queryResult);
}
@Override
//复选框删除多个对象
public QueryResponseResult deletShoppingCarAll(List<Integer> list, int id) {
int i = shoppingCarDao.deletShoppingCarAll(list,id);
QueryResult<Integer> queryResult = new QueryResult<>();
queryResult.setAnInt(i);
return new QueryResponseResult(CommonCode.SUCCESS,queryResult);
}
@Override
//复选框查询购物车所选对象的全部信息
public List<ShoppingCar> selShoppingCarAll(List<Integer> list, int id) {
List<ShoppingCar> shoppingCars = shoppingCarDao.selShoppingCarAll(list,id);
return shoppingCars;
}
}
| [
"1368249116@qq.com"
] | 1368249116@qq.com |
ee12ad7ad4b34889162f6a3eaf8a46e5bb8c5067 | 5822e8a9ce19c4a3bffc11dac4e7a34de42ddb46 | /miaosha-user-center/src/main/java/org/spring/cloud/alibaba/study/common/util/IPUtil.java | 17f2e0092d71927a4a361fed5857f86f4f214392 | [] | no_license | zwuyang/miaosha-cloud | 0411726c17f1e7c080a0907896cbd7afa646e7eb | bcfa28089838c8551ef32faeb37214f08c0759e2 | refs/heads/master | 2022-12-06T16:14:38.197508 | 2020-09-04T08:37:37 | 2020-09-04T08:37:37 | 286,980,908 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,060 | java | package org.spring.cloud.alibaba.study.common.util;
import org.springframework.util.StringUtils;
import javax.servlet.http.HttpServletRequest;
import java.net.InetAddress;
import java.net.UnknownHostException;
/**
* @author yzw
* @Classname IPUtil
* @Description TODO
* @Date 2020/8/14 09:53
*/
public class IPUtil {
private static final String UNKNOWN = "unknown";
private static final String X_FORWARDED_FOR = "x-forwarded-for";
private static final String PROXY_CLIENT_IP = "Proxy-Client-IP";
private static final String X_FORWARDED_FOR_ = "X-Forwarded-For";
private static final String WL_PROXY_CLIENT_IP = "WL-Proxy-Client-IP";
private static final String X_REAL_IP = "X-Real-IP";
private static final String LOCAL_HOST_IPV6 = "0:0:0:0:0:0:0:1";
private static final String LOCAL_HOST = "127.0.0.1";
public static String getIPAddr(HttpServletRequest request){
if (request == null){
return UNKNOWN;
}
String ip = request.getHeader(X_FORWARDED_FOR);
if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)){
ip = request.getHeader(PROXY_CLIENT_IP);
}
if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)){
ip = request.getHeader(X_FORWARDED_FOR_);
}
if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)){
ip = request.getHeader(WL_PROXY_CLIENT_IP);
}
if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)){
ip = request.getHeader(X_REAL_IP);
}
if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)){
ip = request.getRemoteAddr();
}
return LOCAL_HOST_IPV6.equals(ip) ? LOCAL_HOST : ip;
}
public static boolean interIP(String ip){
byte[] addr = textToNumericFormatV4(ip);
return interIP(addr) || LOCAL_HOST.equals(ip);
}
private static boolean interIP(byte[] addr){
if (addr.length < 2 || StringUtils.isEmpty(addr)){
return true;
}
final byte b0 = addr[0];
final byte b1 = addr[1];
// 10.x.x.x/8
final byte SECTION_1 = 0x0A;
// 172.16.x.x/12
final byte SECTION_2 = (byte) 0xAC;
final byte SECTION_3 = (byte) 0x10;
final byte SECTION_4 = (byte) 0x1F;
// 192.168.x.x/16
final byte SECTION_5 = (byte) 0xC0;
final byte SECTION_6 = (byte) 0xA8;
switch (b0)
{
case SECTION_1:
return true;
case SECTION_2:
if (b1 >= SECTION_3 && b1 <= SECTION_4)
{
return true;
}
case SECTION_5:
switch (b1)
{
case SECTION_6:
return true;
}
default:
return false;
}
}
private static byte[] textToNumericFormatV4(String text) {
if (text.length() == 0)
{
return null;
}
byte[] bytes = new byte[4];
String[] elements = text.split("\\.", -1);
try
{
long l;
int i;
switch (elements.length)
{
case 1:
l = Long.parseLong(elements[0]);
if ((l < 0L) || (l > 4294967295L)) {
return null;
}
bytes[0] = (byte) (int) (l >> 24 & 0xFF);
bytes[1] = (byte) (int) ((l & 0xFFFFFF) >> 16 & 0xFF);
bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF);
bytes[3] = (byte) (int) (l & 0xFF);
break;
case 2:
l = Integer.parseInt(elements[0]);
if ((l < 0L) || (l > 255L)) {
return null;
}
bytes[0] = (byte) (int) (l & 0xFF);
l = Integer.parseInt(elements[1]);
if ((l < 0L) || (l > 16777215L)) {
return null;
}
bytes[1] = (byte) (int) (l >> 16 & 0xFF);
bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF);
bytes[3] = (byte) (int) (l & 0xFF);
break;
case 3:
for (i = 0; i < 2; ++i)
{
l = Integer.parseInt(elements[i]);
if ((l < 0L) || (l > 255L)) {
return null;
}
bytes[i] = (byte) (int) (l & 0xFF);
}
l = Integer.parseInt(elements[2]);
if ((l < 0L) || (l > 65535L)) {
return null;
}
bytes[2] = (byte) (int) (l >> 8 & 0xFF);
bytes[3] = (byte) (int) (l & 0xFF);
break;
case 4:
for (i = 0; i < 4; ++i)
{
l = Integer.parseInt(elements[i]);
if ((l < 0L) || (l > 255L)) {
return null;
}
bytes[i] = (byte) (int) (l & 0xFF);
}
break;
default:
return null;
}
}
catch (NumberFormatException e)
{
return null;
}
return bytes;
}
public static String getHostIP(){
try {
return InetAddress.getLocalHost().getHostAddress();
}catch (UnknownHostException e){
}
return LOCAL_HOST;
}
public static String getHostName(){
try {
return InetAddress.getLocalHost().getHostName();
}catch (UnknownHostException e){
}
return UNKNOWN;
}
}
| [
"yzw@gitlab.com"
] | yzw@gitlab.com |
0814ad607dab8196774118ec80b373a5aee23b72 | 25a85d92930a2ec93454b31d6703c69ee2588f7c | /Math/Palindrome Integer.java | 150f288b36aa46ed8db84f92e4d7fa1baf937b6e | [
"MIT"
] | permissive | sonakshi-priya/InterviewBit-Practice | 5a6a68ca254f25f20d264bf9d8eb3da57b721871 | 00eb556b7509df51b8c27f912188a2090a302b82 | refs/heads/master | 2022-12-21T04:56:31.187489 | 2020-10-01T07:29:22 | 2020-10-01T07:29:22 | 300,187,231 | 0 | 0 | MIT | 2020-10-01T07:29:23 | 2020-10-01T07:27:24 | null | UTF-8 | Java | false | false | 330 | java | public class Solution {
public int isPalindrome(int a) {
if(a<0){
return 0;
}
StringBuilder number = new StringBuilder();
number.append(a+"");
number.reverse();
if((a+"").equals(number.toString())){
return 1;
}else{
return 0;
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
fdeab3b5572c841675c408d720bd00dbf00d6169 | 8fd70b0b2605ba7fd95c42d304740097e5d84cdf | /src/main/java/japsa/tools/bio/tr/CompareTRVCmd.java | 00672588f196f7f0fd468ba8bbebe9a868767c14 | [
"BSD-2-Clause",
"LicenseRef-scancode-other-permissive"
] | permissive | lachlancoin/japsa | 312e6f2778139276ed6feea6f74b6a0246247a69 | 80fddf6d3ce47120d24d65572a14dea2dd570f85 | refs/heads/master | 2022-06-03T18:04:53.317842 | 2021-04-07T12:14:36 | 2021-04-07T12:14:36 | 360,778,111 | 0 | 0 | NOASSERTION | 2021-04-23T05:56:40 | 2021-04-23T05:56:40 | null | UTF-8 | Java | false | false | 16,951 | java | /*****************************************************************************
* Copyright (c) Minh Duc Cao, Monash Uni & UQ, All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* 3. Neither the names of the institutions nor the names of the contributors*
* may be used to endorse or promote products derived from this software *
* without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS *
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, *
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR *
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR *
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
****************************************************************************/
/* Revision History
* 08/04/2012 - Minh Duc Cao: Revised
*
****************************************************************************/
package japsa.tools.bio.tr;
import japsa.bio.tr.TandemRepeatVariant;
import japsa.seq.SequenceReader;
import japsa.util.CommandLine;
import japsa.util.deploy.Deployable;
import java.io.BufferedReader;
import java.io.IOException;
import java.util.ArrayList;
/**
* @author minhduc
*
*/
@Deployable(
scriptName = "jsa.str.strvcompare",
scriptDesc = "Compare TR variation to an answer file, use to evaluate strv"
)
public class CompareTRVCmd extends CommandLine{
public CompareTRVCmd(){
super();
Deployable annotation = getClass().getAnnotation(Deployable.class);
setUsage(annotation.scriptName() + " [options]");
setDesc(annotation.scriptDesc());
addString("ansFile", null, "Name of the answer file",true);
addInt("min", 0, "minimum length of TR region");
addInt("max", 10000, "maximum length of TR region");
addString("strviper", null, "Name of the str file");
//cmdLine.addString("lob", null, "Name of the lobstr file");
addString("vcf", null, "Name of the results in vcf format (samtools and Dindel)");
addBoolean("baseline", false, "Benchmark against a baseline");
addStdHelp();
}
//FIXME: standardise
public static void main(String[] args) throws Exception {
CommandLine cmdLine = new CompareTRVCmd();
args = cmdLine.stdParseLine(args);
String ans = cmdLine.getStringVal("ansFile");
String lob = cmdLine.getStringVal("lob");
String strviper = cmdLine.getStringVal("strviper");
String vcf = cmdLine.getStringVal("vcf");
int min = cmdLine.getIntVal("min");
int max = cmdLine.getIntVal("max");
// getInsertSizeSlow(samFile, output);
ArrayList<TandemRepeatVariant> ansList = TandemRepeatVariant.readFromFile(ans);
if (cmdLine.getBooleanVal("baseline")){
System.out.println("###baseline ");
compareStr(ansList, new ArrayList<TandemRepeatVariant>(),min, max);
}
if (lob != null){
ArrayList<TandemRepeatVariant> lobList = new ArrayList<TandemRepeatVariant> ();
BufferedReader in = SequenceReader.openFile(lob);
String line = "";
while ( (line = in.readLine()) != null){
line = line.trim();
if (line.length() <= 0) continue;
if (line.startsWith("#"))
continue;
lobList.add(readLobSTR(line));
}
System.out.println("###LobSTR " + lob);
compareStr(ansList, lobList,min,max);
}
if (strviper != null){
ArrayList<TandemRepeatVariant> myList =TandemRepeatVariant.readFromFile(strviper);
System.out.println("###STRViper " + strviper);
compareStr(ansList, myList,min,max);
}
if (vcf != null){
double [] quals = {0, 20, 40, 60, 80, 100, 120, 140, 160,180,200, 220, 240, 260, 280, 300, 320, 340, 360, 380,400,500,600,700,800,900,1000};
int tt = 0;
//for ( tt = 0; tt < quals.length; tt++){
ArrayList<TandemRepeatVariant> samtoolList = new ArrayList<TandemRepeatVariant>(ansList.size());
for (int i = 0; i < ansList.size(); i++){
TandemRepeatVariant trv = ansList.get(i).tandemRepeatClone();
trv.setMean(0);
trv.setVar(0);
trv.setConfidence(0);
trv.setStd(0);
samtoolList.add(trv);
}
System.out.println("###SAMtool " + vcf);
readVCFResults(samtoolList, vcf, quals[tt]);
compareStr(ansList, samtoolList,min,max);
//ShortTandemRepeat.write(samtoolList, System.out, ShortTandemRepeat.STANDARD_HEADERS);
//}
}
}
static double range = 2.0;
public static void readModilResults(ArrayList<TandemRepeatVariant> trList,String fName) throws IOException{
BufferedReader in = SequenceReader.openFile(fName);
String line = "";
int index = 0;
TandemRepeatVariant tr = trList.get(0);
int indels = 0;
while ( (line = in.readLine()) != null){
if (line.startsWith("#")) continue;
line = line.trim();
if (line.length() < 0) continue;
String [] toks = line.split("\\t");
if (toks.length < 11) continue;
String chr = toks[1];
if (chr.startsWith("chr"))
chr = chr.substring(3);
if (chr.compareTo(tr.getChr()) < 0){
System.out.println("Pass 1 " + line);
continue;//already advanced to the next chromosome
}
int positionS = Integer.parseInt(toks[2]);
int positionE = Integer.parseInt(toks[3]);
while ((chr.compareTo(tr.getChr()) == 0 && positionS > tr.getEnd()) || (chr.compareTo(tr.getChr()) > 0) ){
index ++;
if (index >= trList.size()){
break;
}
tr = trList.get(index);
}
if (index >= trList.size()){
System.out.println("Out " + line);
break;//while
}
//assert: chr == tr.chr && positionS <= tr.end
if (chr.compareTo(tr.getChr()) == 0 && positionE < tr.getStart()){
System.out.print("Pass 2 " + line + ":" + tr.getChr() + ", " + tr.getStart() +" -> "+tr.getEnd());
if (index > 0) System.out.print("#" + trList.get(index - 1).getChr()+", "+trList.get(index - 1).getStart()+" -> "+trList.get(index - 1).getEnd());
System.out.println();
continue;
}
indels++;
int overlap = positionS;
if (tr.getStart() > overlap) overlap = tr.getStart();
if (tr.getEnd() < positionE)
overlap = tr.getEnd() - overlap;
else
overlap = positionE - overlap;
double indelSize = Double.parseDouble(toks[6]);
System.out.println("Enter : " + line + " " + overlap + " vs " + indelSize);
tr.setVar(tr.getVar() + indelSize/tr.getPeriod());
tr.setMean(tr.getVar());
tr.std = 2;
}
System.out.println("## " + indels + " indels found ");
}
public static void readVCFResults(ArrayList<TandemRepeatVariant> trList,String fName, double qual) throws IOException{
BufferedReader in = SequenceReader.openFile(fName);
String line = "";
int index = 0;
TandemRepeatVariant tr = trList.get(0);
int indels = 0;
while ( (line = in.readLine()) != null){
if (line.startsWith("#")) continue;
line = line.trim();
if (line.length() == 0) continue;
String [] toks = line.split("\\t");
if (toks.length < 8) continue;
//if (!toks[7].startsWith("INDEL"))
// continue;
double thisQual = 0;
//this is to account for varscan
if (!".".equals(toks[5]))
thisQual = Double.parseDouble(toks[5]);
if (thisQual < qual) continue;
if (toks[0].compareTo(tr.getChr()) < 0) continue;
int position = Integer.parseInt(toks[1]);
while ((toks[0].compareTo(tr.getChr()) == 0 && position > tr.getEnd()) || (toks[0].compareTo(tr.getChr()) > 0) ){
index ++;
if (index >= trList.size()){
break;
}
tr = trList.get(index);
}
int refLen = toks[3].length();
if (toks[0].compareTo(tr.getChr()) == 0 && position + refLen < tr.getStart())
continue;
indels++;
String [] pToks = toks[4].split(",");
int sumL = 0, countL = 0;
for (int x = 0; x < pToks.length; x++){
if (pToks[x].startsWith("-")){
sumL -= (pToks[x].length() - 1) -refLen;
}else if (pToks[x].startsWith("+")){
sumL += (pToks[x].length() - 1) +refLen;
}else
sumL += pToks[x].length();
countL ++;
}
tr.setVar(tr.getVar() + (sumL * 1.0 / countL - refLen)/tr.getPeriod());
}
System.out.println("## " + indels + " indels found ");
}
public static void readSDIVar(ArrayList<TandemRepeatVariant> trList, String fName) throws IOException{
BufferedReader in = SequenceReader.openFile(fName);
String line = "";
int index = 0;
TandemRepeatVariant tr = trList.get(0);
int indels = 0;
while ( (line = in.readLine()) != null){
if (line.startsWith("#")) continue;
line = line.trim();
if (line.length() == 0) continue;
String [] toks = line.split("\\t");
if (toks.length < 5) continue;
//if (!toks[7].startsWith("INDEL"))
// continue;
if (toks[0].compareTo(tr.getChr()) < 0) continue;
int position = Integer.parseInt(toks[1]);
while ((toks[0].compareTo(tr.getChr()) == 0 && position > tr.getEnd()) || (toks[0].compareTo(tr.getChr()) > 0) ){
index ++;
if (index >= trList.size()){
break;
}
tr = trList.get(index);
}
int refLen = toks[3].length();
if (toks[0].compareTo(tr.getChr()) == 0 && position + refLen < tr.getStart())
continue;
boolean foundIndel = false;
String [] pToks = toks[4].split(",");
int sumL = 0, countL = 0;
for (int x = 0; x < pToks.length; x++){
sumL += pToks[x].length();
countL ++;
foundIndel = true;
}
tr.setVar(tr.getVar() + (sumL * 1.0 / countL - refLen)/tr.getPeriod());
if (foundIndel)
indels++;
}
System.out.println("## " + indels + " indels found ");
}
public static void combineStr(ArrayList<TandemRepeatVariant> trList, ArrayList<TandemRepeatVariant> pList) throws IOException{
int pInd = 0;
//double SSE = 0;
//int sRight = 0, rRight = 0, vRight = 0, pRight = 0;
int pCount = 0;
TandemRepeatVariant pStr = null;
for (int i = 0; i < trList.size(); i++){
TandemRepeatVariant ans = trList.get(i);
if (pStr == null && pInd < pList.size()){
pStr = pList.get(pInd);
pInd ++;
}
if (pStr != null){
if (ans.getChr().equals(pStr.getChr()) && ans.getStart() == pStr.getStart() && ans.getEnd() == pStr.getEnd()){
ans.setVar(pStr.getVar());
ans.setMean(ans.getVar());
ans.setConfidence(pStr.getConfidence());
ans.std = 2.0;
pCount ++;
pStr = null;
}
}
}
System.out.println("##Combine " + pCount);
}
public static void compareStr(ArrayList<TandemRepeatVariant> ansList, ArrayList<TandemRepeatVariant> pList, int minLen, int maxLen) throws IOException{
int pInd = 0;
double SSE = 0;
int sRight = 0, rRight = 0, vRight = 0, pRight = 0;
//sRight = strict count (only equal excepted)
//rRight = relax count (if |predicted - answer| < range = 2)
//vRight = count if there is an event or not
//pRight = countTrue if correctly predict if there is an insertion/or a deletion
int pCount = 0;
int delTP = 0, delTN = 0, delFP = 0, delFN = 0; //deletion
int insTP = 0, insTN = 0, insFP = 0, insFN = 0; //insertion
int idTP = 0, idTN = 0, idFP = 0, idFN = 0 ; //indels in general
TandemRepeatVariant pStr = null;
int total = 0;
for (int i = 0; i < ansList.size(); i++){
TandemRepeatVariant ans = ansList.get(i);
if (ans.getEnd() - ans.getStart() + 1 < minLen) continue;
if (ans.getEnd() - ans.getStart()+ 1 > maxLen) continue;
total ++;
double predicted = 0.0;
//if (pStr == null && pInd < pList.size()){
// pStr = pList.get(pInd);
// pInd ++;
//}
while ((pStr == null || ans.compareTo(pStr) > 0) && (pInd < pList.size())){
pStr = pList.get(pInd);
pInd ++;
}
if (pStr != null && ans.compareTo(pStr) == 0){
//if (ans.chr.equals(pStr.chr) && ans.start == pStr.start && ans.end == pStr.end){
predicted = pStr.getVar();
pCount ++;
pStr = null;
//}
}
if (Math.round(predicted) == Math.round(ans.getVar()))
sRight ++;
if (Math.round(predicted) == Math.round(ans.getVar()))
pRight ++;
else if (Math.round(predicted) * Math.round(ans.getVar()) > 0)
pRight ++;
if (Math.round(predicted) == Math.round(ans.getVar()))
vRight ++;
else if (Math.round(predicted) * Math.round(ans.getVar()) != 0)
vRight ++;
if (Math.abs(predicted - ans.getVar()) <= range)
rRight ++;
SSE += (predicted - ans.getVar()) * (predicted - ans.getVar());
if (ans.getVar() > 0.5){//an insertion
if (predicted > 0.5){//predicted as an insertion
insTP ++;
delTN ++;
idTP ++;
}else if (predicted < -0.5){//predicted as a deletion
insFN ++;//
delFP ++;
idTP ++;
}else{//predicted as no indel
insFN ++;
delTN ++;
idFN++;
}
}else if (ans.getVar() < -0.5){//a deletion
if (predicted > 0.5){//predicted as an insertion
insFP ++;
delFN ++;
idTP ++;
}else if (predicted < -0.5){//predicted as a deletion
insTN ++;//
delTP ++;
idTP ++;
}else{//predicted as no indel
insTN ++;
delFN ++;
idFN++;
}
}else{//no indels
if (predicted > 0.5){//predicted as an insertion
insFP ++;
delTN ++;
idFP ++;
}else if (predicted < -0.5){//predicted as a deletion
insTN ++;//
delFP ++;
idFP ++;
}else{//predicted as no indel
insTN ++;
delTN ++;
idTN++;
}
}
}
//int total = ansList.size();
double insSn = 1.0* insTP/(insTP + insFN); //= recall
double insSp = 1.0* insTN/(insTN + insFP);
double insPv = 1.0* insTP/(insTP + insFP);
double insAc = 1.0* (insTP + insTN)/(insTP + insTN + insFP + insFN);
double insF1 = 2* insPv * insSn / (insPv + insSn);
double delSn = 1.0* delTP/(delTP + delFN);
double delSp = 1.0* delTN/(delTN + delFP);
double delPv = 1.0* delTP/(delTP + delFP);
double delAc = 1.0* (delTP + delTN)/(delTP + delTN + delFP + delFN);
double delF1 = 2* delPv * delSn / (delPv + delSn);
double idSn = 1.0* idTP/(idTP + idFN);
double idSp = 1.0* idTN/(idTN + idFP);
double idPv = 1.0* idTP/(idTP + idFP);
double idAc = 1.0* (idTP + idTN)/(idTP + idTN + idFP + idFN);
double idF1 = 2* idPv * idSn / (idPv + idSn);
System.out.println("##Compare " + pCount + " records ( out of " + pList.size() + ") against " + total + " (" + (idTP + idTN + idFP + idFN) +")");
System.out.printf("%5.2f%%\t%5.2f%%\t%5.2f%%\t%5.2f%%\t%6.4f\t",100.0 * sRight/total, 100.0*rRight/total, 100.0*pRight/total, 100.0*vRight/total, Math.sqrt(SSE/total));
System.out.printf("%6.4f\t%6.4f\t%6.4f\t%6.4f\t%6.4f\t",idSp, idSn, idPv, idAc, idF1);
System.out.printf("%6.4f\t%6.4f\t%6.4f\t%6.4f\t%6.4f\t",insSp, insSn, insPv, insAc, insF1);
System.out.printf("%6.4f\t%6.4f\t%6.4f\t%6.4f\t%6.4f\n",delSp, delSn, delPv, delAc, delF1);
}
public static TandemRepeatVariant readLobSTR(String line){
if (line == null) return null;
TandemRepeatVariant tr = new TandemRepeatVariant();
String [] toks = line.trim().split("\\t");
tr.getTandemRepeat().setChr(toks[0]);
tr.getTandemRepeat().setStart(Integer.parseInt(toks[1]));
tr.getTandemRepeat().setEnd(Integer.parseInt(toks[2]));
tr.getTandemRepeat().setPeriod(Integer.parseInt(toks[4]));
String[] alle = toks[6].split(",");
tr.setVar(((Double.parseDouble(alle[0]) + Double.parseDouble(alle[1])) / tr.getPeriod()) / 2);
//tr.setConfidence(confidence);
return tr;
}
}
| [
"minhduc.cao@gmail.com"
] | minhduc.cao@gmail.com |
75e271c9f0fe744d55f253fd7378ad99b3fe75ee | a068ab3abb81982ae308913237195d28499dc541 | /src/main/java/com/vnua/meozz/model/LoadingIndicatorDialog.java | d30170cf737c1d5333144b7d5c7e2789c256e42a | [] | no_license | ducmanh2802/VNUASchedule | 4ad954bcccd5382fdf87161007e7bedb76237251 | 5beb8299e04820de7f793b8a1bc0ef0d9f489f95 | refs/heads/master | 2023-03-17T20:36:06.571220 | 2021-03-10T09:08:05 | 2021-03-10T09:08:05 | 335,980,151 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,860 | java | package com.vnua.meozz.model;
import java.util.function.Consumer;
import java.util.function.ToIntFunction;
import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import javafx.concurrent.Task;
import javafx.concurrent.WorkerStateEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.ProgressIndicator;
import javafx.scene.effect.ColorAdjust;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javafx.stage.Window;
public class LoadingIndicatorDialog<P> {
private Task animationWorker;
private Task<Integer> taskWorker;
private final ProgressIndicator progressIndicator = new ProgressIndicator(ProgressIndicator.INDETERMINATE_PROGRESS);
private final Stage dialog = new Stage(StageStyle.TRANSPARENT);
private final Label label = new Label();
private final Group root = new Group();
private Scene scene = new Scene(root, 330, 520, Color.TRANSPARENT);
private final BorderPane mainPane = new BorderPane();
private final VBox vbox = new VBox();
/**
* Placing a listener on this list allows to get notified BY the result when the
* task has finished.
*/
public ObservableList<Integer> resultNotificationList = FXCollections.observableArrayList();
public Integer resultValue;
public LoadingIndicatorDialog(Window owner) {
// if(minLengthScreen>0) {
// scene = new Scene(root, minLengthScreen+150, 120, Color.TRANSPARENT);
// }
dialog.initModality(Modality.WINDOW_MODAL);
dialog.initOwner(owner);
dialog.setResizable(false);
dialog.setOpacity(0.75);
ColorAdjust adjust = new ColorAdjust();
// Green HUE value
adjust.setHue(-0.4);
// progressIndicator.setEffect(adjust);
progressIndicator.setStyle(" -fx-progress-color: #FF2424;"); // #3DB5A1, #17E7A1, #00F1B4, #FFEE1C, #FFDF1C, #FF0047
// progressIndicator.setPadding(new Insets(30, 0, 0, 0));
}
/**
*
*/
public void addTaskEndNotification(Consumer<Integer> c) {
resultNotificationList.addListener((ListChangeListener<? super Integer>) n -> {
resultNotificationList.clear();
c.accept(resultValue);
});
}
/**
*
*/
public void exec(P parameter, ToIntFunction func) {
setupDialog();
setupAnimationThread();
setupWorkerThread(parameter, func);
}
/**
*
*/
private void setupDialog() {
// mainPane.setStyle("-fx-background-color:#ADFF30");
root.getChildren().add(mainPane);
vbox.setSpacing(5);
vbox.setAlignment(Pos.CENTER);
// vbox.setStyle("-fx-background-color:#B3B3B3");
vbox.setPadding(new Insets(100, 0, 0, 0));
// if(minLengthScreen>0) {
// vbox.setMinSize(minLengthScreen+150, 130);
// } else {
vbox.setMinSize(330, 520);
// }
vbox.getChildren().addAll(progressIndicator);
mainPane.setTop(vbox);
dialog.setScene(scene);
dialog.setOnHiding(event -> {
/*
* Gets notified when task ended, but BEFORE result value is attributed. Using
* the observable list above is recommended.
*/ });
dialog.show();
}
/**
*
*/
private void setupAnimationThread() {
animationWorker = new Task() {
@Override
protected Object call() throws Exception {
/*
* This is activated when we have a "progressing" indicator. This thread is used
* to advance progress every XXX milliseconds. In case of an
* INDETERMINATE_PROGRESS indicator, it's not of use. for (int i=1;i<=100;i++) {
* Thread.sleep(500); updateMessage(); updateProgress(i,100); }
*/
return true;
}
};
progressIndicator.setProgress(0);
progressIndicator.progressProperty().unbind();
progressIndicator.progressProperty().bind(animationWorker.progressProperty());
animationWorker.messageProperty().addListener((observable, oldValue, newValue) -> {
// Do something when the animation value ticker has changed
});
new Thread(animationWorker).start();
}
/**
*
*/
private void setupWorkerThread(P parameter, ToIntFunction<P> func) {
taskWorker = new Task<Integer>() {
@Override
public Integer call() {
return func.applyAsInt(parameter);
}
};
EventHandler<WorkerStateEvent> eh = event -> {
animationWorker.cancel(true);
progressIndicator.progressProperty().unbind();
dialog.close();
try {
resultValue = taskWorker.get();
resultNotificationList.add(resultValue);
} catch (Exception e) {
throw new RuntimeException(e);
}
};
taskWorker.setOnSucceeded(eh);
taskWorker.setOnFailed(eh);
new Thread(taskWorker).start();
}
/**
* For those that like beans :)
*/
public Integer getResultValue() {
return resultValue;
}
}
| [
"ducmanhtb2802@gmail.com"
] | ducmanhtb2802@gmail.com |
f479c53ddcc0184c2bcde2976d4394702e686e39 | 327dbffc05948c4f983793c04c93fb17087e7eb2 | /BuildshopFramework/src/test/java/com/application/pages/SuperPage.java | 485c479f4301d260e53a1fde0f9cd2d9c9957130 | [] | no_license | Divyashree-g/BuildShop_New | 5be28acc5873f32cbb702baee825608d024d51de | 18792f62728d560a72f03a1e2d3435c82714fcca | refs/heads/master | 2021-01-12T02:47:36.599506 | 2017-01-23T06:50:34 | 2017-01-23T06:50:34 | 78,104,972 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,925 | java | package com.application.pages;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
// TODO: Auto-generated Javadoc
/**
* The Class SuperPage.
*/
public class SuperPage {
/** The driver. */
WebDriver driver;
/**
* Instantiates a new super page.
*
* @param driver the driver
*/
public SuperPage(WebDriver driver)
{
this.driver=driver;
PageFactory.initElements(driver, this);
}
/** The Home page messages link. */
@FindBy(id="ctl00_pnlCommunication")
private WebElement HomePageMessagesLink;
/** The Home page project set up link. */
@FindBy(id="ctl00_pnlSetUp")
private WebElement HomePageProjectSetUpLink;
/** The Home page plan link. */
@FindBy(id="ctl00_pnlPlan")
private WebElement HomePagePlanLink;
/** The Home page procure link. */
@FindBy(id="ctl00_pnlProcurement")
private WebElement HomePageProcureLink;
/** The Home page manage link. */
@FindBy(id="ctl00_pnlManage")
private WebElement HomePageManageLink;
/** The Home page financial link. */
@FindBy(id="ctl00_pnlFinancial")
private WebElement HomePageFinancialLink;
/** The Home page field 360 link. */
@FindBy(id="ctl00_pnlService")
private WebElement HomePageField360Link;
/** The Home page inventory link. */
@FindBy(id="ctl00_pnlInventory")
private WebElement HomePageInventoryLink;
/** The Home page logs link. */
@FindBy(id="ctl00_pnlLogs")
private WebElement HomePageLogsLink;
/** The Home page vehical logs link. */
@FindBy(id="ctl00_pnlVehicles")
private WebElement HomePageVehicalLogsLink;
/** The Home page time sheet link. */
@FindBy(id="ctl00_pnlTimesheet")
private WebElement HomePageTimeSheetLink;
/** The Home page documents link. */
@FindBy(id="ctl00_pnlDocuments")
private WebElement HomePageDocumentsLink;
/** The Home page design link. */
@FindBy(id="ctl00_pnlDesign")
private WebElement HomePageDesignLink;
/** The Home page contacts link. */
@FindBy(id="ctl00_pnlContacts")
private WebElement HomePageContactsLink;
/** The Home page reports link. */
@FindBy(id="ctl00_pnlReports")
private WebElement HomePageReportsLink;
/** The Home page templates link. */
@FindBy(id="ctl00_pnlTemplates")
private WebElement HomePageTemplatesLink;
/** The Home page warranty link. */
@FindBy(id="ctl00_pnlWarranty")
private WebElement HomePageWarrantyLink;
/** The Home page bid center link. */
@FindBy(id="ctl00_pnlBids")
private WebElement HomePageBidCenterLink;
/**
* Click on messages link.
*/
public void clickOnMessagesLink()
{
HomePageMessagesLink.click();
}
/**
* Click on project set up link.
*/
public void clickOnProjectSetUpLink()
{
HomePageProjectSetUpLink.click();
}
/**
* Click on plan link.
*/
public void clickOnPlanLink()
{
HomePagePlanLink.click();
}
/**
* Click on procure link.
*/
public void clickOnProcureLink()
{
HomePageProcureLink.click();
}
/**
* Click on manage link.
*/
public void clickOnManageLink()
{
HomePageManageLink.click();
}
/**
* Click on financial link.
*/
public void clickOnFinancialLink()
{
HomePageFinancialLink.click();
}
/**
* Click on field 360 link.
*/
public void clickOnField360Link()
{
HomePageField360Link.click();
}
/**
* Click on inventory link.
*/
public void clickOnInventoryLink()
{
HomePageInventoryLink.click();
}
/**
* Click on logs link.
*/
public void clickOnLogsLink()
{
HomePageLogsLink.click();
}
/**
* Click on vehical logs link.
*/
public void clickOnVehicalLogsLink()
{
HomePageVehicalLogsLink.click();
}
/**
* Click on time sheet link.
*/
public void clickOnTimeSheetLink()
{
HomePageTimeSheetLink.click();
}
/**
* Click on documents link.
*/
public void clickOnDocumentsLink()
{
HomePageDocumentsLink.click();
}
/**
* Click on design link.
*/
public void clickOnDesignLink()
{
HomePageDesignLink.click();
}
/**
* Click on contacts link.
*/
public void clickOnContactsLink()
{
HomePageContactsLink.click();
}
/**
* Click on reports link.
*/
public void clickOnReportsLink()
{
HomePageReportsLink.click();
}
/**
* Click on templates link.
*/
public void clickOnTemplatesLink()
{
HomePageTemplatesLink.click();
}
/**
* Click on warranty link.
*/
public void clickOnWarrantyLink()
{
HomePageWarrantyLink.click();
}
/**
* Click on bid center link.
*/
public void clickOnBidCenterLink()
{
HomePageBidCenterLink.click();
}
}
| [
"noreply@github.com"
] | noreply@github.com |
9a966a51bae988dab88f4229d5918b0490cb9dea | 2d9bb3af6d89aed5036fe4e7336aca6ca7358313 | /egakat-io-conciliaciones-commons/src/main/java/com/egakat/io/conciliaciones/repository/SaldoInventarioRepository.java | 66346191d07ba2d095322b6af92d435bb7c174c5 | [] | no_license | github-ek/egakat-io-conciliaciones | b95500c26c3e668358384c1d3a6ba4f85232a886 | 310da3844ce92afa3fa83489f1d6cd9f8d55bbd2 | refs/heads/master | 2021-06-09T20:35:22.972145 | 2019-09-23T04:00:42 | 2019-09-23T04:00:42 | 133,686,502 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 703 | java | package com.egakat.io.conciliaciones.repository;
import java.util.List;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import com.egakat.integration.commons.archivos.enums.EstadoRegistroType;
import com.egakat.integration.commons.archivos.repository.RegistroRepository;
import com.egakat.io.conciliaciones.domain.SaldoInventario;
public interface SaldoInventarioRepository extends RegistroRepository<SaldoInventario> {
@Override
@Query("SELECT DISTINCT a.idArchivo FROM SaldoInventario a WHERE a.estado IN (:estados) ORDER BY a.idArchivo")
List<Long> findAllArchivoIdByEstadoIn(@Param("estados") List<EstadoRegistroType> estado);
}
| [
"esb.ega.kat@gmail.com"
] | esb.ega.kat@gmail.com |
972eed5b2f0f3f01e6516e0a8ac4b705c9b75084 | 03a26523c98f98efe88c79c09a0323d22a208619 | /EvryBank/src/com/evryindia/common/dao/AdminOperationDao.java | f873225553b55d3dd9b3f39d4c555d72219da25e | [] | no_license | evrytrainingbatch01/rashmi_evrybank | d100a15e88b072520a8ec6cd647488ba8b74678c | 6c8f0e1a55f768758d563595efd5c8fcaf8a6e82 | refs/heads/master | 2020-04-30T06:42:46.552923 | 2019-03-23T02:56:33 | 2019-03-23T02:56:33 | 176,660,196 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 696 | java | /**
*
*/
package com.evryindia.common.dao;
import java.sql.SQLException;
import java.util.ArrayList;
import com.evryindia.foundation.domain.Customer;
import com.evryindia.foundation.domain.Transaction;
/**
* @author rashmi.kiran
*
*/
public interface AdminOperationDao {
void addCustomer(Customer customerId) throws SQLException;
void deleteCustomer (Customer customerId) throws SQLException;
void addMoney(Transaction t);
void approveTransaction(Transaction t);
void provideLoan(Customer customerId,Transaction t);
ArrayList<Customer> viewCustomersDetails(ArrayList<Customer> customerList) throws SQLException;
ArrayList<Customer> listAllCustomers() throws SQLException;
}
| [
"rashmi.kiran@spanservices.com"
] | rashmi.kiran@spanservices.com |
ebee4de825713c72a27286ffdb10ea4d0d7e9079 | 1c506ca86b7752f6eea028d59e14258fe509156e | /Magento/src/pageObjPattern/Analyzer.java | 8e74850067c301cffc3650f06d948be385dd50ec | [] | no_license | halyavka/ufg_tools_all_in_one | 9a6a6e3ecc3779d73f14f2e7272d25eb6b37ecb9 | 2756b7df89fba5708a655b4230e439b7c34a08b4 | refs/heads/master | 2021-01-23T03:12:20.036259 | 2014-08-12T22:55:06 | 2014-08-12T22:55:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,087 | java | package pageObjPattern;
import org.apache.log4j.Logger;
import org.testng.ITestResult;
import org.testng.util.RetryAnalyzerCount;
import java.util.concurrent.atomic.AtomicInteger;
/**
* Created with IntelliJ IDEA.
* User: ivan.halyavka
* Date: 8/5/13
* Time: 1:05 PM
* To change this template use File | Settings | File Templates.
*/
public class Analyzer extends RetryAnalyzerCount {
protected static Logger LOG = Logger.getLogger(TestsAnalyser.class);
public int getCount() {
return this.count.get();
}
private AtomicInteger count = new AtomicInteger(0);
private static final int MAX_COUNT = 1;
public Analyzer() {
setCount(MAX_COUNT);
}
@Override
public boolean retryMethod(ITestResult result) {
if (count.intValue() < MAX_COUNT) {
LOG.info("Error in " + result.getName() + " with status "
+ result.getStatus() + " Retrying " +(count.intValue()+1) + " times of "+MAX_COUNT);
count.getAndIncrement();
return true;
}
return false;
}
} | [
"vanle@ukr.net"
] | vanle@ukr.net |
0df7d958c9f7925069c05e1871ffae93c234c682 | d313fbac43cb46a10fede535502e5b3e1dcc180a | /config-client/src/main/java/com/example/configclient/ConfigClientApplication.java | 925baaffc3ee85aa665600b7ebec7745fc9511ef | [] | no_license | cctga/maven-parent | 95c8e5029863955e48c7b791a5204b45891808e4 | 737f726744e7350267ca767fa8a62c7ceead4199 | refs/heads/master | 2022-12-13T00:17:36.760789 | 2020-09-10T10:55:44 | 2020-09-10T10:55:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 361 | java | package com.example.configclient;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @author maoludong
*/
@SpringBootApplication
public class ConfigClientApplication {
public static void main(String[] args) {
SpringApplication.run(ConfigClientApplication.class, args);
}
}
| [
"1135892360@qq.com"
] | 1135892360@qq.com |
5ae027b7a72a3ed484508c3dbff809954b13ac55 | 38320e5163cc9c458a473918f794db365983bc33 | /HljHome/.svn/pristine/3a/3a8750b6c3861002f04e6e11cc65d5ad133ff913.svn-base | a8d5f64d88e2e049600f72c5cf5bcae525b638e0 | [] | no_license | Catherinelhl/HLJHome | a79e1236bbf722877c3de9562ceddcabe8834cda | e249d91a37d6be5c5dc4e85c8d02af944e82be25 | refs/heads/master | 2021-05-28T23:36:13.742995 | 2015-05-27T02:43:00 | 2015-05-27T02:43:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,570 | package com.hlj.widget;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import com.hlj.utils.CommonTools;
import com.hlj.utils.Logger;
import com.hlj.view.CustomProgressDialog;
import com.hlj.widget.MediaController.MediaPlayerControl;
import com.live.video.constans.Constants;
import com.live.video.constans.HomeConstants;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Rect;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnCompletionListener;
import android.media.MediaPlayer.OnErrorListener;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.View.MeasureSpec;
import android.view.ViewGroup.LayoutParams;
import android.widget.FrameLayout;
/**
* 针对普通播放的VideoView
*
* @author huangyuchao
*
*/
public class VideoView extends SurfaceView implements MediaPlayerControl {
private Context mContext;
private String mUri = "";
private int mDuration;
// All the stuff we need for playing and showing a video
private SurfaceHolder mSurfaceHolder = null;
private MediaPlayer mMediaPlayer = null;
private boolean mIsPrepared;
public static int mVideoWidth;
public static int mVideoHeight;
private int mSurfaceWidth;
private int mSurfaceHeight;
private MediaController mMediaController;
public OnCompletionListener mOnCompletionListener;
private MediaPlayer.OnPreparedListener mOnPreparedListener;
private int mCurrentBufferPercentage;
private OnErrorListener mOnErrorListener;
private boolean mStartWhenPrepared;
private int mSeekWhenPrepared;
private MySizeChangeLinstener mMyChangeLinstener;
public int getVideoWidth() {
return mVideoWidth;
}
public int getVideoHeight() {
return mVideoHeight;
}
public void setVideoScale(int width, int height) {
LayoutParams lp = getLayoutParams();
lp.height = height;
lp.width = width;
setLayoutParams(lp);
}
public interface MySizeChangeLinstener {
public void doMyThings();
}
public void setMySizeChangeLinstener(MySizeChangeLinstener l) {
mMyChangeLinstener = l;
}
public VideoView(Context context) {
super(context);
mContext = context;
initVideoView();
}
public VideoView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
mContext = context;
initVideoView();
}
public VideoView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
mContext = context;
initVideoView();
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
// Log.i("@@@@", "onMeasure");
int width = getDefaultSize(mVideoWidth, widthMeasureSpec);
int height = getDefaultSize(mVideoHeight, heightMeasureSpec);
setMeasuredDimension(width, height);
}
public void setVideofullScale(int width, int height) {
FrameLayout.LayoutParams lp = (android.widget.FrameLayout.LayoutParams) getLayoutParams();
lp.height = height;
lp.width = width;
lp.setMargins(0, 0, 0, 0);
setLayoutParams(lp);
getHolder().setFixedSize(width, height);
// requestLayout();
// invalidate();
}
public void setVideoDefaultScale(int width, int height) {
FrameLayout.LayoutParams lp = (android.widget.FrameLayout.LayoutParams) getLayoutParams();
lp.height = height;
lp.width = width;
lp.setMargins(258, 85, 0, 0);
setLayoutParams(lp);
getHolder().setFixedSize(width, height);
// requestLayout();
// invalidate();
}
public int resolveAdjustedSize(int desiredSize, int measureSpec) {
int result = desiredSize;
int specMode = MeasureSpec.getMode(measureSpec);
int specSize = MeasureSpec.getSize(measureSpec);
switch (specMode) {
case MeasureSpec.UNSPECIFIED:
result = desiredSize;
break;
case MeasureSpec.AT_MOST:
result = Math.min(desiredSize, specSize);
break;
case MeasureSpec.EXACTLY:
// No choice. Do what we are told.
result = specSize;
break;
}
return result;
}
private CustomProgressDialog dialog;
private WindowManager wm;
private void initVideoView() {
mVideoWidth = 0;
mVideoHeight = 0;
getHolder().addCallback(mSHCallback);
getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
setFocusable(true);
setFocusableInTouchMode(true);
requestFocus();
//wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
dialog = new CustomProgressDialog(mContext);
}
public void setVideoPath(String path) {
setVideoURI(path);
}
public void setVideoURI(String uri) {
mUri = uri;
mStartWhenPrepared = false;
mSeekWhenPrepared = 0;
openVideo();
requestLayout();
invalidate();
}
public void stopPlayback() {
if (mMediaPlayer != null) {
mMediaPlayer.stop();
mMediaPlayer.release();
mMediaPlayer = null;
}
}
private void openVideo() {
if (mUri == null || mSurfaceHolder == null) {
return;
}
if (mMediaPlayer != null) {
mMediaPlayer.reset();
mMediaPlayer.release();
mMediaPlayer = null;
}
try {
mMediaPlayer = new MediaPlayer();
mMediaPlayer.setOnPreparedListener(mPreparedListener);
mMediaPlayer.setOnVideoSizeChangedListener(mSizeChangedListener);
mMediaPlayer.setOnInfoListener(mInfoListener);
mIsPrepared = false;
Logger.log("reset duration to -1 in openVideo");
mDuration = -1;
mMediaPlayer.setOnCompletionListener(mCompletionListener);
mMediaPlayer.setOnErrorListener(mErrorListener);
mMediaPlayer.setOnBufferingUpdateListener(mBufferingUpdateListener);
mCurrentBufferPercentage = 0;
// mMediaPlayer.setDataSource(mUri);
if (Constants.isDefaultPlay == 4 || mUri.contains("tongzhuo100")) {
Map<String, String> headers = new HashMap<String, String>();
headers.put("Cookie", CommonTools.getCookie(mContext));
// headers.put("fastweb_title", "fastwebtongzhuo100");
mMediaPlayer.setDataSource(mUri, headers);
} else {
mMediaPlayer.setDataSource(mUri);
}
mMediaPlayer.setDisplay(mSurfaceHolder);
mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mMediaPlayer.setScreenOnWhilePlaying(true);
mMediaPlayer.prepareAsync();
attachMediaController();
} catch (IOException ex) {
Logger.log("Unable to open content: " + mUri + ex.toString());
return;
} catch (IllegalArgumentException ex) {
Logger.log("Unable to open content: " + mUri + ex.toString());
return;
}
}
MediaPlayer.OnInfoListener mInfoListener = new MediaPlayer.OnInfoListener() {
@Override
public boolean onInfo(MediaPlayer mp, int what, int extra) {
WindowManager.LayoutParams params = new WindowManager.LayoutParams();
params.gravity = Gravity.CENTER;
params.width = LayoutParams.WRAP_CONTENT;
params.height = LayoutParams.WRAP_CONTENT;
Logger.log("what:" + what + ",extra:" + extra);
switch (what) {
case MediaPlayer.MEDIA_INFO_BUFFERING_START:
if (dialog != null && !dialog.isShowing()) {
dialog.show();
}
break;
case MediaPlayer.MEDIA_INFO_BUFFERING_END:
if (dialog != null && dialog.isShowing()) {
dialog.cancel();
}
break;
case MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START:
if (dialog != null && dialog.isShowing()) {
dialog.cancel();
}
break;
}
return true;
}
};
public void setMediaController(MediaController controller) {
if (mMediaController != null) {
mMediaController.hide();
}
mMediaController = controller;
attachMediaController();
}
private void attachMediaController() {
if (mMediaPlayer != null && mMediaController != null) {
mMediaController.setMediaPlayer(this);
View anchorView = this.getParent() instanceof View ? (View) this
.getParent() : this;
mMediaController.setAnchorView(anchorView);
mMediaController.setEnabled(mIsPrepared);
}
}
MediaPlayer.OnVideoSizeChangedListener mSizeChangedListener = new MediaPlayer.OnVideoSizeChangedListener() {
public void onVideoSizeChanged(MediaPlayer mp, int width, int height) {
mVideoWidth = mp.getVideoWidth();
mVideoHeight = mp.getVideoHeight();
if (mMyChangeLinstener != null) {
mMyChangeLinstener.doMyThings();
}
if (mVideoWidth != 0 && mVideoHeight != 0) {
getHolder().setFixedSize(mVideoWidth, mVideoHeight);
}
}
};
MediaPlayer.OnPreparedListener mPreparedListener = new MediaPlayer.OnPreparedListener() {
public void onPrepared(MediaPlayer mp) {
// briefly show the mediacontroller
mIsPrepared = true;
if (mOnPreparedListener != null) {
mOnPreparedListener.onPrepared(mMediaPlayer);
}
if (mMediaController != null) {
mMediaController.setEnabled(true);
}
mVideoWidth = mp.getVideoWidth();
mVideoHeight = mp.getVideoHeight();
if (mVideoWidth != 0 && mVideoHeight != 0) {
// Log.i("@@@@", "video size: " + mVideoWidth +"/"+
// mVideoHeight);
getHolder().setFixedSize(mVideoWidth, mVideoHeight);
if (mSurfaceWidth == mVideoWidth
&& mSurfaceHeight == mVideoHeight) {
// We didn't actually change the size (it was already at the
// size
// we need), so we won't get a "surface changed" callback,
// so
// start the video here instead of in the callback.
if (mSeekWhenPrepared != 0) {
mMediaPlayer.seekTo(mSeekWhenPrepared);
mSeekWhenPrepared = 0;
}
if (mStartWhenPrepared) {
mMediaPlayer.start();
mStartWhenPrepared = false;
if (mMediaController != null) {
mMediaController.show();
}
} else if (!isPlaying()
&& (mSeekWhenPrepared != 0 || getCurrentPosition() > 0)) {
if (mMediaController != null) {
// Show the media controls when we're paused into a
// video and make 'em stick.
mMediaController.show(0);
}
}
}
} else {
// We don't know the video size yet, but should start anyway.
// The video size might be reported to us later.
if (mSeekWhenPrepared != 0) {
mMediaPlayer.seekTo(mSeekWhenPrepared);
mSeekWhenPrepared = 0;
}
if (mStartWhenPrepared) {
mMediaPlayer.start();
mStartWhenPrepared = false;
}
}
}
};
private MediaPlayer.OnCompletionListener mCompletionListener = new MediaPlayer.OnCompletionListener() {
public void onCompletion(MediaPlayer mp) {
if (mMediaController != null) {
mMediaController.hide();
}
if (mOnCompletionListener != null) {
mOnCompletionListener.onCompletion(mMediaPlayer);
}
}
};
private MediaPlayer.OnErrorListener mErrorListener = new MediaPlayer.OnErrorListener() {
public boolean onError(MediaPlayer mp, int framework_err, int impl_err) {
Logger.log("Error: " + framework_err + "," + impl_err);
if (mMediaController != null) {
mMediaController.hide();
}
/* If an error handler has been supplied, use it and finish. */
if (mOnErrorListener != null) {
if (mOnErrorListener.onError(mMediaPlayer, framework_err,
impl_err)) {
return true;
}
}
if (getWindowToken() != null) {
Resources r = mContext.getResources();
int messageId;
}
return true;
}
};
private MediaPlayer.OnBufferingUpdateListener mBufferingUpdateListener = new MediaPlayer.OnBufferingUpdateListener() {
public void onBufferingUpdate(MediaPlayer mp, int percent) {
mCurrentBufferPercentage = percent;
}
};
/**
* Register a callback to be invoked when the media file is loaded and ready
* to go.
*
* @param l
* The callback that will be run
*/
public void setOnPreparedListener(MediaPlayer.OnPreparedListener l) {
mOnPreparedListener = l;
}
/**
* Register a callback to be invoked when the end of a media file has been
* reached during playback.
*
* @param l
* The callback that will be run
*/
public void setOnCompletionListener(OnCompletionListener l) {
mOnCompletionListener = l;
}
/**
* Register a callback to be invoked when an error occurs during playback or
* setup. If no listener is specified, or if the listener returned false,
* VideoView will inform the user of any errors.
*
* @param l
* The callback that will be run
*/
public void setOnErrorListener(OnErrorListener l) {
mOnErrorListener = l;
}
SurfaceHolder.Callback mSHCallback = new SurfaceHolder.Callback() {
public void surfaceChanged(SurfaceHolder holder, int format, int w,
int h) {
mSurfaceWidth = w;
mSurfaceHeight = h;
if (mMediaPlayer != null && mIsPrepared && mVideoWidth == w
&& mVideoHeight == h) {
if (mSeekWhenPrepared != 0) {
mMediaPlayer.seekTo(mSeekWhenPrepared);
mSeekWhenPrepared = 0;
}
mMediaPlayer.start();
if (mMediaController != null) {
mMediaController.show();
}
}
}
public void surfaceCreated(SurfaceHolder holder) {
mSurfaceHolder = holder;
openVideo();
}
public void surfaceDestroyed(SurfaceHolder holder) {
// after we return from this we can't use the surface any more
mSurfaceHolder = null;
if (mMediaController != null)
mMediaController.hide();
if (mMediaPlayer != null) {
mMediaPlayer.reset();
mMediaPlayer.release();
mMediaPlayer = null;
}
}
};
@Override
public boolean onTouchEvent(MotionEvent ev) {
if (mIsPrepared && mMediaPlayer != null && mMediaController != null) {
toggleMediaControlsVisiblity();
}
return false;
}
@Override
public boolean onTrackballEvent(MotionEvent ev) {
if (mIsPrepared && mMediaPlayer != null && mMediaController != null) {
toggleMediaControlsVisiblity();
}
return false;
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (mIsPrepared && keyCode != KeyEvent.KEYCODE_BACK
&& keyCode != KeyEvent.KEYCODE_VOLUME_UP
&& keyCode != KeyEvent.KEYCODE_VOLUME_DOWN
&& keyCode != KeyEvent.KEYCODE_MENU
&& keyCode != KeyEvent.KEYCODE_CALL
&& keyCode != KeyEvent.KEYCODE_ENDCALL && mMediaPlayer != null
&& mMediaController != null) {
if (keyCode == KeyEvent.KEYCODE_HEADSETHOOK
|| keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE) {
if (mMediaPlayer.isPlaying()) {
pause();
mMediaController.show();
} else {
start();
mMediaController.hide();
}
return true;
} else if (keyCode == KeyEvent.KEYCODE_MEDIA_STOP
&& mMediaPlayer.isPlaying()) {
pause();
mMediaController.show();
} else {
toggleMediaControlsVisiblity();
}
}
return super.onKeyDown(keyCode, event);
}
private void toggleMediaControlsVisiblity() {
// if (mMediaController.isShowing()) {
// mMediaController.hide();
// } else {
mMediaController.show();
// }
}
public void start() {
if (mMediaPlayer != null && mIsPrepared) {
mMediaPlayer.start();
mStartWhenPrepared = false;
} else {
mStartWhenPrepared = true;
}
}
public void pause() {
if (mMediaPlayer != null && mIsPrepared) {
if (mMediaPlayer.isPlaying()) {
mMediaPlayer.pause();
}
}
mStartWhenPrepared = false;
}
public long getDuration() {
if (mMediaPlayer != null && mIsPrepared) {
if (mDuration > 0) {
return mDuration;
}
mDuration = mMediaPlayer.getDuration();
return mDuration;
}
mDuration = -1;
return mDuration;
}
public long getCurrentPosition() {
if (mMediaPlayer != null && mIsPrepared) {
return mMediaPlayer.getCurrentPosition();
}
return 0;
}
public void seekTo(int msec) {
if (mMediaPlayer != null && mIsPrepared) {
mMediaPlayer.seekTo(msec);
} else {
mSeekWhenPrepared = msec;
}
}
public boolean isPlaying() {
if (mMediaPlayer != null && mIsPrepared) {
return mMediaPlayer.isPlaying();
}
return false;
}
public int getBufferPercentage() {
if (mMediaPlayer != null) {
return mCurrentBufferPercentage;
}
return 0;
}
public final static int A_DEFALT = 0; // 原始比例
public final static int A_4X3 = 1;
public final static int A_16X9 = 2;
public final static int A_RAW = 4; // 原始大小
/**
* 全屏状态才可以使用选择比例
*
* @param flg
*/
public void selectScales(int flg) {
if (getWindowToken() != null) {
Rect rect = new Rect();
getWindowVisibleDisplayFrame(rect);
Logger.log("Rect = " + rect.top + ":" + rect.bottom + ":"
+ rect.left + ":" + rect.right);
double height = rect.bottom - rect.top;
double width = rect.right - rect.left;
Logger.log("diplay = " + width + ":" + height);
Logger.log("diplay video = " + mVideoWidth + ":" + mVideoHeight);
if (height <= 0.0 || width <= 0.0 || mVideoHeight <= 0.0
|| mVideoWidth <= 0.0) {
return;
}
ViewGroup.LayoutParams param = getLayoutParams();
switch (flg) {
case A_DEFALT:
if (width / height >= mVideoWidth / mVideoHeight) { //
// 屏幕 宽了以屏幕高为基础
param.height = (int) height;
param.width = (int) (mVideoWidth * height / mVideoHeight);
} else { // 屏幕 高了 以宽为基础
param.width = (int) width;
param.height = (int) (mVideoHeight * width / mVideoWidth);
}
Logger.log("A_DEFALT === " + param.width + ":" + param.height);
setLayoutParams(param);
break;
case A_4X3:
if (width / height >= 4.0 / 3.0) {
// 屏幕 宽了 以屏幕高为基础
param.height = (int) height;
param.width = (int) (4 * height / 3);
} else { // 屏幕 高了 以宽为基础
param.width = (int) width;
param.height = (int) (3 * width / 4);
}
Logger.log("A_4X3 === " + param.width + ":" + param.height);
setLayoutParams(param);
break;
case A_16X9:
if (width / height >= 16.0 / 9.0) {
// 屏幕 宽了 以屏幕高为基础
param.height = (int) height;
param.width = (int) (16 * height / 9);
} else { // 屏幕 高了 以宽为基础
param.width = (int) width;
param.height = (int) (9 * width / 16);
}
Logger.log("A_16X9 === " + param.width + ":" + param.height);
setLayoutParams(param);
break;
}
}
}
@Override
public boolean canPause() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean canSeekBackward() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean canSeekForward() {
// TODO Auto-generated method stub
return false;
}
@Override
public void seekTo(long pos) {
if (mMediaPlayer != null && mIsPrepared) {
mMediaPlayer.seekTo((int) pos);
} else {
mSeekWhenPrepared = (int) pos;
}
}
}
| [
"15520054289@163.com"
] | 15520054289@163.com | |
11e4ece25262a91a4a38fd9cbec0cb999c9342d7 | 6119989a8d249b300826e551fa978d7a59d4ebd9 | /node_modules/react-native-google-signin/android/build/generated/source/r/release/android/support/compat/R.java | 87e896e5ad6ff2feccf4522662b032eabe5ab084 | [
"MIT"
] | permissive | Rogeriocsl/React-native-League-Of-Runas-Open | 97f44482c727ee43aa1443006b73efe05d9604d0 | 5cbe0e5166bfc564f33b92d0e6a7b960d8610018 | refs/heads/master | 2023-02-28T11:12:17.072765 | 2021-02-03T01:47:53 | 2021-02-03T01:47:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,028 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package android.support.compat;
public final class R {
public static final class attr {
public static int font = 0x7f04007a;
public static int fontProviderAuthority = 0x7f04007c;
public static int fontProviderCerts = 0x7f04007d;
public static int fontProviderFetchStrategy = 0x7f04007e;
public static int fontProviderFetchTimeout = 0x7f04007f;
public static int fontProviderPackage = 0x7f040080;
public static int fontProviderQuery = 0x7f040081;
public static int fontStyle = 0x7f040082;
public static int fontWeight = 0x7f040083;
}
public static final class bool {
public static int abc_action_bar_embed_tabs = 0x7f050001;
}
public static final class color {
public static int notification_action_color_filter = 0x7f06004a;
public static int notification_icon_bg_color = 0x7f06004b;
public static int ripple_material_light = 0x7f060056;
public static int secondary_text_default_material_light = 0x7f060058;
}
public static final class dimen {
public static int compat_button_inset_horizontal_material = 0x7f08004d;
public static int compat_button_inset_vertical_material = 0x7f08004e;
public static int compat_button_padding_horizontal_material = 0x7f08004f;
public static int compat_button_padding_vertical_material = 0x7f080050;
public static int compat_control_corner_material = 0x7f080051;
public static int notification_action_icon_size = 0x7f08005f;
public static int notification_action_text_size = 0x7f080060;
public static int notification_big_circle_margin = 0x7f080061;
public static int notification_content_margin_start = 0x7f080062;
public static int notification_large_icon_height = 0x7f080063;
public static int notification_large_icon_width = 0x7f080064;
public static int notification_main_column_padding_top = 0x7f080065;
public static int notification_media_narrow_margin = 0x7f080066;
public static int notification_right_icon_size = 0x7f080067;
public static int notification_right_side_padding_top = 0x7f080068;
public static int notification_small_icon_background_padding = 0x7f080069;
public static int notification_small_icon_size_as_large = 0x7f08006a;
public static int notification_subtext_size = 0x7f08006b;
public static int notification_top_pad = 0x7f08006c;
public static int notification_top_pad_large_text = 0x7f08006d;
}
public static final class drawable {
public static int notification_action_background = 0x7f090074;
public static int notification_bg = 0x7f090075;
public static int notification_bg_low = 0x7f090076;
public static int notification_bg_low_normal = 0x7f090077;
public static int notification_bg_low_pressed = 0x7f090078;
public static int notification_bg_normal = 0x7f090079;
public static int notification_bg_normal_pressed = 0x7f09007a;
public static int notification_icon_background = 0x7f09007b;
public static int notification_template_icon_bg = 0x7f09007c;
public static int notification_template_icon_low_bg = 0x7f09007d;
public static int notification_tile_bg = 0x7f09007e;
public static int notify_panel_notification_icon_bg = 0x7f09007f;
}
public static final class id {
public static int action_container = 0x7f0c0009;
public static int action_divider = 0x7f0c000b;
public static int action_image = 0x7f0c000c;
public static int action_text = 0x7f0c0012;
public static int actions = 0x7f0c0013;
public static int async = 0x7f0c001a;
public static int blocking = 0x7f0c001d;
public static int chronometer = 0x7f0c0025;
public static int forever = 0x7f0c0038;
public static int icon = 0x7f0c003c;
public static int icon_group = 0x7f0c003d;
public static int info = 0x7f0c0041;
public static int italic = 0x7f0c0042;
public static int line1 = 0x7f0c0044;
public static int line3 = 0x7f0c0045;
public static int normal = 0x7f0c004e;
public static int notification_background = 0x7f0c004f;
public static int notification_main_column = 0x7f0c0050;
public static int notification_main_column_container = 0x7f0c0051;
public static int right_icon = 0x7f0c0057;
public static int right_side = 0x7f0c0058;
public static int text = 0x7f0c0080;
public static int text2 = 0x7f0c0081;
public static int time = 0x7f0c0084;
public static int title = 0x7f0c0085;
}
public static final class integer {
public static int status_bar_notification_info_maxnum = 0x7f0d0007;
}
public static final class layout {
public static int notification_action = 0x7f0f001e;
public static int notification_action_tombstone = 0x7f0f001f;
public static int notification_template_custom_big = 0x7f0f0026;
public static int notification_template_icon_group = 0x7f0f0027;
public static int notification_template_part_chronometer = 0x7f0f002c;
public static int notification_template_part_time = 0x7f0f002d;
}
public static final class string {
public static int status_bar_notification_info_overflow = 0x7f15004b;
}
public static final class style {
public static int TextAppearance_Compat_Notification = 0x7f160106;
public static int TextAppearance_Compat_Notification_Info = 0x7f160107;
public static int TextAppearance_Compat_Notification_Line2 = 0x7f160109;
public static int TextAppearance_Compat_Notification_Time = 0x7f16010c;
public static int TextAppearance_Compat_Notification_Title = 0x7f16010e;
public static int Widget_Compat_NotificationActionContainer = 0x7f160184;
public static int Widget_Compat_NotificationActionText = 0x7f160185;
}
public static final class styleable {
public static int[] FontFamily = { 0x7f04007c, 0x7f04007d, 0x7f04007e, 0x7f04007f, 0x7f040080, 0x7f040081 };
public static int FontFamily_fontProviderAuthority = 0;
public static int FontFamily_fontProviderCerts = 1;
public static int FontFamily_fontProviderFetchStrategy = 2;
public static int FontFamily_fontProviderFetchTimeout = 3;
public static int FontFamily_fontProviderPackage = 4;
public static int FontFamily_fontProviderQuery = 5;
public static int[] FontFamilyFont = { 0x7f04007a, 0x7f040082, 0x7f040083 };
public static int FontFamilyFont_font = 0;
public static int FontFamilyFont_fontStyle = 1;
public static int FontFamilyFont_fontWeight = 2;
}
}
| [
"carlosrog1414@hotmail.com"
] | carlosrog1414@hotmail.com |
c71560fd835d5584548ae03943f456d989d25630 | 236b2da5d748ef26a90d66316b1ad80f3319d01e | /photon/photon/plugins/org.marketcetera.photon.testfragment/src/test/java/org/marketcetera/photon/tests/PhotonSuite.java | 2f734f9599c564e7c01f14ac0a939c70bdd33bbe | [
"Apache-2.0"
] | permissive | nagyist/marketcetera | a5bd70a0369ce06feab89cd8c62c63d9406b42fd | 4f3cc0d4755ee3730518709412e7d6ec6c1e89bd | refs/heads/master | 2023-08-03T10:57:43.504365 | 2023-07-25T08:37:53 | 2023-07-25T08:37:53 | 19,530,179 | 0 | 2 | Apache-2.0 | 2023-07-25T08:37:54 | 2014-05-07T10:22:59 | Java | UTF-8 | Java | false | false | 2,188 | java | package org.marketcetera.photon.tests;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.marketcetera.photon.BrokerManagerTest;
import org.marketcetera.photon.PhotonPositionMarketDataConcurrencyTest;
import org.marketcetera.photon.PhotonPositionMarketDataTest;
import org.marketcetera.photon.TimeOfDayTest;
import org.marketcetera.photon.actions.BrokerNotificationListenerTest;
import org.marketcetera.photon.parser.CommandParserTest;
import org.marketcetera.photon.parser.OrderSingleParserTest;
import org.marketcetera.photon.ui.databinding.EquityObservableTest;
import org.marketcetera.photon.ui.databinding.NewOrReplaceOrderObservableTest;
import org.marketcetera.photon.ui.databinding.OptionObservableTest;
import org.marketcetera.photon.views.AddSymbolActionTest;
import org.marketcetera.photon.views.InstrumentMementoSerializerTest;
import org.marketcetera.photon.views.MarketDataViewItemTest;
import org.marketcetera.photon.views.OptionOrderTicketViewTest;
import org.marketcetera.photon.views.StockOrderTicketViewTest;
/* $License$ */
/**
* Test suite for this bundle. The tests that require the full Photon
* application are in {@link PhotonApplicationSuite}.
*
* @author <a href="mailto:will@marketcetera.com">Will Horn</a>
* @version $Id: PhotonSuite.java 16154 2012-07-14 16:34:05Z colin $
* @since 2.0.0
*/
@RunWith(Suite.class)
@Suite.SuiteClasses( { BrokerManagerTest.class,
org.marketcetera.photon.MessagesTest.class,
PhotonPositionMarketDataConcurrencyTest.class,
PhotonPositionMarketDataTest.class, TimeOfDayTest.class,
BrokerNotificationListenerTest.class, AddSymbolActionTest.class,
MarketDataViewItemTest.class, NewOrReplaceOrderObservableTest.class,
EquityObservableTest.class, OptionObservableTest.class,
CommandParserTest.class, OrderSingleParserTest.class,
org.marketcetera.photon.parser.MessagesTest.class,
org.marketcetera.photon.views.MessagesTest.class,
InstrumentMementoSerializerTest.class, StockOrderTicketViewTest.class,
OptionOrderTicketViewTest.class })
public class PhotonSuite {
}
| [
"nagyist@mailbox.hu"
] | nagyist@mailbox.hu |
f4c6ee48da86ceee0606c780b256f06076332821 | c2f04eeeb011656b2613c3f1307715be55ef5dc4 | /webhotel/src/main/java/entity/EachRoom_for_List.java | 2a388a8b7c72c9bb12bc41c9072fc619d3c40caf | [] | no_license | Yuxuan-panini/hotel-management | 2f4e73b4e787673b3d52f61d866c97592bd683c3 | 84bce1722de1b7022c36300295c49ef0e1784589 | refs/heads/master | 2023-06-07T22:31:48.744643 | 2021-06-29T15:42:52 | 2021-06-29T15:42:52 | 330,603,364 | 0 | 0 | null | 2021-06-29T15:42:53 | 2021-01-18T08:37:42 | JavaScript | UTF-8 | Java | false | false | 326 | java | package entity;
public class EachRoom_for_List {
public String room_type;
public float room_price;
public int total;
public int rest;
public EachRoom_for_List(String s1,float rp,int tot,int re){
this.room_type=s1;
this.room_price=rp;
this.total=tot;
this.rest=re;
}
} | [
"liyuxuan@bupt.edu.cn"
] | liyuxuan@bupt.edu.cn |
946b2b6d169fdff0ed094e65ef2e0ecaf1e08680 | 5bb0526317b5696aff874b837bc4a6e15761fd04 | /src/Lista3/Questao8.java | 3b029865e940f8c5607225a166c2345ad20d9f48 | [] | no_license | weskleymb/AulasAlgoritmos | dcb8344345b2eeb82eeb598083ec6399f0ed1c4e | 139beae86ccd4bf1d6c6690ce6a8618b7ec1baeb | refs/heads/master | 2021-01-20T20:52:29.882923 | 2016-06-21T21:58:36 | 2016-06-21T21:58:36 | 60,880,466 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,002 | java | package Lista3;
import java.util.Scanner;
public class Questao8 {
public static void main(String[] args) {
Scanner entrada = new Scanner (System.in);
System.out.print("Informe o preço do produto 01: ");
float n1 = entrada.nextFloat ();
System.out.print("Informe o preço do produto 02: ");
float n2 = entrada.nextFloat ();
System.out.print("Informe o preço do produto 03: ");
float menor = n1, n3 = entrada.nextFloat ();
String produto = "";
if (n1 <= menor) {
menor = n1;
produto = "Produto 1";
}
if (n2 < menor) {
menor = n2;
produto = "Produto 2";
}
if (n3 < menor ) {
menor = n3;
produto = "Produto 3";
}
System.out.println (produto + ": " + menor);
}
}
| [
"weskleymb@hotmail.com"
] | weskleymb@hotmail.com |
60b4f7db3af0795b968d4d90d4cb1e7c12d74a20 | 042a624a23c3113563f9e245e118cc4e9b1e9a93 | /Day0620_Spring_lifeCycle_Annotation/src/lifecycle2/StudentDao2.java | a29e1e40e8a4f4f238fcf1e8da4895cdbe3bbfd2 | [] | no_license | kowoo/spring | b1436a4d0ddb0f0d9834915f7eec910b4f2117c8 | 69b2b3c297696c708978451e24de786de0fb2e31 | refs/heads/master | 2020-03-20T23:05:04.881246 | 2018-07-13T08:22:32 | 2018-07-13T08:22:32 | 137,828,376 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,045 | java | package lifecycle2;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class StudentDao2 implements InitializingBean, DisposableBean {
// 기능을 하기 위해서 연결이 필요함
@Autowired
private ConnectionProvider connectionProvider;
private Connection connection;
// DBMS와의 연결은 외부 자원을 이용하는 것이기 때문에 계속해서 열어 놓고 사용하면, 자원 누수가 발생
// 사용할 때마다 연결을 만들어서 사용
// 기능 : insert, update, delete, selectOne, selectAll
public void setConnectionProvider(ConnectionProvider connectionProvider) {
this.connectionProvider = connectionProvider;
}
// public StudentDao(ConnectionProvider connectionProvider) {
// this.connectionProvider = connectionProvider;
// }
public void insertStudent(Student student) {
PreparedStatement pstmt = null;
try {
// 연결얻어오기
connection = connectionProvider.getConnection();
String sql = "insert into student values(?,?,?)";
pstmt = connection.prepareStatement(sql);
pstmt.setInt(1, student.getSnum());
pstmt.setString(2, student.getSname());
pstmt.setInt(3, student.getSgrade());
pstmt.executeUpdate();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
try {
if (connection != null) connection.close();
if (pstmt != null) pstmt.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public void updateStudent(Student student) {
PreparedStatement pstmt = null;
try {
// 연결얻어오기
connection = connectionProvider.getConnection();
String sql = "update student "
+ " set sname = ?,"
+ " sgrade = ?"
+ " where snum = ?";
pstmt = connection.prepareStatement(sql);
pstmt.setString(1, student.getSname());
pstmt.setInt(2, student.getSgrade());
pstmt.setInt(3, student.getSnum());
pstmt.executeUpdate();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
try {
if (connection != null) connection.close();
if (pstmt != null) pstmt.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
public void deleteStudent(int snum) {
PreparedStatement pstmt = null;
try {
// 연결얻어오기
connection = connectionProvider.getConnection();
String sql = "delete from student where snum = ?";
pstmt = connection.prepareStatement(sql);
pstmt.setInt(1, snum);
pstmt.executeUpdate();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
try {
if (connection != null) connection.close();
if (pstmt != null) pstmt.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public Student selectOne(int snum) {
PreparedStatement pstmt = null;
//결과를 담아서 반환할 학생 참조변수
Student student = null;
ResultSet rs = null;
try {
// 연결얻어오기
connection = connectionProvider.getConnection();
String sql = "select * from student where snum = ?";
pstmt = connection.prepareStatement(sql);
pstmt.setInt(1, snum);
rs = pstmt.executeQuery();
if(rs.next()) {
student = new Student();
student.setSnum(rs.getInt("snum"));
student.setSname(rs.getString("sname"));
student.setSgrade(rs.getInt("sgrade"));
}
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
try {
if (connection != null) connection.close();
if (pstmt != null) pstmt.close();
if (rs != null) rs.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return student;
}
public List<Student> selectAll(){
PreparedStatement pstmt = null;
//결과를 담아서 반환할 학생 참조변수
List<Student> studentList = new ArrayList<Student>();
ResultSet rs = null;
try {
// 연결얻어오기
connection = connectionProvider.getConnection();
String sql = "select * from student";
pstmt = connection.prepareStatement(sql);
rs = pstmt.executeQuery();
while(rs.next()) {
Student student = new Student();
student.setSnum(rs.getInt("snum"));
student.setSname(rs.getString("sname"));
student.setSgrade(rs.getInt("sgrade"));
studentList.add(student);
}
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
try {
if (connection != null) connection.close();
if (pstmt != null) pstmt.close();
if (rs != null) rs.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return studentList;
}
@Override
public void afterPropertiesSet() throws Exception {
// TODO Auto-generated method stub
System.out.println("초기화 완료 후 호출");
}
@Override
public void destroy() throws Exception {
// TODO Auto-generated method stub
System.out.println("소멸 전 호출");
}
}
| [
"gwh1027@gmail.com"
] | gwh1027@gmail.com |
d73e5bb0aac6a4265971a18f9fd9f132b34fbe11 | a6611fccf41a6873176965dcb5d7555ee8cdf011 | /android/app/src/main/java/com/appletv/MainActivity.java | 8b4c43c312d9edfe2d4357e87d9b28f7c8aa3d7d | [] | no_license | kchronis/makeathon-appletv | 185d41949d2b047747ad48cb4cfeb1abba57b7cd | 378280e424550bb9f8d681fb1e11591fb03e8a7a | refs/heads/master | 2020-03-23T11:09:10.834247 | 2018-07-18T20:21:58 | 2018-07-18T20:24:14 | 141,486,682 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 359 | java | package com.appletv;
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "appletv";
}
}
| [
"kchronis@pinterest.com"
] | kchronis@pinterest.com |
8e4cede7d31b2ee7ba875d5560668bbd87258b06 | ca898cfaaba405443a398974d61a957cb1cadedc | /src/test/java/com/canvas/cheater/CanvasCheaterApplicationTests.java | 679fef224abff213f3eb265ea0613751fe18935a | [] | no_license | DlockMiz/CanvasCheater | d50cbd8285478172b71666568ce11cec42a2a12c | c2c51276ab894e18602236fe1302544ea25ac012 | refs/heads/master | 2021-06-17T00:58:06.415879 | 2019-08-13T20:58:59 | 2019-08-13T20:58:59 | 200,690,304 | 0 | 0 | null | 2021-05-08T20:15:19 | 2019-08-05T16:21:14 | Java | UTF-8 | Java | false | false | 342 | java | package com.canvas.cheater;
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 CanvasCheaterApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"daniel.w.lock@gmail.com"
] | daniel.w.lock@gmail.com |
4c4f7dcf28a3d1b6522050a2eea4598814c9342c | b81ff2e33a38cce6a47e716870a39f180d50e09e | /app/src/main/java/com/example/newcomer_io/ui/main/MainViewModel.java | f4a99d54cde7664cb9d9d5d8cbbe6726450a450a | [] | no_license | chrismoen1/chrismoen1 | 786a9f6d1796421e1caf857885a7e73395219307 | c70b53b391f401cef54a8bd1c582a2fde4dc2803 | refs/heads/master | 2022-11-18T04:27:33.824476 | 2020-07-18T19:17:48 | 2020-07-18T19:17:48 | 254,759,109 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 166 | java | package com.example.newcomer_io.ui.main;
import androidx.lifecycle.ViewModel;
public class MainViewModel extends ViewModel {
// TODO: Implement the ViewModel
}
| [
"moenchris1@gmail.com"
] | moenchris1@gmail.com |
901af35b3cbc964e8b8b46590ad329430dc3977d | 9d0517091fe2313c40bcc88a7c82218030d2075c | /apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/binders/BindIterableToHeadersWithPurgeCDNObjectEmail.java | a4398144107fe145ba807a63ecd6a6caf5460b56 | [
"Apache-2.0"
] | permissive | nucoupons/Mobile_Applications | 5c63c8d97f48e1051049c5c3b183bbbaae1fa6e6 | 62239dd0f17066c12a86d10d26bef350e6e9bd43 | refs/heads/master | 2020-12-04T11:49:53.121041 | 2020-01-04T12:00:04 | 2020-01-04T12:00:04 | 231,754,011 | 0 | 0 | Apache-2.0 | 2020-01-04T12:02:30 | 2020-01-04T11:46:54 | Java | UTF-8 | Java | false | false | 1,993 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.cloudfiles.binders;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.List;
import javax.inject.Singleton;
import org.jclouds.cloudfiles.reference.CloudFilesHeaders;
import org.jclouds.http.HttpRequest;
import org.jclouds.rest.Binder;
import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableMultimap;
@Singleton
public class BindIterableToHeadersWithPurgeCDNObjectEmail implements Binder {
@SuppressWarnings("unchecked")
@Override
public <R extends HttpRequest> R bindToRequest(R request, Object input) {
checkArgument(checkNotNull(input, "input") instanceof Iterable<?>, "this binder is only valid for Iterable!");
checkNotNull(request, "request");
Iterable<String> emails = (Iterable<String>) input;
String emailCSV = Joiner.on(", ").join((List<String>) emails);
ImmutableMultimap<String, String> headers =
ImmutableMultimap.<String, String> of(CloudFilesHeaders.CDN_CONTAINER_PURGE_OBJECT_EMAIL, emailCSV);
return (R) request.toBuilder().replaceHeaders(headers).build();
}
}
| [
"Administrator@fdp"
] | Administrator@fdp |
f6f0c4826fd3c82920bd575803cab7468068216f | 19b42d08a26bd55ec5e14fd8f86a680ea8191f8c | /Taller_5/src/main/java/com/canessa/maven/test/oferta/OfertaBase.java | 516dd637814af6568207bfd1df7f9df16a78e990 | [] | no_license | Pipe914/Taller_Facade | 40b9d3d6a08762220f3383ec3591b6856dae2dcf | fe77aab8241dde54cb7c9b94f71e15a2640bee67 | refs/heads/main | 2023-05-07T13:06:30.138498 | 2021-05-29T22:05:38 | 2021-05-29T22:05:38 | 356,353,724 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 577 | java | package com.canessa.maven.test.oferta;
import com.canessa.maven.test.Componente;
// Clase base oferta
public class OfertaBase implements Componente{
// Variables globales
private String id;
// Constructor
public OfertaBase(String iD){
id = iD;
}
// Metodos de clase
public void setId(String iD){
id = iD;
}
public String getId(){
return id;
}
@Override
public String imprimirOferta() {
return "La oferta laboral consta de:\n";
}
public String optionalGetId(){
return getId();
}
}
| [
"andresafsa@unisabana.edu.co"
] | andresafsa@unisabana.edu.co |
15b6961834ff27a3b53fe78ec8a1dab36bd9c6ec | 671d2dfd4e1b203680b1427d66d4d69eb6c49d5d | /componentapi/src/main/java/com/it/picliu/componentapi/ComponentFactory.java | fa09467371bab38a518808047ad8213e78ae0f19 | [] | no_license | picliu/ModuleProject-master | ae29a6088c644d3466c764dd2e8a8913b7fa4074 | 4ab24c0a0f046c6cccdd9b9a27b794d931f4b482 | refs/heads/master | 2020-07-01T21:19:28.132981 | 2019-08-11T09:12:43 | 2019-08-11T09:12:43 | 201,304,830 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 382 | java | package com.it.picliu.componentapi;
/**
* * @name:picliu
* * @date: 2019/8/9
* * 组件工厂类
*/
public abstract class ComponentFactory {
private Component mComponent;
public abstract Component onCreate();
public final Component create() {
if (mComponent == null) {
mComponent = onCreate();
}
return mComponent;
}
}
| [
"liuliang@qutoutiao.net"
] | liuliang@qutoutiao.net |
64191ed93ee54814bed0de2edf19c49d2fb7e79b | 94be114d4f9824ff29b0a3be7114f6f4bf66e187 | /axis2-generated/src/gov/niem/niem/niem_core/_2_0/InstantMessengerClientNameDocument.java | 5e45431bc1bf7f40873500aacd1f0792fe2072cb | [] | no_license | CSTARS/uicds | 590b120eb3dcc24a2b73986bd32018e919c4af6a | b4095b7a33cc8af6e8a1b40ab8e83fc280d2d31a | refs/heads/master | 2016-09-11T12:58:01.097476 | 2013-05-09T22:42:38 | 2013-05-09T22:42:38 | 9,942,515 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 9,621 | java | /*
* An XML document type.
* Localname: InstantMessengerClientName
* Namespace: http://niem.gov/niem/niem-core/2.0
* Java type: gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument
*
* Automatically generated - do not modify.
*/
package gov.niem.niem.niem_core._2_0;
/**
* A document containing one InstantMessengerClientName(@http://niem.gov/niem/niem-core/2.0) element.
*
* This is a complex type.
*/
public interface InstantMessengerClientNameDocument extends org.apache.xmlbeans.XmlObject
{
public static final org.apache.xmlbeans.SchemaType type = (org.apache.xmlbeans.SchemaType)
org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(InstantMessengerClientNameDocument.class.getClassLoader(), "schemaorg_apache_xmlbeans.system.s4EF21377E0C3896346FE808A4E61C987").resolveHandle("instantmessengerclientnamec57bdoctype");
/**
* Gets the "InstantMessengerClientName" element
*/
gov.niem.niem.niem_core._2_0.TextType getInstantMessengerClientName();
/**
* Tests for nil "InstantMessengerClientName" element
*/
boolean isNilInstantMessengerClientName();
/**
* Sets the "InstantMessengerClientName" element
*/
void setInstantMessengerClientName(gov.niem.niem.niem_core._2_0.TextType instantMessengerClientName);
/**
* Appends and returns a new empty "InstantMessengerClientName" element
*/
gov.niem.niem.niem_core._2_0.TextType addNewInstantMessengerClientName();
/**
* Nils the "InstantMessengerClientName" element
*/
void setNilInstantMessengerClientName();
/**
* A factory class with static methods for creating instances
* of this type.
*/
public static final class Factory
{
public static gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument newInstance() {
return (gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, null ); }
public static gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument newInstance(org.apache.xmlbeans.XmlOptions options) {
return (gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, options ); }
/** @param xmlAsString the string value to parse */
public static gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument parse(java.lang.String xmlAsString) throws org.apache.xmlbeans.XmlException {
return (gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xmlAsString, type, null ); }
public static gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument parse(java.lang.String xmlAsString, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
return (gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xmlAsString, type, options ); }
/** @param file the file from which to load an xml document */
public static gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument parse(java.io.File file) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( file, type, null ); }
public static gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument parse(java.io.File file, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( file, type, options ); }
public static gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( u, type, null ); }
public static gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( u, type, options ); }
public static gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( is, type, null ); }
public static gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( is, type, options ); }
public static gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( r, type, null ); }
public static gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( r, type, options ); }
public static gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument parse(javax.xml.stream.XMLStreamReader sr) throws org.apache.xmlbeans.XmlException {
return (gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( sr, type, null ); }
public static gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument parse(javax.xml.stream.XMLStreamReader sr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
return (gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( sr, type, options ); }
public static gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
return (gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( node, type, null ); }
public static gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
return (gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( node, type, options ); }
/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */
public static gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return (gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */
public static gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return (gov.niem.niem.niem_core._2_0.InstantMessengerClientNameDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */
public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */
public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
private Factory() { } // No instance of this class allowed
}
}
| [
"jrmerz@gmail.com"
] | jrmerz@gmail.com |
17b247c19baa87dd69cd9990049d9c2ce0bcd86d | e9e6f3113580f93703ab7a05b69145cb39082f85 | /PMServer/src/main/java/beito/PMServer/model/AppSettings.java | 710c24840887fd222d643ea7c07fd01e6f7b4b98 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | beito123/BadArchives | 51f521aa0249b2d95e7e1e0afaf219e506c287fe | d9887cdc6372bd53295fa182c23d02a0b693a920 | refs/heads/master | 2020-12-08T05:56:43.071602 | 2016-08-21T15:17:40 | 2016-08-21T15:17:40 | 66,203,860 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,606 | java | package beito.PMServer.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
/*
author: beito123
*/
@JsonIgnoreProperties(ignoreUnknown=true)
public class AppSettings {
@JsonProperty("version")
private String version;
@JsonProperty("setting")
private Setting setting;
public String getVersion(){
return version;
}
public Setting getSetting(){
return setting;
}
@JsonIgnoreProperties(ignoreUnknown=true)
public class Setting{
@JsonProperty("launch")
private Launch launch;
public Launch getLaunch(){
return launch;
}
@JsonIgnoreProperties(ignoreUnknown=true)
public class Launch {
@JsonProperty("PMPath")
private String PMPath;
@JsonProperty("PharPath")
private String PharPath;
@JsonProperty("PHPPath")
private String PHPPath;
@JsonProperty("IsUseSrc")
private boolean IsUseSrc;
@JsonProperty("SrcPath")
private String SrcPath;
public String getPMPath(){
return PMPath;
}
public void setPMPath(String path){
PMPath = path;
}
public String getPharPath(){
return PharPath;
}
public void setPharPath(String path){
PharPath = path;
}
public String getPHPPath(){
return PHPPath;
}
public void setPHPPath(String path){
this.PHPPath = path;
}
public boolean getIsUseSrc(){
return IsUseSrc;
}
public void setIsUseSrc(boolean bool){
IsUseSrc = bool;
}
public String getSrcPath(){
return SrcPath;
}
public void setSrcPath(String path){
SrcPath = path;
}
}
}
} | [
"beito123@gmx.com"
] | beito123@gmx.com |
7b19536d928fd31726101bc3e4d7d222a2ab10b6 | f74b851f4661f808833d092d3c0cd0c0b4270fc8 | /app/src/main/java/com/cucr/myapplication/activity/TestWebViewActivity.java | 21b96cdaba26cc81ae90e4c568ecb9453e5d3fe6 | [] | no_license | dengjiaping/HeartJump | eb3eeb3df24b9a567e4229c92bf0081d56470eed | 31af25dc06c97f993f228464b054299690308e4b | refs/heads/master | 2021-08-24T13:19:20.914881 | 2017-11-21T07:09:21 | 2017-11-21T07:09:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,186 | java | package com.cucr.myapplication.activity;
import android.graphics.Bitmap;
import android.os.Build;
import android.support.annotation.RequiresApi;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.LinearLayout;
import com.cucr.myapplication.R;
import com.cucr.myapplication.utils.MyLogger;
import com.lidroid.xutils.view.annotation.ViewInject;
public class TestWebViewActivity extends BaseActivity {
@ViewInject(R.id.wv)
private WebView wv;
@ViewInject(R.id.ll_load)
private LinearLayout ll_load;
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Override
protected void initChild() {
initTitle("详情");
String url = getIntent().getStringExtra("url");
WebSettings settings = wv.getSettings();
//webView 加载视频,下面五行必须
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
}
settings.setJavaScriptEnabled(true);//支持js
settings.setPluginState(WebSettings.PluginState.ON);// 支持插件
settings.setLoadsImagesAutomatically(true); //支持自动加载图片
settings.setUseWideViewPort(true); //将图片调整到适合webview的大小 无效
settings.setLoadWithOverviewMode(true); // 缩放至屏幕的大小
// wv.setWebChromeClient(new WebChromeClient() );
wv.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
MyLogger.jLog().i("加载完成");
ll_load.setVisibility(View.GONE);
}
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
MyLogger.jLog().i("开始加载");
}
});
wv.loadUrl(url);
}
@Override
protected int getChildRes() {
return R.layout.activity_test_web_view;
}
}
| [
"1666930276@qq.com"
] | 1666930276@qq.com |
9416ea7d93bbc687e1188786d99c1fc69916a5cc | 975ad56f28e806bf6d15e82549b023e87beebc95 | /src/main/java/com/example/demo/config/SecurityConfiguration.java | b6733687083765fb5994aabe17bcff600185dbfd | [] | no_license | 748079585/oauth2 | 4a222d146e900043c266aada29e56c50a5a5f00a | 6a5e9a8f616df1ab99b6f6afa1b2bb4a5eb330e4 | refs/heads/master | 2022-07-14T13:09:24.479414 | 2019-08-21T05:57:12 | 2019-08-21T05:57:12 | 203,502,186 | 0 | 0 | null | 2022-06-17T02:24:10 | 2019-08-21T03:53:27 | Java | UTF-8 | Java | false | false | 2,435 | java | package com.example.demo.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
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.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import com.example.demo.constans.PermitAllUrl;
/**
* spring security配置
* @author lei
* @date 2019/08/16
*/
@Configuration
@EnableWebSecurity
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Autowired
public UserDetailsService userDetailsService;
@Autowired
private BCryptPasswordEncoder passwordEncoder;
/**
* 全局用户信息<br>
* 方法上的注解@Autowired的意思是,方法的参数的值是从spring容器中获取的<br>
* 即参数AuthenticationManagerBuilder是spring中的一个Bean
*
* @param auth 认证管理
* @throws Exception 用户认证异常信息
*/
@Autowired
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder);
}
/**
* 认证管理
*
* @return 认证管理对象
* @throws Exception
* 认证异常信息
*/
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
/**
* http安全配置
*
* @param http
* http安全对象
* @throws Exception
* http安全异常信息
*/
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers(PermitAllUrl.permitAllUrl("/sys/login","oauth/token","/sys/login3","/sys/login2")).permitAll() // 放开权限的url
.anyRequest().authenticated().and()
.httpBasic().and().csrf().disable();
}
}
| [
"748079585@qq.com"
] | 748079585@qq.com |
cf4cac93e0133b886afd963ac762eebd6820b354 | 517ef6789b5fd0ffa941df480dd240dcc9196dbe | /health_common/src/main/java/com/it/entity/Result.java | f9211a419b70cab212bdba82c68795810a8f1904 | [] | no_license | ITBAI00/mast | cfee2a6b9c479f46f8b42965b87f5e542eeba5b7 | e6f7d510da1e606bc039fe2cb9ec78ba6006f17e | refs/heads/master | 2022-12-24T11:31:17.231101 | 2019-10-29T08:04:52 | 2019-10-29T08:04:52 | 218,218,759 | 1 | 0 | null | 2022-12-16T04:29:29 | 2019-10-29T06:28:08 | JavaScript | UTF-8 | Java | false | false | 992 | java | package com.it.entity;
import java.io.Serializable;
/**
* 封装返回结果
*/
public class Result implements Serializable{
private boolean flag;//执行结果,true为执行成功 false为执行失败
private String message;//返回结果信息
private Object data;//返回数据
public Result(boolean flag, String message) {
super();
this.flag = flag;
this.message = message;
}
public Result(boolean flag, String message, Object data) {
this.flag = flag;
this.message = message;
this.data = data;
}
public boolean isFlag() {
return flag;
}
public void setFlag(boolean flag) {
this.flag = flag;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
}
| [
"by@itbai.cn"
] | by@itbai.cn |
a58210034e4db3153e50b5e376d6a67de67a321f | db570d7dd32d33d3637af4cd5d51ee9f2c6b077a | /src/calculator/CalcView.java | 85ee158dcd00cb512b6870e08260c5b2d5adf441 | [] | no_license | kamelcerbah/java-swing-Calculator-with-MVC-Architecture | 972e3f88d4735b99f8b63be6afd818bb2dfd4c31 | 9c54dc5baf1d77c1e46de8be1e65d9ee077fe9b1 | refs/heads/main | 2023-03-19T12:36:03.331620 | 2021-03-19T14:55:21 | 2021-03-19T14:55:21 | 349,454,957 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,642 | java | package calculator;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.ActionListener;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
@SuppressWarnings("serial")
public class CalcView extends JFrame {
/**
*
*/
//private static final long serialVersionUID = -6379799897662224081L;
private JLabel lbl_choice = new JLabel("Choose type of operation :");
private JButton btn_addition = new JButton(" + ");
private JButton btn_substraction = new JButton(" - ");
private JButton btn_multiplication = new JButton(" * ");
private JButton btn_division = new JButton(" / ");
Dimension btn_dimension = new Dimension(100,100);
public CalcView() {
JPanel btnContainer = new JPanel();
JPanel lblContainer = new JPanel();
JPanel Container = new JPanel();
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setSize(300, 130);
this.setResizable(false);
//Layout
Container.setLayout(new BoxLayout(Container, BoxLayout.Y_AXIS));
//btnContainer.setLayout(new BoxLayout(btnContainer, BoxLayout.X_AXIS));
btnContainer.setAlignmentY(CENTER_ALIGNMENT);
//lblContainer.setLayout(new BoxLayout(lblContainer, BoxLayout.Y_AXIS));
// Background Color
btnContainer.setBackground(new Color(176,196,222));
lblContainer.setBackground(new Color(176,196,222));
lblContainer.add(lbl_choice);
btnContainer.add(btn_addition);
btnContainer.add(btn_substraction);
btnContainer.add(btn_multiplication);
btnContainer.add(btn_division);
Container.add(lblContainer);
Container.add(btnContainer);
this.add(Container);
}
//exiting the CalcView frame
public void addAdditionBtnListener(ActionListener listenForAdditionButton){
btn_addition.addActionListener(listenForAdditionButton);
}
public void addSubstractionBtnListener(ActionListener listenForSubstractionButton){
btn_substraction.addActionListener(listenForSubstractionButton);
}
public void addMultiplicationBtnListener(ActionListener listenForMultiplicationButton){
btn_multiplication.addActionListener(listenForMultiplicationButton);
}
public void addDivisionBtnListener(ActionListener listenForDivisionButton){
btn_division.addActionListener(listenForDivisionButton);
}
// Open a popup that contains the error message passed
public void displayErrorMessage(String errorMessage){
JOptionPane.showMessageDialog(this, errorMessage);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
deb2270527b42270c4f47a0d65b7966a9329e80d | b013f50b527343312bc74ee2c98c3c2edf79f6cd | /gridool/src/common/src/gridool/util/lang/PrintUtils.java | c944759e00326c9e97d72b527282322064dd6a1e | [] | no_license | myui/gridool | 0c3ef888495597e6bc11ce5cc12a2439c5933aae | 5f51d0c192a07839680513c29904b4911e06be86 | refs/heads/master | 2016-08-07T11:34:34.138557 | 2012-07-31T06:53:03 | 2012-07-31T06:53:03 | 32,142,106 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 9,384 | java | /*
* @(#)$Id: PrintUtils.java 3619 2008-03-26 07:23:03Z yui $
*
* Copyright 2006-2008 Makoto YUI
*
* 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.
*
* Contributors:
* Makoto YUI - initial implementation
*/
package gridool.util.lang;
import gridool.util.io.FileUtils;
import java.io.File;
import java.io.PrintStream;
import java.text.DecimalFormat;
/**
* Miscellaneous print utilities.
* <DIV lang="en"></DIV>
* <DIV lang="ja"></DIV>
*
* @author Makoto YUI (yuin405@gmail.com)
*/
public final class PrintUtils {
private static final int TRACE_CAUSE_DEPTH = 5;
private static boolean E_ALL_ON_FATAL = true;
/** Restricts the instantiation. */
private PrintUtils() {}
public static void prettyPrintStackTrace(final Throwable throwable, final PrintStream out) {
final String s = prettyPrintStackTrace(throwable);
out.print(s);
}
public static String prettyPrintStackTrace(final Throwable throwable) {
return prettyPrintStackTrace(throwable, TRACE_CAUSE_DEPTH);
}
public static String prettyPrintStackTrace(final Throwable throwable, final int traceDepth) {
final StringBuilder out = new StringBuilder(512);
out.append(getMessage(throwable));
out.append("\n\n---- Debugging information ----");
final int tracedepth;
if(E_ALL_ON_FATAL && (throwable instanceof RuntimeException || throwable instanceof Error)) {
tracedepth = -1;
} else {
tracedepth = traceDepth;
}
String captured = captureThrownWithStrackTrace(throwable, "trace-exception", tracedepth);
out.append(captured);
final Throwable cause = throwable.getCause();
if(cause != null) {
final Throwable rootCause = getRootCause(cause);
captured = captureThrownWithStrackTrace(rootCause, "trace-cause", TRACE_CAUSE_DEPTH);
out.append(captured);
}
out.append("\n------------------------------- \n");
return out.toString();
}
private static String captureThrownWithStrackTrace(final Throwable throwable, final String label, final int traceDepth) {
assert (traceDepth >= 1 || traceDepth == -1);
final StringBuilder out = new StringBuilder(255);
final String clazz = throwable.getClass().getName();
out.append(String.format("\n%-20s: %s \n", ("* " + label), clazz));
final StackTraceElement[] st = throwable.getStackTrace();
int at;
final int limit = (traceDepth == -1) ? st.length - 1 : traceDepth;
for(at = 0; at < st.length; at++) {
if(at < limit) {
out.append("\tat " + st[at] + '\n');
} else {
out.append("\t...\n");
break;
}
}
if(st.length == 0) {
out.append("\t no stack traces...");
} else if(at != (st.length - 1)) {
out.append("\tat " + st[st.length - 1]);
}
String errmsg = throwable.getMessage();
if(errmsg != null) {
out.append(String.format("\n%-20s: \n", ("* " + label + "-error-msg")));
String[] line = errmsg.split("\n");
final int maxlines = Math.min(line.length, Math.max(1, TRACE_CAUSE_DEPTH - 2));
for(int i = 0; i < maxlines; i++) {
out.append('\t');
out.append(line[i]);
if(i != (maxlines - 1)) {
out.append('\n');
}
}
}
return out.toString();
}
public static String getMessage(Throwable throwable) {
assert (throwable != null);
final String errMsg = throwable.getMessage();
final String clazz = throwable.getClass().getName();
return (errMsg != null) ? clazz + ": " + errMsg : clazz;
}
public static String getOneLineMessage(Throwable throwable) {
String lines = getMessage(throwable);
int last = lines.indexOf('\n');
if(last == -1) {
last = lines.length();
}
return lines.substring(0, last);
}
private static Throwable getRootCause(final Throwable throwable) {
assert (throwable != null);
Throwable top = throwable;
while(top != null) {
Throwable parent = top.getCause();
if(parent != null) {
top = parent;
} else {
break;
}
}
return top;
}
public static void printClassHierarchy(PrintStream out, Class clazz) {
Class sc = clazz;
final StringBuilder sbuf = new StringBuilder(64);
while(sc != null) {
String space = sbuf.toString();
out.println(space + sc.getName());
Class[] ifs = sc.getInterfaces();
for(int i = 0; i < ifs.length; i++) {
out.println(space + " implements: " + ifs[i].getName());
}
sc = sc.getSuperclass();
sbuf.append(' ');
}
}
public static void printClassLoaderHierarchy(PrintStream out, Class clazz) {
final StringBuilder sbuf = new StringBuilder(32);
ClassLoader curr_cl = clazz.getClass().getClassLoader();
while(curr_cl != null) {
out.println(sbuf.toString() + curr_cl.getClass().getName());
curr_cl = curr_cl.getParent();
sbuf.append(' ');
}
}
public static void printMemoryUsage(PrintStream out) {
out.println("[MemoryUsage] " + new java.util.Date(System.currentTimeMillis()).toString()
+ " - Total: " + Runtime.getRuntime().totalMemory() + "byte , " + "Free: "
+ Runtime.getRuntime().freeMemory() + "byte");
}
public static String prettyFileSize(long size) {
if(size < 0) {
return "N/A";
} else {
if(size < 1024) {
return size + " bytes";
} else {
float kb = size / 1024f;
if(kb < 1024f) {
return String.format("%.1f KB", kb);
} else {
float mb = kb / 1024f;
if(mb < 1024f) {
return String.format("%.1f MB", mb);
} else {
float gb = mb / 1024f;
return String.format("%.2f GB", gb);
}
}
}
}
}
public static String prettyFileSize(File file) {
return prettyFileSize(FileUtils.getFileSize(file));
}
public static float toPercent(final double v) {
return (float) (v * 100.0f);
}
public static String toPercentString(final float v) {
String p = String.valueOf(v * 100.0f);
int ix = p.indexOf('.') + 1;
String percent = p.substring(0, ix) + p.substring(ix, ix + 1);
return percent + '%';
}
public static String toPercentString(final double v) {
String p = String.valueOf(v * 100.0f);
int ix = p.indexOf('.') + 1;
String percent = p.substring(0, ix) + p.substring(ix, ix + 1);
return percent + '%';
}
public static String toString(final StackTraceElement[] trace) {
final int depth = trace.length;
if(depth == 0) {
return "\t no stack traces...";
}
final StringBuilder buf = new StringBuilder(512);
for(int i = 0; i < depth; i++) {
buf.append("\tat ");
buf.append(trace[i]);
buf.append('\n');
}
return buf.toString();
}
public static String toString(final StackTraceElement[] trace, final int maxDepth) {
if(trace.length == 0) {
return "\t no stack traces...";
}
final StringBuilder buf = new StringBuilder(512);
final int depth = Math.min(trace.length, maxDepth);
for(int i = 0; i < depth; i++) {
buf.append("\tat ");
buf.append(trace[i]);
buf.append('\n');
}
return buf.toString();
}
public static String formatNumber(final long number) {
DecimalFormat f = new DecimalFormat("#,###");
return f.format(number);
}
public static String formatNumber(final double number) {
return formatNumber(number, true);
}
public static String formatNumber(final double number, boolean commaSep) {
DecimalFormat f = new DecimalFormat(commaSep ? "#,###.###" : "###.###");
f.setDecimalSeparatorAlwaysShown(false);
return f.format(number);
}
} | [
"yuin405@17ef545a-33b9-11de-96ab-f16d9912eac9"
] | yuin405@17ef545a-33b9-11de-96ab-f16d9912eac9 |
c88a6b2f087221f84cec55adc2be6fdecfdeff7a | a8ad9ba059c463cd17c993d8630a5c11802c79c8 | /dubbo-springboot-consumer/src/main/java/com/ql/controller/HelloController.java | a4c628b6b22cbe03b10f43af4e8281a38c34c793 | [] | no_license | xdf020168/dubbo-springboot | 6e619c4df9f8f1c7acf81de7bcb6651cc3e631f8 | 7e435f0a1f302bf23bfab6c4516b698f453d9ccb | refs/heads/main | 2022-12-29T07:17:17.956431 | 2020-10-20T09:01:14 | 2020-10-20T09:01:14 | 446,747,826 | 1 | 0 | null | 2022-01-11T08:59:41 | 2022-01-11T08:59:40 | null | UTF-8 | Java | false | false | 985 | java | package com.ql.controller;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.ql.Service.HelloService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author qinlei
* @description todo
* @date 2020/10/20 15:01
*/
@RestController
@RequestMapping("hello")
public class HelloController {
@DubboReference(version = "1.0.0")
private HelloService helloService;
@HystrixCommand(fallbackMethod = "hello")
@RequestMapping(value = "sayHello")
public String sayHello(){
String s = helloService.sayHello();
System.out.println(s);
return s;
}
/**
* 服务熔断的回调方法
*/
public String hello(){
System.out.println("服务熔断了...");
return ("服务熔断了...");
}
}
| [
"qlanto_147@163.com"
] | qlanto_147@163.com |
5b1c0517ed7a597478f0997b38408c7460a4b337 | 614a78e968d435a1577932873bd1bddc204e1805 | /BootCampProject1/OTHERS/products/CATEGORY.java | 432be3e632a6b22462e137d12c68c2d63c0f5b10 | [] | no_license | Abhishekramola10/SpringProject | 13ae94a9adf39e50e5c532497d32005a6f6ad875 | 463049d6f74db028ded98d1d0ad8e74a88535083 | refs/heads/main | 2023-09-05T07:02:01.233648 | 2021-11-15T17:30:23 | 2021-11-15T17:30:23 | 428,358,211 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 172 | java | package com.BootCampProject1.BootCampProject1.OTHERS.products;
public class CATEGORY {
private int ID;
private String NAME;
private int PARENT_CATEGORY_ID;
}
| [
"noreply@github.com"
] | noreply@github.com |
77f000a96609a7b3ae5fdeb082ab4735f868dd64 | 9f70c6c3652d0a6cf7c4f8e91e400ce3afc0691d | /ch04/readinglist-secured/src/main/java/readinglist/SecurityConfig.java | d3d0b192926bf140674187f643580413d2379bea | [] | no_license | brant-hwang/sbia_examples | b7117e34afd5f2fc1a43b6fc52b77114dd1bd676 | 36cf0cb8916c73aa5243644b12d4f41705b17b3f | refs/heads/master | 2020-12-13T23:31:30.699682 | 2016-06-19T08:51:50 | 2016-06-19T08:51:50 | 59,036,296 | 1 | 0 | null | 2016-05-17T15:46:07 | 2016-05-17T15:46:07 | null | UTF-8 | Java | false | false | 1,793 | java | package readinglist;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
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.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private ReaderRepository readerRepository;
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/").access("hasRole('READER')")
.antMatchers("/**").permitAll()
.and()
.formLogin()
.loginPage("/login")
.failureUrl("/login?error=true");
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userDetailsService());
}
@Bean
public UserDetailsService userDetailsService() {
return new UserDetailsService() {
@Override
public UserDetails loadUserByUsername(String username) {
return readerRepository.findOne(username);
}
};
}
}
| [
"dlstj3039@gmail.com"
] | dlstj3039@gmail.com |
313f605193bdb415b07e02684d7c4ceb089c99c3 | 275a2dce112a72e91f596fd271400c35b41ff8cf | /src/main/java/com/theismann/loginAndReg/validator/UserValidator.java | 48af51e55971c0a923cd2433fe59dbf852121d82 | [] | no_license | stormysea22/LoginAndRegJava | e8be5342920dc28b58e69e3d48b2a90cae7a04ca | 46bd9d6c4cc921df30ceb03d4ac974cbce720ff6 | refs/heads/master | 2023-04-09T21:38:50.861069 | 2021-04-26T20:51:20 | 2021-04-26T20:51:20 | 361,877,776 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,058 | java | package com.theismann.loginAndReg.validator;
import org.springframework.stereotype.Component;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;
import com.theismann.loginAndReg.models.User;
import com.theismann.loginAndReg.service.UserService;
@Component
public class UserValidator implements Validator {
private final UserService userService;
public UserValidator(UserService userService) {
this.userService = userService;
}
@Override
public boolean supports(Class<?> clazz) {
return User.class.equals(clazz);
}
// 2
@Override
public void validate(Object target, Errors errors) {
User user = (User) target;
if (!user.getPasswordConfirmation().equals(user.getPassword())) {
// 3
errors.rejectValue("passwordConfirmation", "Match");
}
if(this.userService.findByEmail(user.getEmail().toLowerCase()) != null) {
errors.rejectValue("email", "DupeEmail");
}
}
}
| [
"59316889+stormysea22@users.noreply.github.com"
] | 59316889+stormysea22@users.noreply.github.com |
8bc4ee3dd892b37e6d257272fe785b59ed1efb1b | 0f2609e764d40300f001292d5071e6b2571979f2 | /zxkj-modules/zxkj-report/src/main/java/com/dzf/zxkj/report/excel/cwbb/ZcfzExcelField.java | ea10529dbd5db59393cb5d03f9790957969d4a5c | [] | no_license | zhoutiancheng77/dzfui | 6c46b5c120e295417b821dfcb3b61e2f1662e803 | 8b8fdac31cc03f94183949665251f172338ae7ee | refs/heads/master | 2022-12-25T02:15:35.292638 | 2020-07-09T08:36:34 | 2020-07-09T08:36:34 | 303,602,589 | 3 | 4 | null | null | null | null | UTF-8 | Java | false | false | 4,556 | java | package com.dzf.zxkj.report.excel.cwbb;
import com.dzf.zxkj.common.lang.DZFDate;
import com.dzf.zxkj.excel.param.Fieldelement;
import com.dzf.zxkj.excel.param.MuiltSheetAndTitleExceport;
import com.dzf.zxkj.excel.param.TitleColumnExcelport;
import com.dzf.zxkj.platform.model.report.ZcFzBVO;
import com.dzf.zxkj.report.utils.ReportUtil;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 资产负债表表导出配置
*
* @author zhw
*
*/
public class ZcfzExcelField extends MuiltSheetAndTitleExceport<ZcFzBVO> {
private ZcFzBVO[] zcfzvos = null;
private List<ZcFzBVO[]> allsheetzcvos = null;
private String[] periods = null;
private String[] allsheetname = null;
private String qj = null;
private String now = DZFDate.getDate(new Date()).toString();
private String creator = null;
private String corpname = null;
private String corptype;
private boolean zeroshownull = true;
public ZcfzExcelField(boolean zeroshownull) {
this.zeroshownull = zeroshownull;
}
@Override
public String getExcelport2007Name() {
return "资产负债表("+corpname+")-" + new ReportUtil().formatqj(periods) + ".xlsx";
}
@Override
public String getExcelport2003Name() {
return "资产负债表("+corpname+")-" + new ReportUtil().formatqj(periods) + ".xls";
}
@Override
public String getExceportHeadName() {
return "资产负债表";
}
@Override
public String getSheetName() {
return "资产负债表";
}
@Override
public ZcFzBVO[] getData() {
return zcfzvos;
}
@Override
public Fieldelement[] getFieldInfo() {
return new Fieldelement[] {
new Fieldelement("zc", "资产", false, 0, false,30,false),
new Fieldelement("hc1", "行次", false, 0, false),
new Fieldelement("qmye1", "期末余额", true, 2, zeroshownull),
new Fieldelement("ncye1", "年初余额", true, 2, zeroshownull),
new Fieldelement("fzhsyzqy", "负债和所有者权益", false, 0, false,30,false),
new Fieldelement("hc2", "行次", false, 0, false),
new Fieldelement("qmye2", "期末余额", true, 2, zeroshownull),
new Fieldelement("ncye2", "年初余额", true, 2, zeroshownull)};
}
public void setZcfzvos(ZcFzBVO[] zcfzvos) {
this.zcfzvos = zcfzvos;
}
@Override
public String getQj() {
return qj;
}
@Override
public String getCreateSheetDate() {
return now;
}
@Override
public String getCreateor() {
return creator;
}
public void setQj(String qj) {
this.qj = qj;
}
public void setCreator(String creator) {
this.creator = creator;
}
@Override
public String getCorpName() {
return corpname;
}
public void setCorpName(String corpname) {
this.corpname = corpname;
}
@Override
public boolean[] isShowTitDetail() {
return new boolean[] { true, true, true };
}
@Override
public List<ZcFzBVO[]> getAllSheetData() {
return allsheetzcvos;
}
@Override
public String[] getAllSheetName() {
return allsheetname;
}
public List<ZcFzBVO[]> getAllsheetzcvos() {
return allsheetzcvos;
}
public void setAllsheetzcvos(List<ZcFzBVO[]> allsheetzcvos) {
this.allsheetzcvos = allsheetzcvos;
}
public String[] getAllsheetname() {
return allsheetname;
}
public void setAllsheetname(String[] allsheetname) {
this.allsheetname = allsheetname;
}
public boolean isZeroshownull() {
return zeroshownull;
}
public void setZeroshownull(boolean zeroshownull) {
this.zeroshownull = zeroshownull;
}
public String[] getPeriods() {
return periods;
}
public void setPeriods(String[] periods) {
this.periods = periods;
}
@Override
public String[] getAllPeriod() {
return periods;
}
public String getCorptype() {
return corptype;
}
public void setCorptype(String corptype) {
this.corptype = corptype;
}
@Override
public List<TitleColumnExcelport> getHeadColumns() {
String column2_name = "01表";
if ("00000100AA10000000000BMD".equals(corptype)) {// 小企业
column2_name = "会小企业01表";
} else if ("00000100AA10000000000BMF".equals(corptype)) {//企业会计准则
column2_name = "会企01表";
}
List<TitleColumnExcelport> lists = new ArrayList<TitleColumnExcelport>();
TitleColumnExcelport column2 = new TitleColumnExcelport(1, column2_name, HorizontalAlignment.RIGHT);
lists.add(column2);
return lists;
}
@Override
public TitleColumnExcelport getTitleColumns() {
TitleColumnExcelport column1 = new TitleColumnExcelport(1, getSheetName(), HorizontalAlignment.RIGHT);
return column1;
}
}
| [
"zhangj@admin-PC"
] | zhangj@admin-PC |
cadce259ccca0acfc710fbcefed0d2105e66e199 | 2b0b5da1a9ef4a452b83158b68441aecd5a64929 | /Project-1-JeffIbarra468/src/main/java/com/revature/service/SubmitService.java | dce10fd6c31d19d92716059a3ea70bcfd201e277 | [] | no_license | JeffIbarra468/Project-1-JeffIbarra468 | 9ee7617b99ef45b2f3870efa9bbdf30ae511b07d | a7389681f579a8a239e5bf0aa73f1b12f78c88ce | refs/heads/master | 2022-12-10T09:28:40.727485 | 2019-07-15T18:01:45 | 2019-07-15T18:01:45 | 196,723,740 | 0 | 0 | null | 2022-11-16T12:25:52 | 2019-07-13T13:17:33 | Java | UTF-8 | Java | false | false | 679 | java | package com.revature.service;
import com.revature.data.ReimbursementDAO;
import com.revature.model.Reimbursement;
public class SubmitService {
ReimbursementDAO reimbursementDAO;
// Dependency injection
public SubmitService(ReimbursementDAO reimbursementDAO) {
this.reimbursementDAO = reimbursementDAO;
}
// Pass reimbursment object to DAOIMPL and return true if created successful
public boolean submitReimbursement(long uId, long remId, String descrip, Double cost) {
//Is false at first
boolean check = false;
check = reimbursementDAO.submitReimbursement(uId, remId, descrip, cost);
if(check == true)
return true;
else
return false;
}
}
| [
"jeffibarra468@gmail.com"
] | jeffibarra468@gmail.com |
68a0114ce7470827053896a2b8497caf67bb3378 | 13ea5da0b7b8d4ba87d622a5f733dcf6b4c5f1e3 | /crash-reproduction-ws/results/XCOMMONS-928-8-1-Single_Objective_GGA-WeightedSum/org/xwiki/job/AbstractJob_ESTest_scaffolding.java | e2f361c1a3fe459744a7c1a0714691a99165bac9 | [
"MIT",
"CC-BY-4.0"
] | permissive | STAMP-project/Botsing-basic-block-coverage-application | 6c1095c6be945adc0be2b63bbec44f0014972793 | 80ea9e7a740bf4b1f9d2d06fe3dcc72323b848da | refs/heads/master | 2022-07-28T23:05:55.253779 | 2022-04-20T13:54:11 | 2022-04-20T13:54:11 | 285,771,370 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 429 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Mon Mar 30 17:17:27 UTC 2020
*/
package org.xwiki.job;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
@EvoSuiteClassExclude
public class AbstractJob_ESTest_scaffolding {
// Empty scaffolding for empty test suite
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
a416b637f2ce0835fb3e79162b7a100802aa370a | cdb3b5cb2af60cb0101322643be372575a9d47e3 | /Engine/src/me/engine/physics/CollisionShape.java | 2f672f835cf1ca6489e56a51bcb7936cbad5c27b | [] | no_license | haved/2DTileGame | 1fde82713e47c869be998794e7ce8b5a40458164 | 7c7e839f454bc1842d3caf6cec3db93eebbbeeae | refs/heads/master | 2021-01-01T16:06:42.958781 | 2013-11-17T14:19:25 | 2013-11-17T14:19:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 332 | java | package me.engine.physics;
public interface CollisionShape
{
public boolean isHoldingUp(CollisionShape shape);
public boolean isHoldingDown(CollisionShape shape);
public boolean isHoldingLeft(CollisionShape shape);
public boolean isHoldingRight(CollisionShape shape);
public boolean intersect(CollisionShape shape);
}
| [
"krogstie.havard@gmail.com"
] | krogstie.havard@gmail.com |
df7c5a670ff5d797a4fd1110d570d0e7dc16ff49 | b616db477c80c2c2d9775eb7b66f87be70a252b8 | /Foundations/PP-Engg-Foundations-Master/PP-Engg-Common-Core/src/main/java/jk/pp/engg/foundations/common/core/util/AppGlobalObjects.java | 5e20249ecbf7726109ee9f668b33011f03ff2add | [] | no_license | javakishore-veleti/PP-Engineering | 2634dac71136f9f134617e584690e1e21043da6b | 004363d329a5a2f03401a77b8a930c6029439a9a | refs/heads/main | 2023-05-07T00:49:59.730274 | 2021-05-25T02:08:45 | 2021-05-25T02:08:45 | 369,681,887 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,288 | java | package jk.pp.engg.foundations.common.core.util;
import java.util.HashMap;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.databind.ObjectMapper;
import jk.pp.engg.foundations.common.core.pubsub.PubSubConsumerInitiator;
@Component
public class AppGlobalObjects {
private static final Logger LOGGER = LoggerFactory.getLogger(AppGlobalObjects.class);
public static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
private Map<String, PubSubConsumerInitiator> pubSubConsumerInitHandlers = new HashMap<>();
@Value("${pp.platform.common.executor.threads:3}")
private Integer executeThreads = 3;
public void registerPubSubConsumerInitHandler(String handlerRefId, PubSubConsumerInitiator initiator) {
LOGGER.debug("PubSubConsumerInitHandler RefId " + handlerRefId);
this.pubSubConsumerInitHandlers.put(handlerRefId, initiator);
}
public void invokeConsumerInitHandlers() {
this.pubSubConsumerInitHandlers.values().forEach(aConsumerInitHandler -> {
try {
aConsumerInitHandler.initiatePubSubConsumers();
} catch (Exception e) {
LOGGER.error("Exception occured", e);
}
});
}
}
| [
"vavkkishore@kishores-mbp.home"
] | vavkkishore@kishores-mbp.home |
bb3bfa96088543af7e9d2b4a8df43bcbac60c33c | 3e94deb04cbf1ec7e2d569d647c866e3073b7696 | /Java21/Java21/src/com/java21days/idea/RangeLister.java | 1ecdbea3a8798d8bafe96a6ebeb856cfc4c01bd7 | [] | no_license | MatFabi/JavaIn21DaysBook | 090279dba4b75533b8c8ca0dbf04425dd340a5d3 | b54cb94b70284c1d0b5cca5f439672cecfa2ae76 | refs/heads/master | 2020-04-05T20:30:28.932042 | 2018-11-12T08:54:11 | 2018-11-12T08:54:11 | 157,183,379 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 821 | 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 com.java21days.idea;
/**
*
* @author Mateusz
*/
public class RangeLister {
int[] makeRange(int lower, int upper){
int[] range = new int[(upper-lower)+1];
for(int i=0; i<range.length; i++){
range[i]=lower++;
}
return range;
}
public static void main(String[] args) {
int[]range;
RangeLister lister = new RangeLister();
range=lister.makeRange(4,13);
System.out.print("Tablica: [ ");
for(int i=0; i<range.length;i++){
System.out.print(range[i]+" ");
}
System.out.println("]");
}
}
| [
"matseb.fabiszewski@gmail.com"
] | matseb.fabiszewski@gmail.com |
5008feba6d8c6590e7b284700541664d478273ee | d0994cc550408dc1b6088c1cefe2ab7e3ba5b21d | /app/src/main/java/com/sample/paging/ContactDao.java | 158885460e5b5a67deee709cb0b8080210c142d8 | [
"Apache-2.0"
] | permissive | mayangming/PagingWithRoomJavaSample | b6a5e222faf132de9f8b1cb32eb0d7a1256cb13b | 2d06f67cd4a05b8d50ed5d2d20bc24b22be6391a | refs/heads/master | 2022-07-27T01:41:12.170890 | 2020-05-09T17:15:25 | 2020-05-09T17:15:25 | 262,587,369 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 548 | java | package com.sample.paging;
import androidx.paging.DataSource;
import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import java.util.List;
@Dao
public interface ContactDao{
@Insert(onConflict = OnConflictStrategy.REPLACE)
void insert(ContactBean contactBean);
@Insert(onConflict = OnConflictStrategy.REPLACE)
void insert(List<ContactBean> contactBeans);
@Query("SELECT * FROM contact")
DataSource.Factory<Integer, ContactBean> queryPageContact();
} | [
"531973474@qq.com"
] | 531973474@qq.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.