blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2 values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557 values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82 values | src_encoding stringclasses 28 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 7 5.41M | extension stringclasses 11 values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
98df3501354b8c2ee186ad5b22d1cb0cd14cd593 | a06ba0d40d86aba3b34083c4c9da5db248bbddf0 | /QuanLySinhVien_JSP/src/java/models/School_year.java | 5c1b5568c7a3efa0a238b3a981eb042873bdb75f | [] | no_license | voduykiet/VoDuyKiet_QLSV_JSP-SERVLET | a52b15f611fd006a00d5788890e1816ac3c73a41 | 55238bc8338d21b5e2451e688e41514a4901c821 | refs/heads/main | 2023-07-14T07:10:47.643779 | 2021-08-13T03:10:22 | 2021-08-13T03:10:22 | 395,505,258 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 942 | 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 models;
/**
*
* @author DELL
*/
public class School_year {
private String id_school_year;
private String name_school_year;
public School_year() {
}
public School_year(String id_school_year, String name_school_year) {
this.id_school_year = id_school_year;
this.name_school_year = name_school_year;
}
public String getId_school_year() {
return id_school_year;
}
public void setId_school_year(String id_school_year) {
this.id_school_year = id_school_year;
}
public String getName_school_year() {
return name_school_year;
}
public void setName_school_year(String name_school_year) {
this.name_school_year = name_school_year;
}
}
| [
"78134909+voduykiet@users.noreply.github.com"
] | 78134909+voduykiet@users.noreply.github.com |
fc2278cf71efb71fa3e2ffed159c3bd68de7e3fd | 96c1cff4320f1bd2abbdc2db58bc5908e98470e5 | /src/com/ksb/algorithm/chap02/Q11.java | d0a90d5f0a2f0e8987ec036a616de288bb0ad4d4 | [] | no_license | kangsb14/studyProjectKSB | 0fde0ea32e0927e567b44789a327136a8aac8cdd | bd3faa94ee2daf9a7f1ae4a3832ee365850dce4c | refs/heads/master | 2022-12-02T01:19:25.127715 | 2020-08-09T13:24:55 | 2020-08-09T13:24:55 | 280,850,063 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 401 | java | package com.ksb.algorithm.chap02;
public class Q11 {
class YMD{
int y;
int m;
int d;
public YMD(int y, int m, int d){
this.y = y;
this.m = m;
this.d = d;
}
int after(int n){
YMD ymd = new YMD(this.y, this.m, this.d);
int result = 0;
return result;
}
}
}
| [
"kangsb14@naver.com"
] | kangsb14@naver.com |
90634799496249748647d3a0b5e9093bad3b0a08 | 67c47524ee80e7a6ce3323bbd10d7e651d7383f0 | /itss/src/main/java/com/kingen/service/workflow/WorkflowDeployService.java | 086b8b61b4db799c2f4afe685bda65315b9e22c5 | [] | no_license | longyzkd/wj-web-ext-enhancer | 8a788b9572fc270cdc2667daf4340f48e7cd9030 | f572915cda07f6e20318f57f9a5bf9f7d7631f95 | refs/heads/master | 2020-06-19T01:06:08.298704 | 2017-03-09T03:11:28 | 2017-03-09T03:11:28 | 74,929,902 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,039 | java | package com.kingen.service.workflow;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.zip.ZipInputStream;
import javax.transaction.Transactional;
import org.activiti.bpmn.converter.BpmnXMLConverter;
import org.activiti.bpmn.model.BpmnModel;
import org.activiti.editor.language.json.converter.BpmnJsonConverter;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.DeploymentBuilder;
import org.activiti.engine.repository.Model;
import org.activiti.engine.repository.ProcessDefinition;
import org.apache.commons.lang3.ArrayUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
import org.springframework.stereotype.Service;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.kingen.util.Constants;
import com.kingen.util.workflow.WorkflowUtils;
/**
* 流程部署控制器
*
* @author
*/
@Service
@Transactional
public class WorkflowDeployService {
protected Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
protected RepositoryService repositoryService;
/**
* 第一种:部署classpath下面的流程定义
* @param processKey 流程定义KEY
* @throws Exception
*/
public void deployFromClasspath(String exportDir, String... processKey) throws Exception {
ResourceLoader resourceLoader = new DefaultResourceLoader();
// String[] processKeys = {"salary", "vacation", "expense", "CountSalary"};
List<String> processKeys = loadDeployFile(resourceLoader);
for (String loopProcessKey : processKeys) {
if (ArrayUtils.isNotEmpty(processKey)) {
//部署单个流程
if (ArrayUtils.contains(processKey, loopProcessKey)) {
logger.debug("hit module of {}", (Object[]) processKey);
deploySingleProcess(resourceLoader, loopProcessKey, exportDir);
} else {
logger.debug("module: {} not equals process key: {}, ignore and continue find next.", loopProcessKey, processKey);
}
} else {
//部署所有流程
deploySingleProcess(resourceLoader, loopProcessKey, exportDir);
}
}
}
/**
* 第二种:部署classpath/bpmn下的流程定义
* @param exportDir
* @param processKey
* @throws Exception
*/
public void deployFromClassPathBpmn(String exportDir, String... processKey) throws Exception{
ResourceLoader resourceLoader = new DefaultResourceLoader();
// String[] processKeys = {"salary.bpmn", "vacation.bpmn", "expense.bpmn", "CountSalary.bpmn"};
List<String> processKeys = loadBpmnFile(resourceLoader);
for (String loopProcessKey : processKeys) {
if (ArrayUtils.isNotEmpty(processKey)) {
//部署单个流程
if (ArrayUtils.contains(processKey, loopProcessKey)) {
logger.debug("hit module of {}", (Object[]) processKey);
deploySingleProcessByBpmn(resourceLoader, loopProcessKey, exportDir);
} else {
logger.debug("module: {} not equals process key: {}, ignore and continue find next.", loopProcessKey, processKey);
}
} else {
//部署所有流程
deploySingleProcessByBpmn(resourceLoader, loopProcessKey, exportDir);
}
}
}
/**
* 第一种:部署单个流程定义
* 此处演示部署以.zip 或者.bar结尾的文件,也可以直接部署.bpmn文件。
*
* @param resourceLoader {@link ResourceLoader}
* @param processKey 模块名称
* @throws IOException 找不到zip或bar文件时
*/
private void deploySingleProcess(ResourceLoader resourceLoader, String processKey, String exportDir) throws IOException {
String classpathResourceUrl = "classpath:/deploy/" + processKey;
logger.debug("read workflow from: {}", classpathResourceUrl);
Resource resource = resourceLoader.getResource(classpathResourceUrl);
logger.info(" resource: "+ resource.exists());
if(resource.exists()){
InputStream inputStream = resource.getInputStream();
if (inputStream == null) {
logger.warn("ignore deploy workflow module: {}", classpathResourceUrl);
} else {
logger.debug("finded workflow module: {}, deploy it!", classpathResourceUrl);
ZipInputStream zis = new ZipInputStream(inputStream);
DeploymentBuilder builder = repositoryService.createDeployment();
builder.addZipInputStream(zis);
//该方法仅仅将DeploymentBuilder 的 isDuplicateFilterEnabled 属性设置为true
//目的是过滤重复部署(如果资源没有发生变化则不会重复部署)
builder.enableDuplicateFiltering();
Deployment deployment = builder.deploy();
// Deployment deployment = repositoryService.createDeployment().addZipInputStream(zis).deploy(); //此方法会重复部署,不管资源变没变化
// export diagram
List<ProcessDefinition> list = repositoryService.createProcessDefinitionQuery().deploymentId(deployment.getId()).list();
for (ProcessDefinition processDefinition : list) {
WorkflowUtils.exportDiagramToFile(repositoryService, processDefinition, exportDir);
}
}
}else{
logger.error("the file:[ {} ]is not exists!", classpathResourceUrl);
}
}
/**
* 第二种:部署.bpmn和.png文件
* @param resourceLoader
* @param processKey
* @param exportDir
* @throws IOException
*/
private void deploySingleProcessByBpmn(ResourceLoader resourceLoader, String processKey, String exportDir) throws IOException {
System.out.println("processKey: "+processKey);
String classpathResourceUrl = "classpath:/bpmn/" + processKey;
Resource resource = resourceLoader.getResource(classpathResourceUrl);
if(resource.exists()){
InputStream inputStream = resource.getInputStream();
if (inputStream == null) {
logger.warn("ignore deploy workflow module: {}", classpathResourceUrl);
} else {
logger.debug("finded workflow module: {}, deploy it!", classpathResourceUrl);
System.out.println(resource.getFilename());
String resourceName = resource.getFilename();
DeploymentBuilder builder = repositoryService.createDeployment();
// builder.addClasspathResource("bpmn/"+resourceName); 使用addClasspathResource方法将流程描述文件和流程图部署到数据库中
builder.addInputStream(resourceName, inputStream);
builder.enableDuplicateFiltering();
builder.deploy();
}
}
}
/**
* 第一种:读取资源目录下的流程文件.zip或者.bar
* @param resourceLoader
* @return
* @throws Exception
*/
public List<String> loadDeployFile(ResourceLoader resourceLoader) throws Exception {
List<String> processKeys = new ArrayList<>();
String classpathResourceUrl = "classpath:/deploy/";
Resource resource = resourceLoader.getResource(classpathResourceUrl);
File[] listFiles = resource.getFile().listFiles();
if(listFiles.length != 0){
for(File f : listFiles) {
if(f.getName().endsWith(".zip") || f.getName().endsWith(".bar")){
processKeys.add(f.getName());
}
}
}else{
logger.debug("The classpath:/deploy/ is empty!");
throw new Exception("The classpath:/deploy/ is empty!");
}
if(processKeys.size() == 0){
logger.debug("can not find .zip or .bar in classpath:/deploy/ !");
throw new Exception("can not find .zip or .bar in classpath:/deploy/ !");
}
return processKeys;
}
/**
* 第二种:读取resource/bpmn目录下的流程描述文件
* @param resourceLoader
* @return
* @throws Exception
*/
public List<String> loadBpmnFile(ResourceLoader resourceLoader) throws Exception{
List<String> processKeys = new ArrayList<String>();
String classpathResourceUrl = "classpath:/bpmn/";
Resource resource = resourceLoader.getResource(classpathResourceUrl);
File[] listFiles = resource.getFile().listFiles();
if(listFiles.length != 0){
for(File f : listFiles) {
String fileName = f.getName();
if(fileName.endsWith(".bpmn") || fileName.endsWith(".png")){
processKeys.add(fileName);
}
}
}else{
logger.debug("The classpath:/deploy/ is empty!");
}
if(processKeys.size() == 0){
logger.debug("can not find .bpmn or .png in classpath:/bpmn/ !");
throw new Exception("can not find .zip or .bar in classpath:/bpmn/ !");
}
return processKeys;
}
/**
* 方法一:重新部署单个流程定义
*
* @param processKey 流程定义KEY
* @throws Exception
* @see #deployFromClasspath
*/
public void redeploySingleFrom(String exportDir, String... processKey) throws Exception {
this.deployFromClasspath(exportDir, processKey);
}
/**
* 方法一:重新部署所有流程定义,调用:{@link #deployFromClasspath()}完成功能
*
* @throws Exception
* @see #deployFromClasspath
*/
public void deployAllFromClasspath(String exportDir) throws Exception {
this.deployFromClasspath(exportDir);
}
/**
* 方法二:根据.bpmn文件部署
* @param exportDir
* @param processKey
* @throws Exception
*/
public void redeployBpmn(String exportDir, String... processKey) throws Exception {
this.deployFromClassPathBpmn(exportDir, processKey);
}
/**
* 方法二:部署全部bpmn流程描述文件
* @param exportDir
* @throws Exception
*/
public void redeployAllBpmn(String exportDir) throws Exception {
this.deployFromClassPathBpmn(exportDir);
}
/**
* 部署Model并修改model的状态为启用,放在事务里
* @author wj
* @param modelData
* @param modelNode
* @param processName
* @param bpmnBytes
* @throws IOException
* @throws JsonMappingException
* @throws JsonParseException
*/
public Deployment deployModelWithStatus(Model modelData, ObjectNode modelNode) throws JsonParseException, JsonMappingException, IOException {
byte[] bpmnBytes = null;
//修改model的状态为 启用
ObjectMapper mapper = new ObjectMapper();
String metaInfo = modelData.getMetaInfo();
ObjectNode node = mapper.readValue(metaInfo, ObjectNode.class);
// String status = node.get(STATUS).asText();
node.put(Constants.STATUS, Constants.ActivitiStatusEnum.work.getIndex());
modelData.setMetaInfo(node.toString());
repositoryService.saveModel(modelData);
BpmnModel model = new BpmnJsonConverter().convertToBpmnModel(modelNode);
bpmnBytes = new BpmnXMLConverter().convertToXML(model);
String processName = modelData.getName() + ".bpmn20.xml";
Deployment deployment = repositoryService.createDeployment().name(modelData.getName()).addString(processName, new String(bpmnBytes)).deploy();
return deployment;
}
}
| [
"longyz.kd@gmail.com"
] | longyz.kd@gmail.com |
2f8a2a15850104adaf71cf6b2cc8291e8ac4a1f9 | 5bab45e4ad936ac895757a8ec25c79ffc7d50c8d | /06. Spring Data Advanced Querying - Lab/shampooCompany-Lab/src/main/java/exercise/App.java | 87ff035ce8c63be674c656c97bffeca7c67748df | [] | no_license | vdjalov/HIBERNATE | 82b8d18d046d4b240527717908279d7a0132f5e5 | ec359deb1bb6a6e643221070dba756a655f548e8 | refs/heads/master | 2022-07-17T13:28:17.366052 | 2019-12-10T10:40:31 | 2019-12-10T10:40:31 | 225,934,846 | 0 | 0 | null | 2022-06-21T02:22:49 | 2019-12-04T18:47:42 | Java | UTF-8 | Java | false | false | 641 | java | package exercise;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
@SpringBootApplication
@EnableJpaRepositories(basePackages = {"repository"})
@EntityScan(basePackages = {"entities"})
@ComponentScan(basePackages = {"controller", ""})
public class App {
public static void main( String[] args ){
SpringApplication.run(App.class, args);
}
}
| [
"vdjalov@gmail.com"
] | vdjalov@gmail.com |
c5c961ef8eef9788dca20e1a88b5ba8fc449f252 | ae5eb1a38b4d22c82dfd67c86db73592094edc4b | /project466/src/main/java/org/gradle/test/performance/largejavamultiproject/project466/p2334/Production46687.java | 0e6aed61ae7655ad3d702e1ab50caaaf6fd883c5 | [] | no_license | big-guy/largeJavaMultiProject | 405cc7f55301e1fd87cee5878a165ec5d4a071aa | 1cd6a3f9c59e9b13dffa35ad27d911114f253c33 | refs/heads/main | 2023-03-17T10:59:53.226128 | 2021-03-04T01:01:39 | 2021-03-04T01:01:39 | 344,307,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,971 | java | package org.gradle.test.performance.largejavamultiproject.project466.p2334;
public class Production46687 {
private Production46684 property0;
public Production46684 getProperty0() {
return property0;
}
public void setProperty0(Production46684 value) {
property0 = value;
}
private Production46685 property1;
public Production46685 getProperty1() {
return property1;
}
public void setProperty1(Production46685 value) {
property1 = value;
}
private Production46686 property2;
public Production46686 getProperty2() {
return property2;
}
public void setProperty2(Production46686 value) {
property2 = value;
}
private String property3;
public String getProperty3() {
return property3;
}
public void setProperty3(String value) {
property3 = value;
}
private String property4;
public String getProperty4() {
return property4;
}
public void setProperty4(String value) {
property4 = value;
}
private String property5;
public String getProperty5() {
return property5;
}
public void setProperty5(String value) {
property5 = value;
}
private String property6;
public String getProperty6() {
return property6;
}
public void setProperty6(String value) {
property6 = value;
}
private String property7;
public String getProperty7() {
return property7;
}
public void setProperty7(String value) {
property7 = value;
}
private String property8;
public String getProperty8() {
return property8;
}
public void setProperty8(String value) {
property8 = value;
}
private String property9;
public String getProperty9() {
return property9;
}
public void setProperty9(String value) {
property9 = value;
}
} | [
"sterling.greene@gmail.com"
] | sterling.greene@gmail.com |
7320a8383a6bdbb0b047b2a388d7f599fbf5ed88 | 0df4bc24796bcf58c099bdd2d2f01a2d7a2b03e0 | /src/pastafari/structures/Hospital.java | 059f56d0fd7d2863c56861b46c95ee1c3afadbd4 | [] | no_license | Scriptopathe/pastafari | 32fce72e7c32c9b862d6cf4a7cc2f98368b073bb | c36c8391428d95fb39d361a2a37ec7d0ca320ceb | refs/heads/master | 2020-12-26T02:40:03.223699 | 2016-04-03T12:53:02 | 2016-04-03T12:53:02 | 55,294,290 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 235 | java | package pastafari.structures;
import pastafari.Tile;
public class Hospital extends Building {
public static final int BUILD_COST = 100;
public Hospital(Tile tile) {
super(tile, BUILD_COST, BuildingType.HOSPITAL);
}
} | [
"graphman65@gmail.com"
] | graphman65@gmail.com |
be834026a7f03f9f2bb3bdbf3fc4f1a20b275d4b | 3a24f3fc44dd51bf73c9649793706a9ec95ab9f1 | /larksuite-oapi/src/main/java/com/larksuite/oapi/service/drive_permission/v1/model/Member.java | d5b62d05fdb423fbe8b81fc595b173d8259470df | [
"Apache-2.0"
] | permissive | keeperlibofan/oapi-sdk-java | e1d6180c3ec599c9b803187a14583d5c1cb940a0 | 1b603c46d7efbb84e15d2bd245f675d2e20cd477 | refs/heads/main | 2023-04-29T23:28:24.836759 | 2021-05-14T10:55:35 | 2021-05-14T10:55:35 | 368,723,315 | 0 | 0 | Apache-2.0 | 2021-05-19T02:35:37 | 2021-05-19T02:35:36 | null | UTF-8 | Java | false | false | 830 | java | // Code generated by lark suite oapi sdk gen
package com.larksuite.oapi.service.drive_permission.v1.model;
import com.google.gson.annotations.SerializedName;
public class Member {
@SerializedName("member_type")
private String memberType;
@SerializedName("member_id")
private String memberId;
@SerializedName("perm")
private String perm;
public String getMemberType() {
return this.memberType;
}
public void setMemberType(String memberType) {
this.memberType = memberType;
}
public String getMemberId() {
return this.memberId;
}
public void setMemberId(String memberId) {
this.memberId = memberId;
}
public String getPerm() {
return this.perm;
}
public void setPerm(String perm) {
this.perm = perm;
}
}
| [
"zhaomingqiang@bytedance.com"
] | zhaomingqiang@bytedance.com |
a0e94beb88e7b87ea53ddc210aea5a281dfb112c | 1003dac6ecc8722738b26b0ad7783e730eae94f5 | /fundooNotes/src/main/java/com/bridgelabz/fundooNotes/user/services/UserServicelogImpl.java | 34ec9312baa57d220556fe11e512ac9f95169193 | [] | no_license | Sush25b/fundooNotes--backend | ffc91e2930ee87942b3731606a2f3a7ec181ee9c | 39cbe5aaf9272b83a7d03380df0e8a283b4c46af | refs/heads/master | 2020-04-25T04:09:39.600719 | 2019-04-29T14:00:05 | 2019-04-29T14:00:05 | 172,501,534 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,345 | java | package com.bridgelabz.fundooNotes.user.services;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.util.Optional;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import com.bridgelabz.fundooNotes.user.dto.LoginDto;
import com.bridgelabz.fundooNotes.user.dto.UserDto;
import com.bridgelabz.fundooNotes.user.exception.UserException;
import com.bridgelabz.fundooNotes.user.exception.UserException2;
import com.bridgelabz.fundooNotes.user.model.User;
import com.bridgelabz.fundooNotes.user.repository.IUserRepository;
import com.bridgelabz.fundooNotes.utility.MailHelper;
import com.bridgelabz.fundooNotes.utility.TokenUtil;
import java.util.Properties;
import javax.mail.Authenticator;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
@PropertySource("classpath:message.properties")
@Service
public class UserServicelogImpl {
// @Value("${sender.email}")
static String fromEmail = null;
// @Value("${sender.password}")
String password = null;
String toEmail = "phulsundarsushant26@gmail.com";
// String receiver= null;
String msgheader = "Welcome to Bridgeit ";
String textmsg = "Your account has been added successfully";
@Autowired
IUserRepository userRepository;
@Autowired
private PasswordEncoder passwordEncoder;
@Autowired
private ModelMapper modelMapper;
@Autowired
Environment environment;
//=========================================================
Date date=new Date();
String updateDate= date.toString();
String registerDate= date.toString();
//=========================================================
// successfull
/**
* Method to---> login
*/
public String onLogin(LoginDto loginDto) throws UnsupportedEncodingException {
//// System.out.println(loginDto.getEmailid());
// get the User (i.e User Object) from loginDTO
User user = modelMapper.map(loginDto, User.class);
//// System.out.println(user);
System.out.println(user.getEmailid());
//get The User (i.e User Object) from Database --->having email passed here
// here we directly use java 8 lambada Throw Exception feature
User validUser =userRepository.findByEmailid(user.getEmailid()).orElseThrow(()-> new UserException(401,environment.getProperty("user.wrongemailid")));
System.out.println(validUser);
if(validUser.getIsVerified().equals(true))
{
//match the loginDto password && validUser password
boolean passwordStatus =passwordEncoder.matches(loginDto.getPassword(), validUser.getPassword());
System.out.println(validUser.getPassword()+"<============>"+loginDto.
getPassword());
if (passwordStatus == false )
{
System.out.println("!!!!!!!!!!!!!!!!!");
throw new UserException(401,environment.getProperty("user.wrongemailid"));
}
else
{
return "Wrong password";
}
}
return "login successfully";
}
/*
* //successfull
*//**
* Method for---> Register User
*//*
* public String authenticate(Optional<User> user, String password) throws
* UserException,UnsupportedEncodingException {
* System.out.println("*********************************************");
*
* Optional<User> useralreadyPresent =
* userRepository.findByEmailid(user.get().getEmailid());
*
* if (user.get().getIsVerified().equals(true)) {
* System.out.println("!!!!!!!!!!!!!!!!!"); throw new
* UserException(401,environment.getProperty("user.register")); }
*
* // encode user password String password =
* passwordEncoder.encode(userDto.getPassword());
*
* user.setPassword(password);
*
* //the Repository==>will save the Object & also return the Saved Object user=
* userRepository.save(user);
*
* //call method-->to send mail sendmail("successfully register",user.getId());
*
* //return return "successfully Register"; }
*/
// successfull
/**
* Method for---> Register User
*/
public String onRegister(UserDto userDto) throws UserException, UnsupportedEncodingException {
System.out.println("*********************************************");
User user = modelMapper.map(userDto, User.class);
Optional<User> useralreadyPresent = userRepository.findByEmailid(user.getEmailid());
if (useralreadyPresent.isPresent())
{
System.out.println("!!!!!!!!!!!!!!!!!");
throw new UserException(401, environment.getProperty("user.register"));
}
// encode user password
String password = passwordEncoder.encode(userDto.getPassword());
user.setPassword(password);
user.setUpdateDate(updateDate);
user.setRegisterDate(registerDate);
// the Repository==>will save the Object & also return the Saved Object
user = userRepository.save(user);
// call method-->to send mail
sendmail("successfully register", user.getId());
// return
return "successfully Register";
}
// successfull
/**
* Method for forgetPassword
*/
public String forgetPassword(String emailId) throws UserException, UnsupportedEncodingException {
// userRepository.fin
Optional<User> alreadyPresent = userRepository.findByEmailid(emailId);
// check user present in database or not
if (!alreadyPresent.isPresent()) {
throw new UserException(401, environment.getProperty("user.forgetpassword.emailId"));
}
Long id = alreadyPresent.get().getId();
// call method-->to send mail
sendmail("successfully register", id);
return "Mail send to setpassword";
}
/**
* method to resetpassword
*/
public String resetPassword(String token, String password) throws UserException, UnsupportedEncodingException {
// encode user
Long userid = TokenUtil.decodeToken(token);
// convert Long to int
Long id = userid;
System.out.println("9999999999999999999" + userid);
Optional<User> alreadyPresent = userRepository.findByid(userid);
// System.out.println(alreadyPresent.get()+"&&&&&&&&&&&&&&&&&&&&&&&&&&");
// check user present in database or not
if (!alreadyPresent.isPresent()) {
throw new UserException(401, environment.getProperty("user.resetpassword"));
}
// encode=====> user newpassword
String newpassword = passwordEncoder.encode(password);
// set newpassword===>for given emailid
alreadyPresent.get().setPassword(newpassword);
User user = alreadyPresent.get();
System.out.println(user + "****************************");
// the Repository==>will save the Object & also return the Saved Object
user = userRepository.save(user);
// from,password,to,subject,message
// call method-->to send mail
sendmail("successfully register", id);
// return
return "password reset successfully";
}
/**
* Method to verifyEmail
*/
public String validEmail(String token) throws UserException, UnsupportedEncodingException {
// encode user
Long userid = TokenUtil.decodeToken(token);
// convert Long to int
//int id = userid.intValue();
System.out.println("9999999999999999999" + userid);
//System.out.println("9999999999999999999" + id);
Optional<User> alreadyPresent = userRepository.findByid(userid);
// System.out.println(alreadyPresent.get()+"&&&&&&&&&&&&&&&&&&&&&&&&&&");
// check user present in database or not
if (!alreadyPresent.isPresent()) {
throw new UserException(401, environment.getProperty("user.tokenexpire"));
}
alreadyPresent.get().setIsVerified("true");
User user = alreadyPresent.get();
System.out.println(user + "****************************");
// the Repository==>will save the Object & also return the Saved Object
user = userRepository.save(user);
// from,password,to,subject,message
// call method-->to send mail
sendmail("successfully register", userid);
// return
return "Email isverified successfully";
}
public void sendmail(String mailSubject, Long userId) {
/*
* Outgoing Mail (SMTP) Server requires TLS or SSL: smtp.gmail.com (use
* authentication) Use Authentication: Yes Port for SSL: 465
*/
fromEmail = environment.getProperty("sender.email");
password = environment.getProperty("sender.password");
System.out.println("SSLEmail Start");
Properties props = new Properties();
props.put("mail.smtp.host", "smtp.gmail.com"); // SMTP Host
props.put("mail.smtp.socketFactory.port", "465"); // SSL Port
props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); // SSL Factory Class
props.put("mail.smtp.auth", "true"); // Enabling SMTP Authentication
props.put("mail.smtp.port", "465"); // SMTP Port
Authenticator auth = new Authenticator() {
// override the getPasswordAuthentication method
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(fromEmail, password);
}
};
Session session = Session.getDefaultInstance(props, auth);
System.out.println("Session created");
System.out.println(fromEmail + " " + "*******" + " " + toEmail + " " + mailSubject);
MailHelper.sendEmail(session, toEmail, mailSubject, MailHelper.getUrl(userId));
}
}
| [
"noreply@github.com"
] | noreply@github.com |
ad28874a895e7458d1cc687c97a5eb6faf889551 | 746976e29a8f75901b56222354bc1a221e697676 | /src/com/edrp/edrp/ImageAdapter.java | 6d5defb4a57003a68310f5d5bc404d66329c7f52 | [] | no_license | animeshjn/EDRP | c046eddbcdab6c28bcb19acc09fbed7a7e7880d3 | c3a619d6c70881c590313aaf0ae951ff53973575 | refs/heads/master | 2021-01-18T18:42:29.381464 | 2017-04-01T03:36:54 | 2017-04-01T03:36:54 | 86,873,440 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,726 | java | package com.edrp.edrp;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
public class ImageAdapter extends BaseAdapter {
private Context mContext;
// Keep all Images in array
public String[] str;
public Integer[] mThumbIds = {
R.drawable.icn_account, R.drawable.icn_attendance,
R.drawable.icn_libsrch, R.drawable.icn_info,
R.drawable.icn_news, R.drawable.icn_ct,R.drawable.icn_libtr
};
// Constructor
public ImageAdapter(Context c,String [] str){
mContext = c;
this.str = str;
}
@Override
public int getCount() {
return mThumbIds.length;
}
@Override
public Object getItem(int position) {
return mThumbIds[position];
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) mContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View gridView;
if (convertView == null) {
gridView = inflater.inflate(R.layout.grid_option, null);
//TextView work
TextView tv = (TextView)gridView.findViewById(R.id.opt);
tv.setText(str[position]);
//ImageView work
ImageView img = (ImageView)gridView.findViewById(R.id.img);
if(str[position].equalsIgnoreCase("my info")){
img.setImageResource(R.drawable.icn_info);
}
else if(str[position].equalsIgnoreCase("attendance")){
img.setImageResource(R.drawable.icn_attendance);
}
else if(str[position].equalsIgnoreCase("accounts")){
img.setImageResource(R.drawable.icn_account);
}
else if(str[position].equalsIgnoreCase("search library books")){
img.setImageResource(R.drawable.icn_libsrch);
}
else if(str[position].equalsIgnoreCase("news/notice")){
img.setImageResource(R.drawable.icn_news);
}
else if(str[position].equalsIgnoreCase("CT marks")){
img.setImageResource(R.drawable.icn_ct);
}
else if(str[position].equalsIgnoreCase("Library transaction")){
img.setImageResource(R.drawable.icn_libtr);
}
} else {
gridView = (View) convertView;
}
return gridView;
}
}
| [
"animesh.jain@hotmail.com"
] | animesh.jain@hotmail.com |
27c8f6a0cbb96b270459b95ac1594ec01e886333 | 148e80a06dbb14208896e1425256e7731498d27d | /src/main/java/be/yildizgames/common/configuration/Configurable.java | b67ca4d546e8628858abd5756748bba9ecb11892 | [
"MIT"
] | permissive | yildiz-online/common-configuration | 40ddecc5d7fea0b566d803ce737522d249952117 | 1ea7426cd6824f3f5a5555c3f2a6644add90cab2 | refs/heads/develop | 2022-10-23T07:22:35.494367 | 2022-09-27T15:31:38 | 2022-09-27T15:31:38 | 168,365,723 | 0 | 0 | MIT | 2022-10-09T16:18:11 | 2019-01-30T15:27:17 | Java | UTF-8 | Java | false | false | 1,440 | java | /*
*
* This file is part of the Yildiz-Engine project, licenced under the MIT License (MIT)
*
* Copyright (c) 2019 Grégory Van den Borre
*
* More infos available: https://engine.yildiz-games.be
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without
* limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
* OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*
*/
package be.yildizgames.common.configuration;
/**
* @author Grégory Van den Borre
*/
public interface Configurable<T> {
void configure(T config);
}
| [
"vandenborre.gregory@hotmail.fr"
] | vandenborre.gregory@hotmail.fr |
9e4dc110c904b1fbb6f36c141a119eb3aad8997b | c20cdcd5f52a9ba2f3047a95e3b5178b95a43acb | /generate-url/src/main/java/com/service/url/generateurl/config/Config.java | 508d94f5b768757c2fcca084075845de5e2a174a | [] | no_license | tribonacci/url-shortener | 2ce50192986c5f679a8087003e7966df16dafd31 | 9a345cd38ccc7cda2ff0b5c085567dc4d2450453 | refs/heads/master | 2020-03-28T23:31:26.105073 | 2018-11-16T06:28:45 | 2018-11-16T06:28:45 | 149,295,514 | 0 | 0 | null | 2018-10-10T14:48:20 | 2018-09-18T13:46:40 | Ruby | UTF-8 | Java | false | false | 413 | java | package com.service.url.generateurl.config;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
@Configuration
public class Config {
@LoadBalanced
@Bean
public RestTemplate restTemplate() {
return new RestTemplate();
}
}
| [
"visingh@zynga.com"
] | visingh@zynga.com |
76c6e45077f15f4123e7dd5ea525ed367003cc56 | fe3d4e813786400723ca31d37796587dce643a6d | /src/main/java/net/mcreator/techadventure/procedures/AppleUpgraderProcedureProcedure.java | 80ee6f336d4b3a82f1c6f9bb213d69fafe136136 | [
"MIT"
] | permissive | CaptainLugaru/tech_adventure | 6cba8db549242f9fa9238d6cc48faafa2cb28cfd | bfe070fd92ccca48f260eb42051baf6498dfbff1 | refs/heads/main | 2023-07-07T20:22:06.270276 | 2021-09-02T06:38:07 | 2021-09-02T06:38:07 | 386,365,127 | 0 | 0 | MIT | 2021-09-02T06:38:08 | 2021-07-15T17:00:47 | Java | UTF-8 | Java | false | false | 4,014 | java | package net.mcreator.techadventure.procedures;
import net.minecraft.item.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.inventory.container.Slot;
import net.minecraft.inventory.container.Container;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.Entity;
import net.mcreator.techadventure.TechAdventureMod;
import java.util.function.Supplier;
import java.util.Map;
public class AppleUpgraderProcedureProcedure {
public static void executeProcedure(Map<String, Object> dependencies) {
if (dependencies.get("entity") == null) {
if (!dependencies.containsKey("entity"))
TechAdventureMod.LOGGER.warn("Failed to load dependency entity for procedure AppleUpgraderProcedure!");
return;
}
Entity entity = (Entity) dependencies.get("entity");
if ((((entity instanceof PlayerEntity) ? ((PlayerEntity) entity).experienceLevel : 0) > 2)) {
if (((new Object() {
public ItemStack getItemStack(int sltid) {
Entity _ent = entity;
if (_ent instanceof ServerPlayerEntity) {
Container _current = ((ServerPlayerEntity) _ent).openContainer;
if (_current instanceof Supplier) {
Object invobj = ((Supplier) _current).get();
if (invobj instanceof Map) {
return ((Slot) ((Map) invobj).get(sltid)).getStack();
}
}
}
return ItemStack.EMPTY;
}
}.getItemStack((int) (0))).getItem() == Items.APPLE)) {
{
Entity _ent = entity;
if (_ent instanceof ServerPlayerEntity) {
Container _current = ((ServerPlayerEntity) _ent).openContainer;
if (_current instanceof Supplier) {
Object invobj = ((Supplier) _current).get();
if (invobj instanceof Map) {
((Slot) ((Map) invobj).get((int) (0))).decrStackSize((int) (1));
_current.detectAndSendChanges();
}
}
}
}
if (entity instanceof PlayerEntity) {
Container _current = ((PlayerEntity) entity).openContainer;
if (_current instanceof Supplier) {
Object invobj = ((Supplier) _current).get();
if (invobj instanceof Map) {
ItemStack _setstack = new ItemStack(Items.GOLDEN_APPLE);
_setstack.setCount((int) 1);
((Slot) ((Map) invobj).get((int) (1))).putStack(_setstack);
_current.detectAndSendChanges();
}
}
}
if (entity instanceof PlayerEntity)
((PlayerEntity) entity).addExperienceLevel(-((int) 2));
} else if (((new Object() {
public ItemStack getItemStack(int sltid) {
Entity _ent = entity;
if (_ent instanceof ServerPlayerEntity) {
Container _current = ((ServerPlayerEntity) _ent).openContainer;
if (_current instanceof Supplier) {
Object invobj = ((Supplier) _current).get();
if (invobj instanceof Map) {
return ((Slot) ((Map) invobj).get(sltid)).getStack();
}
}
}
return ItemStack.EMPTY;
}
}.getItemStack((int) (0))).getItem() == Items.GOLDEN_APPLE)) {
{
Entity _ent = entity;
if (_ent instanceof ServerPlayerEntity) {
Container _current = ((ServerPlayerEntity) _ent).openContainer;
if (_current instanceof Supplier) {
Object invobj = ((Supplier) _current).get();
if (invobj instanceof Map) {
((Slot) ((Map) invobj).get((int) (0))).decrStackSize((int) (1));
_current.detectAndSendChanges();
}
}
}
}
if (entity instanceof PlayerEntity) {
Container _current = ((PlayerEntity) entity).openContainer;
if (_current instanceof Supplier) {
Object invobj = ((Supplier) _current).get();
if (invobj instanceof Map) {
ItemStack _setstack = new ItemStack(Items.ENCHANTED_GOLDEN_APPLE);
_setstack.setCount((int) 1);
((Slot) ((Map) invobj).get((int) (1))).putStack(_setstack);
_current.detectAndSendChanges();
}
}
}
if (entity instanceof PlayerEntity)
((PlayerEntity) entity).addExperienceLevel(-((int) 9));
}
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
7dce730a2d2ab1a9ef5388805d0cecdd421899a0 | 5e9c52eb69bae4163cc23d28c4d936e6b68b6202 | /EmpPayrollApp/src/main/java/com/cg/emppayrollapp/domain/EmployeePayroll.java | 71ffba557207f6e35482027148305bfdb3781bad | [] | no_license | Abhinav9p16/EmployeePayrollFEBE | ebf5b4d17be87a69537fee21c4fcc625b9082553 | a02e6addc224500a2b06f19c34eb8c66edb470a9 | refs/heads/master | 2023-01-29T20:50:30.022011 | 2020-12-14T17:53:38 | 2020-12-14T17:53:38 | 316,421,863 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,011 | java | package com.cg.emppayrollapp.domain;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import java.io.Serializable;
@Data
@Entity
@Table(name = "employee")
public class EmployeePayroll implements Serializable {
private static final long serialVersionUID = -8900492704842756948L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String name;
private String salary;
public EmployeePayroll() {
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSalary() {
return salary;
}
public void setSalary(String salary) {
this.salary = salary;
}
public EmployeePayroll(String name, String salary) {
this.name = name;
this.salary = salary;
}
}
| [
"thakurabhinav56@gmail.com"
] | thakurabhinav56@gmail.com |
d9a9fd8682b5dbbbd1b599dc1efa2ae1112d351a | 456c6060e3d0d81c79ac90c4b02d0314e762c7c3 | /app/src/main/java/com/bw/movie/icoolor/HomePageYingPingContral.java | 24345787fd7f174934956da35b98297fe16e1635 | [] | no_license | qq2321856543/Movie | 2a2de038390b4d72931c6fc73a7a6112617ca4d1 | bf072a0aab5daaf1b729bad07b6a37eab79ad287 | refs/heads/master | 2022-07-30T23:45:48.174526 | 2020-05-15T11:34:22 | 2020-05-15T11:34:22 | 258,491,429 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 697 | java | package com.bw.movie.icoolor;
import com.bw.movie.base.IBaseView;
import com.bw.movie.bean.YingPingBean;
public class HomePageYingPingContral {
public interface getView extends IBaseView {
void getYingPingrSucc(YingPingBean yingPingBean);
void getYingPingFiuld(String str);
}
public interface getPresetner{
void getYingPing(int movieId, int page, int count);
}
public interface getModel{
void getYingPing(int movieId, int page, int count, CallBackYingPing callBackYingPing);
interface CallBackYingPing{
void getYingPingSucc(YingPingBean yingPingBean);
void getYingPingFiuld(String str);
}
}
}
| [
"2321856543@qq.com"
] | 2321856543@qq.com |
2d3024e19ad37c733ea7340b1d51027192591c79 | 2146f5a837c996f1a59246adada3aae068fac8d0 | /service_search/src/main/java/cn/itcast/core/listener/ItemSearchListener.java | a94e43ba181a2dbd27563d4e3a59c2ebd014131e | [] | no_license | lfx1231/p1solo | 6a0fd92863f4010c8b5d110f1b20f699cdd2cae6 | 823f44f71d7983f79922487cd09311a2ade4a85d | refs/heads/master | 2022-12-21T12:10:06.656217 | 2019-05-29T13:11:50 | 2019-05-29T13:12:55 | 189,236,242 | 0 | 0 | null | 2022-12-16T07:13:42 | 2019-05-29T13:57:45 | JavaScript | UTF-8 | Java | false | false | 859 | java | package cn.itcast.core.listener;
import cn.itcast.core.service.SolrService;
import org.apache.activemq.command.ActiveMQTextMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
//自定义监听器
public class ItemSearchListener implements MessageListener{
@Autowired
private SolrService solrService;
@Override
public void onMessage(Message message) {
ActiveMQTextMessage amt = (ActiveMQTextMessage) message;
try {
String id = amt.getText();
long goodsId = Long.parseLong(id);
Long[] arr = {goodsId};
solrService.addItemToSolr(arr);
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"278464087@qq.com"
] | 278464087@qq.com |
dbb8543fb8076042c39a9715c4ff9de84a2c2321 | e6e9ef5f1e7f16d19658fb6ad8c3355084f21d8b | /dmitry/hiberwords/src/main/java/com/wdt/java/HibernateUtil.java | ca61bc2a1c97bbb70677a9578055a2c3ca96128e | [] | no_license | VladislavKisliy/java-int-school | cca8a7a43e1dad1113989f9e018f7e52c314800a | 319d316d6b5845545b393abf50a4e0fd6ada5901 | refs/heads/master | 2016-09-10T10:19:34.572991 | 2016-02-07T15:25:02 | 2016-02-07T15:25:02 | 33,788,875 | 2 | 2 | null | 2015-04-13T12:01:06 | 2015-04-11T19:19:13 | null | UTF-8 | Java | false | false | 712 | java | package com.wdt.java;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
public class HibernateUtil {
private static final SessionFactory sessionFactory = buildSessionFactory();
private static SessionFactory buildSessionFactory() {
try {
// Create the SessionFactory from hibernate.cfg.xml
return new Configuration().configure().buildSessionFactory();
}
catch (Throwable ex) {
// Make sure you log the exception, as it might be swallowed
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex);
}
}
public static SessionFactory getSessionFactory() {
return sessionFactory;
}
}
| [
"dmitry.kuzmin@weigandt-consulting.com"
] | dmitry.kuzmin@weigandt-consulting.com |
257a9183f5a0af4f9ef1c48898cfdc687fddcd41 | 8aafdacfb0f594208e7b1364d293bed07790bfe9 | /springboot-sxgdhz/sxgdhz/sxgdhz-web/src/main/java/com/ruoyi/project/system/user/mapper/UserMapper.java | c1a1bacceb0743a6191e71c893ea7a2ab7e515d6 | [
"MIT"
] | permissive | sxgdhz226/sxgdhz-admin | 722221b989610314aa28bbf2f90c73cb2beaa08f | eb9b4c2288b5d523b9d1819eab631a06c65076ca | refs/heads/master | 2020-04-02T12:47:23.557097 | 2018-11-12T02:37:34 | 2018-11-12T02:37:34 | 154,451,851 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,336 | java | package com.ruoyi.project.system.user.mapper;
import com.ruoyi.project.system.user.domain.User;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 用户表 数据层
*
* @author ruoyi
*/
public interface UserMapper
{
/**
* 根据条件分页查询用户对象
*
* @param user 用户信息
* @return 用户信息集合信息
*/
public List<User> selectUserList(User user);
/**
* 通过用户名查询用户
*
* @param userName 用户名
* @return 用户对象信息
*/
public User selectUserByLoginName(String userName);
/**
* 通过手机号码查询用户
*
* @param phoneNumber 手机号码
* @return 用户对象信息
*/
public User selectUserByPhoneNumber(String phoneNumber);
/**
* 通过邮箱查询用户
*
* @param email 邮箱
* @return 用户对象信息
*/
public User selectUserByEmail(String email);
/**
* 通过用户ID查询用户
*
* @param userId 用户ID
* @return 用户对象信息
*/
public User selectUserById(Long userId);
/**
* 通过用户ID删除用户
*
* @param userId 用户ID
* @return 结果
*/
public int deleteUserById(Long userId);
/**
* 批量删除用户信息
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteUserByIds(Long[] ids);
/**
* 修改用户信息
*
* @param user 用户信息
* @return 结果
*/
public int updateUser(User user);
/**
* 新增用户信息
*
* @param user 用户信息
* @return 结果
*/
public int insertUser(User user);
/**
* 校验用户名称是否唯一
*
* @param loginName 登录名称
* @return 结果
*/
public int checkLoginNameUnique(String loginName);
/**
* 校验手机号码是否唯一
*
* @param phonenumber 手机号码
* @return 结果
*/
public User checkPhoneUnique(String phonenumber);
/**
* 校验email是否唯一
*
* @param email 用户邮箱
* @return 结果
*/
public User checkEmailUnique(String email);
public List<User> selectUser(@Param("name") String name);
}
| [
"1600328315@qq.com"
] | 1600328315@qq.com |
813546e595e3cc4de88c5db06cc6fe4b37465164 | 572aef2925f47805a5446f077182ef2e8f78e0de | /j2EE/javaweb/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/work/Catalina/localhost/jstl01/org/apache/jsp/_01/_01_jsp.java | 5f908c7d257b323928ae8ae1e171c306b6294da8 | [] | no_license | zoulincheng/javaeestudy | bf78d8abbbd5b5a7c7005196a56e2788e13d1701 | 128ef19136cdcff710bc8aa68868dd53a0951add | refs/heads/master | 2021-01-20T15:36:29.197616 | 2016-07-30T09:32:34 | 2016-07-30T09:32:34 | 64,536,961 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,051 | java | package org.apache.jsp._01;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class _01_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 _jspx_dependants;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fc_005fout_0026_005fvalue_005fescapeXml_005fdefault_005fnobody;
private javax.el.ExpressionFactory _el_expressionfactory;
private org.apache.AnnotationProcessor _jsp_annotationprocessor;
public Object getDependants() {
return _jspx_dependants;
}
public void _jspInit() {
_005fjspx_005ftagPool_005fc_005fout_0026_005fvalue_005fescapeXml_005fdefault_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
_jsp_annotationprocessor = (org.apache.AnnotationProcessor) getServletConfig().getServletContext().getAttribute(org.apache.AnnotationProcessor.class.getName());
}
public void _jspDestroy() {
_005fjspx_005ftagPool_005fc_005fout_0026_005fvalue_005fescapeXml_005fdefault_005fnobody.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;
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("<title>Insert title here</title>\r\n");
request.setAttribute("username", "<h1>zhangsan</h1>");
out.write("\r\n");
out.write("</head>\r\n");
out.write("<body>\r\n");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${username}", java.lang.String.class, (PageContext)_jspx_page_context, null, false));
out.write("<!-- 会先在pageContext找,未找到会去request 都没找到不显示 -->\r\n");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${hello}", java.lang.String.class, (PageContext)_jspx_page_context, null, false));
out.write('\r');
out.write('\n');
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${param.hello}", java.lang.String.class, (PageContext)_jspx_page_context, null, false));
out.write('\r');
out.write('\n');
if (_jspx_meth_c_005fout_005f0(_jspx_page_context))
return;
out.write("\r\n");
out.write("\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)
try { out.clearBuffer(); } catch (java.io.IOException e) {}
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else log(t.getMessage(), t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
private boolean _jspx_meth_c_005fout_005f0(PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// c:out
org.apache.taglibs.standard.tag.rt.core.OutTag _jspx_th_c_005fout_005f0 = (org.apache.taglibs.standard.tag.rt.core.OutTag) _005fjspx_005ftagPool_005fc_005fout_0026_005fvalue_005fescapeXml_005fdefault_005fnobody.get(org.apache.taglibs.standard.tag.rt.core.OutTag.class);
_jspx_th_c_005fout_005f0.setPageContext(_jspx_page_context);
_jspx_th_c_005fout_005f0.setParent(null);
// /01/01.jsp(17,0) name = value type = null reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_c_005fout_005f0.setValue((java.lang.Object) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${username1}", java.lang.Object.class, (PageContext)_jspx_page_context, null, false));
// /01/01.jsp(17,0) name = default type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_c_005fout_005f0.setDefault("查无此人");
// /01/01.jsp(17,0) name = escapeXml type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_c_005fout_005f0.setEscapeXml(false);
int _jspx_eval_c_005fout_005f0 = _jspx_th_c_005fout_005f0.doStartTag();
if (_jspx_th_c_005fout_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fc_005fout_0026_005fvalue_005fescapeXml_005fdefault_005fnobody.reuse(_jspx_th_c_005fout_005f0);
return true;
}
_005fjspx_005ftagPool_005fc_005fout_0026_005fvalue_005fescapeXml_005fdefault_005fnobody.reuse(_jspx_th_c_005fout_005f0);
return false;
}
}
| [
"99linzi@163.com"
] | 99linzi@163.com |
ae32647cfe885d96801f59fbd647179c7666d1f2 | f757b83e92bc4ceb43edd06be437568cbff5f846 | /src/main/java/com/pocketchat/services/conversation_group_mute_notification/ConversationGroupMuteNotificationServiceImpl.java | 30f959a52bc7401304b65610c7948c046664d177 | [
"Apache-2.0"
] | permissive | tkhenghong/pocketChatREST | f59dd3610b45d62edfcd37e06b6039819a138656 | 38a2061154221367f71c85d9a7a5d23ed1da0269 | refs/heads/master | 2023-06-26T17:43:53.393041 | 2021-07-31T05:42:45 | 2021-07-31T05:42:45 | 198,076,148 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,402 | java | package com.pocketchat.services.conversation_group_mute_notification;
import com.pocketchat.db.models.conversation_group_mute_notification.ConversationGroupMuteNotification;
import com.pocketchat.db.repo_services.conversation_group_mute_notification.ConversationGroupMuteNotificationRepoService;
import com.pocketchat.models.controllers.request.conversation_group.CreateConversationGroupMuteNotificationRequest;
import com.pocketchat.models.controllers.response.conversation_group_mute_notification.ConversationGroupMuteNotificationResponse;
import com.pocketchat.server.exceptions.conversation_group_mute_notification.ConversationGroupMuteNotificationNotFoundException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Optional;
@Service
public class ConversationGroupMuteNotificationServiceImpl implements ConversationGroupMuteNotificationService {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
private final ConversationGroupMuteNotificationRepoService conversationGroupMuteNotificationRepoService;
@Autowired
public ConversationGroupMuteNotificationServiceImpl(ConversationGroupMuteNotificationRepoService conversationGroupMuteNotificationRepoService) {
this.conversationGroupMuteNotificationRepoService = conversationGroupMuteNotificationRepoService;
}
@Override
public ConversationGroupMuteNotification addConversationGroupMuteNotification(CreateConversationGroupMuteNotificationRequest createConversationGroupMuteNotificationRequest) {
ConversationGroupMuteNotification conversationGroupMuteNotification = createConversationGroupMuteNotificationRequestToConversationGroupMuteNotification(createConversationGroupMuteNotificationRequest);
return conversationGroupMuteNotificationRepoService.save(conversationGroupMuteNotification);
}
@Override
public boolean isConversationGroupMuted(String userContactId, String conversationGroupId) {
return conversationGroupMuteNotificationRepoService.existUserContactIdAndConversationGroupId(userContactId, conversationGroupId);
}
@Override
public ConversationGroupMuteNotification getSingleConversationGroupMuteNotification(String conversationGroupMuteNotificationId) {
Optional<ConversationGroupMuteNotification> conversationGroupMuteNotificationOptional = conversationGroupMuteNotificationRepoService.findById(conversationGroupMuteNotificationId);
if (conversationGroupMuteNotificationOptional.isEmpty()) {
throw new ConversationGroupMuteNotificationNotFoundException("Unable to find any mute record from the conversationGroupMuteNotificationId: " + conversationGroupMuteNotificationId);
}
return conversationGroupMuteNotificationOptional.get();
}
@Override
public void deleteConversationGroupMuteNotification(String conversationGroupMuteNotificationId) {
conversationGroupMuteNotificationRepoService.deleteById(conversationGroupMuteNotificationId);
}
private ConversationGroupMuteNotification createConversationGroupMuteNotificationRequestToConversationGroupMuteNotification(CreateConversationGroupMuteNotificationRequest createConversationGroupMuteNotificationRequest) {
return ConversationGroupMuteNotification.builder()
.userContactId(createConversationGroupMuteNotificationRequest.getUserContactId())
.conversationGroupId(createConversationGroupMuteNotificationRequest.getConversationGroupId())
.notificationBlockExpire(createConversationGroupMuteNotificationRequest.getNotificationBlockExpire())
.build();
}
@Override
public ConversationGroupMuteNotificationResponse conversationGroupMuteNotificationResponseMapper(ConversationGroupMuteNotification conversationGroupMuteNotification) {
return ConversationGroupMuteNotificationResponse.builder()
.id(conversationGroupMuteNotification.getId())
.userContactId(conversationGroupMuteNotification.getUserContactId())
.conversationGroupId(conversationGroupMuteNotification.getConversationGroupId())
.notificationBlockExpire(conversationGroupMuteNotification.getNotificationBlockExpire())
.build();
}
}
| [
"tkhenghong@gmail.com"
] | tkhenghong@gmail.com |
878bec656abca64a7812032bd42329de68f5d96c | 20eb62855cb3962c2d36fda4377dfd47d82eb777 | /newEvaluatedBugs/Jsoup_19_buggy/mutated/105/Node.java | 33069bb93aacde540e53be69304192063dc67c56 | [] | 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 | 22,116 | java | package org.jsoup.nodes;
import org.jsoup.helper.StringUtil;
import org.jsoup.helper.Validate;
import org.jsoup.parser.Parser;
import org.jsoup.select.NodeTraversor;
import org.jsoup.select.NodeVisitor;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
/**
The base, abstract Node model. Elements, Documents, Comments etc are all Node instances.
@author Jonathan Hedley, jonathan@hedley.net */
public abstract class Node implements Cloneable {
Node parentNode;
List<Node> childNodes;
Attributes attributes;
String baseUri;
int siblingIndex;
/**
Create a new Node.
@param baseUri base URI
@param attributes attributes (not null, but may be empty)
*/
protected Node(String baseUri, Attributes attributes) {
Validate.notNull(baseUri);
Validate.notNull(attributes);
childNodes = new ArrayList<Node>(4);
this.baseUri = baseUri.trim();
this.attributes = attributes;
}
protected Node(String baseUri) {
this(baseUri, new Attributes());
}
/**
* Default constructor. Doesn't setup base uri, children, or attributes; use with caution.
*/
protected Node() {
childNodes = Collections.emptyList();
attributes = null;
}
/**
Get the node name of this node. Use for debugging purposes and not logic switching (for that, use instanceof).
@return node name
*/
public abstract String nodeName();
/**
* Get an attribute's value by its key.
* <p>
* To get an absolute URL from an attribute that may be a relative URL, prefix the key with <code><b>abs</b></code>,
* which is a shortcut to the {@link #absUrl} method.
* </p>
* E.g.:
* <blockquote><code>String url = a.attr("abs:href");</code></blockquote>
*
* @param attributeKey The attribute key.
* @return The attribute, or empty string if not present (to avoid nulls).
* @see #attributes()
* @see #hasAttr(String)
* @see #absUrl(String)
*/
public String attr(String attributeKey) {
Validate.notNull(attributeKey);
if (attributes.hasKey(attributeKey))
return attributes.get(attributeKey);
else if (attributeKey.toLowerCase().startsWith("abs:"))
return absUrl(attributeKey.substring("abs:".length()));
else return "";
}
/**
* Get all of the element's attributes.
* @return attributes (which implements iterable, in same order as presented in original HTML).
*/
public Attributes attributes() {
return attributes;
}
/**
* Set an attribute (key=value). If the attribute already exists, it is replaced.
* @param attributeKey The attribute key.
* @param attributeValue The attribute value.
* @return this (for chaining)
*/
public Node attr(String attributeKey, String attributeValue) {
attributes.put(attributeKey, attributeValue);
return this;
}
/**
* Test if this element has an attribute.
* @param attributeKey The attribute key to check.
* @return true if the attribute exists, false if not.
*/
public boolean hasAttr(String attributeKey) {
Validate.notNull(attributeKey);
if (attributeKey.startsWith("abs:")) {
String key = attributeKey.substring("abs:".length());
if (attributes.hasKey(key) && !absUrl(key).equals(""))
return true;
}
return attributes.hasKey(attributeKey);
}
/**
* Remove an attribute from this element.
* @param attributeKey The attribute to remove.
* @return this (for chaining)
*/
public Node removeAttr(String attributeKey) {
Validate.notNull(attributeKey);
attributes.remove(attributeKey);
return this;
}
/**
Get the base URI of this node.
@return base URI
*/
public String baseUri() {
return baseUri;
}
/**
Update the base URI of this node and all of its descendants.
@param baseUri base URI to set
*/
public void setBaseUri(final String baseUri) {
Validate.notNull(baseUri);
traverse(new NodeVisitor() {
public void head(Node node, int depth) {
node.baseUri = baseUri;
}
public void tail(Node node, int depth) {
}
});
}
/**
* Get an absolute URL from a URL attribute that may be relative (i.e. an <code><a href></code> or
* <code><img src></code>).
* <p>
* E.g.: <code>String absUrl = linkEl.absUrl("href");</code>
* </p>
* <p>
* If the attribute value is already absolute (i.e. it starts with a protocol, like
* <code>http://</code> or <code>https://</code> etc), and it successfully parses as a URL, the attribute is
* returned directly. Otherwise, it is treated as a URL relative to the element's {@link #baseUri}, and made
* absolute using that.
* </p>
* <p>
* As an alternate, you can use the {@link #attr} method with the <code>abs:</code> prefix, e.g.:
* <code>String absUrl = linkEl.attr("abs:href");</code>
* </p>
*
* @param attributeKey The attribute key
* @return An absolute URL if one could be made, or an empty string (not null) if the attribute was missing or
* could not be made successfully into a URL.
* @see #attr
* @see java.net.URL#URL(java.net.URL, String)
*/
public String absUrl(String attributeKey) {
Validate.notEmpty(attributeKey);
if (!hasAttr(attributeKey)) {
return ""; // nothing to make absolute with
} else {
return StringUtil.resolve(baseUri, attr(attributeKey));
}
}
/**
Get a child node by its 0-based index.
@param index index of child node
@return the child node at this index. Throws a {@code IndexOutOfBoundsException} if the index is out of bounds.
*/
public Node childNode(int index) {
return childNodes.get(index);
}
/**
Get this node's children. Presented as an unmodifiable list: new children can not be added, but the child nodes
themselves can be manipulated.
@return list of children. If no children, returns an empty list.
*/
public List<Node> childNodes() {
return Collections.unmodifiableList(childNodes);
}
/**
* Returns a deep copy of this node's children. Changes made to these nodes will not be reflected in the original
* nodes
* @return a deep copy of this node's children
*/
public List<Node> childNodesCopy() {
List<Node> children = new ArrayList<Node>(childNodes.size());
for (Node node : childNodes) {
children.add(node.clone());
}
return children;
}
/**
* Get the number of child nodes that this node holds.
* @return the number of child nodes that this node holds.
*/
public final int childNodeSize() {
return childNodes.size();
}
protected Node[] childNodesAsArray() {
return childNodes.toArray(new Node[childNodeSize()]);
}
/**
Gets this node's parent node.
@return parent node; or null if no parent.
*/
public Node parent() {
return parentNode;
}
/**
Gets this node's parent node. Node overridable by extending classes, so useful if you really just need the Node type.
@return parent node; or null if no parent.
*/
public final Node parentNode() {
return parentNode;
}
/**
* Gets the Document associated with this Node.
* @return the Document associated with this Node, or null if there is no such Document.
*/
public Document ownerDocument() {
if (this instanceof Document)
return (Document) this;
else if (parentNode == null)
return null;
else
return parentNode.ownerDocument();
}
/**
* Remove (delete) this node from the DOM tree. If this node has children, they are also removed.
*/
public void remove() {
Validate.notNull(parentNode);
parentNode.removeChild(this);
}
/**
* Insert the specified HTML into the DOM before this node (i.e. as a preceding sibling).
* @param html HTML to add before this node
* @return this node, for chaining
* @see #after(String)
*/
public Node before(String html) {
addSiblingHtml(siblingIndex, html);
return this;
}
/**
* Insert the specified node into the DOM before this node (i.e. as a preceding sibling).
* @param node to add before this node
* @return this node, for chaining
* @see #after(Node)
*/
public Node before(Node node) {
Validate.notNull(node);
Validate.notNull(parentNode);
parentNode.addChildren(siblingIndex, node);
return this;
}
/**
* Insert the specified HTML into the DOM after this node (i.e. as a following sibling).
* @param html HTML to add after this node
* @return this node, for chaining
* @see #before(String)
*/
public Node after(String html) {
addSiblingHtml(siblingIndex + 1, html);
return this;
}
/**
* Insert the specified node into the DOM after this node (i.e. as a following sibling).
* @param node to add after this node
* @return this node, for chaining
* @see #before(Node)
*/
public Node after(Node node) {
Validate.notNull(node);
Validate.notNull(parentNode);
parentNode.addChildren(siblingIndex + 1, node);
return this;
}
private void addSiblingHtml(int index, String html) {
Validate.notNull(html);
Validate.notNull(parentNode);
Element context = parent() instanceof Element ? (Element) parent() : null;
List<Node> nodes = Parser.parseFragment(html, context, baseUri());
parentNode.addChildren(index, nodes.toArray(new Node[nodes.size()]));
}
/**
Wrap the supplied HTML around this node.
@param html HTML to wrap around this element, e.g. {@code <div class="head"></div>}. Can be arbitrarily deep.
@return this node, for chaining.
*/
public Node wrap(String html) {
Validate.notEmpty(html);
Element context = parent() instanceof Element ? (Element) parent() : null;
List<Node> wrapChildren = Parser.parseFragment(html, context, baseUri());
Node wrapNode = wrapChildren.get(0);
if (wrapNode == null || !(wrapNode instanceof Element)) // nothing to wrap with; noop
return null;
Element wrap = (Element) wrapNode;
Element deepest = getDeepChild(wrap);
parentNode.replaceChild(this, wrap);
deepest.addChildren(this);
// remainder (unbalanced wrap, like <div></div><p></p> -- The <p> is remainder
if (wrapChildren.size() > 0) {
for (int i = 0; i < wrapChildren.size(); i++) {
Node remainder = wrapChildren.get(i);
remainder.parentNode.removeChild(remainder);
wrap.appendChild(remainder);
}
}
return this;
}
/**
* Removes this node from the DOM, and moves its children up into the node's parent. This has the effect of dropping
* the node but keeping its children.
* <p>
* For example, with the input html:
* </p>
* <p>{@code <div>One <span>Two <b>Three</b></span></div>}</p>
* Calling {@code element.unwrap()} on the {@code span} element will result in the html:
* <p>{@code <div>One Two <b>Three</b></div>}</p>
* and the {@code "Two "} {@link TextNode} being returned.
*
* @return the first child of this node, after the node has been unwrapped. Null if the node had no children.
* @see #remove()
* @see #wrap(String)
*/
public Node unwrap() {
Validate.notNull(parentNode);
Node firstChild = childNodes.size() > 0 ? childNodes.get(0) : null;
parentNode.addChildren(siblingIndex, this.childNodesAsArray());
this.remove();
return firstChild;
}
private Element getDeepChild(Element el) {
List<Element> children = el.children();
if (children.size() > 0)
return getDeepChild(children.get(0));
else
return el;
}
/**
* Replace this node in the DOM with the supplied node.
* @param in the node that will will replace the existing node.
*/
public void replaceWith(Node in) {
Validate.notNull(in);
Validate.notNull(parentNode);
parentNode.replaceChild(this, in);
}
protected void setParentNode(Node parentNode) {
if (this.parentNode != null)
this.parentNode.removeChild(this);
this.parentNode = parentNode;
}
protected void replaceChild(Node out, Node in) {
Validate.isTrue(out.parentNode == this);
Validate.notNull(in);
if (in.parentNode != null)
in.parentNode.removeChild(in);
final int index = out.siblingIndex;
childNodes.set(index, in);
in.parentNode = this;
in.setSiblingIndex(index);
out.parentNode = null;
}
protected void removeChild(Node out) {
Validate.isTrue(out.parentNode == this);
final int index = out.siblingIndex;
childNodes.remove(index);
reindexChildren(index);
out.parentNode = null;
}
protected void addChildren(Node... children) {
//most used. short circuit addChildren(int), which hits reindex children and array copy
for (Node child: children) {
reparentChild(child);
childNodes.add(child);
child.setSiblingIndex(childNodes.size()-1);
}
}
protected void addChildren(int index, Node... children) {
Validate.noNullElements(children);
for (int i = children.length - 1; i >= 0; i--) {
Node in = children[i];
reparentChild(in);
childNodes.add(index, in);
}
reindexChildren(index);
}
protected void reparentChild(Node child) {
if (child.parentNode != null)
child.parentNode.removeChild(child);
parentNode.setParentNode(this);
}
private void reindexChildren(int start) {
for (int i = start; i < childNodes.size(); i++) {
childNodes.get(i).setSiblingIndex(i);
}
}
/**
Retrieves this node's sibling nodes. Similar to {@link #childNodes() node.parent.childNodes()}, but does not
include this node (a node is not a sibling of itself).
@return node siblings. If the node has no parent, returns an empty list.
*/
public List<Node> siblingNodes() {
if (parentNode == null)
return Collections.emptyList();
List<Node> nodes = parentNode.childNodes;
List<Node> siblings = new ArrayList<Node>(nodes.size() - 1);
for (Node node: nodes)
if (node != this)
siblings.add(node);
return siblings;
}
/**
Get this node's next sibling.
@return next sibling, or null if this is the last sibling
*/
public Node nextSibling() {
if (parentNode == null)
return null; // root
final List<Node> siblings = parentNode.childNodes;
final int index = siblingIndex+1;
if (siblings.size() > index)
return siblings.get(index);
else
return null;
}
/**
Get this node's previous sibling.
@return the previous sibling, or null if this is the first sibling
*/
public Node previousSibling() {
if (parentNode == null)
return null; // root
if (siblingIndex > 0)
return parentNode.childNodes.get(siblingIndex-1);
else
return null;
}
/**
* Get the list index of this node in its node sibling list. I.e. if this is the first node
* sibling, returns 0.
* @return position in node sibling list
* @see org.jsoup.nodes.Element#elementSiblingIndex()
*/
public int siblingIndex() {
return siblingIndex;
}
protected void setSiblingIndex(int siblingIndex) {
this.siblingIndex = siblingIndex;
}
/**
* Perform a depth-first traversal through this node and its descendants.
* @param nodeVisitor the visitor callbacks to perform on each node
* @return this node, for chaining
*/
public Node traverse(NodeVisitor nodeVisitor) {
Validate.notNull(nodeVisitor);
NodeTraversor traversor = new NodeTraversor(nodeVisitor);
traversor.traverse(this);
return this;
}
/**
Get the outer HTML of this node.
@return HTML
*/
public String outerHtml() {
StringBuilder accum = new StringBuilder(128);
outerHtml(accum);
return accum.toString();
}
protected void outerHtml(StringBuilder accum) {
new NodeTraversor(new OuterHtmlVisitor(accum, getOutputSettings())).traverse(this);
}
// if this node has no document (or parent), retrieve the default output settings
Document.OutputSettings getOutputSettings() {
return ownerDocument() != null ? ownerDocument().outputSettings() : (new Document("")).outputSettings();
}
/**
Get the outer HTML of this node.
@param accum accumulator to place HTML into
*/
abstract void outerHtmlHead(StringBuilder accum, int depth, Document.OutputSettings out);
abstract void outerHtmlTail(StringBuilder accum, int depth, Document.OutputSettings out);
@Override
public String toString() {
return outerHtml();
}
protected void indent(StringBuilder accum, int depth, Document.OutputSettings out) {
accum.append("\n").append(StringUtil.padding(depth * out.indentAmount()));
}
/**
* Check if this node is equal to another node. A node is considered equal if its attributes and content equal the
* other node; particularly its position in the tree does not influence its equality.
* @param o other object to compare to
* @return true if the content of this node is the same as the other
*/
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Node node = (Node) o;
if (childNodes != null ? !childNodes.equals(node.childNodes) : node.childNodes != null) return false;
return !(attributes != null ? !attributes.equals(node.attributes) : node.attributes != null);
}
/**
* Calculates a hash code for this node, which includes iterating all its attributes, and recursing into any child
* nodes. This means that a node's hashcode is based on it and its child content, and not its parent or place in the
* tree. So two nodes with the same content, regardless of their position in the tree, will have the same hashcode.
* @return the calculated hashcode
* @see Node#equals(Object)
*/
@Override
public int hashCode() {
int result = childNodes != null ? childNodes.hashCode() : 0;
result = 31 * result + (attributes != null ? attributes.hashCode() : 0);
return result;
}
/**
* Create a stand-alone, deep copy of this node, and all of its children. The cloned node will have no siblings or
* parent node. As a stand-alone object, any changes made to the clone or any of its children will not impact the
* original node.
* <p>
* The cloned node may be adopted into another Document or node structure using {@link Element#appendChild(Node)}.
* @return stand-alone cloned node
*/
@Override
public Node clone() {
Node thisClone = doClone(null); // splits for orphan
// Queue up nodes that need their children cloned (BFS).
LinkedList<Node> nodesToProcess = new LinkedList<Node>();
nodesToProcess.add(thisClone);
while (!nodesToProcess.isEmpty()) {
Node currParent = nodesToProcess.remove();
for (int i = 0; i < currParent.childNodes.size(); i++) {
Node childClone = currParent.childNodes.get(i).doClone(currParent);
currParent.childNodes.set(i, childClone);
nodesToProcess.add(childClone);
}
}
return thisClone;
}
/*
* Return a clone of the node using the given parent (which can be null).
* Not a deep copy of children.
*/
protected Node doClone(Node parent) {
Node clone;
try {
clone = (Node) super.clone();
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
clone.parentNode = parent; // can be null, to create an orphan split
clone.siblingIndex = parent == null ? 0 : siblingIndex;
clone.attributes = attributes != null ? attributes.clone() : null;
clone.baseUri = baseUri;
clone.childNodes = new ArrayList<Node>(childNodes.size());
for (Node child: childNodes)
clone.childNodes.add(child);
return clone;
}
private static class OuterHtmlVisitor implements NodeVisitor {
private StringBuilder accum;
private Document.OutputSettings out;
OuterHtmlVisitor(StringBuilder accum, Document.OutputSettings out) {
this.accum = accum;
this.out = out;
}
public void head(Node node, int depth) {
node.outerHtmlHead(accum, depth, out);
}
public void tail(Node node, int depth) {
if (!node.nodeName().equals("#text")) // saves a void hit.
node.outerHtmlTail(accum, depth, out);
}
}
}
| [
"justinwm@163.com"
] | justinwm@163.com |
ff7fc63630f829e400a5d17571a9ce6d6e776843 | 37847d9bd40d7b237026c2c4b277dbb5a598357c | /src/main/java/org/janvs/annotations/JanusOptions.java | 2a3521e0696d680ffd66cd41fdf357d7834ee2cc | [
"MIT"
] | permissive | zaiquiri/janus | 22a429cf27ce84ccbd2796b3d4fee08c63321918 | 16ed2179f11d9ed9751672588cebc82866a8f95d | refs/heads/master | 2020-04-15T02:00:14.457878 | 2015-02-21T17:08:25 | 2015-02-21T17:08:25 | 20,011,190 | 1 | 1 | null | 2014-05-22T21:29:06 | 2014-05-21T06:57:30 | Java | UTF-8 | Java | false | false | 215 | java | package org.janvs.annotations;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.RUNTIME)
public @interface JanusOptions {
String basePackage();
}
| [
"zachary.lindberg@gmail.com"
] | zachary.lindberg@gmail.com |
7dd789645a58bc6609162d91d6b1b297619e04d4 | 6824f2bc571795bcb6a30a93a2531fb34e303dbb | /Prolog/src/com/lthorup/prolog/Tokenizer.java | 56e6b55d3366f5bf8879a71a76a3d39810279045 | [] | no_license | laynet79/java.prolog.github | 05698e6c0ba2f64553e436ad0b8d7a8099a9b753 | 983a1fac074956fb3cd027b36eba43715b0540fe | refs/heads/master | 2021-01-19T08:30:12.427417 | 2015-10-16T23:54:37 | 2015-10-16T23:54:37 | 22,590,548 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,606 | java | package com.lthorup.prolog;
import java.util.ArrayList;
public class Tokenizer {
private SymbolTable symTable;
private ArrayList<Token> tokens;
private String input;
private int inputNext;
private int inputEnd;
private int line;
private int tokNext;
//-------------------------------------------
public Tokenizer() {
symTable = new SymbolTable();
tokens = new ArrayList<Token>();
}
//-------------------------------------------
public void parse(String str) throws Exception {
input = str;
inputNext = 0;
inputEnd = input.length();
line = 1;
tokens.clear();
while ( parseWhiteSpace() ||
parseComment() ||
parseSymbol() ||
parseId() ||
parseVariable() ||
parseNumber());
input = null;
if (inputNext < inputEnd)
throw new Exception("unexpected input on line: " + line);
tokens.add(new Token(Token.Type.END, Symbol.none, line));
tokNext = 0;
line = 1;
}
//-------------------------------------------
public void printTokens() {
System.out.printf("----------- Tokens ----------\n");
for (Token t : tokens) {
System.out.printf("%s\n", t.toString());
}
}
//-------------------------------------------
public Token peek(int index) {
return (tokNext+index) >= tokens.size() ? tokens.get(tokens.size()-1) : tokens.get(tokNext+index);
}
//-------------------------------------------
public Token expect(Token.Type type) throws Exception {
Token t = tokNext >= tokens.size() ? tokens.get(tokens.size()-1) : tokens.get(tokNext);
if (t.type() != type)
throw new Exception("expected " + t.type() + " on line " + t.line());
tokNext++;
return t;
}
//-------------------------------------------
public Token expect(Symbol s) throws Exception {
Token t = tokNext >= tokens.size() ? tokens.get(tokens.size()-1) : tokens.get(tokNext);
if (t.symbol() != s)
throw new Exception("expected symbol " + s.name() + " on line " + t.line());
tokNext++;
return t;
}
//-------------------------------------------
public Token expect(Symbol.Type type) throws Exception {
Token t = tokNext >= tokens.size() ? tokens.get(tokens.size()-1) : tokens.get(tokNext);
if (t.symbol().type() != type)
throw new Exception("expected symbol " + type + " on line " + t.line());
tokNext++;
return t;
}
//-------------------------------------------
private boolean parseWhiteSpace() {
int i = inputNext;
while (i < inputEnd && Character.isWhitespace(input.charAt(i))) {
if (input.charAt(i) == '\n')
line++;
i++;
}
boolean result = i > inputNext;
inputNext = i;
return result;
}
//-------------------------------------------
private boolean parseComment() {
if (! input.startsWith("//", inputNext))
return false;
int i = inputNext;
while (i < inputEnd && input.charAt(i) != '\n')
i++;
boolean result = i > inputNext;
inputNext = i;
return result;
}
//-------------------------------------------
private boolean parseId() {
if (inputNext >= inputEnd || ! Character.isLowerCase(input.charAt(inputNext)))
return false;
int i = inputNext;
while (i < inputEnd && Character.isLetter(input.charAt(i)))
i++;
String name = input.substring(inputNext, i);
Symbol symbol = symTable.add(name);
tokens.add(new Token(Token.Type.ID, symbol, line));
inputNext = i;
return true;
}
//-------------------------------------------
private boolean parseVariable() {
if (inputNext >= inputEnd || (! Character.isUpperCase(input.charAt(inputNext)) && input.charAt(inputNext) != '_'))
return false;
int i = inputNext;
while (i < inputEnd && (Character.isLetter(input.charAt(i)) || input.charAt(i) == '_'))
i++;
String name = input.substring(inputNext, i);
Symbol symbol = symTable.add(name);
tokens.add(new Token(Token.Type.VARIABLE, symbol, line));
inputNext = i;
return true;
}
//-------------------------------------------
private boolean parseNumber() {
if (inputNext < inputEnd && (Character.isDigit(input.charAt(inputNext)) || input.charAt(inputNext) == '-')) {
int i = inputNext + 1;
while (Character.isDigit(input.charAt(i)))
i++;
String name = input.substring(inputNext, i);
inputNext = i;
int value = Integer.parseInt(name);
tokens.add(new Token(value, line));
return true;
}
return false;
}
//-------------------------------------------
private boolean parseSymbol() {
for (Symbol s : Symbol.symbols) {
if (input.startsWith(s.name(), inputNext)) {
tokens.add(new Token(Token.Type.SYMBOL, s, line));
inputNext += s.name().length();
return true;
}
}
return false;
}
}
| [
"layne@lthorup.com"
] | layne@lthorup.com |
7d59c48eef375a995334e550a3ad9eb5a46cc144 | dbf6a63c8dcd380ff7465d398547b908ecfe0bc3 | /Code Chef/src/Chef_and_easy_Queries/Main.java | bc7436d7fc7c2ee388cd8700d789399cc40c27f0 | [] | no_license | zikrullahMd/Java-Codes | 0eea4a922021ca8e87895e104ce735d997dd8939 | 50c60d8ed9a4e0afe82fb66af61246e349f70462 | refs/heads/master | 2023-04-26T08:55:03.780530 | 2021-05-21T16:16:46 | 2021-05-21T16:16:46 | 368,940,347 | 0 | 0 | null | 2021-05-20T03:28:55 | 2021-05-19T16:52:47 | Java | UTF-8 | Java | false | false | 734 | java | package Chef_and_easy_Queries;
import java.util.*;
import java.util.Map;
class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in = new Scanner(System.in);
long t = in.nextLong();
while(t-->0) {
long n = in.nextLong();
long k = in.nextLong();
long[] a = new long[(int) (n+1)];
for (long i = 1; i <=n; i++) {
a[(int) i] = in.nextLong();
}
long sum = 0;
long day = 0;
long carry = 0;
for(long i = 1;i<=n;i++) {
day++;
sum = a[(int) i] + carry;
carry = sum - k;
if(sum < k) {
break;
}
}
if(sum < k) {
System.out.println(day);
}else {
day += (long) (sum - k) / k+1;
System.out.println(day);
}
}
}
} | [
"mohmmedzikrullah159@gmail.com"
] | mohmmedzikrullah159@gmail.com |
f0a91a4034b433b6009df9024b20d8bb5758befd | a40687db0af5ac367477a37046fe1b0f79ae51e4 | /LeapYearCalculator/src/LeapYearCalculator.java | 5993f018779da3385362d3b0a2d3d0ac6a85979c | [] | no_license | Ishboi/JavaStuff | ff70fe1af667a288a0906daae87f051592fcf299 | b7b11e7a5405cb1a42a2338b154b7e0cb24325b9 | refs/heads/master | 2020-07-28T20:16:17.184234 | 2019-10-16T18:22:17 | 2019-10-16T18:22:17 | 209,523,616 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 568 | java | public class LeapYearCalculator {
public static boolean isLeapYear(int year) {
if((year < 1) || (year > 9999)) {
return false;
} else {
if(year % 4 == 0) {
if(year % 100 == 0) {
if(year % 400 == 0) {
return true;
} else {
return false;
}
} else {
return true;
}
} else {
return false;
}
}
}
}
| [
"bolachaseleite@gmail.com"
] | bolachaseleite@gmail.com |
5ee5221d652cf36be209661309067e6853c1d7a7 | 35ca1144aaa0405079b59c2fcbcd726f2472246d | /src/main/java/us/fok/lenzenslijper/views/ReleasedLinkView.java | ea62d104e0e22df82f53a904971b641dd47f35a2 | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | fokus-llc/lenzenslijper | a1e152fdb0a808f97496e7b09b609b7101a1e956 | 861d741a739c976c96b2821d0b5361c8aae99f69 | refs/heads/master | 2021-01-16T00:22:18.583402 | 2014-10-28T02:39:16 | 2014-10-28T02:39:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,950 | java | package us.fok.lenzenslijper.views;
import us.fok.lenzenslijper.models.dto.ReleasedLinkSummary;
import java.util.UUID;
public class ReleasedLinkView implements LinkView {
private final ReleasedLinkSummary record;
private String linkType;
private String documentType;
private String entityType;
public ReleasedLinkView(ReleasedLinkSummary record) {
this.record = record;
}
@Override
public String getLinkType() {
return linkType;
}
public void setLinkType(String linkType) {
this.linkType = linkType;
}
@Override
public String getTitle() {
String originTitle = record.getTitle();
return originTitle == null ? record.getTargetTitle() : originTitle;
}
public UUID getLinkableId() {
UUID originLink = record.getOriginLinkableId();
return originLink == null ? record.getTargetLinkableId() : originLink;
}
@Override
public UUID getDocumentId() {
return record.getDocumentId();
}
@Override
public String getDocumentType() {
return documentType;
}
public void setDocumentType(String documentType) {
this.documentType = documentType;
}
@Override
public UUID getEntityId() {
return record.getEntityId();
}
@Override
public String getEntityType() {
return entityType;
}
public void setEntityType(String entityType) {
this.entityType = entityType;
}
@Override
public String getTargetValue() {
return record.getTargetValue();
}
@Override
public Integer getRank() {
return record.getRank();
}
@Override
public String getTimeRange() {
return record.getTimeRange();
}
@Override
public Integer getBeginning() {
return record.getBeginning();
}
@Override
public Integer getEnding() {
return record.getEnding();
}
}
| [
"oss+fokus@teleological.net"
] | oss+fokus@teleological.net |
84c5a46e69a49e5a91eed6b12e29737ee1f9eb1a | 19d84a0d1980f775186f64d1bb3949d13f4ef0b6 | /compilador/src/Tree/SEQ.java | c17344b6deb9535e3dfd781d96e4e0e3abd62533 | [] | no_license | rbrito/old-projects | cc7a1d1730f8170e52587a3e3b2d3a5ced33ffbf | 442bb27d5aa99c0af0bb163efd9fd338bccb90ba | refs/heads/master | 2020-05-06T12:21:07.994529 | 2019-04-27T23:02:59 | 2019-04-27T23:02:59 | 5,565,923 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 345 | java | package Tree;
public class SEQ extends Stm {
public Stm left, right;
public SEQ(Stm l, Stm r) {
left = l;
right = r;
}
public ExpList kids() {
throw new Error("kids() not applicable to SEQ");
}
public Stm build(ExpList kids) {
throw new Error("build() not applicable to SEQ");
}
}
| [
"rbrito@ime.usp.br"
] | rbrito@ime.usp.br |
f5a5cf20f3c6aa7a44f995b5c2a6dd1ca48527e8 | 2e7f183e5cff6bbfc8c50f66e307138f6e3282e7 | /trunk/sources/minecraft/net/minecraft/src/GuiMultiplayer.java | ef27a9ac0fe6acd968eec8ac5f1b05a940eb6271 | [] | no_license | BGCX261/zombie-craft-svn-to-git | 2e7aee87c90711139e1aa41d2c240c4f4bc1a3f1 | 72217710ec9f899339478b01f021e2c10b38474c | refs/heads/master | 2016-09-05T10:03:04.075184 | 2015-08-25T15:22:26 | 2015-08-25T15:22:26 | 41,586,607 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,635 | java | package net.minecraft.src;
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode
import java.util.List;
import net.minecraft.client.Minecraft;
import org.lwjgl.input.Keyboard;
public class GuiMultiplayer extends GuiScreen
{
public GuiMultiplayer(GuiScreen guiscreen)
{
parentScreen = guiscreen;
}
public void updateScreen()
{
field_22111_h.func_22070_b();
}
public void initGui()
{
StringTranslate stringtranslate = StringTranslate.getInstance();
Keyboard.enableRepeatEvents(true);
controlList.clear();
controlList.add(new GuiButton(0, width / 2 - 100, height / 4 + 96 + 12, stringtranslate.translateKey("multiplayer.connect")));
controlList.add(new GuiButton(1, width / 2 - 100, height / 4 + 120 + 12, stringtranslate.translateKey("gui.cancel")));
String s = mc.gameSettings.lastServer.replaceAll("_", ":");
((GuiButton)controlList.get(0)).enabled = s.length() > 0;
field_22111_h = new GuiDisableButton(fontRenderer, width / 2 - 100, (height / 4 - 10) + 50 + 18, 200, 20, s);
field_22111_h.field_22082_a = true;
field_22111_h.func_22066_a(32);
}
public void onGuiClosed()
{
Keyboard.enableRepeatEvents(false);
}
protected void actionPerformed(GuiButton guibutton)
{
if(!guibutton.enabled)
{
return;
}
if(guibutton.id == 1)
{
mc.displayGuiScreen(parentScreen);
} else
if(guibutton.id == 0)
{
String s = field_22111_h.func_22071_a();
mc.gameSettings.lastServer = s.replaceAll(":", "_");
mc.gameSettings.saveOptions();
String as[] = s.split(":");
mc.displayGuiScreen(new GuiConnecting(mc, as[0], as.length <= 1 ? 25565 : func_4067_a(as[1], 25565)));
}
}
private int func_4067_a(String s, int i)
{
try
{
return Integer.parseInt(s.trim());
}
catch(Exception exception)
{
return i;
}
}
protected void keyTyped(char c, int i)
{
field_22111_h.func_22072_a(c, i);
if(c == '\r')
{
actionPerformed((GuiButton)controlList.get(0));
}
((GuiButton)controlList.get(0)).enabled = field_22111_h.func_22071_a().length() > 0;
}
protected void mouseClicked(int i, int j, int k)
{
super.mouseClicked(i, j, k);
field_22111_h.func_22069_a(i, j, k);
}
public void drawScreen(int i, int j, float f)
{
StringTranslate stringtranslate = StringTranslate.getInstance();
drawDefaultBackground();
drawCenteredString(fontRenderer, stringtranslate.translateKey("multiplayer.title"), width / 2, (height / 4 - 60) + 20, 0xffffff);
drawString(fontRenderer, stringtranslate.translateKey("multiplayer.info1"), width / 2 - 140, (height / 4 - 60) + 60 + 0, 0xa0a0a0);
drawString(fontRenderer, stringtranslate.translateKey("multiplayer.info2"), width / 2 - 140, (height / 4 - 60) + 60 + 9, 0xa0a0a0);
drawString(fontRenderer, stringtranslate.translateKey("multiplayer.ipinfo"), width / 2 - 140, (height / 4 - 60) + 60 + 36, 0xa0a0a0);
field_22111_h.func_22067_c();
super.drawScreen(i, j, f);
}
private GuiScreen parentScreen;
private GuiDisableButton field_22111_h;
}
| [
"you@example.com"
] | you@example.com |
c396b38442afe37f88c5d3f2602c78fa18552389 | 717efe422175e98cd5920f7a5d0f65219724e57a | /socialcommunity-parent/socialcommunity-dao/src/main/java/com/dancosoft/socialcommunity/dao/impl/UserPhotoDAOImpl.java | d6259b916812dc6045cb65aec173185620bcb82f | [] | no_license | ZaerkoDV/DancosoftProjects | 9f4ccabe8fc31048d7c7a43662127d425a318c04 | 3db35471a294ead87ae1536bc7f6b7d3bd2293bd | refs/heads/master | 2021-05-04T10:44:17.632296 | 2016-12-16T07:30:32 | 2016-12-16T07:30:32 | 47,246,209 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,140 | java | /**
* @package com.dancosoft.socialcommunity.dao.impl
*
* Package com.dancosoft.socialcommunity.dao.impl contain set of class which description
* layer of data access object of SocialCommunity project. This project is based on MVC
* architecture.This class is part of dao layer(DAL pattern) in MVC architecture. This
* layer offer abstract interface for work with any type data base. This pattern give a
* right work with DAO (data-access-object) without matter what kind of storage engine
* is used and without need for a special way to match this storage engine. All classes
* which contain word �DAO� provide to work DAL for Reducer links application.
*
* Please contact with Zaerko Denis or send letter on zaerko1991@gmail.com if you need
* to use information or have any questions.
*/
package com.dancosoft.socialcommunity.dao.impl;
import org.hibernate.Criteria;
import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Restrictions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;
import com.dancosoft.socialcommunity.dao.UserPhotoDAO;
import com.dancosoft.socialcommunity.model.UserPhoto;
/**
* <p>The class UserPhotoDAOImpl use DAO pattern which describes layer of data
* access to object. DAO layer perform link between relational and object model.
* Model for this dao layer describied in class UserPhoto. This class contain
* methods which intended to access to special operation with UserPhoto entity.
* Class extend CommonEntityDAOImpl class, which contain base set of
* operation(CRUD). Class implements interface UserPhotoDAO located in package
* which have name com.dancosoft.socialcommunity.dao. All methods are public in
* class.For logging use logger fasade slf4j and framework log4j. Class contain
* also private, static variable logger, which use to call log message. This
* class use Spring framework to work with ORM. In particular often use
* HibernateTemplate for integration Hibernate and Spring technologys. For work
* with data base use hibernate criteria. This technology provide as
* object-oriented select query in relation to a particular entity, and allows
* you to query the database without writing SQL code. Use Criteria is the most
* successful approach to search interface with a variable number of conditions.
* To create copies of the Criteria used class Session, which acts as a factory.
*
* @see org.springframework.stereotype
* @see org.hibernate.Criteria
* @see slf4j fasade
* @see log4j framework
*
* @version 1.0 23.12.2015
* @author Zaerko Denis
*/
@Repository(value = "userPhotoDAO")
public class UserPhotoDAOImpl extends CommonEntityDAOImpl implements UserPhotoDAO {
private static final Logger logger = LoggerFactory.getLogger(UserPhotoDAOImpl.class);
public UserPhotoDAOImpl(){
super(UserPhoto.class);
}
/**
* Method return user photo by id user. If user photo is not exist return null
*
* @type Long
* @param idUser
*
* @return UserPhoto
*/
public UserPhoto getUserPhotoByIdUser(Long idUser) {
Criteria criteria = this.getHibernateTemplate().getSessionFactory()
.getCurrentSession().createCriteria(UserPhoto.class);
criteria.createAlias("user", "u");
criteria.add(Restrictions.eq("u.idUser", idUser));
logger.info("UserPhotoDAO: User photo load by id user");
return (UserPhoto) criteria.uniqueResult();
}
/**
* Method return return photo name by id user. If photo name
* is not exist return null.
*
* @type Long
* @param idUser
*
* @return String
*/
public String getPhotoNameByIdUser(Long idUser) {
Criteria criteria = this.getHibernateTemplate().getSessionFactory()
.getCurrentSession().createCriteria(UserPhoto.class);
criteria.setProjection(Projections.property("photoName"));
criteria.createAlias("user", "u");
criteria.add(Restrictions.eq("u.idUser", idUser));
logger.info("UserPhotoDAO: Name user photo load by id user");
return (String) criteria.uniqueResult();
}
}
| [
"zaerko1991@gmail.com"
] | zaerko1991@gmail.com |
eb492776fa59d0d885c845ef7bd59ef912f0643c | e0404356cf85611f1a78d753cd82cb2124ef7816 | /src/main/java/ch/zhaw/schilram/sem_hib/model/RecipeIngredient.java | 60eee3e21495328d010479c810f45d5df553855a | [] | no_license | schilram/sem_hib | 0ffb3962b1368f9adfdbd3cb2f34e4026f8a002d | 564c7a6b2039e4266869bf5510209ce16186ab8c | refs/heads/master | 2021-01-02T22:30:27.420593 | 2013-06-29T06:22:49 | 2013-06-29T06:22:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,561 | java | package ch.zhaw.schilram.sem_hib.model;
import javax.persistence.*;
import java.io.Serializable;
/**
* @author schilram
*/
@Entity
@Table(name = "RECIPEINGREDIENT")
public class RecipeIngredient implements Uniqueness, Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private Integer amount;
@ManyToOne(optional = false, fetch = FetchType.EAGER)
private UnitOfMeasure uom;
@ManyToOne(optional = false, fetch = FetchType.EAGER)
private Ingredient ingredient;
@ManyToOne
private Recipe recipe;
public Integer getAmount() {
return amount;
}
public void setAmount(final Integer amount) {
this.amount = amount;
}
public Long getId() {
return id;
}
public void setId(final Long id) {
this.id = id;
}
public Ingredient getIngredient() {
return ingredient;
}
public void setIngredient(final Ingredient ingredient) {
this.ingredient = ingredient;
}
public Recipe getRecipe() {
return recipe;
}
public void setRecipe(final Recipe recipe) {
this.recipe = recipe;
}
public UnitOfMeasure getUom() {
return uom;
}
public void setUom(final UnitOfMeasure uom) {
this.uom = uom;
}
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (!(o instanceof RecipeIngredient)) {
return false;
}
final RecipeIngredient that = (RecipeIngredient) o;
if (amount != null ? !amount.equals(that.amount) : that.amount != null) {
return false;
}
if (!id.equals(that.id)) {
return false;
}
if (ingredient != null ? !ingredient.equals(that.ingredient) : that.ingredient != null) {
return false;
}
if (recipe != null ? !recipe.equals(that.recipe) : that.recipe != null) {
return false;
}
if (uom != null ? !uom.equals(that.uom) : that.uom != null) {
return false;
}
return true;
}
@Override
public int hashCode() {
int result = id.hashCode();
result = 31 * result + (amount != null ? amount.hashCode() : 0);
result = 31 * result + (uom != null ? uom.hashCode() : 0);
result = 31 * result + (ingredient != null ? ingredient.hashCode() : 0);
result = 31 * result + (recipe != null ? recipe.hashCode() : 0);
return result;
}
}
| [
"schilram@students.zhaw.ch"
] | schilram@students.zhaw.ch |
33eec89d0489268afafd7591a1d4a02990d18bab | 5c3d965dca8001ed04f0375ded93c660ad26c898 | /modularFramework-09182019/src/main/java/comonLibs/utils/ConfigFileReadUtils.java | 61659357c77206dd73636008f0f0ee2fc93ef2e3 | [] | no_license | saurabhd2106/modularFramework-09182019 | f063b7017f5e7e88fbcfcb0c1fe54f7d75fe53c8 | 6824134a7cff528a1c229c08276824728b492a8a | refs/heads/master | 2022-07-16T14:38:42.183071 | 2019-11-20T07:38:23 | 2019-11-20T07:38:23 | 209,382,252 | 0 | 1 | null | 2021-04-26T19:32:44 | 2019-09-18T18:54:35 | HTML | UTF-8 | Java | false | false | 440 | java | package comonLibs.utils;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Properties;
public class ConfigFileReadUtils {
public static Properties configFileReader(String filename) throws Exception {
filename = filename.trim();
Properties property = new Properties();
InputStream inStream = new FileInputStream(filename);
property.load(inStream);
return property;
}
}
| [
"Saurabh Dhingra@192.168.1.9"
] | Saurabh Dhingra@192.168.1.9 |
24b12d2ef4b4793d2ba7fef61ab1a6bddda2faff | 2220155b686a13041d73f9e15d21e4b936a2c660 | /src/com/zr/crm/model/SubjectExample.java | 3c19e3c6cb0e8eff002b6c1dd98c36c14c4e3079 | [] | no_license | vincentsdeng/test | f9af8088f384ef572da7740785791c7cf601b0e1 | ecf9cfdca3cbf1141e04e8c0fd088d4507bc9ff6 | refs/heads/master | 2020-04-12T19:56:40.706806 | 2018-12-21T15:04:44 | 2018-12-21T15:04:44 | 162,722,158 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 20,248 | java | package com.zr.crm.model;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
public class SubjectExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public SubjectExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
protected void addCriterionForJDBCDate(String condition, Date value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
addCriterion(condition, new java.sql.Date(value.getTime()), property);
}
protected void addCriterionForJDBCDate(String condition, List<Date> values, String property) {
if (values == null || values.size() == 0) {
throw new RuntimeException("Value list for " + property + " cannot be null or empty");
}
List<java.sql.Date> dateList = new ArrayList<java.sql.Date>();
Iterator<Date> iter = values.iterator();
while (iter.hasNext()) {
dateList.add(new java.sql.Date(iter.next().getTime()));
}
addCriterion(condition, dateList, property);
}
protected void addCriterionForJDBCDate(String condition, Date value1, Date value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
addCriterion(condition, new java.sql.Date(value1.getTime()), new java.sql.Date(value2.getTime()), property);
}
public Criteria andSubjectNoIsNull() {
addCriterion("SUBJECT_NO is null");
return (Criteria) this;
}
public Criteria andSubjectNoIsNotNull() {
addCriterion("SUBJECT_NO is not null");
return (Criteria) this;
}
public Criteria andSubjectNoEqualTo(BigDecimal value) {
addCriterion("SUBJECT_NO =", value, "subjectNo");
return (Criteria) this;
}
public Criteria andSubjectNoNotEqualTo(BigDecimal value) {
addCriterion("SUBJECT_NO <>", value, "subjectNo");
return (Criteria) this;
}
public Criteria andSubjectNoGreaterThan(BigDecimal value) {
addCriterion("SUBJECT_NO >", value, "subjectNo");
return (Criteria) this;
}
public Criteria andSubjectNoGreaterThanOrEqualTo(BigDecimal value) {
addCriterion("SUBJECT_NO >=", value, "subjectNo");
return (Criteria) this;
}
public Criteria andSubjectNoLessThan(BigDecimal value) {
addCriterion("SUBJECT_NO <", value, "subjectNo");
return (Criteria) this;
}
public Criteria andSubjectNoLessThanOrEqualTo(BigDecimal value) {
addCriterion("SUBJECT_NO <=", value, "subjectNo");
return (Criteria) this;
}
public Criteria andSubjectNoIn(List<BigDecimal> values) {
addCriterion("SUBJECT_NO in", values, "subjectNo");
return (Criteria) this;
}
public Criteria andSubjectNoNotIn(List<BigDecimal> values) {
addCriterion("SUBJECT_NO not in", values, "subjectNo");
return (Criteria) this;
}
public Criteria andSubjectNoBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("SUBJECT_NO between", value1, value2, "subjectNo");
return (Criteria) this;
}
public Criteria andSubjectNoNotBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("SUBJECT_NO not between", value1, value2, "subjectNo");
return (Criteria) this;
}
public Criteria andSubjectNameIsNull() {
addCriterion("SUBJECT_NAME is null");
return (Criteria) this;
}
public Criteria andSubjectNameIsNotNull() {
addCriterion("SUBJECT_NAME is not null");
return (Criteria) this;
}
public Criteria andSubjectNameEqualTo(String value) {
addCriterion("SUBJECT_NAME =", value, "subjectName");
return (Criteria) this;
}
public Criteria andSubjectNameNotEqualTo(String value) {
addCriterion("SUBJECT_NAME <>", value, "subjectName");
return (Criteria) this;
}
public Criteria andSubjectNameGreaterThan(String value) {
addCriterion("SUBJECT_NAME >", value, "subjectName");
return (Criteria) this;
}
public Criteria andSubjectNameGreaterThanOrEqualTo(String value) {
addCriterion("SUBJECT_NAME >=", value, "subjectName");
return (Criteria) this;
}
public Criteria andSubjectNameLessThan(String value) {
addCriterion("SUBJECT_NAME <", value, "subjectName");
return (Criteria) this;
}
public Criteria andSubjectNameLessThanOrEqualTo(String value) {
addCriterion("SUBJECT_NAME <=", value, "subjectName");
return (Criteria) this;
}
public Criteria andSubjectNameLike(String value) {
addCriterion("SUBJECT_NAME like", value, "subjectName");
return (Criteria) this;
}
public Criteria andSubjectNameNotLike(String value) {
addCriterion("SUBJECT_NAME not like", value, "subjectName");
return (Criteria) this;
}
public Criteria andSubjectNameIn(List<String> values) {
addCriterion("SUBJECT_NAME in", values, "subjectName");
return (Criteria) this;
}
public Criteria andSubjectNameNotIn(List<String> values) {
addCriterion("SUBJECT_NAME not in", values, "subjectName");
return (Criteria) this;
}
public Criteria andSubjectNameBetween(String value1, String value2) {
addCriterion("SUBJECT_NAME between", value1, value2, "subjectName");
return (Criteria) this;
}
public Criteria andSubjectNameNotBetween(String value1, String value2) {
addCriterion("SUBJECT_NAME not between", value1, value2, "subjectName");
return (Criteria) this;
}
public Criteria andSubjectTimesIsNull() {
addCriterion("SUBJECT_TIMES is null");
return (Criteria) this;
}
public Criteria andSubjectTimesIsNotNull() {
addCriterion("SUBJECT_TIMES is not null");
return (Criteria) this;
}
public Criteria andSubjectTimesEqualTo(BigDecimal value) {
addCriterion("SUBJECT_TIMES =", value, "subjectTimes");
return (Criteria) this;
}
public Criteria andSubjectTimesNotEqualTo(BigDecimal value) {
addCriterion("SUBJECT_TIMES <>", value, "subjectTimes");
return (Criteria) this;
}
public Criteria andSubjectTimesGreaterThan(BigDecimal value) {
addCriterion("SUBJECT_TIMES >", value, "subjectTimes");
return (Criteria) this;
}
public Criteria andSubjectTimesGreaterThanOrEqualTo(BigDecimal value) {
addCriterion("SUBJECT_TIMES >=", value, "subjectTimes");
return (Criteria) this;
}
public Criteria andSubjectTimesLessThan(BigDecimal value) {
addCriterion("SUBJECT_TIMES <", value, "subjectTimes");
return (Criteria) this;
}
public Criteria andSubjectTimesLessThanOrEqualTo(BigDecimal value) {
addCriterion("SUBJECT_TIMES <=", value, "subjectTimes");
return (Criteria) this;
}
public Criteria andSubjectTimesIn(List<BigDecimal> values) {
addCriterion("SUBJECT_TIMES in", values, "subjectTimes");
return (Criteria) this;
}
public Criteria andSubjectTimesNotIn(List<BigDecimal> values) {
addCriterion("SUBJECT_TIMES not in", values, "subjectTimes");
return (Criteria) this;
}
public Criteria andSubjectTimesBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("SUBJECT_TIMES between", value1, value2, "subjectTimes");
return (Criteria) this;
}
public Criteria andSubjectTimesNotBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("SUBJECT_TIMES not between", value1, value2, "subjectTimes");
return (Criteria) this;
}
public Criteria andSubjectPrjManagerIsNull() {
addCriterion("SUBJECT_PRJ_MANAGER is null");
return (Criteria) this;
}
public Criteria andSubjectPrjManagerIsNotNull() {
addCriterion("SUBJECT_PRJ_MANAGER is not null");
return (Criteria) this;
}
public Criteria andSubjectPrjManagerEqualTo(BigDecimal value) {
addCriterion("SUBJECT_PRJ_MANAGER =", value, "subjectPrjManager");
return (Criteria) this;
}
public Criteria andSubjectPrjManagerNotEqualTo(BigDecimal value) {
addCriterion("SUBJECT_PRJ_MANAGER <>", value, "subjectPrjManager");
return (Criteria) this;
}
public Criteria andSubjectPrjManagerGreaterThan(BigDecimal value) {
addCriterion("SUBJECT_PRJ_MANAGER >", value, "subjectPrjManager");
return (Criteria) this;
}
public Criteria andSubjectPrjManagerGreaterThanOrEqualTo(BigDecimal value) {
addCriterion("SUBJECT_PRJ_MANAGER >=", value, "subjectPrjManager");
return (Criteria) this;
}
public Criteria andSubjectPrjManagerLessThan(BigDecimal value) {
addCriterion("SUBJECT_PRJ_MANAGER <", value, "subjectPrjManager");
return (Criteria) this;
}
public Criteria andSubjectPrjManagerLessThanOrEqualTo(BigDecimal value) {
addCriterion("SUBJECT_PRJ_MANAGER <=", value, "subjectPrjManager");
return (Criteria) this;
}
public Criteria andSubjectPrjManagerIn(List<BigDecimal> values) {
addCriterion("SUBJECT_PRJ_MANAGER in", values, "subjectPrjManager");
return (Criteria) this;
}
public Criteria andSubjectPrjManagerNotIn(List<BigDecimal> values) {
addCriterion("SUBJECT_PRJ_MANAGER not in", values, "subjectPrjManager");
return (Criteria) this;
}
public Criteria andSubjectPrjManagerBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("SUBJECT_PRJ_MANAGER between", value1, value2, "subjectPrjManager");
return (Criteria) this;
}
public Criteria andSubjectPrjManagerNotBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("SUBJECT_PRJ_MANAGER not between", value1, value2, "subjectPrjManager");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNull() {
addCriterion("UPDATE_TIME is null");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNotNull() {
addCriterion("UPDATE_TIME is not null");
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(Date value) {
addCriterionForJDBCDate("UPDATE_TIME =", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(Date value) {
addCriterionForJDBCDate("UPDATE_TIME <>", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(Date value) {
addCriterionForJDBCDate("UPDATE_TIME >", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) {
addCriterionForJDBCDate("UPDATE_TIME >=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(Date value) {
addCriterionForJDBCDate("UPDATE_TIME <", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(Date value) {
addCriterionForJDBCDate("UPDATE_TIME <=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<Date> values) {
addCriterionForJDBCDate("UPDATE_TIME in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Date> values) {
addCriterionForJDBCDate("UPDATE_TIME not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(Date value1, Date value2) {
addCriterionForJDBCDate("UPDATE_TIME between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(Date value1, Date value2) {
addCriterionForJDBCDate("UPDATE_TIME not between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andCreteTimeIsNull() {
addCriterion("CRETE_TIME is null");
return (Criteria) this;
}
public Criteria andCreteTimeIsNotNull() {
addCriterion("CRETE_TIME is not null");
return (Criteria) this;
}
public Criteria andCreteTimeEqualTo(Date value) {
addCriterionForJDBCDate("CRETE_TIME =", value, "creteTime");
return (Criteria) this;
}
public Criteria andCreteTimeNotEqualTo(Date value) {
addCriterionForJDBCDate("CRETE_TIME <>", value, "creteTime");
return (Criteria) this;
}
public Criteria andCreteTimeGreaterThan(Date value) {
addCriterionForJDBCDate("CRETE_TIME >", value, "creteTime");
return (Criteria) this;
}
public Criteria andCreteTimeGreaterThanOrEqualTo(Date value) {
addCriterionForJDBCDate("CRETE_TIME >=", value, "creteTime");
return (Criteria) this;
}
public Criteria andCreteTimeLessThan(Date value) {
addCriterionForJDBCDate("CRETE_TIME <", value, "creteTime");
return (Criteria) this;
}
public Criteria andCreteTimeLessThanOrEqualTo(Date value) {
addCriterionForJDBCDate("CRETE_TIME <=", value, "creteTime");
return (Criteria) this;
}
public Criteria andCreteTimeIn(List<Date> values) {
addCriterionForJDBCDate("CRETE_TIME in", values, "creteTime");
return (Criteria) this;
}
public Criteria andCreteTimeNotIn(List<Date> values) {
addCriterionForJDBCDate("CRETE_TIME not in", values, "creteTime");
return (Criteria) this;
}
public Criteria andCreteTimeBetween(Date value1, Date value2) {
addCriterionForJDBCDate("CRETE_TIME between", value1, value2, "creteTime");
return (Criteria) this;
}
public Criteria andCreteTimeNotBetween(Date value1, Date value2) {
addCriterionForJDBCDate("CRETE_TIME not between", value1, value2, "creteTime");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | [
"tdeng377@gmail.com"
] | tdeng377@gmail.com |
e6e315193d2a0aa12f49bc51e936e57fb39c78e6 | 17f7555eeec729f4419682f99531071c25994290 | /OPF/EXPJProj/OPF/KP0050/src/com/nec/jp/orteus/metamorBase/KP0050/KP0050B001/readT_SALES_PLAN.java | 4c0af702dfbb565efa717fab3efe6776ae3a382f | [] | no_license | okyapu/EXPJ.OPF | 42522adc8268b43af1345ae451a4548ed234dfa3 | 7a380007f54ec452efadfad5f74d531ccf90522f | refs/heads/master | 2023-08-26T03:55:34.454031 | 2021-11-11T08:31:46 | 2021-11-11T08:31:46 | 426,916,847 | 0 | 0 | null | null | null | null | SHIFT_JIS | Java | false | false | 14,923 | java | /*
* $Source: D:/EXPJCVS/EXPJPROJ/expjprsaUV2/EXPJProj/OPF/KP0050/src/com/nec/jp/orteus/metamorBase/KP0050/KP0050B001/readT_SALES_PLAN.java,v $
*
* Copyright (c) 2003-2005 NEC Corporation.
* Copyright (c) 2003-2005 NEC Informatec Systems,Ltd.
*
* ALL RIGHTS RESERVED BY NEC INFORMATEC SYSTEMS, LTD.
* THIS PROGRAM MUST BE USED SOLELY FOR THE PURPOSE FOR
* WHICH IT WAS FURNISHED BY NEC INFORMATEC SYSTEMS, LTD,
* NO PART OF THIS PROGRAM MAY BE REPRODUCED OR DISCLOSED
* TO OTHERS, IN ANY FORM WITHOUT THE PRIOR WRITTEN
* PERMISSION OF NEC INFORMATEC SYSTEMS, LTD.
* USE OF COPYRIGHT NOTICE DOES NOT EVIDENCE PUBLICATION
* OF THE PROGRAM
*
* NEC INFORMATEC SYSTEMS CONFIDENTIAL AND PROPRIETARY
*
* テンプレート履歴:
* EXPJ (2004/04/05),メソッドコメントの「* @param なし」をすべて削除
* ,メソッドコメントの「* @return なし」をすべて削除
* ,EXPLANNER/J用に改造
* 3.1.0.1 (2003/10/30),Stored Procedure障害対応
* 3.1.0.0 (2003/06/24),Stored Procedure対応
* 3.0.0.0 (2003/03/19),mediatorリポジトリ情報修正
* 2.1.0.0 (2002/11/05),検索EntityのCacheモード対応
* 2.0.2.0 (2002/10/15),DB2対応
* 2.0.1.0 (2002/08/05),MS SQLServer2000対応
* 2.0.0.0 (2002/05/27),new foundation対応
*
*/
package com.nec.jp.orteus.metamorBase.KP0050.KP0050B001;
import com.nec.jp.orteus.util.*;
import com.nec.jp.orteus.xaf.foundation.*;
import com.nec.jp.orteus.xaf.util.*;
import com.nec.jp.orteus.xaf.ba.*;
import com.nec.jp.orteus.xaf.wa.*;
import java.lang.Number.*;
import java.sql.*;
import java.util.*;
import java.util.Date;
import java.io.*;
//{{user_implement_dev:import
// TODO: ここにimportパッケージを記述してください
//}}user_implement_dev:import
/**
* CLASS : readT_SALES_PLAN クラス
* ファイル・クラス説明
* @author $Author: geng-jia $
* @version $Revision: 1.13 $ $Date: 2015/12/03 08:54:00 $
*/
//{{user_implement_dev:header
//}}user_implement_dev:header
public class readT_SALES_PLAN extends AbstractBatchAppEntity
{
//////////////////////////////
/**
* create()メソッドが利用できるかどうかを返す
*
* @return 利用できる場合にはTRUE、できない場合にはFALSEを返す
*/
public boolean canCreate() { return false; }
/**
* read()メソッドが利用できるかどうかを返す
*
* @return 利用できる場合にはTRUE、できない場合にはFALSEを返す
*/
public boolean canRead() { return true; }
/**
* update()メソッドが利用できるかどうかを返す
*
* @return 利用できる場合にはTRUE、できない場合にはFALSEを返す
*/
public boolean canUpdate() { return false; }
/**
* delete()メソッドが利用できるかどうかを返す
*
* @return 利用できる場合にはTRUE、できない場合にはFALSEを返す
*/
public boolean canDelete() { return false; }
/**
* call()メソッドが利用できるかどうかを返す
*
* @return 利用できる場合にはTRUE、できない場合にはFALSEを返す
*/
public boolean canCall() { return false; }
/**
* ログ部品インスタンス
*/
public DisplayMessageUtil objMessage = new DisplayMessageUtil();
//////////////////////////////
//{{user_implement_dev:db_main
/**
* 初期処理
*
* @return <<コメントを記述してください>>
* @exception <<コメントを記述してください>>
*/
public int beginProc() throws BatchAppException
{
return m_entity.beginProc();
}
/**
* 終了処理
*
* @exception <<コメントを記述してください>>
*/
public int endProc() throws BatchAppException
{
return m_entity.endProc();
}
/**
* DBアクセス処理を実行します
*
* @exception <<コメントを記述してください>>
*/
public int execute() throws BatchAppException
{
return m_entity.execute();
}
/**
* レコード新規追加処理
*
* @exception <<コメントを記述してください>>
*/
public int create() throws BatchAppException
{
return m_entity.create();
}
/**
* データ読出し処理
*
* @exception <<コメントを記述してください>>
*/
public int read() throws BatchAppException
{
m_entity.setCacheMode(false);
return m_entity.read();
}
/**
* データ更新処理
*
* @exception <<コメントを記述してください>>
*/
public int update() throws BatchAppException
{
return m_entity.update();
}
/**
* データ削除処理
*
* @exception <<コメントを記述してください>>
*/
public int delete() throws BatchAppException
{
return m_entity.delete();
}
/**
* Stored Procedure処理
*
* @exception <<コメントを記述してください>>
*/
public List call() throws BatchAppException
{
return m_entity.call();
}
/**
* カレントレコードに対してアクセスする
*
* @exception <<コメントを記述してください>>
*/
public boolean next() throws BatchAppException
{
return m_entity.next();
}
/**
* entityには1つ以上のレコードを持っているか
*
* @exception <<コメントを記述してください>>
*/
public boolean hasRecord(boolean moveCursor) throws BatchAppException
{
return m_entity.hasRecord(moveCursor);
}
//}}user_implement_dev:db_main
//{{entity_class(wizard code)
//////////////////////////////
class interEntity
{
//////////////////////////////
// Cacheモード
private boolean bCachemode = true;
public boolean getCacheMode() { return bCachemode; }
public void setCacheMode( boolean bFlag ) { bCachemode = bFlag; }
// DBレコードコレクションクラス インスタンス
protected IDbRecordset m_doRs=null;
// 日付クラスインスタンス
public java.sql.Date m_dat=null;
//////////////////////////////
public int beginProc() throws BatchAppException
{
// SQL文をprepareします
prepareAll();
return SUCCESS;
}
public int endProc() throws BatchAppException
{
clearAll();
return SUCCESS;
}
public int execute() throws BatchAppException
{
int ret = SUCCESS;
return ret;
}
public int create() throws BatchAppException
{
return BREAK;
}
public void setIN1_R(String value) throws FoundationException { getAdapt_R().setString(1, value); }
public void setIN2_R(String value) throws FoundationException { getAdapt_R().setString(2, value); }
public void setIN3_R(String value) throws FoundationException { getAdapt_R().setString(3, value); }
public void setIN4_R(String value) throws FoundationException { getAdapt_R().setString(4, value); }
public int read() throws BatchAppException
{
return read(bCachemode);
}
public int read(boolean cache) throws BatchAppException
{
try {
if(m_doRs!=null) {
m_doRs.close();
m_doRs = null;
}
setIN1_R(m_med.getCOMPANY_CD());
setIN2_R(m_med.getPLANT_CD());
setIN3_R(m_med.getPLANT_CD());
setIN4_R(m_med.getCOMPANY_CD());
} catch(FoundationException e) {
BatchAppException be=new BatchAppException("readT_SALES_PLAN", "read", "レコード検索条件設定処理失敗");
be.addMessage(e.getErrmsg());
throw be;
}
m_doRs = getRecordset(cache);
return SUCCESS;
}
public int update() throws BatchAppException
{
return BREAK;
}
public int delete() throws BatchAppException
{
return BREAK;
}
public List call() throws BatchAppException
{
return null;
}
public String getPLN_STR_DATE_R() throws FoundationException { return m_doRs.getString(1); }
public String getPLN_END_DATE_R() throws FoundationException { return m_doRs.getString(2); }
public boolean wasNull_PLN_QTY_REMAIN_R() throws FoundationException { return m_doRs.wasNull(3); }
public Number getPLN_QTY_REMAIN_R() throws FoundationException { return m_doRs.getDouble(3); }
public String getBUSINESS_OPR_DATE_R() throws FoundationException { return m_doRs.getString(4); }
public String getTRANSPORT_LT_R() throws FoundationException { return m_doRs.getString(5); }
public String getITEM_CD_R() throws FoundationException { return m_doRs.getString(6); }
public String getMRP_ODR_TYP_R() throws FoundationException { return m_doRs.getString(7); }
public String getOUTSIDE_TYP_R() throws FoundationException { return m_doRs.getString(8); }
public String getISSUE_TYP_R() throws FoundationException { return m_doRs.getString(9); }
public String getODR_LT_R() throws FoundationException { return m_doRs.getString(10); }
public String getFIXED_LT_R() throws FoundationException { return m_doRs.getString(11); }
public String getPROP_LT_R() throws FoundationException { return m_doRs.getString(12); }
public String getSAFETY_LT_R() throws FoundationException { return m_doRs.getString(13); }
public String getISSUE_LT_R() throws FoundationException { return m_doRs.getString(14); }
public String getPROP_LOT_SIZE_R() throws FoundationException { return m_doRs.getString(15); }
public String getHIGH_LEVEL_NO_R() throws FoundationException { return m_doRs.getString(16); }
public String getITEM_SPOIL_R() throws FoundationException { return m_doRs.getString(17); }
public String getPLANT_CD_R() throws FoundationException { return m_doRs.getString(18); }
public boolean next() throws BatchAppException
{
try {
if(m_doRs.next()==false) return false;
m_med.setPLN_STR_DATE(getPLN_STR_DATE_R());
m_med.setPLN_END_DATE(getPLN_END_DATE_R());
if(wasNull_PLN_QTY_REMAIN_R()==true) {
m_med.setPLN_QTY_REMAIN(null);
} else {
m_med.setPLN_QTY_REMAIN(new Double(getPLN_QTY_REMAIN_R().doubleValue()));
}
m_med.setBUSINESS_OPR_DATE(getBUSINESS_OPR_DATE_R());
m_med.setTRANSPORT_LT(getTRANSPORT_LT_R());
m_med.setITEM_CD(getITEM_CD_R());
m_med.setMRP_ODR_TYP(getMRP_ODR_TYP_R());
m_med.setOUTSIDE_TYP(getOUTSIDE_TYP_R());
m_med.setISSUE_TYP(getISSUE_TYP_R());
m_med.setODR_LT(getODR_LT_R());
m_med.setFIXED_LT(getFIXED_LT_R());
m_med.setPROP_LT(getPROP_LT_R());
m_med.setSAFETY_LT(getSAFETY_LT_R());
m_med.setISSUE_LT(getISSUE_LT_R());
m_med.setPROP_LOT_SIZE(getPROP_LOT_SIZE_R());
m_med.setHIGH_LEVEL_NO(getHIGH_LEVEL_NO_R());
m_med.setITEM_SPOIL(getITEM_SPOIL_R());
m_med.setWH_PLANT_CD(getPLANT_CD_R());
} catch(FoundationException e) {
BatchAppException be=new BatchAppException("readT_SALES_PLAN", "next", "レコード移動失敗");
be.addMessage(e.getErrmsg());
throw be;
}
return true;
}
public boolean hasRecord(boolean moveCursor) throws BatchAppException
{
if(read(false)!=SUCCESS) return false;
try {
boolean ret;
if(moveCursor) {
ret = next();
} else {
ret = m_doRs.next();
}
m_doRs.close();
m_doRs = null;
return ret;
} catch(FoundationException e) {
BatchAppException be=new BatchAppException("readT_SALES_PLAN", "hasRecord", "レコード存在チェック失敗");
be.addMessage(e.getErrmsg());
throw be;
}
}
//////////////////////////////
}
//}}entity_class(wizard code)
//////////////////////////////
/**
* DBに対して接続します
*/
void open() throws SystemException
{
try {
setConnection( m_conductor.m_transactionConn );
} catch(BatchAppException e) {
throw new SystemException("SYSERR", "コネクションの設定に失敗しました", null, null, e);
}
return;
}
/**
* SQL文をprepareします
*
*/
void prepareAll() throws BatchAppException
{
String sCREATE=m_inscmd,
sREAD=m_selcmd,
sUPDATE=m_updcmd,
sDELETE=m_delcmd,
sSP=m_calcmd;
//{{user_implement_dev:prepare
// TODO: ここに準備処理を記述してください
//}}user_implement_dev:prepare
prepareCreate(sCREATE);
prepareRead(sREAD);
prepareUpdate(sUPDATE);
prepareDelete(sDELETE);
prepareSp(sSP);
return;
}
//////////////////////////////
/**
* readT_SALES_PLANクラスの標準コンストラクタ
*
*/
public readT_SALES_PLAN(medKP0050B001 med, BatchAppConductor cdr) throws SystemException
{
//{{user_implement_dev:constractor
// TODO: ここに初期処理を記述してください
//}}user_implement_dev:constractor
try {
m_container = new ManageContainer();
} catch(FoundationException e) {
throw new SystemException("SYSERR", "コンテナ接続に失敗しました", null, null, e);
}
m_med = med;
m_conductor = cdr;
// DBに接続します
open();
return;
}
/**
* インスタンス破壊時に行う処理
*
*/
protected void finalize()
{
try {
// DB接続を切断します
close();
} catch(BatchAppException e) {
System.out.println(e.getErrmsg());
}
// 各メンバ変数の初期化
m_med = null;
objMessage = null;
// todo: インスタンス消滅時に実行する処理を記述してください
return;
}
//////////////////////////////
ManageContainer m_container;
// mediatorクラス インスタンス
public medKP0050B001 m_med=null;
protected BatchAppConductor m_conductor;
// interEntityクラスインスタンス
public interEntity m_entity=new interEntity();
// 各状態で実行するsql文の定義
protected static String m_selcmd = "SELECT "
+" to_char(A.PLN_STR_DATE, 'YYYY/MM/DD') AS PLN_STR_DATE, "
+" to_char(A.PLN_END_DATE, 'YYYY/MM/DD') AS PLN_END_DATE, "
+" A.PLN_QTY_REMAIN AS PLN_QTY_REMAIN, "
+" to_char(F.BUSINESS_OPR_DATE, 'YYYY/MM/DD') AS BUSINESS_OPR_DATE, "
+" D.TRANSPORT_LT AS TRANSPORT_LT, "
+" C.ITEM_CD AS ITEM_CD, "
+" B.MRP_ODR_TYP AS MRP_ODR_TYP, "
+" B.OUTSIDE_TYP AS OUTSIDE_TYP, "
+" B.ISSUE_TYP AS ISSUE_TYP, "
+" B.ODR_LT AS ODR_LT, "
+" B.FIXED_LT AS FIXED_LT, "
+" B.PROP_LT AS PROP_LT, "
+" B.SAFETY_LT AS SAFETY_LT, "
+" B.ISSUE_LT AS ISSUE_LT, "
+" B.PROP_LOT_SIZE AS PROP_LOT_SIZE, "
+" B.HIGH_LEVEL_NO AS HIGH_LEVEL_NO, "
+" B.ITEM_SPOIL AS ITEM_SPOIL, "
+" E.PLANT_CD AS WH_PLANT_CD "
+"FROM "
+" T_SALES_PLAN A, "
+" M_ITEM B, "
+" M_ITEM_SPEC C, "
+" M_CUST_BASE D, "
+" M_WH E, "
+" SYS_DATE_CTRL F "
+"WHERE "
+" D.COMPANY_CD = ? "
+" AND D.CUST_CD = A.CUST_CD "
+" AND D.DLV_LOC_CD = A.DLV_LOC_CD "
+" AND E.WH_CD = D.SHIP_WH_CD "
+" AND E.PLANT_CD = ? "
+" AND F.PLANT_CD = ? "
+" AND C.COMPANY_CD = ? "
+" AND C.CUST_CD = A.CUST_CD "
+" AND C.CUST_ITEM_CD = A.CUST_ITEM_CD "
+" AND B.ITEM_CD = C.ITEM_CD "
+" AND B.MRP_ODR_TYP in (4, 5, 6, 7) "
+" AND A.DLT_FLG = 0 "
+" ";
protected static String m_inscmd = null;
protected static String m_updcmd = null;
protected static String m_delcmd = null;
protected static String m_calcmd = null;
// トランザクション利用の可否を設定します
boolean m_useTransaction=true;
//////////////////////////////
}
| [
"kenichirou-yoshida@kowa.co.jp"
] | kenichirou-yoshida@kowa.co.jp |
60687de6a8669b7962b785945c84b38a2ca667df | 639636146960666ea396c8644b09957844126f03 | /Database.java | 89998e5fcdae8dbc83b709615e573a5296bf1dd2 | [] | no_license | stasiey/Sqlite---viewer | 76c3d9d41d9cccaaa32a8c229c42c07a07ec748e | 72328f2dd7ac333c6cc4d2490010c92dfe0e126e | refs/heads/main | 2023-07-24T12:45:21.209858 | 2021-08-28T16:11:46 | 2021-08-28T16:11:46 | 400,836,191 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,343 | java | package viewer;
import org.sqlite.SQLiteDataSource;
import java.sql.*;
import java.util.ArrayList;
public class Database {
final static String query = "SELECT name FROM sqlite_master WHERE type ='table' AND name NOT LIKE 'sqlite_%';";
static SQLiteDataSource dataSource = new SQLiteDataSource();//创建SQLiteDataSource对象
public static ArrayList<String> forTableComboBox(String database) {
ArrayList<String> columnNames = new ArrayList<>();
String url = "jdbc:sqlite:" + database;
dataSource.setUrl(url);
try (Connection con = dataSource.getConnection();
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query)){
while (rs.next()) {
columnNames.add(rs.getString("name"));
}
rs.close();
stmt.close();
con.close();
} catch (SQLException e) {
e.printStackTrace();
// return null;
}
return columnNames;
}
public static String forTableTable(String database, String queryTable, myTableModel myTableModel) {
String url = "jdbc:sqlite:" + database;
dataSource.setUrl(url);
try (Connection con = dataSource.getConnection(); //创立连接
Statement stmt = con.createStatement(); //创建一个对象数据库操作对象
ResultSet rs = stmt.executeQuery(queryTable))//执行查询 ()queryTable)
{
ResultSetMetaData metaData = rs.getMetaData();
String[] cols = new String[metaData.getColumnCount()];
for (int i = 1; i <= cols.length; i++) {
cols[i - 1] = metaData.getColumnLabel(i); //column number from 1...;
}
ArrayList<Object[]> rows = new ArrayList<>();
Object[] row;
while (rs.next()) {
row = new Object[metaData.getColumnCount()];
for (int i = 1; i <= row.length; i++) {
row[i - 1] = rs.getObject(i);
}
rows.add(row);
}
myTableModel.setTableData(cols,rows);
rs.close();
stmt.close();
con.close();
} catch (SQLException e) {
e.printStackTrace();
}return null;
}
}
| [
"87606677+stasiey@users.noreply.github.com"
] | 87606677+stasiey@users.noreply.github.com |
0aadd7346b111ea0a45b9bfde13152e3078d1718 | 5363d8d6dc75357d40ebfbb07f7795a16bbbaa5e | /library-messaging-consumer/src/main/java/library/controller/RabbitMQConsumerController.java | 964bdae6c4a554c352f8a5df05c68ef914093bd7 | [] | no_license | davidepravata/SpringInAction | d5930bf62774c69bbc40756a77789c5a801fc125 | 3c0ec5604e1f218f41d05fc93fd2076750175ed6 | refs/heads/master | 2020-04-08T11:09:09.783098 | 2018-12-05T20:29:39 | 2018-12-05T20:29:39 | 159,295,044 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 979 | java | package library.controller;
import library.consumer.jms.JmsBookOrderConsumer;
import library.consumer.rabbitmq.RabbitMQBookOrderConsumer;
import library.entities.Book;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
@Slf4j
@RequestMapping(path="/messaging",produces="application/json")
@RestController
@CrossOrigin(origins="*")
public class RabbitMQConsumerController {
private RabbitMQBookOrderConsumer rabbitMQBookOrderConsumer;
public RabbitMQConsumerController(RabbitMQBookOrderConsumer rabbitMQBookOrderConsumer) {
this.rabbitMQBookOrderConsumer = rabbitMQBookOrderConsumer;
}
@GetMapping(path = "/receiverabbitmsg")
@ResponseStatus(HttpStatus.OK)
public Book receiveMsg() {
log.info("Invoking rabbitMQ to verify if message has been received");
Book book = (Book) rabbitMQBookOrderConsumer.receiveBookOrder();
return book;
}
}
| [
"davide.pravata@docomodigital.com"
] | davide.pravata@docomodigital.com |
10fa9b24f3e7fab259dbe4b813624ff91cc16846 | 1c2cf15de2eb01b6ca146a7b1822a1d8ecd3d505 | /src/main/java/com/kh/hello/member/model/exception/LoginException.java | bc84928f2a9131f20854bfe342b5db6a6ad7618f | [] | no_license | jinseogood/NewHelloKorea | f7bc19e2881e4d6d2391b052a6232ff187d84487 | 8d9eeabc39b49f9eacf9f074d4c256c6ed2545ed | refs/heads/master | 2022-06-27T04:05:39.914707 | 2022-06-20T14:11:31 | 2022-06-20T14:11:31 | 154,231,337 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 169 | java | package com.kh.hello.member.model.exception;
public class LoginException extends Exception {
public LoginException(String message) {
super(message);
}
}
| [
"Administrator@JINSEO-NT"
] | Administrator@JINSEO-NT |
4ed0cfbf12e464135836c12e58870e9bda9ec0a6 | 2b3f1b26e1dffed7200bae044cb287d04ab47e81 | /JobTraining/src/pkg1203/TakeAWalk.java | 8bc35774d4fef7411773069c717f323618bdb318 | [] | no_license | KitagawaMasahito/Portfolio | 68b024ae3aee82b7a134adff8697bdd36d86dbe0 | 58ce5fb91420c948b306e31d2f4034f6be149a3a | refs/heads/master | 2021-02-20T17:12:31.393995 | 2020-03-06T09:25:07 | 2020-03-06T09:25:07 | 245,342,319 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,801 | java | package pkg1203;
import java.util.Scanner;
public class TakeAWalk {
public static void main(String[] args) {
Scanner sc =new Scanner(System.in);
System.out.print("どの動物にしますか?(1:鳥 2:犬):");
int animalSelect = sc.nextInt();
int doingSelect = 0;
int eneMaxDefault = 25;
if(animalSelect==1) {
VirtualBird pet1=new VirtualBird();
pet1.name=naming();
pet1.maxEnergy=eneMaxDefault;
pet1.energy=pet1.maxEnergy;
while(true) {
doingSelect = doing();
if(doingSelect==1) {
pet1.sleeping();
pet1.printInfo();
}else if(doingSelect==2) {
pet1.fly();
pet1.printInfo();
}else if(doingSelect==3) {
pet1.eat();
pet1.printInfo();
}else if(doingSelect==4) {
pet1.printInfo();
System.out.println("行動を終了します");
break;
}else {
System.out.println("入力が不正です");
}
}
}else if(animalSelect==2) {
VirtualDog pet1=new VirtualDog();
pet1.name=naming();
pet1.maxEnergy=eneMaxDefault;
pet1.energy=pet1.maxEnergy;
while(true) {
doingSelect = doing();
if(doingSelect==1) {
pet1.sleeping();
pet1.printInfo();
}else if(doingSelect==2) {
pet1.walk();
pet1.printInfo();
}else if(doingSelect==3) {
pet1.eat();
pet1.printInfo();
}else if(doingSelect==4) {
pet1.printInfo();
System.out.println("行動を終了します");
break;
}else {
System.out.println("入力が不正です");
}
} }else {
System.out.println("入力が不正です");
return;
}
}
public static String naming() {
Scanner sc =new Scanner(System.in);
System.out.print("名前をつけてください:");
String name=sc.next();
return name;
}
public static int doing() {
Scanner sc =new Scanner(System.in);
System.out.print("行動選択\n1:寝る 2:移動する 3:食べる 4:散歩を終わる:");
int n = sc.nextInt();
return n;
}
}
class VirtualBird extends VirtualPet{
public void fly() {
if(energy>=16) {
System.out.println(name+"は飛んだ!");
energy-=15;
}else {
System.out.println(name+"は動けない!");
}
}
}
class VirtualDog extends VirtualPet{
public void walk() {
if(energy>=11) {
System.out.println(name+"は歩いた!");
energy-=10;
}else{
System.out.println(name+"は動けない!");
}
}
}
class VirtualPet{
String name;
int maxEnergy;
int energy;
public void sleeping() {
System.out.println(name+"は寝た。体力が全快した!");
energy=maxEnergy;
}
public void eat() {
System.out.println(name+"は餌を食べた。体力が5回復した!");
energy+=5;
}
public void printInfo() {
System.out.println("名前:"+name+" 現在の体力:"+energy+" 最大体力:"+maxEnergy);
}
} | [
"rosetta.g54b.lightning01@gmail.com"
] | rosetta.g54b.lightning01@gmail.com |
f3ee739069273595225eaaa5ed0236d781f6b997 | 79e5734f6351374846a204839af4fe7705d90738 | /example.java | 82c96db8b3f39807954ecb1d2d78bded819b6192 | [] | no_license | mrkushalsharma/java-prac-bucky | 3c296c29047b5ef1384c3f9c0b040645baf07035 | 9ca2d8b06f5cb49f0c9c0e8041d4fa92c9363603 | refs/heads/master | 2020-06-10T17:34:07.989400 | 2019-07-15T03:55:37 | 2019-07-15T03:55:37 | 193,693,025 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,901 | java | import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class example extends JFrame {
private JPanel contentPane;
private JTextField textField;
private JTextField textField_1;
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
example frame = new example();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
public example() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 392, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
JLabel lblFirstNumber = new JLabel("First Number");
textField = new JTextField();
textField.setColumns(10);
JLabel lblSecondNumber = new JLabel("Second Number");
textField_1 = new JTextField();
textField_1.setColumns(10);
JLabel lblResult = new JLabel("Result : ");
JLabel lblNewLabel = new JLabel();
JButton btnAdd = new JButton("ADD");
btnAdd.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
String first = textField.getText();
String second = textField_1.getText();
int sum = Integer.parseInt(first) + Integer.parseInt(second);
lblNewLabel.setText(sum + "");
}
});
GroupLayout gl_contentPane = new GroupLayout(contentPane);
gl_contentPane.setHorizontalGroup(gl_contentPane.createParallelGroup(Alignment.LEADING).addGroup(gl_contentPane
.createSequentialGroup().addGap(61)
.addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING).addComponent(lblResult)
.addComponent(lblSecondNumber).addComponent(lblFirstNumber))
.addGap(29)
.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING).addComponent(btnAdd)
.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING, false).addComponent(textField_1)
.addComponent(textField, GroupLayout.DEFAULT_SIZE, 113, Short.MAX_VALUE))
.addComponent(lblNewLabel))
.addContainerGap(88, Short.MAX_VALUE)));
gl_contentPane.setVerticalGroup(gl_contentPane.createParallelGroup(Alignment.LEADING).addGroup(gl_contentPane
.createSequentialGroup().addGap(33)
.addGroup(gl_contentPane
.createParallelGroup(Alignment.BASELINE).addComponent(lblFirstNumber).addComponent(textField,
GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGap(18)
.addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE).addComponent(lblSecondNumber)
.addComponent(textField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
GroupLayout.PREFERRED_SIZE))
.addGap(18).addComponent(btnAdd).addGap(35).addGroup(gl_contentPane
.createParallelGroup(Alignment.BASELINE).addComponent(lblResult).addComponent(lblNewLabel))
.addContainerGap(70, Short.MAX_VALUE)));
contentPane.setLayout(gl_contentPane);
}
} | [
"mrkushalsharma@gmail.com"
] | mrkushalsharma@gmail.com |
7b86afca6c728c9e51f665b3dd1ed2a553965e86 | 48d397581864aff5897c73d11d205bf1b25e5d3d | /src/main/java/br/com/pedido/bo/ProcessaCompra.java | 813a24d1a97a9af2630905036a99d3d4a90e3e40 | [] | no_license | lucianoft/WildFlyJMS | f8813d51f5ec386f237afdcfa13336fc104d03b2 | a824b3cfc4abaa5fa119b5a32eccae28f7ff00f4 | refs/heads/master | 2020-09-08T17:40:59.595385 | 2017-07-11T23:22:40 | 2017-07-11T23:22:40 | 94,436,615 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 680 | java | package br.com.pedido.bo;
import javax.ejb.Stateless;
import br.com.pedido.domain.Compra;
import br.com.pedido.domain.Item;
@Stateless
public class ProcessaCompra {
public Compra fecharCompra(Compra compra){
System.out.println(compra.getNome());
System.out.println(compra.getNumeroCartao());
System.out.println("--- Itens --- ");
float precoTotal = 0;
for (Item item : compra.getItens()) {
System.out.println(item.getNome());
precoTotal += item.getPreco() * item.getQuantidade();
}
System.out.println("Total: " + precoTotal);
return compra;
}
}
| [
"fernandes@DESKTOP-5QM21D0"
] | fernandes@DESKTOP-5QM21D0 |
6b31f0a4b5ee145a10f30e32554c2cf01fc5fb6b | 6df9a4f86a289ef147ce1fe87d3f4c912f3ee52a | /src/org/tathva/triloaded/info/InfoWebView.java | 71df2b836490d14506cd2451c32fe41ed532a40b | [] | no_license | aakifahrahman/Tathva14 | 0610392b1d5eec7aaefe6ad0e16e34f8ef8dc333 | 3e7ee5e7720cef71e4846b369ae07d4fb2369a1d | refs/heads/master | 2016-08-12T08:31:25.573588 | 2016-02-06T15:52:09 | 2016-02-06T15:52:09 | 51,208,745 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,790 | java | package org.tathva.triloaded.info;
import org.tathva.triloaded.mainmenu.R;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.util.Log;
import android.view.Window;
import android.view.WindowManager;
import android.webkit.WebView;
public class InfoWebView extends Activity{
public static final int DEVELOPERS = 1;
public static final int ABOUT_TATHVA = 2;
public static final int SPONSERS = 3;
public static final int ABOUT_NITC = 4;
public static final int NITES = 5;
public static final String KEY ="key";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.webview_layout);
Bundle info = getIntent().getExtras();
int type = info.getInt(KEY);
WebView browser = (WebView) findViewById(R.id.webview);
switch(type){
case ABOUT_NITC: browser.loadUrl("file:///android_asset/aboutnitc.html");break;
case ABOUT_TATHVA: browser.loadUrl("file:///android_asset/abouttathva.html");break;
case DEVELOPERS:browser.loadUrl("file:///android_asset/developers.html"); break;
case SPONSERS:
if(networkCheckIn()){
browser.loadUrl("http://tathva-paperback.rhcloud.com/app/sponsers.html");
}else{
browser.loadUrl("file:///android_asset/offline.html");
};
break;
case NITES:
browser.loadUrl("file:///android_asset/nites.html");
break;
}
}
public boolean networkCheckIn() {
try {
ConnectivityManager networkInfo = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
networkInfo.getActiveNetworkInfo().isConnectedOrConnecting();
Log.d("1", "Net avail:"
+ networkInfo.getActiveNetworkInfo()
.isConnectedOrConnecting());
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo netInfo = cm.getActiveNetworkInfo();
if (netInfo != null && netInfo.isConnectedOrConnecting()) {
// Log.d("2", "Network available:true");
return true;
} else {
// Log.d("3", "Network available:false");
return false;
}
} catch (Exception e) {
return false;
}
}
@Override
public void onBackPressed() {
// TODO Auto-generated method stub
super.onBackPressed();
overridePendingTransition (R.anim.activity_open_scale, R.anim.activity_close_translate);
}
} | [
"aakifahrahiman@yahoo.co.in"
] | aakifahrahiman@yahoo.co.in |
01d2ff204de7477c0357426de72411c0945636f5 | cc28bb3f1cf82cb35bfa7fc6b03e878339f352a7 | /src/main/java/com/yuf/demo/business/excel/filter/Filter.java | a2db69bb146300d2b23ca47a546bc4870600f978 | [] | no_license | yufenvision/springBootDemo | 91e321ec34d5b997d08d04082fee24f08c342fc8 | fc6b2f0048f1b69aa727790e1db5d69b46998d59 | refs/heads/master | 2023-07-21T20:24:34.382119 | 2021-06-23T02:04:01 | 2021-06-23T02:04:01 | 152,387,099 | 0 | 0 | null | 2022-06-17T03:31:19 | 2018-10-10T08:14:35 | HTML | UTF-8 | Java | false | false | 201 | java | package com.yuf.demo.business.excel.filter;
/**
* @Author: dyf
* @Date: 2020/12/16 17:29
* @Description:
*/
public interface Filter <T,S>{
void doFilter(T t, S s, FilterChain filterChain);
}
| [
"duanyufeii@qq.com"
] | duanyufeii@qq.com |
854cf7b62451e8658cf9203d1358ab8f1a311227 | 1474f3829aa0ecd5f7de64d305cbc984145a0b25 | /06_04/start/test/Form.java | 5b701710afd0913c5b49093c7a5d835f9e440db9 | [] | no_license | Sindhuja2014/Formy-project-automation | acfec26ab01b180796fff92c396f6cfa56243878 | 94b6945ad4498a5fcad2f53a732ab2efe71bd3cf | refs/heads/master | 2023-04-07T12:15:57.555652 | 2021-04-13T22:52:13 | 2021-04-13T22:52:13 | 357,697,017 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,018 | java | import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import static org.junit.Assert.assertEquals;
public class Form {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "C:/Program Files/Selenium jars and drivers/Drivers/Chromedriver/chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("https://formy-project.herokuapp.com/form");
driver.manage().window().maximize();
FormPage formPage = new FormPage();
FormPage.submitForm(driver);
ConfirmationPage confirmationPage = new ConfirmationPage();
ConfirmationPage.waitForAlertBanner(driver);
assertEquals("The form was successfully submitted!", ConfirmationPage.getAlertBannerText(driver));
//driver.quit();
}
}
| [
"Sindhujaraj11@gmail.com"
] | Sindhujaraj11@gmail.com |
1e170019ac2467dd093433ad7e691f8f97de6dda | a6b89faf1b5f46603a133948b092d85a270796c3 | /src/test/java/com/oocl/SpringBoot/ApplicationTests.java | 0184a232136560d2f98e4902b6b7406cae176efe | [] | no_license | JerryZer0/Spring-Repository-one-to-n | ccfc73bc8254e47a8186519d75e729dda2d4c18e | 964aed0e52a82cb9368e0c3aca682120eaa476f0 | refs/heads/master | 2020-03-24T03:16:32.699822 | 2018-07-29T08:48:37 | 2018-07-29T08:48:37 | 142,412,088 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 330 | java | package com.oocl.SpringBoot;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class ApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"jerry.zhang@oocl.com"
] | jerry.zhang@oocl.com |
29fb459f828b6144b062f4c386f9728b54c6cf2e | d3044bdb992fc31f6e19d3db5e8b883f698bc78b | /app/src/main/java/mobile/com/fourex/MainActivity.java | 9c97eaddcc78f84f2cb3281ccc113427fdfeb554 | [] | no_license | Ancord1/FourEx | af89815a06dd2d961296701be09087ffe1a38ce3 | b17ce9d17b4c6cfe22ec187ed29cbfc3e5846628 | refs/heads/master | 2020-03-13T22:44:17.507211 | 2018-05-23T08:48:37 | 2018-05-23T08:48:37 | 131,321,696 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,378 | java | package mobile.com.fourex;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.SearchView;
import java.util.List;
public class MainActivity extends AppCompatActivity implements Contract.IView {
private Contract.IPresenter presenter;
private RecyclerView venueList;
private RecyclerView.Adapter adapter;
private ProgressBar progressBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
progressBar = (ProgressBar) findViewById(R.id.progressBar);
progressBar.setVisibility(View.INVISIBLE);
//LocationProvider.checkLocationPermission(this);
venueList = (RecyclerView) findViewById(R.id.venueList);
venueList.setHasFixedSize(true);
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
venueList.setLayoutManager(layoutManager);
DividerItemDecoration divider = new DividerItemDecoration(
venueList.getContext(),
layoutManager.getOrientation()
);
venueList.addItemDecoration(divider);
presenter = new Presenter(this, new Model(getApplicationContext()));
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu_search, menu);
MenuItem item = menu.findItem(R.id.searchBar);
SearchView searchView = (SearchView) item.getActionView();
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String s) {
return false;
}
@Override
public boolean onQueryTextChange(String s) {
presenter.onSearch(s);
return false;
}
});
return super.onCreateOptionsMenu(menu);
}
@Override
public void showVenues(List<Venue> venues) {
adapter = new VenueAdapter(venues);
venueList.setAdapter(adapter);
}
@Override
public void showDialog(String title, String message) {
AlertDialog.Builder alertDialog = new AlertDialog.Builder(MainActivity.this);
alertDialog.setTitle(title);
alertDialog.setMessage(message);
alertDialog.setNegativeButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
alertDialog.show();
}
@Override
public void showProgressBar(boolean isSearching) {
if (isSearching)
progressBar.setVisibility(View.VISIBLE);
else
progressBar.setVisibility(View.INVISIBLE);
}
@Override
protected void onDestroy() {
presenter.onDestroy();
super.onDestroy();
}
}
| [
"dr.indifferent@gmail.com"
] | dr.indifferent@gmail.com |
30fb93e283995837e770b54668559c8dec787ec6 | a549a4a5db0071a9678e7326e568c3f5951556f9 | /src/main/java/ru/banking/Account.java | 601e824d929b1c4faaecb9dd3bd7234c19a090d2 | [] | no_license | DevFactory/assignments | e89bd97cca7bd12c8926c791ffa15508bdfb55ab | d7db9dbb7df181342f831fd7c9b5bb7ff09cfb5f | refs/heads/master | 2021-10-08T22:13:10.039992 | 2018-12-18T07:43:38 | 2018-12-18T07:43:38 | 198,375,830 | 0 | 0 | null | 2019-07-23T07:25:44 | 2019-07-23T07:25:44 | null | UTF-8 | Java | false | false | 2,238 | java | package ru.banking;
import ru.banking.exceptions.AccountBalanceOverflowException;
import java.util.concurrent.locks.StampedLock;
/**
* by Anatolii Danilov on 28-3-2017.
* For simplicity of the exercise we assume that the currency is KRW,
* currency which doesn't have decimal places
*/
public class Account {
private String accountNumber;
private volatile long balance;
private volatile boolean isBlocked;
private final StampedLock lock = new StampedLock();
public Account(String accountNumber) {
if (accountNumber == null)
throw new NullPointerException("Please assign non-null account number");
this.accountNumber = accountNumber;
}
public Account initialBalance(long initialBalance) {
balance = initialBalance;
return this;
}
public String getAccountNumber() {
return accountNumber;
}
public long getBalance() {
long stamp = lock.tryOptimisticRead();
long balance = this.balance;
if (lock.validate(stamp)) {
return balance;
}
stamp = lock.readLock();
try {
return this.balance;
} finally {
lock.unlockRead(stamp);
}
}
public void withdraw(long amount) throws AccountBalanceOverflowException {
long before = balance;
balance -= amount;
if (balance > before) {
throw new AccountBalanceOverflowException(accountNumber);
}
}
public void deposit(long amount) throws AccountBalanceOverflowException {
long before = balance;
balance += amount;
if (balance < before) {
throw new AccountBalanceOverflowException(accountNumber);
}
}
public boolean isBlocked() {
return isBlocked;
}
public void blockAccount() {
isBlocked = true;
}
public long writeLock() {
return lock.writeLock();
}
public void releaseLock(long stamp) {
lock.unlockWrite(stamp);
}
@Override
public String toString() {
return "Account{" +
"accountNumber='" + accountNumber + '\'' +
", isBlocked=" + isBlocked +
'}';
}
}
| [
"anatolii.danilov@ing.nl"
] | anatolii.danilov@ing.nl |
cbdf00e7562cff1b56073dbbf30f824ca928d188 | 35d2aa3be6c6edaaf8849675780018f2e1755a64 | /app/src/main/java/com/example/ygh/app/bean/UserResult.java | 34654f40de83a050b6f58a3590577e8139ae4f86 | [] | no_license | yinguohui/APP | f5245befc5b9dc8712c5b4d63ee433f4f0e0f229 | 8256128e4d2e04a78f9c7860a00c796739c8b9c3 | refs/heads/master | 2020-06-22T01:10:19.486618 | 2019-07-20T08:23:43 | 2019-07-20T08:23:59 | 197,596,491 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,394 | java | package com.example.ygh.app.bean;
import java.util.List;
public class UserResult {
private int code;
private String message;
private String status;
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
private UserInfoBean data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return message;
}
public void setMsg(String msg) {
this.message = msg;
}
public UserInfoBean getList() {
return data;
}
public void setList(UserInfoBean list) {
this.data = list;
}
public static class UserInfoBean{
private String userId;
private String userName;
private String userPassword;
private String userDescription;
private String userTel;
private String userImg;
private String userSex;
private Integer userScore;
private String userMoney;
private String userSign;
private Integer userRole;
private Byte userStatus;
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getUserPassword() {
return userPassword;
}
public void setUserPassword(String userPassword) {
this.userPassword = userPassword;
}
public String getUserDescription() {
return userDescription;
}
public void setUserDescription(String userDescription) {
this.userDescription = userDescription;
}
public String getUserTel() {
return userTel;
}
public void setUserTel(String userTel) {
this.userTel = userTel;
}
public String getUserImg() {
return userImg;
}
public void setUserImg(String userImg) {
this.userImg = userImg;
}
public String getUserSex() {
return userSex;
}
public void setUserSex(String userSex) {
this.userSex = userSex;
}
public Integer getUserScore() {
return userScore;
}
public void setUserScore(Integer userScore) {
this.userScore = userScore;
}
public String getUserMoney() {
return userMoney;
}
public void setUserMoney(String userMoney) {
this.userMoney = userMoney;
}
public String getUserSign() {
return userSign;
}
public void setUserSign(String userSign) {
this.userSign = userSign;
}
public Integer getUserRole() {
return userRole;
}
public void setUserRole(Integer userRole) {
this.userRole = userRole;
}
public Byte getUserStatus() {
return userStatus;
}
public void setUserStatus(Byte userStatus) {
this.userStatus = userStatus;
}
}
}
| [
"15196622412@163.com"
] | 15196622412@163.com |
794944f1bf7ef218c617b0ea3ba1a26c0dffddaa | 736821ff66d7434ef361f1a3bdca6a5ce8f5aa76 | /src/main/java/com/autoapitest/FunctionService/mapper/item/MealMapper.java | 3db65076ef7ee7a0dfabc3f639c1ed553fbefbb1 | [] | no_license | wing112358/Sauto_Api | 849d5813b38b54d429dc4c9fdb902799464cc10f | 609f6e6075a4ddf7b485d07adc051be4d15384d3 | refs/heads/master | 2023-04-23T03:03:39.177884 | 2021-05-07T07:22:03 | 2021-05-07T07:22:03 | 365,143,904 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 519 | java | package com.autoapitest.FunctionService.mapper.item;
import com.autoapitest.FunctionService.entity.MealEntity;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 套餐表相关sql
* @author wing
*/
public interface MealMapper {
public Integer deleteFunctionByName(@Param("name")String name);
public Integer deleteMealByName(@Param("name")String name);
public List<MealEntity> getMealByName(@Param("name")String name);
public Long getIdByname(@Param("name")String name);
}
| [
"wt1994159@163.com"
] | wt1994159@163.com |
638f69895ba1f97922f2c0ea84517110eea291d2 | c5f0dcd3988edc0713c8da9b1856e034ef841c80 | /server/src/main/java/test/jetty/config/Filter.java | 9ab418df710899de4ee5237a3501a83c7d43153a | [] | no_license | treetip/jetty_test | 5d67c87137386effa273c87e45845a7cc98963e8 | d9dac471b8de43be4734c20b307e5afed0a19f19 | refs/heads/master | 2020-07-31T11:03:04.175496 | 2019-09-24T11:11:23 | 2019-09-24T11:11:23 | 210,581,842 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 810 | java | package test.jetty.config;
import java.io.IOException;
import java.io.InputStream;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import org.springframework.stereotype.Component;
// uncomment to enable
//@Component
public class Filter implements javax.servlet.Filter {
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
try {
chain.doFilter(request, response);
} finally {
try {
InputStream in = request.getInputStream();
while (in.read() >= 0);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
| [
"petteri.torkko@iki.fi"
] | petteri.torkko@iki.fi |
9351b20bdb5abae1e7d159e75b930f89051ba2bc | 6ebe9532c3a4b12e63c1569b1d49827db2987255 | /NeuralNetwork/src/com/balazsholczer/neuralnet/NeuralNetConstants.java | 6f377a1987dc4193e7ae81b15e22f1e548689510 | [] | no_license | UKVeteran/Algorithms-in-JAVA | e1f82aecb358e68f27fd9f02557288aa29f825a7 | 1c10f4ab42627bd6e8b6b8830691094a243c5506 | refs/heads/master | 2020-04-04T12:11:10.719474 | 2018-11-02T20:47:52 | 2018-11-02T20:47:52 | 155,917,139 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 266 | java | package com.balazsholczer.neuralnet;
public class NeuralNetConstants {
private NeuralNetConstants() {
}
public static final float LEARNING_RATE = 0.3f;
public static final float MOMENTUM = 0.6f;
public static final int ITERATIONS = 100000;
}
| [
"noreply@github.com"
] | noreply@github.com |
0c2934259d06d0ed47d2594fe416f9e279141df3 | fccf0ae87fe9967c96545407aaa28fdd146f691a | /src/PrimerPrograma/SalirLoop.java | 9ecdec201c9ee8058529cc25cd2a8bac6adc5a61 | [] | no_license | tomasdelvechio/VideoTutorialesJava | d161dd3fa16257e08d104b292192b94af1abbf2c | 9c99a7f7d40324c850c732f5b6434d1073162442 | refs/heads/master | 2021-01-21T05:00:37.820473 | 2014-11-02T23:34:19 | 2014-11-02T23:34:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 366 | java | package PrimerPrograma;
class SalirLoop {
public static void main(String args[]) {
int index = 0;
while (index <= 1000) {
index = index + 5;
System.out.println(index);
if (index == 400) {
break;
}
}
System.out.println("index == " + index + ". Saliendo...");
}
} | [
"tomasdelvechio17@gmail.com"
] | tomasdelvechio17@gmail.com |
a7fdc8ba9a5212a0758db2b80e841658895cb11b | 4099e7b35389e6eecd6c3e8a5a0dfe00eca58646 | /src/Runner.java | bce1a13491e801f450f4c5de67eb01fd7cffa10d | [] | no_license | biancasfirloaga10/cts_1 | 90150c794c534896f587941094c39598c7f35b5b | 299c43f8ced62fab78774ad215cdf2e300e80a5f | refs/heads/master | 2021-01-14T19:09:40.345491 | 2020-02-24T12:49:47 | 2020-02-24T12:49:47 | 242,724,872 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 46 | java |
public interface Runner {
int getSpeed();
}
| [
"bianca.sfirloaga@gmail.com"
] | bianca.sfirloaga@gmail.com |
5b48feada5b7eb9b08a9553f41d0896db5a25de1 | 63aa2851abf6a6892ff7e353040348e19ca2c712 | /app/src/main/java/com/dbychkov/words/view/StudyFlashcardsView.java | 15d2e0f5e624b041d040a65254dbbaeca9b17552 | [
"Apache-2.0"
] | permissive | hvu53/ewords | b5de955334bf6ad79afa10b8dde3f1f9e74556fd | 622adb647b4d2a3bfa10120cb88baf5cadf9f62d | refs/heads/master | 2021-01-10T10:10:58.186892 | 2016-04-27T14:55:55 | 2016-04-27T14:55:55 | 54,933,777 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,031 | java | /*
* Copyright (C) dbychkov.com.
* <p/>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.dbychkov.words.view;
import com.dbychkov.domain.Flashcard;
import java.util.List;
/**
* View, capable of rendering flashcards
*/
public interface StudyFlashcardsView extends View {
void renderFlashcards(List<Flashcard> flashcards);
void showFlashcard(int flashcardNumber);
boolean showCardBack(int flashcardNumber);
void showLessonEndedDialog();
void showAllWordsLearntDialog();
}
| [
"hoavt040789@gmail.com"
] | hoavt040789@gmail.com |
e98a2ebbad8a186af1d5a923523d69ca70b627bd | ecad77b88437de58f04f10ce3a637f5033471dd1 | /Model.java | 73bcca7a4ddd9842cac39ef5b8049e1921ef49bc | [] | no_license | hashimiy/CurrencyConverter | e24a1ef16a8b820cee7778c9a404b23a3c4f99e3 | 9991aea0ee486ebbeed7bd068a2760f8e7586da0 | refs/heads/master | 2022-07-18T18:14:35.649998 | 2020-05-13T06:16:20 | 2020-05-13T06:16:20 | 263,540,824 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 239 | java | import javax.swing.*;
public class Model {
double philippinePeso = 50.53;
double poundSterling = 0.80;
double pakistaniRupee = 159.50;
double uaeDirham = 3.67;
double euro = 0.92;
double singaporeDollar = 1.42;
}
| [
"noreply@github.com"
] | noreply@github.com |
cef45ad6021dfe679d2b1ecb368efb0a982f870c | 9e75eaafbc5ca9a5fc2c9d0219f5ccc0eea874f2 | /Spring_Framwork/Spring_Core/code_samples/sample-no-ioc/src/main/java/ioc/ReportGenerator.java | 89ed87dab9102605997948c1f8a336fc55a56ed7 | [] | no_license | nhutlbuit/Drap_Java_Web | 6bf635701cf07ef820e87e9cdc486dc98588664d | 386fd2baedae17d9efa90c9a1888c25d51b5230e | refs/heads/master | 2020-03-10T17:11:26.043056 | 2018-05-26T18:21:29 | 2018-05-26T18:22:34 | 129,493,859 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 220 | java | package ioc;
public class ReportGenerator {
private PDFWriter pdfWriter;
public ReportGenerator(PDFWriter pdfWriter){
this.pdfWriter = pdfWriter;
}
public void generateReport(){
pdfWriter.writeData();
}
}
| [
"nhutlbuit@gmail.com"
] | nhutlbuit@gmail.com |
e155d6b43ecc5ece9899e05926814873b3707e93 | ef5f5e3029e7de7f21252a6ef050f59e92883118 | /app/src/test/java/com/example/capri/aplikasiketertibanrealm/ExampleUnitTest.java | d789f7a614519959be2560a59ad4befcbf9444f7 | [] | no_license | capriandreas/DelKetertibanApp | 76f5ba324fdc9f4fa37b0a98b1becc2553d6a51a | 76a6e7b9f67571197742bc4a69198fc93dccfb15 | refs/heads/master | 2021-01-20T10:30:13.076578 | 2017-08-28T12:05:47 | 2017-08-28T12:05:47 | 101,639,066 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 419 | java | package com.example.capri.aplikasiketertibanrealm;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"capriandreas@gmail.com"
] | capriandreas@gmail.com |
5744e7fe7a6b4e9f506c045447e27fb81ed30069 | 38a8bc090787dffaafbb636fe1d096ba9e63c950 | /src/main/java/com/shinowit/entity/Stuinfo.java | b1018526d66a5f08b73fd8b4cce93d0707cda168 | [] | no_license | javaLDY/sshbits | ce06922193369d8d7e1718dc347d2f28820df700 | 9ab9beb18e2ac27e903d969ee83af761e26ff2ff | refs/heads/master | 2020-03-31T12:13:14.768688 | 2014-12-24T02:35:34 | 2014-12-24T02:35:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,612 | java | package com.shinowit.entity;
import java.io.Serializable;
public class Stuinfo implements Serializable {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column stuinfo.stuid
*
* @mbggenerated Tue Dec 23 15:49:13 CST 2014
*/
private Integer stuid;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column stuinfo.stucode
*
* @mbggenerated Tue Dec 23 15:49:13 CST 2014
*/
private String stucode;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column stuinfo.stuname
*
* @mbggenerated Tue Dec 23 15:49:13 CST 2014
*/
private String stuname;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column stuinfo.sexcode
*
* @mbggenerated Tue Dec 23 15:49:13 CST 2014
*/
private String sexcode;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table stuinfo
*
* @mbggenerated Tue Dec 23 15:49:13 CST 2014
*/
private static final long serialVersionUID = 1L;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column stuinfo.stuid
*
* @return the value of stuinfo.stuid
*
* @mbggenerated Tue Dec 23 15:49:13 CST 2014
*/
public Integer getStuid() {
return stuid;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column stuinfo.stuid
*
* @param stuid the value for stuinfo.stuid
*
* @mbggenerated Tue Dec 23 15:49:13 CST 2014
*/
public void setStuid(Integer stuid) {
this.stuid = stuid;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column stuinfo.stucode
*
* @return the value of stuinfo.stucode
*
* @mbggenerated Tue Dec 23 15:49:13 CST 2014
*/
public String getStucode() {
return stucode;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column stuinfo.stucode
*
* @param stucode the value for stuinfo.stucode
*
* @mbggenerated Tue Dec 23 15:49:13 CST 2014
*/
public void setStucode(String stucode) {
this.stucode = stucode == null ? null : stucode.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column stuinfo.stuname
*
* @return the value of stuinfo.stuname
*
* @mbggenerated Tue Dec 23 15:49:13 CST 2014
*/
public String getStuname() {
return stuname;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column stuinfo.stuname
*
* @param stuname the value for stuinfo.stuname
*
* @mbggenerated Tue Dec 23 15:49:13 CST 2014
*/
public void setStuname(String stuname) {
this.stuname = stuname == null ? null : stuname.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column stuinfo.sexcode
*
* @return the value of stuinfo.sexcode
*
* @mbggenerated Tue Dec 23 15:49:13 CST 2014
*/
public String getSexcode() {
return sexcode;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column stuinfo.sexcode
*
* @param sexcode the value for stuinfo.sexcode
*
* @mbggenerated Tue Dec 23 15:49:13 CST 2014
*/
public void setSexcode(String sexcode) {
this.sexcode = sexcode == null ? null : sexcode.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table stuinfo
*
* @mbggenerated Tue Dec 23 15:49:13 CST 2014
*/
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
Stuinfo other = (Stuinfo) that;
return (this.getStuid() == null ? other.getStuid() == null : this.getStuid().equals(other.getStuid()))
&& (this.getStucode() == null ? other.getStucode() == null : this.getStucode().equals(other.getStucode()))
&& (this.getStuname() == null ? other.getStuname() == null : this.getStuname().equals(other.getStuname()))
&& (this.getSexcode() == null ? other.getSexcode() == null : this.getSexcode().equals(other.getSexcode()));
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table stuinfo
*
* @mbggenerated Tue Dec 23 15:49:13 CST 2014
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getStuid() == null) ? 0 : getStuid().hashCode());
result = prime * result + ((getStucode() == null) ? 0 : getStucode().hashCode());
result = prime * result + ((getStuname() == null) ? 0 : getStuname().hashCode());
result = prime * result + ((getSexcode() == null) ? 0 : getSexcode().hashCode());
return result;
}
} | [
"1039236687@qq.com"
] | 1039236687@qq.com |
9d495954e7bb0eb6851c4daa1323c5b1777bdfb9 | 90f7ecd23ec3304f037b929382e81da5526d21cb | /src/main/java/com/announce/ecommerce/dao/ProductRepository.java | 90991ddd454969818757971caa75e73646a1c7f4 | [] | no_license | james-dot/spring-boot-ecommerce | 00af2a494f651ee968ac4c7f21feae8767d6cc8b | 77f927b78a17c88bf925bc4ce85ce79ead783330 | refs/heads/master | 2022-10-20T19:17:11.653682 | 2020-06-13T23:40:43 | 2020-06-13T23:40:43 | 272,059,036 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 422 | java | package com.announce.ecommerce.dao;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.web.bind.annotation.CrossOrigin;
import com.announce.ecommerce.entity.Product;
@CrossOrigin("http://localhost:4200")
@RepositoryRestResource
public interface ProductRepository extends JpaRepository<Product, Long>{
}
| [
"imad.live1990@gmail.com"
] | imad.live1990@gmail.com |
73a6d675aa1bc27c3bbf4a2e7605651d52bb2234 | 5157aea9b36f22c9c6212c62e02d956098438f7d | /src/main/java/com/example/testreactspring/controller/TodoController.java | 9c39117222accd011d2e95d42c0ec033ccc35fc9 | [] | no_license | sreebasavamanju/hybrid-react-spring | 2f9cec5b6d49976339fa68c9ed9d1842eb5f1398 | 521137ef807c648b58cdee9f1155b18c8df197ca | refs/heads/master | 2020-04-01T20:22:20.503647 | 2018-10-18T09:43:29 | 2018-10-18T09:43:29 | 153,600,918 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,583 | java | package com.example.testreactspring.controller;
import java.util.List;
import java.util.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
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.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import com.example.testreactspring.exception.advice.TodoNotFoundException;
import com.example.testreactspring.model.Todo;
import com.example.testreactspring.service.TodoService;
@RestController
@RequestMapping(value = "/todos",produces={MediaType.APPLICATION_JSON_VALUE})
public class TodoController {
@Autowired
TodoService todoservice;
@RequestMapping(value="/{id}",method=RequestMethod.GET)
public Todo getSingle(@PathVariable UUID id){
return todoservice.getSingle(id).orElseThrow(() -> new TodoNotFoundException(id));
}
@RequestMapping(method = RequestMethod.GET)
public List<Todo> listAll() {
return todoservice.getAll();
}
@RequestMapping(method = RequestMethod.POST)
public Todo save(@RequestBody Todo todo) {
return todoservice.insert(todo);
}
@RequestMapping(value="/{id}",method=RequestMethod.DELETE)
@ResponseStatus(code=HttpStatus.NO_CONTENT)
public void delete(@PathVariable UUID id){
todoservice.delete(id);
}
}
| [
"manjusree1062@gmail.com"
] | manjusree1062@gmail.com |
22c5d284b7f9febe50afe012870d4d7dd4c3c481 | 2cf76ce40e3036e43bb0b6186f6b2f903cbd270b | /SeleniumTraining/src/test/java/ui/DemoAutomation.java | 065657d5e5146583ea1047837cdc98e29dbe0f53 | [] | no_license | bapita/SeleniumTestProject | 5450dd0790a294cc3fc7677fe690a11ec367a0ac | eb2d0d9b322a352b287f6f62195e1ada0e0b6c1e | refs/heads/master | 2023-03-05T21:50:59.423622 | 2021-02-18T07:08:55 | 2021-02-18T07:08:55 | 339,962,839 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 690 | java | package ui;
import org.openqa.selenium.By;
import org.openqa.selenium.chrome.ChromeDriver;
import io.github.bonigarcia.wdm.WebDriverManager;
public class DemoAutomation {
public static void main(String[] args) {
// TODO Auto-generated method stub
//System.setProperty("webdriver.chrome.driver", "C:\\browserdrivers\\chromedriver.exe");
WebDriverManager.chromedriver().setup();
ChromeDriver driver = new ChromeDriver();
driver.get("http://www.ebay.com");
driver.manage().window().maximize();
driver.findElement(By.xpath("//*[@id=\"gh-ac\"]")).sendKeys("mobile");
driver.findElement(By.xpath("//*[@id=\"gh-btn\"]")).click();
driver.close();
}
}
| [
"bapitaroy14@gmail.com"
] | bapitaroy14@gmail.com |
ec8df33ff9e4b351ad199528772946a95528258e | 34627b7a982fa522ddf8d3764da6d69ba5c06c44 | /Chapter1/Question1.java | d7dee14ab51293e0519f85d73b89928bdc0da792 | [] | no_license | mikehanwu/Cracking | f04f693ca2a5ccd8863fd587faa10cd8d99fb28c | 6f9a0ef63679dd328411187de9fee3cb963bd3d4 | refs/heads/master | 2021-01-10T06:39:45.455273 | 2015-11-20T07:33:48 | 2015-11-20T07:33:48 | 46,160,962 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 949 | java | package ctci;
//Implement an algorithm to determine if a string has all unique characters.
//What if you can not use additional data structures?
public class Question1 {
public static void main(String[] args){
String s1 = null;
String s2 = "";
String s3 = " ";
String s4 = "a";
String s5 = "aaa";
String s6 = "aaabbb";
String s7 = "asdfasdf";
String s8 = "asdfghjkl";
pt(unique(s1));
pt(unique(s2));
pt(unique(s3));
pt(unique(s4));
pt(unique(s5));
pt(unique(s6));
pt(unique(s7));
pt(unique(s8));
}
public static boolean unique(String str){
if(str==null){
return false;
}
else if(str.length()<=1){
return true;
}
else{
boolean[] bools = new boolean[128];
for(int i = 0; i<str.length(); i++){
if(bools[str.charAt(i)]==false)
bools[str.charAt(i)]=true;
else
return false;
}
return true;
}
}
private static void pt(Object obj){
System.out.println(obj);
}
}
| [
"mkwuuu@gmail.com"
] | mkwuuu@gmail.com |
87acd700fcb2039f30da004b28d903adb64fd57b | 65981f65e5d1dd676e4b5f48f3b81e1f55ed39ce | /konig-core/src/main/java/io/konig/core/pojo/PojoListener.java | e437110a1a213d7ed73fc23bd707a719cfa03808 | [] | no_license | konigio/konig | dd49aa70aa63e6bdeb1161f26cf9fba8020e1bfb | 2c093aa94be40ee6a0fa533020f4ef14cecc6f1d | refs/heads/master | 2023-08-11T12:12:53.634492 | 2019-12-02T17:05:03 | 2019-12-02T17:05:03 | 48,807,429 | 4 | 3 | null | 2022-12-14T20:21:51 | 2015-12-30T15:42:21 | Java | UTF-8 | Java | false | false | 1,101 | java | package io.konig.core.pojo;
/*
* #%L
* Konig Core
* %%
* Copyright (C) 2015 - 2016 Gregory McFall
* %%
* 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.
* #L%
*/
import org.openrdf.model.Resource;
/**
* A listener that reacts to the mapping of an RDF resource to a Java POJO.
* @author Greg McFall
*
*/
public interface PojoListener {
/**
* React to the mapping of an RDF resource to a Java POJO
* @param id The identifier for the RDF resource
* @param pojo The POJO that was created for the RDF Resource.
*/
void map(Resource id, Object pojo);
}
| [
"gregory.mcfall@gmail.com"
] | gregory.mcfall@gmail.com |
3bfcad568bf6aab7216cef9d2f1633b9fe3ca6cb | 3419069da6ede1137e55a03613a1bbc2a87fe9b2 | /exchangeserver/src/main/java/com/yuyutechnology/exchange/server/controller/response/GetVerificationCodeResponse.java | e885d4c011dce0a8368349983ad6d95cbee4d872 | [] | no_license | moonshanzhaoqin/Login | 260afc7ded531a7d991547c2d92b8c1612eb291c | c1babbd45e7574269fbd71a9814c1376474b4a48 | refs/heads/master | 2021-05-13T16:36:03.216109 | 2017-11-15T01:40:49 | 2017-11-15T01:40:49 | 116,790,095 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 132 | java | package com.yuyutechnology.exchange.server.controller.response;
public class GetVerificationCodeResponse extends BaseResponse {
}
| [
"silent.sun@aspectgaming.com"
] | silent.sun@aspectgaming.com |
20c3bbb60f72c2044b6ee63a96dcd7824499b086 | 319f90bb54ba4271259de68f84139980e1543e56 | /component/src/main/java/io/siddhi/extension/map/protobuf/utils/ProtobufConstants.java | abf263c9ae698af0f258ac436991f6d778dbe995 | [
"Apache-2.0"
] | permissive | BuddhiWathsala/siddhi-map-protobuf | 2db70935152435e3f788bd0ea7975e6d4dd63128 | d596c2027305e253171a69e50390057654f32541 | refs/heads/master | 2020-11-24T23:21:22.812572 | 2019-12-05T14:48:01 | 2019-12-05T14:48:01 | 228,384,136 | 1 | 0 | Apache-2.0 | 2019-12-16T12:37:23 | 2019-12-16T12:37:22 | null | UTF-8 | Java | false | false | 2,622 | java | /*
* Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. 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 io.siddhi.extension.map.protobuf.utils;
/**
* Class to hold the constants used by protobuf source and sink mapper.
*/
public class ProtobufConstants {
public static final String PUBLISHER_URL = "publisher.url";
public static final String RECEIVER_URL = "receiver.url";
public static final String PORT_SERVICE_SEPARATOR = "/";
public static final String EMPTY_STRING = "";
public static final String GRPC_PROTOCOL_NAME = "grpc";
public static final String DUMMY_PROTOCOL_NAME = "http";
public static final String GRPC_SERVICE_RESPONSE_SINK_NAME = "grpc-service-response";
public static final String GRPC_CALL_RESPONSE_SOURCE_NAME = "grpc-call-response";
public static final String GRPC_SERVICE_SOURCE_NAME = "grpc-service-source";
public static final String CLASS_OPTION_HOLDER = "class";
public static final String STUB_NAME = "Stub";
public static final String GRPC_PROTOCOL_NAME_UPPERCAMELCASE = "Grpc";
public static final String DOLLAR_SIGN = "$";
public static final String NEW_BUILDER_NAME = "newBuilder";
public static final String PARSE_FROM_NAME = "parseFrom";
public static final String TO_BYTE_ARRAY = "toByteArray";
public static final String SETTER = "set";
public static final String GETTER = "get";
public static final String MAP_NAME = "Map";
public static final String LIST_NAME = "List";
public static final String BUILD_METHOD = "build";
public static final String PUTALL_METHOD = "putAll";
public static final String ADDALL_METHOD = "addAll";
public static final String METHOD_NAME = "Method";
public static final String UNDERSCORE = "_";
public static final int PATH_SERVICE_NAME_POSITION = 0;
public static final int PATH_METHOD_NAME_POSITION = 1;
public static final int REQUEST_CLASS_POSITION = 0;
public static final int RESPONSE_CLASS_POSITION = 1;
private ProtobufConstants() {
}
}
| [
"sahandilshansg@gmail.com"
] | sahandilshansg@gmail.com |
80428a46794e68be172d7d8e716c7abdc1671ba2 | 52e0a6210626cc6be3f746e21c93f233aea6b08d | /Java Lab Exam/problem7.java | 4a5ccdd34e620db450a3ce3c8c10aa62b77b02cc | [] | no_license | Nochiketa/Other-Codes | 62a2e98a500e526ff726c11688fb7fc9deb77b41 | 3ba7aedf053232a0cf9627de23aadf96aa7608a1 | refs/heads/master | 2020-05-20T12:25:33.696499 | 2017-09-14T16:53:12 | 2017-09-14T16:53:12 | 80,447,143 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,203 | java | /*(Find the Largest Number) The process of finding the largest value is used frequently in computer applications. For example, a program that determines the winner of a sales contest would input the number of units sold by each salesperson. The salesperson who sells the most units wins the contest.
Write a program that inputs a series of 10 integers and determines and prints the largest integer. Your program should use at least the following three variables:
a) counter: A counter to count to 10 (i.e., to keep track of how many numbers have been input and to determine when all 10 numbers have been processed).
b) number: The integer most recently input by the user.
c) largest: The largest number found so far.
*/
import java.util.Scanner;
public class problem7 {
public static void main(String m[])
{
Scanner scan = new Scanner(System.in);
int counter,number,largest=0;
System.out.println("Enter 10 numbers ");
for(counter = 1;counter<=10;counter++)
{
number = scan.nextInt();
if(number>largest)
{
largest = number;
}
}
System.out.println("The largest number is "+largest);
}
}
/*
Enter 10 numbers
66 44 33 22 32 74 10 89 36 64
The largest number is 89
*/
| [
"noreply@github.com"
] | noreply@github.com |
0cbf6e4ee2422df7e6b125ab89c9c096f6639d47 | 44c1e207f4e4a52f455024e8cac18e147cdc383d | /app/src/main/java/com/example/doneweidudianying/mvp/IModelImpl.java | e5a6046a6a94408508421f27cfcad9bd0447b457 | [] | no_license | moxuanxiao430581/DoneWeiDuDianYing | 0c5fe104abfbbc79178de70b519df0325bed2d23 | 0c8bf65a6dc69155090237b1b3c7e1c3dc2ab8a8 | refs/heads/master | 2022-05-23T22:32:10.839119 | 2020-04-29T05:42:55 | 2020-04-29T05:42:55 | 258,559,260 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,095 | java | package com.example.doneweidudianying.mvp;
import com.example.doneweidudianying.contract.IContract;
import com.example.doneweidudianying.net.NetUtlis;
import java.util.Map;
public class IModelImpl implements IContract.IModel {
//邮箱
@Override
public void ModelPostEmailInfo(String url, String email, Class cls, final IContract.ICallBack callBack) {
NetUtlis.getInstance().PostEmailInfo(url, email, cls, new NetUtlis.NetCallBack() {
@Override
public void onSuccess(Object o) {
callBack.onSuccess(o);
}
@Override
public void onError(String error) {
}
});
}
//注册
@Override
public void ModelPostRegisterInfo(String url, Map<String, Object> map, Class cls, final IContract.ICallBack callBack) {
NetUtlis.getInstance().PostRegisterInfo(url, map, cls, new NetUtlis.NetCallBack() {
@Override
public void onSuccess(Object o) {
callBack.onSuccess(o);
}
@Override
public void onError(String error) {
}
});
}
//登录
@Override
public void ModelPostLoginInfo(String url, Map<String, Object> map, Class cls, final IContract.ICallBack callBack) {
NetUtlis.getInstance().PostLoginInfo(url, map, cls, new NetUtlis.NetCallBack() {
@Override
public void onSuccess(Object o) {
callBack.onSuccess(o);
}
@Override
public void onError(String error) {
}
});
}
//根据用户ID查询用户信息
@Override
public void ModelGetQueryuserInfo(String url, Class cls, IContract.ICallBack callBack) {
NetUtlis.getInstance().GetQueryuserInfo(url, cls, new NetUtlis.NetCallBack() {
@Override
public void onSuccess(Object o) {
callBack.onSuccess(o);
}
@Override
public void onError(String error) {
}
});
}
//查询banner
@Override
public void ModelGetXBannerInfo(String url, Class cls, IContract.ICallBack callBack) {
NetUtlis.getInstance().GetXBannerInfo(url, cls, new NetUtlis.NetCallBack() {
@Override
public void onSuccess(Object o) {
callBack.onSuccess(o);
}
@Override
public void onError(String error) {
}
});
}
//查询正在上映电影列表
@Override
public void ModelGettReceivedInfo(String url, Map<String, Object> map, Class cls, IContract.ICallBack callBack) {
NetUtlis.getInstance().GetReceivedInfo(url, map, cls, new NetUtlis.NetCallBack() {
@Override
public void onSuccess(Object o) {
callBack.onSuccess(o);
}
@Override
public void onError(String error) {
}
});
}
}
| [
"your email"
] | your email |
6e63a12ce54e27b382530bcaf20c8c11b113a2eb | 9e12c83e7d63e58a63b8ce94880531d7c3210ea8 | /src/main/java/com/redhat/rhoar/customer/startup/MainVerticle.java | 7d2bc68920ac0fef3bfdb19dd986c66bfddd85a9 | [] | no_license | AndyYuen/vertx-guice-proxy-example | 0505d88da1ef15b7da7942b16c6e5dcdd926e45f | 7636b17f16ead28704e2aea5d046a8206aee3c61 | refs/heads/master | 2023-07-05T22:43:21.977673 | 2021-08-06T03:18:30 | 2021-08-06T03:18:30 | 117,476,767 | 1 | 1 | null | 2021-08-06T03:18:31 | 2018-01-14T23:48:37 | Java | UTF-8 | Java | false | false | 2,831 | java | package com.redhat.rhoar.customer.startup;
import com.redhat.rhoar.customer.server.RestVerticle;
import com.redhat.rhoar.customer.service.CustomerVerticle;
import io.vertx.config.ConfigRetriever;
import io.vertx.config.ConfigRetrieverOptions;
import io.vertx.config.ConfigStoreOptions;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.Future;
import io.vertx.core.json.JsonObject;
public class MainVerticle extends AbstractVerticle {
@Override
public void start(Future<Void> startFuture) throws Exception {
//----
//
// * Create a ConfigStoreOptions instance.
// * Set the type to "configmap" and the format to "yaml".
// * Configure the ConfigStoreOptions instance with the name and the key of the configmap
// * Create a ConfigRetrieverOptions instance
// * Add the ConfigStoreOptions instance as store to the ConfigRetrieverOptions instance
// * Create a ConfigRetriever instance with the ConfigRetrieverOptions instance
// * Use the ConfigRetriever instance to retrieve the configuration
// * If the retrieval was successful, call the deployVerticles method, otherwise fail the startFuture object.
//
//----
ConfigStoreOptions configStore = new ConfigStoreOptions()
.setType("configmap")
.setFormat("yaml")
.setConfig(new JsonObject()
.put("name", "app-config")
.put("key", "app-config.yaml"));
ConfigRetrieverOptions options = new ConfigRetrieverOptions();
if (System.getenv("KUBERNETES_NAMESPACE") != null) {
//we're running in Kubernetes
options.addStore(configStore);
ConfigRetriever.create(vertx, options)
.getConfig(ar -> {
if (ar.succeeded()) {
System.out.println("Successfully retrieved the configuration.");
AppConfig.getInstance(vertx).setConfig(ar.result());
deploy(ar.result(), startFuture);
} else {
System.out.println("Failed to retrieve the configuration: " + ar.cause());
}
});
}
else {
System.out.println("Failed: Not running on Openshift.");
startFuture.fail("Not running on Openshift.");
}
}
private void deploy(JsonObject config, Future<Void> startFuture) {
GuiceDeploymentHelper deployer = new GuiceDeploymentHelper(vertx, config, Binder.class);
deployer.deployVerticles(RestVerticle.class);
deployer.deployVerticles(CustomerVerticle.class);
deployer.coordinateFutures(startFuture);
}
@Override
public void stop(Future<Void> stopFuture) throws Exception {
super.stop(stopFuture);
}
}
| [
"ayuen@redhat.com"
] | ayuen@redhat.com |
2912f42c247d9a63db583ffcec2b1365e0d37ec8 | 6adbda9f6faa1dc86e766d1b82fe3f9c77ad6c75 | /igloo/igloo-components/igloo-component-jpa/src/main/java/org/iglooproject/jpa/config/spring/provider/IDatabaseConnectionJndiConfigurationProvider.java | ddb2d2cc9ca74e4d465afc6241067bf6e4d7a8f1 | [
"Apache-2.0"
] | permissive | igloo-project/igloo-parent | 61219a09d14b8968838362d76ff77dfdd0cf5e01 | 65e3e8da61e7c07584596b2ad4dc2af3b627a0f0 | refs/heads/dev | 2023-08-17T23:32:47.163929 | 2023-08-10T13:54:18 | 2023-08-10T14:04:50 | 101,907,993 | 20 | 6 | Apache-2.0 | 2023-08-10T14:00:32 | 2017-08-30T17:09:22 | Java | UTF-8 | Java | false | false | 264 | java | package org.iglooproject.jpa.config.spring.provider;
import java.sql.Driver;
public interface IDatabaseConnectionJndiConfigurationProvider extends IDatabaseConnectionConfigurationProvider {
String getJndiName();
@Override
Class<Driver> getDriverClass();
}
| [
"laurent.almeras@kobalt-si.fr"
] | laurent.almeras@kobalt-si.fr |
81991bfd0c80c29ceda05b1bfaf5827c6c142f15 | 7c18f3e798af170b254bd1bd8427efc35fb06cc2 | /src/de/tu_dresden/crowd_db/remote/crowd_flower/config/ApiConfig.java | c8dac3ec172289882aafd14519317aff0aecdb90 | [] | no_license | 0xF013/CrowdFlowerJavaAPI | d2f64eac55fc7713f97067915b31d4624fa459da | 18f66f9489bf1c00db5e937af9dd7baf84b0c0c1 | refs/heads/master | 2021-01-23T13:35:37.499707 | 2013-06-16T09:35:55 | 2013-06-16T09:35:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 343 | java | package de.tu_dresden.crowd_db.remote.crowd_flower.config;
import java.util.List;
import de.tu_dresden.crowd_db.remote.crowd_flower.JobType;
public interface ApiConfig {
String getSecretKey();
int getPaymentCents(JobType type);
int getJobId(JobType type);
int getUnitsCount(JobType type);
List<String> getChannels(JobType type);
}
| [
"0xf013+gh@gmail.com"
] | 0xf013+gh@gmail.com |
c30409db42654c742baa818ac4b51b231f60013c | 832027aacedc4ff576b5c9034856289fdb9f843d | /app/src/main/java/com/example/suraj/petuniverse/Nutrition.java | e18eef33a6dd8ad3562171573ac7dae2630d5bae | [] | no_license | dchinnam/Pet-World-Android-app | be9d630a6b465bb9da3883928d269fcf666c0e15 | 04a956ce4488a00c9f56e8cced35638e4d68f3fb | refs/heads/master | 2021-01-22T02:17:40.024966 | 2017-02-06T03:03:52 | 2017-02-06T03:03:52 | 81,042,346 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,116 | java | package com.example.suraj.petuniverse;
import android.app.Activity;
import android.content.Intent;
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.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;
import com.firebase.client.Firebase;
public class Nutrition extends AppCompatActivity {
WebView mWebview;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_nutrition);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
WebView webView = (WebView) findViewById(R.id.webView2);
webView.getSettings().setJavaScriptEnabled(true);
Bundle bundle = getIntent().getExtras();
String breed = bundle.getString(Constants.BREED);
String animal = bundle.getString(Constants.ANIMAL);
String selectedAnimal="";
if(animal.equals(Constants.DOG)){
webView.loadUrl("https://www.cesarsway.com/dog-care/nutrition/dog-nutrition-a-to-z");
}
else if(animal.equals(Constants.CAT)){
webView.loadUrl("http://www.catinfo.org/");
}
else if(animal.equals(Constants.BIRD)){
webView.loadUrl("http://www.peteducation.com/article.cfm?c=15+1835&aid=2844");
}
else if(animal.equals(Constants.FISH)){
webView.loadUrl("http://www.americanaquariumproducts.com/Quality_Fish_Food.html");
}
// webView.loadUrl("http://www.google.com");
// 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();
// }
// });
}
public void home(View view){
startActivity(new Intent(this,MainActivity.class));
}
public void share(View view){
Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Try Pet World for Android!");
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, "I'm using Pet World for Android and I recommend it. Download the app from Playstore");
Intent chooserIntent = Intent.createChooser(shareIntent, "Share with");
chooserIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(chooserIntent);
}
public void logout(View view){
Firebase ref = new Firebase(Constants.FIREBASE_LINK);
Firebase.setAndroidContext(this);
ref.unauth();
startActivity(new Intent(getApplicationContext(), Splash.class));
}
}
| [
"deepank.chinnam@gmail.com"
] | deepank.chinnam@gmail.com |
d76d20034fdc0b56effcebc1c1386bf84f30f38e | 35f55aad13c696fad7ec37935004f03da55abc73 | /src/main/java/filter/ValidateLoginFilter.java | 9dd6c2066dd0234d7d346c0647f6d3ffec1572ef | [] | no_license | Etherealss/WanderFour | 371cd27574da7a51d2c28f7c0e475202dc22fc55 | bd62b3eb71cf4781e09854f48928904e3a8aa531 | refs/heads/master | 2023-06-25T17:54:13.785568 | 2021-05-06T11:27:04 | 2021-05-06T11:27:04 | 297,966,153 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,176 | java | package filter;
import common.util.WebUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
/**
* @author 寒洲
* @description 检查登录状态
* @date 2020/10/2
*/
@WebFilter(urlPatterns = {"/*"})
public class ValidateLoginFilter implements Filter {
private Logger logger = LoggerFactory.getLogger("simpleAsyncLogger");
/**
* 需要拦截并判断登录状态的路径
*/
private static final Set<String> CHECK_PATHS = Collections.unmodifiableSet(
new HashSet<>(Arrays.asList(
"/editArticle.html", "/editPosts.html", "/user.html", "/chatRoom.html"
)));
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException, IOException {
HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse resp = (HttpServletResponse) response;
resp.setHeader("Access-Control-Allow-Origin", "*");
resp.addHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE");
resp.addHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
//获取资源请求路径
String uri = req.getRequestURI();
//判断是否是登录相关的资源
if (CHECK_PATHS.contains(uri)) {
Long userId = WebUtil.getUserId(req);
if (userId == null) {
//未登录,跳转到登录页面
logger.trace("检查用户的登录状态 未登录,拦截");
resp.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
resp.sendRedirect("401.html");
} else {
//已登录,放行
chain.doFilter(req, resp);
logger.trace("检查用户的登录状态 已登录,放行:userId = " + userId);
}
} else {
//不是需要登录后才能才看的页面,直接放行
chain.doFilter(req, resp);
}
}
@Override
public void init(FilterConfig config) throws ServletException {
}
@Override
public void destroy() {
}
}
| [
"1831669777@qq.com"
] | 1831669777@qq.com |
61c464ccd7eebe826905cef22b8837ef1dd8e14e | 66f0aa4d440eeca656a27a3ec521e52b02a04a6c | /test/AjoutLocation.java | 387e5e13e7d68ec0e16716baa1c9295585846873 | [] | no_license | bigdomm/Tp-Analyse | 9a7ca3b338fdfec6f32404b7d3b1b324cf7b41f8 | 1ed7507a035daccef9fca8c2840a97a5f36f01ba | refs/heads/master | 2020-06-18T07:40:36.580906 | 2016-12-15T04:21:08 | 2016-12-15T04:21:08 | 75,151,492 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 6,249 | java | import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Cas #2 Gestion des locations - Créér une location
*
* Classe qui simule l'interface de location. Elle communique avec le controleur
* Auteur: Vincent Gélinas Date de création: 2016-04-11
*
*/
public class AjoutLocation {
public static void gestionLocation() {
int choix = 0;
do {
// Saisie de l'action de l'usager
choix = menuLocation();
switch (choix) {
// Menu 1 - On se rend au cas Gestion location
case 1:
creerLocation();
break;
case 2:
listerLocation();
break;
case 3:
Main.gestionMain();
break;
}
} while (choix != 3);
}
// Menu de la gestion des location
private static int menuLocation() {
System.out.println("----- Gestion location -----\n");
System.out.println("1 - Démarrer une location");
System.out.println("2 - Lister les locations en cours");
System.out.println("3 - Retour au menu principal");
System.out.print("\nInscrivez le chiffre a la gauche de l'action désiré : ");
// Scan d'un entier entre 1 et 5
return ScanEntrer.scannerEntier(1, 4, "Désolé, choix invalide!");
}
// Lancement d'une location
private static void creerLocation() {
String idClient = "";
idClient = saisirPermis();
// On effectue le scénario #1 du cas Gestion de location
// Dans le graphique on passe normalement le numero de permis ici mais
// dans le cas du programme console on fait la validation du permis
// directement ici pour facilité la fluidité du programme. On passe
// alors l'id du client au controleur
if (!GestionnaireLocation.demarrerLocation(idClient)) {
// Saisie de la date de fin de location
String dateFin = "";
dateFin = saisirDateFin();
String codeVehicule = "";
codeVehicule = saisirInfoVehicule();
// On effectue le scénario #2 du cas Gestion de location
if (!GestionnaireLocation.saisirInfoLocation(dateFin, codeVehicule)) {
// Saisie du mode de paiement
System.out.print("Saisissez le mode de paiement : ");
String modePaiement = ScanEntrer.regString();
// On effectue le scénario #3 et #4 du cas Gestion de location
GestionnaireLocation.creerPaiement(modePaiement);
// Le scénario #5 du cas Gestion de location consiste a
// enregistré la location dans une base de donnée ce qui n'est
// pas geré dans cette application console.
}
}
}
// Validation que le code de véhicule est bien entré. Normalement cela se
// ferait pas ici avec un interface
// mais dans un soucis de fluidité du programme console je valide
// l'information lors de la saisie
private static String inputCodeVehicule() {
System.out.println("----- Liste des véhicules ----- ");
GestionnaireLocation.listerVehicules(Vehicules.getListVehicule());
System.out.print("Saisissez le code du véhicule à louer : ");
String codeVehicule = ScanEntrer.regString();
if (!Vehicules.findVehicule(codeVehicule)) {
System.out.println("Aucun véhicule avec ce code a été trouvé");
System.out.println(Main.espaceEntreMenus);
return "";
} // Cette validation ne se ferait pas ici normalement mais les besoins
// du programme console m'oblige a le faire ici pour avoir une
// experience utilisateur fluide
else if (!Vehicules.verifDispo(codeVehicule)) {
System.out.println("Le véhicule n'est pas disponible");
System.out.println(Main.espaceEntreMenus);
return "";
} else {
return codeVehicule;
}
}
// Validation que la date de fin de location est bien entré. Normalement
// cela se
// ferait pas ici avec un interface
// mais dans un soucis de fluidité du programme console je valide
// l'information lors de la saisie
private static String inputDateFin() {
System.out.print("Saisissez la date de fin de location (YYYY-MM-DD) : ");
String dateFin = ScanEntrer.regString();
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date date = null;
Date today = new Date();
try {
date = dateFormat.parse(dateFin);
} catch (ParseException e) {
System.out.println("La date saisie n'est pas valide");
System.out.println(Main.espaceEntreMenus);
return "";
}
if (!dateFin.equals(dateFormat.format(date))) {
System.out.println("La date saisie n'est pas valide");
System.out.println(Main.espaceEntreMenus);
return "";
} else if (date.before(today)) {
System.out.println("La date de fin de location doit être dans le futur");
System.out.println(Main.espaceEntreMenus);
return "";
} else {
return dateFormat.format(date);
}
}
// Validation que le permis entré existe dans la liste
// Normalement on ferait ca pas ici avec un interface
// mais dans un soucis de fluidité du programme console je valide
// l'information lors de la saisie
private static String inputPermis() {
// Saisie du permis du client
System.out.print("Saisissez le permis du client : ");
String permis = ScanEntrer.regString();
String idClient = "";
if (Clients.findClient(permis)) {
idClient = Clients.getIdClient(permis);
return idClient;
} else {
System.out.println("Aucun client avec ce numéro de permis a été trouvé");
System.out.println(Main.espaceEntreMenus);
return "";
}
}
private static String saisirInfoVehicule() {
// Saisie et validation du code du véhicule
//Modification : Dominic Lafrance
//2016-04-18
String codeVehicule = "";
do {
codeVehicule = inputCodeVehicule();
} while (codeVehicule == "");
//Mofication
return codeVehicule.toUpperCase();
}
private static String saisirDateFin() {
// Saisie et validation de la date de fin
String dateFin = "";
do {
dateFin = inputDateFin();
} while (dateFin == "");
return dateFin;
}
private static String saisirPermis() {
// Saisie et validation du permis
String permis = "";
do {
permis = inputPermis();
} while (permis == "");
return permis;
}
// Liste des locations en cours
private static void listerLocation() {
System.out.println(Main.espaceEntreMenus);
System.out.println("----- Liste des locations ----- ");
GestionnaireLocation.listerLocations(Locations.getListeLocation());
}
}
| [
"Dominic.Lafrance@uqtr.ca"
] | Dominic.Lafrance@uqtr.ca |
b2f2e49c1c1681e549274c35f5ec6fbf84adbd32 | 320e9412b317b4f3017fa4fff805dff8bec05b7a | /Backend_IoT/admin-service/src/main/java/com/uis/iot/admin/entity/Device.java | 898ad280d582b56c9b725857747345098f29185c | [] | no_license | SC3UIS/smart-campus | 0b5ea9938d4c7fa96a39ffbef5ff03fa3e957ced | ae6a17571299c1415523bb419182cecb01dc2aea | refs/heads/master | 2022-11-20T08:11:56.967591 | 2020-07-24T15:22:52 | 2020-07-24T15:22:52 | 282,235,778 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,565 | java | package com.uis.iot.admin.entity;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import org.springframework.util.CollectionUtils;
import com.uis.iot.common.gateway.model.EThingType;
import com.uis.iot.common.gateway.model.PropertyDTO;
import com.uis.iot.common.gateway.model.RegistryDTO;
import com.uis.iot.common.model.DeviceDTO;
import com.uis.iot.common.model.DevicePropertyDTO;
/**
* The persistent class for the device database table.
*
*/
@Entity
@NamedQuery(name = "Device.findAll", query = "SELECT d FROM Device d")
public class Device implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id_device")
private Long id;
@Column(nullable = false)
private String name;
@Column(nullable = false)
private String description;
@Enumerated(EnumType.STRING)
@Column(name = "device_type", nullable = false)
private EThingType deviceType;
// bi-directional many-to-one association to Gateway
@ManyToOne
@JoinColumn(name = "id_gateway")
private Gateway gateway;
// bi-directional many-to-one association to DeviceProperty
@OneToMany(mappedBy = "device", fetch = FetchType.LAZY, cascade = CascadeType.ALL, targetEntity = DeviceProperty.class, orphanRemoval = true)
private List<DeviceProperty> deviceProperties;
public Device() {
super();
}
public Device(final Long id, final String name, final EThingType deviceType, final Gateway gateway,
final String description) {
super();
this.id = id;
this.name = name;
this.deviceType = deviceType;
this.gateway = gateway;
this.description = description;
}
public Long getId() {
return this.id;
}
public void setId(final Long deviceId) {
this.id = deviceId;
}
public String getName() {
return this.name;
}
public void setName(final String name) {
this.name = name;
}
public EThingType getDeviceType() {
return this.deviceType;
}
public void setDeviceType(final EThingType deviceType) {
this.deviceType = deviceType;
}
public Gateway getGateway() {
return this.gateway;
}
public void setGateway(final Gateway gateway) {
this.gateway = gateway;
}
public List<DeviceProperty> getDeviceProperties() {
return this.deviceProperties;
}
public void setDeviceProperties(final List<DeviceProperty> deviceProperties) {
this.deviceProperties = deviceProperties;
}
public DeviceProperty addDeviceProperty(final DeviceProperty deviceProperty) {
getDeviceProperties().add(deviceProperty);
deviceProperty.setDevice(this);
return deviceProperty;
}
public DeviceProperty removeDeviceProperty(final DeviceProperty deviceProperty) {
getDeviceProperties().remove(deviceProperty);
deviceProperty.setDevice(null);
return deviceProperty;
}
/**
* @param deviceDTO
* @return new Device entity.
*/
public static Device fromDTO(final DeviceDTO deviceDTO) {
final Device device = new Device(deviceDTO.getId(), deviceDTO.getName(), deviceDTO.getType(),
new Gateway(deviceDTO.getGatewayId(), null, null, null, true), deviceDTO.getDescription());
device.setDeviceProperties(new ArrayList<>());
if (!CollectionUtils.isEmpty(deviceDTO.getProperties())) {
for (DevicePropertyDTO propDTO : deviceDTO.getProperties()) {
device.addDeviceProperty(DeviceProperty.fromDTO(propDTO));
}
}
return device;
}
/**
* @return dto of the entity.
*/
public DeviceDTO toDTO() {
final DeviceDTO deviceDTO = new DeviceDTO(id, name, gateway.getId(), deviceType, description);
if (deviceProperties != null && !deviceProperties.isEmpty()) {
final List<DevicePropertyDTO> properties = new ArrayList<>();
for (DeviceProperty prop : deviceProperties) {
properties.add(prop.toDTO());
}
deviceDTO.setProperties(properties);
}
return deviceDTO;
}
/**
* @return dto of the entity without properties.
*/
public DeviceDTO toDTO(boolean withProperties) {
DeviceDTO deviceDTO = this.toDTO();
if (withProperties) {
deviceDTO.setProperties(null);
}
return deviceDTO;
}
/**
* @return
*/
public RegistryDTO toDTOforGateway() {
final List<PropertyDTO> props = new ArrayList<>();
for (final DeviceProperty prop : getDeviceProperties()) {
props.add(prop.toDTOforGateway());
}
return new RegistryDTO(id, name, props, deviceType, null, null, description);
}
/**
* @param deviceDTOafterGateway
* @return
*/
public static Device fromDTOfromGateway(final RegistryDTO deviceDTO, final long idGateway) {
final Gateway gateway = new Gateway();
gateway.setId(idGateway);
final Device device = new Device(deviceDTO.getId(), deviceDTO.getName(), deviceDTO.getType(), gateway,
deviceDTO.getDescription());
final List<DeviceProperty> props = new ArrayList<>();
for (final PropertyDTO prop : deviceDTO.getProperties()) {
final DeviceProperty propertyFromGateway = DeviceProperty.fromDTOfromGateway(prop, deviceDTO.getId());
propertyFromGateway.setDevice(device);
props.add(propertyFromGateway);
}
device.setDeviceProperties(props);
return device;
}
} | [
"han315730@gmail.com"
] | han315730@gmail.com |
cff43437af4547e0d159eb93c7bb3f2015655562 | 5876b8c59a719a4ba49d4ecb0a4cf8ee4f052214 | /src/test/java/com/ulabs/minhasfinancas/model/respository/UsuarioRepositoryTest.java | 0aede77898a3d04f5ddbbdcd030873b59500b241 | [] | no_license | uzkha/financasapi | 4d1bc764f10c0f89bc8ce599152caad45d5c63ae | 71d1b92591142e58aa7260ac635f72c3343ea91b | refs/heads/master | 2023-04-17T09:25:28.708384 | 2021-05-06T00:21:03 | 2021-05-06T00:21:03 | 364,739,097 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,817 | java | package com.ulabs.minhasfinancas.model.respository;
import java.util.Optional;
import org.assertj.core.api.Assertions;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase.Replace;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import com.ulabs.minhasfinancas.model.entity.Usuario;
import com.ulabs.minhasfinancas.model.repository.UsuarioRepository;
//@SpringBootTest carrega todo o contexto spring
@RunWith(SpringRunner.class)
@ActiveProfiles("test")
@DataJpaTest
@AutoConfigureTestDatabase(replace = Replace.NONE) //para o @DataJpaTest nao sobrescrever a base configurada, senao cria instancia propria do datajpatest
public class UsuarioRepositoryTest {
@Autowired
UsuarioRepository repository;
@Autowired
TestEntityManager entityManager;
@Test
public void deveVerificarAExistenciaDeUmEmail() {
//cenario
Usuario usuario = criarUsuario();
entityManager.persist(usuario);
//ação / execucao
boolean result = repository.existsByEmail("usuario@email.com");
//verificacao
Assertions.assertThat(result).isTrue();
}
@Test
public void deveRetornarFalsoQuandoNaoHouverUsuarioCadastradoComOEmail() {
//cenario
//acao / execucao
boolean result = repository.existsByEmail("usuario@email.com");
//verificacao
Assertions.assertThat(result).isFalse();
}
@Test
public void devePersistirUmUsuarioNaBaseDeDados() {
//cenario
Usuario usuario = criarUsuario();
//acao
Usuario usuarioSalvo = repository.save(usuario);
//verificacao
Assertions.assertThat(usuarioSalvo.getId()).isNotNull();
}
@Test
public void deveBuscarUmUsuarioPorEmail() {
//cenario
Usuario usuario = criarUsuario();
entityManager.persist(usuario);
//verificacao
Optional<Usuario> result = repository.findByEmail("usuario@email.com");
Assertions.assertThat(result.isPresent()).isTrue();
}
@Test
public void deveRetornarVazioAoBuscarUsuarioPorEmailQuandoNaoExisteNaBase() {
//verificacao
Optional<Usuario> result = repository.findByEmail("usuario@email.com");
Assertions.assertThat(result.isPresent()).isFalse();
}
public static Usuario criarUsuario() {
return Usuario.builder().nome("Usuario").email("usuario@email.com").senha("senha").build();
}
}
| [
"diogolbx@gmail.com"
] | diogolbx@gmail.com |
9c052263023b1898812887c5d6d88c71a62d3c22 | bbfe5ff2eb3c0941a1cb16e39f6b9a079f9847f9 | /src/org/usfirst/frc/team4645/robot/commands/ExampleCommand.java | a6686c81e35b138ba5da2a119a7ea6b9692cb9f1 | [] | no_license | BotDogs4645/TankDriveEncodersExample | 2cc182a9ed62546819fae710ff61b6cc78c50ce6 | a01c762ff90f26ad3a59e10fa46142763836bf42 | refs/heads/master | 2021-09-03T23:46:51.944621 | 2017-12-31T15:32:50 | 2017-12-31T15:32:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 912 | java | package org.usfirst.frc.team4645.robot.commands;
import edu.wpi.first.wpilibj.command.Command;
import org.usfirst.frc.team4645.robot.Robot;
/**
*
*/
public class ExampleCommand extends Command {
public ExampleCommand() {
// Use requires() here to declare subsystem dependencies
requires(Robot.exampleSubsystem);
}
// Called just before this Command runs the first time
@Override
protected void initialize() {
}
// Called repeatedly when this Command is scheduled to run
@Override
protected void execute() {
}
// Make this return true when this Command no longer needs to run execute()
@Override
protected boolean isFinished() {
return false;
}
// Called once after isFinished returns true
@Override
protected void end() {
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
@Override
protected void interrupted() {
}
}
| [
"mbaltman@cps.edu"
] | mbaltman@cps.edu |
d205d051f0ffce3f616740573e1641c375ea8247 | d75342c6c0ec54cd99bc0adaaa2e5b9220b032ec | /app/src/main/java/com/amrendra/codefiesta/db/DBHelper.java | 38c0048adca358006232b46cffe84341976ee8da | [] | no_license | pchhiller/codezera | f6847f9754461692afdc3a0a63e2a5a21c72843d | c34c0df684308abf2391d0105147f52e36610019 | refs/heads/master | 2021-01-15T13:18:58.684368 | 2017-10-01T05:16:19 | 2017-10-01T05:16:19 | 99,669,399 | 0 | 1 | null | 2017-10-01T05:16:20 | 2017-08-08T08:27:50 | Java | UTF-8 | Java | false | false | 3,763 | java | package com.amrendra.codefiesta.db;
import android.content.Context;
import android.database.DatabaseErrorHandler;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import com.amrendra.codefiesta.utils.Debug;
/**
* Created by Amrendra Kumar on 09/04/16.
*/
public class DBHelper extends SQLiteOpenHelper {
public static final int DB_VERSION = 1;
public static final String DB_NAME = "codefiesta.db";
public static final String SQL_CREATE_TABLE_RESOURCE =
"CREATE TABLE " + DBContract.ResourceEntry.TABLE_NAME + " ("
+ DBContract.ResourceEntry._ID + " INTEGER PRIMARY KEY,"
+ DBContract.ResourceEntry.RESOURCE_ID_COL + " INTEGER NOT NULL,"
+ DBContract.ResourceEntry.RESOURCE_NAME_COL + " TEXT NOT NULL,"
+ DBContract.ResourceEntry.RESOURCE_SHOW_COL + " INTEGER NOT NULL,"
+ " UNIQUE (" + DBContract.ResourceEntry.RESOURCE_ID_COL + ") ON CONFLICT IGNORE"
+ " );";
public static final String SQL_CREATE_TABLE_CONTESTS =
"CREATE TABLE " + DBContract.ContestEntry.TABLE_NAME + " ("
+ DBContract.ContestEntry._ID + " INTEGER PRIMARY KEY,"
+ DBContract.ContestEntry.CONTEST_ID_COL + " INTEGER NOT NULL,"
+ DBContract.ContestEntry.CONTEST_NAME_COL + " TEXT NOT NULL,"
+ DBContract.ContestEntry.CONTEST_URL_COL + " TEXT NOT NULL,"
+ DBContract.ContestEntry.CONTEST_RESOURCE_ID_COL + " TEXT NOT NULL,"
+ DBContract.ContestEntry.CONTEST_START_COL + " INTEGER NOT NULL,"
+ DBContract.ContestEntry.CONTEST_END_COL + " INTEGER NOT NULL,"
+ DBContract.ContestEntry.CONTEST_DURATION_COL + " INTEGER NOT NULL,"
+ " UNIQUE (" + DBContract.ContestEntry.CONTEST_ID_COL + ") ON CONFLICT REPLACE"
+ " );";
public static final String SQL_CREATE_TABLE_NOTIFICATIONS =
"CREATE TABLE " + DBContract.NotificationEntry.TABLE_NAME + " ("
+ DBContract.NotificationEntry._ID + " INTEGER PRIMARY KEY,"
+ DBContract.NotificationEntry.NOTIFICATION_CONTEST_ID_COL + " INTEGER NOT NULL,"
+ DBContract.NotificationEntry.NOTIFICATION_TIME_COL + " INTEGER NOT NULL,"
+ DBContract.NotificationEntry.NOTIFICATION_CONTEST_START_TIME_COL + " INTEGER NOT NULL,"
+ " UNIQUE (" + DBContract.NotificationEntry._ID + ") ON CONFLICT REPLACE"
+ " );";
public DBHelper(Context context) {
super(context, DB_NAME, null, DB_VERSION);
Debug.c();
}
public DBHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
super(context, name, factory, version);
}
public DBHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version, DatabaseErrorHandler errorHandler) {
super(context, name, factory, version, errorHandler);
}
@Override
public void onCreate(SQLiteDatabase db) {
Debug.c();
db.execSQL(SQL_CREATE_TABLE_RESOURCE);
db.execSQL(SQL_CREATE_TABLE_CONTESTS);
db.execSQL(SQL_CREATE_TABLE_NOTIFICATIONS);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
Debug.c();
db.execSQL("DROP TABLE IF EXISTS " + DBContract.ResourceEntry.TABLE_NAME);
db.execSQL("DROP TABLE IF EXISTS " + DBContract.ContestEntry.TABLE_NAME);
db.execSQL("DROP TABLE IF EXISTS " + DBContract.NotificationEntry.TABLE_NAME);
onCreate(db);
}
}
| [
"amrendra.nitb@gmail.com"
] | amrendra.nitb@gmail.com |
dfee2a534852461edfbbff1b803c90a01e814f76 | 14284017ddcb7cfef4afaa3c5cf26f598260ab90 | /ProyectoCCT-4/src/persistence/ConexionDB.java | df4451289519d22ba84f60047741878e8a80bf20 | [] | no_license | gmontoya190/RepoCCT | 3c27c951897f95b0588a84d7315d117bdf40e878 | 959c45132c4935a93a54c9cf30700f951e8bb11d | refs/heads/master | 2021-01-15T08:43:31.024817 | 2015-05-12T01:17:24 | 2015-05-12T01:17:24 | 34,834,468 | 0 | 0 | null | 2015-04-30T04:40:44 | 2015-04-30T04:40:44 | null | WINDOWS-1250 | Java | false | false | 8,953 | java | package persistence;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
import data.model.Format;
import data.model.User;
public class ConexionDB {
static Connection conexion = null;
private static String DB_NAME = "camara";
private Statement stmt = null;
public static Connection connect() {
try {
Class.forName("com.mysql.jdbc.Driver");
conexion = DriverManager.getConnection("jdbc:mysql://localhost/"+DB_NAME,"root","root");
System.out.println("conexion exitosa");
} catch (SQLException ex) {
System.out.println("No se establecio conexión por sql");
System.out.println(ex);
} catch (Exception ex) {
System.out.println("No se establecio conexión");
System.out.println(ex);
}
return conexion;
}
public User getIfUserExists(String email, String password) {
String query = "select * from usuario where email='" + email + "' and password='"+password+"';";
User user = null;
ResultSet rs = null;
try {
stmt = conexion.createStatement();
rs = stmt.executeQuery(query);
if (rs != null) {
rs.next();
String em = rs.getString("email");
String name = rs.getString("nombre");
String sex = rs.getString("sexo");
String pass = rs.getString("password");
String idProcess = rs.getString("num_proceso");
String processLead = rs.getString("lider_proceso");
user = new User();
user.setIdProcess(idProcess);
user.setProcessLead(processLead);
user.setEmail(em);
user.setPassword(password);
user.setName(name);
user.setSex(sex);
} else {
System.out.println("No existe el usuario");
}
} catch (SQLException se) {
se.printStackTrace();
} catch (Exception e) {
// Handle errors for Class.forName
e.printStackTrace();
} finally {
try {
rs.close();
stmt.close();
conexion.close();
} catch (Exception e) {
}
}
return user;
}
public List<Format> getFormatsByProcess(String idProcess) {
String query = "select * from formatos where proceso_id='" + idProcess + "' and "
+ "aprobado='Y' and activo='Y';";
List<Format> listFormats = null;
ResultSet rs = null;
try {
stmt = conexion.createStatement();
rs = stmt.executeQuery(query);
if (rs != null) {
listFormats = new ArrayList<Format>();
Format format = null;
while (rs.next()) {
String idFormat = rs.getString("id_formato");
String version = rs.getString("version");
String nameFormat = rs.getString("nombre_formato");
String extension = rs.getString("extension");
String userModi= rs.getString("usuario_ultima_mod");
format = new Format();
format.setExtension(extension);
format.setIdFormat(idFormat);
format.setNameFormat(nameFormat);
format.setVersion(version);
format.setUserLastModification(userModi);
listFormats.add(format);
}
} else {
System.out.println("No existen formatos");
}
} catch (SQLException se) {
se.printStackTrace();
} catch (Exception e) {
// Handle errors for Class.forName
e.printStackTrace();
} finally {
try {
rs.close();
stmt.close();
conexion.close();
} catch (Exception e) {
e.printStackTrace();
System.out.println("No se pudo cerrar la conexion");
}
}
return listFormats;
}
public void createPendingFormat(Format format, String userLastModi, String processId, String aproved) {
String query = "insert into formatos values ('" + format.getIdFormat() + "','" + format.getVersion() + "'," + " '"
+ userLastModi + "', '" + format.getExtension() + "' , '" + aproved + "','" + "Y'" + ",'"
+ format.getNameFormat() + "', '" + processId + "');";
try {
stmt = conexion.createStatement();
stmt.executeUpdate(query);
} catch (SQLException se) {
se.printStackTrace();
} catch (Exception e) {
// Handle errors for Class.forName
e.printStackTrace();
}
}
public void createUsers(User user) {
String query = "insert into usuario values ('" + user.getEmail() + "','" + user.getName() + "'," + " '"
+ user.getPassword() + "', '" + user.getSex() + "' , '" + user.getIdProcess() + "','" + user.getProcessLead() + "');";
try {
stmt = conexion.createStatement();
stmt.executeUpdate(query);
} catch (SQLException se) {
se.printStackTrace();
} catch (Exception e) {
// Handle errors for Class.forName
e.printStackTrace();
}
}
public void ModifyUser (User user) {
String query = "update usuario set nombre='"+user.getName()+"',password='"+user.getPassword()+"' where email='"+ user.getEmail() +"' ;";
try {
stmt = conexion.createStatement();
stmt.executeUpdate(query);
} catch (SQLException se) {
se.printStackTrace();
} catch (Exception e) {
// Handle errors for Class.forName
e.printStackTrace();
} finally {
try {
stmt.close();
conexion.close();
} catch (Exception e) {
}
}
}
public void updateApprovalFormat (String idFormat, String idVersion, String value) {
String query = "update formatos set aprobado='"+value+"'where id_formato='"+ idFormat +"' and version='"+idVersion
+ "';";
try {
stmt = conexion.createStatement();
stmt.executeUpdate(query);
} catch (SQLException se) {
se.printStackTrace();
} catch (Exception e) {
// Handle errors for Class.forName
e.printStackTrace();
} finally {
try {
stmt.close();
conexion.close();
} catch (Exception e) {
}
}
}
public void updateActiveFormat (String idFormat, String idVersion, String value) {
String query = "update formatos set activo='"+value+"'where id_formato='" + idFormat + "'and version=" + "'" +idVersion
+ "';";
try {
stmt = conexion.createStatement();
stmt.executeUpdate(query);
} catch (SQLException se) {
se.printStackTrace();
} catch (Exception e) {
// Handle errors for Class.forName
e.printStackTrace();
} finally {
try {
stmt.close();
conexion.close();
} catch (Exception e) {
}
}
}
public Format getFormat(String idFormat, String idVersion) {
String query = "select * from formatos where id_formato='" + idFormat + "' and version=" + "'" + idVersion
+ "';";
Format formatResult = null;
ResultSet rs = null;
try {
stmt = conexion.createStatement();
rs = stmt.executeQuery(query);
if (rs != null) {
rs.next();
String nameFormat = rs.getString("nombre_formato");
String extension = rs.getString("extension");
String aproved = rs.getString("aprobado");
String activated = rs.getString("activo");
String process = rs.getString("proceso_id");
String userModi= rs.getString("usuario_ultima_mod");
formatResult = new Format();
formatResult.setIdFormat(idFormat);
formatResult.setVersion(idVersion);
formatResult.setNameFormat(nameFormat);
formatResult.setExtension(extension);
formatResult.setActived(activated);
formatResult.setAprobado(aproved);
formatResult.setProcessId(process);
formatResult.setUserLastModification(userModi);
} else {
System.out.println("No existe el usuario");
}
} catch (SQLException se) {
se.printStackTrace();
} catch (Exception e) {
// Handle errors for Class.forName
e.printStackTrace();
} finally {
try {
rs.close();
stmt.close();
conexion.close();
} catch (Exception e) {
}
}
return formatResult;
}
public List<Format> getFormatsNapproved(){
List <Format> formats=null;
String query= "select * from formatos where aprobado='N' and activo='Y';";
ResultSet rs = null;
try {
stmt = conexion.createStatement();
rs = stmt.executeQuery(query);
if (rs != null) {
formats = new ArrayList<Format>();
Format format = null;
while (rs.next()) {
String idFormat = rs.getString("id_formato");
String version = rs.getString("version");
String nameFormat = rs.getString("nombre_formato");
String extension = rs.getString("extension");
String userModi= rs.getString("extension");
format = new Format();
format.setExtension(extension);
format.setIdFormat(idFormat);
format.setNameFormat(nameFormat);
format.setVersion(version);
format.setUserLastModification(userModi);
formats.add(format);
}
} else {
System.out.println("No existen formatos");
}
} catch (SQLException se) {
se.printStackTrace();
} catch (Exception e) {
// Handle errors for Class.forName
e.printStackTrace();
} finally {
try {
rs.close();
stmt.close();
conexion.close();
} catch (Exception e) {
e.printStackTrace();
System.out.println("No se pudo cerrar la conexion");
}
}
return formats;
}
}
| [
"CQ 43 - 450LA@169.254.219.61"
] | CQ 43 - 450LA@169.254.219.61 |
a5e7ba9c5ccf3e91ea4ddb3631d010bcaafc4a2e | 3d74416f02f1215b623b081a7dafc7537f818af4 | /my09/src/Array/Array_test_13.java | 9b840c415cf4b64b8892a18e9bfa2c56e0779eec | [] | no_license | soyeon-gh/JAVA01 | 78ec6e45cbce854fcca24af9e555d3f7de8509ef | 4df64c13cf6b1e3d766aebb7fb3fc2fd7ce2947e | refs/heads/master | 2020-12-28T04:46:17.023196 | 2020-02-06T13:20:47 | 2020-02-06T13:20:47 | 238,185,111 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 573 | java | package Array;
import java.util.Scanner;
public class Array_test_13 {
public static void main(String[] args) {
int s[] = { 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 };
int value, index = -1;
Scanner sc = new Scanner(System.in);
System.out.print("탐색할 값을 입력하시오 : ");
value = sc.nextInt();
for (int i = 0; i < s.length; i++) {
if (s[i] == value) {
index = i;
}
}
if (index < s.length && index >= 0) {
System.out.println("" + value + "값은 " + index + "위치에 있습니다.");
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
ae154a560c22c99adde60f297c4a462a713c5310 | b3a1f1eed1e04cf0aaee842b61d16f41824c1065 | /app/build/generated/source/r/debug/android/support/transition/R.java | e0a6bf18abdac1ebedff4a4623c13c1481750090 | [] | no_license | JamalGuyo/AndroidHomeDashBoard | 774690788ce291481a2ae0a86f0b1c212c1395e3 | 7a0d26bd7ee0eb1ef9a72cae4dbfb1fc38ef1273 | refs/heads/master | 2021-05-12T18:18:44.314762 | 2018-01-16T05:50:35 | 2018-01-16T05:50:35 | 117,063,963 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,107 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package android.support.transition;
public final class R {
public static final class attr {
public static final int font = 0x7f03009a;
public static final int fontProviderAuthority = 0x7f03009c;
public static final int fontProviderCerts = 0x7f03009d;
public static final int fontProviderFetchStrategy = 0x7f03009e;
public static final int fontProviderFetchTimeout = 0x7f03009f;
public static final int fontProviderPackage = 0x7f0300a0;
public static final int fontProviderQuery = 0x7f0300a1;
public static final int fontStyle = 0x7f0300a2;
public static final int fontWeight = 0x7f0300a3;
}
public static final class bool {
public static final int abc_action_bar_embed_tabs = 0x7f040000;
}
public static final class color {
public static final int notification_action_color_filter = 0x7f050052;
public static final int notification_icon_bg_color = 0x7f050053;
public static final int notification_material_background_media_default_color = 0x7f050054;
public static final int primary_text_default_material_dark = 0x7f05005a;
public static final int ripple_material_light = 0x7f05005f;
public static final int secondary_text_default_material_dark = 0x7f050060;
public static final int secondary_text_default_material_light = 0x7f050061;
}
public static final class dimen {
public static final int compat_button_inset_horizontal_material = 0x7f06004d;
public static final int compat_button_inset_vertical_material = 0x7f06004e;
public static final int compat_button_padding_horizontal_material = 0x7f06004f;
public static final int compat_button_padding_vertical_material = 0x7f060050;
public static final int compat_control_corner_material = 0x7f060051;
public static final int notification_action_icon_size = 0x7f060087;
public static final int notification_action_text_size = 0x7f060088;
public static final int notification_big_circle_margin = 0x7f060089;
public static final int notification_content_margin_start = 0x7f06008a;
public static final int notification_large_icon_height = 0x7f06008b;
public static final int notification_large_icon_width = 0x7f06008c;
public static final int notification_main_column_padding_top = 0x7f06008d;
public static final int notification_media_narrow_margin = 0x7f06008e;
public static final int notification_right_icon_size = 0x7f06008f;
public static final int notification_right_side_padding_top = 0x7f060090;
public static final int notification_small_icon_background_padding = 0x7f060091;
public static final int notification_small_icon_size_as_large = 0x7f060092;
public static final int notification_subtext_size = 0x7f060093;
public static final int notification_top_pad = 0x7f060094;
public static final int notification_top_pad_large_text = 0x7f060095;
}
public static final class drawable {
public static final int notification_action_background = 0x7f07006f;
public static final int notification_bg = 0x7f070070;
public static final int notification_bg_low = 0x7f070071;
public static final int notification_bg_low_normal = 0x7f070072;
public static final int notification_bg_low_pressed = 0x7f070073;
public static final int notification_bg_normal = 0x7f070074;
public static final int notification_bg_normal_pressed = 0x7f070075;
public static final int notification_icon_background = 0x7f070076;
public static final int notification_template_icon_bg = 0x7f070077;
public static final int notification_template_icon_low_bg = 0x7f070078;
public static final int notification_tile_bg = 0x7f070079;
public static final int notify_panel_notification_icon_bg = 0x7f07007a;
}
public static final class id {
public static final int action0 = 0x7f080006;
public static final int action_container = 0x7f08000e;
public static final int action_divider = 0x7f080010;
public static final int action_image = 0x7f080011;
public static final int action_text = 0x7f080017;
public static final int actions = 0x7f080018;
public static final int async = 0x7f08001f;
public static final int blocking = 0x7f080023;
public static final int cancel_action = 0x7f080026;
public static final int chronometer = 0x7f08002c;
public static final int end_padder = 0x7f080040;
public static final int forever = 0x7f08004a;
public static final int ghost_view = 0x7f08004b;
public static final int icon = 0x7f08004e;
public static final int icon_group = 0x7f08004f;
public static final int info = 0x7f080052;
public static final int italic = 0x7f080053;
public static final int line1 = 0x7f080057;
public static final int line3 = 0x7f080058;
public static final int media_actions = 0x7f08005c;
public static final int normal = 0x7f080065;
public static final int notification_background = 0x7f080066;
public static final int notification_main_column = 0x7f080067;
public static final int notification_main_column_container = 0x7f080068;
public static final int parent_matrix = 0x7f08006d;
public static final int right_icon = 0x7f080073;
public static final int right_side = 0x7f080074;
public static final int save_image_matrix = 0x7f080075;
public static final int save_non_transition_alpha = 0x7f080076;
public static final int save_scale_type = 0x7f080077;
public static final int status_bar_latest_event_content = 0x7f080099;
public static final int text = 0x7f08009d;
public static final int text2 = 0x7f08009e;
public static final int time = 0x7f0800a4;
public static final int title = 0x7f0800a5;
public static final int transition_current_scene = 0x7f0800ac;
public static final int transition_layout_save = 0x7f0800ad;
public static final int transition_position = 0x7f0800ae;
public static final int transition_scene_layoutid_cache = 0x7f0800af;
public static final int transition_transform = 0x7f0800b0;
}
public static final class integer {
public static final int cancel_button_image_alpha = 0x7f090004;
public static final int status_bar_notification_info_maxnum = 0x7f090009;
}
public static final class layout {
public static final int notification_action = 0x7f0a002a;
public static final int notification_action_tombstone = 0x7f0a002b;
public static final int notification_media_action = 0x7f0a002c;
public static final int notification_media_cancel_action = 0x7f0a002d;
public static final int notification_template_big_media = 0x7f0a002e;
public static final int notification_template_big_media_custom = 0x7f0a002f;
public static final int notification_template_big_media_narrow = 0x7f0a0030;
public static final int notification_template_big_media_narrow_custom = 0x7f0a0031;
public static final int notification_template_custom_big = 0x7f0a0032;
public static final int notification_template_icon_group = 0x7f0a0033;
public static final int notification_template_lines_media = 0x7f0a0034;
public static final int notification_template_media = 0x7f0a0035;
public static final int notification_template_media_custom = 0x7f0a0036;
public static final int notification_template_part_chronometer = 0x7f0a0037;
public static final int notification_template_part_time = 0x7f0a0038;
}
public static final class string {
public static final int status_bar_notification_info_overflow = 0x7f0c0029;
}
public static final class style {
public static final int TextAppearance_Compat_Notification = 0x7f0d0104;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0d0105;
public static final int TextAppearance_Compat_Notification_Info_Media = 0x7f0d0106;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0d0107;
public static final int TextAppearance_Compat_Notification_Line2_Media = 0x7f0d0108;
public static final int TextAppearance_Compat_Notification_Media = 0x7f0d0109;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0d010a;
public static final int TextAppearance_Compat_Notification_Time_Media = 0x7f0d010b;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0d010c;
public static final int TextAppearance_Compat_Notification_Title_Media = 0x7f0d010d;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0d0182;
public static final int Widget_Compat_NotificationActionText = 0x7f0d0183;
}
public static final class styleable {
public static final int[] FontFamily = { 0x7f03009c, 0x7f03009d, 0x7f03009e, 0x7f03009f, 0x7f0300a0, 0x7f0300a1 };
public static final int FontFamily_fontProviderAuthority = 0;
public static final int FontFamily_fontProviderCerts = 1;
public static final int FontFamily_fontProviderFetchStrategy = 2;
public static final int FontFamily_fontProviderFetchTimeout = 3;
public static final int FontFamily_fontProviderPackage = 4;
public static final int FontFamily_fontProviderQuery = 5;
public static final int[] FontFamilyFont = { 0x7f03009a, 0x7f0300a2, 0x7f0300a3 };
public static final int FontFamilyFont_font = 0;
public static final int FontFamilyFont_fontStyle = 1;
public static final int FontFamilyFont_fontWeight = 2;
}
}
| [
"jamalguyo08@gmail.com"
] | jamalguyo08@gmail.com |
613754af73a71408ca663c026116bbb8024cd54b | ca49f50969b38069630357c28b298ac574ea1248 | /src/ba/unsa/rpr/tutorijal7/Tutorijal.java | ea970ac45445078a37ecad91845fd1d461a1db9b | [] | no_license | RijadSehovic/rpr-t7 | 8fe857dbed483e349f6d9c4c9561236f86a65c0c | 28d4fafa22bda21bebdd08b78fc8ad796a9265d8 | refs/heads/master | 2020-04-09T08:03:35.418680 | 2018-12-04T17:32:52 | 2018-12-04T17:32:52 | 160,180,827 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,824 | java | package ba.unsa.rpr.tutorijal7;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.Scanner;
public class Tutorijal {
static ArrayList<Grad> ucitajGradove(){
ArrayList<Grad> gradovi = new ArrayList<>();
Scanner ulaz;
try {
ulaz = new Scanner(new FileReader("mjerenja.txt"));
} catch (FileNotFoundException e) {
System.out.println("Datoteka ulaz.txt ne postoji ili se ne može otvoriti");
System.out.println("Greška: " + e);
return null;
}
int i,j=0;
while(ulaz.hasNext()) {
String jednaLinija = ulaz.next();
String[] podstringovi = jednaLinija.split(",");
double[] pomocni = new double[ 1000 ];
for(i=0; i < podstringovi.length-1; i++){
pomocni[i] = Double.parseDouble( podstringovi [i+1] );
}
gradovi.add( new Grad() );
gradovi.get(j).setNaziv(podstringovi [0]);
gradovi.get(j).setTemperature(pomocni);
j+=1;
}
ulaz.close();
return gradovi;
}
static UN ucitajXml(ArrayList<Grad> gradovi){
UN claniceUN = new UN();
Document xmldoc = null;
try {
DocumentBuilder docReader
= DocumentBuilderFactory.newInstance().newDocumentBuilder();
xmldoc = docReader.parse(new File("proba.xml"));
} catch (Exception e) {
System.out.println("drzave.xml nije validan XML dokument");
return null;
}
NodeList djeca = xmldoc.getChildNodes();
for(int i = 0; i < djeca.getLength(); i++) {
Node dijete = djeca.item(i);
if (dijete instanceof Element) {
Element e = (Element) dijete;
NodeList djecaDrzave = e.getChildNodes();
for(int j = 0; i < djecaDrzave.getLength(); i++) {
Node dijeteDrzave = djecaDrzave.item(i);
if(dijeteDrzave instanceof Element){
if(((Element)dijeteDrzave).getTagName() =="naziv")
dijeteDrzave.getTextContent();
}
}
}
}
return claniceUN;
}
public static void main(String[] args) {
}
} | [
"rsehovic1@etf.unsa.ba"
] | rsehovic1@etf.unsa.ba |
164eafb1d25eaac09a8f19e24072769585751050 | 6df4068c6848e0c6390008fa22725328a3a137a8 | /Dog.java | 937b9512bad35ddbcbbde8eece6fbbf5640e7c8c | [] | no_license | dylkirk23/cisc275-fall2019-first-git | b36dd0971dfbfe8cf69eaa27886ba020cc3af2cb | 33ff946fcc0926c0a4c73255543f4929f18b9989 | refs/heads/master | 2021-02-09T01:31:34.416564 | 2020-03-02T00:55:58 | 2020-03-02T00:55:58 | 244,222,959 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 204 | java | public class Dog extends Animal{
public Dog(String name, int numLegs){
super(name, numLegs);
}
public int getLegs(){ return numLegs; }
public String toString(){
return name + " " + numLegs;
}
} | [
"dylkirk923@gmail.com"
] | dylkirk923@gmail.com |
87d9562b18a3f7cc2c81b93c08cc83fea454375c | be73270af6be0a811bca4f1710dc6a038e4a8fd2 | /crash-reproduction-moho/results/XRENDERING-481-38-16-FEMO-WeightedSum:TestLen:CallDiversity/com/xpn/xwiki/internal/security/authorization/DefaultAuthorExecutor_ESTest_scaffolding.java | a54da99c7a7bf343de9df950580d2d6c5d262cd1 | [] | no_license | STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application | cf118b23ecb87a8bf59643e42f7556b521d1f754 | 3bb39683f9c343b8ec94890a00b8f260d158dfe3 | refs/heads/master | 2022-07-29T14:44:00.774547 | 2020-08-10T15:14:49 | 2020-08-10T15:14:49 | 285,804,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 471 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Sat Apr 04 14:29:43 UTC 2020
*/
package com.xpn.xwiki.internal.security.authorization;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
@EvoSuiteClassExclude
public class DefaultAuthorExecutor_ESTest_scaffolding {
// Empty scaffolding for empty test suite
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
df40d7cf0593e9ab0b8a9eae4711b876576e79fb | 4662944bcb47aa2746e04cf9ee79cbdc1d14e4a0 | /kodilla-testing/src/main/java/com/kodilla/testing/user/SimpleUser.java | 48d8ba5d997a27014a2d268f24e4ef7f754b8e26 | [] | no_license | krysiakpawel/kodilla_java_course | a3e0bdaac75c884cc7063c35b8e6f9930d7e08e2 | 9f02a7baeda100e707392d2e7ef4dbd6f9a16d06 | refs/heads/master | 2023-03-12T14:37:38.835062 | 2021-03-03T23:15:53 | 2021-03-03T23:15:53 | 341,301,663 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 384 | java | package com.kodilla.testing.user;
public class SimpleUser {
private String username;
private String realName;
public SimpleUser(String username, String realName) {
this.username = username;
this.realName = realName;
}
public String getUsername() {
return username;
}
public String getRealName(){
return realName;
}
} | [
"krysiak.p@o2.pl"
] | krysiak.p@o2.pl |
59c217e854d6ad6e45b0a53716c3630b7f0a12a5 | 56a0f160dcb8c6c6e644c43a4c755738ea23cd07 | /FindOdd.java | 81ec422b9e3ecc02e2b2389a6ad63612f4643e6f | [] | no_license | hochental/kata | 0384d8a250cfa024dbc0bcf494c91ba86b233f73 | 866fabb1e880ddc3ea4f8e01194b13136b0acb19 | refs/heads/master | 2022-11-17T19:10:13.525470 | 2020-07-11T13:20:36 | 2020-07-11T13:20:36 | 278,168,365 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 602 | java | import java.util.*;
public class FindOdd {
public static int findIt(int[] a) {
HashMap<Integer, Boolean> checkIfOk = new HashMap<>();
for(int i=0; i<a.length; i++){
if(!checkIfOk.containsKey(a[i]))
checkIfOk.put(a[i], true);
else{
Boolean replace = checkIfOk.get(a[i]);
checkIfOk.replace(a[i], !replace);
}
}
for(Map.Entry<Integer, Boolean> i: checkIfOk.entrySet()){
if(i.getValue()){
return i.getKey();
}
}
return 0;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
fb41d487b16fe843cf04f982688dbdfee9c70ee2 | 876eaaf79ce68a3bd8df8f698fa79c0c6aa5ef63 | /workspaces-itcast/template/springJDBCTest/src/cn/gdcp/jdbc/Account.java | 9b351617a67ec36c0bc5c697e5ca45e2af470e05 | [] | no_license | lcz-sys/Java_prj | cb89207419aebfa6d7df43123a1ae536e0afaed1 | ae4e112d6473af59d969932f2ad540a7db347461 | refs/heads/master | 2022-12-13T03:42:27.550388 | 2020-09-03T08:56:23 | 2020-09-03T08:56:23 | 292,516,809 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 599 | java | package cn.gdcp.jdbc;
public class Account {
private Integer id;
private String username;
private Double balance;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public Double getBalance() {
return balance;
}
public void setBalance(Double balance) {
this.balance = balance;
}
@Override
public String toString() {
return "Account [id=" + id + ", username=" + username + ", balance=" + balance + "]";
}
}
| [
"212065370@qq.com"
] | 212065370@qq.com |
18533297b44235f8b13c89954d8a4a3188f7e89d | aa45fd9e79195be49bf8462e1e7048c80a2412c5 | /src/com/yahoo/util/graph/BFS.java | c6fbcd8ad2a8a0f3ec8f854b54ca274a78dabc44 | [] | no_license | vbarakam/sample1 | 23394e1550ef0a35975c692b4ecbb6498815a5cc | e9dca49493126bb4455ff03a112c333a26fb709c | refs/heads/master | 2021-04-15T14:04:30.537661 | 2018-03-24T14:34:43 | 2018-03-24T14:34:43 | 126,607,262 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,177 | java | package com.yahoo.util.graph;
import java.util.LinkedList;
import java.util.Queue;
public class BFS {
private int vertices = 0;
private LinkedList<Integer> adjs[];
public BFS(int v) {
this.vertices = v;
adjs = new LinkedList[v];
for (int i = 0; i < v; i++) {
adjs[i] = new LinkedList<>();
}
}
public void addEdge(int v, int w) {
adjs[v].add(w);
}
public void bfs(int start) {
int color[] = new int[this.vertices];
int dist[] = new int[this.vertices];
int parent[] = new int[this.vertices];
color[start] = 1;
Queue<Integer> queue = new LinkedList<>();
queue.add(start);
while (!queue.isEmpty()) {
int node = queue.poll();
System.out.println(node);
for (int adj : adjs[node]) {
if (color[adj] == 0) {
color[adj] = 1;
parent[adj] = node;
dist[adj] = dist[node] + 1;
queue.add(adj);
}
}
color[node] = 2;
}
}
public static void main(String args[]) {
BFS g = new BFS(4);
g.addEdge(0, 1);
g.addEdge(0, 2);
g.addEdge(1, 2);
g.addEdge(2, 0);
g.addEdge(2, 3);
g.addEdge(3, 3);
System.out.println("Following is Breadth First Traversal " + "(starting from vertex 2)");
g.bfs(2);
}
}
| [
"vbarakam@yahoo-inc.com"
] | vbarakam@yahoo-inc.com |
917d0a5cfe459e78108ec15bc829aeffe120c4b7 | 00bdd7d0db180bbb1eb4ca74aa0d294bdf85efca | /src/WebDriverArch/WebDriver.java | 7dd8f5878c1539ec40918b2864136f2e5d4ed394 | [] | no_license | naveenanimation20/March2021JavaSessions | 6fe192090a7cb151abc54566c51382a9d17a9532 | 6fea3b6d71b8943c0796302b2034ff07e7ffb5e0 | refs/heads/master | 2023-06-11T03:55:22.495595 | 2021-06-25T03:13:12 | 2021-06-25T03:13:12 | 380,110,396 | 2 | 6 | null | null | null | null | UTF-8 | Java | false | false | 381 | java | package WebDriverArch;
public interface WebDriver extends SearchContext{
public void get(String url);
public String getTitle();
public void close();
public void maximize();
public void click(String element);
public void sendKeys(String value);
@Override
public void findElement(String element);
@Override
public void findElements(String element);
}
| [
"naveenanimation20@gmail.com"
] | naveenanimation20@gmail.com |
3e44f3c31aeab1542ad25019834e5bc8d699b968 | 489d36dbbe727f94109a32101ddbc25fb25292a4 | /core/src/main/java/org/teavm/dependency/SuperArrayFilter.java | f532b177bb7b1558d79efde1a49acc6abbd814c7 | [
"Apache-2.0"
] | permissive | mahairod/teavm | 2ffd42135075ff842f5d648db22f66a7a5d290fc | b018e6161533278974b44edfcf8e8257e03f32fd | refs/heads/master | 2020-04-08T06:30:09.253055 | 2018-11-25T15:46:45 | 2018-11-25T15:46:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,587 | java | /*
* Copyright 2018 Alexey Andreev.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.teavm.dependency;
import org.teavm.model.ValueType;
class SuperArrayFilter implements DependencyTypeFilter {
private DependencyAnalyzer analyzer;
private DependencyTypeFilter itemTypeFilter;
SuperArrayFilter(DependencyAnalyzer analyzer, DependencyTypeFilter itemTypeFilter) {
this.analyzer = analyzer;
this.itemTypeFilter = itemTypeFilter;
}
@Override
public boolean match(DependencyType type) {
if (!type.getName().startsWith("[")) {
return false;
}
String typeName = type.getName().substring(1);
ValueType valueType = ValueType.parseIfPossible(typeName);
if (valueType == null || valueType instanceof ValueType.Primitive) {
return false;
}
if (valueType instanceof ValueType.Object) {
typeName = ((ValueType.Object) valueType).getClassName();
}
return itemTypeFilter.match(analyzer.getType(typeName));
}
}
| [
"Alexey.Andreev@jetbrains.com"
] | Alexey.Andreev@jetbrains.com |
a9f2b5e7d75f28d8429819d406eee0862b434183 | 78d9fb2f59c41dcd920febf0d5bb4a745fb1d3b8 | /Mall-master/owncode/src/main/java/com/nettactic/mall/activity/PaySuccessActivity.java | 92c60dfc6f0bb710fa99cffbd9a33e643c3f0b27 | [] | no_license | heshicaihao/Mall | a50a38f1d050a0d6d1c443269e7f811e053336d7 | c4be76671f89b19e7f20daa121d7406f08c3e01b | refs/heads/master | 2021-09-03T03:46:42.804421 | 2018-01-05T09:11:37 | 2018-01-05T09:11:37 | 116,361,172 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,761 | java | package com.nettactic.mall.activity;
import java.io.UnsupportedEncodingException;
import org.apache.http.Header;
import org.json.JSONException;
import org.json.JSONObject;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.loopj.android.http.AsyncHttpResponseHandler;
import com.nettactic.mall.R;
import com.nettactic.mall.WLMainActivity;
import com.nettactic.mall.base.BaseActivity;
import com.nettactic.mall.bean.UserBean;
import com.nettactic.mall.cache.ACache;
import com.nettactic.mall.common.MyApplication;
import com.nettactic.mall.common.UserController;
import com.nettactic.mall.constants.MyConstants;
import com.nettactic.mall.net.NetHelper;
import com.nettactic.mall.utils.AndroidUtils;
import com.nettactic.mall.utils.JSONUtil;
import com.nettactic.mall.utils.LogUtils;
import com.nettactic.mall.utils.StringUtils;
import com.nettactic.mall.utils.ToastUtils;
/**
*
* 支付成功界面
*
* @author heshicaihao
*
*/
@SuppressWarnings("deprecation")
public class PaySuccessActivity extends BaseActivity implements OnClickListener {
private TextView mTitle;
private ImageView mBack;
private TextView mPayModeValue;
private TextView mPayMoney;
private TextView mDepositPayName;
private TextView mDepositPayValue;
private TextView mOtherPayName;
private TextView mOtherPayValue;
private LinearLayout mDepositPayLL;
private LinearLayout mOtherPayLL;
private Button mGotoHome;
private Button mOrderIdLL;
private String mOutTradeNo;
private ACache mCache;
private UserBean mUser;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pay_success);
initView();
initData();
}
private void initView() {
mBack = (ImageView) findViewById(R.id.back);
mTitle = (TextView) findViewById(R.id.title);
mPayModeValue = (TextView) findViewById(R.id.pay_mode_value);
mPayMoney = (TextView) findViewById(R.id.pay_value);
mGotoHome = (Button) findViewById(R.id.goto_home);
mOrderIdLL = (Button) findViewById(R.id.order_id_ll);
mDepositPayName = (TextView) findViewById(R.id.deposit_pay_name);
mDepositPayValue = (TextView) findViewById(R.id.deposit_pay_value);
mOtherPayName = (TextView) findViewById(R.id.other_pay_name);
mOtherPayValue = (TextView) findViewById(R.id.other_pay_value);
mDepositPayLL = (LinearLayout) findViewById(R.id.deposit_pay_ll);
mOtherPayLL = (LinearLayout) findViewById(R.id.other_pay_ll);
mTitle.setText(R.string.pay_success);
mOrderIdLL.setOnClickListener(this);
mGotoHome.setOnClickListener(this);
mBack.setOnClickListener(this);
}
private void initData() {
mCache = ACache.get(this);
mOutTradeNo = mCache.getAsString(MyConstants.ORDERID);
mUser = UserController.getInstance(this).getUserInfo();
getOrderInfo();
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.goto_home:
gotoMainActivity();
break;
case R.id.order_id_ll:
gotoOrderDetailsActivity();
break;
case R.id.back:
AndroidUtils.finishActivity(this);
break;
default:
break;
}
}
private void gotoMainActivity() {
Intent intent = new Intent(this, WLMainActivity.class);
startActivity(intent);
AndroidUtils.enterActvityAnim(this);
}
private void gotoOrderDetailsActivity() {
Intent intent = new Intent(this, OrderDetailsActivity.class);
intent.putExtra("mOutTradeNo", mOutTradeNo);
startActivity(intent);
AndroidUtils.enterActvityAnim(this);
}
private void getOrderInfo() {
NetHelper.getOrderDetail(mUser.getId(), mUser.getToken(), mOutTradeNo,
new AsyncHttpResponseHandler() {
@Override
public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
LogUtils.logd(TAG, "onSuccess");
resolveOrderDetail(arg2);
}
@Override
public void onFailure(int arg0, Header[] arg1, byte[] arg2,
Throwable arg3) {
LogUtils.logd(TAG, "onFailure");
}
});
}
private void resolveOrderDetail(byte[] responseBody) {
try {
String json = new String(responseBody, "UTF-8");
LogUtils.logd(TAG, "json:" + json);
JSONObject result = JSONUtil.resolveResult(responseBody);
if (result != null) {
JSONObject order = result.optJSONObject("order");
showInfo(order);
} else {
JSONObject JSONObject = new JSONObject(json);
String msg = JSONObject.optString("msg");
ToastUtils.show(msg);
AndroidUtils.finishActivity(this);
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
}
}
private void showInfo(JSONObject order) throws JSONException {
JSONObject total = order.optJSONObject("total");
String mTotalStr = total.optString("total_amount");
String total_amount2p = StringUtils.format2point(mTotalStr);
String totalmoneyStr = total_amount2p
+ MyApplication.getContext().getString(R.string.yuan);
mPayMoney.setText(totalmoneyStr);
String paymodeStr = "";
String deposit_pay_name = "";
String deposit_pay_value = "";
String other_pay_name = "";
String other_pay_value = "";
JSONObject deposit_pay = order.optJSONObject("other_pay");
if (deposit_pay != null) {
deposit_pay_name = deposit_pay.optString("payname");
String deposit_pay_valueStr = deposit_pay.optString("amount");
deposit_pay_value = StringUtils.format2point(deposit_pay_valueStr)
+ MyApplication.getContext().getString(R.string.yuan);
}
JSONObject other_pay = order.optJSONObject("payinfo");
if (other_pay != null) {
other_pay_name = other_pay.optString("payname");
String other_pay_valueStr = other_pay.optString("amount");
other_pay_value = StringUtils.format2point(other_pay_valueStr)
+ MyApplication.getContext().getString(R.string.yuan);
}
if (!StringUtils.isEmpty(deposit_pay_name)
&& StringUtils.isEmpty(other_pay_name)) {
paymodeStr = deposit_pay_name;
mDepositPayName.setText(deposit_pay_name);
mDepositPayValue.setText(deposit_pay_value);
mDepositPayLL.setVisibility(View.VISIBLE);
mOtherPayLL.setVisibility(View.GONE);
mPayModeValue.setText(paymodeStr);
mPayModeValue.setVisibility(View.VISIBLE);
} else if (StringUtils.isEmpty(deposit_pay_name)
&& !StringUtils.isEmpty(other_pay_name)) {
paymodeStr = other_pay_name;
mOtherPayName.setText(other_pay_name);
mOtherPayValue.setText(other_pay_value);
mOtherPayLL.setVisibility(View.VISIBLE);
mDepositPayLL.setVisibility(View.GONE);
mPayModeValue.setText(paymodeStr);
mPayModeValue.setVisibility(View.VISIBLE);
} else if (!StringUtils.isEmpty(deposit_pay_name)
&& !StringUtils.isEmpty(other_pay_name)) {
paymodeStr = deposit_pay_name + "+" + other_pay_name;
mDepositPayName.setText(deposit_pay_name);
mDepositPayValue.setText(deposit_pay_value);
mDepositPayLL.setVisibility(View.VISIBLE);
mOtherPayName.setText(other_pay_name);
mOtherPayValue.setText(other_pay_value);
mOtherPayLL.setVisibility(View.VISIBLE);
mPayModeValue.setText(paymodeStr);
mPayModeValue.setVisibility(View.VISIBLE);
} else if (StringUtils.isEmpty(deposit_pay_name)
&& StringUtils.isEmpty(other_pay_name)) {
mDepositPayLL.setVisibility(View.GONE);
mOtherPayLL.setVisibility(View.GONE);
mPayModeValue.setVisibility(View.GONE);
}
}
}
| [
"heshicaihao@163.com"
] | heshicaihao@163.com |
33df469ab5fe9a01f2df889b0eedc5d2947fa2ec | 359143d25276b10b2479b2394c404043da2a50b0 | /src/main/java/com/wangfengbabe/designpattern/structural/decorator/pizza/FarmHouse.java | a2776083ba6d465795689e7df0d1eb06ee867b53 | [] | no_license | easyfool/learn-patterns | 7d45c07dc5776cdc370ccf9bb3e839e888d9dbc1 | 1a6bdac5aab0c614d5e6724cb9c3fee97421fbdf | refs/heads/master | 2021-10-09T15:55:50.106771 | 2018-12-31T14:09:00 | 2018-12-31T14:09:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 275 | java | package com.wangfengbabe.designpattern.structural.decorator.pizza;
/**
* Created by wangfeng on 11/09/2017.
*/
public class FarmHouse extends Pizza {
@Override
public double getCost() {
return 200;
}
public FarmHouse() {
description = "FarmHouse";
}
}
| [
"wangfengbabe@163.com"
] | wangfengbabe@163.com |
64ee91ff6399a2c0a8535a5b361723844ab81a9f | 12923605cb54ae6b9b64647f1d099cbe1517d06f | /Buzzbux/src/com/felicekarl/buzzbux/presenters/tasks/LogInTask.java | 89428cfda11698c65f7c3247285932a47c8aa938 | [] | no_license | happykarl/BuzzBux | 5eb9ce146a4ce5b7d3fa23cfd27bd87fd90a22ce | a2cc9864b8db503493014411de29f947dcf2aa7d | refs/heads/master | 2021-01-23T12:05:12.703138 | 2014-04-05T23:09:50 | 2014-04-05T23:09:50 | 17,921,261 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,380 | java | package com.felicekarl.buzzbux.presenters.tasks;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import com.felicekarl.buzzbux.presenters.Network;
import android.os.AsyncTask;
/**
* LogInTask.
* @author Karl
*
*/
public class LogInTask extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... params) {
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(params[0]);
String jsonResult = "";
/* add post data*/
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(params.length - 1);
nameValuePairs.add(new BasicNameValuePair(Network.TAG_OMA_USER_USERNAME, params[1]));
nameValuePairs.add(new BasicNameValuePair(Network.TAG_OMA_USER_PASSWORD, params[2]));
try {
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
jsonResult = inputStreamToString(response.getEntity().getContent()).toString();
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return jsonResult;
}
/**
* String builder from InputStream.
* @param is inputStream
* @return built String
*/
private StringBuilder inputStreamToString(InputStream is) {
String rLine = "";
StringBuilder answer = new StringBuilder();
BufferedReader rd = new BufferedReader(new InputStreamReader(is));
try {
while ((rLine = rd.readLine()) != null) {
answer.append(rLine);
}
} catch (IOException e) {
e.printStackTrace();
}
return answer;
}
}
| [
"felicekarl@gmail.com"
] | felicekarl@gmail.com |
6b7abbe129d0cd98fc613c3374799a3502d25e31 | 425fa43be1da3ab67e03e8b9faba6642eb22adaf | /equinox/build-tmp/source/equinox.java | 950a25233d945f4e2c6db8c0378063a6262131ac | [] | no_license | radiodario/processing-stuff | 95191b4d1e4215d14b936cbefb0fb5aff9324ccd | 3ff10f8d5600dca154f29b7895a1460dfcf6b463 | refs/heads/master | 2021-01-15T15:46:35.415146 | 2016-09-06T08:49:20 | 2016-09-06T08:49:20 | 32,917,143 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,029 | java | import processing.core.*;
import processing.data.*;
import processing.event.*;
import processing.opengl.*;
import remixlab.proscene.*;
import remixlab.dandelion.core.*;
import remixlab.dandelion.geom.*;
import processing.pdf.*;
import java.util.HashMap;
import java.util.ArrayList;
import java.io.File;
import java.io.BufferedReader;
import java.io.PrintWriter;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;
public class equinox extends PApplet {
// Equinox - a sun - earth simulation of truth and beauty.
float easing = 1;
boolean showorbit = true;
Scene scene;
PShader lightShader;
Orbiter moon;
Orbiter earth;
boolean record = false;
boolean followEarth = false;
// measurements
// sun radius: 695800 km
// earth orbit: 149597871 km
// earth radius: 6371 km
// moon orbit: 384400 km
// moon radius: 1736 km
// do everything in sunRadius
float scalee = 0.0001f;
float sunRadius = 695500.0f * scalee;
float earthRadius = 6371.0f * scalee;
float earthOrbit = 149597871.0f * scalee;
float moonOrbit = 384400.0f * scalee;
float moonRadius = 1736.0f * scalee;
float angle = 0;
public void setup() {
println(scalee + "," + sunRadius + "," + earthRadius + "," + earthOrbit);
size(1920, 1080, P3D);
// size(3508, 2480, P3D);
smooth();
frameRate(60);
scene = new Scene(this);
scene.setAxesVisualHint(false);
scene.eye().frame().setDampingFriction(0.5f);
scene.setRadius(earthOrbit+moonOrbit);
scene.showAll();
// frustum(-1000, 1000, 1000, -1000, -10000, 10000);
perspective(1, 2, 1, earthOrbit + moonOrbit);
// ortho(-earthOrbit*2, earthOrbit*2, earthOrbit, -earthOrbit, -earthOrbit*0.1, earthOrbit );
colorMode(HSB);
lights();
lightShader = loadShader("lightfrag.glsl", "lightvert.glsl");
moon = new Orbiter(0.02f, 0.001f, moonOrbit, moonRadius, 1, 1, earthRadius);
earth = new Orbiter(0.001f, 0.001f, earthOrbit, earthRadius, 1, 1, moonOrbit/2);
}
public void update() {
earth.orbit(0, 0);
moon.orbit(earth);
}
public void draw() {
update();
if (record) {
// Note that #### will be replaced with the frame number. Fancy!
// beginRecord(PDF, "frame-####.pdf");
}
background(0);
shader(lightShader);
directionalLight(255,255,255, 0, 0, 0);
drawSun();
earth.draw();
moon.draw();
if (followEarth) {
followEarthMode();
}
if (record) {
// endRecord();
saveFrame("frame-######.png");
record = false;
}
}
public void drawSun() {
pushStyle();
noFill();
stroke(40, 255, 255);
pushMatrix();
rotateX(PI/2);
rotateY(angle += 0.0001f);
sphereDetail(15);
sphere(sunRadius);
popMatrix();
popStyle();
}
public void followEarthMode() {
}
public void keyPressed() {
if (key == '1') {
// cam.lookAt(earth.xr, earth.yr, 0, moonOrbit);
scene.setAvatar(earth.frame);
scene.setMouseAsThirdPerson();
scene.motionAgent().setDefaultGrabber(earth.frame);
scene.motionAgent().disableTracking();
}
if (key == '2') {
// cam.lookAt(earth.xr, earth.yr, 0, moonOrbit);
scene.setAvatar(moon.frame);
scene.setMouseAsThirdPerson();
scene.motionAgent().setDefaultGrabber(moon.frame);
scene.motionAgent().disableTracking();
}
if (key == '3') {
scene.unsetAvatar();
scene.setMouseAsArcball();
scene.motionAgent().setDefaultGrabber(scene.eye().frame());
scene.motionAgent().enableTracking();
scene.camera().interpolateToFitScene();
}
if (key == 'r' || key == 'R') {
record = true;
}
if (key == 'o' || key == 'O') {
showorbit = !showorbit;
}
}
class Orbiter {
InteractiveAvatarFrame frame;
float speed; //Angular velocity of the orbs
float radius = width/3; //Base radius of the orbit
float modX, modY; //Modifiers for the roundness of the orbit
float angle;
float targetX; //mouseX
float targetY; //mouseY
float planetRadius;
float rotationalSpeed;
float x; //Mouse follower x
float y; //Mouse follower y
float xr, yr; //Coordinates where the orbs should be
float rotationalAngle = 0;
int colour = color(255, 0, 255);
Orbiter(float orbitSpeed, float rotationalSpeed, float orbitRadius, float planetRadius, float modX, float modY, float trackingRadius) {
frame = new InteractiveAvatarFrame(scene);
frame.setPosition(new Vec(xr, yr, 0));
frame.setAzimuth(QUARTER_PI);
frame.setInclination(PI*(1/5));
frame.setTrackingDistance(trackingRadius);
this.speed = orbitSpeed;
this.rotationalSpeed = rotationalSpeed;
this.radius = orbitRadius;
this.planetRadius = planetRadius;
this.modX = modX;
this.modY = modY;
}
public void orbit(Orbiter target) {
this.x = target.xr;
this.y = target.yr;
this.targetX = target.xr;
this.targetY = target.yr;
calculateOrbit();
}
public void orbit(float targetX, float targetY) {
this.targetX = targetX;
this.targetY = targetY;
calculateOrbit();
}
public void calculateOrbit() {
//Creates the mouse follower effect
float dx = targetX - x;
if (abs(dx) > 1) {
x += dx * easing;
}
float dy = targetY - y;
if (abs(dy) > 1) {
y += dy * easing;
}
//Calculates the x and y coordinates of the rotating orb
xr = x + (radius / modX) * cos(radians(angle));
yr = y + (radius / modY) * sin(radians(angle));
angle += speed % 360;
frame.setPosition(new Vec(xr, yr, 0));
}
public void draw() {
//Line connecting mouse follower to orbs
// stroke(colour);
// strokeWeight(0.5);
// line(xr, yr, x, y);
//Orbs
fill(colour);
strokeWeight(1);
stroke(244);
noFill();
pushMatrix();
translate(xr, yr);
pushMatrix();
rotateX(PI/2);
rotateY(rotationalAngle += rotationalSpeed);
sphere(planetRadius);
popMatrix();
popMatrix();
//Outer ellipse of the mouse follower
stroke(colour);
strokeWeight(1);
noFill();
ellipse(x,y,20,20);
//Inner ellipse of the mouse follower
// fill(colour);
// strokeWeight(1);
// ellipse(x,y,5,5);
//Line connecting mouse cursor to orbs
stroke(colour);
strokeWeight(0.5f);
line(xr, yr, targetX, targetY);
//Orbit trails
if(showorbit) {
strokeWeight(1);
noFill();
ellipse(x,y,(radius / modX) * 2, (radius / modY) * 2);
}
// //Mouse Cursor
// strokeWeight(1);
// fill(colour);
// ellipse(targetX, targetY, 10, 10);
}
//Accelerates clockwise
public void speedup() {
speed++;
}
//Accelerates counter clockwise
public void slowdown() {
speed--;
}
//Enlarges the radius
public void enlarge() {
radius += 20;
}
//Shrinks the radius
public void shrink() {
radius -= 20;
}
}
static public void main(String[] passedArgs) {
String[] appletArgs = new String[] { "equinox" };
if (passedArgs != null) {
PApplet.main(concat(appletArgs, passedArgs));
} else {
PApplet.main(appletArgs);
}
}
}
| [
"dario.villanueva@gmail.com"
] | dario.villanueva@gmail.com |
d4743ea43e4e8670c8828d041795c2a0fa9982d7 | b9abdf482787f7b7a2077ab517041552e4f8f20d | /src/test/java/practice3/ModelTest.java | b387694c14b913231db43a3ffb28e34bb33b71a5 | [] | no_license | andrewsb108/practice_3_guessingNumberGame | 9887ee2179fdf06305286efd1f8ae777e6b64144 | 8ea19a1136f034094d0a289d28551eaf4f33de3b | refs/heads/main | 2023-06-04T10:40:15.622713 | 2021-07-01T11:16:43 | 2021-07-01T11:16:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,676 | java | package practice3;
import org.junit.Before;
import org.junit.Test;
import java.lang.reflect.Field;
import static org.junit.Assert.*;
public class ModelTest {
private Model model;
private Field secretNumber;
@Before
public void setUp() throws Exception {
model = new Model();
secretNumber = model.getClass().getDeclaredField("secretValue");
secretNumber.setAccessible(true);
model.setPrimaryBarrier(model.getPRIMARY_MIN_BARRIER(), model.getPRIMARY_MAX_BARRIER());
}
@Test
public void shouldRandomizeNumber_whenChangeInputNumber() throws IllegalAccessException {
int oldNumber = -1;
secretNumber.set(model, -1);
model.setSecretValue();
int newNumber = (int) secretNumber.get(model);
assertNotEquals(oldNumber, newNumber);
}
@Test
public void shouldRandomizeNumber_whenInRange() {
model.setSecretValue();
assertEquals(0, model.getMinBarrier());
assertEquals(100, model.getMaxBarrier());
}
@Test
public void shouldCheckNumber_whenNumberIsEqualAndReturnFalse() throws IllegalAccessException {
model.setSecretValue();
int orderedValue = 90;
secretNumber.set(model, orderedValue);
boolean res = model.checkValue(orderedValue);
assertFalse(res);
}
@Test
public void shouldCheckNumber_whenUseSmallerNumberAndReturnTrue() throws IllegalAccessException {
model.setSecretValue();
int orderedValue = 30;
secretNumber.set(model, orderedValue);
boolean res = model.checkValue(orderedValue - 10);
assertTrue(res);
}
@Test
public void shouldCheckNumber_whenUseGreaterNumberAndReturnTrue() throws IllegalAccessException {
model.setSecretValue();
int orderedValue = 30;
secretNumber.set(model, orderedValue);
boolean res = model.checkValue(orderedValue + 10);
assertTrue(res);
}
@Test
public void shouldCheckIfNumbersInRangeUsingLoopAndReturnTrue() {
for (int i = 0; i < 10000; i++) {
model.setSecretValue();
int guessedNumber = model.getSecretValue();
boolean inRangeValue = guessedNumber > model.getMinBarrier() && guessedNumber < model.getMaxBarrier();
assertTrue(inRangeValue);
}
}
@Test
public void shouldCheckValueAndReturnTrue() {
boolean value = model.checkValue(10);
assertTrue(value);
}
@Test
public void shouldSetMinAndMaxBorders() {
String expectedBound = "10 to 20";
assertEquals(expectedBound, model.setPrimaryBarrier(10, 20));
}
} | [
"andrey.barsuk1@gmail.com"
] | andrey.barsuk1@gmail.com |
43bfa49fc3df9764118ca4be3b8511c4ec1b4d20 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/8/8_63275a81f2ea9c2576fe01b2cb67e2f1ee45555c/ActivitySimulacion/8_63275a81f2ea9c2576fe01b2cb67e2f1ee45555c_ActivitySimulacion_s.java | d29e046f72c678ffe94a27ec985ac87f32dbe0a5 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 19,485 | java | package com.example.campomagnetico;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Collections;
import Apartados.Apartado;
import Apartados.Datos;
import Apartados.GestoraInformacion;
import Apartados.Medida;
import android.os.Bundle;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Resources;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TabHost;
import android.widget.TextView;
import android.widget.Toast;
public class ActivitySimulacion extends Activity {
protected Intent intent;
/** Un seekBar por apartado*/
protected SeekBar seekbarA;
protected SeekBar seekbarB;
protected SeekBar seekbarC;
/** Un Textview por seekbar */
protected TextView seektextA;
protected TextView seektextB;
protected TextView seektextC;
/** Un Textview por apartado*/
protected TextView tesla1;
protected TextView tesla2;
protected TextView tesla3;
/** Un boton por apartado */
protected Button tomarMedA;
protected Button tomarMedB;
protected Button tomarMedC;
/** Un boton para ordenar las medidas por apartado */
protected Button ordenarA;
protected Button ordenarB;
protected Button ordenarC;
/** Un Array de Medidas por apartado */
protected Datos datosA = new Datos(1);
protected Datos datosB = new Datos(2);
protected Datos datosC = new Datos(3);
protected TabHost tabs;
// Adaptadores de las tablas
protected Adapter_Tabla_Apar1 adaptador_apartado1;
protected Adapter_Tabla adaptador_apartado2;
protected Adapter_Tabla adaptador_apartado3;
protected Adapter_Cabecera_Tabla_1 adaptador_cabecera1;
protected Adapter_Cabecera_Tabla adaptador_cabecera2;
protected Adapter_Cabecera_Tabla adaptador_cabecera3;
//ListView's
protected ListView lista_apartado1;
protected ListView lista_apartado2;
protected ListView lista_apartado3;
protected ListView cabecera_apartado1;
protected ListView cabecera_apartado2;
protected ListView cabecera_apartado3;
//Activit actual
protected Activity activity;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_simulacion);
//Si existen datos en los arrays de la gestora de informacion se los asignamos a los arrays de esta clase
if (!GestoraInformacion.getDatosA().isEmpty()){
datosA.setArrayDatos(GestoraInformacion.getDatosA());
}
if (!GestoraInformacion.getDatosB().isEmpty()){
datosB.setArrayDatos(GestoraInformacion.getDatosB());
}
if (!GestoraInformacion.getDatosC().isEmpty()){
datosC.setArrayDatos(GestoraInformacion.getDatosC());
}
activity = this;
//Inicializacion de los componentes de las listas
lista_apartado1 = (ListView)findViewById(R.id.lvApartado1);
lista_apartado2 = (ListView)findViewById(R.id.lvApartado2);
lista_apartado3 = (ListView)findViewById(R.id.lvApartado3);
//Asignamos los adaptadores (si hace en cada ejecion del evento del boton se sobrecarga)
adaptador_apartado1 = new Adapter_Tabla_Apar1(activity, datosA.get_array());
lista_apartado1.setAdapter(adaptador_apartado1);
adaptador_apartado2 = new Adapter_Tabla(activity, datosB.get_array());
lista_apartado2.setAdapter(adaptador_apartado2);
adaptador_apartado3 = new Adapter_Tabla(activity, datosC.get_array());
lista_apartado3.setAdapter(adaptador_apartado3);
//Inicializacion de las lista que funcionana como cabeceras
cabecera_apartado1 = (ListView)findViewById(R.id.lvCabecera1);
cabecera_apartado2 = (ListView)findViewById(R.id.lvCabecera2);
cabecera_apartado3 = (ListView)findViewById(R.id.lvCabecera3);
//Creacion de las cabeceras
ArrayList<String> cabecera1 = new ArrayList<String>();
cabecera1.add("Intensidad(mA)-Intensidad_C(A)-Campo(T)");
adaptador_cabecera1 = new Adapter_Cabecera_Tabla_1(activity, cabecera1);
cabecera_apartado1.setAdapter(adaptador_cabecera1);
ArrayList<String> cabecera23 = new ArrayList<String>();
cabecera23.add("Intensidad(mA):Campo(T)");
adaptador_cabecera2 = new Adapter_Cabecera_Tabla(activity, cabecera23);
cabecera_apartado2.setAdapter(adaptador_cabecera2);
adaptador_cabecera3 = new Adapter_Cabecera_Tabla(activity, cabecera23);
cabecera_apartado3.setAdapter(adaptador_cabecera3);
//Tabs
Resources res = getResources();
tabs=(TabHost)findViewById(android.R.id.tabhost);
tabs.setup();
TabHost.TabSpec spec=tabs.newTabSpec("tab1");
spec.setContent(R.id.tabConductorA);
spec.setIndicator("Conductor A", res.getDrawable(android.R.drawable.ic_dialog_map));
tabs.addTab(spec);
spec=tabs.newTabSpec("tab2");
spec.setContent(R.id.tabConductorB);
spec.setIndicator("Conductor B", res.getDrawable(android.R.drawable.ic_dialog_map));
tabs.addTab(spec);
spec=tabs.newTabSpec("tab3");
spec.setContent(R.id.tabConductorC);
spec.setIndicator("Conductor C", res.getDrawable(android.R.drawable.ic_dialog_map));
tabs.addTab(spec);
tabs.setCurrentTab(0);
//Fin Tabs
//Inicializacion de teslamometros
final Apartado apartado1 = new Apartado(1);
final Apartado apartado2 = new Apartado(2);
final Apartado apartado3 = new Apartado(3);
//Fin Teslamometros
tomarMedA = (Button) findViewById(R.id.buttonA);
tomarMedB = (Button) findViewById(R.id.buttonB);
tomarMedC = (Button) findViewById(R.id.buttonC);
//Botones
tomarMedA.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
int progress = seekbarA.getProgress();
Medida medA = new Medida(progress * 5, apartado1.getB(progress*5), progress * 5 * 2);
datosA.add_dato(medA);
GestoraInformacion.setDatosA(datosB.get_array());
adaptador_apartado1.notifyDataSetChanged();
}
});
tomarMedB.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
int progress = seekbarB.getProgress();
BigDecimal prog = new BigDecimal(-0.04 + 0.0025 * progress);
prog = prog.setScale(5, RoundingMode.HALF_UP);
double progDouble = prog.doubleValue();
Medida medB = new Medida(progDouble, apartado2.getB(progDouble));
datosB.add_dato(medB);
GestoraInformacion.setDatosB(datosB.get_array());
adaptador_apartado2.notifyDataSetChanged();
}
});
tomarMedC.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
int progress = seekbarC.getProgress();
BigDecimal prog = new BigDecimal(-0.04 + 0.0025 * progress);
prog = prog.setScale(5, RoundingMode.HALF_UP);
double progDouble = prog.doubleValue();
Medida medC = new Medida(progDouble, apartado2.getB(progDouble));
datosC.add_dato(medC);
GestoraInformacion.setDatosC(datosC.get_array());
adaptador_apartado3.notifyDataSetChanged();
}
});
//Fin Botones
//Botones Ordenar
ordenarA = (Button) findViewById(R.id.btnOrdenarA);
ordenarB = (Button) findViewById(R.id.btnOrdenarB);
ordenarC = (Button) findViewById(R.id.btnOrdenarC);
ordenarA.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Collections.sort(datosA.get_array(), new ComparadorMedidas());
GestoraInformacion.setDatosA(datosA.get_array());
adaptador_apartado1.notifyDataSetChanged();
}
});
ordenarB.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Collections.sort(datosB.get_array(), new ComparadorMedidas());
GestoraInformacion.setDatosB(datosB.get_array());
adaptador_apartado2.notifyDataSetChanged();
}
});
ordenarC.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Collections.sort(datosC.get_array(), new ComparadorMedidas());
GestoraInformacion.setDatosC(datosC.get_array());
adaptador_apartado3.notifyDataSetChanged();
}
});
//Seekbars y sus textview asociados
seekbarA = (SeekBar) findViewById(R.id.seekBarA);
seektextA = (TextView) findViewById(R.id.textSeekA);
tesla1 = (TextView) findViewById(R.id.Tesla1);
seekbarA.setOnSeekBarChangeListener(new OnSeekBarChangeListener(){
@Override
/**
* Evento encargado del control del estado del seekbar
*/
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser) {
// TODO Añadir una variable global que tenga el contenido?
seektextA.setText("" + (progress*5) + " mA");
if(progress == 0){
tesla1.setText("0 (T)");
}else{
tesla1.setText(""+ apartado1.getB(progress*5) + " (mT)");
}
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// Nada que hacer
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// Nada que hacer
}
});
seekbarB = (SeekBar) findViewById(R.id.seekBarB);
seektextB = (TextView) findViewById(R.id.textSeekB);
tesla2 = (TextView) findViewById(R.id.Tesla2);
seekbarB.setOnSeekBarChangeListener(new OnSeekBarChangeListener(){
@Override
/**
* Evento encargado del control del estado del seekbar
*/
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser) {
BigDecimal prog = new BigDecimal(-0.04 + 0.0025 * progress);
prog = prog.setScale(5, RoundingMode.HALF_UP);
// TODO Añadir una variable global que tenga el contenido?
seektextB.setText("" + (prog.multiply(new BigDecimal(100)).doubleValue()) + " cm");
tesla2.setText(""+ apartado2.getB(prog.doubleValue()) + " (mT)");
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// Nada que hacer
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// Nada que hacer
}
});
seekbarC = (SeekBar) findViewById(R.id.seekBarC);
seektextC = (TextView) findViewById(R.id.textSeekC);
tesla3 = (TextView) findViewById(R.id.Tesla3);
seekbarC.setOnSeekBarChangeListener(new OnSeekBarChangeListener(){
@Override
/**
* Evento encargado del control del estado del seekbar
*/
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser) {
BigDecimal prog = new BigDecimal(-0.04 + 0.0025 * progress);
prog = prog.setScale(5, RoundingMode.HALF_UP);
// TODO Añadir una variable global que tenga el contenido?
seektextC.setText("" + (prog.multiply(new BigDecimal(100)).doubleValue()) + " cm");
tesla3.setText(""+ apartado3.getB(prog.doubleValue()) + " (mT)");
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// Nada que hacer
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// Nada que hacer
}
});
//Fin SeekViews
//Logica borar una medicion
this.registerForContextMenu(lista_apartado1);
lista_apartado1.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> arg0, View v, int position, long arg3) {
final int pos = position;
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder
.setTitle("Borrar medida")
.setMessage("�Seguro que quieres borrar la medida seleccionada?")
.setIcon(android.R.drawable.ic_dialog_alert)
.setPositiveButton("Si", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
datosA.get_array().remove(pos);
GestoraInformacion.setDatosA(datosA.get_array());
adaptador_apartado1.notifyDataSetChanged();
}
})
.setNegativeButton("No", null)
.show();
return false;
}
});
this.registerForContextMenu(lista_apartado2);
lista_apartado2.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> arg0, View v, int position, long arg3) {
final int pos = position;
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder
.setTitle("Borrar medida")
.setMessage("�Seguro que quieres borrar la medida seleccionada?")
.setIcon(android.R.drawable.ic_dialog_alert)
.setPositiveButton("Si", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
datosB.get_array().remove(pos);
GestoraInformacion.setDatosB(datosB.get_array());
adaptador_apartado2.notifyDataSetChanged();
}
})
.setNegativeButton("No", null)
.show();
return false;
}
});
this.registerForContextMenu(lista_apartado3);
lista_apartado3.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> arg0, View v, int position, long arg3) {
final int pos = position;
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder
.setTitle("Borrar medida")
.setMessage("�Seguro que quieres borrar la medida seleccionada?")
.setIcon(android.R.drawable.ic_dialog_alert)
.setPositiveButton("Si", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
datosC.get_array().remove(pos);
GestoraInformacion.setDatosC(datosC.get_array());
adaptador_apartado3.notifyDataSetChanged();
}
})
.setNegativeButton("No", null)
.show();
return false;
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_simulacion, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_csv:
//Almaceno el resultado de la creacion del CSV
int resultado = 100;
if (tabs.getCurrentTabTag().equals("tab1")){
if (datosA.get_array().isEmpty()){
resultado = 5;
}else{
resultado = datosA.exportar_csv();
}
}else if (tabs.getCurrentTabTag().equals("tab2")){
if (datosB.get_array().isEmpty()){
resultado = 5;
}else{
resultado = datosB.exportar_csv();
}
}else if (tabs.getCurrentTabTag().equals("tab3")){
if (datosC.get_array().isEmpty()){
resultado = 5;
}else{
resultado = datosC.exportar_csv();
}
}
if (resultado == 1){
Toast.makeText(activity, "No se ha encontrado el\nalmacemiento externo (SD)", Toast.LENGTH_LONG).show();
}else if (resultado == 2){
Toast.makeText(activity, "Existe un archivo con el mismo nombre que la carpeta. "
+ "Por favor borre o renombre el archivo", Toast.LENGTH_LONG).show();
}else if (resultado == 3){
Toast.makeText(activity, "No se ha podido crear el archivo", Toast.LENGTH_LONG).show();
}else if (resultado == 4){
Toast.makeText(activity, "No se soporta el encoding de archivo", Toast.LENGTH_LONG).show();
}else if (resultado == 0){
Toast.makeText(activity, "Archivo guardado en la SD", Toast.LENGTH_LONG).show();
}else if (resultado == 5){
Toast.makeText(activity, "No has tomado ninguna medida en este apartado\nHaz alguna medicion antes de exportarlas", Toast.LENGTH_LONG).show();
}else {
Toast.makeText(activity, "La verdad, no se como has llegado a aqui!", Toast.LENGTH_LONG).show();
}
return true;
case R.id.action_inicio:
onBackPressed();
return true;
case R.id.action_acercaDe:
intent = new Intent("acerca_de");
startActivity(intent);
return true;
case R.id.action_borrar_datos:
if (tabs.getCurrentTabTag().equals("tab1")){
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder
.setTitle("Borrar Todas las Medidas")
.setMessage("�Seguro que quieres borrar todas las medidas de este apartado?")
.setIcon(android.R.drawable.ic_dialog_alert)
.setPositiveButton("Si", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
datosA.get_array().clear();
GestoraInformacion.setDatosA(datosA.get_array());
adaptador_apartado1.notifyDataSetChanged();
}
})
.setNegativeButton("No", null)
.show();
return false;
}else if (tabs.getCurrentTabTag().equals("tab2")){
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder
.setTitle("Borrar Todas las Medidas")
.setMessage("�Seguro que quieres borrar todas las medidas de este apartado?")
.setIcon(android.R.drawable.ic_dialog_alert)
.setPositiveButton("Si", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
datosB.get_array().clear();
GestoraInformacion.setDatosB(datosB.get_array());
adaptador_apartado2.notifyDataSetChanged();
}
})
.setNegativeButton("No", null)
.show();
return false;
}else if (tabs.getCurrentTabTag().equals("tab3")){
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder
.setTitle("Borrar Todas las Medidas")
.setMessage("�Seguro que quieres borrar todas las medidas de este apartado?")
.setIcon(android.R.drawable.ic_dialog_alert)
.setPositiveButton("Si", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
datosC.get_array().clear();
GestoraInformacion.setDatosC(datosC.get_array());
adaptador_apartado3.notifyDataSetChanged();
}
})
.setNegativeButton("No", null)
.show();
return false;
}
return true;
default:
return super.onOptionsItemSelected(item);
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
483b3f798bd53de338469f9d678b0c3262810243 | d9affe77484d81e93226f791538360c54cc73fc4 | /DMS/src/com/dms/ui/Login.java | f84d9e561cea1895a54e886d40de0230262516b7 | [] | no_license | tangxianji/JDBC | 56dce5854c5f3f016b507344422e1fb933db19c0 | c110315d82761dd394dc933b67550814d50dba6e | refs/heads/master | 2022-11-09T07:43:27.149517 | 2019-01-15T16:08:56 | 2019-01-15T16:11:12 | 272,858,900 | 0 | 0 | null | 2020-06-17T02:24:58 | 2020-06-17T02:24:57 | null | UTF-8 | Java | false | false | 11,673 | java | package com.dms.ui;
import java.awt.Color;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.border.EmptyBorder;
import javax.swing.text.JTextComponent;
import org.jb2011.lnf.beautyeye.ch3_button.BEButtonUI;
import com.dms.information.LoginInfo;
import com.dms.mydatabase.DB;
import com.dms.myexceptioin.DataBaseException;
import com.dms.myexceptioin.QueryResultIsNullException;
public class Login extends JFrame implements FocusListener,KeyListener,ActionListener{
private static final long serialVersionUID = 1L;
private JPanel Login_Pane;
private JTextField Account_Field;
private JPasswordField Pwd_Field;
private JFrame sr = this;
private JButton Login_Btn ;
private JLabel Login_Img;
private ImageIcon image;
private JRadioButton Type_Student;
private JRadioButton Type_Manager;
private ButtonGroup Radio_Group;
private String selected="Student";
/**
* 登录系统
*/
public Login() {
initialize();
}
public void initialize(){
//全体设置
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setIconImage(Toolkit.getDefaultToolkit().getImage(Login.class.getResource("/MyImage/Icon.png")));
setTitle("Dormitory Management System");
setBounds(800, 300, 600, 500);
Login_Pane = new JPanel();
Login_Pane.setBorder(new EmptyBorder(0, 0, 0, 0));
setContentPane(Login_Pane);
Login_Pane.setLayout(null);
Account_Field = new JTextField();
Pwd_Field = new JPasswordField();
Account_Field.setFont(new Font("Myriad", Font.PLAIN, 17));
Pwd_Field.setFont(new Font("Myriad", Font.PLAIN, 17));
// Account_Field.setColumns(10);
setResizable(false);
//设置圆角边框
RoundBorder TextField_Border=new RoundBorder(new Color(255,20,147));
Account_Field.setOpaque(false);
Pwd_Field.setOpaque(false);
Account_Field.setBorder(TextField_Border);
Pwd_Field.setBorder(TextField_Border);
Account_Field.setBounds(240, 130, 190, 30);
Pwd_Field.setBounds(240, 185, 190, 30);
Account_Field.setForeground(Color.GRAY);
Pwd_Field.setForeground(Color.GRAY);
Account_Field.setText("Input your account");
Pwd_Field.setText("Input your password");
Account_Field.setSelectedTextColor(new Color(135,206,250));
Pwd_Field.setSelectedTextColor(new Color(135,206,250));
Login_Pane.add(Account_Field);
Login_Pane.add(Pwd_Field);
JLabel Account_Label = new JLabel("Account:");
Account_Label.setFont(new Font("Myriad", Font.BOLD, 17));
Account_Label.setBounds(155, 130, 85, 25);
Login_Pane.add(Account_Label);
JLabel Pwd_Label = new JLabel("Password:");
Pwd_Label.setFont(new Font("Myriad", Font.BOLD, 17));
Pwd_Label.setBounds(155, 185, 85, 25);
Login_Pane.add(Pwd_Label);
Type_Student=new JRadioButton("Student");
Type_Manager=new JRadioButton("Manager");
Type_Student.setSelected(true); //默认选择学生
Type_Student.setFont(new Font("Myriad", Font.PLAIN, 14));
Type_Manager.setFont(new Font("Myriad", Font.PLAIN, 14));
Type_Student.setBounds(248, 240, 90, 30);
Type_Manager.setBounds(338, 240, 90, 30);
Radio_Group=new ButtonGroup();
Radio_Group.add(Type_Student);
Radio_Group.add(Type_Manager);
Login_Pane.add(Type_Student);
Login_Pane.add(Type_Manager);
Login_Btn = new JButton("Login");
Login_Btn.setFont(new Font("Myriad", Font.PLAIN, 16));
Login_Btn.setUI(new BEButtonUI().setNormalColor(BEButtonUI.NormalColor.green)); //设置按钮UI
Login_Btn.setBounds(293, 280, 68, 30);
Login_Btn.setBackground(new Color(238,130,238));
Login_Pane.add(Login_Btn);
image = new ImageIcon("src\\MyImage\\Login.jpg");
Login_Img = new JLabel(image);
Login_Img.setBounds(0, 0, image.getIconWidth(),image.getIconHeight());
Login_Pane.add(Login_Img);
Login_Pane.setOpaque(false);
Pwd_Field.addFocusListener(this);
Account_Field.addFocusListener(this);
Account_Field.addKeyListener(this);
Type_Manager.addKeyListener(this);
Type_Student.addKeyListener(this);
Pwd_Field.addKeyListener(this);
Login_Btn.addActionListener(this);
}
//有参构造函数通过用户的登录状态进行判断
public void login(LoginInfo loginInfo) throws DataBaseException,QueryResultIsNullException {
String sql = null;
if (loginInfo.getUserType().equals("Student")) {
sql = "select * from DMSystem..StuAccountPassword where StuId ='"
+ loginInfo.getId() + "' and StuPassword = '"
+ loginInfo.getPassword() + "'";
}
if (loginInfo.getUserType().equals("Manager")) {
sql = "select * from DMSystem..DMAccountPassword where DMId ='"
+ loginInfo.getId() + "' AND DMPassword ='"
+ loginInfo.getPassword() + "'";
}
Statement stmt = DB.CreateStatement();
// System.out.println(sql); //test
try {
ResultSet rs = stmt.executeQuery(sql);
if (!rs.next()) {
throw new QueryResultIsNullException();
}
} catch (SQLException e) {
e.printStackTrace();
throw new DataBaseException();
}
}
public static void main(String[] args) throws Exception {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (InstantiationException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IllegalAccessException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (UnsupportedLookAndFeelException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Login Login_Instance = new Login();
Login_Instance.setVisible(true);
UIManager.LookAndFeelInfo[] infos = UIManager.getInstalledLookAndFeels(); //获取所有的显示样式
final String plafName;
plafName = infos[1].getClassName();
UIManager.setLookAndFeel(plafName);
SwingUtilities.updateComponentTreeUI(Login_Instance);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
private boolean judge(String str1,String str2)
{
if(str1.equals("Input your account"))
{
if(str2.equals("")||str2.equals("Input your password"))
JOptionPane.showMessageDialog(sr,"请输入账号和密码" , "输入信息不完全", JOptionPane.ERROR_MESSAGE);
else
JOptionPane.showMessageDialog(sr,"请输入账号" , "输入信息不完全", JOptionPane.ERROR_MESSAGE);
return false;
}
else if(str2.equals("Input your password"))
{
if(!str1.equals("")||str1.equals("Input your account"))
JOptionPane.showMessageDialog(sr,"请输入密码" , "输入信息不完全", JOptionPane.ERROR_MESSAGE);
else
JOptionPane.showMessageDialog(sr,"请输入账号和密码" , "输入信息不完全", JOptionPane.ERROR_MESSAGE);
return false;
}
else if(str1.equals(""))
{
if(str2.equals("Input your password"))
JOptionPane.showMessageDialog(sr,"请输入账号和密码" , "输入信息不完全", JOptionPane.ERROR_MESSAGE);
else
JOptionPane.showMessageDialog(sr,"请输入账号" , "输入信息不完全", JOptionPane.ERROR_MESSAGE);
return false;
}
else if(str2.equals(""))
{
if(str1.equals("Input your account"))
JOptionPane.showMessageDialog(sr,"请输入账号和密码" , "输入信息不完全", JOptionPane.ERROR_MESSAGE);
else
JOptionPane.showMessageDialog(sr,"请输入密码" , "输入信息不完全", JOptionPane.ERROR_MESSAGE);
return false;
}
return true;
}
/**
*监听JTextField状态,设置光标以及提示语句
*/
@SuppressWarnings("deprecation")
@Override
public void focusGained(FocusEvent e)
{
// TODO Auto-generated method stub
JTextComponent obj=(JTextComponent) e.getSource();
obj.setEditable(true);
if(e.getSource().equals(Account_Field)&&Account_Field.getText().equals("Input your account")) {
Account_Field.setText("");
Account_Field.setForeground(Color.BLACK);
}
if(e.getSource().equals(Pwd_Field)&&Pwd_Field.getText().equals("Input your password")) {
Pwd_Field.setText("");
Pwd_Field.setForeground(Color.BLACK);
}
obj.setCaretColor(Color.green);
//设置光标位置为文本内容最后面
obj.setCaretPosition(obj.getText().length());
}
//设置文本框不可编辑后设置光标的可用性为false以及提示功能
@SuppressWarnings("deprecation")
@Override
public void focusLost(FocusEvent e) {
// TODO Auto-generated method stub
JTextField textfield=(JTextField) e.getSource();
textfield.setEditable(false);
textfield.getCaret().setVisible(false);
if(e.getSource().equals(Account_Field)) {
if("".equals(Account_Field.getText())) {
Account_Field.setText("Input your account");
Account_Field.setForeground(Color.GRAY);
}
}
if(e.getSource().equals(Pwd_Field)) {
if("".equals(Pwd_Field.getText())) {
Pwd_Field.setText("Input your password");
Pwd_Field.setForeground(Color.GRAY);
}
}
}
/**
*监听键盘点击事件
*/
@Override
public void keyTyped(KeyEvent e) {
// TODO Auto-generated method stub
}
@Override
public void keyPressed(KeyEvent e) {
// TODO Auto-generated method stub
//检查输入框内容
String str1=Account_Field.getText().trim();
@SuppressWarnings("deprecation")
String str2=Pwd_Field.getText().trim();
if(e.getKeyCode()==KeyEvent.VK_ENTER)
{
if(judge(str1, str2))
Login_Btn.doClick();
}
}
@Override
public void keyReleased(KeyEvent e) {
// TODO Auto-generated method stub
}
/**
*设置登录按钮的监听
*/
@SuppressWarnings("deprecation")
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
//检查账号和密码输入
String str1=Account_Field.getText().trim();
String str2=Pwd_Field.getText().trim();
if(judge(str1, str2))
{
LoginInfo loginInfo = new LoginInfo(); //创建记录登录状态的LoginInfo对象
loginInfo.setId(Account_Field.getText()); //用户名为id,学生为学号
loginInfo.setPassword(Pwd_Field.getText().trim());
if(Type_Manager.isSelected())
selected="Manager";
else
selected="Student";
loginInfo.setUserType(selected);
try {
login(loginInfo);
if (loginInfo.getUserType().equals("Student")) {
System.out.println("正在登录系统...");
new StudentUI(loginInfo.getId());
setVisible(false);
}
if (loginInfo.getUserType().equals("Manager")) {
System.out.println("正在登录系统...");
new ManagerUI(loginInfo.getId());
setVisible(false);
}
} catch (DataBaseException e1) {
JOptionPane.showMessageDialog(sr, selected+ "系统异常", "System Information", JOptionPane.WARNING_MESSAGE);
e1.printStackTrace();
} catch (QueryResultIsNullException e1) {
JOptionPane.showMessageDialog(sr, selected + "用户不存在或密码错误", "System Information", JOptionPane.WARNING_MESSAGE);
e1.printStackTrace();
}
}
}
}
| [
"2356476549@qq.com"
] | 2356476549@qq.com |
2b6a977aa856dbfe54300415c249958a2b1dc5e6 | f0b9ff7e8dee01241d15783034b7d0a8b6afad1e | /app/src/main/java/org/webrtc/MediaCodecVideoDecoder.java | b605b6009ad6521caf2954d1df475107366721e1 | [
"Apache-2.0"
] | permissive | hexstia/ScreenShareRTC-master | 36d7fa35cc02067ab480840a4f87fd9d0abf92b6 | 30ce46fb7b977dee0c163fd7a0ab00dc47e4e7c3 | refs/heads/master | 2022-06-20T00:12:45.775673 | 2020-05-14T07:38:15 | 2020-05-14T07:38:15 | 262,917,036 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 31,887 | java | //
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package org.webrtc;
import android.media.MediaCodec;
import android.media.MediaCodec.BufferInfo;
import android.media.MediaCodec.CodecException;
import android.media.MediaCodecInfo;
import android.media.MediaCodecInfo.CodecCapabilities;
import android.media.MediaCodecList;
import android.media.MediaCrypto;
import android.media.MediaFormat;
import android.os.Build.VERSION;
import android.os.SystemClock;
import android.view.Surface;
import org.webrtc.SurfaceTextureHelper.OnTextureFrameAvailableListener;
import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
public class MediaCodecVideoDecoder {
private static final String TAG = "MediaCodecVideoDecoder";
private static final long MAX_DECODE_TIME_MS = 200L;
private static final String FORMAT_KEY_STRIDE = "stride";
private static final String FORMAT_KEY_SLICE_HEIGHT = "slice-height";
private static final String FORMAT_KEY_CROP_LEFT = "crop-left";
private static final String FORMAT_KEY_CROP_RIGHT = "crop-right";
private static final String FORMAT_KEY_CROP_TOP = "crop-top";
private static final String FORMAT_KEY_CROP_BOTTOM = "crop-bottom";
private static final int DEQUEUE_INPUT_TIMEOUT = 500000;
private static final int MEDIA_CODEC_RELEASE_TIMEOUT_MS = 5000;
private static final int MAX_QUEUED_OUTPUTBUFFERS = 3;
private static MediaCodecVideoDecoder runningInstance = null;
private static MediaCodecVideoDecoder.MediaCodecVideoDecoderErrorCallback errorCallback = null;
private static int codecErrors = 0;
private static Set<String> hwDecoderDisabledTypes = new HashSet();
private Thread mediaCodecThread;
private MediaCodec mediaCodec;
private ByteBuffer[] inputBuffers;
private ByteBuffer[] outputBuffers;
private static final String VP8_MIME_TYPE = "video/x-vnd.on2.vp8";
private static final String VP9_MIME_TYPE = "video/x-vnd.on2.vp9";
private static final String H264_MIME_TYPE = "video/avc";
private static final String[] supportedVp8HwCodecPrefixes = new String[]{"OMX.qcom.", "OMX.Nvidia.", "OMX.Exynos.", "OMX.Intel."};
private static final String[] supportedVp9HwCodecPrefixes = new String[]{"OMX.qcom.", "OMX.Exynos."};
private static final String[] supportedH264HwCodecPrefixes = new String[]{"OMX.qcom.", "OMX.Intel.", "OMX.Exynos."};
private static final String supportedQcomH264HighProfileHwCodecPrefix = "OMX.qcom.";
private static final String supportedExynosH264HighProfileHwCodecPrefix = "OMX.Exynos.";
private static final int COLOR_QCOM_FORMATYVU420PackedSemiPlanar32m4ka = 2141391873;
private static final int COLOR_QCOM_FORMATYVU420PackedSemiPlanar16m4ka = 2141391874;
private static final int COLOR_QCOM_FORMATYVU420PackedSemiPlanar64x32Tile2m8ka = 2141391875;
private static final int COLOR_QCOM_FORMATYUV420PackedSemiPlanar32m = 2141391876;
private static final List<Integer> supportedColorList = Arrays.asList(19, 21, 2141391872, 2141391873, 2141391874, 2141391875, 2141391876);
private int colorFormat;
private int width;
private int height;
private int stride;
private int sliceHeight;
private boolean hasDecodedFirstFrame;
private final Queue<TimeStamps> decodeStartTimeMs = new LinkedList();
private boolean useSurface;
private MediaCodecVideoDecoder.TextureListener textureListener;
private int droppedFrames;
private Surface surface = null;
private final Queue<DecodedOutputBuffer> dequeuedSurfaceOutputBuffers = new LinkedList();
public MediaCodecVideoDecoder() {
}
public static void setErrorCallback(MediaCodecVideoDecoder.MediaCodecVideoDecoderErrorCallback errorCallback) {
Logging.d("MediaCodecVideoDecoder", "Set error callback");
errorCallback = errorCallback;
}
public static void disableVp8HwCodec() {
Logging.w("MediaCodecVideoDecoder", "VP8 decoding is disabled by application.");
hwDecoderDisabledTypes.add("video/x-vnd.on2.vp8");
}
public static void disableVp9HwCodec() {
Logging.w("MediaCodecVideoDecoder", "VP9 decoding is disabled by application.");
hwDecoderDisabledTypes.add("video/x-vnd.on2.vp9");
}
public static void disableH264HwCodec() {
Logging.w("MediaCodecVideoDecoder", "H.264 decoding is disabled by application.");
hwDecoderDisabledTypes.add("video/avc");
}
public static boolean isVp8HwSupported() {
return !hwDecoderDisabledTypes.contains("video/x-vnd.on2.vp8") && findDecoder("video/x-vnd.on2.vp8", supportedVp8HwCodecPrefixes) != null;
}
public static boolean isVp9HwSupported() {
return !hwDecoderDisabledTypes.contains("video/x-vnd.on2.vp9") && findDecoder("video/x-vnd.on2.vp9", supportedVp9HwCodecPrefixes) != null;
}
public static boolean isH264HwSupported() {
return !hwDecoderDisabledTypes.contains("video/avc") && findDecoder("video/avc", supportedH264HwCodecPrefixes) != null;
}
public static boolean isH264HighProfileHwSupported() {
if (hwDecoderDisabledTypes.contains("video/avc")) {
return false;
} else if (VERSION.SDK_INT >= 21 && findDecoder("video/avc", new String[]{"OMX.qcom."}) != null) {
return true;
} else {
return VERSION.SDK_INT >= 23 && findDecoder("video/avc", new String[]{"OMX.Exynos."}) != null;
}
}
public static void printStackTrace() {
if (runningInstance != null && runningInstance.mediaCodecThread != null) {
StackTraceElement[] mediaCodecStackTraces = runningInstance.mediaCodecThread.getStackTrace();
if (mediaCodecStackTraces.length > 0) {
Logging.d("MediaCodecVideoDecoder", "MediaCodecVideoDecoder stacks trace:");
StackTraceElement[] var1 = mediaCodecStackTraces;
int var2 = mediaCodecStackTraces.length;
for(int var3 = 0; var3 < var2; ++var3) {
StackTraceElement stackTrace = var1[var3];
Logging.d("MediaCodecVideoDecoder", stackTrace.toString());
}
}
}
}
private static MediaCodecVideoDecoder.DecoderProperties findDecoder(String mime, String[] supportedCodecPrefixes) {
if (VERSION.SDK_INT < 19) {
return null;
} else {
Logging.d("MediaCodecVideoDecoder", "Trying to find HW decoder for mime " + mime);
for(int i = 0; i < MediaCodecList.getCodecCount(); ++i) {
MediaCodecInfo info = null;
try {
info = MediaCodecList.getCodecInfoAt(i);
} catch (IllegalArgumentException var13) {
Logging.e("MediaCodecVideoDecoder", "Cannot retrieve decoder codec info", var13);
}
if (info != null && !info.isEncoder()) {
String name = null;
String[] var5 = info.getSupportedTypes();
int var6 = var5.length;
int var7;
for(var7 = 0; var7 < var6; ++var7) {
String mimeType = var5[var7];
if (mimeType.equals(mime)) {
name = info.getName();
break;
}
}
if (name != null) {
Logging.d("MediaCodecVideoDecoder", "Found candidate decoder " + name);
boolean supportedCodec = false;
String[] var16 = supportedCodecPrefixes;
var7 = supportedCodecPrefixes.length;
int supportedColorFormat;
for(supportedColorFormat = 0; supportedColorFormat < var7; ++supportedColorFormat) {
String codecPrefix = var16[supportedColorFormat];
if (name.startsWith(codecPrefix)) {
supportedCodec = true;
break;
}
}
if (supportedCodec) {
CodecCapabilities capabilities;
try {
capabilities = info.getCapabilitiesForType(mime);
} catch (IllegalArgumentException var14) {
Logging.e("MediaCodecVideoDecoder", "Cannot retrieve decoder capabilities", var14);
continue;
}
int[] var18 = capabilities.colorFormats;
supportedColorFormat = var18.length;
int colorFormat;
for(int var21 = 0; var21 < supportedColorFormat; ++var21) {
colorFormat = var18[var21];
Logging.v("MediaCodecVideoDecoder", " Color: 0x" + Integer.toHexString(colorFormat));
}
Iterator var20 = supportedColorList.iterator();
while(var20.hasNext()) {
supportedColorFormat = (Integer)var20.next();
int[] var22 = capabilities.colorFormats;
colorFormat = var22.length;
for(int var11 = 0; var11 < colorFormat; ++var11) {
int codecColorFormat = var22[var11];
if (codecColorFormat == supportedColorFormat) {
Logging.d("MediaCodecVideoDecoder", "Found target decoder " + name + ". Color: 0x" + Integer.toHexString(codecColorFormat));
return new MediaCodecVideoDecoder.DecoderProperties(name, codecColorFormat);
}
}
}
}
}
}
}
Logging.d("MediaCodecVideoDecoder", "No HW decoder found for mime " + mime);
return null;
}
}
private void checkOnMediaCodecThread() throws IllegalStateException {
if (this.mediaCodecThread.getId() != Thread.currentThread().getId()) {
throw new IllegalStateException("MediaCodecVideoDecoder previously operated on " + this.mediaCodecThread + " but is now called on " + Thread.currentThread());
}
}
private boolean initDecode(MediaCodecVideoDecoder.VideoCodecType type, int width, int height, SurfaceTextureHelper surfaceTextureHelper) {
if (this.mediaCodecThread != null) {
throw new RuntimeException("initDecode: Forgot to release()?");
} else {
String mime = null;
this.useSurface = surfaceTextureHelper != null;
String[] supportedCodecPrefixes = null;
if (type == MediaCodecVideoDecoder.VideoCodecType.VIDEO_CODEC_VP8) {
mime = "video/x-vnd.on2.vp8";
supportedCodecPrefixes = supportedVp8HwCodecPrefixes;
} else if (type == MediaCodecVideoDecoder.VideoCodecType.VIDEO_CODEC_VP9) {
mime = "video/x-vnd.on2.vp9";
supportedCodecPrefixes = supportedVp9HwCodecPrefixes;
} else {
if (type != MediaCodecVideoDecoder.VideoCodecType.VIDEO_CODEC_H264) {
throw new RuntimeException("initDecode: Non-supported codec " + type);
}
mime = "video/avc";
supportedCodecPrefixes = supportedH264HwCodecPrefixes;
}
MediaCodecVideoDecoder.DecoderProperties properties = findDecoder(mime, supportedCodecPrefixes);
if (properties == null) {
throw new RuntimeException("Cannot find HW decoder for " + type);
} else {
Logging.d("MediaCodecVideoDecoder", "Java initDecode: " + type + " : " + width + " x " + height + ". Color: 0x" + Integer.toHexString(properties.colorFormat) + ". Use Surface: " + this.useSurface);
runningInstance = this;
this.mediaCodecThread = Thread.currentThread();
try {
this.width = width;
this.height = height;
this.stride = width;
this.sliceHeight = height;
if (this.useSurface) {
this.textureListener = new MediaCodecVideoDecoder.TextureListener(surfaceTextureHelper);
this.surface = new Surface(surfaceTextureHelper.getSurfaceTexture());
}
MediaFormat format = MediaFormat.createVideoFormat(mime, width, height);
if (!this.useSurface) {
format.setInteger("color-format", properties.colorFormat);
}
Logging.d("MediaCodecVideoDecoder", " Format: " + format);
this.mediaCodec = MediaCodecVideoEncoder.createByCodecName(properties.codecName);
if (this.mediaCodec == null) {
Logging.e("MediaCodecVideoDecoder", "Can not create media decoder");
return false;
} else {
this.mediaCodec.configure(format, this.surface, (MediaCrypto)null, 0);
this.mediaCodec.start();
this.colorFormat = properties.colorFormat;
this.outputBuffers = this.mediaCodec.getOutputBuffers();
this.inputBuffers = this.mediaCodec.getInputBuffers();
this.decodeStartTimeMs.clear();
this.hasDecodedFirstFrame = false;
this.dequeuedSurfaceOutputBuffers.clear();
this.droppedFrames = 0;
Logging.d("MediaCodecVideoDecoder", "Input buffers: " + this.inputBuffers.length + ". Output buffers: " + this.outputBuffers.length);
return true;
}
} catch (IllegalStateException var9) {
Logging.e("MediaCodecVideoDecoder", "initDecode failed", var9);
return false;
}
}
}
}
private void reset(int width, int height) {
if (this.mediaCodecThread != null && this.mediaCodec != null) {
Logging.d("MediaCodecVideoDecoder", "Java reset: " + width + " x " + height);
this.mediaCodec.flush();
this.width = width;
this.height = height;
this.decodeStartTimeMs.clear();
this.dequeuedSurfaceOutputBuffers.clear();
this.hasDecodedFirstFrame = false;
this.droppedFrames = 0;
} else {
throw new RuntimeException("Incorrect reset call for non-initialized decoder.");
}
}
private void release() {
Logging.d("MediaCodecVideoDecoder", "Java releaseDecoder. Total number of dropped frames: " + this.droppedFrames);
this.checkOnMediaCodecThread();
final CountDownLatch releaseDone = new CountDownLatch(1);
Runnable runMediaCodecRelease = new Runnable() {
public void run() {
try {
Logging.d("MediaCodecVideoDecoder", "Java releaseDecoder on release thread");
MediaCodecVideoDecoder.this.mediaCodec.stop();
MediaCodecVideoDecoder.this.mediaCodec.release();
Logging.d("MediaCodecVideoDecoder", "Java releaseDecoder on release thread done");
} catch (Exception var2) {
Logging.e("MediaCodecVideoDecoder", "Media decoder release failed", var2);
}
releaseDone.countDown();
}
};
(new Thread(runMediaCodecRelease)).start();
if (!ThreadUtils.awaitUninterruptibly(releaseDone, 5000L)) {
Logging.e("MediaCodecVideoDecoder", "Media decoder release timeout");
++codecErrors;
if (errorCallback != null) {
Logging.e("MediaCodecVideoDecoder", "Invoke codec error callback. Errors: " + codecErrors);
errorCallback.onMediaCodecVideoDecoderCriticalError(codecErrors);
}
}
this.mediaCodec = null;
this.mediaCodecThread = null;
runningInstance = null;
if (this.useSurface) {
this.surface.release();
this.surface = null;
this.textureListener.release();
}
Logging.d("MediaCodecVideoDecoder", "Java releaseDecoder done");
}
private int dequeueInputBuffer() {
this.checkOnMediaCodecThread();
try {
return this.mediaCodec.dequeueInputBuffer(500000L);
} catch (IllegalStateException var2) {
Logging.e("MediaCodecVideoDecoder", "dequeueIntputBuffer failed", var2);
return -2;
}
}
private boolean queueInputBuffer(int inputBufferIndex, int size, long presentationTimeStamUs, long timeStampMs, long ntpTimeStamp) {
this.checkOnMediaCodecThread();
try {
this.inputBuffers[inputBufferIndex].position(0);
this.inputBuffers[inputBufferIndex].limit(size);
this.decodeStartTimeMs.add(new MediaCodecVideoDecoder.TimeStamps(SystemClock.elapsedRealtime(), timeStampMs, ntpTimeStamp));
this.mediaCodec.queueInputBuffer(inputBufferIndex, 0, size, presentationTimeStamUs, 0);
return true;
} catch (IllegalStateException var10) {
Logging.e("MediaCodecVideoDecoder", "decode failed", var10);
return false;
}
}
private MediaCodecVideoDecoder.DecodedOutputBuffer dequeueOutputBuffer(int dequeueTimeoutMs) {
this.checkOnMediaCodecThread();
if (this.decodeStartTimeMs.isEmpty()) {
return null;
} else {
BufferInfo info = new BufferInfo();
while(true) {
int result = this.mediaCodec.dequeueOutputBuffer(info, TimeUnit.MILLISECONDS.toMicros((long)dequeueTimeoutMs));
switch(result) {
case -3:
this.outputBuffers = this.mediaCodec.getOutputBuffers();
Logging.d("MediaCodecVideoDecoder", "Decoder output buffers changed: " + this.outputBuffers.length);
if (this.hasDecodedFirstFrame) {
throw new RuntimeException("Unexpected output buffer change event.");
}
break;
case -2:
MediaFormat format = this.mediaCodec.getOutputFormat();
Logging.d("MediaCodecVideoDecoder", "Decoder format changed: " + format.toString());
int newWidth;
int newHeight;
if (format.containsKey("crop-left") && format.containsKey("crop-right") && format.containsKey("crop-bottom") && format.containsKey("crop-top")) {
newWidth = 1 + format.getInteger("crop-right") - format.getInteger("crop-left");
newHeight = 1 + format.getInteger("crop-bottom") - format.getInteger("crop-top");
} else {
newWidth = format.getInteger("width");
newHeight = format.getInteger("height");
}
if (this.hasDecodedFirstFrame && (newWidth != this.width || newHeight != this.height)) {
throw new RuntimeException("Unexpected size change. Configured " + this.width + "*" + this.height + ". New " + newWidth + "*" + newHeight);
}
this.width = newWidth;
this.height = newHeight;
if (!this.useSurface && format.containsKey("color-format")) {
this.colorFormat = format.getInteger("color-format");
Logging.d("MediaCodecVideoDecoder", "Color: 0x" + Integer.toHexString(this.colorFormat));
if (!supportedColorList.contains(this.colorFormat)) {
throw new IllegalStateException("Non supported color format: " + this.colorFormat);
}
}
if (format.containsKey("stride")) {
this.stride = format.getInteger("stride");
}
if (format.containsKey("slice-height")) {
this.sliceHeight = format.getInteger("slice-height");
}
Logging.d("MediaCodecVideoDecoder", "Frame stride and slice height: " + this.stride + " x " + this.sliceHeight);
this.stride = Math.max(this.width, this.stride);
this.sliceHeight = Math.max(this.height, this.sliceHeight);
break;
case -1:
return null;
default:
this.hasDecodedFirstFrame = true;
MediaCodecVideoDecoder.TimeStamps timeStamps = (MediaCodecVideoDecoder.TimeStamps)this.decodeStartTimeMs.remove();
long decodeTimeMs = SystemClock.elapsedRealtime() - timeStamps.decodeStartTimeMs;
if (decodeTimeMs > 200L) {
Logging.e("MediaCodecVideoDecoder", "Very high decode time: " + decodeTimeMs + "ms. Q size: " + this.decodeStartTimeMs.size() + ". Might be caused by resuming H264 decoding after a pause.");
decodeTimeMs = 200L;
}
return new MediaCodecVideoDecoder.DecodedOutputBuffer(result, info.offset, info.size, TimeUnit.MICROSECONDS.toMillis(info.presentationTimeUs), timeStamps.timeStampMs, timeStamps.ntpTimeStampMs, decodeTimeMs, SystemClock.elapsedRealtime());
}
}
}
}
private MediaCodecVideoDecoder.DecodedTextureBuffer dequeueTextureBuffer(int dequeueTimeoutMs) {
this.checkOnMediaCodecThread();
if (!this.useSurface) {
throw new IllegalStateException("dequeueTexture() called for byte buffer decoding.");
} else {
MediaCodecVideoDecoder.DecodedOutputBuffer outputBuffer = this.dequeueOutputBuffer(dequeueTimeoutMs);
if (outputBuffer != null) {
this.dequeuedSurfaceOutputBuffers.add(outputBuffer);
}
this.MaybeRenderDecodedTextureBuffer();
MediaCodecVideoDecoder.DecodedTextureBuffer renderedBuffer = this.textureListener.dequeueTextureBuffer(dequeueTimeoutMs);
if (renderedBuffer != null) {
this.MaybeRenderDecodedTextureBuffer();
return renderedBuffer;
} else if (this.dequeuedSurfaceOutputBuffers.size() < Math.min(3, this.outputBuffers.length) && (dequeueTimeoutMs <= 0 || this.dequeuedSurfaceOutputBuffers.isEmpty())) {
return null;
} else {
++this.droppedFrames;
MediaCodecVideoDecoder.DecodedOutputBuffer droppedFrame = (MediaCodecVideoDecoder.DecodedOutputBuffer)this.dequeuedSurfaceOutputBuffers.remove();
if (dequeueTimeoutMs > 0) {
Logging.w("MediaCodecVideoDecoder", "Draining decoder. Dropping frame with TS: " + droppedFrame.presentationTimeStampMs + ". Total number of dropped frames: " + this.droppedFrames);
} else {
Logging.w("MediaCodecVideoDecoder", "Too many output buffers " + this.dequeuedSurfaceOutputBuffers.size() + ". Dropping frame with TS: " + droppedFrame.presentationTimeStampMs + ". Total number of dropped frames: " + this.droppedFrames);
}
this.mediaCodec.releaseOutputBuffer(droppedFrame.index, false);
return new MediaCodecVideoDecoder.DecodedTextureBuffer(0, (float[])null, droppedFrame.presentationTimeStampMs, droppedFrame.timeStampMs, droppedFrame.ntpTimeStampMs, droppedFrame.decodeTimeMs, SystemClock.elapsedRealtime() - droppedFrame.endDecodeTimeMs);
}
}
}
private void MaybeRenderDecodedTextureBuffer() {
if (!this.dequeuedSurfaceOutputBuffers.isEmpty() && !this.textureListener.isWaitingForTexture()) {
MediaCodecVideoDecoder.DecodedOutputBuffer buffer = (MediaCodecVideoDecoder.DecodedOutputBuffer)this.dequeuedSurfaceOutputBuffers.remove();
this.textureListener.addBufferToRender(buffer);
this.mediaCodec.releaseOutputBuffer(buffer.index, true);
}
}
private void returnDecodedOutputBuffer(int index) throws IllegalStateException, CodecException {
this.checkOnMediaCodecThread();
if (this.useSurface) {
throw new IllegalStateException("returnDecodedOutputBuffer() called for surface decoding.");
} else {
this.mediaCodec.releaseOutputBuffer(index, false);
}
}
private static class TextureListener implements OnTextureFrameAvailableListener {
private final SurfaceTextureHelper surfaceTextureHelper;
private final Object newFrameLock = new Object();
private MediaCodecVideoDecoder.DecodedOutputBuffer bufferToRender;
private MediaCodecVideoDecoder.DecodedTextureBuffer renderedBuffer;
public TextureListener(SurfaceTextureHelper surfaceTextureHelper) {
this.surfaceTextureHelper = surfaceTextureHelper;
surfaceTextureHelper.startListening(this);
}
public void addBufferToRender(MediaCodecVideoDecoder.DecodedOutputBuffer buffer) {
if (this.bufferToRender != null) {
Logging.e("MediaCodecVideoDecoder", "Unexpected addBufferToRender() called while waiting for a texture.");
throw new IllegalStateException("Waiting for a texture.");
} else {
this.bufferToRender = buffer;
}
}
public boolean isWaitingForTexture() {
Object var1 = this.newFrameLock;
synchronized(this.newFrameLock) {
return this.bufferToRender != null;
}
}
public void onTextureFrameAvailable(int oesTextureId, float[] transformMatrix, long timestampNs) {
Object var5 = this.newFrameLock;
synchronized(this.newFrameLock) {
if (this.renderedBuffer != null) {
Logging.e("MediaCodecVideoDecoder", "Unexpected onTextureFrameAvailable() called while already holding a texture.");
throw new IllegalStateException("Already holding a texture.");
} else {
this.renderedBuffer = new MediaCodecVideoDecoder.DecodedTextureBuffer(oesTextureId, transformMatrix, this.bufferToRender.presentationTimeStampMs, this.bufferToRender.timeStampMs, this.bufferToRender.ntpTimeStampMs, this.bufferToRender.decodeTimeMs, SystemClock.elapsedRealtime() - this.bufferToRender.endDecodeTimeMs);
this.bufferToRender = null;
this.newFrameLock.notifyAll();
}
}
}
public MediaCodecVideoDecoder.DecodedTextureBuffer dequeueTextureBuffer(int timeoutMs) {
Object var2 = this.newFrameLock;
synchronized(this.newFrameLock) {
if (this.renderedBuffer == null && timeoutMs > 0 && this.isWaitingForTexture()) {
try {
this.newFrameLock.wait((long)timeoutMs);
} catch (InterruptedException var5) {
Thread.currentThread().interrupt();
}
}
MediaCodecVideoDecoder.DecodedTextureBuffer returnedBuffer = this.renderedBuffer;
this.renderedBuffer = null;
return returnedBuffer;
}
}
public void release() {
this.surfaceTextureHelper.stopListening();
Object var1 = this.newFrameLock;
synchronized(this.newFrameLock) {
if (this.renderedBuffer != null) {
this.surfaceTextureHelper.returnTextureFrame();
this.renderedBuffer = null;
}
}
}
}
private static class DecodedTextureBuffer {
private final int textureID;
private final float[] transformMatrix;
private final long presentationTimeStampMs;
private final long timeStampMs;
private final long ntpTimeStampMs;
private final long decodeTimeMs;
private final long frameDelayMs;
public DecodedTextureBuffer(int textureID, float[] transformMatrix, long presentationTimeStampMs, long timeStampMs, long ntpTimeStampMs, long decodeTimeMs, long frameDelay) {
this.textureID = textureID;
this.transformMatrix = transformMatrix;
this.presentationTimeStampMs = presentationTimeStampMs;
this.timeStampMs = timeStampMs;
this.ntpTimeStampMs = ntpTimeStampMs;
this.decodeTimeMs = decodeTimeMs;
this.frameDelayMs = frameDelay;
}
}
private static class DecodedOutputBuffer {
private final int index;
private final int offset;
private final int size;
private final long presentationTimeStampMs;
private final long timeStampMs;
private final long ntpTimeStampMs;
private final long decodeTimeMs;
private final long endDecodeTimeMs;
public DecodedOutputBuffer(int index, int offset, int size, long presentationTimeStampMs, long timeStampMs, long ntpTimeStampMs, long decodeTime, long endDecodeTime) {
this.index = index;
this.offset = offset;
this.size = size;
this.presentationTimeStampMs = presentationTimeStampMs;
this.timeStampMs = timeStampMs;
this.ntpTimeStampMs = ntpTimeStampMs;
this.decodeTimeMs = decodeTime;
this.endDecodeTimeMs = endDecodeTime;
}
}
private static class TimeStamps {
private final long decodeStartTimeMs;
private final long timeStampMs;
private final long ntpTimeStampMs;
public TimeStamps(long decodeStartTimeMs, long timeStampMs, long ntpTimeStampMs) {
this.decodeStartTimeMs = decodeStartTimeMs;
this.timeStampMs = timeStampMs;
this.ntpTimeStampMs = ntpTimeStampMs;
}
}
private static class DecoderProperties {
public final String codecName;
public final int colorFormat;
public DecoderProperties(String codecName, int colorFormat) {
this.codecName = codecName;
this.colorFormat = colorFormat;
}
}
public interface MediaCodecVideoDecoderErrorCallback {
void onMediaCodecVideoDecoderCriticalError(int var1);
}
public static enum VideoCodecType {
VIDEO_CODEC_VP8,
VIDEO_CODEC_VP9,
VIDEO_CODEC_H264;
private VideoCodecType() {
}
}
}
| [
"wangyingzheng@suisasi.com"
] | wangyingzheng@suisasi.com |
6d18e12d417adcea236d9eddac27caae86a6da3e | dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9 | /data_defect4j/preprossed_method_corpus/Lang/33/org/apache/commons/lang3/ClassUtils_wrappersToPrimitives_707.java | 295058d25dafd3d24f924091514934fe83d9c14f | [] | no_license | hvdthong/NetML | dca6cf4d34c5799b400d718e0a6cd2e0b167297d | 9bb103da21327912e5a29cbf9be9ff4d058731a5 | refs/heads/master | 2021-06-30T15:03:52.618255 | 2020-10-07T01:58:48 | 2020-10-07T01:58:48 | 150,383,588 | 1 | 1 | null | 2018-09-26T07:08:45 | 2018-09-26T07:08:44 | null | UTF-8 | Java | false | false | 1,884 | java |
org apach common lang3
oper class reflect
handl invalid code code input
method document behaviour detail
notion code canon code includ human
readabl type code code
canon method variant work jvm name
code code
author apach softwar foundat
author gari gregori
author norm dean
author alban peignier
author tomasz blachowicz
version
class util classutil
convert arrai wrapper class object arrai
primit class object
method invok code wrapper primit wrappertoprimit code element
pass arrai
param class arrai convert empti
arrai primit
origin wrapper code code input
empti arrai empti arrai pass
wrapper primit wrappertoprimit class
class wrapper primit wrapperstoprimit class class
class
class length
class
class convert class convertedclass class class length
class length
convert class convertedclass wrapper primit wrappertoprimit class
convert class convertedclass
| [
"hvdthong@gmail.com"
] | hvdthong@gmail.com |
fa8f056c1a28e079fa6b15f46e2199a191d25b89 | a358288c9a69624955485218098a157b8a59ed05 | /src/ServersPackage/SortServer.java | cf467296474cd42d0b5b98dc2fcc5ab201a814d4 | [] | no_license | DawidSiuda/PWJJ-Lab5 | 2994b604ffba85e63af4b17dd9d210fe91b3ea24 | c1caf7e3365d3065fd41c7a57c5aa2d21970e37f | refs/heads/master | 2022-06-30T01:17:19.674842 | 2020-05-10T20:11:31 | 2020-05-10T20:11:31 | 261,880,416 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 816 | java | package ServersPackage;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class SortServer extends Application {
FXMLLoader loader;
Controler controler;
@Override
public void start(Stage primaryStage) throws Exception {
try {
FXMLLoader loader = new FXMLLoader(getClass().getResource("gui.fxml"));
Parent root = loader.load();
primaryStage.setTitle("QuickSortServer");
primaryStage.setScene(new Scene(root, 528, 434));
controler = (Controler)loader.getController();
primaryStage.show();
} catch(Exception e) {
e.printStackTrace();
}
}
@Override
public void stop(){
controler.end();
}
public static void main(String[] args) {
launch(args);
}
}
| [
"dsiuda235069@e-science.pl"
] | dsiuda235069@e-science.pl |
791ba18526bd8232ebc9a522a2e231660ad45715 | ab6b9c9ac08204d05b0f4dea0d82921a3dc6e20f | /app/src/main/java/com/example/wang/myapplication/adapter/LoveCommentAdapter.java | 87d051e6ba2980481671449196003875d8a598c8 | [] | no_license | 508188789/MyApplication | 433ddbd5936be146f9ff464fcccde2511dc216c5 | c2b7abfd3ec2266695b70d37c9b39a8522384356 | refs/heads/master | 2020-05-25T09:14:33.389568 | 2019-05-28T01:07:10 | 2019-05-28T01:07:10 | 187,730,699 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,965 | java | package com.example.wang.myapplication.adapter;
import android.content.Context;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.blankj.utilcode.utils.TimeUtils;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.example.wang.myapplication.R;
import com.example.wang.myapplication.modle.bean.Love;
import com.example.wang.myapplication.modle.bean.LoveComment;
import com.example.wang.myapplication.modle.bean.User;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* 表白墙评论适配器
*/
public class LoveCommentAdapter extends RecyclerView.Adapter<LoveCommentAdapter.MainCardHolder> {
public Itemclick mItemOnClickListener;
public List<LoveComment> lists = null;
private Context context;
private Love bbz;//表白发布者
public LoveCommentAdapter(List<LoveComment> lists, Context context, Love bbz) {
this.lists = lists;
this.context = context;
this.bbz = bbz;
}
public void setOnItemclicklister(Itemclick ItemOnclickListener) {
mItemOnClickListener = ItemOnclickListener;
}
public void notifyDataSetChanged(LoveComment comment) {
lists.add(comment);
super.notifyDataSetChanged();
}
@Override
public MainCardHolder onCreateViewHolder(ViewGroup parent, int viewType) {
return new MainCardHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_lovecomment, parent, false));
}
@Override
public void onBindViewHolder(MainCardHolder holder, int position) {
holder.setDate();
}
@Override
public int getItemCount() {
return (lists == null) ? 0 : lists.size();
}
public interface Itemclick {
void OnItemclick(View view, int floor);
}
public LoveComment getDate(int position) {
return lists.get(position);
}
public class MainCardHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
@BindView(R.id.image_lovecomment_headpic)
ImageView imageLovecommentHeadpic;
@BindView(R.id.tv_lovecomment_floor)
TextView tvLovecommentFloor;
@BindView(R.id.tv_lovecomment_username)
TextView tvLovecommentUsername;
@BindView(R.id.tv_lovecomment_time)
TextView tvLovecommentTime;
@BindView(R.id.tv_lovecomment_content)
TextView tvLovecommentContent;
@BindView(R.id.card_lovecomment)
CardView cardView;
MainCardHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
public void setDate() {
LoveComment date = getDate(getAdapterPosition());
tvLovecommentContent.setText(date.getContent());
tvLovecommentTime.setText(TimeUtils.getFriendlyTimeSpanByNow(date.getCreatedAt()));
int floornum = getAdapterPosition() + 1;
tvLovecommentFloor.setText(floornum + "楼");
tvLovecommentUsername.setText(getcommentr(date.getMy()));
int head;
if (date.getMy() != null && date.getMy().getSex() != null) {
head = "boy".equals(date.getMy().getSex()) ? R.drawable.head_boy : R.drawable.head_girl;
} else {
head = R.drawable.head_girl;
}
Glide.with(context)
.load(head)
.centerCrop()
.transform(new com.example.wang.myapplication.utils.GlideCircleTransform(context))
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(imageLovecommentHeadpic);
cardView.setOnClickListener(this);
}
/**
* 计算出评论者的昵称
*/
private String getcommentr(User user) {
if (user == null || user.getUsername() == null || bbz.getUser() == null) {
return "匿名用户";
}
if (bbz.getUser().getObjectId().equals(user.getObjectId())) {
return "表白者";
}
String username = user.getUsername().substring(0, 4);
StringBuffer sb = new StringBuffer();
String usernamenew = username.substring(0, 2);
if ("15".equals(usernamenew) || "16".equals(usernamenew)) {//说明不是2014级之前的学生
switch (usernamenew) {
case "17":
sb.append("大二");
if(user.getSex() == null){
sb.append("同学");
break;
}
if ("boy".equals(user.getSex())) {
sb.append("学长");
} else {
sb.append("学姐");
}
break;
case "18":
sb.append("大一");
if(user.getSex() == null){
sb.append("同学");
break;
}
if ("boy".equals(user.getSex())) {
sb.append("学弟");
} else {
sb.append("学妹");
}
break;
}
return sb.toString();
}
switch (username) {
case "2016":
sb.append("大三");
if(user.getSex() == null){
sb.append("同学");
break;
}
if ("boy".equals(user.getSex())) {
sb.append("学长");
} else {
sb.append("学姐");
}
break;
case "2015":
sb.append("大四");
if(user.getSex() == null){
sb.append("同学");
break;
}
if ("boy".equals(user.getSex())) {
sb.append("学长");
} else {
sb.append("学姐");
}
break;
default:
sb.setLength(0);
sb.append("匿名用户");
}
return sb.toString();
}
@Override
public void onClick(View v) {
if (mItemOnClickListener != null) {
mItemOnClickListener.OnItemclick(v, getAdapterPosition() + 1);
}
}
}
}
| [
"508188789@qq.com"
] | 508188789@qq.com |
f0d18ae6a9eda9e295b461cc4d55bb0ade6f4008 | 86a648ed0022a574545b98db37bd8f2c15c3d2d1 | /src/controller/action/ui/penalty/Hands.java | ac0a97717becfc148399513e9746df3d17fb1b68 | [] | no_license | yuzong/GameController2 | 249332f2760d04235ad2ffe725c205424e4b2a56 | afb2d67b4d01cbccd6739570524f43f6d86cfcda | refs/heads/master | 2020-05-07T20:20:36.415915 | 2013-04-30T10:34:05 | 2013-04-30T10:34:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,116 | java | package controller.action.ui.penalty;
import controller.EventHandler;
import controller.action.GCAction;
import controller.Log;
import controller.action.ActionBoard;
import controller.action.ActionType;
import data.AdvancedData;
import data.GameControlData;
import data.PlayerInfo;
import data.Rules;
/**
* @author: Michel Bartsch
*
* This action means that the playing with hands penalty has been selected.
*/
public class Hands extends GCAction
{
/**
* Creates a new Hands action.
* Look at the ActionBoard before using this.
*/
public Hands()
{
super(ActionType.UI);
penalty = PlayerInfo.PENALTY_SPL_PLAYING_WITH_HANDS;
}
/**
* Performs this action to manipulate the data (model).
*
* @param data The current data to work on.
*/
@Override
public void perform(AdvancedData data)
{
if(EventHandler.getInstance().lastUIEvent == this) {
EventHandler.getInstance().noLastUIEvent = true;
}
}
/**
* Performs this action`s penalty on a selected player.
*
* @param data The current data to work on.
* @param player The player to penalise.
* @param side The side the player is playing on (0:left, 1:right).
* @param number The player`s number, beginning with 0!
*/
@Override
public void performOn(AdvancedData data, PlayerInfo player, int side, int number)
{
player.penalty = penalty;
ActionBoard.clock.setPlayerPenTime(data, side, number, Rules.PENALTY_STANDARD_TIME);
Log.state(data, "Playing with Hands "+
Rules.TEAM_COLOR_NAME[data.team[side].teamColor]
+ " " + (number+1));
}
/**
* Checks if this action is legal with the given data (model).
* Illegal actions are not performed by the EventHandler.
*
* @param data The current data to check with.
*/
@Override
public boolean isLegal(AdvancedData data)
{
return (data.gameState == GameControlData.STATE_PLAYING) || data.testmode;
}
} | [
"yuzong@tzi.de"
] | yuzong@tzi.de |
9ece7a3867d0df601321ae2cd68fb430fd7682d6 | b1e6e768d724ea220cef3f8abf838c8ae2bcd79d | /archive/zms_aws_json_domain_syncer/src/main/java/com/yahoo/athenz/zms_aws_json_domain_syncer/CloudSyncer.java | 5207880fcd1d3711bb82f78002c10678db69587d | [
"Apache-2.0"
] | permissive | WindzCUHK/athenz | 78461160d18127665d812fcfbab4b5e63b11f472 | 8957f10cf837c28d67feac331ee9dd12af7002cc | refs/heads/master | 2023-08-16T18:17:33.642817 | 2023-08-07T22:28:56 | 2023-08-07T22:28:56 | 181,844,275 | 0 | 1 | Apache-2.0 | 2019-06-27T05:35:59 | 2019-04-17T07:58:04 | Java | UTF-8 | Java | false | false | 819 | java | /*
* Copyright The Athenz Authors
*
* 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.yahoo.athenz.zms_aws_json_domain_syncer;
public interface CloudSyncer {
void uploadDomain(String domainName, String domJson) throws Exception;
void deleteDomain(String domainName) throws Exception;
}
| [
"noreply@github.com"
] | noreply@github.com |
5c5f9abcb301fefc3f8cbc0701af837fd4626c0c | 5757c3a0be22b65bd76c433b93bcfd3f87fafdc5 | /src/main/java/com/hibernate/concept/hibernatetopics/HibernateTopicsApplication.java | 01e5b9c2ad3d6b998730978db353d27b8af752d4 | [] | no_license | binmaziabdullah/Hibernate-Topics | ce131ffc32fbc8bc260f620af36cbe2aec5527e0 | cce6db1efe71cdf698c235d5b6dfbc531d0ab763 | refs/heads/master | 2023-05-12T11:02:49.092935 | 2021-05-21T12:51:40 | 2021-05-21T12:51:40 | 368,525,473 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 348 | java | package com.hibernate.concept.hibernatetopics;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class HibernateTopicsApplication {
public static void main(String[] args) {
SpringApplication.run(HibernateTopicsApplication.class, args);
}
}
| [
"binmazi22@gmail.com"
] | binmazi22@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.