blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2
values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 9.45M | extension stringclasses 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1c20cbc408080fb8f82dea9b1240c70d0b9458d8 | 9a667fcd46de08adf497b00e25dc0d17c3b6d734 | /src/PreparedStmt.java | 96e009c527bfc0f946f29aa7f668c70a0acda99b | [] | no_license | Red-French/JDBC | 04740f07b6ba7ad330f30180d93fd7c18695c116 | e9f820915d9786bccb4ee9cbb8f4a56236cddca1 | refs/heads/master | 2021-01-19T22:59:49.513457 | 2017-04-22T21:28:28 | 2017-04-22T21:28:28 | 88,904,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,823 | java | import java.sql.*;
public class PreparedStmt {
public static void main(String[] args) throws SQLException {
String url = "jdbc:mysql://localhost:3306/demo";
String user = "student";
String password = "student";
Connection myConn = null;
PreparedStatement myStmt = null;
ResultSet results = null;
try {
myConn = DriverManager.getConnection(url, user, password);
myStmt = myConn.prepareStatement("select * from employees where salary > ? and department=?");
System.out.println("Prepared statement: salary > 80000 and department = Legal\n");
myStmt.setDouble(1, 80000); // salary value
myStmt.setString(2, "Legal"); // department value
results = myStmt.executeQuery();
displayEmployees(myStmt, results);
System.out.println("\nReuse the prepared statement: salary > 25000 and department = HR \n");
myStmt.setDouble(1, 25000); // salary value
myStmt.setString(2, "HR"); // department value
results = myStmt.executeQuery();
displayEmployees(myStmt, results);
} catch (Exception exc) {
exc.printStackTrace();
} finally {
if (myConn != null) {
myConn.close();
}
if (results != null) {
results.close();
}
if (myStmt != null) {
myStmt.close();
}
}
}
private static void displayEmployees(PreparedStatement myStmt, ResultSet results) throws SQLException {
try {
while (results.next()) {
String lastName = results.getString("last_name");
String firstName = results.getString("first_name");
double salary = results.getDouble("salary");
String department = results.getString("department");
System.out.printf("%s, %s, %.2f, %s\n", lastName, firstName, salary, department);
}
}
catch (Exception exc) {
exc.printStackTrace();
}
}
}
| [
"red@redfrench.net"
] | red@redfrench.net |
e5fbcbc8b68df7aedd9b01a3ae9550a1402b35b8 | 6baf1fe00541560788e78de5244ae17a7a2b375a | /hollywood/com.oculus.browser-base/sources/defpackage/C1501Yo0.java | 2875d67a5ef93009541f5dd394bc32c5869db5dd | [] | no_license | phwd/quest-tracker | 286e605644fc05f00f4904e51f73d77444a78003 | 3d46fbb467ba11bee5827f7cae7dfeabeb1fd2ba | refs/heads/main | 2023-03-29T20:33:10.959529 | 2021-04-10T22:14:11 | 2021-04-10T22:14:11 | 357,185,040 | 4 | 2 | null | 2021-04-12T12:28:09 | 2021-04-12T12:28:08 | null | UTF-8 | Java | false | false | 960 | java | package defpackage;
/* renamed from: Yo0 reason: default package and case insensitive filesystem */
/* compiled from: chromium-OculusBrowser.apk-stable-281887347 */
public final class C1501Yo0 extends AbstractC4340q31 {
public static final CC[] b;
public static final CC c;
public C3093in0 d;
static {
CC[] ccArr = {new CC(16, 0)};
b = ccArr;
c = ccArr[0];
}
public C1501Yo0() {
super(16, 0);
}
public static C1501Yo0 d(C2740gj0 gj0) {
C4709sD sDVar = new C4709sD(gj0);
sDVar.b();
try {
C1501Yo0 yo0 = new C1501Yo0(sDVar.c(b).b);
yo0.d = C3093in0.d(sDVar.s(8, true));
return yo0;
} finally {
sDVar.a();
}
}
@Override // defpackage.AbstractC4340q31
public final void a(C1648aL aLVar) {
aLVar.x(c).i(this.d, 8, true);
}
public C1501Yo0(int i) {
super(16, i);
}
}
| [
"cyuubiapps@gmail.com"
] | cyuubiapps@gmail.com |
6800a4b7e731b358b92f5d005699b7ad7a13ba2a | 324a9c058d5a5ddf16eb2ed79d40052259f43b39 | /src/main/java/com/wzy/springboot_demo/enttiy/ServerSettings.java | 9b2e6c6513259dd14e8ed98d3d516575851c9d81 | [] | no_license | iswangzy/springboot_demo | 478bdd73f5030cf79a8fc64de5e7ff10919cf94e | 1c6ed05ff09139909589650669d8599f536737a7 | refs/heads/master | 2020-03-19T01:42:10.612032 | 2018-05-31T10:02:14 | 2018-05-31T10:02:14 | 135,565,706 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 834 | java | package com.wzy.springboot_demo.enttiy;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
/**
* springboot_demo
* 服务器配置
*
* @author Wang Zhiyuan
* @date 2018-05-31 17:13
**/
@Component
@PropertySource({"classpath:application.properties"})
@ConfigurationProperties
public class ServerSettings {
private String name;
private String domain;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDomain() {
return domain;
}
public void setDomain(String domain) {
this.domain = domain;
}
}
| [
"iswangzy@163.com"
] | iswangzy@163.com |
007797935b902771373884538ad4545f81834545 | 635162ba17786e6f366f712cb8c31ffb42633554 | /project/securities-portal/src/main/java/cn/hzstk/securities/sys/mapper/RoleMapper.java | 396ab4175d10e56994838c817a1abcc8e4528db8 | [] | no_license | macrogoal/wwh.stock | 19aeed117f57acc1f22f3ed0caf34e481f00eb9c | 8847a4bc6707dd881ea28133b621cf81431d845b | refs/heads/master | 2020-04-17T05:51:47.771160 | 2018-04-04T06:21:15 | 2018-04-04T06:21:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,032 | java | package cn.hzstk.securities.sys.mapper;
import cn.hzstk.securities.sys.domain.Role;
import org.apache.ibatis.annotations.*;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
import java.util.Map;
/**
* Created by allenwc on 15/9/10.
*/
public interface RoleMapper extends Mapper<Role> {
@Select("select * from sys_role where valid='1' and id in (select role_id from sys_r_user_role where valid='1' and user_id=#{value})")
@Results(value = {
@Result(property = "id", column = "ID"),
@Result(property = "name", column = "NAME"),
@Result(property = "code", column = "code"),
@Result(property = "note", column = "note")
})
public List<Role> getRolesByUser(Long userId);
@Delete("DELETE FROM sys_r_user_role where user_id=#{userId}")
public void deleteByUser(Long userId);
@Insert("INSERT INTO sys_r_user_role(user_id,role_id,CREATE_DATE,CREATOR) VALUES (#{userId},#{roleId},NOW(),#{creator})")
public void insertRoleUser(Map map);
}
| [
"wwzero@hotmail.com"
] | wwzero@hotmail.com |
a53ce1f923ecef5523c986f16e3ec81f800ce302 | 394e7605f3bd67f95b8e565f347777781ac1ae5d | /technical-service/src/main/java/com/upgrad/technical/service/business/AdminService.java | 7ee5912df0e80639a5ecbc9f27435fbce98e4a02 | [] | no_license | AbhishekSharma011/imagehosting | 3c944a62939945936b252dce0c884f2a4bb4f5b0 | 796d0418171551f659074981b3225eb11917fb22 | refs/heads/master | 2023-04-30T19:09:15.389114 | 2021-05-25T09:47:21 | 2021-05-25T09:47:21 | 370,640,973 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,021 | java | package com.upgrad.technical.service.business;
import com.upgrad.technical.service.dao.ImageDao;
import com.upgrad.technical.service.dao.UserDao;
import com.upgrad.technical.service.entity.ImageEntity;
import com.upgrad.technical.service.entity.UserAuthTokenEntity;
import com.upgrad.technical.service.exception.ImageNotFoundException;
import com.upgrad.technical.service.exception.UnauthorizedException;
import com.upgrad.technical.service.exception.UserNotSignedInException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.time.ZonedDateTime;
import java.time.temporal.ChronoUnit;
import java.util.Comparator;
@Service
public class AdminService {
@Autowired
private ImageDao imageDao;
public ImageEntity getImage(final String imageUuid, final String authorization) throws ImageNotFoundException, UnauthorizedException, UserNotSignedInException {
UserAuthTokenEntity userAuthTokenEntity = imageDao.getUserAuthToken(authorization);
if(userAuthTokenEntity == null)
throw new UserNotSignedInException("\"USR-001","You are not Signed in, sign in first to get the details");
String role = userAuthTokenEntity.getUser().getRole();
if(!role.equals("admin"))
{
throw new UnauthorizedException("ATH-001", "UNAUTHORIZED Access, Entered user is an admin.");
}
ImageEntity findImage = imageDao.getImage(imageUuid);
if(findImage == null)
throw new ImageNotFoundException("IMG-001", "Image with Uuid not found");
return findImage;
}
@Transactional(propagation = Propagation.REQUIRED)
public ImageEntity updateImage(final ImageEntity imageEntity, final String authorization) throws ImageNotFoundException, UnauthorizedException, UserNotSignedInException {
UserAuthTokenEntity userAuthTokenEntity = imageDao.getUserAuthToken(authorization);
if(userAuthTokenEntity == null)
throw new UserNotSignedInException("USR-001", "You are not Signed in, sign in first to get the details");
String role = userAuthTokenEntity.getUser().getRole();
if(!role.equals("admin"))
throw new UnauthorizedException("ATH-001", "UNAUTHORIZED Access, Entered user is not an admin.");
ImageEntity updateImage = imageDao.getImageById(imageEntity.getId());
if(updateImage == null)
throw new ImageNotFoundException("IMG-001", "Image with Id not found.");
updateImage.setImage(imageEntity.getImage());
updateImage.setStatus(imageEntity.getStatus());
updateImage.setDescription(imageEntity.getDescription());
updateImage.setName(imageEntity.getName());
imageDao.updateImage(updateImage);
return updateImage;
}
}
| [
"rahulbeniwal18112002@gmail.com"
] | rahulbeniwal18112002@gmail.com |
7f1abb432b8c650039851dbf9bf4edc143ac4700 | bdcbd183ef964e078ef0f0c1d103245462718fc3 | /BeHereDesktop-master/src/main/java/GUIClasses/AffectationSectionsController.java | 12743d53a39fa7e9076bd866abbbe4857caa6d5c | [
"MIT",
"LicenseRef-scancode-other-permissive"
] | permissive | OmarMokhfi/Behere | 1af3c582cb0df8ef0b194a3a86a8c51ec0cf4153 | 5178f6b60824ea1515e1ae4da4057276fccecfc1 | refs/heads/master | 2021-06-06T21:57:28.047953 | 2019-08-13T18:05:59 | 2019-08-13T18:05:59 | 146,942,899 | 0 | 1 | NOASSERTION | 2021-06-04T01:02:36 | 2018-08-31T21:15:58 | Java | UTF-8 | Java | false | false | 8,625 | java | package GUIClasses;
import StructureClasses.*;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.concurrent.Task;
import javafx.concurrent.WorkerStateEvent;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.TableView;
import FirebaseClasses.DbOperations;
import java.net.URL;
import java.util.ResourceBundle;
public class AffectationSectionsController implements Initializable{
@FXML
private ChoiceBox<Enseignant> enseignantsChoiceBox;
@FXML
private ChoiceBox<Cycle> cyclesChoiceBox;
@FXML
private ChoiceBox<Filliere> fillieresChoiceBox;
@FXML
private ChoiceBox<Specialite> specialitesChoiceBox;
@FXML
private ChoiceBox<Promo> promosChoiceBox;
@FXML
private ChoiceBox<Section> sectionsChoiceBox;
@FXML
private ChoiceBox<Module> modulesChoiceBox;
@FXML
private TableView<Section> sectionsTableView;
public void initialize(URL location, ResourceBundle resources) {
// remplissage des choiceBox de l'interface
loadEnseignantsToChoiceBox();
loadCyclesToChoiceBox();
enseignantsChoiceBox.valueProperty().addListener(new ChangeListener<Enseignant>() {
public void changed(ObservableValue<? extends Enseignant> observable, Enseignant oldValue, Enseignant newValue) {
loadModulesToChoiceBox();
}
});
cyclesChoiceBox.valueProperty().addListener(new ChangeListener<Cycle>() {
public void changed(ObservableValue<? extends Cycle> observable, Cycle oldValue, Cycle newValue) {
loadFillieresToChoiceBox();
}
});
fillieresChoiceBox.valueProperty().addListener(new ChangeListener<Filliere>() {
public void changed(ObservableValue<? extends Filliere> observable, Filliere oldValue, Filliere newValue) {
if(fillieresChoiceBox.getSelectionModel().getSelectedItem()!=null)
loadSpecialiteToChoiceBox();
}
});
specialitesChoiceBox.valueProperty().addListener(new ChangeListener<Specialite>() {
public void changed(ObservableValue<? extends Specialite> observable, Specialite oldValue, Specialite newValue) {
if(specialitesChoiceBox.getSelectionModel().getSelectedItem()!=null)
loadPromosToChoiceBox();
}
});
promosChoiceBox.valueProperty().addListener(new ChangeListener<Promo>() {
public void changed(ObservableValue<? extends Promo> observable, Promo oldValue, Promo newValue) {
if(promosChoiceBox.getSelectionModel().getSelectedItem()!=null){
loadSectionsToChoiceBox();
}
}
});
modulesChoiceBox.valueProperty().addListener(new ChangeListener<Module>() {
public void changed(ObservableValue<? extends Module> observable, Module oldValue, Module newValue) {
loadEnseignantSectionsToTableView();
}
});
//
}
private void loadEnseignantSectionsToTableView() {
String idEnseignant = enseignantsChoiceBox.getSelectionModel().getSelectedItem().getId();
String idModule = modulesChoiceBox.getSelectionModel().getSelectedItem().getId();
String[] attributs = {"designation"};
String[] columnsTitle = {"Designation"};
String[] path = {DbOperations.ENSEIGNANT_MODULE.substring(1), idEnseignant, idModule, DbOperations.SECTIONS.substring(1)};
//String path = DbOperations.firebasePath(DbOperations.ENSEIGNANT_MODULE, idEnseignant, idModule, DbOperations.SECTIONS);
GUIutils.loadChildrenToTableView(sectionsTableView, path, Structure.class, Section.class,
attributs, columnsTitle);
}
private void loadEnseignantsToChoiceBox() {
String[] path = {DbOperations.ENSEIGNANT_MODULE.substring(1)};
GUIutils.loadChildrenToChoiceBox(enseignantsChoiceBox, path, Structure.class, Enseignant.class);
}
private void loadCyclesToChoiceBox() {
String[] path = {DbOperations.CYCLES.substring(1)};
GUIutils.loadChildrenToChoiceBox(cyclesChoiceBox, path, Structure.class, Cycle.class);
}
private void loadFillieresToChoiceBox() {
sectionsChoiceBox.getItems().clear();
promosChoiceBox.getItems().clear();
sectionsChoiceBox.getItems().clear();
String cycleId = cyclesChoiceBox.getSelectionModel().getSelectedItem().getId();
//String path = DbOperations.firebasePath(DbOperations.CYCLES, cycleId);
String[] path = {DbOperations.CYCLES.substring(1), cycleId};
GUIutils.loadChildrenToChoiceBox(fillieresChoiceBox, path, Cycle.class, Filliere.class);
}
private void loadSpecialiteToChoiceBox() {
promosChoiceBox.getItems().clear();
sectionsChoiceBox.getItems().clear();
String idFilliere = fillieresChoiceBox.getSelectionModel().getSelectedItem().getId();
//String path = DbOperations.firebasePath(DbOperations.FILIERE_SPECIALITES, idFilliere);
String[] path = {DbOperations.FILIERE_SPECIALITES.substring(1), idFilliere};
GUIutils.loadChildrenToChoiceBox(specialitesChoiceBox, path, Filliere.class, Specialite.class);
}
private void loadPromosToChoiceBox() {
sectionsChoiceBox.getItems().clear();
String idCycle = cyclesChoiceBox.getSelectionModel().getSelectedItem().getId();
String idFilliere = fillieresChoiceBox.getSelectionModel().getSelectedItem().getId();
String[] path = {DbOperations.CYCLES.substring(1), idCycle, idFilliere};
//String path = DbOperations.firebasePath(DbOperations.CYCLES, idCycle, idFilliere);
GUIutils.loadChildrenToChoiceBox(promosChoiceBox, path, Section.class, Promo.class);
}
private void loadSectionsToChoiceBox() {
String idCycle = cyclesChoiceBox.getSelectionModel().getSelectedItem().getId();
String idFilliere = fillieresChoiceBox.getSelectionModel().getSelectedItem().getId();
String idPromo = promosChoiceBox.getSelectionModel().getSelectedItem().getId();
//String path = DbOperations.firebasePath(DbOperations.CYCLES, idCycle, idFilliere, idPromo);
String[] path = {DbOperations.CYCLES.substring(1), idCycle, idFilliere, idPromo};
GUIutils.loadChildrenToChoiceBox(sectionsChoiceBox, path, Promo.class, Section.class);
}
private void loadModulesToChoiceBox() {
sectionsTableView.getColumns().clear();
String idEnseignant =enseignantsChoiceBox.getSelectionModel().getSelectedItem().getId();
//String path = DbOperations.firebasePath(DbOperations.ENSEIGNANT_MODULE, idEnseignant);
String[] path = {DbOperations.ENSEIGNANT_MODULE.substring(1), idEnseignant};
GUIutils.loadChildrenToChoiceBox(modulesChoiceBox, path, Enseignant.class, Module.class);
}
public void affecterSectionToEnseignant(ActionEvent actionEvent) {
Enseignant enseignant = enseignantsChoiceBox.getSelectionModel().getSelectedItem();
Module module = modulesChoiceBox.getSelectionModel().getSelectedItem();
Section section = sectionsChoiceBox.getSelectionModel().getSelectedItem();
final Task<Void> affectationTask = affecterSectionDbTask(enseignant, module, section);
affectationTask.setOnSucceeded(new EventHandler<WorkerStateEvent>() {
public void handle(WorkerStateEvent event) {
GUIutils.taskIndicatorForm.getDialogStage().close();
DbGestionController.actualiserLaBaseDeDonnee();
loadEnseignantSectionsToTableView();
}
});
GUIutils.taskIndicatorForm.activateProgressBar(affectationTask);
GUIutils.taskIndicatorForm.getDialogStage().show();
GUIutils.executor.execute(affectationTask);
}
private Task<Void> affecterSectionDbTask(final Enseignant enseignant, final Module module, final Section section) {
final Task<Void> affectationTask = new Task<Void>() {
@Override
protected Void call() throws Exception {
enseignant.affecterSection(module, section);
DbGestionController.actualiserLaBaseDeDonnee();
loadEnseignantSectionsToTableView();
return null;
}
};
return affectationTask;
}
} | [
"omar.mokhfi.official@gmail.com"
] | omar.mokhfi.official@gmail.com |
74ce5002856c28c99435d32e6219c0062fba2372 | a0f8e4a59e874ba906ed39dbf8840d8b2353561a | /TryGank/app/src/main/java/com/gypsophila/trygank/business/gank/view/IGankView.java | 839f47e9031d702741c330ac724ec4fa8b8b5bd4 | [
"Apache-2.0"
] | permissive | AstroGypsophila/TryGank | 2826ea028a3b94dead3e72f4066305f0bd237c98 | cf0402af19bb2fdbd23a12b43d000025eea7c6df | refs/heads/master | 2021-06-14T08:49:40.611274 | 2017-04-29T16:12:17 | 2017-04-29T16:12:17 | 65,220,786 | 56 | 3 | null | null | null | null | UTF-8 | Java | false | false | 562 | java | package com.gypsophila.trygank.business.gank.view;
import com.gypsophila.trygank.entity.GankBean;
import java.util.List;
/**
* Description :
* Author : AstroGypsophila
* GitHub : https://github.com/AstroGypsophila
* Date : 2016/9/28
*/
public interface IGankView {
//加载过程显示进度反馈
void showProgress();
void addNews(List<GankBean> gankBeanList);
void hideProgress();
void showLoadFailMsg(String msg);
void showFilteringPopUpMenu();
void showNoData(boolean shown);
void showMessage(String msg);
}
| [
"astro_chenjie@163.com"
] | astro_chenjie@163.com |
2c3d23b883fcb6dafcb7c22c422a75fe0e9b367e | 78eebe3055f221475a69072936fc581469084d60 | /src/main/java/NetSocket/UDPProvide.java | 882b333c59f64b17da568d217f9e053ddc57e498 | [] | no_license | Chendaseven/Design-Pattern-Code | f8373b5e8756b570d32f37695e5920de3763e486 | 1f061050afb008086a3a40c48fa2f5b296bb2cd3 | refs/heads/master | 2021-07-06T11:23:38.110125 | 2019-08-28T12:51:01 | 2019-08-28T12:51:01 | 181,653,493 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,108 | java | package NetSocket;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.util.Scanner;
import org.junit.Test;
public class UDPProvide {
@Test
public void provideTest() throws IOException {
//1.指定一个端口进行发送
DatagramSocket socket = new DatagramSocket();
//2.指定一个IP
InetAddress addr = InetAddress.getByName("127.0.0.1");
int port = 5051;
//3.准备一个小容器
byte[] sendBuf;
while (true){
Scanner scanner = new Scanner(System.in);
System.out.println("你要发什么东西:");
String s = scanner.nextLine();
//4.加入要放的数据
sendBuf = s.getBytes();
//5.数据打包
DatagramPacket packet = new DatagramPacket(sendBuf,sendBuf.length,addr,port);
//6.发送包
socket.send(packet);
if (s.equals("exit")){
break;
}
}
//7.释放资源
socket.close();
}
}
| [
"854810360@qq.com"
] | 854810360@qq.com |
eb079aaeb93e886cdfdc8a99aca6c76ba32769e6 | 20eb62855cb3962c2d36fda4377dfd47d82eb777 | /newEvaluatedBugs/Jsoup_31_buggy/mutated/1252/HtmlTreeBuilderState.java | 103f52587cdcfb2f8020fe69c49dc72492610911 | [] | no_license | ozzydong/CapGen | 356746618848065cce4e253e5d3c381baa85044a | 0ba0321b6b1191443276021f1997833342f02515 | refs/heads/master | 2023-03-18T20:12:02.923428 | 2020-08-21T03:08:28 | 2020-08-21T03:08:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 68,543 | java | package org.jsoup.parser;
import org.jsoup.helper.DescendableLinkedList;
import org.jsoup.helper.StringUtil;
import org.jsoup.nodes.*;
import java.util.Iterator;
import java.util.LinkedList;
/**
* The Tree Builder's current state. Each state embodies the processing for the state, and transitions to other states.
*/
enum HtmlTreeBuilderState {
Initial {
boolean process(Token t, HtmlTreeBuilder tb) {
if (isWhitespace(t)) {
return true; // ignore whitespace
} else if (t.isComment()) {
tb.insert(t.asComment());
} else if (t.isDoctype()) {
// todo: parse error check on expected doctypes
// todo: quirk state check on doctype ids
Token.Doctype d = t.asDoctype();
DocumentType doctype = new DocumentType(d.getName(), d.getPublicIdentifier(), d.getSystemIdentifier(), tb.getBaseUri());
tb.getDocument().appendChild(doctype);
if (d.isForceQuirks())
tb.getDocument().quirksMode(Document.QuirksMode.quirks);
tb.transition(BeforeHtml);
} else {
// todo: check not iframe srcdoc
tb.transition(BeforeHtml);
return tb.process(t); // re-process token
}
return true;
}
},
BeforeHtml {
boolean process(Token t, HtmlTreeBuilder tb) {
if (t.isDoctype()) {
tb.error(this);
return false;
} else if (t.isComment()) {
tb.insert(t.asComment());
} else if (isWhitespace(t)) {
return true; // ignore whitespace
} else if (t.isStartTag() && t.asStartTag().name().equals("html")) {
tb.insert(t.asStartTag());
tb.transition(BeforeHead);
} else if (t.isEndTag() && (StringUtil.in(t.asEndTag().name(), "head", "body", "html", "br"))) {
return anythingElse(t, tb);
} else if (t.isEndTag()) {
tb.error(this);
return false;
} else {
return anythingElse(t, tb);
}
return true;
}
private boolean anythingElse(Token t, HtmlTreeBuilder tb) {
tb.insert("html");
tb.transition(BeforeHead);
return tb.process(t);
}
},
BeforeHead {
boolean process(Token t, HtmlTreeBuilder tb) {
if (isWhitespace(t)) {
return true;
} else if (t.isComment()) {
tb.insert(t.asComment());
} else if (t.isDoctype()) {
tb.error(this);
return false;
} else if (t.isStartTag() && t.asStartTag().name().equals("html")) {
return InBody.process(t, tb); // does not transition
} else if (t.isStartTag() && t.asStartTag().name().equals("head")) {
Element head = tb.insert(t.asStartTag());
tb.setHeadElement(head);
tb.transition(InHead);
} else if (t.isEndTag() && (StringUtil.in(t.asEndTag().name(), "head", "body", "html", "br"))) {
tb.process(new Token.StartTag("head"));
return tb.process(t);
} else if (t.isEndTag()) {
tb.error(this);
return false;
} else {
tb.process(new Token.StartTag("head"));
return tb.process(t);
}
return true;
}
},
InHead {
boolean process(Token t, HtmlTreeBuilder tb) {
if (isWhitespace(t)) {
tb.insert(t.asCharacter());
return true;
}
switch (t.type) {
case Comment:
tb.insert(t.asComment());
break;
case Doctype:
tb.error(this);
return false;
case StartTag:
Token.StartTag start = t.asStartTag();
String name = start.name();
if (name.equals("html")) {
return InBody.process(t, tb);
} else if (StringUtil.in(name, "base", "basefont", "bgsound", "command", "link")) {
Element el = tb.insertEmpty(start);
// jsoup special: update base the frist time it is seen
if (name.equals("base") && el.hasAttr("href"))
tb.maybeSetBaseUri(el);
} else if (name.equals("meta")) {
Element meta = tb.insertEmpty(start);
// todo: charset switches
} else if (name.equals("title")) {
handleRcData(start, tb);
} else if (StringUtil.in(name, "noframes", "style")) {
handleRawtext(start, tb);
} else if (name.equals("noscript")) {
// else if noscript && scripting flag = true: rawtext (jsoup doesn't run script, to handle as noscript)
tb.insert(start);
tb.transition(InHeadNoscript);
} else if (name.equals("script")) {
// skips some script rules as won't execute them
tb.tokeniser.transition(TokeniserState.ScriptData);
tb.markInsertionMode();
tb.transition(Text);
tb.insert(start);
} else if (name.equals("head")) {
tb.error(this);
return false;
} else {
return anythingElse(t, tb);
}
break;
case EndTag:
Token.EndTag end = t.asEndTag();
name = end.name();
if (name.equals("head")) {
tb.pop();
tb.transition(AfterHead);
} else if (StringUtil.in(name, "body", "html", "br")) {
return anythingElse(t, tb);
} else {
tb.error(this);
return false;
}
break;
default:
return anythingElse(t, tb);
}
return true;
}
private boolean anythingElse(Token t, TreeBuilder tb) {
tb.process(new Token.EndTag("head"));
return tb.process(t);
}
},
InHeadNoscript {
boolean process(Token t, HtmlTreeBuilder tb) {
if (t.isDoctype()) {
tb.error(this);
} else if (t.isStartTag() && t.asStartTag().name().equals("html")) {
return tb.process(t, InBody);
} else if (t.isEndTag() && t.asEndTag().name().equals("noscript")) {
tb.pop();
tb.transition(InHead);
} else if (isWhitespace(t) || t.isComment() || (t.isStartTag() && StringUtil.in(t.asStartTag().name(),
"basefont", "bgsound", "link", "meta", "noframes", "style"))) {
return tb.process(t, InHead);
} else if (t.isEndTag() && t.asEndTag().name().equals("br")) {
return anythingElse(t, tb);
} else if ((t.isStartTag() && StringUtil.in(t.asStartTag().name(), "head", "noscript")) || t.isEndTag()) {
tb.error(this);
return false;
} else {
return anythingElse(t, tb);
}
return true;
}
private boolean anythingElse(Token t, HtmlTreeBuilder tb) {
tb.error(this);
tb.process(new Token.EndTag("noscript"));
return tb.process(t);
}
},
AfterHead {
boolean process(Token t, HtmlTreeBuilder tb) {
if (isWhitespace(t)) {
tb.insert(t.asCharacter());
} else if (t.isComment()) {
tb.insert(t.asComment());
} else if (t.isDoctype()) {
tb.error(this);
} else if (t.isStartTag()) {
Token.StartTag startTag = t.asStartTag();
String name = startTag.name();
if (name.equals("html")) {
return tb.process(t, InBody);
} else if (name.equals("body")) {
tb.insert(startTag);
tb.framesetOk(false);
tb.transition(InBody);
} else if (name.equals("frameset")) {
tb.insert(startTag);
tb.transition(InFrameset);
} else if (StringUtil.in(name, "base", "basefont", "bgsound", "link", "meta", "noframes", "script", "style", "title")) {
tb.error(this);
Element head = tb.getHeadElement();
tb.push(head);
tb.process(t, InHead);
tb.removeFromStack(head);
} else if (name.equals("head")) {
tb.error(this);
return false;
} else {
anythingElse(t, tb);
}
} else if (t.isEndTag()) {
if (StringUtil.in(t.asEndTag().name(), "body", "html")) {
anythingElse(t, tb);
} else {
tb.error(this);
return false;
}
} else {
anythingElse(t, tb);
}
return true;
}
private boolean anythingElse(Token t, HtmlTreeBuilder tb) {
tb.process(new Token.StartTag("body"));
tb.framesetOk(true);
return tb.process(t);
}
},
InBody {
boolean process(Token t, HtmlTreeBuilder tb) {
switch (t.type) {
case Character: {
Token.Character c = t.asCharacter();
if (c.getData().equals(nullString)) {
// todo confirm that check
tb.error(this);
return false;
} else if (isWhitespace(c)) {
tb.reconstructFormattingElements();
tb.insert(c);
} else {
tb.reconstructFormattingElements();
tb.insert(c);
tb.framesetOk(false);
}
break;
}
case Comment: {
tb.insert(t.asComment());
break;
}
case Doctype: {
tb.error(this);
return false;
}
case StartTag:
Token.StartTag startTag = t.asStartTag();
String name = startTag.name();
if (name.equals("html")) {
tb.error(this);
// merge attributes onto real html
Element html = tb.getStack().getFirst();
for (Attribute attribute : startTag.getAttributes()) {
if (!html.hasAttr(attribute.getKey()))
html.attributes().put(attribute);
}
} else if (StringUtil.in(name, "base", "basefont", "bgsound", "command", "link", "meta", "noframes", "script", "style", "title")) {
return tb.process(t, InHead);
} else if (name.equals("body")) {
tb.error(this);
LinkedList<Element> stack = tb.getStack();
if (stack.size() == 1 || (stack.size() > 2 && !stack.get(1).nodeName().equals("body"))) {
// only in fragment case
return false; // ignore
} else {
tb.framesetOk(false);
Element body = stack.get(1);
for (Attribute attribute : startTag.getAttributes()) {
if (!body.hasAttr(attribute.getKey()))
body.attributes().put(attribute);
}
}
} else if (name.equals("frameset")) {
tb.error(this);
LinkedList<Element> stack = tb.getStack();
if (stack.size() == 1 || (stack.size() > 2 && !stack.get(1).nodeName().equals("body"))) {
// only in fragment case
return false; // ignore
} else if (!tb.framesetOk()) {
return false; // ignore frameset
} else {
Element second = stack.get(1);
if (second.parent() != null)
second.remove();
// pop up to html element
while (stack.size() > 1)
stack.removeLast();
tb.insert(startTag);
tb.transition(InFrameset);
}
} else if (StringUtil.in(name,
"address", "article", "aside", "blockquote", "center", "details", "dir", "div", "dl",
"fieldset", "figcaption", "figure", "footer", "header", "hgroup", "menu", "nav", "ol",
"p", "section", "summary", "ul")) {
if (tb.inButtonScope("p")) {
tb.process(new Token.EndTag("p"));
}
tb.insert(startTag);
} else if (StringUtil.in(name, "h1", "h2", "h3", "h4", "h5", "h6")) {
if (tb.inButtonScope("p")) {
tb.process(new Token.EndTag("p"));
}
if (StringUtil.in(tb.currentElement().nodeName(), "h1", "h2", "h3", "h4", "h5", "h6")) {
tb.error(this);
tb.pop();
}
tb.insert(startTag);
} else if (StringUtil.in(name, "pre", "listing")) {
if (tb.inButtonScope("p")) {
tb.process(new Token.EndTag("p"));
}
tb.insert(startTag);
// todo: ignore LF if next token
tb.framesetOk(false);
} else if (name.equals("form")) {
if (tb.getFormElement() != null) {
tb.error(this);
return false;
}
if (tb.inButtonScope("p")) {
tb.process(new Token.EndTag("p"));
}
tb.insertForm(startTag, true);
} else if (name.equals("li")) {
tb.framesetOk(false);
LinkedList<Element> stack = tb.getStack();
for (int i = stack.size() - 1; i > 0; i--) {
Element el = stack.get(i);
if (el.nodeName().equals("li")) {
tb.process(new Token.EndTag("li"));
break;
}
if (tb.isSpecial(el) && !StringUtil.in(el.nodeName(), "address", "div", "p"))
break;
}
if (tb.inButtonScope("p")) {
tb.process(new Token.EndTag("p"));
}
tb.insert(startTag);
} else if (StringUtil.in(name, "dd", "dt")) {
tb.framesetOk(false);
LinkedList<Element> stack = tb.getStack();
for (int i = stack.size() - 1; i > 0; i--) {
Element el = stack.get(i);
if (StringUtil.in(el.nodeName(), "dd", "dt")) {
tb.process(new Token.EndTag(el.nodeName()));
break;
}
if (tb.isSpecial(el) && !StringUtil.in(el.nodeName(), "address", "div", "p"))
break;
}
if (tb.inButtonScope("p")) {
tb.process(new Token.EndTag("p"));
}
tb.insert(startTag);
} else if (name.equals("plaintext")) {
if (tb.inButtonScope("p")) {
tb.process(new Token.EndTag("p"));
}
tb.insert(startTag);
tb.tokeniser.transition(TokeniserState.PLAINTEXT); // once in, never gets out
} else if (name.equals("button")) {
if (tb.inButtonScope("button")) {
// close and reprocess
tb.error(this);
tb.process(new Token.EndTag("button"));
tb.process(startTag);
} else {
tb.reconstructFormattingElements();
tb.insert(startTag);
tb.framesetOk(false);
}
} else if (name.equals("a")) {
if (tb.getActiveFormattingElement("a") != null) {
tb.error(this);
tb.process(new Token.EndTag("a"));
// still on stack?
Element remainingA = tb.getFromStack("a");
if (remainingA != null) {
tb.removeFromActiveFormattingElements(remainingA);
tb.removeFromStack(remainingA);
}
}
tb.reconstructFormattingElements();
Element a = tb.insert(startTag);
tb.pushActiveFormattingElements(a);
} else if (StringUtil.in(name,
"b", "big", "code", "em", "font", "i", "s", "small", "strike", "strong", "tt", "u")) {
tb.reconstructFormattingElements();
Element el = tb.insert(startTag);
tb.pushActiveFormattingElements(el);
} else if (name.equals("nobr")) {
tb.reconstructFormattingElements();
if (tb.inScope("nobr")) {
tb.error(this);
tb.process(new Token.EndTag("nobr"));
tb.reconstructFormattingElements();
}
Element el = tb.insert(startTag);
tb.pushActiveFormattingElements(el);
} else if (StringUtil.in(name, "applet", "marquee", "object")) {
tb.reconstructFormattingElements();
tb.insert(startTag);
tb.insertMarkerToFormattingElements();
tb.framesetOk(false);
} else if (name.equals("table")) {
if (tb.getDocument().quirksMode() != Document.QuirksMode.quirks && tb.inButtonScope("p")) {
tb.process(new Token.EndTag("p"));
}
tb.insert(startTag);
tb.framesetOk(false);
tb.transition(InTable);
} else if (StringUtil.in(name, "area", "br", "embed", "img", "keygen", "wbr")) {
tb.reconstructFormattingElements();
tb.insertEmpty(startTag);
tb.framesetOk(false);
} else if (name.equals("input")) {
tb.reconstructFormattingElements();
Element el = tb.insertEmpty(startTag);
if (!el.attr("type").equalsIgnoreCase("hidden"))
tb.framesetOk(false);
} else if (StringUtil.in(name, "param", "source", "track")) {
tb.insertEmpty(startTag);
} else if (name.equals("hr")) {
if (tb.inButtonScope("p")) {
tb.process(new Token.EndTag("p"));
}
tb.insertEmpty(startTag);
tb.framesetOk(false);
} else if (name.equals("image")) {
// we're not supposed to ask.
startTag.name("img");
return tb.process(startTag);
} else if (name.equals("isindex")) {
// how much do we care about the early 90s?
tb.error(this);
if (tb.getFormElement() != null)
return false;
tb.tokeniser.acknowledgeSelfClosingFlag();
tb.process(new Token.StartTag("form"));
if (startTag.attributes.hasKey("action")) {
Element form = tb.getFormElement();
form.attr("action", startTag.attributes.get("action"));
}
tb.process(new Token.StartTag("hr"));
tb.process(new Token.StartTag("label"));
// hope you like english.
String prompt = startTag.attributes.hasKey("prompt") ?
startTag.attributes.get("prompt") :
"This is a searchable index. Enter search keywords: ";
tb.process(new Token.Character(prompt));
// input
Attributes inputAttribs = new Attributes();
for (Attribute attr : startTag.attributes) {
if (!StringUtil.in(attr.getKey(), "name", "action", "prompt"))
inputAttribs.put(attr);
}
inputAttribs.put("name", "isindex");
tb.process(new Token.StartTag("input", inputAttribs));
tb.process(new Token.EndTag("label"));
tb.process(new Token.StartTag("hr"));
tb.process(new Token.EndTag("form"));
} else if (name.equals("textarea")) {
tb.insert(startTag);
// todo: If the next token is a U+000A LINE FEED (LF) character token, then ignore that token and move on to the next one. (Newlines at the start of textarea elements are ignored as an authoring convenience.)
tb.tokeniser.transition(TokeniserState.Rcdata);
tb.markInsertionMode();
tb.framesetOk(false);
tb.transition(Text);
} else if (name.equals("xmp")) {
if (tb.inButtonScope("p")) {
tb.process(new Token.EndTag("p"));
}
tb.reconstructFormattingElements();
tb.framesetOk(false);
handleRawtext(startTag, tb);
} else if (name.equals("iframe")) {
tb.framesetOk(false);
handleRawtext(startTag, tb);
} else if (name.equals("noembed")) {
// also handle noscript if script enabled
handleRawtext(startTag, tb);
} else if (name.equals("select")) {
tb.reconstructFormattingElements();
tb.insert(startTag);
tb.framesetOk(false);
HtmlTreeBuilderState state = tb.state();
if (state.equals(InTable) || state.equals(InCaption) || state.equals(InTableBody) || state.equals(InRow) || state.equals(InCell))
tb.transition(InSelectInTable);
else
tb.transition(InSelect);
} else if (StringUtil.in("optgroup", "option")) {
if (tb.currentElement().nodeName().equals("option"))
tb.process(new Token.EndTag("option"));
tb.reconstructFormattingElements();
tb.insert(startTag);
} else if (StringUtil.in("rp", "rt")) {
if (tb.inScope("ruby")) {
tb.generateImpliedEndTags();
if (!tb.currentElement().nodeName().equals("ruby")) {
tb.error(this);
tb.popStackToBefore("ruby"); // i.e. close up to but not include name
}
tb.insert(startTag);
}
} else if (name.equals("math")) {
tb.reconstructFormattingElements();
// todo: handle A start tag whose tag name is "math" (i.e. foreign, mathml)
tb.insert(startTag);
tb.tokeniser.acknowledgeSelfClosingFlag();
} else if (name.equals("svg")) {
tb.reconstructFormattingElements();
// todo: handle A start tag whose tag name is "svg" (xlink, svg)
tb.insert(startTag);
tb.tokeniser.acknowledgeSelfClosingFlag();
} else if (StringUtil.in(name,
"caption", "col", "colgroup", "frame", "head", "tbody", "td", "tfoot", "th", "thead", "tr")) {
tb.error(this);
return false;
} else {
tb.reconstructFormattingElements();
tb.insert(startTag);
}
break;
case EndTag:
Token.EndTag endTag = t.asEndTag();
name = endTag.name();
if (name.equals("body")) {
if (!tb.inScope("body")) {
tb.error(this);
return false;
} else {
// todo: error if stack contains something not dd, dt, li, optgroup, option, p, rp, rt, tbody, td, tfoot, th, thead, tr, body, html
tb.transition(AfterBody);
}
} else if (name.equals("html")) {
boolean notIgnored = tb.process(new Token.EndTag("body"));
if (notIgnored)
return tb.process(endTag);
} else if (StringUtil.in(name,
"address", "article", "aside", "blockquote", "button", "center", "details", "dir", "div",
"dl", "fieldset", "figcaption", "figure", "footer", "header", "hgroup", "listing", "menu",
"nav", "ol", "pre", "section", "summary", "ul")) {
// todo: refactor these lookups
if (!tb.inScope(name)) {
// nothing to close
tb.error(this);
return false;
} else {
tb.generateImpliedEndTags();
if (!tb.currentElement().nodeName().equals(name))
tb.error(this);
tb.popStackToClose(name);
}
} else if (name.equals("form")) {
Element currentForm = tb.getFormElement();
tb.setFormElement(null);
if (currentForm == null || !tb.inScope(name)) {
tb.error(this);
return false;
} else {
tb.generateImpliedEndTags();
if (!tb.currentElement().nodeName().equals(name))
tb.error(this);
// remove currentForm from stack. will shift anything under up.
tb.removeFromStack(currentForm);
}
} else if (name.equals("p")) {
if (!tb.inButtonScope(name)) {
tb.error(this);
tb.process(new Token.StartTag(name)); // if no p to close, creates an empty <p></p>
return tb.process(endTag);
} else {
tb.generateImpliedEndTags(name);
if (!tb.currentElement().nodeName().equals(name))
tb.error(this);
tb.popStackToClose(name);
}
} else if (name.equals("li")) {
if (!tb.inListItemScope(name)) {
tb.error(this);
return false;
} else {
tb.generateImpliedEndTags(name);
if (!tb.currentElement().nodeName().equals(name))
tb.error(this);
tb.popStackToClose(name);
}
} else if (StringUtil.in(name, "dd", "dt")) {
if (!tb.inScope(name)) {
tb.error(this);
return false;
} else {
tb.generateImpliedEndTags(name);
if (!tb.currentElement().nodeName().equals(name))
tb.error(this);
tb.popStackToClose(name);
}
} else if (StringUtil.in(name, "h1", "h2", "h3", "h4", "h5", "h6")) {
if (!tb.inScope(new String[]{"h1", "h2", "h3", "h4", "h5", "h6"})) {
tb.error(this);
return false;
} else {
tb.generateImpliedEndTags(name);
if (!tb.currentElement().nodeName().equals(name))
tb.error(this);
tb.popStackToClose("h1", "h2", "h3", "h4", "h5", "h6");
}
} else if (name.equals("sarcasm")) {
// *sigh*
return anyOtherEndTag(t, tb);
} else if (StringUtil.in(name,
"a", "b", "big", "code", "em", "font", "i", "nobr", "s", "small", "strike", "strong", "tt", "u")) {
// Adoption Agency Algorithm.
OUTER:
for (int i = 0; i < 8; i++) {
Element formatEl = tb.getActiveFormattingElement(name);
if (formatEl == null)
return anyOtherEndTag(t, tb);
else if (!tb.onStack(formatEl)) {
tb.error(this);
tb.removeFromActiveFormattingElements(formatEl);
return true;
} else if (!tb.inScope(formatEl.nodeName())) {
tb.error(this);
return false;
} else if (tb.currentElement() != formatEl)
tb.error(this);
Element furthestBlock = null;
Element commonAncestor = null;
boolean seenFormattingElement = false;
LinkedList<Element> stack = tb.getStack();
// the spec doesn't limit to < 64, but in degenerate cases (9000+ stack depth) this prevents
// run-aways
for (int si = 0; si < stack.size() && si < 64; si++) {
Element el = stack.get(si);
if (el == formatEl) {
commonAncestor = stack.get(si - 1);
seenFormattingElement = true;
} else if (seenFormattingElement && tb.isSpecial(el)) {
furthestBlock = el;
break;
}
}
if (furthestBlock == null) {
tb.popStackToClose(formatEl.nodeName());
tb.removeFromActiveFormattingElements(formatEl);
return true;
}
// todo: Let a bookmark note the position of the formatting element in the list of active formatting elements relative to the elements on either side of it in the list.
// does that mean: int pos of format el in list?
Element node = furthestBlock;
Element lastNode = furthestBlock;
INNER:
for (int j = 0; j < 3; j++) {
if (tb.onStack(node))
node = tb.aboveOnStack(node);
if (!tb.isInActiveFormattingElements(node)) { // note no bookmark check
tb.removeFromStack(node);
continue INNER;
} else if (node == formatEl)
break INNER;
Element replacement = new Element(Tag.valueOf(node.nodeName()), tb.getBaseUri());
tb.replaceActiveFormattingElement(node, replacement);
tb.replaceOnStack(node, replacement);
node = replacement;
if (lastNode == furthestBlock) {
// todo: move the aforementioned bookmark to be immediately after the new node in the list of active formatting elements.
// not getting how this bookmark both straddles the element above, but is inbetween here...
}
if (lastNode.parent() != null)
lastNode.remove();
node.appendChild(lastNode);
lastNode = node;
}
if (StringUtil.in(commonAncestor.nodeName(), "table", "tbody", "tfoot", "thead", "tr")) {
if (lastNode.parent() != null)
lastNode.remove();
tb.insertInFosterParent(lastNode);
} else {
if (lastNode.parent() != null)
lastNode.remove();
commonAncestor.appendChild(lastNode);
}
Element adopter = new Element(Tag.valueOf(name), tb.getBaseUri());
Node[] childNodes = furthestBlock.childNodes().toArray(new Node[furthestBlock.childNodeSize()]);
for (Node childNode : childNodes) {
adopter.appendChild(childNode); // append will reparent. thus the clone to avoid concurrent mod.
}
furthestBlock.appendChild(adopter);
tb.removeFromActiveFormattingElements(formatEl);
// todo: insert the new element into the list of active formatting elements at the position of the aforementioned bookmark.
tb.removeFromStack(formatEl);
tb.insertOnStackAfter(furthestBlock, adopter);
}
} else if (StringUtil.in(name, "applet", "marquee", "object")) {
if (!tb.inScope("name")) {
if (!tb.inScope(name)) {
tb.error(this);
return false;
}
tb.generateImpliedEndTags();
if (!tb.currentElement().nodeName().equals(name))
tb.error(this);
tb.popStackToClose(name);
tb.clearFormattingElementsToLastMarker();
}
} else if (name.equals("br")) {
tb.error(this);
tb.process(new Token.StartTag("br"));
return false;
} else {
return anyOtherEndTag(t, tb);
}
break;
case EOF:
// todo: error if stack contains something not dd, dt, li, p, tbody, td, tfoot, th, thead, tr, body, html
// stop parsing
break;
}
return true;
}
boolean anyOtherEndTag(Token t, HtmlTreeBuilder tb) {
String name = t.asEndTag().name();
DescendableLinkedList<Element> stack = tb.getStack();
Iterator<Element> it = stack.descendingIterator();
while (it.hasNext()) {
Element node = it.next();
if (node.nodeName().equals(name)) {
tb.generateImpliedEndTags(name);
tb.process(new org.jsoup.parser.Token.EndTag("button"));
if (!name.equals(tb.currentElement().nodeName()))
tb.error(this);
tb.popStackToClose(name);
break;
} else {
if (tb.isSpecial(node)) {
tb.error(this);
return false;
}
}
}
return true;
}
},
Text {
// in script, style etc. normally treated as data tags
boolean process(Token t, HtmlTreeBuilder tb) {
if (t.isCharacter()) {
tb.insert(t.asCharacter());
} else if (t.isEOF()) {
tb.error(this);
// if current node is script: already started
tb.pop();
tb.transition(tb.originalState());
return tb.process(t);
} else if (t.isEndTag()) {
// if: An end tag whose tag name is "script" -- scripting nesting level, if evaluating scripts
tb.pop();
tb.transition(tb.originalState());
}
return true;
}
},
InTable {
boolean process(Token t, HtmlTreeBuilder tb) {
if (t.isCharacter()) {
tb.newPendingTableCharacters();
tb.markInsertionMode();
tb.transition(InTableText);
return tb.process(t);
} else if (t.isComment()) {
tb.insert(t.asComment());
return true;
} else if (t.isDoctype()) {
tb.error(this);
return false;
} else if (t.isStartTag()) {
Token.StartTag startTag = t.asStartTag();
String name = startTag.name();
if (name.equals("caption")) {
tb.clearStackToTableContext();
tb.insertMarkerToFormattingElements();
tb.insert(startTag);
tb.transition(InCaption);
} else if (name.equals("colgroup")) {
tb.clearStackToTableContext();
tb.insert(startTag);
tb.transition(InColumnGroup);
} else if (name.equals("col")) {
tb.process(new Token.StartTag("colgroup"));
return tb.process(t);
} else if (StringUtil.in(name, "tbody", "tfoot", "thead")) {
tb.clearStackToTableContext();
tb.insert(startTag);
tb.transition(InTableBody);
} else if (StringUtil.in(name, "td", "th", "tr")) {
tb.process(new Token.StartTag("tbody"));
return tb.process(t);
} else if (name.equals("table")) {
tb.error(this);
boolean processed = tb.process(new Token.EndTag("table"));
if (processed) // only ignored if in fragment
return tb.process(t);
} else if (StringUtil.in(name, "style", "script")) {
return tb.process(t, InHead);
} else if (name.equals("input")) {
if (!startTag.attributes.get("type").equalsIgnoreCase("hidden")) {
return anythingElse(t, tb);
} else {
tb.insertEmpty(startTag);
}
} else if (name.equals("form")) {
tb.error(this);
if (tb.getFormElement() != null)
return false;
else {
tb.insertForm(startTag, false);
}
} else {
return anythingElse(t, tb);
}
return true; // todo: check if should return processed http://www.whatwg.org/specs/web-apps/current-work/multipage/tree-construction.html#parsing-main-intable
} else if (t.isEndTag()) {
Token.EndTag endTag = t.asEndTag();
String name = endTag.name();
if (name.equals("table")) {
if (!tb.inTableScope(name)) {
tb.error(this);
return false;
} else {
tb.popStackToClose("table");
}
tb.resetInsertionMode();
} else if (StringUtil.in(name,
"body", "caption", "col", "colgroup", "html", "tbody", "td", "tfoot", "th", "thead", "tr")) {
tb.error(this);
return false;
} else {
return anythingElse(t, tb);
}
return true; // todo: as above todo
} else if (t.isEOF()) {
if (tb.currentElement().nodeName().equals("html"))
tb.error(this);
return true; // stops parsing
}
return anythingElse(t, tb);
}
boolean anythingElse(Token t, HtmlTreeBuilder tb) {
tb.error(this);
boolean processed = true;
if (StringUtil.in(tb.currentElement().nodeName(), "table", "tbody", "tfoot", "thead", "tr")) {
tb.setFosterInserts(true);
processed = tb.process(t, InBody);
tb.setFosterInserts(false);
} else {
processed = tb.process(t, InBody);
}
return processed;
}
},
InTableText {
boolean process(Token t, HtmlTreeBuilder tb) {
switch (t.type) {
case Character:
Token.Character c = t.asCharacter();
if (c.getData().equals(nullString)) {
tb.error(this);
return false;
} else {
tb.getPendingTableCharacters().add(c);
}
break;
default:
if (tb.getPendingTableCharacters().size() > 0) {
for (Token.Character character : tb.getPendingTableCharacters()) {
if (!isWhitespace(character)) {
// InTable anything else section:
tb.error(this);
if (StringUtil.in(tb.currentElement().nodeName(), "table", "tbody", "tfoot", "thead", "tr")) {
tb.setFosterInserts(true);
tb.process(character, InBody);
tb.setFosterInserts(false);
} else {
tb.process(character, InBody);
}
} else
tb.insert(character);
}
tb.newPendingTableCharacters();
}
tb.transition(tb.originalState());
return tb.process(t);
}
return true;
}
},
InCaption {
boolean process(Token t, HtmlTreeBuilder tb) {
if (t.isEndTag() && t.asEndTag().name().equals("caption")) {
Token.EndTag endTag = t.asEndTag();
String name = endTag.name();
if (!tb.inTableScope(name)) {
tb.error(this);
return false;
} else {
tb.generateImpliedEndTags();
if (!tb.currentElement().nodeName().equals("caption"))
tb.error(this);
tb.popStackToClose("caption");
tb.clearFormattingElementsToLastMarker();
tb.transition(InTable);
}
} else if ((
t.isStartTag() && StringUtil.in(t.asStartTag().name(),
"caption", "col", "colgroup", "tbody", "td", "tfoot", "th", "thead", "tr") ||
t.isEndTag() && t.asEndTag().name().equals("table"))
) {
tb.error(this);
boolean processed = tb.process(new Token.EndTag("caption"));
if (processed)
return tb.process(t);
} else if (t.isEndTag() && StringUtil.in(t.asEndTag().name(),
"body", "col", "colgroup", "html", "tbody", "td", "tfoot", "th", "thead", "tr")) {
tb.error(this);
return false;
} else {
return tb.process(t, InBody);
}
return true;
}
},
InColumnGroup {
boolean process(Token t, HtmlTreeBuilder tb) {
if (isWhitespace(t)) {
tb.insert(t.asCharacter());
return true;
}
switch (t.type) {
case Comment:
tb.insert(t.asComment());
break;
case Doctype:
tb.error(this);
break;
case StartTag:
Token.StartTag startTag = t.asStartTag();
String name = startTag.name();
if (name.equals("html"))
return tb.process(t, InBody);
else if (name.equals("col"))
tb.insertEmpty(startTag);
else
return anythingElse(t, tb);
break;
case EndTag:
Token.EndTag endTag = t.asEndTag();
name = endTag.name();
if (name.equals("colgroup")) {
if (tb.currentElement().nodeName().equals("html")) { // frag case
tb.error(this);
return false;
} else {
tb.pop();
tb.transition(InTable);
}
} else
return anythingElse(t, tb);
break;
case EOF:
if (tb.currentElement().nodeName().equals("html"))
return true; // stop parsing; frag case
else
return anythingElse(t, tb);
default:
return anythingElse(t, tb);
}
return true;
}
private boolean anythingElse(Token t, TreeBuilder tb) {
boolean processed = tb.process(new Token.EndTag("colgroup"));
if (processed) // only ignored in frag case
return tb.process(t);
return true;
}
},
InTableBody {
boolean process(Token t, HtmlTreeBuilder tb) {
switch (t.type) {
case StartTag:
Token.StartTag startTag = t.asStartTag();
String name = startTag.name();
if (name.equals("tr")) {
tb.clearStackToTableBodyContext();
tb.insert(startTag);
tb.transition(InRow);
} else if (StringUtil.in(name, "th", "td")) {
tb.error(this);
tb.process(new Token.StartTag("tr"));
return tb.process(startTag);
} else if (StringUtil.in(name, "caption", "col", "colgroup", "tbody", "tfoot", "thead")) {
return exitTableBody(t, tb);
} else
return anythingElse(t, tb);
break;
case EndTag:
Token.EndTag endTag = t.asEndTag();
name = endTag.name();
if (StringUtil.in(name, "tbody", "tfoot", "thead")) {
if (!tb.inTableScope(name)) {
tb.error(this);
return false;
} else {
tb.clearStackToTableBodyContext();
tb.pop();
tb.transition(InTable);
}
} else if (name.equals("table")) {
return exitTableBody(t, tb);
} else if (StringUtil.in(name, "body", "caption", "col", "colgroup", "html", "td", "th", "tr")) {
tb.error(this);
return false;
} else
return anythingElse(t, tb);
break;
default:
return anythingElse(t, tb);
}
return true;
}
private boolean exitTableBody(Token t, HtmlTreeBuilder tb) {
if (!(tb.inTableScope("tbody") || tb.inTableScope("thead") || tb.inScope("tfoot"))) {
// frag case
tb.error(this);
return false;
}
tb.clearStackToTableBodyContext();
tb.process(new Token.EndTag(tb.currentElement().nodeName())); // tbody, tfoot, thead
return tb.process(t);
}
private boolean anythingElse(Token t, HtmlTreeBuilder tb) {
return tb.process(t, InTable);
}
},
InRow {
boolean process(Token t, HtmlTreeBuilder tb) {
if (t.isStartTag()) {
Token.StartTag startTag = t.asStartTag();
String name = startTag.name();
if (StringUtil.in(name, "th", "td")) {
tb.clearStackToTableRowContext();
tb.insert(startTag);
tb.transition(InCell);
tb.insertMarkerToFormattingElements();
} else if (StringUtil.in(name, "caption", "col", "colgroup", "tbody", "tfoot", "thead", "tr")) {
return handleMissingTr(t, tb);
} else {
return anythingElse(t, tb);
}
} else if (t.isEndTag()) {
Token.EndTag endTag = t.asEndTag();
String name = endTag.name();
if (name.equals("tr")) {
if (!tb.inTableScope(name)) {
tb.error(this); // frag
return false;
}
tb.clearStackToTableRowContext();
tb.pop(); // tr
tb.transition(InTableBody);
} else if (name.equals("table")) {
return handleMissingTr(t, tb);
} else if (StringUtil.in(name, "tbody", "tfoot", "thead")) {
if (!tb.inTableScope(name)) {
tb.error(this);
return false;
}
tb.process(new Token.EndTag("tr"));
return tb.process(t);
} else if (StringUtil.in(name, "body", "caption", "col", "colgroup", "html", "td", "th")) {
tb.error(this);
return false;
} else {
return anythingElse(t, tb);
}
} else {
return anythingElse(t, tb);
}
return true;
}
private boolean anythingElse(Token t, HtmlTreeBuilder tb) {
return tb.process(t, InTable);
}
private boolean handleMissingTr(Token t, TreeBuilder tb) {
boolean processed = tb.process(new Token.EndTag("tr"));
if (processed)
return tb.process(t);
else
return false;
}
},
InCell {
boolean process(Token t, HtmlTreeBuilder tb) {
if (t.isEndTag()) {
Token.EndTag endTag = t.asEndTag();
String name = endTag.name();
if (StringUtil.in(name, "td", "th")) {
if (!tb.inTableScope(name)) {
tb.error(this);
tb.transition(InRow); // might not be in scope if empty: <td /> and processing fake end tag
return false;
}
tb.generateImpliedEndTags();
if (!tb.currentElement().nodeName().equals(name))
tb.error(this);
tb.popStackToClose(name);
tb.clearFormattingElementsToLastMarker();
tb.transition(InRow);
} else if (StringUtil.in(name, "body", "caption", "col", "colgroup", "html")) {
tb.error(this);
return false;
} else if (StringUtil.in(name, "table", "tbody", "tfoot", "thead", "tr")) {
if (!tb.inTableScope(name)) {
tb.error(this);
return false;
}
closeCell(tb);
return tb.process(t);
} else {
return anythingElse(t, tb);
}
} else if (t.isStartTag() &&
StringUtil.in(t.asStartTag().name(),
"caption", "col", "colgroup", "tbody", "td", "tfoot", "th", "thead", "tr")) {
if (!(tb.inTableScope("td") || tb.inTableScope("th"))) {
tb.error(this);
return false;
}
closeCell(tb);
return tb.process(t);
} else {
return anythingElse(t, tb);
}
return true;
}
private boolean anythingElse(Token t, HtmlTreeBuilder tb) {
return tb.process(t, InBody);
}
private void closeCell(HtmlTreeBuilder tb) {
if (tb.inTableScope("td"))
tb.process(new Token.EndTag("td"));
else
tb.process(new Token.EndTag("th")); // only here if th or td in scope
}
},
InSelect {
boolean process(Token t, HtmlTreeBuilder tb) {
switch (t.type) {
case Character:
Token.Character c = t.asCharacter();
if (c.getData().equals(nullString)) {
tb.error(this);
return false;
} else {
tb.insert(c);
}
break;
case Comment:
tb.insert(t.asComment());
break;
case Doctype:
tb.error(this);
return false;
case StartTag:
Token.StartTag start = t.asStartTag();
String name = start.name();
if (name.equals("html"))
return tb.process(start, InBody);
else if (name.equals("option")) {
tb.process(new Token.EndTag("option"));
tb.insert(start);
} else if (name.equals("optgroup")) {
if (tb.currentElement().nodeName().equals("option"))
tb.process(new Token.EndTag("option"));
else if (tb.currentElement().nodeName().equals("optgroup"))
tb.process(new Token.EndTag("optgroup"));
tb.insert(start);
} else if (name.equals("select")) {
tb.error(this);
return tb.process(new Token.EndTag("select"));
} else if (StringUtil.in(name, "input", "keygen", "textarea")) {
tb.error(this);
if (!tb.inSelectScope("select"))
return false; // frag
tb.process(new Token.EndTag("select"));
return tb.process(start);
} else if (name.equals("script")) {
return tb.process(t, InHead);
} else {
return anythingElse(t, tb);
}
break;
case EndTag:
Token.EndTag end = t.asEndTag();
name = end.name();
if (name.equals("optgroup")) {
if (tb.currentElement().nodeName().equals("option") && tb.aboveOnStack(tb.currentElement()) != null && tb.aboveOnStack(tb.currentElement()).nodeName().equals("optgroup"))
tb.process(new Token.EndTag("option"));
if (tb.currentElement().nodeName().equals("optgroup"))
tb.pop();
else
tb.error(this);
} else if (name.equals("option")) {
if (tb.currentElement().nodeName().equals("option"))
tb.pop();
else
tb.error(this);
} else if (name.equals("select")) {
if (!tb.inSelectScope(name)) {
tb.error(this);
return false;
} else {
tb.popStackToClose(name);
tb.resetInsertionMode();
}
} else
return anythingElse(t, tb);
break;
case EOF:
if (!tb.currentElement().nodeName().equals("html"))
tb.error(this);
break;
default:
return anythingElse(t, tb);
}
return true;
}
private boolean anythingElse(Token t, HtmlTreeBuilder tb) {
tb.error(this);
return false;
}
},
InSelectInTable {
boolean process(Token t, HtmlTreeBuilder tb) {
if (t.isStartTag() && StringUtil.in(t.asStartTag().name(), "caption", "table", "tbody", "tfoot", "thead", "tr", "td", "th")) {
tb.error(this);
tb.process(new Token.EndTag("select"));
return tb.process(t);
} else if (t.isEndTag() && StringUtil.in(t.asEndTag().name(), "caption", "table", "tbody", "tfoot", "thead", "tr", "td", "th")) {
tb.error(this);
if (tb.inTableScope(t.asEndTag().name())) {
tb.process(new Token.EndTag("select"));
return (tb.process(t));
} else
return false;
} else {
return tb.process(t, InSelect);
}
}
},
AfterBody {
boolean process(Token t, HtmlTreeBuilder tb) {
if (isWhitespace(t)) {
return tb.process(t, InBody);
} else if (t.isComment()) {
tb.insert(t.asComment()); // into html node
} else if (t.isDoctype()) {
tb.error(this);
return false;
} else if (t.isStartTag() && t.asStartTag().name().equals("html")) {
return tb.process(t, InBody);
} else if (t.isEndTag() && t.asEndTag().name().equals("html")) {
if (tb.isFragmentParsing()) {
tb.error(this);
return false;
} else {
tb.transition(AfterAfterBody);
}
} else if (t.isEOF()) {
// chillax! we're done
} else {
tb.error(this);
tb.transition(InBody);
return tb.process(t);
}
return true;
}
},
InFrameset {
boolean process(Token t, HtmlTreeBuilder tb) {
if (isWhitespace(t)) {
tb.insert(t.asCharacter());
} else if (t.isComment()) {
tb.insert(t.asComment());
} else if (t.isDoctype()) {
tb.error(this);
return false;
} else if (t.isStartTag()) {
Token.StartTag start = t.asStartTag();
String name = start.name();
if (name.equals("html")) {
return tb.process(start, InBody);
} else if (name.equals("frameset")) {
tb.insert(start);
} else if (name.equals("frame")) {
tb.insertEmpty(start);
} else if (name.equals("noframes")) {
return tb.process(start, InHead);
} else {
tb.error(this);
return false;
}
} else if (t.isEndTag() && t.asEndTag().name().equals("frameset")) {
if (tb.currentElement().nodeName().equals("html")) { // frag
tb.error(this);
return false;
} else {
tb.pop();
if (!tb.isFragmentParsing() && !tb.currentElement().nodeName().equals("frameset")) {
tb.transition(AfterFrameset);
}
}
} else if (t.isEOF()) {
if (!tb.currentElement().nodeName().equals("html")) {
tb.error(this);
return true;
}
} else {
tb.error(this);
return false;
}
return true;
}
},
AfterFrameset {
boolean process(Token t, HtmlTreeBuilder tb) {
if (isWhitespace(t)) {
tb.insert(t.asCharacter());
} else if (t.isComment()) {
tb.insert(t.asComment());
} else if (t.isDoctype()) {
tb.error(this);
return false;
} else if (t.isStartTag() && t.asStartTag().name().equals("html")) {
return tb.process(t, InBody);
} else if (t.isEndTag() && t.asEndTag().name().equals("html")) {
tb.transition(AfterAfterFrameset);
} else if (t.isStartTag() && t.asStartTag().name().equals("noframes")) {
return tb.process(t, InHead);
} else if (t.isEOF()) {
// cool your heels, we're complete
} else {
tb.error(this);
return false;
}
return true;
}
},
AfterAfterBody {
boolean process(Token t, HtmlTreeBuilder tb) {
if (t.isComment()) {
tb.insert(t.asComment());
} else if (t.isDoctype() || isWhitespace(t) || (t.isStartTag() && t.asStartTag().name().equals("html"))) {
return tb.process(t, InBody);
} else if (t.isEOF()) {
// nice work chuck
} else {
tb.error(this);
tb.transition(InBody);
return tb.process(t);
}
return true;
}
},
AfterAfterFrameset {
boolean process(Token t, HtmlTreeBuilder tb) {
if (t.isComment()) {
tb.insert(t.asComment());
} else if (t.isDoctype() || isWhitespace(t) || (t.isStartTag() && t.asStartTag().name().equals("html"))) {
return tb.process(t, InBody);
} else if (t.isEOF()) {
// nice work chuck
} else if (t.isStartTag() && t.asStartTag().name().equals("noframes")) {
return tb.process(t, InHead);
} else {
tb.error(this);
return false;
}
return true;
}
},
ForeignContent {
boolean process(Token t, HtmlTreeBuilder tb) {
return true;
// todo: implement. Also; how do we get here?
}
};
private static String nullString = String.valueOf('\u0000');
abstract boolean process(Token t, HtmlTreeBuilder tb);
private static boolean isWhitespace(Token t) {
if (t.isCharacter()) {
String data = t.asCharacter().getData();
// todo: this checks more than spec - "\t", "\n", "\f", "\r", " "
for (int i = 0; i < data.length(); i++) {
char c = data.charAt(i);
if (!StringUtil.isWhitespace(c))
return false;
}
return true;
}
return false;
}
private static void handleRcData(Token.StartTag startTag, HtmlTreeBuilder tb) {
tb.insert(startTag);
tb.tokeniser.transition(TokeniserState.Rcdata);
tb.markInsertionMode();
tb.transition(Text);
}
private static void handleRawtext(Token.StartTag startTag, HtmlTreeBuilder tb) {
tb.insert(startTag);
tb.tokeniser.transition(TokeniserState.Rawtext);
tb.markInsertionMode();
tb.transition(Text);
}
}
| [
"justinwm@163.com"
] | justinwm@163.com |
645959b9edb3527f04048a01853aa5e0c2437267 | b919107375417431ddceeb73f9cef655a9b2731f | /news/src/main/java/com/zhaolw/zoo/newapi/MySystemTray.java | a4a309502594ce308b169e4635cc237b47ef524f | [] | no_license | zlwtrouble/z-boot | 940fc94606accea221f6ab57170f2ab212d6d696 | edf075eed1219db319eea20a164f4a5713c96a59 | refs/heads/master | 2022-07-16T02:13:48.920981 | 2022-03-31T05:49:39 | 2022-03-31T05:49:39 | 145,925,149 | 1 | 0 | null | 2022-06-21T04:17:04 | 2018-08-24T01:14:06 | Java | UTF-8 | Java | false | false | 2,735 | java | package com.zhaolw.zoo.newapi;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* @author zhaoliwei
* @description:
* @date 2019/5/8 19:27
**/
public class MySystemTray extends JFrame {
public MySystemTray() {
init();
}
public void init() {
this.setSize(300, 200);
this.setLocationRelativeTo(null);
this.setTray();
this.setVisible(true);
}
//添加托盘显示:1.先判断当前平台是否支持托盘显示
public void setTray() {
if (SystemTray.isSupported()) {//判断当前平台是否支持托盘功能
//创建托盘实例
SystemTray tray = SystemTray.getSystemTray();
//创建托盘图标:1.显示图标Image 2.停留提示text 3.弹出菜单popupMenu 4.创建托盘图标实例
//1.创建Image图像
Image image = Toolkit.getDefaultToolkit().getImage("trayIconImage/clientIcon.jpg");
//2.停留提示text
String text = "MySystemTray";
//3.弹出菜单popupMenu
PopupMenu popMenu = new PopupMenu();
MenuItem itmOpen = new MenuItem("打开");
itmOpen.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Show();
}
});
MenuItem itmHide = new MenuItem("隐藏");
itmHide.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
UnVisible();
}
});
MenuItem itmExit = new MenuItem("退出");
itmExit.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Exit();
}
});
popMenu.add(itmOpen);
popMenu.add(itmHide);
popMenu.add(itmExit);
//创建托盘图标
TrayIcon trayIcon = new TrayIcon(image, text, popMenu);
//将托盘图标加到托盘上
try {
tray.add(trayIcon);
} catch (AWTException e1) {
e1.printStackTrace();
}
}
}
//内部类中不方便直接调用外部类的实例(this不能指向)
public void UnVisible() {
this.setVisible(false);
}
public void Show() {
this.setVisible(true);
}
public void Exit() {
System.exit(0);
}
public static void main(String[] args) {
new MySystemTray();
}
}
| [
"resultList"
] | resultList |
4d6c7109b5f55dcbc128d38f8103c010c67b5a1c | 7f9272d77f296966b431a8801c626ce970e7738f | /src/test/java/service/impl/BaseTest.java | 549fb6763b78a7495bdf07a521db223adb0bc928 | [] | no_license | hugooocl/pers_hugo_20180731_base_item | 5130cdc1c7372d88bb29181d548e5963bc7f9c35 | 2ff3338932dfd136136bed24f5aaed6eeee324e4 | refs/heads/master | 2020-03-24T22:36:51.905758 | 2018-08-01T02:34:03 | 2018-08-01T02:34:03 | 143,094,180 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,209 | java | package service.impl;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import pojo.Base;
import pojo.Item;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityTransaction;
import javax.persistence.Persistence;
public class BaseTest {
private static EntityManagerFactory factory;
@BeforeClass
public static void init() {
factory = Persistence.createEntityManagerFactory("customers");//持久化单元//datasource
}
@AfterClass
public static void destory() {
factory.close();
}
@Test
public void testAdd() throws Exception {
EntityManager em = factory.createEntityManager();//Connection
Base base1 = new Base("base1");
Item item1 = new Item("item1",1);
Item item2 = new Item("item2",2);
item1.setBase(base1);
item2.setBase(base1);
base1.getItems().add(item1);
base1.getItems().add(item2);
EntityTransaction tx = em.getTransaction();
tx.begin();
em.persist(base1);
System.out.println(base1.toString());
tx.commit();
em.close();
}
}
| [
"hugo.qiu@oocl.com"
] | hugo.qiu@oocl.com |
a248b97623ee49eee47851d919b43371f1748d88 | 38e836ae9bb477716ad93ddd4bed4ccf8cd7fa15 | /app/src/main/java/com/badikirwan/dicoding/animeapp/AnimeAdapter.java | ade38db8bac712f4645d5026072e60e5f168ce39 | [] | no_license | badikirwan/AnimeApp | ab8e8c535b20197f6c945a29071b4c431ff2645f | 5d154251ba397a12fc111080e4655f1ba77edeef | refs/heads/master | 2020-03-23T21:53:03.525818 | 2018-07-24T09:51:33 | 2018-07-24T09:51:33 | 142,138,973 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,435 | java | package com.badikirwan.dicoding.animeapp;
import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.bumptech.glide.Glide;
import java.util.ArrayList;
public class AnimeAdapter extends RecyclerView.Adapter<AnimeAdapter.CardViewHolder> {
private ArrayList<AnimeModel> listAnime;
private Context context;
public AnimeAdapter(Context context) {
this.context = context;
}
public ArrayList<AnimeModel> getListAnime() {
return listAnime;
}
public void setListAnime(ArrayList<AnimeModel> listAnime) {
this.listAnime = listAnime;
}
@Override
public AnimeAdapter.CardViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_cardview_anime, parent,false);
CardViewHolder cardViewHolder = new CardViewHolder(view);
return cardViewHolder;
}
@Override
public void onBindViewHolder(final AnimeAdapter.CardViewHolder holder, int position) {
final AnimeModel animeModel = getListAnime().get(position);
Glide.with(context)
.load(animeModel.getPhoto())
.override(350, 550)
.into(holder.imgPhoto);
holder.tvName.setText(animeModel.getName());
holder.tvViewAnime.setText(animeModel.getViewAnime());
holder.btnDetail.setOnClickListener(new CustomOnItemClickListener(position, new CustomOnItemClickListener.OnItemClickCallback() {
@Override
public void onItemClicked(View view, int position) {
Intent moveData = new Intent(context, DetailActivity.class);
moveData.putExtra(DetailActivity.EXTRA_NAME, animeModel.getName());
moveData.putExtra(DetailActivity.EXTRA_PHOTO, animeModel.getPhoto());
moveData.putExtra(DetailActivity.EXTRA_EPISODE, animeModel.getEpisode());
moveData.putExtra(DetailActivity.EXTRA_DESKRIPSI, animeModel.getDeskripsi());
moveData.putExtra(DetailActivity.EXTRA_VIEW_ANIME, animeModel.getViewAnime());
context.startActivity(moveData);
}
}));
holder.btnShare.setOnClickListener(new CustomOnItemClickListener(position, new CustomOnItemClickListener.OnItemClickCallback() {
@Override
public void onItemClicked(View view, int position) {
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_SUBJECT, "Ini adalah anime fovorite saya");
shareIntent.putExtra(Intent.EXTRA_TEXT, animeModel.getName());
shareIntent.setType("text/plain");
context.startActivity(shareIntent);
}
}));
}
@Override
public int getItemCount() {
return getListAnime().size();
}
public class CardViewHolder extends RecyclerView.ViewHolder {
ImageView imgPhoto;
TextView tvName, tvViewAnime;
Button btnShare, btnDetail;
public CardViewHolder(View itemView) {
super(itemView);
imgPhoto = (ImageView) itemView.findViewById(R.id.img_item_photo);
tvName = (TextView) itemView.findViewById(R.id.tv_item_name);
tvViewAnime = (TextView) itemView.findViewById(R.id.tv_item_view);
btnShare = (Button) itemView.findViewById(R.id.btn_set_share);
btnDetail = (Button) itemView.findViewById(R.id.btn_set_detail);
}
}
public static class CustomOnItemClickListener implements View.OnClickListener {
private int position;
private OnItemClickCallback onItemClickCallback;
private CustomOnItemClickListener(int position, OnItemClickCallback onItemClickCallback) {
this.position = position;
this.onItemClickCallback = onItemClickCallback;
}
@Override
public void onClick(View view) {
onItemClickCallback.onItemClicked(view, position);
}
public interface OnItemClickCallback {
void onItemClicked(View view, int position);
}
}
}
| [
"badikirwan@gmail.com"
] | badikirwan@gmail.com |
b96fd7a06da0f4ba2ddebd698bc228122a0039d0 | e904cdfaece422a22563a147f1c6fb921d6e9566 | /src/main/java/stepDefinitions/HooksDefinition.java | 7632096cac24f08a16aef77688f6603dd3674c0e | [] | no_license | shermilag/BDDFramework | 52b340d4d1ca4fa027fadee56fbc9cb1c501b8f9 | 320bfcbe5aa0c845ae8b7d80d74cd531793a06f9 | refs/heads/master | 2020-03-27T21:24:10.478651 | 2018-09-03T22:47:59 | 2018-09-03T22:47:59 | 147,140,513 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,690 | java | package stepDefinitions;
import cucumber.api.java.After;
import cucumber.api.java.Before;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
public class HooksDefinition {
@Before
public void setUP(){
System.out.println("launch FF");
System.out.println("Enter URL for Free CRM APP");
}
@After
public void tearDown(){
System.out.println("close the browser");
}
@Given("^user is on deal page$")
public void user_is_on_deal_oage() throws Throwable {
System.out.println("user is on deal page");
}
@When("^user fills the deals form$")
public void user_fills_the_deals_form() throws Throwable {
System.out.println("create a deal");
}
@Then("^deal is created$")
public void deal_is_created() throws Throwable {
System.out.println("deal is created");
}
@Given("^user is on contact page$")
public void user_is_on_contact_page() throws Throwable {
System.out.println("user is on contact page");
}
@When("^user fills the contact form$")
public void user_fills_the_contact_form() throws Throwable {
System.out.println("create a contact");
}
@Then("^contact is created$")
public void contact_is_created() throws Throwable {
System.out.println("contact is created");
}
@Given("^user is on mail page$")
public void user_is_on_mail_page() throws Throwable {
System.out.println("user is on mail pahge");
}
@When("^user fills the mail form$")
public void user_fills_the_mail_form() throws Throwable {
System.out.println("create a mail");
}
@Then("^mail is created$")
public void mail_is_created() throws Throwable {
System.out.println("mail is created");
}
}
| [
"shermila.g@gmail.com"
] | shermila.g@gmail.com |
a2cdff9d5c051bc9dda8f5cf574c808dd5fb4a3c | c0542546866385891c196b665d65a8bfa810f1a3 | /decompiled/android/service/notification/IStatusBarNotificationHolder.java | 254d0b9ae2ab486ca06cef694b2b33f80b558b7d | [] | no_license | auxor/android-wear-decompile | 6892f3564d316b1f436757b72690864936dd1a82 | eb8ad0d8003c5a3b5623918c79334290f143a2a8 | refs/heads/master | 2016-09-08T02:32:48.433800 | 2015-10-12T02:17:27 | 2015-10-12T02:19:32 | 42,517,868 | 5 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,415 | java | package android.service.notification;
import android.os.Binder;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Parcel;
import android.os.RemoteException;
public interface IStatusBarNotificationHolder extends IInterface {
public static abstract class Stub extends Binder implements IStatusBarNotificationHolder {
private static final String DESCRIPTOR = "android.service.notification.IStatusBarNotificationHolder";
static final int TRANSACTION_get = 1;
private static class Proxy implements IStatusBarNotificationHolder {
private IBinder mRemote;
Proxy(IBinder remote) {
this.mRemote = remote;
}
public IBinder asBinder() {
return this.mRemote;
}
public String getInterfaceDescriptor() {
return Stub.DESCRIPTOR;
}
public StatusBarNotification get() throws RemoteException {
Parcel _data = Parcel.obtain();
Parcel _reply = Parcel.obtain();
try {
StatusBarNotification _result;
_data.writeInterfaceToken(Stub.DESCRIPTOR);
this.mRemote.transact(Stub.TRANSACTION_get, _data, _reply, 0);
_reply.readException();
if (_reply.readInt() != 0) {
_result = (StatusBarNotification) StatusBarNotification.CREATOR.createFromParcel(_reply);
} else {
_result = null;
}
_reply.recycle();
_data.recycle();
return _result;
} catch (Throwable th) {
_reply.recycle();
_data.recycle();
}
}
}
public Stub() {
attachInterface(this, DESCRIPTOR);
}
public static IStatusBarNotificationHolder asInterface(IBinder obj) {
if (obj == null) {
return null;
}
IInterface iin = obj.queryLocalInterface(DESCRIPTOR);
if (iin == null || !(iin instanceof IStatusBarNotificationHolder)) {
return new Proxy(obj);
}
return (IStatusBarNotificationHolder) iin;
}
public IBinder asBinder() {
return this;
}
public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
switch (code) {
case TRANSACTION_get /*1*/:
data.enforceInterface(DESCRIPTOR);
StatusBarNotification _result = get();
reply.writeNoException();
if (_result != null) {
reply.writeInt(TRANSACTION_get);
_result.writeToParcel(reply, TRANSACTION_get);
return true;
}
reply.writeInt(0);
return true;
case IBinder.INTERFACE_TRANSACTION /*1598968902*/:
reply.writeString(DESCRIPTOR);
return true;
default:
return super.onTransact(code, data, reply, flags);
}
}
}
StatusBarNotification get() throws RemoteException;
}
| [
"itop.my@gmail.com"
] | itop.my@gmail.com |
387be1c3768df05e66bf6d908914fd1ebbfa8abd | 7f6e3c414e77195debd71ec179bab5a02fd50d51 | /app/src/main/java/com/example/hotsoon_user_profiiles/music/MusicHandler.java | 931bc4228bb81d392e78cb01e1a9f60d5acb7667 | [
"Apache-2.0"
] | permissive | hyd2016/UserProfile | a3aee010373f23d2289e2af29ab66de0a0fbada1 | 95583986a48489b52456267b94bfac268a982d4f | refs/heads/master | 2020-07-31T05:29:07.510672 | 2019-09-25T07:16:14 | 2019-09-25T07:16:14 | 210,500,110 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,408 | java | package com.example.hotsoon_user_profiiles.music;
import android.os.Handler;
import android.os.Message;
import android.os.Messenger;
import android.util.Log;
import com.example.hotsoon_user_profiiles.Interface.MusicChange;
public class MusicHandler extends Handler {
private static final int MSG_FROM_CLIENT = 0;
private static final String TAG = "MusicHandler";
private MusicChange musicChange;
@Override
public void handleMessage(Message msg) {
switch (msg.what)
{
case MSG_FROM_CLIENT:
Log.d(TAG, "receive msg from client: msg");
Log.d(TAG, "handleMessage: thread"+Thread.currentThread().getId());
//不加这一句话会出现ClassNotFoundException when unmarshalling
msg.getData().setClassLoader(MusicParcelable.class.getClassLoader());
Messenger client = msg.replyTo;
MusicParcelable musicParcelable = msg.getData().getParcelable("music");
Log.d(TAG, "handleMessage: "+ musicParcelable.getMusicUrl());
if (musicChange != null){
musicChange.musicPlay(client, musicParcelable);
}
break;
default:
super.handleMessage(msg);
}
}
public void setMusicChange(MusicChange change){
this.musicChange = change;
}
}
| [
"dinghaoyu.haoyding@bytedance.com"
] | dinghaoyu.haoyding@bytedance.com |
99328d9c76de3e5834788314a54602ec04b0fb09 | 64004938ae0dc80db897ea4b29b8ab5eae53e090 | /service/service_edu/src/main/java/com/marlowe/eduservice/entity/EduTeacher.java | a8ca7f370445b03d6dd63597f52062ae33b75253 | [] | no_license | XMMarlowe/onlineEducation | 4af28238c5c3b42e5d37b9f3ff0f0da0c3a123bd | e3f709b373114fe352cf285b062431d3891816bf | refs/heads/master | 2023-07-19T04:40:32.644910 | 2021-08-19T02:55:04 | 2021-08-19T02:55:04 | 386,348,462 | 16 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,613 | java | package com.marlowe.eduservice.entity;
import com.baomidou.mybatisplus.annotation.*;
import java.util.Date;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
* 讲师
* </p>
*
* @author Marlowe
* @since 2021-07-16
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="EduTeacher对象", description="讲师")
public class EduTeacher implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "讲师ID")
@TableId(value = "id", type = IdType.ID_WORKER_STR)
private String id;
@ApiModelProperty(value = "讲师姓名")
private String name;
@ApiModelProperty(value = "讲师简介")
private String intro;
@ApiModelProperty(value = "讲师资历,一句话说明讲师")
private String career;
@ApiModelProperty(value = "头衔 1高级讲师 2首席讲师")
private Integer level;
@ApiModelProperty(value = "讲师头像")
private String avatar;
@ApiModelProperty(value = "排序")
private Integer sort;
@ApiModelProperty(value = "逻辑删除 1(true)已删除, 0(false)未删除")
@TableLogic
private Boolean isDeleted;
@ApiModelProperty(value = "创建时间")
@TableField(fill = FieldFill.INSERT)
private Date gmtCreate;
@ApiModelProperty(value = "更新时间")
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date gmtModified;
}
| [
"2531649481@qq.com"
] | 2531649481@qq.com |
85187dfe8da27250640ddee3d764b3630249993c | 44252d63eb5c3cc51bb2b28c1d8a66a2ee1623c9 | /FoxitGallary/FoxitGallery_source_from_JADX/com/simplemobiletools/filepicker/asynctasks/CopyMoveTask$doInBackground$2.java | fe3641ca6c6a359cfa3fc1f936f9a90bd3fa7706 | [] | no_license | arunkiddo/Android | 2620a7e02f5883ad1034e9ddb8c38b9521f78f89 | f6221eed9f24f2349318332d86b94c4d87d253cd | refs/heads/master | 2021-04-30T08:46:10.831942 | 2018-02-18T13:36:52 | 2018-02-18T13:36:52 | 119,573,958 | 0 | 0 | null | 2018-02-12T13:15:51 | 2018-01-30T18:03:41 | null | UTF-8 | Java | false | false | 472 | java | package com.simplemobiletools.filepicker.asynctasks;
import p000a.C0055f;
import p000a.p005e.p006a.C0028a;
import p000a.p005e.p007b.C0037g;
final class CopyMoveTask$doInBackground$2 extends C0037g implements C0028a<C0055f> {
public static final CopyMoveTask$doInBackground$2 INSTANCE;
static {
INSTANCE = new CopyMoveTask$doInBackground$2();
}
CopyMoveTask$doInBackground$2() {
super(0);
}
public final void invoke() {
}
}
| [
"karunganessh28@gmail.com"
] | karunganessh28@gmail.com |
d3306ff36ef5176e1222705b7b30818971d64b5e | 3306b4bd783ae58ec0aa76663ade32b107efcbc8 | /src/main/java/snownee/cuisine/plugins/jei/VesselRecipeCategory.java | 24e9b3837ff17fe938dcbe5a58a3486d3fe77840 | [
"MIT"
] | permissive | Snownee/Cuisine | 8e43ab7453d970a68ab43a28c2a453933a8aa25a | 29735bc4129a6b5d86ac19a05fb89119e9d3ed01 | refs/heads/0.5 | 2021-06-04T11:55:07.911909 | 2020-04-17T14:31:18 | 2020-04-17T14:31:18 | 150,828,746 | 56 | 18 | MIT | 2020-02-10T07:45:07 | 2018-09-29T05:38:34 | Java | UTF-8 | Java | false | false | 2,655 | java | package snownee.cuisine.plugins.jei;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IGuiFluidStackGroup;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.gui.ITooltipCallback;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeCategory;
import net.minecraft.client.resources.I18n;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;
import snownee.cuisine.Cuisine;
import snownee.cuisine.CuisineRegistry;
import snownee.cuisine.util.I18nUtil;
public class VesselRecipeCategory implements IRecipeCategory<VesselRecipe>
{
static final String UID = Cuisine.MODID + ".vessel";
private static final ITooltipCallback<FluidStack> SOLVENT_TIP = (
slotIndex, input, ingredient, tooltip
) -> tooltip.add(I18nUtil.translate("tip.solvent"));
private final IDrawable background;
private final String localizedName;
VesselRecipeCategory(IGuiHelper guiHelper)
{
background = guiHelper.createDrawable(new ResourceLocation(Cuisine.MODID, "textures/gui/jei.png"), 36, 0, 130, 18);
localizedName = I18n.format(CuisineRegistry.JAR.getTranslationKey() + ".name");
}
@Override
public String getUid()
{
return UID;
}
@Override
public String getTitle()
{
return localizedName;
}
@Override
public String getModName()
{
return Cuisine.NAME;
}
@Override
public IDrawable getBackground()
{
return background;
}
@Override
public void setRecipe(IRecipeLayout recipeLayout, VesselRecipe recipeWrapper, IIngredients ingredients)
{
IGuiItemStackGroup stacks = recipeLayout.getItemStacks();
IGuiFluidStackGroup fluids = recipeLayout.getFluidStacks();
stacks.init(0, true, 0, 0);
stacks.init(1, true, 36, 0);
stacks.init(2, false, 94, 0);
fluids.init(0, true, 19, 1, 16, 16, 100, false, null);
if (recipeWrapper.recipe.getOutputFluid() != null)
{
fluids.init(1, false, recipeWrapper.recipe.getOutput().isEmpty() ? 95 : 113, 1, 16, 16, recipeWrapper.recipe.getOutputFluid().amount, false, null);
}
else
{
fluids.addTooltipCallback(SOLVENT_TIP);
}
stacks.set(ingredients);
fluids.set(ingredients);
stacks.addTooltipCallback(JEICompat.identifierTooltip(recipeWrapper.recipe.getIdentifier()));
fluids.addTooltipCallback(JEICompat.identifierTooltip(recipeWrapper.recipe.getIdentifier()));
}
}
| [
"1850986885@qq.com"
] | 1850986885@qq.com |
2e3933bc5edc0ebb853ea01de626808358c0276b | 474986ebbf0284f2c097385d73bbe6a829db4c0c | /Paddle/src/cz/apopt/entity/projectile/GuidedMissile.java | 7847f64124c878e50c91df821fc7c43cf2b265b0 | [] | no_license | Opticalll/Tanks | 9cf26726f3aae4d8b9c12549529d0d458c65fec6 | 3cff8b38f40fb6beffba8393e67a3b5ecc2adb26 | refs/heads/master | 2016-09-05T14:50:41.607299 | 2012-11-09T17:33:42 | 2012-11-09T17:33:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,518 | java | package cz.apopt.entity.projectile;
import java.awt.geom.Rectangle2D;
import org.lwjgl.opengl.GL11;
import cz.apopt.entity.Block;
import cz.apopt.entity.Collidable;
import cz.apopt.entity.Entity;
import cz.apopt.entity.Tank;
import cz.apopt.pEngine.PVector;
import cz.apopt.pEngine.Pengine;
import cz.apopt.pEngine.VVector;
import cz.apopt.paddleGame.PaddleGame;
public class GuidedMissile implements Entity, RocketProjectile
{
private float x,y,vx = 0f,vy = 0f,angle,speed = 8f, width = 5.0f, height = 5.0f, lockOnRange, vangle = 4, targetangle;
private float minDmg = 35.0f, maxDmg = 50.0f;
Tank target = null;
Tank shooter;
public GuidedMissile(Tank tank)
{
this.shooter = tank;
}
public GuidedMissile(float x, float y, Tank tank)
{
this.x = x;
this.y = y;
this.shooter = tank;
this.angle = 0;
}
public Projectile getInstance()
{
return new GuidedMissile(shooter);
}
@Override
public void render()
{
GL11.glTranslatef(x+width/2, y+height/2, 0);
GL11.glRotatef(angle, 0, 0, 1);
GL11.glTranslatef(-(x+width/2), -(y+height/2), 0);
PaddleGame.log("" + angle);
GL11.glBegin(GL11.GL_TRIANGLES);
GL11.glVertex2f(x, y+height);
GL11.glVertex2f(x+width, y+height);
GL11.glVertex2f(x+width/2, y);
GL11.glEnd();
}
private void lockOn()
{
for(Entity e : PaddleGame.entities)
{
if(e instanceof Tank)
{
Tank t = (Tank) e;
if(t != shooter)
{
if(vx > 0 && (t.getX() + width/2) > x && ((t.getY() + t.getHeight()/2) <= y + lockOnRange && t.getY() >= y - lockOnRange))
target = t;
else if(vx < 0 && (t.getX() + width/2) < x && ((t.getY() + t.getHeight()/2) <= y + lockOnRange && t.getY() >= y - lockOnRange))
target = t;
else if(vy > 0 && (t.getY() + height/2) > y && ((t.getX() + t.getWidth()/2) <= x + lockOnRange && t.getX() >= x - lockOnRange))
target = t;
else if(vy < 0 && (t.getY() + height/2) < y && ((t.getX() + t.getHeight()/2) <= x + lockOnRange && t.getX() >= x - lockOnRange))
target = t;
else
target = null;
}
else
target = null;
if(target != null)
{
PaddleGame.logT("Target Locked on X: " + target.getX() + " Y: " + target.getY() + "\n Missile Cord X: " + x + " Y: " + y);
break;
}
}
}
}
private float findAngle(float px1, float py1, float px2, float py2)
{
return (float) (Math.atan2((py2 - py1), (px2 - px1)) * 180/Math.PI);
}
private boolean checkPathToTarget()
{
for(Block b : PaddleGame.blocks.blockList)
{
Rectangle2D.Float block = new Rectangle2D.Float(b.getX(), b.getY(), b.getWidth(), b.getHeight());
if(block.intersectsLine(x, y, target.getX()+target.getWidth()/2, target.getY()+target.getHeight()/2))
return false;
}
return true;
}
@Override
public void update()
{
if(target == null)
lockOn();
else
if(checkPathToTarget())
targetangle = findAngle(x, y, target.getX(), target.getY());
if(target != null)
{
if(targetangle > angle)
angle += vangle;
else
angle -=vangle;
}
// angle++;
vx = (float) Math.cos(Math.toRadians(90 - angle)) * speed;
vy = (float) -(Math.sin(Math.toRadians(90 - angle)) * speed);
PaddleGame.log("sin: " + Math.sin(angle) +"vx :" + vx + " cos: " + Math.cos(angle) +" vy: " + vy);
x += vx;
y += vy;
Pengine eng = new Pengine(new PVector(x + width/2, y + height/2), 2, 90, null);
eng.setVVector(new VVector(0.5f, 0.5f));
eng.setTime(0.05f);
eng.setMinFade(0.005f);
eng.setMaxFade(0.5f);
eng.create();
}
@Override
public float getX()
{
return x;
}
@Override
public float getY()
{
return y;
}
public float getDamage()
{
return PaddleGame.getRandom(minDmg, maxDmg);
}
@Override
public float getWidth()
{
return width;
}
@Override
public float getHeight()
{
return height;
}
@Override
public void checkCollision()
{
for(int i = 0; i < PaddleGame.entities.size(); i++)
{
Entity e = PaddleGame.entities.get(i);
if(e instanceof Collidable)
{
Collidable obj = (Collidable) e;
if(obj.equals(shooter))
return;
if(obj.isSolid() || obj.isDestroyable())
obj.intersects(this);
}
}
}
@Override
public Tank getShooter()
{
return shooter;
}
@Override
public String getName()
{
return "Guided";
}
@Override
public void fire()
{
angle = shooter.getAngleFromFacing();
this.x = shooter.getX() + shooter.getWidth()/2;
this.y = shooter.getY() + shooter.getHeight()/2;
PaddleGame.entities.add(this);
}
}
| [
"adam.zazo@gmail.com"
] | adam.zazo@gmail.com |
b50143103a4c6d916af66b108f7d17767bd7ee16 | ff0b8895bf7b4a14e7ad5894787430c1edb3c370 | /HelloWorld/src/main/java/com/kan/HelloWorld.java | daee267cac4a3c02bc373d9229f9dc18a16669df | [] | no_license | kan-r/ProjectTest | e47154f9f511ba17097112a5866d1dd486862903 | 4b86ff11e5051b60aef53fab840a1e065f680d33 | refs/heads/master | 2023-06-28T23:12:30.230613 | 2021-07-24T00:48:26 | 2021-07-24T00:48:26 | 333,988,474 | 0 | 0 | null | 2021-02-05T05:14:55 | 2021-01-28T23:58:45 | Java | UTF-8 | Java | false | false | 363 | java | package com.kan;
public class HelloWorld {
public static final String HELLO_KAN = "Hello Kan Ranganathan!";
public static final String WELCOME = "Welcome";
public static void main(String[] args) {
printMsg(HELLO_KAN);
printMsg(WELCOME);
}
private static void printMsg(String msg) {
System.out.println(msg);
}
}
| [
"krangan100@gmail.com"
] | krangan100@gmail.com |
8865b745e1901333db3d67c0739377d9eadfaaca | 0f859255f131fa60a90acd3c137bbb0b9ee32d01 | /odata-core/src/test/java/org/odata4j/test/unit/producer/inmemory/InMemoryEdmTest.java | 81d0494c54710c139e1132e85ed9f27361459c34 | [
"Apache-2.0"
] | permissive | vhalbert/oreva | fe1f5c76b8f2416dbb36481769585b77dd46e6e9 | 39b6c90c432bcefc410894c04fb831178d560272 | refs/heads/master | 2021-01-18T01:10:00.864949 | 2020-01-28T15:25:14 | 2020-01-28T15:25:14 | 36,017,606 | 0 | 0 | Apache-2.0 | 2020-02-12T14:47:49 | 2015-05-21T14:31:54 | Java | UTF-8 | Java | false | false | 9,711 | java | package org.odata4j.test.unit.producer.inmemory;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;
import java.util.Collection;
import java.util.List;
import org.core4j.Enumerable;
import org.core4j.Predicate1;
import org.junit.Ignore;
import org.junit.Test;
import org.odata4j.edm.EdmDataServices;
import org.odata4j.edm.EdmEntityType;
import org.odata4j.edm.EdmMultiplicity;
import org.odata4j.edm.EdmNavigationProperty;
import org.odata4j.edm.EdmProperty;
import org.odata4j.producer.inmemory.BeanBasedPropertyModel;
import org.odata4j.producer.inmemory.EnumsAsStringsPropertyModelDelegate;
import org.odata4j.producer.inmemory.InMemoryProducer;
/**
* Test various aspects of InMemoryEdmGenerator
*
* hierarchy:
* RHS
* Base
* ----Sub1
* ----Sub1_2
* ----Sub2
*/
public class InMemoryEdmTest {
public static class RHS {
public String getRHSProp1() {
return "";
}
public void setRHSProp1() {}
}
public static class Base {
// key
public String getBaseProp1() {
return "";
}
public void setBaseProp1() {}
// base class relationships
public Collection<RHS> getRHSs() {
return null;
}
public void setRHSs(Collection<RHS> value) {}
public RHS getRHS() {
return null;
}
public void setRHS(RHS value) {}
}
public static class Sub1 extends Base {
public String getSub1Prop1() {
return "";
}
public void setSub1Prop1() {}
}
public static class Sub2 extends Base {
public String getSub2Prop1() {
return "";
}
public void setSub2Prop1() {}
}
public static class Sub1_2 extends Sub1 {
public String getSub1_2Prop1() {
return "";
}
public void setSub1_2Prop1() {}
// leaf relationships
public Collection<Sub2> getSub2s() {
return null;
}
public void setSub2s(Collection<Sub2> value) {}
public Sub2 getSub2() {
return null;
}
public void setSub2(Sub2 value) {}
}
private void register(InMemoryProducer p, Class<? extends Object> clazz, boolean flat, String... keys) {
p.register(clazz, new EnumsAsStringsPropertyModelDelegate(new BeanBasedPropertyModel(clazz, flat)),
clazz.getSimpleName() + "s", // set
clazz.getSimpleName(), // type
null,
keys); // keys
}
private void assertKeys(List<String> keys, String[] expect) {
assertEquals(expect.length, keys.size());
for (String k : expect) {
assertTrue(keys.contains(k));
}
}
private void assertNavProp(String fromType, EdmMultiplicity fromMult, String toType, EdmMultiplicity toMult, EdmNavigationProperty got) {
assertEquals(fromType, got.getFromRole().getType().getName());
assertEquals(fromMult, got.getFromRole().getMultiplicity());
assertEquals(toType, got.getToRole().getType().getName());
assertEquals(toMult, got.getToRole().getMultiplicity());
}
private void assertProps(Enumerable<EdmProperty> got, String... expected) {
assertEquals(expected.length, got.count());
for (final String e : expected) {
EdmProperty p = got.first(new Predicate1<EdmProperty>() {
@Override
public boolean apply(EdmProperty t) {
return t.getName().equals(e);
}
});
assertEquals(e, p.getName());
}
}
@Test
public void testHierarchyEdm() {
InMemoryProducer p = new InMemoryProducer("myns",
null, // String containerName,
100, // int maxResults,
null, // EdmDecorator decorator,
null, // InMemoryTypeMapping typeMapping,
false); // boolean flattenEdm);
register(p, RHS.class, false, "RHSProp1");
register(p, Base.class, false, "BaseProp1");
register(p, Sub1.class, false, "BaseProp1");
register(p, Sub1_2.class, false, "BaseProp1");
register(p, Sub2.class, false, "BaseProp1");
EdmDataServices edm = p.getMetadata();
//EdmxFormatWriter.write(edm, new OutputStreamWriter(System.out));
EdmEntityType rhs = (EdmEntityType) edm.findEdmEntityType("myns." + RHS.class.getSimpleName());
assertTrue(rhs != null);
assertTrue(rhs.getBaseType() == null);
assertKeys(rhs.getKeys(), new String[] { "RHSProp1" });
assertEquals(0, rhs.getDeclaredNavigationProperties().count());
assertEquals(1, rhs.getDeclaredProperties().count());
assertProps(rhs.getDeclaredProperties(), new String[] { "RHSProp1" });
assertProps(rhs.getProperties(), new String[] { "RHSProp1" });
EdmEntityType base = (EdmEntityType) edm.findEdmEntityType("myns." + Base.class.getSimpleName());
assertTrue(base != null);
assertTrue(base.getBaseType() == null);
assertKeys(base.getKeys(), new String[] { "BaseProp1" });
assertProps(base.getDeclaredProperties(), new String[] { "BaseProp1" });
assertProps(base.getProperties(), new String[] { "BaseProp1" });
assertEquals(2, base.getDeclaredNavigationProperties().count());
assertEquals(2, base.getNavigationProperties().count());
assertNavProp("Base", EdmMultiplicity.MANY, "RHS", EdmMultiplicity.ONE, base.findDeclaredNavigationProperty("RHS"));
assertNavProp("Base", EdmMultiplicity.ZERO_TO_ONE, "RHS", EdmMultiplicity.MANY, base.findDeclaredNavigationProperty("RHSs"));
EdmEntityType sub1 = (EdmEntityType) edm.findEdmEntityType("myns." + Sub1.class.getSimpleName());
assertTrue(sub1 != null);
assertEquals(base, sub1.getBaseType());
assertKeys(sub1.getKeys(), new String[] { "BaseProp1" });
assertProps(sub1.getDeclaredProperties(), new String[] { "Sub1Prop1" });
assertProps(sub1.getProperties(), new String[] { "BaseProp1", "Sub1Prop1" });
assertEquals(0, sub1.getDeclaredNavigationProperties().count());
assertEquals(2, sub1.getNavigationProperties().count());
assertNavProp("Base", EdmMultiplicity.MANY, "RHS", EdmMultiplicity.ONE, sub1.findNavigationProperty("RHS"));
assertNavProp("Base", EdmMultiplicity.ZERO_TO_ONE, "RHS", EdmMultiplicity.MANY, sub1.findNavigationProperty("RHSs"));
EdmEntityType sub2 = (EdmEntityType) edm.findEdmEntityType("myns." + Sub2.class.getSimpleName());
assertTrue(sub2 != null);
assertEquals(base, sub2.getBaseType());
assertKeys(sub2.getKeys(), new String[] { "BaseProp1" });
assertProps(sub2.getDeclaredProperties(), new String[] { "Sub2Prop1" });
assertProps(sub2.getProperties(), new String[] { "BaseProp1", "Sub2Prop1" });
assertEquals(0, sub2.getDeclaredNavigationProperties().count());
assertEquals(2, sub2.getNavigationProperties().count());
assertNavProp("Base", EdmMultiplicity.MANY, "RHS", EdmMultiplicity.ONE, sub2.findNavigationProperty("RHS"));
assertNavProp("Base", EdmMultiplicity.ZERO_TO_ONE, "RHS", EdmMultiplicity.MANY, sub2.findNavigationProperty("RHSs"));
EdmEntityType sub1_2 = (EdmEntityType) edm.findEdmEntityType("myns." + Sub1_2.class.getSimpleName());
assertTrue(sub1_2 != null);
assertEquals(sub1, sub1_2.getBaseType());
assertKeys(sub1_2.getKeys(), new String[] { "BaseProp1" });
assertProps(sub1_2.getDeclaredProperties(), new String[] { "Sub1_2Prop1" });
assertProps(sub1_2.getProperties(), new String[] { "BaseProp1", "Sub1Prop1", "Sub1_2Prop1" });
assertEquals(2, sub1_2.getDeclaredNavigationProperties().count());
assertEquals(4, sub1_2.getNavigationProperties().count());
assertNavProp("Base", EdmMultiplicity.MANY, "RHS", EdmMultiplicity.ONE, sub1_2.findNavigationProperty("RHS"));
assertNavProp("Base", EdmMultiplicity.ZERO_TO_ONE, "RHS", EdmMultiplicity.MANY, sub1_2.findNavigationProperty("RHSs"));
assertNavProp("Sub1_2", EdmMultiplicity.MANY, "Sub2", EdmMultiplicity.ONE, sub1_2.findDeclaredNavigationProperty("Sub2"));
assertNavProp("Sub1_2", EdmMultiplicity.ZERO_TO_ONE, "Sub2", EdmMultiplicity.MANY, sub1_2.findDeclaredNavigationProperty("Sub2s"));
}
@Test
public void testFlatEdm() {
InMemoryProducer p = new InMemoryProducer("myns");
register(p, RHS.class, true, "RHSProp1");
register(p, Sub1.class, true, "BaseProp1");
EdmDataServices edm = p.getMetadata();
// EdmxFormatWriter.write(edm, new OutputStreamWriter(System.out));
EdmEntityType sub1 = (EdmEntityType) edm.findEdmEntityType("myns." + Sub1.class.getSimpleName());
assertTrue(sub1 != null);
assertEquals(null, sub1.getBaseType());
assertKeys(sub1.getKeys(), new String[] { "BaseProp1" });
assertProps(sub1.getDeclaredProperties(), new String[] { "BaseProp1", "Sub1Prop1" });
assertProps(sub1.getProperties(), new String[] { "BaseProp1", "Sub1Prop1" });
assertEquals(2, sub1.getDeclaredNavigationProperties().count());
assertEquals(2, sub1.getNavigationProperties().count());
assertNavProp("Sub1", EdmMultiplicity.MANY, "RHS", EdmMultiplicity.ONE, sub1.findNavigationProperty("RHS"));
assertNavProp("Sub1", EdmMultiplicity.ZERO_TO_ONE, "RHS", EdmMultiplicity.MANY, sub1.findNavigationProperty("RHSs"));
}
@Ignore("this currently fails, should not")
//@Test
public void testUniqueAssociationNames() {
InMemoryProducer p = new InMemoryProducer("myns");
register(p, RHS.class, true, "RHSProp1");
register(p, Base.class, true, "BaseProp1");
EdmDataServices edm = p.getMetadata();
EdmEntityType base = (EdmEntityType) edm.findEdmEntityType("myns.Base");
EdmNavigationProperty a1 = base.findNavigationProperty("RHS");
EdmNavigationProperty a2 = base.findNavigationProperty("RHSs");
assertFalse(a1.getRelationship().getName() + " should not equal " + a1.getRelationship().getName(),
a1.getRelationship().getName().equals(a1.getRelationship().getName()));
}
}
| [
"rareddy@jboss.org"
] | rareddy@jboss.org |
eb95f51931af346032851f19b7e78039d1c36dc6 | c36720f673ae7e9069daaaf8ea9fe3084ad86909 | /src/main/java/com/maximesoares/service/dto/package-info.java | fe22ae8b8bf5298def398487dbb33f95dd61b987 | [] | no_license | maximeso/penda | 539952fe5447bce5c72fb3a0c4a554cdd08e9605 | 748cb49b83cef2645c93faebd46d15a7e4110341 | refs/heads/master | 2022-08-04T11:12:45.878882 | 2019-08-22T18:18:57 | 2019-08-22T18:18:57 | 178,494,487 | 0 | 0 | null | 2022-07-07T03:55:07 | 2019-03-30T01:02:30 | TypeScript | UTF-8 | Java | false | false | 72 | java | /**
* Data Transfer Objects.
*/
package com.maximesoares.service.dto;
| [
"jhipster-bot@jhipster.tech"
] | jhipster-bot@jhipster.tech |
1a84baf271a3f12dbd1510d950ea040e30a99cd9 | 410459866fe4211debd6bcac37f10d14363bb369 | /src/main/java/me/xhawk87/CreateYourOwnMenus/commands/menu/script/MenuScriptDeleteCommand.java | 1ce660df3871e487fb06ba8f157915c175537e7b | [] | no_license | AGall0423/CreateYourOwnMenus | 61054780315c05108fb3e2896a539f560ad75d1b | 3deb7faf1f189345bc21c72fb2d4a0d5baa9e024 | refs/heads/master | 2020-12-15T20:24:23.756917 | 2020-01-21T03:03:38 | 2020-01-21T03:03:38 | 235,244,581 | 0 | 0 | null | 2020-01-21T03:02:30 | 2020-01-21T03:02:29 | null | UTF-8 | Java | false | false | 2,983 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package me.xhawk87.CreateYourOwnMenus.commands.menu.script;
import java.util.ArrayList;
import java.util.List;
import me.xhawk87.CreateYourOwnMenus.CreateYourOwnMenus;
import me.xhawk87.CreateYourOwnMenus.commands.menu.IMenuScriptCommand;
import me.xhawk87.CreateYourOwnMenus.utils.ItemStackRef;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
/**
*
* @author XHawk87
*/
public class MenuScriptDeleteCommand extends IMenuScriptCommand {
public MenuScriptDeleteCommand(CreateYourOwnMenus plugin) {
super(plugin);
}
@Override
public String getUsage() {
return "/menu script ([player]) delete [index] - Deletes the line with the given index (0 for first) in the held item's lore";
}
@Override
public String getPermission() {
return "cyom.commands.menu.script.delete";
}
@Override
public boolean onCommand(CommandSender sender, ItemStackRef itemStackRef, Command command, String label, String[] args) {
// Check the player is holding the item
ItemStack held = itemStackRef.get();
if (held == null || held.getTypeId() == 0) {
sender.sendMessage(plugin.translate(sender, "error-no-item-in-hand", "You must be holding a menu item"));
return true;
}
// Get or create the lore
ItemMeta meta = held.getItemMeta();
List<String> loreStrings;
if (meta.hasLore()) {
loreStrings = meta.getLore();
} else {
loreStrings = new ArrayList<>();
}
if (args.length != 1) {
return false;
}
String indexString = args[0];
int index = getIndex(indexString, loreStrings.size(), sender);
if (index == -1) {
return true;
}
// Remove the deleted line
String removedText;
if (index == 0) {
// Handle first-line special case
String replacedWith;
if (loreStrings.size() >= 2) {
replacedWith = loreStrings.get(1);
loreStrings.remove(1);
} else {
replacedWith = "";
}
String firstLine = loreStrings.get(0);
int lastPartIndex = firstLine.lastIndexOf('\r') + 1;
removedText = firstLine.substring(lastPartIndex);
loreStrings.set(0, firstLine.substring(0, lastPartIndex) + replacedWith);
} else {
removedText = loreStrings.remove(index);
}
sender.sendMessage(plugin.translate(sender, "script-line-removed", "Removed {0} from line {1} in the command list of this menu item", removedText, index));
// Update the item
meta.setLore(loreStrings);
held.setItemMeta(meta);
return true;
}
}
| [
"hawk87@hotmail.co.uk"
] | hawk87@hotmail.co.uk |
3b609745c00352aa8ff03b2e9b02659c14d82415 | 28d8b2bfc0ecadb414dced420d50b4e8ba78c473 | /inventory/src/main/java/com/senbazuru/inventory/repository/RawMaterialRepository.java | 395554eceef6315b42fca2ab8b775d6a0ea36aaf | [] | no_license | tranbinh1991/Senbazuru-Inventory-Manager | b1ed1f1b5c6e3b959fbe26b247fba638c9b9939a | c58b4cf6db0cc2c66105002112bed5dd88b226e8 | refs/heads/master | 2023-04-06T07:54:22.050945 | 2019-09-05T19:52:58 | 2019-09-05T19:52:58 | 192,179,787 | 0 | 0 | null | 2023-03-27T22:22:45 | 2019-06-16T10:49:27 | HTML | UTF-8 | Java | false | false | 664 | 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.senbazuru.inventory.repository;
import com.senbazuru.inventory.model.RawMaterial;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
/**
*
* @author Binh
*/
@Repository
public interface RawMaterialRepository extends JpaRepository<RawMaterial, Long>{
List<RawMaterial> findByName(String name);
List<RawMaterial> findAll();
RawMaterial findFirstById(Long id);
}
| [
"tranbinh120@gmail.com"
] | tranbinh120@gmail.com |
519a126d33c42cf9a0456c96faf977aed5225808 | 7940c100aef94619e28126c521081c0c8b285484 | /MakeWordsInCorrectOrder.java | d1bf7bc6ebe325caca9211ae334666306dcd9330 | [] | no_license | juliasad18/scratches | 844924139c00293e748d9f7c054421371b5a7ead | 2f78d3eae9179f0853801f2071884c385ad73cd0 | refs/heads/master | 2022-11-26T20:48:55.276119 | 2020-08-06T09:01:30 | 2020-08-06T09:01:30 | 284,707,941 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 948 | java | import java.util.*;
class MakeWordsInCorrectOrder {
public static String order(String words) {
String[] splitWordsArray = words.split(" ");
int sequenceNumber = 0;
String characterString = "";
HashMap<Integer, String> hashMap = new HashMap<>();
for (String i : splitWordsArray) {
for(int k = 0; k < i.length(); k++) {
characterString = String.valueOf(i.charAt(k));
if (characterString.matches("[123456789]")) {
sequenceNumber = Integer.valueOf(characterString);
hashMap.put(sequenceNumber, i);
}
}
}
Collection<String> orderedWordsList = hashMap.values();
String finalString = String.join(" ", orderedWordsList);
return finalString;
}
public static void main(String[] args) {
System.out.println(order("is2 Thi1s T4est 3a"));
}
}
| [
"julija.asadciha@cognizant.com"
] | julija.asadciha@cognizant.com |
ade98aa110190c4a787d866e4ca69066549e93c1 | c2130380c15418002ebb8ed8b446093ccff5dcaf | /app/src/main/java/com/example/wechat/adapter/ContactAdapter.java | 51143bc742fe5d0ab32de68f87fb63ad37f42e53 | [] | no_license | salmonzhang/WeChat | 6b68285a4068e8e04a4c976d2657b6ff155cfb11 | e4f913f092c404c1f0f32197b1ebd50f3102387c | refs/heads/master | 2021-01-15T19:04:24.800247 | 2017-10-26T03:46:36 | 2017-10-26T03:46:36 | 99,805,316 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,802 | java | package com.example.wechat.adapter;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.example.wechat.R;
import com.example.wechat.Utils.StringUtils;
import com.example.wechat.presenter.IContactAdapter;
import java.util.List;
/**
* author:salmonzhang
* Description:
* Date:2017/8/15 0015 19:33
*/
public class ContactAdapter extends RecyclerView.Adapter<ContactAdapter.ContactViewHolder> implements IContactAdapter {
private List<String> mContactList;
public ContactAdapter(List<String> contactsList) {
mContactList = contactsList;
}
@Override
public int getItemCount() {
return mContactList == null?0:mContactList.size();
}
//创建布局
@Override
public ContactViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_contact,parent,false);
return new ContactViewHolder(view);
}
//绑定数据
@Override
public void onBindViewHolder(ContactViewHolder holder, final int position) {
final String contact = mContactList.get(position);
//填充数据
holder.mTvUsername.setText(contact);
//获取联系人的首字母
String firstNum = StringUtils.getInitial(contact);
holder.mTvSection.setText(firstNum);
/**
* 1:如果position = 0,则首字母显示
* 2:如果position != 0,则判断当前位置的首字母与前一个的首字母是否相等,
* 2.1 如果相等,则不显示
* 2.2 如果不相等,则显示
*/
if (position == 0) {
holder.mTvSection.setVisibility(View.VISIBLE);
} else {
String preFirstNum = StringUtils.getInitial(mContactList.get(position - 1));
if (preFirstNum.equalsIgnoreCase(firstNum)) {
holder.mTvSection.setVisibility(View.GONE);
} else {
holder.mTvSection.setVisibility(View.VISIBLE);
}
}
//给ItemView绑定接口回调监听
/**
* 点击监听
*/
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mOnContactClickListener.onClick(contact,position);
}
});
/**
* 长点击监听
*/
holder.itemView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
mOnContactClickListener.onLongClick(contact,position);
return true;
}
});
}
//提供一个方法让RecyclerView获取适配器中的数据集合
@Override
public List<String> getItems() {
return mContactList;
}
//给RecyclerView定义回调接口
public interface onContactClickListener{
void onClick(String contact,int postion);
void onLongClick(String contact,int postion);
}
private onContactClickListener mOnContactClickListener;
public void setOnContactClickListener(onContactClickListener onContactClickListener) {
mOnContactClickListener = onContactClickListener;
}
class ContactViewHolder extends RecyclerView.ViewHolder{
private final TextView mTvSection;
private final TextView mTvUsername;
public ContactViewHolder(View itemView) {
super(itemView);
mTvSection = (TextView) itemView.findViewById(R.id.tv_section);
mTvUsername = (TextView) itemView.findViewById(R.id.tv_username);
}
}
}
| [
"ahzhangxuping@163.com"
] | ahzhangxuping@163.com |
95d5687e17d30a4da2fec60427a285aa5389e7ca | 904256d9416a0fac8491f22a91acc8bfe57ccadc | /cms-students/src/main/java/pt/isep/cms/products/client/view/ProductsView.java | b9d08296039df28a78043b203951f932b6f3b63e | [] | no_license | Wultyc/ISEP_2021_1A1S_ODSOFT | b59a9363e277cba53dd1c46a0523e4cb1bdb9004 | c1e9b479ff078e6eee5c50005f1a0652c0d3a4d7 | refs/heads/master | 2023-06-03T18:03:27.443154 | 2021-01-17T21:11:16 | 2021-01-17T21:11:16 | 376,934,038 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,541 | java | package pt.isep.cms.products.client.view;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.DecoratorPanel;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.HTMLTable;
import com.google.gwt.user.client.ui.Widget;
import pt.isep.cms.products.client.presenter.ProductsPresenter;
import java.util.ArrayList;
import java.util.List;
public class ProductsView extends Composite implements ProductsPresenter.Display {
private final Button addButton;
private final Button deleteButton;
private FlexTable productsTable;
private final FlexTable contentTable;
// private final VerticalPanel vPanel ;
public ProductsView() {
DecoratorPanel contentTableDecorator = new DecoratorPanel();
initWidget(contentTableDecorator);
contentTableDecorator.setWidth("100%");
contentTableDecorator.setWidth("18em");
contentTable = new FlexTable();
contentTable.setWidth("100%");
contentTable.getCellFormatter().addStyleName(0, 0, "products-ListContainer");
contentTable.getCellFormatter().setWidth(0, 0, "100%");
contentTable.getFlexCellFormatter().setVerticalAlignment(0, 0, DockPanel.ALIGN_TOP);
// vPanel = new VerticalPanel();
// initWidget(vPanel);
// Create the menu
//
HorizontalPanel hPanel = new HorizontalPanel();
hPanel.setBorderWidth(0);
hPanel.setSpacing(0);
hPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT);
addButton = new Button("Add");
hPanel.add(addButton);
deleteButton = new Button("Delete");
hPanel.add(deleteButton);
// vPanel.add(hPanel);
contentTable.getCellFormatter().addStyleName(0, 0, "products-ListMenu");
contentTable.setWidget(0, 0, hPanel);
// Create the products list
//
productsTable = new FlexTable();
productsTable.setCellSpacing(0);
productsTable.setCellPadding(0);
productsTable.setWidth("100%");
productsTable.addStyleName("products-ListContents");
productsTable.getColumnFormatter().setWidth(0, "15px");
// vPanel.add(productsTable);
contentTable.setWidget(1, 0, productsTable);
contentTableDecorator.add(contentTable);
}
public HasClickHandlers getAddButton() {
return addButton;
}
public HasClickHandlers getDeleteButton() {
return deleteButton;
}
public HasClickHandlers getList() {
return productsTable;
}
public void setData(List<String> data) {
productsTable.removeAllRows();
for (int i = 0; i < data.size(); ++i) {
productsTable.setWidget(i, 0, new CheckBox());
productsTable.setText(i, 1, data.get(i));
}
}
public int getClickedRow(ClickEvent event) {
int selectedRow = -1;
HTMLTable.Cell cell = productsTable.getCellForEvent(event);
if (cell != null) {
// Suppress clicks if the user is actually selecting the
// check box
//
if (cell.getCellIndex() > 0) {
selectedRow = cell.getRowIndex();
}
}
return selectedRow;
}
public List<Integer> getSelectedRows() {
List<Integer> selectedRows = new ArrayList<Integer>();
for (int i = 0; i < productsTable.getRowCount(); ++i) {
CheckBox checkBox = (CheckBox) productsTable.getWidget(i, 0);
if (checkBox.getValue()) {
selectedRows.add(i);
}
}
return selectedRows;
}
public Widget asWidget() {
return this;
}
}
| [
"1191182@isep.ipp.pt"
] | 1191182@isep.ipp.pt |
c4ec8e0b8440d7ea1cc48ab7c9c501b27fe6b23f | 6ffb6cdff6b40c0893202ddf7dc6210c3b8f0f5d | /loanquery/src/com/mcjs/service/FundStreamSeleService.java | b98dee094d000575f9c94fe981f3de1d5c9bd4ce | [] | no_license | lingxiao123/loanquery | 8335affe340fef9a66519b956d3c24547e5bfddb | a47344ee5cb5600353d03b96591cee4de99551bd | refs/heads/master | 2016-09-14T01:30:57.569799 | 2016-04-21T09:29:34 | 2016-04-21T09:29:34 | 56,758,350 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 527 | java | package com.mcjs.service;
import java.util.List;
import com.mcjs.entity.FundStreamSele;
import com.mcjs.tool.PageTool;
public interface FundStreamSeleService {
public void addFundStreamSele(FundStreamSele fundStreamSele);
public int getFundStreamSele();
public List<FundStreamSele> findFundStreamSeles(PageTool tool);
public int getFundStreamSele(String where);
public List<FundStreamSele> findFundStreamSeles(PageTool tool,String where);
public List<FundStreamSele> findFundStreamSele(String where);
}
| [
"18694076609@163.com"
] | 18694076609@163.com |
3738815d8e65df52c448898b365823ada8a19755 | a33ed449e758c592dc3c946e7711534ebb60028e | /src/com/caterpillar/xmlrpc/core/XmlRpcCustomSerializer.java | 96283955aa6e22674778f658362134a9b4c9be37 | [
"Apache-2.0"
] | permissive | jamesbluecrow/android-framework-library | b490f7cfcd430d017d89587d0b4d23a56026c65e | b106a49f6fa9d35ded4da92b3699aa783ee8ffb4 | refs/heads/master | 2021-05-31T07:12:25.372847 | 2015-04-18T03:08:14 | 2015-04-18T03:08:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,273 | java | /*
Copyright (c) 2005 Redstone Handelsbolag
This library is free software; you can redistribute it and/or modify it under the terms
of the GNU Lesser General Public License as published by the Free Software Foundation;
either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this
library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
*/
package com.caterpillar.xmlrpc.core;
import java.io.IOException;
import java.io.Writer;
/**
* Java objects are serialized into XML-RPC values using instances of classes
* implementing the XmlRpcCustomSerializer class. When processing an argument or a return
* value for an XML-RPC call, the XmlRpcSerializer will look through its list of
* XmlRpcCustomSerializer objects for a serializer that matches the object type of the
* value. The getValueClass() returns the Class supported by that serializer.
*
* <p>A number of serializers for common types are already implemented, but you may
* wish to add custom serializers for special types of Java objects.</p>
*
* @author Greger Olsson
*/
public interface XmlRpcCustomSerializer
{
/**
* Returns the class of objects this serializer knows how to handle.
*
* @return The class of objects interpretable to this serializer.
*/
Class getSupportedClass();
/**
* Asks the custom serializer to serialize the supplied value into the supplied
* writer. The supplied value will be of the type reported in getSupportedClass()
* or of a type extending therefrom.
*
* @param value The object to serialize.
*
* @param output The writer to place the serialized data.
*
* @param builtInSerializer The built-in serializer used by the client or the server.
*
* @throws XmlRpcException if the value somehow could not be serialized. Many serializers
* rely on the built in serializer which also may throw this
* exception.
*
* @throws IOException if there was an error serializing the value through the
* writer. The exception is the exception thrown by the
* writer, which in most cases will be a StringWriter, in which
* case this exception will never occurr. XmlRpcSerializer and
* custom serializers may, however, be used outside of the
* XML-RPC library to encode information in XML-RPC structs, in
* which case the writer potentially could be writing the
* information over a socket stream for instance.
*/
void serialize(
Object value,
Writer output,
XmlRpcSerializer builtInSerializer )
throws XmlRpcException, IOException;
} | [
"jamesbluecrow@gmail.com"
] | jamesbluecrow@gmail.com |
f4634b20fa17d5201361d0e3cc23ddf965c266ba | bd86a38063721c75e21a7ba64a088e6eca5a0e7b | /familyeducationhelp-fe/app/src/main/java/com/example/familyeducationhelp/classList/wheelpickerwidget/WheelAdapter.java | caa8cc11fa858003f517ce67ddef48c5b744ad1d | [] | no_license | HpBoss/familyEducationHelp | dd850ba5227c262958d1b3e9093b7277d463fc99 | c761d2979383535ff335ff6c2f6fc687ca84eaf6 | refs/heads/master | 2023-05-10T21:58:25.378286 | 2023-05-04T08:53:13 | 2023-05-04T08:53:13 | 197,902,586 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,591 | java | package com.example.familyeducationhelp.classList.wheelpickerwidget;
import androidx.annotation.NonNull;
import java.util.ArrayList;
import java.util.List;
/**
* 滚轮数据适配器
*
* @author <a href="mailto:1032694760@qq.com">liyujiang</a>
* @date 2019/5/14 20:02
*/
@SuppressWarnings({"unused"})
public class WheelAdapter<T> {
private List<T> data;
public WheelAdapter() {
this.data = new ArrayList<>();
}
public int getItemCount() {
return data.size();
}
public T getItem(int position) {
final int itemCount = getItemCount();
if (itemCount == 0) {
return null;
}
int index = (position + itemCount) % itemCount;
return data.get(index);
}
public String getItemText(int position, Formatter formatter) {
T item = getItem(position);
if (item == null) {
return "";
}
if (formatter != null) {
return formatter.formatItemText(position, item);
}
return item.toString();
}
public List<T> getData() {
return data;
}
public void setData(List<T> data) {
this.data.clear();
this.data.addAll(data);
}
public void addData(List<T> data) {
this.data.addAll(data);
}
public int getItemPosition(T item) {
int position = -1;
if (data != null) {
return data.indexOf(item);
}
return position;
}
public interface Formatter {
String formatItemText(int position, @NonNull Object object);
}
}
| [
"39408465+HpBoss@users.noreply.github.com"
] | 39408465+HpBoss@users.noreply.github.com |
58d780067403cbf02917b66d5f15cc7d97cffd9f | 57267ca8d379893409325b05a4e4a1f2af4a4732 | /SpringCRUDExam/src/main/java/egovframework/student/service/StudentService.java | 94a0ca5f012e5f8562d3a99527f033eedcea7a0c | [] | no_license | id-remember/webpro-final2 | c7f71a9e35aae53ade4494751ea89ccad3747c19 | ba7ae27ad53a8d0ac0e20974d72ca0420d01e71d | refs/heads/master | 2020-06-12T09:59:03.823456 | 2016-12-05T05:25:33 | 2016-12-05T05:25:33 | 75,590,984 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 279 | java | package egovframework.student.service;
import java.util.List;
import egovframework.student.StudentVO;
public interface StudentService {
void insertStudent(StudentVO vo) throws Exception;
List<StudentVO> selectStudentList() throws Exception;
}
| [
"2_201600001@P3211-XPS15"
] | 2_201600001@P3211-XPS15 |
fa0a3948377c02692d324d09a64ac54d3f4fbf18 | a16611c75fa0c8699bdf97ab1a9d24c442d48a57 | /ucloude-framework/src/main/java/cn/uway/ucloude/support/bean/PropConverter.java | 48c98dfb7970283292ccd05719f93e8ae5359ab2 | [] | no_license | un-knower/yuncaiji_v4 | cfaf3f18accb794901f70f7252af30280414e7ed | a4ff027e485272b73e2c6fb3f1dd098f5499086b | refs/heads/master | 2020-03-17T23:14:40.121595 | 2017-05-21T05:55:51 | 2017-05-21T05:55:51 | 134,036,686 | 0 | 1 | null | 2018-05-19T06:35:12 | 2018-05-19T06:35:12 | null | UTF-8 | Java | false | false | 209 | java | package cn.uway.ucloude.support.bean;
public interface PropConverter<Source, Output> {
/**
* @param source 是原对象
* @return 这个属性的值
*/
Output convert(Source source);
} | [
"1852300415@qq.com"
] | 1852300415@qq.com |
ceb1fcadefb36a52e22765ad48fd7eded797601c | 7c7cc5de91a9cffbf14174d7b7a3d4c4c21fe86f | /load_balancer/src/oss/distributor/DataMover.java | 21647deec5bcc8177481cce146a04535b56536d4 | [] | no_license | compuwizard123/csse477-simple-web-server | eb5e5e8c6ffbcaf344ea65b81f77f9426434ffa9 | a7a12ec721b4cf7bca5f80186dbd5168cc19744e | refs/heads/master | 2020-05-18T11:32:09.308609 | 2012-10-30T17:59:00 | 2012-10-30T17:59:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 23,023 | java | /*
*****************************************************************************
* $Id: DataMover.java,v 1.14 2003/08/06 21:26:13 jheiss Exp $
*****************************************************************************
* This class passes data back and forth from clients and servers for
* established connections through the load balancer.
*****************************************************************************
* Copyright 2003 Jason Heiss
*
* This file is part of Distributor.
*
* Distributor is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Distributor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Distributor; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************
*/
package oss.distributor;
import java.io.IOException;
import java.net.Socket;
import java.nio.ByteBuffer;
import java.nio.channels.Selector;
import java.nio.channels.SelectionKey;
import java.nio.channels.SocketChannel;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.CancelledKeyException;
import java.util.List;
import java.util.LinkedList;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.logging.Logger;
class DataMover implements Runnable
{
Target target;
boolean halfClose;
Selector selector;
Logger logger;
List<DistributionAlgorithm> distributionAlgorithms;
Map<SocketChannel, SocketChannel> clients;
Map<SocketChannel, SocketChannel> servers;
List<Connection> newConnections;
List<SocketChannel> channelsToReactivate;
DelayedMover delayedMover;
long clientToServerByteCount;
long serverToClientByteCount;
Thread thread;
final int BUFFER_SIZE = 128 * 1024;
protected DataMover(
Distributor distributor, Target target, boolean halfClose)
{
logger = distributor.getLogger();
distributionAlgorithms = distributor.getDistributionAlgorithms();
this.target = target;
this.halfClose = halfClose;
try
{
selector = Selector.open();
}
catch (IOException e)
{
logger.severe("Error creating selector: " + e.getMessage());
System.exit(1);
}
clients = new HashMap<SocketChannel, SocketChannel>();
servers = new HashMap<SocketChannel, SocketChannel>();
newConnections = new LinkedList<Connection>();
channelsToReactivate = new LinkedList<SocketChannel>();
delayedMover = new DelayedMover();
clientToServerByteCount = 0;
serverToClientByteCount = 0;
// Create a thread for ourselves and start it
thread = new Thread(this, toString());
thread.start();
}
/*
* Completed connections established by a distribution algorithm are
* handed to the corresponding Target, which it turn registers them
* with us via this method.
*/
protected void addConnection(Connection conn)
{
// Add connection to a list that will be processed later by
// calling processNewConnections()
synchronized (newConnections)
{
newConnections.add(conn);
}
// Wakeup the select so that the new connection list gets
// processed
selector.wakeup();
}
/*
* Process new connections queued up by calls to addConnection()
*
* Returns true if it did something (i.e. the queue wasn't empty).
*/
private boolean processNewConnections()
{
boolean didSomething = false;
synchronized (newConnections)
{
Iterator<Connection> iter = newConnections.iterator();
while(iter.hasNext())
{
Connection conn = iter.next();
iter.remove();
SocketChannel client = conn.getClient();
SocketChannel server = conn.getServer();
try
{
logger.finest("Setting channels to non-blocking mode");
client.configureBlocking(false);
server.configureBlocking(false);
clients.put(client, server);
servers.put(server, client);
logger.finest("Registering channels with selector");
client.register(selector, SelectionKey.OP_READ);
server.register(selector, SelectionKey.OP_READ);
}
catch (IOException e)
{
logger.warning(
"Error setting channels to non-blocking mode: " +
e.getMessage());
try
{
logger.fine("Closing channels");
client.close();
server.close();
}
catch (IOException ioe)
{
logger.warning("Error closing channels: " +
ioe.getMessage());
}
}
didSomething = true;
}
}
return didSomething;
}
/*
* In the moveData() method, if we have a destination channel which
* we aren't immediately able to write data to, we de-activate the
* corresponding source channel from the selector until DelayedMover
* is able to transmit all of that delayed data. This method is
* used by DelayedMover to tell us that all of the data from a
* channel has been sent to its destination, and thus that we can
* re-activate the channel with the selector and read more data from
* it.
*/
protected void addToReactivateList(SocketChannel channel)
{
// Add channel to a list that will be processed later by
// calling processReactivateList()
synchronized (channelsToReactivate)
{
channelsToReactivate.add(channel);
}
// Wakeup the select so that the list gets processed
selector.wakeup();
}
/*
* Process channels queued up by calls to addToReactivateList()
*
* Returns true if it did something (i.e. the queue wasn't empty).
*/
private boolean processReactivateList()
{
boolean didSomething = false;
synchronized (channelsToReactivate)
{
Iterator<SocketChannel> iter = channelsToReactivate.iterator();
while(iter.hasNext())
{
SocketChannel channel = iter.next();
iter.remove();
SelectionKey key = channel.keyFor(selector);
try
{
// Add OP_READ back to the interest bits
key.interestOps(
key.interestOps() | SelectionKey.OP_READ);
}
catch (CancelledKeyException e)
{
// The channel has been closed or something similar,
// nothing we can do about it.
}
didSomething = true;
}
}
return didSomething;
}
public void run()
{
int selectFailureOrZeroCount = 0;
ByteBuffer buffer = ByteBuffer.allocateDirect(BUFFER_SIZE);
while(true)
{
// Register any new connections with the selector
boolean pncReturn = processNewConnections();
// Re-activate channels with the selector
boolean prlReturn = processReactivateList();
// Reset the failure counter if processNewConnections() or
// processReactivateList() did something, as that would
// explain why select would return with zero ready channels.
if (pncReturn || prlReturn)
{
selectFailureOrZeroCount = 0;
}
// If we exceed the threshold of failed selects, pause
// for a bit so we don't go into a tight loop
if (selectFailureOrZeroCount >= 10)
{
logger.warning(
"select appears to be failing repeatedly, pausing");
try { Thread.sleep(500); }
catch (InterruptedException e) {}
selectFailureOrZeroCount = 0;
}
//
// Now select for any channels that have data to be moved
//
int selectReturn = 0;
try
{
selectReturn = selector.select();
if (selectReturn > 0)
{
selectFailureOrZeroCount = 0;
}
else
{
selectFailureOrZeroCount++;
}
}
catch (IOException e)
{
// The only exceptions thrown by select seem to be the
// occasional (fairly rare) "Interrupted system call"
// which, from what I can tell, is safe to ignore.
logger.warning(
"Error when selecting for ready channel: " +
e.getMessage());
selectFailureOrZeroCount++;
continue;
}
logger.finest(
"select reports " + selectReturn + " channels ready to read");
// Work through the list of channels that have data to read
Iterator<SelectionKey> keyIter = selector.selectedKeys().iterator();
while (keyIter.hasNext())
{
SelectionKey key = keyIter.next();
keyIter.remove();
// Figure out which direction this data is going and
// get the SocketChannel that is the other half of
// the connection.
SocketChannel src = (SocketChannel) key.channel();
SocketChannel dst;
boolean clientToServer;
if (clients.containsKey(src))
{
clientToServer = true;
dst = clients.get(src);
}
else if (servers.containsKey(src))
{
clientToServer = false;
dst = servers.get(src);
}
else
{
// We've been dropped from the maps, which means the
// connection has already been closed. Nothing to
// do except cancel our key (just to be safe) and
// move on to the next ready key.
key.cancel();
continue;
}
try
{
// Loop as long as the source has data to read
// and we can write it to the destination.
boolean readMore = true;
while (readMore) {
// Assume there won't be more data
readMore = false;
// Try to read data
buffer.clear();
int numberOfBytes = src.read(buffer);
logger.finest(
"Read " + numberOfBytes + " bytes from " + src);
if (numberOfBytes > 0) // Data was read
{
if (moveData(
buffer, src, dst, clientToServer, key))
{
readMore = true;
}
}
else if (numberOfBytes == -1) // EOF
{
handleEOF(key, src, dst, clientToServer);
}
}
}
catch (IOException e)
{
logger.warning(
"Error moving data between channels: " +
e.getMessage());
closeConnection(src, dst, clientToServer);
}
}
}
}
/*
* Give the distribution algorithms a chance to review the data in
* buffer, then attempt to send it to dst.
*
* Returns true is all of the data in buffer is successfully
* transmitted to dst, false if some/all of it is delayed.
*/
private boolean moveData(
ByteBuffer buffer,
SocketChannel src, SocketChannel dst,
boolean clientToServer, SelectionKey sourceKey) throws IOException
{
buffer.flip();
if (clientToServer)
{
clientToServerByteCount += buffer.remaining();
}
else
{
serverToClientByteCount += buffer.remaining();
}
// Give each of the distribution algorithms a
// chance to inspect/modify the data stream
Iterator<DistributionAlgorithm> iter = distributionAlgorithms.iterator();
ByteBuffer reviewedBuffer = buffer;
while (iter.hasNext())
{
DistributionAlgorithm algo = iter.next();
if (clientToServer)
{
reviewedBuffer =
algo.reviewClientToServerData(src, dst, reviewedBuffer);
}
else
{
reviewedBuffer =
algo.reviewServerToClientData(src, dst, reviewedBuffer);
}
}
// Make an effort to send the data on to its destination
dst.write(reviewedBuffer);
// If there is still data in the buffer, hand it off to
// DelayedMover
if (reviewedBuffer.hasRemaining())
{
logger.finer("Delaying " + reviewedBuffer.remaining() +
" bytes from " + src + " to " + dst);
// Copy the delayed data into a temporary buffer
ByteBuffer delayedBuffer =
ByteBuffer.allocate(reviewedBuffer.remaining());
delayedBuffer.put(reviewedBuffer);
delayedBuffer.flip();
// De-activate the source channel from the selector by
// removing OP_READ from the interest bits. (This is safer
// than actually canceling the key and then re-registering
// the channel later, there are race condition problems with
// that approach leading to CanceledKeyExceptions.) We
// don't want to read any more data from the source until we
// get this delayed data written to the destination.
// DelayedMover will re-activate the source channel (via
// addToReactivateList()) when it has written all of the
// delayed data.
try
{
sourceKey.interestOps(
sourceKey.interestOps() ^ SelectionKey.OP_READ);
delayedMover.addToQueue(
new DelayedDataInfo(
dst, delayedBuffer, src, clientToServer));
}
catch (CancelledKeyException e)
{
// The channel has been closed or something similar,
// nothing we can do about it.
}
return false;
}
else
{
return true;
}
}
private void handleEOF(
SelectionKey key,
SocketChannel src, SocketChannel dst,
boolean clientToServer) throws IOException
{
if (halfClose)
{
// Cancel this key, otherwise this channel will repeatedly
// trigger select to tell us that it is at EOF.
key.cancel();
Socket srcSocket = src.socket();
Socket dstSocket = dst.socket();
// If the other half of the socket is already shutdown then
// go ahead and close the socket
if (srcSocket.isOutputShutdown())
{
logger.finer("Closing source socket");
srcSocket.close();
}
// Otherwise just close down the input stream. This allows
// any return traffic to continue to flow.
else
{
logger.finest("Shutting down source input");
srcSocket.shutdownInput();
}
// Do the same thing for the destination, but using the
// reverse streams.
if (dstSocket.isInputShutdown())
{
logger.finer("Closing destination socket");
dstSocket.close();
}
else
{
logger.finest("Shutting down dest output");
dstSocket.shutdownOutput();
}
// Clean up if both halves of the connection are now closed
if (srcSocket.isClosed() && dstSocket.isClosed())
{
dumpState(src, dst, clientToServer);
}
}
else
{
// If half close isn't enabled, just close the connection.
closeConnection(src, dst, clientToServer);
}
}
private void closeConnection(
SocketChannel src, SocketChannel dst, boolean clientToServer)
{
SocketChannel client;
SocketChannel server;
if (clientToServer)
{
client = src;
server = dst;
}
else
{
server = src;
client = dst;
}
closeConnection(client, server);
}
protected void closeConnection(
SocketChannel client, SocketChannel server)
{
// Close both channels
try
{
logger.fine("Closing channels");
client.close();
server.close();
}
catch (IOException ioe)
{
logger.warning("Error closing channels: " + ioe.getMessage());
}
dumpState(client, server);
}
private void dumpState(
SocketChannel src, SocketChannel dst, boolean clientToServer)
{
SocketChannel client;
SocketChannel server;
if (clientToServer)
{
client = src;
server = dst;
}
else
{
server = src;
client = dst;
}
dumpState(client, server);
}
/*
* Call this method when closing a connection to remove any
* associated entries from the state tracking maps.
*/
private void dumpState(SocketChannel client, SocketChannel server)
{
clients.remove(client);
servers.remove(server);
delayedMover.dumpDelayedState(client, server);
}
public long getClientToServerByteCount()
{
return clientToServerByteCount;
}
public long getServerToClientByteCount()
{
return serverToClientByteCount;
}
public String toString()
{
return getClass().getName() +
" for " + target.getInetAddress() + ":" + target.getPort();
}
protected String getMemoryStats(String indent)
{
String stats = indent + clients.size() + " entries in clients Map\n";
stats += indent + servers.size() + " entries in servers Map\n";
stats += indent +
newConnections.size() + " entries in newConnections List\n";
stats += indent +
channelsToReactivate.size() +
" entries in channelsToReactivate List\n";
stats += indent +
selector.keys().size() + " entries in selector key Set\n";
stats += indent + "DelayedMover:\n";
stats += delayedMover.getMemoryStats(indent);
return stats;
}
class DelayedMover implements Runnable
{
Selector delayedSelector;
List<DelayedDataInfo> queue;
Map<SocketChannel, DelayedDataInfo> delayedInfo;
Thread thread;
DelayedMover()
{
try
{
delayedSelector = Selector.open();
}
catch (IOException e)
{
logger.severe("Error creating selector: " + e.getMessage());
System.exit(1);
}
queue = new LinkedList<DelayedDataInfo>();
delayedInfo = new HashMap<SocketChannel, DelayedDataInfo>();
// Create a thread for ourselves and start it
thread = new Thread(this, toString());
thread.start();
}
/*
* Used by DataMover to register a destination with us.
*/
void addToQueue(DelayedDataInfo info)
{
// Add channel to a list that will be processed later by
// calling processQueue()
synchronized (queue)
{
queue.add(info);
}
// Wakeup the select so that the new connection list
// gets processed
delayedSelector.wakeup();
}
/*
* Process the list created by addToQueue()
*/
private boolean processQueue()
{
boolean didSomething = false;
synchronized (queue)
{
Iterator<DelayedDataInfo> iter = queue.iterator();
while (iter.hasNext())
{
DelayedDataInfo info = iter.next();
iter.remove();
SocketChannel dst = info.getDest();
// Store the info in a map for later use
synchronized (delayedInfo)
{
delayedInfo.put(dst, info);
}
// Check to see if we already have a key registered
// for this channel.
SelectionKey key = dst.keyFor(delayedSelector);
if (key == null)
{
// Nope, no key already registered. Register a
// new one.
logger.finest(
"Registering channel with selector");
try
{
dst.register(
delayedSelector, SelectionKey.OP_WRITE);
}
catch (ClosedChannelException e)
{
// If the channel is already closed, there isn't
// much else we can do to it. DataMover will
// clean things up.
}
}
else
{
// We already have a key registered, make sure
// it has the right interest bits.
try
{
key.interestOps(
key.interestOps() | SelectionKey.OP_WRITE);
}
catch (CancelledKeyException e)
{
// The channel has been closed or something
// similar, nothing we can do about it.
// DataMover will clean things up.
}
}
didSomething = true;
}
}
return didSomething;
}
public void run()
{
int selectFailureOrZeroCount = 0;
while (true)
{
// Register any new connections with the selector
boolean pqReturn = processQueue();
// Reset the failure counter if processQueue() did
// something, as that would explain why select would
// return with zero ready channels.
if (pqReturn)
{
selectFailureOrZeroCount = 0;
}
// If we exceed the threshold of failed selects, pause
// for a bit so we don't go into a tight loop
if (selectFailureOrZeroCount >= 10)
{
logger.warning(
"select appears to be failing repeatedly, pausing");
try { Thread.sleep(500); }
catch (InterruptedException e) {}
selectFailureOrZeroCount = 0;
}
// Now select for any channels that are ready to write
try
{
int selectReturn = delayedSelector.select();
if (selectReturn > 0)
{
selectFailureOrZeroCount = 0;
}
else
{
selectFailureOrZeroCount++;
}
logger.finest(
"select reports " + selectReturn +
" channels ready to write");
}
catch (IOException e)
{
// The only exceptions thrown by select seem to be the
// occasional (fairly rare) "Interrupted system call"
// which, from what I can tell, is safe to ignore.
logger.warning(
"Error when selecting for ready channel: " +
e.getMessage());
selectFailureOrZeroCount++;
continue;
}
// Work through the list of channels that are
// ready to write
Iterator<SelectionKey> keyIter = delayedSelector.selectedKeys().iterator();
SelectionKey key = keyIter.next();
keyIter.remove();
SocketChannel dst = (SocketChannel) key.channel();
DelayedDataInfo info;
synchronized (delayedInfo)
{
info = delayedInfo.get(dst);
}
ByteBuffer delayedBuffer = info.getBuffer();
try
{
int numberOfBytes = dst.write(delayedBuffer);
logger.finest(
"Wrote " + numberOfBytes +
" delayed bytes to " + dst + ", " +
delayedBuffer.remaining() +
" bytes remain delayed");
// If the buffer is now empty, we're done with
// this channel.
if (! delayedBuffer.hasRemaining())
{
// Instead of canceling the key, we just
// remove OP_WRITE from the interest bits.
// This avoids a race condition leading to a
// CanceledKeyException if DataMover gives
// the channel back to us right away. It
// means we're stuck with the key in our
// selector until the connection is closed,
// but that seems acceptable.
try
{
key.interestOps(
key.interestOps() ^ SelectionKey.OP_WRITE);
}
catch (CancelledKeyException e)
{
// The channel has been closed or something
// similar, nothing we can do about it.
// DataMover will clean things up.
}
SocketChannel src = info.getSource();
dumpDelayedState(info.getDest());
addToReactivateList(src);
}
}
catch (IOException e)
{
logger.warning(
"Error writing delayed data: " +
e.getMessage());
closeConnection(
dst, info.getSource(), info.isClientToServer());
}
}
}
void dumpDelayedState(SocketChannel client, SocketChannel server)
{
dumpDelayedState(client);
dumpDelayedState(server);
}
private void dumpDelayedState(SocketChannel dst)
{
synchronized (delayedInfo)
{
delayedInfo.remove(dst);
}
}
public String toString()
{
return getClass().getName() +
" for " + target.getInetAddress() + ":" + target.getPort();
}
protected String getMemoryStats(String indent)
{
String stats = indent + queue.size() + " entries in queue List\n";
stats = indent +
delayedInfo.size() + " entries in delayedInfo Map\n";
stats += indent +
delayedSelector.keys().size() +
" entries in delayedSelector key Set";
return stats;
}
}
class DelayedDataInfo
{
SocketChannel dst;
ByteBuffer buffer;
SocketChannel src;
boolean clientToServer;
DelayedDataInfo(
SocketChannel dst, ByteBuffer buffer,
SocketChannel src, boolean clientToServer)
{
this.dst = dst;
this.buffer = buffer;
this.src = src;
this.clientToServer = clientToServer;
}
SocketChannel getDest() { return dst; }
ByteBuffer getBuffer() { return buffer; }
SocketChannel getSource() { return src; }
boolean isClientToServer() { return clientToServer; }
}
}
| [
"compuwizard123@gmail.com"
] | compuwizard123@gmail.com |
f251f71e9e41b7feee8af3d32f9437b4e7765c84 | d16c972976f43e0fd3747c6e9c4d5daacaa7fdff | /app/src/main/java/it/gioacchinovaiana/pizzabuona/PizzeriaFragment.java | 8b01f3a013919b8850de9ab0c309db73c4e7cefe | [] | no_license | gioacchinovaiana/PizzaBuona | 82e371589a41c231d43a7f16a4a6230f99ebdffc | 98bcabc4534a01ccf0510e09dd87aa713b54ea48 | refs/heads/master | 2020-05-19T22:27:18.070804 | 2015-05-19T20:03:20 | 2015-05-19T20:03:20 | 35,510,262 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,486 | java | package it.gioacchinovaiana.pizzabuona;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.drawable.LayerDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.CursorLoader;
import android.support.v4.content.Loader;
import android.support.v7.widget.ShareActionProvider;
import android.telephony.TelephonyManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.RatingBar;
import android.widget.TextView;
import it.gioacchinovaiana.pizzabuona.data.PizzaBuonaContratc;
/**
* Created by Gioacchino on 04/04/2015.
*/
public class PizzeriaFragment extends Fragment implements LoaderManager.LoaderCallbacks<Cursor> {
private static final String LOG_TAG = PizzeriaFragment.class.getSimpleName();
private static final String FORECAST_SHARE_HASHTAG = " #PizzaBuonaApp";
private ShareActionProvider mShareActionProvider;
private String mForecast;
private static final int DETAIL_LOADER = 1;
private static final String[] DETAIL_COLUMNS = {
PizzaBuonaContratc.PizzerieEntry.TABLE_NAME + "." + PizzaBuonaContratc.PizzerieEntry.ID_PIZZERIE,
//PizzaBuonaContratc.PizzerieEntry.ID_PIZZERIE,
PizzaBuonaContratc.PizzerieEntry.NOME_PIZZERIA,
PizzaBuonaContratc.PizzerieEntry.TITOLARE,
PizzaBuonaContratc.PizzerieEntry.INDIRIZZO,
PizzaBuonaContratc.PizzerieEntry.CAP,
PizzaBuonaContratc.PizzerieEntry.CITTA,
PizzaBuonaContratc.PizzerieEntry.PROV,
PizzaBuonaContratc.PizzerieEntry.COORD1,
PizzaBuonaContratc.PizzerieEntry.COORD2,
PizzaBuonaContratc.PizzerieEntry.TEL1,
PizzaBuonaContratc.PizzerieEntry.TEL2,
PizzaBuonaContratc.PizzerieEntry.EMAIL,
PizzaBuonaContratc.PizzerieEntry.FORNO,
PizzaBuonaContratc.PizzerieEntry.CHIUSURA,
PizzaBuonaContratc.PizzerieEntry.CELIACI,
PizzaBuonaContratc.PizzerieEntry.NUMIMP,
PizzaBuonaContratc.PizzerieEntry.LIEVMADR,
PizzaBuonaContratc.PizzerieEntry.BIRREART,
PizzaBuonaContratc.PizzerieEntry.FARINEPIETRA,
PizzaBuonaContratc.PizzerieEntry.FILONE,
PizzaBuonaContratc.PizzerieEntry.BOCCONE,
PizzaBuonaContratc.PizzerieEntry.PIZZAIOLO,
PizzaBuonaContratc.PizzerieEntry.CONTO,
PizzaBuonaContratc.PizzerieEntry.DATA_RECENSIONE,
PizzaBuonaContratc.PizzerieEntry.DATA_RIVALUTAZIONE,
PizzaBuonaContratc.PizzerieEntry.LINK_ARTICOLO,
PizzaBuonaContratc.PizzerieEntry.VALUTAZIONE
};
// These indices are tied to DETAIL_COLUMNS. If DETAIL_COLUMNS changes, these
// must change.
public static final int COL_ID_PIZZERIE =0;
public static final int COL_NOME_PIZZERIA = 1;
public static final int COL_TITOLARE = 2;
public static final int COL_INDIRIZZO = 3;
public static final int COL_CAP = 4;
public static final int COL_CITTA = 5;
public static final int COL_PROV = 6;
public static final int COL_COORD1 = 7;
public static final int COL_COORD2 = 8;
public static final int COL_TEL1 = 9;
public static final int COL_TEL2 = 10;
public static final int COL_EMAIL = 11;//
public static final int COL_FORNO = 12;
public static final int COL_CHIUSURA = 13;
public static final int COL_CELIACI = 14;
public static final int COL_NUMIMP = 15;
public static final int COL_LIEVMADR = 16;
public static final int COL_BIRREART = 17;
public static final int COL_FARINEPIETRA = 18;
public static final int COL_FILONE = 19;
public static final int COL_BOCCONE = 20;
public static final int COL_PIZZAIOLO = 21;
public static final int COL_CONTO = 22;
public static final int COL_DATA_RECENSIONE = 23;
public static final int COL_DATA_RIVALUTAZIONE = 24;
public static final int COL_LINK_ARTICOLO = 25;
public static final int COL_VALUTAZIONE = 26;
private TextView textView_nome_pizzeria;
private TextView textView_indirizzo_pizzeria;
private TextView textView_t1;
private TextView textView_t2;
private RatingBar ratingBar;
private LayerDrawable stars;
private TextView textView_pizzaiolo;
private TextView textView_proprietario;
private TextView textView_forno;
private CheckBox check_celiaci;
private CheckBox check_filone;
private CheckBox check_farine_pietra;
private CheckBox check_boccone;
private CheckBox check_lievito_madre;
private CheckBox check_birre_art;
private TextView textView_num_impasti;
private TextView textView_chiusura;
private TextView textView_conto;
private TextView textView_recensione;
private TextView textView_rivalutazione;
private Button button_chiama_tel1;
private Button button_chiama_tel2;
private ImageView image_recensione;
private ImageView image_map;
public PizzeriaFragment() {
setHasOptionsMenu(true);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_dettaglio_pizzeria, container, false);
textView_nome_pizzeria= (TextView)rootView.findViewById(R.id.textView_nome_pizzeria);
textView_indirizzo_pizzeria= (TextView)rootView.findViewById(R.id.textView_indirizzo);
textView_t1 = (TextView)rootView.findViewById(R.id.textView_tel1);
textView_t2 = (TextView)rootView.findViewById(R.id.textView_tel2);
ratingBar = (RatingBar) rootView.findViewById(R.id.rating_pizzeria);
stars = (LayerDrawable) ratingBar.getProgressDrawable();
stars.getDrawable(0).setColorFilter(Color.BLUE, PorterDuff.Mode.SRC_ATOP);
stars.getDrawable(1).setColorFilter(Color.BLUE, PorterDuff.Mode.SRC_ATOP);
stars.getDrawable(2).setColorFilter(Color.YELLOW, PorterDuff.Mode.SRC_ATOP);
textView_pizzaiolo= (TextView)rootView.findViewById(R.id.text_pizzaiolo);
textView_proprietario = (TextView)rootView.findViewById(R.id.text_proprietario);
textView_forno= (TextView)rootView.findViewById(R.id.text_forno);
check_celiaci =(CheckBox) rootView.findViewById(R.id.checkBox_celiaci);
check_filone =(CheckBox) rootView.findViewById(R.id.checkBox_filone);
check_farine_pietra =(CheckBox) rootView.findViewById(R.id.checkBox_farine_pietra);
check_boccone =(CheckBox) rootView.findViewById(R.id.checkBox_boccone);
check_lievito_madre =(CheckBox) rootView.findViewById(R.id.checkBox_lievito_madre);
check_birre_art = (CheckBox) rootView.findViewById(R.id.checkBox_birre_art);
textView_num_impasti= (TextView)rootView.findViewById(R.id.textView_num_impasti);
textView_chiusura= (TextView)rootView.findViewById(R.id.textView_chiusura);
textView_conto= (TextView)rootView.findViewById(R.id.textView_conto);
textView_recensione= (TextView)rootView.findViewById(R.id.textView_recensione);
textView_rivalutazione= (TextView)rootView.findViewById(R.id.textView_rivalutazione);
button_chiama_tel1 = (Button)rootView.findViewById(R.id.textView_tel1);
button_chiama_tel2 = (Button)rootView.findViewById(R.id.textView_tel2);
image_recensione = (ImageView)rootView.findViewById(R.id.imageViewSite);
image_map = (ImageView)rootView.findViewById(R.id.imageViewMap);
return rootView;
}
private Intent createShareForecastIntent() {
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_TEXT, mForecast + FORECAST_SHARE_HASHTAG);
return shareIntent;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
getLoaderManager().initLoader(DETAIL_LOADER, null, this);
super.onActivityCreated(savedInstanceState);
}
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
//Log.v(LOG_TAG, "In onCreateLoader");
Intent intent = getActivity().getIntent();
if (intent == null || intent.getData() == null) {
return null;
}
// Now create and return a CursorLoader that will take care of
// creating a Cursor for the data being displayed.
CursorLoader myCursor = new CursorLoader(
getActivity(),
intent.getData(),
DETAIL_COLUMNS,
null,
null,
null
);
return myCursor;
}
public void updateView(Uri uri){
CursorLoader myCursor = new CursorLoader(
getActivity(),
uri,
DETAIL_COLUMNS,
null,
null,
null
);
onLoadFinished(myCursor,null);
}
@Override
public void onLoadFinished(Loader<Cursor> loader, final Cursor data) {
if (data != null && data.moveToFirst()) {
// Read date from cursor and update views
String indirizzo = data.getString(COL_INDIRIZZO)+", "+data.getString(COL_CITTA)+", "+data.getString(COL_PROV);
setDataPizzeria(data.getString(COL_NOME_PIZZERIA),indirizzo,data.getString(COL_TEL1),data.getString(COL_TEL2),data.getFloat(COL_VALUTAZIONE),data.getString(COL_PIZZAIOLO),
data.getString(COL_FORNO),data.getString(COL_CELIACI),data.getString(COL_FILONE),data.getString(COL_FARINEPIETRA),data.getString(COL_BOCCONE),data.getString(COL_LIEVMADR),data.getString(COL_BIRREART),
data.getString(COL_NUMIMP),data.getString(COL_CHIUSURA),data.getString(COL_CONTO),data.getString(COL_DATA_RECENSIONE),data.getString(COL_DATA_RIVALUTAZIONE), data.getString(COL_LINK_ARTICOLO),
data.getString(COL_TITOLARE),data.getString(COL_COORD1),data.getString(COL_COORD2));
}
}
@Override
public void onLoaderReset(Loader<Cursor> loader) { }
public void setDataPizzeria(final String NomePizzeria, String Indirizzo, final String T1, final String T2, Float valutazione, String pizzaiolo, String forno, String celiaci, String filone,
String farinepietra, String boccone, String lievitomadre, String birreart, String numimp, String chiusura, String conto, String recensione, String rivalutazione,
final String link, String proprietario, final String coord1, final String coord2){
textView_nome_pizzeria.setText(NomePizzeria);
textView_indirizzo_pizzeria.setText(Indirizzo);
ratingBar.setRating(valutazione);
if(pizzaiolo.length()>0){textView_pizzaiolo.setText("Pizzaiolo: "+pizzaiolo);}else{textView_pizzaiolo.setText("");}
if(proprietario.length()>0){textView_proprietario.setText("Titolare: "+proprietario);}else{textView_proprietario.setText("");}
String nomeGiorno = nomeGiornoSettimana(chiusura);
if(nomeGiorno.length()>0){textView_chiusura.setText("Chiusura: "+nomeGiorno);}else{textView_chiusura.setText("");}
textView_t1.setText(T1);
textView_t2.setText(T2);
if (celiaci.equals("Si")){ check_celiaci.setChecked(true);}else{check_celiaci.setChecked(false);}
if (filone.equals("Si")){check_filone.setChecked(true);}else{check_filone.setChecked(false);}
if (farinepietra.equals("Si")){check_farine_pietra.setChecked(true);}else{check_farine_pietra.setChecked(false);}
if (boccone.equals("Si")){check_boccone.setChecked(true);}else{check_boccone.setChecked(false);}
if (lievitomadre.equals("Si")) {check_lievito_madre.setChecked(true);}else{check_lievito_madre.setChecked(false);}
if (birreart.equals("Si")) {check_birre_art.setChecked(true);}else{check_birre_art.setChecked(false);}
if(forno.length()>0){textView_forno.setText("Forno: "+forno);}else{textView_forno.setText("");}
if(numimp.length()>0){textView_num_impasti.setText("Numero impasti: "+numimp);}else{textView_num_impasti.setText("");}
if(conto.length()>0){textView_conto.setText("Conto: € "+conto);}else{textView_conto.setText("");}
if(recensione.length()>0){textView_recensione.setText("Recensione del "+recensione);}else{textView_recensione.setText("");}
if(rivalutazione.length()>0){textView_rivalutazione.setText("Rivalutazione del " + rivalutazione);}else{textView_rivalutazione.setText("");}
if(link.length()>0){
image_recensione.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View arg0) {
String url = link;
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
}
});
}
image_map.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View arg0){
// Creates an Intent that will load a map
Uri gmmIntentUri = Uri.parse("geo:" + coord1 +","+coord2+"?q="+ coord1 +","+coord2+"("+NomePizzeria+")");
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.maps");
startActivity(mapIntent);
}
});
}
private String nomeGiornoSettimana(String giorno){
String nomeGiorno="";
switch (giorno){
case "Lun": nomeGiorno="Lunedi";
break;
case "Mar": nomeGiorno="Martedi";
break;
case "Mer": nomeGiorno="Mercoledi";
break;
case "Gio": nomeGiorno="Giovedi";
break;
case "Ven": nomeGiorno="Venerdi";
break;
case "Sab": nomeGiorno="Sabato";
break;
case "Dom": nomeGiorno="Domenica";
break;
}
return nomeGiorno;
}
}
| [
"gioacchino.vaiana@gmail.com"
] | gioacchino.vaiana@gmail.com |
91de96fff3de9440bbbadc15b257b01cadbcd4ca | 8bf7fc828ddc913fc885d8c72585a2e5481d7d88 | /app/src/main/java/zhushen/com/shejimoshi/chapter18/example1/ProxySubject.java | 483c25e8714deef150592b5c4771008651ec398a | [
"MIT"
] | permissive | keeponZhang/android_design_pattern_book_source | eacfb6b6d338e7b2c52042d5a0cdb5c27e1be3ec | 8c8e98c2071546da5fc517f1c937f302d3a5ec52 | refs/heads/master | 2022-12-16T03:43:31.622111 | 2020-09-11T11:43:58 | 2020-09-11T11:43:58 | 293,052,105 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 353 | java | package zhushen.com.shejimoshi.chapter18.example1;
/**
* Created by Zhushen on 2018/5/30.
*/
public class ProxySubject extends Subject {
private RealSubject realSubject;
public ProxySubject(RealSubject realSubject) {
this.realSubject = realSubject;
}
@Override
public void visit() {
realSubject.visit();
}
}
| [
"zhangwengao@yy.com"
] | zhangwengao@yy.com |
068ab24a8b449dfc1cb9b3b571da35da93d89c53 | 6138af219efc3a8f31060e30ebc532ffcbad1768 | /astrogrid/mySpace/client/src/java/org/astrogrid/store/tree/TreeClientTest.java | 5ef2795b0f5ffaedd1407de67c6a472d14f73309 | [] | no_license | Javastro/astrogrid-legacy | dd794b7867a4ac650d1a84bdef05dfcd135b8bb6 | 51bdbec04bacfc3bcc3af6a896e8c7f603059cd5 | refs/heads/main | 2023-06-26T10:23:01.083788 | 2021-07-30T11:17:12 | 2021-07-30T11:17:12 | 391,028,616 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,232 | java | /*
* <cvs:source>$Source: /Users/pharriso/Work/ag/repo/git/astrogrid-mirror/astrogrid/mySpace/client/src/java/org/astrogrid/store/tree/TreeClientTest.java,v $</cvs:source>
* <cvs:author>$Author: clq2 $</cvs:author>
* <cvs:date>$Date: 2004/11/17 16:22:53 $</cvs:date>
* <cvs:version>$Revision: 1.2 $</cvs:version>
* <cvs:log>
* $Log: TreeClientTest.java,v $
* Revision 1.2 2004/11/17 16:22:53 clq2
* nww-itn07-704
*
* Revision 1.1.2.2 2004/11/16 17:27:58 nw
* tidied imports
*
* Revision 1.1.2.1 2004/11/16 16:47:28 nw
* copied aladinAdapter interfaces into a neutrally-named package.
* deprecated original interfaces.
* javadoc
*
* Revision 1.3 2004/11/11 17:50:42 clq2
* Noel's aladin stuff
*
* Revision 1.2.6.1 2004/11/11 13:12:36 nw
* added some further checking of the root container
*
* Revision 1.2 2004/10/05 15:39:29 dave
* Merged changes to AladinAdapter ...
*
* Revision 1.1.2.1 2004/10/05 15:30:44 dave
* Moved test base from test to src tree ....
* Added MimeTypeUtil
* Added getMimeType to the adapter API
* Added logout to the adapter API
*
* Revision 1.2 2004/09/28 10:24:19 dave
* Added AladinAdapter interfaces and mock implementation.
*
* Revision 1.1.2.7 2004/09/27 22:46:53 dave
* Added AdapterFile interface, with input and output stream API.
*
* Revision 1.1.2.6 2004/09/24 01:36:18 dave
* Refactored File as Node and Container ...
*
* Revision 1.1.2.5 2004/09/24 01:12:09 dave
* Added initial test for child nodes.
*
* Revision 1.1.2.4 2004/09/23 16:32:02 dave
* Added better Exception handling ....
* Added initial mock container ....
* Added initial root container tests ...
*
* Revision 1.1.2.3 2004/09/23 12:21:31 dave
* Added mock security service and login test ...
*
* Revision 1.1.2.2 2004/09/23 10:12:19 dave
* Added config properties for JUnit tests ....
* Added test for null password.
*
* Revision 1.1.2.1 2004/09/23 09:18:13 dave
* Renamed AbstractTest to TestBase to exclude it from batch test ....
* Added first test for null account ....
*
* Revision 1.1.2.1 2004/09/22 16:47:37 dave
* Added initial classes and tests for AladinAdapter.
*
* </cvs:log>
*
*/
package org.astrogrid.store.tree;
import org.astrogrid.store.Ivorn;
import org.astrogrid.store.util.MimeTypeUtil;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Iterator;
import junit.framework.TestCase;
/**
* A JUnit test for the Aladin adapter.
*
*/
public class TreeClientTest
extends TestCase
{
/**
* A test string.
* "A short test string ...."
*
*/
public static final String TEST_STRING = "A short test string ...." ;
/**
* A test byte array.
* "A short byte array ...."
*
*/
public static final byte[] TEST_BYTES = {
0x41,
0x20,
0x73,
0x68,
0x6f,
0x72,
0x74,
0x20,
0x62,
0x79,
0x74,
0x65,
0x20,
0x61,
0x72,
0x72,
0x61,
0x79,
0x20,
0x2e,
0x2e,
0x2e,
0x2e
} ;
/**
* Our target adapter.
*
*/
protected TreeClient adapter ;
/**
* Setup our test adapter.
*
*/
protected void setTestAdapter(TreeClient adapter)
{
this.adapter = adapter ;
}
/**
* Our test account.
*
*/
protected Ivorn account ;
/**
* Setup our test account.
*
*/
public void setTestAccount(Ivorn ivorn)
{
this.account = ivorn ;
}
/**
* Our test password.
*
*/
protected String password ;
/**
* Setup our test password.
*
*/
public void setTestPassword(String pass)
{
this.password = pass ;
}
/**
* Our target container name.
*
*/
protected String container ;
/**
* Setup our container name.
*
*/
public void setContainerName(String name)
{
this.container = name ;
}
/**
* Get our container name.
*
*/
public String getContainerName()
{
return this.container ;
}
/**
* Create our container name.
* This uses the current timestamp to create a unique container name for each test.
*
*/
public void initContainerName()
{
this.setContainerName(
"aladin-" +
String.valueOf(
System.currentTimeMillis()
)
) ;
}
/**
* Check we have an adapter.
*
*/
public void testAdapterNotNull()
throws Exception
{
assertNotNull(
adapter
) ;
}
/**
* Check we get the right Exception for a null account.
*
*/
public void testLoginNullAccount()
throws Exception
{
try {
adapter.login(
null,
password
) ;
}
catch (IllegalArgumentException ouch)
{
return ;
}
fail("Expected IllegalArgumentException") ;
}
/**
* Check we get the right Exception for a null password.
*
*/
public void testLoginNullPassword()
throws Exception
{
try {
adapter.login(
account,
null
) ;
}
catch (IllegalArgumentException ouch)
{
return ;
}
fail("Expected IllegalArgumentException") ;
}
/**
* Check we get the right Exception for the wrong password
*
*/
public void testLoginWrongPassword()
throws Exception
{
try {
adapter.login(
account,
(password + "WRONG")
) ;
}
catch (TreeClientLoginException ouch)
{
return ;
}
fail("Expected AladinAdapterLoginException") ;
}
/**
* Check we can login with the right password.
*
*/
public void testLoginValidPassword()
throws Exception
{
//
// Check we are not logged in.
assertNull(
adapter.getToken()
) ;
//
// Login using our account and password.
adapter.login(
account,
password
) ;
//
// Check we are logged in.
assertNotNull(
adapter.getToken()
) ;
}
/**
* Check we get the right exception if we are not logged in.
*
*/
public void testGetRootFails()
throws Exception
{
try {
adapter.getRoot() ;
}
catch (TreeClientSecurityException ouch)
{
return ;
}
fail("Expected AladinAdapterSecurityException") ;
}
/**
* Check we get the a root node if we are logged in.
*
*/
public void testGetRoot()
throws Exception
{
//
// Login using our account and password.
adapter.login(
account,
password
) ;
//
// Check we have a root node.
Container root = adapter.getRoot();
assertNotNull(
root
) ;
assertTrue(root.isContainer());
}
/**
* Check the root node has the default 'workflow' node.
*
*/
public void testWorkflowNode()
throws Exception
{
//
// Login.
adapter.login(
account,
password
) ;
//
// Get the root container.
Container root = adapter.getRoot() ;
//
// Check the child nodes for the expected defaults.
Iterator iter = root.getChildNodes().iterator() ;
while (iter.hasNext())
{
Node next = (Node) iter.next() ;
//
// Check for a 'workflow' node.
if ("workflow".equals(next.getName()))
{
return ;
}
}
fail("Expected to find workflow container") ;
}
/**
* Check we can add a container.
*
*/
public void testAddContainer()
throws Exception
{
//
// Login.
adapter.login(
account,
password
) ;
//
// Get the root node.
Container root = adapter.getRoot() ;
//
// Create our new container.
assertNotNull(
root.addContainer(
this.getContainerName()
)
) ;
}
/**
* Check we can find our a container.
*
*/
public void testFindContainer()
throws Exception
{
//
// Login.
adapter.login(
account,
password
) ;
//
// Get the root node.
Container root = adapter.getRoot() ;
//
// Create our new container.
root.addContainer(
this.getContainerName()
) ;
//
// Get an iterator for the child nodes.
Node found = null ;
Iterator iter = root.getChildNodes().iterator() ;
while (iter.hasNext())
{
Node next = (Node) iter.next() ;
//
// Check for a matching node.
if (this.getContainerName().equals(next.getName()))
{
return ;
}
}
fail("Expected to find aladin container") ;
}
/*
* Check we get the right exception for a duplicate container.
*
*/
public void testDuplicateContainer()
throws Exception
{
//
// Login.
adapter.login(
account,
password
) ;
//
// Get the root node.
Container root = adapter.getRoot() ;
//
// Create our new container.
root.addContainer(
this.getContainerName()
) ;
//
// Try creating the same container again.
try {
root.addContainer(
this.getContainerName()
) ;
}
catch (TreeClientDuplicateException ouch)
{
return ;
}
fail("Expected AladinAdapterDuplicateException") ;
}
/**
* Check we can add a file.
*
*/
public void testAddFile()
throws Exception
{
//
// Login.
adapter.login(
account,
password
) ;
//
// Get the root node.
Container root = adapter.getRoot() ;
//
// Create our new container.
Container node = root.addContainer(
this.getContainerName()
) ;
//
// Create a new (empty) file.
assertNotNull(
node.addFile(
"data.txt"
)
) ;
}
/*
* Check we get the right exception for a duplicate file.
*
*/
public void testDuplicateFile()
throws Exception
{
//
// Login.
adapter.login(
account,
password
) ;
//
// Get the root node.
Container root = adapter.getRoot() ;
//
// Create our new container.
Container node = root.addContainer(
this.getContainerName()
) ;
//
// Create our new file.
node.addFile(
"results.txt"
) ;
//
// Try creating the same file again.
try {
node.addFile(
"results.txt"
) ;
}
catch (TreeClientDuplicateException ouch)
{
return ;
}
fail("Expected AladinAdapterDuplicateException") ;
}
/**
* Check a new file appears in the list of child nodes.
*
*/
public void testFindFile()
throws Exception
{
//
// Login.
adapter.login(
account,
password
) ;
//
// Get the root node.
Container root = adapter.getRoot() ;
//
// Create our new container.
Container node = root.addContainer(
this.getContainerName()
) ;
//
// Create our new file.
node.addFile(
"results.txt"
) ;
//
// Get an iterator for the child nodes.
Node found = null ;
Iterator iter = node.getChildNodes().iterator() ;
while (iter.hasNext())
{
Node next = (Node) iter.next() ;
//
// Check for a matching node.
if ("results.txt".equals(next.getName()))
{
return ;
}
}
fail("Expected to find results.txt") ;
}
/**
* Check we can get an OutputStream for a file.
*
*/
public void testGetOutputStream()
throws Exception
{
//
// Login.
adapter.login(
account,
password
) ;
//
// Get the root node.
Container root = adapter.getRoot() ;
//
// Create our new container.
Container node = root.addContainer(
this.getContainerName()
) ;
//
// Create our new file.
File file = node.addFile(
"results.txt"
) ;
//
// Get an OutputStream for the file.
assertNotNull(
file.getOutputStream()
) ;
}
/**
* Check we can transfer some data to the stream.
*
*/
public void testImportData()
throws Exception
{
//
// Login.
adapter.login(
account,
password
) ;
//
// Get the root node.
Container root = adapter.getRoot() ;
//
// Create our new container.
Container node = root.addContainer(
this.getContainerName()
) ;
//
// Create our new file.
File file = node.addFile(
"results.txt"
) ;
//
// Get an OutputStream for the file.
OutputStream stream = file.getOutputStream() ;
//
// Transfer some data to the stream.
stream.write(
TEST_BYTES
) ;
//
// Close the stream.
stream.close() ;
}
/**
* Check we can get an InputStream for a file.
*
*/
public void testGetInputStream()
throws Exception
{
//
// Login.
adapter.login(
account,
password
) ;
//
// Get the root node.
Container root = adapter.getRoot() ;
//
// Create our new container.
Container node = root.addContainer(
this.getContainerName()
) ;
//
// Create our new file.
File file = node.addFile(
"results.txt"
) ;
//
// Get an InputStream for the file.
assertNotNull(
file.getInputStream()
) ;
}
/**
* Check we can transfer some data from the stream.
*
*/
public void testImportExportData()
throws Exception
{
//
// Login.
adapter.login(
account,
password
) ;
//
// Get the root node.
Container root = adapter.getRoot() ;
//
// Create our new container.
Container node = root.addContainer(
this.getContainerName()
) ;
//
// Create our new file.
File file = node.addFile(
"results.txt"
) ;
//
// Get an OutputStream for the file.
OutputStream output = file.getOutputStream() ;
//
// Transfer some data to the stream.
output.write(
TEST_BYTES
) ;
//
// Close the stream.
output.close() ;
//
// Get an InputStream for the file.
InputStream input = file.getInputStream() ;
//
// Read some data from the stream.
byte[] data = new byte[TEST_BYTES.length] ;
input.read(data) ;
//
// Check we get the same data back ...
for (int i = 0 ; i < TEST_BYTES.length ; i++)
{
assertEquals(
TEST_BYTES[i],
data[i]
) ;
}
}
/**
* Check we get the right mime type for an unknown type.
*
*/
public void testGetMimeUnknown()
throws Exception
{
//
// Login.
adapter.login(
account,
password
) ;
//
// Get the root node.
Container root = adapter.getRoot() ;
//
// Create our new container.
Container node = root.addContainer(
this.getContainerName()
) ;
//
// Create our new file.
File file = node.addFile(
"results.unknown"
) ;
//
// Check the mime type.
assertNull(
file.getMimeType()
) ;
}
/**
* Check we get the right mime type for an xml file.
*
*/
public void testGetMimeXml()
throws Exception
{
//
// Login.
adapter.login(
account,
password
) ;
//
// Get the root node.
Container root = adapter.getRoot() ;
//
// Create our new container.
Container node = root.addContainer(
this.getContainerName()
) ;
//
// Create our new file.
File file = node.addFile(
"results.xml"
) ;
//
// Check the mime type.
assertEquals(
MimeTypeUtil.MIME_TYPE_XML,
file.getMimeType()
) ;
}
/**
* Check we get the right mime type for an votable file.
*
*/
public void testGetMimeVot()
throws Exception
{
//
// Login.
adapter.login(
account,
password
) ;
//
// Get the root node.
Container root = adapter.getRoot() ;
//
// Create our new container.
Container node = root.addContainer(
this.getContainerName()
) ;
//
// Create our new file.
File file = node.addFile(
"results.vot"
) ;
//
// Check the mime type.
assertEquals(
MimeTypeUtil.MIME_TYPE_VOTABLE,
file.getMimeType()
) ;
}
/**
* Check we get the right mime type for an votable file.
*
*/
public void testGetMimeVotable()
throws Exception
{
//
// Login.
adapter.login(
account,
password
) ;
//
// Get the root node.
Container root = adapter.getRoot() ;
//
// Create our new container.
Container node = root.addContainer(
this.getContainerName()
) ;
//
// Create our new file.
File file = node.addFile(
"results.votable"
) ;
//
// Check the mime type.
assertEquals(
MimeTypeUtil.MIME_TYPE_VOTABLE,
file.getMimeType()
) ;
}
/**
* Check we get the right exception if we logout.
*
*/
public void testLogout()
throws Exception
{
//
// Check we get an exception if we are not logged in.
try {
adapter.getRoot() ;
}
catch (TreeClientSecurityException ouch)
{
return ;
}
fail("Expected AladinAdapterSecurityException") ;
//
// Login.
adapter.login(
account,
password
) ;
//
// Check we can get the root node.
assertNotNull(
adapter.getRoot()
) ;
//
// Logout.
adapter.logout() ;
//
// Check we get an exception having logged out.
try {
adapter.getRoot() ;
}
catch (TreeClientSecurityException ouch)
{
return ;
}
fail("Expected AladinAdapterSecurityException") ;
}
}
| [
"Catherine.Qin@astrogrid.org"
] | Catherine.Qin@astrogrid.org |
f456b583871589cc79590dfd826ae5a37ccc920d | ab21bbc03abcade93ca43c54598bc4ef0c2c8849 | /src/test/java/katas/multicurrency/DollarTest.java | aa5ec1c67b5ef2d0f50d7a3f74319ff691598bcf | [] | no_license | bushi-go/katas-tdd | c5f09f4d05d4de97a0661d8564e61b63456e65e0 | 9f58a9909089f799ecafb59a4971055086e9d786 | refs/heads/master | 2020-04-17T19:26:17.401834 | 2019-01-21T19:05:10 | 2019-01-21T19:05:10 | 166,865,580 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,027 | java | package katas.multicurrency;
import org.junit.Test;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
public class DollarTest
{
@Test
public void testMultiplication(){
Money five = Money.dollar(5);
assertEquals( Money.dollar(10), five.times(2));
assertEquals( Money.dollar(15), five.times(3));
}
@Test
public void testEquality(){
assertTrue( Money.dollar(5).equals( Money.dollar(5)));
assertFalse( Money.dollar(5).equals( Money.dollar(6)));
assertFalse( Money.franc(5).equals( Money.dollar(5)));
}
@Test
public void testCurrencies(){
assertEquals("USD", Money.dollar(1).currency());
assertEquals("CHF", Money.franc(1).currency());
}
@Test
public void testAddition(){
Money five = Money.dollar(5);
Expression expr = five.plus(Money.dollar(5));
Bank bank = new Bank();
Money ten = bank.reduce(expr, "USD");
assertTrue(Money.dollar(10).equals(ten));
}
@Test
public void testPlusReturnSum(){
Money five = Money.dollar(5);
Expression expr = five.plus(Money.dollar(5));
Sum sum =(Sum) expr;
assertEquals(five, sum.augend);
assertEquals(five, sum.addend);
}
@Test
public void testReduceSum(){
Expression sum = new Sum(Money.dollar(4), Money.dollar(3));
Bank bank = new Bank();
Money result = bank.reduce(sum, "USD");
assertEquals(Money.dollar(7), result);
}
@Test
public void testReduceMoney(){
Bank bank = new Bank();
Money result = bank.reduce(Money.dollar(1), "USD");
assertEquals(Money.dollar(1), result);
}
@Test
public void testReduceMoneyDifferentCurrency(){
Bank bank = new Bank();
bank.addRate("CHF", "USD", 2);
Money result = bank.reduce(Money.franc(2), "CHF");
assertEquals(Money.dollar(1),result);
}
} | [
"rgoussu.develop@gmail.com"
] | rgoussu.develop@gmail.com |
b2cabb24b466cfb7ef74d1e7630b3fb370bd04b6 | 7e7af445b226ef0bdc51e1b2d9acaa62143444f2 | /multithreading/src/chapter02/section_2_1/section_2_1_3/Run.java | 4ab8fd24f4e7a0699742daca042ac8a6712a8c1a | [] | no_license | coldcicada/thread | e630bdd664eaee1257ce9d8b77cc616e47bd632d | 12e2b507072bfd29bdb7341011be6cd9d7f20118 | refs/heads/master | 2021-04-17T01:45:53.706142 | 2020-04-04T13:22:58 | 2020-04-04T13:22:58 | 249,401,213 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 386 | java | package chapter02.section_2_1.section_2_1_3;
public class Run {
public static void main(String[] args) {
HasSelfPrivateNum numRef1 = new HasSelfPrivateNum();
HasSelfPrivateNum numRef2 = new HasSelfPrivateNum();
ThreadA threadA = new ThreadA(numRef1);
threadA.start();
ThreadB threadB = new ThreadB(numRef2);
threadB.start();
}
}
| [
"827052896@qq.com"
] | 827052896@qq.com |
95ff44278375fb08fdabd13800fe99d05d76d0ec | 9289413d3f638ebaf95ddc40540ef8d725f2b9b9 | /java/sakila-business-webapi/src/main/java/isep/web/sakila/webapi/controller/FilmRestController.java | 7e8ee4147930a3cd1647b59404ff855facfc0d89 | [] | no_license | snehnain/WebLAB04 | 3d35c6c1a8005e10239ef777f98cd489ba6b2298 | a0d182fe7eec7f1a04bdae879013ca0889ebc6e9 | refs/heads/master | 2021-04-25T03:31:38.240499 | 2017-12-28T09:32:39 | 2017-12-28T09:32:39 | 115,607,490 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,615 | java | package isep.web.sakila.webapi.controller;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.util.UriComponentsBuilder;
import isep.web.sakila.webapi.model.FilmWO;
import isep.web.sakila.webapi.service.FilmService;
@RestController
public class FilmRestController
{
@Autowired
FilmService filmService;
private static final Log log = LogFactory.getLog(FilmRestController.class);
@RequestMapping(value = "/film/", method = RequestMethod.GET)
public ResponseEntity<List<FilmWO>> listAllFilms()
{
List<FilmWO> films = filmService.findAllFilms();
if (films.isEmpty())
{
return new ResponseEntity<List<FilmWO>>(HttpStatus.NO_CONTENT);
}
return new ResponseEntity<List<FilmWO>>(films, HttpStatus.OK);
}
@RequestMapping(value = "/film/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<FilmWO> getFilm(@PathVariable("id") int id)
{
System.out.println("Fetching Film with id " + id);
FilmWO staffWO = filmService.findById(id);
if (staffWO == null)
{
System.out.println("Film with id " + id + " not found");
return new ResponseEntity<FilmWO>(HttpStatus.NOT_FOUND);
}
return new ResponseEntity<FilmWO>(staffWO, HttpStatus.OK);
}
// -------------------Create a Film----------------------------------
@RequestMapping(value = "/film/", method = RequestMethod.POST)
public ResponseEntity<Void> createFilm(@RequestBody FilmWO filmWO, UriComponentsBuilder ucBuilder)
{
System.out.println("Creating Film " + filmWO.getTitle());
filmService.saveFilm(filmWO);
HttpHeaders headers = new HttpHeaders();
headers.setLocation(ucBuilder.path("/film/{id}").buildAndExpand(filmWO.getFilmId()).toUri());
return new ResponseEntity<Void>(headers, HttpStatus.CREATED);
}
@RequestMapping(value = "/filmUpdate/", method = RequestMethod.POST)
public ResponseEntity<FilmWO> updateFilm(@RequestBody FilmWO filmWO, UriComponentsBuilder ucBuilder)
{
log.error(String.format("Updating Film %s ", filmWO.getFilmId()));
FilmWO currentFilm = filmService.findById(filmWO.getFilmId());
if (currentFilm == null)
{
System.out.println("Film with id " + filmWO.getFilmId() + " not found");
return new ResponseEntity<FilmWO>(HttpStatus.NOT_FOUND);
}
currentFilm.setTitle(filmWO.getTitle());
currentFilm.setDuration(filmWO.getDuration());
filmService.updateFilm(currentFilm);
return new ResponseEntity<FilmWO>(currentFilm, HttpStatus.OK);
}
@RequestMapping(value = "/filmDelete/{id}", method = RequestMethod.GET)
public ResponseEntity<FilmWO> deleteFilm(@PathVariable("id") int id)
{
System.out.println("Fetching & Deleting Film with id " + id);
FilmWO staffWO = filmService.findById(id);
if (staffWO == null)
{
System.out.println("Unable to delete. Film with id " + id + " not found");
return new ResponseEntity<FilmWO>(HttpStatus.NOT_FOUND);
}
filmService.deleteFilmById(id);
return new ResponseEntity<FilmWO>(HttpStatus.NO_CONTENT);
}
}
| [
"snehnain1990@gmail.com"
] | snehnain1990@gmail.com |
90f34b302e7ab08609f85acc05fb39771b6eb655 | b1178991eb84069f2a652bb7cb2f5957c39a9778 | /build/app/generated/not_namespaced_r_class_sources/release/r/com/nik/performance/film_app_getx/R.java | 12152794398d22dc1d1630f7f21a6fcde15eaba1 | [] | no_license | klnfreedom/popular_films_getx | 9b0344378994a7728c4a995cb202bfd7e6236b3b | a6b218d7e70f863873cfb9540858a7eaf7441a26 | refs/heads/main | 2023-01-31T21:49:52.043330 | 2020-12-15T15:59:59 | 2020-12-15T15:59:59 | 321,406,958 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 41,436 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.nik.performance.film_app_getx;
public final class R {
public static final class attr {
/**
* Alpha multiplier applied to the base color.
* <p>May be a floating point value, such as "<code>1.2</code>".
*/
public static final int alpha=0x7f010000;
/**
* The reference to the font file to be used. This should be a file in the res/font folder
* and should therefore have an R reference value. E.g. @font/myfont
* <p>May be a reference to another resource, in the form
* "<code>@[+][<i>package</i>:]<i>type</i>/<i>name</i></code>" or a theme
* attribute in the form
* "<code>?[<i>package</i>:]<i>type</i>/<i>name</i></code>".
*/
public static final int font=0x7f010001;
/**
* The authority of the Font Provider to be used for the request.
* <p>May be a string value, using '\\;' to escape characters such as
* '\\n' or '\\uxxxx' for a unicode character;
*/
public static final int fontProviderAuthority=0x7f010002;
/**
* The sets of hashes for the certificates the provider should be signed with. This is
* used to verify the identity of the provider, and is only required if the provider is not
* part of the system image. This value may point to one list or a list of lists, where each
* individual list represents one collection of signature hashes. Refer to your font provider's
* documentation for these values.
* <p>May be a reference to another resource, in the form
* "<code>@[+][<i>package</i>:]<i>type</i>/<i>name</i></code>" or a theme
* attribute in the form
* "<code>?[<i>package</i>:]<i>type</i>/<i>name</i></code>".
*/
public static final int fontProviderCerts=0x7f010003;
/**
* The strategy to be used when fetching font data from a font provider in XML layouts.
* This attribute is ignored when the resource is loaded from code, as it is equivalent to the
* choice of API between {@link
* androidx.core.content.res.ResourcesCompat#getFont(Context, int)} (blocking) and
* {@link
* androidx.core.content.res.ResourcesCompat#getFont(Context, int, FontCallback, Handler)}
* (async).
* <p>Must be one of the following constant values.</p>
* <table>
* <colgroup align="left" />
* <colgroup align="left" />
* <colgroup align="left" />
* <tr><th>Constant</th><th>Value</th><th>Description</th></tr>
* <tr><td>async</td><td>1</td><td>The async font fetch works as follows.
* First, check the local cache, then if the requeted font is not cached, trigger a
* request the font and continue with layout inflation. Once the font fetch succeeds, the
* target text view will be refreshed with the downloaded font data. The
* fontProviderFetchTimeout will be ignored if async loading is specified.</td></tr>
* <tr><td>blocking</td><td>0</td><td>The blocking font fetch works as follows.
* First, check the local cache, then if the requested font is not cached, request the
* font from the provider and wait until it is finished. You can change the length of
* the timeout by modifying fontProviderFetchTimeout. If the timeout happens, the
* default typeface will be used instead.</td></tr>
* </table>
*/
public static final int fontProviderFetchStrategy=0x7f010004;
/**
* The length of the timeout during fetching.
* <p>May be an integer value, such as "<code>100</code>".
* <p>Must be one of the following constant values.</p>
* <table>
* <colgroup align="left" />
* <colgroup align="left" />
* <colgroup align="left" />
* <tr><th>Constant</th><th>Value</th><th>Description</th></tr>
* <tr><td>forever</td><td>ffffffff</td><td>A special value for the timeout. In this case, the blocking font fetching will not
* timeout and wait until a reply is received from the font provider.</td></tr>
* </table>
*/
public static final int fontProviderFetchTimeout=0x7f010005;
/**
* The package for the Font Provider to be used for the request. This is used to verify
* the identity of the provider.
* <p>May be a string value, using '\\;' to escape characters such as
* '\\n' or '\\uxxxx' for a unicode character;
*/
public static final int fontProviderPackage=0x7f010006;
/**
* The query to be sent over to the provider. Refer to your font provider's documentation
* on the format of this string.
* <p>May be a string value, using '\\;' to escape characters such as
* '\\n' or '\\uxxxx' for a unicode character;
*/
public static final int fontProviderQuery=0x7f010007;
/**
* The style of the given font file. This will be used when the font is being loaded into
* the font stack and will override any style information in the font's header tables. If
* unspecified, the value in the font's header tables will be used.
* <p>Must be one of the following constant values.</p>
* <table>
* <colgroup align="left" />
* <colgroup align="left" />
* <colgroup align="left" />
* <tr><th>Constant</th><th>Value</th><th>Description</th></tr>
* <tr><td>italic</td><td>1</td><td></td></tr>
* <tr><td>normal</td><td>0</td><td></td></tr>
* </table>
*/
public static final int fontStyle=0x7f010008;
/**
* The variation settings to be applied to the font. The string should be in the following
* format: "'tag1' value1, 'tag2' value2, ...". If the default variation settings should be
* used, or the font used does not support variation settings, this attribute needs not be
* specified.
* <p>May be a string value, using '\\;' to escape characters such as
* '\\n' or '\\uxxxx' for a unicode character;
*/
public static final int fontVariationSettings=0x7f010009;
/**
* The weight of the given font file. This will be used when the font is being loaded into
* the font stack and will override any weight information in the font's header tables. Must
* be a positive number, a multiple of 100, and between 100 and 900, inclusive. The most
* common values are 400 for regular weight and 700 for bold weight. If unspecified, the value
* in the font's header tables will be used.
* <p>May be an integer value, such as "<code>100</code>".
*/
public static final int fontWeight=0x7f01000a;
/**
* The index of the font in the tcc font file. If the font file referenced is not in the
* tcc format, this attribute needs not be specified.
* <p>May be an integer value, such as "<code>100</code>".
*/
public static final int ttcIndex=0x7f01000b;
}
public static final class color {
public static final int notification_action_color_filter=0x7f020000;
public static final int notification_icon_bg_color=0x7f020001;
public static final int ripple_material_light=0x7f020002;
public static final int secondary_text_default_material_light=0x7f020003;
}
public static final class dimen {
public static final int compat_button_inset_horizontal_material=0x7f030000;
public static final int compat_button_inset_vertical_material=0x7f030001;
public static final int compat_button_padding_horizontal_material=0x7f030002;
public static final int compat_button_padding_vertical_material=0x7f030003;
public static final int compat_control_corner_material=0x7f030004;
public static final int compat_notification_large_icon_max_height=0x7f030005;
public static final int compat_notification_large_icon_max_width=0x7f030006;
public static final int notification_action_icon_size=0x7f030007;
public static final int notification_action_text_size=0x7f030008;
public static final int notification_big_circle_margin=0x7f030009;
public static final int notification_content_margin_start=0x7f03000a;
public static final int notification_large_icon_height=0x7f03000b;
public static final int notification_large_icon_width=0x7f03000c;
public static final int notification_main_column_padding_top=0x7f03000d;
public static final int notification_media_narrow_margin=0x7f03000e;
public static final int notification_right_icon_size=0x7f03000f;
public static final int notification_right_side_padding_top=0x7f030010;
public static final int notification_small_icon_background_padding=0x7f030011;
public static final int notification_small_icon_size_as_large=0x7f030012;
public static final int notification_subtext_size=0x7f030013;
public static final int notification_top_pad=0x7f030014;
public static final int notification_top_pad_large_text=0x7f030015;
}
public static final class drawable {
public static final int launch_background=0x7f040000;
public static final int notification_action_background=0x7f040001;
public static final int notification_bg=0x7f040002;
public static final int notification_bg_low=0x7f040003;
public static final int notification_bg_low_normal=0x7f040004;
public static final int notification_bg_low_pressed=0x7f040005;
public static final int notification_bg_normal=0x7f040006;
public static final int notification_bg_normal_pressed=0x7f040007;
public static final int notification_icon_background=0x7f040008;
public static final int notification_template_icon_bg=0x7f040009;
public static final int notification_template_icon_low_bg=0x7f04000a;
public static final int notification_tile_bg=0x7f04000b;
public static final int notify_panel_notification_icon_bg=0x7f04000c;
}
public static final class id {
public static final int accessibility_action_clickable_span=0x7f050000;
public static final int accessibility_custom_action_0=0x7f050001;
public static final int accessibility_custom_action_1=0x7f050002;
public static final int accessibility_custom_action_10=0x7f050003;
public static final int accessibility_custom_action_11=0x7f050004;
public static final int accessibility_custom_action_12=0x7f050005;
public static final int accessibility_custom_action_13=0x7f050006;
public static final int accessibility_custom_action_14=0x7f050007;
public static final int accessibility_custom_action_15=0x7f050008;
public static final int accessibility_custom_action_16=0x7f050009;
public static final int accessibility_custom_action_17=0x7f05000a;
public static final int accessibility_custom_action_18=0x7f05000b;
public static final int accessibility_custom_action_19=0x7f05000c;
public static final int accessibility_custom_action_2=0x7f05000d;
public static final int accessibility_custom_action_20=0x7f05000e;
public static final int accessibility_custom_action_21=0x7f05000f;
public static final int accessibility_custom_action_22=0x7f050010;
public static final int accessibility_custom_action_23=0x7f050011;
public static final int accessibility_custom_action_24=0x7f050012;
public static final int accessibility_custom_action_25=0x7f050013;
public static final int accessibility_custom_action_26=0x7f050014;
public static final int accessibility_custom_action_27=0x7f050015;
public static final int accessibility_custom_action_28=0x7f050016;
public static final int accessibility_custom_action_29=0x7f050017;
public static final int accessibility_custom_action_3=0x7f050018;
public static final int accessibility_custom_action_30=0x7f050019;
public static final int accessibility_custom_action_31=0x7f05001a;
public static final int accessibility_custom_action_4=0x7f05001b;
public static final int accessibility_custom_action_5=0x7f05001c;
public static final int accessibility_custom_action_6=0x7f05001d;
public static final int accessibility_custom_action_7=0x7f05001e;
public static final int accessibility_custom_action_8=0x7f05001f;
public static final int accessibility_custom_action_9=0x7f050020;
public static final int action_container=0x7f050021;
public static final int action_divider=0x7f050022;
public static final int action_image=0x7f050023;
public static final int action_text=0x7f050024;
public static final int actions=0x7f050025;
public static final int async=0x7f050026;
public static final int blocking=0x7f050027;
public static final int chronometer=0x7f050028;
public static final int dialog_button=0x7f050029;
public static final int forever=0x7f05002a;
public static final int icon=0x7f05002b;
public static final int icon_group=0x7f05002c;
public static final int info=0x7f05002d;
public static final int italic=0x7f05002e;
public static final int line1=0x7f05002f;
public static final int line3=0x7f050030;
public static final int normal=0x7f050031;
public static final int notification_background=0x7f050032;
public static final int notification_main_column=0x7f050033;
public static final int notification_main_column_container=0x7f050034;
public static final int right_icon=0x7f050035;
public static final int right_side=0x7f050036;
public static final int tag_accessibility_actions=0x7f050037;
public static final int tag_accessibility_clickable_spans=0x7f050038;
public static final int tag_accessibility_heading=0x7f050039;
public static final int tag_accessibility_pane_title=0x7f05003a;
public static final int tag_screen_reader_focusable=0x7f05003b;
public static final int tag_transition_group=0x7f05003c;
public static final int tag_unhandled_key_event_manager=0x7f05003d;
public static final int tag_unhandled_key_listeners=0x7f05003e;
public static final int text=0x7f05003f;
public static final int text2=0x7f050040;
public static final int time=0x7f050041;
public static final int title=0x7f050042;
}
public static final class integer {
public static final int status_bar_notification_info_maxnum=0x7f060000;
}
public static final class layout {
public static final int custom_dialog=0x7f070000;
public static final int notification_action=0x7f070001;
public static final int notification_action_tombstone=0x7f070002;
public static final int notification_template_custom_big=0x7f070003;
public static final int notification_template_icon_group=0x7f070004;
public static final int notification_template_part_chronometer=0x7f070005;
public static final int notification_template_part_time=0x7f070006;
}
public static final class mipmap {
public static final int ic_launcher=0x7f080000;
public static final int launcher_icon=0x7f080001;
}
public static final class string {
public static final int status_bar_notification_info_overflow=0x7f090000;
}
public static final class style {
public static final int LaunchTheme=0x7f0a0000;
public static final int NormalTheme=0x7f0a0001;
public static final int TextAppearance_Compat_Notification=0x7f0a0002;
public static final int TextAppearance_Compat_Notification_Info=0x7f0a0003;
public static final int TextAppearance_Compat_Notification_Line2=0x7f0a0004;
public static final int TextAppearance_Compat_Notification_Time=0x7f0a0005;
public static final int TextAppearance_Compat_Notification_Title=0x7f0a0006;
public static final int Widget_Compat_NotificationActionContainer=0x7f0a0007;
public static final int Widget_Compat_NotificationActionText=0x7f0a0008;
}
public static final class styleable {
/**
* Attributes that can be used with a ColorStateListItem.
* <p>Includes the following attributes:</p>
* <table>
* <colgroup align="left" />
* <colgroup align="left" />
* <tr><th>Attribute</th><th>Description</th></tr>
* <tr><td><code>{@link #ColorStateListItem_android_color android:color}</code></td><td></td></tr>
* <tr><td><code>{@link #ColorStateListItem_android_alpha android:alpha}</code></td><td></td></tr>
* <tr><td><code>{@link #ColorStateListItem_alpha com.nik.performance.film_app_getx:alpha}</code></td><td>Alpha multiplier applied to the base color.</td></tr>
* </table>
* @see #ColorStateListItem_android_color
* @see #ColorStateListItem_android_alpha
* @see #ColorStateListItem_alpha
*/
public static final int[] ColorStateListItem={
0x010101a5, 0x0101031f, 0x7f010000
};
/**
* <p>
* @attr description
* Base color for this state.
*
* <p>May be a color value, in the form of "<code>#<i>rgb</i></code>",
* "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or
* "<code>#<i>aarrggbb</i></code>".
*
* @attr name android:color
*/
public static final int ColorStateListItem_android_color=0;
/**
* <p>This symbol is the offset where the {@link android.R.attr#alpha}
* attribute's value can be found in the {@link #ColorStateListItem} array.
*
* <p>May be a floating point value, such as "<code>1.2</code>".
*
* @attr name android:alpha
*/
public static final int ColorStateListItem_android_alpha=1;
/**
* <p>
* @attr description
* Alpha multiplier applied to the base color.
*
* <p>May be a floating point value, such as "<code>1.2</code>".
*
* @attr name com.nik.performance.film_app_getx:alpha
*/
public static final int ColorStateListItem_alpha=2;
/**
* Attributes that can be used with a FontFamily.
* <p>Includes the following attributes:</p>
* <table>
* <colgroup align="left" />
* <colgroup align="left" />
* <tr><th>Attribute</th><th>Description</th></tr>
* <tr><td><code>{@link #FontFamily_fontProviderAuthority com.nik.performance.film_app_getx:fontProviderAuthority}</code></td><td>The authority of the Font Provider to be used for the request.</td></tr>
* <tr><td><code>{@link #FontFamily_fontProviderCerts com.nik.performance.film_app_getx:fontProviderCerts}</code></td><td>The sets of hashes for the certificates the provider should be signed with.</td></tr>
* <tr><td><code>{@link #FontFamily_fontProviderFetchStrategy com.nik.performance.film_app_getx:fontProviderFetchStrategy}</code></td><td>The strategy to be used when fetching font data from a font provider in XML layouts.</td></tr>
* <tr><td><code>{@link #FontFamily_fontProviderFetchTimeout com.nik.performance.film_app_getx:fontProviderFetchTimeout}</code></td><td>The length of the timeout during fetching.</td></tr>
* <tr><td><code>{@link #FontFamily_fontProviderPackage com.nik.performance.film_app_getx:fontProviderPackage}</code></td><td>The package for the Font Provider to be used for the request.</td></tr>
* <tr><td><code>{@link #FontFamily_fontProviderQuery com.nik.performance.film_app_getx:fontProviderQuery}</code></td><td>The query to be sent over to the provider.</td></tr>
* </table>
* @see #FontFamily_fontProviderAuthority
* @see #FontFamily_fontProviderCerts
* @see #FontFamily_fontProviderFetchStrategy
* @see #FontFamily_fontProviderFetchTimeout
* @see #FontFamily_fontProviderPackage
* @see #FontFamily_fontProviderQuery
*/
public static final int[] FontFamily={
0x7f010002, 0x7f010003, 0x7f010004, 0x7f010005,
0x7f010006, 0x7f010007
};
/**
* <p>
* @attr description
* The authority of the Font Provider to be used for the request.
*
* <p>May be a string value, using '\\;' to escape characters such as
* '\\n' or '\\uxxxx' for a unicode character;
*
* @attr name com.nik.performance.film_app_getx:fontProviderAuthority
*/
public static final int FontFamily_fontProviderAuthority=0;
/**
* <p>
* @attr description
* The sets of hashes for the certificates the provider should be signed with. This is
* used to verify the identity of the provider, and is only required if the provider is not
* part of the system image. This value may point to one list or a list of lists, where each
* individual list represents one collection of signature hashes. Refer to your font provider's
* documentation for these values.
*
* <p>May be a reference to another resource, in the form
* "<code>@[+][<i>package</i>:]<i>type</i>/<i>name</i></code>" or a theme
* attribute in the form
* "<code>?[<i>package</i>:]<i>type</i>/<i>name</i></code>".
*
* @attr name com.nik.performance.film_app_getx:fontProviderCerts
*/
public static final int FontFamily_fontProviderCerts=1;
/**
* <p>
* @attr description
* The strategy to be used when fetching font data from a font provider in XML layouts.
* This attribute is ignored when the resource is loaded from code, as it is equivalent to the
* choice of API between {@link
* androidx.core.content.res.ResourcesCompat#getFont(Context, int)} (blocking) and
* {@link
* androidx.core.content.res.ResourcesCompat#getFont(Context, int, FontCallback, Handler)}
* (async).
*
* <p>Must be one of the following constant values.</p>
* <table>
* <colgroup align="left" />
* <colgroup align="left" />
* <colgroup align="left" />
* <tr><th>Constant</th><th>Value</th><th>Description</th></tr>
* <tr><td>async</td><td>1</td><td>The async font fetch works as follows.
* First, check the local cache, then if the requeted font is not cached, trigger a
* request the font and continue with layout inflation. Once the font fetch succeeds, the
* target text view will be refreshed with the downloaded font data. The
* fontProviderFetchTimeout will be ignored if async loading is specified.</td></tr>
* <tr><td>blocking</td><td>0</td><td>The blocking font fetch works as follows.
* First, check the local cache, then if the requested font is not cached, request the
* font from the provider and wait until it is finished. You can change the length of
* the timeout by modifying fontProviderFetchTimeout. If the timeout happens, the
* default typeface will be used instead.</td></tr>
* </table>
*
* @attr name com.nik.performance.film_app_getx:fontProviderFetchStrategy
*/
public static final int FontFamily_fontProviderFetchStrategy=2;
/**
* <p>
* @attr description
* The length of the timeout during fetching.
*
* <p>May be an integer value, such as "<code>100</code>".
* <p>Must be one of the following constant values.</p>
* <table>
* <colgroup align="left" />
* <colgroup align="left" />
* <colgroup align="left" />
* <tr><th>Constant</th><th>Value</th><th>Description</th></tr>
* <tr><td>forever</td><td>ffffffff</td><td>A special value for the timeout. In this case, the blocking font fetching will not
* timeout and wait until a reply is received from the font provider.</td></tr>
* </table>
*
* @attr name com.nik.performance.film_app_getx:fontProviderFetchTimeout
*/
public static final int FontFamily_fontProviderFetchTimeout=3;
/**
* <p>
* @attr description
* The package for the Font Provider to be used for the request. This is used to verify
* the identity of the provider.
*
* <p>May be a string value, using '\\;' to escape characters such as
* '\\n' or '\\uxxxx' for a unicode character;
*
* @attr name com.nik.performance.film_app_getx:fontProviderPackage
*/
public static final int FontFamily_fontProviderPackage=4;
/**
* <p>
* @attr description
* The query to be sent over to the provider. Refer to your font provider's documentation
* on the format of this string.
*
* <p>May be a string value, using '\\;' to escape characters such as
* '\\n' or '\\uxxxx' for a unicode character;
*
* @attr name com.nik.performance.film_app_getx:fontProviderQuery
*/
public static final int FontFamily_fontProviderQuery=5;
/**
* Attributes that can be used with a FontFamilyFont.
* <p>Includes the following attributes:</p>
* <table>
* <colgroup align="left" />
* <colgroup align="left" />
* <tr><th>Attribute</th><th>Description</th></tr>
* <tr><td><code>{@link #FontFamilyFont_android_font android:font}</code></td><td></td></tr>
* <tr><td><code>{@link #FontFamilyFont_android_fontWeight android:fontWeight}</code></td><td></td></tr>
* <tr><td><code>{@link #FontFamilyFont_android_fontStyle android:fontStyle}</code></td><td></td></tr>
* <tr><td><code>{@link #FontFamilyFont_android_ttcIndex android:ttcIndex}</code></td><td></td></tr>
* <tr><td><code>{@link #FontFamilyFont_android_fontVariationSettings android:fontVariationSettings}</code></td><td></td></tr>
* <tr><td><code>{@link #FontFamilyFont_font com.nik.performance.film_app_getx:font}</code></td><td>The reference to the font file to be used.</td></tr>
* <tr><td><code>{@link #FontFamilyFont_fontStyle com.nik.performance.film_app_getx:fontStyle}</code></td><td>The style of the given font file.</td></tr>
* <tr><td><code>{@link #FontFamilyFont_fontVariationSettings com.nik.performance.film_app_getx:fontVariationSettings}</code></td><td>The variation settings to be applied to the font.</td></tr>
* <tr><td><code>{@link #FontFamilyFont_fontWeight com.nik.performance.film_app_getx:fontWeight}</code></td><td>The weight of the given font file.</td></tr>
* <tr><td><code>{@link #FontFamilyFont_ttcIndex com.nik.performance.film_app_getx:ttcIndex}</code></td><td>The index of the font in the tcc font file.</td></tr>
* </table>
* @see #FontFamilyFont_android_font
* @see #FontFamilyFont_android_fontWeight
* @see #FontFamilyFont_android_fontStyle
* @see #FontFamilyFont_android_ttcIndex
* @see #FontFamilyFont_android_fontVariationSettings
* @see #FontFamilyFont_font
* @see #FontFamilyFont_fontStyle
* @see #FontFamilyFont_fontVariationSettings
* @see #FontFamilyFont_fontWeight
* @see #FontFamilyFont_ttcIndex
*/
public static final int[] FontFamilyFont={
0x01010532, 0x01010533, 0x0101053f, 0x0101056f,
0x01010570, 0x7f010001, 0x7f010008, 0x7f010009,
0x7f01000a, 0x7f01000b
};
/**
* <p>This symbol is the offset where the {@link android.R.attr#font}
* attribute's value can be found in the {@link #FontFamilyFont} array.
*
* <p>May be a reference to another resource, in the form
* "<code>@[+][<i>package</i>:]<i>type</i>/<i>name</i></code>" or a theme
* attribute in the form
* "<code>?[<i>package</i>:]<i>type</i>/<i>name</i></code>".
*
* @attr name android:font
*/
public static final int FontFamilyFont_android_font=0;
/**
* <p>This symbol is the offset where the {@link android.R.attr#fontWeight}
* attribute's value can be found in the {@link #FontFamilyFont} array.
*
* <p>May be an integer value, such as "<code>100</code>".
*
* @attr name android:fontWeight
*/
public static final int FontFamilyFont_android_fontWeight=1;
/**
* <p>
* @attr description
* References to the framework attrs
*
* <p>Must be one of the following constant values.</p>
* <table>
* <colgroup align="left" />
* <colgroup align="left" />
* <colgroup align="left" />
* <tr><th>Constant</th><th>Value</th><th>Description</th></tr>
* <tr><td>italic</td><td>1</td><td></td></tr>
* <tr><td>normal</td><td>0</td><td></td></tr>
* </table>
*
* @attr name android:fontStyle
*/
public static final int FontFamilyFont_android_fontStyle=2;
/**
* <p>This symbol is the offset where the {@link android.R.attr#ttcIndex}
* attribute's value can be found in the {@link #FontFamilyFont} array.
*
* <p>May be an integer value, such as "<code>100</code>".
*
* @attr name android:ttcIndex
*/
public static final int FontFamilyFont_android_ttcIndex=3;
/**
* <p>This symbol is the offset where the {@link android.R.attr#fontVariationSettings}
* attribute's value can be found in the {@link #FontFamilyFont} array.
*
* <p>May be a string value, using '\\;' to escape characters such as
* '\\n' or '\\uxxxx' for a unicode character;
*
* @attr name android:fontVariationSettings
*/
public static final int FontFamilyFont_android_fontVariationSettings=4;
/**
* <p>
* @attr description
* The reference to the font file to be used. This should be a file in the res/font folder
* and should therefore have an R reference value. E.g. @font/myfont
*
* <p>May be a reference to another resource, in the form
* "<code>@[+][<i>package</i>:]<i>type</i>/<i>name</i></code>" or a theme
* attribute in the form
* "<code>?[<i>package</i>:]<i>type</i>/<i>name</i></code>".
*
* @attr name com.nik.performance.film_app_getx:font
*/
public static final int FontFamilyFont_font=5;
/**
* <p>
* @attr description
* The style of the given font file. This will be used when the font is being loaded into
* the font stack and will override any style information in the font's header tables. If
* unspecified, the value in the font's header tables will be used.
*
* <p>Must be one of the following constant values.</p>
* <table>
* <colgroup align="left" />
* <colgroup align="left" />
* <colgroup align="left" />
* <tr><th>Constant</th><th>Value</th><th>Description</th></tr>
* <tr><td>italic</td><td>1</td><td></td></tr>
* <tr><td>normal</td><td>0</td><td></td></tr>
* </table>
*
* @attr name com.nik.performance.film_app_getx:fontStyle
*/
public static final int FontFamilyFont_fontStyle=6;
/**
* <p>
* @attr description
* The variation settings to be applied to the font. The string should be in the following
* format: "'tag1' value1, 'tag2' value2, ...". If the default variation settings should be
* used, or the font used does not support variation settings, this attribute needs not be
* specified.
*
* <p>May be a string value, using '\\;' to escape characters such as
* '\\n' or '\\uxxxx' for a unicode character;
*
* @attr name com.nik.performance.film_app_getx:fontVariationSettings
*/
public static final int FontFamilyFont_fontVariationSettings=7;
/**
* <p>
* @attr description
* The weight of the given font file. This will be used when the font is being loaded into
* the font stack and will override any weight information in the font's header tables. Must
* be a positive number, a multiple of 100, and between 100 and 900, inclusive. The most
* common values are 400 for regular weight and 700 for bold weight. If unspecified, the value
* in the font's header tables will be used.
*
* <p>May be an integer value, such as "<code>100</code>".
*
* @attr name com.nik.performance.film_app_getx:fontWeight
*/
public static final int FontFamilyFont_fontWeight=8;
/**
* <p>
* @attr description
* The index of the font in the tcc font file. If the font file referenced is not in the
* tcc format, this attribute needs not be specified.
*
* <p>May be an integer value, such as "<code>100</code>".
*
* @attr name com.nik.performance.film_app_getx:ttcIndex
*/
public static final int FontFamilyFont_ttcIndex=9;
/**
* Attributes that can be used with a GradientColor.
* <p>Includes the following attributes:</p>
* <table>
* <colgroup align="left" />
* <colgroup align="left" />
* <tr><th>Attribute</th><th>Description</th></tr>
* <tr><td><code>{@link #GradientColor_android_startColor android:startColor}</code></td><td></td></tr>
* <tr><td><code>{@link #GradientColor_android_endColor android:endColor}</code></td><td></td></tr>
* <tr><td><code>{@link #GradientColor_android_type android:type}</code></td><td></td></tr>
* <tr><td><code>{@link #GradientColor_android_centerX android:centerX}</code></td><td></td></tr>
* <tr><td><code>{@link #GradientColor_android_centerY android:centerY}</code></td><td></td></tr>
* <tr><td><code>{@link #GradientColor_android_gradientRadius android:gradientRadius}</code></td><td></td></tr>
* <tr><td><code>{@link #GradientColor_android_tileMode android:tileMode}</code></td><td></td></tr>
* <tr><td><code>{@link #GradientColor_android_centerColor android:centerColor}</code></td><td></td></tr>
* <tr><td><code>{@link #GradientColor_android_startX android:startX}</code></td><td></td></tr>
* <tr><td><code>{@link #GradientColor_android_startY android:startY}</code></td><td></td></tr>
* <tr><td><code>{@link #GradientColor_android_endX android:endX}</code></td><td></td></tr>
* <tr><td><code>{@link #GradientColor_android_endY android:endY}</code></td><td></td></tr>
* </table>
* @see #GradientColor_android_startColor
* @see #GradientColor_android_endColor
* @see #GradientColor_android_type
* @see #GradientColor_android_centerX
* @see #GradientColor_android_centerY
* @see #GradientColor_android_gradientRadius
* @see #GradientColor_android_tileMode
* @see #GradientColor_android_centerColor
* @see #GradientColor_android_startX
* @see #GradientColor_android_startY
* @see #GradientColor_android_endX
* @see #GradientColor_android_endY
*/
public static final int[] GradientColor={
0x0101019d, 0x0101019e, 0x010101a1, 0x010101a2,
0x010101a3, 0x010101a4, 0x01010201, 0x0101020b,
0x01010510, 0x01010511, 0x01010512, 0x01010513
};
/**
* <p>
* @attr description
* Start color of the gradient.
*
* <p>May be a color value, in the form of "<code>#<i>rgb</i></code>",
* "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or
* "<code>#<i>aarrggbb</i></code>".
*
* @attr name android:startColor
*/
public static final int GradientColor_android_startColor=0;
/**
* <p>
* @attr description
* End color of the gradient.
*
* <p>May be a color value, in the form of "<code>#<i>rgb</i></code>",
* "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or
* "<code>#<i>aarrggbb</i></code>".
*
* @attr name android:endColor
*/
public static final int GradientColor_android_endColor=1;
/**
* <p>
* @attr description
* Type of gradient. The default type is linear.
*
* <p>Must be one of the following constant values.</p>
* <table>
* <colgroup align="left" />
* <colgroup align="left" />
* <colgroup align="left" />
* <tr><th>Constant</th><th>Value</th><th>Description</th></tr>
* <tr><td>linear</td><td>0</td><td></td></tr>
* <tr><td>radial</td><td>1</td><td></td></tr>
* <tr><td>sweep</td><td>2</td><td></td></tr>
* </table>
*
* @attr name android:type
*/
public static final int GradientColor_android_type=2;
/**
* <p>
* @attr description
* X coordinate of the center of the gradient within the path.
*
* <p>May be a floating point value, such as "<code>1.2</code>".
* <p>May be a fractional value, which is a floating point number appended with
* either % or %p, such as "<code>14.5%</code>".
* The % suffix always means a percentage of the base size;
* the optional %p suffix provides a size relative to some parent container.
*
* @attr name android:centerX
*/
public static final int GradientColor_android_centerX=3;
/**
* <p>
* @attr description
* Y coordinate of the center of the gradient within the path.
*
* <p>May be a floating point value, such as "<code>1.2</code>".
* <p>May be a fractional value, which is a floating point number appended with
* either % or %p, such as "<code>14.5%</code>".
* The % suffix always means a percentage of the base size;
* the optional %p suffix provides a size relative to some parent container.
*
* @attr name android:centerY
*/
public static final int GradientColor_android_centerY=4;
/**
* <p>
* @attr description
* Radius of the gradient, used only with radial gradient.
*
* <p>May be a floating point value, such as "<code>1.2</code>".
* <p>May be a dimension value, which is a floating point number appended with a
* unit such as "<code>14.5sp</code>".
* Available units are: px (pixels), dp (density-independent pixels),
* sp (scaled pixels based on preferred font size), in (inches), and
* mm (millimeters).
* <p>May be a fractional value, which is a floating point number appended with
* either % or %p, such as "<code>14.5%</code>".
* The % suffix always means a percentage of the base size;
* the optional %p suffix provides a size relative to some parent container.
*
* @attr name android:gradientRadius
*/
public static final int GradientColor_android_gradientRadius=5;
/**
* <p>
* @attr description
* Defines the tile mode of the gradient. SweepGradient doesn't support tiling.
*
* <p>Must be one of the following constant values.</p>
* <table>
* <colgroup align="left" />
* <colgroup align="left" />
* <colgroup align="left" />
* <tr><th>Constant</th><th>Value</th><th>Description</th></tr>
* <tr><td>clamp</td><td>0</td><td></td></tr>
* <tr><td>disabled</td><td>ffffffff</td><td></td></tr>
* <tr><td>mirror</td><td>2</td><td></td></tr>
* <tr><td>repeat</td><td>1</td><td></td></tr>
* </table>
*
* @attr name android:tileMode
*/
public static final int GradientColor_android_tileMode=6;
/**
* <p>
* @attr description
* Optional center color.
*
* <p>May be a color value, in the form of "<code>#<i>rgb</i></code>",
* "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or
* "<code>#<i>aarrggbb</i></code>".
*
* @attr name android:centerColor
*/
public static final int GradientColor_android_centerColor=7;
/**
* <p>
* @attr description
* X coordinate of the start point origin of the gradient.
* Defined in same coordinates as the path itself
*
* <p>May be a floating point value, such as "<code>1.2</code>".
*
* @attr name android:startX
*/
public static final int GradientColor_android_startX=8;
/**
* <p>
* @attr description
* Y coordinate of the start point of the gradient within the shape.
* Defined in same coordinates as the path itself
*
* <p>May be a floating point value, such as "<code>1.2</code>".
*
* @attr name android:startY
*/
public static final int GradientColor_android_startY=9;
/**
* <p>
* @attr description
* X coordinate of the end point origin of the gradient.
* Defined in same coordinates as the path itself
*
* <p>May be a floating point value, such as "<code>1.2</code>".
*
* @attr name android:endX
*/
public static final int GradientColor_android_endX=10;
/**
* <p>
* @attr description
* Y coordinate of the end point of the gradient within the shape.
* Defined in same coordinates as the path itself
*
* <p>May be a floating point value, such as "<code>1.2</code>".
*
* @attr name android:endY
*/
public static final int GradientColor_android_endY=11;
/**
* Attributes that can be used with a GradientColorItem.
* <p>Includes the following attributes:</p>
* <table>
* <colgroup align="left" />
* <colgroup align="left" />
* <tr><th>Attribute</th><th>Description</th></tr>
* <tr><td><code>{@link #GradientColorItem_android_color android:color}</code></td><td></td></tr>
* <tr><td><code>{@link #GradientColorItem_android_offset android:offset}</code></td><td></td></tr>
* </table>
* @see #GradientColorItem_android_color
* @see #GradientColorItem_android_offset
*/
public static final int[] GradientColorItem={
0x010101a5, 0x01010514
};
/**
* <p>
* @attr description
* The current color for the offset inside the gradient.
*
* <p>May be a color value, in the form of "<code>#<i>rgb</i></code>",
* "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or
* "<code>#<i>aarrggbb</i></code>".
*
* @attr name android:color
*/
public static final int GradientColorItem_android_color=0;
/**
* <p>
* @attr description
* The offset (or ratio) of this current color item inside the gradient.
* The value is only meaningful when it is between 0 and 1.
*
* <p>May be a floating point value, such as "<code>1.2</code>".
*
* @attr name android:offset
*/
public static final int GradientColorItem_android_offset=1;
}
} | [
"nickluckgroup@gmail.com"
] | nickluckgroup@gmail.com |
c31ab271057b49ccbcf8369bd46036abbd2b80a3 | f59b67b7644a810ad4068df001279ea587fe2296 | /spring-cloud/gateway/src/main/java/com/zkdlu/DemoFilter.java | 6c9b50b78a1e165f7cee75ab249d6f46272ccf93 | [] | no_license | saywithu/spring-boot | 1a318631b370549e420a4b6377582701bf72ae0c | 7d14c2ad737490fc97b14c2563422ba5a1611cd3 | refs/heads/main | 2023-06-07T11:13:08.363093 | 2021-06-29T12:54:43 | 2021-06-29T12:54:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,884 | java | package com.zkdlu;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory;
import org.springframework.stereotype.Component;
import reactor.core.publisher.Mono;
@Component
public class DemoFilter extends AbstractGatewayFilterFactory<DemoFilter.Config> {
private final Logger log = LoggerFactory.getLogger(DemoFilter.class);
public DemoFilter() {
super(Config.class);
}
@Override
public GatewayFilter apply(Config config) {
return ((exchange, chain) -> {
log.info("DemoFilter baseMessage>>>>>>" + config.getBaseMessage());
if (config.isPreLogger()) {
log.info("DemoFilter Start>>>>>>" + exchange.getRequest());
}
return chain.filter(exchange).then(Mono.fromRunnable(()->{
if (config.isPostLogger()) {
log.info("DemoFilter End>>>>>>" + exchange.getResponse());
}
}));
});
}
public static class Config {
private String baseMessage;
private boolean preLogger;
private boolean postLogger;
public String getBaseMessage() {
return baseMessage;
}
public void setBaseMessage(String baseMessage) {
this.baseMessage = baseMessage;
}
public boolean isPreLogger() {
return preLogger;
}
public void setPreLogger(boolean preLogger) {
this.preLogger = preLogger;
}
public boolean isPostLogger() {
return postLogger;
}
public void setPostLogger(boolean postLogger) {
this.postLogger = postLogger;
}
}
}
| [
"zkdlu159951@gmail.com"
] | zkdlu159951@gmail.com |
4d08b75cbab341efdab2f5ffa5385341d6fa9067 | 7e8b691e046c14470f2edf9d646be90432ab0922 | /springmvc/src/test/java/com/apple/springmvc/dao/UserDaoTest.java | f857897764cd847c76b86284a04423a60f9ec3b6 | [] | no_license | Winteren/springmvc | 52379cf219214bba16f78c02b9b7752803d6ae96 | 21809950b6566d1e65f03fae20ecf2313e4d62f4 | refs/heads/master | 2020-04-03T09:54:28.997513 | 2016-07-06T10:12:00 | 2016-07-06T10:12:00 | 62,710,920 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 695 | java | package com.apple.springmvc.dao;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* UserDaoImpl Tester.
*
* @author renxueni
* @since <pre>七月 4, 2016</pre>
* @version 1.0
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:spring/applicationContext-dao.xml",
"classpath:spring/applicationContext-mvc.xml"
})
public class UserDaoTest {
/**
*
* Method: getAllUser()
*
*/
@Test
public void testGetAllUser() throws Exception {
//TODO: Test goes here...
}
}
| [
"luckystar0727@163.com"
] | luckystar0727@163.com |
dfd4eacd2cc21be81994a027aab51c54cb04f3a1 | f100931e377c58623d6bd958eafafaf679d54488 | /src/main/ru/konstpavlov/exchangeUtils/Exchange.java | 7c11fc6c52010e5c2e9acb73ede3a6a2f6b14799 | [] | no_license | KonstantinPavlov/SBT-Test | ed6e2438eb25c59904d3361c91ea07bfdd1bf49d | 7d3aa60d77be2bf906f25d71a09c083aa6d5d9a8 | refs/heads/master | 2021-01-13T16:20:00.224293 | 2017-01-25T10:33:20 | 2017-01-25T10:33:20 | 79,887,460 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,774 | java | package main.ru.konstpavlov.exchangeUtils;
import main.ru.konstpavlov.operations.ExchangeOperation;
import main.ru.konstpavlov.operations.OperationFactory;
import main.ru.konstpavlov.utils.SecurityType;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.Map;
public class Exchange {
private OperationFactory operationFactory = new OperationFactory();
private Map<String,Client> clients = new LinkedHashMap<>();
private OperationList sellList = new OperationList();
private OperationList buyList = new OperationList();
public Exchange(String clientsFilePath, String ordersFilePath) {
try( BufferedReader bufferedFileReader = new BufferedReader(new FileReader(clientsFilePath));
BufferedReader bufferedFileReader2 = new BufferedReader(new FileReader(ordersFilePath))) {
String line;
while ((line = bufferedFileReader.readLine())!= null){
String[] temp = line.split("\\t");
createClient(temp);
}
while ((line = bufferedFileReader2.readLine())!= null){
String[] temp = line.split("\\t");
createOrder(temp);
}
}
catch (IOException e){
System.out.println(e.getMessage());
}
}
private void createClient(String[] temp){
// parsing data
int balance = Integer.parseInt(temp[1]);
Map<SecurityType,Integer> securities = new LinkedHashMap<>();
securities.put(SecurityType.A,Integer.parseInt(temp[2]));
securities.put(SecurityType.B,Integer.parseInt(temp[3]));
securities.put(SecurityType.C,Integer.parseInt(temp[4]));
securities.put(SecurityType.D,Integer.parseInt(temp[5]));
Client client = new Client(temp[0],balance,securities);
this.clients.put(temp[0],client);
}
private void createOrder(String[] temp){
// parsing data
String clientName = temp[0];
SecurityType securityType = selectSecurityType(temp[2]);
Order order = new Order(securityType,Integer.parseInt(temp[3]),Integer.parseInt(temp[4]));
// call factory for getting correct operation
ExchangeOperation operation = operationFactory.getOperation(temp[1],clientName,order);
//execute operation
operation.executeOperation(this);
}
public void sellOperation(ExchangeOperation operation){
baseOperation(-1,1,operation);
}
public void buyOperation(ExchangeOperation operation){
baseOperation(1,-1,operation);
}
private void baseOperation(int a, int b ,ExchangeOperation operation){
Client currentClient= clients.get(operation.getClientName());
SecurityType secType = operation.getOrder().getSecurityType();
int secCount;
secCount=currentClient.getSecurities().get(secType);
secCount+= a*operation.getOrder().getSecurityCount();
currentClient.getSecurities().put(secType,secCount);
int currentBalance=currentClient.getBalance();
currentBalance = currentBalance + b*(operation.getOrder().getSecurityCount()*operation.getOrder().getSecurityCost());
currentClient.setBalance(currentBalance);
clients.put(currentClient.getName(),currentClient);
}
private SecurityType selectSecurityType (String text){
switch (text){
case "A":
return SecurityType.A;
case "B":
return SecurityType.B;
case "C":
return SecurityType.C;
case "D":
return SecurityType.D;
default:
throw new IllegalArgumentException();
}
}
public void showResults(String resultFilePath){
try(FileWriter writer = new FileWriter(resultFilePath, false)) {
int size=clients.size();
int count=0;
for (Map.Entry<String,Client> entry: clients.entrySet()) {
count++;
String text = entry.getKey()+ "\t";
text = text + entry.getValue().getBalance()+"\t";
text = text+ entry.getValue().getSecuritiesString();
writer.write(text);
if (count<size){
writer.append("\n");
}
}
writer.flush();
}
catch (IOException e){
System.out.println(e.getMessage());
}
}
public Map<String, Client> getClients() {
return clients;
}
public OperationList getSellList() {
return sellList;
}
public OperationList getBuyList() {
return buyList;
}
}
| [
"konstpavlovsdr@gmail.com"
] | konstpavlovsdr@gmail.com |
c2f523caae89ea1844678bde2e9d190fe2c1f52c | b23404e272db01f2bf46320565c11b9e02cf0c61 | /new/pps/src/main/java/ice/cn/joy/ggg/api/model/PageSupport.java | 47ebce3910e38623f22b0be1a961cfd7f4857329 | [] | no_license | brucesq/brucedamon001 | 95ab98798f1c29d722a397681956c24ff4091385 | 92ab181f90005afffb354d10768921545912119c | refs/heads/master | 2021-05-29T09:35:05.115101 | 2011-12-20T05:42:28 | 2011-12-20T05:42:28 | 32,131,555 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,962 | java | // **********************************************************************
//
// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
// Ice version 3.4.0
package cn.joy.ggg.api.model;
// <auto-generated>
//
// Generated from file `community.ice'
//
// Warning: do not edit this file.
//
// </auto-generated>
public class PageSupport implements java.lang.Cloneable, java.io.Serializable
{
public int pageNo;
public int pageSize;
public int totalSize;
public Ice.Object result;
public PageSupport()
{
}
public PageSupport(int pageNo, int pageSize, int totalSize, Ice.Object result)
{
this.pageNo = pageNo;
this.pageSize = pageSize;
this.totalSize = totalSize;
this.result = result;
}
public boolean
equals(java.lang.Object rhs)
{
if(this == rhs)
{
return true;
}
PageSupport _r = null;
try
{
_r = (PageSupport)rhs;
}
catch(ClassCastException ex)
{
}
if(_r != null)
{
if(pageNo != _r.pageNo)
{
return false;
}
if(pageSize != _r.pageSize)
{
return false;
}
if(totalSize != _r.totalSize)
{
return false;
}
if(result != _r.result && result != null && !result.equals(_r.result))
{
return false;
}
return true;
}
return false;
}
public int
hashCode()
{
int __h = 0;
__h = 5 * __h + pageNo;
__h = 5 * __h + pageSize;
__h = 5 * __h + totalSize;
if(result != null)
{
__h = 5 * __h + result.hashCode();
}
return __h;
}
public java.lang.Object
clone()
{
java.lang.Object o = null;
try
{
o = super.clone();
}
catch(CloneNotSupportedException ex)
{
assert false; // impossible
}
return o;
}
public void
__write(IceInternal.BasicStream __os)
{
__os.writeInt(pageNo);
__os.writeInt(pageSize);
__os.writeInt(totalSize);
__os.writeObject(result);
}
private class Patcher implements IceInternal.Patcher
{
public void
patch(Ice.Object v)
{
try
{
result = (Ice.Object)v;
}
catch(ClassCastException ex)
{
IceInternal.Ex.throwUOE(type(), v.ice_id());
}
}
public String
type()
{
return "::Ice::Object";
}
}
public void
__read(IceInternal.BasicStream __is)
{
pageNo = __is.readInt();
pageSize = __is.readInt();
totalSize = __is.readInt();
__is.readObject(new Patcher());
}
public int getPageNo() {
return pageNo;
}
public void setPageNo(int pageNo) {
this.pageNo = pageNo;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getTotalSize() {
return totalSize;
}
public void setTotalSize(int totalSize) {
this.totalSize = totalSize;
}
public Ice.Object getResult() {
return result;
}
public void setResult(Ice.Object result) {
this.result = result;
}
}
| [
"quanzhi@8cf3193c-f4eb-11de-8355-bf90974c4141"
] | quanzhi@8cf3193c-f4eb-11de-8355-bf90974c4141 |
c204b09277dbdff888b4998615d498a5c9ee2be9 | aa0c3c4fcf69127dc4d361d7c4f12dc164e3d561 | /java/AULAS/src/lista4Exercicios/CadCliente.java | 24a90586ed0fdd7bbb58897527d550815a370e05 | [] | no_license | rodrigoroseo/turma30java | be16310ed640ff5869fc626cbdf41643f8ceb5ae | 28e3951ca39568ac917369c4f405c194dbb68e56 | refs/heads/main | 2023-08-18T20:00:58.876333 | 2021-10-03T20:14:24 | 2021-10-03T20:14:24 | 388,224,797 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 731 | java | package lista4Exercicios;
public class CadCliente {
public static void main(String[] args) {
Cliente cliente1 = new Cliente();
cliente1.nome = "Rodrigo";
cliente1.cpf = "11122233345";
cliente1.anoNascimento = 1998;
Cliente cliente2 = new Cliente();
cliente2.nome = "Roseo";
cliente2.cpf = "111222333";
cliente2.anoNascimento = 1990;
System.out.printf("NOME\t| CPF\t\t| IDADE");
System.out.printf("\n-------------------------------");
System.out.printf("\n%s\t| %s\t| %d",cliente1.nome,cliente1.validarCPF(),cliente1.calcularIdade());
System.out.printf("\n-------------------------------");
System.out.printf("\n%s\t| %s\t| %d",cliente2.nome,cliente2.validarCPF(),cliente2.calcularIdade());
}
}
| [
"rodrigo.roseo@gmail.com"
] | rodrigo.roseo@gmail.com |
19d2481ce1ad807b2e12ca5ccfddbfe8028084e8 | 3a6c7d7dca31ef6a65d4d893696585d26e6bcfb6 | /src/game/graphics/effects/Updatable.java | 21fb740c598d762a91aa320c61e75f46326ba400 | [] | no_license | Shamzaa/OOP-spillprosjekt | 1918fb74b483fa1c8bc5ae34635c110b2eae24be | 5025ad2907a4ac6de3ab93443d5274da9ad20095 | refs/heads/master | 2016-08-12T12:49:31.180930 | 2016-04-20T11:29:14 | 2016-04-20T11:29:14 | 54,209,028 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 191 | java | package game.graphics.effects;
public interface Updatable {
public void update(long dtime);
public void render();
public void destroy();
public void kill();
public boolean isAlive();
}
| [
"aborysa@gmail.com"
] | aborysa@gmail.com |
822a1047848a9f4e117e1a87257ddc840f161af8 | 45cbf4213e178994963ec018d3344d11ab7e8d03 | /SkynetBus/src/main/java/com/auxo/cache/AuxoCacheConstant.java | 632a1054eb8d48e813ec844e5a734d876eccd3cb | [] | no_license | skynet-auxo/skynet-auxo | 412f88e65d9f2eb08acfeef3230251f3670de4e8 | cdab50c63b0124f77d777df00677bff49fe54674 | refs/heads/master | 2022-11-01T08:13:47.681341 | 2019-06-17T01:10:21 | 2019-06-17T01:10:21 | 192,259,296 | 0 | 0 | null | 2022-10-12T20:28:02 | 2019-06-17T02:09:26 | JavaScript | UTF-8 | Java | false | false | 677 | java | /**
* Project Name: AuxoBus
* File Name:AuxoCacheConstant.java
* Package Name:com.auxo.cache
* History
* Seq Date Developer Description
* ---------------------------------------------------------------------------
* 1 2019年06月14日 zeroLi Create
*
* ---------------------------------------------------------------------------
* Copyright (c) 2018, zeroLi of AuXo All Rights Reserved.
*
*/
package com.auxo.cache;
public class AuxoCacheConstant {
protected final static String AUXO_CACHE_TYPE_EHCACHE = "EHCACHE";
protected final static String AUXO_CACHE_TYPE_REDIS = "REDIS";
}
| [
"343077359@qq.com"
] | 343077359@qq.com |
040dab000941fcc91544ec4ca441c0d8be314a68 | c5f8c4f03d277c640c56925bebb778bf4930b505 | /SeProject/src/day1110/network/gui/EchoServer.java | 69c2cb799f18a7e08c19fc3ca299011bbbf07d09 | [] | no_license | qowoeo948/java_swing_javafx | 67dcd8545182c9d1ab1c6db362075a7cde2a9fcc | cb73a69a8f90629e014597a303fdccc18ee85ee1 | refs/heads/master | 2023-01-22T07:05:23.846706 | 2020-12-01T09:00:40 | 2020-12-01T09:00:40 | 307,729,305 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,610 | java | package day1110.network.gui;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.ServerSocket;
import java.net.Socket;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
public class EchoServer extends JFrame{
JTextField t_port;
JButton bt;
JPanel p_north;
JTextArea area;
JScrollPane scroll;
ServerSocket server;
int port=7777;
Thread thread ; //메인쓰레드 대신, 접속자를 감지하게 될 쓰레드!! (accept()메서드 떄문에,,)
BufferedReader buffr; //듣기 (서버입장)
BufferedWriter buffw;// 말하기 (써버입장)
public EchoServer() {
t_port = new JTextField((Integer.toString(port)),10);
bt = new JButton("서버가동");
p_north = new JPanel();
area = new JTextArea();
scroll = new JScrollPane(area);
//조립
p_north.add(t_port);
p_north.add(bt);
add(p_north,BorderLayout.NORTH);
add(scroll);
//가동버튼과 리스너 연결
bt.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
thread = new Thread() {
@Override
public void run() {
startServer();
}
};
thread.start();
}
});
setDefaultCloseOperation(EXIT_ON_CLOSE); //윈도우창 닫기 + 프로세스종료
setVisible(true);
setBounds(600,200,300,400); //x,y,width,height 순서
}
//서버 가동
public void startServer() {
try {
server = new ServerSocket(Integer.parseInt(t_port.getText()));
area.append("서버 준비\n");
//서버가동하기
//자바는 쓰레드기반이므로, 지금까지 메인실행부라 불렸던 실행조체도 사실은 시스템에 의해서 생성된 쓰레드였다.
//하지만, 메인쓰레드는 개발자가 생성하는 일반쓰레드와는 하는 역할에 차이가 있다.
//메인쓰레드는 프로그램을 운영해주는 역할, 특히 그래픽처리와, 이벤트처리까지 담당하므로, 절대로
//이러한 업무 금지 1) 무한루프에 빠뜨리지 말것 2) 대기상태에 빠뜨리지 말것, 예로 (accept,read())
//참고로 안드로이드에서는 메인쓰레드의 1,2번 시도자체를 에러로 본다.
//결론) 별도의 쓰레드를 생성하여 처리하자!!
Socket socket = server.accept(); //접속자 감지와 동시에 대화용 소켓 반환!
area.append("접속자 발견\n");
buffr = new BufferedReader(new InputStreamReader(socket.getInputStream()));
buffw = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
listen(); //듣기시작
} catch (NumberFormatException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
//메시지 받기 (청취)
public void listen() {
String msg=null;
try {
while(true) {
msg = buffr.readLine();
area.append(msg+"\n");
//클라이언트에게 다시 보내야 한다(서버의 의무)
send(msg);
}
} catch (IOException e) {
e.printStackTrace();
}
}
//클라이언트에게 메시지 보내기
public void send(String msg) {
try {
buffw.write(msg+"\n");
buffw.flush();
} catch (IOException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
new EchoServer();
}
}
| [
"qowoeo948@gmail.com"
] | qowoeo948@gmail.com |
d6a38f26766e1f3b1ed1da9e993326252d1137e3 | e16c386483e203721bf469698e2110fbd2c3033b | /src/main/java/ua/in/dris4ecoder/model/businessServices/ServiceService.java | fa87e021d229b019d466d8a4c5c1253f476fe688 | [] | no_license | alex-korneyko/Restaurant | 1fdf0225d7868d1245f27a263ca6cadf40d425a4 | 60fe3d1afcc28d6396e465789667d84ba21be711 | refs/heads/master | 2020-05-21T20:05:33.236044 | 2016-12-29T16:26:36 | 2016-12-29T16:26:36 | 64,385,747 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,833 | java | package ua.in.dris4ecoder.model.businessServices;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import ua.in.dris4ecoder.model.businessObjects.*;
import ua.in.dris4ecoder.model.dao.RestaurantDao;
import java.time.LocalDateTime;
import java.util.List;
/**
* Created by Alex Korneyko on 04.08.2016 10:55.
*/
public class ServiceService implements BusinessService {
private RestaurantDao<Order> ordersDao;
private RestaurantDao<KitchenProcess> kitchenProcessDao;
@Autowired
private ManagementService managementController;
@Transactional
public WarehouseChangeResult addOrder(Order order) {
SalesInvoice salesInvoice = new SalesInvoice(true, order);
WarehouseChangeResult result = managementController.addSalesInvoice(salesInvoice, false);
if (result.isChangeSuccessfully()) {
order.addSalesInvoice(salesInvoice);
ordersDao.addItem(order);
}
return result;
}
public WarehouseChangeResult editOrder(Order order) {
//receiving old invoice for this order
SalesInvoice salesInvoice = managementController.findSalesInvoice(order.getSalesInvoice().getId());
//filling old invoice
salesInvoice.fillInvoice(order);
//attempt updating of warehouse
WarehouseChangeResult changeResult = managementController.editSalesInvoice(salesInvoice, false);
if (changeResult.isChangeSuccessfully()) {
order.addSalesInvoice(salesInvoice);
ordersDao.editItem(order.getId(), order);
}
return changeResult;
}
@Transactional
public void removeOrder(Order order) {
managementController.removeSalesInvoice(order.getSalesInvoice().getId(), false);
ordersDao.removeItem(order);
}
@Transactional
public void removeOrder(int id) {
removeOrder(findOrder(id));
}
@Transactional
public Order findOrder(int id) {
final Order order = ordersDao.findItemById(id);
if (order != null) return order;
else throw new IllegalArgumentException("order not found");
}
@Transactional
public List<Order> findOrder(OrderDishStatus orderDishStatus) {
return ordersDao.findItem(orderDishStatus);
}
@Transactional
public List<Order> findOrder(LocalDateTime start, LocalDateTime end) {
return ordersDao.findItem(start, end);
}
public List<Order> getAllOrders() {
return ordersDao.findAll();
}
public void setOrdersDao(RestaurantDao<Order> ordersDao) {
this.ordersDao = ordersDao;
}
public void setKitchenProcessDao(RestaurantDao<KitchenProcess> kitchenProcessDao) {
this.kitchenProcessDao = kitchenProcessDao;
}
}
| [
"a.korneyko@gmail.com"
] | a.korneyko@gmail.com |
9955c982a7694f9863b90ee54fd3df16748ae233 | 42aaa68a848c0f5cbedf265567e2466e4b1d6757 | /src/main/java/jxl/biff/drawing/Dgg.java | f19b2c31abb42219861e42b6939c6df4108eacd0 | [] | no_license | qinglinyi/jexcelapi-gradle | c6abd8ada1a75a06b1ed8d102c983ae203eba46a | d50a877597c54f578855b315902e18f149fc3503 | refs/heads/master | 2021-01-16T15:49:02.486798 | 2017-02-01T09:47:27 | 2017-02-01T15:22:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,213 | java | /*********************************************************************
*
* Copyright (C) 2003 Andrew Khan
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***************************************************************************/
package jxl.biff.drawing;
import jxl.biff.IntegerHelper;
import jxl.common.Logger;
import java.util.ArrayList;
/**
* Dgg record
*/
class Dgg extends EscherAtom {
/**
* The logger
*/
private static Logger logger = Logger.getLogger(Dgg.class);
/**
* The binary data
*/
private byte[] data;
/**
* The number of clusters
*/
private int numClusters;
/**
* The maximum shape id
*/
private int maxShapeId;
/**
* The number of shapes saved
*/
private int shapesSaved;
/**
* The number of drawings saved
*/
private int drawingsSaved;
/**
* The clusters
*/
private ArrayList clusters;
/**
* The cluster structure
*/
static final class Cluster {
/**
* The drawing group id
*/
int drawingGroupId;
/**
* The something or other
*/
int shapeIdsUsed;
/**
* Constructor
*
* @param dgId the drawing group id
* @param sids the sids
*/
Cluster(int dgId, int sids) {
drawingGroupId = dgId;
shapeIdsUsed = sids;
}
}
/**
* Constructor
*
* @param erd the read in data
*/
public Dgg(EscherRecordData erd) {
super(erd);
clusters = new ArrayList();
byte[] bytes = getBytes();
maxShapeId = IntegerHelper.getInt
(bytes[0], bytes[1], bytes[2], bytes[3]);
numClusters = IntegerHelper.getInt
(bytes[4], bytes[5], bytes[6], bytes[7]);
shapesSaved = IntegerHelper.getInt
(bytes[8], bytes[9], bytes[10], bytes[11]);
drawingsSaved = IntegerHelper.getInt
(bytes[12], bytes[13], bytes[14], bytes[15]);
int pos = 16;
for (int i = 0; i < numClusters; i++) {
int dgId = IntegerHelper.getInt(bytes[pos], bytes[pos + 1]);
int sids = IntegerHelper.getInt(bytes[pos + 2], bytes[pos + 3]);
Cluster c = new Cluster(dgId, sids);
clusters.add(c);
pos += 4;
}
}
/**
* Constructor
*
* @param numShapes the number of shapes
* @param numDrawings the number of drawings
*/
public Dgg(int numShapes, int numDrawings) {
super(EscherRecordType.DGG);
shapesSaved = numShapes;
drawingsSaved = numDrawings;
clusters = new ArrayList();
}
/**
* Adds a cluster to this record
*
* @param dgid the id
* @param sids the sid
*/
void addCluster(int dgid, int sids) {
Cluster c = new Cluster(dgid, sids);
clusters.add(c);
}
/**
* Gets the data for writing out
*
* @return the binary data
*/
byte[] getData() {
numClusters = clusters.size();
data = new byte[16 + numClusters * 4];
// The max shape id
IntegerHelper.getFourBytes(1024 + shapesSaved, data, 0);
// The number of clusters
IntegerHelper.getFourBytes(numClusters, data, 4);
// The number of shapes saved
IntegerHelper.getFourBytes(shapesSaved, data, 8);
// The number of drawings saved
// IntegerHelper.getFourBytes(drawingsSaved, data, 12);
IntegerHelper.getFourBytes(1, data, 12);
int pos = 16;
for (int i = 0; i < numClusters; i++) {
Cluster c = (Cluster) clusters.get(i);
IntegerHelper.getTwoBytes(c.drawingGroupId, data, pos);
IntegerHelper.getTwoBytes(c.shapeIdsUsed, data, pos + 2);
pos += 4;
}
return setHeaderData(data);
}
/**
* Accessor for the number of shapes saved
*
* @return the number of shapes saved
*/
int getShapesSaved() {
return shapesSaved;
}
/**
* Accessor for the number of drawings saved
*
* @return the number of drawings saved
*/
int getDrawingsSaved() {
return drawingsSaved;
}
/**
* Accessor for a particular cluster
*
* @param i the cluster number
* @return the cluster
*/
Cluster getCluster(int i) {
return (Cluster) clusters.get(i);
}
}
| [
"mtrakal@gmail.com"
] | mtrakal@gmail.com |
47c28f34e55bb76b2af7300f827b536030c18651 | 709d581732f5026d2d637205ea28bad58e9bda7c | /test/src/main/java/fpt/finish/severlet/QuanLyUserController.java | eb34fc8ef5385b445b56fe1c21751ec48a7de7b3 | [] | no_license | quachtan/finish | 614b5053ff45af60285c78392fa6ccc82bec1935 | a88930904634a4ca0b20ce09326aeeedbb00525f | refs/heads/master | 2021-08-26T09:09:44.860955 | 2017-11-22T17:56:29 | 2017-11-22T17:56:29 | 108,884,949 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,976 | java | package fpt.finish.severlet;
import java.io.IOException;
import java.sql.Connection;
import java.util.ArrayList;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import fpt.finish.Dao.UserDao;
import fpt.finish.bean.User_haui;
import fpt.finish.until.MyUtils;
@WebServlet("/qluser")
public class QuanLyUserController extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public QuanLyUserController() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HttpSession session = request.getSession();
User_haui userhaui = MyUtils.getLoginedUser(session);
if (userhaui == null) {
RequestDispatcher dispatcher = request.getServletContext()
.getRequestDispatcher("/DangNhap.jsp");
dispatcher.forward(request, response);
}
else{
if (userhaui.getMa_role()==1) {
UserDao userDao=new UserDao();
Connection conn=MyUtils.getStoredConnection(request);
ArrayList<User_haui> list=userDao.findAll(conn);
request.setAttribute("listUser", list);
RequestDispatcher rd=request.getRequestDispatcher("/QuanLyNguoiDung.jsp");
rd.forward(request, response);
}
}
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
| [
"33230512+trongngoc96@users.noreply.github.com"
] | 33230512+trongngoc96@users.noreply.github.com |
3bec660aa71550737df61eaab473728013742ccf | 7617a656b6f77dfc60cd405baf87bc7700296092 | /src/konstruktory_metody_dziedziczenie/src/konstruktory_metody_dziedziczenie/Car.java | 8298094500988f85c7faf02d1cf8e5e23a916b5a | [] | no_license | iJaguar/Cwiczenia | 6f38d74c7077b1faaea2b190a3257cbb0c174f09 | 9c200980a9205cec28f7374301a6a555aaabf736 | refs/heads/master | 2021-01-20T17:47:26.197080 | 2017-05-10T18:05:36 | 2017-05-10T18:05:36 | 90,889,595 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,141 | java | package konstruktory_metody_dziedziczenie;
import static java.lang.String.*;
public class Car {
double kilometers;
String nazwa;
int liczba_pasazerow;
double pojemnosc_baku;
Car() { //konstruktoir domyslny
}
Car(double kilometers, String name, int passengers, double capacity) {
this.kilometers = kilometers;
this.nazwa = name;
this.liczba_pasazerow = passengers;
this.pojemnosc_baku = capacity;
}
Car(String name, int passengers, double capacity) {
this.kilometers = 10;
this.nazwa = name;
this.liczba_pasazerow = passengers;
this.pojemnosc_baku = capacity;
}//klasa,metody,konstruktory musza miec cialo
void print() {
System.out.println(format("%s pomiesci %d pasazerow, a pojemnosc jego baku wynosi: %d spala na 100 km %d",
nazwa, liczba_pasazerow, pojemnosc_baku, kilometers));
}
void printRange() {
System.out.println(format("%s na pelnym baku przejedzie: %d", nazwa, getRange()));
}
private double getRange() {
return (pojemnosc_baku / kilometers) * 100;
}
}
| [
"gpmstach@gmail.com"
] | gpmstach@gmail.com |
35754ad3dad01b5cfa04c76e2691e6292a820879 | a120e4f6c0d1f60e4bae95f32888f8d5a257a359 | /STUN5389Emu/src/STUN/STUNrfc/Util.java | 1ca45a362682f3344be95e24a5feeda60d6e5aa9 | [] | no_license | zhiji6/basic_STUN_5389_Emulator | a8582c86b9598cf911a892c0bf84de8d0a376426 | 5bc5496960e9d50cc79b9e1e3aaeca76b326022d | refs/heads/master | 2020-04-28T14:36:23.735274 | 2018-03-22T13:31:59 | 2018-03-22T13:31:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 558 | java | package STUN.STUNrfc;
import java.math.BigInteger;
import java.util.Random;
public class Util {
private static Random rnd = new Random();
public static BigInteger generateTrxId() {
return new BigInteger(Constants.TRX_ID_SIZE - 1, rnd);
}
public static String formatIPAddress(byte[] addr) {
StringBuilder buffer = new StringBuilder();
for(int i=0; i<4; i++) {
buffer.append(addr[i] & 0xFF).append(".");
}
return buffer.toString();
}
}
| [
"Mrhie@DESKTOP-1S23VTE"
] | Mrhie@DESKTOP-1S23VTE |
c8c69b959d08553eb725987aea58072b92c78c36 | 92543800c0b9c8978ed327212f0628e442ce7473 | /app/src/main/java/in/savegenie/savegenie/backgroundclasses/BundleItem.java | 5bf7b2b4d463d2fbb79e19ebb436e3e01cd09419 | [] | no_license | gupta-manish/Savegenie | 75766e831ab2a651f14a1b285fa63d4a0a5fd5fa | 6b0728bde14c10f7b6f185a87da50080b3e62230 | refs/heads/master | 2021-01-01T19:29:35.241193 | 2015-04-11T07:00:33 | 2015-04-11T07:00:33 | 23,832,129 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 597 | java | package in.savegenie.savegenie.backgroundclasses;
/**
* Created by manish on 20/3/15.
*/
public class BundleItem
{
public String id,bundle_get_id,store_id,store_sku_id,qty,status;
public StoreSku storeSku;
public BundleItem(String id,String bundle_get_id,String store_id,String store_sku_id,String qty,String status,StoreSku storeSku)
{
this.id = id;
this.bundle_get_id = bundle_get_id;
this.store_id = store_id;
this.store_sku_id = store_sku_id;
this.qty = qty;
this.status = status;
this.storeSku = storeSku;
}
}
| [
"guptamanish712@gmail.com"
] | guptamanish712@gmail.com |
77e069d27274d7db84986f4f49b00fcd109a9582 | 5f8620ad72f80d011c0124becea4df74f949bfdd | /src/interfacce/opvaccinale.java | 6e619cfe33a68c1817e55d0731c60c7646a75b37 | [] | no_license | francesco-esposito/Laboratorio-B | 6d5bd6aca2bf1c99ad6c844b6b62a8edd627eb7f | d1282fcc078ac14e18297f80121a8d90ad2b3726 | refs/heads/master | 2023-07-23T15:22:31.719901 | 2021-09-05T09:40:24 | 2021-09-05T09:40:24 | 401,123,199 | 0 | 0 | null | null | null | null | ISO-8859-13 | Java | false | false | 3,662 | java | package interfacce;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.GridLayout;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.SwingConstants;
import backenddb.ServerDBMSInterface;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
/**Interfaccia che mostra tutte le funzionalitą che il sistema offre per gli operatori vaccinali.
* @author Alessandro Alonzi
* @author Daniel Pedrotti
* @author Francesco Esposito
*/
public class opvaccinale {
JFrame frame;
private ServerDBMSInterface db;
/**
* Launch the application.
*/
public static void main(String[] args, final ServerDBMSInterface db) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
opvaccinale window = new opvaccinale();
window.setDB(db);
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public opvaccinale() {
initialize();
}
public void setDB(ServerDBMSInterface db){
this.db = db;
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 450, 281);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
//creazione di una label e imposta i vari campi (posizione, font) inoltre lo aggiunge al frame
JLabel lblNewLabel = new JLabel("Quale operazione desideri effettuare?");
lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 20));
lblNewLabel.setBounds(10, 29, 416, 30);
frame.getContentPane().add(lblNewLabel);
//bottone che permette di aprire la schermata per inserire un nuovo centro vaccinale
JButton btnNewButton = new JButton("Registra nuovo centro vaccinale ");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
frame.setVisible(false);
//regcentro rc= new regcentro(db);
regcentro.main(null, db);
}
});
btnNewButton.setFont(new Font("Tahoma", Font.PLAIN, 14));
btnNewButton.setBounds(10, 89, 416, 30);
frame.getContentPane().add(btnNewButton);
//bottone che apre la schermata per inserire un nuovo vaccinato
JButton btnNewButton_1 = new JButton("Registra nuovo vaccinato");
btnNewButton_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
frame.setVisible(false);
//regvaccinato rv= new regvaccinato(db);
regvaccinato.main(null, db);
}
});
btnNewButton_1.setFont(new Font("Tahoma", Font.PLAIN, 14));
btnNewButton_1.setBounds(10, 155, 416, 30);
frame.getContentPane().add(btnNewButton_1);
//bottone che permette di tornare alla schermata principale
JButton btnNewButton_2 = new JButton("\uD83D\uDD19");
btnNewButton_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
frame.setVisible(false);
//client c1 = new client();
client.main(null, db);
}
});
btnNewButton_2.setBounds(10, 213, 52, 21);
frame.getContentPane().add(btnNewButton_2);
//bottone che permette di tornare alla home
JButton btnNewButton_2_1 = new JButton("\u2302");
btnNewButton_2_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
frame.setVisible(false);
//client c1= new client(null);
client.main(null, db);
}
});
btnNewButton_2_1.setBounds(369, 213, 57, 21);
frame.getContentPane().add(btnNewButton_2_1);
}
} | [
"francesco-esposito"
] | francesco-esposito |
ef464ff9fd36985ae2620315627ac8d13f45819f | 055a93bd6ac2eac503ed21ed24e7ee419759a0e9 | /src/main/java/lsv/core/graphics/Turtle.java | b5dc6f4e3f63d8749c486f6928afcdadd7462606 | [] | no_license | ccieh/LSystemVisualizer | 3be7c8a1d5cbf4c7e84d96d652915b1267853f9d | a9cf72e1b6e2425743022a05965bbaf6b7a4ae1b | refs/heads/master | 2021-01-10T13:33:40.951071 | 2016-03-23T21:10:50 | 2016-03-23T21:13:05 | 54,454,875 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 292 | java | package lsv.core.graphics;
public interface Turtle {
void rotate(double radians);
void push();
void pop();
void move(double distance);
void penUp();
void penDown();
void setWidth(double width);
void setColor(double r, double g, double b);
void reset();
}
| [
"verdigo.private@gmail.com"
] | verdigo.private@gmail.com |
da4b18118a2abe7b1e3075ebaad53adff53ff8ae | fe83cee7e251f2085bd1516ec36711a3ec044251 | /forum/forum-web/target/tmp/jsp/org/apache/jsp/WEB_002dINF/jsp/role/list_jsp.java | e98690f649931bf8e1cbc796239bbfe2f88174e1 | [] | no_license | aymwxbb2012/forum | f983e99938a694ed22775933ed7f80241c19879a | cc3697746d0cc60c6ceda6b6dac8298b4f7c35d0 | refs/heads/master | 2021-01-02T09:35:36.285152 | 2018-09-27T06:42:24 | 2018-09-27T06:42:24 | 99,254,600 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,263 | java | package org.apache.jsp.WEB_002dINF.jsp.role;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class list_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();
private static java.util.List<String> _jspx_dependants;
private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_c_forEach_var_items;
private org.glassfish.jsp.api.ResourceInjector _jspx_resourceInjector;
public java.util.List<String> getDependants() {
return _jspx_dependants;
}
public void _jspInit() {
_jspx_tagPool_c_forEach_var_items = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
}
public void _jspDestroy() {
_jspx_tagPool_c_forEach_var_items.release();
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
response.setContentType("text/html; charset=UTF-8");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
_jspx_resourceInjector = (org.glassfish.jsp.api.ResourceInjector) application.getAttribute("com.sun.appserv.jsp.resource.injector");
out.write("\r\n");
out.write("\r\n");
out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n");
out.write("<html>\r\n");
out.write("<head>\r\n");
out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\r\n");
out.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"");
out.print(request.getContextPath() );
out.write("/resources/css/admin/main.css\"/>\r\n");
out.write("<script type=\"text/javascript\" src=\"");
out.print(request.getContextPath() );
out.write("/resources/js/jquery-1.7.2.min.js\"></script>\r\n");
out.write("<script type=\"text/javascript\" src=\"");
out.print(request.getContextPath() );
out.write("/resources/js/core/jquery.forum.core.js\"></script>\r\n");
out.write("<script type=\"text/javascript\" src=\"");
out.print(request.getContextPath() );
out.write("/resources/js/admin/main.js\"></script>\r\n");
out.write("</head>\r\n");
out.write("<body>\r\n");
out.write("<div id=\"content\">\r\n");
out.write("\t<h3 class=\"admin_link_bar\">\r\n");
out.write("\t\t");
org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, "inc.jsp", out, false);
out.write("\r\n");
out.write("\t</h3>\r\n");
out.write("\t<table width=\"800\" cellspacing=\"0\" cellPadding=\"0\" id=\"listTable\">\r\n");
out.write("\t\t<thead>\r\n");
out.write("\t\t<tr>\r\n");
out.write("\t\t\t<td>Role identification</td>\r\n");
out.write("\t\t\t<td>Role name</td>\r\n");
out.write("\t\t\t<td>Role type</td>\r\n");
out.write("\t\t\t<td>Role operation</td>\r\n");
out.write("\t\t</tr>\r\n");
out.write("\t\t</thead>\r\n");
out.write("\t\t<tbody>\r\n");
out.write("\t\t");
if (_jspx_meth_c_forEach_0(_jspx_page_context))
return;
out.write("\r\n");
out.write("\t\t</tbody>\r\n");
out.write("\t</table>\r\n");
out.write("</div>\r\n");
out.write("</body>\r\n");
out.write("</html>");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
private boolean _jspx_meth_c_forEach_0(PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// c:forEach
org.apache.taglibs.standard.tag.rt.core.ForEachTag _jspx_th_c_forEach_0 = (org.apache.taglibs.standard.tag.rt.core.ForEachTag) _jspx_tagPool_c_forEach_var_items.get(org.apache.taglibs.standard.tag.rt.core.ForEachTag.class);
_jspx_th_c_forEach_0.setPageContext(_jspx_page_context);
_jspx_th_c_forEach_0.setParent(null);
_jspx_th_c_forEach_0.setItems((java.lang.Object) org.apache.jasper.runtime.PageContextImpl.evaluateExpression("${roles}", java.lang.Object.class, (PageContext)_jspx_page_context, null));
_jspx_th_c_forEach_0.setVar("role");
int[] _jspx_push_body_count_c_forEach_0 = new int[] { 0 };
try {
int _jspx_eval_c_forEach_0 = _jspx_th_c_forEach_0.doStartTag();
if (_jspx_eval_c_forEach_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
do {
out.write("\r\n");
out.write("\t\t\t<tr>\r\n");
out.write("\t\t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.evaluateExpression("${role.id }", java.lang.String.class, (PageContext)_jspx_page_context, null));
out.write(" </td>\r\n");
out.write("\t\t\t\t<td><a href=\"");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.evaluateExpression("${role.id }", java.lang.String.class, (PageContext)_jspx_page_context, null));
out.write("\" class=\"list_link\">");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.evaluateExpression("${role.name }", java.lang.String.class, (PageContext)_jspx_page_context, null));
out.write("</a></td>\r\n");
out.write("\t\t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.evaluateExpression("${role.roleType }", java.lang.String.class, (PageContext)_jspx_page_context, null));
out.write(" </td>\r\n");
out.write("\t\t\t\t<td>\r\n");
out.write("\t\t\t\t\t<a href=\"delete/");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.evaluateExpression("${role.id }", java.lang.String.class, (PageContext)_jspx_page_context, null));
out.write("\" class=\"list_op delete\">Delete</a>\r\n");
out.write("\t\t\t\t\t<a href=\"update/");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.evaluateExpression("${role.id }", java.lang.String.class, (PageContext)_jspx_page_context, null));
out.write("\" class=\"list_op\">Update</a>\r\n");
out.write("\t\t\t\t\t<a href=\"clearUsers/");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.evaluateExpression("${role.id }", java.lang.String.class, (PageContext)_jspx_page_context, null));
out.write("\" class=\"list_op delete\">Clean user</a>\r\n");
out.write("\t\t\t\t \r\n");
out.write("\t\t\t\t</td>\r\n");
out.write("\t\t\t</tr>\r\n");
out.write("\t\t");
int evalDoAfterBody = _jspx_th_c_forEach_0.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
}
if (_jspx_th_c_forEach_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
return true;
}
} catch (Throwable _jspx_exception) {
while (_jspx_push_body_count_c_forEach_0[0]-- > 0)
out = _jspx_page_context.popBody();
_jspx_th_c_forEach_0.doCatch(_jspx_exception);
} finally {
_jspx_th_c_forEach_0.doFinally();
_jspx_tagPool_c_forEach_var_items.reuse(_jspx_th_c_forEach_0);
}
return false;
}
}
| [
"liangchaotech@gmail.com"
] | liangchaotech@gmail.com |
fdee542756ade2163164947d6f0ee035419563e3 | d99b5c846628cba29622048454cba3546c305e3c | /datacenterframework/src/main/java/br/framework/domain/mission/SpaceMission.java | f4b1d1cfab74bdf1469f40593fb1520f3237ab59 | [] | no_license | anovais/famtee | 14ae0eaf3bb128d0cddbf077cb4e2a2c8b92d155 | 48c32f5a47696b1d61345be367d2a2fca510da36 | refs/heads/master | 2021-01-13T11:58:32.047812 | 2017-02-07T00:44:00 | 2017-02-07T00:44:00 | 81,148,333 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,617 | java | package br.framework.domain.mission;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.ElementCollection;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinTable;
import javax.persistence.Lob;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Component;
import br.framework.domain.PhotoEntity;
import br.framework.domain.GenericEntity;
import br.framework.domain.Institution;
import br.framework.domain.Metadata;
import br.framework.domain.assessment.Environment;
import br.framework.domain.instrument.Instrument;
import br.framework.domain.secutiry.User;
import br.framework.domain.util.Period;
/**
* Author: Andre Novais <br>
* Date: 10/2016 <br>
* Description: Representa uma missão espacial
*/
@Entity
@Component
public class SpaceMission extends Environment implements GenericEntity, PhotoEntity{
/**
* identificação do veiculo espacial
*/
@OneToOne(cascade=CascadeType.ALL, fetch=FetchType.EAGER)
@Autowired
private SpaceCraft spaceCraft;
private String code;
// Logs de reports do status da missão
@OneToMany(fetch=FetchType.LAZY)
private List<MissionReport> status;
@ManyToMany(fetch=FetchType.EAGER)
private List<Institution> institutions;
@OneToMany(cascade=CascadeType.DETACH, fetch=FetchType.LAZY)
private List<User> researchers;
@OneToMany(cascade=CascadeType.ALL , fetch=FetchType.EAGER)
private List<Metadata> metadata;
@Lob
private String objective;
//Payloads embarcadas
@ManyToMany
@JoinTable(name="mission_instrument")
private List<Instrument> payloads = new ArrayList<Instrument>();
@Embedded
private Period period;
@DateTimeFormat
private Calendar launchDate;
private String photoPath;
public List<Institution> getInstitutions() {
return institutions;
}
public void setInstitutions(List<Institution> institutions) {
this.institutions = institutions;
}
public List<User> getResearchers() {
return researchers;
}
public void setResearchers(List<User> researchers) {
this.researchers = researchers;
}
public List<Metadata> getMetadata() {
return metadata;
}
public void setMetadata(List<Metadata> metadata) {
this.metadata = metadata;
}
public Period getPeriod() {
return period;
}
public void setPeriod(Period period) {
this.period = period;
}
public Calendar getLaunchDate() {
return launchDate;
}
public void setLaunchDate(Calendar launchDate) {
this.launchDate = launchDate;
}
public String getObjective() {
return objective;
}
public void setObjective(String objective) {
this.objective = objective;
}
public SpaceCraft getSpaceCraft() {
return spaceCraft;
}
public void setSpaceCraft(SpaceCraft spaceCraft) {
this.spaceCraft = spaceCraft;
}
public List<MissionReport> getStatus() {
return status;
}
public void setStatus(List<MissionReport> status) {
this.status = status;
}
public List<Instrument> getPayloads() {
return payloads;
}
public void setPayloads(List<Instrument> payloads) {
this.payloads = payloads;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getPhotoPath() {
return photoPath;
}
public void setPhotoPath(String photoPath) {
this.photoPath = photoPath;
}
}
| [
"Andre Novais"
] | Andre Novais |
554f7ef95b7d61d7d5454c5327b16c267debb28b | cb6f5939c9fa12ab07cf71401b977d4fa4c22860 | /week-05/practical-04/.svn/pristine/55/554f7ef95b7d61d7d5454c5327b16c267debb28b.svn-base | 89392044b6aaa3d88b0fa4e562e7cfbccdd90bfc | [] | no_license | arpit2412/Foundation-of-Computer-Science | be6807359f5e8cf93ffbea80b58ab1c458c75d03 | 9008b7482d71410dff4c3449dfa4a32f8ab6e7e3 | refs/heads/master | 2022-12-07T17:55:37.002403 | 2020-09-03T11:01:24 | 2020-09-03T11:01:24 | 292,543,573 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,005 | /*
*
* Foundations of Computer Science
* Semester 02 Year 2019
* id: a1784072 name: Arpit Garg
*
*/
//class human child class of player
import java.util.*;
class Human extends Player{
public String input;
Scanner in = new Scanner(System.in);
//Overriding the performmove and return the string
@Override
public String performMove(){
//exception handling
try{
System.out.println("\n-----------------------------------\n");
System.out.println("Select: \n1.Rock \n2.Paper \n3.Scissor");
System.out.println("\n-----------------------------------\n");
input = in.nextLine(); //users choice
if(input.equalsIgnoreCase("Rock")){
return "Rock";
}else if(input.equalsIgnoreCase("Paper")){
return "Paper";
}else if(input.equalsIgnoreCase("Scissor")){
return "Scissor";
}else{
return input;
}
}catch (Exception e){
System.out.println("Exception: " + e); //showing exceptions if occurs
return "Error wrong input!!";
}
}
} | [
"arpit.rikki2412@gmail.com"
] | arpit.rikki2412@gmail.com | |
26e5388aa5f07d057581693156a259e15ca120b5 | eda23998e87ee63e25ea7587bc232c3ff36fb6ac | /geobatch/webapp/src/test/java/it/geosolutions/geobatch/jetty/StartDESTINATION.java | d51fbb20b38de8397b3787a3ed62b2673ff37fb7 | [] | no_license | geosolutions-it/destination | ad260ae0f34140f77210ab347c5f91086b32dcc2 | f9d65cc2f30e6cb14590539ea2d6fa8c296af133 | refs/heads/master | 2023-07-19T08:58:10.249183 | 2015-09-24T15:19:20 | 2015-09-24T15:19:20 | 7,544,277 | 0 | 4 | null | 2015-12-17T14:01:00 | 2013-01-10T16:22:05 | Java | UTF-8 | Java | false | false | 3,673 | java | /*
* GeoBatch - Open Source geospatial batch processing system
* http://geobatch.codehaus.org/
* Copyright (C) 2007-2008-2009 GeoSolutions S.A.S.
* http://www.geo-solutions.it
*
* GPLv3 + Classpath exception
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package it.geosolutions.geobatch.jetty;
import java.io.File;
import org.mortbay.jetty.Connector;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.bio.SocketConnector;
import org.mortbay.jetty.webapp.WebAppContext;
import org.mortbay.thread.BoundedThreadPool;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Jetty starter, will run GeoBatch inside the Jetty web container.<br>
* Useful for debugging, especially in IDE were you have direct dependencies between the sources of
* the various modules (such as Eclipse).
*
* @author wolf
*
*/
public class StartDESTINATION {
private static final Logger log = LoggerFactory.getLogger(StartDESTINATION.class);
public static void main(String[] args) {
Server jettyServer = null;
try {
jettyServer = new Server();
// don't even think of serving more than XX requests in parallel...
// we
// have a limit in our processing and memory capacities
BoundedThreadPool tp = new BoundedThreadPool();
tp.setMaxThreads(50);
SocketConnector conn = new SocketConnector();
String portVariable = System.getProperty("jetty.port");
int port = parsePort(portVariable);
if (port <= 0) {
port = 8081;
}
conn.setPort(port);
conn.setThreadPool(tp);
conn.setAcceptQueueSize(100);
jettyServer.setConnectors(new Connector[] { conn });
WebAppContext wah = new WebAppContext();
wah.setContextPath("/geobatch");
// wah.setWar("target/geobatch");
wah.setWar("src/main/webapp");
jettyServer.setHandler(wah);
wah.setTempDirectory(new File("target/work"));
jettyServer.start();
// use this to test normal stop behavior, that is, to check stuff
// that
// need to be done on container shutdown (and yes, this will make
// jetty stop just after you started it...)
// jettyServer.stop();
} catch (Throwable e) {
log.error("Could not start the Jetty server: " + e.getMessage(), e);
if (jettyServer != null) {
try {
jettyServer.stop();
} catch (Exception e1) {
log.error("Unable to stop the " + "Jetty server:" + e1.getMessage(), e1);
}
}
}
}
private static int parsePort(String portVariable) {
if (portVariable == null) {
return -1;
}
try {
return Integer.valueOf(portVariable).intValue();
} catch (NumberFormatException e) {
return -1;
}
}
}
| [
"damianofds@gmail.com"
] | damianofds@gmail.com |
ed47755df55c29c8052e342877c2104b238179b2 | 48d8ce3ba08e482a2253f7982a01998518a91517 | /src/main/java/com/zte/model/UserInfo.java | e030b2d179779d9ba472a773b6d20e3885ab4dde | [] | no_license | daviddai429/springboot | b7ba3d4653269062da97db2c2e06928932f9dd7a | 340d294baa6c51194d3eb3e25dcfe171f3a30135 | refs/heads/master | 2021-06-27T05:08:13.618945 | 2017-09-17T13:50:11 | 2017-09-17T13:50:11 | 103,832,461 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,759 | java | package com.zte.model;
import java.util.List;
/**
* 用戶信息表
* @author david
*
*/
public class UserInfo extends BaseModel {
private String username;
private String password;
private String usertype;
private Integer enabled;
private String realname;
private String qq;
private String email;
private String tel;
private List<String> roleStrlist;
private List<String> menuStrlist;
public List<String> getMenuStrlist() {
return menuStrlist;
}
public void setMenuStrlist(List<String> menuStrlist) {
this.menuStrlist = menuStrlist;
}
public List<String> getRoleStrlist() {
return roleStrlist;
}
public void setRoleStrlist(List<String> roleStrlist) {
this.roleStrlist = roleStrlist;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getUsertype() {
return usertype;
}
public void setUsertype(String usertype) {
this.usertype = usertype;
}
public Integer getEnabled() {
return enabled;
}
public void setEnabled(Integer enabled) {
this.enabled = enabled;
}
public String getRealname() {
return realname;
}
public void setRealname(String realname) {
this.realname = realname;
}
public String getQq() {
return qq;
}
public void setQq(String qq) {
this.qq = qq;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getTel() {
return tel;
}
public void setTel(String tel) {
this.tel = tel;
}
}
| [
"18766253119@163.com"
] | 18766253119@163.com |
c9d3c9c3a41031b0f80bd9dd0c60949f8fd869a6 | 8e26c45835806b7c19a27676c163bc95a6255a24 | /src/com/shadowburst/bubblechamber/ColourPair.java | 60421f73fc0e401dcf4c0d205b9985d5233a48e7 | [
"Apache-2.0"
] | permissive | orac/bubblechamber | b3dfc81d24ac181d09df60d13894ce4cb11d589b | 305476d71faf7122258a500353a68fd5fedff81d | refs/heads/master | 2020-05-18T18:21:30.264435 | 2012-08-24T13:34:40 | 2012-08-25T14:50:11 | 2,704,482 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 184 | java | package com.shadowburst.bubblechamber;
public class ColourPair {
public int positive;
public int negative;
public ColourPair(int p, int n) {
positive = p;
negative = n;
}
}
| [
"st@istic.org"
] | st@istic.org |
0c31eafa2e7409fa0ef80c628bd673be38ea370c | 0c13449e14bb50987b2a16a8f8798daaae5c44c9 | /hotel/common/jpacommonsecurity/com/jython/serversecurity/jpa/OObjectAdminJpa.java | 438711862d3b604c57111f84d9dca10b458083f4 | [] | no_license | digideskio/javahotel | 68929601930ef6cbee2e6d06fc8b92a764e5663e | 169d131f9e515fa3032fe061e3bcb0512950ffbc | refs/heads/master | 2021-01-13T03:39:34.874305 | 2016-12-06T22:42:42 | 2016-12-06T22:42:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,629 | java | package com.jython.serversecurity.jpa;
/*
* Copyright 2016 stanislawbartkowski@gmail.com
* 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.
*/
import java.util.ArrayList;
import java.util.List;
import javax.inject.Named;
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import javax.persistence.Query;
import com.google.inject.Inject;
import com.gwtmodel.table.common.CUtil;
import com.gwtmodel.table.shared.RMap;
import com.jython.serversecurity.AppInstanceId;
import com.jython.serversecurity.IOObjectAdmin;
import com.jython.serversecurity.OObject;
import com.jython.serversecurity.OObjectRoles;
import com.jython.serversecurity.Person;
import com.jython.serversecurity.jpa.entities.EDictEntry;
import com.jython.serversecurity.jpa.entities.EObject;
import com.jython.serversecurity.jpa.entities.EPersonPassword;
import com.jython.serversecurity.jpa.entities.EPersonRoles;
import com.jython.ui.server.jpatrans.ITransactionContextFactory;
import com.jython.ui.server.jpatrans.JpaTransaction;
import com.jythonui.server.BUtil;
import com.jythonui.server.ISharedConsts;
import com.jythonui.server.UtilHelper;
import com.jythonui.server.getmess.IGetLogMess;
import com.jythonui.server.logmess.IErrorCode;
import com.jythonui.server.logmess.ILogMess;
public class OObjectAdminJpa extends UtilHelper implements IOObjectAdmin {
private final ITransactionContextFactory iC;
private final IGetLogMess lMess;
@Inject
public OObjectAdminJpa(ITransactionContextFactory iC, @Named(ISharedConsts.JYTHONMESSSERVER) IGetLogMess lMess) {
this.iC = iC;
this.lMess = lMess;
}
private abstract class doTransaction extends JpaTransaction {
final AppInstanceId i;
private doTransaction(AppInstanceId i) {
super(iC);
this.i = i;
if (i.getId() == null) {
String mess = lMess.getMess(IErrorCode.ERRORCODE85, ILogMess.INSTANCEIDCANNOTNENULLHERE);
errorLog(mess);
}
}
}
private void addRole(List<OObjectRoles> resList, RMap object, EPersonRoles p) {
OObjectRoles role = new OObjectRoles(object);
for (String r : p.getRoles()) {
role.getRoles().add(r);
}
resList.add(role);
}
private EObject getObjectByName(EntityManager em, AppInstanceId i, String name) {
Query q = em.createNamedQuery("findObjectByName");
q.setParameter(1, i.getId());
q.setParameter(2, name);
try {
EObject hote = (EObject) q.getSingleResult();
return hote;
} catch (NoResultException e) {
return null;
}
}
private EPersonPassword getPersonByName(EntityManager em, AppInstanceId i, String name) {
Query q = em.createNamedQuery("findPersonByName");
q.setParameter(1, i.getId());
q.setParameter(2, name);
try {
EPersonPassword pers = (EPersonPassword) q.getSingleResult();
return pers;
} catch (NoResultException e) {
return null;
}
}
private class GetListOfRolesForPerson extends doTransaction {
private final String person;
private List<OObjectRoles> resList = new ArrayList<OObjectRoles>();
GetListOfRolesForPerson(AppInstanceId i, String person) {
super(i);
this.person = person;
}
@Override
protected void dosth(EntityManager em) {
EPersonPassword pers = getPersonByName(em, i, person);
if (pers == null) {
resList = null;
return;
}
Query q = em.createNamedQuery("getListOfRolesForPerson");
q.setParameter(1, pers);
List<EPersonRoles> list = q.getResultList();
for (EPersonRoles p : list) {
// Query q1 = em.createNamedQuery("findObjectByLong");
// q1.setParameter(1, p.getObject());
// EObject h = (EObject) q1.getSingleResult();
EObject h = p.getObject();
OObject ho = new OObject();
PropUtils.copyToProp(ho, h);
addRole(resList, ho, p);
}
}
}
@Override
public List<OObjectRoles> getListOfRolesForPerson(AppInstanceId i, String person) {
GetListOfRolesForPerson com = new GetListOfRolesForPerson(i, person);
com.executeTran();
return com.resList;
}
private class GetListOfRolesForOObject extends doTransaction {
private final String Object;
private List<OObjectRoles> resList = new ArrayList<OObjectRoles>();
GetListOfRolesForOObject(AppInstanceId i, String Object) {
super(i);
this.Object = Object;
}
@Override
protected void dosth(EntityManager em) {
EObject hote = getObjectByName(em, i, Object);
if (hote == null) {
resList = null;
return;
}
Query q = em.createNamedQuery("getListOfRolesForObject");
q.setParameter(1, hote);
List<EPersonRoles> list = q.getResultList();
for (EPersonRoles p : list) {
EPersonPassword h = p.getPerson();
Person ho = new Person();
PropUtils.copyToProp(ho, h);
addRole(resList, ho, p);
}
}
}
@Override
public List<OObjectRoles> getListOfRolesForObject(AppInstanceId i, String Object) {
GetListOfRolesForOObject comm = new GetListOfRolesForOObject(i, Object);
comm.executeTran();
return comm.resList;
}
private void modifPersonRoles(EntityManager em, EObject object, EPersonPassword pe, OObjectRoles role) {
EPersonRoles eRoles = new EPersonRoles();
eRoles.setObject(object);
eRoles.setPerson(pe);
ArrayList<String> roles = new ArrayList<String>();
for (String ro : role.getRoles()) {
roles.add(ro);
}
eRoles.setRoles(roles);
em.persist(eRoles);
}
private class AddModifOObject extends doTransaction {
private final OObject OObject;
private final List<OObjectRoles> roles;
AddModifOObject(AppInstanceId i, OObject OObject, List<OObjectRoles> roles) {
super(i);
this.OObject = OObject;
this.roles = roles;
}
@Override
protected void dosth(EntityManager em) {
EObject hote = getObjectByName(em, i, OObject.getName());
boolean create = false;
if (hote == null) {
hote = new EObject();
hote.setInstanceId(i.getId());
create = true;
}
PropUtils.copyToEDict(hote, OObject);
BUtil.setCreateModif(i.getPerson(), hote, create);
em.persist(hote);
makekeys();
Query q = em.createNamedQuery("removeRolesForObject");
q.setParameter(1, hote);
q.executeUpdate();
for (OObjectRoles rol : roles) {
Person pe = (Person) rol.getObject();
String person = pe.getName();
EPersonPassword pers = getPersonByName(em, i, person);
modifPersonRoles(em, hote, pers, rol);
}
}
}
@Override
public void addOrModifObject(AppInstanceId i, OObject Object, List<OObjectRoles> roles) {
AddModifOObject comma = new AddModifOObject(i, Object, roles);
comma.executeTran();
}
private class AddModifPerson extends doTransaction {
private final Person person;
private final List<OObjectRoles> roles;
AddModifPerson(AppInstanceId i, Person person, List<OObjectRoles> roles) {
super(i);
this.person = person;
this.roles = roles;
}
@Override
protected void dosth(EntityManager em) {
EPersonPassword pe = getPersonByName(em, i, person.getName());
boolean create = false;
if (pe == null) {
pe = new EPersonPassword();
pe.setInstanceId(i.getId());
create = true;
}
PropUtils.copyToEDict(pe, person);
BUtil.setCreateModif(i.getPerson(), pe, create);
em.persist(pe);
makekeys();
Query q = em.createNamedQuery("removeRolesForPerson");
q.setParameter(1, pe);
q.executeUpdate();
for (OObjectRoles rol : roles) {
OObject ho = (OObject) rol.getObject();
String OObject = ho.getName();
EObject hote = getObjectByName(em, i, OObject);
modifPersonRoles(em, hote, pe, rol);
}
}
}
@Override
public void addOrModifPerson(AppInstanceId i, Person person, List<OObjectRoles> roles) {
AddModifPerson comma = new AddModifPerson(i, person, roles);
comma.executeTran();
}
private class ChangePassword extends doTransaction {
private final String person;
private final String password;
ChangePassword(AppInstanceId i, String person, String password) {
super(i);
this.person = person;
this.password = password;
}
@Override
protected void dosth(EntityManager em) {
EPersonPassword pe = getPersonByName(em, i, person);
pe.setPassword(password);
em.persist(pe);
}
}
@Override
public void changePasswordForPerson(AppInstanceId i, String person, String password) {
ChangePassword comma = new ChangePassword(i, person, password);
comma.executeTran();
}
private class ValidatePassword extends doTransaction {
private final String person;
private final String password;
boolean ok = false;
ValidatePassword(AppInstanceId i, String person, String password) {
super(i);
this.person = person;
this.password = password;
}
@Override
protected void dosth(EntityManager em) {
EPersonPassword pe = getPersonByName(em, i, person);
if (pe == null)
return;
if (CUtil.EmptyS(pe.getPassword()))
return;
ok = password.equals(pe.getPassword());
}
}
@Override
public boolean validatePasswordForPerson(AppInstanceId i, String person, String password) {
ValidatePassword comma = new ValidatePassword(i, person, password);
comma.executeTran();
return comma.ok;
}
private class GetListOfPersons extends doTransaction {
private final List<Person> pList = new ArrayList<Person>();
GetListOfPersons(AppInstanceId i) {
super(i);
}
@Override
protected void dosth(EntityManager em) {
Query q = em.createNamedQuery("findAllPersons");
q.setParameter(1, i.getId());
List<EPersonPassword> resList = q.getResultList();
for (EPersonPassword e : resList) {
Person pe = new Person();
PropUtils.copyToProp(pe, e);
pList.add(pe);
}
}
}
@Override
public List<Person> getListOfPersons(AppInstanceId i) {
GetListOfPersons comma = new GetListOfPersons(i);
comma.executeTran();
return comma.pList;
}
private class GetListOfOObjects extends doTransaction {
private final List<OObject> hList = new ArrayList<OObject>();
GetListOfOObjects(AppInstanceId i) {
super(i);
}
@Override
protected void dosth(EntityManager em) {
Query q = em.createNamedQuery("findAllObjects");
q.setParameter(1, i.getId());
List<EObject> resList = q.getResultList();
for (EObject e : resList) {
OObject ho = new OObject();
PropUtils.copyToProp(ho, e);
hList.add(ho);
}
}
}
@Override
public List<OObject> getListOfObjects(AppInstanceId i) {
GetListOfOObjects comma = new GetListOfOObjects(i);
comma.executeTran();
return comma.hList;
}
private class DeleteAll extends doTransaction {
DeleteAll(AppInstanceId i) {
super(i);
}
@Override
protected void dosth(EntityManager em) {
String[] findAllQ = { "findAllPersons", "findAllObjects" };
String[] removeQ = { "removeRolesForPerson", "removeRolesForObject" };
for (int k = 0; k < findAllQ.length; k++) {
Query q = em.createNamedQuery(findAllQ[k]);
q.setParameter(1, i.getId());
List<EDictEntry> resList = q.getResultList();
for (EDictEntry e : resList) {
Query q1 = em.createNamedQuery(removeQ[k]);
q1.setParameter(1, e);
q1.executeUpdate();
}
}
String[] namedQ = new String[] { "removeAllObjects", "removeAllPersons" };
for (String s : namedQ) {
Query q = em.createNamedQuery(s);
q.setParameter(1, i.getId());
q.executeUpdate();
}
}
}
@Override
public void clearAll(AppInstanceId i) {
info(lMess.getMessN(ILogMess.CLEANALLADMIN));
DeleteAll comm = new DeleteAll(i);
comm.executeTran();
}
private class RemovePerson extends doTransaction {
private final String person;
RemovePerson(AppInstanceId i, String person) {
super(i);
this.person = person;
}
@Override
protected void dosth(EntityManager em) {
EPersonPassword pe = getPersonByName(em, i, person);
Query q = em.createNamedQuery("removeRolesForPerson");
q.setParameter(1, pe);
q.executeUpdate();
em.remove(pe);
}
}
@Override
public void removePerson(AppInstanceId i, String person) {
RemovePerson comma = new RemovePerson(i, person);
comma.executeTran();
}
private class RemoveOObject extends doTransaction {
private final String OObject;
RemoveOObject(AppInstanceId i, String OObject) {
super(i);
this.OObject = OObject;
}
@Override
protected void dosth(EntityManager em) {
EObject hote = getObjectByName(em, i, OObject);
Query q = em.createNamedQuery("removeRolesForObject");
q.setParameter(1, hote);
q.executeUpdate();
em.remove(hote);
}
}
@Override
public void removeObject(AppInstanceId i, String OObject) {
RemoveOObject comma = new RemoveOObject(i, OObject);
comma.executeTran();
}
private class GetPassword extends doTransaction {
private final String person;
String password;
GetPassword(AppInstanceId i, String person) {
super(i);
this.person = person;
password = null;
}
@Override
protected void dosth(EntityManager em) {
EPersonPassword pe = getPersonByName(em, i, person);
if (pe == null)
return;
if (CUtil.EmptyS(pe.getPassword()))
return;
password = pe.getPassword();
}
}
@Override
public String getPassword(AppInstanceId i, String person) {
GetPassword comm = new GetPassword(i, person);
comm.executeTran();
return comm.password;
}
}
| [
"stanislawbartkowski@gmail.com"
] | stanislawbartkowski@gmail.com |
3d4824d6de4dfbec228671e330cdcace61954c81 | 57607404d2006cfd6ce5098b73d4ab2a5015c702 | /src/grades.java | 835ca99f6d0d2ac09866cfa232483fa5cf6c4954 | [] | no_license | agregforrester/pset-3 | e5939a0f346f318767e3db18f4349262a9022bb9 | ca76eb15f9703434390d5fb0e470b74bea3da3c9 | refs/heads/master | 2022-12-24T12:44:52.988341 | 2020-09-28T20:59:31 | 2020-09-28T20:59:31 | 296,691,240 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,239 | java | import java.util.Scanner;
public class grades {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Homework 1 : ");
double homework1 = in.nextDouble();
in.nextLine();
System.out.println("Homework 2 : ");
double homework2 = in.nextDouble();
in.nextLine();
System.out.println("Homework 3 : ");
double homework3 = in.nextDouble();
in.nextLine();
System.out.println("Quiz 1 : ");
double quiz1 = in.nextDouble();
in.nextLine();
System.out.println("Quiz 2 : ");
double quiz2 = in.nextDouble();
in.nextLine();
System.out.println("Test 1 : ");
double test1 = in.nextDouble();
double finalGrade = (((homework1 + homework2 + homework3) / 3) * .15) + (((quiz1 + quiz2) / 2) * .35) + (test1 * .5);
System.out.println(" ");
System.out.printf("%.2f", finalGrade); System.out.println("%.");
in.close();
}
} | [
"agregforrester@gmail.com"
] | agregforrester@gmail.com |
d59401a1593ed1aac6a9e8f8bd19a4b8c61f361b | 6260b4be792a7efc35bb333de9a62ffba23344e3 | /app/src/main/java/com/harunkor/androidgifviewsample/GifImageView.java | a0c54c00db73b6b5c7ace9d48480c99141031594 | [] | no_license | harunkor/AndroidGifViewSample | cfc58d666ba4c51aa504ee6c2f5e09f8adecb0c5 | 98a8568932130053dfff967c79b58d3959f9cd89 | refs/heads/master | 2021-01-20T00:06:17.381656 | 2017-04-22T15:30:09 | 2017-04-22T15:30:09 | 89,079,834 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,444 | java | package com.harunkor.androidgifviewsample;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Movie;
import android.net.Uri;
import android.os.SystemClock;
import android.util.AttributeSet;
import android.view.View;
import java.io.FileNotFoundException;
import java.io.InputStream;
/**
* Created by harunkor on 22.04.2017.
*/
public class GifImageView extends View {
private InputStream mInputStream;
private Movie mMovie;
private int mWidth, mHeight;
private long mStart;
private Context mContext;
public GifImageView(Context context) {
super(context);
this.mContext=context;
}
public GifImageView(Context context, AttributeSet attributeSet)
{
this(context,attributeSet,0);
}
public GifImageView(Context context,AttributeSet attributeSet,int defStyleattr)
{
super(context,attributeSet,defStyleattr);
this.mContext=context;
if(attributeSet.getAttributeName(1).equals("background"))
{
int id=Integer.parseInt(attributeSet.getAttributeName(1).substring(1));
setGifImageResource(id);
}
}
private void init()
{
setFocusable(true);
mMovie=Movie.decodeStream(mInputStream);
mWidth=mMovie.width();
mHeight=mMovie.height();
requestLayout();
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
setMeasuredDimension(mWidth,mHeight);
}
@Override
protected void onDraw(Canvas canvas) {
long now= SystemClock.uptimeMillis();
if(mStart==0)
{
mStart=now;
}
if(mMovie!=null)
{
int duration = mMovie.duration();
if(duration==0)
{
duration=1000;
}
int relTime=(int) ((now-mStart) % duration);
mMovie.setTime(relTime);
mMovie.draw(canvas,0,0);
invalidate();
}
}
public void setGifImageResource(int id)
{
mInputStream=mContext.getResources().openRawResource(id);
init();
}
public void setGifImageUri(Uri uri)
{
try {
mInputStream=mContext.getContentResolver().openInputStream(uri);
init();
}catch (FileNotFoundException e)
{
e.printStackTrace();
}
}
}
| [
"harunkor@HARUN-MacBook-Pro.local"
] | harunkor@HARUN-MacBook-Pro.local |
163d3c44c99c64cc294c55a82ddd0b9b9d1b0fff | c9edd21bdf3e643fe182c5b0f480d7deb218737c | /dy-agent-log4j/dy-agent-log4j-core/src/main/java/com/hust/foolwc/dy/agent/log4j/core/util/datetime/DateParser.java | 730fc21b42aa69c14b15b3856b85e500bf7b0f3c | [] | no_license | foolwc/dy-agent | f302d2966cf3ab9fe8ce6872963828a66ca8a34e | d7eca9df2fd8c4c4595a7cdc770d6330e7ab241c | refs/heads/master | 2022-11-22T00:13:52.434723 | 2022-02-18T09:39:15 | 2022-02-18T09:39:15 | 201,186,332 | 10 | 4 | null | 2022-11-16T02:45:38 | 2019-08-08T05:44:02 | Java | UTF-8 | Java | false | false | 5,132 | 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.hust.foolwc.dy.agent.log4j.core.util.datetime;
import java.text.ParseException;
import java.text.ParsePosition;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
/**
* DateParser is the "missing" interface for the parsing methods of
* {@link java.text.DateFormat}. You can obtain an object implementing this
* interface by using one of the FastDateFormat factory methods.
* <p>
* Warning: Since binary compatible methods may be added to this interface in any
* release, developers are not expected to implement this interface.
*
* <p>
* Copied and modified from <a href="https://commons.apache.org/proper/commons-lang/">Apache Commons Lang</a>.
* </p>
*
* @since Apache Commons Lang 3.2
*/
public interface DateParser {
/**
* Equivalent to DateFormat.parse(String).
*
* See {@link java.text.DateFormat#parse(String)} for more information.
* @param source A <code>String</code> whose beginning should be parsed.
* @return A <code>Date</code> parsed from the string
* @throws ParseException if the beginning of the specified string cannot be parsed.
*/
Date parse(String source) throws ParseException;
/**
* Equivalent to DateFormat.parse(String, ParsePosition).
*
* See {@link java.text.DateFormat#parse(String, ParsePosition)} for more information.
*
* @param source A <code>String</code>, part of which should be parsed.
* @param pos A <code>ParsePosition</code> object with index and error index information
* as described above.
* @return A <code>Date</code> parsed from the string. In case of error, returns null.
* @throws NullPointerException if text or pos is null.
*/
Date parse(String source, ParsePosition pos);
/**
* Parses a formatted date string according to the format. Updates the Calendar with parsed fields.
* Upon success, the ParsePosition index is updated to indicate how much of the source text was consumed.
* Not all source text needs to be consumed. Upon parse failure, ParsePosition error index is updated to
* the offset of the source text which does not match the supplied format.
*
* @param source The text to parse.
* @param pos On input, the position in the source to start parsing, on output, updated position.
* @param calendar The calendar into which to set parsed fields.
* @return true, if source has been parsed (pos parsePosition is updated); otherwise false (and pos errorIndex is updated)
* @throws IllegalArgumentException when Calendar has been set to be not lenient, and a parsed field is
* out of range.
*
* @since 3.5
*/
boolean parse(String source, ParsePosition pos, Calendar calendar);
// Accessors
//-----------------------------------------------------------------------
/**
* <p>Gets the pattern used by this parser.</p>
*
* @return the pattern, {@link java.text.SimpleDateFormat} compatible
*/
String getPattern();
/**
* <p>
* Gets the time zone used by this parser.
* </p>
*
* <p>
* The default {@link TimeZone} used to create a {@link Date} when the {@link TimeZone} is not specified by
* the format pattern.
* </p>
*
* @return the time zone
*/
TimeZone getTimeZone();
/**
* <p>Gets the locale used by this parser.</p>
*
* @return the locale
*/
Locale getLocale();
/**
* Parses text from a string to produce a Date.
*
* @param source A <code>String</code> whose beginning should be parsed.
* @return a <code>java.util.Date</code> object
* @throws ParseException if the beginning of the specified string cannot be parsed.
* @see java.text.DateFormat#parseObject(String)
*/
Object parseObject(String source) throws ParseException;
/**
* Parses a date/time string according to the given parse position.
*
* @param source A <code>String</code> whose beginning should be parsed.
* @param pos the parse position
* @return a <code>java.util.Date</code> object
* @see java.text.DateFormat#parseObject(String, ParsePosition)
*/
Object parseObject(String source, ParsePosition pos);
}
| [
"liwencheng@douyu.tv"
] | liwencheng@douyu.tv |
86ff2840b9e7be8b517357fc984bf05aa69e5017 | 4d0c8db0342cdc1ba109ffcfda77fda9514b77a7 | /src/hawox/uquest/PluginListener.java | daabdab1f725ab730cc913d22c1ed5f22dd04427 | [] | no_license | Elephunk/uQuest | cc72560bc2afb4592f73545e7a8d4e813053f151 | 44b79f81853f32d117b189cff0e8abd41a17668a | refs/heads/master | 2021-01-18T05:50:53.711877 | 2011-05-05T03:57:13 | 2011-05-05T03:57:13 | 1,689,984 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,221 | java | package hawox.uquest;
import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.event.server.ServerListener;
import org.bukkit.plugin.Plugin;
import com.earth2me.essentials.Essentials;
import com.nijiko.coelho.iConomy.iConomy;
import com.nijikokun.bukkit.Permissions.Permissions;
import cosine.boseconomy.BOSEconomy;
/**
* Checks for plugins whenever one is enabled
*/
public class PluginListener extends ServerListener {
public PluginListener() { }
@Override
public void onPluginEnable(PluginEnableEvent event) {
if(UQuest.getiConomy() == null) {
Plugin iConomy = UQuest.getBukkitServer().getPluginManager().getPlugin("iConomy");
if (iConomy != null) {
if(iConomy.isEnabled()) {
UQuest.setiConomy((iConomy)iConomy);
System.out.println("[uQuest] Successfully linked with iConomy.");
}
}
}
if(UQuest.getPermissions() == null){
Plugin Permissions = UQuest.getBukkitServer().getPluginManager().getPlugin("Permissions");
if (Permissions != null) {
if(Permissions.isEnabled()){
UQuest.setPermissions(((Permissions) Permissions).getHandler());
System.out.println("[uQuest] Successfully linked with Permissions.");
}
}
}
if(UQuest.getBOSEconomy() == null){
Plugin BOSEconomy = UQuest.getBukkitServer().getPluginManager().getPlugin("BOSEconomy");
if (BOSEconomy != null) {
if(BOSEconomy.isEnabled()){
UQuest.setBOSEconomy((BOSEconomy) BOSEconomy);
System.out.println("[uQuest] Successfully linked with BOSEconomy.");
}
}
}
if(UQuest.getEssentials() == null){
Plugin Essentials = UQuest.getBukkitServer().getPluginManager().getPlugin("Essentials");
if (Essentials != null) {
if(Essentials.isEnabled()){
UQuest.setEssentials((Essentials) Essentials);
System.out.println("[uQuest] Successfully linked with Essentials.");
}
}
}
}
} | [
"thehawox@gmail.com"
] | thehawox@gmail.com |
8fbb4a44d4b00f0b3a4bd1019038941735094859 | 34fa725679633f757a2b758f6eebb699d72488e8 | /task-manager/src/main/java/com/colpatria/taskmanager/commons/domains/generic/UserDTO.java | 2e7754814e5970cafc5a898c5131d88a044f4849 | [] | no_license | jsquimbayo/Colpatria-Task-manager | 88f2b6510a34fd5dd6fb1b3b1aae3c416571a2b0 | ec74d74d65bebb6f81812de6023ee0213e7940fe | refs/heads/main | 2023-09-05T23:17:53.125096 | 2021-11-18T18:43:50 | 2021-11-18T18:43:50 | 429,539,907 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 384 | java | package com.colpatria.taskmanager.commons.domains.generic;
import lombok.*;
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Builder
public class UserDTO {
private String idUser;
private String nameUser;
private String lastNameUser;
private String identUser;
private String mailUser;
private String loginNameUser;
private String passwordUser;
}
| [
"jsquimbayo@soaint.com"
] | jsquimbayo@soaint.com |
f43a109e10421f61f42afef4e8b4a1efab2b729d | b96387cf04a4a82754762f87294564d2b2ffcd71 | /src/main/java/com/gishere/aicamera/config/http/domain/push/SmartData.java | ba7bfa0da2ba7aa1af3b8133ab4ec78485feac4d | [] | no_license | nixuechao/ai-camera | 91dc80786e4b414609709b943d0f6786e3b0cab3 | ffba0cd4e19b39d1d5d47df2598def53f302367d | refs/heads/main | 2023-03-20T00:16:34.460759 | 2021-03-08T14:02:24 | 2021-03-08T14:02:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 589 | java | package com.gishere.aicamera.config.http.domain.push;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import lombok.Data;
import com.gishere.aicamera.config.http.domain.push.smart.*;
/**
* @author niXueChao
* @date 2021/2/4.
*/
@JsonAutoDetect(getterVisibility=JsonAutoDetect.Visibility.NONE)
@Data
public class SmartData {
/**
* 抓拍
*/
private Face Face;
/**
* 过线
*/
private FlowEvent FlowEvent;
/**
* 客流统计
*/
private FlowStats FlowStats;
/**
* 数据识别
*/
private Feature Feature;
}
| [
"nixuechao@live.com"
] | nixuechao@live.com |
fde6b5781035dd1c33d30dfbfd0df4f88a784392 | 720ba343ce147af5b3881679e3b2aebd21d62910 | /multi-language/src/main/java/com/greentea/multilang/controller/FileController.java | 65333afcdfa7117f3746a16a30243b7156ad1de5 | [] | no_license | tomlxq/ShowCase | 698ffdaf16979c8197cba5a1f97c179b25617281 | 17717c3411c98ede281c75a747ff3583b82e5997 | refs/heads/master | 2021-01-20T10:10:49.638899 | 2018-11-22T16:31:56 | 2018-11-22T16:31:56 | 28,090,123 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,678 | java | package com.greentea.multilang.controller;
import org.apache.commons.io.FileUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
/**
* 说明:
*
* @author tom
* @version 创建时间: 2015/1/12 20:47
*/ @Controller
public class FileController {
@RequestMapping("/file")
public ModelAndView showContacts() {
Map model = new HashMap();
return new ModelAndView("file", model);
}
@RequestMapping(value = "/file", method = RequestMethod.POST)
public void addUser(@RequestParam MultipartFile[] file_upload, HttpServletRequest request) throws IOException {
//如果只是上传一个文件,则只需要MultipartFile类型接收文件即可,而且无需显式指定@RequestParam注解
//如果想上传多个文件,那么这里就要用MultipartFile[]类型来接收文件,并且还要指定@RequestParam注解
//并且上传多个文件时,前台表单中的所有<input type="file"/>的name都应该是myfiles,否则参数里的myfiles无法获取到所有上传的文件
for (MultipartFile file : file_upload) {
if (file.isEmpty()) {
System.out.println("文件未上传");
} else {
System.out.println("文件长度: " + file.getSize());
System.out.println("文件类型: " + file.getContentType());
System.out.println("文件名称: " + file.getName());
System.out.println("文件原名: " + file.getOriginalFilename());
System.out.println("========================================");
//如果用的是Tomcat服务器,则文件会上传到\\%TOMCAT_HOME%\\webapps\\YourWebProject\\WEB-INF\\upload\\文件夹中
String realPath = request.getSession().getServletContext().getRealPath("/WEB-INF/upload");
FileUtils.forceMkdir(new File(realPath));
//这里不必处理IO流关闭的问题,因为FileUtils.copyInputStreamToFile()方法内部会自动把用到的IO流关掉,我是看它的源码才知道的
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(realPath, file.getOriginalFilename()));
}
}
}
}
| [
"21429503@qq.com"
] | 21429503@qq.com |
2ee09bb86bee13e8ebebf267d16d55aa90313e54 | eace8b32a87489266bec9f2a867f89e6b9caa5e7 | /GingerUI/gingerui/src/main/java/com/spicerack/framework/frameworkutilities/LogUtil.java | 72a68f794e6887fee2e02342367343d04c92a6cd | [] | no_license | nageshphaniraj81/SpiceRack | d3e161918b9f4a7c40b23f9762f991df98d13699 | 4a3078f426f46d3d8c9cb491bf2ce65e0c9b5cdd | refs/heads/master | 2021-01-20T02:42:30.159445 | 2019-03-14T10:40:31 | 2019-03-14T10:40:31 | 89,444,622 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,040 | java | /*
*
*/
package com.spicerack.framework.frameworkutilities;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import com.spicerack.framework.configuration.ConfigReader;
import com.spicerack.framework.configuration.Settings;
/**
* The Class LogUtil used to generate userdefined logs
*/
public class LogUtil {
/** The date. */
// File format for the log file
ZonedDateTime date = ZonedDateTime.now();
/** The formatter. */
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("ddMMyyyyHHMMSS");
/** The file name format. */
String fileNameFormat = date.format(formatter);
/** The buffered writter. */
private BufferedWriter bufferedWritter = null;
/**
* Instantiates a new log util.
*
* @throws IOException
* Signals that an I/O exception has occurred.
*/
public LogUtil() throws IOException{
// Initializing configuration Settings
ConfigReader.populateSetting();
}
/**
* Creates the log file in the location specified in
* Global Configuration properties file.
*/
private void CreateLogFile() {
try {
File dir = new File(Settings.LogFolder);
if (!dir.exists())
dir.mkdir();
File logFile = new File(dir + "/" +fileNameFormat+".log");
FileWriter fileWriter = new FileWriter(logFile.getAbsolutePath());
bufferedWritter = new BufferedWriter(fileWriter);
} catch (Exception e) {
System.out.println(e.toString());
}
}
/**
* To write the log message in the log.
*
* @param message
* the message
*/
public void Write(String message) {
CreateLogFile();
try {
formatter = DateTimeFormatter.ofPattern("dd-MM-yy:HH_MM_SS");
String dateFormat = date.format(formatter);
bufferedWritter.write(" ["+dateFormat+"] "+message);
bufferedWritter.newLine();
bufferedWritter.flush();
} catch (Exception e) {
System.out.println(e.toString());
}
}
}
| [
"nageshphaniraj81@gmail.com"
] | nageshphaniraj81@gmail.com |
73b11f24de4827e09e7acff07e9531775161af9c | af6cb688760ffd70603efffa285e8469ecaf7834 | /springbootfirst/src/test/java/com/faramarz/spring/springbootfirst/SpringbootfirstApplicationTests.java | 5457ece98b999c9aa0a72d67dd3119d82c92154d | [] | no_license | faramarzaf/SpringReference | fcf84de7399e14d986c51136aa18a6206d7d282b | e953e341c9d43fa04afe850ad2f83876127f0d6a | refs/heads/main | 2023-06-20T18:44:23.564653 | 2021-07-30T08:03:35 | 2021-07-30T08:05:21 | 376,356,228 | 0 | 0 | null | 2021-07-29T20:52:40 | 2021-06-12T18:10:56 | Java | UTF-8 | Java | false | false | 236 | java | package com.faramarz.spring.springbootfirst;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class SpringbootfirstApplicationTests {
@Test
void contextLoads() {
}
}
| [
"faramarzafzali@gmail.com"
] | faramarzafzali@gmail.com |
d1af8f9ef0cfd6714965446280218178bf561718 | 90ccb066437d0323009c32c3cec1592e10a7e0b9 | /SGame/app/src/main/java/kr/ac/kpu/game/s2016180003/sgame/framework/GameBitmap.java | 966d17756827daa006c7c5a7db93f5b171da3740 | [] | no_license | hd3379/SGPProjects | 7bdcb905a7b0f712c5802058bf0fdb6cae8e6968 | 28d86491504990cd8194a344129e3f57425c77a0 | refs/heads/main | 2023-05-22T08:24:00.083249 | 2021-06-10T19:33:43 | 2021-06-10T19:33:43 | 350,710,057 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 784 | java | package kr.ac.kpu.game.s2016180003.sgame.framework;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import java.util.HashMap;
import kr.ac.kpu.game.s2016180003.sgame.view.GameView;
public class GameBitmap {
private static HashMap<Integer, Bitmap> bitmaps = new HashMap<Integer, Bitmap>();
protected Bitmap load(int resId) {
Bitmap bitmap = bitmaps.get(resId);
if(bitmap == null) {
Resources res = GameView.view.getResources();
BitmapFactory.Options opts = new BitmapFactory.Options();
opts.inScaled = false;
bitmap = BitmapFactory.decodeResource(res, resId, opts);
bitmaps.put(resId, bitmap);
}
return bitmap;
}
}
| [
"hd3379@naver.com"
] | hd3379@naver.com |
46b97f43aca46ae6e21cb3f2448e6ce9ec72a9ba | 3cc4d5e841e30b5717a6fb2fdb05b12405b2d3ce | /RobotOnTiles/src/main/java/assignment/home/tina/Translator.java | 071bb45e49eaa9292158d419220c1a2c6823911a | [] | no_license | stortina/AuditionStortina | 1ff198974281f0261ad5a28a6111bc3676fb9039 | 3cbf50cbace9d08545aa0c412dcd6633a7192e92 | refs/heads/master | 2020-12-25T19:26:21.957482 | 2012-03-26T19:33:55 | 2012-03-26T19:33:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,482 | java | package assignment.home.tina;
//import java.util.regex.Matcher;
//import java.util.regex.Pattern;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Translator {
private final static Logger LOG = LoggerFactory.getLogger(Translator.class .getSimpleName());
public static String translateEnlighsOrdersToSwedish (String commands){
commands = commands.replaceAll("L", "V");
commands = commands.replaceAll("R", "H");
commands = commands.replaceAll("F", "G");
return commands;
}
public static String getDirectionAsCompass(int currentRotation, boolean english){
switch( currentRotation ){
case 0: {
return "N";
}
case 90: {
return english? "E": "Ö"; //East is to the right on a map!
}
case 180: {
return "S";
}
case 270: {
return english? "W": "V";//West is to the left on a map!
}
default: return null;
}
}
}
//public static String tidyUpCommands(String commands, boolean useEnglish){
//
//LOG.info("Receiving a String of length {}", commands.length());
//
//String tidyCommands = commands;
//
//String regex_anyCharBut = ( useEnglish ) ? "[^FLRflr]" : "[^GHVghv]";
//
// tidyCommands = Pattern.compile(regex_anyCharBut).matcher(tidyCommands).replaceAll("");
// tidyCommands = tidyCommands.toUpperCase(Locale.ENGLISH);
//
//
// LOG.info("no length is: ", tidyCommands.length());
//return tidyCommands;
//}
| [
"stortina@gmail.com"
] | stortina@gmail.com |
64fe5dcb7859611e3f1ded36e5a1d50d13318ea0 | 66e307e4a2ed39ae7de82759d6c6f8b1eb278484 | /src/main/java/br/ifpe/pp2/controller/VideoAulaController.java | 8928c7e4a27b66dfc66b476e646fad9aeee76923 | [] | no_license | TaisSantana/Projeto-2-IFPE | 445d73fad8ef054c954d2c4cc96544cffb0477c3 | 334bd2bbffc03bf673c37ebd6fea22b43d3d2a38 | refs/heads/master | 2023-08-14T22:56:05.731634 | 2021-08-17T03:02:08 | 2021-08-17T03:02:08 | 368,006,597 | 0 | 1 | null | 2021-08-17T03:02:09 | 2021-05-16T23:35:38 | CSS | UTF-8 | Java | false | false | 71 | java | package br.ifpe.pp2.controller;
public class VideoAulaController {
}
| [
"54585626+TaisSantana@users.noreply.github.com"
] | 54585626+TaisSantana@users.noreply.github.com |
4e7956a478c7b71287a114c4fd1d915e44b288b2 | 8f7d1e218613839fc5bf1daec09aa1a80bdc29da | /src/main/java/com/orange/entity/ListSortUtil.java | 0130997db9f77ba3d967d3cabf170cce5b9a8f87 | [] | no_license | Alex429/gittest | 320fd096a9b15e6211f37f949261be1fb639cc92 | 25d4f2cdcfa3a2090ef1d71d976e42c1992e4ac5 | refs/heads/master | 2020-03-22T09:26:35.039120 | 2018-07-05T11:42:44 | 2018-07-05T11:42:44 | 139,837,607 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,798 | java | package com.orange.entity;
import java.lang.reflect.Method;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
public class ListSortUtil<T> {
/**
* @param targetList 要排序的集合(使用泛型)
* @param sortField 要排序的集合中的实体类的某个字段
* @param sortMode 排序的方式(升序asc/降序desc)
*/
@SuppressWarnings({"unchecked", "rawtypes"})
public void sort(List<T> targetList, final String sortField, final String sortMode) {
//使用集合的sort方法 ,并且自定义一个排序的比较器
/**
* API文档:
* public static <T> void sort(List<T> list,Comparator<? super T> c)
* 根据指定比较器产生的顺序对指定列表进行排序。此列表内的所有元素都必须可使用指定比较器 相互比较
* (也就是说,对于列表中的任意 e1 和 e2 元素, c.compare(e1, e2) 不得抛出 ClassCastException)。
* 参数: list - 要排序的列表。
* c - 确定列表顺序的比较器。 null 值指示应该使用元素的 自然顺序。
*/
Collections.sort(targetList, new Comparator() {
//匿名内部类,重写compare方法
public int compare(Object obj1, Object obj2) {
int result = 0;
try {
//首字母转大写
String newStr = sortField.substring(0, 1).toUpperCase() + sortField.replaceFirst("\\w", "");
//获取需要排序字段的“get方法名”
String methodStr = "get" + newStr;
/** API文档::
* getMethod(String name, Class<?>... parameterTypes)
* 返回一个 Method 对象,它反映此 Class 对象所表示的类或接口的指定公共成员方法。
*/
Method method1 = ((T) obj1).getClass().getMethod(methodStr, null);
Method method2 = ((T) obj2).getClass().getMethod(methodStr, null);
if (sortMode != null && "desc".equals(sortMode)) {
/**
* Method类代表一个方法,invoke(调用)就是调用Method类代表的方法。
* 它可以让你实现动态调用,也可以动态的传入参数。
* API文档:(这个英文解释更地道易懂,原谅我是英文渣,哎!)
* invoke(Object obj, Object... args)
* Invokes the underlying method represented by this Method object,
* on the specified object with the specified parameters.
*/
/** API文档:
* String-----public int compareTo(String anotherString)
* 按字典顺序比较两个字符串。该比较基于字符串中各个字符的 Unicode 值。
* 按字典顺序将此 String 对象表示的字符序列与参数字符串所表示的字符序列进行比较
*/
result = method2.invoke(((T) obj2), null).toString()
.compareTo(method1.invoke(((T) obj1), null).toString()); // 倒序
} else {
result = method1.invoke(((T) obj1), null).toString()
.compareTo(method2.invoke(((T) obj2), null).toString()); // 正序
}
} catch (Exception e) {
throw new RuntimeException();
}
return result;
}
});
}
} | [
"1007098107@qq.com"
] | 1007098107@qq.com |
4bdf2f8539e1863729244f523c8469a49e46e5c9 | 89dc8e394218cb49b4d3d46f0bbd1db4b010fed7 | /idea2/ProjectSpringmvc/src/com/systop/controller/ProController.java | 90c7b81917fd048047399a045cc349b2e7a0530e | [] | no_license | cloud-star-player/java-test | 90ee45a78a3a6a69d5e588cad5e2360fd59e7ffc | dbad0c81a291a7b9c2cf324cf8fd0e83da451b93 | refs/heads/master | 2022-12-04T16:20:29.788999 | 2020-08-15T11:17:35 | 2020-08-15T11:17:35 | 287,731,861 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,671 | java | package com.systop.controller;
import java.util.List;
import java.util.UUID;
import java.io.File;
import java.net.URLEncoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.systop.pojo.UserLogin;
import com.systop.service.UserLoginService;
@Controller
public class ProController {
@Autowired
private UserLoginService useLoginService;
@RequestMapping("/tologin")
public String tologin(){
return "login";
}
@RequestMapping("/login")
public String tocustomer() {
return "customer";
}
@PostMapping(value = "/user/{usercode}/{password}")
public @ResponseBody
Integer selectUser(@PathVariable("usercode") String usercode, @PathVariable("password") String password, HttpSession session) throws Exception {
UserLogin a =useLoginService.login(usercode,password);
session.setAttribute("user",a);
int b = 1;
if (a != null) {
b = 1;
} else {
b = 0;
}
return b;
}
}
| [
"2906801776@qq.com"
] | 2906801776@qq.com |
1d96e099a9719ce339867eacd32fa21c7618e92a | 3ad3b08bd84691cb40de4c3835218a39556852d6 | /Java prototype/src/SettingsPage.java | 85365ef5c0ea345fd86c94cf426ee0226cea18f1 | [] | no_license | SomeBeavers/StyleClassification | fe3cea483eab35153445bdaf8320f6a0852beee2 | 7b8634b7736cee8533fd611bc98679855ac6290e | refs/heads/master | 2021-06-16T19:44:09.682056 | 2017-04-18T15:41:38 | 2017-04-18T15:41:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,054 | java | import BayesClassifier.DBHelper;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;
@WebServlet(name = "SettingsPage")
// Servlet for handling Settings page.
public class SettingsPage extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
request.setAttribute("IsAdmin", CommonMethods.ConnectToDBAndCheckUser());
request.setAttribute("usernameDisplay", DBHelper.user);
RequestDispatcher view = request.getRequestDispatcher("SettingsPage.jsp");
view.forward(request, response);
}
}
| [
"Lilija146@yandex.ru"
] | Lilija146@yandex.ru |
52c0853825c8ddebd6c6ec7a1c509e207eb8aa37 | fec4a09f54f4a1e60e565ff833523efc4cc6765a | /Dependencies/work/decompile-00fabbe5/net/minecraft/world/level/levelgen/feature/WorldGenDungeons.java | b200edc481ef21c92009fdd6bdc8d453560ef46e | [] | no_license | DefiantBurger/SkyblockItems | 012d2082ae3ea43b104ac4f5bf9eeb509889ec47 | b849b99bd4dc52ae2f7144ddee9cbe2fd1e6bf03 | refs/heads/master | 2023-06-23T17:08:45.610270 | 2021-07-27T03:27:28 | 2021-07-27T03:27:28 | 389,780,883 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,443 | java | package net.minecraft.world.level.levelgen.feature;
import com.mojang.serialization.Codec;
import java.util.Iterator;
import java.util.Random;
import java.util.function.Predicate;
import net.minecraft.SystemUtils;
import net.minecraft.core.BlockPosition;
import net.minecraft.core.EnumDirection;
import net.minecraft.tags.TagsBlock;
import net.minecraft.world.entity.EntityTypes;
import net.minecraft.world.level.GeneratorAccessSeed;
import net.minecraft.world.level.IBlockAccess;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.TileEntity;
import net.minecraft.world.level.block.entity.TileEntityLootable;
import net.minecraft.world.level.block.entity.TileEntityMobSpawner;
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.level.levelgen.feature.configurations.WorldGenFeatureEmptyConfiguration;
import net.minecraft.world.level.levelgen.structure.StructurePiece;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.storage.loot.LootTables;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class WorldGenDungeons extends WorldGenerator<WorldGenFeatureEmptyConfiguration> {
private static final Logger LOGGER = LogManager.getLogger();
private static final EntityTypes<?>[] MOBS = new EntityTypes[]{EntityTypes.SKELETON, EntityTypes.ZOMBIE, EntityTypes.ZOMBIE, EntityTypes.SPIDER};
private static final IBlockData AIR = Blocks.CAVE_AIR.getBlockData();
public WorldGenDungeons(Codec<WorldGenFeatureEmptyConfiguration> codec) {
super(codec);
}
@Override
public boolean generate(FeaturePlaceContext<WorldGenFeatureEmptyConfiguration> featureplacecontext) {
Predicate<IBlockData> predicate = WorldGenerator.a(TagsBlock.FEATURES_CANNOT_REPLACE.a());
BlockPosition blockposition = featureplacecontext.d();
Random random = featureplacecontext.c();
GeneratorAccessSeed generatoraccessseed = featureplacecontext.a();
boolean flag = true;
int i = random.nextInt(2) + 2;
int j = -i - 1;
int k = i + 1;
boolean flag1 = true;
boolean flag2 = true;
int l = random.nextInt(2) + 2;
int i1 = -l - 1;
int j1 = l + 1;
int k1 = 0;
BlockPosition blockposition1;
int l1;
int i2;
int j2;
for (l1 = j; l1 <= k; ++l1) {
for (i2 = -1; i2 <= 4; ++i2) {
for (j2 = i1; j2 <= j1; ++j2) {
blockposition1 = blockposition.c(l1, i2, j2);
Material material = generatoraccessseed.getType(blockposition1).getMaterial();
boolean flag3 = material.isBuildable();
if (i2 == -1 && !flag3) {
return false;
}
if (i2 == 4 && !flag3) {
return false;
}
if ((l1 == j || l1 == k || j2 == i1 || j2 == j1) && i2 == 0 && generatoraccessseed.isEmpty(blockposition1) && generatoraccessseed.isEmpty(blockposition1.up())) {
++k1;
}
}
}
}
if (k1 >= 1 && k1 <= 5) {
for (l1 = j; l1 <= k; ++l1) {
for (i2 = 3; i2 >= -1; --i2) {
for (j2 = i1; j2 <= j1; ++j2) {
blockposition1 = blockposition.c(l1, i2, j2);
IBlockData iblockdata = generatoraccessseed.getType(blockposition1);
if (l1 != j && i2 != -1 && j2 != i1 && l1 != k && i2 != 4 && j2 != j1) {
if (!iblockdata.a(Blocks.CHEST) && !iblockdata.a(Blocks.SPAWNER)) {
this.a(generatoraccessseed, blockposition1, WorldGenDungeons.AIR, predicate);
}
} else if (blockposition1.getY() >= generatoraccessseed.getMinBuildHeight() && !generatoraccessseed.getType(blockposition1.down()).getMaterial().isBuildable()) {
generatoraccessseed.setTypeAndData(blockposition1, WorldGenDungeons.AIR, 2);
} else if (iblockdata.getMaterial().isBuildable() && !iblockdata.a(Blocks.CHEST)) {
if (i2 == -1 && random.nextInt(4) != 0) {
this.a(generatoraccessseed, blockposition1, Blocks.MOSSY_COBBLESTONE.getBlockData(), predicate);
} else {
this.a(generatoraccessseed, blockposition1, Blocks.COBBLESTONE.getBlockData(), predicate);
}
}
}
}
}
l1 = 0;
while (l1 < 2) {
i2 = 0;
while (true) {
if (i2 < 3) {
label100:
{
j2 = blockposition.getX() + random.nextInt(i * 2 + 1) - i;
int k2 = blockposition.getY();
int l2 = blockposition.getZ() + random.nextInt(l * 2 + 1) - l;
BlockPosition blockposition2 = new BlockPosition(j2, k2, l2);
if (generatoraccessseed.isEmpty(blockposition2)) {
int i3 = 0;
Iterator iterator = EnumDirection.EnumDirectionLimit.HORIZONTAL.iterator();
while (iterator.hasNext()) {
EnumDirection enumdirection = (EnumDirection) iterator.next();
if (generatoraccessseed.getType(blockposition2.shift(enumdirection)).getMaterial().isBuildable()) {
++i3;
}
}
if (i3 == 1) {
this.a(generatoraccessseed, blockposition2, StructurePiece.a((IBlockAccess) generatoraccessseed, blockposition2, Blocks.CHEST.getBlockData()), predicate);
TileEntityLootable.a((IBlockAccess) generatoraccessseed, random, blockposition2, LootTables.SIMPLE_DUNGEON);
break label100;
}
}
++i2;
continue;
}
}
++l1;
break;
}
}
this.a(generatoraccessseed, blockposition, Blocks.SPAWNER.getBlockData(), predicate);
TileEntity tileentity = generatoraccessseed.getTileEntity(blockposition);
if (tileentity instanceof TileEntityMobSpawner) {
((TileEntityMobSpawner) tileentity).getSpawner().setMobName(this.a(random));
} else {
WorldGenDungeons.LOGGER.error("Failed to fetch mob spawner entity at ({}, {}, {})", blockposition.getX(), blockposition.getY(), blockposition.getZ());
}
return true;
} else {
return false;
}
}
private EntityTypes<?> a(Random random) {
return (EntityTypes) SystemUtils.a((Object[]) WorldGenDungeons.MOBS, random);
}
}
| [
"joseph.cicalese@gmail.com"
] | joseph.cicalese@gmail.com |
1358652d078a2969bdb44b99acf190a75c4d63a5 | f4fec896b47fd72f9fb81b5fef037bda86d035f7 | /app/src/main/java/com/example/videoplayer/view/MyViedeoPlayer.java | 5c707a313049a867875ea5092d58cf31467ea351 | [] | no_license | zhuandian/videoplayer | e313a3cbf73c3317103b6118aa761da6f5d034b0 | 03eccd17d3271905e09448eb8037c0d7baf278a9 | refs/heads/master | 2021-01-04T06:47:08.902324 | 2020-02-22T10:54:24 | 2020-02-22T10:54:24 | 240,435,893 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 945 | java | package com.example.videoplayer.view;
import android.content.Context;
import android.util.AttributeSet;
import cn.jzvd.JZVideoPlayer;
import cn.jzvd.JZVideoPlayerStandard;
/**
* desc :
* author:xiedong
* date:2020/02/07
*/
public class MyViedeoPlayer extends JZVideoPlayerStandard {
private OnVideoPlayingListener videoPlayingListener;
public MyViedeoPlayer(Context context) {
this(context, null);
}
public MyViedeoPlayer(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public void onStatePlaying() {
super.onStatePlaying();
if (videoPlayingListener != null) {
videoPlayingListener.onVideoPlaying();
}
}
public void setOnVideoPlayingListener(OnVideoPlayingListener listener) {
this.videoPlayingListener = listener;
}
public interface OnVideoPlayingListener {
void onVideoPlaying();
}
}
| [
"xiedong11@aliyun.com"
] | xiedong11@aliyun.com |
67195c493ed03a483a0894d1a0c34f258ae4831a | b84ecda4559551a58658945b78505d0da96f8bc5 | /develop/source-code/framework/msg-framework/src/com/zte/mos/msg/framework/CommServiceFactory.java | 34328b564a740dae2b696cc50f3806b51b166619 | [] | no_license | qingw/mos | bb114f0d1fafea4d19ec839309900473075541cb | dff2428487293a7cb1ae5f98718f985a6f7362bc | refs/heads/master | 2023-03-16T07:54:18.515765 | 2018-10-18T10:45:01 | 2018-10-18T10:45:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,423 | java | package com.zte.mos.msg.framework;
import com.zte.mos.msg.framework.session.ISessionConfigBuilder;
import com.zte.mos.msg.framework.session.ISessionService;
import com.zte.mos.util.Scan;
import java.lang.reflect.Constructor;
import java.util.Set;
public class CommServiceFactory
{
private static ISouthService service = new SouthService();
public static ISouthService getService() {
return service;
}
public static void setService(ISouthService userService) {
service = userService;
}
public static void stop(){
}
public static void initService() {
Class[] filters = new Class[3];
filters[0] = MsgProcess.class;
filters[1] = ISessionService.class;
filters[2] = ISessionConfigBuilder.class;
Set<Class> set = Scan.getClasses("com.zte.mos.msg.impl", filters);
if (!set.isEmpty()) {
for (Class clazz : set) {
if (MsgProcess.class.isAssignableFrom(clazz)){
Class<? extends MsgProcess> implClazz = clazz.asSubclass(MsgProcess.class);
try {
MsgProcessPool.register(implClazz);
} catch (Exception e) {
e.printStackTrace();
}
}else if(ISessionService.class.isAssignableFrom(clazz)
|| ISessionConfigBuilder.class.isAssignableFrom(clazz)){
try
{
Constructor<?> constructor = clazz.getDeclaredConstructor();
constructor.setAccessible(true);
constructor.newInstance();
} catch (Exception e)
{
e.printStackTrace();
}
}
}
}
// Set<Class<LocalOnly>> increamentalSet =
// Scan.getClasses("com.zte.mos.domain.model.autogen.nr8120.v241.local", LocalOnly.class);
// if (!increamentalSet.isEmpty()) {
// for (Class<LocalOnly> clazz : increamentalSet) {
// Class<? extends LocalOnly> implClazz = clazz.asSubclass(LocalOnly.class);
// try {
// LocalOnlyPool.register(implClazz);
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
// }
}
}
| [
"liu.wei91@zte.com.cn"
] | liu.wei91@zte.com.cn |
f5f51c8e23a377d9cee6ece1d118ea9cbbf9a6f2 | 763b71c5c56bedee02e29fed6bb206556a30a45e | /app/src/main/java/com/xyd/red_wine/balance/BalanceActivity.java | 74bdf713c08cc1a20a004c345dee0bfa7591fe53 | [] | no_license | zhengyiheng123/Red_wine | 8d39bacd4e18642d4179cf436b037055cf1d98a6 | 3173de942c29f864ada6d1a70e7033bc28487597 | refs/heads/master | 2021-08-28T21:35:18.089452 | 2017-12-13T06:30:35 | 2017-12-13T06:30:35 | 100,663,653 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,355 | java | package com.xyd.red_wine.balance;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.xyd.red_wine.R;
import com.xyd.red_wine.api.MineApi;
import com.xyd.red_wine.base.BaseActivity;
import com.xyd.red_wine.base.BaseApi;
import com.xyd.red_wine.base.BaseModel;
import com.xyd.red_wine.base.BaseObserver;
import com.xyd.red_wine.base.PublicStaticData;
import com.xyd.red_wine.base.RxSchedulers;
import com.xyd.red_wine.glide.GlideUtil;
import com.xyd.red_wine.login.LoginActivity;
import com.xyd.red_wine.login.StartupPageActivity;
import com.xyd.red_wine.main.MainActivity;
import com.xyd.red_wine.personinformation.BindActivity;
import com.xyd.red_wine.personinformation.InfromationModel;
import com.xyd.red_wine.promptdialog.PromptDialog;
import com.xyd.red_wine.view.DrawImageView;
import java.util.Random;
import butterknife.Bind;
import butterknife.ButterKnife;
/**
* @author: zhaoxiaolei
* @date: 2017/7/13
* @time: 16:05
* @description: 账户余额
*/
public class BalanceActivity extends BaseActivity {
@Bind(R.id.base_title_back)
TextView baseTitleBack;
@Bind(R.id.base_title_right)
TextView baseTitleRight;
@Bind(R.id.base_title_title)
TextView baseTitleTitle;
@Bind(R.id.base_title_menu)
ImageView baseTitleMenu;
@Bind(R.id.balance_tv_name)
TextView balanceTvName;
@Bind(R.id.balance_tv_money)
TextView balanceTvMoney;
@Bind(R.id.balance_tv_all)
TextView balanceTvAll;
@Bind(R.id.balance_tv_generalize)
TextView balanceTvGeneralize;
@Bind(R.id.balance_tv_withdraw)
TextView balanceTvWithdraw;
@Bind(R.id.balance_tv_balance)
TextView balanceTvBalance;
@Bind(R.id.balance_tv_top_up)
TextView balanceTvTopUp;
@Bind(R.id.balance_rl)
RelativeLayout balanceRl;
@Bind(R.id.balance_iv_head)
ImageView balanceIvHead;
@Bind(R.id.balance_iv_money)
DrawImageView balanceIvMoney;
@Bind(R.id.base_title_headline)
ImageView mHeadLine;
private BalanceModel model;
@Override
protected int getLayoutId() {
return R.layout.activity_account_balance;
}
@Override
protected void initView() {
mHeadLine.setVisibility(View.GONE);
baseTitleTitle.setText("账户余额");
baseTitleMenu.setVisibility(View.GONE);
baseTitleRight.setVisibility(View.VISIBLE);
baseTitleRight.setText("记录");
getData();
}
@Override
protected void onResume() {
super.onResume();
getData();
}
private void getData() {
BaseApi.getRetrofit()
.create(MineApi.class)
.balance()
.compose(RxSchedulers.<BaseModel<BalanceModel>>compose())
.subscribe(new BaseObserver<BalanceModel>() {
@Override
protected void onHandleSuccess(BalanceModel balanceModel, String msg, int code) {
model = balanceModel;
balanceTvName.setText(balanceModel.getNickname());
GlideUtil.getInstance().loadCircleImage(BalanceActivity.this, balanceIvHead, PublicStaticData.baseUrl + balanceModel.getHead_img());
balanceTvMoney.setText(balanceModel.getTotal() + "");
balanceTvBalance.setText(balanceModel.getAccount_balance() + "");
balanceTvGeneralize.setText(balanceModel.getRevenue_balance() + "");
balanceIvMoney.setAngel(balanceModel.getTotal() / 20);
}
@Override
protected void onHandleError(String msg) {
showToast(msg);
}
});
}
@Override
protected void initEvent() {
baseTitleBack.setOnClickListener(this);
baseTitleMenu.setOnClickListener(this);
balanceTvWithdraw.setOnClickListener(this);
balanceTvTopUp.setOnClickListener(this);
baseTitleRight.setOnClickListener(this);
}
@Override
public void widgetClick(View v) {
switch (v.getId()) {
case R.id.base_title_back:
finish();
break;
case R.id.base_title_menu:
// showTestToast("菜单");
// Random random = new Random();
// balanceIvMoney.setAngel(random.nextInt(360));
break;
case R.id.balance_tv_withdraw:
getUserInfo();
break;
case R.id.balance_tv_top_up:
startActivity(ChongzhiActivity.class);
break;
case R.id.base_title_right:
startActivity(RecordActivity.class);
break;
}
}
//获取用户信息
private void getUserInfo(){
final PromptDialog dialog=new PromptDialog(BalanceActivity.this);
dialog.showLoading("请稍后",false);
BaseApi.getRetrofit()
.create(MineApi.class)
.information()
.compose(RxSchedulers.<BaseModel<InfromationModel>>compose())
.subscribe(new BaseObserver<InfromationModel>() {
@Override
protected void onHandleSuccess(InfromationModel infromationModel, String msg, int code) {
dialog.dismissImmediately();
// login("qiaozhijinhan" + infromationModel.getUserid(), "123456");
if (!TextUtils.isEmpty(infromationModel.getPhone())){
Bundle bundle=new Bundle();
bundle.putDouble(TixianActivity.AVAILAVLE_MONEY,model.getAccount_balance());
bundle.putString(TixianActivity.PHONENUM,infromationModel.getPhone());
startActivity(TixianActivity.class,bundle);
}else {
AlertDialog.Builder builder=new AlertDialog.Builder(BalanceActivity.this);
builder.setTitle("提示");
builder.setMessage("请先绑定手机号码,才能进行提现。");
builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
startActivity(BindActivity.class);
}
});
builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
}
});
builder.show();
}
}
@Override
protected void onHandleError(String msg) {
showTestToast(msg);
dialog.dismissImmediately();
}
});
}
}
| [
"15621599930@163.com"
] | 15621599930@163.com |
3164ccd1c0982382859d12a5ab235346b2a5ea7f | e8685ddbe3d5a281ee0f8e9853415a7fa23d764f | /src/main/java/mcgill/fiveCardStud/GameTest.java | f5ecde82e194918662f71ea84060fe033f077b7d | [] | no_license | angelini/ECSE_321-Game | 2b6a75c151b4d2c86389db7ef6e61fff7e6913d3 | a28d0be0031bcc37713bf8f145ec2fd94a76f7ab | refs/heads/master | 2021-01-22T22:45:51.119891 | 2012-04-15T18:24:46 | 2012-04-15T18:24:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,084 | java | /*
package mcgill.fiveCardStud;
import java.util.ArrayList;
import java.util.Scanner;
import mcgill.poker.OutOfMoneyException;
import mcgill.poker.Player;
import mcgill.poker.Hand;
import mcgill.poker.Card;
import mcgill.poker.TooFewCardsException;
import mcgill.poker.TooManyCardsException;
public class GameTest {
private static final int LOW_BET = 20;
private static final int STARTING_CASH = 400;
private static final int NUMBER_OF_PLAYERS = 5;
private static final int MAX_RAISES = 3;
private static final int BRING_IN = 10;
public static void main(String[] args) throws TooFewCardsException, TooManyCardsException, OutOfMoneyException {
ArrayList<Player> players = new ArrayList<Player>();
for(int i = 0; i < NUMBER_OF_PLAYERS; i++) {
players.add(new Player(STARTING_CASH));
}
FiveCardStud game = new FiveCardStud(players, LOW_BET, MAX_RAISES, BRING_IN);
game.playRound();
}
//0 is check, -1 is fold, any positive integer is a raise or call.
public static int getAction(int indexPlayer, int callAmount) {
System.out.println("The amount to call is "+callAmount);
System.out.println("Player "+indexPlayer+" please enter your desired action.\n"+
"0 is check, -1 is fold, any positive integer is a raise or call:");
Scanner scan = new Scanner(System.in);
int action = scan.nextInt();
System.out.println("You entered "+action);
return action;
}
public static void printHand(Player player) {
Hand hand = player.getHand();
System.out.print(" #");
for (Card card : hand) {
System.out.print("|"+card.getValue()+"."+card.getSuit()+"|");
}
System.out.print("# \n");
}
public static void printAmountInPots(Player player) {
System.out.println("Amount In Pots = "+player.getAmountInPots());
}
public static void printPlayerStatus(Player player) {
if (player.isAllIn()) {
System.out.println("Your status: All In");
} else if (player.isFolded()) {
System.out.println("Your status: Folded");
} else if (player.isBetting()) {
System.out.println("Your status: Betting");
}
}
}
*/
| [
"alex.louis.angelini@gmail.com"
] | alex.louis.angelini@gmail.com |
8110b1bcb4cf740ed30a65adbe71ddf639462cd9 | d3d4bf071cef3df0735dde43ec800c80cad28922 | /services/gamemgmt-service/src/main/java/com/trdsimul/gamemgmt/model/entity/Roles.java | 0159f2ec5185c948e766ea28768daea8fbc16f3f | [] | no_license | Damini25/TradeDashboard | 0df566365a2c066ab65135b299df09215f45a4a2 | 7686cf94410860be07a9313a7d8ba12882d75783 | refs/heads/master | 2022-07-14T18:44:32.922095 | 2021-01-02T05:45:01 | 2021-01-02T05:45:01 | 200,001,631 | 0 | 0 | null | 2022-06-29T18:28:01 | 2019-08-01T07:37:02 | JavaScript | UTF-8 | Java | false | false | 872 | java | package com.trdsimul.gamemgmt.model.entity;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table
public class Roles {
@Id
private Integer roleId;
private String roleName;
private Date lastUpdate;
public Roles() {
super();
}
public Roles(Integer roleId, String roleName, Date lastUpdate) {
super();
this.roleId = roleId;
this.roleName = roleName;
this.lastUpdate = lastUpdate;
}
public Integer getRoleId() {
return roleId;
}
public void setRoleId(Integer roleId) {
this.roleId = roleId;
}
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
public Date getLastUpdate() {
return lastUpdate;
}
public void setLastUpdate(Date lastUpdate) {
this.lastUpdate = lastUpdate;
}
}
| [
"damgarg@publicisgroupe.net"
] | damgarg@publicisgroupe.net |
f6485390e234eb9a07aa14682e41a055f3e115c1 | 681e97a53c76afc2ffdfceeb2bfecdb3ffd9aeff | /app/src/main/java/com/ihm/myapp/entity/DurationObject.java | 883fe82cbdbbcb2c3d65228f92d2777fb96cc9e3 | [] | no_license | madforfame/jogging | 3b936f387552917eae47026820c71dbeeb036c85 | 3110f91cada5e0663590d2f11fdce9a58da71020 | refs/heads/master | 2020-08-26T11:36:26.371885 | 2019-11-06T09:29:30 | 2019-11-06T09:29:30 | 217,005,124 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 324 | java | package com.ihm.myapp.entity;
public class DurationObject {
private String text;
public DurationObject(){}
public DurationObject(String text) {
this.text = text;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
}
| [
"liveforlove123123+"
] | liveforlove123123+ |
b9cb9725b139bfceee1a9a6fd805eff8fcf9cbcd | 908975042ea662f775192d22927d5485368668dc | /app/src/main/java/kamrulhasan3288/weatherapp/component/WeatherApiComponent.java | 5b6a2d6372b120accfe27b70039a631d1e88303c | [] | no_license | kamrul3288/WeatherApp | ef89191920eef546811029db4a132b1aa5468035 | 96536174202d5f641d46897bd22ab37222306188 | refs/heads/master | 2020-03-18T21:53:04.372030 | 2018-05-29T14:59:12 | 2018-05-29T14:59:12 | 135,310,552 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 399 | java | package kamrulhasan3288.weatherapp.component;
import dagger.Component;
import kamrulhasan3288.weatherapp.interfaces.WeatherApi;
import kamrulhasan3288.weatherapp.module.WeatherApiModule;
import kamrulhasan3288.weatherapp.scope.WeatherApplicationScope;
@Component(modules = WeatherApiModule.class)
@WeatherApplicationScope
public interface WeatherApiComponent {
WeatherApi getWeatherApi();
}
| [
"kamrulhasan3288@gmail.com"
] | kamrulhasan3288@gmail.com |
6e53010da1f7ddbe6bb170a2e36f86e31ac49ebb | be8005660700eb1785c91f9c5ac263c8d13ebfd4 | /javasrc/edu/brown/cs/fait/testgen/TestgenReferenceValue.java | 88eeddf4d1503c957182ccf16b998968f7986a1c | [] | no_license | StevenReiss/fait | e1403ae4a2509d92f83e64ebea5e240c58719f51 | af54cd525ac86ccc07850832eacb99dc3845dfde | refs/heads/master | 2023-08-17T08:00:02.711001 | 2023-08-16T15:30:41 | 2023-08-16T15:30:41 | 183,441,883 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,824 | java | /********************************************************************************/
/* */
/* TestgenReferenceValue.java */
/* */
/* Value that is a reference to a stack/local/field/array */
/* */
/********************************************************************************/
/* Copyright 2013 Brown University -- Steven P. Reiss */
/*********************************************************************************
* Copyright 2013, Brown University, Providence, RI. *
* *
* All Rights Reserved *
* *
* Permission to use, copy, modify, and distribute this software and its *
* documentation for any purpose other than its incorporation into a *
* commercial product is hereby granted without fee, provided that the *
* above copyright notice appear in all copies and that both that *
* copyright notice and this permission notice appear in supporting *
* documentation, and that the name of Brown University not be used in *
* advertising or publicity pertaining to distribution of the software *
* without specific, written prior permission. *
* *
* BROWN UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS *
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND *
* FITNESS FOR ANY PARTICULAR PURPOSE. IN NO EVENT SHALL BROWN UNIVERSITY *
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY *
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, *
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS *
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE *
* OF THIS SOFTWARE. *
* *
********************************************************************************/
package edu.brown.cs.fait.testgen;
import java.util.List;
import edu.brown.cs.fait.iface.IfaceControl;
import edu.brown.cs.fait.iface.IfaceField;
import edu.brown.cs.fait.iface.IfaceState;
import edu.brown.cs.fait.iface.IfaceType;
class TestgenReferenceValue extends TestgenValue implements TestgenConstants
{
/********************************************************************************/
/* */
/* Private Storage */
/* */
/********************************************************************************/
private int slot_value;
private int stack_value;
private TestgenValue base_value;
private IfaceField field_ref;
private TestgenValue index_ref;
/********************************************************************************/
/* */
/* Constructors */
/* */
/********************************************************************************/
TestgenReferenceValue(IfaceType t,int slot,boolean var)
{
this(t);
if (var) slot_value = slot;
else stack_value = slot;
}
TestgenReferenceValue(TestgenValue base,IfaceField fld)
{
this(fld.getType());
base_value = base;
field_ref = fld;
}
TestgenReferenceValue(TestgenValue base,TestgenValue idx)
{
this(base.getDataType().getBaseType());
base_value = base;
index_ref = idx;
}
private TestgenReferenceValue(IfaceType t)
{
super(t);
slot_value = -1;
stack_value = -1;
base_value = null;
field_ref = null;
index_ref = null;
}
/********************************************************************************/
/* */
/* Access methods */
/* */
/********************************************************************************/
int getRefStack()
{
return stack_value;
}
IfaceField getRefField()
{
return field_ref;
}
int getRefSlot()
{
return slot_value;
}
/********************************************************************************/
/* */
/* Abstract Method Implementations */
/* */
/********************************************************************************/
@Override protected void updateInternal(IfaceControl fc,IfaceState prior,IfaceState cur,List<TestgenValue> rslt)
{
rslt.add(this);
}
/********************************************************************************/
/* */
/* Output methods */
/* */
/********************************************************************************/
@Override public String toString()
{
StringBuffer buf = new StringBuffer();
buf.append("<^^^");
if (stack_value >= 0) {
buf.append("S");
buf.append(stack_value);
}
else if (slot_value >= 0) {
buf.append("V");
buf.append(slot_value);
}
else {
if (base_value != null) {
buf.append(base_value.toString());
}
if (field_ref != null) {
buf.append(" . ");
buf.append(field_ref.getFullName());
}
else if (index_ref != null) {
buf.append(" [] ");
buf.append(index_ref.toString());
}
}
buf.append(">");
return buf.toString();
}
} // end of class TestgenReferenceValue
/* end of TestgenReferenceValue.java */
| [
"spr@cs.brown.edu"
] | spr@cs.brown.edu |
3479acc5eb511fee5e7dedf38f42fe9e6f2eb93f | a6a1516fd45ef009fbf50581293ce001c19dab67 | /src/com/sujan/lms/entity/author/Author.java | e039efe4ccf77fe2a7c3d2ddf24da93aa40cc22b | [
"Apache-2.0"
] | permissive | suzan-1515/Library-Management-System | c2eeea0ea24d99e14cfcf84696fd3026aba69560 | c9ef0089d080fcdc7ea03724e295bcabdeeff751 | refs/heads/master | 2021-08-29T10:46:03.630383 | 2017-12-13T19:05:02 | 2017-12-13T19:05:02 | 106,183,660 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,387 | 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.sujan.lms.entity.author;
import java.io.Serializable;
/**
*
* @author Suzn
*/
public class Author implements Serializable {
private int id;
private String title;
private String contact;
public Author() {
}
public Author(int id) {
this.id = id;
}
public Author(int id, String title, String contact) {
this.id = id;
this.title = title;
this.contact = contact;
}
/**
* @return the title
*/
public String getTitle() {
return title;
}
/**
* @param title the title to set
*/
public void setTitle(String title) {
this.title = title;
}
/**
* @return the contact
*/
public String getContact() {
return contact;
}
/**
* @param contact the contact to set
*/
public void setContact(String contact) {
this.contact = contact;
}
/**
* @return the id
*/
public int getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(int id) {
this.id = id;
}
}
| [
"Suzn@DESKTOP-0ISHRHQ"
] | Suzn@DESKTOP-0ISHRHQ |
d4807df369c466f01e9e0cdd961ef147b90c1edd | dc0790c71fb8a2eac4d541b236081c233f27d633 | /src/main/java/com/example/kkcbackend/service/DataService.java | 8e51298ecb489d00614c163caa761bc1af02d2b7 | [] | no_license | D3V41/kkc-backend | df417420d5734ffdbee07c8b7b009c8ba98f6bf5 | 2f3fd45f27be678ea51f4c659bbede9b6dacb56a | refs/heads/master | 2023-06-21T00:03:23.297683 | 2021-07-15T15:34:39 | 2021-07-15T15:34:39 | 379,503,900 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,619 | java | package com.example.kkcbackend.service;
import com.example.kkcbackend.dao.DataDao;
import com.example.kkcbackend.model.Data;
import com.example.kkcbackend.payload.responce.StatusResponce;
import com.example.kkcbackend.payload.responce.UnitListResponce;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Service
public class DataService {
@Autowired
DataDao dataDao;
public Boolean insertData(Data d){
dataDao.save(d);
return true;
}
public List<Data> getDatalistByUlbname(String ulbname){
return dataDao.findByUlbname(ulbname);
}
public Boolean getDataById(Long id){
List<Data> data = dataDao.findByDataId(id);
return !data.isEmpty();
}
public List<StatusResponce> getStatusData(int phase,String ulbname){
List<Object[]> list = dataDao.getStatusData(phase,ulbname);
return extractStatus(list);
}
public List<StatusResponce> getStatusDataAllPhase(String ulbname){
List<Object[]> list = dataDao.getStatusDataAllPhase(ulbname);
return extractStatus(list);
}
public float getTotalcurrent(float r,float y, float b){
return (r+y+b)/3;
}
public List<StatusResponce> extractStatus(List<Object[]> list){
List<StatusResponce> list2 = new ArrayList<>();
int i=1;
for (Object[] obj : list){
StatusResponce statusResponce = new StatusResponce();
statusResponce.setSrNo(i++);
statusResponce.setTimestamp((Date) obj[0]);
statusResponce.setZone((String) obj[1]);
statusResponce.setWard((int) obj[2]);
statusResponce.setRoadName((String) obj[3]);
statusResponce.setUnitId((int) obj[4]);
float iTotal = getTotalcurrent((float)obj[8],(float)obj[9],(float)obj[10]);
if(iTotal==0){
statusResponce.setStatus(false);
}
else {
statusResponce.setStatus(true);
}
statusResponce.setOnTime((String) obj[5]);
statusResponce.setOffTime((String) obj[6]);
statusResponce.setKwh((float) obj[7]);
statusResponce.setiTotal(iTotal);
statusResponce.setKwTotal(0.0F);
statusResponce.setEventType((String) obj[11]);
statusResponce.setTotalloadwattage(0.0F);
statusResponce.setImei((Long) obj[12]);
list2.add(statusResponce);
}
return list2;
}
}
| [
"deval.italiya@gmail.com"
] | deval.italiya@gmail.com |
437f99fd942a339c4147036f97cff3ca6e012a15 | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/alibaba--druid/78488b0b1ab0fb312cd0c0ec4c591ed68362f91d/after/Oracle_pl_if_2.java | 3e76b3edc53a51f2f2b6a3a80096917465ea9270 | [] | no_license | fracz/refactor-extractor | 3ae45c97cc63f26d5cb8b92003b12f74cc9973a9 | dd5e82bfcc376e74a99e18c2bf54c95676914272 | refs/heads/master | 2021-01-19T06:50:08.211003 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,033 | java | /*
* Copyright 1999-2017 Alibaba Group Holding Ltd.
*
* 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.alibaba.druid.bvt.sql.oracle.pl;
import com.alibaba.druid.sql.OracleTest;
import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.visitor.SchemaStatVisitor;
import com.alibaba.druid.util.JdbcConstants;
import java.util.List;
public class Oracle_pl_if_2 extends OracleTest {
public void test_0() throws Exception {
String sql = "IF l_salary <= 40000\n" +
"THEN\n" +
" give_bonus (l_employee_id, 0);\n" +
"ELSE\n" +
" give_bonus (l_employee_id, 500);\n" +
"END IF;"; //
List<SQLStatement> statementList = SQLUtils.parseStatements(sql, JdbcConstants.ORACLE);
SQLStatement stmt = statementList.get(0);
assertEquals(1, statementList.size());
SchemaStatVisitor visitor = SQLUtils.createSchemaStatVisitor(JdbcConstants.ORACLE);
for (SQLStatement statement : statementList) {
statement.accept(visitor);
}
// System.out.println("Tables : " + visitor.getTables());
// System.out.println("fields : " + visitor.getColumns());
// System.out.println("coditions : " + visitor.getConditions());
// System.out.println("relationships : " + visitor.getRelationships());
// System.out.println("orderBy : " + visitor.getOrderByColumns());
assertEquals(0, visitor.getTables().size());
// Assert.assertTrue(visitor.getTables().containsKey(new TableStat.Name("employees")));
// Assert.assertTrue(visitor.getTables().containsKey(new TableStat.Name("emp_name")));
// Assert.assertEquals(7, visitor.getColumns().size());
// Assert.assertEquals(3, visitor.getConditions().size());
// Assert.assertEquals(1, visitor.getRelationships().size());
// Assert.assertTrue(visitor.getColumns().contains(new TableStat.Column("employees", "salary")));
{
String output = SQLUtils.toOracleString(stmt);
assertEquals("IF l_salary <= 40000 THEN\n" +
"\tgive_bonus(l_employee_id, 0);\n" +
"ELSE\n" +
"\tgive_bonus(l_employee_id, 500);\n" +
"END IF;", //
output);
}
{
String output = SQLUtils.toOracleString(stmt, SQLUtils.DEFAULT_LCASE_FORMAT_OPTION);
assertEquals("if l_salary <= 40000 then\n" +
"\tgive_bonus(l_employee_id, 0);\n" +
"else\n" +
"\tgive_bonus(l_employee_id, 500);\n" +
"end if;", //
output);
}
}
} | [
"fraczwojciech@gmail.com"
] | fraczwojciech@gmail.com |
ba7f6e70923ad8687244457a90402d6a6c744b91 | 1c28979765ab5020071da0333afc851d92e44218 | /Servidor/src/servidor/Server.java | 6a1bc9c525074ddc0062ca95d8efa9f80ddda59b | [] | no_license | planthree1/SI | 4ea63f27281a9c63a7ec7f94f3c814ccb9346ec8 | b74eb9ddd2273f8d13906c47d8cf2493733ae7d8 | refs/heads/master | 2020-04-03T19:40:05.449224 | 2019-01-09T10:37:25 | 2019-01-09T10:37:25 | 155,530,829 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,154 | java | package servidor;
import java.net.Socket;
import java.net.ServerSocket;
import java.net.InetAddress;
class Server {
static public void
waitForClients ( ServerSocket s ) {
ServerControl registry = new ServerControl();
try {
while (true) {
Socket c = s.accept();
ServerActions handler = new ServerActions( c, registry );
new Thread( handler ).start ();
}
} catch ( Exception e ) {
System.err.print( "Cannot use socket: " + e );
}
}
public static void main ( String[] args ) {
// if (args.length < 1) {
// System.err.print( "Usage: port\n" );
// System.exit( 1 );
// }
//
// int port = Integer.parseInt(args[0]);
try {
ServerSocket s = new ServerSocket( 3000, 5, InetAddress.getByName( "localhost" ) );
System.out.print( "Started server on port " + 3000 + "\n" );
waitForClients( s );
} catch (Exception e) {
System.err.print( "Cannot open socket: " + e );
System.exit( 1 );
}
}
} | [
"joaoprm@ua.pt"
] | joaoprm@ua.pt |
2cf6f463d01ce2b84d7268d9120593186bcfcf2f | e184db02f3b9051f78184cebbc0a0f66cf5cc48f | /src/main/java/com/coller/clibrary/service/UserService.java | 487aff9d3f83ec45558226697d112ea57a2088e2 | [] | no_license | npmcdn-to-unpkg-bot/clibrary | e6e5e0406d719a88fc3aa4b55e6b677f958f5e1a | ac1de95e844b00730a7c958cd32657e728d43c8d | refs/heads/master | 2021-01-24T23:50:36.780291 | 2016-08-23T17:49:52 | 2016-08-23T17:50:08 | 67,340,698 | 0 | 0 | null | 2016-09-04T11:20:43 | 2016-09-04T11:20:43 | null | UTF-8 | Java | false | false | 397 | java | package com.coller.clibrary.service;
import com.coller.clibrary.entity.Authority;
import com.coller.clibrary.entity.User;
import com.coller.clibrary.exception.UserExistsException;
import org.springframework.security.core.userdetails.UserDetails;
import java.util.List;
public interface UserService {
UserDetails addUser(User user, List<Authority> authorities) throws UserExistsException;
}
| [
"drummerc25@gmail.com"
] | drummerc25@gmail.com |
88c494abcbbfc1d5dd598116725f149eea65ee53 | 27a1accb04033c111ed32ca9539798687a01e1a0 | /Stacks-On/src/com/stacks_on/accounts/GenericAccountService.java | 629bd8908d1a11aec7fc886fe6808c5993917d5f | [] | no_license | kaputnikGo/Stacks-On | fff3d28d7254b9c8bc2e0fcad3ee476591b7c908 | 0907b87aafd79d9124d6875d0c8d723e8bc58caa | refs/heads/master | 2021-01-10T08:46:42.206395 | 2015-11-15T22:21:46 | 2015-11-15T22:21:46 | 44,781,907 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,640 | java | package com.stacks_on.accounts;
import android.accounts.AbstractAccountAuthenticator;
import android.accounts.Account;
import android.accounts.AccountAuthenticatorResponse;
import android.accounts.NetworkErrorException;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.IBinder;
import android.util.Log;
public class GenericAccountService extends Service {
private static final String TAG = "GenericAccountService";
public static final String ACCOUNT_NAME = "Account";
private Authenticator mAuthenticator;
public static Account GetAccount(String accountType) {
final String accountName = ACCOUNT_NAME;
return new Account(accountName, accountType);
}
@Override
public void onCreate() {
Log.i(TAG, "Service created.");
mAuthenticator = new Authenticator(this);
}
@Override
public void onDestroy() {
Log.i(TAG, "Service destroyed.");
}
@Override
public IBinder onBind(Intent intent) {
return mAuthenticator.getIBinder();
}
public class Authenticator extends AbstractAccountAuthenticator {
public Authenticator(Context context) {
super(context);
}
@Override
public Bundle editProperties(AccountAuthenticatorResponse accountAuthenticatorResponse, String s) {
throw new UnsupportedOperationException();
}
@Override
public Bundle addAccount(AccountAuthenticatorResponse accountAuthenticatorResponse,
String s, String s2, String[] strings, Bundle bundle) throws NetworkErrorException {
return null;
}
@Override
public Bundle confirmCredentials(AccountAuthenticatorResponse accountAuthenticatorResponse,
Account account, Bundle bundle) throws NetworkErrorException {
return null;
}
@Override
public Bundle getAuthToken(AccountAuthenticatorResponse accountAuthenticatorResponse,
Account account, String s, Bundle bundle) throws NetworkErrorException {
throw new UnsupportedOperationException();
}
@Override
public String getAuthTokenLabel(String s) {
throw new UnsupportedOperationException();
}
@Override
public Bundle updateCredentials(AccountAuthenticatorResponse accountAuthenticatorResponse,
Account account, String s, Bundle bundle) throws NetworkErrorException {
throw new UnsupportedOperationException();
}
@Override
public Bundle hasFeatures(AccountAuthenticatorResponse accountAuthenticatorResponse,
Account account, String[] strings) throws NetworkErrorException {
throw new UnsupportedOperationException();
}
}
}
| [
"kaputnikGo@gmail.com"
] | kaputnikGo@gmail.com |
1804c5709465951c9b7c1454c29cac744b03f0c5 | fefe984a326e87f67605f2e9cbb1490d82f101af | /app/templates/src/main/java/package/domain/_Authority.java | f37195d79664f184f5b895f24ed9d34c4ce32075 | [
"MIT"
] | permissive | alanma/generator-jhipster | f0a12248600856f33f4e3879a47c716267c5295d | 935d80541650a36817d0384f9bef3f8fb6a8a2c1 | refs/heads/master | 2021-01-15T11:02:20.434083 | 2013-10-30T16:08:04 | 2013-10-30T16:08:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,351 | java | package <%=packageName%>.domain;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
/**
* An authority (a security role) used by Spring Security.
*/
@Entity
@Table(name="T_AUTHORITY")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Authority implements Serializable {
@NotNull
@Size(min = 0, max = 50)
@Id
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Authority authority = (Authority) o;
if (name != null ? !name.equals(authority.name) : authority.name != null) return false;
return true;
}
@Override
public int hashCode() {
return name != null ? name.hashCode() : 0;
}
@Override
public String toString() {
return "Authority{" +
"name='" + name + '\'' +
"} " + super.toString();
}
}
| [
"jdubois@ippon.fr"
] | jdubois@ippon.fr |
76fc422e44179fee7e8e5de0e6ea4761fd3591fa | 58f9ed107e610a612af459d8231fbe97dd0c814f | /src/main/java/com/ht/extra/pojo/outpbill/ChargeReduceMaster.java | afc85cc8e3ace4cac1c48c96ecc8bcc417f25edb | [] | no_license | tangguoqiang/htwebExtra | 3bee6434a87e9333d80eeb391f80dfb72178675d | ca9d50a66586905d5164f6087b7778f233a1fd13 | refs/heads/master | 2020-03-15T13:13:57.645083 | 2018-08-22T12:54:44 | 2018-08-22T12:54:44 | 132,161,700 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,519 | java | package com.ht.extra.pojo.outpbill;
import java.math.BigDecimal;
import java.util.Date;
public class ChargeReduceMaster {
private Integer serialNo;
private String rcptNo;
private String patientId;
private Short visitId;
private String name;
private String chargeType;
private String unit;
private String cardNo;
private BigDecimal reduceAmount;
private String reduceCause;
private String ratifier;
private String undertaker;
private String undertakerUnit;
private String operNo;
private String operName;
private Date operDateTime;
public Integer getSerialNo() {
return serialNo;
}
public void setSerialNo(Integer serialNo) {
this.serialNo = serialNo;
}
public String getRcptNo() {
return rcptNo;
}
public void setRcptNo(String rcptNo) {
this.rcptNo = rcptNo == null ? null : rcptNo.trim();
}
public String getPatientId() {
return patientId;
}
public void setPatientId(String patientId) {
this.patientId = patientId == null ? null : patientId.trim();
}
public Short getVisitId() {
return visitId;
}
public void setVisitId(Short visitId) {
this.visitId = visitId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getChargeType() {
return chargeType;
}
public void setChargeType(String chargeType) {
this.chargeType = chargeType == null ? null : chargeType.trim();
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit == null ? null : unit.trim();
}
public String getCardNo() {
return cardNo;
}
public void setCardNo(String cardNo) {
this.cardNo = cardNo == null ? null : cardNo.trim();
}
public BigDecimal getReduceAmount() {
return reduceAmount;
}
public void setReduceAmount(BigDecimal reduceAmount) {
this.reduceAmount = reduceAmount;
}
public String getReduceCause() {
return reduceCause;
}
public void setReduceCause(String reduceCause) {
this.reduceCause = reduceCause == null ? null : reduceCause.trim();
}
public String getRatifier() {
return ratifier;
}
public void setRatifier(String ratifier) {
this.ratifier = ratifier == null ? null : ratifier.trim();
}
public String getUndertaker() {
return undertaker;
}
public void setUndertaker(String undertaker) {
this.undertaker = undertaker == null ? null : undertaker.trim();
}
public String getUndertakerUnit() {
return undertakerUnit;
}
public void setUndertakerUnit(String undertakerUnit) {
this.undertakerUnit = undertakerUnit == null ? null : undertakerUnit.trim();
}
public String getOperNo() {
return operNo;
}
public void setOperNo(String operNo) {
this.operNo = operNo == null ? null : operNo.trim();
}
public String getOperName() {
return operName;
}
public void setOperName(String operName) {
this.operName = operName == null ? null : operName.trim();
}
public Date getOperDateTime() {
return operDateTime;
}
public void setOperDateTime(Date operDateTime) {
this.operDateTime = operDateTime;
}
} | [
"ttang11@its.jnj.com"
] | ttang11@its.jnj.com |
56508249c564041e64655dcdfeb3349dbf71118c | abb505b77b09acf19c1a19000c6332e41eba14bd | /Conticious.HlokkPlugin/src/main/java/no/kodegenet/conticious/plugin/hlokk/HlokkAuthService.java | c30dcf4bee0b332a92ef2c27c57a5c6dda1326af | [
"Apache-2.0"
] | permissive | oddbjornkvalsund/Conticious | 2fcac3462334acb55981d8449299cdb9d51160c5 | 33557d3197127984a8f9683f2f4a2365e65861c2 | refs/heads/master | 2021-01-26T06:59:46.308832 | 2020-02-27T07:42:05 | 2020-02-27T07:42:05 | 243,356,369 | 0 | 0 | Apache-2.0 | 2020-02-26T20:14:28 | 2020-02-26T20:14:27 | null | UTF-8 | Java | false | false | 2,053 | java | package no.kodegenet.conticious.plugin.hlokk;
import no.haagensoftware.contentice.util.RandomString;
import no.kodegenet.conticious.plugin.hlokk.data.HlokkUser;
import java.util.*;
/**
* Created by joachimhaagenskeie on 16/08/2017.
*/
public class HlokkAuthService {
private static HlokkAuthService instance = null;
private static Map<String, HlokkUser> tokenMap;
private static long lastCheckTimestamp = 0;
private HlokkAuthService() {
tokenMap = new HashMap<>();
}
public static HlokkAuthService getInstance() {
if (instance == null) {
instance = new HlokkAuthService();
}
return instance;
}
public String generateTokenForUser(String username) {
String newToken = new RandomString(6).nextString();
tokenMap.put(newToken, new HlokkUser(newToken, username));
purgeOldTokens();
return newToken;
}
public HlokkUser authenticateToken(String token, String username) {
HlokkUser hlokkUser = tokenMap.get(token);
/**
* Only return user if token and username matches.
*/
if (hlokkUser != null && hlokkUser.getUsername() != null && hlokkUser.getUsername().equals(username)) {
tokenMap.remove(token);
return hlokkUser;
} else {
return null;
}
}
/**
* Only check once every 5 minutes. If a token is older than 7 days, delete it
*/
private void purgeOldTokens() {
long now = new Date().getTime();
List<String> tokensToDelete = new ArrayList<>();
if (now - lastCheckTimestamp > 300000l) { //5 minutes
for (String token : tokenMap.keySet()) {
if (now - tokenMap.get(token).getGeneratedTimestamp() > 604800000l) { // 7 days
tokensToDelete.add(token);
}
}
for (String token : tokensToDelete) {
tokenMap.remove(token);
}
lastCheckTimestamp = now;
}
}
}
| [
"joachim@haagen.name"
] | joachim@haagen.name |
0b087e6b48c76b4f564ec3d9ba1b6693d3e94e1f | 61b010b34e3a5e01b75b6496e14f288391c33ab3 | /hondayesway-hu-service/src/main/java/cn/yesway/common/soap/userextrainfoservice/UserExtraInfoService_Service.java | ebcdfca1346766271f72857ce3a9d5e091f779c7 | [] | no_license | respectOrg/hondayesway | 2d7cab76e96a95653c44dcdc4ac7ac8ed4b7162c | b68635ed40fc6136ed650538d3421775eff4a0ab | refs/heads/master | 2021-07-14T21:16:14.043261 | 2017-10-20T03:32:01 | 2017-10-20T03:32:01 | 107,385,500 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 734 | java | /**
* UserExtraInfoService_Service.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package cn.yesway.common.soap.userextrainfoservice;
public interface UserExtraInfoService_Service extends javax.xml.rpc.Service {
public java.lang.String getBasicHttpBinding_UserExtraInfoServiceAddress();
public cn.yesway.common.soap.userextrainfoservice.UserExtraInfoService_PortType getBasicHttpBinding_UserExtraInfoService() throws javax.xml.rpc.ServiceException;
public cn.yesway.common.soap.userextrainfoservice.UserExtraInfoService_PortType getBasicHttpBinding_UserExtraInfoService(java.net.URL portAddress) throws javax.xml.rpc.ServiceException;
}
| [
"bksqmy@163.com"
] | bksqmy@163.com |
f416145d344577aae47ecfbd9d301b4a096c4eae | 4a886eb79b50f6b6e93c360e7ee085569bcaedd9 | /ProtocolBuffer/src/ProtoWrite.java | 1dcea283f77fd4dda3927560e45727b8c7525d5a | [] | no_license | dandujaipalreddy/DataSerialization | cc28e7d24307112ddc48955763b9d4879aa4082f | 47154be223309fa77ed0468a00e22532f7d078f5 | refs/heads/master | 2021-01-10T12:42:53.699725 | 2015-11-09T16:25:06 | 2015-11-09T16:25:06 | 45,820,729 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,746 | java | import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import com.example.tutorial.AddressBookProtos.AddressBook;
import com.example.tutorial.AddressBookProtos.Person;
class ProtoWrite {
// This function fills in a Person message based on user input.
static Person PromptForAddress(BufferedReader stdin,
PrintStream stdout) throws IOException {
Person.Builder person = Person.newBuilder();
stdout.print("Enter person ID: ");
person.setId(Integer.valueOf(stdin.readLine()));
stdout.print("Enter name: ");
person.setName(stdin.readLine());
stdout.print("Enter email address (blank for none): ");
String email = stdin.readLine();
if (email.length() > 0) {
person.setEmail(email);
}
while (true) {
stdout.print("Enter a phone number (or leave blank to finish): ");
String number = stdin.readLine();
if (number.length() == 0) {
break;
}
Person.PhoneNumber.Builder phoneNumber =
Person.PhoneNumber.newBuilder().setNumber(number);
stdout.print("Is this a mobile, home, or work phone? ");
String type = stdin.readLine();
if (type.equals("mobile")) {
phoneNumber.setType(Person.PhoneType.MOBILE);
} else if (type.equals("home")) {
phoneNumber.setType(Person.PhoneType.HOME);
} else if (type.equals("work")) {
phoneNumber.setType(Person.PhoneType.WORK);
} else {
stdout.println("Unknown phone type. Using default.");
}
person.addPhone(phoneNumber);
}
return person.build();
}
// Main function: Reads the entire address book from a file,
// adds one person based on user input, then writes it back out to the same
// file.
public static void main(String[] args) throws Exception {
if (args.length != 1) {
System.err.println("Usage: AddPerson ADDRESS_BOOK_FILE");
System.exit(-1);
}
AddressBook.Builder addressBook = AddressBook.newBuilder();
// Read the existing address book.
try {
addressBook.mergeFrom(new FileInputStream(args[0]));
} catch (FileNotFoundException e) {
System.out.println(args[0] + ": File not found. Creating a new file.");
}
// Add an address.
addressBook.addPerson(
PromptForAddress(new BufferedReader(new InputStreamReader(System.in)),
System.out));
// Write the new address book back to disk.
FileOutputStream output = new FileOutputStream(args[0]);
addressBook.build().writeTo(output);
output.close();
}
}
| [
"dandujaipalreddy@hotmail.com"
] | dandujaipalreddy@hotmail.com |
8d8782d98aca5fc34e181ad63bd56dcdd94740c5 | d8e924ef91475ee893b7d550b78dc97fdd321a49 | /apidiff-lib/src/main/java/net/ninjacat/brking/api/ApiObjectPool.java | 1d0040954a9a08cfc9e6281955228078c8f01094 | [
"MIT"
] | permissive | uaraven/brkng-change | d0fb9853d00ae661d701685168caa59d27e3626e | 0e48ffa93721c123c03a1394feabc76c6439c3b7 | refs/heads/master | 2023-06-23T22:54:58.701028 | 2023-06-16T13:34:07 | 2023-06-16T13:34:07 | 246,708,592 | 0 | 0 | MIT | 2023-06-16T13:34:09 | 2020-03-12T00:31:14 | Java | UTF-8 | Java | false | false | 821 | java | package net.ninjacat.brking.api;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors;
public class ApiObjectPool<T> {
private final Map<String, T> objects;
protected ApiObjectPool(final List<T> objects, final Function<T, String> nameExtractor) {
this.objects = objects.stream().collect(Collectors.toUnmodifiableMap(nameExtractor, Function.identity()));
}
public Map<String, T> all() {
return objects;
}
public boolean has(final String name) {
return objects.containsKey(name);
}
public Optional<T> find(final String name) {
return Optional.ofNullable(objects.get(name));
}
public T get(final String name) {
return objects.get(name);
}
}
| [
"ovoronin@gmail.com"
] | ovoronin@gmail.com |
ad59700a8107b5ba92c5194fbdda6073b2f19705 | 1e518c5592b6aa7d9dc60fe50591abad77b8deeb | /HelloWorld/app/src/main/java/com/example/davidkezi/helloworld/MainActivity.java | d85b6fd3e0d78895aa8c7980cb692e2cea542715 | [] | no_license | Mrkezii/Hello_World_andriod | 50693eb121d251fc3b3e4f87005102add71d230f | 9ecaef4f616a359afd98cbe8fb1de78dff40bf3d | refs/heads/master | 2021-01-10T16:24:45.920363 | 2016-03-09T15:34:27 | 2016-03-09T15:34:27 | 52,697,761 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,119 | java | package com.example.davidkezi.helloworld;
import android.content.Context;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
static String TAG = "MainActivity ";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
Log.i(TAG, "app is running");
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
public void btnClick(View view){
Toast.makeText(getBaseContext(), "You have just clicked a button",
Toast.LENGTH_LONG).show();
}
}
| [
"david.kezi@yahoo.com"
] | david.kezi@yahoo.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.